build(ui-scripts): fix changed token/theme parsing to follow the new design token structure#2561
Open
HerrTopi wants to merge 4 commits into
Open
build(ui-scripts): fix changed token/theme parsing to follow the new design token structure#2561HerrTopi wants to merge 4 commits into
HerrTopi wants to merge 4 commits into
Conversation
…design token structure
…perly and add deep merge to the token build
|
Visual regression report✅ No changes.
Baselines come from the |
matyasf
requested changes
May 21, 2026
| function buildProject() { | ||
| console.info('Fetching design tokens...') | ||
| try { | ||
| execSync('pnpm update @instructure/instructure-design-tokens -r', opts) |
Collaborator
There was a problem hiding this comment.
This has an unintended side effect of updating all peer dependencies too, this takes a long time and results in unrelated pnpm-lock.yaml changes. AI recommends to use pnpm --filter @instructure/ui-scripts add @instructure/instructure-design-tokens@github:instructure/instructure-design-tokens, but please double check
…es with adding color modifiers
8e354cf to
d196368
Compare
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.
Summary
Brings InstUI's token build in line with the new design-token structure and adds runtime support for color modifiers.
Token parsing fixes (
ui-scripts)semantic.prefix, soformatReferenceno longer prependssemantics.. Param name in generated component files renamedsemantics → semanticto match.mergeDeepinstead of shallow spread, so nested keys from different files no longer clobber each other.mergeDeepis inlined intogenerateSemantics.tsrather than imported from@instructure/ui-utils, because build scripts need to run before workspace packages are compiled.Bootstrap design-token refresh
scripts/bootstrap.jsnow refreshes@instructure/instructure-design-tokensfrom its GitHub source before building themes, so a clean bootstrap doesn't reuse a stale tarball.pnpm --filter @instructure/ui-scripts update …(onlyui-scriptsdeclares the dep) to avoid the workspace-wide lockfile churn thatpnpm update -rwas causing.Color modifiers (
emotion,ui-scripts)applyColorModifiersutil inpackages/emotionresolves Tokens Studiodarken/lightenmodifiers in HSL space, matching Studio'sspace: "hsl"math (each step is a fraction of the remaining distance to black/white, so it never overshoots).useStyleNewandwithStyleNewso any component theme entry shaped as{ value, modify: { type, value } }is collapsed to a final color string before reaching the component.generateComponents.jsnow preserves the$extensions["studio.tokens"].modifypayload through the token build instead of dropping it, so the modifier metadata actually reaches the runtime.Theme type generation refactor
componentTypes/; the function is emitted untyped and consumers rely on the aggregateComponentTypesshape. Reduces cross-file coupling in the generated output.Test plan
pnpm run bootstrapsucceeds end-to-end on a clean checkout; onlyui-scripts-related entries change inpnpm-lock.yaml.packages/ui-themes/src/themes/*/components/— signature is(semantic: Semantics)and body references resolve againstsemantic.*, notsemantics.*.semantics.tsfor at least one theme — values that come from multiple token files are all present (verifies the deep-merge fix).darken/lightenmodifier (e.g. a hover/active state) — at runtime, the resolved CSS shows anhsl(…)/hsla(…)color rather than a{ value, modify }object, and the shade matches what Tokens Studio renders for the same token.pnpm run ts:checkpasses.pnpm run devboots the docs app and components using semantic tokens (e.g. Button) render with correct theming, including any states that rely on color modifiers.