openpencil/packages
Danila Poyarkov 4254204685
feat(dom-css): compile component variants into state styles (#965)
* feat(dom-css): compile component variants into state styles

Code export needs a component's variants as one markup tree whose look follows the control's state. stateStyles keeps the rest variant as the base and turns each other variant into only what it changes, under the data-state, data-disabled and interaction conditions Reka and Radix set, or a data attribute for other variant properties. Layers only some variants draw stay hidden where absent. stateStylesToCSS writes a stylesheet with readable classes and stateStylesToTailwind writes utilities behind state variants.

* refactor(dom-css): build state stylesheets with the CSS object model

The stylesheet was assembled from strings with JSON-quoted attribute values. It is now built with @acemir/cssom, which rejects an invalid selector and prints the declarations, and attribute values are escaped as CSS strings by cssesc. The object model loads lazily, as for font-face rules, so stateStylesToCSS is async.

* refactor(dom-css): split state styles by step and require a rest variant

model.ts mixed reading conditions, projecting and merging variants, and comparing styles. They now live in conditions.ts, layers.ts, and model.ts, with the types in types.ts. A layer only some variants draw keeps the style of the variant that adds it, so no separate first-style pass is needed. A set with no rest variant now has no state styles, instead of using a checked or hovered variant as its rest look.
2026-10-07 21:15:40 +00:00
..
cli test: resolve repository files without climbing directories (#946) 2026-10-07 12:35:39 +00:00
core perf: speed up opening large pages (#953) 2026-10-07 20:57:57 +00:00
demos
design-jsx feat: show controls in a prebuilt demo and fix what saving it to .fig lost (#938) 2026-10-07 18:37:05 +00:00
docs feat(dom-css): compile component variants into state styles (#965) 2026-10-07 21:15:40 +00:00
dom-css feat(dom-css): compile component variants into state styles (#965) 2026-10-07 21:15:40 +00:00
emit refactor: rename @open-pencil/codegen to @open-pencil/emit (#822) 2026-10-04 11:22:20 +00:00
fig fix(fig): keep the sizes Figma derived for instance layers when a page loads (#951) 2026-10-07 20:57:55 +00:00
harness feat(ai): add guided AI setup for providers, coding agents, and Pi (#916) 2026-10-07 08:46:57 +00:00
kiwi test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
mcp feat(mcp): let MCP clients read only the selection, with a compact get_selection (#732) 2026-10-07 13:01:28 +00:00
pen fix(layout): size each axis on its own and lay out before geometry reads (#942) 2026-10-07 11:52:08 +00:00
scene-graph perf: speed up opening large pages (#953) 2026-10-07 20:57:57 +00:00
vue fix(canvas): keep image-heavy documents within CanvasKit memory (#963) 2026-10-07 20:30:25 +00:00