Repository navigation
chore: land 3 approved pull requests together (batch 7) - #12811
Conversation
…se test build matches Storybook again
On a system-mode page the server does not know the reader's scheme, so a Toast took the side its light-page tokens pick, and a dark-mode reader saw the info toast unreadable until script ran. The Toast now computes its side for both page modes from the theme. While the scheme is unknown it renders the light-page side and names the dark-page side in a private attribute. The theme compiler writes that side's surface rules again under the conditions that make the page dark, only for themes whose inverted surfaces flip (architecture:theme-compilation INV21).
…st as its first user
…ge side; Toast reads its side once Inside a surface that takes another side on a dark page, the root color-mode block of that side applies there and the other side's nearest-surface rule leaves it out, under the same dark-page conditions, so a Button with root mode blocks draws the right block before script names the side. The Toast's pre-measurement side comes from invertedSideIn alone.
The dark-page side is now named on the MediaTheme element itself, beside its light-page side. Its copy of the surface rules also undoes what only the light-page side's on-media overrides set: a token inherits again (revert-layer), and a component property takes the theme root's value for the same style key, else the base style. A light-page onDark button fill no longer reaches the close button on a dark page's first paint. INV21 says so; the INV18 row and colorModeBlocks test name allow INV21's rules.
…ad of reverting them On a dark page, a surface that names its light-page side and takes the other side gets none of the light-page side's rules (when the copy does not write each of them again), so the theme root's rules for every style key and mode apply as they would without them. This replaces the revert-layer undo, which also dropped the root's rules under other keys. MediaDarkPage is a client module. Tests about other rules use a theme whose surfaces keep their side.
…children's place MediaTheme always renders the nested MediaDarkPage provider, so a server-rendered toast's content keeps its place in the tree after hydration and focus stays on its close button. The dark-page copy's page conditions sit in :where(), as a root color-mode block's do, so a root state rule (a ghost Button's hover fill) wins there as it does once script names the side. The setup evaluator reads an Astryx media surface's own color-scheme as that surface's side, not as disabling dark mode; the CLI build tests allow a flipped surface's dark-page rules.
…es; width check matches the compiler setup-integrity exempts a color-scheme arm only when the surface's side attribute is on the compound itself, not inside a functional pseudo-class (body:not([data-astryx-media=light]) forces light on everything else and stays a finding). themeAdaptations.test.ts checks for the @media (width ...) form the compiler writes.
…k; adaptations follow the flipped side The dark-page mode-block rules match content on the nearest-surface chain with the flipped surface as its outermost link, so a dark surface nested in a flipped toast keeps the dark block at the first paint. An adaptation's color-mode blocks get the theme's dark-page sides as the root blocks do.
The menu set its gap to the trigger with a marginBlock on the layer. The layer zeroes marginBlockStart and sets a far-edge gutter on marginBlockEnd. Under property-specificity resolution, the published one, the longhands win, so the menu sat flush on the crumb, the entrance measured no room and took no step. Under application order the shorthand instead overwrote the far-edge gutter. The offset option sets both margins and keeps them through a flip, as DropdownMenu does.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/approve-spec e725afd |
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Toast · Storybook | 105.9 kB (+282 B) · 11.1 kB CSS (0) | 1,754 (+15) | — · — · — |
| lab/Comments | 379.6 kB (+137 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 372.6 kB (+123 B) · 2.4 kB CSS (0) | — | — · — · — |
16 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/DialogHeroHeader | 90.5 kB (+120 B) · 372 B CSS (0) | — | — · — · — |
| Overlay | 23.6 kB (+113 B) · 3.9 kB CSS (0) | — | — · — · — |
| Lightbox | 149.9 kB (+110 B) · 12.0 kB CSS (0) | — | — · — · — |
| charts/Chart | 242.1 kB (0) · 516 B CSS (0) | — | — · — · — |
| Breadcrumbs | 16.5 kB (0) · 3.4 kB CSS (0) | — | — · — · — |
| Markdown | 205.3 kB (0) · 22.2 kB CSS (0) | — | — · — · — |
| Table | 121.7 kB (0) · 19.9 kB CSS (0) | — | — · — · — |
| TableBody | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableCell | 104.7 kB (0) · 19.3 kB CSS (0) | — | — · — · — |
| TableFooter | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableHeader | 3.5 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 104.5 kB (0) · 19.2 kB CSS (0) | — | — · — · — |
| TableRow | 7.1 kB (0) · 4.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 76.7 kB (0) · 14.1 kB CSS (0) | — | — · — · — |
| lab/ListInput | 95.3 kB (0) · 922 B CSS (0) | — | — · — · — |
| BreadcrumbItem | 98.1 kB (−11 B) · 13.3 kB CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/core 7.70 MB packed (+8.5 kB); no new dependencies
- @astryxdesign/theme-butter 56.3 kB packed (+88 B); no new dependencies
- @astryxdesign/theme-chocolate 18.3 kB packed (+101 B); no new dependencies
4 more packages
- @astryxdesign/theme-matcha 29.8 kB packed (+100 B); no new dependencies
- @astryxdesign/theme-neutral 41.3 kB packed (+110 B); no new dependencies
- @astryxdesign/theme-stone 41.2 kB packed (+101 B); no new dependencies
- @astryxdesign/theme-y2k 45.4 kB packed (+101 B); no new dependencies
Wide change (shared styles: packages/core/src/theme/MediaDarkPage.tsx, packages/core/src/theme/MediaTheme.tsx, packages/core/src/theme/generateThemeRules.ts, and 2 more): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approved pending CI. CI has not finished on this head yet, and the merge guard waits for it to pass.
The three fixes land cleanly together. The new Breadcrumbs and Toast tests fail before the change and pass with it, and the record change has an engineering owner's approval at this head. There is no public API change.
Non-blocking:
- On a system-mode page whose own CSS pins its root to
color-scheme: light, a reader who prefers dark now gets the toast's dark-page text on the dark card before hydration, or always without script; the first-paint rule follows the reader's preference until the root Theme names the scheme, as color-mode blocks already do. Toast.tsxtreats only'system'as an unknown scheme, while Theme and the theme compiler treat any mode other thanlightordarkas system.- The record line "Toast is the first user" states sequencing, and three new comments could be shorter (see the inline notes).
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: Breadcrumbs release note: the menu keeps its gap below the crumb, slides in from it again in published builds, and keeps the viewport gutter on its far edge. Verified: the menu passes its gap as the layer offset (
BreadcrumbItem.tsx:749), its own style keeps only a minimum width, and the new unit test fails before the change and passes with it. - Claim: Toast release note: a toast's card draws on the right side from the first paint on a system-mode page; before script a dark-mode reader saw light text on a light card; the toast renders its light-page side and names its dark-page side; themes whose surfaces keep one side write no extra CSS. Verified: the server-markup test fails before the change and passes with it; with the default tokens the old pair was white on white (the exact ratio varies by theme); the gothic theme's built CSS is byte-identical.
- Claim: Three approved pull requests are merged onto main in order, each as a merge commit. Verified: three merge commits in the stated order, each identical to an automatic merge of its parents.
- Claim: Each member was reviewed and approved on its own head. Verified: each member's approval is at the exact head merged here.
- Claim: This branch checks that the members build and test together. Pending: CI is still running; the builds and the targeted tests pass in this review.
- Claim: The Breadcrumbs fix lands before the Storybook change, so the menu entrance keeps its offset under the new resolution. Verified: merge order, and the offset does not depend on the style resolution.
- Claim: The theme-compilation record gains the dark-page surface invariant, amends the color-mode-block invariant and adds applies_to entries. Verified (
theme-compilation.md:20-21,:282-283,:302-323). - Claim: The record change was approved on its own pull request and again at this head. Verified: exact-head approval comments from an engineering owner on both, and the spec-owner status passes.
- Claim: Each member pull request is closed with a note when this merges. Not checkable in code: it is a step after merge.
- File:
.changeset/breadcrumb-menu-entrance-clearance.md: clear - File:
.changeset/core-toast-first-paint-side.md: clear - File:
apps/storybook/.storybook/main.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: clear - File:
apps/storybook/stories/Layout.stories.tsx: clear - File:
apps/storybook/stories/UseContainerReveal.stories.tsx: clear - File:
apps/storybook/vite.config.ts: clear - File:
docs/architecture/theme-compilation.md: non-blocking: the "first user" sequencing line - File:
internal/vibe-tests/setup-test/setup-integrity.mjs: clear - File:
internal/vibe-tests/setup-test/setup-integrity.test.mjs: clear - File:
packages/cli/clients/cli/commands/build-theme.adaptations.test.mjs: clear - File:
packages/cli/clients/cli/commands/build-theme.color-mode-blocks.test.mjs: clear - File:
packages/core/src/Breadcrumbs/BreadcrumbItem.tsx: non-blocking: comment wording - File:
packages/core/src/Breadcrumbs/Breadcrumbs.test.tsx: clear - File:
packages/core/src/Table/__tests__/TableVirtualization.release.vite.mjs: clear - File:
packages/core/src/Toast/Toast.mediaFallback.test.tsx: clear - File:
packages/core/src/Toast/Toast.tsx: non-blocking: the system-mode check and comment wording - File:
packages/core/src/Toast/ToastViewport.test.tsx: clear - File:
packages/core/src/privateAttributes/mediaDarkPage.ts: clear - File:
packages/core/src/theme/MediaDarkPage.tsx: clear - File:
packages/core/src/theme/MediaTheme.tsx: clear - File:
packages/core/src/theme/colorModeBlocks.test.ts: clear - File:
packages/core/src/theme/dynamicType.test.ts: clear - File:
packages/core/src/theme/generateThemeRules.test.ts: clear - File:
packages/core/src/theme/generateThemeRules.ts: non-blocking: first paint on a page that pins its root scheme; a displaced doc comment - File:
packages/core/src/theme/invertedSurfaceSide.ts: clear - File:
packages/core/src/theme/onMediaTokens.test.ts: clear - File:
packages/core/src/theme/statusRoleDerivation.ts: clear - File:
packages/core/src/theme/themeAdaptations.test.ts: clear
| const unforced = `${system}:not(${forcedAround} *)`; | ||
| return preference | ||
| ? [ | ||
| `${unforced}:where(${ROOT_SCHEME_UNNAMED} *)`, |
There was a problem hiding this comment.
Non-blocking: before the root Theme names the page's scheme, this preference condition applies the dark-page side even on a page whose own CSS pins :root { color-scheme: light }. There the card's fill follows the root and stays dark, so a reader who prefers dark sees dark text on a dark card until hydration, or always without script. The base drew that page correctly. INV21 copies INV18's first-paint rule here, so this is an owner call rather than a code fix.
| // markup), its scheme is the reader's and unknown; later renders know it. | ||
| const isHydrating = useIsHydrating(); | ||
| const themeMode = use(ThemeContext)?.mode ?? 'system'; | ||
| const isSchemeUnknown = themeMode === 'system' && isHydrating; |
There was a problem hiding this comment.
Non-blocking: Theme (forcesScheme) and the compiler's darkPageConditions treat any mode other than light or dark as system. themeMode !== 'light' && themeMode !== 'dark' keeps the toast in step with the CSS when a stray mode value reaches it.
| // A system-mode page's scheme is the reader's, which the server does not | ||
| // know. The card takes its light-page side, and the side it takes on a | ||
| // dark page rides beside it; the theme writes that side's rules for a dark | ||
| // page, so the first paint is right in both. | ||
| const theme = useThemeDefinition(); | ||
| // While a system-mode page renders on the server (or hydrates the server's | ||
| // markup), its scheme is the reader's and unknown; later renders know it. |
There was a problem hiding this comment.
Non-blocking (comment style): these two comments say twice that the scheme "is the reader's", in long sentences. Suggested:
// The server does not know a system-mode page's scheme.
// The card renders its light-page side and names its dark-page side.
// The theme draws that side on a dark page.| ); | ||
| } | ||
|
|
||
| function nearestSurfaceIs(mode: MediaSide): string[] { |
There was a problem hiding this comment.
Non-blocking: this function's doc comment (the "Ancestor conditions …" block at lines 1346-1357) now sits above darkPageNearestIs's own doc comment. So nearestSurfaceIs has no doc, and the old block documents nothing. Move that block back above this line.
| // The layer's own clearance: the layer runtime measures it as the | ||
| // entrance's room to the trigger and keeps it through a flip. |
There was a problem hiding this comment.
Non-blocking (comment style): one topic per sentence reads easier. Suggested:
// The layer's clearance from the crumb. The entrance uses it as its
// room to slide, and a flip keeps it.| same way. The compiler | ||
| picks each side by the rule the painted surface is measured with, from the | ||
| theme's tokens for each mode, and writes these rules only for a theme whose | ||
| surfaces take different sides in the two page modes. Toast is the first |
There was a problem hiding this comment.
Non-blocking: "Toast is the first user" states sequencing, which records leave out. Suggested: "Toast uses it: its card's fill is …".
This pull request lands three approved pull requests together in one CI run, merged onto main in order, each as a merge commit. Each member was reviewed and approved on its own head; this branch checks that they build and test together.
#12784 lands before #12327, so the breadcrumb menu's entrance keeps its offset once Storybook resolves StyleX the new way.
Records
architecture:theme-compilationgains INV21 (dark-page surface rules) and amends INV18, with itsapplies_toentries. Approved on its own pull request; re-approved at this head below. Decider: josephfarina.When this merges, each pull request above is closed with a note that names this one.