@sanity/ui 2.0.10 → 2.0.11
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.mts +2777 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +129 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6852 -0
- package/dist/index.mjs.map +1 -0
- package/dist/theme.d.mts +1506 -0
- package/dist/theme.mjs +3348 -0
- package/dist/theme.mjs.map +1 -0
- package/package.json +37 -38
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -1
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +1 -1
- package/src/core/components/menu/menu.tsx +1 -1
- package/src/core/components/menu/menuDivider.ts +1 -1
- package/src/core/components/skeleton/skeleton.tsx +1 -1
- package/src/core/components/skeleton/textSkeleton.tsx +1 -1
- package/src/core/components/tab/tab.tsx +1 -1
- package/src/core/components/tab/tabList.tsx +1 -1
- package/src/core/components/toast/toast.tsx +1 -1
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +1 -1
- package/src/core/primitives/_selectable/selectable.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +1 -1
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/badge.tsx +1 -1
- package/src/core/primitives/box/box.tsx +1 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/button.tsx +1 -1
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +1 -1
- package/src/core/primitives/checkbox/checkbox.tsx +1 -1
- package/src/core/primitives/code/code.tsx +1 -1
- package/src/core/primitives/container/container.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +1 -1
- package/src/core/primitives/grid/grid.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +1 -1
- package/src/core/primitives/label/label.tsx +1 -1
- package/src/core/primitives/popover/popoverCard.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/spinner/spinner.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +1 -1
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/text.tsx +1 -1
- package/src/core/primitives/textArea/textArea.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -1
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
package/dist/theme.mjs
ADDED
|
@@ -0,0 +1,3348 @@
|
|
|
1
|
+
import { COLOR_HUES, COLOR_TINTS, color } from "@sanity/color";
|
|
2
|
+
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
3
|
+
return {
|
|
4
|
+
default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
|
|
5
|
+
primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
|
|
6
|
+
positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
|
|
7
|
+
caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
|
|
8
|
+
critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
12
|
+
return {
|
|
13
|
+
enabled: opts.selectable({
|
|
14
|
+
base,
|
|
15
|
+
dark,
|
|
16
|
+
solid,
|
|
17
|
+
muted,
|
|
18
|
+
state: "enabled",
|
|
19
|
+
tone
|
|
20
|
+
}),
|
|
21
|
+
hovered: opts.selectable({
|
|
22
|
+
base,
|
|
23
|
+
dark,
|
|
24
|
+
solid,
|
|
25
|
+
muted,
|
|
26
|
+
state: "hovered",
|
|
27
|
+
tone
|
|
28
|
+
}),
|
|
29
|
+
pressed: opts.selectable({
|
|
30
|
+
base,
|
|
31
|
+
dark,
|
|
32
|
+
solid,
|
|
33
|
+
muted,
|
|
34
|
+
state: "pressed",
|
|
35
|
+
tone
|
|
36
|
+
}),
|
|
37
|
+
selected: opts.selectable({
|
|
38
|
+
base,
|
|
39
|
+
dark,
|
|
40
|
+
solid,
|
|
41
|
+
muted,
|
|
42
|
+
state: "selected",
|
|
43
|
+
tone
|
|
44
|
+
}),
|
|
45
|
+
disabled: opts.selectable({
|
|
46
|
+
base,
|
|
47
|
+
dark,
|
|
48
|
+
solid,
|
|
49
|
+
muted,
|
|
50
|
+
state: "disabled",
|
|
51
|
+
tone
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function createSolidTones(opts, base, dark, name) {
|
|
56
|
+
return {
|
|
57
|
+
default: {
|
|
58
|
+
enabled: opts.solid({ base, dark, tone: "default", name, state: "enabled" }),
|
|
59
|
+
disabled: opts.solid({ base, dark, tone: "default", name, state: "disabled" }),
|
|
60
|
+
hovered: opts.solid({ base, dark, tone: "default", name, state: "hovered" }),
|
|
61
|
+
pressed: opts.solid({ base, dark, tone: "default", name, state: "pressed" }),
|
|
62
|
+
selected: opts.solid({ base, dark, tone: "default", name, state: "selected" })
|
|
63
|
+
},
|
|
64
|
+
transparent: {
|
|
65
|
+
enabled: opts.solid({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
66
|
+
disabled: opts.solid({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
67
|
+
hovered: opts.solid({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
68
|
+
pressed: opts.solid({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
69
|
+
selected: opts.solid({ base, dark, tone: "transparent", name, state: "selected" })
|
|
70
|
+
},
|
|
71
|
+
primary: {
|
|
72
|
+
enabled: opts.solid({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
73
|
+
disabled: opts.solid({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
74
|
+
hovered: opts.solid({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
75
|
+
pressed: opts.solid({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
76
|
+
selected: opts.solid({ base, dark, tone: "primary", name, state: "selected" })
|
|
77
|
+
},
|
|
78
|
+
positive: {
|
|
79
|
+
enabled: opts.solid({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
80
|
+
disabled: opts.solid({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
81
|
+
hovered: opts.solid({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
82
|
+
pressed: opts.solid({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
83
|
+
selected: opts.solid({ base, dark, tone: "positive", name, state: "selected" })
|
|
84
|
+
},
|
|
85
|
+
caution: {
|
|
86
|
+
enabled: opts.solid({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
87
|
+
disabled: opts.solid({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
88
|
+
hovered: opts.solid({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
89
|
+
pressed: opts.solid({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
90
|
+
selected: opts.solid({ base, dark, tone: "caution", name, state: "selected" })
|
|
91
|
+
},
|
|
92
|
+
critical: {
|
|
93
|
+
enabled: opts.solid({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
94
|
+
disabled: opts.solid({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
95
|
+
hovered: opts.solid({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
96
|
+
pressed: opts.solid({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
97
|
+
selected: opts.solid({ base, dark, tone: "critical", name, state: "selected" })
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
102
|
+
return {
|
|
103
|
+
default: opts.button({
|
|
104
|
+
base,
|
|
105
|
+
dark,
|
|
106
|
+
solid: solid.default,
|
|
107
|
+
muted: muted.default,
|
|
108
|
+
mode
|
|
109
|
+
}),
|
|
110
|
+
primary: opts.button({
|
|
111
|
+
base,
|
|
112
|
+
dark,
|
|
113
|
+
solid: solid.primary,
|
|
114
|
+
muted: muted.primary,
|
|
115
|
+
mode
|
|
116
|
+
}),
|
|
117
|
+
positive: opts.button({
|
|
118
|
+
base,
|
|
119
|
+
dark,
|
|
120
|
+
solid: solid.positive,
|
|
121
|
+
muted: muted.positive,
|
|
122
|
+
mode
|
|
123
|
+
}),
|
|
124
|
+
caution: opts.button({
|
|
125
|
+
base,
|
|
126
|
+
dark,
|
|
127
|
+
solid: solid.caution,
|
|
128
|
+
muted: muted.caution,
|
|
129
|
+
mode
|
|
130
|
+
}),
|
|
131
|
+
critical: opts.button({
|
|
132
|
+
base,
|
|
133
|
+
dark,
|
|
134
|
+
solid: solid.critical,
|
|
135
|
+
muted: muted.critical,
|
|
136
|
+
mode
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function createButtonModes(opts, base, dark, solid, muted) {
|
|
141
|
+
return {
|
|
142
|
+
default: createButtonTones(opts, base, dark, solid, muted, "default"),
|
|
143
|
+
ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
|
|
144
|
+
bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function createCardStates(opts, base, dark, name, solid, muted) {
|
|
148
|
+
return {
|
|
149
|
+
enabled: opts.card({
|
|
150
|
+
base,
|
|
151
|
+
dark,
|
|
152
|
+
name,
|
|
153
|
+
state: "enabled",
|
|
154
|
+
solid,
|
|
155
|
+
muted
|
|
156
|
+
}),
|
|
157
|
+
disabled: opts.card({
|
|
158
|
+
base,
|
|
159
|
+
dark,
|
|
160
|
+
name,
|
|
161
|
+
state: "disabled",
|
|
162
|
+
solid,
|
|
163
|
+
muted
|
|
164
|
+
}),
|
|
165
|
+
hovered: opts.card({
|
|
166
|
+
base,
|
|
167
|
+
dark,
|
|
168
|
+
name,
|
|
169
|
+
state: "hovered",
|
|
170
|
+
solid,
|
|
171
|
+
muted
|
|
172
|
+
}),
|
|
173
|
+
pressed: opts.card({
|
|
174
|
+
base,
|
|
175
|
+
dark,
|
|
176
|
+
name,
|
|
177
|
+
state: "pressed",
|
|
178
|
+
solid,
|
|
179
|
+
muted
|
|
180
|
+
}),
|
|
181
|
+
selected: opts.card({
|
|
182
|
+
base,
|
|
183
|
+
dark,
|
|
184
|
+
name,
|
|
185
|
+
state: "selected",
|
|
186
|
+
solid,
|
|
187
|
+
muted
|
|
188
|
+
})
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
192
|
+
default: {
|
|
193
|
+
lightest: "hsl(0, 0%, 95%)",
|
|
194
|
+
lighter: "hsl(0, 0%, 70%)",
|
|
195
|
+
light: "hsl(0, 0%, 65%)",
|
|
196
|
+
base: "hsl(0, 0%, 50%)",
|
|
197
|
+
dark: "hsl(0, 0%, 35%)",
|
|
198
|
+
darker: "hsl(0, 0%, 20%)",
|
|
199
|
+
darkest: "hsl(0, 0%, 5%)"
|
|
200
|
+
},
|
|
201
|
+
transparent: {
|
|
202
|
+
lightest: "hsl(240, 100%, 95%)",
|
|
203
|
+
lighter: "hsl(240, 100%, 70%)",
|
|
204
|
+
light: "hsl(240, 100%, 65%)",
|
|
205
|
+
base: "hsl(240, 100%, 50%)",
|
|
206
|
+
dark: "hsl(240, 100%, 35%)",
|
|
207
|
+
darker: "hsl(240, 100%, 20%)",
|
|
208
|
+
darkest: "hsl(240, 100%, 5%)"
|
|
209
|
+
},
|
|
210
|
+
primary: {
|
|
211
|
+
lightest: "hsl(240, 100%, 95%)",
|
|
212
|
+
lighter: "hsl(240, 100%, 70%)",
|
|
213
|
+
light: "hsl(240, 100%, 65%)",
|
|
214
|
+
base: "hsl(240, 100%, 50%)",
|
|
215
|
+
dark: "hsl(240, 100%, 35%)",
|
|
216
|
+
darker: "hsl(240, 100%, 20%)",
|
|
217
|
+
darkest: "hsl(240, 100%, 5%)"
|
|
218
|
+
},
|
|
219
|
+
positive: {
|
|
220
|
+
lightest: "hsl(120, 100%, 95%)",
|
|
221
|
+
lighter: "hsl(120, 100%, 70%)",
|
|
222
|
+
light: "hsl(120, 100%, 65%)",
|
|
223
|
+
base: "hsl(120, 100%, 50%)",
|
|
224
|
+
dark: "hsl(120, 100%, 35%)",
|
|
225
|
+
darker: "hsl(120, 100%, 20%)",
|
|
226
|
+
darkest: "hsl(120, 100%, 5%)"
|
|
227
|
+
},
|
|
228
|
+
caution: {
|
|
229
|
+
lightest: "hsl(60, 100%, 95%)",
|
|
230
|
+
lighter: "hsl(60, 100%, 70%)",
|
|
231
|
+
light: "hsl(60, 100%, 65%)",
|
|
232
|
+
base: "hsl(60, 100%, 50%)",
|
|
233
|
+
dark: "hsl(60, 100%, 35%)",
|
|
234
|
+
darker: "hsl(60, 100%, 20%)",
|
|
235
|
+
darkest: "hsl(60, 100%, 5%)"
|
|
236
|
+
},
|
|
237
|
+
critical: {
|
|
238
|
+
lightest: "hsl(0, 100%, 95%)",
|
|
239
|
+
lighter: "hsl(0, 100%, 70%)",
|
|
240
|
+
light: "hsl(0, 100%, 65%)",
|
|
241
|
+
base: "hsl(0, 100%, 50%)",
|
|
242
|
+
dark: "hsl(0, 100%, 35%)",
|
|
243
|
+
darker: "hsl(0, 100%, 20%)",
|
|
244
|
+
darkest: "hsl(0, 100%, 5%)"
|
|
245
|
+
}
|
|
246
|
+
}, spots = {
|
|
247
|
+
gray: "hsl(0, 0%, 50%)",
|
|
248
|
+
red: "hsl(0, 100%, 50%)",
|
|
249
|
+
orange: "hsl(30, 100%, 50%)",
|
|
250
|
+
yellow: "hsl(60, 100%, 50%)",
|
|
251
|
+
green: "hsl(120, 100%, 50%)",
|
|
252
|
+
cyan: "hsl(180, 100%, 50%)",
|
|
253
|
+
blue: "hsl(240, 100%, 50%)",
|
|
254
|
+
purple: "hsl(270, 100%, 50%)",
|
|
255
|
+
magenta: "hsl(300, 100%, 50%)"
|
|
256
|
+
}, tones = {
|
|
257
|
+
transparent: {
|
|
258
|
+
bg: [colors.transparent.darkest, colors.transparent.lightest],
|
|
259
|
+
fg: [colors.transparent.lightest, colors.transparent.darkest],
|
|
260
|
+
border: [colors.transparent.darker, colors.transparent.lighter],
|
|
261
|
+
focusRing: [colors.transparent.base, colors.transparent.base]
|
|
262
|
+
},
|
|
263
|
+
primary: {
|
|
264
|
+
bg: [colors.primary.darkest, colors.primary.lightest],
|
|
265
|
+
fg: [colors.primary.lightest, colors.primary.darkest],
|
|
266
|
+
border: [colors.primary.darker, colors.primary.lighter],
|
|
267
|
+
focusRing: [colors.primary.base, colors.primary.base]
|
|
268
|
+
},
|
|
269
|
+
positive: {
|
|
270
|
+
bg: [colors.positive.darkest, colors.positive.lightest],
|
|
271
|
+
fg: [colors.positive.lightest, colors.positive.darkest],
|
|
272
|
+
border: [colors.positive.darker, colors.positive.lighter],
|
|
273
|
+
focusRing: [colors.positive.base, colors.positive.base]
|
|
274
|
+
},
|
|
275
|
+
caution: {
|
|
276
|
+
bg: [colors.caution.darkest, colors.caution.lightest],
|
|
277
|
+
fg: [colors.caution.lightest, colors.caution.darkest],
|
|
278
|
+
border: [colors.caution.darker, colors.caution.lighter],
|
|
279
|
+
focusRing: [colors.caution.base, colors.caution.base]
|
|
280
|
+
},
|
|
281
|
+
critical: {
|
|
282
|
+
bg: [colors.critical.darkest, colors.critical.lightest],
|
|
283
|
+
fg: [colors.critical.lightest, colors.critical.darkest],
|
|
284
|
+
border: [colors.critical.darker, colors.critical.lighter],
|
|
285
|
+
focusRing: [colors.critical.base, colors.critical.base]
|
|
286
|
+
}
|
|
287
|
+
}, defaultOpts = {
|
|
288
|
+
base: ({ dark, name }) => name === "default" ? {
|
|
289
|
+
bg: dark ? black : white,
|
|
290
|
+
fg: dark ? white : black,
|
|
291
|
+
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
292
|
+
focusRing: colors.primary.base,
|
|
293
|
+
shadow: {
|
|
294
|
+
outline: black,
|
|
295
|
+
umbra: black,
|
|
296
|
+
penumbra: black,
|
|
297
|
+
ambient: black
|
|
298
|
+
},
|
|
299
|
+
skeleton: {
|
|
300
|
+
from: dark ? white : black,
|
|
301
|
+
to: dark ? white : black
|
|
302
|
+
}
|
|
303
|
+
} : {
|
|
304
|
+
bg: tones[name].bg[dark ? 0 : 1],
|
|
305
|
+
fg: tones[name].fg[dark ? 0 : 1],
|
|
306
|
+
border: tones[name].border[dark ? 0 : 1],
|
|
307
|
+
focusRing: tones[name].focusRing[dark ? 0 : 1],
|
|
308
|
+
shadow: {
|
|
309
|
+
outline: black,
|
|
310
|
+
umbra: black,
|
|
311
|
+
penumbra: black,
|
|
312
|
+
ambient: black
|
|
313
|
+
},
|
|
314
|
+
skeleton: {
|
|
315
|
+
from: dark ? white : black,
|
|
316
|
+
to: dark ? white : black
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
solid: ({ base, dark, state, tone }) => {
|
|
320
|
+
const color2 = colors[tone];
|
|
321
|
+
return state === "hovered" ? {
|
|
322
|
+
bg: dark ? color2.light : color2.dark,
|
|
323
|
+
bg2: dark ? color2.light : color2.dark,
|
|
324
|
+
border: dark ? color2.lighter : color2.darker,
|
|
325
|
+
fg: dark ? color2.darkest : color2.lightest,
|
|
326
|
+
icon: dark ? color2.darkest : color2.lightest,
|
|
327
|
+
muted: {
|
|
328
|
+
fg: black
|
|
329
|
+
},
|
|
330
|
+
accent: {
|
|
331
|
+
fg: black
|
|
332
|
+
},
|
|
333
|
+
link: {
|
|
334
|
+
fg: black
|
|
335
|
+
},
|
|
336
|
+
code: {
|
|
337
|
+
bg: black,
|
|
338
|
+
fg: black
|
|
339
|
+
},
|
|
340
|
+
skeleton: base.skeleton
|
|
341
|
+
} : {
|
|
342
|
+
bg: color2.base,
|
|
343
|
+
bg2: color2.base,
|
|
344
|
+
border: dark ? color2.light : color2.dark,
|
|
345
|
+
fg: dark ? color2.darkest : color2.lightest,
|
|
346
|
+
icon: dark ? color2.darkest : color2.lightest,
|
|
347
|
+
muted: {
|
|
348
|
+
fg: black
|
|
349
|
+
},
|
|
350
|
+
accent: {
|
|
351
|
+
fg: black
|
|
352
|
+
},
|
|
353
|
+
link: {
|
|
354
|
+
fg: black
|
|
355
|
+
},
|
|
356
|
+
code: {
|
|
357
|
+
bg: black,
|
|
358
|
+
fg: black
|
|
359
|
+
},
|
|
360
|
+
skeleton: base.skeleton
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
muted: ({ base, dark, state, tone }) => {
|
|
364
|
+
const color2 = colors[tone];
|
|
365
|
+
return state === "hovered" ? {
|
|
366
|
+
bg: dark ? color2.darker : color2.lighter,
|
|
367
|
+
bg2: dark ? color2.darker : color2.lighter,
|
|
368
|
+
border: dark ? color2.lighter : color2.darker,
|
|
369
|
+
fg: dark ? color2.lightest : color2.darkest,
|
|
370
|
+
icon: dark ? color2.lightest : color2.darkest,
|
|
371
|
+
muted: {
|
|
372
|
+
fg: black
|
|
373
|
+
},
|
|
374
|
+
accent: {
|
|
375
|
+
fg: black
|
|
376
|
+
},
|
|
377
|
+
link: {
|
|
378
|
+
fg: black
|
|
379
|
+
},
|
|
380
|
+
code: {
|
|
381
|
+
bg: black,
|
|
382
|
+
fg: black
|
|
383
|
+
},
|
|
384
|
+
skeleton: base.skeleton
|
|
385
|
+
} : {
|
|
386
|
+
bg: dark ? color2.darkest : color2.lightest,
|
|
387
|
+
bg2: dark ? color2.darkest : color2.lightest,
|
|
388
|
+
border: dark ? color2.darker : color2.lighter,
|
|
389
|
+
fg: dark ? color2.lighter : color2.darker,
|
|
390
|
+
icon: dark ? color2.lighter : color2.darker,
|
|
391
|
+
muted: {
|
|
392
|
+
fg: black
|
|
393
|
+
},
|
|
394
|
+
accent: {
|
|
395
|
+
fg: black
|
|
396
|
+
},
|
|
397
|
+
link: {
|
|
398
|
+
fg: black
|
|
399
|
+
},
|
|
400
|
+
code: {
|
|
401
|
+
bg: black,
|
|
402
|
+
fg: black
|
|
403
|
+
},
|
|
404
|
+
skeleton: base.skeleton
|
|
405
|
+
};
|
|
406
|
+
},
|
|
407
|
+
button: ({ base, mode, muted, solid }) => mode === "bleed" ? {
|
|
408
|
+
...muted,
|
|
409
|
+
enabled: {
|
|
410
|
+
bg: "transparent",
|
|
411
|
+
bg2: "transparent",
|
|
412
|
+
fg: muted.enabled.fg,
|
|
413
|
+
icon: muted.enabled.fg,
|
|
414
|
+
border: "transparent",
|
|
415
|
+
muted: {
|
|
416
|
+
fg: black
|
|
417
|
+
},
|
|
418
|
+
accent: {
|
|
419
|
+
fg: black
|
|
420
|
+
},
|
|
421
|
+
link: {
|
|
422
|
+
fg: black
|
|
423
|
+
},
|
|
424
|
+
code: {
|
|
425
|
+
bg: black,
|
|
426
|
+
fg: black
|
|
427
|
+
},
|
|
428
|
+
skeleton: base.skeleton
|
|
429
|
+
},
|
|
430
|
+
hovered: {
|
|
431
|
+
bg: muted.enabled.bg,
|
|
432
|
+
bg2: muted.enabled.bg,
|
|
433
|
+
fg: muted.hovered.fg,
|
|
434
|
+
icon: muted.hovered.fg,
|
|
435
|
+
border: "transparent",
|
|
436
|
+
muted: {
|
|
437
|
+
fg: black
|
|
438
|
+
},
|
|
439
|
+
accent: {
|
|
440
|
+
fg: black
|
|
441
|
+
},
|
|
442
|
+
link: {
|
|
443
|
+
fg: black
|
|
444
|
+
},
|
|
445
|
+
code: {
|
|
446
|
+
bg: black,
|
|
447
|
+
fg: black
|
|
448
|
+
},
|
|
449
|
+
skeleton: base.skeleton
|
|
450
|
+
}
|
|
451
|
+
} : mode === "ghost" ? {
|
|
452
|
+
...solid,
|
|
453
|
+
enabled: muted.enabled
|
|
454
|
+
} : solid,
|
|
455
|
+
card: ({ base }) => ({
|
|
456
|
+
bg: black,
|
|
457
|
+
bg2: black,
|
|
458
|
+
fg: black,
|
|
459
|
+
icon: black,
|
|
460
|
+
border: black,
|
|
461
|
+
muted: {
|
|
462
|
+
fg: black
|
|
463
|
+
},
|
|
464
|
+
accent: {
|
|
465
|
+
fg: black
|
|
466
|
+
},
|
|
467
|
+
link: {
|
|
468
|
+
fg: black
|
|
469
|
+
},
|
|
470
|
+
code: {
|
|
471
|
+
bg: black,
|
|
472
|
+
fg: black
|
|
473
|
+
},
|
|
474
|
+
skeleton: base.skeleton
|
|
475
|
+
}),
|
|
476
|
+
input: () => ({
|
|
477
|
+
bg: black,
|
|
478
|
+
bg2: black,
|
|
479
|
+
fg: black,
|
|
480
|
+
border: black,
|
|
481
|
+
placeholder: black
|
|
482
|
+
}),
|
|
483
|
+
selectable: ({ muted, state, tone }) => muted[tone][state],
|
|
484
|
+
spot: ({ key }) => spots[key],
|
|
485
|
+
syntax: () => ({
|
|
486
|
+
atrule: black,
|
|
487
|
+
attrName: black,
|
|
488
|
+
attrValue: black,
|
|
489
|
+
attribute: black,
|
|
490
|
+
boolean: black,
|
|
491
|
+
builtin: black,
|
|
492
|
+
cdata: black,
|
|
493
|
+
char: black,
|
|
494
|
+
class: black,
|
|
495
|
+
className: black,
|
|
496
|
+
comment: black,
|
|
497
|
+
constant: black,
|
|
498
|
+
deleted: black,
|
|
499
|
+
doctype: black,
|
|
500
|
+
entity: black,
|
|
501
|
+
function: black,
|
|
502
|
+
hexcode: black,
|
|
503
|
+
id: black,
|
|
504
|
+
important: black,
|
|
505
|
+
inserted: black,
|
|
506
|
+
keyword: black,
|
|
507
|
+
number: black,
|
|
508
|
+
operator: black,
|
|
509
|
+
prolog: black,
|
|
510
|
+
property: black,
|
|
511
|
+
pseudoClass: black,
|
|
512
|
+
pseudoElement: black,
|
|
513
|
+
punctuation: black,
|
|
514
|
+
regex: black,
|
|
515
|
+
selector: black,
|
|
516
|
+
string: black,
|
|
517
|
+
symbol: black,
|
|
518
|
+
tag: black,
|
|
519
|
+
unit: black,
|
|
520
|
+
url: black,
|
|
521
|
+
variable: black
|
|
522
|
+
})
|
|
523
|
+
};
|
|
524
|
+
function createInputModes(opts, base, dark, solid, muted) {
|
|
525
|
+
return {
|
|
526
|
+
default: {
|
|
527
|
+
enabled: opts.input({
|
|
528
|
+
base,
|
|
529
|
+
dark,
|
|
530
|
+
mode: "default",
|
|
531
|
+
state: "enabled",
|
|
532
|
+
solid: solid.default,
|
|
533
|
+
muted: muted.default
|
|
534
|
+
}),
|
|
535
|
+
disabled: opts.input({
|
|
536
|
+
base,
|
|
537
|
+
dark,
|
|
538
|
+
mode: "default",
|
|
539
|
+
state: "disabled",
|
|
540
|
+
solid: solid.default,
|
|
541
|
+
muted: muted.default
|
|
542
|
+
}),
|
|
543
|
+
hovered: opts.input({
|
|
544
|
+
base,
|
|
545
|
+
dark,
|
|
546
|
+
mode: "default",
|
|
547
|
+
state: "hovered",
|
|
548
|
+
solid: solid.default,
|
|
549
|
+
muted: muted.default
|
|
550
|
+
}),
|
|
551
|
+
readOnly: opts.input({
|
|
552
|
+
base,
|
|
553
|
+
dark,
|
|
554
|
+
mode: "default",
|
|
555
|
+
state: "readOnly",
|
|
556
|
+
solid: solid.default,
|
|
557
|
+
muted: muted.default
|
|
558
|
+
})
|
|
559
|
+
},
|
|
560
|
+
invalid: {
|
|
561
|
+
enabled: opts.input({
|
|
562
|
+
base,
|
|
563
|
+
dark,
|
|
564
|
+
mode: "invalid",
|
|
565
|
+
state: "enabled",
|
|
566
|
+
solid: solid.default,
|
|
567
|
+
muted: muted.default
|
|
568
|
+
}),
|
|
569
|
+
disabled: opts.input({
|
|
570
|
+
base,
|
|
571
|
+
dark,
|
|
572
|
+
mode: "invalid",
|
|
573
|
+
state: "disabled",
|
|
574
|
+
solid: solid.default,
|
|
575
|
+
muted: muted.default
|
|
576
|
+
}),
|
|
577
|
+
hovered: opts.input({
|
|
578
|
+
base,
|
|
579
|
+
dark,
|
|
580
|
+
mode: "invalid",
|
|
581
|
+
state: "hovered",
|
|
582
|
+
solid: solid.default,
|
|
583
|
+
muted: muted.default
|
|
584
|
+
}),
|
|
585
|
+
readOnly: opts.input({
|
|
586
|
+
base,
|
|
587
|
+
dark,
|
|
588
|
+
mode: "invalid",
|
|
589
|
+
state: "readOnly",
|
|
590
|
+
solid: solid.default,
|
|
591
|
+
muted: muted.default
|
|
592
|
+
})
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function createMutedTones(opts, base, dark, name) {
|
|
597
|
+
return {
|
|
598
|
+
default: {
|
|
599
|
+
enabled: opts.muted({ base, dark, tone: "default", name, state: "enabled" }),
|
|
600
|
+
disabled: opts.muted({ base, dark, tone: "default", name, state: "disabled" }),
|
|
601
|
+
hovered: opts.muted({ base, dark, tone: "default", name, state: "hovered" }),
|
|
602
|
+
pressed: opts.muted({ base, dark, tone: "default", name, state: "pressed" }),
|
|
603
|
+
selected: opts.muted({ base, dark, tone: "default", name, state: "selected" })
|
|
604
|
+
},
|
|
605
|
+
transparent: {
|
|
606
|
+
enabled: opts.muted({ base, dark, tone: "transparent", name, state: "enabled" }),
|
|
607
|
+
disabled: opts.muted({ base, dark, tone: "transparent", name, state: "disabled" }),
|
|
608
|
+
hovered: opts.muted({ base, dark, tone: "transparent", name, state: "hovered" }),
|
|
609
|
+
pressed: opts.muted({ base, dark, tone: "transparent", name, state: "pressed" }),
|
|
610
|
+
selected: opts.muted({ base, dark, tone: "transparent", name, state: "selected" })
|
|
611
|
+
},
|
|
612
|
+
primary: {
|
|
613
|
+
enabled: opts.muted({ base, dark, tone: "primary", name, state: "enabled" }),
|
|
614
|
+
disabled: opts.muted({ base, dark, tone: "primary", name, state: "disabled" }),
|
|
615
|
+
hovered: opts.muted({ base, dark, tone: "primary", name, state: "hovered" }),
|
|
616
|
+
pressed: opts.muted({ base, dark, tone: "primary", name, state: "pressed" }),
|
|
617
|
+
selected: opts.muted({ base, dark, tone: "primary", name, state: "selected" })
|
|
618
|
+
},
|
|
619
|
+
positive: {
|
|
620
|
+
enabled: opts.muted({ base, dark, tone: "positive", name, state: "enabled" }),
|
|
621
|
+
disabled: opts.muted({ base, dark, tone: "positive", name, state: "disabled" }),
|
|
622
|
+
hovered: opts.muted({ base, dark, tone: "positive", name, state: "hovered" }),
|
|
623
|
+
pressed: opts.muted({ base, dark, tone: "positive", name, state: "pressed" }),
|
|
624
|
+
selected: opts.muted({ base, dark, tone: "positive", name, state: "selected" })
|
|
625
|
+
},
|
|
626
|
+
caution: {
|
|
627
|
+
enabled: opts.muted({ base, dark, tone: "caution", name, state: "enabled" }),
|
|
628
|
+
disabled: opts.muted({ base, dark, tone: "caution", name, state: "disabled" }),
|
|
629
|
+
hovered: opts.muted({ base, dark, tone: "caution", name, state: "hovered" }),
|
|
630
|
+
pressed: opts.muted({ base, dark, tone: "caution", name, state: "pressed" }),
|
|
631
|
+
selected: opts.muted({ base, dark, tone: "caution", name, state: "selected" })
|
|
632
|
+
},
|
|
633
|
+
critical: {
|
|
634
|
+
enabled: opts.muted({ base, dark, tone: "critical", name, state: "enabled" }),
|
|
635
|
+
disabled: opts.muted({ base, dark, tone: "critical", name, state: "disabled" }),
|
|
636
|
+
hovered: opts.muted({ base, dark, tone: "critical", name, state: "hovered" }),
|
|
637
|
+
pressed: opts.muted({ base, dark, tone: "critical", name, state: "pressed" }),
|
|
638
|
+
selected: opts.muted({ base, dark, tone: "critical", name, state: "selected" })
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function createSpot(opts, base, dark) {
|
|
643
|
+
return {
|
|
644
|
+
gray: opts.spot({ base, dark, key: "gray" }),
|
|
645
|
+
blue: opts.spot({ base, dark, key: "blue" }),
|
|
646
|
+
purple: opts.spot({ base, dark, key: "purple" }),
|
|
647
|
+
magenta: opts.spot({ base, dark, key: "magenta" }),
|
|
648
|
+
red: opts.spot({ base, dark, key: "red" }),
|
|
649
|
+
orange: opts.spot({ base, dark, key: "orange" }),
|
|
650
|
+
yellow: opts.spot({ base, dark, key: "yellow" }),
|
|
651
|
+
green: opts.spot({ base, dark, key: "green" }),
|
|
652
|
+
cyan: opts.spot({ base, dark, key: "cyan" })
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function createColorTheme(partialOpts = {}) {
|
|
656
|
+
const builders = { ...defaultOpts, ...partialOpts };
|
|
657
|
+
return {
|
|
658
|
+
light: _createColorScheme(builders, !1),
|
|
659
|
+
dark: _createColorScheme(builders, !0)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function _createColorScheme(opts, dark) {
|
|
663
|
+
return {
|
|
664
|
+
default: _createColor(opts, dark, "default"),
|
|
665
|
+
transparent: _createColor(opts, dark, "transparent"),
|
|
666
|
+
primary: _createColor(opts, dark, "primary"),
|
|
667
|
+
positive: _createColor(opts, dark, "positive"),
|
|
668
|
+
caution: _createColor(opts, dark, "caution"),
|
|
669
|
+
critical: _createColor(opts, dark, "critical")
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function _createColor(opts, dark, name) {
|
|
673
|
+
const base = opts.base({ dark, name }), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
674
|
+
return {
|
|
675
|
+
base,
|
|
676
|
+
button: createButtonModes(opts, base, dark, solid, muted),
|
|
677
|
+
card: createCardStates(opts, base, dark, name, solid, muted),
|
|
678
|
+
dark,
|
|
679
|
+
input: createInputModes(opts, base, dark, solid, muted),
|
|
680
|
+
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
681
|
+
spot: createSpot(opts, base, dark),
|
|
682
|
+
syntax: opts.syntax({ base, dark }),
|
|
683
|
+
solid,
|
|
684
|
+
muted
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
const BORDER_WIDTH = 1, OUTLINE_WIDTH = 0.5, defaultThemeConfig = {
|
|
688
|
+
_version: 2,
|
|
689
|
+
avatar: {
|
|
690
|
+
sizes: [
|
|
691
|
+
{ distance: -4, size: 19 },
|
|
692
|
+
{ distance: -4, size: 25 },
|
|
693
|
+
{ distance: -8, size: 33 },
|
|
694
|
+
{ distance: -12, size: 49 }
|
|
695
|
+
],
|
|
696
|
+
focusRing: { offset: 1, width: 1 }
|
|
697
|
+
},
|
|
698
|
+
button: {
|
|
699
|
+
textWeight: "medium",
|
|
700
|
+
border: { width: BORDER_WIDTH },
|
|
701
|
+
focusRing: { offset: -1, width: 1 }
|
|
702
|
+
},
|
|
703
|
+
card: {
|
|
704
|
+
border: { width: BORDER_WIDTH },
|
|
705
|
+
focusRing: { offset: -1, width: 1 },
|
|
706
|
+
shadow: { outline: OUTLINE_WIDTH }
|
|
707
|
+
},
|
|
708
|
+
container: [320, 640, 960, 1280, 1600, 1920],
|
|
709
|
+
media: [360, 600, 900, 1200, 1800, 2400],
|
|
710
|
+
layer: {
|
|
711
|
+
dialog: { zOffset: 600 },
|
|
712
|
+
popover: { zOffset: 400 },
|
|
713
|
+
tooltip: { zOffset: 200 }
|
|
714
|
+
},
|
|
715
|
+
radius: [0, 1, 3, 6, 9, 12, 21],
|
|
716
|
+
shadow: [
|
|
717
|
+
null,
|
|
718
|
+
{ umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0] },
|
|
719
|
+
{ umbra: [0, 3, 5, -2], penumbra: [0, 6, 10, 0], ambient: [0, 1, 18, 1] },
|
|
720
|
+
{ umbra: [0, 7, 8, -4], penumbra: [0, 12, 17, 2], ambient: [0, 5, 22, 4] },
|
|
721
|
+
{ umbra: [0, 9, 11, -5], penumbra: [0, 18, 28, 2], ambient: [0, 7, 34, 6] },
|
|
722
|
+
{ umbra: [0, 11, 15, -7], penumbra: [0, 24, 38, 3], ambient: [0, 9, 46, 8] }
|
|
723
|
+
],
|
|
724
|
+
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
725
|
+
input: {
|
|
726
|
+
border: {
|
|
727
|
+
width: BORDER_WIDTH
|
|
728
|
+
},
|
|
729
|
+
checkbox: {
|
|
730
|
+
size: 17,
|
|
731
|
+
focusRing: { offset: -1, width: 1 }
|
|
732
|
+
},
|
|
733
|
+
radio: {
|
|
734
|
+
size: 17,
|
|
735
|
+
markSize: 9,
|
|
736
|
+
focusRing: { offset: -1, width: 1 }
|
|
737
|
+
},
|
|
738
|
+
switch: {
|
|
739
|
+
width: 25,
|
|
740
|
+
height: 17,
|
|
741
|
+
padding: 5,
|
|
742
|
+
transitionDurationMs: 150,
|
|
743
|
+
transitionTimingFunction: "ease-out",
|
|
744
|
+
focusRing: { offset: 1, width: 1 }
|
|
745
|
+
},
|
|
746
|
+
select: {
|
|
747
|
+
focusRing: { offset: -1, width: 1 }
|
|
748
|
+
},
|
|
749
|
+
text: {
|
|
750
|
+
focusRing: { offset: -1, width: 1 }
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
style: {
|
|
754
|
+
button: {
|
|
755
|
+
root: {
|
|
756
|
+
transition: "background-color 100ms,border-color 100ms,color 100ms"
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
// card: {
|
|
760
|
+
// root: {
|
|
761
|
+
// transition: 'background-color 100ms,border-color 100ms,color 100ms',
|
|
762
|
+
// },
|
|
763
|
+
// },
|
|
764
|
+
}
|
|
765
|
+
}, defaultThemeFonts = {
|
|
766
|
+
code: {
|
|
767
|
+
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
768
|
+
weights: {
|
|
769
|
+
regular: 400,
|
|
770
|
+
medium: 500,
|
|
771
|
+
semibold: 600,
|
|
772
|
+
bold: 700
|
|
773
|
+
},
|
|
774
|
+
sizes: [
|
|
775
|
+
{
|
|
776
|
+
ascenderHeight: 4,
|
|
777
|
+
descenderHeight: 4,
|
|
778
|
+
fontSize: 10,
|
|
779
|
+
iconSize: 17,
|
|
780
|
+
lineHeight: 15,
|
|
781
|
+
letterSpacing: 0
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
ascenderHeight: 5,
|
|
785
|
+
descenderHeight: 5,
|
|
786
|
+
fontSize: 13,
|
|
787
|
+
iconSize: 21,
|
|
788
|
+
lineHeight: 19,
|
|
789
|
+
letterSpacing: 0
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
ascenderHeight: 6,
|
|
793
|
+
descenderHeight: 6,
|
|
794
|
+
fontSize: 16,
|
|
795
|
+
iconSize: 25,
|
|
796
|
+
lineHeight: 23,
|
|
797
|
+
letterSpacing: 0
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
ascenderHeight: 7,
|
|
801
|
+
descenderHeight: 7,
|
|
802
|
+
fontSize: 19,
|
|
803
|
+
iconSize: 29,
|
|
804
|
+
lineHeight: 27,
|
|
805
|
+
letterSpacing: 0
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
ascenderHeight: 8,
|
|
809
|
+
descenderHeight: 8,
|
|
810
|
+
fontSize: 22,
|
|
811
|
+
iconSize: 33,
|
|
812
|
+
lineHeight: 31,
|
|
813
|
+
letterSpacing: 0
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
heading: {
|
|
818
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
819
|
+
weights: {
|
|
820
|
+
regular: 700,
|
|
821
|
+
medium: 800,
|
|
822
|
+
semibold: 900,
|
|
823
|
+
bold: 900
|
|
824
|
+
},
|
|
825
|
+
sizes: [
|
|
826
|
+
{
|
|
827
|
+
ascenderHeight: 5,
|
|
828
|
+
descenderHeight: 5,
|
|
829
|
+
fontSize: 13,
|
|
830
|
+
iconSize: 17,
|
|
831
|
+
lineHeight: 19,
|
|
832
|
+
letterSpacing: 0
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
ascenderHeight: 6,
|
|
836
|
+
descenderHeight: 6,
|
|
837
|
+
fontSize: 16,
|
|
838
|
+
iconSize: 25,
|
|
839
|
+
lineHeight: 23,
|
|
840
|
+
letterSpacing: 0
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
ascenderHeight: 7,
|
|
844
|
+
descenderHeight: 7,
|
|
845
|
+
fontSize: 21,
|
|
846
|
+
iconSize: 33,
|
|
847
|
+
lineHeight: 29,
|
|
848
|
+
letterSpacing: 0
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
ascenderHeight: 8,
|
|
852
|
+
descenderHeight: 8,
|
|
853
|
+
fontSize: 27,
|
|
854
|
+
iconSize: 41,
|
|
855
|
+
lineHeight: 35,
|
|
856
|
+
letterSpacing: 0
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
ascenderHeight: 9.5,
|
|
860
|
+
descenderHeight: 8.5,
|
|
861
|
+
fontSize: 33,
|
|
862
|
+
iconSize: 49,
|
|
863
|
+
lineHeight: 41,
|
|
864
|
+
letterSpacing: 0
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
ascenderHeight: 10.5,
|
|
868
|
+
descenderHeight: 9.5,
|
|
869
|
+
fontSize: 38,
|
|
870
|
+
iconSize: 53,
|
|
871
|
+
lineHeight: 47,
|
|
872
|
+
letterSpacing: 0
|
|
873
|
+
}
|
|
874
|
+
]
|
|
875
|
+
},
|
|
876
|
+
label: {
|
|
877
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
878
|
+
weights: {
|
|
879
|
+
regular: 600,
|
|
880
|
+
medium: 700,
|
|
881
|
+
semibold: 800,
|
|
882
|
+
bold: 900
|
|
883
|
+
},
|
|
884
|
+
sizes: [
|
|
885
|
+
{
|
|
886
|
+
ascenderHeight: 2,
|
|
887
|
+
descenderHeight: 2,
|
|
888
|
+
fontSize: 8.1,
|
|
889
|
+
iconSize: 13,
|
|
890
|
+
lineHeight: 10,
|
|
891
|
+
letterSpacing: 0.5
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
ascenderHeight: 2,
|
|
895
|
+
descenderHeight: 2,
|
|
896
|
+
fontSize: 9.5,
|
|
897
|
+
iconSize: 15,
|
|
898
|
+
lineHeight: 11,
|
|
899
|
+
letterSpacing: 0.5
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
ascenderHeight: 2,
|
|
903
|
+
descenderHeight: 2,
|
|
904
|
+
fontSize: 10.8,
|
|
905
|
+
iconSize: 17,
|
|
906
|
+
lineHeight: 12,
|
|
907
|
+
letterSpacing: 0.5
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
ascenderHeight: 2,
|
|
911
|
+
descenderHeight: 2,
|
|
912
|
+
fontSize: 12.25,
|
|
913
|
+
iconSize: 19,
|
|
914
|
+
lineHeight: 13,
|
|
915
|
+
letterSpacing: 0.5
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
ascenderHeight: 2,
|
|
919
|
+
descenderHeight: 2,
|
|
920
|
+
fontSize: 13.6,
|
|
921
|
+
iconSize: 21,
|
|
922
|
+
lineHeight: 14,
|
|
923
|
+
letterSpacing: 0.5
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
ascenderHeight: 2,
|
|
927
|
+
descenderHeight: 2,
|
|
928
|
+
fontSize: 15,
|
|
929
|
+
iconSize: 23,
|
|
930
|
+
lineHeight: 15,
|
|
931
|
+
letterSpacing: 0.5
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
text: {
|
|
936
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
937
|
+
weights: {
|
|
938
|
+
regular: 400,
|
|
939
|
+
medium: 500,
|
|
940
|
+
semibold: 600,
|
|
941
|
+
bold: 700
|
|
942
|
+
},
|
|
943
|
+
sizes: [
|
|
944
|
+
{
|
|
945
|
+
ascenderHeight: 4,
|
|
946
|
+
descenderHeight: 4,
|
|
947
|
+
fontSize: 10,
|
|
948
|
+
iconSize: 17,
|
|
949
|
+
lineHeight: 15,
|
|
950
|
+
letterSpacing: 0
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
ascenderHeight: 5,
|
|
954
|
+
descenderHeight: 5,
|
|
955
|
+
fontSize: 13,
|
|
956
|
+
iconSize: 21,
|
|
957
|
+
lineHeight: 19,
|
|
958
|
+
letterSpacing: 0
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
ascenderHeight: 6,
|
|
962
|
+
descenderHeight: 6,
|
|
963
|
+
fontSize: 15,
|
|
964
|
+
iconSize: 25,
|
|
965
|
+
lineHeight: 23,
|
|
966
|
+
letterSpacing: 0
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
ascenderHeight: 7,
|
|
970
|
+
descenderHeight: 7,
|
|
971
|
+
fontSize: 18,
|
|
972
|
+
iconSize: 29,
|
|
973
|
+
lineHeight: 27,
|
|
974
|
+
letterSpacing: 0
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
ascenderHeight: 8,
|
|
978
|
+
descenderHeight: 8,
|
|
979
|
+
fontSize: 21,
|
|
980
|
+
iconSize: 33,
|
|
981
|
+
lineHeight: 31,
|
|
982
|
+
letterSpacing: 0
|
|
983
|
+
}
|
|
984
|
+
]
|
|
985
|
+
}
|
|
986
|
+
}, cache$4 = /* @__PURE__ */ new WeakMap();
|
|
987
|
+
function themeColor_v0_v2(color_v0) {
|
|
988
|
+
var _a, _b, _c;
|
|
989
|
+
const cached_v2 = cache$4.get(color_v0);
|
|
990
|
+
if (cached_v2)
|
|
991
|
+
return cached_v2;
|
|
992
|
+
const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
|
|
993
|
+
_blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
|
|
994
|
+
_dark: color_v0.dark,
|
|
995
|
+
accent: base.accent,
|
|
996
|
+
avatar: base.avatar,
|
|
997
|
+
backdrop: color_v0.base.shadow.ambient,
|
|
998
|
+
badge: base.badge,
|
|
999
|
+
bg: color_v0.base.bg,
|
|
1000
|
+
border: color_v0.base.border,
|
|
1001
|
+
button: {
|
|
1002
|
+
default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
|
|
1003
|
+
ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
|
|
1004
|
+
bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
|
|
1005
|
+
},
|
|
1006
|
+
code: base.code,
|
|
1007
|
+
fg: color_v0.base.fg,
|
|
1008
|
+
focusRing: color_v0.base.focusRing,
|
|
1009
|
+
icon: base.muted.fg,
|
|
1010
|
+
input: {
|
|
1011
|
+
default: inputStatesThemeColor_v0_v2(color_v0.input.default),
|
|
1012
|
+
invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
|
|
1013
|
+
},
|
|
1014
|
+
kbd: base.kbd,
|
|
1015
|
+
link: base.link,
|
|
1016
|
+
muted: {
|
|
1017
|
+
...base.muted,
|
|
1018
|
+
bg: ((_a = color_v0.selectable) == null ? void 0 : _a.default.enabled.bg2) || color_v0.base.bg
|
|
1019
|
+
},
|
|
1020
|
+
selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
|
|
1021
|
+
shadow: color_v0.base.shadow,
|
|
1022
|
+
skeleton: {
|
|
1023
|
+
from: ((_b = color_v0.skeleton) == null ? void 0 : _b.from) || color_v0.base.border,
|
|
1024
|
+
to: ((_c = color_v0.skeleton) == null ? void 0 : _c.to) || color_v0.base.border
|
|
1025
|
+
},
|
|
1026
|
+
syntax: color_v0.syntax
|
|
1027
|
+
};
|
|
1028
|
+
return cache$4.set(color_v0, color_v2), color_v2;
|
|
1029
|
+
}
|
|
1030
|
+
function stateTonesThemeColor_v0_v2(v0, t) {
|
|
1031
|
+
return {
|
|
1032
|
+
default: {
|
|
1033
|
+
enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
|
|
1034
|
+
hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
|
|
1035
|
+
pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
|
|
1036
|
+
selected: stateThemeColor_v0_v2(v0, t.default.selected),
|
|
1037
|
+
disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
|
|
1038
|
+
},
|
|
1039
|
+
primary: {
|
|
1040
|
+
enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
|
|
1041
|
+
hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
|
|
1042
|
+
pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
|
|
1043
|
+
selected: stateThemeColor_v0_v2(v0, t.primary.selected),
|
|
1044
|
+
disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
|
|
1045
|
+
},
|
|
1046
|
+
positive: {
|
|
1047
|
+
enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
|
|
1048
|
+
hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
|
|
1049
|
+
pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
|
|
1050
|
+
selected: stateThemeColor_v0_v2(v0, t.positive.selected),
|
|
1051
|
+
disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
|
|
1052
|
+
},
|
|
1053
|
+
caution: {
|
|
1054
|
+
enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
|
|
1055
|
+
hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
|
|
1056
|
+
pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
|
|
1057
|
+
selected: stateThemeColor_v0_v2(v0, t.caution.selected),
|
|
1058
|
+
disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
|
|
1059
|
+
},
|
|
1060
|
+
critical: {
|
|
1061
|
+
enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
|
|
1062
|
+
hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
|
|
1063
|
+
pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
|
|
1064
|
+
selected: stateThemeColor_v0_v2(v0, t.critical.selected),
|
|
1065
|
+
disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
function stateThemeColor_v0_v2(v0, state) {
|
|
1070
|
+
var _a, _b;
|
|
1071
|
+
return {
|
|
1072
|
+
...state,
|
|
1073
|
+
avatar: {
|
|
1074
|
+
gray: {
|
|
1075
|
+
bg: v0.spot.gray,
|
|
1076
|
+
fg: v0.base.bg
|
|
1077
|
+
},
|
|
1078
|
+
blue: {
|
|
1079
|
+
bg: v0.spot.blue,
|
|
1080
|
+
fg: v0.base.bg
|
|
1081
|
+
},
|
|
1082
|
+
purple: {
|
|
1083
|
+
bg: v0.spot.purple,
|
|
1084
|
+
fg: v0.base.bg
|
|
1085
|
+
},
|
|
1086
|
+
magenta: {
|
|
1087
|
+
bg: v0.spot.magenta,
|
|
1088
|
+
fg: v0.base.bg
|
|
1089
|
+
},
|
|
1090
|
+
red: {
|
|
1091
|
+
bg: v0.spot.red,
|
|
1092
|
+
fg: v0.base.bg
|
|
1093
|
+
},
|
|
1094
|
+
orange: {
|
|
1095
|
+
bg: v0.spot.orange,
|
|
1096
|
+
fg: v0.base.bg
|
|
1097
|
+
},
|
|
1098
|
+
yellow: {
|
|
1099
|
+
bg: v0.spot.yellow,
|
|
1100
|
+
fg: v0.base.bg
|
|
1101
|
+
},
|
|
1102
|
+
green: {
|
|
1103
|
+
bg: v0.spot.green,
|
|
1104
|
+
fg: v0.base.bg
|
|
1105
|
+
},
|
|
1106
|
+
cyan: {
|
|
1107
|
+
bg: v0.spot.cyan,
|
|
1108
|
+
fg: v0.base.bg
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
badge: {
|
|
1112
|
+
default: {
|
|
1113
|
+
bg: v0.muted.default.enabled.bg,
|
|
1114
|
+
fg: v0.muted.default.enabled.fg,
|
|
1115
|
+
dot: v0.muted.default.enabled.muted.fg,
|
|
1116
|
+
icon: v0.muted.default.enabled.muted.fg
|
|
1117
|
+
},
|
|
1118
|
+
primary: {
|
|
1119
|
+
bg: v0.muted.primary.enabled.bg,
|
|
1120
|
+
fg: v0.muted.primary.enabled.fg,
|
|
1121
|
+
dot: v0.muted.primary.enabled.muted.fg,
|
|
1122
|
+
icon: v0.muted.primary.enabled.muted.fg
|
|
1123
|
+
},
|
|
1124
|
+
positive: {
|
|
1125
|
+
bg: v0.muted.positive.enabled.bg,
|
|
1126
|
+
fg: v0.muted.positive.enabled.fg,
|
|
1127
|
+
dot: v0.muted.positive.enabled.muted.fg,
|
|
1128
|
+
icon: v0.muted.positive.enabled.muted.fg
|
|
1129
|
+
},
|
|
1130
|
+
caution: {
|
|
1131
|
+
bg: v0.muted.caution.enabled.bg,
|
|
1132
|
+
fg: v0.muted.caution.enabled.fg,
|
|
1133
|
+
dot: v0.muted.caution.enabled.muted.fg,
|
|
1134
|
+
icon: v0.muted.caution.enabled.muted.fg
|
|
1135
|
+
},
|
|
1136
|
+
critical: {
|
|
1137
|
+
bg: v0.muted.critical.enabled.bg,
|
|
1138
|
+
fg: v0.muted.critical.enabled.fg,
|
|
1139
|
+
dot: v0.muted.critical.enabled.muted.fg,
|
|
1140
|
+
icon: v0.muted.critical.enabled.muted.fg
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
kbd: {
|
|
1144
|
+
bg: v0.muted.default.enabled.bg,
|
|
1145
|
+
fg: v0.muted.default.enabled.fg,
|
|
1146
|
+
border: v0.muted.default.enabled.border
|
|
1147
|
+
},
|
|
1148
|
+
muted: {
|
|
1149
|
+
...v0.muted.default.enabled.muted,
|
|
1150
|
+
bg: state.bg2 || state.bg
|
|
1151
|
+
},
|
|
1152
|
+
skeleton: {
|
|
1153
|
+
from: ((_a = state.skeleton) == null ? void 0 : _a.from) || state.border,
|
|
1154
|
+
to: ((_b = state.skeleton) == null ? void 0 : _b.to) || state.border
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function inputStatesThemeColor_v0_v2(states) {
|
|
1159
|
+
return {
|
|
1160
|
+
enabled: inputStateThemeColor_v0_v2(states.enabled),
|
|
1161
|
+
disabled: inputStateThemeColor_v0_v2(states.disabled),
|
|
1162
|
+
readOnly: inputStateThemeColor_v0_v2(states.readOnly),
|
|
1163
|
+
hovered: inputStateThemeColor_v0_v2(states.hovered)
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
function inputStateThemeColor_v0_v2(state) {
|
|
1167
|
+
return {
|
|
1168
|
+
bg: state.bg,
|
|
1169
|
+
border: state.border,
|
|
1170
|
+
fg: state.fg,
|
|
1171
|
+
muted: {
|
|
1172
|
+
bg: state.bg2
|
|
1173
|
+
},
|
|
1174
|
+
placeholder: state.placeholder
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
const cache$3 = /* @__PURE__ */ new WeakMap();
|
|
1178
|
+
function getTheme_v2(theme) {
|
|
1179
|
+
var _a, _b;
|
|
1180
|
+
if ((_a = theme.sanity.v2) != null && _a._resolved)
|
|
1181
|
+
return theme.sanity.v2;
|
|
1182
|
+
const cached_v2 = cache$3.get(theme);
|
|
1183
|
+
if (cached_v2)
|
|
1184
|
+
return cached_v2;
|
|
1185
|
+
const v2 = {
|
|
1186
|
+
_version: 2,
|
|
1187
|
+
_resolved: !0,
|
|
1188
|
+
avatar: {
|
|
1189
|
+
...defaultThemeConfig.avatar,
|
|
1190
|
+
...theme.sanity.avatar
|
|
1191
|
+
},
|
|
1192
|
+
button: {
|
|
1193
|
+
...defaultThemeConfig.button,
|
|
1194
|
+
...theme.sanity.button
|
|
1195
|
+
},
|
|
1196
|
+
card: defaultThemeConfig.card,
|
|
1197
|
+
color: themeColor_v0_v2(theme.sanity.color),
|
|
1198
|
+
container: theme.sanity.container,
|
|
1199
|
+
font: theme.sanity.fonts,
|
|
1200
|
+
input: {
|
|
1201
|
+
...defaultThemeConfig.input,
|
|
1202
|
+
...theme.sanity.input,
|
|
1203
|
+
checkbox: {
|
|
1204
|
+
...defaultThemeConfig.input.checkbox,
|
|
1205
|
+
...theme.sanity.input.checkbox
|
|
1206
|
+
},
|
|
1207
|
+
radio: {
|
|
1208
|
+
...defaultThemeConfig.input.radio,
|
|
1209
|
+
...theme.sanity.input.radio
|
|
1210
|
+
},
|
|
1211
|
+
switch: {
|
|
1212
|
+
...defaultThemeConfig.input.switch,
|
|
1213
|
+
...theme.sanity.input.switch
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
layer: (_b = theme.sanity.layer) != null ? _b : defaultThemeConfig.layer,
|
|
1217
|
+
media: theme.sanity.media,
|
|
1218
|
+
radius: theme.sanity.radius,
|
|
1219
|
+
shadow: theme.sanity.shadows,
|
|
1220
|
+
space: theme.sanity.space,
|
|
1221
|
+
style: theme.sanity.styles
|
|
1222
|
+
};
|
|
1223
|
+
return cache$3.set(theme, v2), v2;
|
|
1224
|
+
}
|
|
1225
|
+
function is_v0(themeProp) {
|
|
1226
|
+
return themeProp._version === 0;
|
|
1227
|
+
}
|
|
1228
|
+
function is_v2(themeProp) {
|
|
1229
|
+
return themeProp._version === 2;
|
|
1230
|
+
}
|
|
1231
|
+
const cache$2 = /* @__PURE__ */ new WeakMap();
|
|
1232
|
+
function v0_v2(v0) {
|
|
1233
|
+
if (v0.v2)
|
|
1234
|
+
return v0.v2;
|
|
1235
|
+
const cached_v2 = cache$2.get(v0);
|
|
1236
|
+
if (cached_v2)
|
|
1237
|
+
return cached_v2;
|
|
1238
|
+
const {
|
|
1239
|
+
avatar,
|
|
1240
|
+
button,
|
|
1241
|
+
color: color2,
|
|
1242
|
+
container,
|
|
1243
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1244
|
+
focusRing: _unused_focusRing,
|
|
1245
|
+
fonts: font,
|
|
1246
|
+
input,
|
|
1247
|
+
layer,
|
|
1248
|
+
media,
|
|
1249
|
+
radius,
|
|
1250
|
+
shadows: shadow,
|
|
1251
|
+
space,
|
|
1252
|
+
styles: style
|
|
1253
|
+
} = v0, v2 = {
|
|
1254
|
+
_version: 2,
|
|
1255
|
+
avatar: {
|
|
1256
|
+
...defaultThemeConfig.avatar,
|
|
1257
|
+
...avatar
|
|
1258
|
+
},
|
|
1259
|
+
button: {
|
|
1260
|
+
...defaultThemeConfig.button,
|
|
1261
|
+
...button
|
|
1262
|
+
},
|
|
1263
|
+
card: defaultThemeConfig.card,
|
|
1264
|
+
color: {
|
|
1265
|
+
light: {
|
|
1266
|
+
transparent: themeColor_v0_v2(color2.light.transparent),
|
|
1267
|
+
default: themeColor_v0_v2(color2.light.default),
|
|
1268
|
+
primary: themeColor_v0_v2(color2.light.primary),
|
|
1269
|
+
positive: themeColor_v0_v2(color2.light.positive),
|
|
1270
|
+
caution: themeColor_v0_v2(color2.light.caution),
|
|
1271
|
+
critical: themeColor_v0_v2(color2.light.critical)
|
|
1272
|
+
},
|
|
1273
|
+
dark: {
|
|
1274
|
+
transparent: themeColor_v0_v2(color2.dark.transparent),
|
|
1275
|
+
default: themeColor_v0_v2(color2.dark.default),
|
|
1276
|
+
primary: themeColor_v0_v2(color2.dark.primary),
|
|
1277
|
+
positive: themeColor_v0_v2(color2.dark.positive),
|
|
1278
|
+
caution: themeColor_v0_v2(color2.dark.caution),
|
|
1279
|
+
critical: themeColor_v0_v2(color2.dark.critical)
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
container,
|
|
1283
|
+
font,
|
|
1284
|
+
input: {
|
|
1285
|
+
...defaultThemeConfig.input,
|
|
1286
|
+
...input,
|
|
1287
|
+
checkbox: {
|
|
1288
|
+
...defaultThemeConfig.input.checkbox,
|
|
1289
|
+
...input.checkbox
|
|
1290
|
+
},
|
|
1291
|
+
radio: {
|
|
1292
|
+
...defaultThemeConfig.input.radio,
|
|
1293
|
+
...input.radio
|
|
1294
|
+
},
|
|
1295
|
+
switch: {
|
|
1296
|
+
...defaultThemeConfig.input.switch,
|
|
1297
|
+
...input.switch
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
layer: layer != null ? layer : defaultThemeConfig.layer,
|
|
1301
|
+
media,
|
|
1302
|
+
radius,
|
|
1303
|
+
shadow,
|
|
1304
|
+
space,
|
|
1305
|
+
style
|
|
1306
|
+
};
|
|
1307
|
+
return cache$2.set(v0, v2), v2;
|
|
1308
|
+
}
|
|
1309
|
+
const cache$1 = /* @__PURE__ */ new WeakMap();
|
|
1310
|
+
function v2_v0(v2) {
|
|
1311
|
+
const cachedTheme = cache$1.get(v2);
|
|
1312
|
+
if (cachedTheme)
|
|
1313
|
+
return cachedTheme;
|
|
1314
|
+
const {
|
|
1315
|
+
avatar,
|
|
1316
|
+
button,
|
|
1317
|
+
color: color2,
|
|
1318
|
+
container,
|
|
1319
|
+
font: fonts,
|
|
1320
|
+
input,
|
|
1321
|
+
media,
|
|
1322
|
+
radius,
|
|
1323
|
+
shadow: shadows,
|
|
1324
|
+
space,
|
|
1325
|
+
style: styles
|
|
1326
|
+
} = v2;
|
|
1327
|
+
return {
|
|
1328
|
+
_version: 0,
|
|
1329
|
+
avatar,
|
|
1330
|
+
button,
|
|
1331
|
+
container,
|
|
1332
|
+
color: {
|
|
1333
|
+
light: {
|
|
1334
|
+
transparent: themeColor_v2_v0(color2.light.transparent),
|
|
1335
|
+
default: themeColor_v2_v0(color2.light.default),
|
|
1336
|
+
primary: themeColor_v2_v0(color2.light.primary),
|
|
1337
|
+
positive: themeColor_v2_v0(color2.light.positive),
|
|
1338
|
+
caution: themeColor_v2_v0(color2.light.caution),
|
|
1339
|
+
critical: themeColor_v2_v0(color2.light.critical)
|
|
1340
|
+
},
|
|
1341
|
+
dark: {
|
|
1342
|
+
transparent: themeColor_v2_v0(color2.dark.transparent),
|
|
1343
|
+
default: themeColor_v2_v0(color2.dark.default),
|
|
1344
|
+
primary: themeColor_v2_v0(color2.dark.primary),
|
|
1345
|
+
positive: themeColor_v2_v0(color2.dark.positive),
|
|
1346
|
+
caution: themeColor_v2_v0(color2.dark.caution),
|
|
1347
|
+
critical: themeColor_v2_v0(color2.dark.critical)
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
focusRing: input.text.focusRing,
|
|
1351
|
+
fonts,
|
|
1352
|
+
input,
|
|
1353
|
+
media,
|
|
1354
|
+
radius,
|
|
1355
|
+
shadows,
|
|
1356
|
+
space,
|
|
1357
|
+
styles,
|
|
1358
|
+
v2
|
|
1359
|
+
};
|
|
1360
|
+
}
|
|
1361
|
+
function themeColor_v2_v0(color_v2) {
|
|
1362
|
+
return {
|
|
1363
|
+
base: {
|
|
1364
|
+
bg: color_v2.bg,
|
|
1365
|
+
fg: color_v2.fg,
|
|
1366
|
+
border: color_v2.border,
|
|
1367
|
+
focusRing: color_v2.focusRing,
|
|
1368
|
+
shadow: color_v2.shadow
|
|
1369
|
+
},
|
|
1370
|
+
button: color_v2.button,
|
|
1371
|
+
card: color_v2.selectable.default,
|
|
1372
|
+
dark: color_v2._dark,
|
|
1373
|
+
input: {
|
|
1374
|
+
default: inputStatesThemeColor_v2_v0(color_v2.input.default),
|
|
1375
|
+
invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
|
|
1376
|
+
},
|
|
1377
|
+
muted: {
|
|
1378
|
+
...color_v2.button.ghost,
|
|
1379
|
+
transparent: color_v2.button.ghost.default
|
|
1380
|
+
},
|
|
1381
|
+
solid: {
|
|
1382
|
+
...color_v2.button.default,
|
|
1383
|
+
transparent: color_v2.button.default.default
|
|
1384
|
+
},
|
|
1385
|
+
selectable: color_v2.selectable,
|
|
1386
|
+
spot: {
|
|
1387
|
+
gray: color_v2.avatar.gray.bg,
|
|
1388
|
+
blue: color_v2.avatar.blue.bg,
|
|
1389
|
+
purple: color_v2.avatar.purple.bg,
|
|
1390
|
+
magenta: color_v2.avatar.magenta.bg,
|
|
1391
|
+
red: color_v2.avatar.red.bg,
|
|
1392
|
+
orange: color_v2.avatar.orange.bg,
|
|
1393
|
+
yellow: color_v2.avatar.yellow.bg,
|
|
1394
|
+
green: color_v2.avatar.green.bg,
|
|
1395
|
+
cyan: color_v2.avatar.cyan.bg
|
|
1396
|
+
},
|
|
1397
|
+
syntax: color_v2.syntax
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
function inputStatesThemeColor_v2_v0(t) {
|
|
1401
|
+
return {
|
|
1402
|
+
enabled: inputStateThemeColor_v2_v0(t.enabled),
|
|
1403
|
+
disabled: inputStateThemeColor_v2_v0(t.disabled),
|
|
1404
|
+
readOnly: inputStateThemeColor_v2_v0(t.readOnly),
|
|
1405
|
+
hovered: inputStateThemeColor_v2_v0(t.hovered)
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
function inputStateThemeColor_v2_v0(t) {
|
|
1409
|
+
return {
|
|
1410
|
+
bg: t.bg,
|
|
1411
|
+
bg2: t.muted.bg,
|
|
1412
|
+
border: t.border,
|
|
1413
|
+
fg: t.fg,
|
|
1414
|
+
placeholder: t.placeholder
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1418
|
+
"transparent",
|
|
1419
|
+
"default",
|
|
1420
|
+
"primary",
|
|
1421
|
+
"positive",
|
|
1422
|
+
"caution",
|
|
1423
|
+
"critical"
|
|
1424
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1425
|
+
"default",
|
|
1426
|
+
"primary",
|
|
1427
|
+
"positive",
|
|
1428
|
+
"caution",
|
|
1429
|
+
"critical"
|
|
1430
|
+
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1431
|
+
function isColorBlendModeValue(str) {
|
|
1432
|
+
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1433
|
+
}
|
|
1434
|
+
function isColorHueKey(str) {
|
|
1435
|
+
return COLOR_HUES.includes(str);
|
|
1436
|
+
}
|
|
1437
|
+
function isColorTintKey(str) {
|
|
1438
|
+
return COLOR_TINTS.includes(str);
|
|
1439
|
+
}
|
|
1440
|
+
function isColorButtonMode(str) {
|
|
1441
|
+
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1442
|
+
}
|
|
1443
|
+
const COLOR_CONFIG_STATE_KEYS = [
|
|
1444
|
+
"_hue",
|
|
1445
|
+
"bg",
|
|
1446
|
+
"fg",
|
|
1447
|
+
"border",
|
|
1448
|
+
"focusRing",
|
|
1449
|
+
"muted/fg",
|
|
1450
|
+
"accent/fg",
|
|
1451
|
+
"link/fg",
|
|
1452
|
+
"code/bg",
|
|
1453
|
+
"code/fg",
|
|
1454
|
+
"skeleton/from",
|
|
1455
|
+
"skeleton/to",
|
|
1456
|
+
"status/dot",
|
|
1457
|
+
"status/icon"
|
|
1458
|
+
], COLOR_CONFIG_CARD_KEYS = [
|
|
1459
|
+
...COLOR_CONFIG_STATE_KEYS,
|
|
1460
|
+
"_hue",
|
|
1461
|
+
"bg",
|
|
1462
|
+
"fg",
|
|
1463
|
+
"border",
|
|
1464
|
+
"focusRing",
|
|
1465
|
+
"shadow/outline",
|
|
1466
|
+
"shadow/umbra",
|
|
1467
|
+
"shadow/penumbra",
|
|
1468
|
+
"shadow/ambient"
|
|
1469
|
+
], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1470
|
+
function parseTokenKey(str) {
|
|
1471
|
+
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1472
|
+
if (isColorConfigBaseTone(segment0)) {
|
|
1473
|
+
const key = segments.join("/");
|
|
1474
|
+
if (isColorConfigBaseKey(key))
|
|
1475
|
+
return {
|
|
1476
|
+
type: "base",
|
|
1477
|
+
tone: segment0,
|
|
1478
|
+
key
|
|
1479
|
+
};
|
|
1480
|
+
if (isColorConfigBlendKey(key))
|
|
1481
|
+
return {
|
|
1482
|
+
type: "base",
|
|
1483
|
+
tone: segment0,
|
|
1484
|
+
key
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
if (segment0 === "button") {
|
|
1488
|
+
const segment1 = segments.shift() || "";
|
|
1489
|
+
if (isColorConfigStateTone(segment1)) {
|
|
1490
|
+
const segment2 = segments.shift() || "";
|
|
1491
|
+
if (isColorButtonMode(segment2)) {
|
|
1492
|
+
const key = segments.join("/");
|
|
1493
|
+
if (isColorConfigStateKey(key))
|
|
1494
|
+
return {
|
|
1495
|
+
type: "button",
|
|
1496
|
+
tone: segment1,
|
|
1497
|
+
mode: segment2,
|
|
1498
|
+
key
|
|
1499
|
+
};
|
|
1500
|
+
if (isColorConfigBlendKey(key))
|
|
1501
|
+
return {
|
|
1502
|
+
type: "button",
|
|
1503
|
+
tone: segment1,
|
|
1504
|
+
mode: segment2,
|
|
1505
|
+
key
|
|
1506
|
+
};
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
function isColorMixPercentValue(str) {
|
|
1512
|
+
return /^\d+%$/.test(str);
|
|
1513
|
+
}
|
|
1514
|
+
function parseTokenValue(str) {
|
|
1515
|
+
const segments = str.split("/");
|
|
1516
|
+
let nextSegment = segments.shift() || "";
|
|
1517
|
+
const [segment0, segment0mix] = nextSegment.split(" ");
|
|
1518
|
+
if (isColorTintKey(segment0)) {
|
|
1519
|
+
const tint = segment0, segment1 = segments.shift() || "";
|
|
1520
|
+
if (isColorMixPercentValue(segment0mix)) {
|
|
1521
|
+
const mix2 = Number(segment0mix.slice(0, -1)) / 100;
|
|
1522
|
+
return {
|
|
1523
|
+
type: "color",
|
|
1524
|
+
tint,
|
|
1525
|
+
mix: mix2
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
if (isColorOpacityValue(segment1)) {
|
|
1529
|
+
const opacity = Number(segment1);
|
|
1530
|
+
return {
|
|
1531
|
+
type: "color",
|
|
1532
|
+
tint,
|
|
1533
|
+
opacity
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
return {
|
|
1537
|
+
type: "color",
|
|
1538
|
+
tint
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
if (isColorValue(segment0)) {
|
|
1542
|
+
const key = segment0, segment1 = segments.shift() || "";
|
|
1543
|
+
if (isColorMixPercentValue(segment0mix)) {
|
|
1544
|
+
const mix2 = Number(segment0mix.slice(0, -1)) / 100;
|
|
1545
|
+
return {
|
|
1546
|
+
type: "color",
|
|
1547
|
+
key,
|
|
1548
|
+
mix: mix2
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
if (isColorOpacityValue(segment1)) {
|
|
1552
|
+
const opacity = Number(segment1);
|
|
1553
|
+
return {
|
|
1554
|
+
type: "color",
|
|
1555
|
+
key,
|
|
1556
|
+
opacity
|
|
1557
|
+
};
|
|
1558
|
+
}
|
|
1559
|
+
return {
|
|
1560
|
+
type: "color",
|
|
1561
|
+
key
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
if (isColorHueKey(segment0)) {
|
|
1565
|
+
const hue = segment0;
|
|
1566
|
+
nextSegment = segments.shift() || "";
|
|
1567
|
+
const [segment1, segment1mix] = nextSegment.split(" ");
|
|
1568
|
+
if (isColorTintKey(segment1)) {
|
|
1569
|
+
const tint = segment1, segment2 = segments.shift() || "";
|
|
1570
|
+
if (isColorMixPercentValue(segment1mix)) {
|
|
1571
|
+
const mix2 = Number(segment1mix.slice(0, -1)) / 100;
|
|
1572
|
+
return {
|
|
1573
|
+
type: "color",
|
|
1574
|
+
hue,
|
|
1575
|
+
tint,
|
|
1576
|
+
mix: mix2
|
|
1577
|
+
};
|
|
1578
|
+
}
|
|
1579
|
+
if (isColorOpacityValue(segment2)) {
|
|
1580
|
+
const opacity = Number(segment2);
|
|
1581
|
+
return {
|
|
1582
|
+
type: "color",
|
|
1583
|
+
hue,
|
|
1584
|
+
tint,
|
|
1585
|
+
opacity
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
return {
|
|
1589
|
+
type: "color",
|
|
1590
|
+
hue,
|
|
1591
|
+
tint
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
return {
|
|
1595
|
+
type: "hue",
|
|
1596
|
+
value: hue
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
if (isColorBlendModeValue(segment0))
|
|
1600
|
+
return {
|
|
1601
|
+
type: "blendMode",
|
|
1602
|
+
value: segment0
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1605
|
+
function isColorConfigBaseTone(str) {
|
|
1606
|
+
return COLOR_CONFIG_CARD_TONES.includes(str);
|
|
1607
|
+
}
|
|
1608
|
+
function isColorConfigBaseKey(str) {
|
|
1609
|
+
return COLOR_CONFIG_CARD_KEYS.includes(str);
|
|
1610
|
+
}
|
|
1611
|
+
function isColorConfigStateKey(str) {
|
|
1612
|
+
return COLOR_CONFIG_STATE_KEYS.includes(str);
|
|
1613
|
+
}
|
|
1614
|
+
function isColorConfigStateTone(str) {
|
|
1615
|
+
return COLOR_CONFIG_STATE_TONES.includes(str);
|
|
1616
|
+
}
|
|
1617
|
+
function isColorConfigBlendKey(str) {
|
|
1618
|
+
return COLOR_CONFIG_BLEND_KEYS.includes(str);
|
|
1619
|
+
}
|
|
1620
|
+
function isColorTokenValue(str) {
|
|
1621
|
+
var _a, _b;
|
|
1622
|
+
return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
|
|
1623
|
+
}
|
|
1624
|
+
function isColorValue(str) {
|
|
1625
|
+
return str === "black" || str === "white";
|
|
1626
|
+
}
|
|
1627
|
+
function isColorOpacityValue(str) {
|
|
1628
|
+
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1629
|
+
}
|
|
1630
|
+
function compileColorTokenValue(node) {
|
|
1631
|
+
let key = "";
|
|
1632
|
+
return node.key === "black" || node.key === "white" ? key = node.key : key = `${node.hue}/${node.tint}`, node.mix !== void 0 ? `${key} ${node.mix * 100}%` : (node.opacity !== void 0 && (key += `/${node.opacity}`), key);
|
|
1633
|
+
}
|
|
1634
|
+
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1635
|
+
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1636
|
+
const { hue, scheme } = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1637
|
+
if (!node || node.type !== "color")
|
|
1638
|
+
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1639
|
+
return compileColorTokenValue({ ...node, hue: node.hue || hue });
|
|
1640
|
+
}
|
|
1641
|
+
const defaultColorTokens = {
|
|
1642
|
+
base: {
|
|
1643
|
+
"*": {
|
|
1644
|
+
_blend: ["multiply", "screen"],
|
|
1645
|
+
accent: {
|
|
1646
|
+
fg: ["purple/600", "purple/400"]
|
|
1647
|
+
},
|
|
1648
|
+
avatar: {
|
|
1649
|
+
"*": {
|
|
1650
|
+
_blend: ["screen", "multiply"],
|
|
1651
|
+
bg: ["500", "400"],
|
|
1652
|
+
fg: ["white", "black"]
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
backdrop: ["gray/200/0.5", "black/0.5"],
|
|
1656
|
+
badge: {
|
|
1657
|
+
"*": {
|
|
1658
|
+
bg: ["100", "900"],
|
|
1659
|
+
fg: ["600", "400"],
|
|
1660
|
+
icon: ["500", "500"],
|
|
1661
|
+
dot: ["500", "500"]
|
|
1662
|
+
},
|
|
1663
|
+
positive: {
|
|
1664
|
+
bg: ["200 50%", "900"],
|
|
1665
|
+
fg: ["600", "500"]
|
|
1666
|
+
},
|
|
1667
|
+
caution: {
|
|
1668
|
+
bg: ["200 50%", "900"],
|
|
1669
|
+
fg: ["600", "500"]
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
bg: ["50", "950"],
|
|
1673
|
+
border: ["200", "800"],
|
|
1674
|
+
code: {
|
|
1675
|
+
bg: ["50", "950"],
|
|
1676
|
+
fg: ["600", "400"]
|
|
1677
|
+
},
|
|
1678
|
+
fg: ["800", "200"],
|
|
1679
|
+
focusRing: ["blue/500", "blue/500"],
|
|
1680
|
+
icon: ["600", "400"],
|
|
1681
|
+
kbd: {
|
|
1682
|
+
bg: ["white", "black"],
|
|
1683
|
+
fg: ["600", "400"],
|
|
1684
|
+
border: ["200", "800"]
|
|
1685
|
+
},
|
|
1686
|
+
link: {
|
|
1687
|
+
fg: ["blue/600", "blue/300"]
|
|
1688
|
+
},
|
|
1689
|
+
muted: {
|
|
1690
|
+
bg: ["50", "950"],
|
|
1691
|
+
fg: ["700 75%", "300 75%"]
|
|
1692
|
+
},
|
|
1693
|
+
shadow: {
|
|
1694
|
+
outline: ["500/0.3", "500/0.4"],
|
|
1695
|
+
umbra: ["gray/500/0.1", "black/0.2"],
|
|
1696
|
+
penumbra: ["gray/500/0.07", "black/0.14"],
|
|
1697
|
+
ambient: ["gray/500/0.06", "black/0.12"]
|
|
1698
|
+
},
|
|
1699
|
+
skeleton: {
|
|
1700
|
+
from: ["100", "900"],
|
|
1701
|
+
to: ["100 50%", "900 50%"]
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
transparent: {
|
|
1705
|
+
bg: ["50", "black"]
|
|
1706
|
+
},
|
|
1707
|
+
default: {
|
|
1708
|
+
bg: ["white", "950"],
|
|
1709
|
+
fg: ["800", "200"],
|
|
1710
|
+
muted: {
|
|
1711
|
+
fg: ["600", "400"]
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
primary: { _hue: "blue" },
|
|
1715
|
+
positive: {
|
|
1716
|
+
_hue: "green",
|
|
1717
|
+
shadow: { outline: ["500/0.4", "500/0.4"] }
|
|
1718
|
+
},
|
|
1719
|
+
caution: {
|
|
1720
|
+
_hue: "yellow",
|
|
1721
|
+
shadow: { outline: ["600/0.3", "500/0.4"] }
|
|
1722
|
+
},
|
|
1723
|
+
critical: { _hue: "red" }
|
|
1724
|
+
},
|
|
1725
|
+
button: {
|
|
1726
|
+
default: {
|
|
1727
|
+
"*": {
|
|
1728
|
+
"*": {
|
|
1729
|
+
_blend: ["screen", "multiply"],
|
|
1730
|
+
accent: {
|
|
1731
|
+
fg: ["purple/300", "purple/700"]
|
|
1732
|
+
},
|
|
1733
|
+
avatar: {
|
|
1734
|
+
"*": {
|
|
1735
|
+
_blend: ["multiply", "screen"],
|
|
1736
|
+
bg: ["white", "black"],
|
|
1737
|
+
fg: ["black", "white"]
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
badge: {
|
|
1741
|
+
"*": {
|
|
1742
|
+
bg: ["900", "100"],
|
|
1743
|
+
fg: ["400", "600"],
|
|
1744
|
+
dot: ["500", "500"],
|
|
1745
|
+
icon: ["500", "500"]
|
|
1746
|
+
}
|
|
1747
|
+
},
|
|
1748
|
+
bg: ["500", "400"],
|
|
1749
|
+
border: ["500/0", "400/0"],
|
|
1750
|
+
code: {
|
|
1751
|
+
bg: ["500 20%", "400 20%"],
|
|
1752
|
+
fg: ["200", "600"]
|
|
1753
|
+
},
|
|
1754
|
+
fg: ["white", "black"],
|
|
1755
|
+
icon: ["100 70%", "900 70%"],
|
|
1756
|
+
kbd: {
|
|
1757
|
+
bg: ["black", "white"],
|
|
1758
|
+
fg: ["200", "600"],
|
|
1759
|
+
border: ["800", "200"]
|
|
1760
|
+
},
|
|
1761
|
+
link: {
|
|
1762
|
+
fg: ["blue/200", "blue/600"]
|
|
1763
|
+
},
|
|
1764
|
+
muted: {
|
|
1765
|
+
bg: ["950", "50"],
|
|
1766
|
+
fg: ["100 70%", "900 70%"]
|
|
1767
|
+
},
|
|
1768
|
+
skeleton: {
|
|
1769
|
+
from: ["900", "100"],
|
|
1770
|
+
to: ["900 50%", "100 50%"]
|
|
1771
|
+
}
|
|
1772
|
+
},
|
|
1773
|
+
hovered: {
|
|
1774
|
+
bg: ["700", "300"],
|
|
1775
|
+
border: ["700/0", "300/0"]
|
|
1776
|
+
},
|
|
1777
|
+
pressed: {
|
|
1778
|
+
bg: ["700", "300"]
|
|
1779
|
+
},
|
|
1780
|
+
selected: {
|
|
1781
|
+
bg: ["700", "300"]
|
|
1782
|
+
},
|
|
1783
|
+
disabled: {
|
|
1784
|
+
_hue: "gray",
|
|
1785
|
+
accent: {
|
|
1786
|
+
fg: ["100 70%", "900 70%"]
|
|
1787
|
+
},
|
|
1788
|
+
badge: {
|
|
1789
|
+
"*": {
|
|
1790
|
+
bg: ["gray/700", "gray/300"],
|
|
1791
|
+
fg: ["white", "black"],
|
|
1792
|
+
dot: ["white", "black"],
|
|
1793
|
+
icon: ["white", "black"]
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
bg: ["200", "800"],
|
|
1797
|
+
kbd: {
|
|
1798
|
+
bg: ["black", "white"],
|
|
1799
|
+
fg: ["white", "black"],
|
|
1800
|
+
border: ["700", "300"]
|
|
1801
|
+
},
|
|
1802
|
+
link: {
|
|
1803
|
+
fg: ["100 70%", "900 70%"]
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
default: {
|
|
1808
|
+
"*": {
|
|
1809
|
+
bg: ["800", "200"],
|
|
1810
|
+
muted: {
|
|
1811
|
+
bg: ["950", "50"],
|
|
1812
|
+
fg: ["400", "600"]
|
|
1813
|
+
}
|
|
1814
|
+
},
|
|
1815
|
+
hovered: {
|
|
1816
|
+
bg: ["900", "100"]
|
|
1817
|
+
},
|
|
1818
|
+
pressed: {
|
|
1819
|
+
bg: ["black", "white"]
|
|
1820
|
+
},
|
|
1821
|
+
selected: {
|
|
1822
|
+
bg: ["black", "white"]
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
ghost: {
|
|
1827
|
+
"*": {
|
|
1828
|
+
"*": {
|
|
1829
|
+
_blend: ["multiply", "screen"],
|
|
1830
|
+
accent: {
|
|
1831
|
+
fg: ["purple/700 60%", "purple/300 70%"]
|
|
1832
|
+
},
|
|
1833
|
+
badge: {
|
|
1834
|
+
"*": {
|
|
1835
|
+
bg: ["100", "900"],
|
|
1836
|
+
fg: ["600", "400"],
|
|
1837
|
+
dot: ["500", "500"],
|
|
1838
|
+
icon: ["500", "500"]
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
bg: ["50", "950"],
|
|
1842
|
+
border: ["100", "900"],
|
|
1843
|
+
code: {
|
|
1844
|
+
bg: ["500 10%", "400 10%"],
|
|
1845
|
+
fg: ["700 60%", "400 60%"]
|
|
1846
|
+
},
|
|
1847
|
+
fg: ["600", "400"],
|
|
1848
|
+
icon: ["700 60%", "300 60%"],
|
|
1849
|
+
kbd: {
|
|
1850
|
+
bg: ["white", "black"],
|
|
1851
|
+
fg: ["600", "400"],
|
|
1852
|
+
border: ["200", "800"]
|
|
1853
|
+
},
|
|
1854
|
+
link: {
|
|
1855
|
+
fg: ["blue/700 60%", "blue/300 60%"]
|
|
1856
|
+
},
|
|
1857
|
+
muted: {
|
|
1858
|
+
bg: ["100", "950"],
|
|
1859
|
+
fg: ["700 60%", "300 60%"]
|
|
1860
|
+
},
|
|
1861
|
+
skeleton: {
|
|
1862
|
+
from: ["100", "900"],
|
|
1863
|
+
to: ["100 50%", "900 50%"]
|
|
1864
|
+
}
|
|
1865
|
+
},
|
|
1866
|
+
hovered: {
|
|
1867
|
+
bg: ["100", "900"],
|
|
1868
|
+
fg: ["700", "300"]
|
|
1869
|
+
},
|
|
1870
|
+
pressed: {
|
|
1871
|
+
bg: ["100", "900"],
|
|
1872
|
+
fg: ["800", "200"]
|
|
1873
|
+
},
|
|
1874
|
+
selected: {
|
|
1875
|
+
bg: ["100", "900"],
|
|
1876
|
+
fg: ["800", "200"]
|
|
1877
|
+
},
|
|
1878
|
+
disabled: {
|
|
1879
|
+
_hue: "gray",
|
|
1880
|
+
accent: {
|
|
1881
|
+
fg: ["200", "800"]
|
|
1882
|
+
},
|
|
1883
|
+
badge: {
|
|
1884
|
+
"*": {
|
|
1885
|
+
_hue: "gray",
|
|
1886
|
+
bg: ["50", "950"],
|
|
1887
|
+
fg: ["gray/200", "gray/800"],
|
|
1888
|
+
dot: ["gray/200", "gray/800"],
|
|
1889
|
+
icon: ["gray/200", "gray/800"]
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
border: ["100", "900"],
|
|
1893
|
+
code: {
|
|
1894
|
+
bg: ["50", "950"],
|
|
1895
|
+
fg: ["200", "800"]
|
|
1896
|
+
},
|
|
1897
|
+
fg: ["200", "800"],
|
|
1898
|
+
icon: ["200", "800"],
|
|
1899
|
+
kbd: {
|
|
1900
|
+
bg: ["white", "black"],
|
|
1901
|
+
fg: ["200", "800"],
|
|
1902
|
+
border: ["100", "900"]
|
|
1903
|
+
},
|
|
1904
|
+
link: {
|
|
1905
|
+
fg: ["200", "800"]
|
|
1906
|
+
},
|
|
1907
|
+
muted: {
|
|
1908
|
+
fg: ["200", "800"]
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
},
|
|
1912
|
+
positive: {
|
|
1913
|
+
"*": {
|
|
1914
|
+
border: ["600 20%", "800"]
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
caution: {
|
|
1918
|
+
"*": {
|
|
1919
|
+
border: ["600 20%", "800"]
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
},
|
|
1923
|
+
bleed: {
|
|
1924
|
+
"*": {
|
|
1925
|
+
"*": {
|
|
1926
|
+
_blend: ["multiply", "screen"],
|
|
1927
|
+
accent: {
|
|
1928
|
+
fg: ["purple/700 70%", "purple/300 70%"]
|
|
1929
|
+
},
|
|
1930
|
+
badge: {
|
|
1931
|
+
"*": {
|
|
1932
|
+
bg: ["100", "900"],
|
|
1933
|
+
fg: ["600", "400"],
|
|
1934
|
+
dot: ["500", "500"],
|
|
1935
|
+
icon: ["500", "500"]
|
|
1936
|
+
}
|
|
1937
|
+
},
|
|
1938
|
+
bg: ["white", "black"],
|
|
1939
|
+
border: ["white/0", "black/0"],
|
|
1940
|
+
code: {
|
|
1941
|
+
bg: ["50", "950"],
|
|
1942
|
+
fg: ["700 75%", "300 75%"]
|
|
1943
|
+
},
|
|
1944
|
+
fg: ["700", "300"],
|
|
1945
|
+
icon: ["700 75%", "300 75%"],
|
|
1946
|
+
kbd: {
|
|
1947
|
+
bg: ["white", "black"],
|
|
1948
|
+
fg: ["700", "300"],
|
|
1949
|
+
border: ["200", "800"]
|
|
1950
|
+
},
|
|
1951
|
+
link: {
|
|
1952
|
+
fg: ["blue/700 70%", "blue/300 70%"]
|
|
1953
|
+
},
|
|
1954
|
+
muted: {
|
|
1955
|
+
bg: ["100", "950"],
|
|
1956
|
+
fg: ["700 75%", "300 75%"]
|
|
1957
|
+
},
|
|
1958
|
+
skeleton: {
|
|
1959
|
+
from: ["100", "900"],
|
|
1960
|
+
to: ["100 50%", "900 50%"]
|
|
1961
|
+
}
|
|
1962
|
+
},
|
|
1963
|
+
hovered: {
|
|
1964
|
+
bg: ["50", "950"],
|
|
1965
|
+
icon: ["700 70%", "400 70%"]
|
|
1966
|
+
},
|
|
1967
|
+
pressed: {
|
|
1968
|
+
bg: ["100", "900"],
|
|
1969
|
+
fg: ["800", "200"],
|
|
1970
|
+
icon: ["800 70%", "200 70%"]
|
|
1971
|
+
},
|
|
1972
|
+
selected: {
|
|
1973
|
+
bg: ["100", "900"],
|
|
1974
|
+
fg: ["800", "200"],
|
|
1975
|
+
icon: ["800 60%", "200 60%"]
|
|
1976
|
+
},
|
|
1977
|
+
disabled: {
|
|
1978
|
+
_hue: "gray",
|
|
1979
|
+
accent: {
|
|
1980
|
+
fg: ["200", "800"]
|
|
1981
|
+
},
|
|
1982
|
+
badge: {
|
|
1983
|
+
"*": {
|
|
1984
|
+
_hue: "gray",
|
|
1985
|
+
bg: ["50", "950"],
|
|
1986
|
+
fg: ["gray/200", "gray/800"],
|
|
1987
|
+
dot: ["gray/200", "gray/800"],
|
|
1988
|
+
icon: ["gray/200", "gray/800"]
|
|
1989
|
+
}
|
|
1990
|
+
},
|
|
1991
|
+
code: {
|
|
1992
|
+
bg: ["50", "950"],
|
|
1993
|
+
fg: ["200", "800"]
|
|
1994
|
+
},
|
|
1995
|
+
fg: ["200", "800"],
|
|
1996
|
+
icon: ["200", "800"],
|
|
1997
|
+
kbd: {
|
|
1998
|
+
bg: ["white", "black"],
|
|
1999
|
+
fg: ["200", "800"],
|
|
2000
|
+
border: ["100", "900"]
|
|
2001
|
+
},
|
|
2002
|
+
link: {
|
|
2003
|
+
fg: ["200", "800"]
|
|
2004
|
+
},
|
|
2005
|
+
muted: {
|
|
2006
|
+
fg: ["200", "800"]
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
},
|
|
2012
|
+
input: {
|
|
2013
|
+
"*": {
|
|
2014
|
+
"*": {
|
|
2015
|
+
_blend: ["multiply", "screen"],
|
|
2016
|
+
bg: ["white", "black"],
|
|
2017
|
+
border: ["200", "800"],
|
|
2018
|
+
fg: ["black", "200"],
|
|
2019
|
+
muted: {
|
|
2020
|
+
bg: ["50", "950"]
|
|
2021
|
+
},
|
|
2022
|
+
placeholder: ["400", "600 50%"]
|
|
2023
|
+
},
|
|
2024
|
+
hovered: {
|
|
2025
|
+
border: ["300", "700"]
|
|
2026
|
+
},
|
|
2027
|
+
readOnly: {
|
|
2028
|
+
bg: ["50", "950"],
|
|
2029
|
+
border: ["200", "800"],
|
|
2030
|
+
fg: ["800", "200"]
|
|
2031
|
+
},
|
|
2032
|
+
disabled: {
|
|
2033
|
+
fg: ["200", "800"],
|
|
2034
|
+
border: ["100", "900"]
|
|
2035
|
+
}
|
|
2036
|
+
},
|
|
2037
|
+
invalid: {
|
|
2038
|
+
"*": {
|
|
2039
|
+
_hue: "red",
|
|
2040
|
+
bg: ["100", "950"]
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
},
|
|
2044
|
+
selectable: {
|
|
2045
|
+
"*": {
|
|
2046
|
+
"*": {
|
|
2047
|
+
_blend: ["multiply", "screen"],
|
|
2048
|
+
accent: {
|
|
2049
|
+
fg: ["purple/700 70%", "purple/300 70%"]
|
|
2050
|
+
},
|
|
2051
|
+
badge: {
|
|
2052
|
+
"*": {
|
|
2053
|
+
bg: ["100", "900"],
|
|
2054
|
+
fg: ["600", "400"],
|
|
2055
|
+
dot: ["500", "500"],
|
|
2056
|
+
icon: ["500", "500"]
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
bg: ["white", "black"],
|
|
2060
|
+
border: ["200", "800"],
|
|
2061
|
+
code: {
|
|
2062
|
+
bg: ["50", "950"],
|
|
2063
|
+
fg: ["600", "400"]
|
|
2064
|
+
},
|
|
2065
|
+
fg: ["700", "300"],
|
|
2066
|
+
icon: ["700 75%", "300 75%"],
|
|
2067
|
+
kbd: {
|
|
2068
|
+
bg: ["white", "black"],
|
|
2069
|
+
fg: ["600", "400"],
|
|
2070
|
+
border: ["200", "800"]
|
|
2071
|
+
},
|
|
2072
|
+
link: {
|
|
2073
|
+
fg: ["blue/700 70%", "blue/300 70%"]
|
|
2074
|
+
},
|
|
2075
|
+
muted: {
|
|
2076
|
+
bg: ["100", "950"],
|
|
2077
|
+
fg: ["700 75%", "300 75%"]
|
|
2078
|
+
},
|
|
2079
|
+
skeleton: {
|
|
2080
|
+
from: ["100", "900"],
|
|
2081
|
+
to: ["100 50%", "900 50%"]
|
|
2082
|
+
}
|
|
2083
|
+
},
|
|
2084
|
+
hovered: {
|
|
2085
|
+
bg: ["50", "950"]
|
|
2086
|
+
},
|
|
2087
|
+
pressed: {
|
|
2088
|
+
bg: ["100", "900"]
|
|
2089
|
+
},
|
|
2090
|
+
selected: {
|
|
2091
|
+
_blend: ["screen", "multiply"],
|
|
2092
|
+
accent: {
|
|
2093
|
+
fg: ["purple/300", "purple/700"]
|
|
2094
|
+
},
|
|
2095
|
+
avatar: {
|
|
2096
|
+
"*": {
|
|
2097
|
+
_blend: ["multiply", "screen"],
|
|
2098
|
+
bg: ["white", "black"],
|
|
2099
|
+
fg: ["black", "white"]
|
|
2100
|
+
}
|
|
2101
|
+
},
|
|
2102
|
+
badge: {
|
|
2103
|
+
"*": {
|
|
2104
|
+
bg: ["900", "100"],
|
|
2105
|
+
fg: ["400", "600"],
|
|
2106
|
+
dot: ["500", "500"],
|
|
2107
|
+
icon: ["500", "500"]
|
|
2108
|
+
}
|
|
2109
|
+
},
|
|
2110
|
+
bg: ["500", "400"],
|
|
2111
|
+
border: ["500 20%", "400 20%"],
|
|
2112
|
+
code: {
|
|
2113
|
+
bg: ["500 20%", "400 20%"],
|
|
2114
|
+
fg: ["200", "600"]
|
|
2115
|
+
},
|
|
2116
|
+
fg: ["white", "black"],
|
|
2117
|
+
icon: ["100 70%", "900 70%"],
|
|
2118
|
+
kbd: {
|
|
2119
|
+
bg: ["black", "white"],
|
|
2120
|
+
fg: ["200", "600"],
|
|
2121
|
+
border: ["800", "200"]
|
|
2122
|
+
},
|
|
2123
|
+
link: {
|
|
2124
|
+
fg: ["blue/200", "blue/600"]
|
|
2125
|
+
},
|
|
2126
|
+
muted: {
|
|
2127
|
+
bg: ["950", "50"],
|
|
2128
|
+
fg: ["100 70%", "900 70%"]
|
|
2129
|
+
},
|
|
2130
|
+
skeleton: {
|
|
2131
|
+
from: ["900", "100"],
|
|
2132
|
+
to: ["900 50%", "100 50%"]
|
|
2133
|
+
}
|
|
2134
|
+
},
|
|
2135
|
+
disabled: {
|
|
2136
|
+
_hue: "gray",
|
|
2137
|
+
accent: {
|
|
2138
|
+
fg: ["200", "800"]
|
|
2139
|
+
},
|
|
2140
|
+
badge: {
|
|
2141
|
+
"*": {
|
|
2142
|
+
_hue: "gray",
|
|
2143
|
+
bg: ["50", "950"],
|
|
2144
|
+
fg: ["gray/200", "gray/800"],
|
|
2145
|
+
dot: ["gray/200", "gray/800"],
|
|
2146
|
+
icon: ["gray/200", "gray/800"]
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
2149
|
+
border: ["100", "900"],
|
|
2150
|
+
code: {
|
|
2151
|
+
bg: ["50", "950"],
|
|
2152
|
+
fg: ["200", "800"]
|
|
2153
|
+
},
|
|
2154
|
+
fg: ["200", "800"],
|
|
2155
|
+
icon: ["200", "800"],
|
|
2156
|
+
kbd: {
|
|
2157
|
+
bg: ["white", "black"],
|
|
2158
|
+
fg: ["200", "800"],
|
|
2159
|
+
border: ["100", "900"]
|
|
2160
|
+
},
|
|
2161
|
+
link: {
|
|
2162
|
+
fg: ["200", "800"]
|
|
2163
|
+
},
|
|
2164
|
+
muted: {
|
|
2165
|
+
fg: ["200", "800"]
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
},
|
|
2169
|
+
default: {
|
|
2170
|
+
selected: {
|
|
2171
|
+
_hue: "blue"
|
|
2172
|
+
}
|
|
2173
|
+
},
|
|
2174
|
+
critical: {
|
|
2175
|
+
disabled: {
|
|
2176
|
+
bg: ["50 50%", "950 50%"]
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
},
|
|
2180
|
+
syntax: {
|
|
2181
|
+
atrule: ["purple/600", "purple/400"],
|
|
2182
|
+
attrName: ["green/600", "green/400"],
|
|
2183
|
+
attrValue: ["yellow/600", "yellow/400"],
|
|
2184
|
+
attribute: ["yellow/600", "yellow/400"],
|
|
2185
|
+
boolean: ["purple/600", "purple/400"],
|
|
2186
|
+
builtin: ["purple/600", "purple/400"],
|
|
2187
|
+
cdata: ["yellow/600", "yellow/400"],
|
|
2188
|
+
char: ["yellow/600", "yellow/400"],
|
|
2189
|
+
class: ["orange/600", "orange/400"],
|
|
2190
|
+
className: ["cyan/600", "cyan/400"],
|
|
2191
|
+
comment: ["gray/400", "gray/600"],
|
|
2192
|
+
constant: ["purple/600", "purple/400"],
|
|
2193
|
+
deleted: ["red/600", "red/400"],
|
|
2194
|
+
entity: ["red/600", "red/400"],
|
|
2195
|
+
function: ["green/600", "green/400"],
|
|
2196
|
+
hexcode: ["blue/600", "blue/400"],
|
|
2197
|
+
id: ["purple/600", "purple/400"],
|
|
2198
|
+
important: ["purple/600", "purple/400"],
|
|
2199
|
+
inserted: ["yellow/600", "yellow/400"],
|
|
2200
|
+
keyword: ["magenta/600", "magenta/400"],
|
|
2201
|
+
number: ["purple/600", "purple/400"],
|
|
2202
|
+
operator: ["magenta/600", "magenta/400"],
|
|
2203
|
+
property: ["blue/600", "blue/400"],
|
|
2204
|
+
pseudoClass: ["yellow/600", "yellow/400"],
|
|
2205
|
+
pseudoElement: ["yellow/600", "yellow/400"],
|
|
2206
|
+
punctuation: ["gray/600", "gray/400"],
|
|
2207
|
+
regex: ["blue/600", "blue/400"],
|
|
2208
|
+
selector: ["red/600", "red/400"],
|
|
2209
|
+
string: ["yellow/600", "yellow/400"],
|
|
2210
|
+
symbol: ["purple/600", "purple/400"],
|
|
2211
|
+
tag: ["red/600", "red/400"],
|
|
2212
|
+
unit: ["orange/600", "orange/400"],
|
|
2213
|
+
url: ["red/600", "red/400"],
|
|
2214
|
+
variable: ["red/600", "red/400"]
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2217
|
+
function isRecord(value) {
|
|
2218
|
+
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
2219
|
+
}
|
|
2220
|
+
function merge(...records) {
|
|
2221
|
+
const _records = records.filter(Boolean);
|
|
2222
|
+
return _records.length === 0 ? {} : _records.reduce(_merge, {});
|
|
2223
|
+
}
|
|
2224
|
+
function _merge(acc, source) {
|
|
2225
|
+
for (const key of Object.keys(source)) {
|
|
2226
|
+
const prevValue = acc[key], nextValue = source[key];
|
|
2227
|
+
isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
|
|
2228
|
+
}
|
|
2229
|
+
return acc;
|
|
2230
|
+
}
|
|
2231
|
+
function resolveColorTokens(inputTokens) {
|
|
2232
|
+
const tokens = merge(defaultColorTokens, inputTokens);
|
|
2233
|
+
return {
|
|
2234
|
+
base: resolveBaseColorTokens(tokens),
|
|
2235
|
+
button: resolveButtonColorTokens(tokens),
|
|
2236
|
+
input: resolveInputColorTokens(tokens),
|
|
2237
|
+
selectable: resolveSelectableColorTokens(tokens),
|
|
2238
|
+
syntax: tokens.syntax
|
|
2239
|
+
};
|
|
2240
|
+
}
|
|
2241
|
+
function resolveBaseColorTokens(sparseTokens) {
|
|
2242
|
+
const tokens = {};
|
|
2243
|
+
for (const tone of THEME_COLOR_CARD_TONES)
|
|
2244
|
+
tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
2245
|
+
return tokens;
|
|
2246
|
+
}
|
|
2247
|
+
function resolveBaseColorTones(inputTokens, tone) {
|
|
2248
|
+
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;
|
|
2249
|
+
const spec = merge((_a = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _a["*"], (_b = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _b[tone]), hue = spec._hue || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue) || "gray";
|
|
2250
|
+
return {
|
|
2251
|
+
...spec,
|
|
2252
|
+
_hue: hue,
|
|
2253
|
+
avatar: {
|
|
2254
|
+
gray: merge({ _hue: "gray" }, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
|
|
2255
|
+
blue: merge({ _hue: "blue" }, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
|
|
2256
|
+
purple: merge({ _hue: "purple" }, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
|
|
2257
|
+
magenta: merge({ _hue: "magenta" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
|
|
2258
|
+
red: merge({ _hue: "red" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
|
|
2259
|
+
orange: merge({ _hue: "orange" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
|
|
2260
|
+
yellow: merge({ _hue: "yellow" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
|
|
2261
|
+
green: merge({ _hue: "green" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
|
|
2262
|
+
cyan: merge({ _hue: "cyan" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
|
|
2263
|
+
},
|
|
2264
|
+
badge: {
|
|
2265
|
+
default: {
|
|
2266
|
+
_hue: ((_x = (_w = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _w.default) == null ? void 0 : _x._hue) || hue,
|
|
2267
|
+
...(_y = spec.badge) == null ? void 0 : _y["*"],
|
|
2268
|
+
...(_z = spec.badge) == null ? void 0 : _z.default
|
|
2269
|
+
},
|
|
2270
|
+
primary: {
|
|
2271
|
+
_hue: ((_B = (_A = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _A.primary) == null ? void 0 : _B._hue) || hue,
|
|
2272
|
+
...(_C = spec.badge) == null ? void 0 : _C["*"],
|
|
2273
|
+
...(_D = spec.badge) == null ? void 0 : _D.primary
|
|
2274
|
+
},
|
|
2275
|
+
positive: {
|
|
2276
|
+
_hue: ((_F = (_E = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _E.positive) == null ? void 0 : _F._hue) || hue,
|
|
2277
|
+
...(_G = spec.badge) == null ? void 0 : _G["*"],
|
|
2278
|
+
...(_H = spec.badge) == null ? void 0 : _H.positive
|
|
2279
|
+
},
|
|
2280
|
+
caution: {
|
|
2281
|
+
_hue: ((_J = (_I = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _I.caution) == null ? void 0 : _J._hue) || hue,
|
|
2282
|
+
...(_K = spec.badge) == null ? void 0 : _K["*"],
|
|
2283
|
+
...(_L = spec.badge) == null ? void 0 : _L.caution
|
|
2284
|
+
},
|
|
2285
|
+
critical: {
|
|
2286
|
+
_hue: ((_N = (_M = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _M.critical) == null ? void 0 : _N._hue) || hue,
|
|
2287
|
+
...(_O = spec.badge) == null ? void 0 : _O["*"],
|
|
2288
|
+
...(_P = spec.badge) == null ? void 0 : _P.critical
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
function resolveButtonColorTokens(inputTokens) {
|
|
2294
|
+
const tokens = {};
|
|
2295
|
+
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2296
|
+
tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
|
|
2297
|
+
return tokens;
|
|
2298
|
+
}
|
|
2299
|
+
function resolveButtonToneColorTokens(inputTokens, mode) {
|
|
2300
|
+
const tokens = {};
|
|
2301
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2302
|
+
tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
|
|
2303
|
+
return tokens;
|
|
2304
|
+
}
|
|
2305
|
+
function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
2306
|
+
const tokens = {};
|
|
2307
|
+
for (const state of THEME_COLOR_STATES)
|
|
2308
|
+
tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
|
|
2309
|
+
return tokens;
|
|
2310
|
+
}
|
|
2311
|
+
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2312
|
+
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;
|
|
2313
|
+
const spec = merge(
|
|
2314
|
+
(_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"],
|
|
2315
|
+
(_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"],
|
|
2316
|
+
(_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state],
|
|
2317
|
+
(_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]
|
|
2318
|
+
), hue = spec._hue || ((_n = (_m = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue);
|
|
2319
|
+
return {
|
|
2320
|
+
...spec,
|
|
2321
|
+
_hue: hue,
|
|
2322
|
+
avatar: {
|
|
2323
|
+
gray: merge({ _hue: "gray" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
|
|
2324
|
+
blue: merge({ _hue: "blue" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
|
|
2325
|
+
purple: merge({ _hue: "purple" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
|
|
2326
|
+
magenta: merge({ _hue: "magenta" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
|
|
2327
|
+
red: merge({ _hue: "red" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
|
|
2328
|
+
orange: merge({ _hue: "orange" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
|
|
2329
|
+
yellow: merge({ _hue: "yellow" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
|
|
2330
|
+
green: merge({ _hue: "green" }, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
|
|
2331
|
+
cyan: merge({ _hue: "cyan" }, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
|
|
2332
|
+
},
|
|
2333
|
+
badge: {
|
|
2334
|
+
default: {
|
|
2335
|
+
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.default) == null ? void 0 : _H._hue,
|
|
2336
|
+
...(_I = spec.badge) == null ? void 0 : _I["*"],
|
|
2337
|
+
...(_J = spec.badge) == null ? void 0 : _J.default
|
|
2338
|
+
},
|
|
2339
|
+
primary: {
|
|
2340
|
+
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.primary) == null ? void 0 : _L._hue,
|
|
2341
|
+
...(_M = spec.badge) == null ? void 0 : _M["*"],
|
|
2342
|
+
...(_N = spec.badge) == null ? void 0 : _N.primary
|
|
2343
|
+
},
|
|
2344
|
+
positive: {
|
|
2345
|
+
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.positive) == null ? void 0 : _P._hue,
|
|
2346
|
+
...(_Q = spec.badge) == null ? void 0 : _Q["*"],
|
|
2347
|
+
...(_R = spec.badge) == null ? void 0 : _R.positive
|
|
2348
|
+
},
|
|
2349
|
+
caution: {
|
|
2350
|
+
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.caution) == null ? void 0 : _T._hue,
|
|
2351
|
+
...(_U = spec.badge) == null ? void 0 : _U["*"],
|
|
2352
|
+
...(_V = spec.badge) == null ? void 0 : _V.caution
|
|
2353
|
+
},
|
|
2354
|
+
critical: {
|
|
2355
|
+
_hue: (_X = (_W = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _W.critical) == null ? void 0 : _X._hue,
|
|
2356
|
+
...(_Y = spec.badge) == null ? void 0 : _Y["*"],
|
|
2357
|
+
...(_Z = spec.badge) == null ? void 0 : _Z.critical
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
function resolveInputColorTokens(inputTokens) {
|
|
2363
|
+
const tokens = {};
|
|
2364
|
+
for (const mode of THEME_COLOR_INPUT_MODES)
|
|
2365
|
+
tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
|
|
2366
|
+
return tokens;
|
|
2367
|
+
}
|
|
2368
|
+
function resolveInputModeColorTokens(inputTokens, mode) {
|
|
2369
|
+
const states = {};
|
|
2370
|
+
for (const state of THEME_COLOR_INPUT_STATES)
|
|
2371
|
+
states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
|
|
2372
|
+
return states;
|
|
2373
|
+
}
|
|
2374
|
+
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2375
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2376
|
+
const spec = merge(
|
|
2377
|
+
(_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
|
|
2378
|
+
(_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"],
|
|
2379
|
+
(_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
|
|
2380
|
+
(_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]
|
|
2381
|
+
), hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _i[mode]) == null ? void 0 : _j._hue);
|
|
2382
|
+
return { ...spec, _hue: hue };
|
|
2383
|
+
}
|
|
2384
|
+
function resolveSelectableColorTokens(inputTokens) {
|
|
2385
|
+
const tokens = {};
|
|
2386
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2387
|
+
tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
|
|
2388
|
+
return tokens;
|
|
2389
|
+
}
|
|
2390
|
+
function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
2391
|
+
var _a, _b, _c, _d;
|
|
2392
|
+
const states = {
|
|
2393
|
+
_hue: ((_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a[tone]) == null ? void 0 : _b._hue) || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue)
|
|
2394
|
+
};
|
|
2395
|
+
for (const state of THEME_COLOR_STATES)
|
|
2396
|
+
states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
|
|
2397
|
+
return states;
|
|
2398
|
+
}
|
|
2399
|
+
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2400
|
+
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;
|
|
2401
|
+
const spec = merge(
|
|
2402
|
+
(_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"],
|
|
2403
|
+
(_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"],
|
|
2404
|
+
(_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state],
|
|
2405
|
+
(_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]
|
|
2406
|
+
), hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _i[tone]) == null ? void 0 : _j._hue);
|
|
2407
|
+
return {
|
|
2408
|
+
...spec,
|
|
2409
|
+
_hue: hue,
|
|
2410
|
+
avatar: {
|
|
2411
|
+
gray: merge({ _hue: "gray" }, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
|
|
2412
|
+
blue: merge({ _hue: "blue" }, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
|
|
2413
|
+
purple: merge({ _hue: "purple" }, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
|
|
2414
|
+
magenta: merge({ _hue: "magenta" }, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
|
|
2415
|
+
red: merge({ _hue: "red" }, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
|
|
2416
|
+
orange: merge({ _hue: "orange" }, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
|
|
2417
|
+
yellow: merge({ _hue: "yellow" }, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
|
|
2418
|
+
green: merge({ _hue: "green" }, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
|
|
2419
|
+
cyan: merge({ _hue: "cyan" }, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
|
|
2420
|
+
},
|
|
2421
|
+
badge: {
|
|
2422
|
+
default: {
|
|
2423
|
+
_hue: (_D = (_C = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _C.default) == null ? void 0 : _D._hue,
|
|
2424
|
+
...(_E = spec.badge) == null ? void 0 : _E["*"],
|
|
2425
|
+
...(_F = spec.badge) == null ? void 0 : _F.default
|
|
2426
|
+
},
|
|
2427
|
+
primary: {
|
|
2428
|
+
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.primary) == null ? void 0 : _H._hue,
|
|
2429
|
+
...(_I = spec.badge) == null ? void 0 : _I["*"],
|
|
2430
|
+
...(_J = spec.badge) == null ? void 0 : _J.primary
|
|
2431
|
+
},
|
|
2432
|
+
positive: {
|
|
2433
|
+
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.positive) == null ? void 0 : _L._hue,
|
|
2434
|
+
...(_M = spec.badge) == null ? void 0 : _M["*"],
|
|
2435
|
+
...(_N = spec.badge) == null ? void 0 : _N.positive
|
|
2436
|
+
},
|
|
2437
|
+
caution: {
|
|
2438
|
+
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.caution) == null ? void 0 : _P._hue,
|
|
2439
|
+
...(_Q = spec.badge) == null ? void 0 : _Q["*"],
|
|
2440
|
+
...(_R = spec.badge) == null ? void 0 : _R.caution
|
|
2441
|
+
},
|
|
2442
|
+
critical: {
|
|
2443
|
+
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.critical) == null ? void 0 : _T._hue,
|
|
2444
|
+
...(_U = spec.badge) == null ? void 0 : _U["*"],
|
|
2445
|
+
...(_V = spec.badge) == null ? void 0 : _V.critical
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
function buildColorTheme(config) {
|
|
2451
|
+
const resolvedConfig = {
|
|
2452
|
+
...config,
|
|
2453
|
+
color: resolveColorTokens(config == null ? void 0 : config.color)
|
|
2454
|
+
};
|
|
2455
|
+
return {
|
|
2456
|
+
light: buildColorScheme({ scheme: "light" }, resolvedConfig),
|
|
2457
|
+
dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
|
|
2458
|
+
};
|
|
2459
|
+
}
|
|
2460
|
+
function buildColorScheme(options, config) {
|
|
2461
|
+
const { scheme } = options;
|
|
2462
|
+
return {
|
|
2463
|
+
transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
|
|
2464
|
+
default: buildCardColorTheme({ scheme, tone: "default" }, config),
|
|
2465
|
+
primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
|
|
2466
|
+
positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
|
|
2467
|
+
caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
|
|
2468
|
+
critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
function buildCardColorTheme(options, config) {
|
|
2472
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2473
|
+
const { scheme, tone } = options, tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
|
|
2474
|
+
return {
|
|
2475
|
+
_blend: ((tokens == null ? void 0 : tokens._blend) || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2476
|
+
_dark: scheme === "dark",
|
|
2477
|
+
accent: {
|
|
2478
|
+
fg: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _c.fg)
|
|
2479
|
+
},
|
|
2480
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2481
|
+
backdrop: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.backdrop),
|
|
2482
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
2483
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2484
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
2485
|
+
button: buildButtonColorTheme({ scheme }, config),
|
|
2486
|
+
code: {
|
|
2487
|
+
bg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.code) == null ? void 0 : _d.bg),
|
|
2488
|
+
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.fg)
|
|
2489
|
+
},
|
|
2490
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
2491
|
+
focusRing: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.focusRing),
|
|
2492
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
2493
|
+
input: buildInputColorTheme({ scheme, tone }, config),
|
|
2494
|
+
kbd: {
|
|
2495
|
+
bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _f.bg),
|
|
2496
|
+
fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _g.fg),
|
|
2497
|
+
border: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _h.border)
|
|
2498
|
+
},
|
|
2499
|
+
link: {
|
|
2500
|
+
fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.link) == null ? void 0 : _i.fg)
|
|
2501
|
+
},
|
|
2502
|
+
muted: {
|
|
2503
|
+
bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _j.bg),
|
|
2504
|
+
fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _k.fg)
|
|
2505
|
+
},
|
|
2506
|
+
selectable: buildSelectableColorTheme({ scheme }, config),
|
|
2507
|
+
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
2508
|
+
skeleton: {
|
|
2509
|
+
from: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _l.from),
|
|
2510
|
+
to: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.to)
|
|
2511
|
+
},
|
|
2512
|
+
syntax: buildSyntaxColorTheme({ scheme }, config)
|
|
2513
|
+
};
|
|
2514
|
+
}
|
|
2515
|
+
function buildShadowColorTheme(options, config) {
|
|
2516
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2517
|
+
const { scheme, tone } = options, tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
|
|
2518
|
+
return {
|
|
2519
|
+
outline: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline),
|
|
2520
|
+
umbra: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra),
|
|
2521
|
+
penumbra: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra),
|
|
2522
|
+
ambient: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient)
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
function buildAvatarColorTheme(options, stateTokens) {
|
|
2526
|
+
const { scheme } = options;
|
|
2527
|
+
return {
|
|
2528
|
+
gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
|
|
2529
|
+
blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
|
|
2530
|
+
purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
|
|
2531
|
+
magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
|
|
2532
|
+
red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
|
|
2533
|
+
orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
|
|
2534
|
+
yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
|
|
2535
|
+
green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
|
|
2536
|
+
cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2540
|
+
var _a;
|
|
2541
|
+
const { color: color2, scheme } = options, tokens = (_a = stateTokens == null ? void 0 : stateTokens.avatar) == null ? void 0 : _a[color2], context = { hue: (tokens == null ? void 0 : tokens._hue) || "gray", scheme };
|
|
2542
|
+
return {
|
|
2543
|
+
_blend: ((tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2544
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2545
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg)
|
|
2546
|
+
};
|
|
2547
|
+
}
|
|
2548
|
+
function buildBadgeColorTheme(tokens, options, config) {
|
|
2549
|
+
const { scheme } = options;
|
|
2550
|
+
return {
|
|
2551
|
+
default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
|
|
2552
|
+
primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
|
|
2553
|
+
positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
|
|
2554
|
+
caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
|
|
2555
|
+
critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2559
|
+
var _a, _b, _c;
|
|
2560
|
+
const { scheme, tone } = options, tokens = parentTokens == null ? void 0 : parentTokens[tone], context = { 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", scheme };
|
|
2561
|
+
return {
|
|
2562
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2563
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
2564
|
+
dot: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.dot),
|
|
2565
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon)
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
function buildButtonColorTheme(options, config) {
|
|
2569
|
+
const { scheme } = options, modes = {};
|
|
2570
|
+
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2571
|
+
modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
|
|
2572
|
+
return modes;
|
|
2573
|
+
}
|
|
2574
|
+
function buildButtonTonesColorTheme(options, config) {
|
|
2575
|
+
const { mode, scheme } = options, tones2 = {};
|
|
2576
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2577
|
+
tones2[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
|
|
2578
|
+
return tones2;
|
|
2579
|
+
}
|
|
2580
|
+
function buildButtonStatesColorTheme(options, config) {
|
|
2581
|
+
const { mode, scheme, tone } = options, states = {};
|
|
2582
|
+
for (const state of THEME_COLOR_STATES)
|
|
2583
|
+
states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
|
|
2584
|
+
return states;
|
|
2585
|
+
}
|
|
2586
|
+
function buildButtonStateColorTheme(options, config) {
|
|
2587
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
2588
|
+
const { mode, tone, scheme, state } = options, 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], hue = (tokens == null ? void 0 : tokens._hue) || "gray", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
|
|
2589
|
+
return {
|
|
2590
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2591
|
+
accent: {
|
|
2592
|
+
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _e.fg)
|
|
2593
|
+
},
|
|
2594
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2595
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
2596
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2597
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
2598
|
+
code: {
|
|
2599
|
+
bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.bg),
|
|
2600
|
+
fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.code) == null ? void 0 : _g.fg)
|
|
2601
|
+
},
|
|
2602
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
2603
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
2604
|
+
muted: {
|
|
2605
|
+
bg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.bg),
|
|
2606
|
+
fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _i.fg)
|
|
2607
|
+
},
|
|
2608
|
+
kbd: {
|
|
2609
|
+
bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.bg),
|
|
2610
|
+
fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.fg),
|
|
2611
|
+
border: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _l.border)
|
|
2612
|
+
},
|
|
2613
|
+
link: {
|
|
2614
|
+
fg: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.link) == null ? void 0 : _m.fg)
|
|
2615
|
+
},
|
|
2616
|
+
skeleton: {
|
|
2617
|
+
from: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.from),
|
|
2618
|
+
to: resolveColorTokenValue(context, (_o = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _o.to)
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
function buildInputColorTheme(options, config) {
|
|
2623
|
+
const { scheme, tone } = options;
|
|
2624
|
+
return {
|
|
2625
|
+
default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
|
|
2626
|
+
invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
|
|
2627
|
+
};
|
|
2628
|
+
}
|
|
2629
|
+
function buildInputStatesColorTheme(options, config) {
|
|
2630
|
+
const { mode, scheme, tone } = options;
|
|
2631
|
+
return {
|
|
2632
|
+
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
|
|
2633
|
+
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
|
|
2634
|
+
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
|
|
2635
|
+
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
|
|
2636
|
+
};
|
|
2637
|
+
}
|
|
2638
|
+
function buildInputStateColorTheme(options, config) {
|
|
2639
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2640
|
+
const { mode, tone, scheme, state } = options, 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], 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", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
|
|
2641
|
+
return {
|
|
2642
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2643
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2644
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
2645
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
2646
|
+
muted: {
|
|
2647
|
+
bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg)
|
|
2648
|
+
},
|
|
2649
|
+
placeholder: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.placeholder)
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
function buildSelectableColorTheme(options, config) {
|
|
2653
|
+
const { scheme } = options, tones2 = {};
|
|
2654
|
+
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2655
|
+
tones2[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
|
|
2656
|
+
return tones2;
|
|
2657
|
+
}
|
|
2658
|
+
function buildSelectableStatesColorTheme(options, config) {
|
|
2659
|
+
const { scheme, tone } = options, states = {};
|
|
2660
|
+
for (const state of THEME_COLOR_STATES)
|
|
2661
|
+
states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
|
|
2662
|
+
return states;
|
|
2663
|
+
}
|
|
2664
|
+
function buildSelectableStateColorTheme(options, config) {
|
|
2665
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2666
|
+
const { scheme, state, tone } = options, 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], hue = (tokens == null ? void 0 : tokens._hue) || "gray", blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"], context = { hue, scheme };
|
|
2667
|
+
return {
|
|
2668
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2669
|
+
accent: {
|
|
2670
|
+
fg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _d.fg)
|
|
2671
|
+
},
|
|
2672
|
+
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2673
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, { scheme }, config),
|
|
2674
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
2675
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
2676
|
+
code: {
|
|
2677
|
+
bg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.bg),
|
|
2678
|
+
fg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.fg)
|
|
2679
|
+
},
|
|
2680
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
2681
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
2682
|
+
muted: {
|
|
2683
|
+
bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg),
|
|
2684
|
+
fg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.fg)
|
|
2685
|
+
},
|
|
2686
|
+
kbd: {
|
|
2687
|
+
bg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _i.bg),
|
|
2688
|
+
fg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.fg),
|
|
2689
|
+
border: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.border)
|
|
2690
|
+
},
|
|
2691
|
+
link: {
|
|
2692
|
+
fg: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.link) == null ? void 0 : _l.fg)
|
|
2693
|
+
},
|
|
2694
|
+
skeleton: {
|
|
2695
|
+
from: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.from),
|
|
2696
|
+
to: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.to)
|
|
2697
|
+
}
|
|
2698
|
+
};
|
|
2699
|
+
}
|
|
2700
|
+
function buildSyntaxColorTheme(options, config) {
|
|
2701
|
+
var _a;
|
|
2702
|
+
const { scheme } = options, tokens = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.syntax, context = { hue: "gray", scheme };
|
|
2703
|
+
return {
|
|
2704
|
+
atrule: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.atrule),
|
|
2705
|
+
attrName: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrName),
|
|
2706
|
+
attrValue: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrValue),
|
|
2707
|
+
attribute: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attribute),
|
|
2708
|
+
boolean: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.boolean),
|
|
2709
|
+
builtin: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.builtin),
|
|
2710
|
+
cdata: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.cdata),
|
|
2711
|
+
char: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.char),
|
|
2712
|
+
class: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.class),
|
|
2713
|
+
className: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.className),
|
|
2714
|
+
comment: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.comment),
|
|
2715
|
+
constant: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.constant),
|
|
2716
|
+
deleted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.deleted),
|
|
2717
|
+
doctype: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.doctype),
|
|
2718
|
+
entity: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.entity),
|
|
2719
|
+
function: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.function),
|
|
2720
|
+
hexcode: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.hexcode),
|
|
2721
|
+
id: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.id),
|
|
2722
|
+
important: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.important),
|
|
2723
|
+
inserted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.inserted),
|
|
2724
|
+
keyword: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.keyword),
|
|
2725
|
+
number: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.number),
|
|
2726
|
+
operator: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.operator),
|
|
2727
|
+
prolog: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.prolog),
|
|
2728
|
+
property: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.property),
|
|
2729
|
+
pseudoClass: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoClass),
|
|
2730
|
+
pseudoElement: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoElement),
|
|
2731
|
+
punctuation: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.punctuation),
|
|
2732
|
+
regex: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.regex),
|
|
2733
|
+
selector: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.selector),
|
|
2734
|
+
string: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.string),
|
|
2735
|
+
symbol: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.symbol),
|
|
2736
|
+
tag: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.tag),
|
|
2737
|
+
unit: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.unit),
|
|
2738
|
+
url: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.url),
|
|
2739
|
+
variable: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.variable)
|
|
2740
|
+
};
|
|
2741
|
+
}
|
|
2742
|
+
const defaultColorPalette = color;
|
|
2743
|
+
function mixChannel(b, s, weight) {
|
|
2744
|
+
const delta = (s - b) * weight;
|
|
2745
|
+
return b + delta;
|
|
2746
|
+
}
|
|
2747
|
+
function mix(b, s, weight) {
|
|
2748
|
+
return {
|
|
2749
|
+
r: mixChannel(b.r, s.r, weight),
|
|
2750
|
+
g: mixChannel(b.g, s.g, weight),
|
|
2751
|
+
b: mixChannel(b.b, s.b, weight)
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
function multiplyChannel(b, s) {
|
|
2755
|
+
return b * s;
|
|
2756
|
+
}
|
|
2757
|
+
function multiply(b, s) {
|
|
2758
|
+
return {
|
|
2759
|
+
r: multiplyChannel(b.r / 255, s.r / 255) * 255,
|
|
2760
|
+
g: multiplyChannel(b.g / 255, s.g / 255) * 255,
|
|
2761
|
+
b: multiplyChannel(b.b / 255, s.b / 255) * 255
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
function screenChannel(b, s) {
|
|
2765
|
+
return b + s - b * s;
|
|
2766
|
+
}
|
|
2767
|
+
function screen(b, s) {
|
|
2768
|
+
return {
|
|
2769
|
+
r: screenChannel(b.r / 255, s.r / 255) * 255,
|
|
2770
|
+
g: screenChannel(b.g / 255, s.g / 255) * 255,
|
|
2771
|
+
b: screenChannel(b.b / 255, s.b / 255) * 255
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
function lerp(x, y, a) {
|
|
2775
|
+
return x * (1 - a) + y * a;
|
|
2776
|
+
}
|
|
2777
|
+
function invlerp(x, y, a) {
|
|
2778
|
+
return clamp((a - x) / (y - x));
|
|
2779
|
+
}
|
|
2780
|
+
function clamp(a, min = 0, max = 1) {
|
|
2781
|
+
return Math.min(max, Math.max(min, a));
|
|
2782
|
+
}
|
|
2783
|
+
function range(x1, y1, x2, y2, a) {
|
|
2784
|
+
return lerp(x2, y2, invlerp(x1, y1, a));
|
|
2785
|
+
}
|
|
2786
|
+
function round(value) {
|
|
2787
|
+
return Math.round(value);
|
|
2788
|
+
}
|
|
2789
|
+
function hexToRgb(hex) {
|
|
2790
|
+
if (hex.length === 4) {
|
|
2791
|
+
const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
|
|
2792
|
+
return {
|
|
2793
|
+
r: parseInt(hexR + hexR, 16),
|
|
2794
|
+
g: parseInt(hexG + hexG, 16),
|
|
2795
|
+
b: parseInt(hexB + hexB, 16)
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
return {
|
|
2799
|
+
r: parseInt(hex.slice(1, 3), 16),
|
|
2800
|
+
g: parseInt(hex.slice(3, 5), 16),
|
|
2801
|
+
b: parseInt(hex.slice(5, 7), 16)
|
|
2802
|
+
};
|
|
2803
|
+
}
|
|
2804
|
+
function rgbaToRGBA(rgba2) {
|
|
2805
|
+
const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
|
|
2806
|
+
return {
|
|
2807
|
+
r: parseInt(values[0]),
|
|
2808
|
+
g: parseInt(values[1]),
|
|
2809
|
+
b: parseInt(values[2]),
|
|
2810
|
+
a: parseFloat(values[3])
|
|
2811
|
+
};
|
|
2812
|
+
}
|
|
2813
|
+
function rgbToHex(color2) {
|
|
2814
|
+
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
2815
|
+
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2816
|
+
}
|
|
2817
|
+
function rgbToHsl({ r, g, b }) {
|
|
2818
|
+
r /= 255, g /= 255, b /= 255;
|
|
2819
|
+
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2820
|
+
let h = 0, s = 0, l = 0;
|
|
2821
|
+
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
|
|
2822
|
+
}
|
|
2823
|
+
function hslToRgb(hsl) {
|
|
2824
|
+
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
2825
|
+
let r = 0, g = 0, b = 0;
|
|
2826
|
+
return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
|
|
2827
|
+
r: Math.round((r + m) * 255),
|
|
2828
|
+
g: Math.round((g + m) * 255),
|
|
2829
|
+
b: Math.round((b + m) * 255)
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2832
|
+
const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
|
|
2833
|
+
function isHexChars(str) {
|
|
2834
|
+
for (const c of str)
|
|
2835
|
+
if (HEX_CHARS.indexOf(c) === -1)
|
|
2836
|
+
return !1;
|
|
2837
|
+
return !0;
|
|
2838
|
+
}
|
|
2839
|
+
function isHex(str) {
|
|
2840
|
+
return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
|
|
2841
|
+
}
|
|
2842
|
+
function parseHsl(str) {
|
|
2843
|
+
const res = HSL_RE.exec(str);
|
|
2844
|
+
if (!res)
|
|
2845
|
+
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2846
|
+
return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
|
|
2847
|
+
}
|
|
2848
|
+
function parseColor(color2) {
|
|
2849
|
+
if (!color2)
|
|
2850
|
+
return { r: 0, g: 0, b: 0 };
|
|
2851
|
+
if (typeof color2 != "string")
|
|
2852
|
+
throw new Error("parseColor: expected a string");
|
|
2853
|
+
if (isHex(color2))
|
|
2854
|
+
return hexToRgb(color2);
|
|
2855
|
+
if (color2.startsWith("hsl("))
|
|
2856
|
+
return hslToRgb(parseHsl(color2));
|
|
2857
|
+
if (color2.startsWith("rgba("))
|
|
2858
|
+
return rgbaToRGBA(color2);
|
|
2859
|
+
throw new Error(`parseColor: unexpected color format: "${color2}"`);
|
|
2860
|
+
}
|
|
2861
|
+
function getContrastRatio(bg, fg) {
|
|
2862
|
+
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2863
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2864
|
+
}
|
|
2865
|
+
function rgb_lrgb({ r, g, b }) {
|
|
2866
|
+
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2867
|
+
}
|
|
2868
|
+
function rgb_lrgb1(v) {
|
|
2869
|
+
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
2870
|
+
}
|
|
2871
|
+
function lrgb_luminance([r, g, b]) {
|
|
2872
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
2873
|
+
}
|
|
2874
|
+
function rgba(color2, a) {
|
|
2875
|
+
const rgb = parseColor(color2);
|
|
2876
|
+
return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
|
|
2877
|
+
}
|
|
2878
|
+
const RGB_RANGE = [0, 255];
|
|
2879
|
+
function mixThemeColor(value, options) {
|
|
2880
|
+
const { blendMode } = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2881
|
+
r: [black2.r, white2.r],
|
|
2882
|
+
g: [black2.g, white2.g],
|
|
2883
|
+
b: [black2.b, white2.b]
|
|
2884
|
+
}, convertedBgColor = {
|
|
2885
|
+
r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
|
|
2886
|
+
g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
|
|
2887
|
+
b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
|
|
2888
|
+
}, convertedColor = {
|
|
2889
|
+
r: clamp(range(...paletteRange.r, ...RGB_RANGE, color2.r), ...RGB_RANGE),
|
|
2890
|
+
g: clamp(range(...paletteRange.g, ...RGB_RANGE, color2.g), ...RGB_RANGE),
|
|
2891
|
+
b: clamp(range(...paletteRange.b, ...RGB_RANGE, color2.b), ...RGB_RANGE)
|
|
2892
|
+
}, resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor), v = {
|
|
2893
|
+
r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
|
|
2894
|
+
g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
|
|
2895
|
+
b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
|
|
2896
|
+
};
|
|
2897
|
+
return rgbToHex(v);
|
|
2898
|
+
}
|
|
2899
|
+
function renderColorValue(str, options) {
|
|
2900
|
+
const { bg, blendMode, colorPalette } = options;
|
|
2901
|
+
if (bg === "white")
|
|
2902
|
+
throw new Error("Cannot blend with white background");
|
|
2903
|
+
const node = parseTokenValue(str);
|
|
2904
|
+
if (!node || node.type !== "color")
|
|
2905
|
+
throw new Error(`Invalid color token value: ${str}`);
|
|
2906
|
+
let hex = "";
|
|
2907
|
+
if (node.key === "black" && (hex = renderColorHex(colorPalette.black)), node.key === "white" && (hex = renderColorHex(colorPalette.white)), node.hue && node.tint && (hex = renderColorHex(colorPalette[node.hue][node.tint])), !hex)
|
|
2908
|
+
throw new Error(`Invalid color token value: ${str}`);
|
|
2909
|
+
const hexBeforeMix = hex, mixOptions = {
|
|
2910
|
+
blendMode,
|
|
2911
|
+
bg,
|
|
2912
|
+
black: renderColorHex(colorPalette.black),
|
|
2913
|
+
// opacity: node.opacity,
|
|
2914
|
+
white: renderColorHex(colorPalette.white)
|
|
2915
|
+
};
|
|
2916
|
+
try {
|
|
2917
|
+
if (hex = mixThemeColor(hex, mixOptions), bg && node.mix !== void 0) {
|
|
2918
|
+
const from = hexToRgb(bg), to = hexToRgb(hex);
|
|
2919
|
+
hex = rgbToHex(mix(from, to, node.mix));
|
|
2920
|
+
}
|
|
2921
|
+
} catch (err) {
|
|
2922
|
+
throw console.warn("could not blend", hex, mixOptions), err;
|
|
2923
|
+
}
|
|
2924
|
+
return hex === "#aN" && (console.warn(`invalid color token value: ${str}`), hex = hexBeforeMix), node.opacity !== void 0 && (hex = rgba(hex, node.opacity)), hex;
|
|
2925
|
+
}
|
|
2926
|
+
function renderColorHex(color2) {
|
|
2927
|
+
return typeof color2 == "string" ? color2 : color2.hex;
|
|
2928
|
+
}
|
|
2929
|
+
function renderThemeColorSchemes(value, config) {
|
|
2930
|
+
var _a;
|
|
2931
|
+
const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
|
|
2932
|
+
return {
|
|
2933
|
+
light: renderThemeColorScheme(colorPalette, value.light),
|
|
2934
|
+
dark: renderThemeColorScheme(colorPalette, value.dark)
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
function renderThemeColorScheme(colorPalette, value) {
|
|
2938
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette }), renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette }), bg = renderedDefaultTone.bg;
|
|
2939
|
+
if (bg === "white")
|
|
2940
|
+
throw new Error("Cannot blend with white background");
|
|
2941
|
+
return Object.fromEntries([
|
|
2942
|
+
["transparent", renderedTransparentTone],
|
|
2943
|
+
["default", renderedDefaultTone],
|
|
2944
|
+
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
|
|
2945
|
+
]);
|
|
2946
|
+
}
|
|
2947
|
+
function renderThemeColor(value, options) {
|
|
2948
|
+
const { colorPalette, bg } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode }), colorOptions = { colorPalette, bg: baseBg, blendMode }, button = renderThemeColorButton(value.button, {
|
|
2949
|
+
baseBg,
|
|
2950
|
+
blendMode,
|
|
2951
|
+
colorPalette
|
|
2952
|
+
}), selectable = renderThemeColorSelectable(value.selectable, {
|
|
2953
|
+
colorPalette,
|
|
2954
|
+
baseBg,
|
|
2955
|
+
blendMode
|
|
2956
|
+
}), shadow = {
|
|
2957
|
+
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
2958
|
+
umbra: renderColorValue(value.shadow.umbra, {
|
|
2959
|
+
...colorOptions,
|
|
2960
|
+
bg: void 0,
|
|
2961
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2962
|
+
}),
|
|
2963
|
+
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
2964
|
+
...colorOptions,
|
|
2965
|
+
bg: void 0,
|
|
2966
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2967
|
+
}),
|
|
2968
|
+
ambient: renderColorValue(value.shadow.ambient, {
|
|
2969
|
+
...colorOptions,
|
|
2970
|
+
bg: void 0,
|
|
2971
|
+
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2972
|
+
})
|
|
2973
|
+
};
|
|
2974
|
+
return {
|
|
2975
|
+
_blend: blendMode,
|
|
2976
|
+
_dark: value._dark,
|
|
2977
|
+
accent: {
|
|
2978
|
+
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2979
|
+
},
|
|
2980
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
2981
|
+
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2982
|
+
badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
|
|
2983
|
+
bg: baseBg,
|
|
2984
|
+
border: renderColorValue(value.border, colorOptions),
|
|
2985
|
+
button,
|
|
2986
|
+
code: {
|
|
2987
|
+
bg: renderColorValue(value.code.bg, colorOptions),
|
|
2988
|
+
fg: renderColorValue(value.code.fg, colorOptions)
|
|
2989
|
+
},
|
|
2990
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
2991
|
+
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2992
|
+
icon: renderColorValue(value.icon, colorOptions),
|
|
2993
|
+
input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
|
|
2994
|
+
kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
|
|
2995
|
+
link: {
|
|
2996
|
+
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2997
|
+
},
|
|
2998
|
+
muted: {
|
|
2999
|
+
bg: renderColorValue(value.muted.bg, colorOptions),
|
|
3000
|
+
fg: renderColorValue(value.muted.fg, colorOptions)
|
|
3001
|
+
},
|
|
3002
|
+
shadow,
|
|
3003
|
+
skeleton: {
|
|
3004
|
+
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
3005
|
+
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
3006
|
+
},
|
|
3007
|
+
syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
|
|
3008
|
+
selectable
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
function renderThemeColorKBD(value, options) {
|
|
3012
|
+
const { baseBg, blendMode, colorPalette } = options, rootOptions = {
|
|
3013
|
+
bg: baseBg,
|
|
3014
|
+
blendMode,
|
|
3015
|
+
colorPalette
|
|
3016
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3017
|
+
bg,
|
|
3018
|
+
blendMode,
|
|
3019
|
+
colorPalette
|
|
3020
|
+
};
|
|
3021
|
+
return {
|
|
3022
|
+
bg,
|
|
3023
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
3024
|
+
border: renderColorValue(value.border, colorOptions)
|
|
3025
|
+
};
|
|
3026
|
+
}
|
|
3027
|
+
function renderThemeColorAvatar(value, options) {
|
|
3028
|
+
return {
|
|
3029
|
+
gray: renderThemeColorAvatarColor(value.gray, options),
|
|
3030
|
+
blue: renderThemeColorAvatarColor(value.blue, options),
|
|
3031
|
+
purple: renderThemeColorAvatarColor(value.purple, options),
|
|
3032
|
+
magenta: renderThemeColorAvatarColor(value.magenta, options),
|
|
3033
|
+
red: renderThemeColorAvatarColor(value.red, options),
|
|
3034
|
+
orange: renderThemeColorAvatarColor(value.orange, options),
|
|
3035
|
+
yellow: renderThemeColorAvatarColor(value.yellow, options),
|
|
3036
|
+
green: renderThemeColorAvatarColor(value.green, options),
|
|
3037
|
+
cyan: renderThemeColorAvatarColor(value.cyan, options)
|
|
3038
|
+
};
|
|
3039
|
+
}
|
|
3040
|
+
function renderThemeColorAvatarColor(value, options) {
|
|
3041
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3042
|
+
bg: baseBg,
|
|
3043
|
+
blendMode: rootBlendMode,
|
|
3044
|
+
colorPalette
|
|
3045
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3046
|
+
bg,
|
|
3047
|
+
blendMode,
|
|
3048
|
+
colorPalette
|
|
3049
|
+
};
|
|
3050
|
+
return {
|
|
3051
|
+
_blend: blendMode,
|
|
3052
|
+
bg,
|
|
3053
|
+
fg: renderColorValue(value.fg, colorOptions)
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
function renderThemeColorBadge(value, options) {
|
|
3057
|
+
return {
|
|
3058
|
+
default: renderThemeColorBadgeColor(value.default, options),
|
|
3059
|
+
primary: renderThemeColorBadgeColor(value.primary, options),
|
|
3060
|
+
positive: renderThemeColorBadgeColor(value.positive, options),
|
|
3061
|
+
caution: renderThemeColorBadgeColor(value.caution, options),
|
|
3062
|
+
critical: renderThemeColorBadgeColor(value.critical, options)
|
|
3063
|
+
};
|
|
3064
|
+
}
|
|
3065
|
+
function renderThemeColorBadgeColor(value, options) {
|
|
3066
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
|
|
3067
|
+
bg: baseBg,
|
|
3068
|
+
blendMode: rootBlendMode,
|
|
3069
|
+
colorPalette
|
|
3070
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3071
|
+
bg,
|
|
3072
|
+
blendMode,
|
|
3073
|
+
colorPalette
|
|
3074
|
+
};
|
|
3075
|
+
return {
|
|
3076
|
+
bg,
|
|
3077
|
+
dot: renderColorValue(value.dot, colorOptions),
|
|
3078
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
3079
|
+
icon: renderColorValue(value.icon, colorOptions)
|
|
3080
|
+
};
|
|
3081
|
+
}
|
|
3082
|
+
function renderThemeColorButton(value, options) {
|
|
3083
|
+
return {
|
|
3084
|
+
default: renderThemeColorButtonTones(value.default, options),
|
|
3085
|
+
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
3086
|
+
bleed: renderThemeColorButtonTones(value.bleed, options)
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
function renderThemeColorButtonTones(value, options) {
|
|
3090
|
+
return {
|
|
3091
|
+
default: renderThemeColorButtonStates(value.default, options),
|
|
3092
|
+
primary: renderThemeColorButtonStates(value.primary, options),
|
|
3093
|
+
positive: renderThemeColorButtonStates(value.positive, options),
|
|
3094
|
+
caution: renderThemeColorButtonStates(value.caution, options),
|
|
3095
|
+
critical: renderThemeColorButtonStates(value.critical, options)
|
|
3096
|
+
};
|
|
3097
|
+
}
|
|
3098
|
+
function renderThemeColorButtonStates(value, options) {
|
|
3099
|
+
return {
|
|
3100
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
3101
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
3102
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
3103
|
+
selected: renderThemeColorState(value.selected, options),
|
|
3104
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
function renderThemeColorState(value, options) {
|
|
3108
|
+
var _a, _b;
|
|
3109
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3110
|
+
bg: baseBg,
|
|
3111
|
+
blendMode: rootBlendMode,
|
|
3112
|
+
colorPalette
|
|
3113
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3114
|
+
bg,
|
|
3115
|
+
blendMode,
|
|
3116
|
+
colorPalette
|
|
3117
|
+
};
|
|
3118
|
+
return {
|
|
3119
|
+
_blend: blendMode,
|
|
3120
|
+
accent: {
|
|
3121
|
+
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
3122
|
+
},
|
|
3123
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
3124
|
+
badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
|
|
3125
|
+
bg,
|
|
3126
|
+
border: renderColorValue(value.border, colorOptions),
|
|
3127
|
+
code: {
|
|
3128
|
+
bg: renderColorValue(value.code.bg, colorOptions),
|
|
3129
|
+
fg: renderColorValue(value.code.fg, colorOptions)
|
|
3130
|
+
},
|
|
3131
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
3132
|
+
icon: renderColorValue(value.icon, colorOptions),
|
|
3133
|
+
link: {
|
|
3134
|
+
fg: renderColorValue(value.link.fg, colorOptions)
|
|
3135
|
+
},
|
|
3136
|
+
muted: {
|
|
3137
|
+
bg: renderColorValue(value.muted.bg, colorOptions),
|
|
3138
|
+
fg: renderColorValue(value.muted.fg, colorOptions)
|
|
3139
|
+
},
|
|
3140
|
+
kbd: {
|
|
3141
|
+
bg: renderColorValue(value.kbd.bg, colorOptions),
|
|
3142
|
+
fg: renderColorValue(value.kbd.fg, colorOptions),
|
|
3143
|
+
border: renderColorValue(value.kbd.border, colorOptions)
|
|
3144
|
+
},
|
|
3145
|
+
skeleton: {
|
|
3146
|
+
from: renderColorValue((_a = value.skeleton) == null ? void 0 : _a.from, colorOptions),
|
|
3147
|
+
to: renderColorValue((_b = value.skeleton) == null ? void 0 : _b.to, colorOptions)
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
}
|
|
3151
|
+
function renderThemeColorInput(value, options) {
|
|
3152
|
+
return {
|
|
3153
|
+
default: renderInputStatesColorTheme(value.default, options),
|
|
3154
|
+
invalid: renderInputStatesColorTheme(value.invalid, options)
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
function renderInputStatesColorTheme(value, options) {
|
|
3158
|
+
return {
|
|
3159
|
+
enabled: renderInputStateColorTheme(value.enabled, options),
|
|
3160
|
+
hovered: renderInputStateColorTheme(value.hovered, options),
|
|
3161
|
+
readOnly: renderInputStateColorTheme(value.readOnly, options),
|
|
3162
|
+
disabled: renderInputStateColorTheme(value.disabled, options)
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
function renderInputStateColorTheme(value, options) {
|
|
3166
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode }, bg = renderColorValue(value.bg, rootOptions), colorOptions = { colorPalette, bg, blendMode };
|
|
3167
|
+
return {
|
|
3168
|
+
_blend: blendMode,
|
|
3169
|
+
bg,
|
|
3170
|
+
border: renderColorValue(value.border, colorOptions),
|
|
3171
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
3172
|
+
muted: {
|
|
3173
|
+
bg: renderColorValue(value.muted.bg, colorOptions)
|
|
3174
|
+
},
|
|
3175
|
+
placeholder: renderColorValue(value.placeholder, colorOptions)
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
function renderThemeColorSelectable(value, options) {
|
|
3179
|
+
return {
|
|
3180
|
+
default: renderThemeColorSelectableStates(value.default, options),
|
|
3181
|
+
primary: renderThemeColorSelectableStates(value.primary, options),
|
|
3182
|
+
positive: renderThemeColorSelectableStates(value.positive, options),
|
|
3183
|
+
caution: renderThemeColorSelectableStates(value.caution, options),
|
|
3184
|
+
critical: renderThemeColorSelectableStates(value.critical, options)
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
function renderThemeColorSelectableStates(value, options) {
|
|
3188
|
+
return {
|
|
3189
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
3190
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
3191
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
3192
|
+
selected: renderThemeColorState(value.selected, options),
|
|
3193
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
3194
|
+
};
|
|
3195
|
+
}
|
|
3196
|
+
function renderSyntaxColorTheme(value, options) {
|
|
3197
|
+
const { colorPalette, baseBg, blendMode } = options, colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
3198
|
+
return {
|
|
3199
|
+
atrule: renderColorValue(value.atrule, colorOptions),
|
|
3200
|
+
attrName: renderColorValue(value.attrName, colorOptions),
|
|
3201
|
+
attrValue: renderColorValue(value.attrValue, colorOptions),
|
|
3202
|
+
attribute: renderColorValue(value.attribute, colorOptions),
|
|
3203
|
+
boolean: renderColorValue(value.boolean, colorOptions),
|
|
3204
|
+
builtin: renderColorValue(value.builtin, colorOptions),
|
|
3205
|
+
cdata: renderColorValue(value.cdata, colorOptions),
|
|
3206
|
+
char: renderColorValue(value.char, colorOptions),
|
|
3207
|
+
class: renderColorValue(value.class, colorOptions),
|
|
3208
|
+
className: renderColorValue(value.className, colorOptions),
|
|
3209
|
+
comment: renderColorValue(value.comment, colorOptions),
|
|
3210
|
+
constant: renderColorValue(value.constant, colorOptions),
|
|
3211
|
+
deleted: renderColorValue(value.deleted, colorOptions),
|
|
3212
|
+
doctype: renderColorValue(value.doctype, colorOptions),
|
|
3213
|
+
entity: renderColorValue(value.entity, colorOptions),
|
|
3214
|
+
function: renderColorValue(value.function, colorOptions),
|
|
3215
|
+
hexcode: renderColorValue(value.hexcode, colorOptions),
|
|
3216
|
+
id: renderColorValue(value.id, colorOptions),
|
|
3217
|
+
important: renderColorValue(value.important, colorOptions),
|
|
3218
|
+
inserted: renderColorValue(value.inserted, colorOptions),
|
|
3219
|
+
keyword: renderColorValue(value.keyword, colorOptions),
|
|
3220
|
+
number: renderColorValue(value.number, colorOptions),
|
|
3221
|
+
operator: renderColorValue(value.operator, colorOptions),
|
|
3222
|
+
prolog: renderColorValue(value.prolog, colorOptions),
|
|
3223
|
+
property: renderColorValue(value.property, colorOptions),
|
|
3224
|
+
pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
|
|
3225
|
+
pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
|
|
3226
|
+
punctuation: renderColorValue(value.punctuation, colorOptions),
|
|
3227
|
+
regex: renderColorValue(value.regex, colorOptions),
|
|
3228
|
+
selector: renderColorValue(value.selector, colorOptions),
|
|
3229
|
+
string: renderColorValue(value.string, colorOptions),
|
|
3230
|
+
symbol: renderColorValue(value.symbol, colorOptions),
|
|
3231
|
+
tag: renderColorValue(value.tag, colorOptions),
|
|
3232
|
+
unit: renderColorValue(value.unit, colorOptions),
|
|
3233
|
+
url: renderColorValue(value.url, colorOptions),
|
|
3234
|
+
variable: renderColorValue(value.variable, colorOptions)
|
|
3235
|
+
};
|
|
3236
|
+
}
|
|
3237
|
+
function buildTheme(config) {
|
|
3238
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
3239
|
+
const colorTheme = buildColorTheme(config), v2 = {
|
|
3240
|
+
_version: 2,
|
|
3241
|
+
avatar: (_a = config == null ? void 0 : config.avatar) != null ? _a : defaultThemeConfig.avatar,
|
|
3242
|
+
button: (_b = config == null ? void 0 : config.button) != null ? _b : defaultThemeConfig.button,
|
|
3243
|
+
card: (_c = config == null ? void 0 : config.card) != null ? _c : defaultThemeConfig.card,
|
|
3244
|
+
// How colors are generated:
|
|
3245
|
+
// 1. Merge custom tokens with default tokens
|
|
3246
|
+
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
3247
|
+
// 3. Apply mixing and render to hex values
|
|
3248
|
+
// render(build(mergeWithDefaults()))
|
|
3249
|
+
color: renderThemeColorSchemes(colorTheme, config),
|
|
3250
|
+
container: (_d = config == null ? void 0 : config.container) != null ? _d : defaultThemeConfig.container,
|
|
3251
|
+
font: (_e = config == null ? void 0 : config.font) != null ? _e : defaultThemeFonts,
|
|
3252
|
+
input: (_f = config == null ? void 0 : config.input) != null ? _f : defaultThemeConfig.input,
|
|
3253
|
+
layer: (_g = config == null ? void 0 : config.layer) != null ? _g : defaultThemeConfig.layer,
|
|
3254
|
+
media: (_h = config == null ? void 0 : config.media) != null ? _h : defaultThemeConfig.media,
|
|
3255
|
+
radius: (_i = config == null ? void 0 : config.radius) != null ? _i : defaultThemeConfig.radius,
|
|
3256
|
+
shadow: (_j = config == null ? void 0 : config.shadow) != null ? _j : defaultThemeConfig.shadow,
|
|
3257
|
+
space: (_k = config == null ? void 0 : config.space) != null ? _k : defaultThemeConfig.space,
|
|
3258
|
+
style: (_l = config == null ? void 0 : config.style) != null ? _l : defaultThemeConfig.style
|
|
3259
|
+
};
|
|
3260
|
+
return v2_v0(v2);
|
|
3261
|
+
}
|
|
3262
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3263
|
+
function getScopedTheme(themeProp, scheme, tone) {
|
|
3264
|
+
const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
|
|
3265
|
+
if (cachedTheme)
|
|
3266
|
+
return cachedTheme;
|
|
3267
|
+
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
|
|
3268
|
+
sanity: {
|
|
3269
|
+
...v0,
|
|
3270
|
+
color: color_v0,
|
|
3271
|
+
layer: layer_v0,
|
|
3272
|
+
v2: {
|
|
3273
|
+
...v2,
|
|
3274
|
+
_resolved: !0,
|
|
3275
|
+
color: color_v2,
|
|
3276
|
+
layer: layer_v2
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
};
|
|
3280
|
+
return _setCachedTheme(themeProp, scheme, tone, theme), theme;
|
|
3281
|
+
}
|
|
3282
|
+
function _getCachedTheme(rootTheme, scheme, tone) {
|
|
3283
|
+
const schemeCache = cache.get(scheme);
|
|
3284
|
+
if (!schemeCache)
|
|
3285
|
+
return;
|
|
3286
|
+
const toneCache = schemeCache.get(tone);
|
|
3287
|
+
if (toneCache)
|
|
3288
|
+
return toneCache.get(rootTheme);
|
|
3289
|
+
}
|
|
3290
|
+
function _setCachedTheme(rootTheme, scheme, tone, theme) {
|
|
3291
|
+
cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
|
|
3292
|
+
const schemeCache = cache.get(scheme);
|
|
3293
|
+
schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
|
|
3294
|
+
}
|
|
3295
|
+
export {
|
|
3296
|
+
COLOR_CONFIG_AVATAR_COLORS,
|
|
3297
|
+
COLOR_CONFIG_BLEND_KEYS,
|
|
3298
|
+
COLOR_CONFIG_CARD_KEYS,
|
|
3299
|
+
COLOR_CONFIG_CARD_TONES,
|
|
3300
|
+
COLOR_CONFIG_INPUT_MODES,
|
|
3301
|
+
COLOR_CONFIG_INPUT_STATES,
|
|
3302
|
+
COLOR_CONFIG_STATES,
|
|
3303
|
+
COLOR_CONFIG_STATE_KEYS,
|
|
3304
|
+
COLOR_CONFIG_STATE_TONES,
|
|
3305
|
+
THEME_COLOR_AVATAR_COLORS,
|
|
3306
|
+
THEME_COLOR_BLEND_MODES,
|
|
3307
|
+
THEME_COLOR_BUTTON_MODES,
|
|
3308
|
+
THEME_COLOR_CARD_TONES,
|
|
3309
|
+
THEME_COLOR_INPUT_MODES,
|
|
3310
|
+
THEME_COLOR_INPUT_STATES,
|
|
3311
|
+
THEME_COLOR_SCHEMES,
|
|
3312
|
+
THEME_COLOR_STATES,
|
|
3313
|
+
THEME_COLOR_STATE_TONES,
|
|
3314
|
+
buildTheme,
|
|
3315
|
+
createColorTheme,
|
|
3316
|
+
getContrastRatio,
|
|
3317
|
+
getScopedTheme,
|
|
3318
|
+
getTheme_v2,
|
|
3319
|
+
hexToRgb,
|
|
3320
|
+
hslToRgb,
|
|
3321
|
+
isColorBlendModeValue,
|
|
3322
|
+
isColorButtonMode,
|
|
3323
|
+
isColorConfigBaseKey,
|
|
3324
|
+
isColorConfigBaseTone,
|
|
3325
|
+
isColorConfigBlendKey,
|
|
3326
|
+
isColorConfigStateKey,
|
|
3327
|
+
isColorConfigStateTone,
|
|
3328
|
+
isColorHueKey,
|
|
3329
|
+
isColorOpacityValue,
|
|
3330
|
+
isColorTintKey,
|
|
3331
|
+
isColorTokenValue,
|
|
3332
|
+
isColorValue,
|
|
3333
|
+
is_v0,
|
|
3334
|
+
is_v2,
|
|
3335
|
+
mix,
|
|
3336
|
+
multiply,
|
|
3337
|
+
parseColor,
|
|
3338
|
+
parseTokenKey,
|
|
3339
|
+
parseTokenValue,
|
|
3340
|
+
rgbToHex,
|
|
3341
|
+
rgbToHsl,
|
|
3342
|
+
rgba,
|
|
3343
|
+
rgbaToRGBA,
|
|
3344
|
+
screen,
|
|
3345
|
+
v0_v2,
|
|
3346
|
+
v2_v0
|
|
3347
|
+
};
|
|
3348
|
+
//# sourceMappingURL=theme.mjs.map
|