@sanity/ui 2.0.2 → 2.0.3
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/index.d.ts +4 -330
- package/dist/index.esm.js +3984 -4410
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3976 -4405
- package/dist/index.js.map +1 -1
- package/dist/theme.esm.js +622 -1387
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +624 -1390
- package/dist/theme.js.map +1 -1
- package/package.json +92 -91
- package/src/core/components/dialog/dialog.tsx +10 -2
- package/src/core/components/toast/toastProvider.tsx +76 -61
- package/src/core/hooks/useMounted.ts +8 -7
- package/src/core/primitives/avatar/styles.ts +0 -3
- package/src/core/primitives/popover/popover.tsx +10 -2
- package/src/core/primitives/tooltip/tooltip.tsx +4 -2
package/dist/theme.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
|
|
5
|
-
});
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
6
5
|
var color = require('@sanity/color');
|
|
6
|
+
|
|
7
7
|
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
8
8
|
return {
|
|
9
9
|
default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
|
|
@@ -57,232 +57,54 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
|
57
57
|
})
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
|
|
60
61
|
function createSolidTones(opts, base, dark, name) {
|
|
61
62
|
return {
|
|
62
63
|
default: {
|
|
63
|
-
enabled: opts.solid({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
state: "enabled"
|
|
69
|
-
}),
|
|
70
|
-
disabled: opts.solid({
|
|
71
|
-
base,
|
|
72
|
-
dark,
|
|
73
|
-
tone: "default",
|
|
74
|
-
name,
|
|
75
|
-
state: "disabled"
|
|
76
|
-
}),
|
|
77
|
-
hovered: opts.solid({
|
|
78
|
-
base,
|
|
79
|
-
dark,
|
|
80
|
-
tone: "default",
|
|
81
|
-
name,
|
|
82
|
-
state: "hovered"
|
|
83
|
-
}),
|
|
84
|
-
pressed: opts.solid({
|
|
85
|
-
base,
|
|
86
|
-
dark,
|
|
87
|
-
tone: "default",
|
|
88
|
-
name,
|
|
89
|
-
state: "pressed"
|
|
90
|
-
}),
|
|
91
|
-
selected: opts.solid({
|
|
92
|
-
base,
|
|
93
|
-
dark,
|
|
94
|
-
tone: "default",
|
|
95
|
-
name,
|
|
96
|
-
state: "selected"
|
|
97
|
-
})
|
|
64
|
+
enabled: opts.solid({ base, dark, tone: "default", name, state: "enabled" }),
|
|
65
|
+
disabled: opts.solid({ base, dark, tone: "default", name, state: "disabled" }),
|
|
66
|
+
hovered: opts.solid({ base, dark, tone: "default", name, state: "hovered" }),
|
|
67
|
+
pressed: opts.solid({ base, dark, tone: "default", name, state: "pressed" }),
|
|
68
|
+
selected: opts.solid({ base, dark, tone: "default", name, state: "selected" })
|
|
98
69
|
},
|
|
99
70
|
transparent: {
|
|
100
|
-
enabled: opts.solid({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
state: "enabled"
|
|
106
|
-
}),
|
|
107
|
-
disabled: opts.solid({
|
|
108
|
-
base,
|
|
109
|
-
dark,
|
|
110
|
-
tone: "transparent",
|
|
111
|
-
name,
|
|
112
|
-
state: "disabled"
|
|
113
|
-
}),
|
|
114
|
-
hovered: opts.solid({
|
|
115
|
-
base,
|
|
116
|
-
dark,
|
|
117
|
-
tone: "transparent",
|
|
118
|
-
name,
|
|
119
|
-
state: "hovered"
|
|
120
|
-
}),
|
|
121
|
-
pressed: opts.solid({
|
|
122
|
-
base,
|
|
123
|
-
dark,
|
|
124
|
-
tone: "transparent",
|
|
125
|
-
name,
|
|
126
|
-
state: "pressed"
|
|
127
|
-
}),
|
|
128
|
-
selected: opts.solid({
|
|
129
|
-
base,
|
|
130
|
-
dark,
|
|
131
|
-
tone: "transparent",
|
|
132
|
-
name,
|
|
133
|
-
state: "selected"
|
|
134
|
-
})
|
|
71
|
+
enabled: opts.solid({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
72
|
+
disabled: opts.solid({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
73
|
+
hovered: opts.solid({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
74
|
+
pressed: opts.solid({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
75
|
+
selected: opts.solid({ base, dark, tone: "transparent", name, state: "selected" })
|
|
135
76
|
},
|
|
136
77
|
primary: {
|
|
137
|
-
enabled: opts.solid({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
state: "enabled"
|
|
143
|
-
}),
|
|
144
|
-
disabled: opts.solid({
|
|
145
|
-
base,
|
|
146
|
-
dark,
|
|
147
|
-
tone: "primary",
|
|
148
|
-
name,
|
|
149
|
-
state: "disabled"
|
|
150
|
-
}),
|
|
151
|
-
hovered: opts.solid({
|
|
152
|
-
base,
|
|
153
|
-
dark,
|
|
154
|
-
tone: "primary",
|
|
155
|
-
name,
|
|
156
|
-
state: "hovered"
|
|
157
|
-
}),
|
|
158
|
-
pressed: opts.solid({
|
|
159
|
-
base,
|
|
160
|
-
dark,
|
|
161
|
-
tone: "primary",
|
|
162
|
-
name,
|
|
163
|
-
state: "pressed"
|
|
164
|
-
}),
|
|
165
|
-
selected: opts.solid({
|
|
166
|
-
base,
|
|
167
|
-
dark,
|
|
168
|
-
tone: "primary",
|
|
169
|
-
name,
|
|
170
|
-
state: "selected"
|
|
171
|
-
})
|
|
78
|
+
enabled: opts.solid({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
79
|
+
disabled: opts.solid({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
80
|
+
hovered: opts.solid({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
81
|
+
pressed: opts.solid({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
82
|
+
selected: opts.solid({ base, dark, tone: "primary", name, state: "selected" })
|
|
172
83
|
},
|
|
173
84
|
positive: {
|
|
174
|
-
enabled: opts.solid({
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
state: "enabled"
|
|
180
|
-
}),
|
|
181
|
-
disabled: opts.solid({
|
|
182
|
-
base,
|
|
183
|
-
dark,
|
|
184
|
-
tone: "positive",
|
|
185
|
-
name,
|
|
186
|
-
state: "disabled"
|
|
187
|
-
}),
|
|
188
|
-
hovered: opts.solid({
|
|
189
|
-
base,
|
|
190
|
-
dark,
|
|
191
|
-
tone: "positive",
|
|
192
|
-
name,
|
|
193
|
-
state: "hovered"
|
|
194
|
-
}),
|
|
195
|
-
pressed: opts.solid({
|
|
196
|
-
base,
|
|
197
|
-
dark,
|
|
198
|
-
tone: "positive",
|
|
199
|
-
name,
|
|
200
|
-
state: "pressed"
|
|
201
|
-
}),
|
|
202
|
-
selected: opts.solid({
|
|
203
|
-
base,
|
|
204
|
-
dark,
|
|
205
|
-
tone: "positive",
|
|
206
|
-
name,
|
|
207
|
-
state: "selected"
|
|
208
|
-
})
|
|
85
|
+
enabled: opts.solid({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
86
|
+
disabled: opts.solid({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
87
|
+
hovered: opts.solid({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
88
|
+
pressed: opts.solid({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
89
|
+
selected: opts.solid({ base, dark, tone: "positive", name, state: "selected" })
|
|
209
90
|
},
|
|
210
91
|
caution: {
|
|
211
|
-
enabled: opts.solid({
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
state: "enabled"
|
|
217
|
-
}),
|
|
218
|
-
disabled: opts.solid({
|
|
219
|
-
base,
|
|
220
|
-
dark,
|
|
221
|
-
tone: "caution",
|
|
222
|
-
name,
|
|
223
|
-
state: "disabled"
|
|
224
|
-
}),
|
|
225
|
-
hovered: opts.solid({
|
|
226
|
-
base,
|
|
227
|
-
dark,
|
|
228
|
-
tone: "caution",
|
|
229
|
-
name,
|
|
230
|
-
state: "hovered"
|
|
231
|
-
}),
|
|
232
|
-
pressed: opts.solid({
|
|
233
|
-
base,
|
|
234
|
-
dark,
|
|
235
|
-
tone: "caution",
|
|
236
|
-
name,
|
|
237
|
-
state: "pressed"
|
|
238
|
-
}),
|
|
239
|
-
selected: opts.solid({
|
|
240
|
-
base,
|
|
241
|
-
dark,
|
|
242
|
-
tone: "caution",
|
|
243
|
-
name,
|
|
244
|
-
state: "selected"
|
|
245
|
-
})
|
|
92
|
+
enabled: opts.solid({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
93
|
+
disabled: opts.solid({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
94
|
+
hovered: opts.solid({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
95
|
+
pressed: opts.solid({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
96
|
+
selected: opts.solid({ base, dark, tone: "caution", name, state: "selected" })
|
|
246
97
|
},
|
|
247
98
|
critical: {
|
|
248
|
-
enabled: opts.solid({
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
state: "enabled"
|
|
254
|
-
}),
|
|
255
|
-
disabled: opts.solid({
|
|
256
|
-
base,
|
|
257
|
-
dark,
|
|
258
|
-
tone: "critical",
|
|
259
|
-
name,
|
|
260
|
-
state: "disabled"
|
|
261
|
-
}),
|
|
262
|
-
hovered: opts.solid({
|
|
263
|
-
base,
|
|
264
|
-
dark,
|
|
265
|
-
tone: "critical",
|
|
266
|
-
name,
|
|
267
|
-
state: "hovered"
|
|
268
|
-
}),
|
|
269
|
-
pressed: opts.solid({
|
|
270
|
-
base,
|
|
271
|
-
dark,
|
|
272
|
-
tone: "critical",
|
|
273
|
-
name,
|
|
274
|
-
state: "pressed"
|
|
275
|
-
}),
|
|
276
|
-
selected: opts.solid({
|
|
277
|
-
base,
|
|
278
|
-
dark,
|
|
279
|
-
tone: "critical",
|
|
280
|
-
name,
|
|
281
|
-
state: "selected"
|
|
282
|
-
})
|
|
99
|
+
enabled: opts.solid({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
100
|
+
disabled: opts.solid({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
101
|
+
hovered: opts.solid({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
102
|
+
pressed: opts.solid({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
103
|
+
selected: opts.solid({ base, dark, tone: "critical", name, state: "selected" })
|
|
283
104
|
}
|
|
284
105
|
};
|
|
285
106
|
}
|
|
107
|
+
|
|
286
108
|
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
287
109
|
return {
|
|
288
110
|
default: opts.button({
|
|
@@ -322,6 +144,7 @@ function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
|
322
144
|
})
|
|
323
145
|
};
|
|
324
146
|
}
|
|
147
|
+
|
|
325
148
|
function createButtonModes(opts, base, dark, solid, muted) {
|
|
326
149
|
return {
|
|
327
150
|
default: createButtonTones(opts, base, dark, solid, muted, "default"),
|
|
@@ -329,6 +152,7 @@ function createButtonModes(opts, base, dark, solid, muted) {
|
|
|
329
152
|
bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
|
|
330
153
|
};
|
|
331
154
|
}
|
|
155
|
+
|
|
332
156
|
function createCardStates(opts, base, dark, name, solid, muted) {
|
|
333
157
|
return {
|
|
334
158
|
enabled: opts.card({
|
|
@@ -373,6 +197,7 @@ function createCardStates(opts, base, dark, name, solid, muted) {
|
|
|
373
197
|
})
|
|
374
198
|
};
|
|
375
199
|
}
|
|
200
|
+
|
|
376
201
|
const black = "hsl(0, 0%, 0%)";
|
|
377
202
|
const white = "hsl(0, 0%, 100%)";
|
|
378
203
|
const colors = {
|
|
@@ -475,11 +300,7 @@ const tones = {
|
|
|
475
300
|
}
|
|
476
301
|
};
|
|
477
302
|
const defaultOpts = {
|
|
478
|
-
base:
|
|
479
|
-
let {
|
|
480
|
-
dark,
|
|
481
|
-
name
|
|
482
|
-
} = _ref;
|
|
303
|
+
base: ({ dark, name }) => {
|
|
483
304
|
if (name === "default") {
|
|
484
305
|
return {
|
|
485
306
|
bg: dark ? black : white,
|
|
@@ -515,13 +336,7 @@ const defaultOpts = {
|
|
|
515
336
|
}
|
|
516
337
|
};
|
|
517
338
|
},
|
|
518
|
-
solid:
|
|
519
|
-
let {
|
|
520
|
-
base,
|
|
521
|
-
dark,
|
|
522
|
-
state,
|
|
523
|
-
tone
|
|
524
|
-
} = _ref2;
|
|
339
|
+
solid: ({ base, dark, state, tone }) => {
|
|
525
340
|
const color = colors[tone];
|
|
526
341
|
if (state === "hovered") {
|
|
527
342
|
return {
|
|
@@ -568,13 +383,7 @@ const defaultOpts = {
|
|
|
568
383
|
skeleton: base.skeleton
|
|
569
384
|
};
|
|
570
385
|
},
|
|
571
|
-
muted:
|
|
572
|
-
let {
|
|
573
|
-
base,
|
|
574
|
-
dark,
|
|
575
|
-
state,
|
|
576
|
-
tone
|
|
577
|
-
} = _ref3;
|
|
386
|
+
muted: ({ base, dark, state, tone }) => {
|
|
578
387
|
const color = colors[tone];
|
|
579
388
|
if (state === "hovered") {
|
|
580
389
|
return {
|
|
@@ -621,13 +430,7 @@ const defaultOpts = {
|
|
|
621
430
|
skeleton: base.skeleton
|
|
622
431
|
};
|
|
623
432
|
},
|
|
624
|
-
button:
|
|
625
|
-
let {
|
|
626
|
-
base,
|
|
627
|
-
mode,
|
|
628
|
-
muted,
|
|
629
|
-
solid
|
|
630
|
-
} = _ref4;
|
|
433
|
+
button: ({ base, mode, muted, solid }) => {
|
|
631
434
|
if (mode === "bleed") {
|
|
632
435
|
return {
|
|
633
436
|
...muted,
|
|
@@ -675,16 +478,14 @@ const defaultOpts = {
|
|
|
675
478
|
}
|
|
676
479
|
};
|
|
677
480
|
}
|
|
678
|
-
if (mode === "ghost")
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
481
|
+
if (mode === "ghost")
|
|
482
|
+
return {
|
|
483
|
+
...solid,
|
|
484
|
+
enabled: muted.enabled
|
|
485
|
+
};
|
|
682
486
|
return solid;
|
|
683
487
|
},
|
|
684
|
-
card:
|
|
685
|
-
let {
|
|
686
|
-
base
|
|
687
|
-
} = _ref5;
|
|
488
|
+
card: ({ base }) => {
|
|
688
489
|
return {
|
|
689
490
|
bg: black,
|
|
690
491
|
bg2: black,
|
|
@@ -716,18 +517,10 @@ const defaultOpts = {
|
|
|
716
517
|
placeholder: black
|
|
717
518
|
};
|
|
718
519
|
},
|
|
719
|
-
selectable:
|
|
720
|
-
let {
|
|
721
|
-
muted,
|
|
722
|
-
state,
|
|
723
|
-
tone
|
|
724
|
-
} = _ref6;
|
|
520
|
+
selectable: ({ muted, state, tone }) => {
|
|
725
521
|
return muted[tone][state];
|
|
726
522
|
},
|
|
727
|
-
spot:
|
|
728
|
-
let {
|
|
729
|
-
key
|
|
730
|
-
} = _ref7;
|
|
523
|
+
spot: ({ key }) => {
|
|
731
524
|
return spots[key];
|
|
732
525
|
},
|
|
733
526
|
syntax: () => ({
|
|
@@ -769,6 +562,7 @@ const defaultOpts = {
|
|
|
769
562
|
variable: black
|
|
770
563
|
})
|
|
771
564
|
};
|
|
565
|
+
|
|
772
566
|
function createInputModes(opts, base, dark, solid, muted) {
|
|
773
567
|
return {
|
|
774
568
|
default: {
|
|
@@ -841,287 +635,70 @@ function createInputModes(opts, base, dark, solid, muted) {
|
|
|
841
635
|
}
|
|
842
636
|
};
|
|
843
637
|
}
|
|
638
|
+
|
|
844
639
|
function createMutedTones(opts, base, dark, name) {
|
|
845
640
|
return {
|
|
846
641
|
default: {
|
|
847
|
-
enabled: opts.muted({
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
state: "enabled"
|
|
853
|
-
}),
|
|
854
|
-
disabled: opts.muted({
|
|
855
|
-
base,
|
|
856
|
-
dark,
|
|
857
|
-
tone: "default",
|
|
858
|
-
name,
|
|
859
|
-
state: "disabled"
|
|
860
|
-
}),
|
|
861
|
-
hovered: opts.muted({
|
|
862
|
-
base,
|
|
863
|
-
dark,
|
|
864
|
-
tone: "default",
|
|
865
|
-
name,
|
|
866
|
-
state: "hovered"
|
|
867
|
-
}),
|
|
868
|
-
pressed: opts.muted({
|
|
869
|
-
base,
|
|
870
|
-
dark,
|
|
871
|
-
tone: "default",
|
|
872
|
-
name,
|
|
873
|
-
state: "pressed"
|
|
874
|
-
}),
|
|
875
|
-
selected: opts.muted({
|
|
876
|
-
base,
|
|
877
|
-
dark,
|
|
878
|
-
tone: "default",
|
|
879
|
-
name,
|
|
880
|
-
state: "selected"
|
|
881
|
-
})
|
|
642
|
+
enabled: opts.muted({ base, dark, tone: "default", name, state: "enabled" }),
|
|
643
|
+
disabled: opts.muted({ base, dark, tone: "default", name, state: "disabled" }),
|
|
644
|
+
hovered: opts.muted({ base, dark, tone: "default", name, state: "hovered" }),
|
|
645
|
+
pressed: opts.muted({ base, dark, tone: "default", name, state: "pressed" }),
|
|
646
|
+
selected: opts.muted({ base, dark, tone: "default", name, state: "selected" })
|
|
882
647
|
},
|
|
883
648
|
transparent: {
|
|
884
|
-
enabled: opts.muted({
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
state: "enabled"
|
|
890
|
-
}),
|
|
891
|
-
disabled: opts.muted({
|
|
892
|
-
base,
|
|
893
|
-
dark,
|
|
894
|
-
tone: "transparent",
|
|
895
|
-
name,
|
|
896
|
-
state: "disabled"
|
|
897
|
-
}),
|
|
898
|
-
hovered: opts.muted({
|
|
899
|
-
base,
|
|
900
|
-
dark,
|
|
901
|
-
tone: "transparent",
|
|
902
|
-
name,
|
|
903
|
-
state: "hovered"
|
|
904
|
-
}),
|
|
905
|
-
pressed: opts.muted({
|
|
906
|
-
base,
|
|
907
|
-
dark,
|
|
908
|
-
tone: "transparent",
|
|
909
|
-
name,
|
|
910
|
-
state: "pressed"
|
|
911
|
-
}),
|
|
912
|
-
selected: opts.muted({
|
|
913
|
-
base,
|
|
914
|
-
dark,
|
|
915
|
-
tone: "transparent",
|
|
916
|
-
name,
|
|
917
|
-
state: "selected"
|
|
918
|
-
})
|
|
649
|
+
enabled: opts.muted({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
650
|
+
disabled: opts.muted({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
651
|
+
hovered: opts.muted({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
652
|
+
pressed: opts.muted({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
653
|
+
selected: opts.muted({ base, dark, tone: "transparent", name, state: "selected" })
|
|
919
654
|
},
|
|
920
655
|
primary: {
|
|
921
|
-
enabled: opts.muted({
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
state: "enabled"
|
|
927
|
-
}),
|
|
928
|
-
disabled: opts.muted({
|
|
929
|
-
base,
|
|
930
|
-
dark,
|
|
931
|
-
tone: "primary",
|
|
932
|
-
name,
|
|
933
|
-
state: "disabled"
|
|
934
|
-
}),
|
|
935
|
-
hovered: opts.muted({
|
|
936
|
-
base,
|
|
937
|
-
dark,
|
|
938
|
-
tone: "primary",
|
|
939
|
-
name,
|
|
940
|
-
state: "hovered"
|
|
941
|
-
}),
|
|
942
|
-
pressed: opts.muted({
|
|
943
|
-
base,
|
|
944
|
-
dark,
|
|
945
|
-
tone: "primary",
|
|
946
|
-
name,
|
|
947
|
-
state: "pressed"
|
|
948
|
-
}),
|
|
949
|
-
selected: opts.muted({
|
|
950
|
-
base,
|
|
951
|
-
dark,
|
|
952
|
-
tone: "primary",
|
|
953
|
-
name,
|
|
954
|
-
state: "selected"
|
|
955
|
-
})
|
|
656
|
+
enabled: opts.muted({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
657
|
+
disabled: opts.muted({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
658
|
+
hovered: opts.muted({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
659
|
+
pressed: opts.muted({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
660
|
+
selected: opts.muted({ base, dark, tone: "primary", name, state: "selected" })
|
|
956
661
|
},
|
|
957
662
|
positive: {
|
|
958
|
-
enabled: opts.muted({
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
state: "enabled"
|
|
964
|
-
}),
|
|
965
|
-
disabled: opts.muted({
|
|
966
|
-
base,
|
|
967
|
-
dark,
|
|
968
|
-
tone: "positive",
|
|
969
|
-
name,
|
|
970
|
-
state: "disabled"
|
|
971
|
-
}),
|
|
972
|
-
hovered: opts.muted({
|
|
973
|
-
base,
|
|
974
|
-
dark,
|
|
975
|
-
tone: "positive",
|
|
976
|
-
name,
|
|
977
|
-
state: "hovered"
|
|
978
|
-
}),
|
|
979
|
-
pressed: opts.muted({
|
|
980
|
-
base,
|
|
981
|
-
dark,
|
|
982
|
-
tone: "positive",
|
|
983
|
-
name,
|
|
984
|
-
state: "pressed"
|
|
985
|
-
}),
|
|
986
|
-
selected: opts.muted({
|
|
987
|
-
base,
|
|
988
|
-
dark,
|
|
989
|
-
tone: "positive",
|
|
990
|
-
name,
|
|
991
|
-
state: "selected"
|
|
992
|
-
})
|
|
663
|
+
enabled: opts.muted({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
664
|
+
disabled: opts.muted({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
665
|
+
hovered: opts.muted({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
666
|
+
pressed: opts.muted({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
667
|
+
selected: opts.muted({ base, dark, tone: "positive", name, state: "selected" })
|
|
993
668
|
},
|
|
994
669
|
caution: {
|
|
995
|
-
enabled: opts.muted({
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
state: "enabled"
|
|
1001
|
-
}),
|
|
1002
|
-
disabled: opts.muted({
|
|
1003
|
-
base,
|
|
1004
|
-
dark,
|
|
1005
|
-
tone: "caution",
|
|
1006
|
-
name,
|
|
1007
|
-
state: "disabled"
|
|
1008
|
-
}),
|
|
1009
|
-
hovered: opts.muted({
|
|
1010
|
-
base,
|
|
1011
|
-
dark,
|
|
1012
|
-
tone: "caution",
|
|
1013
|
-
name,
|
|
1014
|
-
state: "hovered"
|
|
1015
|
-
}),
|
|
1016
|
-
pressed: opts.muted({
|
|
1017
|
-
base,
|
|
1018
|
-
dark,
|
|
1019
|
-
tone: "caution",
|
|
1020
|
-
name,
|
|
1021
|
-
state: "pressed"
|
|
1022
|
-
}),
|
|
1023
|
-
selected: opts.muted({
|
|
1024
|
-
base,
|
|
1025
|
-
dark,
|
|
1026
|
-
tone: "caution",
|
|
1027
|
-
name,
|
|
1028
|
-
state: "selected"
|
|
1029
|
-
})
|
|
670
|
+
enabled: opts.muted({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
671
|
+
disabled: opts.muted({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
672
|
+
hovered: opts.muted({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
673
|
+
pressed: opts.muted({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
674
|
+
selected: opts.muted({ base, dark, tone: "caution", name, state: "selected" })
|
|
1030
675
|
},
|
|
1031
676
|
critical: {
|
|
1032
|
-
enabled: opts.muted({
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
state: "enabled"
|
|
1038
|
-
}),
|
|
1039
|
-
disabled: opts.muted({
|
|
1040
|
-
base,
|
|
1041
|
-
dark,
|
|
1042
|
-
tone: "critical",
|
|
1043
|
-
name,
|
|
1044
|
-
state: "disabled"
|
|
1045
|
-
}),
|
|
1046
|
-
hovered: opts.muted({
|
|
1047
|
-
base,
|
|
1048
|
-
dark,
|
|
1049
|
-
tone: "critical",
|
|
1050
|
-
name,
|
|
1051
|
-
state: "hovered"
|
|
1052
|
-
}),
|
|
1053
|
-
pressed: opts.muted({
|
|
1054
|
-
base,
|
|
1055
|
-
dark,
|
|
1056
|
-
tone: "critical",
|
|
1057
|
-
name,
|
|
1058
|
-
state: "pressed"
|
|
1059
|
-
}),
|
|
1060
|
-
selected: opts.muted({
|
|
1061
|
-
base,
|
|
1062
|
-
dark,
|
|
1063
|
-
tone: "critical",
|
|
1064
|
-
name,
|
|
1065
|
-
state: "selected"
|
|
1066
|
-
})
|
|
677
|
+
enabled: opts.muted({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
678
|
+
disabled: opts.muted({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
679
|
+
hovered: opts.muted({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
680
|
+
pressed: opts.muted({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
681
|
+
selected: opts.muted({ base, dark, tone: "critical", name, state: "selected" })
|
|
1067
682
|
}
|
|
1068
683
|
};
|
|
1069
684
|
}
|
|
685
|
+
|
|
1070
686
|
function createSpot(opts, base, dark) {
|
|
1071
687
|
return {
|
|
1072
|
-
gray: opts.spot({
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}),
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
}),
|
|
1082
|
-
purple: opts.spot({
|
|
1083
|
-
base,
|
|
1084
|
-
dark,
|
|
1085
|
-
key: "purple"
|
|
1086
|
-
}),
|
|
1087
|
-
magenta: opts.spot({
|
|
1088
|
-
base,
|
|
1089
|
-
dark,
|
|
1090
|
-
key: "magenta"
|
|
1091
|
-
}),
|
|
1092
|
-
red: opts.spot({
|
|
1093
|
-
base,
|
|
1094
|
-
dark,
|
|
1095
|
-
key: "red"
|
|
1096
|
-
}),
|
|
1097
|
-
orange: opts.spot({
|
|
1098
|
-
base,
|
|
1099
|
-
dark,
|
|
1100
|
-
key: "orange"
|
|
1101
|
-
}),
|
|
1102
|
-
yellow: opts.spot({
|
|
1103
|
-
base,
|
|
1104
|
-
dark,
|
|
1105
|
-
key: "yellow"
|
|
1106
|
-
}),
|
|
1107
|
-
green: opts.spot({
|
|
1108
|
-
base,
|
|
1109
|
-
dark,
|
|
1110
|
-
key: "green"
|
|
1111
|
-
}),
|
|
1112
|
-
cyan: opts.spot({
|
|
1113
|
-
base,
|
|
1114
|
-
dark,
|
|
1115
|
-
key: "cyan"
|
|
1116
|
-
})
|
|
688
|
+
gray: opts.spot({ base, dark, key: "gray" }),
|
|
689
|
+
blue: opts.spot({ base, dark, key: "blue" }),
|
|
690
|
+
purple: opts.spot({ base, dark, key: "purple" }),
|
|
691
|
+
magenta: opts.spot({ base, dark, key: "magenta" }),
|
|
692
|
+
red: opts.spot({ base, dark, key: "red" }),
|
|
693
|
+
orange: opts.spot({ base, dark, key: "orange" }),
|
|
694
|
+
yellow: opts.spot({ base, dark, key: "yellow" }),
|
|
695
|
+
green: opts.spot({ base, dark, key: "green" }),
|
|
696
|
+
cyan: opts.spot({ base, dark, key: "cyan" })
|
|
1117
697
|
};
|
|
1118
698
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
const builders = {
|
|
1122
|
-
...defaultOpts,
|
|
1123
|
-
...partialOpts
|
|
1124
|
-
};
|
|
699
|
+
|
|
700
|
+
function createColorTheme(partialOpts = {}) {
|
|
701
|
+
const builders = { ...defaultOpts, ...partialOpts };
|
|
1125
702
|
return {
|
|
1126
703
|
light: _createColorScheme(builders, false),
|
|
1127
704
|
dark: _createColorScheme(builders, true)
|
|
@@ -1138,10 +715,7 @@ function _createColorScheme(opts, dark) {
|
|
|
1138
715
|
};
|
|
1139
716
|
}
|
|
1140
717
|
function _createColor(opts, dark, name) {
|
|
1141
|
-
const base = opts.base({
|
|
1142
|
-
dark,
|
|
1143
|
-
name
|
|
1144
|
-
});
|
|
718
|
+
const base = opts.base({ dark, name });
|
|
1145
719
|
const solid = createSolidTones(opts, base, dark, name);
|
|
1146
720
|
const muted = createMutedTones(opts, base, dark, name);
|
|
1147
721
|
return {
|
|
@@ -1152,94 +726,51 @@ function _createColor(opts, dark, name) {
|
|
|
1152
726
|
input: createInputModes(opts, base, dark, solid, muted),
|
|
1153
727
|
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
1154
728
|
spot: createSpot(opts, base, dark),
|
|
1155
|
-
syntax: opts.syntax({
|
|
1156
|
-
base,
|
|
1157
|
-
dark
|
|
1158
|
-
}),
|
|
729
|
+
syntax: opts.syntax({ base, dark }),
|
|
1159
730
|
solid,
|
|
1160
731
|
muted
|
|
1161
732
|
};
|
|
1162
733
|
}
|
|
734
|
+
|
|
1163
735
|
const BORDER_WIDTH = 1;
|
|
1164
736
|
const OUTLINE_WIDTH = 0.5;
|
|
1165
737
|
const defaultThemeConfig = {
|
|
1166
738
|
_version: 2,
|
|
1167
739
|
avatar: {
|
|
1168
|
-
sizes: [
|
|
1169
|
-
distance: -4,
|
|
1170
|
-
size:
|
|
1171
|
-
|
|
1172
|
-
distance: -
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
distance: -8,
|
|
1176
|
-
size: 33
|
|
1177
|
-
}, {
|
|
1178
|
-
distance: -12,
|
|
1179
|
-
size: 49
|
|
1180
|
-
}],
|
|
1181
|
-
focusRing: {
|
|
1182
|
-
offset: 1,
|
|
1183
|
-
width: 1
|
|
1184
|
-
}
|
|
740
|
+
sizes: [
|
|
741
|
+
{ distance: -4, size: 19 },
|
|
742
|
+
{ distance: -4, size: 25 },
|
|
743
|
+
{ distance: -8, size: 33 },
|
|
744
|
+
{ distance: -12, size: 49 }
|
|
745
|
+
],
|
|
746
|
+
focusRing: { offset: 1, width: 1 }
|
|
1185
747
|
},
|
|
1186
748
|
button: {
|
|
1187
749
|
textWeight: "medium",
|
|
1188
|
-
border: {
|
|
1189
|
-
|
|
1190
|
-
},
|
|
1191
|
-
focusRing: {
|
|
1192
|
-
offset: -1,
|
|
1193
|
-
width: 1
|
|
1194
|
-
}
|
|
750
|
+
border: { width: BORDER_WIDTH },
|
|
751
|
+
focusRing: { offset: -1, width: 1 }
|
|
1195
752
|
},
|
|
1196
753
|
card: {
|
|
1197
|
-
border: {
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
focusRing: {
|
|
1201
|
-
offset: -1,
|
|
1202
|
-
width: 1
|
|
1203
|
-
},
|
|
1204
|
-
shadow: {
|
|
1205
|
-
outline: OUTLINE_WIDTH
|
|
1206
|
-
}
|
|
754
|
+
border: { width: BORDER_WIDTH },
|
|
755
|
+
focusRing: { offset: -1, width: 1 },
|
|
756
|
+
shadow: { outline: OUTLINE_WIDTH }
|
|
1207
757
|
},
|
|
1208
758
|
container: [320, 640, 960, 1280, 1600, 1920],
|
|
1209
759
|
media: [360, 600, 900, 1200, 1800, 2400],
|
|
1210
760
|
layer: {
|
|
1211
|
-
dialog: {
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
popover: {
|
|
1215
|
-
zOffset: 400
|
|
1216
|
-
},
|
|
1217
|
-
tooltip: {
|
|
1218
|
-
zOffset: 200
|
|
1219
|
-
}
|
|
761
|
+
dialog: { zOffset: 600 },
|
|
762
|
+
popover: { zOffset: 400 },
|
|
763
|
+
tooltip: { zOffset: 200 }
|
|
1220
764
|
},
|
|
1221
765
|
radius: [0, 1, 3, 6, 9, 12, 21],
|
|
1222
|
-
shadow: [
|
|
1223
|
-
|
|
1224
|
-
penumbra: [0, 0, 0, 0],
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
umbra: [0,
|
|
1228
|
-
penumbra: [0,
|
|
1229
|
-
|
|
1230
|
-
}, {
|
|
1231
|
-
umbra: [0, 7, 8, -4],
|
|
1232
|
-
penumbra: [0, 12, 17, 2],
|
|
1233
|
-
ambient: [0, 5, 22, 4]
|
|
1234
|
-
}, {
|
|
1235
|
-
umbra: [0, 9, 11, -5],
|
|
1236
|
-
penumbra: [0, 18, 28, 2],
|
|
1237
|
-
ambient: [0, 7, 34, 6]
|
|
1238
|
-
}, {
|
|
1239
|
-
umbra: [0, 11, 15, -7],
|
|
1240
|
-
penumbra: [0, 24, 38, 3],
|
|
1241
|
-
ambient: [0, 9, 46, 8]
|
|
1242
|
-
}],
|
|
766
|
+
shadow: [
|
|
767
|
+
null,
|
|
768
|
+
{ umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0] },
|
|
769
|
+
{ umbra: [0, 3, 5, -2], penumbra: [0, 6, 10, 0], ambient: [0, 1, 18, 1] },
|
|
770
|
+
{ umbra: [0, 7, 8, -4], penumbra: [0, 12, 17, 2], ambient: [0, 5, 22, 4] },
|
|
771
|
+
{ umbra: [0, 9, 11, -5], penumbra: [0, 18, 28, 2], ambient: [0, 7, 34, 6] },
|
|
772
|
+
{ umbra: [0, 11, 15, -7], penumbra: [0, 24, 38, 3], ambient: [0, 9, 46, 8] }
|
|
773
|
+
],
|
|
1243
774
|
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1244
775
|
input: {
|
|
1245
776
|
border: {
|
|
@@ -1247,18 +778,12 @@ const defaultThemeConfig = {
|
|
|
1247
778
|
},
|
|
1248
779
|
checkbox: {
|
|
1249
780
|
size: 17,
|
|
1250
|
-
focusRing: {
|
|
1251
|
-
offset: -1,
|
|
1252
|
-
width: 1
|
|
1253
|
-
}
|
|
781
|
+
focusRing: { offset: -1, width: 1 }
|
|
1254
782
|
},
|
|
1255
783
|
radio: {
|
|
1256
784
|
size: 17,
|
|
1257
785
|
markSize: 9,
|
|
1258
|
-
focusRing: {
|
|
1259
|
-
offset: -1,
|
|
1260
|
-
width: 1
|
|
1261
|
-
}
|
|
786
|
+
focusRing: { offset: -1, width: 1 }
|
|
1262
787
|
},
|
|
1263
788
|
switch: {
|
|
1264
789
|
width: 25,
|
|
@@ -1266,22 +791,13 @@ const defaultThemeConfig = {
|
|
|
1266
791
|
padding: 5,
|
|
1267
792
|
transitionDurationMs: 150,
|
|
1268
793
|
transitionTimingFunction: "ease-out",
|
|
1269
|
-
focusRing: {
|
|
1270
|
-
offset: 1,
|
|
1271
|
-
width: 1
|
|
1272
|
-
}
|
|
794
|
+
focusRing: { offset: 1, width: 1 }
|
|
1273
795
|
},
|
|
1274
796
|
select: {
|
|
1275
|
-
focusRing: {
|
|
1276
|
-
offset: -1,
|
|
1277
|
-
width: 1
|
|
1278
|
-
}
|
|
797
|
+
focusRing: { offset: -1, width: 1 }
|
|
1279
798
|
},
|
|
1280
799
|
text: {
|
|
1281
|
-
focusRing: {
|
|
1282
|
-
offset: -1,
|
|
1283
|
-
width: 1
|
|
1284
|
-
}
|
|
800
|
+
focusRing: { offset: -1, width: 1 }
|
|
1285
801
|
}
|
|
1286
802
|
},
|
|
1287
803
|
style: {
|
|
@@ -1297,6 +813,7 @@ const defaultThemeConfig = {
|
|
|
1297
813
|
// },
|
|
1298
814
|
}
|
|
1299
815
|
};
|
|
816
|
+
|
|
1300
817
|
const defaultThemeFonts = {
|
|
1301
818
|
code: {
|
|
1302
819
|
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
@@ -1306,42 +823,48 @@ const defaultThemeFonts = {
|
|
|
1306
823
|
semibold: 600,
|
|
1307
824
|
bold: 700
|
|
1308
825
|
},
|
|
1309
|
-
sizes: [
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
826
|
+
sizes: [
|
|
827
|
+
{
|
|
828
|
+
ascenderHeight: 4,
|
|
829
|
+
descenderHeight: 4,
|
|
830
|
+
fontSize: 10,
|
|
831
|
+
iconSize: 17,
|
|
832
|
+
lineHeight: 15,
|
|
833
|
+
letterSpacing: 0
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
ascenderHeight: 5,
|
|
837
|
+
descenderHeight: 5,
|
|
838
|
+
fontSize: 13,
|
|
839
|
+
iconSize: 21,
|
|
840
|
+
lineHeight: 19,
|
|
841
|
+
letterSpacing: 0
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
ascenderHeight: 6,
|
|
845
|
+
descenderHeight: 6,
|
|
846
|
+
fontSize: 16,
|
|
847
|
+
iconSize: 25,
|
|
848
|
+
lineHeight: 23,
|
|
849
|
+
letterSpacing: 0
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
ascenderHeight: 7,
|
|
853
|
+
descenderHeight: 7,
|
|
854
|
+
fontSize: 19,
|
|
855
|
+
iconSize: 29,
|
|
856
|
+
lineHeight: 27,
|
|
857
|
+
letterSpacing: 0
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
ascenderHeight: 8,
|
|
861
|
+
descenderHeight: 8,
|
|
862
|
+
fontSize: 22,
|
|
863
|
+
iconSize: 33,
|
|
864
|
+
lineHeight: 31,
|
|
865
|
+
letterSpacing: 0
|
|
866
|
+
}
|
|
867
|
+
]
|
|
1345
868
|
},
|
|
1346
869
|
heading: {
|
|
1347
870
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -1351,49 +874,56 @@ const defaultThemeFonts = {
|
|
|
1351
874
|
semibold: 900,
|
|
1352
875
|
bold: 900
|
|
1353
876
|
},
|
|
1354
|
-
sizes: [
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
877
|
+
sizes: [
|
|
878
|
+
{
|
|
879
|
+
ascenderHeight: 5,
|
|
880
|
+
descenderHeight: 5,
|
|
881
|
+
fontSize: 13,
|
|
882
|
+
iconSize: 17,
|
|
883
|
+
lineHeight: 19,
|
|
884
|
+
letterSpacing: 0
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
ascenderHeight: 6,
|
|
888
|
+
descenderHeight: 6,
|
|
889
|
+
fontSize: 16,
|
|
890
|
+
iconSize: 25,
|
|
891
|
+
lineHeight: 23,
|
|
892
|
+
letterSpacing: 0
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
ascenderHeight: 7,
|
|
896
|
+
descenderHeight: 7,
|
|
897
|
+
fontSize: 21,
|
|
898
|
+
iconSize: 33,
|
|
899
|
+
lineHeight: 29,
|
|
900
|
+
letterSpacing: 0
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
ascenderHeight: 8,
|
|
904
|
+
descenderHeight: 8,
|
|
905
|
+
fontSize: 27,
|
|
906
|
+
iconSize: 41,
|
|
907
|
+
lineHeight: 35,
|
|
908
|
+
letterSpacing: 0
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
ascenderHeight: 9.5,
|
|
912
|
+
descenderHeight: 8.5,
|
|
913
|
+
fontSize: 33,
|
|
914
|
+
iconSize: 49,
|
|
915
|
+
lineHeight: 41,
|
|
916
|
+
letterSpacing: 0
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
ascenderHeight: 10.5,
|
|
920
|
+
descenderHeight: 9.5,
|
|
921
|
+
fontSize: 38,
|
|
922
|
+
iconSize: 53,
|
|
923
|
+
lineHeight: 47,
|
|
924
|
+
letterSpacing: 0
|
|
925
|
+
}
|
|
926
|
+
]
|
|
1397
927
|
},
|
|
1398
928
|
label: {
|
|
1399
929
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
@@ -1403,49 +933,56 @@ const defaultThemeFonts = {
|
|
|
1403
933
|
semibold: 800,
|
|
1404
934
|
bold: 900
|
|
1405
935
|
},
|
|
1406
|
-
sizes: [
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
936
|
+
sizes: [
|
|
937
|
+
{
|
|
938
|
+
ascenderHeight: 2,
|
|
939
|
+
descenderHeight: 2,
|
|
940
|
+
fontSize: 8.1,
|
|
941
|
+
iconSize: 13,
|
|
942
|
+
lineHeight: 10,
|
|
943
|
+
letterSpacing: 0.5
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
ascenderHeight: 2,
|
|
947
|
+
descenderHeight: 2,
|
|
948
|
+
fontSize: 9.5,
|
|
949
|
+
iconSize: 15,
|
|
950
|
+
lineHeight: 11,
|
|
951
|
+
letterSpacing: 0.5
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
ascenderHeight: 2,
|
|
955
|
+
descenderHeight: 2,
|
|
956
|
+
fontSize: 10.8,
|
|
957
|
+
iconSize: 17,
|
|
958
|
+
lineHeight: 12,
|
|
959
|
+
letterSpacing: 0.5
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
ascenderHeight: 2,
|
|
963
|
+
descenderHeight: 2,
|
|
964
|
+
fontSize: 12.25,
|
|
965
|
+
iconSize: 19,
|
|
966
|
+
lineHeight: 13,
|
|
967
|
+
letterSpacing: 0.5
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
ascenderHeight: 2,
|
|
971
|
+
descenderHeight: 2,
|
|
972
|
+
fontSize: 13.6,
|
|
973
|
+
iconSize: 21,
|
|
974
|
+
lineHeight: 14,
|
|
975
|
+
letterSpacing: 0.5
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
ascenderHeight: 2,
|
|
979
|
+
descenderHeight: 2,
|
|
980
|
+
fontSize: 15,
|
|
981
|
+
iconSize: 23,
|
|
982
|
+
lineHeight: 15,
|
|
983
|
+
letterSpacing: 0.5
|
|
984
|
+
}
|
|
985
|
+
]
|
|
1449
986
|
},
|
|
1450
987
|
text: {
|
|
1451
988
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -1455,49 +992,57 @@ const defaultThemeFonts = {
|
|
|
1455
992
|
semibold: 600,
|
|
1456
993
|
bold: 700
|
|
1457
994
|
},
|
|
1458
|
-
sizes: [
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
995
|
+
sizes: [
|
|
996
|
+
{
|
|
997
|
+
ascenderHeight: 4,
|
|
998
|
+
descenderHeight: 4,
|
|
999
|
+
fontSize: 10,
|
|
1000
|
+
iconSize: 17,
|
|
1001
|
+
lineHeight: 15,
|
|
1002
|
+
letterSpacing: 0
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
ascenderHeight: 5,
|
|
1006
|
+
descenderHeight: 5,
|
|
1007
|
+
fontSize: 13,
|
|
1008
|
+
iconSize: 21,
|
|
1009
|
+
lineHeight: 19,
|
|
1010
|
+
letterSpacing: 0
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
ascenderHeight: 6,
|
|
1014
|
+
descenderHeight: 6,
|
|
1015
|
+
fontSize: 15,
|
|
1016
|
+
iconSize: 25,
|
|
1017
|
+
lineHeight: 23,
|
|
1018
|
+
letterSpacing: 0
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
ascenderHeight: 7,
|
|
1022
|
+
descenderHeight: 7,
|
|
1023
|
+
fontSize: 18,
|
|
1024
|
+
iconSize: 29,
|
|
1025
|
+
lineHeight: 27,
|
|
1026
|
+
letterSpacing: 0
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
ascenderHeight: 8,
|
|
1030
|
+
descenderHeight: 8,
|
|
1031
|
+
fontSize: 21,
|
|
1032
|
+
iconSize: 33,
|
|
1033
|
+
lineHeight: 31,
|
|
1034
|
+
letterSpacing: 0
|
|
1035
|
+
}
|
|
1036
|
+
]
|
|
1494
1037
|
}
|
|
1495
1038
|
};
|
|
1496
|
-
|
|
1039
|
+
|
|
1040
|
+
const cache$4 = /* @__PURE__ */ new WeakMap();
|
|
1497
1041
|
function themeColor_v0_v2(color_v0) {
|
|
1498
1042
|
var _a, _b, _c;
|
|
1499
1043
|
const cached_v2 = cache$4.get(color_v0);
|
|
1500
|
-
if (cached_v2)
|
|
1044
|
+
if (cached_v2)
|
|
1045
|
+
return cached_v2;
|
|
1501
1046
|
const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled);
|
|
1502
1047
|
const color_v2 = {
|
|
1503
1048
|
_blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
|
|
@@ -1685,12 +1230,15 @@ function inputStateThemeColor_v0_v2(state) {
|
|
|
1685
1230
|
placeholder: state.placeholder
|
|
1686
1231
|
};
|
|
1687
1232
|
}
|
|
1688
|
-
|
|
1233
|
+
|
|
1234
|
+
const cache$3 = /* @__PURE__ */ new WeakMap();
|
|
1689
1235
|
function getTheme_v2(theme) {
|
|
1690
1236
|
var _a, _b;
|
|
1691
|
-
if ((_a = theme.sanity.v2) == null ? void 0 : _a._resolved)
|
|
1237
|
+
if ((_a = theme.sanity.v2) == null ? void 0 : _a._resolved)
|
|
1238
|
+
return theme.sanity.v2;
|
|
1692
1239
|
const cached_v2 = cache$3.get(theme);
|
|
1693
|
-
if (cached_v2)
|
|
1240
|
+
if (cached_v2)
|
|
1241
|
+
return cached_v2;
|
|
1694
1242
|
const v2 = {
|
|
1695
1243
|
_version: 2,
|
|
1696
1244
|
_resolved: true,
|
|
@@ -1732,17 +1280,22 @@ function getTheme_v2(theme) {
|
|
|
1732
1280
|
cache$3.set(theme, v2);
|
|
1733
1281
|
return v2;
|
|
1734
1282
|
}
|
|
1283
|
+
|
|
1735
1284
|
function is_v0(themeProp) {
|
|
1736
1285
|
return themeProp._version === 0;
|
|
1737
1286
|
}
|
|
1287
|
+
|
|
1738
1288
|
function is_v2(themeProp) {
|
|
1739
1289
|
return themeProp._version === 2;
|
|
1740
1290
|
}
|
|
1741
|
-
|
|
1291
|
+
|
|
1292
|
+
const cache$2 = /* @__PURE__ */ new WeakMap();
|
|
1742
1293
|
function v0_v2(v0) {
|
|
1743
|
-
if (v0.v2)
|
|
1294
|
+
if (v0.v2)
|
|
1295
|
+
return v0.v2;
|
|
1744
1296
|
const cached_v2 = cache$2.get(v0);
|
|
1745
|
-
if (cached_v2)
|
|
1297
|
+
if (cached_v2)
|
|
1298
|
+
return cached_v2;
|
|
1746
1299
|
const {
|
|
1747
1300
|
avatar,
|
|
1748
1301
|
button,
|
|
@@ -1816,10 +1369,12 @@ function v0_v2(v0) {
|
|
|
1816
1369
|
cache$2.set(v0, v2);
|
|
1817
1370
|
return v2;
|
|
1818
1371
|
}
|
|
1819
|
-
|
|
1372
|
+
|
|
1373
|
+
const cache$1 = /* @__PURE__ */ new WeakMap();
|
|
1820
1374
|
function v2_v0(v2) {
|
|
1821
1375
|
const cachedTheme = cache$1.get(v2);
|
|
1822
|
-
if (cachedTheme)
|
|
1376
|
+
if (cachedTheme)
|
|
1377
|
+
return cachedTheme;
|
|
1823
1378
|
const {
|
|
1824
1379
|
avatar,
|
|
1825
1380
|
button,
|
|
@@ -1923,15 +1478,30 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1923
1478
|
placeholder: t.placeholder
|
|
1924
1479
|
};
|
|
1925
1480
|
}
|
|
1481
|
+
|
|
1926
1482
|
const THEME_COLOR_SCHEMES = ["light", "dark"];
|
|
1927
1483
|
const THEME_COLOR_BLEND_MODES = ["multiply", "screen"];
|
|
1928
|
-
const THEME_COLOR_CARD_TONES = [
|
|
1929
|
-
|
|
1484
|
+
const THEME_COLOR_CARD_TONES = [
|
|
1485
|
+
"transparent",
|
|
1486
|
+
"default",
|
|
1487
|
+
"primary",
|
|
1488
|
+
"positive",
|
|
1489
|
+
"caution",
|
|
1490
|
+
"critical"
|
|
1491
|
+
];
|
|
1492
|
+
const THEME_COLOR_STATE_TONES = [
|
|
1493
|
+
"default",
|
|
1494
|
+
"primary",
|
|
1495
|
+
"positive",
|
|
1496
|
+
"caution",
|
|
1497
|
+
"critical"
|
|
1498
|
+
];
|
|
1930
1499
|
const THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
|
|
1931
1500
|
const THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
|
|
1932
1501
|
const THEME_COLOR_INPUT_MODES = ["default", "invalid"];
|
|
1933
1502
|
const THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"];
|
|
1934
1503
|
const THEME_COLOR_AVATAR_COLORS = color.COLOR_HUES;
|
|
1504
|
+
|
|
1935
1505
|
function isColorBlendModeValue(str) {
|
|
1936
1506
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1937
1507
|
}
|
|
@@ -1944,8 +1514,35 @@ function isColorTintKey(str) {
|
|
|
1944
1514
|
function isColorButtonMode(str) {
|
|
1945
1515
|
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1946
1516
|
}
|
|
1947
|
-
|
|
1948
|
-
const
|
|
1517
|
+
|
|
1518
|
+
const COLOR_CONFIG_STATE_KEYS = [
|
|
1519
|
+
"_hue",
|
|
1520
|
+
"bg",
|
|
1521
|
+
"fg",
|
|
1522
|
+
"border",
|
|
1523
|
+
"focusRing",
|
|
1524
|
+
"muted/fg",
|
|
1525
|
+
"accent/fg",
|
|
1526
|
+
"link/fg",
|
|
1527
|
+
"code/bg",
|
|
1528
|
+
"code/fg",
|
|
1529
|
+
"skeleton/from",
|
|
1530
|
+
"skeleton/to",
|
|
1531
|
+
"status/dot",
|
|
1532
|
+
"status/icon"
|
|
1533
|
+
];
|
|
1534
|
+
const COLOR_CONFIG_CARD_KEYS = [
|
|
1535
|
+
...COLOR_CONFIG_STATE_KEYS,
|
|
1536
|
+
"_hue",
|
|
1537
|
+
"bg",
|
|
1538
|
+
"fg",
|
|
1539
|
+
"border",
|
|
1540
|
+
"focusRing",
|
|
1541
|
+
"shadow/outline",
|
|
1542
|
+
"shadow/umbra",
|
|
1543
|
+
"shadow/penumbra",
|
|
1544
|
+
"shadow/ambient"
|
|
1545
|
+
];
|
|
1949
1546
|
const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
|
|
1950
1547
|
const COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS];
|
|
1951
1548
|
const COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES];
|
|
@@ -1953,6 +1550,7 @@ const COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES];
|
|
|
1953
1550
|
const COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES];
|
|
1954
1551
|
const COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES];
|
|
1955
1552
|
const COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1553
|
+
|
|
1956
1554
|
function parseTokenKey(str) {
|
|
1957
1555
|
const segments = str.split("/");
|
|
1958
1556
|
const segment0 = segments.shift() || "";
|
|
@@ -2000,6 +1598,7 @@ function parseTokenKey(str) {
|
|
|
2000
1598
|
}
|
|
2001
1599
|
return void 0;
|
|
2002
1600
|
}
|
|
1601
|
+
|
|
2003
1602
|
function isColorMixPercentValue(str) {
|
|
2004
1603
|
return /^\d+%$/.test(str);
|
|
2005
1604
|
}
|
|
@@ -2100,6 +1699,7 @@ function parseTokenValue(str) {
|
|
|
2100
1699
|
}
|
|
2101
1700
|
return void 0;
|
|
2102
1701
|
}
|
|
1702
|
+
|
|
2103
1703
|
function isColorConfigBaseTone(str) {
|
|
2104
1704
|
return COLOR_CONFIG_CARD_TONES.includes(str);
|
|
2105
1705
|
}
|
|
@@ -2125,6 +1725,7 @@ function isColorValue(str) {
|
|
|
2125
1725
|
function isColorOpacityValue(str) {
|
|
2126
1726
|
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
2127
1727
|
}
|
|
1728
|
+
|
|
2128
1729
|
function compileColorTokenValue(node) {
|
|
2129
1730
|
let key = "";
|
|
2130
1731
|
if (node.key === "black" || node.key === "white") {
|
|
@@ -2140,22 +1741,17 @@ function compileColorTokenValue(node) {
|
|
|
2140
1741
|
}
|
|
2141
1742
|
return key;
|
|
2142
1743
|
}
|
|
1744
|
+
|
|
2143
1745
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
2144
|
-
function resolveColorTokenValue(context) {
|
|
2145
|
-
|
|
2146
|
-
const {
|
|
2147
|
-
hue,
|
|
2148
|
-
scheme
|
|
2149
|
-
} = context;
|
|
1746
|
+
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1747
|
+
const { hue, scheme } = context;
|
|
2150
1748
|
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
2151
1749
|
if (!node || node.type !== "color") {
|
|
2152
1750
|
throw new Error("Invalid color token: ".concat(value[0]));
|
|
2153
1751
|
}
|
|
2154
|
-
return compileColorTokenValue({
|
|
2155
|
-
...node,
|
|
2156
|
-
hue: node.hue || hue
|
|
2157
|
-
});
|
|
1752
|
+
return compileColorTokenValue({ ...node, hue: node.hue || hue });
|
|
2158
1753
|
}
|
|
1754
|
+
|
|
2159
1755
|
const defaultColorTokens = {
|
|
2160
1756
|
base: {
|
|
2161
1757
|
"*": {
|
|
@@ -2229,24 +1825,16 @@ const defaultColorTokens = {
|
|
|
2229
1825
|
fg: ["600", "400"]
|
|
2230
1826
|
}
|
|
2231
1827
|
},
|
|
2232
|
-
primary: {
|
|
2233
|
-
_hue: "blue"
|
|
2234
|
-
},
|
|
1828
|
+
primary: { _hue: "blue" },
|
|
2235
1829
|
positive: {
|
|
2236
1830
|
_hue: "green",
|
|
2237
|
-
shadow: {
|
|
2238
|
-
outline: ["500/0.4", "500/0.4"]
|
|
2239
|
-
}
|
|
1831
|
+
shadow: { outline: ["500/0.4", "500/0.4"] }
|
|
2240
1832
|
},
|
|
2241
1833
|
caution: {
|
|
2242
1834
|
_hue: "yellow",
|
|
2243
|
-
shadow: {
|
|
2244
|
-
outline: ["600/0.3", "500/0.4"]
|
|
2245
|
-
}
|
|
1835
|
+
shadow: { outline: ["600/0.3", "500/0.4"] }
|
|
2246
1836
|
},
|
|
2247
|
-
critical: {
|
|
2248
|
-
_hue: "red"
|
|
2249
|
-
}
|
|
1837
|
+
critical: { _hue: "red" }
|
|
2250
1838
|
},
|
|
2251
1839
|
button: {
|
|
2252
1840
|
default: {
|
|
@@ -2740,13 +2328,12 @@ const defaultColorTokens = {
|
|
|
2740
2328
|
variable: ["red/600", "red/400"]
|
|
2741
2329
|
}
|
|
2742
2330
|
};
|
|
2331
|
+
|
|
2743
2332
|
function isRecord(value) {
|
|
2744
2333
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
2745
2334
|
}
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
records[_key] = arguments[_key];
|
|
2749
|
-
}
|
|
2335
|
+
|
|
2336
|
+
function merge(...records) {
|
|
2750
2337
|
const _records = records.filter(Boolean);
|
|
2751
2338
|
if (_records.length === 0) {
|
|
2752
2339
|
return {};
|
|
@@ -2765,6 +2352,7 @@ function _merge(acc, source) {
|
|
|
2765
2352
|
}
|
|
2766
2353
|
return acc;
|
|
2767
2354
|
}
|
|
2355
|
+
|
|
2768
2356
|
function resolveColorTokens(inputTokens) {
|
|
2769
2357
|
const tokens = merge(defaultColorTokens, inputTokens);
|
|
2770
2358
|
return {
|
|
@@ -2790,59 +2378,41 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2790
2378
|
...spec,
|
|
2791
2379
|
_hue: hue,
|
|
2792
2380
|
avatar: {
|
|
2793
|
-
gray: merge({
|
|
2794
|
-
|
|
2795
|
-
}, (
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
}, (
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
}, (
|
|
2802
|
-
magenta: merge({
|
|
2803
|
-
_hue: "magenta"
|
|
2804
|
-
}, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
|
|
2805
|
-
red: merge({
|
|
2806
|
-
_hue: "red"
|
|
2807
|
-
}, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
|
|
2808
|
-
orange: merge({
|
|
2809
|
-
_hue: "orange"
|
|
2810
|
-
}, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
|
|
2811
|
-
yellow: merge({
|
|
2812
|
-
_hue: "yellow"
|
|
2813
|
-
}, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
|
|
2814
|
-
green: merge({
|
|
2815
|
-
_hue: "green"
|
|
2816
|
-
}, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
|
|
2817
|
-
cyan: merge({
|
|
2818
|
-
_hue: "cyan"
|
|
2819
|
-
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
|
|
2381
|
+
gray: merge({ _hue: "gray" }, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
|
|
2382
|
+
blue: merge({ _hue: "blue" }, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
|
|
2383
|
+
purple: merge({ _hue: "purple" }, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
|
|
2384
|
+
magenta: merge({ _hue: "magenta" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
|
|
2385
|
+
red: merge({ _hue: "red" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
|
|
2386
|
+
orange: merge({ _hue: "orange" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
|
|
2387
|
+
yellow: merge({ _hue: "yellow" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
|
|
2388
|
+
green: merge({ _hue: "green" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
|
|
2389
|
+
cyan: merge({ _hue: "cyan" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
|
|
2820
2390
|
},
|
|
2821
2391
|
badge: {
|
|
2822
2392
|
default: {
|
|
2823
2393
|
_hue: ((_x = (_w = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _w.default) == null ? void 0 : _x._hue) || hue,
|
|
2824
|
-
...(
|
|
2825
|
-
...(
|
|
2394
|
+
...(_y = spec.badge) == null ? void 0 : _y["*"],
|
|
2395
|
+
...(_z = spec.badge) == null ? void 0 : _z.default
|
|
2826
2396
|
},
|
|
2827
2397
|
primary: {
|
|
2828
2398
|
_hue: ((_B = (_A = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _A.primary) == null ? void 0 : _B._hue) || hue,
|
|
2829
|
-
...(
|
|
2830
|
-
...(
|
|
2399
|
+
...(_C = spec.badge) == null ? void 0 : _C["*"],
|
|
2400
|
+
...(_D = spec.badge) == null ? void 0 : _D.primary
|
|
2831
2401
|
},
|
|
2832
2402
|
positive: {
|
|
2833
2403
|
_hue: ((_F = (_E = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _E.positive) == null ? void 0 : _F._hue) || hue,
|
|
2834
|
-
...(
|
|
2835
|
-
...(
|
|
2404
|
+
...(_G = spec.badge) == null ? void 0 : _G["*"],
|
|
2405
|
+
...(_H = spec.badge) == null ? void 0 : _H.positive
|
|
2836
2406
|
},
|
|
2837
2407
|
caution: {
|
|
2838
2408
|
_hue: ((_J = (_I = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _I.caution) == null ? void 0 : _J._hue) || hue,
|
|
2839
|
-
...(
|
|
2840
|
-
...(
|
|
2409
|
+
...(_K = spec.badge) == null ? void 0 : _K["*"],
|
|
2410
|
+
...(_L = spec.badge) == null ? void 0 : _L.caution
|
|
2841
2411
|
},
|
|
2842
2412
|
critical: {
|
|
2843
2413
|
_hue: ((_N = (_M = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _M.critical) == null ? void 0 : _N._hue) || hue,
|
|
2844
|
-
...(
|
|
2845
|
-
...(
|
|
2414
|
+
...(_O = spec.badge) == null ? void 0 : _O["*"],
|
|
2415
|
+
...(_P = spec.badge) == null ? void 0 : _P.critical
|
|
2846
2416
|
}
|
|
2847
2417
|
}
|
|
2848
2418
|
};
|
|
@@ -2870,65 +2440,52 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2870
2440
|
}
|
|
2871
2441
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2872
2442
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z;
|
|
2873
|
-
const spec = merge(
|
|
2443
|
+
const spec = merge(
|
|
2444
|
+
(_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"],
|
|
2445
|
+
(_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"],
|
|
2446
|
+
(_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state],
|
|
2447
|
+
(_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]
|
|
2448
|
+
);
|
|
2874
2449
|
const hue = spec._hue || ((_n = (_m = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue);
|
|
2875
2450
|
return {
|
|
2876
2451
|
...spec,
|
|
2877
2452
|
_hue: hue,
|
|
2878
2453
|
avatar: {
|
|
2879
|
-
gray: merge({
|
|
2880
|
-
|
|
2881
|
-
}, (
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
}, (
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
}, (
|
|
2888
|
-
magenta: merge({
|
|
2889
|
-
_hue: "magenta"
|
|
2890
|
-
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
|
|
2891
|
-
red: merge({
|
|
2892
|
-
_hue: "red"
|
|
2893
|
-
}, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
|
|
2894
|
-
orange: merge({
|
|
2895
|
-
_hue: "orange"
|
|
2896
|
-
}, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
|
|
2897
|
-
yellow: merge({
|
|
2898
|
-
_hue: "yellow"
|
|
2899
|
-
}, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
|
|
2900
|
-
green: merge({
|
|
2901
|
-
_hue: "green"
|
|
2902
|
-
}, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
|
|
2903
|
-
cyan: merge({
|
|
2904
|
-
_hue: "cyan"
|
|
2905
|
-
}, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
|
|
2454
|
+
gray: merge({ _hue: "gray" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
|
|
2455
|
+
blue: merge({ _hue: "blue" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
|
|
2456
|
+
purple: merge({ _hue: "purple" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
|
|
2457
|
+
magenta: merge({ _hue: "magenta" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
|
|
2458
|
+
red: merge({ _hue: "red" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
|
|
2459
|
+
orange: merge({ _hue: "orange" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
|
|
2460
|
+
yellow: merge({ _hue: "yellow" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
|
|
2461
|
+
green: merge({ _hue: "green" }, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
|
|
2462
|
+
cyan: merge({ _hue: "cyan" }, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
|
|
2906
2463
|
},
|
|
2907
2464
|
badge: {
|
|
2908
2465
|
default: {
|
|
2909
2466
|
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.default) == null ? void 0 : _H._hue,
|
|
2910
|
-
...(
|
|
2911
|
-
...(
|
|
2467
|
+
...(_I = spec.badge) == null ? void 0 : _I["*"],
|
|
2468
|
+
...(_J = spec.badge) == null ? void 0 : _J.default
|
|
2912
2469
|
},
|
|
2913
2470
|
primary: {
|
|
2914
2471
|
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.primary) == null ? void 0 : _L._hue,
|
|
2915
|
-
...(
|
|
2916
|
-
...(
|
|
2472
|
+
...(_M = spec.badge) == null ? void 0 : _M["*"],
|
|
2473
|
+
...(_N = spec.badge) == null ? void 0 : _N.primary
|
|
2917
2474
|
},
|
|
2918
2475
|
positive: {
|
|
2919
2476
|
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.positive) == null ? void 0 : _P._hue,
|
|
2920
|
-
...(
|
|
2921
|
-
...(
|
|
2477
|
+
...(_Q = spec.badge) == null ? void 0 : _Q["*"],
|
|
2478
|
+
...(_R = spec.badge) == null ? void 0 : _R.positive
|
|
2922
2479
|
},
|
|
2923
2480
|
caution: {
|
|
2924
2481
|
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.caution) == null ? void 0 : _T._hue,
|
|
2925
|
-
...(
|
|
2926
|
-
...(
|
|
2482
|
+
...(_U = spec.badge) == null ? void 0 : _U["*"],
|
|
2483
|
+
...(_V = spec.badge) == null ? void 0 : _V.caution
|
|
2927
2484
|
},
|
|
2928
2485
|
critical: {
|
|
2929
2486
|
_hue: (_X = (_W = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _W.critical) == null ? void 0 : _X._hue,
|
|
2930
|
-
...(
|
|
2931
|
-
...(
|
|
2487
|
+
...(_Y = spec.badge) == null ? void 0 : _Y["*"],
|
|
2488
|
+
...(_Z = spec.badge) == null ? void 0 : _Z.critical
|
|
2932
2489
|
}
|
|
2933
2490
|
}
|
|
2934
2491
|
};
|
|
@@ -2949,12 +2506,14 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2949
2506
|
}
|
|
2950
2507
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2951
2508
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2952
|
-
const spec = merge(
|
|
2509
|
+
const spec = merge(
|
|
2510
|
+
(_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
|
|
2511
|
+
(_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"],
|
|
2512
|
+
(_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
|
|
2513
|
+
(_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]
|
|
2514
|
+
);
|
|
2953
2515
|
const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _i[mode]) == null ? void 0 : _j._hue);
|
|
2954
|
-
return {
|
|
2955
|
-
...spec,
|
|
2956
|
-
_hue: hue
|
|
2957
|
-
};
|
|
2516
|
+
return { ...spec, _hue: hue };
|
|
2958
2517
|
}
|
|
2959
2518
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2960
2519
|
const tokens = {};
|
|
@@ -2975,126 +2534,84 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2975
2534
|
}
|
|
2976
2535
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2977
2536
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V;
|
|
2978
|
-
const spec = merge(
|
|
2537
|
+
const spec = merge(
|
|
2538
|
+
(_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
|
|
2539
|
+
(_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"],
|
|
2540
|
+
(_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
|
|
2541
|
+
(_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]
|
|
2542
|
+
);
|
|
2979
2543
|
const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _i[tone]) == null ? void 0 : _j._hue);
|
|
2980
2544
|
return {
|
|
2981
2545
|
...spec,
|
|
2982
2546
|
_hue: hue,
|
|
2983
2547
|
avatar: {
|
|
2984
|
-
gray: merge({
|
|
2985
|
-
|
|
2986
|
-
}, (
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
}, (
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
}, (
|
|
2993
|
-
magenta: merge({
|
|
2994
|
-
_hue: "magenta"
|
|
2995
|
-
}, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
|
|
2996
|
-
red: merge({
|
|
2997
|
-
_hue: "red"
|
|
2998
|
-
}, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
|
|
2999
|
-
orange: merge({
|
|
3000
|
-
_hue: "orange"
|
|
3001
|
-
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
|
|
3002
|
-
yellow: merge({
|
|
3003
|
-
_hue: "yellow"
|
|
3004
|
-
}, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
|
|
3005
|
-
green: merge({
|
|
3006
|
-
_hue: "green"
|
|
3007
|
-
}, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
|
|
3008
|
-
cyan: merge({
|
|
3009
|
-
_hue: "cyan"
|
|
3010
|
-
}, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
|
|
2548
|
+
gray: merge({ _hue: "gray" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
|
|
2549
|
+
blue: merge({ _hue: "blue" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
|
|
2550
|
+
purple: merge({ _hue: "purple" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
|
|
2551
|
+
magenta: merge({ _hue: "magenta" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
|
|
2552
|
+
red: merge({ _hue: "red" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
|
|
2553
|
+
orange: merge({ _hue: "orange" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
|
|
2554
|
+
yellow: merge({ _hue: "yellow" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
|
|
2555
|
+
green: merge({ _hue: "green" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
|
|
2556
|
+
cyan: merge({ _hue: "cyan" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
|
|
3011
2557
|
},
|
|
3012
2558
|
badge: {
|
|
3013
2559
|
default: {
|
|
3014
2560
|
_hue: (_D = (_C = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _C.default) == null ? void 0 : _D._hue,
|
|
3015
|
-
...(
|
|
3016
|
-
...(
|
|
2561
|
+
...(_E = spec.badge) == null ? void 0 : _E["*"],
|
|
2562
|
+
...(_F = spec.badge) == null ? void 0 : _F.default
|
|
3017
2563
|
},
|
|
3018
2564
|
primary: {
|
|
3019
2565
|
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.primary) == null ? void 0 : _H._hue,
|
|
3020
|
-
...(
|
|
3021
|
-
...(
|
|
2566
|
+
...(_I = spec.badge) == null ? void 0 : _I["*"],
|
|
2567
|
+
...(_J = spec.badge) == null ? void 0 : _J.primary
|
|
3022
2568
|
},
|
|
3023
2569
|
positive: {
|
|
3024
2570
|
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.positive) == null ? void 0 : _L._hue,
|
|
3025
|
-
...(
|
|
3026
|
-
...(
|
|
2571
|
+
...(_M = spec.badge) == null ? void 0 : _M["*"],
|
|
2572
|
+
...(_N = spec.badge) == null ? void 0 : _N.positive
|
|
3027
2573
|
},
|
|
3028
2574
|
caution: {
|
|
3029
2575
|
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.caution) == null ? void 0 : _P._hue,
|
|
3030
|
-
...(
|
|
3031
|
-
...(
|
|
2576
|
+
...(_Q = spec.badge) == null ? void 0 : _Q["*"],
|
|
2577
|
+
...(_R = spec.badge) == null ? void 0 : _R.caution
|
|
3032
2578
|
},
|
|
3033
2579
|
critical: {
|
|
3034
2580
|
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.critical) == null ? void 0 : _T._hue,
|
|
3035
|
-
...(
|
|
3036
|
-
...(
|
|
2581
|
+
...(_U = spec.badge) == null ? void 0 : _U["*"],
|
|
2582
|
+
...(_V = spec.badge) == null ? void 0 : _V.critical
|
|
3037
2583
|
}
|
|
3038
2584
|
}
|
|
3039
2585
|
};
|
|
3040
2586
|
}
|
|
2587
|
+
|
|
3041
2588
|
function buildColorTheme(config) {
|
|
3042
2589
|
const resolvedConfig = {
|
|
3043
2590
|
...config,
|
|
3044
2591
|
color: resolveColorTokens(config == null ? void 0 : config.color)
|
|
3045
2592
|
};
|
|
3046
2593
|
return {
|
|
3047
|
-
light: buildColorScheme({
|
|
3048
|
-
|
|
3049
|
-
}, resolvedConfig),
|
|
3050
|
-
dark: buildColorScheme({
|
|
3051
|
-
scheme: "dark"
|
|
3052
|
-
}, resolvedConfig)
|
|
2594
|
+
light: buildColorScheme({ scheme: "light" }, resolvedConfig),
|
|
2595
|
+
dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
|
|
3053
2596
|
};
|
|
3054
2597
|
}
|
|
3055
2598
|
function buildColorScheme(options, config) {
|
|
3056
|
-
const {
|
|
3057
|
-
scheme
|
|
3058
|
-
} = options;
|
|
2599
|
+
const { scheme } = options;
|
|
3059
2600
|
return {
|
|
3060
|
-
transparent: buildCardColorTheme({
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
}, config),
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
tone: "default"
|
|
3067
|
-
}, config),
|
|
3068
|
-
primary: buildCardColorTheme({
|
|
3069
|
-
scheme,
|
|
3070
|
-
tone: "primary"
|
|
3071
|
-
}, config),
|
|
3072
|
-
positive: buildCardColorTheme({
|
|
3073
|
-
scheme,
|
|
3074
|
-
tone: "positive"
|
|
3075
|
-
}, config),
|
|
3076
|
-
caution: buildCardColorTheme({
|
|
3077
|
-
scheme,
|
|
3078
|
-
tone: "caution"
|
|
3079
|
-
}, config),
|
|
3080
|
-
critical: buildCardColorTheme({
|
|
3081
|
-
scheme,
|
|
3082
|
-
tone: "critical"
|
|
3083
|
-
}, config)
|
|
2601
|
+
transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
|
|
2602
|
+
default: buildCardColorTheme({ scheme, tone: "default" }, config),
|
|
2603
|
+
primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
|
|
2604
|
+
positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
|
|
2605
|
+
caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
|
|
2606
|
+
critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
|
|
3084
2607
|
};
|
|
3085
2608
|
}
|
|
3086
2609
|
function buildCardColorTheme(options, config) {
|
|
3087
2610
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3088
|
-
const {
|
|
3089
|
-
scheme,
|
|
3090
|
-
tone
|
|
3091
|
-
} = options;
|
|
2611
|
+
const { scheme, tone } = options;
|
|
3092
2612
|
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
|
|
3093
2613
|
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3094
|
-
const context = {
|
|
3095
|
-
hue,
|
|
3096
|
-
scheme
|
|
3097
|
-
};
|
|
2614
|
+
const context = { hue, scheme };
|
|
3098
2615
|
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["multiply", "screen"];
|
|
3099
2616
|
return {
|
|
3100
2617
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
@@ -3102,18 +2619,12 @@ function buildCardColorTheme(options, config) {
|
|
|
3102
2619
|
accent: {
|
|
3103
2620
|
fg: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _c.fg)
|
|
3104
2621
|
},
|
|
3105
|
-
avatar: buildAvatarColorTheme({
|
|
3106
|
-
scheme
|
|
3107
|
-
}, tokens),
|
|
2622
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
3108
2623
|
backdrop: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.backdrop),
|
|
3109
|
-
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3110
|
-
scheme
|
|
3111
|
-
}, config),
|
|
2624
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
3112
2625
|
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3113
2626
|
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3114
|
-
button: buildButtonColorTheme({
|
|
3115
|
-
scheme
|
|
3116
|
-
}, config),
|
|
2627
|
+
button: buildButtonColorTheme({ scheme }, config),
|
|
3117
2628
|
code: {
|
|
3118
2629
|
bg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.code) == null ? void 0 : _d.bg),
|
|
3119
2630
|
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.fg)
|
|
@@ -3121,10 +2632,7 @@ function buildCardColorTheme(options, config) {
|
|
|
3121
2632
|
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3122
2633
|
focusRing: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.focusRing),
|
|
3123
2634
|
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
3124
|
-
input: buildInputColorTheme({
|
|
3125
|
-
scheme,
|
|
3126
|
-
tone
|
|
3127
|
-
}, config),
|
|
2635
|
+
input: buildInputColorTheme({ scheme, tone }, config),
|
|
3128
2636
|
kbd: {
|
|
3129
2637
|
bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _f.bg),
|
|
3130
2638
|
fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _g.fg),
|
|
@@ -3137,34 +2645,21 @@ function buildCardColorTheme(options, config) {
|
|
|
3137
2645
|
bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _j.bg),
|
|
3138
2646
|
fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _k.fg)
|
|
3139
2647
|
},
|
|
3140
|
-
selectable: buildSelectableColorTheme({
|
|
3141
|
-
|
|
3142
|
-
}, config),
|
|
3143
|
-
shadow: buildShadowColorTheme({
|
|
3144
|
-
scheme,
|
|
3145
|
-
tone
|
|
3146
|
-
}, config),
|
|
2648
|
+
selectable: buildSelectableColorTheme({ scheme }, config),
|
|
2649
|
+
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
3147
2650
|
skeleton: {
|
|
3148
2651
|
from: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _l.from),
|
|
3149
2652
|
to: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.to)
|
|
3150
2653
|
},
|
|
3151
|
-
syntax: buildSyntaxColorTheme({
|
|
3152
|
-
scheme
|
|
3153
|
-
}, config)
|
|
2654
|
+
syntax: buildSyntaxColorTheme({ scheme }, config)
|
|
3154
2655
|
};
|
|
3155
2656
|
}
|
|
3156
2657
|
function buildShadowColorTheme(options, config) {
|
|
3157
2658
|
var _a, _b, _c, _d, _e, _f;
|
|
3158
|
-
const {
|
|
3159
|
-
scheme,
|
|
3160
|
-
tone
|
|
3161
|
-
} = options;
|
|
2659
|
+
const { scheme, tone } = options;
|
|
3162
2660
|
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
|
|
3163
2661
|
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3164
|
-
const context = {
|
|
3165
|
-
hue,
|
|
3166
|
-
scheme
|
|
3167
|
-
};
|
|
2662
|
+
const context = { hue, scheme };
|
|
3168
2663
|
return {
|
|
3169
2664
|
outline: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline),
|
|
3170
2665
|
umbra: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra),
|
|
@@ -3173,59 +2668,24 @@ function buildShadowColorTheme(options, config) {
|
|
|
3173
2668
|
};
|
|
3174
2669
|
}
|
|
3175
2670
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
3176
|
-
const {
|
|
3177
|
-
scheme
|
|
3178
|
-
} = options;
|
|
2671
|
+
const { scheme } = options;
|
|
3179
2672
|
return {
|
|
3180
|
-
gray: _buildAvatarColorTheme({
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
}, stateTokens),
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
}, stateTokens),
|
|
3188
|
-
|
|
3189
|
-
color: "purple",
|
|
3190
|
-
scheme
|
|
3191
|
-
}, stateTokens),
|
|
3192
|
-
magenta: _buildAvatarColorTheme({
|
|
3193
|
-
color: "magenta",
|
|
3194
|
-
scheme
|
|
3195
|
-
}, stateTokens),
|
|
3196
|
-
red: _buildAvatarColorTheme({
|
|
3197
|
-
color: "red",
|
|
3198
|
-
scheme
|
|
3199
|
-
}, stateTokens),
|
|
3200
|
-
orange: _buildAvatarColorTheme({
|
|
3201
|
-
color: "orange",
|
|
3202
|
-
scheme
|
|
3203
|
-
}, stateTokens),
|
|
3204
|
-
yellow: _buildAvatarColorTheme({
|
|
3205
|
-
color: "yellow",
|
|
3206
|
-
scheme
|
|
3207
|
-
}, stateTokens),
|
|
3208
|
-
green: _buildAvatarColorTheme({
|
|
3209
|
-
color: "green",
|
|
3210
|
-
scheme
|
|
3211
|
-
}, stateTokens),
|
|
3212
|
-
cyan: _buildAvatarColorTheme({
|
|
3213
|
-
color: "cyan",
|
|
3214
|
-
scheme
|
|
3215
|
-
}, stateTokens)
|
|
2673
|
+
gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
|
|
2674
|
+
blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
|
|
2675
|
+
purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
|
|
2676
|
+
magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
|
|
2677
|
+
red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
|
|
2678
|
+
orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
|
|
2679
|
+
yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
|
|
2680
|
+
green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
|
|
2681
|
+
cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
|
|
3216
2682
|
};
|
|
3217
2683
|
}
|
|
3218
2684
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
3219
2685
|
var _a;
|
|
3220
|
-
const {
|
|
3221
|
-
color,
|
|
3222
|
-
scheme
|
|
3223
|
-
} = options;
|
|
2686
|
+
const { color, scheme } = options;
|
|
3224
2687
|
const tokens = (_a = stateTokens == null ? void 0 : stateTokens.avatar) == null ? void 0 : _a[color];
|
|
3225
|
-
const context = {
|
|
3226
|
-
hue: (tokens == null ? void 0 : tokens._hue) || "gray",
|
|
3227
|
-
scheme
|
|
3228
|
-
};
|
|
2688
|
+
const context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
|
|
3229
2689
|
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3230
2690
|
return {
|
|
3231
2691
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
@@ -3234,44 +2694,21 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
3234
2694
|
};
|
|
3235
2695
|
}
|
|
3236
2696
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
3237
|
-
const {
|
|
3238
|
-
scheme
|
|
3239
|
-
} = options;
|
|
2697
|
+
const { scheme } = options;
|
|
3240
2698
|
return {
|
|
3241
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
}, config),
|
|
3245
|
-
|
|
3246
|
-
scheme,
|
|
3247
|
-
tone: "primary"
|
|
3248
|
-
}, config),
|
|
3249
|
-
positive: _buildBadgeColorTheme(tokens, {
|
|
3250
|
-
scheme,
|
|
3251
|
-
tone: "positive"
|
|
3252
|
-
}, config),
|
|
3253
|
-
caution: _buildBadgeColorTheme(tokens, {
|
|
3254
|
-
scheme,
|
|
3255
|
-
tone: "caution"
|
|
3256
|
-
}, config),
|
|
3257
|
-
critical: _buildBadgeColorTheme(tokens, {
|
|
3258
|
-
scheme,
|
|
3259
|
-
tone: "critical"
|
|
3260
|
-
}, config)
|
|
2699
|
+
default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
|
|
2700
|
+
primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
|
|
2701
|
+
positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
|
|
2702
|
+
caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
|
|
2703
|
+
critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
|
|
3261
2704
|
};
|
|
3262
2705
|
}
|
|
3263
2706
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
3264
2707
|
var _a, _b, _c;
|
|
3265
|
-
const {
|
|
3266
|
-
scheme,
|
|
3267
|
-
tone
|
|
3268
|
-
} = options;
|
|
2708
|
+
const { scheme, tone } = options;
|
|
3269
2709
|
const tokens = parentTokens == null ? void 0 : parentTokens[tone];
|
|
3270
2710
|
const hue = (tokens == null ? void 0 : tokens._hue) || ((_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone]) == null ? void 0 : _c._hue) || "gray";
|
|
3271
|
-
const context = {
|
|
3272
|
-
hue,
|
|
3273
|
-
scheme
|
|
3274
|
-
};
|
|
2711
|
+
const context = { hue, scheme };
|
|
3275
2712
|
return {
|
|
3276
2713
|
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3277
2714
|
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
@@ -3280,76 +2717,43 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
3280
2717
|
};
|
|
3281
2718
|
}
|
|
3282
2719
|
function buildButtonColorTheme(options, config) {
|
|
3283
|
-
const {
|
|
3284
|
-
scheme
|
|
3285
|
-
} = options;
|
|
2720
|
+
const { scheme } = options;
|
|
3286
2721
|
const modes = {};
|
|
3287
2722
|
for (const mode of THEME_COLOR_BUTTON_MODES) {
|
|
3288
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
3289
|
-
scheme,
|
|
3290
|
-
mode
|
|
3291
|
-
}, config);
|
|
2723
|
+
modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
|
|
3292
2724
|
}
|
|
3293
2725
|
return modes;
|
|
3294
2726
|
}
|
|
3295
2727
|
function buildButtonTonesColorTheme(options, config) {
|
|
3296
|
-
const {
|
|
3297
|
-
mode,
|
|
3298
|
-
scheme
|
|
3299
|
-
} = options;
|
|
2728
|
+
const { mode, scheme } = options;
|
|
3300
2729
|
const tones = {};
|
|
3301
2730
|
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
3302
|
-
tones[tone] = buildButtonStatesColorTheme({
|
|
3303
|
-
mode,
|
|
3304
|
-
scheme,
|
|
3305
|
-
tone
|
|
3306
|
-
}, config);
|
|
2731
|
+
tones[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
|
|
3307
2732
|
}
|
|
3308
2733
|
return tones;
|
|
3309
2734
|
}
|
|
3310
2735
|
function buildButtonStatesColorTheme(options, config) {
|
|
3311
|
-
const {
|
|
3312
|
-
mode,
|
|
3313
|
-
scheme,
|
|
3314
|
-
tone
|
|
3315
|
-
} = options;
|
|
2736
|
+
const { mode, scheme, tone } = options;
|
|
3316
2737
|
const states = {};
|
|
3317
2738
|
for (const state of THEME_COLOR_STATES) {
|
|
3318
|
-
states[state] = buildButtonStateColorTheme({
|
|
3319
|
-
mode,
|
|
3320
|
-
tone,
|
|
3321
|
-
scheme,
|
|
3322
|
-
state
|
|
3323
|
-
}, config);
|
|
2739
|
+
states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
|
|
3324
2740
|
}
|
|
3325
2741
|
return states;
|
|
3326
2742
|
}
|
|
3327
2743
|
function buildButtonStateColorTheme(options, config) {
|
|
3328
2744
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
3329
|
-
const {
|
|
3330
|
-
mode,
|
|
3331
|
-
tone,
|
|
3332
|
-
scheme,
|
|
3333
|
-
state
|
|
3334
|
-
} = options;
|
|
2745
|
+
const { mode, tone, scheme, state } = options;
|
|
3335
2746
|
const tokens = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.button) == null ? void 0 : _b[mode]) == null ? void 0 : _c[tone]) == null ? void 0 : _d[state];
|
|
3336
2747
|
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3337
2748
|
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3338
|
-
const context = {
|
|
3339
|
-
hue,
|
|
3340
|
-
scheme
|
|
3341
|
-
};
|
|
2749
|
+
const context = { hue, scheme };
|
|
3342
2750
|
return {
|
|
3343
2751
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3344
2752
|
accent: {
|
|
3345
2753
|
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _e.fg)
|
|
3346
2754
|
},
|
|
3347
|
-
avatar: buildAvatarColorTheme({
|
|
3348
|
-
|
|
3349
|
-
}, tokens),
|
|
3350
|
-
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3351
|
-
scheme
|
|
3352
|
-
}, config),
|
|
2755
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2756
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
3353
2757
|
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3354
2758
|
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3355
2759
|
code: {
|
|
@@ -3377,71 +2781,28 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
3377
2781
|
};
|
|
3378
2782
|
}
|
|
3379
2783
|
function buildInputColorTheme(options, config) {
|
|
3380
|
-
const {
|
|
3381
|
-
scheme,
|
|
3382
|
-
tone
|
|
3383
|
-
} = options;
|
|
2784
|
+
const { scheme, tone } = options;
|
|
3384
2785
|
return {
|
|
3385
|
-
default: buildInputStatesColorTheme({
|
|
3386
|
-
|
|
3387
|
-
scheme,
|
|
3388
|
-
tone
|
|
3389
|
-
}, config),
|
|
3390
|
-
invalid: buildInputStatesColorTheme({
|
|
3391
|
-
mode: "invalid",
|
|
3392
|
-
scheme,
|
|
3393
|
-
tone
|
|
3394
|
-
}, config)
|
|
2786
|
+
default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
|
|
2787
|
+
invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
|
|
3395
2788
|
};
|
|
3396
2789
|
}
|
|
3397
2790
|
function buildInputStatesColorTheme(options, config) {
|
|
3398
|
-
const {
|
|
3399
|
-
mode,
|
|
3400
|
-
scheme,
|
|
3401
|
-
tone
|
|
3402
|
-
} = options;
|
|
2791
|
+
const { mode, scheme, tone } = options;
|
|
3403
2792
|
return {
|
|
3404
|
-
enabled: buildInputStateColorTheme({
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
tone
|
|
3409
|
-
}, config),
|
|
3410
|
-
hovered: buildInputStateColorTheme({
|
|
3411
|
-
mode,
|
|
3412
|
-
scheme,
|
|
3413
|
-
state: "hovered",
|
|
3414
|
-
tone
|
|
3415
|
-
}, config),
|
|
3416
|
-
readOnly: buildInputStateColorTheme({
|
|
3417
|
-
mode,
|
|
3418
|
-
scheme,
|
|
3419
|
-
state: "readOnly",
|
|
3420
|
-
tone
|
|
3421
|
-
}, config),
|
|
3422
|
-
disabled: buildInputStateColorTheme({
|
|
3423
|
-
mode,
|
|
3424
|
-
scheme,
|
|
3425
|
-
state: "disabled",
|
|
3426
|
-
tone
|
|
3427
|
-
}, config)
|
|
2793
|
+
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
|
|
2794
|
+
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
|
|
2795
|
+
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
|
|
2796
|
+
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
|
|
3428
2797
|
};
|
|
3429
2798
|
}
|
|
3430
2799
|
function buildInputStateColorTheme(options, config) {
|
|
3431
2800
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3432
|
-
const {
|
|
3433
|
-
mode,
|
|
3434
|
-
tone,
|
|
3435
|
-
scheme,
|
|
3436
|
-
state
|
|
3437
|
-
} = options;
|
|
2801
|
+
const { mode, tone, scheme, state } = options;
|
|
3438
2802
|
const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.input) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
|
|
3439
2803
|
const hue = (tokens == null ? void 0 : tokens._hue) || ((_f = (_e = (_d = config == null ? void 0 : config.color) == null ? void 0 : _d.base) == null ? void 0 : _e[tone]) == null ? void 0 : _f._hue) || "gray";
|
|
3440
2804
|
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3441
|
-
const context = {
|
|
3442
|
-
hue,
|
|
3443
|
-
scheme
|
|
3444
|
-
};
|
|
2805
|
+
const context = { hue, scheme };
|
|
3445
2806
|
return {
|
|
3446
2807
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3447
2808
|
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
@@ -3454,58 +2815,35 @@ function buildInputStateColorTheme(options, config) {
|
|
|
3454
2815
|
};
|
|
3455
2816
|
}
|
|
3456
2817
|
function buildSelectableColorTheme(options, config) {
|
|
3457
|
-
const {
|
|
3458
|
-
scheme
|
|
3459
|
-
} = options;
|
|
2818
|
+
const { scheme } = options;
|
|
3460
2819
|
const tones = {};
|
|
3461
2820
|
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
3462
|
-
tones[tone] = buildSelectableStatesColorTheme({
|
|
3463
|
-
scheme,
|
|
3464
|
-
tone
|
|
3465
|
-
}, config);
|
|
2821
|
+
tones[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
|
|
3466
2822
|
}
|
|
3467
2823
|
return tones;
|
|
3468
2824
|
}
|
|
3469
2825
|
function buildSelectableStatesColorTheme(options, config) {
|
|
3470
|
-
const {
|
|
3471
|
-
scheme,
|
|
3472
|
-
tone
|
|
3473
|
-
} = options;
|
|
2826
|
+
const { scheme, tone } = options;
|
|
3474
2827
|
const states = {};
|
|
3475
2828
|
for (const state of THEME_COLOR_STATES) {
|
|
3476
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3477
|
-
tone,
|
|
3478
|
-
scheme,
|
|
3479
|
-
state
|
|
3480
|
-
}, config);
|
|
2829
|
+
states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
|
|
3481
2830
|
}
|
|
3482
2831
|
return states;
|
|
3483
2832
|
}
|
|
3484
2833
|
function buildSelectableStateColorTheme(options, config) {
|
|
3485
2834
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3486
|
-
const {
|
|
3487
|
-
scheme,
|
|
3488
|
-
state,
|
|
3489
|
-
tone
|
|
3490
|
-
} = options;
|
|
2835
|
+
const { scheme, state, tone } = options;
|
|
3491
2836
|
const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.selectable) == null ? void 0 : _b[tone]) == null ? void 0 : _c[state];
|
|
3492
2837
|
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3493
2838
|
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3494
|
-
const context = {
|
|
3495
|
-
hue,
|
|
3496
|
-
scheme
|
|
3497
|
-
};
|
|
2839
|
+
const context = { hue, scheme };
|
|
3498
2840
|
return {
|
|
3499
2841
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3500
2842
|
accent: {
|
|
3501
2843
|
fg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _d.fg)
|
|
3502
2844
|
},
|
|
3503
|
-
avatar: buildAvatarColorTheme({
|
|
3504
|
-
|
|
3505
|
-
}, tokens),
|
|
3506
|
-
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3507
|
-
scheme
|
|
3508
|
-
}, config),
|
|
2845
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2846
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
3509
2847
|
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3510
2848
|
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3511
2849
|
code: {
|
|
@@ -3534,14 +2872,9 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
3534
2872
|
}
|
|
3535
2873
|
function buildSyntaxColorTheme(options, config) {
|
|
3536
2874
|
var _a;
|
|
3537
|
-
const {
|
|
3538
|
-
scheme
|
|
3539
|
-
} = options;
|
|
2875
|
+
const { scheme } = options;
|
|
3540
2876
|
const tokens = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.syntax;
|
|
3541
|
-
const context = {
|
|
3542
|
-
hue: "gray",
|
|
3543
|
-
scheme
|
|
3544
|
-
};
|
|
2877
|
+
const context = { hue: "gray", scheme };
|
|
3545
2878
|
return {
|
|
3546
2879
|
atrule: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.atrule),
|
|
3547
2880
|
attrName: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrName),
|
|
@@ -3581,7 +2914,9 @@ function buildSyntaxColorTheme(options, config) {
|
|
|
3581
2914
|
variable: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.variable)
|
|
3582
2915
|
};
|
|
3583
2916
|
}
|
|
2917
|
+
|
|
3584
2918
|
const defaultColorPalette = color.color;
|
|
2919
|
+
|
|
3585
2920
|
function mixChannel(b, s, weight) {
|
|
3586
2921
|
const diff = s - b;
|
|
3587
2922
|
const delta = diff * weight;
|
|
@@ -3594,6 +2929,7 @@ function mix(b, s, weight) {
|
|
|
3594
2929
|
b: mixChannel(b.b, s.b, weight)
|
|
3595
2930
|
};
|
|
3596
2931
|
}
|
|
2932
|
+
|
|
3597
2933
|
function multiplyChannel(b, s) {
|
|
3598
2934
|
return b * s;
|
|
3599
2935
|
}
|
|
@@ -3604,6 +2940,7 @@ function multiply(b, s) {
|
|
|
3604
2940
|
b: multiplyChannel(b.b / 255, s.b / 255) * 255
|
|
3605
2941
|
};
|
|
3606
2942
|
}
|
|
2943
|
+
|
|
3607
2944
|
function screenChannel(b, s) {
|
|
3608
2945
|
return b + s - b * s;
|
|
3609
2946
|
}
|
|
@@ -3614,15 +2951,14 @@ function screen(b, s) {
|
|
|
3614
2951
|
b: screenChannel(b.b / 255, s.b / 255) * 255
|
|
3615
2952
|
};
|
|
3616
2953
|
}
|
|
2954
|
+
|
|
3617
2955
|
function lerp(x, y, a) {
|
|
3618
2956
|
return x * (1 - a) + y * a;
|
|
3619
2957
|
}
|
|
3620
2958
|
function invlerp(x, y, a) {
|
|
3621
2959
|
return clamp((a - x) / (y - x));
|
|
3622
2960
|
}
|
|
3623
|
-
function clamp(a) {
|
|
3624
|
-
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3625
|
-
let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
2961
|
+
function clamp(a, min = 0, max = 1) {
|
|
3626
2962
|
return Math.min(max, Math.max(min, a));
|
|
3627
2963
|
}
|
|
3628
2964
|
function range(x1, y1, x2, y2, a) {
|
|
@@ -3631,6 +2967,7 @@ function range(x1, y1, x2, y2, a) {
|
|
|
3631
2967
|
function round(value) {
|
|
3632
2968
|
return Math.round(value);
|
|
3633
2969
|
}
|
|
2970
|
+
|
|
3634
2971
|
function hexToRgb(hex) {
|
|
3635
2972
|
if (hex.length === 4) {
|
|
3636
2973
|
const hexR = hex.slice(1, 2);
|
|
@@ -3666,12 +3003,7 @@ function rgbToHex(color) {
|
|
|
3666
3003
|
}
|
|
3667
3004
|
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
3668
3005
|
}
|
|
3669
|
-
function rgbToHsl(
|
|
3670
|
-
let {
|
|
3671
|
-
r,
|
|
3672
|
-
g,
|
|
3673
|
-
b
|
|
3674
|
-
} = _ref8;
|
|
3006
|
+
function rgbToHsl({ r, g, b }) {
|
|
3675
3007
|
r /= 255;
|
|
3676
3008
|
g /= 255;
|
|
3677
3009
|
b /= 255;
|
|
@@ -3681,18 +3013,22 @@ function rgbToHsl(_ref8) {
|
|
|
3681
3013
|
let h = 0;
|
|
3682
3014
|
let s = 0;
|
|
3683
3015
|
let l = 0;
|
|
3684
|
-
if (delta == 0)
|
|
3016
|
+
if (delta == 0)
|
|
3017
|
+
h = 0;
|
|
3018
|
+
else if (cmax == r)
|
|
3019
|
+
h = (g - b) / delta % 6;
|
|
3020
|
+
else if (cmax == g)
|
|
3021
|
+
h = (b - r) / delta + 2;
|
|
3022
|
+
else
|
|
3023
|
+
h = (r - g) / delta + 4;
|
|
3685
3024
|
h = Math.round(h * 60);
|
|
3686
|
-
if (h < 0)
|
|
3025
|
+
if (h < 0)
|
|
3026
|
+
h += 360;
|
|
3687
3027
|
l = (cmax + cmin) / 2;
|
|
3688
3028
|
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
3689
3029
|
s = +(s * 100).toFixed(1);
|
|
3690
3030
|
l = +(l * 100).toFixed(1);
|
|
3691
|
-
return {
|
|
3692
|
-
h,
|
|
3693
|
-
s,
|
|
3694
|
-
l
|
|
3695
|
-
};
|
|
3031
|
+
return { h, s, l };
|
|
3696
3032
|
}
|
|
3697
3033
|
function hslToRgb(hsl) {
|
|
3698
3034
|
const s = hsl.s / 100;
|
|
@@ -3734,6 +3070,7 @@ function hslToRgb(hsl) {
|
|
|
3734
3070
|
b: Math.round((b + m) * 255)
|
|
3735
3071
|
};
|
|
3736
3072
|
}
|
|
3073
|
+
|
|
3737
3074
|
const HEX_CHARS = "0123456789ABCDEFabcdef";
|
|
3738
3075
|
const HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
|
|
3739
3076
|
function isHexChars(str) {
|
|
@@ -3745,8 +3082,10 @@ function isHexChars(str) {
|
|
|
3745
3082
|
return true;
|
|
3746
3083
|
}
|
|
3747
3084
|
function isHex(str) {
|
|
3748
|
-
if (str[0] !== "#")
|
|
3749
|
-
|
|
3085
|
+
if (str[0] !== "#")
|
|
3086
|
+
return false;
|
|
3087
|
+
if (!(str.length === 4 || str.length === 7))
|
|
3088
|
+
return false;
|
|
3750
3089
|
return isHexChars(str.slice(1));
|
|
3751
3090
|
}
|
|
3752
3091
|
function parseHsl(str) {
|
|
@@ -3754,18 +3093,11 @@ function parseHsl(str) {
|
|
|
3754
3093
|
if (!res) {
|
|
3755
3094
|
throw new Error('parseHsl: string is not a HSL color: "'.concat(str, '"'));
|
|
3756
3095
|
}
|
|
3757
|
-
return {
|
|
3758
|
-
h: parseInt(res[1]),
|
|
3759
|
-
s: parseFloat(res[3]),
|
|
3760
|
-
l: parseFloat(res[5])
|
|
3761
|
-
};
|
|
3096
|
+
return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
|
|
3762
3097
|
}
|
|
3763
3098
|
function parseColor(color) {
|
|
3764
|
-
if (!color)
|
|
3765
|
-
r: 0,
|
|
3766
|
-
g: 0,
|
|
3767
|
-
b: 0
|
|
3768
|
-
};
|
|
3099
|
+
if (!color)
|
|
3100
|
+
return { r: 0, g: 0, b: 0 };
|
|
3769
3101
|
if (typeof color !== "string") {
|
|
3770
3102
|
throw new Error("parseColor: expected a string");
|
|
3771
3103
|
}
|
|
@@ -3780,6 +3112,7 @@ function parseColor(color) {
|
|
|
3780
3112
|
}
|
|
3781
3113
|
throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
|
|
3782
3114
|
}
|
|
3115
|
+
|
|
3783
3116
|
function getContrastRatio(bg, fg) {
|
|
3784
3117
|
const rgb1 = parseColor(bg);
|
|
3785
3118
|
const rgb2 = parseColor(fg);
|
|
@@ -3789,30 +3122,24 @@ function getContrastRatio(bg, fg) {
|
|
|
3789
3122
|
const l2 = lrgb_luminance(c2);
|
|
3790
3123
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
3791
3124
|
}
|
|
3792
|
-
function rgb_lrgb(
|
|
3793
|
-
let {
|
|
3794
|
-
r,
|
|
3795
|
-
g,
|
|
3796
|
-
b
|
|
3797
|
-
} = _ref9;
|
|
3125
|
+
function rgb_lrgb({ r, g, b }) {
|
|
3798
3126
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
3799
3127
|
}
|
|
3800
3128
|
function rgb_lrgb1(v) {
|
|
3801
3129
|
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
3802
3130
|
}
|
|
3803
|
-
function lrgb_luminance(
|
|
3804
|
-
let [r, g, b] = _ref10;
|
|
3131
|
+
function lrgb_luminance([r, g, b]) {
|
|
3805
3132
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
3806
3133
|
}
|
|
3134
|
+
|
|
3807
3135
|
function rgba(color, a) {
|
|
3808
3136
|
const rgb = parseColor(color);
|
|
3809
3137
|
return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
|
|
3810
3138
|
}
|
|
3139
|
+
|
|
3811
3140
|
const RGB_RANGE = [0, 255];
|
|
3812
3141
|
function mixThemeColor(value, options) {
|
|
3813
|
-
const {
|
|
3814
|
-
blendMode
|
|
3815
|
-
} = options;
|
|
3142
|
+
const { blendMode } = options;
|
|
3816
3143
|
const color = parseColor(value);
|
|
3817
3144
|
const black = parseColor(options.black);
|
|
3818
3145
|
const white = parseColor(options.white);
|
|
@@ -3840,12 +3167,9 @@ function mixThemeColor(value, options) {
|
|
|
3840
3167
|
};
|
|
3841
3168
|
return rgbToHex(v);
|
|
3842
3169
|
}
|
|
3170
|
+
|
|
3843
3171
|
function renderColorValue(str, options) {
|
|
3844
|
-
const {
|
|
3845
|
-
bg,
|
|
3846
|
-
blendMode,
|
|
3847
|
-
colorPalette
|
|
3848
|
-
} = options;
|
|
3172
|
+
const { bg, blendMode, colorPalette } = options;
|
|
3849
3173
|
if (bg === "white") {
|
|
3850
3174
|
throw new Error("Cannot blend with white background");
|
|
3851
3175
|
}
|
|
@@ -3897,6 +3221,7 @@ function renderColorValue(str, options) {
|
|
|
3897
3221
|
function renderColorHex(color) {
|
|
3898
3222
|
return typeof color === "string" ? color : color.hex;
|
|
3899
3223
|
}
|
|
3224
|
+
|
|
3900
3225
|
function renderThemeColorSchemes(value, config) {
|
|
3901
3226
|
var _a;
|
|
3902
3227
|
const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
|
|
@@ -3907,51 +3232,25 @@ function renderThemeColorSchemes(value, config) {
|
|
|
3907
3232
|
}
|
|
3908
3233
|
function renderThemeColorScheme(colorPalette, value) {
|
|
3909
3234
|
const toneEntries = Object.entries(value);
|
|
3910
|
-
const [, transparentTone] = toneEntries.find(
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
});
|
|
3914
|
-
const [, defaultTone] = toneEntries.find(_ref12 => {
|
|
3915
|
-
let [k] = _ref12;
|
|
3916
|
-
return k === "default";
|
|
3917
|
-
});
|
|
3918
|
-
const renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3919
|
-
colorPalette
|
|
3920
|
-
});
|
|
3921
|
-
const renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3922
|
-
colorPalette
|
|
3923
|
-
});
|
|
3235
|
+
const [, transparentTone] = toneEntries.find(([k]) => k === "transparent");
|
|
3236
|
+
const [, defaultTone] = toneEntries.find(([k]) => k === "default");
|
|
3237
|
+
const renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette });
|
|
3238
|
+
const renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette });
|
|
3924
3239
|
const bg = renderedDefaultTone.bg;
|
|
3925
3240
|
if (bg === "white") {
|
|
3926
3241
|
throw new Error("Cannot blend with white background");
|
|
3927
3242
|
}
|
|
3928
|
-
return Object.fromEntries([
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
return [k, renderThemeColor(v, {
|
|
3934
|
-
bg,
|
|
3935
|
-
colorPalette
|
|
3936
|
-
})];
|
|
3937
|
-
})]);
|
|
3243
|
+
return Object.fromEntries([
|
|
3244
|
+
["transparent", renderedTransparentTone],
|
|
3245
|
+
["default", renderedDefaultTone],
|
|
3246
|
+
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
|
|
3247
|
+
]);
|
|
3938
3248
|
}
|
|
3939
3249
|
function renderThemeColor(value, options) {
|
|
3940
|
-
const {
|
|
3941
|
-
colorPalette,
|
|
3942
|
-
bg
|
|
3943
|
-
} = options;
|
|
3250
|
+
const { colorPalette, bg } = options;
|
|
3944
3251
|
const blendMode = value._blend || "multiply";
|
|
3945
|
-
const baseBg = renderColorValue(value.bg, {
|
|
3946
|
-
|
|
3947
|
-
bg,
|
|
3948
|
-
blendMode
|
|
3949
|
-
});
|
|
3950
|
-
const colorOptions = {
|
|
3951
|
-
colorPalette,
|
|
3952
|
-
bg: baseBg,
|
|
3953
|
-
blendMode
|
|
3954
|
-
};
|
|
3252
|
+
const baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode });
|
|
3253
|
+
const colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
3955
3254
|
const button = renderThemeColorButton(value.button, {
|
|
3956
3255
|
baseBg,
|
|
3957
3256
|
blendMode,
|
|
@@ -3967,26 +3266,17 @@ function renderThemeColor(value, options) {
|
|
|
3967
3266
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
3968
3267
|
...colorOptions,
|
|
3969
3268
|
bg: void 0,
|
|
3970
|
-
colorPalette: {
|
|
3971
|
-
...colorPalette,
|
|
3972
|
-
black: "#000000"
|
|
3973
|
-
}
|
|
3269
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3974
3270
|
}),
|
|
3975
3271
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
3976
3272
|
...colorOptions,
|
|
3977
3273
|
bg: void 0,
|
|
3978
|
-
colorPalette: {
|
|
3979
|
-
...colorPalette,
|
|
3980
|
-
black: "#000000"
|
|
3981
|
-
}
|
|
3274
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3982
3275
|
}),
|
|
3983
3276
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
3984
3277
|
...colorOptions,
|
|
3985
3278
|
bg: void 0,
|
|
3986
|
-
colorPalette: {
|
|
3987
|
-
...colorPalette,
|
|
3988
|
-
black: "#000000"
|
|
3989
|
-
}
|
|
3279
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
3990
3280
|
})
|
|
3991
3281
|
};
|
|
3992
3282
|
return {
|
|
@@ -3995,17 +3285,9 @@ function renderThemeColor(value, options) {
|
|
|
3995
3285
|
accent: {
|
|
3996
3286
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
3997
3287
|
},
|
|
3998
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3999
|
-
baseBg,
|
|
4000
|
-
colorPalette,
|
|
4001
|
-
blendMode
|
|
4002
|
-
}),
|
|
3288
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
4003
3289
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
4004
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
4005
|
-
baseBg,
|
|
4006
|
-
colorPalette,
|
|
4007
|
-
blendMode
|
|
4008
|
-
}),
|
|
3290
|
+
badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
|
|
4009
3291
|
bg: baseBg,
|
|
4010
3292
|
border: renderColorValue(value.border, colorOptions),
|
|
4011
3293
|
button,
|
|
@@ -4016,16 +3298,8 @@ function renderThemeColor(value, options) {
|
|
|
4016
3298
|
fg: renderColorValue(value.fg, colorOptions),
|
|
4017
3299
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
4018
3300
|
icon: renderColorValue(value.icon, colorOptions),
|
|
4019
|
-
input: renderThemeColorInput(value.input, {
|
|
4020
|
-
|
|
4021
|
-
colorPalette,
|
|
4022
|
-
blendMode
|
|
4023
|
-
}),
|
|
4024
|
-
kbd: renderThemeColorKBD(value.kbd, {
|
|
4025
|
-
baseBg,
|
|
4026
|
-
colorPalette,
|
|
4027
|
-
blendMode
|
|
4028
|
-
}),
|
|
3301
|
+
input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
|
|
3302
|
+
kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
|
|
4029
3303
|
link: {
|
|
4030
3304
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
4031
3305
|
},
|
|
@@ -4038,20 +3312,12 @@ function renderThemeColor(value, options) {
|
|
|
4038
3312
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
4039
3313
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
4040
3314
|
},
|
|
4041
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
4042
|
-
baseBg,
|
|
4043
|
-
colorPalette,
|
|
4044
|
-
blendMode
|
|
4045
|
-
}),
|
|
3315
|
+
syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
|
|
4046
3316
|
selectable
|
|
4047
3317
|
};
|
|
4048
3318
|
}
|
|
4049
3319
|
function renderThemeColorKBD(value, options) {
|
|
4050
|
-
const {
|
|
4051
|
-
baseBg,
|
|
4052
|
-
blendMode,
|
|
4053
|
-
colorPalette
|
|
4054
|
-
} = options;
|
|
3320
|
+
const { baseBg, blendMode, colorPalette } = options;
|
|
4055
3321
|
const rootOptions = {
|
|
4056
3322
|
bg: baseBg,
|
|
4057
3323
|
blendMode,
|
|
@@ -4083,11 +3349,7 @@ function renderThemeColorAvatar(value, options) {
|
|
|
4083
3349
|
};
|
|
4084
3350
|
}
|
|
4085
3351
|
function renderThemeColorAvatarColor(value, options) {
|
|
4086
|
-
const {
|
|
4087
|
-
baseBg,
|
|
4088
|
-
blendMode: rootBlendMode,
|
|
4089
|
-
colorPalette
|
|
4090
|
-
} = options;
|
|
3352
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
|
|
4091
3353
|
const blendMode = value._blend || "multiply";
|
|
4092
3354
|
const rootOptions = {
|
|
4093
3355
|
bg: baseBg,
|
|
@@ -4116,11 +3378,7 @@ function renderThemeColorBadge(value, options) {
|
|
|
4116
3378
|
};
|
|
4117
3379
|
}
|
|
4118
3380
|
function renderThemeColorBadgeColor(value, options) {
|
|
4119
|
-
const {
|
|
4120
|
-
baseBg,
|
|
4121
|
-
blendMode: rootBlendMode,
|
|
4122
|
-
colorPalette
|
|
4123
|
-
} = options;
|
|
3381
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
|
|
4124
3382
|
const blendMode = rootBlendMode;
|
|
4125
3383
|
const rootOptions = {
|
|
4126
3384
|
bg: baseBg,
|
|
@@ -4167,11 +3425,7 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
4167
3425
|
}
|
|
4168
3426
|
function renderThemeColorState(value, options) {
|
|
4169
3427
|
var _a, _b;
|
|
4170
|
-
const {
|
|
4171
|
-
baseBg,
|
|
4172
|
-
blendMode: rootBlendMode,
|
|
4173
|
-
colorPalette
|
|
4174
|
-
} = options;
|
|
3428
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
|
|
4175
3429
|
const blendMode = value._blend || "multiply";
|
|
4176
3430
|
const rootOptions = {
|
|
4177
3431
|
bg: baseBg,
|
|
@@ -4189,16 +3443,8 @@ function renderThemeColorState(value, options) {
|
|
|
4189
3443
|
accent: {
|
|
4190
3444
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
4191
3445
|
},
|
|
4192
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
4193
|
-
|
|
4194
|
-
colorPalette,
|
|
4195
|
-
blendMode
|
|
4196
|
-
}),
|
|
4197
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
4198
|
-
baseBg: bg,
|
|
4199
|
-
colorPalette,
|
|
4200
|
-
blendMode
|
|
4201
|
-
}),
|
|
3446
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
3447
|
+
badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
|
|
4202
3448
|
bg,
|
|
4203
3449
|
border: renderColorValue(value.border, colorOptions),
|
|
4204
3450
|
code: {
|
|
@@ -4240,23 +3486,11 @@ function renderInputStatesColorTheme(value, options) {
|
|
|
4240
3486
|
};
|
|
4241
3487
|
}
|
|
4242
3488
|
function renderInputStateColorTheme(value, options) {
|
|
4243
|
-
const {
|
|
4244
|
-
baseBg,
|
|
4245
|
-
blendMode: rootBlendMode,
|
|
4246
|
-
colorPalette
|
|
4247
|
-
} = options;
|
|
3489
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options;
|
|
4248
3490
|
const blendMode = value._blend || "multiply";
|
|
4249
|
-
const rootOptions = {
|
|
4250
|
-
colorPalette,
|
|
4251
|
-
bg: baseBg,
|
|
4252
|
-
blendMode: rootBlendMode
|
|
4253
|
-
};
|
|
3491
|
+
const rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode };
|
|
4254
3492
|
const bg = renderColorValue(value.bg, rootOptions);
|
|
4255
|
-
const colorOptions = {
|
|
4256
|
-
colorPalette,
|
|
4257
|
-
bg,
|
|
4258
|
-
blendMode
|
|
4259
|
-
};
|
|
3493
|
+
const colorOptions = { colorPalette, bg, blendMode };
|
|
4260
3494
|
return {
|
|
4261
3495
|
_blend: blendMode,
|
|
4262
3496
|
bg,
|
|
@@ -4287,16 +3521,8 @@ function renderThemeColorSelectableStates(value, options) {
|
|
|
4287
3521
|
};
|
|
4288
3522
|
}
|
|
4289
3523
|
function renderSyntaxColorTheme(value, options) {
|
|
4290
|
-
const {
|
|
4291
|
-
|
|
4292
|
-
baseBg,
|
|
4293
|
-
blendMode
|
|
4294
|
-
} = options;
|
|
4295
|
-
const colorOptions = {
|
|
4296
|
-
colorPalette,
|
|
4297
|
-
bg: baseBg,
|
|
4298
|
-
blendMode
|
|
4299
|
-
};
|
|
3524
|
+
const { colorPalette, baseBg, blendMode } = options;
|
|
3525
|
+
const colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
4300
3526
|
return {
|
|
4301
3527
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
4302
3528
|
attrName: renderColorValue(value.attrName, colorOptions),
|
|
@@ -4336,6 +3562,7 @@ function renderSyntaxColorTheme(value, options) {
|
|
|
4336
3562
|
variable: renderColorValue(value.variable, colorOptions)
|
|
4337
3563
|
};
|
|
4338
3564
|
}
|
|
3565
|
+
|
|
4339
3566
|
function buildTheme(config) {
|
|
4340
3567
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
4341
3568
|
const colorTheme = buildColorTheme(config);
|
|
@@ -4362,10 +3589,12 @@ function buildTheme(config) {
|
|
|
4362
3589
|
};
|
|
4363
3590
|
return v2_v0(v2);
|
|
4364
3591
|
}
|
|
4365
|
-
|
|
3592
|
+
|
|
3593
|
+
const cache = /* @__PURE__ */ new Map();
|
|
4366
3594
|
function getScopedTheme(themeProp, scheme, tone) {
|
|
4367
3595
|
const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
|
|
4368
|
-
if (cachedTheme)
|
|
3596
|
+
if (cachedTheme)
|
|
3597
|
+
return cachedTheme;
|
|
4369
3598
|
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp;
|
|
4370
3599
|
const v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp);
|
|
4371
3600
|
const colorScheme_v0 = v0.color[scheme] || v0.color.light;
|
|
@@ -4392,18 +3621,23 @@ function getScopedTheme(themeProp, scheme, tone) {
|
|
|
4392
3621
|
}
|
|
4393
3622
|
function _getCachedTheme(rootTheme, scheme, tone) {
|
|
4394
3623
|
const schemeCache = cache.get(scheme);
|
|
4395
|
-
if (!schemeCache)
|
|
3624
|
+
if (!schemeCache)
|
|
3625
|
+
return void 0;
|
|
4396
3626
|
const toneCache = schemeCache.get(tone);
|
|
4397
|
-
if (!toneCache)
|
|
3627
|
+
if (!toneCache)
|
|
3628
|
+
return void 0;
|
|
4398
3629
|
return toneCache.get(rootTheme);
|
|
4399
3630
|
}
|
|
4400
3631
|
function _setCachedTheme(rootTheme, scheme, tone, theme) {
|
|
4401
|
-
if (!cache.has(scheme))
|
|
3632
|
+
if (!cache.has(scheme))
|
|
3633
|
+
cache.set(scheme, /* @__PURE__ */ new Map());
|
|
4402
3634
|
const schemeCache = cache.get(scheme);
|
|
4403
|
-
if (!schemeCache.has(tone))
|
|
3635
|
+
if (!schemeCache.has(tone))
|
|
3636
|
+
schemeCache.set(tone, /* @__PURE__ */ new WeakMap());
|
|
4404
3637
|
const toneCache = schemeCache.get(tone);
|
|
4405
3638
|
toneCache.set(rootTheme, theme);
|
|
4406
3639
|
}
|
|
3640
|
+
|
|
4407
3641
|
exports.COLOR_CONFIG_AVATAR_COLORS = COLOR_CONFIG_AVATAR_COLORS;
|
|
4408
3642
|
exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
|
|
4409
3643
|
exports.COLOR_CONFIG_CARD_KEYS = COLOR_CONFIG_CARD_KEYS;
|