@sanity/ui 2.9.0-corel.0 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/getTheme_v2.js +110 -54
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +110 -54
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +110 -54
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.d.mts +14 -21
- package/dist/index.d.ts +14 -21
- package/dist/index.esm.js +3327 -3068
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3328 -3070
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3327 -3068
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +8 -8
- package/dist/theme.d.ts +8 -8
- package/dist/theme.esm.js +1144 -592
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1144 -592
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1144 -592
- package/dist/theme.mjs.map +1 -1
- package/package.json +60 -52
- package/src/core/__workshop__/constants.ts +15 -19
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +13 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +31 -39
- package/src/core/components/dialog/dialog.tsx +4 -2
- package/src/core/components/menu/__workshop__/tones.tsx +5 -6
- package/src/core/components/menu/menu.tsx +15 -11
- package/src/core/components/menu/menuButton.tsx +14 -36
- package/src/core/components/menu/menuGroup.tsx +2 -1
- package/src/core/components/menu/menuItem.tsx +4 -2
- package/src/core/components/tab/tabList.tsx +3 -11
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +5 -6
- package/src/core/components/toast/toastState.ts +6 -0
- package/src/core/constants.ts +1 -1
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -5
- package/src/core/primitives/badge/__workshop__/tones.tsx +6 -13
- package/src/core/primitives/button/__workshop__/custom.tsx +4 -3
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/button.tsx +6 -11
- package/src/core/primitives/button/styles.ts +1 -1
- package/src/core/primitives/card/__workshop__/allTones.tsx +6 -8
- package/src/core/primitives/card/__workshop__/asButton.tsx +42 -24
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +17 -7
- package/src/core/primitives/card/__workshop__/interactive.tsx +10 -3
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +5 -3
- package/src/core/primitives/card/__workshop__/props.tsx +7 -5
- package/src/core/primitives/card/__workshop__/selected.tsx +4 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +6 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +3 -3
- package/src/core/primitives/flex/flex.tsx +1 -5
- package/src/core/primitives/grid/__workshop__/responsive.tsx +12 -12
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +13 -25
- package/src/core/primitives/heading/heading.tsx +1 -1
- package/src/core/primitives/inline/__workshop__/plain.tsx +3 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +6 -6
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -1
- package/src/core/primitives/popover/popover.tsx +6 -5
- package/src/core/primitives/radio/__workshop__/plain.tsx +2 -2
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +6 -6
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +11 -21
- package/src/core/primitives/text/styles.ts +0 -1
- package/src/core/primitives/text/text.tsx +2 -4
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -2
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +6 -2
- package/src/core/primitives/textInput/__workshop__/tones.tsx +38 -0
- package/src/core/styles/card/_cardColorStyle.ts +8 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +0 -2
- package/src/core/theme/__workshop__/debug/story.tsx +18 -11
- package/src/core/theme/themeProvider.tsx +4 -6
- package/src/core/utils/elementQuery/elementQuery.tsx +16 -17
- package/src/core/utils/layer/layerProvider.tsx +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +12 -8
- package/src/theme/build/renderColorTheme.ts +54 -232
- package/src/theme/defaults/colorTokens.ts +13 -18
- package/src/theme/system/color/_constants.ts +6 -10
- package/src/theme/versioning/themeColor_v0_v2.ts +26 -26
- package/src/theme/versioning/v0_v2.ts +4 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {COLOR_HUES} from '@sanity/color'
|
|
1
2
|
import {ThemeColorPalette, ThemeConfig} from '../config'
|
|
2
3
|
import {defaultColorPalette} from '../defaults/colorPalette'
|
|
3
4
|
import {
|
|
@@ -32,18 +33,15 @@ export function renderThemeColorSchemes(
|
|
|
32
33
|
const colorPalette = config?.palette ?? defaultColorPalette
|
|
33
34
|
|
|
34
35
|
return {
|
|
35
|
-
light: renderThemeColorScheme(colorPalette, value.light
|
|
36
|
-
dark: renderThemeColorScheme(colorPalette, value.dark
|
|
36
|
+
light: renderThemeColorScheme(colorPalette, value.light),
|
|
37
|
+
dark: renderThemeColorScheme(colorPalette, value.dark),
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function renderThemeColorScheme(
|
|
41
42
|
colorPalette: ThemeColorPalette,
|
|
42
43
|
value: ThemeColorScheme_v2,
|
|
43
|
-
options: {debugPath: string},
|
|
44
44
|
): ThemeColorScheme_v2 {
|
|
45
|
-
const {debugPath} = options
|
|
46
|
-
|
|
47
45
|
const toneEntries = Object.entries(value) as [ThemeColorCardToneKey, ThemeColorCard_v2][]
|
|
48
46
|
|
|
49
47
|
const [, transparentTone] = toneEntries.find(([k]) => k === 'transparent')!
|
|
@@ -52,14 +50,8 @@ function renderThemeColorScheme(
|
|
|
52
50
|
// The `transparent` and `default` tones are special cases, so we render them first
|
|
53
51
|
// (rendered without a `bg` option).
|
|
54
52
|
// But the rest of the tones are rendered on top of the `default` tone's `bg`.
|
|
55
|
-
const renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
56
|
-
|
|
57
|
-
debugPath: `${debugPath}.transparent`,
|
|
58
|
-
})
|
|
59
|
-
const renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
60
|
-
colorPalette,
|
|
61
|
-
debugPath: `${debugPath}.default`,
|
|
62
|
-
})
|
|
53
|
+
const renderedTransparentTone = renderThemeColor(transparentTone, {colorPalette})
|
|
54
|
+
const renderedDefaultTone = renderThemeColor(defaultTone, {colorPalette})
|
|
63
55
|
|
|
64
56
|
// Get the `default` tone's `bg` property
|
|
65
57
|
const bg = renderedDefaultTone.bg
|
|
@@ -73,14 +65,7 @@ function renderThemeColorScheme(
|
|
|
73
65
|
['default', renderedDefaultTone],
|
|
74
66
|
...toneEntries
|
|
75
67
|
.filter(([k]) => k !== 'default' && k !== 'transparent')
|
|
76
|
-
.map(([k, v]) => [
|
|
77
|
-
k,
|
|
78
|
-
renderThemeColor(v, {
|
|
79
|
-
bg,
|
|
80
|
-
colorPalette,
|
|
81
|
-
debugPath: `${debugPath}.${k}`,
|
|
82
|
-
}),
|
|
83
|
-
]),
|
|
68
|
+
.map(([k, v]) => [k, renderThemeColor(v, {bg, colorPalette})]),
|
|
84
69
|
]) as ThemeColorScheme_v2
|
|
85
70
|
}
|
|
86
71
|
|
|
@@ -89,12 +74,10 @@ function renderThemeColor(
|
|
|
89
74
|
options: {
|
|
90
75
|
bg?: string
|
|
91
76
|
colorPalette: ThemeColorPalette
|
|
92
|
-
debugPath: string
|
|
93
77
|
},
|
|
94
78
|
): ThemeColorCard_v2 {
|
|
95
|
-
const {colorPalette, bg
|
|
79
|
+
const {colorPalette, bg} = options
|
|
96
80
|
const blendMode = value._blend || 'multiply'
|
|
97
|
-
|
|
98
81
|
const baseBg = renderColorValue(value.bg, {colorPalette, bg, blendMode})
|
|
99
82
|
const colorOptions: RenderColorValueOptions = {colorPalette, bg: baseBg, blendMode}
|
|
100
83
|
|
|
@@ -102,14 +85,12 @@ function renderThemeColor(
|
|
|
102
85
|
baseBg,
|
|
103
86
|
blendMode,
|
|
104
87
|
colorPalette,
|
|
105
|
-
debugPath: `${debugPath}.button`,
|
|
106
88
|
})
|
|
107
89
|
|
|
108
90
|
const selectable = renderThemeColorSelectable(value.selectable, {
|
|
109
91
|
colorPalette,
|
|
110
92
|
baseBg,
|
|
111
93
|
blendMode,
|
|
112
|
-
debugPath: `${debugPath}.selectable`,
|
|
113
94
|
})
|
|
114
95
|
|
|
115
96
|
const shadow: ThemeColorShadow = {
|
|
@@ -137,19 +118,9 @@ function renderThemeColor(
|
|
|
137
118
|
accent: {
|
|
138
119
|
fg: renderColorValue(value.accent.fg, colorOptions),
|
|
139
120
|
},
|
|
140
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
141
|
-
baseBg,
|
|
142
|
-
colorPalette,
|
|
143
|
-
blendMode,
|
|
144
|
-
debugPath: `${debugPath}.avatar`,
|
|
145
|
-
}),
|
|
121
|
+
avatar: renderThemeColorAvatar(value.avatar, {baseBg, colorPalette, blendMode}),
|
|
146
122
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
147
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
148
|
-
baseBg,
|
|
149
|
-
colorPalette,
|
|
150
|
-
blendMode,
|
|
151
|
-
debugPath: `${debugPath}.badge`,
|
|
152
|
-
}),
|
|
123
|
+
badge: renderThemeColorBadge(value.badge, {baseBg, colorPalette, blendMode}),
|
|
153
124
|
bg: baseBg,
|
|
154
125
|
border: renderColorValue(value.border, colorOptions),
|
|
155
126
|
button,
|
|
@@ -160,18 +131,8 @@ function renderThemeColor(
|
|
|
160
131
|
fg: renderColorValue(value.fg, colorOptions),
|
|
161
132
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
162
133
|
icon: renderColorValue(value.icon, colorOptions),
|
|
163
|
-
input: renderThemeColorInput(value.input, {
|
|
164
|
-
|
|
165
|
-
colorPalette,
|
|
166
|
-
blendMode,
|
|
167
|
-
debugPath: `${debugPath}.input`,
|
|
168
|
-
}),
|
|
169
|
-
kbd: renderThemeColorKBD(value.kbd, {
|
|
170
|
-
baseBg,
|
|
171
|
-
colorPalette,
|
|
172
|
-
blendMode,
|
|
173
|
-
debugPath: `${debugPath}.kbd`,
|
|
174
|
-
}),
|
|
134
|
+
input: renderThemeColorInput(value.input, {baseBg, colorPalette, blendMode}),
|
|
135
|
+
kbd: renderThemeColorKBD(value.kbd, {baseBg, colorPalette, blendMode}),
|
|
175
136
|
link: {
|
|
176
137
|
fg: renderColorValue(value.link.fg, colorOptions),
|
|
177
138
|
},
|
|
@@ -184,12 +145,7 @@ function renderThemeColor(
|
|
|
184
145
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
185
146
|
to: renderColorValue(value.skeleton.to, colorOptions),
|
|
186
147
|
},
|
|
187
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
188
|
-
baseBg,
|
|
189
|
-
colorPalette,
|
|
190
|
-
blendMode,
|
|
191
|
-
debugPath: `${debugPath}.syntax`,
|
|
192
|
-
}),
|
|
148
|
+
syntax: renderSyntaxColorTheme(value.syntax, {baseBg, colorPalette, blendMode}),
|
|
193
149
|
selectable,
|
|
194
150
|
}
|
|
195
151
|
}
|
|
@@ -200,7 +156,6 @@ function renderThemeColorKBD(
|
|
|
200
156
|
baseBg: string
|
|
201
157
|
blendMode: ThemeColorBlendModeKey
|
|
202
158
|
colorPalette: ThemeColorPalette
|
|
203
|
-
debugPath: string
|
|
204
159
|
},
|
|
205
160
|
): ThemeColorKBD {
|
|
206
161
|
const {baseBg, blendMode, colorPalette} = options
|
|
@@ -232,49 +187,15 @@ function renderThemeColorAvatar(
|
|
|
232
187
|
baseBg: string
|
|
233
188
|
blendMode: ThemeColorBlendModeKey
|
|
234
189
|
colorPalette: ThemeColorPalette
|
|
235
|
-
debugPath: string
|
|
236
190
|
},
|
|
237
191
|
): ThemeColorAvatar_v2 {
|
|
238
|
-
const {
|
|
192
|
+
const colorAvatar = {} as ThemeColorAvatar_v2
|
|
239
193
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
...options,
|
|
243
|
-
debugPath: `${debugPath}.gray`,
|
|
244
|
-
}),
|
|
245
|
-
blue: renderThemeColorAvatarColor(value.blue, {
|
|
246
|
-
...options,
|
|
247
|
-
debugPath: `${debugPath}.blue`,
|
|
248
|
-
}),
|
|
249
|
-
purple: renderThemeColorAvatarColor(value.purple, {
|
|
250
|
-
...options,
|
|
251
|
-
debugPath: `${debugPath}.purple`,
|
|
252
|
-
}),
|
|
253
|
-
magenta: renderThemeColorAvatarColor(value.magenta, {
|
|
254
|
-
...options,
|
|
255
|
-
debugPath: `${debugPath}.magenta`,
|
|
256
|
-
}),
|
|
257
|
-
red: renderThemeColorAvatarColor(value.red, {
|
|
258
|
-
...options,
|
|
259
|
-
debugPath: `${debugPath}.red`,
|
|
260
|
-
}),
|
|
261
|
-
orange: renderThemeColorAvatarColor(value.orange, {
|
|
262
|
-
...options,
|
|
263
|
-
debugPath: `${debugPath}.orange`,
|
|
264
|
-
}),
|
|
265
|
-
yellow: renderThemeColorAvatarColor(value.yellow, {
|
|
266
|
-
...options,
|
|
267
|
-
debugPath: `${debugPath}.yellow`,
|
|
268
|
-
}),
|
|
269
|
-
green: renderThemeColorAvatarColor(value.green, {
|
|
270
|
-
...options,
|
|
271
|
-
debugPath: `${debugPath}.green`,
|
|
272
|
-
}),
|
|
273
|
-
cyan: renderThemeColorAvatarColor(value.cyan, {
|
|
274
|
-
...options,
|
|
275
|
-
debugPath: `${debugPath}.cyan`,
|
|
276
|
-
}),
|
|
194
|
+
for (const hue of COLOR_HUES) {
|
|
195
|
+
colorAvatar[hue] = renderThemeColorAvatarColor(value[hue], options)
|
|
277
196
|
}
|
|
197
|
+
|
|
198
|
+
return colorAvatar
|
|
278
199
|
}
|
|
279
200
|
|
|
280
201
|
function renderThemeColorAvatarColor(
|
|
@@ -283,7 +204,6 @@ function renderThemeColorAvatarColor(
|
|
|
283
204
|
baseBg: string
|
|
284
205
|
blendMode: ThemeColorBlendModeKey
|
|
285
206
|
colorPalette: ThemeColorPalette
|
|
286
|
-
debugPath: string
|
|
287
207
|
},
|
|
288
208
|
): ThemeColorAvatar_v2['gray'] {
|
|
289
209
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
@@ -316,19 +236,15 @@ function renderThemeColorBadge(
|
|
|
316
236
|
baseBg: string
|
|
317
237
|
blendMode: ThemeColorBlendModeKey
|
|
318
238
|
colorPalette: ThemeColorPalette
|
|
319
|
-
debugPath: string
|
|
320
239
|
},
|
|
321
240
|
): ThemeColorBadge_v2 {
|
|
322
|
-
const {
|
|
241
|
+
const colorBadge = {} as ThemeColorBadge_v2
|
|
323
242
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
debugPath: `${debugPath}.${tone}`,
|
|
328
|
-
})
|
|
243
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
244
|
+
colorBadge[tone] = renderThemeColorBadgeColor(value[tone], options)
|
|
245
|
+
}
|
|
329
246
|
|
|
330
|
-
|
|
331
|
-
}, {} as ThemeColorBadge_v2)
|
|
247
|
+
return colorBadge
|
|
332
248
|
}
|
|
333
249
|
|
|
334
250
|
function renderThemeColorBadgeColor(
|
|
@@ -337,7 +253,6 @@ function renderThemeColorBadgeColor(
|
|
|
337
253
|
baseBg: string
|
|
338
254
|
blendMode: ThemeColorBlendModeKey
|
|
339
255
|
colorPalette: ThemeColorPalette
|
|
340
|
-
debugPath: string
|
|
341
256
|
},
|
|
342
257
|
): ThemeColorBadgeTone_v2 {
|
|
343
258
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
@@ -372,24 +287,12 @@ function renderThemeColorButton(
|
|
|
372
287
|
baseBg: string
|
|
373
288
|
blendMode: ThemeColorBlendModeKey
|
|
374
289
|
colorPalette: ThemeColorPalette
|
|
375
|
-
debugPath: string
|
|
376
290
|
},
|
|
377
291
|
): ThemeColorButton_v2 {
|
|
378
|
-
const {debugPath} = options
|
|
379
|
-
|
|
380
292
|
return {
|
|
381
|
-
default: renderThemeColorButtonTones(value.default,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}),
|
|
385
|
-
ghost: renderThemeColorButtonTones(value.ghost, {
|
|
386
|
-
...options,
|
|
387
|
-
debugPath: `${debugPath}.ghost`,
|
|
388
|
-
}),
|
|
389
|
-
bleed: renderThemeColorButtonTones(value.bleed, {
|
|
390
|
-
...options,
|
|
391
|
-
debugPath: `${debugPath}.bleed`,
|
|
392
|
-
}),
|
|
293
|
+
default: renderThemeColorButtonTones(value.default, options),
|
|
294
|
+
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
295
|
+
bleed: renderThemeColorButtonTones(value.bleed, options),
|
|
393
296
|
}
|
|
394
297
|
}
|
|
395
298
|
|
|
@@ -399,19 +302,15 @@ function renderThemeColorButtonTones(
|
|
|
399
302
|
baseBg: string
|
|
400
303
|
blendMode: ThemeColorBlendModeKey
|
|
401
304
|
colorPalette: ThemeColorPalette
|
|
402
|
-
debugPath: string
|
|
403
305
|
},
|
|
404
306
|
): ThemeColorButtonMode_v2 {
|
|
405
|
-
const {
|
|
307
|
+
const colorButtonMode = {} as ThemeColorButtonMode_v2
|
|
406
308
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
debugPath: `${debugPath}.${tone}`,
|
|
411
|
-
})
|
|
309
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
310
|
+
colorButtonMode[tone] = renderThemeColorButtonStates(value[tone], options)
|
|
311
|
+
}
|
|
412
312
|
|
|
413
|
-
|
|
414
|
-
}, {} as ThemeColorButtonMode_v2)
|
|
313
|
+
return colorButtonMode
|
|
415
314
|
}
|
|
416
315
|
|
|
417
316
|
function renderThemeColorButtonStates(
|
|
@@ -420,32 +319,14 @@ function renderThemeColorButtonStates(
|
|
|
420
319
|
baseBg: string
|
|
421
320
|
blendMode: ThemeColorBlendModeKey
|
|
422
321
|
colorPalette: ThemeColorPalette
|
|
423
|
-
debugPath: string
|
|
424
322
|
},
|
|
425
323
|
): ThemeColorButtonTone_v2 {
|
|
426
|
-
const {debugPath} = options
|
|
427
|
-
|
|
428
324
|
return {
|
|
429
|
-
enabled: renderThemeColorState(value.enabled,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
...options,
|
|
435
|
-
debugPath: `${debugPath}.hovered`,
|
|
436
|
-
}),
|
|
437
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
438
|
-
...options,
|
|
439
|
-
debugPath: `${debugPath}.pressed`,
|
|
440
|
-
}),
|
|
441
|
-
selected: renderThemeColorState(value.selected, {
|
|
442
|
-
...options,
|
|
443
|
-
debugPath: `${debugPath}.selected`,
|
|
444
|
-
}),
|
|
445
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
446
|
-
...options,
|
|
447
|
-
debugPath: `${debugPath}.disabled`,
|
|
448
|
-
}),
|
|
325
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
326
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
327
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
328
|
+
selected: renderThemeColorState(value.selected, options),
|
|
329
|
+
disabled: renderThemeColorState(value.disabled, options),
|
|
449
330
|
}
|
|
450
331
|
}
|
|
451
332
|
|
|
@@ -455,10 +336,9 @@ function renderThemeColorState(
|
|
|
455
336
|
baseBg: string
|
|
456
337
|
blendMode: ThemeColorBlendModeKey
|
|
457
338
|
colorPalette: ThemeColorPalette
|
|
458
|
-
debugPath: string
|
|
459
339
|
},
|
|
460
340
|
): ThemeColorState_v2 {
|
|
461
|
-
const {baseBg, blendMode: rootBlendMode, colorPalette
|
|
341
|
+
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
462
342
|
const blendMode = value._blend || 'multiply'
|
|
463
343
|
|
|
464
344
|
const rootOptions: RenderColorValueOptions = {
|
|
@@ -480,18 +360,8 @@ function renderThemeColorState(
|
|
|
480
360
|
accent: {
|
|
481
361
|
fg: renderColorValue(value.accent.fg, colorOptions),
|
|
482
362
|
},
|
|
483
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
484
|
-
|
|
485
|
-
colorPalette,
|
|
486
|
-
blendMode,
|
|
487
|
-
debugPath: `${debugPath}.avatar`,
|
|
488
|
-
}),
|
|
489
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
490
|
-
baseBg: bg,
|
|
491
|
-
colorPalette,
|
|
492
|
-
blendMode,
|
|
493
|
-
debugPath: `${debugPath}.badge`,
|
|
494
|
-
}),
|
|
363
|
+
avatar: renderThemeColorAvatar(value.avatar, {baseBg: bg, colorPalette, blendMode}),
|
|
364
|
+
badge: renderThemeColorBadge(value.badge, {baseBg: bg, colorPalette, blendMode}),
|
|
495
365
|
bg,
|
|
496
366
|
border: renderColorValue(value.border, colorOptions),
|
|
497
367
|
code: {
|
|
@@ -525,20 +395,11 @@ function renderThemeColorInput(
|
|
|
525
395
|
baseBg: string
|
|
526
396
|
blendMode: ThemeColorBlendModeKey
|
|
527
397
|
colorPalette: ThemeColorPalette
|
|
528
|
-
debugPath: string
|
|
529
398
|
},
|
|
530
399
|
): ThemeColorInput_v2 {
|
|
531
|
-
const {debugPath} = options
|
|
532
|
-
|
|
533
400
|
return {
|
|
534
|
-
default: renderInputStatesColorTheme(value.default,
|
|
535
|
-
|
|
536
|
-
debugPath: `${debugPath}.default`,
|
|
537
|
-
}),
|
|
538
|
-
invalid: renderInputStatesColorTheme(value.invalid, {
|
|
539
|
-
...options,
|
|
540
|
-
debugPath: `${debugPath}.invalid`,
|
|
541
|
-
}),
|
|
401
|
+
default: renderInputStatesColorTheme(value.default, options),
|
|
402
|
+
invalid: renderInputStatesColorTheme(value.invalid, options),
|
|
542
403
|
}
|
|
543
404
|
}
|
|
544
405
|
|
|
@@ -548,28 +409,13 @@ function renderInputStatesColorTheme(
|
|
|
548
409
|
baseBg: string
|
|
549
410
|
blendMode: ThemeColorBlendModeKey
|
|
550
411
|
colorPalette: ThemeColorPalette
|
|
551
|
-
debugPath: string
|
|
552
412
|
},
|
|
553
413
|
): ThemeColorInputMode_v2 {
|
|
554
|
-
const {debugPath} = options
|
|
555
|
-
|
|
556
414
|
return {
|
|
557
|
-
enabled: renderInputStateColorTheme(value.enabled,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
hovered: renderInputStateColorTheme(value.hovered, {
|
|
562
|
-
...options,
|
|
563
|
-
debugPath: `${debugPath}.hovered`,
|
|
564
|
-
}),
|
|
565
|
-
readOnly: renderInputStateColorTheme(value.readOnly, {
|
|
566
|
-
...options,
|
|
567
|
-
debugPath: `${debugPath}.readOnly`,
|
|
568
|
-
}),
|
|
569
|
-
disabled: renderInputStateColorTheme(value.disabled, {
|
|
570
|
-
...options,
|
|
571
|
-
debugPath: `${debugPath}.disabled`,
|
|
572
|
-
}),
|
|
415
|
+
enabled: renderInputStateColorTheme(value.enabled, options),
|
|
416
|
+
hovered: renderInputStateColorTheme(value.hovered, options),
|
|
417
|
+
readOnly: renderInputStateColorTheme(value.readOnly, options),
|
|
418
|
+
disabled: renderInputStateColorTheme(value.disabled, options),
|
|
573
419
|
}
|
|
574
420
|
}
|
|
575
421
|
|
|
@@ -579,7 +425,6 @@ function renderInputStateColorTheme(
|
|
|
579
425
|
baseBg: string
|
|
580
426
|
blendMode: ThemeColorBlendModeKey
|
|
581
427
|
colorPalette: ThemeColorPalette
|
|
582
|
-
debugPath: string
|
|
583
428
|
},
|
|
584
429
|
): ThemeColorInputState_v2 {
|
|
585
430
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
@@ -606,19 +451,15 @@ function renderThemeColorSelectable(
|
|
|
606
451
|
baseBg: string
|
|
607
452
|
blendMode: ThemeColorBlendModeKey
|
|
608
453
|
colorPalette: ThemeColorPalette
|
|
609
|
-
debugPath: string
|
|
610
454
|
},
|
|
611
455
|
): ThemeColorSelectable_v2 {
|
|
612
|
-
const {
|
|
456
|
+
const colorSelectable = {} as ThemeColorSelectable_v2
|
|
613
457
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
debugPath: `${debugPath}.${tone}`,
|
|
618
|
-
})
|
|
458
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
459
|
+
colorSelectable[tone] = renderThemeColorSelectableStates(value[tone], options)
|
|
460
|
+
}
|
|
619
461
|
|
|
620
|
-
|
|
621
|
-
}, {} as ThemeColorSelectable_v2)
|
|
462
|
+
return colorSelectable
|
|
622
463
|
}
|
|
623
464
|
|
|
624
465
|
function renderThemeColorSelectableStates(
|
|
@@ -627,32 +468,14 @@ function renderThemeColorSelectableStates(
|
|
|
627
468
|
baseBg: string
|
|
628
469
|
blendMode: ThemeColorBlendModeKey
|
|
629
470
|
colorPalette: ThemeColorPalette
|
|
630
|
-
debugPath: string
|
|
631
471
|
},
|
|
632
472
|
): ThemeColorSelectableTone_v2 {
|
|
633
|
-
const {debugPath} = options
|
|
634
|
-
|
|
635
473
|
return {
|
|
636
|
-
enabled: renderThemeColorState(value.enabled,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
...options,
|
|
642
|
-
debugPath: `${debugPath}.hovered`,
|
|
643
|
-
}),
|
|
644
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
645
|
-
...options,
|
|
646
|
-
debugPath: `${debugPath}.pressed`,
|
|
647
|
-
}),
|
|
648
|
-
selected: renderThemeColorState(value.selected, {
|
|
649
|
-
...options,
|
|
650
|
-
debugPath: `${debugPath}.selected`,
|
|
651
|
-
}),
|
|
652
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
653
|
-
...options,
|
|
654
|
-
debugPath: `${debugPath}.disabled`,
|
|
655
|
-
}),
|
|
474
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
475
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
476
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
477
|
+
selected: renderThemeColorState(value.selected, options),
|
|
478
|
+
disabled: renderThemeColorState(value.disabled, options),
|
|
656
479
|
}
|
|
657
480
|
}
|
|
658
481
|
|
|
@@ -662,7 +485,6 @@ function renderSyntaxColorTheme(
|
|
|
662
485
|
baseBg: string
|
|
663
486
|
blendMode: ThemeColorBlendModeKey
|
|
664
487
|
colorPalette: ThemeColorPalette
|
|
665
|
-
debugPath: string
|
|
666
488
|
},
|
|
667
489
|
): ThemeColorSyntax {
|
|
668
490
|
const {colorPalette, baseBg, blendMode} = options
|
|
@@ -22,9 +22,6 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
22
22
|
icon: ['500', '500'],
|
|
23
23
|
dot: ['500', '500'],
|
|
24
24
|
},
|
|
25
|
-
'default': {
|
|
26
|
-
_hue: 'gray',
|
|
27
|
-
},
|
|
28
25
|
'positive': {
|
|
29
26
|
bg: ['200 50%', '900'],
|
|
30
27
|
fg: ['600', '500'],
|
|
@@ -41,7 +38,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
41
38
|
fg: ['600', '400'],
|
|
42
39
|
},
|
|
43
40
|
fg: ['800', '200'],
|
|
44
|
-
focusRing: ['
|
|
41
|
+
focusRing: ['blue/500', 'blue/500'],
|
|
45
42
|
icon: ['600', '400'],
|
|
46
43
|
kbd: {
|
|
47
44
|
bg: ['white', 'black'],
|
|
@@ -49,7 +46,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
49
46
|
border: ['200', '800'],
|
|
50
47
|
},
|
|
51
48
|
link: {
|
|
52
|
-
fg: ['
|
|
49
|
+
fg: ['blue/600', 'blue/300'],
|
|
53
50
|
},
|
|
54
51
|
muted: {
|
|
55
52
|
bg: ['50', '950'],
|
|
@@ -76,7 +73,8 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
76
73
|
fg: ['600', '400'],
|
|
77
74
|
},
|
|
78
75
|
},
|
|
79
|
-
'primary': {_hue: '
|
|
76
|
+
'primary': {_hue: 'blue'},
|
|
77
|
+
'suggest': {_hue: 'purple'},
|
|
80
78
|
'positive': {
|
|
81
79
|
_hue: 'green',
|
|
82
80
|
shadow: {outline: ['500/0.4', '500/0.4']},
|
|
@@ -86,8 +84,6 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
86
84
|
shadow: {outline: ['600/0.3', '500/0.4']},
|
|
87
85
|
},
|
|
88
86
|
'critical': {_hue: 'red'},
|
|
89
|
-
'prospect': {_hue: 'purple'},
|
|
90
|
-
'explore': {_hue: 'cyan'},
|
|
91
87
|
},
|
|
92
88
|
button: {
|
|
93
89
|
default: {
|
|
@@ -126,7 +122,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
126
122
|
border: ['800', '200'],
|
|
127
123
|
},
|
|
128
124
|
link: {
|
|
129
|
-
fg: ['
|
|
125
|
+
fg: ['blue/200', 'blue/600'],
|
|
130
126
|
},
|
|
131
127
|
muted: {
|
|
132
128
|
bg: ['950', '50'],
|
|
@@ -138,7 +134,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
138
134
|
},
|
|
139
135
|
},
|
|
140
136
|
'hovered': {
|
|
141
|
-
bg: ['
|
|
137
|
+
bg: ['600', '300'],
|
|
142
138
|
border: ['700/0', '300/0'],
|
|
143
139
|
},
|
|
144
140
|
'pressed': {
|
|
@@ -249,7 +245,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
249
245
|
border: ['200', '800'],
|
|
250
246
|
},
|
|
251
247
|
link: {
|
|
252
|
-
fg: ['
|
|
248
|
+
fg: ['blue/700 60%', 'blue/300 60%'],
|
|
253
249
|
},
|
|
254
250
|
muted: {
|
|
255
251
|
bg: ['100', '950'],
|
|
@@ -265,11 +261,11 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
265
261
|
fg: ['700', '300'],
|
|
266
262
|
},
|
|
267
263
|
'pressed': {
|
|
268
|
-
bg: ['
|
|
264
|
+
bg: ['200', '800'],
|
|
269
265
|
fg: ['800', '200'],
|
|
270
266
|
},
|
|
271
267
|
'selected': {
|
|
272
|
-
bg: ['
|
|
268
|
+
bg: ['200', '800'],
|
|
273
269
|
fg: ['800', '200'],
|
|
274
270
|
},
|
|
275
271
|
'disabled': {
|
|
@@ -360,7 +356,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
360
356
|
border: ['200', '800'],
|
|
361
357
|
},
|
|
362
358
|
link: {
|
|
363
|
-
fg: ['
|
|
359
|
+
fg: ['blue/700 70%', 'blue/300 70%'],
|
|
364
360
|
},
|
|
365
361
|
muted: {
|
|
366
362
|
bg: ['100', '950'],
|
|
@@ -498,7 +494,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
498
494
|
border: ['200', '800'],
|
|
499
495
|
},
|
|
500
496
|
link: {
|
|
501
|
-
fg: ['
|
|
497
|
+
fg: ['blue/700 70%', 'blue/300 70%'],
|
|
502
498
|
},
|
|
503
499
|
muted: {
|
|
504
500
|
bg: ['50', '950'],
|
|
@@ -513,7 +509,6 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
513
509
|
bg: ['50', '950'],
|
|
514
510
|
},
|
|
515
511
|
'pressed': {
|
|
516
|
-
// _hue: 'purple',
|
|
517
512
|
bg: ['100', '900'],
|
|
518
513
|
},
|
|
519
514
|
'selected': {
|
|
@@ -550,7 +545,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
550
545
|
border: ['800', '200'],
|
|
551
546
|
},
|
|
552
547
|
link: {
|
|
553
|
-
fg: ['
|
|
548
|
+
fg: ['blue/200', 'blue/600'],
|
|
554
549
|
},
|
|
555
550
|
muted: {
|
|
556
551
|
bg: ['500 10%', '400 10%'],
|
|
@@ -605,7 +600,7 @@ export const defaultColorTokens: ThemeColorTokens = {
|
|
|
605
600
|
},
|
|
606
601
|
'default': {
|
|
607
602
|
selected: {
|
|
608
|
-
_hue: '
|
|
603
|
+
_hue: 'blue',
|
|
609
604
|
},
|
|
610
605
|
},
|
|
611
606
|
'critical': {
|
|
@@ -10,27 +10,23 @@ export const THEME_COLOR_BLEND_MODES = ['multiply', 'screen'] as const
|
|
|
10
10
|
export const THEME_COLOR_CARD_TONES = [
|
|
11
11
|
'transparent',
|
|
12
12
|
'default',
|
|
13
|
-
'
|
|
13
|
+
'neutral',
|
|
14
|
+
'primary', // deprecated
|
|
15
|
+
'suggest',
|
|
14
16
|
'positive',
|
|
15
17
|
'caution',
|
|
16
18
|
'critical',
|
|
17
|
-
|
|
18
|
-
// new
|
|
19
|
-
'prospect',
|
|
20
|
-
'explore',
|
|
21
19
|
] as const
|
|
22
20
|
|
|
23
21
|
/** @public */
|
|
24
22
|
export const THEME_COLOR_STATE_TONES = [
|
|
25
23
|
'default',
|
|
26
|
-
'
|
|
24
|
+
'neutral',
|
|
25
|
+
'primary', // deprecated
|
|
26
|
+
'suggest',
|
|
27
27
|
'positive',
|
|
28
28
|
'caution',
|
|
29
29
|
'critical',
|
|
30
|
-
|
|
31
|
-
// new
|
|
32
|
-
'prospect',
|
|
33
|
-
'explore',
|
|
34
30
|
] as const
|
|
35
31
|
|
|
36
32
|
/** @public */
|