Commit 49b4bfc
authored
refactor(tokens): migrate SCSS variables to CSS custom properties (#90)
* refactor(tokens): migrate SCSS variables to CSS custom properties
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.
* chore: add changeset for SCSS to CSS custom properties migration
* feat(tokens,react): add fine-grained component token customization
- 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)
* chore: update changeset for component token customization
* fix(config-provider): address PR review feedback
- 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
* chore: lint
* fix(config-provider): ref-count global styles for multiple providers
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.
* fix(config-provider): use stack-based registry for nested providers
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.
* refactor: configProvider
* fix: export types
* test: fix tests1 parent 55ad7a7 commit 49b4bfc
File tree
182 files changed
+2771
-2274
lines changed- .changeset
- apps/docs
- guides
- src/containers/theme-editor
- components
- constants
- utils
- packages
- charts/src/style
- extract/src
- mcp/__tests__
- react/src
- _utils
- __tests__
- alert
- anchor
- aspect-ratio
- auto-complete
- avatar
- style
- back-top
- __tests__
- badge
- breadcrumb
- style
- button
- style
- calendar
- style
- card
- style
- carousel
- cascader
- __tests__
- style
- checkbox
- collapse/style
- color-picker
- style
- col
- config-provider
- __tests__
- __snapshots__
- demo
- copy-to-clipboard
- __tests__
- countdown
- date-picker
- descriptions
- style
- divider
- drawer
- dropdown
- empty
- flex
- flip
- form
- style
- image
- input-number
- style
- input-otp
- style
- input-password
- input
- style
- keyboard
- layout/style
- link
- list
- style
- loader
- loading-bar
- marquee
- message
- modal
- __tests__
- native-select
- style
- notification
- style
- overlay
- __tests__
- pagination
- pop-confirm
- popover
- popup
- style
- portal
- progress
- radio
- rate
- result
- row
- scroll-indicator
- scroll-number
- style
- segmented
- style
- select
- style
- skeleton
- slider
- space
- speed-dial
- style
- split-button
- split
- statistic
- style
- steps
- sticky
- strength-indicator
- switch
- table
- style
- tabs
- tag
- style
- text-loop
- textarea
- time-picker
- timeline
- tooltip
- style
- tour
- __tests__
- style
- transfer
- tree
- style
- typography
- style
- upload
- waterfall
- tokens
- css
- scss
- themes
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
182 files changed
+2771
-2274
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
72 | 85 | | |
73 | 86 | | |
74 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
79 | 94 | | |
80 | | - | |
| 95 | + | |
81 | 96 | | |
82 | 97 | | |
83 | 98 | | |
84 | | - | |
| 99 | + | |
85 | 100 | | |
86 | | - | |
| 101 | + | |
87 | 102 | | |
88 | | - | |
| 103 | + | |
89 | 104 | | |
90 | 105 | | |
91 | 106 | | |
| |||
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
98 | | - | |
| 113 | + | |
99 | 114 | | |
100 | 115 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
105 | 120 | | |
106 | 121 | | |
107 | 122 | | |
| |||
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
113 | | - | |
| 128 | + | |
114 | 129 | | |
115 | 130 | | |
116 | | - | |
| 131 | + | |
117 | 132 | | |
118 | | - | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
139 | 147 | | |
140 | 148 | | |
141 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
79 | 94 | | |
80 | | - | |
| 95 | + | |
81 | 96 | | |
82 | 97 | | |
83 | 98 | | |
84 | | - | |
| 99 | + | |
85 | 100 | | |
86 | | - | |
| 101 | + | |
87 | 102 | | |
88 | | - | |
| 103 | + | |
89 | 104 | | |
90 | 105 | | |
91 | 106 | | |
| |||
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
98 | | - | |
| 113 | + | |
99 | 114 | | |
100 | 115 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
105 | 120 | | |
106 | 121 | | |
107 | 122 | | |
| |||
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
113 | | - | |
| 128 | + | |
114 | 129 | | |
115 | 130 | | |
116 | | - | |
| 131 | + | |
117 | 132 | | |
118 | | - | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
139 | 147 | | |
140 | 148 | | |
141 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
| |||
0 commit comments