Repository navigation
perf(core): the breakpoint vocabulary has its own module - #13507
Conversation
The token import test walks the whole-module first load of a page: a bundler that keeps a module's code keeps every module it imports. It now also checks that a Button, a Link, an IconButton, a Popover, an AppShell and the touch presentation resolver, and every export of their entries, reach none of the theme adaptation writer, the value resolver it runs and the local tokens. Tests: the eleven new cases fail on main. These components read only the breakpoint vocabulary and the compact definition, and they import them from themeAdaptations.ts. The next commit fixes it.
Button, Link, IconButton, Popover and AppShell read only the breakpoint names and the compact definition. They imported them from themeAdaptations.ts, so a bundler that keeps whole modules also kept the theme adaptation writer, the theme value resolver and the scale expanders. A bundler that never splits a module across chunks keeps the writer whole in the first load when a lazy theme chunk uses it. The breakpoint names and defaults, the size-edge helpers and the compact definition move to theme/breakpoints.ts, which imports nothing. themeAdaptations.ts re-exports them, so its exports do not change. touchPresentation.ts, Popover, AppShell and its unread width point import the new module. The edges test reads the helpers in their new file, and the header of touchPresentation.stylex.ts names it. The theme authoring contract names the new module as the owner of the breakpoint vocabulary. AST-012 links both files by path, in place of the comments that cited it. Tests: the eleven cases from the commit before now pass.
|
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 |
|---|---|---|---|
| Timestamp | 28.4 kB (0) · 11.5 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/Comments | 394.3 kB (−4 B) · 2.5 kB CSS (0) | — | — · — · — |
130 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateInput | 212.1 kB (−6 B) · 19.1 kB CSS (0) | — | — · — · — |
| DateTimeInput | 236.3 kB (−23 B) · 20.8 kB CSS (0) | — | — · — · — |
| lab/VideoPlayer | 239.9 kB (−24 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 131.7 kB (−27 B) · 773 B CSS (0) | — | — · — · — |
| lab/CommentThread | 387.4 kB (−27 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 132.9 kB (−28 B) · 1.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 84.7 kB (−38 B) · 13.8 kB CSS (0) | — | — · — · — |
| Lightbox | 153.6 kB (−41 B) · 12.4 kB CSS (0) | — | — · — · — |
| Markdown | 214.0 kB (−41 B) · 23.7 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 86.6 kB (−43 B) · 12.3 kB CSS (0) | — | — · — · — |
| Pagination | 157.4 kB (−43 B) · 20.3 kB CSS (0) | — | — · — · — |
| ToggleButtonGroup | 42.5 kB (−43 B) · 3.7 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 30.3 kB (−44 B) · 7.7 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 190.2 kB (−44 B) · 1.9 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 106.0 kB (−45 B) · 14.2 kB CSS (0) | — | — · — · — |
| CheckboxList | 77.4 kB (−45 B) · 8.5 kB CSS (0) | — | — · — · — |
| ContextMenu | 109.8 kB (−46 B) · 19.8 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 30.3 kB (−47 B) · 7.7 kB CSS (0) | — | — · — · — |
| TextArea | 97.1 kB (−47 B) · 10.3 kB CSS (0) | — | — · — · — |
| SideNavItem | 85.2 kB (−48 B) · 12.5 kB CSS (0) | — | — · — · — |
| ToggleButton | 97.2 kB (−49 B) · 11.4 kB CSS (0) | — | — · — · — |
| Token | 31.4 kB (−49 B) · 5.0 kB CSS (0) | — | — · — · — |
| AlertDialog | 136.5 kB (−50 B) · 16.4 kB CSS (0) | — | — · — · — |
| Selector | 124.6 kB (−50 B) · 19.9 kB CSS (0) | — | — · — · — |
| Tab | 15.3 kB (−50 B) · 4.3 kB CSS (0) | — | — · — · — |
| InputGroup | 65.4 kB (−51 B) · 9.2 kB CSS (0) | — | — · — · — |
| TableCell | 111.0 kB (−51 B) · 20.5 kB CSS (0) | — | — · — · — |
| lab/ListInput | 100.3 kB (−51 B) · 1.3 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 319.8 kB (−51 B) · 454 B CSS (0) | — | — · — · — |
| ContextMenuItem | 40.1 kB (−52 B) · 7.4 kB CSS (0) | — | — · — · — |
| FieldLabel | 58.8 kB (−52 B) · 6.5 kB CSS (0) | — | — · — · — |
| Item | 21.6 kB (−52 B) · 6.3 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 85.1 kB (−53 B) · 12.9 kB CSS (0) | — | — · — · — |
| Collapsible | 30.1 kB (−53 B) · 4.6 kB CSS (0) | — | — · — · — |
| DateRangeInput | 109.2 kB (−53 B) · 14.4 kB CSS (0) | — | — · — · — |
| ListItem | 84.2 kB (−53 B) · 12.9 kB CSS (0) | — | — · — · — |
| Overlay | 24.0 kB (−53 B) · 4.2 kB CSS (0) | — | — · — · — |
| Slider | 119.0 kB (−53 B) · 9.6 kB CSS (0) | — | — · — · — |
| AppShell · Storybook | 93.9 kB (−54 B) · 15.0 kB CSS (0) | 1,357 (0) | — · — · — |
| BottomSheet | 77.1 kB (−54 B) · 7.8 kB CSS (0) | — | — · — · — |
| RadioList | 64.8 kB (−54 B) · 8.0 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 110.8 kB (−54 B) · 20.2 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 98.8 kB (−54 B) · 2.3 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 73.7 kB (−54 B) · 162 B CSS (0) | — | — · — · — |
| CodeBlock | 85.8 kB (−55 B) · 13.0 kB CSS (0) | — | — · — · — |
| Outline | 27.2 kB (−55 B) · 4.3 kB CSS (0) | — | — · — · — |
| SegmentedControl | 105.3 kB (−55 B) · 7.6 kB CSS (0) | — | — · — · — |
| TopNavMegaMenuItem | 15.5 kB (−55 B) · 4.2 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 63.2 kB (−55 B) · 1.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 289.9 kB (−55 B) · 2.4 kB CSS (0) | — | — · — · — |
| ClickableCard | 19.5 kB (−56 B) · 7.9 kB CSS (0) | — | — · — · — |
| Field | 63.3 kB (−56 B) · 8.0 kB CSS (0) | — | — · — · — |
| SideNavHeading | 91.1 kB (−56 B) · 12.7 kB CSS (0) | — | — · — · — |
| TopNavItem | 14.9 kB (−56 B) · 4.0 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 86.8 kB (−56 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 86.8 kB (−56 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/PageControl | 79.4 kB (−56 B) · 716 B CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 70.2 kB (−57 B) · 11.4 kB CSS (0) | — | — · — · — |
| CommandPaletteItem | 13.8 kB (−57 B) · 3.6 kB CSS (0) | — | — · — · — |
| DialogHeader | 72.9 kB (−57 B) · 12.9 kB CSS (0) | — | — · — · — |
| MobileNav | 82.1 kB (−57 B) · 11.9 kB CSS (0) | — | — · — · — |
| MoreMenu | 136.6 kB (−57 B) · 20.0 kB CSS (0) | — | — · — · — |
| Calendar | 80.9 kB (−58 B) · 11.9 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 29.5 kB (−58 B) · 7.2 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 71.5 kB (−58 B) · 11.9 kB CSS (0) | — | — · — · — |
| MultiSelector | 112.2 kB (−58 B) · 19.1 kB CSS (0) | — | — · — · — |
| Step | 32.4 kB (−58 B) · 5.7 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 155.2 kB (−58 B) · 1.6 kB CSS (0) | — | — · — · — |
| Link | 59.7 kB (−59 B) · 7.8 kB CSS (0) | — | — · — · — |
| SegmentedControlItem | 19.8 kB (−59 B) · 4.4 kB CSS (0) | — | — · — · — |
| SelectableCard | 19.7 kB (−59 B) · 8.1 kB CSS (0) | — | — · — · — |
| TopNavHeading | 90.8 kB (−59 B) · 12.6 kB CSS (0) | — | — · — · — |
| lab/TourStep | 99.2 kB (−59 B) · 691 B CSS (0) | — | — · — · — |
| Button | 69.6 kB (−60 B) · 11.2 kB CSS (0) | — | — · — · — |
| Carousel | 80.2 kB (−60 B) · 12.2 kB CSS (0) | — | — · — · — |
| DrawerHeader | 73.1 kB (−60 B) · 14.4 kB CSS (0) | — | — · — · — |
| Banner | 71.7 kB (−61 B) · 11.7 kB CSS (0) | — | — · — · — |
| ChatSendButton | 70.1 kB (−61 B) · 11.3 kB CSS (0) | — | — · — · — |
| Stepper | 71.4 kB (−61 B) · 11.4 kB CSS (0) | — | — · — · — |
| TreeList | 47.8 kB (−61 B) · 6.0 kB CSS (0) | — | — · — · — |
| Typeahead | 98.2 kB (−61 B) · 14.5 kB CSS (0) | — | — · — · — |
| lab/TabBar | 84.9 kB (−61 B) · 1.8 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 90.6 kB (−62 B) · 12.6 kB CSS (0) | — | — · — · — |
| DropdownMenu | 136.4 kB (−62 B) · 20.0 kB CSS (0) | — | — · — · — |
| SideNav | 118.0 kB (−62 B) · 12.7 kB CSS (0) | — | — · — · — |
| Switch | 113.7 kB (−62 B) · 10.9 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 80.2 kB (−62 B) · 14.6 kB CSS (0) | — | — · — · — |
| TopNavMenu | 90.2 kB (−62 B) · 12.6 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 90.6 kB (−63 B) · 12.6 kB CSS (0) | — | — · — · — |
| ChatLayout | 93.5 kB (−63 B) · 11.8 kB CSS (0) | — | — · — · — |
| CheckboxInput | 73.3 kB (−63 B) · 11.0 kB CSS (0) | — | — · — · — |
| FileInput | 79.8 kB (−63 B) · 12.9 kB CSS (0) | — | — · — · — |
| PowerSearch | 323.7 kB (−63 B) · 27.5 kB CSS (0) | — | — · — · — |
| RadioListItem | 81.1 kB (−63 B) · 11.6 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 70.5 kB (−63 B) · 11.3 kB CSS (0) | — | — · — · — |
| TabMenu | 87.3 kB (−63 B) · 12.5 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 70.2 kB (−64 B) · 11.3 kB CSS (0) | — | — · — · — |
| IconButton | 69.7 kB (−64 B) · 11.2 kB CSS (0) | — | — · — · — |
| Thumbnail | 74.2 kB (−64 B) · 12.8 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 313.2 kB (−64 B) · 2.7 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 54.4 kB (−65 B) · 6.4 kB CSS (0) | — | — · — · — |
| ButtonGroup | 45.2 kB (−65 B) · 3.7 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 123.3 kB (−65 B) · 751 B CSS (0) | — | — · — · — |
| NumberInput | 108.6 kB (−67 B) · 13.1 kB CSS (0) | — | — · — · — |
| ProgressBar | 12.5 kB (−67 B) · 7.0 kB CSS (0) | — | — · — · — |
| Table | 129.2 kB (−67 B) · 21.4 kB CSS (0) | — | — · — · — |
| Tokenizer | 116.4 kB (−68 B) · 22.1 kB CSS (0) | — | — · — · — |
| lab/TransferList | 143.2 kB (−68 B) · 1.4 kB CSS (0) | — | — · — · — |
| Toast | 109.7 kB (−69 B) · 11.6 kB CSS (0) | — | — · — · — |
| ChatComposer | 93.5 kB (−70 B) · 13.7 kB CSS (0) | — | — · — · — |
| Popover · Storybook | 108.1 kB (−70 B) · 15.7 kB CSS (0) | 1,924 (0) | — · — · — |
| SelectorOption | 25.4 kB (−70 B) · 6.8 kB CSS (0) | — | — · — · — |
| TimeInput | 184.3 kB (−70 B) · 18.0 kB CSS (0) | — | — · — · — |
| lab/Schedule | 121.4 kB (−70 B) · 3.9 kB CSS (0) | — | — · — · — |
| ComplexSelector | 86.5 kB (−71 B) · 13.4 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 84.4 kB (−71 B) · 13.2 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 82.8 kB (−72 B) · 11.5 kB CSS (0) | — | — · — · — |
| TopNav | 73.2 kB (−72 B) · 12.2 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 107.6 kB (−72 B) · 1.8 kB CSS (0) | — | — · — · — |
| TextInput | 103.6 kB (−74 B) · 12.9 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 94.3 kB (−77 B) · 372 B CSS (0) | — | — · — · — |
| lab/AudioPlayer | 242.0 kB (−445 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/MediaPlaybackRate | 232.1 kB (−465 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaCaptionsButton | 232.1 kB (−466 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaFullscreenButton | 232.1 kB (−466 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTime | 232.1 kB (−466 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaSeekButton | 232.1 kB (−467 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaTimeSlider | 232.1 kB (−467 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaVolume | 232.1 kB (−467 B) · 1.5 kB CSS (0) | — | — · — · — |
| lab/MediaPlayButton | 232.1 kB (−468 B) · 1.5 kB CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/cli 6.33 MB packed (−1 B); no new dependencies
- @astryxdesign/core 8.04 MB packed (+1.6 kB); no new dependencies
Wide change (shared styles: packages/core/src/theme/breakpoints.ts, packages/core/src/theme/themeAdaptations.ts, packages/core/src/utils/touchPresentation.stylex.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
Main moved by 154 commits since 8b5d5e9. The merge has no conflicts. AppShell.tsx and Popover.tsx changed on both sides, in separate hunks.
There was a problem hiding this comment.
Changes requested: the module split itself holds up (the moved code is identical and @astryxdesign/core/theme exports the same names), but two things block approval:
- No current record names
packages/core/src/theme/breakpoints.ts, although Popover, AppShell andutils/touchPresentation.tsimport it, so the new module needs an engineering owner's API decision (architecture:knowledge-contractsDEC-22), which approving this pull request's record amendment would give. - The changeset says "other components that read them" no longer import the theme adaptation writer, but the
./Toastentry still does throughToastViewport→theme/Theme.tsx→defineThemeandgenerateThemeRules, so limit the sentence to the five named components or say every component entry except Toast.
Approval also waits on an engineering owner deciding the amended Owning code lines in architecture:theme-authoring-contract, which move ownership of the breakpoint vocabulary from themeAdaptations.ts to breakpoints.ts. An engineering owner records that decision by commenting /approve-spec <full head SHA> on the pull request for its final head, and the author may do so as an engineering owner. Non-blocking: the SYNC comment at packages/cli/api/theme/build/build.mjs:2145 still points to themeAdaptations.ts for the default width points.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
Claims:
- The touch presentation resolver, Popover and AppShell imported the breakpoint names or compact definition from
themeAdaptations.ts: verified (their imports on the base). theme/breakpoints.tsholds the names, defaults, size-edge helpers and compact definition and imports nothing: verified (breakpoints.tshas no import statement).themeAdaptations.tsre-exports every moved name, so no export changes: verified (themeAdaptations.ts:44-74;theme/index.ts:48-64is unchanged).- The touch presentation resolver, Popover, AppShell and its unread width point import the new module: verified (
touchPresentation.ts:50,Popover.tsx:58,AppShell.tsx:102,unreadWidthPoint.ts:22). - The eleven new first-load cases fail on
mainand all 22 pass with the change: consistent with a static walk of the import graph (the six modules and five entries reach the writer on the base and not at the head); the tests were not run again at this head. - Rolldown lazy-theme pages 8,854 B and 9,055 B gzip smaller, the reference-page deltas and the outside app's figures: not re-measured.
- The theme adaptation, size-edge and touch presentation suites pass (98 tests): not run again at this head.
- The head merges
mainwith no conflicts and the change is the same 12 files with the same diff: verified. - The records stay aligned under the knowledge check: not run again at this head.
- Changeset: Button, Link, IconButton, Popover, AppShell and other components that read the vocabulary no longer import the writer: false for Toast (
Toast/ToastViewport.tsx:70). - Changeset:
@astryxdesign/core/themeexports the same names: verified (same re-export chain).
Files:
.changeset/theme-breakpoints-module.md: finding (Toast claim).docs/architecture/theme-authoring-contract.md: amendment awaiting an engineering owner.docs/specs/AST-012/spec.md: clear.packages/core/src/AppShell/AppShell.tsx: clear.packages/core/src/AppShell/unreadWidthPoint.ts: clear.packages/core/src/Popover/Popover.tsx: clear.packages/core/src/theme/breakpoints.ts: finding (no current record names it).packages/core/src/theme/themeAdaptations.edges.test.ts: clear.packages/core/src/theme/themeAdaptations.ts: clear.packages/core/src/theme/tokensImports.test.ts: clear.packages/core/src/utils/touchPresentation.stylex.ts: clear.packages/core/src/utils/touchPresentation.ts: clear.
Toast reads the breakpoint vocabulary through its Button, but its viewport also applies the caller's theme through Theme, which imports defineTheme and generateThemeRules, so the Toast entry still imports the theme adaptation writer. The changeset said every component that reads the vocabulary leaves the writer; it now names Toast and why. The CLI's copy of the default width points named themeAdaptations.ts as its SYNC source. This branch moved those points to breakpoints.ts, so the comment now names that file, and a CLI changeset records the change. Tests: no code changes. `pnpm check:changesets` passes, and a walk of every source entry of the package finds two at this head that reach the writer: Toast and the theme entry.
Main moved by 38 commits since 61362fc. The merge has no conflicts, and no file changed on both sides. It brings in meta#13731, which steadies the browser suite's AlertDialog motion test.
|
/approve-spec 8926805 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is a draft, so its CI starts when it is marked ready for review.
The module split holds up: the moved code is identical, @astryxdesign/core/theme exports the same names, the changeset now names Toast as the one component entry that keeps the theme adaptation writer, and the record change that names the new module's owner carries an engineering owner's approval for this head. There are no blocking findings.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Before this change, the touch presentation resolver, Popover and AppShell read the breakpoint names or the compact definition from the theme adaptation module: verified (their base imports, now at
touchPresentation.ts:50,Popover.tsx:58,AppShell.tsx:102andunreadWidthPoint.ts:22). - A bundler that keeps whole modules, or never splits one across chunks, ships the writer with its first reader: bundler behavior, not reproduced here; the import graph it rests on is verified.
- The new breakpoint module holds the names, defaults, size-edge helpers and compact definition, and imports nothing: verified (
breakpoints.ts:1-123has no import). - The adaptation module re-exports every moved name, so no export changes: verified (
themeAdaptations.ts:44-74; the theme entry's index is unchanged). - The touch presentation resolver, Popover, AppShell and its unread width point import the new module: verified (the four lines above).
- The ownership record names the new module, and the theme adaptations spec links both files by path: verified (
theme-authoring-contract.md:15and:308-313;AST-012/spec.md:39-48). - The eleven new boundary cases fail on the base and all 22 pass with the change: consistent with the import graph (the six modules and five entries reach the writer on the base and none do at this head); the suite was not run here.
- The reference-page, lazy-theme and outside-app byte savings: not reproduced here; the twelve theme modules said to leave the first load are the twelve that leave each reference page's import graph.
- The adaptation, size-edge and touch presentation suites (98 tests), the full preflight and the knowledge check pass: not run here.
- The head merges the base branch with no conflicts, and the commit before that merge edits the core changeset and one CLI comment and adds a CLI changeset: verified.
- The import walk over the package entries finds two at this head that reach the writer, Toast and the theme entry: verified for the subpath entries; the root entry also reaches it, since it exports the theme builder.
- Core changeset, the names and the compact definition live in their own import-free module: verified.
- Core changeset, every component entry except Toast stops importing the writer, also when the bundler keeps whole modules: verified under the boundary test's import model (
tokensImports.test.ts:15-19); 72 entries stop reaching it. - Core changeset, Toast still does because its viewport applies the caller's theme: verified (
ToastViewport.tsx:70importsTheme, which imports the theme builder atTheme.tsx:55-56). - Core changeset, the theme entry exports the same names as before: verified.
- CLI changeset, a theme-build comment names the module that now holds the default width points and no command changes: verified (
build.mjs:2145, a comment).
Files:
.changeset/internal-a-comment-in-the-theme-build-names-the--iebk.md: clear..changeset/theme-breakpoints-module.md: clear.docs/architecture/theme-authoring-contract.md: clear.docs/specs/AST-012/spec.md: clear.packages/cli/api/theme/build/build.mjs: clear.packages/core/src/AppShell/AppShell.tsx: clear.packages/core/src/AppShell/unreadWidthPoint.ts: clear.packages/core/src/Popover/Popover.tsx: clear.packages/core/src/theme/breakpoints.ts: clear.packages/core/src/theme/themeAdaptations.edges.test.ts: clear.packages/core/src/theme/themeAdaptations.ts: clear.packages/core/src/theme/tokensImports.test.ts: clear.packages/core/src/utils/touchPresentation.stylex.ts: clear.packages/core/src/utils/touchPresentation.ts: clear.
The vocabulary section that left themeAdaptations.ts for breakpoints.ts carried six citations, and breakpoints.ts cites none, so the no-comment-provenance baseline listed sites that no longer exist. The regenerated baseline lists FR5 and spec:AST-108 for themeAdaptations.ts and is otherwise unchanged. Tests: no code changes. The baseline script's --check passes.
|
/approve-spec f28a63b |
There was a problem hiding this comment.
Approved pending CI: lint, typecheck and the CLI smoke test pass on this head, and the heavy CI jobs (build, test, docsite tests) run once review passes, so they have not run yet.
The module split holds up: the moved code is identical apart from three comment citations, @astryxdesign/core/theme exports the same names, the regenerated comment-provenance baseline matches the citations that remain, and the record change that names the new module's owner carries an engineering owner's approval for this head. There are no blocking findings.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Before this change, the touch presentation resolver, Popover and AppShell read the breakpoint names or the compact definition from the theme adaptation module: verified (their base imports, now at
touchPresentation.ts:50,Popover.tsx:58,AppShell.tsx:102andunreadWidthPoint.ts:22). - A bundler that keeps whole modules, or never splits one across chunks, ships the writer with its first reader: bundler behavior, not reproduced here; the import graph it rests on is verified.
- The new breakpoint module holds the names, defaults, size-edge helpers and compact definition, and imports nothing: verified (
breakpoints.ts:1-123has no import). - The adaptation module re-exports every moved name, so no export changes: verified (
themeAdaptations.ts:44-74; the theme entry's index is unchanged). - The touch presentation resolver, Popover, AppShell and its unread width point import the new module: verified (the four lines above).
- The ownership record names the new module, and the theme adaptations spec links both files by path: verified (
theme-authoring-contract.md:15and:308-313;AST-012/spec.md:39-48). - The eleven new boundary cases fail on the base and all 22 pass with the change: consistent with the import graph (the six modules and five entries reach the writer on the base and none do at this head, even when every import and re-export is followed); the suite was not run here.
- The reference-page, lazy-theme and outside-app byte savings: not reproduced here.
- The adaptation, size-edge and touch presentation suites (98 tests), the full preflight, the pre-review check and the knowledge check pass: not run here; the pre-review check's count of 15 changed files is verified.
- The last commit only updates the comment-provenance baseline, dropping the six citations that left with the moved code: verified (the commit changes only that file; the remaining entries match the one cited comment at
themeAdaptations.ts:115, andbreakpoints.tscites nothing); CI's lint job at this head reports the baseline up to date. - The head merges the base branch with no conflicts, and the commit before that merge edits the core changeset and one CLI comment and adds a CLI changeset: verified.
- The import walk over the package entries finds two at this head that reach the writer, Toast and the theme entry: verified for the subpath entries under the boundary test's import model; the root entry also reaches it, since it exports the theme builder.
- The owner-decision section gives the new module's usage, why it is needed and why existing modules are not enough: verified against the four importers and the re-exports.
- Core changeset, the names and the compact definition live in their own import-free module: verified.
- Core changeset, every component entry except Toast stops importing the writer, also when the bundler keeps whole modules: verified under the boundary test's import model; following every barrel re-export, CodeBlock and Markdown still reach it through the theme barrel, which Core's
sideEffectslist lets bundlers drop. - Core changeset, Toast still does because its viewport applies the caller's theme: verified (
ToastViewport.tsx:70importsTheme, which imports the theme builder atTheme.tsx:55-56). - Core changeset, the theme entry exports the same names as before: verified.
- CLI changeset, a theme-build comment names the module that now holds the default width points and no command changes: verified (
build.mjs:2145, a comment).
Files:
.changeset/internal-a-comment-in-the-theme-build-names-the--iebk.md: clear..changeset/theme-breakpoints-module.md: clear.docs/architecture/theme-authoring-contract.md: clear.docs/specs/AST-012/spec.md: clear.internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear.packages/cli/api/theme/build/build.mjs: clear.packages/core/src/AppShell/AppShell.tsx: clear.packages/core/src/AppShell/unreadWidthPoint.ts: clear.packages/core/src/Popover/Popover.tsx: clear.packages/core/src/theme/breakpoints.ts: clear.packages/core/src/theme/themeAdaptations.edges.test.ts: clear.packages/core/src/theme/themeAdaptations.ts: clear.packages/core/src/theme/tokensImports.test.ts: clear.packages/core/src/utils/touchPresentation.stylex.ts: clear.packages/core/src/utils/touchPresentation.ts: clear.
User impact
A page with a Button, a Link, a Popover or an AppShell can load the theme adaptation writer and the theme value resolver up front. It happens under Rolldown when the page also loads a theme lazily, and under any bundler that keeps whole modules.
Problem and solution fit
touchPresentation.ts, Popover and AppShell import the compact definition or the breakpoint names fromthemeAdaptations.ts. That module also holds the rule writer and its imports.Expected behavior and authority
architecture:component-import-boundaries: a public import carries what renders without interaction.architecture:theme-authoring-contractnames the owner of each theme authoring module, and this change amends it.Smallest restoration
theme/breakpoints.tstakes the vocabulary section ofthemeAdaptations.ts: the breakpoint names and defaults, the size-edge helpers and the compact definition. It imports nothing.themeAdaptations.tsre-exports every name, so no export changes.touchPresentation.ts, Popover, AppShell and its unread width point import the new module.architecture:theme-authoring-contractnow namesbreakpoints.tsas the breakpoint vocabulary's owner.spec:AST-012links both files by path.Evidence
tokensImports.test.tscases fail on main (test).import()@astryxdesign/core/theme: first load 8,869 B and 9,036 B gzip smaller (test). The form page, with the same import, changes by 2 B (test).tokensImports.test.ts.Scope
Components: theme, Popover, AppShell
Testing
pnpm preflight --browserat 8926805, the merged head (CI unset,VITEST_MAX_WORKERS=12,ASTRYX_STRICT_LINT=1): every check passes (test). Its interaction step passed 1,979 tests and skipped 54, and its accessibility step passed 703 and skipped 5 (test).mainat d63c249, so it also checked 12 newermaincommits (test).pnpm review:pre --base a90cd4a110e1finds nothing in the 15 changed files at this head (test).--checkpasses at this head (test).mainat a90cd4a, with no conflicts (test). The commit before that merge edits the core changeset and one CLI comment, and adds a CLI changeset.pnpm exec vitest run --project ui packages/core/src/theme/tokensImports.test.ts: 11 of 22 cases fail at the test-only commit, and all 22 pass with the fix (test).pnpm exec vitest run --project ui packages/core/src/theme/themeAdaptations.test.ts packages/core/src/theme/themeAdaptations.edges.test.ts packages/core/src/utils/touchPresentation.test.ts: 98 tests pass (test).pnpm size:pages --base a90cd4a110e1 --head 89268053c428 --bundler rolldown: the reference-page numbers above (test).size:pages --bundler rolldownbuilds them, plus oneimport()of the built@astryxdesign/core/themeentry (test). Without that import, the figures equal those ofsize:pages(test).pnpm check:knowledge: templates and records are aligned.tokensImports.test.tswalk, run over every package entry: 74 of 173 entries reach the theme adaptation writer onmain, 2 at this head (test). The two are./Toast, whose viewport applies the caller's theme, and./theme, the writer's own entry.Owner decision asked (DEC-22)
theme/breakpoints.tsis a new internal module that other components import, soarchitecture:knowledge-contractsDEC-22 asks for an owner decision. This pull request's amendment toarchitecture:theme-authoring-contractrecords it: the module joinsapplies_to, and an Owning code line names what it owns.touchPresentation.ts, Popover, AppShell and its unread width point import it, andthemeAdaptations.tsre-exports every name.themeAdaptations.ts, beside the writer and its imports.Writing rubric results
applies_topath and apath-applicability:v1block.