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
Store style states in db (#1384)
Bogdan Chadkinba9738d33221
diff --git a/apps/builder/app/builder/features/style-panel/shared/style-info.ts b/apps/builder/app/builder/features/style-panel/shared/style-info.tsindex 02f1476418..4aa6ce737b 100644--- a/apps/builder/app/builder/features/style-panel/shared/style-info.ts+++ b/apps/builder/app/builder/features/style-panel/shared/style-info.ts@@ -10,13 +10,14 @@ import type {StyleSource as StyleSourceType,} from "@webstudio-is/project-build";import {+ type StyleSourceSelector,instancesStore,selectedInstanceBrowserStyleStore,selectedInstanceSelectorStore,selectedInstanceIntanceToTagStore,- selectedStyleSourceStore,stylesIndexStore,useBreakpoints,+ selectedOrLastStyleSourceSelectorStore,} from "~/shared/nano-states";import { selectedBreakpointStore } from "~/shared/nano-states/breakpoints";import type { InstanceSelector } from "~/shared/tree-utils";@@ -102,15 +103,20 @@ for (const [property, value] of Object.entries(properties)) {const getSelectedStyle = (stylesByStyleSourceId: Map<StyleSourceType["id"], StyleDecl[]>,breakpointId: string,- styleSourceId: string+ styleSourceSelector: StyleSourceSelector) => {const style: Style = {};- const instanceStyles = stylesByStyleSourceId.get(styleSourceId);+ const instanceStyles = stylesByStyleSourceId.get(+ styleSourceSelector.styleSourceId+ );if (instanceStyles === undefined) {return style;}for (const styleDecl of instanceStyles) {- if (styleDecl.breakpointId === breakpointId) {+ if (+ styleDecl.breakpointId === breakpointId &&+ styleDecl.state === styleSourceSelector.state+ ) {style[styleDecl.property] = styleDecl.value;}}@@ -151,7 +157,10 @@ export const getCascadedInfo = (}for (const breakpointId of cascadedBreakpointIds) {for (const styleDecl of instanceStyles) {- if (styleDecl.breakpointId === breakpointId) {+ if (+ styleDecl.breakpointId === breakpointId &&+ styleDecl.state === undefined+ ) {cascadedStyle[styleDecl.property] = {breakpointId,value: styleDecl.value,@@ -252,8 +261,9 @@ export const useStyleInfo = () => {const selectedBreakpoint = useStore(selectedBreakpointStore);const selectedBreakpointId = selectedBreakpoint?.id;const selectedInstanceSelector = useStore(selectedInstanceSelectorStore);- const selectedStyleSource = useStore(selectedStyleSourceStore);- const selectedStyleSourceId = selectedStyleSource?.id;+ const selectedOrLastStyleSourceSelector = useStore(+ selectedOrLastStyleSourceSelectorStore+ );const browserStyle = useStore(selectedInstanceBrowserStyleStore);const selectedInstanceIntanceToTag = useStore(selectedInstanceIntanceToTagStore@@ -266,16 +276,20 @@ export const useStyleInfo = () => {const selectedStyle = useMemo(() => {if (selectedBreakpointId === undefined ||- selectedStyleSourceId === undefined+ selectedOrLastStyleSourceSelector === undefined) {return {};}return getSelectedStyle(stylesByStyleSourceId,selectedBreakpointId,- selectedStyleSourceId+ selectedOrLastStyleSourceSelector);- }, [stylesByStyleSourceId, selectedBreakpointId, selectedStyleSourceId]);+ }, [+ stylesByStyleSourceId,+ selectedBreakpointId,+ selectedOrLastStyleSourceSelector,+ ]);const cascadedBreakpointIds = useMemo(() => getCascadedBreakpointIds(breakpoints, selectedBreakpointId),diff --git a/apps/builder/app/builder/features/style-panel/shared/use-style-data.ts b/apps/builder/app/builder/features/style-panel/shared/use-style-data.tsindex 0274268282..dff08c349f 100644--- a/apps/builder/app/builder/features/style-panel/shared/use-style-data.ts+++ b/apps/builder/app/builder/features/style-panel/shared/use-style-data.ts@@ -10,6 +10,7 @@ import {import type { StyleProperty, StyleValue } from "@webstudio-is/css-data";import type { Publish } from "~/shared/pubsub";import {+ selectedOrLastStyleSourceSelectorStore,selectedStyleSourceStore,styleSourceSelectionsStore,styleSourcesStore,@@ -80,11 +81,13 @@ export const useStyleData = ({ selectedInstance, publish }: UseStyleData) => {const publishUpdates = useCallback((type: "update" | "preview", updates: StyleUpdates["updates"]) => {const selectedStyleSource = selectedStyleSourceStore.get();+ const styleSourceSelector = selectedOrLastStyleSourceSelectorStore.get();if (updates.length === 0 ||selectedBreakpoint === undefined ||- selectedStyleSource === undefined+ selectedStyleSource === undefined ||+ styleSourceSelector === undefined) {return;}@@ -106,7 +109,6 @@ export const useStyleData = ({ selectedInstance, publish }: UseStyleData) => {(styleSourceSelections, styleSources, styles) => {const instanceId = selectedInstance.id;const breakpointId = selectedBreakpoint.id;- const styleSourceId = selectedStyleSource.id;// set only selected style source and update selection with it// generated local style source will not be written if not selectedstyleSources.set(selectedStyleSource.id, selectedStyleSource);@@ -114,16 +116,17 @@ export const useStyleData = ({ selectedInstance, publish }: UseStyleData) => {styleSourceSelections.get(instanceId)?.values ?? [];styleSourceSelections.set(instanceId, {instanceId,- values: selectionValues.includes(styleSourceId)+ values: selectionValues.includes(styleSourceSelector.styleSourceId)? selectionValues- : [...selectionValues, styleSourceId],+ : [...selectionValues, styleSourceSelector.styleSourceId],});for (const update of updates) {if (update.operation === "set") {const styleDecl = {breakpointId,- styleSourceId,+ styleSourceId: styleSourceSelector.styleSourceId,+ state: styleSourceSelector.state,property: update.property,value: update.value,};@@ -133,7 +136,8 @@ export const useStyleData = ({ selectedInstance, publish }: UseStyleData) => {if (update.operation === "delete") {const styleDeclKey = getStyleDeclKey({breakpointId,- styleSourceId,+ styleSourceId: styleSourceSelector.styleSourceId,+ state: styleSourceSelector.state,property: update.property,});styles.delete(styleDeclKey);diff --git a/apps/builder/app/builder/features/style-panel/style-source-section.tsx b/apps/builder/app/builder/features/style-panel/style-source-section.tsxindex 0496ac2ebf..fb0d8cfd3c 100644--- a/apps/builder/app/builder/features/style-panel/style-source-section.tsx+++ b/apps/builder/app/builder/features/style-panel/style-source-section.tsx@@ -13,7 +13,9 @@ import { useStore } from "@nanostores/react";import {availableStyleSourcesStore,selectedInstanceSelectorStore,+ selectedInstanceStatesByStyleSourceIdStore,selectedInstanceStyleSourcesStore,+ selectedOrLastStyleSourceSelectorStore,selectedStyleSourceSelectorStore,styleSourceSelectionsStore,styleSourcesStore,@@ -244,22 +246,19 @@ type StyleSourceInputItem = {label: string;disabled: boolean;source: ItemSource;+ states: string[];};-const convertToInputItem = (styleSource: StyleSource): StyleSourceInputItem => {- if (styleSource.type === "local") {- return {- id: styleSource.id,- label: "Local",- disabled: false,- source: styleSource.type,- };- }+const convertToInputItem = (+ styleSource: StyleSource,+ states: string[]+): StyleSourceInputItem => {return {id: styleSource.id,- label: styleSource.name,+ label: styleSource.type === "local" ? "Local" : styleSource.name,disabled: false,source: styleSource.type,+ states,};};@@ -269,13 +268,19 @@ export const StyleSourcesSection = () => {selectedInstanceStyleSourcesStore);const items = availableStyleSources.map((styleSource) =>- convertToInputItem(styleSource)+ convertToInputItem(styleSource, [])+ );+ const selectedInstanceStatesByStyleSourceId = useStore(+ selectedInstanceStatesByStyleSourceIdStore);const value = selectedInstanceStyleSources.map((styleSource) =>- convertToInputItem(styleSource)+ convertToInputItem(+ styleSource,+ selectedInstanceStatesByStyleSourceId.get(styleSource.id) ?? []+ ));- const selectedStyleSourceSelector = useStore(- selectedStyleSourceSelectorStore+ const selectedOrLastStyleSourceSelector = useStore(+ selectedOrLastStyleSourceSelectorStore);const [editingItemId, setEditingItemId] = useState<@@ -291,7 +296,7 @@ export const StyleSourcesSection = () => {<StyleSourceInputitems={items}value={value}- selectedItemSelector={selectedStyleSourceSelector}+ selectedItemSelector={selectedOrLastStyleSourceSelector}onCreateItem={createStyleSource}onSelectAutocompleteItem={({ id }) => {addStyleSourceToInstace(id);diff --git a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.stories.tsx b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.stories.tsxindex f58ccf2298..56d6d856f6 100644--- a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.stories.tsx+++ b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.stories.tsx@@ -12,6 +12,7 @@ type Item = {label: string;source: ItemSource;disabled: boolean;+ states: string[];};const localItem: Item = {@@ -19,6 +20,7 @@ const localItem: Item = {label: "Local",source: "local",disabled: false,+ states: [],};const getItems = (): Array<Item> => [@@ -27,12 +29,14 @@ const getItems = (): Array<Item> => [label: "Token",source: "token",disabled: false,+ states: [],},{id: nanoid(),label: "Tag",source: "tag",disabled: false,+ states: [],},];@@ -46,6 +50,7 @@ const createItem = (label,source: "token",disabled: false,+ states: [],};setValue([...value, item]);};@@ -90,6 +95,7 @@ export const WithTruncatedItem: ComponentStory<"Local Something Something Something Something Something Something Something Something Something Something Something",source: "local",disabled: false,+ states: [],},]);return (@@ -121,6 +127,7 @@ export const Complete: ComponentStory<typeof StyleSourceInput> = () => {label: "Disabled",source: "token",disabled: true,+ states: [],},]);const [selectedItemSelector, setSelectedItemSelector] = useState<diff --git a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsxindex 38ba7051a7..b16fcae4db 100644--- a/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx+++ b/apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx@@ -29,6 +29,8 @@ import {DropdownMenuItem,DropdownMenuLabel,DropdownMenuSeparator,+ rawTheme,+ theme,} from "@webstudio-is/design-system";import {forwardRef,@@ -40,10 +42,9 @@ import {import { mergeRefs } from "@react-aria/utils";import { type ItemSource, menuCssVars, StyleSource } from "./style-source";import { useSortable } from "./use-sortable";-import { theme } from "@webstudio-is/design-system";import { matchSorter } from "match-sorter";import { StyleSourceBadge } from "./style-source-badge";-import { CheckMarkIcon } from "@webstudio-is/icons";+import { CheckMarkIcon, DotIcon } from "@webstudio-is/icons";import { isFeatureEnabled } from "@webstudio-is/feature-flags";import { humanizeString } from "~/shared/string-utils";@@ -53,6 +54,7 @@ type IntermediateItem = {disabled: boolean;source: ItemSource;isAdded?: boolean;+ states: string[];};export type ItemSelector = {@@ -219,6 +221,7 @@ const matchOrSuggestToCreate = (disabled: false,source: "token",isAdded: false,+ states: [],});}// skip already added values@@ -246,9 +249,7 @@ const userActionStates = [const renderMenuItems = (props: {selectedItemSelector: undefined | ItemSelector;- itemId: IntermediateItem["id"];- source: ItemSource;- disabled: boolean;+ item: IntermediateItem;onSelect?: (itemSelector: undefined | ItemSelector) => void;onEdit?: (itemId: IntermediateItem["id"]) => void;onDuplicate?: (itemId: IntermediateItem["id"]) => void;@@ -259,18 +260,20 @@ const renderMenuItems = (props: {onDelete?: (itemId: IntermediateItem["id"]) => void;}) => (<>- {props.source !== "local" && (- <DropdownMenuItem onSelect={() => props.onEdit?.(props.itemId)}>+ {props.item.source !== "local" && (+ <DropdownMenuItem onSelect={() => props.onEdit?.(props.item.id)}>Edit Name</DropdownMenuItem>)}- {props.source !== "local" && (- <DropdownMenuItem onSelect={() => props.onDuplicate?.(props.itemId)}>+ {props.item.source !== "local" && (+ <DropdownMenuItem onSelect={() => props.onDuplicate?.(props.item.id)}>Duplicate</DropdownMenuItem>)}- {props.source === "local" && (- <DropdownMenuItem onSelect={() => props.onConvertToToken?.(props.itemId)}>+ {props.item.source === "local" && (+ <DropdownMenuItem+ onSelect={() => props.onConvertToToken?.(props.item.id)}+ >Convert to token</DropdownMenuItem>)}@@ -285,15 +288,15 @@ const renderMenuItems = (props: {</DropdownMenuItem>)}*/}- {props.source !== "local" && (- <DropdownMenuItem onSelect={() => props.onRemove?.(props.itemId)}>+ {props.item.source !== "local" && (+ <DropdownMenuItem onSelect={() => props.onRemove?.(props.item.id)}>Remove</DropdownMenuItem>)}- {props.source !== "local" && (+ {props.item.source !== "local" && (<DropdownMenuItemdestructive={true}- onSelect={() => props.onDelete?.(props.itemId)}+ onSelect={() => props.onDelete?.(props.item.id)}>Delete</DropdownMenuItem>@@ -307,11 +310,21 @@ const renderMenuItems = (props: {key={state}withIndicator={true}icon={- props.itemId === props.selectedItemSelector?.styleSourceId &&- state === props.selectedItemSelector.state && <CheckMarkIcon />+ props.item.id === props.selectedItemSelector?.styleSourceId &&+ state === props.selectedItemSelector.state ? (+ <CheckMarkIcon+ color={+ props.item.states.includes(state)+ ? rawTheme.colors.foregroundPrimary+ : rawTheme.colors.foregroundIconMain+ }+ />+ ) : props.item.states.includes(state) ? (+ <DotIcon color={rawTheme.colors.foregroundPrimary} />+ ) : null}onSelect={() =>- props.onSelect?.({ styleSourceId: props.itemId, state })+ props.onSelect?.({ styleSourceId: props.item.id, state })}>{humanizeString(state)}@@ -342,6 +355,7 @@ export const StyleSourceInput = (disabled: false,id: "",source: "local",+ states: [],},selectedItem: undefined,match: matchOrSuggestToCreate,@@ -387,9 +401,7 @@ export const StyleSourceInput = (renderStyleSourceMenuItems={(item) =>renderMenuItems({selectedItemSelector: props.selectedItemSelector,- itemId: item.id,- source: item.source,- disabled: item.disabled,+ item,onSelect: props.onSelectItem,onDuplicate: props.onDuplicateItem,onConvertToToken: props.onConvertToToken,diff --git a/apps/builder/app/shared/nano-states/nano-states.ts b/apps/builder/app/shared/nano-states/nano-states.tsindex 72f008f23e..28b8704582 100644--- a/apps/builder/app/shared/nano-states/nano-states.ts+++ b/apps/builder/app/shared/nano-states/nano-states.ts@@ -225,7 +225,7 @@ export const useSetStyleSourceSelections = (});};-type StyleSourceSelector = {+export type StyleSourceSelector = {styleSourceId: StyleSource["id"];state?: string;};@@ -317,6 +317,36 @@ export const selectedInstanceIntanceToTagStore = atom<undefined | Map<Instance["id"], HtmlTags>>();+export const selectedInstanceStatesByStyleSourceIdStore = computed(+ [stylesStore, styleSourceSelectionsStore, selectedInstanceSelectorStore],+ (styles, styleSourceSelections, selectedInstanceSelector) => {+ const statesByStyleSourceId = new Map<StyleSource["id"], string[]>();+ if (selectedInstanceSelector === undefined) {+ return statesByStyleSourceId;+ }+ const styleSourceIds = new Set(+ styleSourceSelections.get(selectedInstanceSelector[0])?.values+ );+ for (const styleDecl of styles.values()) {+ if (+ styleDecl.state === undefined ||+ styleSourceIds.has(styleDecl.styleSourceId) === false+ ) {+ continue;+ }+ let states = statesByStyleSourceId.get(styleDecl.styleSourceId);+ if (states === undefined) {+ states = [];+ statesByStyleSourceId.set(styleDecl.styleSourceId, states);+ }+ if (states.includes(styleDecl.state) === false) {+ states.push(styleDecl.state);+ }+ }+ return statesByStyleSourceId;+ }+);+export const selectedInstanceStyleSourcesStore = computed([styleSourceSelectionsStore,@@ -353,6 +383,20 @@ export const selectedInstanceStyleSourcesStore = computed(});+export const selectedOrLastStyleSourceSelectorStore = computed(+ [selectedInstanceStyleSourcesStore, selectedStyleSourceSelectorStore],+ (styleSources, selectedStyleSourceSelector) => {+ if (selectedStyleSourceSelector !== undefined) {+ return selectedStyleSourceSelector;+ }+ const lastStyleSource = styleSources.at(-1);+ if (lastStyleSource !== undefined) {+ return { styleSourceId: lastStyleSource.id };+ }+ return;+ }+);+/*** Provide selected style source with fallback* to the last style source of selected instancediff --git a/apps/builder/app/shared/tree-utils.test.ts b/apps/builder/app/shared/tree-utils.test.tsindex 0cc26a9d13..809e02e6df 100644--- a/apps/builder/app/shared/tree-utils.test.ts+++ b/apps/builder/app/shared/tree-utils.test.ts@@ -10,6 +10,7 @@ import type {StyleSource,StyleSourceSelection,} from "@webstudio-is/project-build";+import { getStyleDeclKey } from "@webstudio-is/project-build";import {type InstanceSelector,cloneStyles,@@ -117,10 +118,16 @@ const createStyleDecl = (const createStyleDeclPair = (styleSourceId: string,breakpointId: string,+ state?: string,value?: string) => {return [- `${styleSourceId}:${breakpointId}:width`,+ getStyleDeclKey({+ styleSourceId,+ breakpointId,+ state,+ property: "width",+ }),createStyleDecl(styleSourceId, breakpointId, value),] as const;};@@ -780,12 +787,12 @@ test("insert styles copy and apply new style source ids", () => {test("clone styles with appled new style source ids", () => {const styles: Styles = new Map([- [`styleSource1:bp1:width`, createStyleDecl("styleSource1", "bp1")],- [`styleSource2:bp2:width`, createStyleDecl("styleSource2", "bp2")],- [`styleSource1:bp3:width`, createStyleDecl("styleSource1", "bp3")],- [`styleSource3:bp4:width`, createStyleDecl("styleSource3", "bp4")],- [`styleSource1:bp5:width`, createStyleDecl("styleSource1", "bp5")],- [`styleSource3:bp6:width`, createStyleDecl("styleSource3", "bp6")],+ createStyleDeclPair("styleSource1", "bp1"),+ createStyleDeclPair("styleSource2", "bp2"),+ createStyleDeclPair("styleSource1", "bp3"),+ createStyleDeclPair("styleSource3", "bp4"),+ createStyleDeclPair("styleSource1", "bp5"),+ createStyleDeclPair("styleSource3", "bp6"),]);const clonedStyleSourceIds = new Map<StyleSource["id"], StyleSource["id"]>();clonedStyleSourceIds.set("styleSource2", "newStyleSource2");diff --git a/packages/project-build/src/db/styles.ts b/packages/project-build/src/db/styles.tsindex 3f33c7764a..3c629c38a7 100644--- a/packages/project-build/src/db/styles.ts+++ b/packages/project-build/src/db/styles.ts@@ -133,6 +133,7 @@ export const parseStyles = async (const styleDecl = {styleSourceId: storedStyleDecl.styleSourceId,breakpointId: storedStyleDecl.breakpointId,+ state: storedStyleDecl.state,property: storedStyleDecl.property,value: parseValue(storedStyleDecl.value, assetsMap),};@@ -189,6 +190,7 @@ export const serializeStyles = (styles: Styles) => {return {breakpointId: styleDecl.breakpointId,styleSourceId: styleDecl.styleSourceId,+ state: styleDecl.state,property: styleDecl.property,value: serializeValue(styleDecl.value),};diff --git a/packages/project-build/src/schema/styles.ts b/packages/project-build/src/schema/styles.tsindex 6226abeff6..3e55ccdb40 100644--- a/packages/project-build/src/schema/styles.ts+++ b/packages/project-build/src/schema/styles.ts@@ -36,6 +36,7 @@ const StoredLayersValue = z.object({export const StoredStyleDecl = z.object({styleSourceId: z.string(),breakpointId: z.string(),+ state: z.optional(z.string()),// @todo can't figure out how to make property to be enumproperty: z.string() as z.ZodType<StyleProperty>,value: z.union([StoredImageValue, StoredLayersValue, SharedStyleValue]),@@ -50,6 +51,7 @@ export type StoredStyles = z.infer<typeof StoredStyles>;export const StyleDecl = z.object({styleSourceId: z.string(),breakpointId: z.string(),+ state: z.optional(z.string()),// @todo can't figure out how to make property to be enumproperty: z.string() as z.ZodType<StyleProperty>,value: z.union([ImageValue, LayersValue, SharedStyleValue]),@@ -62,7 +64,9 @@ export type StyleDeclKey = string;export const getStyleDeclKey = (styleDecl: Omit<StyleDecl, "value">): StyleDeclKey => {- return `${styleDecl.styleSourceId}:${styleDecl.breakpointId}:${styleDecl.property}`;+ return `${styleDecl.styleSourceId}:${styleDecl.breakpointId}:${+ styleDecl.property+ }:${styleDecl.state ?? ""}`;};export const Styles = z.map(z.string() as z.ZodType<StyleDeclKey>, StyleDecl);diff --git a/packages/react-sdk/src/css/style-rules.test.ts b/packages/react-sdk/src/css/style-rules.test.tsindex a7d0966e80..47e5ec116f 100644--- a/packages/react-sdk/src/css/style-rules.test.ts+++ b/packages/react-sdk/src/css/style-rules.test.ts@@ -1,75 +1,60 @@import { test, expect } from "@jest/globals";-import type {+import {+ getStyleDeclKey,+ StyleDecl,Styles,StyleSourceSelections,} from "@webstudio-is/project-build";import { getStyleRules } from "./style-rules";+const createStyleDeclPair = (styleDecl: StyleDecl) => {+ return [getStyleDeclKey(styleDecl), styleDecl] as const;+};+test("compute styles from different style sources", () => {const styles: Styles = new Map([- [- "styleSource1:a:width",- {- breakpointId: "a",- styleSourceId: "styleSource1",- property: "width",- value: { type: "unit", value: 10, unit: "px" },- },- ],- [- "styleSource2:a:display",- {- breakpointId: "a",- styleSourceId: "styleSource2",- property: "display",- value: { type: "keyword", value: "block" },- },- ],- [- "styleSource4:a:color",- {- breakpointId: "a",- styleSourceId: "styleSource4",- property: "color",- value: { type: "keyword", value: "green" },- },- ],- [- "styleSource4:a:width",- {- breakpointId: "a",- styleSourceId: "styleSource4",- property: "width",- value: { type: "keyword", value: "min-content" },- },- ],- [- "styleSource3:a:color",- {- breakpointId: "a",- styleSourceId: "styleSource3",- property: "color",- value: { type: "keyword", value: "red" },- },- ],- [- "styleSource5:b:color",- {- breakpointId: "b",- styleSourceId: "styleSource5",- property: "color",- value: { type: "keyword", value: "orange" },- },- ],- [- "styleSource6:a:color",- {- breakpointId: "a",- styleSourceId: "styleSource6",- property: "color",- value: { type: "keyword", value: "blue" },- },- ],+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource1",+ property: "width",+ value: { type: "unit", value: 10, unit: "px" },+ }),+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource2",+ property: "display",+ value: { type: "keyword", value: "block" },+ }),+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource4",+ property: "color",+ value: { type: "keyword", value: "green" },+ }),+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource4",+ property: "width",+ value: { type: "keyword", value: "min-content" },+ }),+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource3",+ property: "color",+ value: { type: "keyword", value: "red" },+ }),+ createStyleDeclPair({+ breakpointId: "b",+ styleSourceId: "styleSource5",+ property: "color",+ value: { type: "keyword", value: "orange" },+ }),+ createStyleDeclPair({+ breakpointId: "a",+ styleSourceId: "styleSource6",+ property: "color",+ value: { type: "keyword", value: "blue" },+ }),]);const styleSourceSelections: StyleSourceSelections = new Map([[