feat(ui-scripts,ui-themes): generate theme tokens as css custom properties - #2690
Open
HerrTopi wants to merge 1 commit into
Open
feat(ui-scripts,ui-themes): generate theme tokens as css custom properties#2690HerrTopi wants to merge 1 commit into
HerrTopi wants to merge 1 commit into
Conversation
…rties Add a buildCSSVariables step to build-themes that flattens each theme's shared tokens and emits one stylesheet per theme under src/themes/newThemeTokens/themesAsCSSVariables/, plus a cssThemesWithMediaQueries.css that maps the light and dark themes to prefers-color-scheme. Register the malva plugin in dprint.json so the generated stylesheets are formatted by the existing dprint pass, and mark *.css as side-effectful in ui-themes so bundlers do not drop the stylesheet imports. Also emit SharedTokens as a type-only import in the generated component templates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Contributor
Visual regression report
Diff images (33)alert.png — baseline no longer producedavatar.png — baseline no longer producedbadge.png — baseline no longer producedbillboard.png — baseline no longer producedbreadcrumb.png — baseline no longer producedbutton-and-derivatives.png — baseline no longer producedbyline.png — baseline no longer producedcalendar.png — baseline no longer producedcheckbox.png — baseline no longer producedcheckboxgroup.png — baseline no longer producedcolorpicker.png — baseline no longer producedcontextview.png — baseline no longer producedcustom-and-lucide-icons.png — baseline no longer produceddateinput-dateinput2.png — baseline no longer produceddatetimeinput.png — baseline no longer produceddiff-demo.png — 6324 pixels differdrilldown.png — baseline no longer producedfiledrop.png — baseline no longer producedform-errors.png — baseline no longer producedheading.png — baseline no longer producedimg.png — baseline no longer producedlink.png — baseline no longer producedmenu.png — baseline no longer producedmetric-pill-tag-timeselect-text.png — baseline no longer producedoptions.png — baseline no longer producedpagination.png — baseline no longer producedprogressbar.png — baseline no longer producedselect-simpleselect.png — baseline no longer producedtable.png — baseline no longer producedtabs.png — baseline no longer producedtooltip.png — baseline no longer producedtreebrowser.png — baseline no longer producedview.png — baseline no longer producedBaselines come from the |
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
buildCSSVariablesstep tobuild-themesthat flattens each theme's shared tokens and emits one stylesheet per theme undersrc/themes/newThemeTokens/themesAsCSSVariables/.cssThemesWithMediaQueries.css, mapping the light and dark themes toprefers-color-scheme.dprint.jsonso the generated stylesheets go through the existing dprint pass.*.cssas side-effectful inui-themesso bundlers don't tree-shake stylesheet imports.Test Plan
pnpm run build:themesand check the 5 files underpackages/ui-themes/src/themes/newThemeTokens/themesAsCSSVariables/— the directory is gitignored, so none of the generated CSS appears in this diff.cssThemesWithMediaQueries.cssloaded, toggle the OS colour scheme and confirm the:rootvalues andcolor-schemeswitch.Open questions for the reviewer
--background-*,--spacing-md). The existing style-dictionary emitter usesinstui-<theme>. Adding a prefix later is breaking, so this should be settled before release.:rootin the media-query file and.light/.darkin the per-theme files are both specificity 0-1-0, so combining them makes source order decide which wins.boxShadowtokens are emitted as per-field vars with no composed value;boxShadowObjectsToCSSStringalready handles this for JS consumers.Fixes INSTUI-5153
🤖 Generated with Claude Code