Files
webstudio/apps/builder/app/canvas/stores.ts
T
Bogdan Chadkin 9f897f5d41 refactor: reimplement canvas style renderer (#3253)
Here refactored canvas styles with nesting rules which allow to update
each declaration incrementally and closer to our data format.

Things to test
- initial rendering
- updating values
- ephemeral values
- selecting state, rendered as separate stylesheet

Added shim.ts to contain simplified polyfills for future methods like
Set.prototype.difference which I use here to find added and deleted
styles.

Removed warning from parseCssValue which pollutes log with outdated
messages.

Additionally fixed old bugs
- support ephemeral styles with selector state, for example hover was
not updated on on canvas while updating ephemeral styles
- remove ephemeral custom property from body (bug appeared when added
support ephemeral styles in tokens)
2024-05-02 17:51:09 +04:00

8 lines
255 B
TypeScript

import { atom } from "nanostores";
import type { StyleDecl } from "@webstudio-is/sdk";
import type { Params } from "@webstudio-is/react-sdk";
export const $ephemeralStyles = atom<Array<StyleDecl>>([]);
export const $params = atom<undefined | Params>();