Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
Use style info to display "local" values in style panel (#709)
Bogdan Chadkin9020f389f555
diff --git a/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx b/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsxindex 2906acbcee..3a5c42fb36 100644--- a/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/menu/menu-control.tsx@@ -1,8 +1,8 @@import { IconButtonWithMenu } from "@webstudio-is/design-system";-import { useIsFromCurrentBreakpoint } from "../../shared/use-is-from-current-breakpoint";import type { ControlProps } from "../../style-sections";import { iconConfigs, styleConfigByName } from "../../shared/configs";import { toValue } from "@webstudio-is/css-engine";+import { getStyleSource } from "../../shared/style-info";export const MenuControl = ({property,@@ -12,7 +12,7 @@ export const MenuControl = ({}: ControlProps) => {const { label, items: defaultItems } = styleConfigByName[property];const value = currentStyle[property]?.value;- const isFromCurrentBreakpoint = useIsFromCurrentBreakpoint(property);+ const styleSource = getStyleSource(currentStyle[property]);if (value === undefined) {return null;@@ -47,7 +47,7 @@ export const MenuControl = ({label={label}items={items}value={String(currentValue)}- isActive={isFromCurrentBreakpoint}+ isActive={styleSource === "local"}onChange={setValue}onHover={(value) => setValue(value, { isEphemeral: true })}/>diff --git a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsxindex 206f2d6742..2b4f0d7a76 100644--- a/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/text/text-control.tsx@@ -7,6 +7,7 @@ import type { StyleValue } from "@webstudio-is/css-data";import { useState } from "react";import { Box, EnhancedTooltip } from "@webstudio-is/design-system";import { styleConfigByName } from "../../shared/configs";+import { getStyleSource } from "../../shared/style-info";export const TextControl = ({property,@@ -17,7 +18,8 @@ export const TextControl = ({icon,}: ControlProps & { icon?: JSX.Element }) => {const { label, items: defaultItems } = styleConfigByName[property];- const value = currentStyle[property]?.value;+ const styleInfo = currentStyle[property];+ const value = styleInfo?.value;const setValue = setProperty(property);@@ -29,6 +31,7 @@ export const TextControl = ({<EnhancedTooltip content={label}><Box><CssValueInput+ styleSource={getStyleSource(styleInfo)}icon={icon}property={property}value={value}diff --git a/apps/designer/app/designer/features/style-panel/controls/toggle/toggle-control.tsx b/apps/designer/app/designer/features/style-panel/controls/toggle/toggle-control.tsxindex 0f32a1f3f9..55063744cd 100644--- a/apps/designer/app/designer/features/style-panel/controls/toggle/toggle-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/toggle/toggle-control.tsx@@ -5,23 +5,25 @@ import {ToggleGroup,ToggleGroupItem,} from "@webstudio-is/design-system";-import type { StyleProperty } from "@webstudio-is/css-data";-import { useIsFromCurrentBreakpoint } from "../../shared/use-is-from-current-breakpoint";+import type { StyleSource } from "../../shared/style-info";export type ToggleGroupControlProps = {- property: StyleProperty | StyleProperty[];+ styleSource: StyleSource;value: string;items: { child: JSX.Element; label: string; value: string }[];onValueChange?: (value: string) => void;};export const ToggleGroupControl = ({- property,+ styleSource,value = "",items = [],onValueChange,}: ToggleGroupControlProps) => {- const isCurrentBreakpoint = useIsFromCurrentBreakpoint(property);+ let state: undefined | "set" = undefined;+ if (styleSource === "local") {+ state = "set";+ }return (<ToggleGrouptype="single"@@ -31,11 +33,7 @@ export const ToggleGroupControl = ({>{items.map(({ child, label, value }, index) => {return (- <ToggleGroupControlItem- key={index}- value={value}- state={isCurrentBreakpoint ? "set" : undefined}- >+ <ToggleGroupControlItem key={index} value={value} state={state}><Tooltip content={label} delayDuration={0}><Flex>{child}</Flex></Tooltip>diff --git a/apps/designer/app/designer/features/style-panel/sections/flex-child/flex-child.tsx b/apps/designer/app/designer/features/style-panel/sections/flex-child/flex-child.tsxindex 3b2b5cbef2..23fe21614c 100644--- a/apps/designer/app/designer/features/style-panel/sections/flex-child/flex-child.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/flex-child/flex-child.tsx@@ -18,6 +18,7 @@ import {EllipsesIcon,} from "@webstudio-is/icons";import { FloatingPanel } from "~/designer/shared/floating-panel";+import { getStyleSource } from "../../shared/style-info";export const FlexChildSection = (props: RenderCategoryProps) => {return (@@ -36,12 +37,13 @@ const FlexChildSectionAlign = (props: RenderCategoryProps) => {return (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property="alignSelf"label="Align"onReset={() => deleteProperty("alignSelf")}/><ToggleGroupControl- property="alignSelf"+ styleSource={getStyleSource(currentStyle.alignSelf)}onValueChange={(value) => setAlignSelf(value)}value={toValue(currentStyle.alignSelf?.value)}items={[@@ -88,6 +90,7 @@ const FlexChildSectionSizing = (props: RenderCategoryProps) => {return (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property={["flexGrow", "flexShrink"]}label="Sizing"onReset={() => {@@ -97,7 +100,10 @@ const FlexChildSectionSizing = (props: RenderCategoryProps) => {}}/><ToggleGroupControl- property={["flexGrow", "flexShrink"]}+ styleSource={getStyleSource(+ currentStyle.flexGrow,+ currentStyle.flexShrink+ )}onValueChange={(value) => {switch (value) {case "none": {@@ -169,6 +175,7 @@ const FlexChildSectionSizingPopover = ({><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="flexBasis"label="Basis"onReset={() => deleteProperty("flexBasis")}@@ -182,6 +189,7 @@ const FlexChildSectionSizingPopover = ({</Grid><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="flexGrow"label="Grow"onReset={() => deleteProperty("flexGrow")}@@ -195,6 +203,7 @@ const FlexChildSectionSizingPopover = ({</Grid><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="flexShrink"label="Shrink"onReset={() => deleteProperty("flexShrink")}@@ -223,12 +232,13 @@ const FlexChildSectionOrder = (props: RenderCategoryProps) => {return (<Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property="order"label="Order"onReset={() => deleteProperty("order")}/><ToggleGroupControl- property="order"+ styleSource={getStyleSource(currentStyle.order)}onValueChange={(value) => {switch (value) {case "0":@@ -276,6 +286,7 @@ const FlexChildSectionOrderPopover = (props: RenderCategoryProps) => {<Grid css={{ padding: "$spacing$9" }}><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}property="order"label="Order"onReset={() => deleteProperty("order")}diff --git a/apps/designer/app/designer/features/style-panel/sections/layout/layout.tsx b/apps/designer/app/designer/features/style-panel/sections/layout/layout.tsxindex 732f9ce470..1060500c90 100644--- a/apps/designer/app/designer/features/style-panel/sections/layout/layout.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/layout/layout.tsx@@ -159,6 +159,7 @@ export const LayoutSection = ({<><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}property="display"label={label}onReset={() => deleteProperty("display")}diff --git a/apps/designer/app/designer/features/style-panel/sections/layout/shared/flex-grid.tsx b/apps/designer/app/designer/features/style-panel/sections/layout/shared/flex-grid.tsxindex 7f97480555..47a62dc999 100644--- a/apps/designer/app/designer/features/style-panel/sections/layout/shared/flex-grid.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/layout/shared/flex-grid.tsx@@ -6,9 +6,8 @@ import {} from "@webstudio-is/design-system";import { toValue } from "@webstudio-is/css-engine";import { DotFilledIcon } from "@webstudio-is/icons";-import { useIsFromCurrentBreakpoint } from "../../../shared/use-is-from-current-breakpoint";import type { CreateBatchUpdate } from "../../../shared/use-style-data";-import type { StyleInfo } from "../../../shared/style-info";+import { getStyleSource, StyleInfo } from "../../../shared/style-info";export const FlexGrid = ({currentStyle,@@ -17,13 +16,13 @@ export const FlexGrid = ({currentStyle: StyleInfo;batchUpdate: ReturnType<CreateBatchUpdate>;}) => {- const isCurrentBreakpoint = useIsFromCurrentBreakpoint([- "flexDirection",- "justifyContent",- "justifyItems",- "alignContent",- "alignItems",- ]);+ const styleSource = getStyleSource(+ currentStyle.flexDirection,+ currentStyle.justifyContent,+ currentStyle.justifyItems,+ currentStyle.alignContent,+ currentStyle.alignItems+ );const flexDirection = toValue(currentStyle.flexDirection?.value);const justifyContent = toValue(currentStyle.justifyContent?.value);const alignItems = toValue(currentStyle.alignItems?.value);@@ -47,7 +46,7 @@ export const FlexGrid = ({gap: "$spacing$1",gridTemplateColumns: "repeat(3, 1fr)",gridTemplateRows: "repeat(3, 1fr)",- color: isCurrentBreakpoint ? "$colors$blue9" : "$colors$slate8",+ color: styleSource === "local" ? "$colors$blue9" : "$colors$slate8",}}>{Array.from(Array(gridSize * gridSize), (_, index) => {diff --git a/apps/designer/app/designer/features/style-panel/sections/spacing/input-popover.tsx b/apps/designer/app/designer/features/style-panel/sections/spacing/input-popover.tsxindex ec81b89e43..9a9f27cfd1 100644--- a/apps/designer/app/designer/features/style-panel/sections/spacing/input-popover.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/spacing/input-popover.tsx@@ -13,6 +13,7 @@ import {} from "../../shared/css-value-input";import type { StyleProperty, StyleValue } from "@webstudio-is/css-data";import type { StyleChangeHandler } from "./types";+import type { StyleSource } from "../../shared/style-info";const slideUpAndFade = keyframes({"0%": { opacity: 0, transform: "scale(0.8)" },@@ -20,11 +21,13 @@ const slideUpAndFade = keyframes({});const Input = ({+ styleSource,value,property,onChange,onClosePopover,}: {+ styleSource: StyleSource;property: StyleProperty;value: StyleValue;onChange: StyleChangeHandler;@@ -36,6 +39,7 @@ const Input = ({return (<CssValueInput+ styleSource={styleSource}property={property}value={value}intermediateValue={intermediateValue}@@ -100,12 +104,14 @@ const PopoverContentStyled = styled(PopoverContent, {});export const InputPopover = ({- value,+ styleSource,property,+ value,onChange,isOpen,onClose,}: {+ styleSource: StyleSource;property: StyleProperty;value: StyleValue;onChange: StyleChangeHandler;@@ -127,6 +133,7 @@ export const InputPopover = ({<PopoverPortal><PopoverContentStyled hideArrow sideOffset={-24}><Input+ styleSource={styleSource}value={value}property={property}onChange={onChange}diff --git a/apps/designer/app/designer/features/style-panel/sections/spacing/spacing.tsx b/apps/designer/app/designer/features/style-panel/sections/spacing/spacing.tsxindex 1596dd9a32..3a42921c92 100644--- a/apps/designer/app/designer/features/style-panel/sections/spacing/spacing.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/spacing/spacing.tsx@@ -1,5 +1,4 @@import { useState } from "react";-import { useIsFromCurrentBreakpoint } from "../../shared/use-is-from-current-breakpoint";import type { RenderCategoryProps } from "../../style-sections";import { SpacingLayout } from "./layout";import { ValueText } from "./value-text";@@ -11,6 +10,7 @@ import type {} from "./types";import { InputPopover } from "./input-popover";import { SpacingTooltip } from "./tooltip";+import { getStyleSource } from "../../shared/style-info";const Cell = ({isPopoverOpen,@@ -31,20 +31,26 @@ const Cell = ({scrubStatus: ReturnType<typeof useScrub>;currentStyle: RenderCategoryProps["currentStyle"];}) => {- const isFromCurrentBreakpoint = useIsFromCurrentBreakpoint(property);-- const styleValue = currentStyle[property]?.value;-- const finalValue = scrubStatus.isActive ? scrubStatus.value : styleValue;+ const styleInfo = currentStyle[property];+ const finalValue = scrubStatus.isActive+ ? scrubStatus.value+ : styleInfo?.value;+ const styleSource = getStyleSource(styleInfo);// for TypeScriptif (finalValue === undefined) {return null;}+ let origin: "set" | "unset" = "unset";+ if (styleSource === "local") {+ origin = "set";+ }+return (<><InputPopover+ styleSource={styleSource}value={finalValue}isOpen={isPopoverOpen}property={property}@@ -66,7 +72,7 @@ const Cell = ({}}value={finalValue}isActive={isActive}- origin={isFromCurrentBreakpoint ? "set" : "unset"}+ origin={origin}onMouseEnter={(event) =>onHover({ property, element: event.currentTarget })}diff --git a/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx b/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsxindex 48101c38b8..e5bb96b588 100644--- a/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx+++ b/apps/designer/app/designer/features/style-panel/sections/typography/typography.tsx@@ -34,6 +34,7 @@ import {} from "@webstudio-is/icons";import { ToggleGroupControl } from "../../controls/toggle/toggle-control";import { FloatingPanel } from "~/designer/shared/floating-panel";+import { getStyleSource } from "../../shared/style-info";export const TypographySection = (props: RenderCategoryProps) => {return (@@ -56,6 +57,7 @@ export const TypographySectionFont = (props: RenderCategoryProps) => {><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}label="Font"property="fontFamily"onReset={() => deleteProperty("fontFamily")}@@ -69,6 +71,7 @@ export const TypographySectionFont = (props: RenderCategoryProps) => {</Grid><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}label="Weight"property="fontWeight"onReset={() => deleteProperty("fontWeight")}@@ -82,6 +85,7 @@ export const TypographySectionFont = (props: RenderCategoryProps) => {</Grid><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}label="Color"property="color"onReset={() => deleteProperty("color")}@@ -109,6 +113,7 @@ export const TypographySectionSizing = (props: RenderCategoryProps) => {><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="fontSize"label="Size"onReset={() => deleteProperty("fontSize")}@@ -122,6 +127,7 @@ export const TypographySectionSizing = (props: RenderCategoryProps) => {</Grid><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="lineHeight"label="Height"onReset={() => deleteProperty("lineHeight")}@@ -135,6 +141,7 @@ export const TypographySectionSizing = (props: RenderCategoryProps) => {</Grid><Grid css={{ gridTemplateColumns: "auto", gap: "$spacing$3" }}><PropertyName+ style={currentStyle}property="letterSpacing"label="Spacing"onReset={() => deleteProperty("letterSpacing")}@@ -170,7 +177,7 @@ export const TypographySectionAdvanced = (props: RenderCategoryProps) => {}}><ToggleGroupControl- property="textAlign"+ styleSource={getStyleSource(currentStyle.textAlign)}onValueChange={(value) => setTextAlign(value)}value={String(getTextAlign(toValue(currentStyle.textAlign?.value)))}items={[@@ -197,7 +204,7 @@ export const TypographySectionAdvanced = (props: RenderCategoryProps) => {]}/><ToggleGroupControl- property="textDecorationLine"+ styleSource={getStyleSource(currentStyle.textDecorationLine)}onValueChange={(value) => setTextDecorationLine(value)}value={toValue(currentStyle.textDecorationLine?.value)}items={[@@ -227,7 +234,7 @@ export const TypographySectionAdvanced = (props: RenderCategoryProps) => {}}><ToggleGroupControl- property="textTransform"+ styleSource={getStyleSource(currentStyle.textTransform)}onValueChange={(value) => setTextTransform(value)}value={toValue(currentStyle.textTransform?.value)}items={[@@ -254,7 +261,7 @@ export const TypographySectionAdvanced = (props: RenderCategoryProps) => {]}/><ToggleGroupControl- property="fontStyle"+ styleSource={getStyleSource(currentStyle.fontStyle)}onValueChange={(value) => setFontStyle(value)}value={toValue(currentStyle.fontStyle?.value)}items={[@@ -290,6 +297,7 @@ export const TypographySectionAdvancedPopover = (<Grid css={{ padding: "$spacing$9", gap: "$spacing$9" }}><Grid css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}property="whiteSpace"label="White Space"onReset={() => deleteProperty("whiteSpace")}@@ -303,12 +311,13 @@ export const TypographySectionAdvancedPopover = (</Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property="direction"label="Direction"onReset={() => deleteProperty("direction")}/><ToggleGroupControl- property="direction"+ styleSource={getStyleSource(currentStyle.direction)}onValueChange={(value) => setDirection(value)}value={toValue(currentStyle.direction?.value)}items={[@@ -327,12 +336,13 @@ export const TypographySectionAdvancedPopover = (</Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property="hyphens"label="Hyphens"onReset={() => deleteProperty("hyphens")}/><ToggleGroupControl- property="hyphens"+ styleSource={getStyleSource(currentStyle.hyphens)}onValueChange={(value) => setHyphens(value)}value={toValue(currentStyle.hyphens?.value)}items={[@@ -351,12 +361,13 @@ export const TypographySectionAdvancedPopover = (</Grid><Grid css={{ gridTemplateColumns: "4fr auto" }}><PropertyName+ style={currentStyle}property="textOverflow"label="Text Overflow"onReset={() => deleteProperty("textOverflow")}/><ToggleGroupControl- property="textOverflow"+ styleSource={getStyleSource(currentStyle.textOverflow)}onValueChange={(value) => setTextOverflow(value)}value={toValue(currentStyle.textOverflow?.value)}items={[diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsxindex fda54d9b02..1ab933ccbf 100644--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.stories.tsx@@ -21,6 +21,7 @@ export const WithKeywords = () => {return (<CssValueInput+ styleSource="preset"property="width"value={value}intermediateValue={intermediateValue}@@ -61,6 +62,7 @@ export const WithIcons = () => {return (<CssValueInput+ styleSource="preset"property="alignItems"value={value}intermediateValue={intermediateValue}@@ -106,6 +108,7 @@ export const WithUnits = () => {return (<Flex css={{ gap: "$spacing$9" }}><CssValueInput+ styleSource="preset"property="rowGap"value={value}intermediateValue={intermediateValue}diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsxindex 6743754c25..6b94de3739 100644--- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx@@ -26,12 +26,12 @@ import {useEffect,useRef,} from "react";-import { useIsFromCurrentBreakpoint } from "../use-is-from-current-breakpoint";import { useUnitSelect } from "./unit-select";import { unstable_batchedUpdates as unstableBatchedUpdates } from "react-dom";import { parseIntermediateOrInvalidValue } from "./parse-intermediate-or-invalid-value";import { toValue } from "@webstudio-is/css-engine";import { useDebouncedCallback } from "use-debounce";+import type { StyleSource } from "../style-info";// We increment by 10 when shift is pressed, by 0.1 when alt/option is pressed and by 1 by default.const calcNumberChange = (@@ -206,6 +206,7 @@ type ChangeReason =| "scrub-end";type CssValueInputProps = {+ styleSource: StyleSource;property: StyleProperty;value: StyleValue | undefined;intermediateValue: CssValueInputValue | undefined;@@ -260,6 +261,7 @@ const initialValue: IntermediateStyleValue = {*/export const CssValueInput = ({icon,+ styleSource,property,keywords = [],onHighlight,@@ -412,10 +414,13 @@ export const CssValueInput = ({onKeyDown: inputProps.onKeyDown,});- const isCurrentBreakpoint = useIsFromCurrentBreakpoint(property);+ let state = undefined;+ if (styleSource === "local") {+ state = "set" as const;+ }const prefix = icon && (<CssValueInputIconButton- state={isCurrentBreakpoint ? "set" : undefined}+ state={state}css={value.type === "unit" ? { cursor: "ew-resize" } : undefined}>{icon}diff --git a/apps/designer/app/designer/features/style-panel/shared/property-name.tsx b/apps/designer/app/designer/features/style-panel/shared/property-name.tsxindex ee440c8817..eca12e07f2 100644--- a/apps/designer/app/designer/features/style-panel/shared/property-name.tsx+++ b/apps/designer/app/designer/features/style-panel/shared/property-name.tsx@@ -14,27 +14,36 @@ import {Separator,} from "@webstudio-is/design-system";import { UndoIcon } from "@webstudio-is/icons";-import { useIsFromCurrentBreakpoint } from "./use-is-from-current-breakpoint";import { isFeatureEnabled } from "~/shared/feature-flags";+import { getStyleSource, StyleInfo } from "./style-info";-type PropertyProps = {+type PropertyNameProps = {+ style: StyleInfo;property: StyleProperty | StyleProperty[];label: string;onReset: () => void;};-export const PropertyName = ({ property, label, onReset }: PropertyProps) => {- const isCurrentBreakpoint = useIsFromCurrentBreakpoint(property);+export const PropertyName = ({+ style: currentStyle,+ property,+ label,+ onReset,+}: PropertyNameProps) => {+ const properties = Array.isArray(property) ? property : [property];+ const styleSource = getStyleSource(+ ...properties.map((property) => currentStyle[property])+ );const [isOpen, setIsOpen] = useState(false);const isPopoverEnabled =- isFeatureEnabled("propertyReset") && isCurrentBreakpoint;+ isFeatureEnabled("propertyReset") && styleSource === "local";const labelElement = (<Labelcss={{fontWeight: "inherit",padding: "calc($spacing$3 / 2) $spacing$3",- ...(isCurrentBreakpoint+ ...(styleSource === "local"? {color: "$blue11",backgroundColor: "$colors$blue4",diff --git a/apps/designer/app/designer/features/style-panel/shared/style-info.ts b/apps/designer/app/designer/features/style-panel/shared/style-info.tsindex 8d0d2f7325..f794b210ec 100644--- a/apps/designer/app/designer/features/style-panel/shared/style-info.ts+++ b/apps/designer/app/designer/features/style-panel/shared/style-info.ts@@ -10,6 +10,19 @@ export type StyleInfo = {[property in StyleProperty]?: StyleValueInfo;};+export type StyleSource = "local" | "preset";++export const getStyleSource = (+ ...styleValueInfos: (undefined | StyleValueInfo)[]+): StyleSource => {+ for (const info of styleValueInfos) {+ if (info?.local) {+ return "local";+ }+ }+ return "preset";+};+export const useStyleInfo = ({localStyle,browserStyle,diff --git a/apps/designer/app/designer/features/style-panel/shared/use-is-from-current-breakpoint.ts b/apps/designer/app/designer/features/style-panel/shared/use-is-from-current-breakpoint.tsdeleted file mode 100644index 4f326e6224..0000000000--- a/apps/designer/app/designer/features/style-panel/shared/use-is-from-current-breakpoint.ts+++ /dev/null@@ -1,32 +0,0 @@-import { useMemo } from "react";-import type { StyleProperty } from "@webstudio-is/css-data";-import {- useSelectedBreakpoint,- useSelectedInstanceData,-} from "~/designer/shared/nano-states";-import { getCssRuleForBreakpoint } from "./get-css-rule-for-breakpoint";--/**- * Identify if the provided property is defined in the instance css rule matching the selected breakpoint.- */-export const useIsFromCurrentBreakpoint = (- property: StyleProperty | StyleProperty[]-) => {- const [selectedBreakpoint] = useSelectedBreakpoint();- const [selectedInstanceData] = useSelectedInstanceData();- const cssRule = useMemo(- () =>- getCssRuleForBreakpoint(- selectedInstanceData?.cssRules,- selectedBreakpoint- ),- [selectedInstanceData, selectedBreakpoint]- );- if (cssRule === undefined) {- return false;- }- if (Array.isArray(property)) {- return property.some((property) => property in cssRule.style);- }- return property in cssRule.style;-};diff --git a/apps/designer/app/designer/features/style-panel/style-sections.tsx b/apps/designer/app/designer/features/style-panel/style-sections.tsxindex b13d13591c..909f799735 100644--- a/apps/designer/app/designer/features/style-panel/style-sections.tsx+++ b/apps/designer/app/designer/features/style-panel/style-sections.tsx@@ -67,6 +67,7 @@ export const renderProperty = ({return (<Grid key={category + property} css={{ gridTemplateColumns: "4fr 6fr" }}><PropertyName+ style={currentStyle}property={property}label={label}onReset={() => deleteProperty(property)}