Repository navigation
chore(storybook): resolve StyleX merges the way the published CSS does - #12327
josephfarina wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Requesting changes. Matching Storybook's StyleX resolution to the published build is the right fix and Storybook builds cleanly with it, but two points need attention first.
- The Layer story longhands do not say the same thing as the shorthands they replace:
var(--color-border-default)is defined nowhere, so the oldbordershorthand painted no border, while the newborderWidth/borderStyle/borderColorpaint a 1px black (currentColor) border on every Layer popover and dashed black borders on the Context Menu Press zones (apps/storybook/stories/Layer.stories.tsx:19-21and:35-37); pointborderColorat a defined token such as--color-borderand mention the visible change, or drop those three longhands. - The description says "Full story sweep: see the comment below", but no such comment exists on the pull request; post the sweep or remove that line.
Non-blocking: packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs says it uses the same resolution as Storybook but still sets styleResolution: 'application-order', so consider dropping that line in this change too.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: Storybook compiled StyleX with application-order while the published Core build uses StyleX's default, property-specificity. Verified: the removed lines in both Storybook configs;
packages/core/babel.config.jsonsets no resolution; StyleX 0.19.1 defaults to property-specificity. - Claim: the two modes resolve a shorthand after its longhand, or a component longhand followed by a caller's xstyle shorthand, differently, and a Markdown blockquote shows it. Verified in code: Blockquote's
marginInlineStart/marginInlineEndlonghands (Blockquote.tsx:43-44) against Markdown's callermarginInlineshorthand (Markdown.tsx:391-393,:1748). - Claim: both Storybook StyleX configs now leave the resolution unset. Verified (
.storybook/main.ts:207-218,vite.config.ts:23-34). - Claim: the default rejects
border,borderTop,borderBottomandbackgroundinstylex.create(), as it does for Core. Verified: StyleX throws for them in this mode, and the Astryx wrapper sets validation to throw (packages/build/src/vite.ts:725). - Claim: six stories used them and now use longhands that say the same thing, with the same values. Six stories and the same values verified; "say the same thing" is false for two Layer styles (first finding).
- Claim: inline
style={}props are unchanged. Verified (Layer.stories.tsx:200,:327). - Claim: the baseline manifest has 516 shots (348 Neutral, 168 probe) and none move. Counts verified; the no-move result was not re-run across all 516, and the touched baselined stories captured here are pixel-identical.
- Claim: a full story sweep is in a comment below. False (second finding).
- Claim: Storybook builds both ways and every story compiles under the published resolution. Verified: Storybook builds at both the head and the base.
- Claim: no component, public API, default or interaction changes. Verified: only
apps/storybookchanges. - File
apps/storybook/.storybook/main.ts: clear. - File
apps/storybook/vite.config.ts: clear. - File
apps/storybook/stories/ChatAutoScroll.stories.tsx: clear. - File
apps/storybook/stories/FormLayout.stories.tsx: clear. - File
apps/storybook/stories/GridMasonry.stories.tsx: clear. - File
apps/storybook/stories/Layer.stories.tsx: first finding. - File
apps/storybook/stories/Layout.stories.tsx: clear. - File
apps/storybook/stories/UseContainerReveal.stories.tsx: clear.
…se test build matches Storybook again
Full story sweepEvery story in this Storybook (2,920), built twice from the same tree: once with Moves that reproduce (same picture on a second capture in each build):
Noise (changes between two captures of the same build): streaming and animated stories in Accepted baselines: 0 of 516 move. No moved story is in the baseline set. The crumb menu position is what the published CSS renders today; Storybook now shows it too. Whether that offset is intended is tracked separately and is not changed here. |
There was a problem hiding this comment.
Requesting changes. The Layer border and Table fixture fixes from the last round are in, the story sweep is posted, and Storybook builds and renders as described, but one required check still fails.
- Miss: the required
lintcheck fails becauseapps/storybook/stories/GridMasonry.stories.tsx(lines 47 and 61) and the touchedapps/storybook/stories/ChatAutoScroll.stories.tsxare not Prettier-formatted; runpnpm exec prettier --writeon both files and push.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: Storybook compiled StyleX with application-order while the published Core build uses the default, property-specificity. Verified: the removed lines in both Storybook configs; Core's Babel config sets no resolution; StyleX 0.19.1 defaults to property-specificity.
- Claim: the two modes resolve a shorthand after its longhand, or a component longhand followed by a caller's xstyle shorthand, differently, as a Markdown blockquote shows. Verified in code (Blockquote longhands against Markdown's
marginInline), and the Breadcrumb menu capture shows the same pattern. - Claim: both Storybook StyleX configs now leave the resolution unset. Verified (
.storybook/main.ts:210-211,vite.config.ts:27-28). - Claim: the default rejects
border,borderTop,borderBottomandbackgroundinstylex.create(), as for Core. Verified: StyleX throws for them in this mode, and the head Storybook builds with the longhands. - Claim: six stories used them and now use longhands that say the same thing. Verified: six files; the Layer captures are pixel-identical to the base and the other stories keep the same values.
- Claim: the Layer story's two borders used an undefined variable, so dropping them keeps the old picture. Verified: nothing defines the variable, and both Layer captures are pixel-identical.
- Claim: inline
style={}props are unchanged. Verified: the diff touches none. - Claim: the Table virtualization release test build matches Storybook again. Verified (
TableVirtualization.release.vite.mjs:14-17). - Claim: 516 accepted baseline shots (348 Neutral, 168 probe) and none move. Counts verified; consistent, since neither moved Breadcrumb story is baselined and the baselined menu-crumb story keeps its menu closed; the full comparison was not re-run.
- Claim: a full story sweep is in a comment. Verified: the comment exists, and its two Breadcrumb moves reproduce (the menu's margin goes from 4px to 0px).
- Claim: Storybook builds both ways and every story compiles. Verified: head and base builds pass.
- Claim: no new public API, default or interaction model. Verified: only Storybook config, stories and a test-only build config change.
- File
apps/storybook/.storybook/main.ts: clear. - File
apps/storybook/vite.config.ts: clear. - File
apps/storybook/stories/ChatAutoScroll.stories.tsx: lint finding. - File
apps/storybook/stories/FormLayout.stories.tsx: clear. - File
apps/storybook/stories/GridMasonry.stories.tsx: lint finding. - File
apps/storybook/stories/Layer.stories.tsx: clear. - File
apps/storybook/stories/Layout.stories.tsx: clear. - File
apps/storybook/stories/UseContainerReveal.stories.tsx: clear. - File
packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs: clear.
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet. The formatting fix from the last round is in, every changed file is Prettier-clean, and the required lint check passes, so nothing in the change blocks. CI stopped at its capacity check ("CI is full") before test, build and docsite-test ran; re-run the CI jobs once there is room, and the merge guard waits for them to pass.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: Storybook compiled StyleX with application-order while the published Core build uses the default, property-specificity. Verified: the removed lines in both Storybook configs; Core's Babel config sets no resolution; StyleX 0.19.1 defaults to property-specificity.
- Claim: the two modes resolve a shorthand after its own longhand, or a component longhand followed by a caller's xstyle shorthand, differently, as a Markdown blockquote shows. Verified in code (Blockquote's margin longhands against Markdown's
marginInline); the Breadcrumb menu capture shows the same pattern. - Claim: both Storybook StyleX configs now leave the resolution unset. Verified (
.storybook/main.ts:210-211,vite.config.ts:27-28). - Claim: under the default, StyleX rejects
border,borderTop,borderBottomandbackgroundinstylex.create(), as for Core. Verified: the StyleX plugin throws for each of them, and the head Storybook builds with the longhands. - Claim: six stories used them and now use longhands that say the same thing. Verified: six files with the same values; the Layer and Masonry captures are pixel-identical to the base.
- Claim: the Layer story's two borders used an undefined variable, so dropping them keeps the old picture. Verified: nothing defines the variable, and the Layer capture is pixel-identical.
- Claim: inline
style={}props are unchanged. Verified: the diff touches none. - Claim: the Table virtualization release test build matches Storybook again. Verified (
TableVirtualization.release.vite.mjs:14-17). - Claim: 516 accepted baseline shots (348 Neutral, 168 probe) and none move. Counts verified; consistent, since no story that moves is baselined; the full comparison was not re-run.
- Claim: a full story sweep is in a comment. Verified: the comment exists, and its two Breadcrumb moves reproduce (the menu's top margin goes from 4px to 0px).
- Claim: Storybook builds both ways and every story file compiles under the published resolution. Verified: the head static build passes; the base build passed in the last round on the same base.
- Claim: no new public API, visual representation, default or interaction model. Verified: only Storybook config, stories and a test-only build config change.
- File
apps/storybook/.storybook/main.ts: clear. - File
apps/storybook/vite.config.ts: clear. - File
apps/storybook/stories/ChatAutoScroll.stories.tsx: clear (formatting fixed). - File
apps/storybook/stories/FormLayout.stories.tsx: clear. - File
apps/storybook/stories/GridMasonry.stories.tsx: clear (formatting fixed). - File
apps/storybook/stories/Layer.stories.tsx: clear. - File
apps/storybook/stories/Layout.stories.tsx: clear. - File
apps/storybook/stories/UseContainerReveal.stories.tsx: clear. - File
packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs: clear.
- #12784 fix(Breadcrumbs): the menu crumb's menu slides in from the crumb in published builds Author: Joey Farina <[email protected]> - #12327 chore(storybook): resolve StyleX merges the way the published CSS does Author: josephfarina <[email protected]> - #12564 fix(Toast): a toast's card draws on the right side from the first paint Author: Joey <[email protected]>
|
Landed in #12811. |
User impact
Storybook showed some components differently from what npm users get. Storybook compiled StyleX with
styleResolution: 'application-order', and the published Core build uses StyleX's default,property-specificity. The two resolve some merges differently: a shorthand after its own longhand, or a component's longhand followed by a caller'sxstyleshorthand. So a story could look right while the shipped component did not. A Markdown blockquote in a page template is one example.Problem and solution fit
Storybook is where a component's look is reviewed and its visual baselines are taken, so it has to resolve styles the way the published CSS does. Both Storybook StyleX configs now leave
styleResolutionunset and get the same default as the published build.Under
property-specificity, StyleX rejects a few shorthands instylex.create()(border,borderTop,borderBottom,background), as it does for Core itself. Six stories used them in their own demo styles. Each one now uses the longhands that say the same thing (borderWidth/borderStyle/borderColor,backgroundColororbackgroundImage). The Layer story's two borders pointed at an undefined variable, so the old shorthand painted no border; those two styles now drop the border, which keeps the old picture. Inlinestyle={}props are unchanged. The Table virtualization release test build, which uses Storybook's resolution, matches it again.Expected behavior and authority
A story renders what the published package renders.
Smallest restoration
apps/storybook/vite.config.tsandapps/storybook/.storybook/main.ts: dropstyleResolution: 'application-order'.stylex.create()styles, with the same result.TableVirtualization.release.vite.mjs: drop the same option.Evidence
.github/visual-baseline/manifest.json(516: 348 Neutral light/dark, 168 probe light/dark), captured from a Storybook built each way at the baseline viewport. 0 of 516 move.Scope
Components: none (Storybook configuration and story demo styles)
Testing
storybook build); every story file compiles under the published resolution.