Repository navigation
P4 (parts 1-3,5): dual-emit astryx-* CSS classes, data-attrs + sibling astryx.css - #2928
Merged
ejhammond merged 7 commits intoJun 19, 2026
Merged
Conversation
xdsThemeProps() now emits BOTH the new astryx-* and legacy xds-* base class (e.g. 'astryx-button xds-button primary sm') so new consumer CSS can target astryx-* while existing xds-* selectors keep matching through the compat window. Variant tokens (primary, sm, level-1) are unchanged. Uses the stableClassName/legacyStableClassName helpers from the naming module. Updates xdsThemeProps.test.ts assertions to the dual-class form. Component tests that use toContain/toHaveClass/querySelector on xds-* keep passing (the xds-* class is still present); exact-match assertions (P6 scope) will be swept separately. Part of P4 (source-of-record renames); CSS dual-emit sub-part.
…pshots - xdsThemeProps.test.ts combined assertion -> dual-class form - regenerate 3 XDSFormLayout snapshots (astryx-form-layout prepended to xds-form-layout; otherwise byte-identical) Full core suite: 3152/3152 pass with the class dual-emit.
Renames the self-contained internal data attributes in place (no dual-emit
per P0 decision 2 — these are not consumer-observable contracts):
data-xds-token{,-id,-value}, data-xds-dictation-interim, data-xds-scrolling,
data-xds-trigger-anchor, data-xds-highlight-{dynamic,styles}, data-xds-edge-comp,
data-xds-toast-fallback -> data-astryx-*.
Each attr's write (setAttribute/JSX) and read (querySelector/stylex :is()/:has())
sites are co-located within the same component module and moved together, so
there is no contract break. 14 source + test files; 150 tests across
Chat/CodeBlock/Layout/Toast pass.
Deliberately EXCLUDED (not in this unit):
- data-xds-theme / -theme-prose / -media / -id — Population A, dual-emit +
@scope-coupled (theme CSS generation). Handled in the data-attr dual-emit unit.
- data-xds-syntax-theme — read by generated syntax CSS at runtime (coupled).
The CSS build now writes dist/astryx.css with byte-identical content to
dist/xds.css (verified: same md5), and package.json exports './astryx.css'.
Gives consumers a forward-named import path ('@xds/core/astryx.css') during
the compat window. Layer name stays @layer xds-base until final cutover (P10).
dist/ is gitignored (build artifact); committing the build script, the
astryx.css.d.ts type stub, and the package export only.
Population A (consumer-observable theme attributes) now dual-emit both the new astryx-* and legacy xds-* forms, and the theme-CSS generators (both the runtime generateThemeRules.ts and the static build-theme.mjs path) scope to either form. Writers: - XDSTheme.tsx: documentElement gets both data-astryx-theme + data-xds-theme; injected <style> markers use the naming helpers (cleanup query matches). - XDSMediaTheme.tsx: dual-emits data-astryx-media + data-xds-media. - reset.css: color-scheme rule matches :where([data-astryx-media], [data-xds-media]). Generators (kept in SYNC): - generateThemeRules.ts: new themeScopeStart()/THEME_SCOPE_TO/mediaSelector()/ componentClassSelector() build dual-prefix selector-lists for @scope start, @scope limit, on-media surfaces, and .astryx-/.xds- component overrides. - build-theme.mjs: mirrors the same dual-prefix helpers on the static path. Layer names unchanged (xds-base/xds-theme) per P0 decision 4. Package scope still @xds/*. Next: source rename + generator inversion (part 4).
generateThemeRules + onMediaTokens tests asserted the old single-prefix CSS shape. Update to the dual form: @scope ([data-astryx-theme=x], [data-xds-theme=x]) to ([data-astryx-theme], [data-xds-theme]); on-media :is([data-*-media]) :is(.astryx-*, .xds-*); reset.css :where([data-astryx-media], [data-xds-media]) regexes. All 232 theme tests pass.
ejhammond
requested review from
cixzhang,
imdreamrunner,
josephfarina,
marie-lucas,
nynexman4464 and
thedjpetersen
as code owners
June 18, 2026 23:59
|
@ejhammond must be a member of the Meta Open Source team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
apps/sandbox/.claude/CLAUDE.md is a build-regenerated agent-docs artifact that got swept into the part-1 fixup commit. Restore to the integration baseline — it's out of scope for the P4 dual-emit work.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ejhammond
added a commit
that referenced
this pull request
Jun 19, 2026
…g astryx.css (#2928) * P4 (part 1): dual-emit astryx-* + xds-* base classes in xdsThemeProps xdsThemeProps() now emits BOTH the new astryx-* and legacy xds-* base class (e.g. 'astryx-button xds-button primary sm') so new consumer CSS can target astryx-* while existing xds-* selectors keep matching through the compat window. Variant tokens (primary, sm, level-1) are unchanged. Uses the stableClassName/legacyStableClassName helpers from the naming module. Updates xdsThemeProps.test.ts assertions to the dual-class form. Component tests that use toContain/toHaveClass/querySelector on xds-* keep passing (the xds-* class is still present); exact-match assertions (P6 scope) will be swept separately. Part of P4 (source-of-record renames); CSS dual-emit sub-part. * P4 (part 1 fixup): update remaining class assertions + FormLayout snapshots - xdsThemeProps.test.ts combined assertion -> dual-class form - regenerate 3 XDSFormLayout snapshots (astryx-form-layout prepended to xds-form-layout; otherwise byte-identical) Full core suite: 3152/3152 pass with the class dual-emit. * P4 (part 3): rename internal Population B data-attrs to data-astryx-* Renames the self-contained internal data attributes in place (no dual-emit per P0 decision 2 — these are not consumer-observable contracts): data-xds-token{,-id,-value}, data-xds-dictation-interim, data-xds-scrolling, data-xds-trigger-anchor, data-xds-highlight-{dynamic,styles}, data-xds-edge-comp, data-xds-toast-fallback -> data-astryx-*. Each attr's write (setAttribute/JSX) and read (querySelector/stylex :is()/:has()) sites are co-located within the same component module and moved together, so there is no contract break. 14 source + test files; 150 tests across Chat/CodeBlock/Layout/Toast pass. Deliberately EXCLUDED (not in this unit): - data-xds-theme / -theme-prose / -media / -id — Population A, dual-emit + @scope-coupled (theme CSS generation). Handled in the data-attr dual-emit unit. - data-xds-syntax-theme — read by generated syntax CSS at runtime (coupled). * P4 (part 5): emit sibling astryx.css alongside xds.css The CSS build now writes dist/astryx.css with byte-identical content to dist/xds.css (verified: same md5), and package.json exports './astryx.css'. Gives consumers a forward-named import path ('@xds/core/astryx.css') during the compat window. Layer name stays @layer xds-base until final cutover (P10). dist/ is gitignored (build artifact); committing the build script, the astryx.css.d.ts type stub, and the package export only. * P4 (part 2): dual-emit Population A theme data-attrs + @scope selectors Population A (consumer-observable theme attributes) now dual-emit both the new astryx-* and legacy xds-* forms, and the theme-CSS generators (both the runtime generateThemeRules.ts and the static build-theme.mjs path) scope to either form. Writers: - XDSTheme.tsx: documentElement gets both data-astryx-theme + data-xds-theme; injected <style> markers use the naming helpers (cleanup query matches). - XDSMediaTheme.tsx: dual-emits data-astryx-media + data-xds-media. - reset.css: color-scheme rule matches :where([data-astryx-media], [data-xds-media]). Generators (kept in SYNC): - generateThemeRules.ts: new themeScopeStart()/THEME_SCOPE_TO/mediaSelector()/ componentClassSelector() build dual-prefix selector-lists for @scope start, @scope limit, on-media surfaces, and .astryx-/.xds- component overrides. - build-theme.mjs: mirrors the same dual-prefix helpers on the static path. Layer names unchanged (xds-base/xds-theme) per P0 decision 4. Package scope still @xds/*. Next: source rename + generator inversion (part 4). * P4 (part 2 fixup): update theme-CSS tests for dual-prefix @scope output generateThemeRules + onMediaTokens tests asserted the old single-prefix CSS shape. Update to the dual form: @scope ([data-astryx-theme=x], [data-xds-theme=x]) to ([data-astryx-theme], [data-xds-theme]); on-media :is([data-*-media]) :is(.astryx-*, .xds-*); reset.css :where([data-astryx-media], [data-xds-media]) regexes. All 232 theme tests pass. * Drop accidentally-committed regenerated CLAUDE.md apps/sandbox/.claude/CLAUDE.md is a build-regenerated agent-docs artifact that got swept into the part-1 fixup commit. Restore to the integration baseline — it's out of scope for the P4 dual-emit work. (cherry picked from commit 3eb6bf0)
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The non-rename portions of P4 — the dual-emit compat surfaces that let consumers adopt
astryx-*whilexds-*keeps working. The big source rename (part 4) is intentionally a separate follow-up PR.(1) CSS class dual-emit
xdsThemeProps()now emits both base classes:astryx-button xds-button primary sm(viastableClassName+legacyStableClassName). Variant tokens unchanged.(2) Population A theme data-attr dual-emit + @scope
Consumer-observable theme attributes dual-emit, and BOTH theme-CSS generators scope to either prefix:
XDSTheme.tsx:documentElementgetsdata-astryx-theme+data-xds-theme; injected<style>markers use naming helpers.XDSMediaTheme.tsx: dual-emitsdata-astryx-media+data-xds-media.reset.css::where([data-astryx-media], [data-xds-media]).generateThemeRules.ts(runtime) +build-theme.mjs(static) — newthemeScopeStart/THEME_SCOPE_TO/mediaSelector/componentClassSelectorhelpers build dual-prefix@scopestart/limit, on-media surfaces, and.astryx-/.xds-component overrides. Kept in SYNC.(3) Population B internal data-attrs
Renamed in place to
data-astryx-*(token/dictation/scrolling/trigger-anchor/highlight/edge-comp/toast-fallback) — internal plumbing, write+read co-located, no consumer contract.(5) Sibling astryx.css
Build emits
dist/astryx.css(md5-identical toxds.css) +./astryx.csspackage export. Layer name stays@layer xds-baseper P0 decision 4.Not in this PR (P4 part 4)
The 320-file source rename (
XDS*.tsx→ bare canonical) + compat-generator inversion + 101 barrel regenerations. That's the largest, highest-risk change and gets its own staged, reviewed PR.Validation
Full
@xds/corevitest suite: 3152/3152 pass. Updated the ~11 exact-match class/scope assertions + 3 FormLayout snapshots to the dual form (all othertoContain/toHaveClassassertions stayed green sincexds-*is still present).Package scope stays
@xds/*; layer names unchanged. CI note: integration-branch PRs don't auto-run CI; validated locally. (A pre-existingDateRangePresetTS2308 from the integration base — fixed on main by #2925/#2926, awaiting sync — blocks the fulltscbuild but is unrelated to these changes; vitest validates independently.)