Repository navigation
Conversation
…he color mode, not the resolved tokens
Co-authored-by: JasonOA888 <JasonOA888@users.noreply.github.com>
…de surface that measures nothing; Toast renders it with its measured side
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentThread | 377.5 kB (+83 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 384.5 kB (+64 B) · 2.5 kB CSS (0) | — | — · — · — |
| Markdown | 202.5 kB (+15 B) · 23.9 kB CSS (0) | — | — · — · — |
✓ passed · ✗ needs a fix · Δ changed, for review in the shots below · ↻ needs re-verify · — did not run
132 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/ListInput | 102.9 kB (+15 B) · 1.3 kB CSS (0) | — | — · — · — |
| charts/Chart | 261.5 kB (+10 B) · 529 B CSS (0) | — | — · — · — |
| AppShell | 95.6 kB (+3 B) · 15.2 kB CSS (0) | — | — · — · — |
| TopNavHeading | 93.3 kB (+3 B) · 12.7 kB CSS (0) | — | — · — · — |
| SideNavHeading | 94.2 kB (+2 B) · 12.8 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 108.1 kB (+1 B) · 14.3 kB CSS (0) | — | — · — · — |
| Timestamp | 28.8 kB (+1 B) · 11.6 kB CSS (0) | — | — · — · — |
| AlertDialog | 138.5 kB (0) · 16.5 kB CSS (0) | — | — · — · — |
| Banner | 73.3 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 88.7 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| Button | 71.2 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| ButtonGroup | 45.3 kB (0) · 3.8 kB CSS (0) | — | — · — · — |
| Calendar | 82.4 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| Carousel | 83.1 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| ChatComposer | 95.7 kB (0) · 14.0 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 92.8 kB (0) · 12.8 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 92.8 kB (0) · 12.8 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 71.8 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| ChatLayout | 95.0 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 71.7 kB (0) · 11.5 kB CSS (0) | — | — · — · — |
| ChatMessageList | 29.5 kB (0) · 7.9 kB CSS (0) | — | — · — · — |
| ChatMessageMetadata | 21.0 kB (0) · 4.2 kB CSS (0) | — | — · — · — |
| ChatSendButton | 71.6 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 34.0 kB (0) · 9.3 kB CSS (0) | — | — · — · — |
| CheckboxInput | 74.2 kB (0) · 11.1 kB CSS (0) | — | — · — · — |
| CheckboxList | 69.3 kB (0) · 8.5 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 85.9 kB (0) · 13.1 kB CSS (0) | — | — · — · — |
| CheckIndicator | 9.0 kB (0) · 681 B CSS (0) | — | — · — · — |
| Citation | 21.4 kB (0) · 4.6 kB CSS (0) | — | — · — · — |
| CodeBlock | 87.6 kB (0) · 13.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 88.1 kB (0) · 14.0 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 35.1 kB (0) · 8.4 kB CSS (0) | — | — · — · — |
| ComplexSelector | 88.6 kB (0) · 13.7 kB CSS (0) | — | — · — · — |
| ContextMenu | 111.5 kB (0) · 20.0 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 42.4 kB (0) · 7.4 kB CSS (0) | — | — · — · — |
| DateInput | 215.0 kB (0) · 19.5 kB CSS (0) | — | — · — · — |
| DateRangeInput | 101.9 kB (0) · 14.6 kB CSS (0) | — | — · — · — |
| DateTimeInput | 239.0 kB (0) · 21.3 kB CSS (0) | — | — · — · — |
| DialogHeader | 74.5 kB (0) · 13.0 kB CSS (0) | — | — · — · — |
| DrawerHeader | 74.6 kB (0) · 14.5 kB CSS (0) | — | — · — · — |
| DropdownMenu | 138.8 kB (0) · 20.2 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 30.6 kB (0) · 7.8 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 29.7 kB (0) · 7.2 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 30.6 kB (0) · 7.8 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 84.1 kB (0) · 11.6 kB CSS (0) | — | — · — · — |
| Field | 64.0 kB (0) · 8.0 kB CSS (0) | — | — · — · — |
| FieldLabel | 59.5 kB (0) · 6.5 kB CSS (0) | — | — · — · — |
| FieldStatus | 10.9 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| FileInput | 81.7 kB (0) · 13.2 kB CSS (0) | — | — · — · — |
| Icon | 8.8 kB (0) · 681 B CSS (0) | — | — · — · — |
| IconButton | 71.2 kB (0) · 11.3 kB CSS (0) | — | — · — · — |
| InfoTip | 53.9 kB (0) · 6.1 kB CSS (0) | — | — · — · — |
| InputGroup | 66.2 kB (0) · 9.5 kB CSS (0) | — | — · — · — |
| Link | 61.3 kB (0) · 7.8 kB CSS (0) | — | — · — · — |
| ListItem | 85.1 kB (0) · 13.1 kB CSS (0) | — | — · — · — |
| MobileNav | 84.0 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 73.4 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| MoreMenu | 139.0 kB (0) · 20.2 kB CSS (0) | — | — · — · — |
| MultiSelector | 110.9 kB (0) · 19.5 kB CSS (0) | — | — · — · — |
| NavHeadingMenuItem | 20.3 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| NumberInput | 110.5 kB (0) · 13.5 kB CSS (0) | — | — · — · — |
| Pagination | 156.1 kB (0) · 20.6 kB CSS (0) | — | — · — · — |
| Popover | 110.5 kB (0) · 15.9 kB CSS (0) | — | — · — · — |
| PowerSearch | 328.0 kB (0) · 27.9 kB CSS (0) | — | — · — · — |
| ProgressBar | 12.5 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| RadioList | 65.5 kB (0) · 8.0 kB CSS (0) | — | — · — · — |
| RadioListItem | 82.0 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| SegmentedControl | 105.9 kB (0) · 7.8 kB CSS (0) | — | — · — · — |
| Selector | 122.8 kB (0) · 20.2 kB CSS (0) | — | — · — · — |
| SelectorOption | 25.9 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| SideNav | 120.1 kB (0) · 12.8 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 72.2 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| SideNavItem | 87.5 kB (0) · 12.6 kB CSS (0) | — | — · — · — |
| Slider | 120.0 kB (0) · 9.7 kB CSS (0) | — | — · — · — |
| Step | 32.7 kB (0) · 5.8 kB CSS (0) | — | — · — · — |
| Stepper | 72.9 kB (0) · 11.5 kB CSS (0) | — | — · — · — |
| Switch | 114.7 kB (0) · 11.0 kB CSS (0) | — | — · — · — |
| Table | 127.3 kB (0) · 21.6 kB CSS (0) | — | — · — · — |
| TableCell | 112.6 kB (0) · 20.7 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 112.5 kB (0) · 20.4 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 81.8 kB (0) · 14.9 kB CSS (0) | — | — · — · — |
| TabList | 49.4 kB (0) · 7.0 kB CSS (0) | — | — · — · — |
| TabMenu | 89.5 kB (0) · 12.7 kB CSS (0) | — | — · — · — |
| TextArea | 98.0 kB (0) · 10.6 kB CSS (0) | — | — · — · — |
| TextInput | 105.2 kB (0) · 13.2 kB CSS (0) | — | — · — · — |
| Thumbnail | 75.9 kB (0) · 12.9 kB CSS (0) | — | — · — · — |
| TimeInput | 187.2 kB (0) · 18.3 kB CSS (0) | — | — · — · — |
| ToggleButton | 71.9 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| ToggleButtonGroup | 42.5 kB (0) · 3.8 kB CSS (0) | — | — · — · — |
| Token | 31.7 kB (0) · 5.1 kB CSS (0) | — | — · — · — |
| Tokenizer | 119.1 kB (0) · 22.5 kB CSS (0) | — | — · — · — |
| TopNav | 75.2 kB (0) · 12.4 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 86.4 kB (0) · 13.4 kB CSS (0) | — | — · — · — |
| TopNavMenu | 92.5 kB (0) · 12.7 kB CSS (0) | — | — · — · — |
| TreeList | 48.3 kB (0) · 6.1 kB CSS (0) | — | — · — · — |
| Typeahead | 100.4 kB (0) · 14.9 kB CSS (0) | — | — · — · — |
| lab/AudioPlayer | 242.1 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 134.2 kB (0) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 135.7 kB (0) · 1.1 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 193.1 kB (0) · 1.9 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 64.0 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 100.5 kB (0) · 2.3 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 125.2 kB (0) · 751 B CSS (0) | — | — · — · — |
| lab/MediaCaptionsButton | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaFullscreenButton | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlaybackRate | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlayButton | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaSeekButton | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTime | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTimeSlider | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaVolume | 231.6 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 87.2 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 87.2 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/PageControl | 79.6 kB (0) · 716 B CSS (0) | — | — · — · — |
| lab/Schedule | 123.1 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 74.5 kB (0) · 162 B CSS (0) | — | — · — · — |
| lab/TabBar | 85.1 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 98.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/Tour | 112.7 kB (0) · 1.0 kB CSS (0) | — | — · — · — |
| lab/TransferList | 134.8 kB (0) · 1.4 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 147.6 kB (0) · 1.6 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 315.1 kB (0) · 2.7 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.6 kB (0) · 454 B CSS (0) | — | — · — · — |
| richtext/RichTextView | 291.7 kB (0) · 2.4 kB CSS (0) | — | — · — · — |
| Collapsible | 30.2 kB (−1 B) · 4.7 kB CSS (0) | — | — · — · — |
| Spinner | 26.0 kB (−3 B) · 7.0 kB CSS (0) | — | — · — · — |
| Toast · Storybook | 111.2 kB (−55 B) · 11.7 kB CSS (0) | 1,864 (0) | — · — · — |
| lab/VideoPlayer | 237.5 kB (−2.5 kB) · 2.1 kB CSS (0) | — | — · — · — |
| Overlay | 16.3 kB (−8.9 kB) · 4.3 kB CSS (0) | — | — · — · — |
| Lightbox | 146.5 kB (−9.4 kB) · 12.5 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 86.6 kB (−9.4 kB) · 372 B CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 8.18 MB packed (+1.4 kB); no new dependencies.
Wide change (shared styles: packages/core/src/theme/MediaDarkPage.tsx, packages/core/src/theme/MediaTheme.tsx, packages/core/src/theme/MediaThemeSurface.tsx, and 1 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
|
/approve-spec 3eadc91 |
There was a problem hiding this comment.
Changes requested. The size win holds up and the new internal module is now approved by an engineering owner at this head, but Core does not typecheck and the records, changeset and description need a few corrections. These fixes touch spec records, so the next head needs a fresh /approve-spec <full head SHA> from an engineering owner, which you can post as one.
Blocking:
- Core does not build:
useThemeIdentityreturnsgetRegisteredTheme'sDefinedTheme | nullwhere it declaresDefinedTheme | undefined, so Core's typecheck fails with TS2322 atuseTheme.ts:562(reproduced locally); ending line 556 with?? undefined, asuseThemeDefinitiondoes, fixes it. - Theme-application ownership not amended:
architecture:theme-applicationstill saysMediaTheme.tsxowns local light/dark surface context whileMediaThemeSurface.tsxnow applies it and Toast uses it directly, so amend that Owning code line (and list the new file inapplies_to). - Tooltip is not a user of the new module: the record bullet (
MediaTheme.spec.md:72-75), the file header (MediaThemeSurface.tsx:11-12) and the description say it is used by MediaTheme, Toast and Tooltip, but only MediaTheme and Toast import it. - Toast's side is not always measured: the changeset and the description say Toast renders the surface with the side it measured, but before measurement it uses the side
component:ToastFR13 picks from the theme, so say it uses the side it resolves for its card.
Also:
- Reference-page deltas missing: add the docs, form, menu and table first-load deltas for the whole branch, which INV10 asks for when a shared module grows.
- Missing Stack line: add
Stack: #14300 → #14302to both pull request bodies so each one is reviewed on its own increment. - Stale MediaTheme header:
MediaTheme.tsx:11-13still lists Toast as a user ofMediaTheme. - Toast saving overstated across the branch: with #14300's +48 B, a Toast page saves about 42 B rather than about 80 B if both changesets ship together.
Claims and files checked
Review mode: same-head; reason: none
Changed rules (0): none since the last review.
Claims:
- Title, a component that knows its side applies it without the backdrop measurement: verified (
Toast.tsx:46imports only the surface). - MediaTheme's measurement import makes fixed-side users pay for colour parsing, contrast maths and the side picker: verified on the base (
MediaTheme.tsximported the measurement hook). - Adding MediaTheme to a Button page costs about 2.6 KB gzip: reported.
- A component that knows its side pays only for the scope: verified (the surface imports only styles, naming and
MediaDarkPage). - Stacked on #14300 and merges after it: verified (#14300's head is an ancestor); no Stack line.
- MediaTheme's API and behaviour are unchanged for fixed sides and
auto: verified (equivalence test and existing MediaTheme tests run here; no API rows). - Toast's card takes the side it measures, as before: false before measurement.
- The surface renders the marker, dark-page side and text colour, measures nothing and is not exported: verified (
MediaThemeSurface.tsx, theme barrel, package exports). - MediaTheme measures only for
autoand renders the surface: verified (MediaTheme.tsx:88-93). - Toast renders the surface with the side it already measures: false before measurement.
- The Owns bullet names the module as used by MediaTheme, Toast and Tooltip: false for Tooltip.
- Size table, how it was built, and the +20 B / +25 B boundary cost: reported.
- New equivalence test for
dark,lightandoff: verified (runs and passes here). - Existing MediaTheme, Toast, Lightbox and theme tests pass unchanged: verified (run here).
- No public API, behaviour, visual or policy change: verified for API and behaviour (no API rows; identical markup); the record change is owner-approved.
- Product changes discovered were removed or split: reported.
- No internal context in public text: verified (scan of added lines, title, body, branch and commit messages).
- Overlap with #13179 and #14300: verified (#14300 is open and carried here).
- Tests green, 2,390: verified (54 files, 2,390 tests run here).
- Knowledge check aligned: verified (run here).
- Surface changeset, a Toast page about 80 B smaller: reported (relative to #14300's head).
- Surface changeset, MediaTheme applies its side through an internal surface and behaves as before: verified.
- Surface changeset, Toast renders the surface with the side it measured: false before measurement.
- Cache-key changeset, MediaTheme and Lightbox pages that do not call
useThemeabout 9.5 KB smaller: reported. - Cache-key changeset, the measurement keys on theme and colour mode and no longer resolves tokens: verified (
useAutoMediaMode.ts:143-181). - Cache-key changeset, it measures again on the same changes as before: verified (
useThemememoizes tokens on the same theme and mode; the reprobe test covers a theme change, a mode change, an unchanged render and a rootdata-themechange).
Files:
.changeset/media-theme-static-surface.md: measured-side wording; Toast saving across the branch..changeset/use-auto-media-mode-theme-key.md: clear.docs/specs/components/theme/MediaTheme.spec.md: Tooltip.packages/core/src/Toast/Toast.tsx: clear.packages/core/src/hooks/useAutoMediaMode.reprobe.test.tsx: clear.packages/core/src/hooks/useAutoMediaMode.ts: clear.packages/core/src/theme/MediaTheme.dom.test.tsx: clear.packages/core/src/theme/MediaTheme.tsx: stale header.packages/core/src/theme/MediaThemeSurface.tsx: Tooltip in the header; its ownership is not reflected inarchitecture:theme-application.packages/core/src/theme/useTheme.ts: TS2322.
…'s saving under a Theme provider Co-authored-by: JasonOA888 <JasonOA888@users.noreply.github.com>
…me-static-surface
… side it resolves
|
/approve-spec d85741f |
There was a problem hiding this comment.
Changes requested. Core now builds and typechecks in a local run, an engineering owner approved the new internal surface at this head, and last round's Tooltip, release-note and ownership wording is fixed. Two statements still disagree with the code.
- Theme-compilation INV21 still names MediaTheme as Toast's writer: INV21 in
docs/architecture/theme-compilation.mdsays Toast's dark-page attribute is one "which MediaTheme writes beside its own side". Toast now rendersMediaThemeSurface, which writes it (MediaThemeSurface.tsx:53). Change it to "whichMediaThemeSurfacewrites", then record a fresh/approve-specfor that head. - Toast's side is not always measured: the description's Intended invariant still says "Toast's card takes the side it measures, as before".
Toast.tsx:493uses the sidecomponent:ToastFR13 picks from the theme until the card is measured, so reword the sentence as the Change list already does. - Stack line does not hold (non-blocking): #12410, named as the top, does not yet contain this branch or #14300's.
- Miss: Comments still name MediaTheme as Toast's writer (non-blocking):
MediaDarkPage.tsx:8-11,:26,:37,privateAttributes/mediaDarkPage.ts:7-11andToast.tsx:213still say MediaTheme does whatMediaThemeSurfacenow does.
Claims and files checked
Review mode: full; reason: spec-record
- Claim (title): a component that knows its side applies it without MediaTheme's measurement. Verified: the surface imports no measurement code, and Toast renders it.
- Claim: the Stack line orders #14300, this pull request, then #12410. Does not hold: #12410 contains neither branch (non-blocking).
- Claim: on the base, MediaTheme loads its measurement even for a fixed side. Verified: the base MediaTheme imports it statically.
- Claim: MediaTheme costs a Button page about 2.6 KB gzip. Reported.
- Claim: after the split, a side-aware component pays only for the scope. Verified from the surface's imports.
- Claim: this branch is stacked on #14300 and merges after it. Verified: #14300's head is in this branch.
- Claim: MediaTheme's API and behaviour are unchanged for fixed and auto modes. Verified: no API rows, the markup moved verbatim, and the MediaTheme tests pass locally.
- Claim: Toast's card takes the side it measures, as before. False: Toast uses the theme-picked side until the card is measured.
- Claim: the surface renders the marker, dark-page side and text colour, measures nothing, and is not exported. Verified.
- Claim: MediaTheme resolves its side, measures only for auto, and renders the surface. Verified (
MediaTheme.tsx:89-95). - Claim: Toast renders the surface with the side it resolves for its card. Verified (
Toast.tsx:493,:540). - Claim: the MediaTheme and theme-application records name the module. Verified; the theme-compilation record's INV21 is not amended (finding).
- Claim: the page-size table and the module-boundary costs of +20 and +25 B. Reported.
- Claim: whole-branch reference pages and the Toast page. Reported, and reproduced locally within a few bytes: docs +0, form +0, menu +5, table +4, Toast −42 B.
- Claim: the new test compares the surface's markup with MediaTheme's for dark, light and off. Verified: it passes locally.
- Claim: the existing MediaTheme, Toast, Lightbox and theme tests pass unchanged. Verified: no existing test was edited, and 2,429 tests pass locally.
- Claim: scope is theme and Toast, with no public API, behaviour, visual or policy change. Verified.
- Claim: this pull request adds only the fixed-mode surface over #14300. Verified for its own commits.
- Claim: tests are green (2,390). Reported; 2,429 pass locally over a slightly wider set.
- Claim: the knowledge check is aligned. Verified locally.
- Claim (release note): MediaTheme applies its side through a surface that measures nothing, Toast renders it with the side it resolves, and MediaTheme behaves as before. Verified.
- Claim (release note): a Toast page loads about 80 B less than with MediaTheme. Reported.
- Claim (release note): measuring pages with no other
useThemecall save about 9.5 KB with no provider and 2.6 to 3.3 KB under one. Reported; the no-provider figure is reproduced locally (MediaTheme −9,573, Lightbox −9,679, Overlay −9,113 B). - Claim (release note): the measurement re-measures from the theme and colour mode, no longer resolves the token set, and re-measures on the same changes as before. Verified (
useAutoMediaMode.ts:145,useTheme.ts:596-599; the re-probe test passes locally). - File
.changeset/media-theme-static-surface.md: clear. - File
.changeset/use-auto-media-mode-theme-key.md: clear. - File
docs/architecture/theme-application.md: clear. - File
docs/specs/components/theme/MediaTheme.spec.md: clear. - File
packages/core/src/Toast/Toast.tsx: non-blocking (stale docblock at line 213). - File
packages/core/src/hooks/useAutoMediaMode.reprobe.test.tsx: clear. - File
packages/core/src/hooks/useAutoMediaMode.ts: clear. - File
packages/core/src/theme/MediaTheme.dom.test.tsx: clear. - File
packages/core/src/theme/MediaTheme.tsx: clear. - File
packages/core/src/theme/MediaThemeSurface.tsx: finding (theme-compilation INV21 still names MediaTheme as its writer for Toast). - File
packages/core/src/theme/useTheme.ts: clear.
…s comments name it
|
/approve-spec f636c9a |
There was a problem hiding this comment.
Approved. CI passes at this head, an engineering owner approved the record edits that name MediaThemeSurface for this head, and the theme, Toast, Lightbox and Overlay tests pass in a local run.
- Stack line does not hold (non-blocking): #14311's description writes
thisin place of its own number and #12410's adds a clause naming #14307, so the four descriptions do not share one identical Stack line and these pull requests are not reviewed as one stack; give #14311 and #12410 exactly this line, with #14307 in it if #12410 builds on it.
Claims and files checked
Review mode: same-head; reason: none
- changed rules (0): none
- Claim (title): a component that knows its side applies it without MediaTheme's measurement. Verified: the surface imports no measurement code (
MediaThemeSurface.tsx:16-20), and Toast renders it (Toast.tsx:46,:540). - Claim: the Stack line orders #14300, this pull request, #14311, then #12410. Does not hold: #14311 and #12410 carry different Stack lines, although each branch contains the one before it (non-blocking).
- Claim: on the base, MediaTheme loads its measurement even for a fixed side. Verified: the base imports the measurement hook statically.
- Claim: MediaTheme costs a Button page about 2.6 KB gzip. Reported.
- Claim: after the split, a component that knows its side pays only for the scope. Verified from the surface's imports.
- Claim: this branch is stacked on #14300 and merges after it. Verified: #14300's head is in this branch.
- Claim: MediaTheme's API and behaviour are unchanged for fixed and auto modes. Verified: CI's API report lists no rows, the markup moved verbatim, and the MediaTheme tests pass in a local run.
- Claim: Toast's card takes the side it resolves, the theme's until it measures the card and then the measured side, as before. Verified (
Toast.tsx:480-493,:540; the Toast tests pass locally and in CI). - Claim: the surface renders the marker, dark-page side and text colour for dark, light or off, measures nothing, and is not exported. Verified (
MediaThemeSurface.tsx:44-58; the theme barrel does not export it). - Claim: MediaTheme resolves its side, measures only for auto, and renders the surface. Verified (
MediaTheme.tsx:89-95). - Claim: Toast renders the surface with the side it resolves, in place of MediaTheme with that fixed side. Verified (
Toast.tsx:540). - Claim: the MediaTheme and theme-application records name the module, its two users and that it is internal. Verified (
MediaTheme.spec.md:72-75,theme-application.md:16,:196). - Claim: the page-size table and the module-boundary costs of +20 and +25 B. Reported.
- Claim: whole-branch reference pages and the Toast page. Reported; CI's size analysis shows Button and Table unchanged and Toast at −55 B.
- Claim: the new test compares the surface's markup with MediaTheme's for dark, light and off. Verified: it passes in a local run.
- Claim: the existing MediaTheme, Toast, Lightbox and theme tests pass unchanged. Verified: no existing case was edited, 2,429 tests pass locally, and CI's test jobs pass.
- Claim: scope is theme and Toast, with no public API, behaviour, visual or policy change. Verified.
- Claim: product changes found during the work were removed or split. Reported.
- Claim: public text carries no internal context. Verified: the title, description, branch, commit messages and added lines carry none.
- Claim: stacked on #14300, which supersedes an older pull request; this adds only the fixed-mode surface. Verified for its own commits; the supersession is reported.
- Claim: tests are green (2,390). Reported; 2,429 pass locally over a slightly wider set, and CI's test jobs pass.
- Claim: the knowledge check is aligned. Verified in a local run.
- Claim: whichever of this and #14307 lands second moves the inline-code marker onto the surface. Reported: a plan for a later merge.
- Claim (release note): MediaTheme applies its side through a surface that measures nothing, Toast renders it with the side it resolves, and MediaTheme behaves as before. Verified.
- Claim (release note): a Toast page loads about 80 B less than with MediaTheme. Reported.
- Claim (release note): pages that measure their backdrop with no other
useThemecall save about 9.5 KB with no provider and 2.6 to 3.3 KB under one. Reported; CI's size analysis shows Lightbox at −9,595 B and Overlay at −9,140 B. - Claim (release note): the measurement re-measures from the theme and colour mode, no longer resolves the token set, and re-measures on the same changes as before. Verified (
useAutoMediaMode.ts:145,useTheme.ts:596-599; the re-probe test passes locally). - File
.changeset/media-theme-static-surface.md: clear. - File
.changeset/use-auto-media-mode-theme-key.md: clear. - File
docs/architecture/theme-application.md: clear. - File
docs/architecture/theme-compilation.md: clear. - File
docs/specs/components/theme/MediaTheme.spec.md: clear. - File
packages/core/src/Toast/Toast.tsx: clear. - File
packages/core/src/hooks/useAutoMediaMode.reprobe.test.tsx: clear. - File
packages/core/src/hooks/useAutoMediaMode.ts: clear. - File
packages/core/src/privateAttributes/mediaDarkPage.ts: clear. - File
packages/core/src/theme/MediaDarkPage.tsx: clear. - File
packages/core/src/theme/MediaTheme.dom.test.tsx: clear. - File
packages/core/src/theme/MediaTheme.tsx: clear. - File
packages/core/src/theme/MediaThemeSurface.tsx: clear. - File
packages/core/src/theme/useTheme.ts: clear.
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #12410.
Stack: #14300 → #14302 → #14311 → #12410
Maintainer impact
MediaThemeimports its backdrop measurement formode="auto", so every user of a fixed side pays for color parsing, contrast math and the side picker even though it never measures. A component that knows its side cannot apply a media side's theme scope without that cost: on a Button page, addingMediaThemecosts about 2.6 KB gzip. This splits the fixed-mode part into an internal module, so a component that knows its side pays only for the scope.Stacked on #14300 (the backdrop measurement's cache key); it merges after it.
Intended invariant
MediaTheme's public API and behavior stay the same (component:MediaThemeFR1–FR3): for a fixed side it renders the same element, surface marker, dark-page side and text color, andmode="auto"measures and resolvesfallbackas before. Toast's card takes the side it resolves for its card (the sidecomponent:ToastFR13 picks from the theme until it measures the card, then the measured side), as before.Change
packages/core/src/theme/MediaThemeSurface.tsx: fixed-mode theme application. It renders one side's (dark,lightoroff) surface marker, the dark-page sideMediaDarkPagenames, and the side's text color, and measures nothing. Not exported from the theme barrel or the package.MediaThemeresolves its side (measuring only formode="auto") and rendersMediaThemeSurface.ToastrendersMediaThemeSurfacewith the side it resolves for its card (the sidecomponent:ToastFR13 picks from the theme before measuring, then the measured side), in place ofMediaThemewith that fixed side.component:MediaTheme's Owns list names the module, its scope (fixed-mode theme application, used by MediaTheme and Toast), and that it is internal;architecture:theme-application's owning-code line names it and lists it inapplies_to.Evidence
First-load JavaScript, gzip, against #14300's head (base 1e0603c), each Core built with
size:pages'buildCoreand bundled with itsmeasurePage(the size report's options); the internal module is measured through a temporary dist entry, since no package entry exports it:ButtonButton+ the fixed-mode surfaceButton(INV10 limit 307 B)ToastToast+ButtonMediaThemealoneLightboxMediaThemeandLightboxgain the module boundary (+20 and +25 B).The whole branch (#14300 and this) against its
mainbase 8c5743e (pnpm size:pages --base 8c5743ea3c8729620fd28585e8e6e1e3ee74d973 --head d85741ff --page toast=Toast, gzip): docs, form and menu +0; table −3; Toast −33 (with #14300's +48, a Toast page saves about 33 B when both ship).MediaThemeSurfacecase inMediaTheme.dom.test.tsx: fordark,lightandoff, the surface renders exactly the markupMediaThemerenders.Scope
Components: theme (MediaTheme, MediaThemeSurface), Toast
Overlap checked: #13179, #14300 (stacked on #14300, which supersedes #13179; this adds only the fixed-mode surface)
Testing
vitest runtheme, Toast, Lightbox andhooks/useAutoMediaMode: green (2,390 tests).check:knowledge: aligned.Merge order with #14307: that PR adds an internal StyleX marker to MediaTheme's element for inline code. Whichever of the two lands second puts
mediaSurfaceMarkeronMediaThemeSurface's element, so Toast's card carries it too.