Repository navigation
Resolve cornerRadius refs from the radius scale first - #259
Merged
Merged
Conversation
lookupToken read spacing before radius, so under a preset that defines md in both, cornerRadius "$md" rendered the spacing value (16, not 8). It now takes the property: cornerRadius reads radius first, every other prop spacing first. The detachment lint's radius re-attach fix now renders the value it matched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up named in Phase 32 slice C's verify round (
docs/specs/PHASE-32-SPEC.md), fixed as its own change.The problem
lookupTokenalways read the spacing scale before the radius scale, whatever property the ref sat on. All four built-in presets definesm,mdandlgin both scales, so under any of themcornerRadius: "$md"rendered the spacing value (16) instead of the radius value (8). Theunknown-tokenrule saw anumbertoken where a number belongs and stayed silent, and the README's ownget_variablesexample (cornerRadius: "$sm") rendered 8 instead of 4.What changed
lookupTokentakes the property a ref sits on. OncornerRadius, as a single value or as array entries, it reads radius first and falls back to spacing. Every other property reads spacing first, as before.unknown-tokenrule's check for a token defined as another ref passes the property too, so it reads the same scale the renderer does.cornerRadius: "$md". Under a preset, that fix used to render the spacing value. It now renders the value it matched.docs/GUIDELINES.md, and theset_variables,workspace_set_design_systemandproject_set_design_systemdescriptions. The spec's note now records the fix.Renders that move
A canvas that uses a preset's short names on
cornerRadiusgets smaller corners. Under the dark and light presets,$smgoes from 8 to 4,$mdfrom 16 to 8, and$lgfrom 24 to 16;materialandminimalmove by their own radius values. Generated design systems name their tokensspace-*andradius-*, which never collide, so canvases themed bygenerate_design_systemor stamped from a scaffold render unchanged. No test's verdict moved.Tests
test/unit/test-radius-token-precedence.ts: under the dark preset,cornerRadius: "$md"resolves to 8,gap: "$md"to 16, a padding array to spacing values, a cornerRadius array to radius values, and a cornerRadius name defined only in spacing still resolves. It failed on master with 16 and the spacing array.srcandtestis clean;test-discoverability.ts166/166.