Repository navigation
fix(core): a theme value left undefined in a part or surface is not set - #11760
Conversation
… or surface is not set, as a page token's is The stylesheet writes nothing for it and an inherited value for that property stays; before, it wrote the text 'undefined', which the browser drops.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
…t, as everywhere else; null is still refused
There was a problem hiding this comment.
This needs an owner decision before it can be approved, and one fix.
No current record says whether an undefined value in a theme's component block (a part, a pseudo-class block, an @light/@dark block, a media surface or an adaptation rule) means "not set", so approval waits on an engineering owner settling that rule; an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Blocking
- The release note and the
mergeComponents.tsheader say an inherited value stays, but anundefinedinside an@light/@darkblock still erases the inherited mode value (mergeComponents.ts:64-69) and a restated pseudo-class block still replaces the inherited block whole, so filterundefinedin the color-mode merge, add a@darkcase to the inheritance test, and narrow the release note for pseudo-class blocks.
Also worth updating with the fix: the description's 1,788/1,788 test count (the head runs 1,789, all passing) and the comment at themeAdaptations.ts:671-672, which puts two topics in one sentence.
Claims and files checked
- Claim: an undefined part, pseudo-class or surface value writes no
: undefined;declaration and no empty rule. Verified:generateThemeRules.test.ts:193fails on the base and passes on the head. - Claim: a child's undefined part property keeps the base's value. Verified for style-key properties (
generateThemeRules.test.ts:219); false for@light/@darkand pseudo-class blocks (blocking finding). - Claim: the token cascade skips undefined, as its comment requires. Verified at
generateThemeRules.ts:585-592. - Claim: an adaptation rule's undefined part value is now not set, where
defineThemeused to refuse the theme. Verified:themeAdaptations.test.ts:268throws on the base and passes on the head. - Claim:
nullis unchanged and still refused in an adaptation rule. Verified: the root still writespadding: null;and the adaptation test expects the throw. - Claim: before, the stylesheet held
padding: undefined;and the inherited value was lost. Verified on the base. - Claim: the new tests fail without the fix. Verified: three fail on the base.
- Claim: the theme tests pass 1,788/1,788. Outdated: the head runs 1,789, all passing.
- Claim: tsc, eslint and prettier are clean. Verified on the changed files.
- Claim: no record states how an undefined component value is treated. Verified; this is the open owner decision.
.changeset/core-theme-undefined-declaration.md: finding (inheritance wording).packages/core/src/theme/generateThemeRules.ts: clear.packages/core/src/theme/mergeComponents.ts: finding (color-mode merge and header comment).packages/core/src/theme/themeAdaptations.ts: clear apart from the comment suggestion.packages/core/src/theme/generateThemeRules.test.ts: clear.packages/core/src/theme/themeAdaptations.test.ts: clear.
…ed value too; the authoring contract states the undefined rule A restated pseudo-class block still replaces the inherited one whole; undefined inside it is not set. null keeps its meaning.
|
/approve-spec 0e924bb |
There was a problem hiding this comment.
Changes requested: two fixes are needed before approval. The spec direction itself is settled by the engineering owner's approval of this head.
- The new line in
docs/architecture/theme-authoring-contract.md(lines 128-130) says an inherited value stays when a pseudo-class block leaves a valueundefined, but a restated pseudo-class block still replaces the inherited block whole (mergeComponents.ts:12-14and the release note say so), so a child':hover': {color: undefined}drops the base's hovercolorandbackground; reword the line to match the code, then re-approve the new head. - Miss: an adaptation rule whose part or component is itself
undefined(components: {card: {base: undefined}}) now passesdefineTheme, becausethemeAdaptations.ts:671-674skipsundefinedat every depth, and compilation then throwsTypeError: Cannot convert undefined or null to objectatgenerateThemeRules.ts:1390instead of the named error the base gave; treat anundefinedcomponent or style key as not set where component maps are read (or keep refusing it above property depth), with a test.
The @dark inheritance fix and the narrowed release note address the earlier inline comments. Non-blocking: the surface test case uses onDark.tokens, which already worked without the fix, so please add an onDark.components case.
Claims and files checked
- Release note: an
undefinedpart, color-mode, pseudo-class, surface or rule-part value now writes nothing: verified by the new tests and by probes. - Release note: this matches how page tokens already behaved: verified.
- Release note: inherited style-key and color-mode values stay, and a restated pseudo-class block still replaces the inherited one: verified.
- Release note: before, the stylesheet held
undefined, inherited values were lost, and an adaptation rule was refused: verified on the base. - Release note:
nullkeeps its meaning and an adaptation rule still refuses it: verified. - Description: emit, pseudo-class and token-cascade skips, and the merge filter for style keys and color-mode blocks: verified in the code.
- Description: each
undefinedcase fails without the fix: verified per test; the surface sub-case alone (surface tokens) already passed before. - Description: the theme suite (30 files, 1,790 tests), typecheck, lint and formatting pass: verified.
- Description: one record line in the theme authoring contract: verified; it overstates the pseudo-class case.
.changeset/core-theme-undefined-declaration.md: clear.docs/architecture/theme-authoring-contract.md: blocking finding above.packages/core/src/theme/generateThemeRules.ts: clear; the crash surfaces here.packages/core/src/theme/mergeComponents.ts: clear.packages/core/src/theme/themeAdaptations.ts: blocking finding above; the comment "as everywhere else" is vague.packages/core/src/theme/generateThemeRules.test.ts: non-blocking surface test gap.packages/core/src/theme/themeAdaptations.test.ts: clear.
…r component maps are read One normalizer drops what a component map leaves undefined (a component, a style key, a property at any depth) for the merge and each resolved layer; the emit skips them too. The record line says exactly what the code does: inherited values stay in a style key or color-mode block, and a restated pseudo-class block replaces the inherited one whole.
|
/approve-spec cae2c0a |
There was a problem hiding this comment.
Changes requested: one fix is needed before approval. The spec direction is settled by an engineering owner's approval of this head, and the earlier @dark inheritance, record-wording and adaptation-crash findings are fixed.
- Miss: in an adaptation rule that also sets
typography.scale, a type-scale leaf leftundefined(for examplecomponents: {text: {'type:body': {fontSize: undefined}}}) still counts as an authored write, becauseomitRootTypeScaleDefaultsreads the rawrule.value.components(themeAdaptations.ts:1080, filtered byObject.hasOwnat:993), so the rule writesfont-size: var(--text-body-size)and overrides an earlier rule's value wherever both match, contrary to the new authoring-contract line and AST-012 FR6; passingwithoutUnsetComponents(rule.value.components)there fixes it, with a test for this case.
Non-blocking: mergeComponents.test.ts:38 passes without the fix because toEqual ignores undefined keys (use toStrictEqual), and a component map left empty, such as text: {base: undefined}, still writes Text's colour and size override rules.
Claims and files checked
- Release note: an
undefinedvalue in a part, color-mode block, pseudo-class block, surface or plain adaptation rule now writes nothing: verified by the new tests and by before/after runs; false for a type-scale leaf in a rule that sets a type scale (finding above). - Release note: an
undefinedcomponent or style key is not set either: verified; an emptied Text, Heading or Link map still writes their prop override rules (non-blocking). - Release note: this matches how page tokens already behaved: verified.
- Release note: inherited style-key and color-mode values stay, and a restated pseudo-class block still replaces the inherited one: verified.
- Release note: before, the stylesheet held
undefined, the inherited value was lost, and an adaptation rule was refused: verified on the base. - Release note:
nullkeeps its meaning and an adaptation rule still refuses it: verified. - Description: the emitter, pseudo-class blocks and the token cascade skip
undefined; the merge drops a child'sundefined: verified in the code and tests. - Description: one normalizer handles every place component maps are read: false, the type-scale filter for adaptation rules reads the raw map (finding above).
- Description: an
undefinedcomponent or style key builds nothing instead of throwing a TypeError: verified. - Description: each
undefinedcase it lists fails without the fix: verified (five tests fail on the base); one extra merge test passes on the base (non-blocking). - Description: the theme suite (31 files, 1,794 tests), typecheck, lint and formatting pass: verified.
- Description: one record line in the theme authoring contract: verified, and approved for this head.
.changeset/core-theme-undefined-declaration.md: clear.docs/architecture/theme-authoring-contract.md: clear; the code contradicts its adaptation clause for type-scale leaves (finding above).packages/core/src/theme/generateThemeRules.ts: clear; non-blocking empty-map note.packages/core/src/theme/generateThemeRules.test.ts: clear.packages/core/src/theme/mergeComponents.ts: its comment says every reader uses the normalizer (finding above); non-blocking header length.packages/core/src/theme/mergeComponents.test.ts: non-blockingtoEqualnote.packages/core/src/theme/resolveThemeValues.ts: clear.packages/core/src/theme/themeAdaptations.test.ts: clear; the type-scale case is missing.
<!-- codebunny-mode: full; reason: spec-record -->
… a component whose every value is undefined is not set The adaptation lowering reads the rule's authored map through the same normalizer, so a type-scale leaf left undefined does not count as an authored write. A component or block whose every value is left undefined is dropped, so it writes no Text/Heading/Link override rules; the stylesheet reads a rule source's map through the normalizer once.
|
/approve-spec 14cd48e |
There was a problem hiding this comment.
Changes requested: one fix is needed before approval. The spec direction is approved by an engineering owner for this head, and the earlier type-scale, empty-component and test findings are fixed.
- A restated pseudo-class block whose every value is
undefinedis now dropped before the merge (mergeComponents.ts:44-54), so anextendschild's':hover': {color: undefined}keeps the base's whole hover block, although the new authoring-contract line and the release note say a restated pseudo-class block replaces the inherited one whole; keep such a block as an empty block (collapse only components and style keys) or state the new rule in the record line and release note for a fresh owner approval, and add anextendstest for it.
Non-blocking: the mergeComponents.ts header is still 17 lines and repeats the withoutUnsetComponents JSDoc, and the comment at generateThemeRules.ts:1230-1232 could say plainly that a raw source can hold undefined.
Claims and files checked
Review mode: incremental; reason: none
- Release note: a value left
undefinedin a part, colour-mode block, pseudo-class block, surface or adaptation rule now writes nothing: verified by the new tests, which fail on the base. - Release note: a component or style key left
undefined, or one whose every value is, is not set: verified. - Release note: this matches how page tokens already behaved: verified.
- Release note: inherited style-key and colour-mode values stay: verified.
- Release note: a restated pseudo-class block still replaces the inherited one whole: false when every value in the block is
undefined(finding above). - Release note: before, the stylesheet held
undefined, the inherited value was lost, and an adaptation rule was refused: verified on the base. - Release note:
nullkeeps its meaning and an adaptation rule still refuses it: verified. - Description:
joinDeclarations, the component emit, empty pseudo-class blocks and the token cascade skipundefined: verified; the component emit now relies on the normalizer at entry. - Description: the merge drops a child's
undefinedin style keys and colour-mode blocks: verified. - Description: a restated pseudo-class block replaces the base's block whole, as before: false for a block whose every value is
undefined(finding above). - Description: an adaptation rule's
undefinedpart is not set andnullis still refused: verified. - Description: one normalizer wherever component maps are read; an
undefinedcomponent builds nothing; a component left with nothing set writes no Text or Link override rules; a scale rule'sundefinedtype-scale leaf is no write: verified. - Description: each
undefinedcase fails without the fix: verified (eight tests fail on the base). - Description: the theme suite (31 files, 1,796 tests), typecheck, lint and formatting pass: verified.
- Description: one record line in the theme authoring contract: verified, and approved for this head.
.changeset/core-theme-undefined-declaration.md: the pseudo-class claim is false (finding above).docs/architecture/theme-authoring-contract.md: clear; the code departs from its pseudo-class clause (finding above).packages/core/src/theme/generateThemeRules.ts: clear; non-blocking comment wording.packages/core/src/theme/generateThemeRules.test.ts: clear.packages/core/src/theme/mergeComponents.ts: the finding above; non-blocking header length.packages/core/src/theme/mergeComponents.test.ts: clear.packages/core/src/theme/resolveThemeValues.ts: clear.packages/core/src/theme/themeAdaptations.ts: clear; the earlier type-scale finding is fixed.packages/core/src/theme/themeAdaptations.test.ts: clear.
…ed still replaces the inherited one Only a component or style key whose every value is undefined collapses; a nested pseudo-class or color-mode block stays, empty, so a restated pseudo-class block replaces the base's whole.
|
/approve-spec bf0424a |
|
/approve-spec 10aa066 |
|
/approve-spec 504ab0e |
There was a problem hiding this comment.
Changes requested: one fix is needed before approval. The not-set rule itself is approved by an engineering owner at this head, the public API and every built theme are unchanged, and every earlier finding is fixed.
- The release note and the description say a component whose every value is
undefinedwrites nothing, buttext: {base: {'@dark': {color: undefined}}}keeps an empty@darkblock (mergeComponents.ts:61-64) and still writes Text's 17 prop override rules (Heading 10, Link 6), so drop an emptied color-mode block there, say that a restated pseudo-class block stays empty, and add@darkand:hovercases to the Text, Heading and Link override test.
Non-blocking: one new comment in generateThemeRules.ts has a 35-word sentence; the inline suggestion shortens it.
Claims and files checked
Review mode: incremental; reason: none
- Claim: undefined part, pseudo-class and surface values were written as text on the base and now write nothing, with no warning: verified (tests fail on the base and pass on the head)
- Claim: a child's undefined value keeps the inherited value in a style key and a color-mode block: verified (tests, including an inherited surface)
- Claim: a restated pseudo-class block still replaces the inherited one whole: verified (new test)
- Claim: an adaptation rule's undefined part is not set and null is still refused: verified (adaptation tests)
- Claim: a scale rule's undefined type-scale value is no write, so an earlier rule's value stands: verified (fails on the base, passes on the head)
- Claim: an undefined component or style key builds nothing instead of throwing: verified
- Claim: a component or block whose every value is undefined is dropped and writes no Text or Link override rules: false when the undefined values sit in a color-mode or pseudo-class block
- Claim: null keeps its meaning: verified (null cases pass on the base and the head)
- Claim: each undefined case fails without the fix: verified (9 of 9)
- Claim: the theme tests pass (31 files, 1,797 tests) and type checking, lint and formatting are clean: verified
- Claim: the authoring-contract line reads as quoted: verified
- File
.changeset/core-theme-undefined-declaration.md: finding (the claim above) - File
docs/architecture/theme-authoring-contract.md: clear - File
packages/core/src/theme/generateThemeRules.ts: non-blocking comment note - File
packages/core/src/theme/generateThemeRules.test.ts: clear - File
packages/core/src/theme/mergeComponents.ts: finding (lines 61-64) - File
packages/core/src/theme/mergeComponents.test.ts: clear - File
packages/core/src/theme/resolveThemeValues.ts: clear - File
packages/core/src/theme/themeAdaptations.ts: clear - File
packages/core/src/theme/themeAdaptations.test.ts: clear
…et; an emptied pseudo-class block stays So a component whose every value is undefined writes no Text/Heading/Link override rules, while a restated pseudo-class block still replaces the inherited one whole and its component counts as themed.
|
/approve-spec a2e36ed |
…r regex The @dark/@light cases equal the theme without those components; the :hover cases equal the same components given an empty style key (their prop override rules and nothing else), so rules main writes regardless do not break it.
|
/approve-spec 19e3c92 |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentThread | 362.2 kB (+12 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 369.5 kB (+10 B) · 2.5 kB CSS (0) | — | — · — · — |
| Markdown | 201.9 kB (+8 B) · 21.7 kB CSS (0) | — | — · — · — |
121 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/DialogHeroHeader | 88.4 kB (+8 B) · 372 B CSS (0) | — | — · — · — |
| Lightbox | 145.8 kB (+7 B) · 11.9 kB CSS (0) | — | — · — · — |
| Overlay | 23.0 kB (+7 B) · 3.9 kB CSS (0) | — | — · — · — |
| Toast | 103.5 kB (+7 B) · 11.1 kB CSS (0) | — | — · — · — |
| lab/ListInput | 93.4 kB (+7 B) · 922 B CSS (0) | — | — · — · — |
| ContextMenuItem | 35.1 kB (+6 B) · 6.9 kB CSS (0) | — | — · — · — |
| charts/Chart | 237.4 kB (+5 B) · 516 B CSS (0) | — | — · — · — |
| PowerSearch | 306.1 kB (+4 B) · 25.5 kB CSS (0) | — | — · — · — |
| TableCell | 121.6 kB (+4 B) · 18.9 kB CSS (0) | — | — · — · — |
| ContextMenu | 120.3 kB (+3 B) · 18.4 kB CSS (0) | — | — · — · — |
| TextArea | 66.7 kB (+3 B) · 9.4 kB CSS (0) | — | — · — · — |
| lab/TourStep | 93.0 kB (+3 B) · 691 B CSS (0) | — | — · — · — |
| ChatLayout | 88.2 kB (+2 B) · 11.3 kB CSS (0) | — | — · — · — |
| FileInput | 74.0 kB (+2 B) · 11.7 kB CSS (0) | — | — · — · — |
| Selector | 112.6 kB (+2 B) · 18.5 kB CSS (0) | — | — · — · — |
| ToggleButton | 91.9 kB (+2 B) · 10.9 kB CSS (0) | — | — · — · — |
| AlertDialog | 128.5 kB (+1 B) · 15.4 kB CSS (0) | — | — · — · — |
| Banner | 66.9 kB (+1 B) · 11.3 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 96.3 kB (+1 B) · 13.1 kB CSS (0) | — | — · — · — |
| Carousel | 74.5 kB (+1 B) · 11.7 kB CSS (0) | — | — · — · — |
| CheckboxInput | 68.8 kB (+1 B) · 10.1 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 79.6 kB (+1 B) · 11.9 kB CSS (0) | — | — · — · — |
| ComplexSelector | 77.4 kB (+1 B) · 12.6 kB CSS (0) | — | — · — · — |
| DateInput | 199.8 kB (+1 B) · 17.9 kB CSS (0) | — | — · — · — |
| DateRangeInput | 99.2 kB (+1 B) · 13.3 kB CSS (0) | — | — · — · — |
| DialogHeader | 67.7 kB (+1 B) · 12.3 kB CSS (0) | — | — · — · — |
| InputGroup | 60.9 kB (+1 B) · 7.9 kB CSS (0) | — | — · — · — |
| MoreMenu | 107.1 kB (+1 B) · 18.6 kB CSS (0) | — | — · — · — |
| Outline | 25.3 kB (+1 B) · 4.1 kB CSS (0) | — | — · — · — |
| Pagination | 123.6 kB (+1 B) · 18.9 kB CSS (0) | — | — · — · — |
| Popover | 98.4 kB (+1 B) · 15.1 kB CSS (0) | — | — · — · — |
| TopNav | 77.9 kB (+1 B) · 11.7 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 92.8 kB (+1 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 68.6 kB (+1 B) · 162 B CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 305.3 kB (+1 B) · 2.6 kB CSS (0) | — | — · — · — |
| AvatarGroupOverflow | 51.8 kB (0) · 5.7 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 78.2 kB (0) · 11.7 kB CSS (0) | — | — · — · — |
| BottomSheet | 73.0 kB (0) · 7.7 kB CSS (0) | — | — · — · — |
| Button | 64.9 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| ButtonGroup | 44.1 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| Calendar | 76.0 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 82.0 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 82.0 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 65.4 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 65.4 kB (0) · 11.0 kB CSS (0) | — | — · — · — |
| ChatSendButton | 65.3 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| ClickableCard | 18.5 kB (0) · 7.3 kB CSS (0) | — | — · — · — |
| Collapsible | 29.0 kB (0) · 4.5 kB CSS (0) | — | — · — · — |
| CommandPaletteItem | 13.4 kB (0) · 3.6 kB CSS (0) | — | — · — · — |
| DrawerHeader | 67.9 kB (0) · 13.7 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 28.3 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 27.5 kB (0) · 6.8 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 28.4 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 79.1 kB (0) · 10.3 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.2 kB (0) · 5.8 kB CSS (0) | — | — · — · — |
| IconButton | 64.9 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| Item | 20.3 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| ListItem | 78.8 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| MobileNav | 76.1 kB (0) · 11.4 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 65.2 kB (0) · 10.8 kB CSS (0) | — | — · — · — |
| NumberInput | 77.4 kB (0) · 12.2 kB CSS (0) | — | — · — · — |
| ProgressBar | 11.9 kB (0) · 6.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 75.8 kB (0) · 10.5 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.0 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| SegmentedControlItem | 18.8 kB (0) · 4.3 kB CSS (0) | — | — · — · — |
| SelectableCard | 18.7 kB (0) · 7.5 kB CSS (0) | — | — · — · — |
| SelectorOption | 23.8 kB (0) · 6.6 kB CSS (0) | — | — · — · — |
| SideNavHeading | 82.3 kB (0) · 12.1 kB CSS (0) | — | — · — · — |
| SideNavItem | 76.8 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| Step | 31.6 kB (0) · 5.6 kB CSS (0) | — | — · — · — |
| Tab | 14.9 kB (0) · 4.2 kB CSS (0) | — | — · — · — |
| Table | 138.5 kB (0) · 19.4 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 121.3 kB (0) · 18.7 kB CSS (0) | — | — · — · — |
| TabMenu | 78.7 kB (0) · 11.9 kB CSS (0) | — | — · — · — |
| Thumbnail | 69.2 kB (0) · 12.3 kB CSS (0) | — | — · — · — |
| TimeInput | 174.6 kB (0) · 16.9 kB CSS (0) | — | — · — · — |
| Timestamp | 35.8 kB (0) · 11.0 kB CSS (0) | — | — · — · — |
| ToggleButtonGroup | 41.3 kB (0) · 3.7 kB CSS (0) | — | — · — · — |
| Token | 29.3 kB (0) · 4.8 kB CSS (0) | — | — · — · — |
| TopNavItem | 14.5 kB (0) · 4.0 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 75.9 kB (0) · 12.6 kB CSS (0) | — | — · — · — |
| TopNavMegaMenuItem | 14.3 kB (0) · 4.2 kB CSS (0) | — | — · — · — |
| TopNavMenu | 81.4 kB (0) · 12.0 kB CSS (0) | — | — · — · — |
| TreeList | 46.2 kB (0) · 5.9 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 113.3 kB (0) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 114.5 kB (0) · 1.1 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.2 kB (0) · 1.2 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 92.3 kB (0) · 751 B CSS (0) | — | — · — · — |
| lab/NavigationScreen | 84.9 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 84.9 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/PageControl | 78.1 kB (0) · 709 B CSS (0) | — | — · — · — |
| lab/Schedule | 114.5 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
| lab/TabBar | 83.5 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 101.6 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
| AppShell | 97.4 kB (−1 B) · 14.3 kB CSS (0) | — | — · — · — |
| ChatComposer | 84.4 kB (−1 B) · 12.9 kB CSS (0) | — | — · — · — |
| CheckboxList | 73.0 kB (−1 B) · 7.8 kB CSS (0) | — | — · — · — |
| CodeBlock | 79.9 kB (−1 B) · 12.1 kB CSS (0) | — | — · — · — |
| DropdownMenu | 106.8 kB (−1 B) · 18.6 kB CSS (0) | — | — · — · — |
| Field | 59.3 kB (−1 B) · 7.3 kB CSS (0) | — | — · — · — |
| Link | 56.2 kB (−1 B) · 7.1 kB CSS (0) | — | — · — · — |
| MultiSelector | 101.3 kB (−1 B) · 17.7 kB CSS (0) | — | — · — · — |
| RadioList | 60.6 kB (−1 B) · 7.3 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 65.7 kB (−1 B) · 10.8 kB CSS (0) | — | — · — · — |
| Slider | 114.3 kB (−1 B) · 8.9 kB CSS (0) | — | — · — · — |
| Stepper | 66.6 kB (−1 B) · 10.9 kB CSS (0) | — | — · — · — |
| Switch | 108.8 kB (−1 B) · 10.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 75.1 kB (−1 B) · 14.0 kB CSS (0) | — | — · — · — |
| TextInput | 72.6 kB (−1 B) · 12.0 kB CSS (0) | — | — · — · — |
| Tokenizer | 103.5 kB (−1 B) · 20.1 kB CSS (0) | — | — · — · — |
| TopNavHeading | 82.0 kB (−1 B) · 12.0 kB CSS (0) | — | — · — · — |
| Typeahead | 87.5 kB (−1 B) · 13.3 kB CSS (0) | — | — · — · — |
| lab/TransferList | 111.8 kB (−1 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 120.6 kB (−1 B) · 1.4 kB CSS (0) | — | — · — · — |
| CommandPalette | 79.1 kB (−2 B) · 12.7 kB CSS (0) | — | — · — · — |
| DateTimeInput | 223.3 kB (−2 B) · 19.7 kB CSS (0) | — | — · — · — |
| SideNav | 121.1 kB (−2 B) · 12.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 299.3 kB (−2 B) · 454 B CSS (0) | — | — · — · — |
| richtext/RichTextView | 281.9 kB (−2 B) · 2.3 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 162.5 kB (−3 B) · 1.9 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.59 MB packed (+1.8 kB); no new dependencies.
Wide change (shared styles: packages/core/src/theme/generateThemeRules.ts, packages/core/src/theme/mergeComponents.ts, packages/core/src/theme/resolveThemeValues.ts, and 1 more): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: one fix is needed before approval, and it is a description edit. The not-set rule is approved by an engineering owner at this head, CI passes, the public API and every built theme are unchanged, and the earlier color-mode finding is fixed.
- The description's normalizer bullet says a component or block whose every value is
undefinedis dropped and writes no Text/Link override rules, but a restated pseudo-class block whose every value isundefinedstays empty (mergeComponents.ts:65-68) and its component still writes those rules, as the test atgenerateThemeRules.test.ts:308-325asserts, so reword that bullet the way the changeset already says it.
Non-blocking (Miss): the readEntries JSDoc opens with a 27-word sentence; the inline suggestion splits it.
Claims and files checked
Review mode: incremental; reason: none
- Claim: on the base, an undefined value in a component, pseudo-class or surface block was written as the text
undefined, and a child's undefined replaced the inherited value: verified (the new tests fail on the base) - Claim: the declaration writer skips undefined, an emptied pseudo-class block writes no rule, and the token cascade skips undefined: verified (theme rule generator and its tests)
- Claim: the merge drops a child's own undefined values, so the inherited value stays in a style key and a color-mode block: verified (merge and inheritance tests)
- Claim: a restated pseudo-class block still replaces the inherited one whole: verified (pseudo-class inheritance test)
- Claim: an adaptation rule's undefined part value is not set, and null is still refused: verified (adaptation tests)
- Claim: one normalizer reads component maps in the merge, each resolved layer and the stylesheet, so an undefined component or style key builds nothing instead of throwing: verified
- Claim: a component or block whose every value is undefined is dropped and writes no Text or Link override rules: false for a pseudo-class block, which stays and keeps its component themed
- Claim: a scale rule's undefined type-scale value is no write, so an earlier rule's value stands: verified (fails on the base, passes on the head)
- Claim: null keeps its meaning: verified (null cases pass on the base and the head)
- Claim: each undefined case fails without the fix: verified (9 of 9)
- Claim: the theme tests pass (31 files, 1,800 tests) and type checking, lint and formatting are clean: verified
- Claim: the authoring-contract line reads as quoted, and the writing rubric finds nothing: verified
- Release note: undefined values in a part, color-mode block, pseudo-class block, surface or adaptation rule are not set: verified
- Release note: a component, style key or color-mode block left undefined, or whose every value is, writes nothing: verified
- Release note: the inherited value stays in a style key or color-mode block; a restated pseudo-class block replaces the inherited one, stays empty and keeps its component themed: verified
- Release note: before, the stylesheet held
undefined, the inherited value was lost, and an adaptation rule refused the theme: verified - Release note: null replaces an inherited value, is written as it is, and an adaptation rule still refuses it: verified
- File
.changeset/core-theme-undefined-declaration.md: clear - File
docs/architecture/theme-authoring-contract.md: clear - File
packages/core/src/theme/generateThemeRules.ts: clear - File
packages/core/src/theme/generateThemeRules.test.ts: clear - File
packages/core/src/theme/mergeComponents.ts: non-blocking comment note - File
packages/core/src/theme/mergeComponents.test.ts: clear - File
packages/core/src/theme/resolveThemeValues.ts: clear - File
packages/core/src/theme/themeAdaptations.ts: clear - File
packages/core/src/theme/themeAdaptations.test.ts: clear
|
/approve-spec 4888fa2 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
A theme value left undefined in a component block, pseudo-class or color-mode block, surface or adaptation rule is now not set, as the authoring-contract line approved for this head states, and the nine new tests fail without the fix and pass with it. The description now states the pseudo-class exception and the readEntries comment uses short sentences, so nothing from the last review remains.
Claims and files checked
Review mode: incremental; reason: none
Claims (description):
- The base wrote an undefined part, pseudo-class or surface value as the text
undefined: verified, the new test atgenerateThemeRules.test.ts:193fails on the base. - A child's undefined replaced the inherited value because maps merged by spread: verified, base
mergeComponents.tsspread the child's block;generateThemeRules.test.ts:226fails on the base. - The declaration writer, component emit and token cascade skip undefined, and an emptied pseudo-class block writes no rule: verified,
generateThemeRules.ts:504-507and:586-588; test:193. - The merge drops a child's undefined in style keys and color-mode blocks, and a restated pseudo-class block still replaces the base's: verified,
mergeComponents.ts:95-96and:122-128;mergeComponents.test.ts:22,generateThemeRules.test.ts:328. - An adaptation rule's undefined part is not set and null is still refused: verified,
resolveThemeValues.ts:397runs before the check atthemeAdaptations.ts:1043;themeAdaptations.test.ts:268. - One normalizer serves the merge, each resolved layer and the emit,
card: {base: undefined}builds nothing, and an all-undefined component, style key or color-mode block is dropped with no Text, Heading or Link overrides: verified,mergeComponents.ts:61-84,generateThemeRules.ts:1233; testsgenerateThemeRules.test.ts:254and:270. - A restated all-undefined pseudo-class block stays empty, replaces the inherited block and keeps its component themed: verified,
mergeComponents.ts:63-66;generateThemeRules.test.ts:308-325and:328. - An adaptation rule's undefined type-scale leaf is no write, so an earlier rule's value stands: verified,
themeAdaptations.ts:1082;themeAdaptations.test.ts:327. - null keeps its meaning: verified,
generateThemeRules.test.ts:348,mergeComponents.test.ts:50. - Each undefined case fails without the fix: verified, the nine undefined tests fail on the base with the head's tests.
- The theme folder passes 31 files and 1,800 tests, and tsc, eslint and prettier are clean: verified at this head.
- The quoted record line matches the record: verified,
theme-authoring-contract.md:128-132. - The writing rubric results: verified, the record line is present tense with no narration, history or status.
Claims (changeset):
- A Core patch release: verified, a fix with no public API change.
- An undefined value in a part, color-mode block, pseudo-class block, surface or adaptation rule, and an undefined or all-undefined component, style key or color-mode block, writes nothing: verified, as above.
- In a style key or color-mode block the inherited value stays: verified,
mergeComponents.test.ts:22. - A restated pseudo-class block still replaces the inherited one whole even when every value is undefined, stays empty and keeps its component themed: verified,
generateThemeRules.test.ts:308-325. - Before, the stylesheet held
padding: undefined;, the inherited value was lost, and an adaptation rule madedefineThemethrow: verified, the matching tests fail on the base. - null keeps its meaning and an adaptation rule still refuses it: verified,
themeAdaptations.test.ts:311-324.
Files:
.changeset/core-theme-undefined-declaration.md: cleardocs/architecture/theme-authoring-contract.md: clearpackages/core/src/theme/mergeComponents.ts: clearpackages/core/src/theme/generateThemeRules.ts: clearpackages/core/src/theme/resolveThemeValues.ts: clearpackages/core/src/theme/themeAdaptations.ts: clearpackages/core/src/theme/generateThemeRules.test.ts: clearpackages/core/src/theme/mergeComponents.test.ts: clearpackages/core/src/theme/themeAdaptations.test.ts: clear
Summary
A theme value left
undefinedinside a component block, a pseudo-class block or anonDark/onLightsurface was written into the stylesheet as the textundefined, which the browser drops. And a child theme'sundefinedproperty replaced the value it inherits from its base, because component maps merged with object spread.Now
undefinedmeans "not set" everywhere, as it already does for page tokens:joinDeclarationsand the component emit skip an undefined value; a pseudo-class block left empty writes no rule; the token cascade skips undefined, as its comment requires.deepMergeComponentsdrops a child's own undefined properties before it merges, in style keys and color-mode blocks, so the base's value stays ("explicit values win": undefined is not explicit). A restated pseudo-class block replaces the base's block whole, as before; an undefined value inside it is not set.nullthere is still refused).components: {card: {base: undefined}}builds nothing instead of throwing a TypeError, and a component, style key or color-mode block whose every value is undefined is dropped too (so it writes no Text/Heading/Link override rules). A restated pseudo-class block whose every value is undefined stays, empty: it still replaces the inherited one whole, and its component still counts as themed. An adaptation rule's type-scale leaf left undefined is no authored write, so an earlier rule's value stands.nullkeeps its meaning: it replaces an inherited value and is written as it is, as page tokens do today.Tests
generateThemeRules.test.ts: part, pseudo-class and surface undefined values write no: undefined;, no empty:hover {}and no diagnostic; a child's undefinedbutton.base.paddingkeeps the base's8pxintheme.componentsand in the CSS. A@darkinheritance case andnullcases at the merge and emit levels;themeAdaptations.test.tscovers rules. Each undefined case fails without the fix.packages/core/src/themepasses: 31 files, 1,800 tests. tsc, eslint and prettier clean.One record line in
architecture:theme-authoring-contract: "A component, style key, or value leftundefinedin a component block, pseudo-class block, color-mode block, surface, or adaptation rule is not set: in a style key or a color-mode block the inherited value stays, and a restated pseudo-class block replaces the inherited one whole.nullkeeps its existing meaning."Writing rubric results
@josephfarina