@sdata/web-vue 4.7.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/sd.css +4004 -3955
  2. package/dist/sd.min.css +13 -13
  3. package/es/_components/input-label/style/index.css +47 -47
  4. package/es/_components/select-view/style/index.css +256 -256
  5. package/es/alert/style/index.css +48 -48
  6. package/es/alert/style/token.scss +257 -0
  7. package/es/anchor/style/index.css +18 -18
  8. package/es/anchor/style/token.scss +74 -0
  9. package/es/auto-complete/style/index.css +18 -18
  10. package/es/auto-complete/style/token.scss +94 -0
  11. package/es/avatar/style/index.css +31 -31
  12. package/es/avatar/style/token.scss +118 -0
  13. package/es/back-top/style/index.css +11 -11
  14. package/es/back-top/style/token.scss +60 -0
  15. package/es/badge/style/index.css +35 -35
  16. package/es/badge/style/token.scss +148 -0
  17. package/es/basic-crud-table/style/index.css +4 -4
  18. package/es/basic-crud-table/style/token.scss +20 -0
  19. package/es/bloom-menu/style/index.css +33 -34
  20. package/es/bloom-menu/style/index.scss +5 -5
  21. package/es/bloom-menu/style/token.scss +99 -0
  22. package/es/border-beam/style/token.scss +28 -0
  23. package/es/breadcrumb/style/index.css +17 -17
  24. package/es/breadcrumb/style/token.scss +97 -0
  25. package/es/button/style/index.css +379 -379
  26. package/es/button/style/index.scss +3 -3
  27. package/es/button/style/token.scss +1604 -0
  28. package/es/card/style/index.css +36 -36
  29. package/es/card/style/token.scss +162 -0
  30. package/es/carousel/style/index.css +41 -41
  31. package/es/carousel/style/token.scss +101 -0
  32. package/es/cascader/style/index.css +58 -58
  33. package/es/cascader/style/token.scss +89 -0
  34. package/es/checkbox/style/index.css +28 -28
  35. package/es/checkbox/style/token.scss +134 -0
  36. package/es/collapse/style/index.css +24 -24
  37. package/es/collapse/style/token.scss +136 -0
  38. package/es/color-picker/style/index.css +50 -50
  39. package/es/color-picker/style/token.scss +200 -0
  40. package/es/comment/style/index.css +15 -15
  41. package/es/comment/style/token.scss +83 -0
  42. package/es/config-provider/algorithms.d.ts +11 -0
  43. package/es/config-provider/algorithms.js +53 -0
  44. package/es/config-provider/global-theme.js +7 -4
  45. package/es/config-provider/theme-config.d.ts +11 -0
  46. package/es/config-provider/theme-config.js +114 -0
  47. package/es/config-provider/theme-provider.vue_vue_type_script_setup_true_lang.js +46 -11
  48. package/es/config-provider/theme.d.ts +4 -1
  49. package/es/config-provider/theme.js +6 -5
  50. package/es/config-provider/token-key.d.ts +1 -0
  51. package/es/config-provider/token-key.js +6 -0
  52. package/es/copy/style/index.css +1 -1
  53. package/es/copy/style/token.scss +9 -0
  54. package/es/cropper/style/index.css +7 -7
  55. package/es/cropper/style/token.scss +24 -0
  56. package/es/date-picker/style/index.css +73 -73
  57. package/es/date-picker/style/token.scss +229 -0
  58. package/es/descriptions/style/index.css +45 -45
  59. package/es/descriptions/style/token.scss +191 -0
  60. package/es/divider/style/index.css +11 -11
  61. package/es/divider/style/token.scss +60 -0
  62. package/es/drawer/style/index.css +13 -13
  63. package/es/drawer/style/token.scss +68 -0
  64. package/es/dropdown/style/index.css +24 -23
  65. package/es/dropdown/style/index.scss +4 -2
  66. package/es/dropdown/style/token.scss +123 -0
  67. package/es/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js +3 -3
  68. package/es/ellipsis/interface.d.ts +1 -0
  69. package/es/ellipsis/style/index.css +2 -2
  70. package/es/ellipsis/style/token.scss +5 -0
  71. package/es/empty/style/index.css +7 -7
  72. package/es/empty/style/token.scss +35 -0
  73. package/es/file-previewer/style/index.css +44 -44
  74. package/es/file-previewer/style/token.scss +198 -0
  75. package/es/form/style/index.css +113 -113
  76. package/es/form/style/token.scss +340 -0
  77. package/es/image/style/index.css +83 -83
  78. package/es/image/style/token.scss +451 -0
  79. package/es/index.css +4004 -3955
  80. package/es/index.d.ts +3 -0
  81. package/es/index.js +4 -1
  82. package/es/input/style/index.css +104 -104
  83. package/es/input/style/input.scss +2 -8
  84. package/es/input/style/size.scss +4 -4
  85. package/es/input/style/token.scss +327 -0
  86. package/es/input-mask/style/index.css +1 -1
  87. package/es/input-mask/style/token.scss +8 -0
  88. package/es/input-number/style/index.css +19 -19
  89. package/es/input-number/style/token.scss +82 -0
  90. package/es/input-tag/style/index.css +209 -209
  91. package/es/input-tag/style/token.scss +226 -0
  92. package/es/json-form/style/index.css +2 -2
  93. package/es/json-form/style/token.scss +21 -0
  94. package/es/kv-list/style/index.css +13 -13
  95. package/es/kv-list/style/token.scss +29 -0
  96. package/es/layout/style/index.css +38 -38
  97. package/es/layout/style/token.scss +100 -0
  98. package/es/link/style/index.css +28 -28
  99. package/es/link/style/token.scss +117 -0
  100. package/es/list/style/index.css +27 -27
  101. package/es/list/style/token.scss +178 -0
  102. package/es/mention/style/token.scss +22 -0
  103. package/es/menu/style/index.css +153 -120
  104. package/es/menu/style/index.scss +12 -4
  105. package/es/menu/style/token.scss +390 -0
  106. package/es/message/style/index.css +33 -33
  107. package/es/message/style/token.scss +218 -0
  108. package/es/modal/style/index.css +21 -21
  109. package/es/modal/style/token.scss +115 -0
  110. package/es/model-selector/style/index.css +1 -1
  111. package/es/notification/style/index.css +44 -44
  112. package/es/notification/style/token.scss +241 -0
  113. package/es/number-flow/style/index.css +5 -5
  114. package/es/number-flow/style/token.scss +19 -0
  115. package/es/page-header/style/index.css +25 -25
  116. package/es/page-header/style/token.scss +139 -0
  117. package/es/pagination/style/index.css +85 -85
  118. package/es/pagination/style/token.scss +303 -0
  119. package/es/panel-group/style/index.css +7 -7
  120. package/es/panel-group/style/token.scss +28 -0
  121. package/es/popconfirm/style/index.css +18 -18
  122. package/es/popconfirm/style/token.scss +83 -0
  123. package/es/popover/style/index.css +12 -12
  124. package/es/popover/style/token.scss +58 -0
  125. package/es/progress/style/index.css +55 -55
  126. package/es/progress/style/token.scss +253 -0
  127. package/es/qr-code/style/index.css +18 -21
  128. package/es/qr-code/style/index.scss +4 -6
  129. package/es/qr-code/style/token.scss +59 -0
  130. package/es/radio/style/index.css +45 -44
  131. package/es/radio/style/index.scss +1 -0
  132. package/es/radio/style/token.scss +185 -0
  133. package/es/rate/style/index.css +8 -8
  134. package/es/rate/style/token.scss +19 -0
  135. package/es/regex-vis/style/index.css +51 -51
  136. package/es/regex-vis/style/token.scss +170 -0
  137. package/es/result/style/index.css +26 -26
  138. package/es/result/style/token.scss +139 -0
  139. package/es/rich-text-editor/style/index.css +31 -31
  140. package/es/rich-text-editor/style/token.scss +120 -0
  141. package/es/scrollbar/style/index.css +14 -14
  142. package/es/scrollbar/style/token.scss +33 -0
  143. package/es/secret/style/index.css +6 -6
  144. package/es/secret/style/token.scss +30 -0
  145. package/es/select/style/index.css +27 -27
  146. package/es/select/style/token.scss +151 -0
  147. package/es/selectable-card/style/index.css +53 -51
  148. package/es/selectable-card/style/index.scss +6 -2
  149. package/es/selectable-card/style/token.scss +60 -0
  150. package/es/sender/style/index.css +54 -54
  151. package/es/sender/style/token.scss +155 -0
  152. package/es/skeleton/style/index.css +12 -12
  153. package/es/skeleton/style/token.scss +60 -0
  154. package/es/slider/style/index.css +34 -34
  155. package/es/slider/style/token.scss +144 -0
  156. package/es/spin/style/index.css +11 -11
  157. package/es/spin/style/token.scss +60 -0
  158. package/es/split/style/index.css +2 -2
  159. package/es/split/style/token.scss +18 -0
  160. package/es/statistic/style/index.css +13 -13
  161. package/es/statistic/style/token.scss +73 -0
  162. package/es/steps/style/index.css +98 -98
  163. package/es/steps/style/token.scss +464 -0
  164. package/es/style/color/css-variables.scss +382 -381
  165. package/es/style/theme/css-variables.scss +329 -135
  166. package/es/style/theme/global.scss +5 -5
  167. package/es/style/theme/index.scss +1 -1
  168. package/es/style/theme/runtime.scss +29 -0
  169. package/es/switch/style/index.css +37 -37
  170. package/es/switch/style/token.scss +135 -0
  171. package/es/table/style/index.css +127 -127
  172. package/es/table/style/token.scss +425 -0
  173. package/es/tabs/style/index.css +196 -190
  174. package/es/tabs/style/index.scss +27 -17
  175. package/es/tabs/style/token.scss +534 -0
  176. package/es/tag/index.d.ts +13 -0
  177. package/es/tag/interface.d.ts +1 -0
  178. package/es/tag/style/index.css +159 -159
  179. package/es/tag/style/token.scss +513 -0
  180. package/es/tag/tag.vue.d.ts +13 -3
  181. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +35 -8
  182. package/es/tag-group/style/index.css +3 -3
  183. package/es/tag-group/style/token.scss +9 -0
  184. package/es/textarea/style/index.css +40 -40
  185. package/es/time-picker/style/index.css +12 -12
  186. package/es/time-picker/style/token.scss +50 -0
  187. package/es/timeline/style/index.css +22 -22
  188. package/es/timeline/style/token.scss +75 -0
  189. package/es/toolbar/style/index.css +6 -6
  190. package/es/toolbar/style/token.scss +45 -0
  191. package/es/tooltip/style/index.css +8 -8
  192. package/es/tooltip/style/token.scss +46 -0
  193. package/es/tour/style/index.css +28 -28
  194. package/es/tour/style/token.scss +65 -0
  195. package/es/transfer/style/index.css +46 -45
  196. package/es/transfer/style/index.scss +4 -1
  197. package/es/transfer/style/token.scss +199 -0
  198. package/es/tree/style/index.css +43 -36
  199. package/es/tree/style/index.scss +10 -0
  200. package/es/tree/style/token.scss +163 -0
  201. package/es/tree-select/style/index.css +9 -9
  202. package/es/tree-select/style/token.scss +21 -0
  203. package/es/trigger/style/index.css +7 -7
  204. package/es/trigger/style/token.scss +19 -0
  205. package/es/typography/style/index.css +40 -40
  206. package/es/typography/style/token.scss +220 -0
  207. package/es/upload/index.d.ts +3 -0
  208. package/es/upload/style/index.css +95 -95
  209. package/es/upload/style/token.scss +470 -0
  210. package/es/upload/upload.vue.d.ts +2 -0
  211. package/es/upload/upload.vue_vue_type_script_setup_true_lang.js +109 -16
  212. package/json/vetur-attributes.json +7 -0
  213. package/json/vetur-tags.json +4 -1
  214. package/json/web-types.json +18 -2
  215. package/package.json +7 -2
  216. package/es/style/color/palette-dark.d.ts +0 -4
  217. package/es/style/color/palette-dark.js +0 -10
  218. package/es/style/color/palette.d.ts +0 -4
  219. package/es/style/color/palette.js +0 -10
