@sanity/ui 3.0.0-static.10 → 3.0.0-static.12
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 +1300 -1269
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +28 -10
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1298 -1263
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +516 -360
- package/dist/_visual-editing.d.ts +516 -360
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +258 -75
- package/dist/css.d.ts +258 -75
- package/dist/css.js +746 -752
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +748 -754
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1342 -871
- package/dist/index.d.ts +1342 -871
- package/dist/index.js +433 -325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +429 -321
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +105 -1
- package/dist/sanity-palette.min.css +1 -0
- package/dist/sanity-theme.css +4571 -1
- package/dist/sanity-theme.min.css +1 -0
- package/dist/system.css +22053 -21710
- package/dist/system.min.css +1 -0
- package/dist/theme.d.mts +51 -106
- package/dist/theme.d.ts +51 -106
- package/dist/theme.js +19 -20
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +19 -20
- package/dist/theme.mjs.map +1 -1
- package/package.json +10 -5
- package/src/cli/buildCommand.ts +46 -19
- package/src/css/_comp.ts +2 -2
- package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
- package/src/css/_resp.ts +0 -1
- package/src/css/{system.style.ts → _system.style.ts} +3 -2
- package/src/css/aspects/display/display.ts +1 -0
- package/src/css/aspects/display/types.ts +2 -3
- package/src/css/aspects/flex/types.ts +4 -12
- package/src/css/aspects/flexItem/types.ts +1 -3
- package/src/css/aspects/font/font.style.ts +7 -66
- package/src/css/aspects/font/types.ts +1 -3
- package/src/css/aspects/grid/grid.ts +1 -0
- package/src/css/aspects/grid/types.ts +5 -9
- package/src/css/aspects/gridItem/gridItem.ts +1 -1
- package/src/css/aspects/gridItem/types.ts +7 -18
- package/src/css/aspects/height/height.ts +3 -4
- package/src/css/aspects/inset/inset.ts +1 -0
- package/src/css/aspects/margin/margin.ts +1 -0
- package/src/css/aspects/margin/types.ts +1 -0
- package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
- package/src/css/aspects/maxWidth/types.ts +1 -0
- package/src/css/aspects/minWidth/minWidth.ts +1 -0
- package/src/css/aspects/minWidth/types.ts +2 -0
- package/src/css/aspects/overflow/overflow.ts +1 -0
- package/src/css/aspects/padding/padding.ts +1 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
- package/src/css/aspects/position/position.ts +1 -0
- package/src/css/aspects/shadow/shadow.style.ts +16 -41
- package/src/css/aspects/shadow/shadow.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
- package/src/css/aspects/textOverflow/types.ts +1 -0
- package/src/css/aspects/width/types.ts +2 -0
- package/src/css/aspects/width/width.ts +1 -0
- package/src/css/compilePalette.ts +32 -0
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/compileTheme_v3.ts +434 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
- package/src/css/components/dialog/dialog.ts +7 -0
- package/src/css/components/menu/menu.ts +2 -0
- package/src/css/components/skeleton/skeleton.style.ts +8 -4
- package/src/css/components/skeleton/skeleton.ts +4 -0
- package/src/css/components/skeleton/types.ts +4 -0
- package/src/css/components/toast/toast.ts +5 -0
- package/src/css/components/tree/tree.ts +1 -0
- package/src/css/composeClassNames.ts +4 -2
- package/src/css/constants.ts +11 -0
- package/src/css/index.ts +4 -3
- package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
- package/src/css/primitives/_arrow/_arrow.ts +7 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +24 -25
- package/src/css/primitives/_selectable/selectable.ts +1 -2
- package/src/css/primitives/avatar/avatar.style.ts +5 -8
- package/src/css/primitives/avatar/avatar.ts +6 -0
- package/src/css/primitives/avatar/types.ts +1 -0
- package/src/css/primitives/box/types.ts +1 -3
- package/src/css/primitives/button/button.style.ts +48 -15
- package/src/css/primitives/button/button.ts +4 -21
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/types.ts +18 -0
- package/src/css/primitives/card/card.style.ts +4 -7
- package/src/css/primitives/card/card.ts +2 -2
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.ts +2 -0
- package/src/css/primitives/container/container.ts +1 -0
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.ts +1 -0
- package/src/css/primitives/label/types.ts +7 -2
- package/src/css/primitives/popover/popover.ts +2 -0
- package/src/css/primitives/radio/radio.ts +1 -0
- package/src/css/primitives/select/select.ts +2 -0
- package/src/css/primitives/spinner/spinner.ts +2 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/types.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +1 -0
- package/src/css/primitives/textInput/textInput.ts +1 -0
- package/src/css/primitives/token/token.style.ts +37 -36
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/responsiveRules.ts +12 -19
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +115 -15
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +1 -0
- package/src/css/varNames.ts +230 -143
- package/src/css/vars.ts +53 -22
- package/src/theme/palette/constants.ts +2 -0
- package/src/theme/palette/types.ts +3 -0
- package/src/theme/types.ts +2 -6
- package/src/theme/v0/focusRing.ts +1 -3
- package/src/theme/v0/font.ts +6 -18
- package/src/theme/v0/layer.ts +1 -3
- package/src/theme/v0/shadow.ts +2 -6
- package/src/theme/v2/avatar.ts +1 -3
- package/src/theme/v2/color/_system.ts +1 -3
- package/src/theme/v2/color/avatar.ts +2 -6
- package/src/theme/v2/color/badge.ts +2 -6
- package/src/theme/v2/color/button.ts +3 -9
- package/src/theme/v2/color/color.ts +3 -9
- package/src/theme/v2/color/input.ts +3 -9
- package/src/theme/v2/color/kbd.ts +1 -3
- package/src/theme/v2/color/selectable.ts +2 -6
- package/src/theme/v2/color/state.ts +1 -3
- package/src/theme/v2/color/syntax.ts +1 -3
- package/src/theme/v2/input.ts +1 -3
- package/src/theme/v2/theme.ts +2 -6
- package/src/theme/v3/buildTheme_v3.ts +2 -1
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/{defaults.ts → defaultTokens.ts} +2 -2
- package/src/theme/v3/index.ts +1 -1
- package/src/theme/v3/resolveTokens.ts +18 -18
- package/src/ui/RootClassNames.tsx +44 -0
- package/src/ui/StyleTags.tsx +3 -1
- 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/theme/themeColorProvider.tsx +2 -6
- package/src/ui/_compat/theme/themeProvider.tsx +2 -6
- package/src/ui/_compat/theme/types.ts +1 -3
- package/src/ui/_compat/theme/useRootTheme.ts +1 -3
- package/src/ui/_compat/theme/useTheme.ts +2 -6
- package/src/ui/_compat/types.ts +0 -83
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
- package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
- package/src/ui/components/autocomplete/types.ts +3 -8
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
- package/src/ui/components/dialog/dialog.tsx +89 -291
- package/src/ui/components/dialog/dialogCard.tsx +183 -0
- package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
- package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
- package/src/ui/components/menu/menu.tsx +27 -33
- package/src/ui/components/menu/menuButton.tsx +10 -14
- package/src/ui/components/menu/menuDivider.tsx +25 -13
- package/src/ui/components/menu/menuGroup.tsx +34 -26
- package/src/ui/components/menu/menuItem.tsx +51 -40
- package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
- package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
- package/src/ui/components/skeleton/index.ts +3 -0
- package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
- package/src/ui/components/skeleton/skeleton.tsx +39 -16
- package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
- package/src/ui/components/tab/tab.tsx +23 -19
- package/src/ui/components/tab/tabList.tsx +34 -33
- package/src/ui/components/tab/tabPanel.tsx +25 -19
- package/src/ui/components/toast/toast.tsx +21 -16
- package/src/ui/components/toast/toastLayer.tsx +28 -10
- package/src/ui/components/toast/toastProvider.tsx +2 -6
- package/src/ui/components/toast/types.ts +2 -6
- package/src/ui/components/toast/useToast.ts +1 -3
- package/src/ui/components/tree/tree.tsx +194 -187
- package/src/ui/components/tree/treeGroup.tsx +25 -5
- package/src/ui/components/tree/treeItem.tsx +35 -23
- package/src/ui/hooks/useClickOutside.ts +2 -6
- package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
- package/src/ui/index.ts +1 -0
- package/src/ui/primitives/_selectable/selectable.tsx +33 -20
- package/src/ui/primitives/avatar/avatar.tsx +28 -31
- package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
- package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
- package/src/ui/primitives/avatar/types.ts +2 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
- package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
- package/src/ui/primitives/badge/badge.tsx +33 -32
- package/src/ui/primitives/badge/types.ts +2 -1
- package/src/ui/primitives/box/box.tsx +59 -29
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
- package/src/ui/primitives/button/button.test.tsx +1 -15
- package/src/ui/primitives/button/button.tsx +63 -70
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
- package/src/ui/primitives/card/card.tsx +22 -22
- package/src/ui/primitives/card/cardProvider.tsx +2 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
- package/src/ui/primitives/code/code.tsx +24 -22
- package/src/ui/primitives/container/container.tsx +26 -15
- package/src/ui/primitives/flex/flex.tsx +21 -19
- package/src/ui/primitives/grid/grid.tsx +21 -16
- package/src/ui/primitives/heading/heading.tsx +42 -19
- package/src/ui/primitives/inline/inline.tsx +26 -23
- package/src/ui/primitives/kbd/kbd.tsx +25 -23
- package/src/ui/primitives/label/label.tsx +29 -26
- package/src/ui/primitives/popover/popover.tsx +293 -271
- package/src/ui/primitives/popover/popoverCard.tsx +122 -120
- package/src/ui/primitives/radio/radio.tsx +30 -14
- package/src/ui/primitives/select/select.tsx +24 -16
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
- package/src/ui/primitives/spinner/spinner.tsx +24 -12
- package/src/ui/primitives/stack/stack.tsx +27 -18
- package/src/ui/primitives/switch/switch.tsx +31 -14
- package/src/ui/primitives/text/text.tsx +30 -24
- package/src/ui/primitives/textArea/textArea.tsx +33 -18
- package/src/ui/primitives/textInput/textInput.tsx +28 -40
- package/src/ui/primitives/tooltip/constants.ts +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +85 -61
- package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
- package/src/ui/primitives/types.ts +1 -3
- package/src/ui/types/avatar.ts +3 -6
- package/src/ui/types/badge.ts +1 -3
- package/src/ui/types/button.ts +1 -3
- package/src/ui/types/card.ts +1 -3
- package/src/ui/types/dialog.ts +1 -3
- package/src/ui/types/props.ts +20 -10
- package/src/ui/utils/arrow/arrow.tsx +43 -25
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
- package/src/ui/utils/boundaryElement/types.ts +1 -3
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
- package/src/ui/utils/elementQuery/elementQuery.tsx +43 -19
- package/src/ui/utils/errorBoundary.tsx +2 -0
- package/src/ui/utils/index.ts +0 -1
- package/src/ui/utils/layer/layer.tsx +23 -93
- package/src/ui/utils/layer/layerCard.tsx +92 -0
- package/src/ui/utils/layer/layerProvider.tsx +2 -6
- package/src/ui/utils/layer/useLayer.ts +1 -3
- package/src/ui/utils/portal/portal.ts +2 -6
- package/src/ui/utils/portal/portalProvider.tsx +2 -6
- package/src/ui/utils/portal/types.ts +1 -3
- package/src/ui/utils/portal/usePortal.ts +1 -3
- package/src/ui/utils/srOnly/srOnly.tsx +25 -20
- package/src/ui/utils/virtualList/virtualList.tsx +69 -50
- package/src/css/compile/compilePalette.ts +0 -27
- package/src/css/compile/compileRule.ts +0 -97
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileSystem.ts +0 -10
- package/src/css/compile/compileTheme_v3.ts +0 -401
- package/src/css/compile/types.ts +0 -6
- 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/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- 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
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
package/src/css/varNames.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {COLOR_HUES, COLOR_TINTS, ColorHueKey, ColorTintKey} from '@sanity/color'
|
|
1
2
|
import {
|
|
2
3
|
AVATAR_SIZE,
|
|
3
4
|
AvatarSize,
|
|
@@ -11,10 +12,14 @@ import {
|
|
|
11
12
|
type FontTextSize,
|
|
12
13
|
RADIUS,
|
|
13
14
|
Radius,
|
|
15
|
+
SHADOW,
|
|
16
|
+
Shadow,
|
|
14
17
|
SPACE,
|
|
15
18
|
type Space,
|
|
19
|
+
THEME_COLOR_CARD_TONES,
|
|
16
20
|
THEME_COLOR_STATE_TONES,
|
|
17
21
|
type ThemeColorCardToneKey as CardTone,
|
|
22
|
+
ThemeColorCardToneKey,
|
|
18
23
|
type ThemeColorSchemeKey as Scheme,
|
|
19
24
|
} from '@sanity/ui/theme'
|
|
20
25
|
|
|
@@ -26,6 +31,7 @@ import {
|
|
|
26
31
|
type VarNames,
|
|
27
32
|
} from './types'
|
|
28
33
|
|
|
34
|
+
/** @public */
|
|
29
35
|
export const varNames: VarNames = {
|
|
30
36
|
avatar: {
|
|
31
37
|
distance: `--avatar-distance`,
|
|
@@ -47,11 +53,22 @@ export const varNames: VarNames = {
|
|
|
47
53
|
{} as Record<AvatarSize, {distance: VarName; size: VarName}>,
|
|
48
54
|
),
|
|
49
55
|
},
|
|
56
|
+
button: {
|
|
57
|
+
border: {
|
|
58
|
+
width: `--button-border-width`,
|
|
59
|
+
},
|
|
60
|
+
focusRing: {
|
|
61
|
+
offset: `--button-focus-ring-offset`,
|
|
62
|
+
width: `--button-focus-ring-width`,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
card: {
|
|
66
|
+
shadow: {
|
|
67
|
+
outline: `--card-shadow-outline`,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
50
70
|
color: {
|
|
51
71
|
// card scope
|
|
52
|
-
accent: {
|
|
53
|
-
fg: `--color-accent-fg`,
|
|
54
|
-
},
|
|
55
72
|
avatar: {
|
|
56
73
|
bg: `--color-avatar-bg`,
|
|
57
74
|
fg: `--color-avatar-fg`,
|
|
@@ -169,36 +186,32 @@ export const varNames: VarNames = {
|
|
|
169
186
|
tinted: buildColorVariantVarNames({variant: 'tinted'}),
|
|
170
187
|
|
|
171
188
|
// tone scopes
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// scheme
|
|
182
|
-
dark:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
positive: buildColorCardVarNames({scheme: 'light', tone: 'positive'}),
|
|
199
|
-
caution: buildColorCardVarNames({scheme: 'light', tone: 'caution'}),
|
|
200
|
-
critical: buildColorCardVarNames({scheme: 'light', tone: 'critical'}),
|
|
201
|
-
},
|
|
189
|
+
...THEME_COLOR_CARD_TONES.reduce(
|
|
190
|
+
(acc, tone) => {
|
|
191
|
+
acc[tone] = buildColorCardVarNames({tone})
|
|
192
|
+
|
|
193
|
+
return acc
|
|
194
|
+
},
|
|
195
|
+
{} as Record<ThemeColorCardToneKey, ColorCardVarNames>,
|
|
196
|
+
),
|
|
197
|
+
|
|
198
|
+
// scheme scopes
|
|
199
|
+
dark: THEME_COLOR_CARD_TONES.reduce(
|
|
200
|
+
(acc, tone) => {
|
|
201
|
+
acc[tone] = buildColorCardVarNames({scheme: 'dark', tone})
|
|
202
|
+
|
|
203
|
+
return acc
|
|
204
|
+
},
|
|
205
|
+
{} as Record<ThemeColorCardToneKey, ColorCardVarNames>,
|
|
206
|
+
),
|
|
207
|
+
light: THEME_COLOR_CARD_TONES.reduce(
|
|
208
|
+
(acc, tone) => {
|
|
209
|
+
acc[tone] = buildColorCardVarNames({scheme: 'light', tone})
|
|
210
|
+
|
|
211
|
+
return acc
|
|
212
|
+
},
|
|
213
|
+
{} as Record<ThemeColorCardToneKey, ColorCardVarNames>,
|
|
214
|
+
),
|
|
202
215
|
},
|
|
203
216
|
container: {
|
|
204
217
|
0: `--container-0`,
|
|
@@ -211,6 +224,7 @@ export const varNames: VarNames = {
|
|
|
211
224
|
font: {
|
|
212
225
|
code: {
|
|
213
226
|
family: `--font-code-family`,
|
|
227
|
+
featureSettings: `--font-code-feature-settings`,
|
|
214
228
|
sizes: FONT_CODE_SIZE.reduce(
|
|
215
229
|
(acc, size) => {
|
|
216
230
|
return {
|
|
@@ -227,7 +241,7 @@ export const varNames: VarNames = {
|
|
|
227
241
|
},
|
|
228
242
|
{} as Record<FontCodeSize, FontSizeVarNames>,
|
|
229
243
|
),
|
|
230
|
-
|
|
244
|
+
weights: {
|
|
231
245
|
regular: `--font-code-weight-regular`,
|
|
232
246
|
medium: `--font-code-weight-medium`,
|
|
233
247
|
semibold: `--font-code-weight-semibold`,
|
|
@@ -236,6 +250,7 @@ export const varNames: VarNames = {
|
|
|
236
250
|
},
|
|
237
251
|
heading: {
|
|
238
252
|
family: `--font-heading-family`,
|
|
253
|
+
featureSettings: `--font-heading-feature-settings`,
|
|
239
254
|
sizes: FONT_HEADING_SIZE.reduce(
|
|
240
255
|
(acc, size) => {
|
|
241
256
|
return {
|
|
@@ -252,7 +267,7 @@ export const varNames: VarNames = {
|
|
|
252
267
|
},
|
|
253
268
|
{} as Record<FontHeadingSize, FontSizeVarNames>,
|
|
254
269
|
),
|
|
255
|
-
|
|
270
|
+
weights: {
|
|
256
271
|
regular: `--font-heading-weight-regular`,
|
|
257
272
|
medium: `--font-heading-weight-medium`,
|
|
258
273
|
semibold: `--font-heading-weight-semibold`,
|
|
@@ -261,6 +276,7 @@ export const varNames: VarNames = {
|
|
|
261
276
|
},
|
|
262
277
|
label: {
|
|
263
278
|
family: `--font-label-family`,
|
|
279
|
+
featureSettings: `--font-label-feature-settings`,
|
|
264
280
|
sizes: FONT_LABEL_SIZE.reduce(
|
|
265
281
|
(acc, size) => {
|
|
266
282
|
return {
|
|
@@ -277,7 +293,7 @@ export const varNames: VarNames = {
|
|
|
277
293
|
},
|
|
278
294
|
{} as Record<FontLabelSize, FontSizeVarNames>,
|
|
279
295
|
),
|
|
280
|
-
|
|
296
|
+
weights: {
|
|
281
297
|
regular: `--font-label-weight-regular`,
|
|
282
298
|
medium: `--font-label-weight-medium`,
|
|
283
299
|
semibold: `--font-label-weight-semibold`,
|
|
@@ -286,6 +302,7 @@ export const varNames: VarNames = {
|
|
|
286
302
|
},
|
|
287
303
|
text: {
|
|
288
304
|
family: `--font-text-family`,
|
|
305
|
+
featureSettings: `--font-text-feature-settings`,
|
|
289
306
|
sizes: FONT_TEXT_SIZE.reduce(
|
|
290
307
|
(acc, size) => {
|
|
291
308
|
return {
|
|
@@ -302,7 +319,7 @@ export const varNames: VarNames = {
|
|
|
302
319
|
},
|
|
303
320
|
{} as Record<FontTextSize, FontSizeVarNames>,
|
|
304
321
|
),
|
|
305
|
-
|
|
322
|
+
weights: {
|
|
306
323
|
regular: `--font-text-weight-regular`,
|
|
307
324
|
medium: `--font-text-weight-medium`,
|
|
308
325
|
semibold: `--font-text-weight-semibold`,
|
|
@@ -311,12 +328,59 @@ export const varNames: VarNames = {
|
|
|
311
328
|
},
|
|
312
329
|
},
|
|
313
330
|
input: {
|
|
331
|
+
border: {
|
|
332
|
+
width: `--input-border-width`,
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
checkbox: {
|
|
336
|
+
focusRing: {
|
|
337
|
+
offset: `--input-checkbox-focus-ring-offset`,
|
|
338
|
+
width: `--input-checkbox-focus-ring-width`,
|
|
339
|
+
},
|
|
340
|
+
size: `--input-checkbox-size`,
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
radio: {
|
|
344
|
+
focusRing: {
|
|
345
|
+
offset: `--input-radio-focus-ring-offset`,
|
|
346
|
+
width: `--input-radio-focus-ring-width`,
|
|
347
|
+
},
|
|
348
|
+
markSize: `--input-radio-mark-size`,
|
|
349
|
+
size: `--input-radio-size`,
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
select: {
|
|
353
|
+
focusRing: {
|
|
354
|
+
offset: `--input-select-focus-ring-offset`,
|
|
355
|
+
width: `--input-select-focus-ring-width`,
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
switch: {
|
|
360
|
+
focusRing: {
|
|
361
|
+
offset: `--input-switch-focus-ring-offset`,
|
|
362
|
+
width: `--input-switch-focus-ring-width`,
|
|
363
|
+
},
|
|
364
|
+
height: `--input-switch-height`,
|
|
365
|
+
padding: `--input-switch-padding`,
|
|
366
|
+
transitionDurationMs: `--input-switch-transition-duration-ms`,
|
|
367
|
+
transitionTimingFunction: `--input-switch-transition-timing-function`,
|
|
368
|
+
width: `--input-switch-width`,
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
text: {
|
|
372
|
+
focusRing: {
|
|
373
|
+
offset: `--input-text-focus-ring-offset`,
|
|
374
|
+
width: `--input-text-focus-ring-width`,
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
|
|
314
378
|
fontSize: `--input-font-size`,
|
|
379
|
+
|
|
315
380
|
lineHeight: `--input-line-height`,
|
|
316
381
|
letterSpacing: `--input-letter-spacing`,
|
|
317
382
|
ascenderHeight: `--input-ascender-height`,
|
|
318
383
|
descenderHeight: `--input-descender-height`,
|
|
319
|
-
// capHeight: `--input-cap-height`,
|
|
320
384
|
|
|
321
385
|
gap: `--input-gap`,
|
|
322
386
|
padding: `--input-padding`,
|
|
@@ -324,120 +388,143 @@ export const varNames: VarNames = {
|
|
|
324
388
|
radius: Object.fromEntries(
|
|
325
389
|
RADIUS.map((radius) => [radius, `--radius-${radius}` as VarName]),
|
|
326
390
|
) as Record<Radius, VarName>,
|
|
391
|
+
shadow: Object.fromEntries(
|
|
392
|
+
SHADOW.map((shadow) => [
|
|
393
|
+
shadow,
|
|
394
|
+
{
|
|
395
|
+
umbra: `--shadow-${shadow}-umbra`,
|
|
396
|
+
penumbra: `--shadow-${shadow}-penumbra`,
|
|
397
|
+
ambient: `--shadow-${shadow}-ambient`,
|
|
398
|
+
},
|
|
399
|
+
]),
|
|
400
|
+
) as Record<Shadow, {umbra: VarName; penumbra: VarName; ambient: VarName}>,
|
|
327
401
|
space: Object.fromEntries(
|
|
328
402
|
SPACE.map((space) => [space, `--space-${String(space).replace('.', '_')}` as VarName]),
|
|
329
403
|
) as Record<Space, VarName>,
|
|
404
|
+
|
|
405
|
+
// color
|
|
406
|
+
black: `--black`,
|
|
407
|
+
white: `--white`,
|
|
408
|
+
...COLOR_HUES.reduce(
|
|
409
|
+
(acc, hue) => {
|
|
410
|
+
const tints = {} as Record<ColorTintKey, VarName>
|
|
411
|
+
|
|
412
|
+
for (const tint of COLOR_TINTS) {
|
|
413
|
+
tints[tint] = `--${hue}-${tint}`
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
acc[hue] = tints
|
|
417
|
+
|
|
418
|
+
return acc
|
|
419
|
+
},
|
|
420
|
+
{} as Record<ColorHueKey, Record<ColorTintKey, VarName>>,
|
|
421
|
+
),
|
|
330
422
|
} as const
|
|
331
423
|
|
|
332
424
|
function buildColorCardVarNames(props: {scheme?: Scheme; tone: CardTone}): ColorCardVarNames {
|
|
333
425
|
const {scheme, tone} = props
|
|
334
426
|
|
|
335
|
-
const
|
|
336
|
-
? (`--color-${scheme}-${tone}` as const)
|
|
337
|
-
: (`--color-${tone}` as const)
|
|
427
|
+
const prefix = scheme ? (`--color-${scheme}-${tone}` as const) : (`--color-${tone}` as const)
|
|
338
428
|
|
|
339
429
|
return {
|
|
340
|
-
accent: {
|
|
341
|
-
fg: `${sourcePrefix}-accent-fg`,
|
|
342
|
-
},
|
|
343
430
|
avatar: {
|
|
344
431
|
gray: {
|
|
345
|
-
bg: `${
|
|
346
|
-
fg: `${
|
|
432
|
+
bg: `${prefix}-avatar-gray-bg`,
|
|
433
|
+
fg: `${prefix}-avatar-gray-fg`,
|
|
347
434
|
},
|
|
348
435
|
blue: {
|
|
349
|
-
bg: `${
|
|
350
|
-
fg: `${
|
|
436
|
+
bg: `${prefix}-avatar-blue-bg`,
|
|
437
|
+
fg: `${prefix}-avatar-blue-fg`,
|
|
351
438
|
},
|
|
352
439
|
purple: {
|
|
353
|
-
bg: `${
|
|
354
|
-
fg: `${
|
|
440
|
+
bg: `${prefix}-avatar-purple-bg`,
|
|
441
|
+
fg: `${prefix}-avatar-purple-fg`,
|
|
355
442
|
},
|
|
356
443
|
magenta: {
|
|
357
|
-
bg: `${
|
|
358
|
-
fg: `${
|
|
444
|
+
bg: `${prefix}-avatar-magenta-bg`,
|
|
445
|
+
fg: `${prefix}-avatar-magenta-fg`,
|
|
359
446
|
},
|
|
360
447
|
red: {
|
|
361
|
-
bg: `${
|
|
362
|
-
fg: `${
|
|
448
|
+
bg: `${prefix}-avatar-red-bg`,
|
|
449
|
+
fg: `${prefix}-avatar-red-fg`,
|
|
363
450
|
},
|
|
364
451
|
orange: {
|
|
365
|
-
bg: `${
|
|
366
|
-
fg: `${
|
|
452
|
+
bg: `${prefix}-avatar-orange-bg`,
|
|
453
|
+
fg: `${prefix}-avatar-gray-fg`,
|
|
367
454
|
},
|
|
368
455
|
yellow: {
|
|
369
|
-
bg: `${
|
|
370
|
-
fg: `${
|
|
456
|
+
bg: `${prefix}-avatar-yellow-bg`,
|
|
457
|
+
fg: `${prefix}-avatar-yellow-fg`,
|
|
371
458
|
},
|
|
372
459
|
green: {
|
|
373
|
-
bg: `${
|
|
374
|
-
fg: `${
|
|
460
|
+
bg: `${prefix}-avatar-green-bg`,
|
|
461
|
+
fg: `${prefix}-avatar-green-fg`,
|
|
375
462
|
},
|
|
376
463
|
cyan: {
|
|
377
|
-
bg: `${
|
|
378
|
-
fg: `${
|
|
464
|
+
bg: `${prefix}-avatar-cyan-bg`,
|
|
465
|
+
fg: `${prefix}-avatar-yellow-fg`,
|
|
379
466
|
},
|
|
380
467
|
},
|
|
381
|
-
backdrop: `${
|
|
468
|
+
backdrop: `${prefix}-backdrop`,
|
|
382
469
|
code: {
|
|
383
|
-
bg: `${
|
|
384
|
-
fg: `${
|
|
470
|
+
bg: `${prefix}-code-bg`,
|
|
471
|
+
fg: `${prefix}-code-fg`,
|
|
385
472
|
token: {
|
|
386
|
-
atrule: `${
|
|
387
|
-
attrName: `${
|
|
388
|
-
attrValue: `${
|
|
389
|
-
attribute: `${
|
|
390
|
-
boolean: `${
|
|
391
|
-
builtin: `${
|
|
392
|
-
cdata: `${
|
|
393
|
-
char: `${
|
|
394
|
-
class: `${
|
|
395
|
-
className: `${
|
|
396
|
-
comment: `${
|
|
397
|
-
constant: `${
|
|
398
|
-
deleted: `${
|
|
399
|
-
doctype: `${
|
|
400
|
-
entity: `${
|
|
401
|
-
function: `${
|
|
402
|
-
hexcode: `${
|
|
403
|
-
id: `${
|
|
404
|
-
important: `${
|
|
405
|
-
inserted: `${
|
|
406
|
-
keyword: `${
|
|
407
|
-
number: `${
|
|
408
|
-
operator: `${
|
|
409
|
-
prolog: `${
|
|
410
|
-
property: `${
|
|
411
|
-
pseudoClass: `${
|
|
412
|
-
pseudoElement: `${
|
|
413
|
-
punctuation: `${
|
|
414
|
-
regex: `${
|
|
415
|
-
selector: `${
|
|
416
|
-
string: `${
|
|
417
|
-
symbol: `${
|
|
418
|
-
tag: `${
|
|
419
|
-
unit: `${
|
|
420
|
-
url: `${
|
|
421
|
-
variable: `${
|
|
473
|
+
atrule: `${prefix}-code-token-atrule`,
|
|
474
|
+
attrName: `${prefix}-code-token-attr-name`,
|
|
475
|
+
attrValue: `${prefix}-code-token-attr-value`,
|
|
476
|
+
attribute: `${prefix}-code-token-attribute`,
|
|
477
|
+
boolean: `${prefix}-code-token-boolean`,
|
|
478
|
+
builtin: `${prefix}-code-token-builtin`,
|
|
479
|
+
cdata: `${prefix}-code-token-cdata`,
|
|
480
|
+
char: `${prefix}-code-token-char`,
|
|
481
|
+
class: `${prefix}-code-token-class`,
|
|
482
|
+
className: `${prefix}-code-token-class-name`,
|
|
483
|
+
comment: `${prefix}-code-token-comment`,
|
|
484
|
+
constant: `${prefix}-code-token-constant`,
|
|
485
|
+
deleted: `${prefix}-code-token-deleted`,
|
|
486
|
+
doctype: `${prefix}-code-token-doctype`,
|
|
487
|
+
entity: `${prefix}-code-token-entity`,
|
|
488
|
+
function: `${prefix}-code-token-function`,
|
|
489
|
+
hexcode: `${prefix}-code-token-hexcode`,
|
|
490
|
+
id: `${prefix}-code-token-id`,
|
|
491
|
+
important: `${prefix}-code-token-important`,
|
|
492
|
+
inserted: `${prefix}-code-token-inserted`,
|
|
493
|
+
keyword: `${prefix}-code-token-keyword`,
|
|
494
|
+
number: `${prefix}-code-token-number`,
|
|
495
|
+
operator: `${prefix}-code-token-operator`,
|
|
496
|
+
prolog: `${prefix}-code-token-prolog`,
|
|
497
|
+
property: `${prefix}-code-token-property`,
|
|
498
|
+
pseudoClass: `${prefix}-code-token-pseudo-class`,
|
|
499
|
+
pseudoElement: `${prefix}-code-token-pseudo-element`,
|
|
500
|
+
punctuation: `${prefix}-code-token-punctuation`,
|
|
501
|
+
regex: `${prefix}-code-token-regex`,
|
|
502
|
+
selector: `${prefix}-code-token-selector`,
|
|
503
|
+
string: `${prefix}-code-token-string`,
|
|
504
|
+
symbol: `${prefix}-code-token-symbol`,
|
|
505
|
+
tag: `${prefix}-code-token-tag`,
|
|
506
|
+
unit: `${prefix}-code-token-unit`,
|
|
507
|
+
url: `${prefix}-code-token-url`,
|
|
508
|
+
variable: `${prefix}-code-token-variable`,
|
|
422
509
|
},
|
|
423
510
|
},
|
|
424
|
-
focusRing: `${
|
|
511
|
+
focusRing: `${prefix}-focus-ring`,
|
|
425
512
|
link: {
|
|
426
|
-
fg: `${
|
|
513
|
+
fg: `${prefix}-link-fg`,
|
|
427
514
|
},
|
|
428
515
|
muted: {
|
|
429
|
-
bg: `${
|
|
430
|
-
fg: `${
|
|
516
|
+
bg: `${prefix}-muted-bg`,
|
|
517
|
+
fg: `${prefix}-muted-fg`,
|
|
431
518
|
},
|
|
432
519
|
shadow: {
|
|
433
|
-
outline: `${
|
|
434
|
-
umbra: `${
|
|
435
|
-
penumbra: `${
|
|
436
|
-
ambient: `${
|
|
520
|
+
outline: `${prefix}-shadow-outline`,
|
|
521
|
+
umbra: `${prefix}-shadow-umbra`,
|
|
522
|
+
penumbra: `${prefix}-shadow-penumbra`,
|
|
523
|
+
ambient: `${prefix}-shadow-ambient`,
|
|
437
524
|
},
|
|
438
525
|
skeleton: {
|
|
439
|
-
from: `${
|
|
440
|
-
to: `${
|
|
526
|
+
from: `${prefix}-skeleton-from`,
|
|
527
|
+
to: `${prefix}-skeleton-to`,
|
|
441
528
|
},
|
|
442
529
|
|
|
443
530
|
solid: buildColorVariantVarNames({scheme, tone, variant: 'solid'}),
|
|
@@ -452,7 +539,7 @@ function buildColorVariantVarNames(options: {
|
|
|
452
539
|
}): ColorVariantVarNames {
|
|
453
540
|
const {scheme, tone, variant} = options
|
|
454
541
|
|
|
455
|
-
const
|
|
542
|
+
const prefix =
|
|
456
543
|
scheme && tone
|
|
457
544
|
? (`--color-${scheme}-${tone}-${variant}` as const)
|
|
458
545
|
: tone
|
|
@@ -461,30 +548,30 @@ function buildColorVariantVarNames(options: {
|
|
|
461
548
|
|
|
462
549
|
const vars = {
|
|
463
550
|
bg: {
|
|
464
|
-
0: `${
|
|
465
|
-
1: `${
|
|
466
|
-
2: `${
|
|
467
|
-
3: `${
|
|
468
|
-
4: `${
|
|
551
|
+
0: `${prefix}-bg-0`,
|
|
552
|
+
1: `${prefix}-bg-1`,
|
|
553
|
+
2: `${prefix}-bg-2`,
|
|
554
|
+
3: `${prefix}-bg-3`,
|
|
555
|
+
4: `${prefix}-bg-4`,
|
|
469
556
|
},
|
|
470
557
|
border: {
|
|
471
|
-
0: `${
|
|
472
|
-
1: `${
|
|
473
|
-
2: `${
|
|
474
|
-
3: `${
|
|
475
|
-
4: `${
|
|
558
|
+
0: `${prefix}-border-0`,
|
|
559
|
+
1: `${prefix}-border-1`,
|
|
560
|
+
2: `${prefix}-border-2`,
|
|
561
|
+
3: `${prefix}-border-3`,
|
|
562
|
+
4: `${prefix}-border-4`,
|
|
476
563
|
},
|
|
477
564
|
fg: {
|
|
478
|
-
0: `${
|
|
479
|
-
1: `${
|
|
480
|
-
2: `${
|
|
481
|
-
3: `${
|
|
482
|
-
4: `${
|
|
565
|
+
0: `${prefix}-fg-0`,
|
|
566
|
+
1: `${prefix}-fg-1`,
|
|
567
|
+
2: `${prefix}-fg-2`,
|
|
568
|
+
3: `${prefix}-fg-3`,
|
|
569
|
+
4: `${prefix}-fg-4`,
|
|
483
570
|
},
|
|
484
571
|
} as ColorVariantVarNames
|
|
485
572
|
|
|
486
573
|
for (const elementTone of THEME_COLOR_STATE_TONES) {
|
|
487
|
-
const
|
|
574
|
+
const _prefix =
|
|
488
575
|
scheme && tone
|
|
489
576
|
? (`--color-${scheme}-${tone}-${variant}-${elementTone}` as const)
|
|
490
577
|
: tone
|
|
@@ -493,25 +580,25 @@ function buildColorVariantVarNames(options: {
|
|
|
493
580
|
|
|
494
581
|
vars[elementTone] = {
|
|
495
582
|
bg: {
|
|
496
|
-
0: `${
|
|
497
|
-
1: `${
|
|
498
|
-
2: `${
|
|
499
|
-
3: `${
|
|
500
|
-
4: `${
|
|
583
|
+
0: `${_prefix}-bg-0`,
|
|
584
|
+
1: `${_prefix}-bg-1`,
|
|
585
|
+
2: `${_prefix}-bg-2`,
|
|
586
|
+
3: `${_prefix}-bg-3`,
|
|
587
|
+
4: `${_prefix}-bg-4`,
|
|
501
588
|
},
|
|
502
589
|
border: {
|
|
503
|
-
0: `${
|
|
504
|
-
1: `${
|
|
505
|
-
2: `${
|
|
506
|
-
3: `${
|
|
507
|
-
4: `${
|
|
590
|
+
0: `${_prefix}-border-0`,
|
|
591
|
+
1: `${_prefix}-border-1`,
|
|
592
|
+
2: `${_prefix}-border-2`,
|
|
593
|
+
3: `${_prefix}-border-3`,
|
|
594
|
+
4: `${_prefix}-border-4`,
|
|
508
595
|
},
|
|
509
596
|
fg: {
|
|
510
|
-
0: `${
|
|
511
|
-
1: `${
|
|
512
|
-
2: `${
|
|
513
|
-
3: `${
|
|
514
|
-
4: `${
|
|
597
|
+
0: `${_prefix}-fg-0`,
|
|
598
|
+
1: `${_prefix}-fg-1`,
|
|
599
|
+
2: `${_prefix}-fg-2`,
|
|
600
|
+
3: `${_prefix}-fg-3`,
|
|
601
|
+
4: `${_prefix}-fg-4`,
|
|
515
602
|
},
|
|
516
603
|
}
|
|
517
604
|
}
|