@sanity/ui 2.8.13-canary.0 → 2.8.13
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 +28 -84
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +28 -84
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +28 -84
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.esm.js +2912 -2941
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2912 -2940
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2912 -2941
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +448 -1197
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +448 -1197
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +448 -1197
- package/dist/theme.mjs.map +1 -1
- package/package.json +34 -27
package/dist/theme.esm.js
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) {
|
|
@@ -1502,7 +1097,20 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1502
1097
|
placeholder: t.placeholder
|
|
1503
1098
|
};
|
|
1504
1099
|
}
|
|
1505
|
-
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1100
|
+
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1101
|
+
"transparent",
|
|
1102
|
+
"default",
|
|
1103
|
+
"primary",
|
|
1104
|
+
"positive",
|
|
1105
|
+
"caution",
|
|
1106
|
+
"critical"
|
|
1107
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1108
|
+
"default",
|
|
1109
|
+
"primary",
|
|
1110
|
+
"positive",
|
|
1111
|
+
"caution",
|
|
1112
|
+
"critical"
|
|
1113
|
+
], 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
1114
|
function isColorBlendModeValue(str) {
|
|
1507
1115
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1508
1116
|
}
|
|
@@ -1515,7 +1123,33 @@ function isColorTintKey(str) {
|
|
|
1515
1123
|
function isColorButtonMode(str) {
|
|
1516
1124
|
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1517
1125
|
}
|
|
1518
|
-
const COLOR_CONFIG_STATE_KEYS = [
|
|
1126
|
+
const COLOR_CONFIG_STATE_KEYS = [
|
|
1127
|
+
"_hue",
|
|
1128
|
+
"bg",
|
|
1129
|
+
"fg",
|
|
1130
|
+
"border",
|
|
1131
|
+
"focusRing",
|
|
1132
|
+
"muted/fg",
|
|
1133
|
+
"accent/fg",
|
|
1134
|
+
"link/fg",
|
|
1135
|
+
"code/bg",
|
|
1136
|
+
"code/fg",
|
|
1137
|
+
"skeleton/from",
|
|
1138
|
+
"skeleton/to",
|
|
1139
|
+
"status/dot",
|
|
1140
|
+
"status/icon"
|
|
1141
|
+
], COLOR_CONFIG_CARD_KEYS = [
|
|
1142
|
+
...COLOR_CONFIG_STATE_KEYS,
|
|
1143
|
+
"_hue",
|
|
1144
|
+
"bg",
|
|
1145
|
+
"fg",
|
|
1146
|
+
"border",
|
|
1147
|
+
"focusRing",
|
|
1148
|
+
"shadow/outline",
|
|
1149
|
+
"shadow/umbra",
|
|
1150
|
+
"shadow/penumbra",
|
|
1151
|
+
"shadow/ambient"
|
|
1152
|
+
], 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
1153
|
function parseTokenKey(str) {
|
|
1520
1154
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1521
1155
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -1681,16 +1315,10 @@ function compileColorTokenValue(node) {
|
|
|
1681
1315
|
}
|
|
1682
1316
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1683
1317
|
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1684
|
-
const {
|
|
1685
|
-
hue,
|
|
1686
|
-
scheme
|
|
1687
|
-
} = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1318
|
+
const { hue, scheme } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1688
1319
|
if (!node || node.type !== "color")
|
|
1689
1320
|
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1690
|
-
return compileColorTokenValue({
|
|
1691
|
-
...node,
|
|
1692
|
-
hue: node.hue || hue
|
|
1693
|
-
});
|
|
1321
|
+
return compileColorTokenValue({ ...node, hue: node.hue || hue });
|
|
1694
1322
|
}
|
|
1695
1323
|
const defaultColorTokens = {
|
|
1696
1324
|
base: {
|
|
@@ -1765,24 +1393,16 @@ const defaultColorTokens = {
|
|
|
1765
1393
|
fg: ["600", "400"]
|
|
1766
1394
|
}
|
|
1767
1395
|
},
|
|
1768
|
-
primary: {
|
|
1769
|
-
_hue: "blue"
|
|
1770
|
-
},
|
|
1396
|
+
primary: { _hue: "blue" },
|
|
1771
1397
|
positive: {
|
|
1772
1398
|
_hue: "green",
|
|
1773
|
-
shadow: {
|
|
1774
|
-
outline: ["500/0.4", "500/0.4"]
|
|
1775
|
-
}
|
|
1399
|
+
shadow: { outline: ["500/0.4", "500/0.4"] }
|
|
1776
1400
|
},
|
|
1777
1401
|
caution: {
|
|
1778
1402
|
_hue: "yellow",
|
|
1779
|
-
shadow: {
|
|
1780
|
-
outline: ["600/0.3", "500/0.4"]
|
|
1781
|
-
}
|
|
1403
|
+
shadow: { outline: ["600/0.3", "500/0.4"] }
|
|
1782
1404
|
},
|
|
1783
|
-
critical: {
|
|
1784
|
-
_hue: "red"
|
|
1785
|
-
}
|
|
1405
|
+
critical: { _hue: "red" }
|
|
1786
1406
|
},
|
|
1787
1407
|
button: {
|
|
1788
1408
|
default: {
|
|
@@ -2379,33 +1999,15 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2379
1999
|
...spec,
|
|
2380
2000
|
_hue: hue,
|
|
2381
2001
|
avatar: {
|
|
2382
|
-
gray: merge({
|
|
2383
|
-
|
|
2384
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
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)
|
|
2002
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2003
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2004
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2005
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2006
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2007
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2008
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2009
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2010
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2409
2011
|
},
|
|
2410
2012
|
badge: {
|
|
2411
2013
|
default: {
|
|
@@ -2455,38 +2057,25 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2455
2057
|
return tokens;
|
|
2456
2058
|
}
|
|
2457
2059
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2458
|
-
const spec = merge(
|
|
2060
|
+
const spec = merge(
|
|
2061
|
+
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2062
|
+
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2063
|
+
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2064
|
+
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2065
|
+
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2459
2066
|
return {
|
|
2460
2067
|
...spec,
|
|
2461
2068
|
_hue: hue,
|
|
2462
2069
|
avatar: {
|
|
2463
|
-
gray: merge({
|
|
2464
|
-
|
|
2465
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
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)
|
|
2070
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2071
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2072
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2073
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2074
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2075
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2076
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2077
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2078
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2490
2079
|
},
|
|
2491
2080
|
badge: {
|
|
2492
2081
|
default: {
|
|
@@ -2530,11 +2119,13 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2530
2119
|
return states;
|
|
2531
2120
|
}
|
|
2532
2121
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2533
|
-
const spec = merge(
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2122
|
+
const spec = merge(
|
|
2123
|
+
inputTokens?.input?.["*"]?.["*"],
|
|
2124
|
+
inputTokens?.input?.[mode]?.["*"],
|
|
2125
|
+
inputTokens?.input?.["*"]?.[state],
|
|
2126
|
+
inputTokens?.input?.[mode]?.[state]
|
|
2127
|
+
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2128
|
+
return { ...spec, _hue: hue };
|
|
2538
2129
|
}
|
|
2539
2130
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2540
2131
|
const tokens = {};
|
|
@@ -2551,38 +2142,25 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2551
2142
|
return states;
|
|
2552
2143
|
}
|
|
2553
2144
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2554
|
-
const spec = merge(
|
|
2145
|
+
const spec = merge(
|
|
2146
|
+
inputTokens?.selectable?.["*"]?.["*"],
|
|
2147
|
+
inputTokens?.selectable?.[tone]?.["*"],
|
|
2148
|
+
inputTokens?.selectable?.["*"]?.[state],
|
|
2149
|
+
inputTokens?.selectable?.[tone]?.[state]
|
|
2150
|
+
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2555
2151
|
return {
|
|
2556
2152
|
...spec,
|
|
2557
2153
|
_hue: hue,
|
|
2558
2154
|
avatar: {
|
|
2559
|
-
gray: merge({
|
|
2560
|
-
|
|
2561
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
}, spec.avatar?.["*"], spec.avatar?.
|
|
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)
|
|
2155
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2156
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2157
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2158
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2159
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2160
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2161
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2162
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2163
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2586
2164
|
},
|
|
2587
2165
|
badge: {
|
|
2588
2166
|
default: {
|
|
@@ -2619,71 +2197,35 @@ function buildColorTheme(config) {
|
|
|
2619
2197
|
color: resolveColorTokens(config?.color)
|
|
2620
2198
|
};
|
|
2621
2199
|
return {
|
|
2622
|
-
light: buildColorScheme({
|
|
2623
|
-
|
|
2624
|
-
}, resolvedConfig),
|
|
2625
|
-
dark: buildColorScheme({
|
|
2626
|
-
scheme: "dark"
|
|
2627
|
-
}, resolvedConfig)
|
|
2200
|
+
light: buildColorScheme({ scheme: "light" }, resolvedConfig),
|
|
2201
|
+
dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
|
|
2628
2202
|
};
|
|
2629
2203
|
}
|
|
2630
2204
|
function buildColorScheme(options, config) {
|
|
2631
|
-
const {
|
|
2632
|
-
scheme
|
|
2633
|
-
} = options;
|
|
2205
|
+
const { scheme } = options;
|
|
2634
2206
|
return {
|
|
2635
|
-
transparent: buildCardColorTheme({
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
}, config),
|
|
2639
|
-
|
|
2640
|
-
|
|
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)
|
|
2207
|
+
transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
|
|
2208
|
+
default: buildCardColorTheme({ scheme, tone: "default" }, config),
|
|
2209
|
+
primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
|
|
2210
|
+
positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
|
|
2211
|
+
caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
|
|
2212
|
+
critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
|
|
2659
2213
|
};
|
|
2660
2214
|
}
|
|
2661
2215
|
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
|
-
};
|
|
2216
|
+
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2669
2217
|
return {
|
|
2670
2218
|
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2671
2219
|
_dark: scheme === "dark",
|
|
2672
2220
|
accent: {
|
|
2673
2221
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2674
2222
|
},
|
|
2675
|
-
avatar: buildAvatarColorTheme({
|
|
2676
|
-
scheme
|
|
2677
|
-
}, tokens),
|
|
2223
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2678
2224
|
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2679
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2680
|
-
scheme
|
|
2681
|
-
}, config),
|
|
2225
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2682
2226
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2683
2227
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2684
|
-
button: buildButtonColorTheme({
|
|
2685
|
-
scheme
|
|
2686
|
-
}, config),
|
|
2228
|
+
button: buildButtonColorTheme({ scheme }, config),
|
|
2687
2229
|
code: {
|
|
2688
2230
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2689
2231
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2691,10 +2233,7 @@ function buildCardColorTheme(options, config) {
|
|
|
2691
2233
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2692
2234
|
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2693
2235
|
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2694
|
-
input: buildInputColorTheme({
|
|
2695
|
-
scheme,
|
|
2696
|
-
tone
|
|
2697
|
-
}, config),
|
|
2236
|
+
input: buildInputColorTheme({ scheme, tone }, config),
|
|
2698
2237
|
kbd: {
|
|
2699
2238
|
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2700
2239
|
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
@@ -2707,30 +2246,17 @@ function buildCardColorTheme(options, config) {
|
|
|
2707
2246
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2708
2247
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2709
2248
|
},
|
|
2710
|
-
selectable: buildSelectableColorTheme({
|
|
2711
|
-
|
|
2712
|
-
}, config),
|
|
2713
|
-
shadow: buildShadowColorTheme({
|
|
2714
|
-
scheme,
|
|
2715
|
-
tone
|
|
2716
|
-
}, config),
|
|
2249
|
+
selectable: buildSelectableColorTheme({ scheme }, config),
|
|
2250
|
+
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
2717
2251
|
skeleton: {
|
|
2718
2252
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2719
2253
|
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2720
2254
|
},
|
|
2721
|
-
syntax: buildSyntaxColorTheme({
|
|
2722
|
-
scheme
|
|
2723
|
-
}, config)
|
|
2255
|
+
syntax: buildSyntaxColorTheme({ scheme }, config)
|
|
2724
2256
|
};
|
|
2725
2257
|
}
|
|
2726
2258
|
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
|
-
};
|
|
2259
|
+
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2734
2260
|
return {
|
|
2735
2261
|
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2736
2262
|
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
@@ -2739,56 +2265,21 @@ function buildShadowColorTheme(options, config) {
|
|
|
2739
2265
|
};
|
|
2740
2266
|
}
|
|
2741
2267
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
2742
|
-
const {
|
|
2743
|
-
scheme
|
|
2744
|
-
} = options;
|
|
2268
|
+
const { scheme } = options;
|
|
2745
2269
|
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)
|
|
2270
|
+
gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
|
|
2271
|
+
blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
|
|
2272
|
+
purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
|
|
2273
|
+
magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
|
|
2274
|
+
red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
|
|
2275
|
+
orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
|
|
2276
|
+
yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
|
|
2277
|
+
green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
|
|
2278
|
+
cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
|
|
2782
2279
|
};
|
|
2783
2280
|
}
|
|
2784
2281
|
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
|
-
};
|
|
2282
|
+
const { color: color2, scheme } = options, tokens = stateTokens?.avatar?.[color2], context = { hue: tokens?._hue || "gray", scheme };
|
|
2792
2283
|
return {
|
|
2793
2284
|
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2794
2285
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2796,40 +2287,17 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2796
2287
|
};
|
|
2797
2288
|
}
|
|
2798
2289
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2799
|
-
const {
|
|
2800
|
-
scheme
|
|
2801
|
-
} = options;
|
|
2290
|
+
const { scheme } = options;
|
|
2802
2291
|
return {
|
|
2803
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
}, config),
|
|
2807
|
-
|
|
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)
|
|
2292
|
+
default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
|
|
2293
|
+
primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
|
|
2294
|
+
positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
|
|
2295
|
+
caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
|
|
2296
|
+
critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
|
|
2823
2297
|
};
|
|
2824
2298
|
}
|
|
2825
2299
|
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
|
-
};
|
|
2300
|
+
const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
|
|
2833
2301
|
return {
|
|
2834
2302
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2835
2303
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
@@ -2838,65 +2306,32 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2838
2306
|
};
|
|
2839
2307
|
}
|
|
2840
2308
|
function buildButtonColorTheme(options, config) {
|
|
2841
|
-
const {
|
|
2842
|
-
scheme
|
|
2843
|
-
} = options, modes = {};
|
|
2309
|
+
const { scheme } = options, modes = {};
|
|
2844
2310
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2845
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
2846
|
-
scheme,
|
|
2847
|
-
mode
|
|
2848
|
-
}, config);
|
|
2311
|
+
modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
|
|
2849
2312
|
return modes;
|
|
2850
2313
|
}
|
|
2851
2314
|
function buildButtonTonesColorTheme(options, config) {
|
|
2852
|
-
const {
|
|
2853
|
-
mode,
|
|
2854
|
-
scheme
|
|
2855
|
-
} = options, tones2 = {};
|
|
2315
|
+
const { mode, scheme } = options, tones2 = {};
|
|
2856
2316
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2857
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
2858
|
-
mode,
|
|
2859
|
-
scheme,
|
|
2860
|
-
tone
|
|
2861
|
-
}, config);
|
|
2317
|
+
tones2[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
|
|
2862
2318
|
return tones2;
|
|
2863
2319
|
}
|
|
2864
2320
|
function buildButtonStatesColorTheme(options, config) {
|
|
2865
|
-
const {
|
|
2866
|
-
mode,
|
|
2867
|
-
scheme,
|
|
2868
|
-
tone
|
|
2869
|
-
} = options, states = {};
|
|
2321
|
+
const { mode, scheme, tone } = options, states = {};
|
|
2870
2322
|
for (const state of THEME_COLOR_STATES)
|
|
2871
|
-
states[state] = buildButtonStateColorTheme({
|
|
2872
|
-
mode,
|
|
2873
|
-
tone,
|
|
2874
|
-
scheme,
|
|
2875
|
-
state
|
|
2876
|
-
}, config);
|
|
2323
|
+
states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
|
|
2877
2324
|
return states;
|
|
2878
2325
|
}
|
|
2879
2326
|
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
|
-
};
|
|
2327
|
+
const { mode, tone, scheme, state } = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2889
2328
|
return {
|
|
2890
2329
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2891
2330
|
accent: {
|
|
2892
2331
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2893
2332
|
},
|
|
2894
|
-
avatar: buildAvatarColorTheme({
|
|
2895
|
-
|
|
2896
|
-
}, tokens),
|
|
2897
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2898
|
-
scheme
|
|
2899
|
-
}, config),
|
|
2333
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2334
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2900
2335
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2901
2336
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2902
2337
|
code: {
|
|
@@ -2924,66 +2359,23 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
2924
2359
|
};
|
|
2925
2360
|
}
|
|
2926
2361
|
function buildInputColorTheme(options, config) {
|
|
2927
|
-
const {
|
|
2928
|
-
scheme,
|
|
2929
|
-
tone
|
|
2930
|
-
} = options;
|
|
2362
|
+
const { scheme, tone } = options;
|
|
2931
2363
|
return {
|
|
2932
|
-
default: buildInputStatesColorTheme({
|
|
2933
|
-
|
|
2934
|
-
scheme,
|
|
2935
|
-
tone
|
|
2936
|
-
}, config),
|
|
2937
|
-
invalid: buildInputStatesColorTheme({
|
|
2938
|
-
mode: "invalid",
|
|
2939
|
-
scheme,
|
|
2940
|
-
tone
|
|
2941
|
-
}, config)
|
|
2364
|
+
default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
|
|
2365
|
+
invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
|
|
2942
2366
|
};
|
|
2943
2367
|
}
|
|
2944
2368
|
function buildInputStatesColorTheme(options, config) {
|
|
2945
|
-
const {
|
|
2946
|
-
mode,
|
|
2947
|
-
scheme,
|
|
2948
|
-
tone
|
|
2949
|
-
} = options;
|
|
2369
|
+
const { mode, scheme, tone } = options;
|
|
2950
2370
|
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)
|
|
2371
|
+
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
|
|
2372
|
+
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
|
|
2373
|
+
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
|
|
2374
|
+
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
|
|
2975
2375
|
};
|
|
2976
2376
|
}
|
|
2977
2377
|
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
|
-
};
|
|
2378
|
+
const { mode, tone, scheme, state } = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2987
2379
|
return {
|
|
2988
2380
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2989
2381
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2996,49 +2388,26 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2996
2388
|
};
|
|
2997
2389
|
}
|
|
2998
2390
|
function buildSelectableColorTheme(options, config) {
|
|
2999
|
-
const {
|
|
3000
|
-
scheme
|
|
3001
|
-
} = options, tones2 = {};
|
|
2391
|
+
const { scheme } = options, tones2 = {};
|
|
3002
2392
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
3003
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3004
|
-
scheme,
|
|
3005
|
-
tone
|
|
3006
|
-
}, config);
|
|
2393
|
+
tones2[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
|
|
3007
2394
|
return tones2;
|
|
3008
2395
|
}
|
|
3009
2396
|
function buildSelectableStatesColorTheme(options, config) {
|
|
3010
|
-
const {
|
|
3011
|
-
scheme,
|
|
3012
|
-
tone
|
|
3013
|
-
} = options, states = {};
|
|
2397
|
+
const { scheme, tone } = options, states = {};
|
|
3014
2398
|
for (const state of THEME_COLOR_STATES)
|
|
3015
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3016
|
-
tone,
|
|
3017
|
-
scheme,
|
|
3018
|
-
state
|
|
3019
|
-
}, config);
|
|
2399
|
+
states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
|
|
3020
2400
|
return states;
|
|
3021
2401
|
}
|
|
3022
2402
|
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
|
-
};
|
|
2403
|
+
const { scheme, state, tone } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
3031
2404
|
return {
|
|
3032
2405
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3033
2406
|
accent: {
|
|
3034
2407
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
3035
2408
|
},
|
|
3036
|
-
avatar: buildAvatarColorTheme({
|
|
3037
|
-
|
|
3038
|
-
}, tokens),
|
|
3039
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3040
|
-
scheme
|
|
3041
|
-
}, config),
|
|
2409
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2410
|
+
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
3042
2411
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
3043
2412
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
3044
2413
|
code: {
|
|
@@ -3066,12 +2435,7 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
3066
2435
|
};
|
|
3067
2436
|
}
|
|
3068
2437
|
function buildSyntaxColorTheme(options, config) {
|
|
3069
|
-
const {
|
|
3070
|
-
scheme
|
|
3071
|
-
} = options, tokens = config?.color?.syntax, context = {
|
|
3072
|
-
hue: "gray",
|
|
3073
|
-
scheme
|
|
3074
|
-
};
|
|
2438
|
+
const { scheme } = options, tokens = config?.color?.syntax, context = { hue: "gray", scheme };
|
|
3075
2439
|
return {
|
|
3076
2440
|
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
3077
2441
|
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
@@ -3186,19 +2550,11 @@ function rgbToHex(color2) {
|
|
|
3186
2550
|
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
2551
|
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
3188
2552
|
}
|
|
3189
|
-
function rgbToHsl({
|
|
3190
|
-
r,
|
|
3191
|
-
g,
|
|
3192
|
-
b
|
|
3193
|
-
}) {
|
|
2553
|
+
function rgbToHsl({ r, g, b }) {
|
|
3194
2554
|
r /= 255, g /= 255, b /= 255;
|
|
3195
2555
|
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
3196
2556
|
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
|
-
};
|
|
2557
|
+
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
2558
|
}
|
|
3203
2559
|
function hslToRgb(hsl) {
|
|
3204
2560
|
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 +2579,10 @@ function parseHsl(str) {
|
|
|
3223
2579
|
const res = HSL_RE.exec(str);
|
|
3224
2580
|
if (!res)
|
|
3225
2581
|
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
|
-
};
|
|
2582
|
+
return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
|
|
3231
2583
|
}
|
|
3232
2584
|
function parseColor(color2) {
|
|
3233
|
-
if (!color2) return {
|
|
3234
|
-
r: 0,
|
|
3235
|
-
g: 0,
|
|
3236
|
-
b: 0
|
|
3237
|
-
};
|
|
2585
|
+
if (!color2) return { r: 0, g: 0, b: 0 };
|
|
3238
2586
|
if (typeof color2 != "string")
|
|
3239
2587
|
throw new Error("parseColor: expected a string");
|
|
3240
2588
|
if (isHex(color2))
|
|
@@ -3249,11 +2597,7 @@ function getContrastRatio(bg, fg) {
|
|
|
3249
2597
|
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
3250
2598
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
3251
2599
|
}
|
|
3252
|
-
function rgb_lrgb({
|
|
3253
|
-
r,
|
|
3254
|
-
g,
|
|
3255
|
-
b
|
|
3256
|
-
}) {
|
|
2600
|
+
function rgb_lrgb({ r, g, b }) {
|
|
3257
2601
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
3258
2602
|
}
|
|
3259
2603
|
function rgb_lrgb1(v) {
|
|
@@ -3268,9 +2612,7 @@ function rgba(color2, a) {
|
|
|
3268
2612
|
}
|
|
3269
2613
|
const RGB_RANGE = [0, 255];
|
|
3270
2614
|
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 = {
|
|
2615
|
+
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
2616
|
r: [black2.r, white2.r],
|
|
3275
2617
|
g: [black2.g, white2.g],
|
|
3276
2618
|
b: [black2.b, white2.b]
|
|
@@ -3290,11 +2632,7 @@ function mixThemeColor(value, options) {
|
|
|
3290
2632
|
return rgbToHex(v);
|
|
3291
2633
|
}
|
|
3292
2634
|
function renderColorValue(str, options) {
|
|
3293
|
-
const {
|
|
3294
|
-
bg,
|
|
3295
|
-
blendMode,
|
|
3296
|
-
colorPalette
|
|
3297
|
-
} = options;
|
|
2635
|
+
const { bg, blendMode, colorPalette } = options;
|
|
3298
2636
|
if (bg === "white")
|
|
3299
2637
|
throw new Error("Cannot blend with white background");
|
|
3300
2638
|
const node = parseTokenValue(str);
|
|
@@ -3331,31 +2669,17 @@ function renderThemeColorSchemes(value, config) {
|
|
|
3331
2669
|
};
|
|
3332
2670
|
}
|
|
3333
2671
|
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
|
|
3336
|
-
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3337
|
-
colorPalette
|
|
3338
|
-
}), bg = renderedDefaultTone.bg;
|
|
2672
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette }), renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette }), bg = renderedDefaultTone.bg;
|
|
3339
2673
|
if (bg === "white")
|
|
3340
2674
|
throw new Error("Cannot blend with white background");
|
|
3341
|
-
return Object.fromEntries([
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
2675
|
+
return Object.fromEntries([
|
|
2676
|
+
["transparent", renderedTransparentTone],
|
|
2677
|
+
["default", renderedDefaultTone],
|
|
2678
|
+
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
|
|
2679
|
+
]);
|
|
3345
2680
|
}
|
|
3346
2681
|
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, {
|
|
2682
|
+
const { colorPalette, bg } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode }), colorOptions = { colorPalette, bg: baseBg, blendMode }, button = renderThemeColorButton(value.button, {
|
|
3359
2683
|
baseBg,
|
|
3360
2684
|
blendMode,
|
|
3361
2685
|
colorPalette
|
|
@@ -3368,26 +2692,17 @@ function renderThemeColor(value, options) {
|
|
|
3368
2692
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
3369
2693
|
...colorOptions,
|
|
3370
2694
|
bg: void 0,
|
|
3371
|
-
colorPalette: {
|
|
3372
|
-
...colorPalette,
|
|
3373
|
-
black: "#000000"
|
|
3374
|
-
}
|
|
2695
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3375
2696
|
}),
|
|
3376
2697
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
3377
2698
|
...colorOptions,
|
|
3378
2699
|
bg: void 0,
|
|
3379
|
-
colorPalette: {
|
|
3380
|
-
...colorPalette,
|
|
3381
|
-
black: "#000000"
|
|
3382
|
-
}
|
|
2700
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3383
2701
|
}),
|
|
3384
2702
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
3385
2703
|
...colorOptions,
|
|
3386
2704
|
bg: void 0,
|
|
3387
|
-
colorPalette: {
|
|
3388
|
-
...colorPalette,
|
|
3389
|
-
black: "#000000"
|
|
3390
|
-
}
|
|
2705
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3391
2706
|
})
|
|
3392
2707
|
};
|
|
3393
2708
|
return {
|
|
@@ -3396,17 +2711,9 @@ function renderThemeColor(value, options) {
|
|
|
3396
2711
|
accent: {
|
|
3397
2712
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
3398
2713
|
},
|
|
3399
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3400
|
-
baseBg,
|
|
3401
|
-
colorPalette,
|
|
3402
|
-
blendMode
|
|
3403
|
-
}),
|
|
2714
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
3404
2715
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
3405
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
3406
|
-
baseBg,
|
|
3407
|
-
colorPalette,
|
|
3408
|
-
blendMode
|
|
3409
|
-
}),
|
|
2716
|
+
badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
|
|
3410
2717
|
bg: baseBg,
|
|
3411
2718
|
border: renderColorValue(value.border, colorOptions),
|
|
3412
2719
|
button,
|
|
@@ -3417,16 +2724,8 @@ function renderThemeColor(value, options) {
|
|
|
3417
2724
|
fg: renderColorValue(value.fg, colorOptions),
|
|
3418
2725
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
3419
2726
|
icon: renderColorValue(value.icon, colorOptions),
|
|
3420
|
-
input: renderThemeColorInput(value.input, {
|
|
3421
|
-
|
|
3422
|
-
colorPalette,
|
|
3423
|
-
blendMode
|
|
3424
|
-
}),
|
|
3425
|
-
kbd: renderThemeColorKBD(value.kbd, {
|
|
3426
|
-
baseBg,
|
|
3427
|
-
colorPalette,
|
|
3428
|
-
blendMode
|
|
3429
|
-
}),
|
|
2727
|
+
input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
|
|
2728
|
+
kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
|
|
3430
2729
|
link: {
|
|
3431
2730
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
3432
2731
|
},
|
|
@@ -3439,20 +2738,12 @@ function renderThemeColor(value, options) {
|
|
|
3439
2738
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
3440
2739
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
3441
2740
|
},
|
|
3442
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3443
|
-
baseBg,
|
|
3444
|
-
colorPalette,
|
|
3445
|
-
blendMode
|
|
3446
|
-
}),
|
|
2741
|
+
syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
|
|
3447
2742
|
selectable
|
|
3448
2743
|
};
|
|
3449
2744
|
}
|
|
3450
2745
|
function renderThemeColorKBD(value, options) {
|
|
3451
|
-
const {
|
|
3452
|
-
baseBg,
|
|
3453
|
-
blendMode,
|
|
3454
|
-
colorPalette
|
|
3455
|
-
} = options, rootOptions = {
|
|
2746
|
+
const { baseBg, blendMode, colorPalette } = options, rootOptions = {
|
|
3456
2747
|
bg: baseBg,
|
|
3457
2748
|
blendMode,
|
|
3458
2749
|
colorPalette
|
|
@@ -3481,11 +2772,7 @@ function renderThemeColorAvatar(value, options) {
|
|
|
3481
2772
|
};
|
|
3482
2773
|
}
|
|
3483
2774
|
function renderThemeColorAvatarColor(value, options) {
|
|
3484
|
-
const {
|
|
3485
|
-
baseBg,
|
|
3486
|
-
blendMode: rootBlendMode,
|
|
3487
|
-
colorPalette
|
|
3488
|
-
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2775
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3489
2776
|
bg: baseBg,
|
|
3490
2777
|
blendMode: rootBlendMode,
|
|
3491
2778
|
colorPalette
|
|
@@ -3510,11 +2797,7 @@ function renderThemeColorBadge(value, options) {
|
|
|
3510
2797
|
};
|
|
3511
2798
|
}
|
|
3512
2799
|
function renderThemeColorBadgeColor(value, options) {
|
|
3513
|
-
const {
|
|
3514
|
-
baseBg,
|
|
3515
|
-
blendMode: rootBlendMode,
|
|
3516
|
-
colorPalette
|
|
3517
|
-
} = options, blendMode = rootBlendMode, rootOptions = {
|
|
2800
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
|
|
3518
2801
|
bg: baseBg,
|
|
3519
2802
|
blendMode: rootBlendMode,
|
|
3520
2803
|
colorPalette
|
|
@@ -3556,11 +2839,7 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
3556
2839
|
};
|
|
3557
2840
|
}
|
|
3558
2841
|
function renderThemeColorState(value, options) {
|
|
3559
|
-
const {
|
|
3560
|
-
baseBg,
|
|
3561
|
-
blendMode: rootBlendMode,
|
|
3562
|
-
colorPalette
|
|
3563
|
-
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2842
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3564
2843
|
bg: baseBg,
|
|
3565
2844
|
blendMode: rootBlendMode,
|
|
3566
2845
|
colorPalette
|
|
@@ -3574,16 +2853,8 @@ function renderThemeColorState(value, options) {
|
|
|
3574
2853
|
accent: {
|
|
3575
2854
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
3576
2855
|
},
|
|
3577
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3578
|
-
|
|
3579
|
-
colorPalette,
|
|
3580
|
-
blendMode
|
|
3581
|
-
}),
|
|
3582
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
3583
|
-
baseBg: bg,
|
|
3584
|
-
colorPalette,
|
|
3585
|
-
blendMode
|
|
3586
|
-
}),
|
|
2856
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg: bg, colorPalette, blendMode }),
|
|
2857
|
+
badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
|
|
3587
2858
|
bg,
|
|
3588
2859
|
border: renderColorValue(value.border, colorOptions),
|
|
3589
2860
|
code: {
|
|
@@ -3625,19 +2896,7 @@ function renderInputStatesColorTheme(value, options) {
|
|
|
3625
2896
|
};
|
|
3626
2897
|
}
|
|
3627
2898
|
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
|
-
};
|
|
2899
|
+
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
2900
|
return {
|
|
3642
2901
|
_blend: blendMode,
|
|
3643
2902
|
bg,
|
|
@@ -3668,15 +2927,7 @@ function renderThemeColorSelectableStates(value, options) {
|
|
|
3668
2927
|
};
|
|
3669
2928
|
}
|
|
3670
2929
|
function renderSyntaxColorTheme(value, options) {
|
|
3671
|
-
const {
|
|
3672
|
-
colorPalette,
|
|
3673
|
-
baseBg,
|
|
3674
|
-
blendMode
|
|
3675
|
-
} = options, colorOptions = {
|
|
3676
|
-
colorPalette,
|
|
3677
|
-
bg: baseBg,
|
|
3678
|
-
blendMode
|
|
3679
|
-
};
|
|
2930
|
+
const { colorPalette, baseBg, blendMode } = options, colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
3680
2931
|
return {
|
|
3681
2932
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
3682
2933
|
attrName: renderColorValue(value.attrName, colorOptions),
|