@@ -1,3 +1,4 @@
1
+ @use '@style/theme/runtime.scss' as theme-runtime;
1
2
  @use '@style/theme/index.scss' as global;
2
3
 
3
4
  @forward '@style/theme/index.scss';
@@ -98,3 +99,202 @@ $color-panel-block-margin: global.$spacing-3;
98
99
  $color-panel-block-border-radius: global.$border-2;
99
100
 
100
101
  $color-panel-border-color: var(string.unquote('#{global.$sd-cssvars-prefix}-color-border-2'));
102
+
103
+ // @generated runtime tokens — pnpm theme:generate
104
+ $color-preview-size-mini: theme-runtime.token(
105
+ 'color-picker',
106
+ 'color-preview-size-mini',
107
+ $color-preview-size-mini,
108
+ 'size-4'
109
+ );
110
+ $color-preview-size-small: theme-runtime.token(
111
+ 'color-picker',
112
+ 'color-preview-size-small',
113
+ $color-preview-size-small
114
+ );
115
+ $color-preview-size-medium: theme-runtime.token(
116
+ 'color-picker',
117
+ 'color-preview-size-medium',
118
+ $color-preview-size-medium,
119
+ 'size-6'
120
+ );
121
+ $color-preview-size-large: theme-runtime.token(
122
+ 'color-picker',
123
+ 'color-preview-size-large',
124
+ $color-preview-size-large
125
+ );
126
+ $color-input-bg-color: theme-runtime.token(
127
+ 'color-picker',
128
+ 'color-input-bg-color',
129
+ $color-input-bg-color
130
+ );
131
+ $color-value-margin-left: theme-runtime.token(
132
+ 'color-picker',
133
+ 'color-value-margin-left',
134
+ $color-value-margin-left,
135
+ 'spacing-2'
136
+ );
137
+ $color-value-font-color: theme-runtime.token(
138
+ 'color-picker',
139
+ 'color-value-font-color',
140
+ $color-value-font-color
141
+ );
142
+ $color-value-font-color_disabled: theme-runtime.token(
143
+ 'color-picker',
144
+ 'color-value-font-color-disabled',
145
+ $color-value-font-color_disabled
146
+ );
147
+ $color-value-size-mini-font-size: theme-runtime.token(
148
+ 'color-picker',
149
+ 'color-value-size-mini-font-size',
150
+ $color-value-size-mini-font-size,
151
+ 'font-size-body-1'
152
+ );
153
+ $color-value-size-small-font-size: theme-runtime.token(
154
+ 'color-picker',
155
+ 'color-value-size-small-font-size',
156
+ $color-value-size-small-font-size,
157
+ 'font-size-body-3'
158
+ );
159
+ $color-value-size-medium-font-size: theme-runtime.token(
160
+ 'color-picker',
161
+ 'color-value-size-medium-font-size',
162
+ $color-value-size-medium-font-size,
163
+ 'font-size-body-3'
164
+ );
165
+ $color-value-size-large-font-size: theme-runtime.token(
166
+ 'color-picker',
167
+ 'color-value-size-large-font-size',
168
+ $color-value-size-large-font-size,
169
+ 'font-size-body-3'
170
+ );
171
+ $color-input-border-radius: theme-runtime.token(
172
+ 'color-picker',
173
+ 'color-input-border-radius',
174
+ $color-input-border-radius,
175
+ 'border-radius-small'
176
+ );
177
+ $color-preview-border-size: theme-runtime.token(
178
+ 'color-picker',
179
+ 'color-preview-border-size',
180
+ $color-preview-border-size,
181
+ 'border-1'
182
+ );
183
+ $color-preview-border-color: theme-runtime.token(
184
+ 'color-picker',
185
+ 'color-preview-border-color',
186
+ $color-preview-border-color
187
+ );
188
+ $color-value-font-size: theme-runtime.token(
189
+ 'color-picker',
190
+ 'color-value-font-size',
191
+ $color-value-font-size,
192
+ 'font-weight-400'
193
+ );
194
+ $color-panel-width: theme-runtime.token('color-picker', 'color-panel-width', $color-panel-width);
195
+ $color-panel-padding: theme-runtime.token(
196
+ 'color-picker',
197
+ 'color-panel-padding',
198
+ $color-panel-padding,
199
+ 'spacing-6'
200
+ );
201
+ $color-panel-border-radius: theme-runtime.token(
202
+ 'color-picker',
203
+ 'color-panel-border-radius',
204
+ $color-panel-border-radius,
205
+ 'border-radius-small'
206
+ );
207
+ $color-panel-bg-color: theme-runtime.token(
208
+ 'color-picker',
209
+ 'color-panel-bg-color',
210
+ $color-panel-bg-color
211
+ );
212
+ $color-panel-box-shadow: theme-runtime.token(
213
+ 'color-picker',
214
+ 'color-panel-box-shadow',
215
+ $color-panel-box-shadow
216
+ );
217
+ $color-palette-height: theme-runtime.token(
218
+ 'color-picker',
219
+ 'color-palette-height',
220
+ $color-palette-height
221
+ );
222
+ $color-palette-handle-size: theme-runtime.token(
223
+ 'color-picker',
224
+ 'color-palette-handle-size',
225
+ $color-palette-handle-size,
226
+ 'size-4'
227
+ );
228
+ $color-palette-handle-border-size: theme-runtime.token(
229
+ 'color-picker',
230
+ 'color-palette-handle-border-size',
231
+ $color-palette-handle-border-size,
232
+ 'border-2'
233
+ );
234
+ $color-control-bar-width: theme-runtime.token(
235
+ 'color-picker',
236
+ 'color-control-bar-width',
237
+ $color-control-bar-width
238
+ );
239
+ $color-control-bar-height: theme-runtime.token(
240
+ 'color-picker',
241
+ 'color-control-bar-height',
242
+ $color-control-bar-height
243
+ );
244
+ $color-control-bar-alpha-margin-top: theme-runtime.token(
245
+ 'color-picker',
246
+ 'color-control-bar-alpha-margin-top',
247
+ $color-control-bar-alpha-margin-top,
248
+ 'spacing-6'
249
+ );
250
+ $color-control-bar-border-radius: theme-runtime.token(
251
+ 'color-picker',
252
+ 'color-control-bar-border-radius',
253
+ $color-control-bar-border-radius
254
+ );
255
+ $color-panel-input-margin-top: theme-runtime.token(
256
+ 'color-picker',
257
+ 'color-panel-input-margin-top',
258
+ $color-panel-input-margin-top,
259
+ 'spacing-6'
260
+ );
261
+ $color-panel-input-group-margin-left: theme-runtime.token(
262
+ 'color-picker',
263
+ 'color-panel-input-group-margin-left',
264
+ $color-panel-input-group-margin-left,
265
+ 'spacing-6'
266
+ );
267
+ $color-panel-format-select-width: theme-runtime.token(
268
+ 'color-picker',
269
+ 'color-panel-format-select-width',
270
+ $color-panel-format-select-width
271
+ );
272
+ $color-panel-section-title-font-size: theme-runtime.token(
273
+ 'color-picker',
274
+ 'color-panel-section-title-font-size',
275
+ $color-panel-section-title-font-size,
276
+ 'font-size-caption'
277
+ );
278
+ $color-panel-empty-font-size: theme-runtime.token(
279
+ 'color-picker',
280
+ 'color-panel-empty-font-size',
281
+ $color-panel-empty-font-size,
282
+ 'font-size-body-1'
283
+ );
284
+ $color-panel-block-size: theme-runtime.token(
285
+ 'color-picker',
286
+ 'color-panel-block-size',
287
+ $color-panel-block-size,
288
+ 'size-4'
289
+ );
290
+ $color-panel-block-border-radius: theme-runtime.token(
291
+ 'color-picker',
292
+ 'color-panel-block-border-radius',
293
+ $color-panel-block-border-radius,
294
+ 'border-2'
295
+ );
296
+ $color-panel-border-color: theme-runtime.token(
297
+ 'color-picker',
298
+ 'color-panel-border-color',
299
+ $color-panel-border-color
300
+ );
@@ -18,48 +18,48 @@
18
18
  .sd-comment {
19
19
  display: flex;
20
20
  flex-wrap: nowrap;
21
- font-size: 14px;
21
+ font-size: var(--component-comment-comment-font-size, var(--component-comment-font-size, var(--font-size-body-3, 14px)));
22
22
  line-height: 1.5715;
23
23
  }
