openpencil/packages/docs/development
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
..
architecture.md feat: behaviours and preview mode (#893) 2026-10-06 13:23:05 +00:00
behaviours-and-preview.md feat(dom-css): compile component variants into state styles (#965) 2026-10-07 21:15:40 +00:00
contributing.md docs: route contributors through per-domain guides and ship npm license text (#785) 2026-09-29 01:02:06 +04:00
fig-reader.md feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
navigation-performance.md build(tools): group tools by role and gate them like the rest of the repo (#791) 2026-09-30 05:00:31 +04:00
renderer-lifecycle.md perf(canvas): rebuild navigation rendering (#591) 2026-08-31 13:39:40 +03:00
renderer-profiler.md docs: move development notes into docs package 2026-05-13 02:48:09 +03:00
roadmap.md fix: keep bound text and visibility in step with their variables (#954) 2026-10-07 18:37:15 +00:00
tech-stack.md docs: refresh contributor guidance 2026-09-02 10:56:00 +03:00
testing.md test: typecheck the test suites and fix what that found (#896) 2026-10-05 12:42:38 +00:00
vector-conversion.md docs: generate llms files 2026-05-22 16:03:04 +03:00