refactor(tokens): migrate SCSS variables to CSS custom properties#90
Merged
wangdicoder merged 11 commits intomasterfrom Apr 5, 2026
Merged
refactor(tokens): migrate SCSS variables to CSS custom properties#90wangdicoder merged 11 commits intomasterfrom
wangdicoder merged 11 commits intomasterfrom
Conversation
Replace hardcoded SCSS variables with CSS custom properties (--ty-*) across component styles for runtime theming. Remove _tokens.scss in favor of direct custom property usage. Add new theme tokens for color-picker, list, speed-dial, and avatar components.
- Migrate ~80 structural SCSS constants to CSS custom properties - Tokenize hardcoded values in Button, Input, Card, Select, Notification - Add component-scoped CSS variable fallback chain pattern - Add ConfigProvider ThemeConfig API for programmatic token overrides - Convert SCSS arithmetic to CSS calc() in popup, tooltip, notification - Update ConfigProvider docs (EN + ZH)
- Apply token overrides to <html> instead of wrapper div, so portals (modals, tooltips, dropdowns) inherit overrides correctly - Remove wrapper <div> to avoid invalid DOM in constrained containers - Clean up data-tiny-theme attribute on unmount/mode change - Fix Select dropdown shadow to use $select-dropdown-shadow token - Remove unused .ty-config-provider CSS rule
Add global-style-registry with acquire/release pattern so multiple concurrent ConfigProvider instances don't clobber each other's theme mode or token overrides on <html>. DOM cleanup only fires when the last provider holding a given property unmounts.
Replace ref-counting with per-key stacks so nested ConfigProviders correctly restore the parent's value on unmount instead of deleting it. Each provider gets a stable Symbol id via useRef. acquireMode/acquireProps push onto the stack; releaseMode/releaseProps pop and restore the previous entry. The topmost (last-registered) entry always wins.
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
--ty-*) across 30+ component stylesheets for runtime theming support_tokens.scssin favor of direct custom property usage; add_constants.scssfor compile-time structural constantsRelease
minor(1.8.0 → 1.9.0)@tiny-design/tokens,@tiny-design/reactTest plan
pnpm buildto verify all packages compile successfullypnpm testto ensure no test regressionsvar(--ty-*)tokens are applied correctly🤖 Generated with Claude Code