Skip to content

RFC + PoC: Component Style Spec DSL - #36745

Draft
Dmytro Kirpa (dmytrokirpa) wants to merge 8 commits into
microsoft:masterfrom
dmytrokirpa:cursor/component-style-spec-dsl-125a
Draft

Dmytro Kirpa (dmytrokirpa) wants to merge 8 commits into
microsoft:masterfrom
dmytrokirpa:cursor/component-style-spec-dsl-125a

Conversation

@dmytrokirpa

Copy link
Copy Markdown
Contributor

Previous Behavior

Component styles for v9 React (Griffel), web components (FAST css), and headless CSS Modules are authored independently. The same design decisions (slots, variant axes, states, token references) are re-implemented by hand on each surface, which invites drift and blocks a machine-readable style contract for downstream / headless wrappers.

New Behavior

Adds an RFC and a side-by-side PoC for a framework-agnostic Component Style Spec DSL:

  • RFC: docs/react-v9/contributing/rfcs/shared/component-style-spec.md
  • @fluentui/style-spec — JSON-shaped types, validate, normalize→IR, JSON schema (private PoC package)
  • @fluentui/component-style-specs — Badge / Divider / Button specs transcribed from current v9 Griffel styles
  • @fluentui/style-spec-compilers — deterministic Griffel / web-components CSS / CSS Modules emitters + CLI --check, fixtures, parity tests
  • Stories — shipped v9 vs generated Griffel vs CSS Module side-by-side demos

No edits to shipped react-badge / react-button / react-divider / web-components / headless sources. Packages remain private: true until RFC acceptance.

Verification

yarn nx run-many -t build,type-check,lint,test -p style-spec,component-style-specs,style-spec-compilers
yarn nx run component-style-specs-stories:type-check
yarn nx run component-style-specs-stories:lint

All of the above pass locally (51 unit tests across the three packages).

Related Issue(s)

  • RFC / PoC for shared component style-spec DSL (no linked issue yet)

Made with Cursor

Introduce a framework-agnostic ComponentStyleSpec JSON DSL with
@fluentui/style-spec, Badge/Divider/Button specs, and compilers that
deterministically emit Griffel, web-components CSS, and CSS Modules.
Side-by-side PoC only — no edits to shipped component packages.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant