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
refactor: drop legacy style engine (#4377)
Bogdan Chadkina71190a0a8c4
diff --git a/apps/builder/app/builder/features/style-panel/shared/style-info.test.ts b/apps/builder/app/builder/features/style-panel/shared/style-info.test.tsdeleted file mode 100644index 2abebda00b..0000000000--- a/apps/builder/app/builder/features/style-panel/shared/style-info.test.ts+++ /dev/null@@ -1,931 +0,0 @@-import { test, expect, describe, jest } from "@jest/globals";-import { act, renderHook } from "@testing-library/react-hooks";-import * as defaultMetas from "@webstudio-is/sdk-components-react/metas";-import {- getStyleDeclKey,- type Breakpoints,- type Instance,- type Instances,- type StyleDecl,- StyleSourceSelection,-} from "@webstudio-is/sdk";-import {- $selectedBreakpointId,- $selectedInstanceStates,- $breakpoints,- $instances,- $registeredComponentMetas,- $selectedInstanceSelector,- $selectedStyleSources,- $styleSourceSelections,- $styleSources,- $styles,- $selectedStyleState,-} from "~/shared/nano-states";-import {- getCascadedBreakpointIds,- getCascadedInfo,- getInheritedInfo,- getNextSourceInfo,- getPreviousSourceInfo,- __testing__,- useStyleInfo,-} from "./style-info";--jest.unstable_mockModule("~/shared/canvas-api", () => ({- isInitialized: () => {- throw new Error("Not implemented");- },- getElementAndAncestorInstanceTags: () => {- throw new Error("Not implemented");- },-}));--const { setInstanceToTag } = __testing__;--const toMap = <T extends { id: string }>(list: T[]) =>- new Map(list.map((item) => [item.id, item]));--const toStyleSourceSelectionsMap = (list: StyleSourceSelection[]) =>- new Map(list.map((item) => [item.instanceId, item]));--const toStylesMap = (list: StyleDecl[]) =>- new Map(list.map((item) => [getStyleDeclKey(item), item]));--const metas = new Map(Object.entries(defaultMetas));--const breakpoints: Breakpoints = new Map([- ["1", { id: "1", label: "1", minWidth: 0 }],- ["2", { id: "2", label: "2", minWidth: 768 }],- ["3", { id: "3", label: "3", minWidth: 1280 }],- ["4", { id: "4", label: "4", minWidth: 1920 }],-]);--const selectedBreakpointId = "3";-const selectedInstanceSelector = ["3", "2", "1"];-const cascadedBreakpointIds = getCascadedBreakpointIds(- breakpoints,- selectedBreakpointId-);--const cascadingStylesByInstanceId = new Map<Instance["id"], StyleDecl[]>();-cascadingStylesByInstanceId.set(selectedInstanceSelector[0], [- {- breakpointId: "1",- styleSourceId: "styleSourceId",- property: "width",- value: { type: "unit", value: 100, unit: "px" },- },- {- breakpointId: "1",- styleSourceId: "styleSourceId",- property: "height",- value: { type: "unit", value: 50, unit: "px" },- },- {- breakpointId: "2",- styleSourceId: "styleSourceId",- property: "width",- value: { type: "unit", value: 200, unit: "px" },- },- {- breakpointId: "3",- styleSourceId: "styleSourceId",- // should not be computed because current breakpoint- property: "height",- value: { type: "unit", value: 150, unit: "px" },- },- {- breakpointId: "4",- styleSourceId: "styleSourceId",- property: "width",- value: { type: "unit", value: 400, unit: "px" },- },-]);--const instances: Instances = new Map([- [- "1",- {- type: "instance",- id: "1",- component: "Body",- children: [{ type: "id", value: "2" }],- },- ],- [- "2",- {- type: "instance",- id: "2",- component: "Box",- children: [{ type: "id", value: "3" }],- },- ],- [- "3",- {- type: "instance",- id: "3",- component: "Box",- children: [],- },- ],-]);--const inheritingStylesByInstanceId = new Map<Instance["id"], StyleDecl[]>();-inheritingStylesByInstanceId.set("1", [- // should be inherited even from another breakpoint- {- breakpointId: "1",- styleSourceId: "styleSourceId1",- property: "fontSize",- value: { type: "unit", value: 20, unit: "px" },- },-]);-inheritingStylesByInstanceId.set("2", [- // should not be inherited because width is not inheritable- {- breakpointId: "3",- styleSourceId: "styleSourceId2",- property: "width",- value: { type: "unit", value: 100, unit: "px" },- },- // should be inherited from selected breakpoint- {- breakpointId: "3",- styleSourceId: "styleSourceId2",- property: "fontWeight",- value: { type: "keyword", value: "600" },- },-]);-inheritingStylesByInstanceId.set("3", [- // should not show selected style as inherited- {- breakpointId: "3",- styleSourceId: "styleSourceId3",- property: "fontWeight",- value: { type: "keyword", value: "500" },- },-]);--test("compute cascaded styles", () => {- expect(- getCascadedInfo(- cascadingStylesByInstanceId,- selectedInstanceSelector[0],- cascadedBreakpointIds,- new Set()- )- ).toMatchInlineSnapshot(`- {- "height": {- "breakpointId": "1",- "value": {- "type": "unit",- "unit": "px",- "value": 50,- },- },- "width": {- "breakpointId": "2",- "value": {- "type": "unit",- "unit": "px",- "value": 200,- },- },- }- `);-});--test("compute inherited styles", () => {- expect(- getInheritedInfo(- instances,- metas,- inheritingStylesByInstanceId,- selectedInstanceSelector,- new Map([- ["1", "body"],- ["2", "div"],- ["3", "div"],- ]),-- cascadedBreakpointIds,- selectedBreakpointId,- new Set()- )- ).toMatchInlineSnapshot(`- {- "MozOsxFontSmoothing": {- "instanceId": "1",- "value": {- "type": "keyword",- "value": "grayscale",- },- },- "WebkitFontSmoothing": {- "instanceId": "1",- "value": {- "type": "keyword",- "value": "antialiased",- },- },- "fontSize": {- "instanceId": "1",- "styleSourceId": "styleSourceId1",- "value": {- "type": "unit",- "unit": "px",- "value": 20,- },- },- "fontWeight": {- "instanceId": "2",- "styleSourceId": "styleSourceId2",- "value": {- "type": "keyword",- "value": "600",- },- },- }- `);-});--test("compute styles from previous sources", () => {- const styleSourceSelections = new Map([- ["3", { instanceId: "3", values: ["1", "2", "3", "4"] }],- ]);- const selectedStyleSourceSelector = {- styleSourceId: "3",- };- const stylesByInstanceId = new Map<Instance["id"], StyleDecl[]>([- [- "3",- [- {- breakpointId: "bp",- styleSourceId: "1",- property: "width",- value: { type: "unit", value: 100, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "2",- property: "width",- value: { type: "unit", value: 200, unit: "px" },- },- // prevent overriding by value from other breakpoint- {- breakpointId: "bp2",- styleSourceId: "2",- property: "width",- value: { type: "unit", value: 250, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "3",- property: "width",- value: { type: "unit", value: 300, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "4",- property: "width",- value: { type: "unit", value: 400, unit: "px" },- },- ],- ],- ]);- expect(- getPreviousSourceInfo(- styleSourceSelections,- stylesByInstanceId,- selectedInstanceSelector,- selectedStyleSourceSelector,- "bp",- new Set()- )- ).toMatchInlineSnapshot(`- {- "width": {- "styleSourceId": "2",- "value": {- "type": "unit",- "unit": "px",- "value": 200,- },- },- }- `);-});--test("compute styles from next sources", () => {- const styleSourceSelections = new Map([- ["3", { instanceId: "3", values: ["1", "2", "3", "4"] }],- ]);- const selectedStyleSourceSelector = {- styleSourceId: "3",- };- const stylesByInstanceId = new Map<Instance["id"], StyleDecl[]>([- [- "3",- [- {- breakpointId: "bp",- styleSourceId: "1",- property: "width",- value: { type: "unit", value: 100, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "2",- property: "width",- value: { type: "unit", value: 200, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "3",- property: "width",- value: { type: "unit", value: 300, unit: "px" },- },- {- breakpointId: "bp",- styleSourceId: "4",- property: "width",- value: { type: "unit", value: 400, unit: "px" },- },- // prevent overriding by value from other breakpoint- {- breakpointId: "bp2",- styleSourceId: "4",- property: "width",- value: { type: "unit", value: 450, unit: "px" },- },- ],- ],- ]);- expect(- getNextSourceInfo(- styleSourceSelections,- stylesByInstanceId,- selectedInstanceSelector,- selectedStyleSourceSelector,- "bp",- new Set()- )- ).toMatchInlineSnapshot(`- {- "width": {- "styleSourceId": "4",- "value": {- "type": "unit",- "unit": "px",- "value": 400,- },- },- }- `);-});--const resetStores = () => {- $registeredComponentMetas.set(new Map());- $instances.set(new Map());- $styles.set(new Map());- $styleSources.set(new Map());- $styleSourceSelections.set(new Map());- $breakpoints.set(new Map());- $selectedInstanceSelector.set(undefined);- setInstanceToTag(new Map());- $selectedStyleSources.set(new Map());- $selectedInstanceStates.set(new Set());-};--describe("color and currentColor", () => {- const bodyBoxInstances: Instances = new Map([- [- "body",- {- type: "instance",- id: "body",- component: "Body",- children: [{ type: "id", value: "box" }],- },- ],- ["box", { type: "instance", id: "box", component: "Box", children: [] }],- ]);- const baseBreakpoint = new Map([["base", { id: "base", label: "Base" }]]);-- test("initial color and currentColor is taken from properties", () => {- resetStores();- $instances.set(bodyBoxInstances);- $selectedInstanceSelector.set(["box", "body"]);- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "black",- });- expect(result.current.color?.currentColor).toEqual({- type: "keyword",- value: "black",- });- });-- test("color and currentColor inherits from parent instance", () => {- resetStores();- $instances.set(bodyBoxInstances);- $breakpoints.set(baseBreakpoint);- $styleSources.set(- new Map([["body.local", { id: "body.local", type: "local" }]])- );- $styleSourceSelections.set(- new Map([["body", { instanceId: "body", values: ["body.local"] }]])- );- const bodyColor: StyleDecl = {- styleSourceId: "body.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- };- $styles.set(new Map([[getStyleDeclKey(bodyColor), bodyColor]]));- $selectedInstanceSelector.set(["box", "body"]);- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "red",- });- expect(result.current.color?.currentColor).toEqual({- type: "keyword",- value: "red",- });- });-- test("color: inherit inherits from parent instance", () => {- resetStores();- $instances.set(bodyBoxInstances);- $breakpoints.set(baseBreakpoint);- $styleSources.set(- new Map([- ["body.local", { id: "body.local", type: "local" }],- ["box.local", { id: "box.local", type: "local" }],- ])- );- $styleSourceSelections.set(- new Map([- ["body", { instanceId: "body", values: ["body.local"] }],- ["box", { instanceId: "box", values: ["box.local"] }],- ])- );- const bodyColor: StyleDecl = {- styleSourceId: "body.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- };- const boxColor: StyleDecl = {- styleSourceId: "box.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "inherit" },- };- $styles.set(- new Map([- [getStyleDeclKey(bodyColor), bodyColor],- [getStyleDeclKey(boxColor), boxColor],- ])- );- $selectedInstanceSelector.set(["box", "body"]);- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "inherit",- });- expect(result.current.color?.currentColor).toEqual({- type: "keyword",- value: "red",- });- });-- test("color: currentColor inherits from parent instance", () => {- resetStores();- $instances.set(bodyBoxInstances);- $breakpoints.set(baseBreakpoint);- $styleSources.set(- new Map([- ["body.local", { id: "body.local", type: "local" }],- ["box.local", { id: "box.local", type: "local" }],- ])- );- $styleSourceSelections.set(- new Map([- ["body", { instanceId: "body", values: ["body.local"] }],- ["box", { instanceId: "box", values: ["box.local"] }],- ])- );- const bodyColor: StyleDecl = {- styleSourceId: "body.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- };- const boxColor: StyleDecl = {- styleSourceId: "box.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "currentColor" },- };- $styles.set(- new Map([- [getStyleDeclKey(bodyColor), bodyColor],- [getStyleDeclKey(boxColor), boxColor],- ])- );- $selectedInstanceSelector.set(["box", "body"]);- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "currentColor",- });- expect(result.current.color?.currentColor).toEqual({- type: "keyword",- value: "red",- });- });-- test("color and currentColor inherits default value", () => {- resetStores();- $instances.set(bodyBoxInstances);- $breakpoints.set(baseBreakpoint);- $styleSources.set(- new Map([["body.local", { id: "body.local", type: "local" }]])- );- $styleSourceSelections.set(- new Map([["body", { instanceId: "body", values: ["body.local"] }]])- );- const bodyColor: StyleDecl = {- styleSourceId: "body.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "inherit" },- };- $styles.set(new Map([[getStyleDeclKey(bodyColor), bodyColor]]));- $selectedInstanceSelector.set(["box", "body"]);- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "inherit",- });- expect(result.current.color?.currentColor).toEqual({- type: "keyword",- value: "black",- });- });-});--describe("active states", () => {- test("show stateless style as remote when state is selected", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(toMap([{ id: "box.local", type: "local" }]));- $styleSourceSelections.set(- toStyleSourceSelectionsMap([{ instanceId: "box", values: ["box.local"] }])- );- $styles.set(- toStylesMap([- {- styleSourceId: "box.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "green" },- },- ])- );- $selectedInstanceSelector.set(["box"]);- $selectedStyleSources.set(new Map([["box", "box.local"]]));-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });-- act(() => {- $selectedStyleSources.set(new Map([["box", "box.local"]]));- $selectedStyleState.set(":hover");- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-- test("show active state style as local when selected", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(toMap([{ id: "box.local", type: "local" }]));- $styleSourceSelections.set(- toStyleSourceSelectionsMap([{ instanceId: "box", values: ["box.local"] }])- );- $styles.set(- toStylesMap([- {- styleSourceId: "box.local",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- ])- );- $selectedInstanceSelector.set(["box"]);- $selectedStyleSources.set(new Map([["box", "box.local"]]));- $selectedInstanceStates.set(new Set([":hover"]));-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });-- act(() => {- $selectedStyleSources.set(new Map([["box", "box.local"]]));- $selectedStyleState.set(":hover");- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-- test("show active state from another breakpoint as remote", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(- toMap([- { id: "base", label: "" },- { id: "small", label: "", minWidth: 768 },- ])- );- $styleSources.set(toMap([{ id: "box.local", type: "local" }]));- $styleSourceSelections.set(- toStyleSourceSelectionsMap([{ instanceId: "box", values: ["box.local"] }])- );- $styles.set(- toStylesMap([- {- styleSourceId: "box.local",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- // check stateless declaration does not override state- {- styleSourceId: "box.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- },- ])- );- $selectedInstanceSelector.set(["box"]);- $selectedStyleSources.set(new Map([["box", "box.local"]]));- $selectedBreakpointId.set("small");-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "red",- });-- act(() => {- $selectedInstanceStates.set(new Set([":hover"]));- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-- test("show active state inherited from parent as remote", () => {- resetStores();- $instances.set(- toMap([- {- type: "instance",- id: "body",- component: "Body",- children: [{ type: "id", value: "box" }],- },- { type: "instance", id: "box", component: "Box", children: [] },- ])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(toMap([{ id: "body.local", type: "local" }]));- $styleSourceSelections.set(- toStyleSourceSelectionsMap([- { instanceId: "body", values: ["body.local"] },- ])- );- $styles.set(- toStylesMap([- {- styleSourceId: "body.local",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- // check stateless declaration does not override state- {- styleSourceId: "body.local",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- },- ])- );- $selectedInstanceSelector.set(["box", "body"]);-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "red",- });-- act(() => {- $selectedInstanceStates.set(new Set([":hover"]));- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-- test("show active state from the previous token as remote", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(- toMap([- { id: "box.token", type: "token", name: "" },- { id: "box.local", type: "local" },- ])- );- $styleSourceSelections.set(- toStyleSourceSelectionsMap([- { instanceId: "box", values: ["box.token", "box.local"] },- ])- );- $styles.set(- toStylesMap([- {- styleSourceId: "box.token",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- // check stateless declaration does not override state- {- styleSourceId: "box.token",- breakpointId: "base",- property: "color",- value: { type: "keyword", value: "red" },- },- ])- );- $selectedInstanceSelector.set(["box"]);- $selectedStyleSources.set(new Map([["box", "box.local"]]));-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "red",- });-- act(() => {- $selectedInstanceStates.set(new Set([":hover"]));- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-- test("show active state from the next token as overwritten", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(- toMap([- { id: "box.first", type: "token", name: "" },- { id: "box.second", type: "token", name: "" },- { id: "box.third", type: "token", name: "" },- ])- );- $styleSourceSelections.set(- toStyleSourceSelectionsMap([- { instanceId: "box", values: ["box.first", "box.second", "box.third"] },- ])- );- $styles.set(- toStylesMap([- {- styleSourceId: "box.third",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- // check stateless declaration does not override state- {- styleSourceId: "box.second",- breakpointId: "base",- state: ":hover",- property: "color",- value: { type: "keyword", value: "blue" },- },- ])- );- $selectedInstanceSelector.set(["box"]);- $selectedStyleSources.set(new Map([["box", "box.first"]]));- $selectedInstanceStates.set(new Set([":hover"]));-- const { result } = renderHook(() => useStyleInfo());- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });-- act(() => {- $selectedStyleSources.set(new Map([["box", "box.second"]]));- });- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "blue",- });- });-- test("show active state from preset", () => {- resetStores();- $instances.set(- toMap([{ type: "instance", id: "box", component: "Box", children: [] }])- );- $breakpoints.set(toMap([{ id: "base", label: "" }]));- $styleSources.set(toMap([{ id: "box.local", type: "local" }]));- $styleSourceSelections.set(- toStyleSourceSelectionsMap([{ instanceId: "box", values: ["box.local"] }])- );- $styles.set(new Map());- $registeredComponentMetas.set(- new Map([- [- "Box",- {- type: "container",- icon: "",- presetStyle: {- div: [- {- state: ":hover",- property: "color",- value: { type: "keyword", value: "green" },- },- {- property: "color",- value: { type: "keyword", value: "red" },- },- ],- },- },- ],- ])- );-- $selectedInstanceSelector.set(["box"]);- $selectedInstanceStates.set(new Set([":hover"]));- $selectedStyleSources.set(new Map([["box", "box.local"]]));- setInstanceToTag(new Map([["box", "div"]]));-- const { result } = renderHook(() => useStyleInfo());-- expect(result.current.color?.value).toEqual({- type: "keyword",- value: "green",- });- });-});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.tsdeleted file mode 100644index 905e18f0ed..0000000000--- a/apps/builder/app/builder/features/style-panel/shared/style-info.ts+++ /dev/null@@ -1,834 +0,0 @@-import { useMemo } from "react";-import { useStore } from "@nanostores/react";-import type { HtmlTags } from "html-tags";-import type {- Style,- StyleProperty,- StyleValue,-} from "@webstudio-is/css-engine";-import { compareMedia } from "@webstudio-is/css-engine";-import { html, properties } from "@webstudio-is/css-data";-import type {- StyleSourceSelections,- Breakpoints,- Instance,- Instances,- StyleDecl,- StyleSource as StyleSourceType,- Breakpoint,-} from "@webstudio-is/sdk";-import {- type StyleSourceSelector,- $instances,- $selectedInstanceSelector,- $stylesIndex,- $selectedOrLastStyleSourceSelector,- $breakpoints,- $styleSourceSelections,- $registeredComponentMetas,- $selectedInstanceStates,-} from "~/shared/nano-states";-import { $selectedBreakpoint } from "~/shared/nano-states";-import type { InstanceSelector } from "~/shared/tree-utils";-import type { WsComponentMeta } from "@webstudio-is/react-sdk";-import { canvasApi } from "~/shared/canvas-api";-import { computed } from "nanostores";-import { $loadingState } from "~/builder/shared/nano-states";--type CascadedValueInfo = {- breakpointId: string;- value: StyleValue;-};--type CascadedProperties = {- [property in StyleProperty]?: CascadedValueInfo;-};--type InheritedValueInfo = {- instanceId: string;- styleSourceId?: StyleSourceType["id"];- value: StyleValue;-};--type InheritedProperties = {- [property in StyleProperty]?: InheritedValueInfo;-};--type SourceValueInfo = {- styleSourceId: string;- value: StyleValue;-};--type SourceProperties = {- [property in StyleProperty]?: SourceValueInfo;-};--/*- * For some cases we are encouraging to use custom defaults, than- * `initial` values provided by browsers. This helps in controlling the behaviour- * of such properties- *- * @todo override in generated properties- */-const CUSTOM_DEFAULT_VALUES: Partial<Record<StyleProperty, StyleValue>> = {- outlineWidth: { value: 0, type: "unit", unit: "px" },-};--type StatefulValue = { state: string; value: StyleValue };--type StyleValueInfo = {- value: StyleValue;- // either stateful and local exist or stateless and local or just local- // @todo improve with more clear structure- stateful?: StatefulValue;- local?: StyleValue;- stateless?: StyleValue;- previousSource?: SourceValueInfo;- nextSource?: SourceValueInfo;- cascaded?: CascadedValueInfo;- inherited?: InheritedValueInfo;- preset?: StyleValue;- htmlValue?: StyleValue;-};--export type StyleInfo = {- [property in Exclude<StyleProperty, "color">]?: StyleValueInfo;-} & {- /**- * In order to maintain code efficiency and reduce clutter, we should only expose the currentColor value for the color property.- * We can consider it an edge case when it is necessary to display the actual currentColor value in the Color Picker.- */- color?: StyleValueInfo & {- /**- * Only color property can have currentColor- * Now we take it from the computed style, @todo: calculate when we are going to remove computed.- **/- currentColor?: StyleValue | undefined;- };-};--export type StyleSource =- | "local"- | "overwritten"- | "remote"- | "preset"- | "default";--const propertyNames = Object.keys(properties) as StyleProperty[];--const inheritableProperties = new Set<string>();-for (const [property, value] of Object.entries(properties)) {- if (value.inherited) {- inheritableProperties.add(property);- }-}--const getLocalStyles = (- stylesByStyleSourceId: Map<StyleSourceType["id"], StyleDecl[]>,- breakpointId: string,- styleSourceSelector: StyleSourceSelector,- activeStates: Set<string>-) => {- const statelessStyles = new Map<StyleProperty, StyleValue>();- const localStyles = new Map<StyleProperty, StyleValue>();- const statefulStyles = new Map<StyleProperty, StatefulValue>();- const instanceStyles = stylesByStyleSourceId.get(- styleSourceSelector.styleSourceId- );- if (instanceStyles === undefined) {- return { statelessStyles, localStyles, statefulStyles };- }- for (const styleDecl of instanceStyles) {- if (styleDecl.breakpointId !== breakpointId) {- continue;- }- if (styleDecl.state === undefined) {- if (styleSourceSelector.state === undefined) {- localStyles.set(styleDecl.property, styleDecl.value);- } else {- statelessStyles.set(styleDecl.property, styleDecl.value);- }- }- if (styleDecl.state && activeStates.has(styleDecl.state)) {- if (styleDecl.state === styleSourceSelector.state) {- localStyles.set(styleDecl.property, styleDecl.value);- } else {- statefulStyles.set(styleDecl.property, {- state: styleDecl.state,- value: styleDecl.value,- });- }- }- }- return { statelessStyles, localStyles, statefulStyles };-};--/**- * find all breakpoints which may affect current view- */-export const getCascadedBreakpointIds = (- breakpoints: Breakpoints,- selectedBreakpointId?: string-) => {- const sortedBreakpoints = Array.from(breakpoints.values()).sort(compareMedia);- const cascadedBreakpointIds: string[] = [];- for (const breakpoint of sortedBreakpoints) {- if (breakpoint.id === selectedBreakpointId) {- break;- }- cascadedBreakpointIds.push(breakpoint.id);- }- return cascadedBreakpointIds;-};--/**- * extract all styles from breakpoints- * affecting current view- */-export const getCascadedInfo = (- stylesByInstanceId: Map<Instance["id"], StyleDecl[]>,- instanceId: string,- cascadedBreakpointIds: string[],- activeStates: Set<string>-) => {- const cascadedStyle: CascadedProperties = {};- const instanceStyles = stylesByInstanceId.get(instanceId);- if (instanceStyles === undefined) {- return cascadedStyle;- }- for (const breakpointId of cascadedBreakpointIds) {- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- styleDecl.state === undefined- ) {- cascadedStyle[styleDecl.property] = {- breakpointId,- value: styleDecl.value,- };- }- }- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- styleDecl.state &&- activeStates.has(styleDecl.state)- ) {- cascadedStyle[styleDecl.property] = {- breakpointId,- value: styleDecl.value,- };- }- }- }- return cascadedStyle;-};--export const getInstanceComponent = (- instances: Instances,- instanceId: undefined | Instance["id"]-) => {- if (instanceId === undefined) {- return;- }- const instance = instances.get(instanceId);- if (instance === undefined) {- return;- }- return instance.component;-};--export const getPresetStyleRule = (- meta: undefined | WsComponentMeta,- tagName: HtmlTags,- activeStates: Set<string>-) => {- const presetStyles = meta?.presetStyle?.[tagName];- if (presetStyles === undefined) {- return;- }- const presetStyle: Style = {};- for (const styleDecl of presetStyles) {- if (styleDecl.state === undefined) {- presetStyle[styleDecl.property] = styleDecl.value;- }- }- for (const styleDecl of presetStyles) {- if (styleDecl.state && activeStates.has(styleDecl.state)) {- presetStyle[styleDecl.property] = styleDecl.value;- }- }- return presetStyle;-};--/**- * extract all inheritable styles from ancestor instances- * including active breakpoints- */-export const getInheritedInfo = (- instances: Instances,- metas: Map<string, WsComponentMeta>,- stylesByInstanceId: Map<Instance["id"], StyleDecl[]>,- instanceSelector: InstanceSelector,- selectedInstanceIntanceToTag: Map<Instance["id"], HtmlTags>,- cascadedBreakpointIds: string[],- selectedBreakpointId: string,- activeStates: Set<string>-) => {- const inheritedStyle: InheritedProperties = {};- // skip current instance and start with root til parent- for (const instanceId of instanceSelector.slice(1).reverse()) {- const ancestorInstance = instances.get(instanceId);- if (ancestorInstance === undefined) {- continue;- }- const cascadedAndSelectedBreakpointIds = [- ...cascadedBreakpointIds,- selectedBreakpointId,- ];-- const tagName = selectedInstanceIntanceToTag.get(instanceId);-- const component = getInstanceComponent(instances, instanceId);- const presetStyle =- tagName !== undefined && component !== undefined- ? metas.get(component)?.presetStyle?.[tagName]- : undefined;- if (presetStyle) {- for (const styleDecl of presetStyle) {- if (- styleDecl.state === undefined &&- inheritableProperties.has(styleDecl.property)- ) {- inheritedStyle[styleDecl.property] = {- instanceId: ancestorInstance.id,- value: styleDecl.value,- };- }- }- }-- const ancestorInstanceStyles = stylesByInstanceId.get(ancestorInstance.id);- if (ancestorInstanceStyles === undefined) {- continue;- }-- // extract styles from all active breakpoints- for (const breakpointId of cascadedAndSelectedBreakpointIds) {- for (const styleDecl of ancestorInstanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- inheritableProperties.has(styleDecl.property) &&- styleDecl.state === undefined- ) {- inheritedStyle[styleDecl.property] = {- instanceId: ancestorInstance.id,- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- for (const styleDecl of ancestorInstanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- inheritableProperties.has(styleDecl.property) &&- styleDecl.state &&- activeStates.has(styleDecl.state)- ) {- inheritedStyle[styleDecl.property] = {- instanceId: ancestorInstance.id,- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- }- }- return inheritedStyle;-};--export const getPreviousSourceInfo = (- styleSourceSelections: StyleSourceSelections,- stylesByInstanceId: Map<Instance["id"], StyleDecl[]>,- selectedInstanceSelector: InstanceSelector,- selectedStyleSourceSelector: StyleSourceSelector,- breakpointId: Breakpoint["id"],- activeStates: Set<string>-) => {- const previousSourceStyle: SourceProperties = {};- const [selectedInstanceId] = selectedInstanceSelector;- const { styleSourceId } = selectedStyleSourceSelector;- const styleSourceSelection = styleSourceSelections.get(selectedInstanceId);- const instanceStyles = stylesByInstanceId.get(selectedInstanceId);- if (styleSourceSelection === undefined || instanceStyles === undefined) {- return previousSourceStyle;- }- const previousSourceIds = styleSourceSelection.values.slice(- 0,- styleSourceSelection.values.indexOf(styleSourceId)- );- // expect instance styles to be ordered- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- previousSourceIds.includes(styleDecl.styleSourceId) &&- styleDecl.state === undefined- ) {- previousSourceStyle[styleDecl.property] = {- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- previousSourceIds.includes(styleDecl.styleSourceId) &&- styleDecl.state &&- activeStates.has(styleDecl.state)- ) {- previousSourceStyle[styleDecl.property] = {- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- return previousSourceStyle;-};--export const getNextSourceInfo = (- styleSourceSelections: StyleSourceSelections,- stylesByInstanceId: Map<Instance["id"], StyleDecl[]>,- selectedInstanceSelector: InstanceSelector,- selectedStyleSourceSelector: StyleSourceSelector,- breakpointId: Breakpoint["id"],- activeStates: Set<string>-) => {- const nextSourceStyle: SourceProperties = {};- const [selectedInstanceId] = selectedInstanceSelector;- const { styleSourceId } = selectedStyleSourceSelector;- const styleSourceSelection = styleSourceSelections.get(selectedInstanceId);- const instanceStyles = stylesByInstanceId.get(selectedInstanceId);- if (styleSourceSelection === undefined || instanceStyles === undefined) {- return nextSourceStyle;- }- const nextSourceIds = styleSourceSelection.values.slice(- // exclude current style source- styleSourceSelection.values.indexOf(styleSourceId) + 1- );- // expect instance styles to be ordered- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- nextSourceIds.includes(styleDecl.styleSourceId) &&- styleDecl.state === undefined- ) {- nextSourceStyle[styleDecl.property] = {- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- for (const styleDecl of instanceStyles) {- if (- styleDecl.breakpointId === breakpointId &&- nextSourceIds.includes(styleDecl.styleSourceId) &&- styleDecl.state &&- activeStates.has(styleDecl.state)- ) {- nextSourceStyle[styleDecl.property] = {- styleSourceId: styleDecl.styleSourceId,- value: styleDecl.value,- };- }- }- return nextSourceStyle;-};--const $instanceToTag = computed(- [$selectedInstanceSelector, $loadingState],- (instanceSelector, loadingState) => {- if (__testing__.instanceToTag !== undefined) {- return __testing__.instanceToTag;- }-- if (instanceSelector === undefined) {- return;- }-- if (loadingState.state !== "ready") {- return;- }-- const result =- canvasApi.getElementAndAncestorInstanceTags(instanceSelector);-- return result;- }-);--/**- * combine all local, cascaded, inherited and browser styles- */-const useStyleInfoByInstanceAndStyleSource = (- instanceSelector: InstanceSelector | undefined,- styleSourceSelector: StyleSourceSelector | undefined-) => {- const breakpoints = useStore($breakpoints);- const selectedBreakpoint = useStore($selectedBreakpoint);- const selectedBreakpointId = selectedBreakpoint?.id;- const instances = useStore($instances);- const metas = useStore($registeredComponentMetas);- const { stylesByInstanceId, stylesByStyleSourceId } = useStore($stylesIndex);- const styleSourceSelections = useStore($styleSourceSelections);- const selectedInstanceStates = useStore($selectedInstanceStates);- const instanceToTag = useStore($instanceToTag);- const activeStates = useMemo(() => {- const activeStates = new Set(selectedInstanceStates);- if (styleSourceSelector?.state !== undefined) {- activeStates.add(styleSourceSelector.state);- }- return activeStates;- }, [styleSourceSelector, selectedInstanceStates]);-- const selectedStyle = useMemo((): {- statelessStyles: Map<StyleProperty, StyleValue>;- localStyles: Map<StyleProperty, StyleValue>;- statefulStyles: Map<StyleProperty, StatefulValue>;- } => {- if (- selectedBreakpointId === undefined ||- styleSourceSelector === undefined- ) {- return {- statelessStyles: new Map(),- localStyles: new Map(),- statefulStyles: new Map(),- };- }- return getLocalStyles(- stylesByStyleSourceId,- selectedBreakpointId,- styleSourceSelector,- activeStates- );- }, [- stylesByStyleSourceId,- selectedBreakpointId,- activeStates,- styleSourceSelector,- ]);-- const cascadedBreakpointIds = useMemo(- () => getCascadedBreakpointIds(breakpoints, selectedBreakpointId),- [breakpoints, selectedBreakpointId]- );-- const inheritedInfo = useMemo(() => {- if (- selectedBreakpointId === undefined ||- instanceSelector === undefined ||- instanceToTag === undefined- ) {- return {};- }- return getInheritedInfo(- instances,- metas,- stylesByInstanceId,- instanceSelector,- instanceToTag,- cascadedBreakpointIds,- selectedBreakpointId,- activeStates- );- }, [- instances,- metas,- stylesByInstanceId,- cascadedBreakpointIds,- selectedBreakpointId,- instanceSelector,- instanceToTag,- activeStates,- ]);-- const cascadedInfo = useMemo(() => {- if (instanceSelector === undefined) {- return {};- }- return getCascadedInfo(- stylesByInstanceId,- instanceSelector[0],- cascadedBreakpointIds,- activeStates- );- }, [- stylesByInstanceId,- instanceSelector,- cascadedBreakpointIds,- activeStates,- ]);-- const previousSourceInfo = useMemo(() => {- if (- instanceSelector === undefined ||- styleSourceSelector === undefined ||- selectedBreakpointId === undefined- ) {- return {};- }- return getPreviousSourceInfo(- styleSourceSelections,- stylesByInstanceId,- instanceSelector,- styleSourceSelector,- selectedBreakpointId,- activeStates- );- }, [- styleSourceSelections,- stylesByInstanceId,- instanceSelector,- styleSourceSelector,- selectedBreakpointId,- activeStates,- ]);-- const nextSourceInfo = useMemo(() => {- if (- instanceSelector === undefined ||- styleSourceSelector === undefined ||- selectedBreakpointId === undefined- ) {- return {};- }- return getNextSourceInfo(- styleSourceSelections,- stylesByInstanceId,- instanceSelector,- styleSourceSelector,- selectedBreakpointId,- activeStates- );- }, [- styleSourceSelections,- stylesByInstanceId,- instanceSelector,- styleSourceSelector,- selectedBreakpointId,- activeStates,- ]);-- const presetStyle = useMemo(() => {- const selectedInstanceId = instanceSelector?.[0];- if (selectedInstanceId === undefined || styleSourceSelector === undefined) {- return;- }- const tagName = instanceToTag?.get(selectedInstanceId);- const component = getInstanceComponent(instances, selectedInstanceId);- if (tagName === undefined || component === undefined) {- return;- }- return getPresetStyleRule(metas.get(component), tagName, activeStates);- }, [- instances,- metas,- instanceSelector,- instanceToTag,- activeStates,- styleSourceSelector,- ]);-- const allPropertyNames = useMemo(() => {- const [selectedInstanceId] = instanceSelector ?? [];- const all: Set<StyleProperty> = new Set(propertyNames);- const styles = stylesByInstanceId.get(selectedInstanceId);- if (styles) {- for (const styleDecl of styles) {- if (all.has(styleDecl.property) === false) {- all.add(styleDecl.property);- }- }- }- return Array.from(all);- }, [instanceSelector, stylesByInstanceId]);-- const styleInfoData = useMemo(() => {- const styleInfoData: StyleInfo = {};- const instanceId = instanceSelector?.[0];- const tagName = instanceToTag?.get(instanceId ?? "");- for (const property of allPropertyNames) {- const defaultValue = CUSTOM_DEFAULT_VALUES[property] ??- properties[property as keyof typeof properties]?.initial ?? {- type: "guaranteedInvalid",- };- const htmlValue = tagName- ? html.get(`${tagName}:${property as string}`)- : undefined;- const preset = presetStyle?.[property];- const inherited = inheritedInfo[property];- const cascaded = cascadedInfo[property];- const previousSource = previousSourceInfo[property];- const nextSource = nextSourceInfo[property];- const { statelessStyles, localStyles, statefulStyles } = selectedStyle;- const stateful = statefulStyles.get(property);- const local = localStyles.get(property);- const stateless = statelessStyles.get(property);- const ownValue =- local ??- stateful?.value ??- stateless ??- nextSource?.value ??- previousSource?.value ??- cascaded?.value ??- preset ??- htmlValue;- const inheritedValue = inherited?.value;- const value = ownValue ?? inheritedValue ?? defaultValue;-- if (value) {- if (property === "color") {- const ownColor =- ownValue?.type === "keyword" &&- (ownValue.value === "inherit" || ownValue.value === "currentColor")- ? undefined- : ownValue;- const inheritedColor =- inheritedValue?.type === "keyword" &&- (inheritedValue.value === "inherit" ||- inheritedValue.value === "currentColor")- ? undefined- : inheritedValue;- const currentColor = ownColor ?? inheritedColor ?? defaultValue;- styleInfoData[property] = {- value,- stateful,- local,- stateless,- nextSource,- previousSource,- cascaded,- inherited,- preset,- htmlValue,- currentColor,- };- } else {- styleInfoData[property] = {- value,- stateful,- local,- stateless,- nextSource,- previousSource,- cascaded,- inherited,- preset,- htmlValue,- };- }- }- }- return styleInfoData;- }, [- instanceSelector,- instanceToTag,- presetStyle,- inheritedInfo,- cascadedInfo,- nextSourceInfo,- previousSourceInfo,- selectedStyle,- allPropertyNames,- ]);-- return styleInfoData;-};--export const useStyleInfo = () => {- const instanceSelector = useStore($selectedInstanceSelector);-- const styleSourceSelector = useStore($selectedOrLastStyleSourceSelector);-- return useStyleInfoByInstanceAndStyleSource(- instanceSelector,- styleSourceSelector- );-};--const isAncestorOrSelfOfSelectedInstance = (- instanceSelector: InstanceSelector-) => {- const selectedInstanceSelector = $selectedInstanceSelector.get();-- if (selectedInstanceSelector === undefined) {- return false;- }-- if (instanceSelector.length > selectedInstanceSelector.length) {- return false;- }-- if (instanceSelector.length === 0) {- return false;- }-- const deltaLength = selectedInstanceSelector.length - instanceSelector.length;- return instanceSelector.every(- (instance, index) =>- instance === selectedInstanceSelector[index + deltaLength]- );-};--export const useStyleInfoByInstanceId = (- instanceSelector: InstanceSelector | undefined-) => {- const styleSourceSelections = useStore($styleSourceSelections);-- if (- instanceSelector !== undefined &&- isAncestorOrSelfOfSelectedInstance(instanceSelector) === false- ) {- console.error(- `The style works correctly only on ancestors of the selected element,- as our style data only includes information about these ancestors.- See $selectedInstanceIntanceToTag for details.`- );- }-- const [selectedInstanceId] = instanceSelector ?? [];-- const styleSourceIds =- selectedInstanceId !== undefined- ? (styleSourceSelections.get(selectedInstanceId)?.values ?? [])- : [];-- const lastStyleSourceId = styleSourceIds.at(-1);-- const lastStyleSource: StyleSourceSelector | undefined =- lastStyleSourceId !== undefined- ? {- styleSourceId: lastStyleSourceId,- }- : undefined;-- return useStyleInfoByInstanceAndStyleSource(- instanceSelector,- lastStyleSource- );-};--export const __testing__ = {- instanceToTag: undefined as Map<Instance["id"], HtmlTags> | undefined,- setInstanceToTag: (instanceToTag: Map<Instance["id"], HtmlTags>) => {- __testing__.instanceToTag = instanceToTag;-- const selector = $selectedInstanceSelector.get();- if (selector === undefined) {- return;- }- // enforce recompute- $selectedInstanceSelector.set([...selector]);- },-};diff --git a/apps/builder/app/canvas/collapsed.ts b/apps/builder/app/canvas/collapsed.tsindex 8b42c8583a..105c3d1fd8 100644--- a/apps/builder/app/canvas/collapsed.ts+++ b/apps/builder/app/canvas/collapsed.ts@@ -1,11 +1,5 @@import htmlTags, { voidHtmlTags, type HtmlTags } from "html-tags";import { collapsedAttribute, idAttribute } from "@webstudio-is/react-sdk";-import {- getCascadedBreakpointIds,- getCascadedInfo,- getInstanceComponent,- getPresetStyleRule,-} from "~/builder/features/style-panel/shared/style-info";import {$breakpoints,$instances,@@ -15,6 +9,7 @@ import {import { $selectedBreakpoint } from "~/shared/nano-states";import { subscribe } from "~/shared/pubsub";import { $selectedPage } from "~/shared/awareness";+import { compareMedia, StyleValue } from "@webstudio-is/css-engine";const isHtmlTag = (tag: string): tag is HtmlTags =>htmlTags.includes(tag as HtmlTags);@@ -70,36 +65,56 @@ const getInstanceSize = (instanceId: string, tagName: HtmlTags | undefined) => {};}- const cascadedBreakpointIds = getCascadedBreakpointIds(- breakpoints,- selectedBreakpointId- );+ let widthValue: undefined | StyleValue;+ let heightValue: undefined | StyleValue;++ const component =+ instanceId === undefined ? undefined : instances.get(instanceId)?.component;+ if (component && tagName) {+ const presetStyles = metas.get(component)?.presetStyle?.[tagName] ?? [];+ for (const styleDecl of presetStyles) {+ if (styleDecl.state === undefined) {+ if (styleDecl.property === "width") {+ widthValue = styleDecl.value;+ }+ if (styleDecl.property === "height") {+ heightValue = styleDecl.value;+ }+ }+ }+ }- const component = getInstanceComponent(instances, instanceId);- const presetStyle =- tagName !== undefined && component !== undefined- ? getPresetStyleRule(metas.get(component), tagName, new Set())- : undefined;-- const cascadedStyle = getCascadedInfo(- stylesByInstanceId,- instanceId,- [...cascadedBreakpointIds, selectedBreakpointId],- new Set()- );+ const sortedBreakpoints = Array.from(breakpoints.values()).sort(compareMedia);+ const matchingBreakpoints: string[] = [];+ for (const breakpoint of sortedBreakpoints) {+ matchingBreakpoints.push(breakpoint.id);+ if (breakpoint.id === selectedBreakpointId) {+ break;+ }+ }- const widthStyle = cascadedStyle?.width?.value ?? presetStyle?.width;- const heightStyle = cascadedStyle?.height?.value ?? presetStyle?.height;+ const instanceStyles = stylesByInstanceId.get(instanceId);+ if (instanceStyles) {+ for (const breakpointId of matchingBreakpoints) {+ for (const styleDecl of instanceStyles) {+ if (+ styleDecl.breakpointId === breakpointId &&+ styleDecl.state === undefined+ ) {+ if (styleDecl.property === "width") {+ widthValue = styleDecl.value;+ }+ if (styleDecl.property === "height") {+ heightValue = styleDecl.value;+ }+ }+ }+ }+ }return {- width:- widthStyle !== undefined && widthStyle.type === "unit"- ? widthStyle.value- : undefined,- height:- heightStyle !== undefined && heightStyle.type === "unit"- ? heightStyle.value- : undefined,+ width: widthValue?.type === "unit" ? widthValue.value : undefined,+ height: heightValue?.type === "unit" ? heightValue.value : undefined,};};diff --git a/apps/builder/package.json b/apps/builder/package.jsonindex 36311fd156..67c82261cb 100644--- a/apps/builder/package.json+++ b/apps/builder/package.json@@ -124,7 +124,6 @@"devDependencies": {"@jest/globals": "^29.7.0","@remix-run/dev": "^2.12.1",- "@testing-library/react-hooks": "^8.0.1","@types/cookie": "^0.6.0","@types/debug": "^4.1.12","@types/dom-navigation": "^1.0.4",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e10db4791a..16ff92e319 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -440,9 +440,6 @@ importers:'@remix-run/dev':specifier: ^2.12.1version: 2.12.1(patch_hash=yortwzoeu3uj2blmdikhhw5byy)(@remix-run/[email protected]([email protected]([email protected]))([email protected])([email protected]))(@remix-run/[email protected]([email protected]))(@types/[email protected])([email protected])([email protected](@types/[email protected]))([email protected](@cloudflare/[email protected]))- '@testing-library/react-hooks':- specifier: ^8.0.1- version: 8.0.1(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])'@types/cookie':specifier: ^0.6.0version: 0.6.0@@ -5023,22 +5020,6 @@ packages:resolution: {integrity: sha512-FlS4ZWlp97iiNWig0Muq8p+3rVDjRiYE+YKGbAqXOu9nwJFFOdL00kFpz42M+4huzYi86vAK1sOOfyOG45muIQ==}engines: {node: '>=14'}- '@testing-library/[email protected]':- resolution: {integrity: sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g==}- engines: {node: '>=12'}- peerDependencies:- '@types/react': ^18.2.70- react: 18.3.0-canary-14898b6a9-20240318- react-dom: 18.3.0-canary-14898b6a9-20240318- react-test-renderer: ^16.9.0 || ^17.0.0- peerDependenciesMeta:- '@types/react':- optional: true- react-dom:- optional: true- react-test-renderer:- optional: true-'@testing-library/[email protected]':resolution: {integrity: sha512-SOUuM2ysCvjUWBXTNfQ/ztmnKDmqaiPV3SvoIuyxMUca45rbSWWAT/qB8CUs/JQ/ux/8JFs9DNdFQ3f6jH3crA==}engines: {node: '>=14'}@@ -12559,16 +12540,6 @@ snapshots:lz-string: 1.5.0pretty-format: 27.5.1- '@testing-library/[email protected](@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])':- dependencies:- '@babel/runtime': 7.22.3- react: 18.3.0-canary-14898b6a9-20240318- react-error-boundary: 3.1.4([email protected])- optionalDependencies:- '@types/react': 18.2.79- react-dom: 18.3.0-canary-14898b6a9-20240318([email protected])- react-test-renderer: 18.3.0-canary-14898b6a9-20240318([email protected])-dependencies:'@babel/runtime': 7.22.3