Skip to content

Minimal role token adoption - #987

Draft
microbit-matt-hillsdon wants to merge 6 commits into
mainfrom
link-colour
Draft

Minimal role token adoption#987
microbit-matt-hillsdon wants to merge 6 commits into
mainfrom
link-colour

Conversation

@microbit-matt-hillsdon

Copy link
Copy Markdown

Lots of ramp references left for another pass but this restates the overrides in terms of role tokens and updates links.

Draft awaiting UI library release.

Phase 3 of the focus-and-colour plan (ui-private docs/role-tokens.md).
The library replaced its ad-hoc semantic tokens with property-namespaced
roles, so this preset moves with them: statusBarBg becomes
surface.statusBar, and the secondary-disabled variant reads
button.secondary.border / .fg rather than the old flat keys.

Value-preserving, measured: Panda's generated CSS resolved through every
var() chain shows 0 changed declarations across 1568 selectors in the
light context. The dark context picks up the library's new on-dark wash
flips, which is what fixes `ghost` on the tagged ActionBar.

dev:link-ui and dev:link-ui-patterns join the scripts — the first
matching classroom and data-microbit-org, the second new to the family
because the LanguageDialog pattern reads these tokens too.
Symlinks ../ml-trainer-microbit into node_modules, which is the switch
both panda.config.ts and vite.config.ts test for, so one link moves the
Panda codegen and the Vite alias together. Builds the theme package first
— both resolve it through dist. dev:unlink-theme reverses it.
Moves the twelve link call sites onto `fg.link`, replacing the hardcoded
brand.600 they each carried. No preset change: brand.600 is already the
base preset's default, so this app was on the right value all along and
simply said so twelve times.

Value-preserving there: #2b6cb0 on the OSS build, #0071aa with the
CreateAI preset, before and after.

One visible change. The privacy policy link in NativeConsentDialog reads
as ordinary body text — it sits mid-sentence inside a grey <Text> and
inherits it, so nothing but the hover underline marks it as a link.

That is original, not migration fallout: the element has carried `href`
and no colour in all nine versions of the file, back to its first commit
(dcbba7b). Chakra's Link base style was `color: "inherit"` and this app
never themed Link, so it inherited under Chakra exactly as it did under
Panda. It is now a link.

Links that deliberately inherit are untouched: the GitHub icon links in
the About dialog's version table take currentColor, and the buttons using
`variant="link"` without an override were already on this token.
Panda accepts an unknown `semanticTokens` key silently — the override
never applies and nothing fails, so a rename in @microbit/ui would leave
this app on the library's colours with a green typecheck.

Covers the private brand preset too, when it is linked. Checking it here
rather than in its own repo keeps that repo free of a dependency on
@microbit/ui, and runs the check where the merge actually happens.
Assert @microbit/ui's droppedConditionTokens alongside the existing
key check, for the app preset and (when linked) the brand preset: a
flat override of a { base, _onDark } token merges wholesale and
silently drops the dark-surface flip.
@github-actions

Copy link
Copy Markdown

Preview build will be at
https://review-createai.microbit.org/link-colour/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant