Repository navigation
fix(core): a numeric typography weight builds through an extended base's adaptation rules - #12154
josephfarina wants to merge 2 commits into
Conversation
…heme extending a base with adaptation rules builds
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
This pull request needs an owner decision before approval. The runtime fix is sound: a numeric weight is now written as its text, and a red-first test proves that a theme extending a base with adaptation rules builds. The new number member of the public FontWeight type has no governing spec, so approval needs a maintainer to provide or identify the governing spec for it; what must be settled is whether FontWeight accepts a number beside the raw CSS string '700' it already takes. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Blocking findings:
type FontWeightchanges outside this pull request's scope (corenames no component and the description has no## Scopeline), so nameFontWeighton aComponents:line under a## Scopeheading and get the owner decision, or split the widening into its own pull request.astryx theme buildstill warns, andastryx experimental theme compilestill exits 1, onheading: {weight: 700}as "a type mismatch the theme's types refuse" (packages/cli/api/theme/build/typography-values.mjs:178-188and its tests), so either accept a number from 1 to 1000 there or drop| numberfrompackages/core/src/theme/types.ts:19.- The description says every bundled base has adaptation rules, but matcha, gothic and y2k have none and already build a numeric weight on
main, so it should name neutral, stone, chocolate and butter instead.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a numeric weight in a theme that extends a base with adaptation rules failed with "must resolve to a concrete CSS string": verified (red-first test; a
neutralThemeprobe onmain). - Claim: every bundled base has adaptation rules: false (matcha, gothic and y2k have none).
- Claim: the same theme without
extendsalready built: verified at runtime (mainwrites the number700; its type refused a number). - Claim: the number passed through unchanged and only the adaptation path required text: verified (
resolveFontWeightonmain;themeAdaptations.ts:684-698). - Claim:
resolveFontWeightwrites a number as its text, so root and rule tokens hold the same string: verified (resolveThemeValues.ts:152-154; both'700'). - Claim:
FontWeighttakesnumberas an additive widening: verified (types.ts:19); its authority waits on the owner decision. - Claim: the new test builds and asserts
'700','800'and'450'in root and rule tokens, and fails without the change: verified (themeAdaptations.test.ts:1718-1748; red-first run). - Claim: all Core theme tests pass: verified (31 files, 1,810 tests).
- Changeset claim: a numeric weight is written as its text everywhere it is read: verified for Core; the CLI check still calls it a type mismatch (finding above).
- Changeset claim: a theme extending a base with adaptation rules builds instead of failing: verified.
- Changeset claim:
FontWeighttakes a number too: verified; waits on the owner decision. - File
.changeset/core-numeric-font-weight.md: see the CLI finding. - File
packages/core/src/theme/resolveThemeValues.ts: clear. - File
packages/core/src/theme/themeAdaptations.test.ts: clear. - File
packages/core/src/theme/types.ts: owner decision, scope and CLI findings.
…ic weight as its text
There was a problem hiding this comment.
Approved pending CI: the CI workflow did not run on this head (it was cancelled because CI was full), so it needs a re-run before merge.
The runtime fix is sound: resolveFontWeight now writes a numeric weight as its text, so a JavaScript or JSON theme that extends a base with adaptation rules builds, and the new test fails without the change. FontWeight is unchanged, so the earlier type, CLI and scope points no longer apply, and the description now names the right bases.
- Optional: the
ThemeModecomment change inpackages/core/src/theme/types.tsalready matchesmain, so it adds nothing on merge; drop it or mergemainto keep the diff to the fix.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: a numeric weight that reaches Core from a JavaScript or JSON theme now works through
defineTheme: verified (resolveThemeValues.ts:152-155,themeAdaptations.test.ts:1718-1750). - Claim: before, such a theme failed whenever its base had adaptation rules (neutral, stone, chocolate, butter), with the "must resolve to a concrete CSS string" error: verified (the new test fails on the base with that error; those four theme sources declare one adaptation rule each).
- Claim: on a base without rules (matcha, gothic, y2k) or with no
extends, the same theme already built, and only the adaptation path required text: verified (those theme sources declare no rules; the root path passes values through atresolveThemeValues.ts:135-142, the rule path checks leaves atthemeAdaptations.ts:684-698). - Claim: root tokens and every rule's tokens hold the same CSS string: verified (the test asserts
'700','800'and'450'in both). - Claim: the public
FontWeighttype does not change; this is runtime tolerance only: verified (types.ts:17-18matches the base; the public API delta has no rows). - Claim: the test fails without the change and all Core theme tests pass: verified (fails on the base; 31 files and 1,810 tests pass on the head).
- Claim: the changeset is a
[fix]patch for@astryxdesign/core: verified. - Changeset: a number is written as its text everywhere
defineThemereads a weight: verified (everyresolveFontWeightcall inbuildTypeScaleConfig,resolveThemeValues.ts:208-230). - Changeset: a theme extending a base with adaptation rules now builds instead of failing: verified (the new test).
- Changeset: the
FontWeighttype does not change: verified. - File
.changeset/core-numeric-font-weight.md: clear. - File
packages/core/src/theme/resolveThemeValues.ts: clear. - File
packages/core/src/theme/themeAdaptations.test.ts: clear. - File
packages/core/src/theme/types.ts: note (theThemeModecomment hunk already matchesmain);FontWeightunchanged.
… extended base's adaptation rules
… extended base's adaptation rules
- #12252 docs(cli): agent docs name the prop names that differ from other libraries Author: Joey Farina <[email protected]> - #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules Author: Joey <[email protected]> - #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone Author: Joey Farina <[email protected]> - #12316 fix(core): a shorthand never follows its own longhand in one style merge Author: josephfarina <[email protected]> - #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent Author: Joey Farina <[email protected]> - #12349 fix(core): end a mouse drag a sandboxed frame never saw released Author: josephfarina <[email protected]> - #12425 fix(cli): use a stored doc parse only with the zod release that made it Author: Joey <[email protected]> - #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs Author: Joey <[email protected]> - #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label Author: Joey Farina <[email protected]> - #12448 fix(cli): upgrade outside a project names the project, not --from Author: Joey Farina <[email protected]> - #12459 fix(templates): the dashboard scorecard fits a phone screen Author: Joey Farina <[email protected]> - #12428 fix(core): Field labels draw in a bolder face than their description Author: Joey Farina <[email protected]> - #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral Author: Joey <[email protected]> - #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge Author: Joey Farina <[email protected]> - #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons Author: Joey Farina <[email protected]> - #12472 fix(MetadataListItem): a value breaks only a word longer than its line Author: Joey <[email protected]>
|
Landed in #12718. |
What users see
A typography weight that reaches Core as a number now works everywhere. That happens in a theme written in JavaScript, or one read from JSON:
Before, a theme like this failed to load whenever its base had adaptation rules, as neutral, stone, chocolate and butter do:
defineTheme("acme").adaptations.rules[0].value.tokens["--text-heading-1-weight"] must resolve to a concrete CSS string. The message named a rule the author never wrote and gave no fix. On a base without adaptation rules (matcha, gothic, y2k), or withoutextends, the same theme already built. The number was passed through as a number, and only the adaptation path required text.Change
resolveFontWeightwrites a number as its text (700→'700'), so the root tokens and every adaptation rule's tokens hold the same CSS string.FontWeighttype does not change: TypeScript still asks for the string form. This is runtime tolerance only.Tests
packages/core/src/theme/themeAdaptations.test.ts: a child of a base with an adaptation rule, given untypedheading: {weight: 700, weights: {2: 800}}andbody: {weight: 450}, builds. Both the root tokens and the rule's tokens hold'700','800'and'450'. The test fails without this change. All Core theme tests pass.Changeset
[fix]for@astryxdesign/core.