Skip to content

refactor(tokens): migrate SCSS variables to CSS custom properties#90

Merged
wangdicoder merged 11 commits intomasterfrom
refactor/scss-to-css-custom-properties
Apr 5, 2026
Merged

refactor(tokens): migrate SCSS variables to CSS custom properties#90
wangdicoder merged 11 commits intomasterfrom
refactor/scss-to-css-custom-properties

Conversation

@wangdicoder
Copy link
Copy Markdown
Owner

Summary

  • Replace hardcoded SCSS variables with CSS custom properties (--ty-*) across 30+ component stylesheets for runtime theming support
  • Remove _tokens.scss in favor of direct custom property usage; add _constants.scss for compile-time structural constants
  • Add new theme tokens for color-picker, list, speed-dial, and avatar components (both light and dark themes)
  • Update docs theme editor and customization guides to reflect the new token architecture

Release

  • Bump: minor (1.8.0 → 1.9.0)
  • Affected packages: @tiny-design/tokens, @tiny-design/react

Test plan

  • Run pnpm build to verify all packages compile successfully
  • Run pnpm test to ensure no test regressions
  • Verify light and dark themes render correctly in the docs site
  • Check that component styles using var(--ty-*) tokens are applied correctly
  • Confirm CSS custom property overrides work as documented in the tokens README

🤖 Generated with Claude Code

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.
@wangdicoder wangdicoder merged commit 49b4bfc into master Apr 5, 2026
1 check passed
@wangdicoder wangdicoder deleted the refactor/scss-to-css-custom-properties branch April 5, 2026 11:23
@github-actions github-actions bot mentioned this pull request Apr 5, 2026
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