Repository navigation
fix(build): split Astryx and product styles into their cascade layers in a production build - #5410
Merged
Merged
Conversation
… but unsettable collectThemingVars joins collectThemingTargets as part of the one theming enumeration, and two checks ride on it. A documented public var no component reads compiles to a declaration that never applies (#5012). A var the component writes inline outranks every cascade layer, so no theme can reach it (#4530). Both shipped, and neither is visible in the generated theme CSS, which is the artifact the jsdom suites assert on.
StyleX emits its rules into its own top-level @layer priority1...priorityN. The dev server re-serves those wrapped in astryx-base and the pre-compiled astryx.css ships them wrapped, but a Vite build did neither, so the priority layers sorted after astryx-theme and outranked it. Every components: {} override a theme sets was silently dropped in the built app while working in dev. All seven shipped themes carry components: blocks, so this changes what a built app renders. theme-var-reachability.js drives Chromium against the built Storybook and fails when a theme's declaration does not land on the element; it fails on all four documented public vars before this fix and passes after.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… wrap both The previous commit wrapped everything StyleX emitted in the library layer. That fixed the theme and broke the app: product StyleX landed below astryx-theme too, so a theme could silently restyle code it does not own. Partition by source file, the way the dev server always has. StyleX's shared rule store is reachable at build time and is keyed by absolute source path, which is the only place the origin survives — by the time the CSS is text it is gone, so the wrap had nothing sound to split on. Both plugins now call one renderSplitLayers helper; the lifecycles differ, the partition does not. The replacement runs the same lightningcss pass StyleX does, or the build would quietly lose the vendor prefixes the original output had. Tests: vite.build.test.ts runs a real Vite build of a fixture app that renders an Astryx component and authors its own StyleX, then reads the emitted stylesheet. theme-layer-cascade.js renders that build in Chromium and asserts Astryx < theme < product, which no jsdom test can. Both were watched failing against the unsplit and the wrapped builds.
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
August 24, 2026 14:02
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
It was in pr-a11y, which runs only when packages/core or packages/lab changed. What it guards is packages/build, so on this PR — the one that changes the splitting logic — it did not run at all.
An app that imports no stylesheet of its own gives StyleX no bundle asset to append to, so it writes assets/stylex.css itself — outside Rollup's graph, which means Vite's HTML plugin never learns about it and emits no <link>. The app shipped every Astryx style correctly split into layers and a completely unstyled page. Importing any stylesheet hides it, which is why it survived: one line of the project's own CSS and the symptom disappears. Only orphans are linked. A stylesheet a page already references is Vite's, and touching it would load it twice; a build with no HTML at all — library mode — is left alone, because its consumer imports the CSS themselves. The build test now covers both emission paths as two fixtures running the same assertions, including that the page links the stylesheet exactly once. Verified across app shapes: css-import, no-css-import, no-product-StyleX (no empty product layer), multiple entries, library mode, write:false, minify on and off, and an app with no Astryx at all (no spurious build failure).
cixzhang
marked this pull request as ready for review
August 24, 2026 16:34
cixzhang
added a commit
that referenced
this pull request
Aug 27, 2026
* feat(Spinner): make size diameters and rail width themeable
The size prop stays a fixed enum ('sm' | 'md' | 'lg' | 'xl'). A theme can now
redefine what each named size resolves to — its diameter and the rail (ring
stroke) width — via the --_spinner-diameter and --_spinner-rail-width custom
properties on the size-variant target, e.g.
spinner: { 'size:xl': { '--_spinner-diameter': '40px' } }.
Spinner is canvas-drawn, so CSS custom properties do not reach the paint
automatically. The draw effect reads the resolved vars back off the canvas via
getComputedStyle (falling back to the built-in SIZES constants), mirroring the
existing shade='inherit' read-back, and the wrapping box tracks the same vars
in CSS with calc(). Output is byte-identical when no theme overrides them.
* feat(Spinner): make the ring's geometry and colors themeable through public vars
Reworks the theming surface after review. Three things were wrong with the
first pass, and adding themeable color makes a fourth worth having.
Public vars, not private ones. `--_*` means "the pipeline sets this, not you":
`validatePrivateVars` reports every theme that writes one, so the API the docs
and changeset advertised was one the build refuses. The four vars are now
`--spinner-diameter`, `--spinner-rail-width`, `--spinner-color` and
`--spinner-track-color`, set directly under a size- or shade-variant key —
the `--button-focus-offset` / `--tree-list-indent` precedent. Derived vars are
the other route and are wrong here: the ring is painted on a canvas, so
`width` would name a box the element does not have, and mapping `color` would
take the label's text color with it.
Only px survived. `parseFloat` on an unregistered custom property reads the
SPECIFIED value, so a themed `2.5rem` drew a 3.25px ring inside a 52px box and
`calc()` drew the fallback. The two geometry vars are registered as `<length>`
(CSS.registerProperty, guarded and idempotent), which makes their computed
value an absolute px length: rem, em and calc all arrive resolved. A rail of
`0` is now honoured too — it read as "absent" through `||` and fell back to
the default, drawing a 36px ring in a 28px box that `overflow: hidden` then
clipped.
Box and ring only agreed at mount. The draw ran on [shade, size, themeTokens],
so a var change no dependency could see left the box resized and the ring
where it was. The box is sized from the same vars, so its resize IS the
signal: a ResizeObserver on it redraws, and a cheap key check keeps that to
one draw on mount. This also covers a media query swapping the var, and a root
font-size change moving a rem.
Color, the new part, goes through a real `color` property rather than a custom
property read back raw — the arc on the canvas, the track on the box it sits
in. That indirection is what resolves `var()`, `color-mix()` and the
`currentColor` the inherit shade is built on into something canvas can stroke;
a registered `<color>` custom property computes `currentColor` to the literal
string. It generalizes the read-back the inherit shade already used, and the
per-shade tokens move from JS into the CSS fallbacks, leaving one code path.
The onMedia track's `4D` hex suffix becomes globalAlpha 77/255 — the same
composite, no longer requiring the token to be hex.
Verified in Chromium against builds of main, of the reviewed commit, and of
this one: the 16 size x shade defaults are pixel-identical to main (canvas
bitmaps compared as data URLs), every themed spelling above now draws a ring
that matches its box, and each of the five color cases changes the painted
output where it was previously inert.
The six previous tests passed against an unmodified Spinner. These fail
against main: 10 of them, covering which element declares each var, what each
size and shade resolves to, and that a themed value reaches the target.
build.public-component-vars.test.mjs runs the real builder over the documented
snippet — the check that would have caught the private-var problem. It asserts
on the receipt's warnings, not a rejection: the build reports a private var
and then emits its CSS anyway, which is why a throwaway build read as a pass.
Also fixes the doc drift the review noted, in the lines this touches: `size`
omitted xl and called 28px "36px" (that is the box), and the component was
described as having three sizes and two shades.
* fix(Spinner): type the theme-CSS test helper from defineTheme's own input
`Record<string, unknown>` does not satisfy ComponentStyleMap, so
`pnpm -F @astryxdesign/core typecheck` — which covers tests, and which I had
run before writing them rather than after — failed in CI.
* fix(Spinner): stop a flex host shrinking the box out from under the ring
Found auditing the 23 internal Spinner call sites. Several components paint a
spinner inside a fixed-size control and are flex containers: a Switch thumb is
14×14 at the smallest size — exactly the default box, zero headroom — and a
CheckboxInput indicator is 20×20.
The box carries no `flex-shrink`, so it defaults to 1 and the parent is free to
compress it. The canvas is not laid out by that parent, though: it keeps
drawing at whatever the vars resolve to. Today the two never disagree, because
the diameter cannot be themed. Once it can, they do — measured in Chromium with
`--spinner-diameter: 24px`:
Switch sm (off) ring 32px in a 14px box ring painted outside its own box
Switch md (on) ring 32px in a 20px box "
CheckboxInput sm ring 32px in an 18px box "
and `overflow: hidden` on the box then clips the ring it is meant to contain.
With `flex-shrink: 0` all six report 32/32: the box and the ring stay the same
measurement, so a themed size that does not fit its host overflows visibly at
the host rather than being silently cut in half.
Defaults are untouched — all 26 measured size × shade cases are identical
before and after, and the whole suite passes.
* fix(Spinner): let a theme's geometry actually reach the ring
The four public vars were documented as themeable, and the theme pipeline
emitted the right rule for them, but a themed diameter or rail width had
no effect in a browser: the default rings and the themed rings measured
identically (14/20/24/36px in both rows of the new Storybook story).
StyleX assigns custom-property declarations priority 0 and emits priority-0
rules OUTSIDE its cascade layers (babel-plugin: `useLayers && pri > 0`),
while a theme's component overrides are injected into `@layer astryx-theme`.
Unlayered declarations beat every layer regardless of specificity, so
`sizeStyles` declaring `--spinner-diameter: 10px` shadowed the theme's
`.astryx-spinner.sm { --spinner-diameter: 1rem }` permanently. The two color
vars were never affected, because they are read with the shade's token as a
`var()` fallback and never declared — which is exactly the shape the geometry
now uses too.
Each size now resolves into a private `--_spinner-ring-*` pair:
--_spinner-ring-diameter: var(--spinner-diameter, 10px)
so the theme's declaration is the only declaration of the public var, and the
size's default applies precisely when there isn't one. The registration moves
to the private pair with it — registering the public vars would give them an
initial value, and a registered property is never guaranteed-invalid, so the
`var(..., default)` fallback would stop firing and every unthemed spinner
would draw at 0px.
Measured in Chromium against the built Storybook:
default sm 14 md 20 lg 24 xl 36 (unchanged)
themed sm 20 md 32 lg 42 xl 52 (was 14/20/24/36)
The themed values are `rem` and `calc(2rem + 8px)`, so this also shows the
registered length resolving rather than being read as text. A rail of `0`
draws a 28px ring in a 28px box, unclipped. Sizes, shades and the labelled
layout are pixel-identical to before.
Also here, from the review notes on the first version:
- Deleted the computed-style assertions from Spinner.test.tsx. They passed
against an unmodified Spinner.tsx, and per the rubric's V4 they were slop —
worse, two of them asserted the very declaration that made the feature
inert. What's left asserts the theme routing (a size key must land on
`.astryx-spinner.xl`, not on the bare target), which is a real contract.
- Extracted the geometry fallback into `resolveRingGeometry`, with tests for
the deliberate asymmetry: diameter 0 falls back, rail 0 is honoured.
- Made the CLI's public-var test doc-driven — it now scans every `*.doc.mjs`
and builds a theme naming every non-private, non-derived var, so a new
component gets the check for free. Filtered on the `private` flag rather
than the `--_` prefix, so a mis-prefixed var is caught instead of skipped.
- Storybook: `ThemedGeometry` and `ThemedColor` stories, and the `shade`
argTypes had gone stale (missing `subtle` and `inherit`).
* chore(Spinner): separate the two non-theming changes out of this PR
The flex-shrink fix moves to #5484, against main: a flex host narrower than
the spinner compressed its box while the ring kept drawing at full size, and
that is a bug with or without themeable geometry. Its changeset goes with it.
The inline-size to CSS-size change stays here — the box has to read the same
vars as the ring — but it is a behaviour change on shipped surface rather than
part of the feature, so it gets its own [breaking] changeset saying what flips:
a caller's inline style width now wins over the box, where the component's
inline size used to win. Tagged [breaking] because it is the tier that surfaces
in Breaking Changes; say the word if you would rather it were a [fix] patch.
* docs(Spinner): say what a themed rail of 0 does, and stop the stories claiming a default row they do not show
A rail of 0 paints nothing. One stroke-width drives both circles, so zeroing
it zeroes the arc with the track — measured: box 28x28, r 14px, stroke-width
0px, an empty box that still announces "Loading". That is what a zero-width
stroke means in SVG, and 'an arc with no track' is already expressible as
--spinner-track-color: transparent, so the docs now say so instead of promising
a trackless arc the value cannot produce. The story that promised it becomes a
1px hairline rail over a transparent track (box 30x30, r 14px, stroke 1px),
which is the thing it was trying to show.
The 'Default —' rows in the themed stories were not default. A Theme with no
parent Theme syncs its name onto the document root so its @scope'd component
rules reach portals, which also means they reach spinners rendered outside the
provider: in a page holding both rows, the unthemed row measured 20/30/40/52
- the themed numbers, not 14/20/24/36. The rows are removed rather than
relabelled, one Theme per story, with the unthemed reference named.
* refactor(Spinner): declare the public vars, now that #5410 layers the StyleX CSS
This PR was built around a cascade bug that main has since fixed. StyleX gave
custom-property declarations priority 0 and emitted priority-0 rules outside
its layers, so a StyleX-declared '--spinner-diameter: 10px' outranked the
theme's own '@layer astryx-theme' rule and the documented var did nothing. The
workaround was to never declare the public var and read it with the size's
default as a var() fallback, leaving the theme's declaration the only one.
#5410 splits the compiled CSS into '@layer astryx-base' and the product layer,
so a component declaration now loses to a theme rule the way it always should
have — measured: TreeList and Button's four previously-inert vars all reach
now, and so do these.
The fallback shape also fails main's new theme-var-reachability guard, and
fairly: it finds a var's declaring element and checks a theme rule against the
documented target class wins there. With nothing declaring the var there is no
element to check, so all four read as unreachable — a documented var no theme
appears able to set.
So sizeStyles and the new shadeStyles declare all four public vars on the
element carrying the 'spinner' theme target, and everything downstream reads
them: the box and the ring through the registered <length> pair (still
private, still registered, so a themed rail of 0 stays a zero-width stroke
instead of poisoning the calc()), the circles through 'stroke'. The declaration
sits on the span, or on the wrapper when a label moves the target there -- never
both, or the span's own default would shadow a theme's value on the wrapper.
The four public vars stay unregistered on purpose: a registered property has an
initial-value, so every element in the document would report a value and the
guard would resolve the declaring element to <html>.
Chromium, rebuilt: defaults 14/20/24/36 with r 5/7/9/14 and stroke 2/3/3/4,
identical to a build of origin/main; themed rem/calc geometry 20/30/40/52 with
stroke 2/3/4/6; colour vars, color-mix and a transparent track all applied;
labelled case themed through the wrapper (52, r 20, stroke 6) and unthemed at
36. The reachability guard reports all four vars reaching, alongside Button's
and TreeList's.
* perf(Spinner): register the geometry vars at import, not at first mount
Addresses the review on #5214.
`registerSpinnerVars()` ran from the ring's ref callback, so both registrations
landed when the first spinner mounted. Registering an inherited property with
an `initial-value` invalidates style for the whole document — and a spinner is
the loading indicator, so that lands on a page that has already rendered, with
someone already waiting. Measured on an 11,204-element page, mounting one cost
a median 29.1 ms against 12.1 ms with the call at module scope (five runs each,
Chromium, same bundle but for this line).
At module scope the registration happens while the module is evaluated, which
for a bundle loaded in the head is against an empty tree.
Both of the reasons the call was in the callback turn out not to hold:
- **The server render.** The `typeof CSS === 'undefined'` guard already inside
the function covers it, and importing the built module under plain node with
no DOM returns without throwing.
- **A bundler's reach.** Core's `sideEffects` allowlist does not name this
file, so a build that never imports `Spinner` drops the module whole and the
registration with it — verified: a bundle rendering only `Text` contains no
`registerProperty` at all and reports no value for the var, while one
rendering `Spinner` registers and draws. A bundle that renders a `Button`
also registers, because `Button` imports `Spinner` for its loading state —
that dependency is real, and an app with buttons is an app that will show a
spinner.
The `didRegisterVars` flag goes with it. At module scope the call cannot run
twice in one evaluation, and across two evaluations — a second copy of the
package, a fast refresh — each gets its own flag, so it never guarded that case
either. The `try`/`catch` is what makes a duplicate registration safe, and it
still does.
Two tests pin the timing: one asserts both properties are registered by the
import alone, with nothing rendered, and one asserts a throwing
`registerProperty` does not take the module down. Both fail if the call moves
back into the ref callback.
Themed geometry still resolves through the cascade, checked in Chromium against
this build: `--spinner-diameter: 40px` on `size:xl` gives a 48px box and r=20px,
`--spinner-rail-width: 0px` on `size:lg` gives stroke-width 0 with the box still
at its 18px — the `calc()` case the registration exists for — and an unthemed
`md` is unchanged at 20px / r=7.
* fix(Spinner): rename the stroke var, keep the box's sizing precedence, drop pathLength
Three things from review, all on the public contract rather than the
mechanism.
1. `--spinner-rail-width` is now `--spinner-stroke-width`. The old name reads
as the stationary track — and `--spinner-track-color` beside it made that
the natural reading — while it is the stroke width of both circles, so a
themed 0 takes the moving arc with the track. Not split into two widths:
nothing has asked to set the arc and the track independently, and a var per
circle is a wider public contract than the demand for it. The private
resolved var follows (`--_spinner-ring-stroke`), and the doc entry in both
locales now leads with the one-width-drives-both fact.
2. The box keeps its own size ahead of a caller's inline width, as it always
has. Sizing it from the themed vars had moved the declaration out of the
inline style and into a rule, which handed a `style={{width}}` a precedence
over the box it never had. The size is composed into an unregistered
`--_spinner-box-size` and applied inline after the caller's `style`, exactly
where the number used to go, with the size's own frame as the `var()`
fallback for a render with no stylesheet. Measured against a build of main:
`style={{width: 999}}` leaves a 36x36 box on both, and the caller's other
style properties still apply. The `[breaking]` changeset goes with it —
there is no behaviour change left to describe.
3. `pathLength` is gone; the themed dash is composed instead. Normalizing to
the default circumference rescales the pattern against the path length the
UA measures on its own approximation of the circle — 87.398 against the
87.965 of pi x 28 — which shortened the default arc by 0.64% and moved the
cap by half a pixel, 191 changed pixels on an xl spinner against main. The
rule now multiplies the resolved diameter by the arc and gap fractions,
which is exact at the default and scales the same way when a theme moves the
diameter: every themed row measures 135.000 degrees of arc.
Verified in Chromium 149 against a build of origin/main: every size x every
shade x the labelled case x an inline-in-text case, at four frozen rotation
angles — 72 of 72 element screenshots byte-identical, geometry identical.
Through a built Storybook, the themed stories reach: rem and calc() diameters
give 20/32/42/52 boxes with 8/12/16/20 radii and 2/4/5/6 strokes, the hairline
story is a 30x30 box at 1px, and the reachability guard resolves all four
public vars on .astryx-spinner.
---------
Co-authored-by: freddymeta <[email protected]>
Co-authored-by: Cindy Zhang <[email protected]>
This branch was successfully 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.
Fixes #5095.
A theme's
components: {…}override works on the dev server and is silentlydropped in a production build. Every one of them — a colour, a radius, a public
custom property.
All seven shipped themes carry
components:blocks, 58 component keys betweenthem, and none has ever applied in a built app or in the deployed Storybook
preview. The neutral theme's destructive Button ("locked pastel red bg") renders
solid red there.
core-iconbutton--destructive— the shipped neutral theme asks for a pastel-red destructive button and gets a solid onecore-treelist--themed-guides— the theme recolours the connector lines and nothing happensCause
StyleX emits everything it collects into its own top-level
@layer priority1…priorityN, declared in a separate@layerstatement from@layer reset, astryx-base, astryx-theme, product;. A layer named in a laterstatement sorts after every layer named earlier, so the priority layers outrank
astryx-theme, and layer order beats selector specificity.The dev server does not have this bug:
astryx-split-layersre-serves StyleX'srules partitioned by source file — Astryx's own into
astryx-base, theapp's into
product. It is aconfigureServerhook, so a build got nothing.The pre-compiled
astryx.cssis wrapped too (scripts/build-css.mjs). The Vitebuild was the one path of three doing neither.
Measured,
CSS.getMatchedStylesForNodeon the destructive IconButton:The fix
astryx-build-layer-splitpartitions StyleX's collected rules by source fileand renders each half into its layer — the same partition the dev middleware
does, now from the same
renderSplitLayershelper. The lifecycles differ; thepartition cannot.
It has to be a partition and not a wrapper. Wrapping everything in
astryx-basefixes the theme and breaks the app: product StyleX lands belowastryx-themetoo, so a theme silently restyles code it does not own. Thepartition key only exists in
rulesById, which is keyed by absolute sourcepath — by the time the CSS is text, the origin is gone.
lightningcss: StyleX runs its collected CSS through it before emitting.
Regenerating the two halves without that pass silently dropped vendor prefixes
(4
-webkit-occurrences → 2), so the replacement runs the same pass.Where StyleX emits, and which paths are covered
Enumerated from
@stylexjs/unplugin/lib/vite.js, not assumed:generateBundle→ append to an existing CSS assetwriteBundle→ append to a file found inassets/writeBundle→ writeassets/stylex.cssfreshDEV_CSS_PATHAll three build paths end with the CSS in a file under
outDir, and this pluginis
writeBundle+enforce: 'post', so it runs after every one of them. Thatis why the work happens on disk rather than on the bundle: there is one case
there instead of three.
The third row also had a second defect. StyleX writes that file outside
Rollup's graph, so Vite's HTML plugin never learns about it and emits no
<link>— the app shipped every style correctly split into layers and acompletely unstyled page. Importing any stylesheet hides it, which is why it
survived. The plugin now links a stylesheet it patched that no page references.
Only orphans: a stylesheet Vite already linked is left alone, and so is a build
with no HTML (library mode, whose consumer imports the CSS themselves).
Build tests
packages/build/src/vite.build.test.tsruns real Vite production builds oftwo fixture apps — one importing a stylesheet, one importing none — through the
same assertions: Astryx's rules in
astryx-base, the app's11pxinproductand not in
astryx-base, neither layer carrying the other's class prefix, noStyleX rule outside the two, vendor prefixing intact, and the page linking the
stylesheet exactly once.
.github/scripts/theme-layer-cascade.jsrenders that build in Chromium, becausewhich declaration paints is a cascade fact and jsdom resolves none. Three
origins compete on one element:
Blue is the theme, orange is the app. Left: the app's own style loses. Right: it
wins.
It runs as its own
theme-layersCI job. The sibling Chromium guards live inpr-a11y, which fires only whenpackages/coreorpackages/labchanged —hosted there it skipped on exactly the PRs that can break it, as it did on this
one until I moved it. Its gate is now "any PR that is not docsite-only", which
covers
packages/build, the CLI's theme build,packages/core/src/theme, andthe scripts themselves.
Every assertion was watched failing, against four builds:
productlayerastryx-baseholds 0 Astryx rules,productis missing the app's11pxstylex.cssThe unit tests in
vite.test.tsare kept and rewritten for the split, but theyare not the evidence: they passed throughout both bugs.
App shapes checked
productblockwrite: false(in-memory)cssMinifyon and offThe two that can actually break the split — no-CSS-import and no-product-StyleX
— are now fixtures or assertions. Multiple entries and library mode are covered
by the same
writeBundlescan and are not separately fixtured;write: falseand the bare app are guard-against-spurious-failure cases, verified once.
The plugin fails the build if StyleX emitted rules and its CSS block cannot
be found — leaving a build unsplit would let product styles lose to a theme, so
silence is the wrong failure. Verified it fires when the block is genuinely
missed, and that none of the shapes above trips it.
What this changes for people
58 shipped theme-component overrides begin applying, and the visual
baselines move with them. Sampled 78 stories (every 13th in the catalogue plus
all 19 theme-override stories), each difference re-shot to rule out animation
noise: 21 change, and every one is a theme override that now works — 17
themed-*demos pluscore-iconbutton--destructive,core-alertdialog--delete,core-overflowlist--capped-multi-rowandcore-sidenav--end-content, which pick up the shipped theme's ownbuttonandbadgeoverrides. None is a regression. Three further stories differbetween two identical runs (animated canvas/WebGL) and are noise.
Builders keep what they had: an app's own styles still outrank a theme, which is
what the layer order has always promised and what the wrap would have taken
away.
Still open
The PostCSS path (
apps/docsite/postcss.config.js, used by the docsite andsandbox) has the same bug, and this PR does not fix it. Now measured rather
than assumed —
processStylexRuleswith that config emits:The priority layers are named after
astryx-themein the one statement, sothey outrank it exactly as before. It needs the same partition rather than a
reordering, because that pipeline compiles Astryx and docsite source together.
Written up on #5095, which this PR half-fixes.
Test plan
pnpm test— the build package is green (21 tests acrossvite.test.tsandvite.build.test.ts). CI runs the full suite.node .github/scripts/theme-layer-cascade.js→ 3/3, and fails on each mutantabove. Green in CI as
theme-layers.node .github/scripts/theme-var-reachability.js --storybook-dir apps/storybook/dist→ 4/4 after, 4/4 before the fix.
pnpm check:repoclean.