Repository navigation
set: a text size for a part with several text pieces goes to its largest - #13234
Conversation
…ts largest piece's token
|
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.
Approval waits on an engineering owner's decision at this head, and two problems need fixing whatever that decision is.
No current spec record says where astryx experimental theme editor set <theme> font-size <size> --on <part> sends a text size when the part's text reads several size tokens, so an engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner) or names the record that governs it; what needs settling is that the value goes into the largest inner size token by Core's defaults and only that token is written on the part.
Blocking findings:
mainTextSizeToken(packages/cli/api/theme-edit/_settings.mjs:15070) does not refuse a part that holds other parts, sofont-size 20px --on popoverwrites--text-label-size: 20pxon every popover (its buttons and checkbox labels grow to 20px while its heading and body text stay at 14px) and--on calendargrows only the month label, each with a note that the size "also reaches" the held parts although nofont-sizeis written; please return null when the part holds other parts and add refusal rows forpopoverandcalendar.- The changeset says a part whose sizes come from the parts it holds is "refused as before", but
popoverandcalendarare accepted at this head; the fix above makes that true, or the note should name the parts the rule reaches.
Not blocking: the comment above the check in _check.mjs still says several tokens are refused, and namesToken could replace the three inline copies of the same test in compileTheme.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- A text size for a part whose inner pieces each read a size token goes into the largest one, the top nav heading's title: verified for the top nav heading (new test, built rule); false as a general rule, since popover and calendar get a token that is not their main text.
- The setting is saved as typed and undo finds it: verified (new test; the saved setting is
font-size). - The build writes only the token: verified (the built rule holds no
font-size). - A tie, sizes from held parts, an icon sized by spacing and a value naming the token are refused as before: tie verified in code (strict comparison); icon verified (
nav-iconrow on base and head); a value naming the token verified (test, plus acalc()case); sizes from held parts false (popover, calendar). - A text column's lines each still take it: verified (banner row on base and head).
- The top nav heading command was refused on the base, offering both tokens: verified (base run).
- One inner token already goes into that token, as for a code block: verified (existing row on base and head).
- The largest inner token is plainly the part's main text: true for both nav headings and the mega menu item; false for popover and calendar.
- The helper names none for an unreadable size or a text column: verified in code and by the banner row.
- A value naming the token is never written into it: verified.
- The check uses the helpers for its note and the build writes only that token: verified.
- Every value check still runs: verified (
redrefused). - A group keeps its reading: verified in code (the one-part guard in both check and build).
- The set docs say where such a size goes: verified (the same sentence in both docs).
- Unchanged paths (banner,
red,var(--text-large-size),nav-icon): verified on base and head. - The regression test fails before the change: verified (two new rows and the moved row fail on the base).
- One defect is restored, with no new behaviour under the fix label: not established, since no current spec defines the expected answer (decision above).
- Public text has no internal context: verified.
- The whole theme-edit test directory passes: partly checked; the two changed and five related test files pass, and the full directory was not rerun.
- Preflight passed with CI green: not confirmed at this head; lint and the CLI smoke test passed, and the CI workflow was cancelled before its test jobs ran.
Files:
.changeset/experimental-theme-text-size-main-piece.md: finding (the held-parts claim).packages/cli/api/theme-edit/_settings.mjs: finding (no held-parts guard).packages/cli/api/theme-edit/_check.mjs: finding (accepts popover and calendar through the same helper); stale comment, not blocking.packages/cli/api/theme-edit/theme-edit-text-size-main-piece.test.mjs: clear; covers the top nav heading only.packages/cli/api/theme-edit/theme-set-takes-text-a-part-reads.test.mjs: clear.packages/cli/api/theme-edit/themeEditSet.doc.mjs: clear.packages/cli/clients/cli/commands/experimental-theme-editor-set.doc.mjs: clear.
| */ | ||
| export function mainTextSizeToken(C, part, tokens) { | ||
| const rec = C.MAP[part]; | ||
| if (!rec || rec.own?.['font-size']) return null; |
There was a problem hiding this comment.
This accepts a part that holds other parts. popover (no text of its own, 25 held parts in the census) and calendar both pass. So font-size 20px --on popover writes --text-label-size: 20px into every popover: its buttons and checkbox labels grow to 20px, and its heading and body text stay at 14px. The result also says the size "also reaches" the held parts, but no font-size is written. Returning null when the part holds other parts keeps top-nav-heading, side-nav-heading and top-nav-mega-menu-item:
if (!rec || rec.own?.['font-size'] || rec.contains?.length) return null;| '@astryxdesign/cli': patch | ||
| --- | ||
|
|
||
| [experimental] `astryx experimental theme editor set <theme> font-size <size> --on <part>` takes a text size for a part whose text is drawn by elements inside it that each read a text size token: the value goes into the token of its main text, the largest as the sizes resolve (a top nav heading's title, not its supporting line), on that part. The setting is saved as typed, so `undo` finds it, and the build writes only the token. Where no one main text can be told (a tie, sizes from the parts it holds, an icon sized by spacing, a value naming the token itself) it is refused as before; a text column's lines each still take it. |
There was a problem hiding this comment.
popover and calendar hold other parts, but at this head they are accepted, so "sizes from the parts it holds … refused as before" is not true yet. The guard in mainTextSizeToken makes it true, and refusal rows for both in the new test would keep it true.
|
Covers the theme-editor reading this pull request records (the owner's ruling): font-size set on one part whose inner elements read several text-size tokens takes the largest of them by Core's defaults; it is refused where no one main text can be told; it is saved as typed and built as the token alone. |
|
/approve-spec 964c976 |
|
I'll run a full review to re-check this with your note. |
|
Taken out of landing #13276 because the review of the combined head flagged a line this change made. It stays on the working branch and rides the next landing together with its fix: open the fix as a new pull request based on the working branch (it already holds this change), whose description names #13234. |
- #13190 perf(cli): the first how ask compiles only the lexicon patterns it can match - #13167 how: no rounding anywhere squares the pill radius too - #13234 set: a text size for a part with several text pieces goes to its largest - #13248 docs(changeset): #13190's release note states no pattern count - #13039 fix(cli): experimental theme editor - controls share one height at each size - #13040 feat(cli): experimental theme editor - a badges setting styles the status and category badges in the theme's colors - #13285 set: a part that holds other parts has no main text for a size - #13260 how: no rounding anywhere reads its scope word on the corner ask alone - #12723 experimental theme how: a mood said beside an ask is named as not used, never dropped
|
Landed on main in #13315. |
User impact
set <theme> font-size 20px --on top-nav-headingwas refused: the heading's text is drawn by a title and a supporting line inside it, each reading its own text size token, and set offered both tokens without saying which line each sets.Problem and solution fit
A text size on a part whose inner text reads one size token already goes into that token (a code block). With several, set refused, though the largest is plainly the part's main text. The fix sends the value to the largest token, as the sizes resolve, and refuses as before where no one main text can be told.
Expected behavior and authority
The existing rule for one inner size token: the value goes into the token the inner text reads, on the part, saved as typed.
Smallest restoration
Two helpers in
_settings.mjs:mainTextSizeToken(several text size tokens read by elements inside the part itself; the largest throughvar(); a tie, an unreadable size, a text column, or sizes taken from held parts name none) andnamesToken(a value naming the token is never written into it). Set's property check uses them for the note; the build writes only that token. The setting is saved as typed, soundofinds it and every value check still runs. A group keeps its reading. The set docs say where such a size goes.Evidence
.astryx-top-nav-heading { --text-large-size: 20px; }, nofont-sizeline.font-size 14px --on bannersets each line;font-size red,font-size 'var(--text-large-size)'and--on nav-iconare refused as before.Scope
Components: cli/api/theme-edit (set)
Testing
vitest run packages/cli/api/theme-edit(the whole theme-edit directory) passes.preflight: pass 964c976 (CI green; review: no blocking findings, one owner question)
replay: worse 0 at 964c976