@sanity/ui 3.0.0-static.10 → 3.0.0-static.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/_chunks-cjs/_visual-editing.js +160 -207
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +161 -208
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +1 -3
- package/dist/_visual-editing.d.ts +1 -3
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +115 -2
- package/dist/css.d.ts +115 -2
- package/dist/css.js +539 -402
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +541 -404
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +50 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -12
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +418 -182
- package/dist/theme.js +10 -11
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +10 -11
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/_resp.ts +0 -1
- package/src/css/aspects/font/font.style.ts +7 -66
- package/src/css/aspects/shadow/shadow.style.ts +16 -41
- package/src/css/compile/compilePalette.ts +4 -3
- package/src/css/compile/compileSystem.ts +0 -3
- package/src/css/compile/compileTheme_v3.ts +233 -219
- package/src/css/components/skeleton/skeleton.style.ts +8 -4
- package/src/css/constants.ts +9 -0
- package/src/css/index.ts +1 -0
- package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
- package/src/css/primitives/_arrow/_arrow.ts +4 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +23 -23
- package/src/css/primitives/button/button.style.ts +48 -15
- package/src/css/primitives/card/card.style.ts +1 -1
- package/src/css/primitives/token/token.style.ts +37 -36
- package/src/css/responsiveRules.ts +12 -19
- package/src/css/types.ts +106 -3
- package/src/css/varNames.ts +101 -4
- package/src/css/vars.ts +52 -16
- package/src/theme/v3/buildTheme_v3.ts +1 -1
- package/src/theme/v3/{defaults.ts → defaultTokens.ts} +1 -2
- package/src/theme/v3/index.ts +1 -1
- package/src/theme/v3/resolveTokens.ts +9 -9
- package/src/ui/RootClassNames.tsx +41 -0
- package/src/ui/_compat/helpers.ts +72 -0
- package/src/ui/_compat/index.ts +2 -6
- package/src/ui/_compat/studioTheme.ts +7 -0
- package/src/ui/_compat/types.ts +0 -83
- package/src/ui/index.ts +1 -0
- package/src/ui/primitives/button/button.tsx +5 -6
- package/src/ui/primitives/popover/popover.tsx +25 -7
- package/src/ui/primitives/popover/popoverCard.tsx +46 -45
- package/src/ui/primitives/tooltip/tooltip.tsx +9 -2
- package/src/ui/primitives/tooltip/tooltipCard.tsx +1 -1
- package/src/ui/utils/arrow/arrow.tsx +3 -11
- package/src/ui/utils/elementQuery/elementQuery.tsx +10 -8
- package/src/ui/utils/virtualList/virtualList.tsx +37 -32
- package/src/css/components/breadcrumbs/rules.ts +0 -25
- package/src/css/components/dialog/rules.ts +0 -78
- package/src/css/components/skeleton/rules.ts +0 -113
- package/src/css/components/toast/rules.ts +0 -18
- package/src/css/components/tree/rules.ts +0 -168
- package/src/css/primitives/popover/rules.ts +0 -5
- package/src/css/primitives/spinner/rules.ts +0 -21
- package/src/css/primitives/token/rules.ts +0 -45
|
@@ -15,8 +15,12 @@ import {
|
|
|
15
15
|
|
|
16
16
|
import {Properties} from '../types'
|
|
17
17
|
import {px, rem, toBoxShadow} from '../util'
|
|
18
|
+
import {varNames} from '../varNames'
|
|
18
19
|
import {compileRule} from './compileRule'
|
|
19
20
|
|
|
21
|
+
const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
22
|
+
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
23
|
+
|
|
20
24
|
export function compileTheme_v3(theme: Theme_v3): string {
|
|
21
25
|
return compileRule(':root', compileThemeProperties(theme), {keyframes: {}, media: {}})
|
|
22
26
|
}
|
|
@@ -25,6 +29,7 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
25
29
|
return {
|
|
26
30
|
...buildAvatarThemeProperties(theme),
|
|
27
31
|
...buildButtonThemeProperties(theme),
|
|
32
|
+
[varNames.card.shadow.outline]: px(theme.card.shadow.outline),
|
|
28
33
|
...buildContainerThemeProperties(theme),
|
|
29
34
|
...buildFontCodeThemeProperties(theme),
|
|
30
35
|
...buildFontHeadingThemeProperties(theme),
|
|
@@ -40,58 +45,62 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
40
45
|
|
|
41
46
|
function buildAvatarThemeProperties(theme: Theme_v3): Properties {
|
|
42
47
|
return {
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
|
|
52
|
-
[
|
|
48
|
+
[varNames.avatar.focusRing.offset]: px(theme.avatar.focusRing.offset),
|
|
49
|
+
[varNames.avatar.focusRing.width]: px(theme.avatar.focusRing.width),
|
|
50
|
+
|
|
51
|
+
[varNames.avatar.sizes[0].distance]: px(theme.avatar.sizes[0].distance),
|
|
52
|
+
[varNames.avatar.sizes[0].size]: px(theme.avatar.sizes[0].size),
|
|
53
|
+
|
|
54
|
+
[varNames.avatar.sizes[1].distance]: px(theme.avatar.sizes[1].distance),
|
|
55
|
+
[varNames.avatar.sizes[1].size]: px(theme.avatar.sizes[1].size),
|
|
56
|
+
|
|
57
|
+
[varNames.avatar.sizes[2].distance]: px(theme.avatar.sizes[2].distance),
|
|
58
|
+
[varNames.avatar.sizes[2].size]: px(theme.avatar.sizes[2].size),
|
|
59
|
+
|
|
60
|
+
[varNames.avatar.sizes[3].distance]: px(theme.avatar.sizes[3].distance),
|
|
61
|
+
[varNames.avatar.sizes[3].size]: px(theme.avatar.sizes[3].size),
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
function buildButtonThemeProperties(theme: Theme_v3): Properties {
|
|
57
66
|
return {
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
// [`--button-text-weight`]: theme.button.textWeight,
|
|
67
|
+
[varNames.button.border.width]: px(theme.button.border.width),
|
|
68
|
+
[varNames.button.focusRing.offset]: px(theme.button.focusRing.offset),
|
|
69
|
+
[varNames.button.focusRing.width]: px(theme.button.focusRing.width),
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
function buildContainerThemeProperties(theme: Theme_v3): Properties {
|
|
66
74
|
return {
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
75
|
+
[varNames.container[0]]: px(theme.container[0]),
|
|
76
|
+
[varNames.container[1]]: px(theme.container[1]),
|
|
77
|
+
[varNames.container[2]]: px(theme.container[2]),
|
|
78
|
+
[varNames.container[3]]: px(theme.container[3]),
|
|
79
|
+
[varNames.container[4]]: px(theme.container[4]),
|
|
80
|
+
[varNames.container[5]]: px(theme.container[5]),
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
|
|
77
85
|
const props: Properties = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
[varNames.font.code.family]: theme.font.code.family,
|
|
87
|
+
[varNames.font.code.featureSettings]: theme.font.code.featureSettings,
|
|
88
|
+
[varNames.font.code.weights.regular]: `${theme.font.code.weights.regular}`,
|
|
89
|
+
[varNames.font.code.weights.medium]: `${theme.font.code.weights.medium}`,
|
|
90
|
+
[varNames.font.code.weights.semibold]: `${theme.font.code.weights.semibold}`,
|
|
91
|
+
[varNames.font.code.weights.bold]: `${theme.font.code.weights.bold}`,
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
for (const size of FONT_CODE_SIZE) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
props[
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
props[
|
|
94
|
-
props[
|
|
95
|
+
const v = varNames.font.code.sizes[size]
|
|
96
|
+
const t = theme.font.code.sizes[size]
|
|
97
|
+
|
|
98
|
+
props[v.fontSize] = rem(t.fontSize)
|
|
99
|
+
props[v.lineHeight] = rem(t.lineHeight)
|
|
100
|
+
props[v.ascenderHeight] = px(t.ascenderHeight)
|
|
101
|
+
props[v.descenderHeight] = px(t.descenderHeight)
|
|
102
|
+
props[v.letterSpacing] = px(t.letterSpacing)
|
|
103
|
+
props[v.iconSize] = px(t.iconSize)
|
|
95
104
|
}
|
|
96
105
|
|
|
97
106
|
return props
|
|
@@ -99,29 +108,24 @@ function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
|
|
|
99
108
|
|
|
100
109
|
function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
|
|
101
110
|
const props: Properties = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
[varNames.font.heading.family]: theme.font.heading.family,
|
|
112
|
+
[varNames.font.heading.featureSettings]: theme.font.heading.featureSettings,
|
|
113
|
+
[varNames.font.heading.weights.regular]: `${theme.font.heading.weights.regular}`,
|
|
114
|
+
[varNames.font.heading.weights.medium]: `${theme.font.heading.weights.medium}`,
|
|
115
|
+
[varNames.font.heading.weights.semibold]: `${theme.font.heading.weights.semibold}`,
|
|
116
|
+
[varNames.font.heading.weights.bold]: `${theme.font.heading.weights.bold}`,
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
for (const size of FONT_HEADING_SIZE) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
)
|
|
116
|
-
props[
|
|
117
|
-
|
|
118
|
-
)
|
|
119
|
-
props[
|
|
120
|
-
theme.font.heading.sizes[size].letterSpacing,
|
|
121
|
-
)
|
|
122
|
-
// props[`--font-heading-${size}-cap-height`] =
|
|
123
|
-
// `calc(var(--font-heading-${size}-line-height) - var(--font-heading-${size}-ascender-height) - var(--font-heading-${size}-descender-height))`
|
|
124
|
-
props[`--font-heading-${size}-icon-size`] = px(theme.font.heading.sizes[size].iconSize)
|
|
120
|
+
const v = varNames.font.heading.sizes[size]
|
|
121
|
+
const t = theme.font.heading.sizes[size]
|
|
122
|
+
|
|
123
|
+
props[v.fontSize] = rem(t.fontSize)
|
|
124
|
+
props[v.lineHeight] = rem(t.lineHeight)
|
|
125
|
+
props[v.ascenderHeight] = px(t.ascenderHeight)
|
|
126
|
+
props[v.descenderHeight] = px(t.descenderHeight)
|
|
127
|
+
props[v.letterSpacing] = px(t.letterSpacing)
|
|
128
|
+
props[v.iconSize] = px(t.iconSize)
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
return props
|
|
@@ -129,25 +133,24 @@ function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
|
|
|
129
133
|
|
|
130
134
|
function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
|
|
131
135
|
const props: Properties = {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
[varNames.font.label.family]: theme.font.label.family,
|
|
137
|
+
[varNames.font.label.featureSettings]: theme.font.label.featureSettings,
|
|
138
|
+
[varNames.font.label.weights.regular]: `${theme.font.label.weights.regular}`,
|
|
139
|
+
[varNames.font.label.weights.medium]: `${theme.font.label.weights.medium}`,
|
|
140
|
+
[varNames.font.label.weights.semibold]: `${theme.font.label.weights.semibold}`,
|
|
141
|
+
[varNames.font.label.weights.bold]: `${theme.font.label.weights.bold}`,
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
for (const size of FONT_LABEL_SIZE) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
props[
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
props[
|
|
150
|
-
props[`--font-label-${size}-icon-size`] = px(theme.font.label.sizes[size].iconSize)
|
|
145
|
+
const v = varNames.font.label.sizes[size]
|
|
146
|
+
const t = theme.font.label.sizes[size]
|
|
147
|
+
|
|
148
|
+
props[v.fontSize] = rem(t.fontSize)
|
|
149
|
+
props[v.lineHeight] = rem(t.lineHeight)
|
|
150
|
+
props[v.ascenderHeight] = px(t.ascenderHeight)
|
|
151
|
+
props[v.descenderHeight] = px(t.descenderHeight)
|
|
152
|
+
props[v.letterSpacing] = px(t.letterSpacing)
|
|
153
|
+
props[v.iconSize] = px(t.iconSize)
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
return props
|
|
@@ -155,23 +158,24 @@ function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
|
|
|
155
158
|
|
|
156
159
|
function buildFontTextThemeProperties(theme: Theme_v3): Properties {
|
|
157
160
|
const props: Properties = {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
[varNames.font.text.family]: theme.font.text.family,
|
|
162
|
+
[varNames.font.text.featureSettings]: theme.font.text.featureSettings,
|
|
163
|
+
[varNames.font.text.weights.regular]: `${theme.font.text.weights.regular}`,
|
|
164
|
+
[varNames.font.text.weights.medium]: `${theme.font.text.weights.medium}`,
|
|
165
|
+
[varNames.font.text.weights.semibold]: `${theme.font.text.weights.semibold}`,
|
|
166
|
+
[varNames.font.text.weights.bold]: `${theme.font.text.weights.bold}`,
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
for (const size of FONT_TEXT_SIZE) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
props[
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
props[
|
|
174
|
-
props[
|
|
170
|
+
const v = varNames.font.text.sizes[size]
|
|
171
|
+
const t = theme.font.text.sizes[size]
|
|
172
|
+
|
|
173
|
+
props[v.fontSize] = rem(t.fontSize)
|
|
174
|
+
props[v.lineHeight] = rem(t.lineHeight)
|
|
175
|
+
props[v.ascenderHeight] = px(t.ascenderHeight)
|
|
176
|
+
props[v.descenderHeight] = px(t.descenderHeight)
|
|
177
|
+
props[v.letterSpacing] = px(t.letterSpacing)
|
|
178
|
+
props[v.iconSize] = px(t.iconSize)
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
return props
|
|
@@ -179,83 +183,84 @@ function buildFontTextThemeProperties(theme: Theme_v3): Properties {
|
|
|
179
183
|
|
|
180
184
|
function buildInputThemeProperties(theme: Theme_v3): Properties {
|
|
181
185
|
return {
|
|
182
|
-
[
|
|
183
|
-
[
|
|
184
|
-
[
|
|
185
|
-
[
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
192
|
-
[
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
[
|
|
196
|
-
[
|
|
197
|
-
[
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
186
|
+
[varNames.input.border.width]: px(theme.input.border.width),
|
|
187
|
+
[varNames.input.checkbox.focusRing.offset]: px(theme.input.checkbox.focusRing.offset),
|
|
188
|
+
[varNames.input.checkbox.focusRing.width]: px(theme.input.checkbox.focusRing.width),
|
|
189
|
+
[varNames.input.checkbox.size]: px(theme.input.checkbox.size),
|
|
190
|
+
[varNames.input.radio.focusRing.offset]: px(theme.input.radio.focusRing.offset),
|
|
191
|
+
[varNames.input.radio.focusRing.width]: px(theme.input.radio.focusRing.width),
|
|
192
|
+
[varNames.input.radio.markSize]: px(theme.input.radio.markSize),
|
|
193
|
+
[varNames.input.radio.size]: px(theme.input.radio.size),
|
|
194
|
+
[varNames.input.select.focusRing.offset]: px(theme.input.select.focusRing.offset),
|
|
195
|
+
[varNames.input.select.focusRing.width]: px(theme.input.select.focusRing.width),
|
|
196
|
+
[varNames.input.switch.focusRing.offset]: px(theme.input.switch.focusRing.offset),
|
|
197
|
+
[varNames.input.switch.focusRing.width]: px(theme.input.switch.focusRing.width),
|
|
198
|
+
[varNames.input.switch.height]: px(theme.input.switch.height),
|
|
199
|
+
[varNames.input.switch.padding]: px(theme.input.switch.padding),
|
|
200
|
+
[varNames.input.switch.transitionDurationMs]: `${theme.input.switch.transitionDurationMs}ms`,
|
|
201
|
+
[varNames.input.switch.transitionTimingFunction]: theme.input.switch.transitionTimingFunction,
|
|
202
|
+
[varNames.input.switch.width]: px(theme.input.switch.width),
|
|
203
|
+
[varNames.input.text.focusRing.offset]: px(theme.input.text.focusRing.offset),
|
|
204
|
+
[varNames.input.text.focusRing.width]: px(theme.input.text.focusRing.width),
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
function buildRadiusThemeProperties(theme: Theme_v3): Properties {
|
|
205
209
|
return {
|
|
206
|
-
[
|
|
207
|
-
[
|
|
208
|
-
[
|
|
209
|
-
[
|
|
210
|
-
[
|
|
211
|
-
[
|
|
212
|
-
[
|
|
210
|
+
[varNames.radius[0]]: rem(theme.radius[0]),
|
|
211
|
+
[varNames.radius[1]]: rem(theme.radius[1]),
|
|
212
|
+
[varNames.radius[2]]: rem(theme.radius[2]),
|
|
213
|
+
[varNames.radius[3]]: rem(theme.radius[3]),
|
|
214
|
+
[varNames.radius[4]]: rem(theme.radius[4]),
|
|
215
|
+
[varNames.radius[5]]: rem(theme.radius[5]),
|
|
216
|
+
[varNames.radius[6]]: rem(theme.radius[6]),
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
|
|
216
220
|
function buildShadowThemeProperties(theme: Theme_v3): Properties {
|
|
217
221
|
return {
|
|
218
|
-
[
|
|
219
|
-
[
|
|
220
|
-
[
|
|
221
|
-
|
|
222
|
-
[
|
|
223
|
-
[
|
|
224
|
-
[
|
|
225
|
-
|
|
226
|
-
[
|
|
227
|
-
[
|
|
228
|
-
[
|
|
229
|
-
|
|
230
|
-
[
|
|
231
|
-
[
|
|
232
|
-
[
|
|
233
|
-
|
|
234
|
-
[
|
|
235
|
-
[
|
|
236
|
-
[
|
|
222
|
+
[varNames.shadow[0].umbra]: toBoxShadow(theme.shadow[0]?.umbra),
|
|
223
|
+
[varNames.shadow[0].penumbra]: toBoxShadow(theme.shadow[0]?.penumbra),
|
|
224
|
+
[varNames.shadow[0].ambient]: toBoxShadow(theme.shadow[0]?.ambient),
|
|
225
|
+
|
|
226
|
+
[varNames.shadow[1].umbra]: toBoxShadow(theme.shadow[1]?.umbra),
|
|
227
|
+
[varNames.shadow[1].penumbra]: toBoxShadow(theme.shadow[1]?.penumbra),
|
|
228
|
+
[varNames.shadow[1].ambient]: toBoxShadow(theme.shadow[1]?.ambient),
|
|
229
|
+
|
|
230
|
+
[varNames.shadow[2].umbra]: toBoxShadow(theme.shadow[2]?.umbra),
|
|
231
|
+
[varNames.shadow[2].penumbra]: toBoxShadow(theme.shadow[2]?.penumbra),
|
|
232
|
+
[varNames.shadow[2].ambient]: toBoxShadow(theme.shadow[2]?.ambient),
|
|
233
|
+
|
|
234
|
+
[varNames.shadow[3].umbra]: toBoxShadow(theme.shadow[3]?.umbra),
|
|
235
|
+
[varNames.shadow[3].penumbra]: toBoxShadow(theme.shadow[3]?.penumbra),
|
|
236
|
+
[varNames.shadow[3].ambient]: toBoxShadow(theme.shadow[3]?.ambient),
|
|
237
|
+
|
|
238
|
+
[varNames.shadow[4].umbra]: toBoxShadow(theme.shadow[4]?.umbra),
|
|
239
|
+
[varNames.shadow[4].penumbra]: toBoxShadow(theme.shadow[4]?.penumbra),
|
|
240
|
+
[varNames.shadow[4].ambient]: toBoxShadow(theme.shadow[4]?.ambient),
|
|
241
|
+
|
|
242
|
+
[varNames.shadow[5].umbra]: toBoxShadow(theme.shadow[5]?.umbra),
|
|
243
|
+
[varNames.shadow[5].penumbra]: toBoxShadow(theme.shadow[5]?.penumbra),
|
|
244
|
+
[varNames.shadow[5].ambient]: toBoxShadow(theme.shadow[5]?.ambient),
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
|
|
240
248
|
function buildSpaceThemeProperties(theme: Theme_v3): Properties {
|
|
241
249
|
return {
|
|
242
|
-
[
|
|
243
|
-
[
|
|
244
|
-
[
|
|
245
|
-
[
|
|
246
|
-
[
|
|
247
|
-
[
|
|
248
|
-
[
|
|
249
|
-
[
|
|
250
|
-
[
|
|
251
|
-
[
|
|
252
|
-
[
|
|
250
|
+
[varNames.space[0]]: rem(theme.space[0]),
|
|
251
|
+
[varNames.space[0.5]]: rem(theme.space[1] / 2),
|
|
252
|
+
[varNames.space[1]]: rem(theme.space[1]),
|
|
253
|
+
[varNames.space[2]]: rem(theme.space[2]),
|
|
254
|
+
[varNames.space[3]]: rem(theme.space[3]),
|
|
255
|
+
[varNames.space[4]]: rem(theme.space[4]),
|
|
256
|
+
[varNames.space[5]]: rem(theme.space[5]),
|
|
257
|
+
[varNames.space[6]]: rem(theme.space[6]),
|
|
258
|
+
[varNames.space[7]]: rem(theme.space[7]),
|
|
259
|
+
[varNames.space[8]]: rem(theme.space[8]),
|
|
260
|
+
[varNames.space[9]]: rem(theme.space[9]),
|
|
253
261
|
}
|
|
254
262
|
}
|
|
255
263
|
|
|
256
|
-
const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
257
|
-
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
258
|
-
|
|
259
264
|
function buildColorThemeProperties(theme: Theme_v3): Properties {
|
|
260
265
|
const props: Properties = {}
|
|
261
266
|
|
|
@@ -264,36 +269,38 @@ function buildColorThemeProperties(theme: Theme_v3): Properties {
|
|
|
264
269
|
Object.assign(props, buildColorAvatarThemeProperties(theme, {scheme, cardTone}))
|
|
265
270
|
Object.assign(props, buildColorCardThemeProperties(theme, {scheme, cardTone}))
|
|
266
271
|
|
|
267
|
-
// card variants: tinted, solid
|
|
268
272
|
for (const colorVariant of THEME_COLOR_VARIANTS) {
|
|
269
273
|
for (const elementTone of THEME_COLOR_STATE_TONES) {
|
|
270
|
-
|
|
271
|
-
const
|
|
274
|
+
// shorthand to variable names
|
|
275
|
+
const v = varNames.color[scheme][cardTone][colorVariant][elementTone]
|
|
276
|
+
|
|
277
|
+
// shorthand to values
|
|
278
|
+
const t = theme._tokens.color[cardTone].variant[colorVariant][elementTone]
|
|
272
279
|
|
|
273
280
|
const context: RenderColorContext = {
|
|
274
|
-
bgVar:
|
|
275
|
-
hue:
|
|
281
|
+
bgVar: v.bg[0],
|
|
282
|
+
hue: t._hue,
|
|
276
283
|
scheme,
|
|
277
284
|
}
|
|
278
285
|
|
|
279
286
|
Object.assign(props, {
|
|
280
|
-
[
|
|
281
|
-
[
|
|
282
|
-
[
|
|
283
|
-
[
|
|
284
|
-
[
|
|
285
|
-
|
|
286
|
-
[
|
|
287
|
-
[
|
|
288
|
-
[
|
|
289
|
-
[
|
|
290
|
-
[
|
|
291
|
-
|
|
292
|
-
[
|
|
293
|
-
[
|
|
294
|
-
[
|
|
295
|
-
[
|
|
296
|
-
[
|
|
287
|
+
[v.bg[0]]: renderColor(t.bg[0], context),
|
|
288
|
+
[v.bg[1]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 25%)`,
|
|
289
|
+
[v.bg[2]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 50%)`,
|
|
290
|
+
[v.bg[3]]: `color-mix(in srgb, var(${v.bg[0]}), var(${v.bg[4]}) 75%)`,
|
|
291
|
+
[v.bg[4]]: renderColor(t.bg[4], context),
|
|
292
|
+
|
|
293
|
+
[v.border[0]]: renderColor(t.border[0], context),
|
|
294
|
+
[v.border[1]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 25%)`,
|
|
295
|
+
[v.border[2]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 50%)`,
|
|
296
|
+
[v.border[3]]: `color-mix(in srgb, var(${v.border[0]}), var(${v.border[4]}) 75%)`,
|
|
297
|
+
[v.border[4]]: renderColor(t.border[4], context),
|
|
298
|
+
|
|
299
|
+
[v.fg[0]]: renderColor(t.fg[0], context),
|
|
300
|
+
[v.fg[1]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 25%)`,
|
|
301
|
+
[v.fg[2]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 50%)`,
|
|
302
|
+
[v.fg[3]]: `color-mix(in srgb, var(${v.fg[0]}), var(${v.fg[4]}) 75%)`,
|
|
303
|
+
[v.fg[4]]: renderColor(t.fg[4], context),
|
|
297
304
|
} satisfies Properties)
|
|
298
305
|
}
|
|
299
306
|
}
|
|
@@ -308,21 +315,22 @@ function buildColorAvatarThemeProperties(
|
|
|
308
315
|
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
309
316
|
): Properties {
|
|
310
317
|
const {scheme, cardTone} = options
|
|
311
|
-
|
|
312
|
-
const
|
|
318
|
+
|
|
319
|
+
const v = varNames.color[scheme][cardTone]
|
|
320
|
+
const t = theme._tokens.color[cardTone]
|
|
313
321
|
|
|
314
322
|
const props: Properties = {}
|
|
315
323
|
|
|
316
324
|
for (const hue of HUES) {
|
|
317
325
|
const context: RenderColorContext = {
|
|
318
|
-
bgVar:
|
|
319
|
-
hue:
|
|
326
|
+
bgVar: varNames.color.bg,
|
|
327
|
+
hue: t.avatar[hue]._hue ?? hue,
|
|
320
328
|
scheme,
|
|
321
329
|
}
|
|
322
330
|
|
|
323
331
|
Object.assign(props, {
|
|
324
|
-
[
|
|
325
|
-
[
|
|
332
|
+
[v.avatar[hue].bg]: renderColor(t.avatar[hue].bg, context),
|
|
333
|
+
[v.avatar[hue].fg]: renderColor(t.avatar[hue].fg, context),
|
|
326
334
|
} satisfies Properties)
|
|
327
335
|
}
|
|
328
336
|
|
|
@@ -334,67 +342,73 @@ function buildColorCardThemeProperties(
|
|
|
334
342
|
options: {scheme: ThemeColorSchemeKey; cardTone: ThemeColorCardToneKey},
|
|
335
343
|
): Properties {
|
|
336
344
|
const {scheme, cardTone} = options
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
const
|
|
345
|
+
|
|
346
|
+
const v = varNames.color[scheme][cardTone]
|
|
347
|
+
const t = theme._tokens.color[cardTone]
|
|
348
|
+
|
|
349
|
+
const context: RenderColorContext = {
|
|
350
|
+
bgVar: varNames.color.bg,
|
|
351
|
+
hue: t._hue,
|
|
352
|
+
scheme,
|
|
353
|
+
}
|
|
340
354
|
|
|
341
355
|
const props: Properties = {
|
|
342
356
|
// backdrop
|
|
343
|
-
[
|
|
357
|
+
[v.backdrop]: renderColor(t.backdrop, context),
|
|
344
358
|
|
|
345
359
|
// code
|
|
346
|
-
[
|
|
347
|
-
[
|
|
360
|
+
[v.code.bg]: renderColor(t.code.bg, context),
|
|
361
|
+
[v.code.fg]: renderColor(t.code.fg, context),
|
|
348
362
|
|
|
349
363
|
// code / token
|
|
350
|
-
[
|
|
351
|
-
[
|
|
352
|
-
[
|
|
353
|
-
[
|
|
354
|
-
[
|
|
355
|
-
[
|
|
356
|
-
[
|
|
357
|
-
[
|
|
358
|
-
[
|
|
359
|
-
[
|
|
360
|
-
[
|
|
361
|
-
[
|
|
362
|
-
[
|
|
363
|
-
[
|
|
364
|
-
[
|
|
365
|
-
[
|
|
366
|
-
[
|
|
367
|
-
[
|
|
368
|
-
[
|
|
369
|
-
[
|
|
370
|
-
[
|
|
371
|
-
[
|
|
372
|
-
[
|
|
373
|
-
[
|
|
374
|
-
[
|
|
375
|
-
[
|
|
376
|
-
[
|
|
377
|
-
[
|
|
378
|
-
[
|
|
379
|
-
[
|
|
380
|
-
[
|
|
381
|
-
[
|
|
382
|
-
[
|
|
383
|
-
[
|
|
384
|
-
[
|
|
385
|
-
[
|
|
364
|
+
[v.code.token.atrule]: renderColor(t.code.token.atrule, context),
|
|
365
|
+
[v.code.token.attrName]: renderColor(t.code.token.attrName, context),
|
|
366
|
+
[v.code.token.attrValue]: renderColor(t.code.token.attrValue, context),
|
|
367
|
+
[v.code.token.attribute]: renderColor(t.code.token.attribute, context),
|
|
368
|
+
[v.code.token.boolean]: renderColor(t.code.token.boolean, context),
|
|
369
|
+
[v.code.token.builtin]: renderColor(t.code.token.builtin, context),
|
|
370
|
+
[v.code.token.cdata]: renderColor(t.code.token.cdata, context),
|
|
371
|
+
[v.code.token.char]: renderColor(t.code.token.char, context),
|
|
372
|
+
[v.code.token.className]: renderColor(t.code.token.className, context),
|
|
373
|
+
[v.code.token.class]: renderColor(t.code.token.class, context),
|
|
374
|
+
[v.code.token.comment]: renderColor(t.code.token.comment, context),
|
|
375
|
+
[v.code.token.constant]: renderColor(t.code.token.constant, context),
|
|
376
|
+
[v.code.token.deleted]: renderColor(t.code.token.deleted, context),
|
|
377
|
+
[v.code.token.doctype]: renderColor(t.code.token.doctype, context),
|
|
378
|
+
[v.code.token.entity]: renderColor(t.code.token.entity, context),
|
|
379
|
+
[v.code.token.function]: renderColor(t.code.token.function, context),
|
|
380
|
+
[v.code.token.hexcode]: renderColor(t.code.token.hexcode, context),
|
|
381
|
+
[v.code.token.id]: renderColor(t.code.token.id, context),
|
|
382
|
+
[v.code.token.important]: renderColor(t.code.token.important, context),
|
|
383
|
+
[v.code.token.inserted]: renderColor(t.code.token.inserted, context),
|
|
384
|
+
[v.code.token.keyword]: renderColor(t.code.token.keyword, context),
|
|
385
|
+
[v.code.token.number]: renderColor(t.code.token.number, context),
|
|
386
|
+
[v.code.token.operator]: renderColor(t.code.token.operator, context),
|
|
387
|
+
[v.code.token.prolog]: renderColor(t.code.token.prolog, context),
|
|
388
|
+
[v.code.token.property]: renderColor(t.code.token.property, context),
|
|
389
|
+
[v.code.token.pseudoClass]: renderColor(t.code.token.pseudoClass, context),
|
|
390
|
+
[v.code.token.pseudoElement]: renderColor(t.code.token.pseudoElement, context),
|
|
391
|
+
[v.code.token.punctuation]: renderColor(t.code.token.punctuation, context),
|
|
392
|
+
[v.code.token.regex]: renderColor(t.code.token.regex, context),
|
|
393
|
+
[v.code.token.selector]: renderColor(t.code.token.selector, context),
|
|
394
|
+
[v.code.token.string]: renderColor(t.code.token.string, context),
|
|
395
|
+
[v.code.token.symbol]: renderColor(t.code.token.symbol, context),
|
|
396
|
+
[v.code.token.tag]: renderColor(t.code.token.tag, context),
|
|
397
|
+
[v.code.token.unit]: renderColor(t.code.token.unit, context),
|
|
398
|
+
[v.code.token.url]: renderColor(t.code.token.url, context),
|
|
399
|
+
[v.code.token.variable]: renderColor(t.code.token.variable, context),
|
|
386
400
|
|
|
387
401
|
// focus ring
|
|
388
|
-
[
|
|
402
|
+
[v.focusRing]: renderColor(t.focusRing, context),
|
|
389
403
|
|
|
390
404
|
// link
|
|
391
|
-
[
|
|
405
|
+
[v.link.fg]: renderColor(t.link.fg, context),
|
|
392
406
|
|
|
393
407
|
// shadow
|
|
394
|
-
[
|
|
395
|
-
[
|
|
396
|
-
[
|
|
397
|
-
[
|
|
408
|
+
[v.shadow.outline]: renderColor(t.shadow.outline, context),
|
|
409
|
+
[v.shadow.umbra]: renderColor(t.shadow.umbra, context),
|
|
410
|
+
[v.shadow.penumbra]: renderColor(t.shadow.penumbra, context),
|
|
411
|
+
[v.shadow.ambient]: renderColor(t.shadow.ambient, context),
|
|
398
412
|
}
|
|
399
413
|
|
|
400
414
|
return props
|