24
24
  .sd-comment:not(:first-of-type), .sd-comment-inner-comment {
25
- margin-top: 20px;
25
+ margin-top: var(--component-comment-comment-margin-bottom, var(--component-comment-margin-bottom, var(--spacing-8, 20px)));
26
26
  }
27
27
  .sd-comment-inner {
28
28
  flex: 1;
29
29
  }
30
30
  .sd-comment-avatar {
31
31
  flex-shrink: 0;
32
- margin-right: 12px;
32
+ margin-right: var(--component-comment-comment-margin-avatar-right, var(--component-comment-margin-avatar-right, var(--spacing-6, 12px)));
33
33
  cursor: pointer;
34
34
  }
35
35
  .sd-comment-avatar > img {
36
- width: 32px;
37
- height: 32px;
36
+ width: var(--component-comment-comment-size-avatar-width, var(--component-comment-size-avatar-width, var(--size-8, 32px)));
37
+ height: var(--component-comment-comment-size-avatar-width, var(--component-comment-size-avatar-width, var(--size-8, 32px)));
38
38
  border-radius: var(--sd-border-radius-circle);
39
39
  }
40
40
  .sd-comment-author {
41
- margin-right: 8px;
42
- color: var(--sd-color-text-2);
43
- font-size: 14px;
41
+ margin-right: var(--component-comment-comment-margin-author-right, var(--component-comment-margin-author-right, var(--spacing-4, 8px)));
42
+ color: var(--component-comment-comment-color-author-text, var(--component-comment-color-author-text, var(--sd-color-text-2)));
43
+ font-size: var(--component-comment-comment-font-author-size, var(--component-comment-font-author-size, var(--font-size-body-3, 14px)));
44
44
  }
