@sanity/ui 3.0.0-static.16 → 3.0.0-static.17
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/README.md +2 -4
- package/bin/{ui.js → sanity-ui.cjs} +1 -1
- package/dist/_chunks-cjs/{_visual-editing.js → _visual-editing.cjs} +4 -4
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -0
- package/dist/_chunks-cjs/{buildCommand.js → buildCommand.cjs} +26 -10
- package/dist/_chunks-cjs/buildCommand.cjs.map +1 -0
- package/dist/_chunks-cjs/{refractor.js → refractor.cjs} +1 -1
- package/dist/_chunks-cjs/refractor.cjs.map +1 -0
- package/dist/_chunks-es/{_visual-editing.mjs → _visual-editing.js} +4 -4
- package/dist/_chunks-es/_visual-editing.js.map +1 -0
- package/dist/_chunks-es/{refractor.mjs → refractor.js} +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -0
- package/dist/_visual-editing.cjs +30 -0
- package/dist/_visual-editing.cjs.map +1 -0
- package/dist/_visual-editing.js +29 -29
- package/dist/_visual-editing.js.map +1 -1
- package/dist/{cli.js → cli.cjs} +4 -4
- package/dist/cli.cjs.map +1 -0
- package/dist/{css.mjs → css.cjs} +490 -499
- package/dist/css.cjs.map +1 -0
- package/dist/{css.d.mts → css.d.cts} +19 -23
- package/dist/css.d.ts +19 -23
- package/dist/css.js +490 -497
- package/dist/css.js.map +1 -1
- package/dist/{index.mjs → index.cjs} +368 -367
- package/dist/{index.mjs.map → index.cjs.map} +1 -1
- package/dist/index.js +366 -367
- package/dist/index.js.map +1 -1
- package/dist/{theme.mjs → theme.cjs} +219 -196
- package/dist/theme.cjs.map +1 -0
- package/dist/{theme.d.mts → theme.d.cts} +2 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +218 -195
- package/dist/theme.js.map +1 -1
- package/dist/{sanity-palette.css → ui-palette.css} +1 -1
- package/dist/ui-palette.min.css +1 -0
- package/dist/{system.css → ui-system.css} +258 -140
- package/dist/ui-system.min.css +1 -0
- package/dist/{sanity-theme.css → ui-theme.css} +199 -199
- package/dist/ui-theme.min.css +1 -0
- package/dist/ui.css +29152 -0
- package/dist/ui.min.css +1 -0
- package/package.json +20 -20
- package/src/cli/buildCommand.ts +55 -20
- package/src/cli/index.ts +1 -1
- package/src/core/StyleTags.tsx +4 -4
- package/src/core/components/autocomplete/__workshop__/async.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +3 -3
- package/src/core/primitives/button/__workshop__/custom.tsx +18 -41
- package/src/core/primitives/button/button.tsx +3 -1
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -9
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -1
- package/src/core/primitives/card/__workshop__/props.tsx +0 -3
- package/src/core/primitives/card/__workshop__/selected.tsx +6 -37
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +1 -8
- package/src/core/primitives/label/__workshop__/plain.tsx +1 -9
- package/src/core/primitives/text/__workshop__/example.tsx +1 -9
- package/src/css/{compilePalette.ts → _compilePalette.ts} +2 -2
- package/src/css/{compileSystem.ts → _compileSystem.ts} +1 -1
- package/src/css/{compileTheme.ts → _compileTheme.ts} +3 -3
- package/src/css/{compileTheme_v3.ts → _compileTheme_v3.ts} +7 -1
- package/src/css/_system.style.ts +1 -0
- package/src/css/index.ts +3 -3
- package/src/css/primitives/button/button.style.ts +23 -9
- package/src/css/primitives/button/button.ts +1 -12
- package/src/css/primitives/button/types.ts +1 -6
- package/src/css/primitives/card/card.style.ts +12 -21
- package/src/css/primitives/kbd/kbd.style.ts +3 -6
- package/src/css/types.ts +9 -9
- package/src/theme/v3/color/buildColor_v3.ts +53 -25
- package/src/theme/v3/color/card.ts +0 -42
- package/src/theme/v3/color/renderColor.test.ts +1 -0
- package/src/theme/v3/color/renderColor.ts +9 -2
- package/src/theme/v3/color/token.ts +1 -0
- package/src/theme/v3/defaultTokens.ts +7 -2
- package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
- package/dist/_chunks-cjs/buildCommand.js.map +0 -1
- package/dist/_chunks-cjs/refractor.js.map +0 -1
- package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
- package/dist/_chunks-es/refractor.mjs.map +0 -1
- package/dist/_visual-editing.mjs +0 -30
- package/dist/_visual-editing.mjs.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/css.mjs.map +0 -1
- package/dist/sanity-palette.min.css +0 -1
- package/dist/sanity-theme.min.css +0 -1
- package/dist/system.min.css +0 -1
- package/dist/theme.mjs.map +0 -1
- package/src/css/primitives/button/_constants.ts +0 -17
- /package/dist/{_visual-editing.d.mts → _visual-editing.d.cts} +0 -0
- /package/dist/{cli.d.ts → cli.d.cts} +0 -0
- /package/dist/{index.d.mts → index.d.cts} +0 -0
|
@@ -22,7 +22,7 @@ const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
|
22
22
|
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
23
23
|
|
|
24
24
|
/** @internal */
|
|
25
|
-
export function
|
|
25
|
+
export function _compileTheme_v3(theme: Theme_v3): string {
|
|
26
26
|
return _compileStyle({
|
|
27
27
|
layers: {
|
|
28
28
|
theme: {
|
|
@@ -36,7 +36,10 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
36
36
|
return {
|
|
37
37
|
...buildAvatarThemeProperties(theme),
|
|
38
38
|
...buildButtonThemeProperties(theme),
|
|
39
|
+
|
|
40
|
+
// card
|
|
39
41
|
[varNames.card.shadow.outline]: px(theme.card.shadow.outline),
|
|
42
|
+
|
|
40
43
|
...buildColorThemeProperties(theme),
|
|
41
44
|
...buildContainerThemeProperties(theme),
|
|
42
45
|
...buildFontCodeThemeProperties(theme),
|
|
@@ -297,6 +300,7 @@ function buildColorThemeProperties(theme: Theme_v3): Properties {
|
|
|
297
300
|
const t = theme._tokens.color[cardTone].variant[colorVariant][elementTone]
|
|
298
301
|
|
|
299
302
|
const context: RenderColorContext = {
|
|
303
|
+
bgValue: 'transparent',
|
|
300
304
|
bgVar: v.bg[0],
|
|
301
305
|
hue: t._hue,
|
|
302
306
|
scheme,
|
|
@@ -342,6 +346,7 @@ function buildColorAvatarThemeProperties(
|
|
|
342
346
|
|
|
343
347
|
for (const hue of HUES) {
|
|
344
348
|
const context: RenderColorContext = {
|
|
349
|
+
bgValue: 'transparent',
|
|
345
350
|
bgVar: varNames.color.bg,
|
|
346
351
|
hue: t.avatar[hue]._hue ?? hue,
|
|
347
352
|
scheme,
|
|
@@ -366,6 +371,7 @@ function buildColorCardThemeProperties(
|
|
|
366
371
|
const t = theme._tokens.color[cardTone]
|
|
367
372
|
|
|
368
373
|
const context: RenderColorContext = {
|
|
374
|
+
bgValue: 'transparent',
|
|
369
375
|
bgVar: varNames.color.bg,
|
|
370
376
|
hue: t._hue,
|
|
371
377
|
scheme,
|
package/src/css/_system.style.ts
CHANGED
package/src/css/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
export * from './_compilePalette'
|
|
2
|
+
export * from './_compileSystem'
|
|
3
|
+
export * from './_compileTheme'
|
|
1
4
|
export * from './aspects'
|
|
2
|
-
export * from './compilePalette'
|
|
3
|
-
export * from './compileSystem'
|
|
4
|
-
export * from './compileTheme'
|
|
5
5
|
export * from './components/breadcrumbs'
|
|
6
6
|
export * from './components/dialog'
|
|
7
7
|
export * from './components/menu'
|
|
@@ -3,7 +3,6 @@ import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
|
3
3
|
import {Style, StyleRules} from '../../types'
|
|
4
4
|
import {varNames} from '../../varNames'
|
|
5
5
|
import {vars} from '../../vars'
|
|
6
|
-
import {toneMap, variantMap} from './_constants'
|
|
7
6
|
|
|
8
7
|
const primitive: StyleRules = {
|
|
9
8
|
'.button': {
|
|
@@ -62,9 +61,11 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
62
61
|
const tinted = vars.color.tinted[tone]
|
|
63
62
|
|
|
64
63
|
// mode: default
|
|
65
|
-
primitive[`.button
|
|
64
|
+
primitive[`.button[data-mode="default"][data-tone="${tone}"]`] = {
|
|
66
65
|
[varNames.color.bg]: solid.bg[0],
|
|
67
66
|
[varNames.color.border]: solid.border[1],
|
|
67
|
+
[varNames.color.code.bg]: solid.bg[1],
|
|
68
|
+
[varNames.color.code.fg]: solid.fg[4],
|
|
68
69
|
[varNames.color.fg]: solid.fg[0],
|
|
69
70
|
[varNames.color.muted.bg]: solid.bg[1],
|
|
70
71
|
[varNames.color.muted.fg]: solid.fg[4],
|
|
@@ -74,6 +75,8 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
74
75
|
'&:not([data-disabled]):hover': {
|
|
75
76
|
[varNames.color.bg]: solid.bg[1],
|
|
76
77
|
[varNames.color.border]: solid.border[2],
|
|
78
|
+
[varNames.color.code.bg]: solid.bg[2],
|
|
79
|
+
[varNames.color.code.fg]: solid.fg[4],
|
|
77
80
|
[varNames.color.fg]: solid.fg[0],
|
|
78
81
|
[varNames.color.muted.bg]: solid.bg[2],
|
|
79
82
|
[varNames.color.muted.fg]: solid.fg[4],
|
|
@@ -82,6 +85,8 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
82
85
|
'&:not([data-disabled]):active': {
|
|
83
86
|
[varNames.color.bg]: solid.bg[2],
|
|
84
87
|
[varNames.color.border]: solid.border[3],
|
|
88
|
+
[varNames.color.code.bg]: solid.bg[3],
|
|
89
|
+
[varNames.color.code.fg]: solid.fg[4],
|
|
85
90
|
[varNames.color.fg]: solid.fg[0],
|
|
86
91
|
[varNames.color.muted.bg]: solid.bg[3],
|
|
87
92
|
[varNames.color.muted.fg]: solid.fg[4],
|
|
@@ -90,6 +95,8 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
90
95
|
'&:not([data-disabled])[data-selected]': {
|
|
91
96
|
[varNames.color.bg]: solid.bg[2],
|
|
92
97
|
[varNames.color.border]: solid.border[3],
|
|
98
|
+
[varNames.color.code.bg]: solid.bg[3],
|
|
99
|
+
[varNames.color.code.fg]: solid.fg[4],
|
|
93
100
|
[varNames.color.fg]: solid.fg[0],
|
|
94
101
|
[varNames.color.muted.bg]: solid.bg[3],
|
|
95
102
|
[varNames.color.muted.fg]: solid.fg[4],
|
|
@@ -117,10 +124,12 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
// mode: ghost
|
|
120
|
-
primitive[`.button
|
|
127
|
+
primitive[`.button[data-mode="ghost"][data-tone="${tone}"]`] = {
|
|
121
128
|
[varNames.color.bg]: tinted.bg[1],
|
|
122
|
-
[varNames.color.border]: tinted.border[
|
|
129
|
+
[varNames.color.border]: tinted.border[1],
|
|
123
130
|
[varNames.color.fg]: tinted.fg[2],
|
|
131
|
+
[varNames.color.code.bg]: tinted.bg[2],
|
|
132
|
+
[varNames.color.code.fg]: tinted.fg[4],
|
|
124
133
|
[varNames.color.muted.bg]: tinted.bg[2],
|
|
125
134
|
[varNames.color.muted.fg]: tinted.fg[4],
|
|
126
135
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
@@ -128,16 +137,19 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
128
137
|
'@nest': {
|
|
129
138
|
'&:not([data-disabled]):hover': {
|
|
130
139
|
[varNames.color.bg]: tinted.bg[2],
|
|
131
|
-
[varNames.color.border]: tinted.border[
|
|
140
|
+
[varNames.color.border]: tinted.border[2],
|
|
141
|
+
[varNames.color.code.bg]: tinted.bg[3],
|
|
142
|
+
[varNames.color.code.fg]: tinted.fg[3],
|
|
132
143
|
[varNames.color.fg]: tinted.fg[1],
|
|
133
144
|
[varNames.color.muted.bg]: tinted.bg[3],
|
|
134
145
|
[varNames.color.muted.fg]: tinted.fg[3],
|
|
135
|
-
// '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
136
146
|
},
|
|
137
147
|
|
|
138
148
|
'&:not([data-disabled]):active': {
|
|
139
149
|
[varNames.color.bg]: tinted.bg[3],
|
|
140
|
-
[varNames.color.border]: tinted.border[
|
|
150
|
+
[varNames.color.border]: tinted.border[3],
|
|
151
|
+
[varNames.color.code.bg]: tinted.bg[4],
|
|
152
|
+
[varNames.color.code.fg]: tinted.fg[3],
|
|
141
153
|
[varNames.color.fg]: tinted.fg[1],
|
|
142
154
|
[varNames.color.muted.bg]: tinted.bg[4],
|
|
143
155
|
[varNames.color.muted.fg]: tinted.fg[3],
|
|
@@ -146,7 +158,9 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
146
158
|
|
|
147
159
|
'&:not([data-disabled])[data-selected]': {
|
|
148
160
|
[varNames.color.bg]: tinted.bg[3],
|
|
149
|
-
[varNames.color.border]: tinted.border[
|
|
161
|
+
[varNames.color.border]: tinted.border[3],
|
|
162
|
+
[varNames.color.code.bg]: tinted.bg[4],
|
|
163
|
+
[varNames.color.code.fg]: tinted.fg[3],
|
|
150
164
|
[varNames.color.fg]: tinted.fg[1],
|
|
151
165
|
[varNames.color.muted.bg]: tinted.bg[4],
|
|
152
166
|
[varNames.color.muted.fg]: tinted.fg[3],
|
|
@@ -175,7 +189,7 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
// mode: bleed
|
|
178
|
-
primitive[`.button
|
|
192
|
+
primitive[`.button[data-mode="bleed"][data-tone="${tone}"]`] = {
|
|
179
193
|
'boxShadow': 'none',
|
|
180
194
|
[varNames.color.bg]: tinted.bg[0],
|
|
181
195
|
[varNames.color.border]: tinted.border[1],
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
import {display, flexItem, radius, width} from '../../aspects'
|
|
3
|
-
import {toneMap, variantMap} from './_constants'
|
|
4
3
|
import {ButtonStyleProps} from './types'
|
|
5
4
|
|
|
6
5
|
/** @public */
|
|
7
6
|
export function button(props: ButtonStyleProps): string | undefined {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return _comp(
|
|
11
|
-
'button',
|
|
12
|
-
variantMap[mode ?? 'default'],
|
|
13
|
-
toneMap[tone ?? 'default'],
|
|
14
|
-
display(props),
|
|
15
|
-
flexItem(props),
|
|
16
|
-
radius(props),
|
|
17
|
-
width(props),
|
|
18
|
-
)
|
|
7
|
+
return _comp('button', display(props), flexItem(props), radius(props), width(props))
|
|
19
8
|
}
|
|
20
9
|
|
|
21
10
|
/** @public */
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
DisplayStyleProps,
|
|
5
3
|
FlexItemStyleProps,
|
|
@@ -12,7 +10,4 @@ export interface ButtonStyleProps
|
|
|
12
10
|
extends DisplayStyleProps,
|
|
13
11
|
FlexItemStyleProps,
|
|
14
12
|
RadiusStyleProps,
|
|
15
|
-
WidthStyleProps {
|
|
16
|
-
mode?: ThemeColorButtonModeKey
|
|
17
|
-
tone?: ThemeColorStateToneKey
|
|
18
|
-
}
|
|
13
|
+
WidthStyleProps {}
|
|
@@ -45,6 +45,13 @@ const primitive: StyleRules = {
|
|
|
45
45
|
whiteSpace: 'inherit',
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
+
'&[data-checkered]': {
|
|
49
|
+
backgroundSize: `${vars.space[3]} ${vars.space[3]}` as string,
|
|
50
|
+
backgroundPosition: 'top left',
|
|
51
|
+
backgroundImage:
|
|
52
|
+
`repeating-conic-gradient(${vars.color.bg} 0% 25%, ${vars.color.muted.bg} 0% 50%)` as string,
|
|
53
|
+
},
|
|
54
|
+
|
|
48
55
|
'a&:not([data-disabled]):hover, button&:not([data-disabled]):hover': {
|
|
49
56
|
[varNames.color.bg]: vars.color.tinted.default.bg[1],
|
|
50
57
|
[varNames.color.border]: vars.color.tinted.default.border[3],
|
|
@@ -87,29 +94,13 @@ const primitive: StyleRules = {
|
|
|
87
94
|
[varNames.color.muted.fg]: vars.color.solid.primary.fg[3],
|
|
88
95
|
},
|
|
89
96
|
|
|
90
|
-
// '&:not([data-disabled]):focus': {
|
|
91
|
-
// '--color-bg': vars.color.solid.bg[0],
|
|
92
|
-
// '--color-border': vars.color.solid.border[1],
|
|
93
|
-
// '--color-fg': vars.color.solid.fg[1],
|
|
94
|
-
// '--color-muted-bg': vars.color.solid.bg[1],
|
|
95
|
-
// '--color-muted-fg': vars.color.solid.fg[3],
|
|
96
|
-
// },
|
|
97
|
-
|
|
98
97
|
'a&[data-disabled], button&[data-disabled]': {
|
|
99
|
-
[varNames.color.bg]: vars.color.tinted.default.bg[
|
|
100
|
-
[varNames.color.border]: vars.color.tinted.default.border[
|
|
101
|
-
[varNames.color.fg]: vars.color.tinted.default.
|
|
102
|
-
[varNames.color.muted.bg]: vars.color.tinted.default.bg[
|
|
103
|
-
[varNames.color.muted.fg]: vars.color.tinted.default.
|
|
98
|
+
[varNames.color.bg]: vars.color.tinted.default.bg[0],
|
|
99
|
+
[varNames.color.border]: vars.color.tinted.default.border[1],
|
|
100
|
+
[varNames.color.fg]: vars.color.tinted.default.border[3],
|
|
101
|
+
[varNames.color.muted.bg]: vars.color.tinted.default.bg[1],
|
|
102
|
+
[varNames.color.muted.fg]: vars.color.tinted.default.border[1],
|
|
104
103
|
},
|
|
105
|
-
|
|
106
|
-
// '&[data-disabled]': {
|
|
107
|
-
// '--color-bg': vars.color.tinted.bg[0],
|
|
108
|
-
// '--color-border': vars.color.tinted.border[1],
|
|
109
|
-
// '--color-fg': vars.color.tinted.border[4],
|
|
110
|
-
// '--color-muted-bg': vars.color.tinted.bg[1],
|
|
111
|
-
// '--color-muted-fg': vars.color.tinted.border[4],
|
|
112
|
-
// },
|
|
113
104
|
},
|
|
114
105
|
},
|
|
115
106
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {Style, StyleRules} from '../../types'
|
|
2
|
+
import {vars} from '../../vars'
|
|
2
3
|
|
|
3
4
|
const primitive: StyleRules = {
|
|
4
5
|
'.kbd': {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// '--color-fg': 'var(--color-tinted-default-fg-3)',
|
|
8
|
-
|
|
9
|
-
'boxShadow': 'inset 0 0 0 0.5px var(--color-tinted-default-border-3)',
|
|
10
|
-
'background': 'var(--color-muted-bg)',
|
|
6
|
+
'boxShadow': `inset 0 0 0 0.5px ${vars.color.border}`,
|
|
7
|
+
'backgroundColor': vars.color.muted.bg,
|
|
11
8
|
'font': 'inherit',
|
|
12
9
|
'verticalAlign': 'top',
|
|
13
10
|
|
package/src/css/types.ts
CHANGED
|
@@ -611,6 +611,15 @@ export interface FontVarNames<Size extends number> {
|
|
|
611
611
|
|
|
612
612
|
/** @public */
|
|
613
613
|
export interface VarNames {
|
|
614
|
+
avatar: {
|
|
615
|
+
distance: VarName
|
|
616
|
+
focusRing: {
|
|
617
|
+
offset: VarName
|
|
618
|
+
width: VarName
|
|
619
|
+
}
|
|
620
|
+
size: VarName
|
|
621
|
+
sizes: Record<AvatarSize, {distance: VarName; size: VarName}>
|
|
622
|
+
}
|
|
614
623
|
button: {
|
|
615
624
|
border: {
|
|
616
625
|
width: VarName
|
|
@@ -629,15 +638,6 @@ export interface VarNames {
|
|
|
629
638
|
ScopedColorVarNames &
|
|
630
639
|
Record<CardTone, ColorCardVarNames>
|
|
631
640
|
container: Record<Exclude<ContainerWidth, 'auto'>, VarName>
|
|
632
|
-
avatar: {
|
|
633
|
-
distance: VarName
|
|
634
|
-
focusRing: {
|
|
635
|
-
offset: VarName
|
|
636
|
-
width: VarName
|
|
637
|
-
}
|
|
638
|
-
size: VarName
|
|
639
|
-
sizes: Record<AvatarSize, {distance: VarName; size: VarName}>
|
|
640
|
-
}
|
|
641
641
|
font: {
|
|
642
642
|
code: FontVarNames<FontCodeSize>
|
|
643
643
|
heading: FontVarNames<FontHeadingSize>
|
|
@@ -57,7 +57,22 @@ function buildColorCard_v3(
|
|
|
57
57
|
},
|
|
58
58
|
): ThemeColorCard_v3 {
|
|
59
59
|
const {cardTone, scheme} = options
|
|
60
|
-
const context: RenderColorContext = {
|
|
60
|
+
const context: RenderColorContext = {
|
|
61
|
+
bgVar: `--color-bg`,
|
|
62
|
+
bgValue: 'transparent',
|
|
63
|
+
hue: tokens._hue,
|
|
64
|
+
scheme,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const tintedDefaultVariant = buildColorElement_v3(tokens.variant.tinted.default, {
|
|
68
|
+
bgValue: 'transparent',
|
|
69
|
+
cardTone,
|
|
70
|
+
debugId: 'tinted',
|
|
71
|
+
scheme,
|
|
72
|
+
tone: 'default',
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const bgValue = tintedDefaultVariant.bg[0]
|
|
61
76
|
|
|
62
77
|
return {
|
|
63
78
|
_hue: tokens._hue ?? 'gray',
|
|
@@ -65,8 +80,18 @@ function buildColorCard_v3(
|
|
|
65
80
|
const avatarTokens = tokens.avatar[hue]
|
|
66
81
|
|
|
67
82
|
acc[hue] = {
|
|
68
|
-
bg: renderColor(avatarTokens.bg, {
|
|
69
|
-
|
|
83
|
+
bg: renderColor(avatarTokens.bg, {
|
|
84
|
+
bgValue,
|
|
85
|
+
bgVar: `--color-bg-1`,
|
|
86
|
+
hue: avatarTokens._hue,
|
|
87
|
+
scheme,
|
|
88
|
+
}),
|
|
89
|
+
fg: renderColor(avatarTokens.fg, {
|
|
90
|
+
bgValue,
|
|
91
|
+
bgVar: `--color-bg-1`,
|
|
92
|
+
hue: avatarTokens._hue,
|
|
93
|
+
scheme,
|
|
94
|
+
}),
|
|
70
95
|
}
|
|
71
96
|
|
|
72
97
|
return acc
|
|
@@ -128,32 +153,34 @@ function buildColorCard_v3(
|
|
|
128
153
|
|
|
129
154
|
variant: {
|
|
130
155
|
solid: {
|
|
131
|
-
...THEME_COLOR_STATE_TONES.reduce(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
),
|
|
156
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
157
|
+
acc[tone] = buildColorElement_v3(tokens.variant.solid[tone], {
|
|
158
|
+
bgValue,
|
|
159
|
+
cardTone,
|
|
160
|
+
debugId: `solid`,
|
|
161
|
+
scheme,
|
|
162
|
+
tone,
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
return acc
|
|
166
|
+
}, {} as ThemeColorVariant),
|
|
143
167
|
},
|
|
144
168
|
tinted: {
|
|
145
|
-
...THEME_COLOR_STATE_TONES.reduce(
|
|
146
|
-
(
|
|
147
|
-
|
|
148
|
-
|
|
169
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => {
|
|
170
|
+
if (tone === 'default') {
|
|
171
|
+
acc[tone] = tintedDefaultVariant
|
|
172
|
+
} else {
|
|
173
|
+
acc[tone] = buildColorElement_v3(tokens.variant.tinted[tone], {
|
|
174
|
+
bgValue,
|
|
149
175
|
cardTone,
|
|
150
176
|
debugId: `tinted`,
|
|
151
177
|
scheme,
|
|
152
178
|
tone,
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return acc
|
|
183
|
+
}, {} as ThemeColorVariant),
|
|
157
184
|
},
|
|
158
185
|
},
|
|
159
186
|
}
|
|
@@ -162,13 +189,14 @@ function buildColorCard_v3(
|
|
|
162
189
|
function buildColorElement_v3(
|
|
163
190
|
tokens: ElementColorTokens,
|
|
164
191
|
options: {
|
|
192
|
+
bgValue: string
|
|
165
193
|
cardTone: ThemeColorCardToneKey
|
|
166
194
|
debugId?: string
|
|
167
195
|
scheme: ThemeColorSchemeKey
|
|
168
196
|
tone?: ThemeColorStateToneKey
|
|
169
197
|
},
|
|
170
198
|
): ThemeColorElement {
|
|
171
|
-
const {cardTone, debugId, scheme, tone} = options
|
|
199
|
+
const {bgValue, cardTone, debugId, scheme, tone} = options
|
|
172
200
|
|
|
173
201
|
const path = [scheme, cardTone, debugId, tone].filter(Boolean).join('/')
|
|
174
202
|
|
|
@@ -178,7 +206,7 @@ function buildColorElement_v3(
|
|
|
178
206
|
nodeLen += 1
|
|
179
207
|
}
|
|
180
208
|
|
|
181
|
-
const context: RenderColorContext = {bgVar: `--bg`, hue: tokens._hue, scheme}
|
|
209
|
+
const context: RenderColorContext = {bgValue, bgVar: `--color-bg`, hue: tokens._hue, scheme}
|
|
182
210
|
|
|
183
211
|
return {
|
|
184
212
|
_hue: tokens._hue ?? 'gray',
|
|
@@ -77,45 +77,3 @@ export interface CardColorTokens {
|
|
|
77
77
|
tinted: Record<'*' | ThemeColorStateToneKey, ElementColorTokens>
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
// /**
|
|
82
|
-
// * @public
|
|
83
|
-
// */
|
|
84
|
-
// export interface ThemeColorSyntax {
|
|
85
|
-
// atrule: string
|
|
86
|
-
// attrName: string
|
|
87
|
-
// attrValue: string
|
|
88
|
-
// attribute: string
|
|
89
|
-
// boolean: string
|
|
90
|
-
// builtin: string
|
|
91
|
-
// cdata: string
|
|
92
|
-
// char: string
|
|
93
|
-
// class: string
|
|
94
|
-
// className: string
|
|
95
|
-
// comment: string
|
|
96
|
-
// constant: string
|
|
97
|
-
// deleted: string
|
|
98
|
-
// doctype: string
|
|
99
|
-
// entity: string
|
|
100
|
-
// function: string
|
|
101
|
-
// hexcode: string
|
|
102
|
-
// id: string
|
|
103
|
-
// important: string
|
|
104
|
-
// inserted: string
|
|
105
|
-
// keyword: string
|
|
106
|
-
// number: string
|
|
107
|
-
// operator: string
|
|
108
|
-
// prolog: string
|
|
109
|
-
// property: string
|
|
110
|
-
// pseudoClass: string
|
|
111
|
-
// pseudoElement: string
|
|
112
|
-
// punctuation: string
|
|
113
|
-
// regex: string
|
|
114
|
-
// selector: string
|
|
115
|
-
// string: string
|
|
116
|
-
// symbol: string
|
|
117
|
-
// tag: string
|
|
118
|
-
// unit: string
|
|
119
|
-
// url: string
|
|
120
|
-
// variable: string
|
|
121
|
-
// }
|
|
@@ -9,15 +9,22 @@ export type CSSVariableKey = `--${string}`
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface RenderColorContext {
|
|
11
11
|
bgVar: CSSVariableKey
|
|
12
|
+
bgValue: string
|
|
12
13
|
hue: Hue
|
|
13
14
|
scheme: ThemeColorSchemeKey
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
/** @public */
|
|
17
18
|
export function renderColor(token: [ColorToken, ColorToken], context: RenderColorContext): string {
|
|
18
|
-
const {bgVar, hue, scheme} = context
|
|
19
|
+
const {bgValue, bgVar, hue, scheme} = context
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
+
const t = token[scheme === 'dark' ? 0 : 1]
|
|
22
|
+
|
|
23
|
+
if (t === 'inherit') {
|
|
24
|
+
return bgValue
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const result = parseColor(t)
|
|
21
28
|
|
|
22
29
|
const colorVar =
|
|
23
30
|
result.color.type === 'hue'
|
|
@@ -74,18 +74,23 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
74
74
|
},
|
|
75
75
|
'primary': {
|
|
76
76
|
_hue: 'blue',
|
|
77
|
+
bg: {0: ['inherit', 'inherit']},
|
|
77
78
|
},
|
|
78
79
|
'suggest': {
|
|
79
80
|
_hue: 'purple',
|
|
81
|
+
bg: {0: ['inherit', 'inherit']},
|
|
80
82
|
},
|
|
81
83
|
'positive': {
|
|
82
84
|
_hue: 'green',
|
|
85
|
+
bg: {0: ['inherit', 'inherit']},
|
|
83
86
|
},
|
|
84
87
|
'caution': {
|
|
85
88
|
_hue: 'yellow',
|
|
89
|
+
bg: {0: ['inherit', 'inherit']},
|
|
86
90
|
},
|
|
87
91
|
'critical': {
|
|
88
92
|
_hue: 'red',
|
|
93
|
+
bg: {0: ['inherit', 'inherit']},
|
|
89
94
|
},
|
|
90
95
|
},
|
|
91
96
|
solid: {
|
|
@@ -100,7 +105,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
100
105
|
},
|
|
101
106
|
fg: {
|
|
102
107
|
0: ['black', 'white'],
|
|
103
|
-
4: ['
|
|
108
|
+
4: ['700', '200'],
|
|
104
109
|
},
|
|
105
110
|
},
|
|
106
111
|
'default': {
|
|
@@ -161,7 +166,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
161
166
|
},
|
|
162
167
|
border: {
|
|
163
168
|
0: ['800', '100'],
|
|
164
|
-
4: ['600', '
|
|
169
|
+
4: ['600', '400'],
|
|
165
170
|
},
|
|
166
171
|
fg: {
|
|
167
172
|
0: ['white', 'black'],
|