@sanity/ui 2.9.0-canary.5 → 2.9.0-corel.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.
- package/dist/_chunks-cjs/getTheme_v2.js +54 -84
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +54 -84
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +54 -84
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.d.mts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.esm.js +3117 -3676
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3117 -3675
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3117 -3676
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +22 -28
- package/dist/theme.d.ts +22 -28
- package/dist/theme.esm.js +630 -1318
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +630 -1318
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +630 -1318
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -2
- package/src/core/__workshop__/constants.ts +13 -13
- package/src/core/components/autocomplete/autocomplete.tsx +31 -42
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +58 -0
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +3 -1
- package/src/core/components/breadcrumbs/__workshop__/index.ts +5 -0
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -13
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +70 -50
- package/src/core/components/dialog/dialog.tsx +3 -5
- package/src/core/components/menu/menu.tsx +11 -15
- package/src/core/components/menu/menuButton.tsx +36 -14
- package/src/core/components/menu/menuGroup.tsx +1 -2
- package/src/core/components/menu/menuItem.tsx +2 -4
- package/src/core/components/menu/useMenuController.ts +21 -18
- package/src/core/components/tab/tabList.tsx +11 -3
- package/src/core/components/toast/toastProvider.tsx +6 -5
- package/src/core/components/tree/treeItem.tsx +15 -18
- package/src/core/constants.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +9 -14
- package/src/core/hooks/useMatchMedia.ts +22 -12
- package/src/core/primitives/avatar/avatarStack.tsx +5 -2
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/button.tsx +11 -6
- package/src/core/primitives/button/styles.ts +1 -1
- package/src/core/primitives/flex/flex.tsx +5 -1
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +139 -74
- package/src/core/primitives/popover/popoverCard.tsx +4 -1
- package/src/core/primitives/text/styles.ts +1 -0
- package/src/core/primitives/text/text.tsx +4 -2
- package/src/core/primitives/tooltip/tooltip.tsx +4 -7
- package/src/core/styles/card/_cardColorStyle.ts +8 -0
- package/src/core/styles/flex/flexStyle.ts +18 -0
- package/src/core/styles/flex/types.ts +2 -0
- package/src/core/theme/themeProvider.tsx +6 -4
- package/src/core/utils/elementQuery/elementQuery.tsx +17 -16
- package/src/core/utils/layer/layerProvider.tsx +1 -1
- package/src/core/utils/portal/portalProvider.tsx +5 -5
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +45 -39
- package/src/theme/build/renderColorTheme.ts +239 -65
- package/src/theme/build/resolveColorTokens.ts +51 -115
- package/src/theme/config/tokens/color/types.ts +4 -18
- package/src/theme/defaults/colorTokens.ts +19 -11
- package/src/theme/getScopedTheme.ts +9 -2
- package/src/theme/system/color/_constants.ts +8 -0
- package/src/theme/system/color/badge.ts +3 -7
- package/src/theme/system/v0/color/_system.ts +8 -4
- package/src/theme/system/v0/color/color.ts +3 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -0
- package/src/theme/versioning/v0_v2.ts +4 -0
- package/src/core/components/toast/toastState.ts +0 -6
package/dist/theme.mjs
CHANGED
|
@@ -57,226 +57,46 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
|
57
57
|
function createSolidTones(opts, base, dark, name) {
|
|
58
58
|
return {
|
|
59
59
|
default: {
|
|
60
|
-
enabled: opts.solid({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
state: "enabled"
|
|
66
|
-
}),
|
|
67
|
-
disabled: opts.solid({
|
|
68
|
-
base,
|
|
69
|
-
dark,
|
|
70
|
-
tone: "default",
|
|
71
|
-
name,
|
|
72
|
-
state: "disabled"
|
|
73
|
-
}),
|
|
74
|
-
hovered: opts.solid({
|
|
75
|
-
base,
|
|
76
|
-
dark,
|
|
77
|
-
tone: "default",
|
|
78
|
-
name,
|
|
79
|
-
state: "hovered"
|
|
80
|
-
}),
|
|
81
|
-
pressed: opts.solid({
|
|
82
|
-
base,
|
|
83
|
-
dark,
|
|
84
|
-
tone: "default",
|
|
85
|
-
name,
|
|
86
|
-
state: "pressed"
|
|
87
|
-
}),
|
|
88
|
-
selected: opts.solid({
|
|
89
|
-
base,
|
|
90
|
-
dark,
|
|
91
|
-
tone: "default",
|
|
92
|
-
name,
|
|
93
|
-
state: "selected"
|
|
94
|
-
})
|
|
60
|
+
enabled: opts.solid({ base, dark, tone: "default", name, state: "enabled" }),
|
|
61
|
+
disabled: opts.solid({ base, dark, tone: "default", name, state: "disabled" }),
|
|
62
|
+
hovered: opts.solid({ base, dark, tone: "default", name, state: "hovered" }),
|
|
63
|
+
pressed: opts.solid({ base, dark, tone: "default", name, state: "pressed" }),
|
|
64
|
+
selected: opts.solid({ base, dark, tone: "default", name, state: "selected" })
|
|
95
65
|
},
|
|
96
66
|
transparent: {
|
|
97
|
-
enabled: opts.solid({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
state: "enabled"
|
|
103
|
-
}),
|
|
104
|
-
disabled: opts.solid({
|
|
105
|
-
base,
|
|
106
|
-
dark,
|
|
107
|
-
tone: "transparent",
|
|
108
|
-
name,
|
|
109
|
-
state: "disabled"
|
|
110
|
-
}),
|
|
111
|
-
hovered: opts.solid({
|
|
112
|
-
base,
|
|
113
|
-
dark,
|
|
114
|
-
tone: "transparent",
|
|
115
|
-
name,
|
|
116
|
-
state: "hovered"
|
|
117
|
-
}),
|
|
118
|
-
pressed: opts.solid({
|
|
119
|
-
base,
|
|
120
|
-
dark,
|
|
121
|
-
tone: "transparent",
|
|
122
|
-
name,
|
|
123
|
-
state: "pressed"
|
|
124
|
-
}),
|
|
125
|
-
selected: opts.solid({
|
|
126
|
-
base,
|
|
127
|
-
dark,
|
|
128
|
-
tone: "transparent",
|
|
129
|
-
name,
|
|
130
|
-
state: "selected"
|
|
131
|
-
})
|
|
67
|
+
enabled: opts.solid({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
68
|
+
disabled: opts.solid({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
69
|
+
hovered: opts.solid({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
70
|
+
pressed: opts.solid({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
71
|
+
selected: opts.solid({ base, dark, tone: "transparent", name, state: "selected" })
|
|
132
72
|
},
|
|
133
73
|
primary: {
|
|
134
|
-
enabled: opts.solid({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
state: "enabled"
|
|
140
|
-
}),
|
|
141
|
-
disabled: opts.solid({
|
|
142
|
-
base,
|
|
143
|
-
dark,
|
|
144
|
-
tone: "primary",
|
|
145
|
-
name,
|
|
146
|
-
state: "disabled"
|
|
147
|
-
}),
|
|
148
|
-
hovered: opts.solid({
|
|
149
|
-
base,
|
|
150
|
-
dark,
|
|
151
|
-
tone: "primary",
|
|
152
|
-
name,
|
|
153
|
-
state: "hovered"
|
|
154
|
-
}),
|
|
155
|
-
pressed: opts.solid({
|
|
156
|
-
base,
|
|
157
|
-
dark,
|
|
158
|
-
tone: "primary",
|
|
159
|
-
name,
|
|
160
|
-
state: "pressed"
|
|
161
|
-
}),
|
|
162
|
-
selected: opts.solid({
|
|
163
|
-
base,
|
|
164
|
-
dark,
|
|
165
|
-
tone: "primary",
|
|
166
|
-
name,
|
|
167
|
-
state: "selected"
|
|
168
|
-
})
|
|
74
|
+
enabled: opts.solid({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
75
|
+
disabled: opts.solid({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
76
|
+
hovered: opts.solid({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
77
|
+
pressed: opts.solid({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
78
|
+
selected: opts.solid({ base, dark, tone: "primary", name, state: "selected" })
|
|
169
79
|
},
|
|
170
80
|
positive: {
|
|
171
|
-
enabled: opts.solid({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
state: "enabled"
|
|
177
|
-
}),
|
|
178
|
-
disabled: opts.solid({
|
|
179
|
-
base,
|
|
180
|
-
dark,
|
|
181
|
-
tone: "positive",
|
|
182
|
-
name,
|
|
183
|
-
state: "disabled"
|
|
184
|
-
}),
|
|
185
|
-
hovered: opts.solid({
|
|
186
|
-
base,
|
|
187
|
-
dark,
|
|
188
|
-
tone: "positive",
|
|
189
|
-
name,
|
|
190
|
-
state: "hovered"
|
|
191
|
-
}),
|
|
192
|
-
pressed: opts.solid({
|
|
193
|
-
base,
|
|
194
|
-
dark,
|
|
195
|
-
tone: "positive",
|
|
196
|
-
name,
|
|
197
|
-
state: "pressed"
|
|
198
|
-
}),
|
|
199
|
-
selected: opts.solid({
|
|
200
|
-
base,
|
|
201
|
-
dark,
|
|
202
|
-
tone: "positive",
|
|
203
|
-
name,
|
|
204
|
-
state: "selected"
|
|
205
|
-
})
|
|
81
|
+
enabled: opts.solid({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
82
|
+
disabled: opts.solid({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
83
|
+
hovered: opts.solid({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
84
|
+
pressed: opts.solid({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
85
|
+
selected: opts.solid({ base, dark, tone: "positive", name, state: "selected" })
|
|
206
86
|
},
|
|
207
87
|
caution: {
|
|
208
|
-
enabled: opts.solid({
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
state: "enabled"
|
|
214
|
-
}),
|
|
215
|
-
disabled: opts.solid({
|
|
216
|
-
base,
|
|
217
|
-
dark,
|
|
218
|
-
tone: "caution",
|
|
219
|
-
name,
|
|
220
|
-
state: "disabled"
|
|
221
|
-
}),
|
|
222
|
-
hovered: opts.solid({
|
|
223
|
-
base,
|
|
224
|
-
dark,
|
|
225
|
-
tone: "caution",
|
|
226
|
-
name,
|
|
227
|
-
state: "hovered"
|
|
228
|
-
}),
|
|
229
|
-
pressed: opts.solid({
|
|
230
|
-
base,
|
|
231
|
-
dark,
|
|
232
|
-
tone: "caution",
|
|
233
|
-
name,
|
|
234
|
-
state: "pressed"
|
|
235
|
-
}),
|
|
236
|
-
selected: opts.solid({
|
|
237
|
-
base,
|
|
238
|
-
dark,
|
|
239
|
-
tone: "caution",
|
|
240
|
-
name,
|
|
241
|
-
state: "selected"
|
|
242
|
-
})
|
|
88
|
+
enabled: opts.solid({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
89
|
+
disabled: opts.solid({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
90
|
+
hovered: opts.solid({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
91
|
+
pressed: opts.solid({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
92
|
+
selected: opts.solid({ base, dark, tone: "caution", name, state: "selected" })
|
|
243
93
|
},
|
|
244
94
|
critical: {
|
|
245
|
-
enabled: opts.solid({
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
state: "enabled"
|
|
251
|
-
}),
|
|
252
|
-
disabled: opts.solid({
|
|
253
|
-
base,
|
|
254
|
-
dark,
|
|
255
|
-
tone: "critical",
|
|
256
|
-
name,
|
|
257
|
-
state: "disabled"
|
|
258
|
-
}),
|
|
259
|
-
hovered: opts.solid({
|
|
260
|
-
base,
|
|
261
|
-
dark,
|
|
262
|
-
tone: "critical",
|
|
263
|
-
name,
|
|
264
|
-
state: "hovered"
|
|
265
|
-
}),
|
|
266
|
-
pressed: opts.solid({
|
|
267
|
-
base,
|
|
268
|
-
dark,
|
|
269
|
-
tone: "critical",
|
|
270
|
-
name,
|
|
271
|
-
state: "pressed"
|
|
272
|
-
}),
|
|
273
|
-
selected: opts.solid({
|
|
274
|
-
base,
|
|
275
|
-
dark,
|
|
276
|
-
tone: "critical",
|
|
277
|
-
name,
|
|
278
|
-
state: "selected"
|
|
279
|
-
})
|
|
95
|
+
enabled: opts.solid({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
96
|
+
disabled: opts.solid({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
97
|
+
hovered: opts.solid({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
98
|
+
pressed: opts.solid({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
99
|
+
selected: opts.solid({ base, dark, tone: "critical", name, state: "selected" })
|
|
280
100
|
}
|
|
281
101
|
};
|
|
282
102
|
}
|
|
@@ -467,10 +287,7 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
467
287
|
focusRing: [colors.critical.base, colors.critical.base]
|
|
468
288
|
}
|
|
469
289
|
}, defaultOpts = {
|
|
470
|
-
base: ({
|
|
471
|
-
dark,
|
|
472
|
-
name
|
|
473
|
-
}) => name === "default" ? {
|
|
290
|
+
base: ({ dark, name }) => name === "default" ? {
|
|
474
291
|
bg: dark ? black : white,
|
|
475
292
|
fg: dark ? white : black,
|
|
476
293
|
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
@@ -501,12 +318,7 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
501
318
|
to: dark ? white : black
|
|
502
319
|
}
|
|
503
320
|
},
|
|
504
|
-
solid: ({
|
|
505
|
-
base,
|
|
506
|
-
dark,
|
|
507
|
-
state,
|
|
508
|
-
tone
|
|
509
|
-
}) => {
|
|
321
|
+
solid: ({ base, dark, state, tone }) => {
|
|
510
322
|
const color2 = colors[tone];
|
|
511
323
|
return state === "hovered" ? {
|
|
512
324
|
bg: dark ? color2.light : color2.dark,
|
|
@@ -550,12 +362,7 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
550
362
|
skeleton: base.skeleton
|
|
551
363
|
};
|
|
552
364
|
},
|
|
553
|
-
muted: ({
|
|
554
|
-
base,
|
|
555
|
-
dark,
|
|
556
|
-
state,
|
|
557
|
-
tone
|
|
558
|
-
}) => {
|
|
365
|
+
muted: ({ base, dark, state, tone }) => {
|
|
559
366
|
const color2 = colors[tone];
|
|
560
367
|
return state === "hovered" ? {
|
|
561
368
|
bg: dark ? color2.darker : color2.lighter,
|
|
@@ -599,12 +406,7 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
599
406
|
skeleton: base.skeleton
|
|
600
407
|
};
|
|
601
408
|
},
|
|
602
|
-
button: ({
|
|
603
|
-
base,
|
|
604
|
-
mode,
|
|
605
|
-
muted,
|
|
606
|
-
solid
|
|
607
|
-
}) => mode === "bleed" ? {
|
|
409
|
+
button: ({ base, mode, muted, solid }) => mode === "bleed" ? {
|
|
608
410
|
...muted,
|
|
609
411
|
enabled: {
|
|
610
412
|
bg: "transparent",
|
|
@@ -652,9 +454,7 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
652
454
|
...solid,
|
|
653
455
|
enabled: muted.enabled
|
|
654
456
|
} : solid,
|
|
655
|
-
card: ({
|
|
656
|
-
base
|
|
657
|
-
}) => ({
|
|
457
|
+
card: ({ base }) => ({
|
|
658
458
|
bg: black,
|
|
659
459
|
bg2: black,
|
|
660
460
|
fg: black,
|
|
@@ -682,14 +482,8 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
682
482
|
border: black,
|
|
683
483
|
placeholder: black
|
|
684
484
|
}),
|
|
685
|
-
selectable: ({
|
|
686
|
-
|
|
687
|
-
state,
|
|
688
|
-
tone
|
|
689
|
-
}) => muted[tone][state],
|
|
690
|
-
spot: ({
|
|
691
|
-
key
|
|
692
|
-
}) => spots[key],
|
|
485
|
+
selectable: ({ muted, state, tone }) => muted[tone][state],
|
|
486
|
+
spot: ({ key }) => spots[key],
|
|
693
487
|
syntax: () => ({
|
|
694
488
|
atrule: black,
|
|
695
489
|
attrName: black,
|
|
@@ -804,283 +598,64 @@ function createInputModes(opts, base, dark, solid, muted) {
|
|
|
804
598
|
function createMutedTones(opts, base, dark, name) {
|
|
805
599
|
return {
|
|
806
600
|
default: {
|
|
807
|
-
enabled: opts.muted({
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
state: "enabled"
|
|
813
|
-
}),
|
|
814
|
-
disabled: opts.muted({
|
|
815
|
-
base,
|
|
816
|
-
dark,
|
|
817
|
-
tone: "default",
|
|
818
|
-
name,
|
|
819
|
-
state: "disabled"
|
|
820
|
-
}),
|
|
821
|
-
hovered: opts.muted({
|
|
822
|
-
base,
|
|
823
|
-
dark,
|
|
824
|
-
tone: "default",
|
|
825
|
-
name,
|
|
826
|
-
state: "hovered"
|
|
827
|
-
}),
|
|
828
|
-
pressed: opts.muted({
|
|
829
|
-
base,
|
|
830
|
-
dark,
|
|
831
|
-
tone: "default",
|
|
832
|
-
name,
|
|
833
|
-
state: "pressed"
|
|
834
|
-
}),
|
|
835
|
-
selected: opts.muted({
|
|
836
|
-
base,
|
|
837
|
-
dark,
|
|
838
|
-
tone: "default",
|
|
839
|
-
name,
|
|
840
|
-
state: "selected"
|
|
841
|
-
})
|
|
601
|
+
enabled: opts.muted({ base, dark, tone: "default", name, state: "enabled" }),
|
|
602
|
+
disabled: opts.muted({ base, dark, tone: "default", name, state: "disabled" }),
|
|
603
|
+
hovered: opts.muted({ base, dark, tone: "default", name, state: "hovered" }),
|
|
604
|
+
pressed: opts.muted({ base, dark, tone: "default", name, state: "pressed" }),
|
|
605
|
+
selected: opts.muted({ base, dark, tone: "default", name, state: "selected" })
|
|
842
606
|
},
|
|
843
607
|
transparent: {
|
|
844
|
-
enabled: opts.muted({
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
state: "enabled"
|
|
850
|
-
}),
|
|
851
|
-
disabled: opts.muted({
|
|
852
|
-
base,
|
|
853
|
-
dark,
|
|
854
|
-
tone: "transparent",
|
|
855
|
-
name,
|
|
856
|
-
state: "disabled"
|
|
857
|
-
}),
|
|
858
|
-
hovered: opts.muted({
|
|
859
|
-
base,
|
|
860
|
-
dark,
|
|
861
|
-
tone: "transparent",
|
|
862
|
-
name,
|
|
863
|
-
state: "hovered"
|
|
864
|
-
}),
|
|
865
|
-
pressed: opts.muted({
|
|
866
|
-
base,
|
|
867
|
-
dark,
|
|
868
|
-
tone: "transparent",
|
|
869
|
-
name,
|
|
870
|
-
state: "pressed"
|
|
871
|
-
}),
|
|
872
|
-
selected: opts.muted({
|
|
873
|
-
base,
|
|
874
|
-
dark,
|
|
875
|
-
tone: "transparent",
|
|
876
|
-
name,
|
|
877
|
-
state: "selected"
|
|
878
|
-
})
|
|
608
|
+
enabled: opts.muted({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
609
|
+
disabled: opts.muted({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
610
|
+
hovered: opts.muted({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
611
|
+
pressed: opts.muted({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
612
|
+
selected: opts.muted({ base, dark, tone: "transparent", name, state: "selected" })
|
|
879
613
|
},
|
|
880
614
|
primary: {
|
|
881
|
-
enabled: opts.muted({
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
state: "enabled"
|
|
887
|
-
}),
|
|
888
|
-
disabled: opts.muted({
|
|
889
|
-
base,
|
|
890
|
-
dark,
|
|
891
|
-
tone: "primary",
|
|
892
|
-
name,
|
|
893
|
-
state: "disabled"
|
|
894
|
-
}),
|
|
895
|
-
hovered: opts.muted({
|
|
896
|
-
base,
|
|
897
|
-
dark,
|
|
898
|
-
tone: "primary",
|
|
899
|
-
name,
|
|
900
|
-
state: "hovered"
|
|
901
|
-
}),
|
|
902
|
-
pressed: opts.muted({
|
|
903
|
-
base,
|
|
904
|
-
dark,
|
|
905
|
-
tone: "primary",
|
|
906
|
-
name,
|
|
907
|
-
state: "pressed"
|
|
908
|
-
}),
|
|
909
|
-
selected: opts.muted({
|
|
910
|
-
base,
|
|
911
|
-
dark,
|
|
912
|
-
tone: "primary",
|
|
913
|
-
name,
|
|
914
|
-
state: "selected"
|
|
915
|
-
})
|
|
615
|
+
enabled: opts.muted({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
616
|
+
disabled: opts.muted({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
617
|
+
hovered: opts.muted({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
618
|
+
pressed: opts.muted({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
619
|
+
selected: opts.muted({ base, dark, tone: "primary", name, state: "selected" })
|
|
916
620
|
},
|
|
917
621
|
positive: {
|
|
918
|
-
enabled: opts.muted({
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
state: "enabled"
|
|
924
|
-
}),
|
|
925
|
-
disabled: opts.muted({
|
|
926
|
-
base,
|
|
927
|
-
dark,
|
|
928
|
-
tone: "positive",
|
|
929
|
-
name,
|
|
930
|
-
state: "disabled"
|
|
931
|
-
}),
|
|
932
|
-
hovered: opts.muted({
|
|
933
|
-
base,
|
|
934
|
-
dark,
|
|
935
|
-
tone: "positive",
|
|
936
|
-
name,
|
|
937
|
-
state: "hovered"
|
|
938
|
-
}),
|
|
939
|
-
pressed: opts.muted({
|
|
940
|
-
base,
|
|
941
|
-
dark,
|
|
942
|
-
tone: "positive",
|
|
943
|
-
name,
|
|
944
|
-
state: "pressed"
|
|
945
|
-
}),
|
|
946
|
-
selected: opts.muted({
|
|
947
|
-
base,
|
|
948
|
-
dark,
|
|
949
|
-
tone: "positive",
|
|
950
|
-
name,
|
|
951
|
-
state: "selected"
|
|
952
|
-
})
|
|
622
|
+
enabled: opts.muted({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
623
|
+
disabled: opts.muted({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
624
|
+
hovered: opts.muted({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
625
|
+
pressed: opts.muted({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
626
|
+
selected: opts.muted({ base, dark, tone: "positive", name, state: "selected" })
|
|
953
627
|
},
|
|
954
628
|
caution: {
|
|
955
|
-
enabled: opts.muted({
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
state: "enabled"
|
|
961
|
-
}),
|
|
962
|
-
disabled: opts.muted({
|
|
963
|
-
base,
|
|
964
|
-
dark,
|
|
965
|
-
tone: "caution",
|
|
966
|
-
name,
|
|
967
|
-
state: "disabled"
|
|
968
|
-
}),
|
|
969
|
-
hovered: opts.muted({
|
|
970
|
-
base,
|
|
971
|
-
dark,
|
|
972
|
-
tone: "caution",
|
|
973
|
-
name,
|
|
974
|
-
state: "hovered"
|
|
975
|
-
}),
|
|
976
|
-
pressed: opts.muted({
|
|
977
|
-
base,
|
|
978
|
-
dark,
|
|
979
|
-
tone: "caution",
|
|
980
|
-
name,
|
|
981
|
-
state: "pressed"
|
|
982
|
-
}),
|
|
983
|
-
selected: opts.muted({
|
|
984
|
-
base,
|
|
985
|
-
dark,
|
|
986
|
-
tone: "caution",
|
|
987
|
-
name,
|
|
988
|
-
state: "selected"
|
|
989
|
-
})
|
|
629
|
+
enabled: opts.muted({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
630
|
+
disabled: opts.muted({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
631
|
+
hovered: opts.muted({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
632
|
+
pressed: opts.muted({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
633
|
+
selected: opts.muted({ base, dark, tone: "caution", name, state: "selected" })
|
|
990
634
|
},
|
|
991
635
|
critical: {
|
|
992
|
-
enabled: opts.muted({
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
state: "enabled"
|
|
998
|
-
}),
|
|
999
|
-
disabled: opts.muted({
|
|
1000
|
-
base,
|
|
1001
|
-
dark,
|
|
1002
|
-
tone: "critical",
|
|
1003
|
-
name,
|
|
1004
|
-
state: "disabled"
|
|
1005
|
-
}),
|
|
1006
|
-
hovered: opts.muted({
|
|
1007
|
-
base,
|
|
1008
|
-
dark,
|
|
1009
|
-
tone: "critical",
|
|
1010
|
-
name,
|
|
1011
|
-
state: "hovered"
|
|
1012
|
-
}),
|
|
1013
|
-
pressed: opts.muted({
|
|
1014
|
-
base,
|
|
1015
|
-
dark,
|
|
1016
|
-
tone: "critical",
|
|
1017
|
-
name,
|
|
1018
|
-
state: "pressed"
|
|
1019
|
-
}),
|
|
1020
|
-
selected: opts.muted({
|
|
1021
|
-
base,
|
|
1022
|
-
dark,
|
|
1023
|
-
tone: "critical",
|
|
1024
|
-
name,
|
|
1025
|
-
state: "selected"
|
|
1026
|
-
})
|
|
636
|
+
enabled: opts.muted({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
637
|
+
disabled: opts.muted({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
638
|
+
hovered: opts.muted({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
639
|
+
pressed: opts.muted({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
640
|
+
selected: opts.muted({ base, dark, tone: "critical", name, state: "selected" })
|
|
1027
641
|
}
|
|
1028
642
|
};
|
|
1029
643
|
}
|
|
1030
644
|
function createSpot(opts, base, dark) {
|
|
1031
645
|
return {
|
|
1032
|
-
gray: opts.spot({
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
}),
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
}),
|
|
1042
|
-
purple: opts.spot({
|
|
1043
|
-
base,
|
|
1044
|
-
dark,
|
|
1045
|
-
key: "purple"
|
|
1046
|
-
}),
|
|
1047
|
-
magenta: opts.spot({
|
|
1048
|
-
base,
|
|
1049
|
-
dark,
|
|
1050
|
-
key: "magenta"
|
|
1051
|
-
}),
|
|
1052
|
-
red: opts.spot({
|
|
1053
|
-
base,
|
|
1054
|
-
dark,
|
|
1055
|
-
key: "red"
|
|
1056
|
-
}),
|
|
1057
|
-
orange: opts.spot({
|
|
1058
|
-
base,
|
|
1059
|
-
dark,
|
|
1060
|
-
key: "orange"
|
|
1061
|
-
}),
|
|
1062
|
-
yellow: opts.spot({
|
|
1063
|
-
base,
|
|
1064
|
-
dark,
|
|
1065
|
-
key: "yellow"
|
|
1066
|
-
}),
|
|
1067
|
-
green: opts.spot({
|
|
1068
|
-
base,
|
|
1069
|
-
dark,
|
|
1070
|
-
key: "green"
|
|
1071
|
-
}),
|
|
1072
|
-
cyan: opts.spot({
|
|
1073
|
-
base,
|
|
1074
|
-
dark,
|
|
1075
|
-
key: "cyan"
|
|
1076
|
-
})
|
|
646
|
+
gray: opts.spot({ base, dark, key: "gray" }),
|
|
647
|
+
blue: opts.spot({ base, dark, key: "blue" }),
|
|
648
|
+
purple: opts.spot({ base, dark, key: "purple" }),
|
|
649
|
+
magenta: opts.spot({ base, dark, key: "magenta" }),
|
|
650
|
+
red: opts.spot({ base, dark, key: "red" }),
|
|
651
|
+
orange: opts.spot({ base, dark, key: "orange" }),
|
|
652
|
+
yellow: opts.spot({ base, dark, key: "yellow" }),
|
|
653
|
+
green: opts.spot({ base, dark, key: "green" }),
|
|
654
|
+
cyan: opts.spot({ base, dark, key: "cyan" })
|
|
1077
655
|
};
|
|
1078
656
|
}
|
|
1079
657
|
function createColorTheme(partialOpts = {}) {
|
|
1080
|
-
const builders = {
|
|
1081
|
-
...defaultOpts,
|
|
1082
|
-
...partialOpts
|
|
1083
|
-
};
|
|
658
|
+
const builders = { ...defaultOpts, ...partialOpts };
|
|
1084
659
|
return {
|
|
1085
660
|
light: _createColorScheme(builders, !1),
|
|
1086
661
|
dark: _createColorScheme(builders, !0)
|
|
@@ -1097,10 +672,7 @@ function _createColorScheme(opts, dark) {
|
|
|
1097
672
|
};
|
|
1098
673
|
}
|
|
1099
674
|
function _createColor(opts, dark, name) {
|
|
1100
|
-
const base = opts.base({
|
|
1101
|
-
dark,
|
|
1102
|
-
name
|
|
1103
|
-
}), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
675
|
+
const base = opts.base({ dark, name }), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
1104
676
|
return {
|
|
1105
677
|
base,
|
|
1106
678
|
button: createButtonModes(opts, base, dark, solid, muted),
|
|
@@ -1109,10 +681,7 @@ function _createColor(opts, dark, name) {
|
|
|
1109
681
|
input: createInputModes(opts, base, dark, solid, muted),
|
|
1110
682
|
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
1111
683
|
spot: createSpot(opts, base, dark),
|
|
1112
|
-
syntax: opts.syntax({
|
|
1113
|
-
base,
|
|
1114
|
-
dark
|
|
1115
|
-
}),
|
|
684
|
+
syntax: opts.syntax({ base, dark }),
|
|
1116
685
|
solid,
|
|
1117
686
|
muted
|
|
1118
687
|
};
|
|
@@ -1126,42 +695,48 @@ const defaultThemeFonts = {
|
|
|
1126
695
|
semibold: 600,
|
|
1127
696
|
bold: 700
|
|
1128
697
|
},
|
|
1129
|
-
sizes: [
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
698
|
+
sizes: [
|
|
699
|
+
{
|
|
700
|
+
ascenderHeight: 4,
|
|
701
|
+
descenderHeight: 4,
|
|
702
|
+
fontSize: 10,
|
|
703
|
+
iconSize: 17,
|
|
704
|
+
lineHeight: 15,
|
|
705
|
+
letterSpacing: 0
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
ascenderHeight: 5,
|
|
709
|
+
descenderHeight: 5,
|
|
710
|
+
fontSize: 13,
|
|
711
|
+
iconSize: 21,
|
|
712
|
+
lineHeight: 19,
|
|
713
|
+
letterSpacing: 0
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
ascenderHeight: 6,
|
|
717
|
+
descenderHeight: 6,
|
|
718
|
+
fontSize: 16,
|
|
719
|
+
iconSize: 25,
|
|
720
|
+
lineHeight: 23,
|
|
721
|
+
letterSpacing: 0
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
ascenderHeight: 7,
|
|
725
|
+
descenderHeight: 7,
|
|
726
|
+
fontSize: 19,
|
|
727
|
+
iconSize: 29,
|
|
728
|
+
lineHeight: 27,
|
|
729
|
+
letterSpacing: 0
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
ascenderHeight: 8,
|
|
733
|
+
descenderHeight: 8,
|
|
734
|
+
fontSize: 22,
|
|
735
|
+
iconSize: 33,
|
|
736
|
+
lineHeight: 31,
|
|
737
|
+
letterSpacing: 0
|
|
738
|
+
}
|
|
739
|
+
]
|
|
1165
740
|
},
|
|
1166
741
|
heading: {
|
|
1167
742
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -1171,49 +746,56 @@ const defaultThemeFonts = {
|
|
|
1171
746
|
semibold: 900,
|
|
1172
747
|
bold: 900
|
|
1173
748
|
},
|
|
1174
|
-
sizes: [
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
749
|
+
sizes: [
|
|
750
|
+
{
|
|
751
|
+
ascenderHeight: 5,
|
|
752
|
+
descenderHeight: 5,
|
|
753
|
+
fontSize: 13,
|
|
754
|
+
iconSize: 17,
|
|
755
|
+
lineHeight: 19,
|
|
756
|
+
letterSpacing: 0
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
ascenderHeight: 6,
|
|
760
|
+
descenderHeight: 6,
|
|
761
|
+
fontSize: 16,
|
|
762
|
+
iconSize: 25,
|
|
763
|
+
lineHeight: 23,
|
|
764
|
+
letterSpacing: 0
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
ascenderHeight: 7,
|
|
768
|
+
descenderHeight: 7,
|
|
769
|
+
fontSize: 21,
|
|
770
|
+
iconSize: 33,
|
|
771
|
+
lineHeight: 29,
|
|
772
|
+
letterSpacing: 0
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
ascenderHeight: 8,
|
|
776
|
+
descenderHeight: 8,
|
|
777
|
+
fontSize: 27,
|
|
778
|
+
iconSize: 41,
|
|
779
|
+
lineHeight: 35,
|
|
780
|
+
letterSpacing: 0
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
ascenderHeight: 9.5,
|
|
784
|
+
descenderHeight: 8.5,
|
|
785
|
+
fontSize: 33,
|
|
786
|
+
iconSize: 49,
|
|
787
|
+
lineHeight: 41,
|
|
788
|
+
letterSpacing: 0
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
ascenderHeight: 10.5,
|
|
792
|
+
descenderHeight: 9.5,
|
|
793
|
+
fontSize: 38,
|
|
794
|
+
iconSize: 53,
|
|
795
|
+
lineHeight: 47,
|
|
796
|
+
letterSpacing: 0
|
|
797
|
+
}
|
|
798
|
+
]
|
|
1217
799
|
},
|
|
1218
800
|
label: {
|
|
1219
801
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
@@ -1223,49 +805,56 @@ const defaultThemeFonts = {
|
|
|
1223
805
|
semibold: 800,
|
|
1224
806
|
bold: 900
|
|
1225
807
|
},
|
|
1226
|
-
sizes: [
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
808
|
+
sizes: [
|
|
809
|
+
{
|
|
810
|
+
ascenderHeight: 2,
|
|
811
|
+
descenderHeight: 2,
|
|
812
|
+
fontSize: 8.1,
|
|
813
|
+
iconSize: 13,
|
|
814
|
+
lineHeight: 10,
|
|
815
|
+
letterSpacing: 0.5
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
ascenderHeight: 2,
|
|
819
|
+
descenderHeight: 2,
|
|
820
|
+
fontSize: 9.5,
|
|
821
|
+
iconSize: 15,
|
|
822
|
+
lineHeight: 11,
|
|
823
|
+
letterSpacing: 0.5
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
ascenderHeight: 2,
|
|
827
|
+
descenderHeight: 2,
|
|
828
|
+
fontSize: 10.8,
|
|
829
|
+
iconSize: 17,
|
|
830
|
+
lineHeight: 12,
|
|
831
|
+
letterSpacing: 0.5
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
ascenderHeight: 2,
|
|
835
|
+
descenderHeight: 2,
|
|
836
|
+
fontSize: 12.25,
|
|
837
|
+
iconSize: 19,
|
|
838
|
+
lineHeight: 13,
|
|
839
|
+
letterSpacing: 0.5
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
ascenderHeight: 2,
|
|
843
|
+
descenderHeight: 2,
|
|
844
|
+
fontSize: 13.6,
|
|
845
|
+
iconSize: 21,
|
|
846
|
+
lineHeight: 14,
|
|
847
|
+
letterSpacing: 0.5
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
ascenderHeight: 2,
|
|
851
|
+
descenderHeight: 2,
|
|
852
|
+
fontSize: 15,
|
|
853
|
+
iconSize: 23,
|
|
854
|
+
lineHeight: 15,
|
|
855
|
+
letterSpacing: 0.5
|
|
856
|
+
}
|
|
857
|
+
]
|
|
1269
858
|
},
|
|
1270
859
|
text: {
|
|
1271
860
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -1275,42 +864,48 @@ const defaultThemeFonts = {
|
|
|
1275
864
|
semibold: 600,
|
|
1276
865
|
bold: 700
|
|
1277
866
|
},
|
|
1278
|
-
sizes: [
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
867
|
+
sizes: [
|
|
868
|
+
{
|
|
869
|
+
ascenderHeight: 4,
|
|
870
|
+
descenderHeight: 4,
|
|
871
|
+
fontSize: 10,
|
|
872
|
+
iconSize: 17,
|
|
873
|
+
lineHeight: 15,
|
|
874
|
+
letterSpacing: 0
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
ascenderHeight: 5,
|
|
878
|
+
descenderHeight: 5,
|
|
879
|
+
fontSize: 13,
|
|
880
|
+
iconSize: 21,
|
|
881
|
+
lineHeight: 19,
|
|
882
|
+
letterSpacing: 0
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
ascenderHeight: 6,
|
|
886
|
+
descenderHeight: 6,
|
|
887
|
+
fontSize: 15,
|
|
888
|
+
iconSize: 25,
|
|
889
|
+
lineHeight: 23,
|
|
890
|
+
letterSpacing: 0
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
ascenderHeight: 7,
|
|
894
|
+
descenderHeight: 7,
|
|
895
|
+
fontSize: 18,
|
|
896
|
+
iconSize: 29,
|
|
897
|
+
lineHeight: 27,
|
|
898
|
+
letterSpacing: 0
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
ascenderHeight: 8,
|
|
902
|
+
descenderHeight: 8,
|
|
903
|
+
fontSize: 21,
|
|
904
|
+
iconSize: 33,
|
|
905
|
+
lineHeight: 31,
|
|
906
|
+
letterSpacing: 0
|
|
907
|
+
}
|
|
908
|
+
]
|
|
1314
909
|
}
|
|
1315
910
|
};
|
|
1316
911
|
function is_v0(themeProp) {
|
|
@@ -1357,7 +952,9 @@ function v0_v2(v0) {
|
|
|
1357
952
|
primary: themeColor_v0_v2(color2.light.primary),
|
|
1358
953
|
positive: themeColor_v0_v2(color2.light.positive),
|
|
1359
954
|
caution: themeColor_v0_v2(color2.light.caution),
|
|
1360
|
-
critical: themeColor_v0_v2(color2.light.critical)
|
|
955
|
+
critical: themeColor_v0_v2(color2.light.critical),
|
|
956
|
+
prospect: themeColor_v0_v2(color2.light.default),
|
|
957
|
+
explore: themeColor_v0_v2(color2.light.default)
|
|
1361
958
|
},
|
|
1362
959
|
dark: {
|
|
1363
960
|
transparent: themeColor_v0_v2(color2.dark.transparent),
|
|
@@ -1365,7 +962,9 @@ function v0_v2(v0) {
|
|
|
1365
962
|
primary: themeColor_v0_v2(color2.dark.primary),
|
|
1366
963
|
positive: themeColor_v0_v2(color2.dark.positive),
|
|
1367
964
|
caution: themeColor_v0_v2(color2.dark.caution),
|
|
1368
|
-
critical: themeColor_v0_v2(color2.dark.critical)
|
|
965
|
+
critical: themeColor_v0_v2(color2.dark.critical),
|
|
966
|
+
prospect: themeColor_v0_v2(color2.dark.default),
|
|
967
|
+
explore: themeColor_v0_v2(color2.dark.default)
|
|
1369
968
|
}
|
|
1370
969
|
},
|
|
1371
970
|
container,
|
|
@@ -1502,7 +1101,26 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1502
1101
|
placeholder: t.placeholder
|
|
1503
1102
|
};
|
|
1504
1103
|
}
|
|
1505
|
-
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1104
|
+
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1105
|
+
"transparent",
|
|
1106
|
+
"default",
|
|
1107
|
+
"primary",
|
|
1108
|
+
"positive",
|
|
1109
|
+
"caution",
|
|
1110
|
+
"critical",
|
|
1111
|
+
// new
|
|
1112
|
+
"prospect",
|
|
1113
|
+
"explore"
|
|
1114
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1115
|
+
"default",
|
|
1116
|
+
"primary",
|
|
1117
|
+
"positive",
|
|
1118
|
+
"caution",
|
|
1119
|
+
"critical",
|
|
1120
|
+
// new
|
|
1121
|
+
"prospect",
|
|
1122
|
+
"explore"
|
|
1123
|
+
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1506
1124
|
function isColorBlendModeValue(str) {
|
|
1507
1125
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1508
1126
|
}
|
|
@@ -1515,7 +1133,33 @@ function isColorTintKey(str) {
|
|
|
1515
1133
|
function isColorButtonMode(str) {
|
|
1516
1134
|
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1517
1135
|
}
|
|
1518
|
-
const COLOR_CONFIG_STATE_KEYS = [
|
|
1136
|
+
const COLOR_CONFIG_STATE_KEYS = [
|
|
1137
|
+
"_hue",
|
|
1138
|
+
"bg",
|
|
1139
|
+
"fg",
|
|
1140
|
+
"border",
|
|
1141
|
+
"focusRing",
|
|
1142
|
+
"muted/fg",
|
|
1143
|
+
"accent/fg",
|
|
1144
|
+
"link/fg",
|
|
1145
|
+
"code/bg",
|
|
1146
|
+
"code/fg",
|
|
1147
|
+
"skeleton/from",
|
|
1148
|
+
"skeleton/to",
|
|
1149
|
+
"status/dot",
|
|
1150
|
+
"status/icon"
|
|
1151
|
+
], COLOR_CONFIG_CARD_KEYS = [
|
|
1152
|
+
...COLOR_CONFIG_STATE_KEYS,
|
|
1153
|
+
"_hue",
|
|
1154
|
+
"bg",
|
|
1155
|
+
"fg",
|
|
1156
|
+
"border",
|
|
1157
|
+
"focusRing",
|
|
1158
|
+
"shadow/outline",
|
|
1159
|
+
"shadow/umbra",
|
|
1160
|
+
"shadow/penumbra",
|
|
1161
|
+
"shadow/ambient"
|
|
1162
|
+
], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1519
1163
|
function parseTokenKey(str) {
|
|
1520
1164
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1521
1165
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -1681,16 +1325,10 @@ function compileColorTokenValue(node) {
|
|
|
1681
1325
|
}
|
|
1682
1326
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1683
1327
|
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1684
|
-
const {
|
|
1685
|
-
hue,
|
|
1686
|
-
scheme
|
|
1687
|
-
} = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1328
|
+
const { hue, scheme } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1688
1329
|
if (!node || node.type !== "color")
|
|
1689
1330
|
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1690
|
-
return compileColorTokenValue({
|
|
1691
|
-
...node,
|
|
1692
|
-
hue: node.hue || hue
|
|
1693
|
-
});
|
|
1331
|
+
return compileColorTokenValue({ ...node, hue: node.hue || hue });
|
|
1694
1332
|
}
|
|
1695
1333
|
const defaultColorTokens = {
|
|
1696
1334
|
base: {
|
|
@@ -1714,6 +1352,9 @@ const defaultColorTokens = {
|
|
|
1714
1352
|
icon: ["500", "500"],
|
|
1715
1353
|
dot: ["500", "500"]
|
|
1716
1354
|
},
|
|
1355
|
+
default: {
|
|
1356
|
+
_hue: "gray"
|
|
1357
|
+
},
|
|
1717
1358
|
positive: {
|
|
1718
1359
|
bg: ["200 50%", "900"],
|
|
1719
1360
|
fg: ["600", "500"]
|
|
@@ -1730,7 +1371,7 @@ const defaultColorTokens = {
|
|
|
1730
1371
|
fg: ["600", "400"]
|
|
1731
1372
|
},
|
|
1732
1373
|
fg: ["800", "200"],
|
|
1733
|
-
focusRing: ["
|
|
1374
|
+
focusRing: ["purple/500", "purple/500"],
|
|
1734
1375
|
icon: ["600", "400"],
|
|
1735
1376
|
kbd: {
|
|
1736
1377
|
bg: ["white", "black"],
|
|
@@ -1738,7 +1379,7 @@ const defaultColorTokens = {
|
|
|
1738
1379
|
border: ["200", "800"]
|
|
1739
1380
|
},
|
|
1740
1381
|
link: {
|
|
1741
|
-
fg: ["
|
|
1382
|
+
fg: ["purple/600", "purple/300"]
|
|
1742
1383
|
},
|
|
1743
1384
|
muted: {
|
|
1744
1385
|
bg: ["50", "950"],
|
|
@@ -1765,24 +1406,18 @@ const defaultColorTokens = {
|
|
|
1765
1406
|
fg: ["600", "400"]
|
|
1766
1407
|
}
|
|
1767
1408
|
},
|
|
1768
|
-
primary: {
|
|
1769
|
-
_hue: "blue"
|
|
1770
|
-
},
|
|
1409
|
+
primary: { _hue: "purple" },
|
|
1771
1410
|
positive: {
|
|
1772
1411
|
_hue: "green",
|
|
1773
|
-
shadow: {
|
|
1774
|
-
outline: ["500/0.4", "500/0.4"]
|
|
1775
|
-
}
|
|
1412
|
+
shadow: { outline: ["500/0.4", "500/0.4"] }
|
|
1776
1413
|
},
|
|
1777
1414
|
caution: {
|
|
1778
1415
|
_hue: "yellow",
|
|
1779
|
-
shadow: {
|
|
1780
|
-
outline: ["600/0.3", "500/0.4"]
|
|
1781
|
-
}
|
|
1416
|
+
shadow: { outline: ["600/0.3", "500/0.4"] }
|
|
1782
1417
|
},
|
|
1783
|
-
critical: {
|
|
1784
|
-
|
|
1785
|
-
}
|
|
1418
|
+
critical: { _hue: "red" },
|
|
1419
|
+
prospect: { _hue: "purple" },
|
|
1420
|
+
explore: { _hue: "cyan" }
|
|
1786
1421
|
},
|
|
1787
1422
|
button: {
|
|
1788
1423
|
default: {
|
|
@@ -1821,7 +1456,7 @@ const defaultColorTokens = {
|
|
|
1821
1456
|
border: ["800", "200"]
|
|
1822
1457
|
},
|
|
1823
1458
|
link: {
|
|
1824
|
-
fg: ["
|
|
1459
|
+
fg: ["purple/200", "purple/600"]
|
|
1825
1460
|
},
|
|
1826
1461
|
muted: {
|
|
1827
1462
|
bg: ["950", "50"],
|
|
@@ -1944,7 +1579,7 @@ const defaultColorTokens = {
|
|
|
1944
1579
|
border: ["200", "800"]
|
|
1945
1580
|
},
|
|
1946
1581
|
link: {
|
|
1947
|
-
fg: ["
|
|
1582
|
+
fg: ["purple/700 60%", "purple/300 60%"]
|
|
1948
1583
|
},
|
|
1949
1584
|
muted: {
|
|
1950
1585
|
bg: ["100", "950"],
|
|
@@ -2055,7 +1690,7 @@ const defaultColorTokens = {
|
|
|
2055
1690
|
border: ["200", "800"]
|
|
2056
1691
|
},
|
|
2057
1692
|
link: {
|
|
2058
|
-
fg: ["
|
|
1693
|
+
fg: ["purple/700 70%", "purple/300 70%"]
|
|
2059
1694
|
},
|
|
2060
1695
|
muted: {
|
|
2061
1696
|
bg: ["100", "950"],
|
|
@@ -2068,7 +1703,8 @@ const defaultColorTokens = {
|
|
|
2068
1703
|
},
|
|
2069
1704
|
hovered: {
|
|
2070
1705
|
bg: ["50", "950"],
|
|
2071
|
-
|
|
1706
|
+
fg: ["800", "200"],
|
|
1707
|
+
icon: ["800 70%", "300 70%"]
|
|
2072
1708
|
},
|
|
2073
1709
|
pressed: {
|
|
2074
1710
|
bg: ["100", "900"],
|
|
@@ -2127,7 +1763,7 @@ const defaultColorTokens = {
|
|
|
2127
1763
|
"*": {
|
|
2128
1764
|
_blend: ["multiply", "screen"],
|
|
2129
1765
|
bg: ["white", "black"],
|
|
2130
|
-
border: ["200", "
|
|
1766
|
+
border: ["200", "700"],
|
|
2131
1767
|
fg: ["black", "200"],
|
|
2132
1768
|
muted: {
|
|
2133
1769
|
bg: ["50", "950"]
|
|
@@ -2143,6 +1779,7 @@ const defaultColorTokens = {
|
|
|
2143
1779
|
fg: ["800", "200"]
|
|
2144
1780
|
},
|
|
2145
1781
|
disabled: {
|
|
1782
|
+
bg: ["50", "950"],
|
|
2146
1783
|
fg: ["400", "600"],
|
|
2147
1784
|
border: ["100", "900"],
|
|
2148
1785
|
placeholder: ["200", "800 50%"]
|
|
@@ -2191,7 +1828,7 @@ const defaultColorTokens = {
|
|
|
2191
1828
|
border: ["200", "800"]
|
|
2192
1829
|
},
|
|
2193
1830
|
link: {
|
|
2194
|
-
fg: ["
|
|
1831
|
+
fg: ["purple/700 70%", "purple/300 70%"]
|
|
2195
1832
|
},
|
|
2196
1833
|
muted: {
|
|
2197
1834
|
bg: ["50", "950"],
|
|
@@ -2206,6 +1843,7 @@ const defaultColorTokens = {
|
|
|
2206
1843
|
bg: ["50", "950"]
|
|
2207
1844
|
},
|
|
2208
1845
|
pressed: {
|
|
1846
|
+
// _hue: 'purple',
|
|
2209
1847
|
bg: ["100", "900"]
|
|
2210
1848
|
},
|
|
2211
1849
|
selected: {
|
|
@@ -2242,7 +1880,7 @@ const defaultColorTokens = {
|
|
|
2242
1880
|
border: ["800", "200"]
|
|
2243
1881
|
},
|
|
2244
1882
|
link: {
|
|
2245
|
-
fg: ["
|
|
1883
|
+
fg: ["purple/200", "purple/600"]
|
|
2246
1884
|
},
|
|
2247
1885
|
muted: {
|
|
2248
1886
|
bg: ["500 10%", "400 10%"],
|
|
@@ -2297,7 +1935,7 @@ const defaultColorTokens = {
|
|
|
2297
1935
|
},
|
|
2298
1936
|
default: {
|
|
2299
1937
|
selected: {
|
|
2300
|
-
_hue: "
|
|
1938
|
+
_hue: "purple"
|
|
2301
1939
|
}
|
|
2302
1940
|
},
|
|
2303
1941
|
critical: {
|
|
@@ -2378,62 +2016,18 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2378
2016
|
return {
|
|
2379
2017
|
...spec,
|
|
2380
2018
|
_hue: hue,
|
|
2381
|
-
avatar: {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
_hue: "purple"
|
|
2390
|
-
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2391
|
-
magenta: merge({
|
|
2392
|
-
_hue: "magenta"
|
|
2393
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2394
|
-
red: merge({
|
|
2395
|
-
_hue: "red"
|
|
2396
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2397
|
-
orange: merge({
|
|
2398
|
-
_hue: "orange"
|
|
2399
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2400
|
-
yellow: merge({
|
|
2401
|
-
_hue: "yellow"
|
|
2402
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2403
|
-
green: merge({
|
|
2404
|
-
_hue: "green"
|
|
2405
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2406
|
-
cyan: merge({
|
|
2407
|
-
_hue: "cyan"
|
|
2408
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2409
|
-
},
|
|
2410
|
-
badge: {
|
|
2411
|
-
default: {
|
|
2412
|
-
_hue: inputTokens?.base?.default?._hue || hue,
|
|
2019
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2020
|
+
...acc,
|
|
2021
|
+
[hue2]: merge({ _hue: hue2 }, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2022
|
+
}), {}),
|
|
2023
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2024
|
+
...acc,
|
|
2025
|
+
[tone2]: {
|
|
2026
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2413
2027
|
...spec.badge?.["*"],
|
|
2414
|
-
...spec.badge?.
|
|
2415
|
-
},
|
|
2416
|
-
primary: {
|
|
2417
|
-
_hue: inputTokens?.base?.primary?._hue || hue,
|
|
2418
|
-
...spec.badge?.["*"],
|
|
2419
|
-
...spec.badge?.primary
|
|
2420
|
-
},
|
|
2421
|
-
positive: {
|
|
2422
|
-
_hue: inputTokens?.base?.positive?._hue || hue,
|
|
2423
|
-
...spec.badge?.["*"],
|
|
2424
|
-
...spec.badge?.positive
|
|
2425
|
-
},
|
|
2426
|
-
caution: {
|
|
2427
|
-
_hue: inputTokens?.base?.caution?._hue || hue,
|
|
2428
|
-
...spec.badge?.["*"],
|
|
2429
|
-
...spec.badge?.caution
|
|
2430
|
-
},
|
|
2431
|
-
critical: {
|
|
2432
|
-
_hue: inputTokens?.base?.critical?._hue || hue,
|
|
2433
|
-
...spec.badge?.["*"],
|
|
2434
|
-
...spec.badge?.critical
|
|
2028
|
+
...spec.badge?.[tone2]
|
|
2435
2029
|
}
|
|
2436
|
-
}
|
|
2030
|
+
}), {})
|
|
2437
2031
|
};
|
|
2438
2032
|
}
|
|
2439
2033
|
function resolveButtonColorTokens(inputTokens) {
|
|
@@ -2455,66 +2049,27 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2455
2049
|
return tokens;
|
|
2456
2050
|
}
|
|
2457
2051
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2458
|
-
const spec = merge(
|
|
2052
|
+
const spec = merge(
|
|
2053
|
+
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2054
|
+
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2055
|
+
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2056
|
+
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2057
|
+
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2459
2058
|
return {
|
|
2460
2059
|
...spec,
|
|
2461
2060
|
_hue: hue,
|
|
2462
|
-
avatar: {
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
_hue: "purple"
|
|
2471
|
-
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2472
|
-
magenta: merge({
|
|
2473
|
-
_hue: "magenta"
|
|
2474
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2475
|
-
red: merge({
|
|
2476
|
-
_hue: "red"
|
|
2477
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2478
|
-
orange: merge({
|
|
2479
|
-
_hue: "orange"
|
|
2480
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2481
|
-
yellow: merge({
|
|
2482
|
-
_hue: "yellow"
|
|
2483
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2484
|
-
green: merge({
|
|
2485
|
-
_hue: "green"
|
|
2486
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2487
|
-
cyan: merge({
|
|
2488
|
-
_hue: "cyan"
|
|
2489
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2490
|
-
},
|
|
2491
|
-
badge: {
|
|
2492
|
-
default: {
|
|
2493
|
-
_hue: inputTokens?.base?.default?._hue,
|
|
2494
|
-
...spec.badge?.["*"],
|
|
2495
|
-
...spec.badge?.default
|
|
2496
|
-
},
|
|
2497
|
-
primary: {
|
|
2498
|
-
_hue: inputTokens?.base?.primary?._hue,
|
|
2499
|
-
...spec.badge?.["*"],
|
|
2500
|
-
...spec.badge?.primary
|
|
2501
|
-
},
|
|
2502
|
-
positive: {
|
|
2503
|
-
_hue: inputTokens?.base?.positive?._hue,
|
|
2504
|
-
...spec.badge?.["*"],
|
|
2505
|
-
...spec.badge?.positive
|
|
2506
|
-
},
|
|
2507
|
-
caution: {
|
|
2508
|
-
_hue: inputTokens?.base?.caution?._hue,
|
|
2509
|
-
...spec.badge?.["*"],
|
|
2510
|
-
...spec.badge?.caution
|
|
2511
|
-
},
|
|
2512
|
-
critical: {
|
|
2513
|
-
_hue: inputTokens?.base?.critical?._hue,
|
|
2061
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2062
|
+
...acc,
|
|
2063
|
+
[hue2]: merge({ _hue: hue2 }, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2064
|
+
}), {}),
|
|
2065
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2066
|
+
...acc,
|
|
2067
|
+
[tone2]: {
|
|
2068
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2514
2069
|
...spec.badge?.["*"],
|
|
2515
|
-
...spec.badge?.
|
|
2070
|
+
...spec.badge?.[tone2]
|
|
2516
2071
|
}
|
|
2517
|
-
}
|
|
2072
|
+
}), {})
|
|
2518
2073
|
};
|
|
2519
2074
|
}
|
|
2520
2075
|
function resolveInputColorTokens(inputTokens) {
|
|
@@ -2530,11 +2085,13 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2530
2085
|
return states;
|
|
2531
2086
|
}
|
|
2532
2087
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2533
|
-
const spec = merge(
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2088
|
+
const spec = merge(
|
|
2089
|
+
inputTokens?.input?.["*"]?.["*"],
|
|
2090
|
+
inputTokens?.input?.[mode]?.["*"],
|
|
2091
|
+
inputTokens?.input?.["*"]?.[state],
|
|
2092
|
+
inputTokens?.input?.[mode]?.[state]
|
|
2093
|
+
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2094
|
+
return { ...spec, _hue: hue };
|
|
2538
2095
|
}
|
|
2539
2096
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2540
2097
|
const tokens = {};
|
|
@@ -2551,66 +2108,27 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2551
2108
|
return states;
|
|
2552
2109
|
}
|
|
2553
2110
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2554
|
-
const spec = merge(
|
|
2111
|
+
const spec = merge(
|
|
2112
|
+
inputTokens?.selectable?.["*"]?.["*"],
|
|
2113
|
+
inputTokens?.selectable?.[tone]?.["*"],
|
|
2114
|
+
inputTokens?.selectable?.["*"]?.[state],
|
|
2115
|
+
inputTokens?.selectable?.[tone]?.[state]
|
|
2116
|
+
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2555
2117
|
return {
|
|
2556
2118
|
...spec,
|
|
2557
2119
|
_hue: hue,
|
|
2558
|
-
avatar: {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
_hue: "purple"
|
|
2567
|
-
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2568
|
-
magenta: merge({
|
|
2569
|
-
_hue: "magenta"
|
|
2570
|
-
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2571
|
-
red: merge({
|
|
2572
|
-
_hue: "red"
|
|
2573
|
-
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2574
|
-
orange: merge({
|
|
2575
|
-
_hue: "orange"
|
|
2576
|
-
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2577
|
-
yellow: merge({
|
|
2578
|
-
_hue: "yellow"
|
|
2579
|
-
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2580
|
-
green: merge({
|
|
2581
|
-
_hue: "green"
|
|
2582
|
-
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2583
|
-
cyan: merge({
|
|
2584
|
-
_hue: "cyan"
|
|
2585
|
-
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2586
|
-
},
|
|
2587
|
-
badge: {
|
|
2588
|
-
default: {
|
|
2589
|
-
_hue: inputTokens?.base?.default?._hue,
|
|
2120
|
+
avatar: COLOR_HUES.reduce((acc, hue2) => ({
|
|
2121
|
+
...acc,
|
|
2122
|
+
[hue2]: merge({ _hue: hue2 }, spec.avatar?.["*"], spec.avatar?.[hue2])
|
|
2123
|
+
}), {}),
|
|
2124
|
+
badge: THEME_COLOR_STATE_TONES.reduce((acc, tone2) => ({
|
|
2125
|
+
...acc,
|
|
2126
|
+
[tone2]: {
|
|
2127
|
+
_hue: inputTokens?.base?.[tone2]?._hue || hue,
|
|
2590
2128
|
...spec.badge?.["*"],
|
|
2591
|
-
...spec.badge?.
|
|
2592
|
-
},
|
|
2593
|
-
primary: {
|
|
2594
|
-
_hue: inputTokens?.base?.primary?._hue,
|
|
2595
|
-
...spec.badge?.["*"],
|
|
2596
|
-
...spec.badge?.primary
|
|
2597
|
-
},
|
|
2598
|
-
positive: {
|
|
2599
|
-
_hue: inputTokens?.base?.positive?._hue,
|
|
2600
|
-
...spec.badge?.["*"],
|
|
2601
|
-
...spec.badge?.positive
|
|
2602
|
-
},
|
|
2603
|
-
caution: {
|
|
2604
|
-
_hue: inputTokens?.base?.caution?._hue,
|
|
2605
|
-
...spec.badge?.["*"],
|
|
2606
|
-
...spec.badge?.caution
|
|
2607
|
-
},
|
|
2608
|
-
critical: {
|
|
2609
|
-
_hue: inputTokens?.base?.critical?._hue,
|
|
2610
|
-
...spec.badge?.["*"],
|
|
2611
|
-
...spec.badge?.critical
|
|
2129
|
+
...spec.badge?.[tone2]
|
|
2612
2130
|
}
|
|
2613
|
-
}
|
|
2131
|
+
}), {})
|
|
2614
2132
|
};
|
|
2615
2133
|
}
|
|
2616
2134
|
function buildColorTheme(config) {
|
|
@@ -2619,71 +2137,28 @@ function buildColorTheme(config) {
|
|
|
2619
2137
|
color: resolveColorTokens(config?.color)
|
|
2620
2138
|
};
|
|
2621
2139
|
return {
|
|
2622
|
-
light: buildColorScheme({
|
|
2623
|
-
|
|
2624
|
-
}, resolvedConfig),
|
|
2625
|
-
dark: buildColorScheme({
|
|
2626
|
-
scheme: "dark"
|
|
2627
|
-
}, resolvedConfig)
|
|
2140
|
+
light: buildColorScheme({ scheme: "light" }, resolvedConfig),
|
|
2141
|
+
dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
|
|
2628
2142
|
};
|
|
2629
2143
|
}
|
|
2630
2144
|
function buildColorScheme(options, config) {
|
|
2631
|
-
const {
|
|
2632
|
-
|
|
2633
|
-
} = options;
|
|
2634
|
-
return {
|
|
2635
|
-
transparent: buildCardColorTheme({
|
|
2636
|
-
scheme,
|
|
2637
|
-
tone: "transparent"
|
|
2638
|
-
}, config),
|
|
2639
|
-
default: buildCardColorTheme({
|
|
2640
|
-
scheme,
|
|
2641
|
-
tone: "default"
|
|
2642
|
-
}, config),
|
|
2643
|
-
primary: buildCardColorTheme({
|
|
2644
|
-
scheme,
|
|
2645
|
-
tone: "primary"
|
|
2646
|
-
}, config),
|
|
2647
|
-
positive: buildCardColorTheme({
|
|
2648
|
-
scheme,
|
|
2649
|
-
tone: "positive"
|
|
2650
|
-
}, config),
|
|
2651
|
-
caution: buildCardColorTheme({
|
|
2652
|
-
scheme,
|
|
2653
|
-
tone: "caution"
|
|
2654
|
-
}, config),
|
|
2655
|
-
critical: buildCardColorTheme({
|
|
2656
|
-
scheme,
|
|
2657
|
-
tone: "critical"
|
|
2658
|
-
}, config)
|
|
2659
|
-
};
|
|
2145
|
+
const { scheme } = options;
|
|
2146
|
+
return THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildCardColorTheme({ scheme, tone }, config), acc), {});
|
|
2660
2147
|
}
|
|
2661
2148
|
function buildCardColorTheme(options, config) {
|
|
2662
|
-
const {
|
|
2663
|
-
scheme,
|
|
2664
|
-
tone
|
|
2665
|
-
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2666
|
-
hue: tokens?._hue || "gray",
|
|
2667
|
-
scheme
|
|
2668
|
-
};
|
|
2149
|
+
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2669
2150
|
return {
|
|
2670
2151
|
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2671
2152
|
_dark: scheme === "dark",
|
|
2672
2153
|
accent: {
|
|
2673
2154
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2674
2155
|
},
|
|
2675
|
-
avatar: buildAvatarColorTheme({
|
|
2676
|
-
scheme
|
|
2677
|
-
}, tokens),
|
|
2156
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2678
2157
|
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2679
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2680
|
-
scheme
|
|
2681
|
-
}, config),
|
|
2158
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2682
2159
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2683
2160
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2684
|
-
button: buildButtonColorTheme({
|
|
2685
|
-
scheme
|
|
2686
|
-
}, config),
|
|
2161
|
+
button: buildButtonColorTheme({ scheme, tone }, config),
|
|
2687
2162
|
code: {
|
|
2688
2163
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2689
2164
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2691,10 +2166,7 @@ function buildCardColorTheme(options, config) {
|
|
|
2691
2166
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2692
2167
|
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2693
2168
|
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2694
|
-
input: buildInputColorTheme({
|
|
2695
|
-
scheme,
|
|
2696
|
-
tone
|
|
2697
|
-
}, config),
|
|
2169
|
+
input: buildInputColorTheme({ scheme, tone }, config),
|
|
2698
2170
|
kbd: {
|
|
2699
2171
|
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2700
2172
|
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
@@ -2707,30 +2179,17 @@ function buildCardColorTheme(options, config) {
|
|
|
2707
2179
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2708
2180
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2709
2181
|
},
|
|
2710
|
-
selectable: buildSelectableColorTheme({
|
|
2711
|
-
|
|
2712
|
-
}, config),
|
|
2713
|
-
shadow: buildShadowColorTheme({
|
|
2714
|
-
scheme,
|
|
2715
|
-
tone
|
|
2716
|
-
}, config),
|
|
2182
|
+
selectable: buildSelectableColorTheme({ scheme, tone }, config),
|
|
2183
|
+
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
2717
2184
|
skeleton: {
|
|
2718
2185
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2719
2186
|
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2720
2187
|
},
|
|
2721
|
-
syntax: buildSyntaxColorTheme({
|
|
2722
|
-
scheme
|
|
2723
|
-
}, config)
|
|
2188
|
+
syntax: buildSyntaxColorTheme({ scheme }, config)
|
|
2724
2189
|
};
|
|
2725
2190
|
}
|
|
2726
2191
|
function buildShadowColorTheme(options, config) {
|
|
2727
|
-
const {
|
|
2728
|
-
scheme,
|
|
2729
|
-
tone
|
|
2730
|
-
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2731
|
-
hue: tokens?._hue || "gray",
|
|
2732
|
-
scheme
|
|
2733
|
-
};
|
|
2192
|
+
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2734
2193
|
return {
|
|
2735
2194
|
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2736
2195
|
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
@@ -2739,56 +2198,21 @@ function buildShadowColorTheme(options, config) {
|
|
|
2739
2198
|
};
|
|
2740
2199
|
}
|
|
2741
2200
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
2742
|
-
const {
|
|
2743
|
-
scheme
|
|
2744
|
-
} = options;
|
|
2201
|
+
const { scheme } = options;
|
|
2745
2202
|
return {
|
|
2746
|
-
gray: _buildAvatarColorTheme({
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
}, stateTokens),
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
}, stateTokens),
|
|
2754
|
-
|
|
2755
|
-
color: "purple",
|
|
2756
|
-
scheme
|
|
2757
|
-
}, stateTokens),
|
|
2758
|
-
magenta: _buildAvatarColorTheme({
|
|
2759
|
-
color: "magenta",
|
|
2760
|
-
scheme
|
|
2761
|
-
}, stateTokens),
|
|
2762
|
-
red: _buildAvatarColorTheme({
|
|
2763
|
-
color: "red",
|
|
2764
|
-
scheme
|
|
2765
|
-
}, stateTokens),
|
|
2766
|
-
orange: _buildAvatarColorTheme({
|
|
2767
|
-
color: "orange",
|
|
2768
|
-
scheme
|
|
2769
|
-
}, stateTokens),
|
|
2770
|
-
yellow: _buildAvatarColorTheme({
|
|
2771
|
-
color: "yellow",
|
|
2772
|
-
scheme
|
|
2773
|
-
}, stateTokens),
|
|
2774
|
-
green: _buildAvatarColorTheme({
|
|
2775
|
-
color: "green",
|
|
2776
|
-
scheme
|
|
2777
|
-
}, stateTokens),
|
|
2778
|
-
cyan: _buildAvatarColorTheme({
|
|
2779
|
-
color: "cyan",
|
|
2780
|
-
scheme
|
|
2781
|
-
}, stateTokens)
|
|
2203
|
+
gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
|
|
2204
|
+
blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
|
|
2205
|
+
purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
|
|
2206
|
+
magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
|
|
2207
|
+
red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
|
|
2208
|
+
orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
|
|
2209
|
+
yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
|
|
2210
|
+
green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
|
|
2211
|
+
cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
|
|
2782
2212
|
};
|
|
2783
2213
|
}
|
|
2784
2214
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2785
|
-
const {
|
|
2786
|
-
color: color2,
|
|
2787
|
-
scheme
|
|
2788
|
-
} = options, tokens = stateTokens?.avatar?.[color2], context = {
|
|
2789
|
-
hue: tokens?._hue || "gray",
|
|
2790
|
-
scheme
|
|
2791
|
-
};
|
|
2215
|
+
const { color: color2, scheme } = options, tokens = stateTokens?.avatar?.[color2], context = { hue: tokens?._hue || "gray", scheme };
|
|
2792
2216
|
return {
|
|
2793
2217
|
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2794
2218
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2796,40 +2220,11 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2796
2220
|
};
|
|
2797
2221
|
}
|
|
2798
2222
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2799
|
-
const {
|
|
2800
|
-
|
|
2801
|
-
} = options;
|
|
2802
|
-
return {
|
|
2803
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
2804
|
-
scheme,
|
|
2805
|
-
tone: "default"
|
|
2806
|
-
}, config),
|
|
2807
|
-
primary: _buildBadgeColorTheme(tokens, {
|
|
2808
|
-
scheme,
|
|
2809
|
-
tone: "primary"
|
|
2810
|
-
}, config),
|
|
2811
|
-
positive: _buildBadgeColorTheme(tokens, {
|
|
2812
|
-
scheme,
|
|
2813
|
-
tone: "positive"
|
|
2814
|
-
}, config),
|
|
2815
|
-
caution: _buildBadgeColorTheme(tokens, {
|
|
2816
|
-
scheme,
|
|
2817
|
-
tone: "caution"
|
|
2818
|
-
}, config),
|
|
2819
|
-
critical: _buildBadgeColorTheme(tokens, {
|
|
2820
|
-
scheme,
|
|
2821
|
-
tone: "critical"
|
|
2822
|
-
}, config)
|
|
2823
|
-
};
|
|
2223
|
+
const { scheme } = options;
|
|
2224
|
+
return THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = _buildBadgeColorTheme(tokens, { scheme, tone }, config), acc), {});
|
|
2824
2225
|
}
|
|
2825
2226
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2826
|
-
const {
|
|
2827
|
-
scheme,
|
|
2828
|
-
tone
|
|
2829
|
-
} = options, tokens = parentTokens?.[tone], context = {
|
|
2830
|
-
hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
|
|
2831
|
-
scheme
|
|
2832
|
-
};
|
|
2227
|
+
const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
|
|
2833
2228
|
return {
|
|
2834
2229
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2835
2230
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
@@ -2838,65 +2233,32 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2838
2233
|
};
|
|
2839
2234
|
}
|
|
2840
2235
|
function buildButtonColorTheme(options, config) {
|
|
2841
|
-
const {
|
|
2842
|
-
scheme
|
|
2843
|
-
} = options, modes = {};
|
|
2236
|
+
const { scheme, tone: cardTone } = options, modes = {};
|
|
2844
2237
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2845
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
2846
|
-
scheme,
|
|
2847
|
-
mode
|
|
2848
|
-
}, config);
|
|
2238
|
+
modes[mode] = buildButtonTonesColorTheme({ cardTone, scheme, mode }, config);
|
|
2849
2239
|
return modes;
|
|
2850
2240
|
}
|
|
2851
2241
|
function buildButtonTonesColorTheme(options, config) {
|
|
2852
|
-
const {
|
|
2853
|
-
mode,
|
|
2854
|
-
scheme
|
|
2855
|
-
} = options, tones2 = {};
|
|
2242
|
+
const { cardTone, mode, scheme } = options, tones2 = {};
|
|
2856
2243
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2857
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
2858
|
-
mode,
|
|
2859
|
-
scheme,
|
|
2860
|
-
tone
|
|
2861
|
-
}, config);
|
|
2244
|
+
tones2[tone] = buildButtonStatesColorTheme({ cardTone, mode, scheme, tone }, config);
|
|
2862
2245
|
return tones2;
|
|
2863
2246
|
}
|
|
2864
2247
|
function buildButtonStatesColorTheme(options, config) {
|
|
2865
|
-
const {
|
|
2866
|
-
mode,
|
|
2867
|
-
scheme,
|
|
2868
|
-
tone
|
|
2869
|
-
} = options, states = {};
|
|
2248
|
+
const { cardTone, mode, scheme, tone } = options, states = {};
|
|
2870
2249
|
for (const state of THEME_COLOR_STATES)
|
|
2871
|
-
states[state] = buildButtonStateColorTheme({
|
|
2872
|
-
mode,
|
|
2873
|
-
tone,
|
|
2874
|
-
scheme,
|
|
2875
|
-
state
|
|
2876
|
-
}, config);
|
|
2250
|
+
states[state] = buildButtonStateColorTheme({ cardTone, mode, tone, scheme, state }, config);
|
|
2877
2251
|
return states;
|
|
2878
2252
|
}
|
|
2879
2253
|
function buildButtonStateColorTheme(options, config) {
|
|
2880
|
-
const {
|
|
2881
|
-
mode,
|
|
2882
|
-
tone,
|
|
2883
|
-
scheme,
|
|
2884
|
-
state
|
|
2885
|
-
} = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2886
|
-
hue,
|
|
2887
|
-
scheme
|
|
2888
|
-
};
|
|
2254
|
+
const { cardTone, mode, tone, scheme, state } = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2889
2255
|
return {
|
|
2890
2256
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2891
2257
|
accent: {
|
|
2892
2258
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2893
2259
|
},
|
|
2894
|
-
avatar: buildAvatarColorTheme({
|
|
2895
|
-
|
|
2896
|
-
}, tokens),
|
|
2897
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2898
|
-
scheme
|
|
2899
|
-
}, config),
|
|
2260
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2261
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2900
2262
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2901
2263
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2902
2264
|
code: {
|
|
@@ -2924,66 +2286,23 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
2924
2286
|
};
|
|
2925
2287
|
}
|
|
2926
2288
|
function buildInputColorTheme(options, config) {
|
|
2927
|
-
const {
|
|
2928
|
-
scheme,
|
|
2929
|
-
tone
|
|
2930
|
-
} = options;
|
|
2289
|
+
const { scheme, tone } = options;
|
|
2931
2290
|
return {
|
|
2932
|
-
default: buildInputStatesColorTheme({
|
|
2933
|
-
|
|
2934
|
-
scheme,
|
|
2935
|
-
tone
|
|
2936
|
-
}, config),
|
|
2937
|
-
invalid: buildInputStatesColorTheme({
|
|
2938
|
-
mode: "invalid",
|
|
2939
|
-
scheme,
|
|
2940
|
-
tone
|
|
2941
|
-
}, config)
|
|
2291
|
+
default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
|
|
2292
|
+
invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
|
|
2942
2293
|
};
|
|
2943
2294
|
}
|
|
2944
2295
|
function buildInputStatesColorTheme(options, config) {
|
|
2945
|
-
const {
|
|
2946
|
-
mode,
|
|
2947
|
-
scheme,
|
|
2948
|
-
tone
|
|
2949
|
-
} = options;
|
|
2296
|
+
const { mode, scheme, tone } = options;
|
|
2950
2297
|
return {
|
|
2951
|
-
enabled: buildInputStateColorTheme({
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
tone
|
|
2956
|
-
}, config),
|
|
2957
|
-
hovered: buildInputStateColorTheme({
|
|
2958
|
-
mode,
|
|
2959
|
-
scheme,
|
|
2960
|
-
state: "hovered",
|
|
2961
|
-
tone
|
|
2962
|
-
}, config),
|
|
2963
|
-
readOnly: buildInputStateColorTheme({
|
|
2964
|
-
mode,
|
|
2965
|
-
scheme,
|
|
2966
|
-
state: "readOnly",
|
|
2967
|
-
tone
|
|
2968
|
-
}, config),
|
|
2969
|
-
disabled: buildInputStateColorTheme({
|
|
2970
|
-
mode,
|
|
2971
|
-
scheme,
|
|
2972
|
-
state: "disabled",
|
|
2973
|
-
tone
|
|
2974
|
-
}, config)
|
|
2298
|
+
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", cardTone: tone }, config),
|
|
2299
|
+
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", cardTone: tone }, config),
|
|
2300
|
+
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", cardTone: tone }, config),
|
|
2301
|
+
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", cardTone: tone }, config)
|
|
2975
2302
|
};
|
|
2976
2303
|
}
|
|
2977
2304
|
function buildInputStateColorTheme(options, config) {
|
|
2978
|
-
const {
|
|
2979
|
-
mode,
|
|
2980
|
-
tone,
|
|
2981
|
-
scheme,
|
|
2982
|
-
state
|
|
2983
|
-
} = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2984
|
-
hue,
|
|
2985
|
-
scheme
|
|
2986
|
-
};
|
|
2305
|
+
const { cardTone, mode, scheme, state } = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2987
2306
|
return {
|
|
2988
2307
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2989
2308
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2996,49 +2315,26 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2996
2315
|
};
|
|
2997
2316
|
}
|
|
2998
2317
|
function buildSelectableColorTheme(options, config) {
|
|
2999
|
-
const {
|
|
3000
|
-
scheme
|
|
3001
|
-
} = options, tones2 = {};
|
|
2318
|
+
const { scheme, tone: cardTone } = options, tones2 = {};
|
|
3002
2319
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3003
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3004
|
-
scheme,
|
|
3005
|
-
tone
|
|
3006
|
-
}, config);
|
|
2320
|
+
tones2[tone] = buildSelectableStatesColorTheme({ cardTone, scheme, tone }, config);
|
|
3007
2321
|
return tones2;
|
|
3008
2322
|
}
|
|
3009
2323
|
function buildSelectableStatesColorTheme(options, config) {
|
|
3010
|
-
const {
|
|
3011
|
-
scheme,
|
|
3012
|
-
tone
|
|
3013
|
-
} = options, states = {};
|
|
2324
|
+
const { cardTone, scheme, tone } = options, states = {};
|
|
3014
2325
|
for (const state of THEME_COLOR_STATES)
|
|
3015
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3016
|
-
tone,
|
|
3017
|
-
scheme,
|
|
3018
|
-
state
|
|
3019
|
-
}, config);
|
|
2326
|
+
states[state] = buildSelectableStateColorTheme({ cardTone, tone, scheme, state }, config);
|
|
3020
2327
|
return states;
|
|
3021
2328
|
}
|
|
3022
2329
|
function buildSelectableStateColorTheme(options, config) {
|
|
3023
|
-
const {
|
|
3024
|
-
scheme,
|
|
3025
|
-
state,
|
|
3026
|
-
tone
|
|
3027
|
-
} = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3028
|
-
hue,
|
|
3029
|
-
scheme
|
|
3030
|
-
};
|
|
2330
|
+
const { cardTone, scheme, state, tone } = options, cardTokens = config?.color?.base?.[cardTone], tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || cardTokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
3031
2331
|
return {
|
|
3032
2332
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3033
2333
|
accent: {
|
|
3034
2334
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
3035
2335
|
},
|
|
3036
|
-
avatar: buildAvatarColorTheme({
|
|
3037
|
-
|
|
3038
|
-
}, tokens),
|
|
3039
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3040
|
-
scheme
|
|
3041
|
-
}, config),
|
|
2336
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2337
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
3042
2338
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
3043
2339
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
3044
2340
|
code: {
|
|
@@ -3066,12 +2362,7 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
3066
2362
|
};
|
|
3067
2363
|
}
|
|
3068
2364
|
function buildSyntaxColorTheme(options, config) {
|
|
3069
|
-
const {
|
|
3070
|
-
scheme
|
|
3071
|
-
} = options, tokens = config?.color?.syntax, context = {
|
|
3072
|
-
hue: "gray",
|
|
3073
|
-
scheme
|
|
3074
|
-
};
|
|
2365
|
+
const { scheme } = options, tokens = config?.color?.syntax, context = { hue: "gray", scheme };
|
|
3075
2366
|
return {
|
|
3076
2367
|
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
3077
2368
|
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
@@ -3186,19 +2477,11 @@ function rgbToHex(color2) {
|
|
|
3186
2477
|
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
3187
2478
|
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
3188
2479
|
}
|
|
3189
|
-
function rgbToHsl({
|
|
3190
|
-
r,
|
|
3191
|
-
g,
|
|
3192
|
-
b
|
|
3193
|
-
}) {
|
|
2480
|
+
function rgbToHsl({ r, g, b }) {
|
|
3194
2481
|
r /= 255, g /= 255, b /= 255;
|
|
3195
2482
|
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
3196
2483
|
let h = 0, s = 0, l = 0;
|
|
3197
|
-
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
3198
|
-
h,
|
|
3199
|
-
s,
|
|
3200
|
-
l
|
|
3201
|
-
};
|
|
2484
|
+
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
|
|
3202
2485
|
}
|
|
3203
2486
|
function hslToRgb(hsl) {
|
|
3204
2487
|
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
@@ -3223,18 +2506,10 @@ function parseHsl(str) {
|
|
|
3223
2506
|
const res = HSL_RE.exec(str);
|
|
3224
2507
|
if (!res)
|
|
3225
2508
|
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
3226
|
-
return {
|
|
3227
|
-
h: parseInt(res[1]),
|
|
3228
|
-
s: parseFloat(res[3]),
|
|
3229
|
-
l: parseFloat(res[5])
|
|
3230
|
-
};
|
|
2509
|
+
return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
|
|
3231
2510
|
}
|
|
3232
2511
|
function parseColor(color2) {
|
|
3233
|
-
if (!color2) return {
|
|
3234
|
-
r: 0,
|
|
3235
|
-
g: 0,
|
|
3236
|
-
b: 0
|
|
3237
|
-
};
|
|
2512
|
+
if (!color2) return { r: 0, g: 0, b: 0 };
|
|
3238
2513
|
if (typeof color2 != "string")
|
|
3239
2514
|
throw new Error("parseColor: expected a string");
|
|
3240
2515
|
if (isHex(color2))
|
|
@@ -3249,11 +2524,7 @@ function getContrastRatio(bg, fg) {
|
|
|
3249
2524
|
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
3250
2525
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
3251
2526
|
}
|
|
3252
|
-
function rgb_lrgb({
|
|
3253
|
-
r,
|
|
3254
|
-
g,
|
|
3255
|
-
b
|
|
3256
|
-
}) {
|
|
2527
|
+
function rgb_lrgb({ r, g, b }) {
|
|
3257
2528
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
3258
2529
|
}
|
|
3259
2530
|
function rgb_lrgb1(v) {
|
|
@@ -3268,9 +2539,7 @@ function rgba(color2, a) {
|
|
|
3268
2539
|
}
|
|
3269
2540
|
const RGB_RANGE = [0, 255];
|
|
3270
2541
|
function mixThemeColor(value, options) {
|
|
3271
|
-
const {
|
|
3272
|
-
blendMode
|
|
3273
|
-
} = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2542
|
+
const { blendMode } = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
3274
2543
|
r: [black2.r, white2.r],
|
|
3275
2544
|
g: [black2.g, white2.g],
|
|
3276
2545
|
b: [black2.b, white2.b]
|
|
@@ -3290,11 +2559,7 @@ function mixThemeColor(value, options) {
|
|
|
3290
2559
|
return rgbToHex(v);
|
|
3291
2560
|
}
|
|
3292
2561
|
function renderColorValue(str, options) {
|
|
3293
|
-
const {
|
|
3294
|
-
bg,
|
|
3295
|
-
blendMode,
|
|
3296
|
-
colorPalette
|
|
3297
|
-
} = options;
|
|
2562
|
+
const { bg, blendMode, colorPalette } = options;
|
|
3298
2563
|
if (bg === "white")
|
|
3299
2564
|
throw new Error("Cannot blend with white background");
|
|
3300
2565
|
const node = parseTokenValue(str);
|
|
@@ -3326,68 +2591,60 @@ function renderColorHex(color2) {
|
|
|
3326
2591
|
function renderThemeColorSchemes(value, config) {
|
|
3327
2592
|
const colorPalette = config?.palette ?? defaultColorPalette;
|
|
3328
2593
|
return {
|
|
3329
|
-
light: renderThemeColorScheme(colorPalette, value.light),
|
|
3330
|
-
dark: renderThemeColorScheme(colorPalette, value.dark)
|
|
2594
|
+
light: renderThemeColorScheme(colorPalette, value.light, { debugPath: "light" }),
|
|
2595
|
+
dark: renderThemeColorScheme(colorPalette, value.dark, { debugPath: "dark" })
|
|
3331
2596
|
};
|
|
3332
2597
|
}
|
|
3333
|
-
function renderThemeColorScheme(colorPalette, value) {
|
|
3334
|
-
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3335
|
-
colorPalette
|
|
2598
|
+
function renderThemeColorScheme(colorPalette, value, options) {
|
|
2599
|
+
const { debugPath } = options, toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
2600
|
+
colorPalette,
|
|
2601
|
+
debugPath: `${debugPath}.transparent`
|
|
3336
2602
|
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3337
|
-
colorPalette
|
|
2603
|
+
colorPalette,
|
|
2604
|
+
debugPath: `${debugPath}.default`
|
|
3338
2605
|
}), bg = renderedDefaultTone.bg;
|
|
3339
2606
|
if (bg === "white")
|
|
3340
2607
|
throw new Error("Cannot blend with white background");
|
|
3341
|
-
return Object.fromEntries([
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
2608
|
+
return Object.fromEntries([
|
|
2609
|
+
["transparent", renderedTransparentTone],
|
|
2610
|
+
["default", renderedDefaultTone],
|
|
2611
|
+
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [
|
|
2612
|
+
k,
|
|
2613
|
+
renderThemeColor(v, {
|
|
2614
|
+
bg,
|
|
2615
|
+
colorPalette,
|
|
2616
|
+
debugPath: `${debugPath}.${k}`
|
|
2617
|
+
})
|
|
2618
|
+
])
|
|
2619
|
+
]);
|
|
3345
2620
|
}
|
|
3346
2621
|
function renderThemeColor(value, options) {
|
|
3347
|
-
const {
|
|
3348
|
-
colorPalette,
|
|
3349
|
-
bg
|
|
3350
|
-
} = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
|
|
3351
|
-
colorPalette,
|
|
3352
|
-
bg,
|
|
3353
|
-
blendMode
|
|
3354
|
-
}), colorOptions = {
|
|
3355
|
-
colorPalette,
|
|
3356
|
-
bg: baseBg,
|
|
3357
|
-
blendMode
|
|
3358
|
-
}, button = renderThemeColorButton(value.button, {
|
|
2622
|
+
const { colorPalette, bg, debugPath } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode }), colorOptions = { colorPalette, bg: baseBg, blendMode }, button = renderThemeColorButton(value.button, {
|
|
3359
2623
|
baseBg,
|
|
3360
2624
|
blendMode,
|
|
3361
|
-
colorPalette
|
|
2625
|
+
colorPalette,
|
|
2626
|
+
debugPath: `${debugPath}.button`
|
|
3362
2627
|
}), selectable = renderThemeColorSelectable(value.selectable, {
|
|
3363
2628
|
colorPalette,
|
|
3364
2629
|
baseBg,
|
|
3365
|
-
blendMode
|
|
2630
|
+
blendMode,
|
|
2631
|
+
debugPath: `${debugPath}.selectable`
|
|
3366
2632
|
}), shadow = {
|
|
3367
2633
|
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
3368
2634
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
3369
2635
|
...colorOptions,
|
|
3370
2636
|
bg: void 0,
|
|
3371
|
-
colorPalette: {
|
|
3372
|
-
...colorPalette,
|
|
3373
|
-
black: "#000000"
|
|
3374
|
-
}
|
|
2637
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3375
2638
|
}),
|
|
3376
2639
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
3377
2640
|
...colorOptions,
|
|
3378
2641
|
bg: void 0,
|
|
3379
|
-
colorPalette: {
|
|
3380
|
-
...colorPalette,
|
|
3381
|
-
black: "#000000"
|
|
3382
|
-
}
|
|
2642
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3383
2643
|
}),
|
|
3384
2644
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
3385
2645
|
...colorOptions,
|
|
3386
2646
|
bg: void 0,
|
|
3387
|
-
colorPalette: {
|
|
3388
|
-
...colorPalette,
|
|
3389
|
-
black: "#000000"
|
|
3390
|
-
}
|
|
2647
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3391
2648
|
})
|
|
3392
2649
|
};
|
|
3393
2650
|
return {
|
|
@@ -3399,13 +2656,15 @@ function renderThemeColor(value, options) {
|
|
|
3399
2656
|
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3400
2657
|
baseBg,
|
|
3401
2658
|
colorPalette,
|
|
3402
|
-
blendMode
|
|
2659
|
+
blendMode,
|
|
2660
|
+
debugPath: `${debugPath}.avatar`
|
|
3403
2661
|
}),
|
|
3404
2662
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
3405
2663
|
badge: renderThemeColorBadge(value.badge, {
|
|
3406
2664
|
baseBg,
|
|
3407
2665
|
colorPalette,
|
|
3408
|
-
blendMode
|
|
2666
|
+
blendMode,
|
|
2667
|
+
debugPath: `${debugPath}.badge`
|
|
3409
2668
|
}),
|
|
3410
2669
|
bg: baseBg,
|
|
3411
2670
|
border: renderColorValue(value.border, colorOptions),
|
|
@@ -3420,12 +2679,14 @@ function renderThemeColor(value, options) {
|
|
|
3420
2679
|
input: renderThemeColorInput(value.input, {
|
|
3421
2680
|
baseBg,
|
|
3422
2681
|
colorPalette,
|
|
3423
|
-
blendMode
|
|
2682
|
+
blendMode,
|
|
2683
|
+
debugPath: `${debugPath}.input`
|
|
3424
2684
|
}),
|
|
3425
2685
|
kbd: renderThemeColorKBD(value.kbd, {
|
|
3426
2686
|
baseBg,
|
|
3427
2687
|
colorPalette,
|
|
3428
|
-
blendMode
|
|
2688
|
+
blendMode,
|
|
2689
|
+
debugPath: `${debugPath}.kbd`
|
|
3429
2690
|
}),
|
|
3430
2691
|
link: {
|
|
3431
2692
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
@@ -3442,17 +2703,14 @@ function renderThemeColor(value, options) {
|
|
|
3442
2703
|
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3443
2704
|
baseBg,
|
|
3444
2705
|
colorPalette,
|
|
3445
|
-
blendMode
|
|
2706
|
+
blendMode,
|
|
2707
|
+
debugPath: `${debugPath}.syntax`
|
|
3446
2708
|
}),
|
|
3447
2709
|
selectable
|
|
3448
2710
|
};
|
|
3449
2711
|
}
|
|
3450
2712
|
function renderThemeColorKBD(value, options) {
|
|
3451
|
-
const {
|
|
3452
|
-
baseBg,
|
|
3453
|
-
blendMode,
|
|
3454
|
-
colorPalette
|
|
3455
|
-
} = options, rootOptions = {
|
|
2713
|
+
const { baseBg, blendMode, colorPalette } = options, rootOptions = {
|
|
3456
2714
|
bg: baseBg,
|
|
3457
2715
|
blendMode,
|
|
3458
2716
|
colorPalette
|
|
@@ -3468,24 +2726,48 @@ function renderThemeColorKBD(value, options) {
|
|
|
3468
2726
|
};
|
|
3469
2727
|
}
|
|
3470
2728
|
function renderThemeColorAvatar(value, options) {
|
|
2729
|
+
const { debugPath } = options;
|
|
3471
2730
|
return {
|
|
3472
|
-
gray: renderThemeColorAvatarColor(value.gray,
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
2731
|
+
gray: renderThemeColorAvatarColor(value.gray, {
|
|
2732
|
+
...options,
|
|
2733
|
+
debugPath: `${debugPath}.gray`
|
|
2734
|
+
}),
|
|
2735
|
+
blue: renderThemeColorAvatarColor(value.blue, {
|
|
2736
|
+
...options,
|
|
2737
|
+
debugPath: `${debugPath}.blue`
|
|
2738
|
+
}),
|
|
2739
|
+
purple: renderThemeColorAvatarColor(value.purple, {
|
|
2740
|
+
...options,
|
|
2741
|
+
debugPath: `${debugPath}.purple`
|
|
2742
|
+
}),
|
|
2743
|
+
magenta: renderThemeColorAvatarColor(value.magenta, {
|
|
2744
|
+
...options,
|
|
2745
|
+
debugPath: `${debugPath}.magenta`
|
|
2746
|
+
}),
|
|
2747
|
+
red: renderThemeColorAvatarColor(value.red, {
|
|
2748
|
+
...options,
|
|
2749
|
+
debugPath: `${debugPath}.red`
|
|
2750
|
+
}),
|
|
2751
|
+
orange: renderThemeColorAvatarColor(value.orange, {
|
|
2752
|
+
...options,
|
|
2753
|
+
debugPath: `${debugPath}.orange`
|
|
2754
|
+
}),
|
|
2755
|
+
yellow: renderThemeColorAvatarColor(value.yellow, {
|
|
2756
|
+
...options,
|
|
2757
|
+
debugPath: `${debugPath}.yellow`
|
|
2758
|
+
}),
|
|
2759
|
+
green: renderThemeColorAvatarColor(value.green, {
|
|
2760
|
+
...options,
|
|
2761
|
+
debugPath: `${debugPath}.green`
|
|
2762
|
+
}),
|
|
2763
|
+
cyan: renderThemeColorAvatarColor(value.cyan, {
|
|
2764
|
+
...options,
|
|
2765
|
+
debugPath: `${debugPath}.cyan`
|
|
2766
|
+
})
|
|
3481
2767
|
};
|
|
3482
2768
|
}
|
|
3483
2769
|
function renderThemeColorAvatarColor(value, options) {
|
|
3484
|
-
const {
|
|
3485
|
-
baseBg,
|
|
3486
|
-
blendMode: rootBlendMode,
|
|
3487
|
-
colorPalette
|
|
3488
|
-
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2770
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3489
2771
|
bg: baseBg,
|
|
3490
2772
|
blendMode: rootBlendMode,
|
|
3491
2773
|
colorPalette
|
|
@@ -3501,20 +2783,14 @@ function renderThemeColorAvatarColor(value, options) {
|
|
|
3501
2783
|
};
|
|
3502
2784
|
}
|
|
3503
2785
|
function renderThemeColorBadge(value, options) {
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
critical: renderThemeColorBadgeColor(value.critical, options)
|
|
3510
|
-
};
|
|
2786
|
+
const { debugPath } = options;
|
|
2787
|
+
return THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = renderThemeColorBadgeColor(value[tone], {
|
|
2788
|
+
...options,
|
|
2789
|
+
debugPath: `${debugPath}.${tone}`
|
|
2790
|
+
}), acc), {});
|
|
3511
2791
|
}
|
|
3512
2792
|
function renderThemeColorBadgeColor(value, options) {
|
|
3513
|
-
const {
|
|
3514
|
-
baseBg,
|
|
3515
|
-
blendMode: rootBlendMode,
|
|
3516
|
-
colorPalette
|
|
3517
|
-
} = options, blendMode = rootBlendMode, rootOptions = {
|
|
2793
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
|
|
3518
2794
|
bg: baseBg,
|
|
3519
2795
|
blendMode: rootBlendMode,
|
|
3520
2796
|
colorPalette
|
|
@@ -3531,36 +2807,56 @@ function renderThemeColorBadgeColor(value, options) {
|
|
|
3531
2807
|
};
|
|
3532
2808
|
}
|
|
3533
2809
|
function renderThemeColorButton(value, options) {
|
|
2810
|
+
const { debugPath } = options;
|
|
3534
2811
|
return {
|
|
3535
|
-
default: renderThemeColorButtonTones(value.default,
|
|
3536
|
-
|
|
3537
|
-
|
|
2812
|
+
default: renderThemeColorButtonTones(value.default, {
|
|
2813
|
+
...options,
|
|
2814
|
+
debugPath: `${debugPath}.default`
|
|
2815
|
+
}),
|
|
2816
|
+
ghost: renderThemeColorButtonTones(value.ghost, {
|
|
2817
|
+
...options,
|
|
2818
|
+
debugPath: `${debugPath}.ghost`
|
|
2819
|
+
}),
|
|
2820
|
+
bleed: renderThemeColorButtonTones(value.bleed, {
|
|
2821
|
+
...options,
|
|
2822
|
+
debugPath: `${debugPath}.bleed`
|
|
2823
|
+
})
|
|
3538
2824
|
};
|
|
3539
2825
|
}
|
|
3540
2826
|
function renderThemeColorButtonTones(value, options) {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
critical: renderThemeColorButtonStates(value.critical, options)
|
|
3547
|
-
};
|
|
2827
|
+
const { debugPath } = options;
|
|
2828
|
+
return THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = renderThemeColorButtonStates(value[tone], {
|
|
2829
|
+
...options,
|
|
2830
|
+
debugPath: `${debugPath}.${tone}`
|
|
2831
|
+
}), acc), {});
|
|
3548
2832
|
}
|
|
3549
2833
|
function renderThemeColorButtonStates(value, options) {
|
|
2834
|
+
const { debugPath } = options;
|
|
3550
2835
|
return {
|
|
3551
|
-
enabled: renderThemeColorState(value.enabled,
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
2836
|
+
enabled: renderThemeColorState(value.enabled, {
|
|
2837
|
+
...options,
|
|
2838
|
+
debugPath: `${debugPath}.enabled`
|
|
2839
|
+
}),
|
|
2840
|
+
hovered: renderThemeColorState(value.hovered, {
|
|
2841
|
+
...options,
|
|
2842
|
+
debugPath: `${debugPath}.hovered`
|
|
2843
|
+
}),
|
|
2844
|
+
pressed: renderThemeColorState(value.pressed, {
|
|
2845
|
+
...options,
|
|
2846
|
+
debugPath: `${debugPath}.pressed`
|
|
2847
|
+
}),
|
|
2848
|
+
selected: renderThemeColorState(value.selected, {
|
|
2849
|
+
...options,
|
|
2850
|
+
debugPath: `${debugPath}.selected`
|
|
2851
|
+
}),
|
|
2852
|
+
disabled: renderThemeColorState(value.disabled, {
|
|
2853
|
+
...options,
|
|
2854
|
+
debugPath: `${debugPath}.disabled`
|
|
2855
|
+
})
|
|
3556
2856
|
};
|
|
3557
2857
|
}
|
|
3558
2858
|
function renderThemeColorState(value, options) {
|
|
3559
|
-
const {
|
|
3560
|
-
baseBg,
|
|
3561
|
-
blendMode: rootBlendMode,
|
|
3562
|
-
colorPalette
|
|
3563
|
-
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2859
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette, debugPath } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3564
2860
|
bg: baseBg,
|
|
3565
2861
|
blendMode: rootBlendMode,
|
|
3566
2862
|
colorPalette
|
|
@@ -3577,12 +2873,14 @@ function renderThemeColorState(value, options) {
|
|
|
3577
2873
|
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3578
2874
|
baseBg: bg,
|
|
3579
2875
|
colorPalette,
|
|
3580
|
-
blendMode
|
|
2876
|
+
blendMode,
|
|
2877
|
+
debugPath: `${debugPath}.avatar`
|
|
3581
2878
|
}),
|
|
3582
2879
|
badge: renderThemeColorBadge(value.badge, {
|
|
3583
2880
|
baseBg: bg,
|
|
3584
2881
|
colorPalette,
|
|
3585
|
-
blendMode
|
|
2882
|
+
blendMode,
|
|
2883
|
+
debugPath: `${debugPath}.badge`
|
|
3586
2884
|
}),
|
|
3587
2885
|
bg,
|
|
3588
2886
|
border: renderColorValue(value.border, colorOptions),
|
|
@@ -3611,33 +2909,41 @@ function renderThemeColorState(value, options) {
|
|
|
3611
2909
|
};
|
|
3612
2910
|
}
|
|
3613
2911
|
function renderThemeColorInput(value, options) {
|
|
2912
|
+
const { debugPath } = options;
|
|
3614
2913
|
return {
|
|
3615
|
-
default: renderInputStatesColorTheme(value.default,
|
|
3616
|
-
|
|
2914
|
+
default: renderInputStatesColorTheme(value.default, {
|
|
2915
|
+
...options,
|
|
2916
|
+
debugPath: `${debugPath}.default`
|
|
2917
|
+
}),
|
|
2918
|
+
invalid: renderInputStatesColorTheme(value.invalid, {
|
|
2919
|
+
...options,
|
|
2920
|
+
debugPath: `${debugPath}.invalid`
|
|
2921
|
+
})
|
|
3617
2922
|
};
|
|
3618
2923
|
}
|
|
3619
2924
|
function renderInputStatesColorTheme(value, options) {
|
|
2925
|
+
const { debugPath } = options;
|
|
3620
2926
|
return {
|
|
3621
|
-
enabled: renderInputStateColorTheme(value.enabled,
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
2927
|
+
enabled: renderInputStateColorTheme(value.enabled, {
|
|
2928
|
+
...options,
|
|
2929
|
+
debugPath: `${debugPath}.enabled`
|
|
2930
|
+
}),
|
|
2931
|
+
hovered: renderInputStateColorTheme(value.hovered, {
|
|
2932
|
+
...options,
|
|
2933
|
+
debugPath: `${debugPath}.hovered`
|
|
2934
|
+
}),
|
|
2935
|
+
readOnly: renderInputStateColorTheme(value.readOnly, {
|
|
2936
|
+
...options,
|
|
2937
|
+
debugPath: `${debugPath}.readOnly`
|
|
2938
|
+
}),
|
|
2939
|
+
disabled: renderInputStateColorTheme(value.disabled, {
|
|
2940
|
+
...options,
|
|
2941
|
+
debugPath: `${debugPath}.disabled`
|
|
2942
|
+
})
|
|
3625
2943
|
};
|
|
3626
2944
|
}
|
|
3627
2945
|
function renderInputStateColorTheme(value, options) {
|
|
3628
|
-
const {
|
|
3629
|
-
baseBg,
|
|
3630
|
-
blendMode: rootBlendMode,
|
|
3631
|
-
colorPalette
|
|
3632
|
-
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3633
|
-
colorPalette,
|
|
3634
|
-
bg: baseBg,
|
|
3635
|
-
blendMode: rootBlendMode
|
|
3636
|
-
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3637
|
-
colorPalette,
|
|
3638
|
-
bg,
|
|
3639
|
-
blendMode
|
|
3640
|
-
};
|
|
2946
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode }, bg = renderColorValue(value.bg, rootOptions), colorOptions = { colorPalette, bg, blendMode };
|
|
3641
2947
|
return {
|
|
3642
2948
|
_blend: blendMode,
|
|
3643
2949
|
bg,
|
|
@@ -3650,33 +2956,39 @@ function renderInputStateColorTheme(value, options) {
|
|
|
3650
2956
|
};
|
|
3651
2957
|
}
|
|
3652
2958
|
function renderThemeColorSelectable(value, options) {
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
critical: renderThemeColorSelectableStates(value.critical, options)
|
|
3659
|
-
};
|
|
2959
|
+
const { debugPath } = options;
|
|
2960
|
+
return THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = renderThemeColorSelectableStates(value[tone], {
|
|
2961
|
+
...options,
|
|
2962
|
+
debugPath: `${debugPath}.${tone}`
|
|
2963
|
+
}), acc), {});
|
|
3660
2964
|
}
|
|
3661
2965
|
function renderThemeColorSelectableStates(value, options) {
|
|
2966
|
+
const { debugPath } = options;
|
|
3662
2967
|
return {
|
|
3663
|
-
enabled: renderThemeColorState(value.enabled,
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
2968
|
+
enabled: renderThemeColorState(value.enabled, {
|
|
2969
|
+
...options,
|
|
2970
|
+
debugPath: `${debugPath}.enabled`
|
|
2971
|
+
}),
|
|
2972
|
+
hovered: renderThemeColorState(value.hovered, {
|
|
2973
|
+
...options,
|
|
2974
|
+
debugPath: `${debugPath}.hovered`
|
|
2975
|
+
}),
|
|
2976
|
+
pressed: renderThemeColorState(value.pressed, {
|
|
2977
|
+
...options,
|
|
2978
|
+
debugPath: `${debugPath}.pressed`
|
|
2979
|
+
}),
|
|
2980
|
+
selected: renderThemeColorState(value.selected, {
|
|
2981
|
+
...options,
|
|
2982
|
+
debugPath: `${debugPath}.selected`
|
|
2983
|
+
}),
|
|
2984
|
+
disabled: renderThemeColorState(value.disabled, {
|
|
2985
|
+
...options,
|
|
2986
|
+
debugPath: `${debugPath}.disabled`
|
|
2987
|
+
})
|
|
3668
2988
|
};
|
|
3669
2989
|
}
|
|
3670
2990
|
function renderSyntaxColorTheme(value, options) {
|
|
3671
|
-
const {
|
|
3672
|
-
colorPalette,
|
|
3673
|
-
baseBg,
|
|
3674
|
-
blendMode
|
|
3675
|
-
} = options, colorOptions = {
|
|
3676
|
-
colorPalette,
|
|
3677
|
-
bg: baseBg,
|
|
3678
|
-
blendMode
|
|
3679
|
-
};
|
|
2991
|
+
const { colorPalette, baseBg, blendMode } = options, colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
3680
2992
|
return {
|
|
3681
2993
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
3682
2994
|
attrName: renderColorValue(value.attrName, colorOptions),
|