45
45
  .sd-comment-datetime {
46
- color: var(--sd-color-text-3);
47
- font-size: 12px;
46
+ color: var(--component-comment-comment-color-datetime-text, var(--component-comment-color-datetime-text, var(--sd-color-text-3)));
47
+ font-size: var(--component-comment-comment-font-datetime-size, var(--component-comment-font-datetime-size, var(--font-size-body-1, 12px)));
48
48
  }
49
49
  .sd-comment-content {
50
- color: var(--sd-color-text-1);
50
+ color: var(--component-comment-comment-color-content-text, var(--component-comment-color-content-text, var(--sd-color-text-1)));
51
51
  }
52
52
  .sd-comment-title-align-right {
53
53
  display: flex;
54
54
  justify-content: space-between;
55
55
  }
56
56
  .sd-comment-actions {
57
- margin-top: 8px;
58
- color: var(--sd-color-text-2);
59
- font-size: 14px;
57
+ margin-top: var(--component-comment-comment-margin-actions-top, var(--component-comment-margin-actions-top, var(--spacing-4, 8px)));
58
+ color: var(--component-comment-comment-color-actions-text, var(--component-comment-color-actions-text, var(--sd-color-text-2)));
59
+ font-size: var(--component-comment-comment-font-action-size, var(--component-comment-font-action-size, var(--font-size-body-3, 14px)));
60
60
  }
61
61
  .sd-comment-actions > *:not(:last-child) {
62
- margin-right: 8px;
62
+ margin-right: var(--component-comment-comment-margin-actions-right, var(--component-comment-margin-actions-right, var(--spacing-4, 8px)));
63
63
  }
64
64
  .sd-comment-actions-align-right {
65
65
  display: flex;
@@ -1,3 +1,4 @@
1
+ @use '@style/theme/runtime.scss' as theme-runtime;
1
2
  @use '@style/theme/index.scss' as global;
2
3
 
3
4
  @forward '@style/theme/index.scss';
@@ -33,3 +34,85 @@ $comment-margin-actions-right: global.$spacing-4;
33
34
  $comment-size-avatar-width: global.$size-8;
34
35
 
35
36
  $comment-font-action-size: global.$font-size-body-3;
37
+
38
+ // @generated runtime tokens — pnpm theme:generate
39
+ $comment-color-author-text: theme-runtime.token(
40
+ 'comment',
41
+ 'comment-color-author-text',
42
+ $comment-color-author-text
43
+ );
44
+ $comment-color-datetime-text: theme-runtime.token(
45
+ 'comment',
46
+ 'comment-color-datetime-text',
47
+ $comment-color-datetime-text
48
+ );
49
+ $comment-color-content-text: theme-runtime.token(
50
+ 'comment',
51
+ 'comment-color-content-text',
52
+ $comment-color-content-text
53
+ );
54
+ $comment-color-actions-text: theme-runtime.token(
55
+ 'comment',
56
+ 'comment-color-actions-text',
57
+ $comment-color-actions-text
58
+ );
59
+ $comment-font-size: theme-runtime.token(
60
+ 'comment',
61
+ 'comment-font-size',
62
+ $comment-font-size,
63
+ 'font-size-body-3'
64
+ );
65
+ $comment-font-author-size: theme-runtime.token(
66
+ 'comment',
67
+ 'comment-font-author-size',
68
+ $comment-font-author-size,
69
+ 'font-size-body-3'
70
+ );
71
+ $comment-font-datetime-size: theme-runtime.token(
72
+ 'comment',
73
+ 'comment-font-datetime-size',
74
+ $comment-font-datetime-size,
75
+ 'font-size-body-1'
76
+ );
77
+ $comment-margin-avatar-right: theme-runtime.token(
78
+ 'comment',
79
+ 'comment-margin-avatar-right',
80
+ $comment-margin-avatar-right,
81
+ 'spacing-6'
82
+ );
83
+ $comment-margin-author-right: theme-runtime.token(
84
+ 'comment',
85
+ 'comment-margin-author-right',
86
+ $comment-margin-author-right,
87
+ 'spacing-4'
88
+ );
89
+ $comment-margin-actions-top: theme-runtime.token(
90
+ 'comment',
91
+ 'comment-margin-actions-top',
92
+ $comment-margin-actions-top,
93
+ 'spacing-4'
94
+ );
95
+ $comment-margin-bottom: theme-runtime.token(
96
+ 'comment',
97
+ 'comment-margin-bottom',
98
+ $comment-margin-bottom,
99
+ 'spacing-8'
100
+ );
101
+ $comment-margin-actions-right: theme-runtime.token(
102
+ 'comment',
103
+ 'comment-margin-actions-right',
104
+ $comment-margin-actions-right,
105
+ 'spacing-4'
106
+ );
107
+ $comment-size-avatar-width: theme-runtime.token(
108
+ 'comment',
109
+ 'comment-size-avatar-width',
110
+ $comment-size-avatar-width,
111
+ 'size-8'
112
+ );
113
+ $comment-font-action-size: theme-runtime.token(
114
+ 'comment',
115
+ 'comment-font-action-size',
116
+ $comment-font-action-size,
117
+ 'font-size-body-3'
118
+ );
@@ -0,0 +1,11 @@
1
+ import type { SdThemeConfig, ThemeTokenMap } from './theme';
2
+ export interface SdThemeSeed {
3
+ primary?: string;
4
+ success?: string;
5
+ warning?: string;
6
+ danger?: string;
7
+ radius?: number;
8
+ fontSize?: number;
9
+ controlHeight?: number;
10
+ }
11
+ export declare function deriveThemeTokens(theme: SdThemeConfig): ThemeTokenMap;
@@ -0,0 +1,53 @@
1
+ import { generate } from "@arco-design/color";
2
+ //#region components/config-provider/algorithms.ts
3
+ /** 基础 token 派生为现有 CSS 协议,显式 tokens 始终拥有更高优先级。 */
4
+ function deriveThemeTokens(theme) {
5
+ var _theme$seed, _theme$algorithm$incl, _theme$algorithm, _theme$algorithm$incl2, _theme$algorithm2;
6
+ const tokens = {};
7
+ const seed = (_theme$seed = theme.seed) !== null && _theme$seed !== void 0 ? _theme$seed : {};
8
+ const dark = (_theme$algorithm$incl = (_theme$algorithm = theme.algorithm) === null || _theme$algorithm === void 0 ? void 0 : _theme$algorithm.includes("dark")) !== null && _theme$algorithm$incl !== void 0 ? _theme$algorithm$incl : false;
9
+ for (const name of [
10
+ "primary",
11
+ "success",
12
+ "warning",
13
+ "danger"
14
+ ]) {
15
+ const color = seed[name];
16
+ if (!color || !/^#[\da-f]{6}$/i.test(color)) continue;
17
+ generate(color, {
18
+ list: true,
19
+ dark,
20
+ format: "rgb"
21
+ }).forEach((value, index) => {
22
+ const channels = value.replace(/^rgba?\(|\)$/g, "");
23
+ tokens[`${name}-${index + 1}`] = channels;
24
+ if (name === "primary") tokens[`link-${index + 1}`] = channels;
25
+ });
26
+ }
27
+ if (seed.radius !== void 0) {
28
+ tokens["border-radius-small"] = `${seed.radius}px`;
29
+ tokens["border-radius-medium"] = `${seed.radius * 1.5}px`;
30
+ tokens["border-radius-large"] = `${seed.radius * 2}px`;
31
+ }
32
+ if (seed.fontSize !== void 0) for (const [index, delta] of [
33
+ -2,
34
+ -1,
35
+ 0
36
+ ].entries()) tokens[`font-size-body-${index + 1}`] = `${seed.fontSize + delta}px`;
37
+ const compact = (_theme$algorithm$incl2 = (_theme$algorithm2 = theme.algorithm) === null || _theme$algorithm2 === void 0 ? void 0 : _theme$algorithm2.includes("compact")) !== null && _theme$algorithm$incl2 !== void 0 ? _theme$algorithm$incl2 : false;
38
+ if (seed.controlHeight !== void 0 || compact) {
39
+ var _seed$controlHeight;
40
+ const base = ((_seed$controlHeight = seed.controlHeight) !== null && _seed$controlHeight !== void 0 ? _seed$controlHeight : 32) * (compact ? .875 : 1);
41
+ for (const [name, delta] of [
42
+ ["mini", -8],
43
+ ["small", -4],
44
+ ["default", 0],
45
+ ["medium", 0],
46
+ ["large", 4]
47
+ ]) tokens[`size-${name}`] = `${base + delta}px`;
48
+ }
49
+ if (compact) tokens["spacing-7"] = "12px";
50
+ return tokens;
51
+ }
52
+ //#endregion
53
+ export { deriveThemeTokens };
@@ -2,20 +2,23 @@ import { getThemeCSSVariables } from "./theme.js";
2
2
  //#region components/config-provider/global-theme.ts
3
3
  var targets = /* @__PURE__ */ new WeakMap();
4
4
  function render(target, state) {
5
+ var _declared;
5
6
  const variables = {};
6
- let mode = state.mode;
7
+ let declared;
7
8
  for (const layer of state.layers.values()) {
8
9
  Object.assign(variables, layer.variables);
9
- if (layer.mode !== void 0) mode = layer.mode;
10
+ if (layer.mode !== void 0) declared = layer.mode;
10
11
  }
12
+ const mode = (_declared = declared) !== null && _declared !== void 0 ? _declared : state.layers.size ? target.getAttribute("sd-theme") : state.mode;
11
13
  for (const [key, original] of state.variables) if (variables[key] !== void 0) target.style.setProperty(key, variables[key]);
12
14
  else {
13
15
  if (original.value) target.style.setProperty(key, original.value, original.priority);
14
16
  else target.style.removeProperty(key);
15
17
  state.variables.delete(key);
16
18
  }
17
- if (mode === null) target.removeAttribute("sd-theme");
18
- else target.setAttribute("sd-theme", mode);
19
+ if (mode === null) {
20
+ if (target.hasAttribute("sd-theme")) target.removeAttribute("sd-theme");
21
+ } else if (target.getAttribute("sd-theme") !== mode) target.setAttribute("sd-theme", mode);
19
22
  }
20
23
  function applyGlobalTheme(target, owner, theme, mode) {
21
24
  let state = targets.get(target);
@@ -0,0 +1,11 @@
1
+ import type { SdThemeConfig } from './theme';
2
+ export declare function validateThemeConfig(input: unknown): {
3
+ valid: boolean;
4
+ data?: SdThemeConfig;
5
+ errors: string[];
6
+ };
7
+ export declare function parseThemeConfig(text: string): {
8
+ valid: boolean;
9
+ data?: SdThemeConfig;
10
+ errors: string[];
11
+ };
@@ -0,0 +1,114 @@
1
+ import { normalizeTokenKey } from "./token-key.js";
2
+ //#region components/config-provider/theme-config.ts
3
+ var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
4
+ function validateThemeConfig(input) {
5
+ var _input$tokens, _input$components;
6
+ const errors = [];
7
+ if (!object(input)) return {
8
+ valid: false,
9
+ errors: ["主题配置必须是 JSON 对象。"]
10
+ };
11
+ const allowed = /* @__PURE__ */ new Set([
12
+ "meta",
13
+ "tokens",
14
+ "token",
15
+ "components",
16
+ "component",
17
+ "seed",
18
+ "algorithm"
19
+ ]);
20
+ for (const key of Object.keys(input)) if (!allowed.has(key)) errors.push(`不支持的字段:${key}`);
21
+ const tokenMap = (value, location) => {
22
+ const result = {};
23
+ if (value === void 0) return result;
24
+ if (!object(value)) {
25
+ errors.push(`${location} 必须是对象。`);
26
+ return result;
27
+ }
28
+ for (const [key, item] of Object.entries(value)) {
29
+ const normalized = normalizeTokenKey(key);
30
+ if (!normalized || /^(?:__proto__|constructor|prototype)$/.test(key) || !/^[\w-]+$/.test(normalized)) errors.push(`${location}.${key} 名称无效。`);
31
+ else if (typeof item !== "string" && typeof item !== "number" || typeof item === "number" && !Number.isFinite(item)) errors.push(`${location}.${key} 必须是字符串或有限数字。`);
32
+ else if (normalized in result) errors.push(`${location}.${key} 与已有 token 重复。`);
33
+ else result[normalized] = item;
34
+ }
35
+ return result;
36
+ };
37
+ const data = {
38
+ tokens: tokenMap((_input$tokens = input.tokens) !== null && _input$tokens !== void 0 ? _input$tokens : input.token, "tokens"),
39
+ components: {}
40
+ };
41
+ const components = (_input$components = input.components) !== null && _input$components !== void 0 ? _input$components : input.component;
42
+ if (components !== void 0 && !object(components)) errors.push("components 必须是对象。");
43
+ else if (object(components)) for (const [name, value] of Object.entries(components)) {
44
+ const key = normalizeTokenKey(name);
45
+ if (!key || [
46
+ "__proto__",
47
+ "constructor",
48
+ "prototype"
49
+ ].includes(name) || !/^[\w-]+$/.test(key)) errors.push(`组件名称 ${name} 无效。`);
50
+ else if (key in data.components) errors.push(`组件名称 ${name} 与已有组件重复。`);
51
+ else data.components[key] = tokenMap(value, `components.${name}`);
52
+ }
53
+ data.meta = {
54
+ schemaVersion: 1,
55
+ cssVarPrefix: "--"
56
+ };
57
+ if (input.meta !== void 0) {
58
+ if (!object(input.meta)) errors.push("meta 必须是对象。");
59
+ else {
60
+ if (input.meta.schemaVersion !== void 0 && input.meta.schemaVersion !== 1) errors.push("仅支持 schemaVersion 1。");
61
+ if (input.meta.cssVarPrefix !== void 0) {
62
+ if (typeof input.meta.cssVarPrefix !== "string" || !input.meta.cssVarPrefix.trim()) errors.push("meta.cssVarPrefix 必须是非空字符串。");
63
+ else data.meta.cssVarPrefix = input.meta.cssVarPrefix;
64
+ }
65
+ if (input.meta.name !== void 0 && typeof input.meta.name !== "string") errors.push("meta.name 必须是字符串。");
66
+ else if (typeof input.meta.name === "string") data.meta.name = input.meta.name;
67
+ }
68
+ }
69
+ if (input.algorithm !== void 0) {
70
+ if (!Array.isArray(input.algorithm) || input.algorithm.some((value) => value !== "dark" && value !== "compact")) errors.push("algorithm 仅支持 dark、compact 数组。");
71
+ else data.algorithm = [...new Set(input.algorithm)];
72
+ }
73
+ if (input.seed !== void 0) {
74
+ if (!object(input.seed)) errors.push("seed 必须是对象。");
75
+ else {
76
+ const seed = {};
77
+ for (const [key, value] of Object.entries(input.seed)) if ([
78
+ "primary",
79
+ "success",
80
+ "warning",
81
+ "danger"
82
+ ].includes(key)) {
83
+ if (typeof value !== "string" || !/^#[\da-f]{6}$/i.test(value)) errors.push(`seed.${key} 必须是六位十六进制颜色。`);
84
+ else seed[key] = value;
85
+ } else if ([
86
+ "radius",
87
+ "fontSize",
88
+ "controlHeight"
89
+ ].includes(key)) {
90
+ const minimum = key === "radius" ? 0 : key === "fontSize" ? 8 : 16;
91
+ if (typeof value !== "number" || !Number.isFinite(value) || value < minimum || value > 256) errors.push(`seed.${key} 必须是 ${minimum} 到 256 之间的数字。`);
92
+ else seed[key] = value;
93
+ } else errors.push(`不支持的基础 token:${key}`);
94
+ data.seed = seed;
95
+ }
96
+ }
97
+ return {
98
+ valid: !errors.length,
99
+ data: errors.length ? void 0 : data,
100
+ errors
101
+ };
102
+ }
103
+ function parseThemeConfig(text) {
104
+ try {
105
+ return validateThemeConfig(JSON.parse(text));
106
+ } catch (_unused) {
107
+ return {
108
+ valid: false,
109
+ errors: ["JSON 解析失败,请检查逗号、引号和对象结构。"]
110
+ };
111
+ }
112
+ }
113
+ //#endregion
114
+ export { parseThemeConfig, validateThemeConfig };