@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/vars.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,6 +12,8 @@ import {
|
|
|
11
12
|
type FontTextSize,
|
|
12
13
|
RADIUS,
|
|
13
14
|
Radius,
|
|
15
|
+
SHADOW,
|
|
16
|
+
Shadow,
|
|
14
17
|
SPACE,
|
|
15
18
|
type Space,
|
|
16
19
|
THEME_COLOR_AVATAR_COLORS,
|
|
@@ -44,9 +47,6 @@ for (const tone of THEME_COLOR_CARD_TONES) {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
const colorVars: Vars['color'] = {
|
|
47
|
-
accent: {
|
|
48
|
-
fg: `var(${varNames.color.accent.fg})`,
|
|
49
|
-
},
|
|
50
50
|
avatar: {
|
|
51
51
|
bg: `var(${varNames.color.avatar.bg})`,
|
|
52
52
|
fg: `var(${varNames.color.avatar.fg})`,
|
|
@@ -173,6 +173,7 @@ const colorVars: Vars['color'] = {
|
|
|
173
173
|
light: lightColorVars,
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/** @public */
|
|
176
177
|
export const vars: Vars = {
|
|
177
178
|
avatar: {
|
|
178
179
|
distance: `var(${varNames.avatar.distance})`,
|
|
@@ -190,6 +191,11 @@ export const vars: Vars = {
|
|
|
190
191
|
{} as Record<AvatarSize, {distance: CSSVar; size: CSSVar}>,
|
|
191
192
|
),
|
|
192
193
|
},
|
|
194
|
+
card: {
|
|
195
|
+
shadow: {
|
|
196
|
+
outline: `var(${varNames.card.shadow.outline})`,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
193
199
|
color: colorVars,
|
|
194
200
|
container: {
|
|
195
201
|
0: `var(${varNames.container[0]})`,
|
|
@@ -219,10 +225,10 @@ export const vars: Vars = {
|
|
|
219
225
|
{} as Record<FontCodeSize, FontSizeVars>,
|
|
220
226
|
),
|
|
221
227
|
weight: {
|
|
222
|
-
regular: `var(${varNames.font.code.
|
|
223
|
-
medium: `var(${varNames.font.code.
|
|
224
|
-
semibold: `var(${varNames.font.code.
|
|
225
|
-
bold: `var(${varNames.font.code.
|
|
228
|
+
regular: `var(${varNames.font.code.weights.regular})`,
|
|
229
|
+
medium: `var(${varNames.font.code.weights.medium})`,
|
|
230
|
+
semibold: `var(${varNames.font.code.weights.semibold})`,
|
|
231
|
+
bold: `var(${varNames.font.code.weights.bold})`,
|
|
226
232
|
},
|
|
227
233
|
},
|
|
228
234
|
heading: {
|
|
@@ -244,10 +250,10 @@ export const vars: Vars = {
|
|
|
244
250
|
{} as Record<FontHeadingSize, FontSizeVars>,
|
|
245
251
|
),
|
|
246
252
|
weight: {
|
|
247
|
-
regular: `var(${varNames.font.heading.
|
|
248
|
-
medium: `var(${varNames.font.heading.
|
|
249
|
-
semibold: `var(${varNames.font.heading.
|
|
250
|
-
bold: `var(${varNames.font.heading.
|
|
253
|
+
regular: `var(${varNames.font.heading.weights.regular})`,
|
|
254
|
+
medium: `var(${varNames.font.heading.weights.medium})`,
|
|
255
|
+
semibold: `var(${varNames.font.heading.weights.semibold})`,
|
|
256
|
+
bold: `var(${varNames.font.heading.weights.bold})`,
|
|
251
257
|
},
|
|
252
258
|
},
|
|
253
259
|
label: {
|
|
@@ -269,10 +275,10 @@ export const vars: Vars = {
|
|
|
269
275
|
{} as Record<FontLabelSize, FontSizeVars>,
|
|
270
276
|
),
|
|
271
277
|
weight: {
|
|
272
|
-
regular: `var(${varNames.font.label.
|
|
273
|
-
medium: `var(${varNames.font.label.
|
|
274
|
-
semibold: `var(${varNames.font.label.
|
|
275
|
-
bold: `var(${varNames.font.label.
|
|
278
|
+
regular: `var(${varNames.font.label.weights.regular})`,
|
|
279
|
+
medium: `var(${varNames.font.label.weights.medium})`,
|
|
280
|
+
semibold: `var(${varNames.font.label.weights.semibold})`,
|
|
281
|
+
bold: `var(${varNames.font.label.weights.bold})`,
|
|
276
282
|
},
|
|
277
283
|
},
|
|
278
284
|
text: {
|
|
@@ -294,10 +300,10 @@ export const vars: Vars = {
|
|
|
294
300
|
{} as Record<FontTextSize, FontSizeVars>,
|
|
295
301
|
),
|
|
296
302
|
weight: {
|
|
297
|
-
regular: `var(${varNames.font.text.
|
|
298
|
-
medium: `var(${varNames.font.text.
|
|
299
|
-
semibold: `var(${varNames.font.text.
|
|
300
|
-
bold: `var(${varNames.font.text.
|
|
303
|
+
regular: `var(${varNames.font.text.weights.regular})`,
|
|
304
|
+
medium: `var(${varNames.font.text.weights.medium})`,
|
|
305
|
+
semibold: `var(${varNames.font.text.weights.semibold})`,
|
|
306
|
+
bold: `var(${varNames.font.text.weights.bold})`,
|
|
301
307
|
},
|
|
302
308
|
},
|
|
303
309
|
},
|
|
@@ -322,9 +328,37 @@ export const vars: Vars = {
|
|
|
322
328
|
radius: Object.fromEntries(
|
|
323
329
|
RADIUS.map((radius) => [radius, `var(${varNames.radius[radius]})` as const]),
|
|
324
330
|
) as Record<Radius, CSSVar>,
|
|
331
|
+
shadow: Object.fromEntries(
|
|
332
|
+
SHADOW.map((shadow) => [
|
|
333
|
+
shadow,
|
|
334
|
+
{
|
|
335
|
+
umbra: `var(${varNames.shadow[shadow].umbra})`,
|
|
336
|
+
penumbra: `var(${varNames.shadow[shadow].penumbra})`,
|
|
337
|
+
ambient: `var(${varNames.shadow[shadow].ambient})`,
|
|
338
|
+
},
|
|
339
|
+
]),
|
|
340
|
+
) as Record<Shadow, {umbra: CSSVar; penumbra: CSSVar; ambient: CSSVar}>,
|
|
325
341
|
space: Object.fromEntries(
|
|
326
342
|
SPACE.map((space) => [space, `var(${varNames.space[space]})` as const]),
|
|
327
343
|
) as Record<Space, CSSVar>,
|
|
344
|
+
|
|
345
|
+
// color
|
|
346
|
+
black: `var(${varNames.black})`,
|
|
347
|
+
white: `var(${varNames.white})`,
|
|
348
|
+
...COLOR_HUES.reduce(
|
|
349
|
+
(acc, hue) => {
|
|
350
|
+
const tints = {} as Record<ColorTintKey, CSSVar>
|
|
351
|
+
|
|
352
|
+
for (const tint of COLOR_TINTS) {
|
|
353
|
+
tints[tint] = `var(--${hue}-${tint})`
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
acc[hue] = tints
|
|
357
|
+
|
|
358
|
+
return acc
|
|
359
|
+
},
|
|
360
|
+
{} as Record<ColorHueKey, Record<ColorTintKey, CSSVar>>,
|
|
361
|
+
),
|
|
328
362
|
} as const
|
|
329
363
|
|
|
330
364
|
function buildColorCardVars(props: {scheme?: Scheme; tone: CardTone}): ColorCardVars {
|
|
@@ -333,9 +367,6 @@ function buildColorCardVars(props: {scheme?: Scheme; tone: CardTone}): ColorCard
|
|
|
333
367
|
const prefix = scheme ? varNames.color[scheme][tone] : varNames.color[tone]
|
|
334
368
|
|
|
335
369
|
return {
|
|
336
|
-
accent: {
|
|
337
|
-
fg: `var(${prefix.accent.fg})`,
|
|
338
|
-
},
|
|
339
370
|
avatar: {
|
|
340
371
|
...THEME_COLOR_AVATAR_COLORS.reduce((acc, color) => {
|
|
341
372
|
return {
|
package/src/theme/types.ts
CHANGED
|
@@ -3,17 +3,13 @@ import {RootTheme_v0} from './v0/theme'
|
|
|
3
3
|
import {RootTheme_v2, Theme_v2} from './v2/theme'
|
|
4
4
|
import {Theme_v3} from './v3'
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
6
|
+
/** @public */
|
|
9
7
|
export interface RootTheme extends RootTheme_v0 {
|
|
10
8
|
v2?: RootTheme_v2
|
|
11
9
|
v3?: Theme_v3
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
12
|
+
/** @public */
|
|
17
13
|
export type BaseTheme = RootTheme
|
|
18
14
|
|
|
19
15
|
/**
|
package/src/theme/v0/font.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
1
|
+
/** @public */
|
|
4
2
|
export type ThemeFontKey = 'code' | 'heading' | 'label' | 'text'
|
|
5
3
|
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
4
|
+
/** @public */
|
|
9
5
|
export type ThemeFontWeightKey = 'regular' | 'medium' | 'semibold' | 'bold'
|
|
10
6
|
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
7
|
+
/** @public */
|
|
14
8
|
export interface ThemeFontSize {
|
|
15
9
|
ascenderHeight: number
|
|
16
10
|
descenderHeight: number
|
|
@@ -20,9 +14,7 @@ export interface ThemeFontSize {
|
|
|
20
14
|
lineHeight: number
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
17
|
+
/** @public */
|
|
26
18
|
export interface ThemeFontWeight {
|
|
27
19
|
regular: number
|
|
28
20
|
medium: number
|
|
@@ -30,9 +22,7 @@ export interface ThemeFontWeight {
|
|
|
30
22
|
bold: number
|
|
31
23
|
}
|
|
32
24
|
|
|
33
|
-
/**
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
25
|
+
/** @public */
|
|
36
26
|
export interface ThemeFont {
|
|
37
27
|
family: string
|
|
38
28
|
featureSettings?: string
|
|
@@ -42,9 +32,7 @@ export interface ThemeFont {
|
|
|
42
32
|
horizontalOffset?: number
|
|
43
33
|
}
|
|
44
34
|
|
|
45
|
-
/**
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
35
|
+
/** @public */
|
|
48
36
|
export interface ThemeFonts {
|
|
49
37
|
code: ThemeFont
|
|
50
38
|
heading: ThemeFont
|
package/src/theme/v0/layer.ts
CHANGED
package/src/theme/v0/shadow.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @public
|
|
3
|
-
*/
|
|
1
|
+
/** @public */
|
|
4
2
|
export type ThemeBoxShadow = [
|
|
5
3
|
// offsetX, offsetY, blurRadius, spreadRadius
|
|
6
4
|
number,
|
|
@@ -9,9 +7,7 @@ export type ThemeBoxShadow = [
|
|
|
9
7
|
number,
|
|
10
8
|
]
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
10
|
+
/** @public */
|
|
15
11
|
export interface ThemeShadow {
|
|
16
12
|
umbra: ThemeBoxShadow
|
|
17
13
|
penumbra: ThemeBoxShadow
|
package/src/theme/v2/avatar.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import {ThemeColorAvatarColorKey, ThemeColorBlendModeKey} from './_system'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export interface ThemeColorAvatarHue_v2 {
|
|
7
5
|
_blend?: ThemeColorBlendModeKey
|
|
8
6
|
bg: string
|
|
9
7
|
fg: string
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
10
|
+
/** @public */
|
|
15
11
|
export type ThemeColorAvatar_v2 = Record<ThemeColorAvatarColorKey, ThemeColorAvatarHue_v2>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {ThemeColorStateToneKey} from './_system'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export interface ThemeColorBadgeTone_v2 {
|
|
7
5
|
bg: string
|
|
8
6
|
fg: string
|
|
@@ -10,7 +8,5 @@ export interface ThemeColorBadgeTone_v2 {
|
|
|
10
8
|
icon: string
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
11
|
+
/** @public */
|
|
16
12
|
export type ThemeColorBadge_v2 = Record<ThemeColorStateToneKey, ThemeColorBadgeTone_v2>
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import {ThemeColorButtonModeKey, ThemeColorStateKey, ThemeColorStateToneKey} from './_system'
|
|
2
2
|
import {ThemeColorState_v2} from './state'
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
4
|
+
/** @public */
|
|
7
5
|
export type ThemeColorButtonTone_v2 = Record<ThemeColorStateKey, ThemeColorState_v2>
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
7
|
+
/** @public */
|
|
12
8
|
export type ThemeColorButtonMode_v2 = Record<ThemeColorStateToneKey, ThemeColorButtonTone_v2>
|
|
13
9
|
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
10
|
+
/** @public */
|
|
17
11
|
export type ThemeColorButton_v2 = Record<ThemeColorButtonModeKey, ThemeColorButtonMode_v2>
|
|
@@ -6,9 +6,7 @@ import {ThemeColorShadow} from './shadow'
|
|
|
6
6
|
import {ThemeColorState_v2} from './state'
|
|
7
7
|
import {ThemeColorSyntax} from './syntax'
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
9
|
+
/** @public */
|
|
12
10
|
export interface ThemeColorCard_v2 extends ThemeColorState_v2 {
|
|
13
11
|
/** @internal */
|
|
14
12
|
_blend: ThemeColorBlendModeKey
|
|
@@ -23,12 +21,8 @@ export interface ThemeColorCard_v2 extends ThemeColorState_v2 {
|
|
|
23
21
|
syntax: ThemeColorSyntax
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
/**
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
24
|
+
/** @public */
|
|
29
25
|
export type ThemeColorScheme_v2 = Record<ThemeColorCardToneKey, ThemeColorCard_v2>
|
|
30
26
|
|
|
31
|
-
/**
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
27
|
+
/** @public */
|
|
34
28
|
export type ThemeColorSchemes_v2 = Record<ThemeColorSchemeKey, ThemeColorScheme_v2>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {ThemeColorBlendModeKey, ThemeColorInputModeKey, ThemeColorInputStateKey} from './_system'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export interface ThemeColorInputState_v2 {
|
|
7
5
|
_blend?: ThemeColorBlendModeKey
|
|
8
6
|
bg: string
|
|
@@ -14,12 +12,8 @@ export interface ThemeColorInputState_v2 {
|
|
|
14
12
|
placeholder: string
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
15
|
+
/** @public */
|
|
20
16
|
export type ThemeColorInputMode_v2 = Record<ThemeColorInputStateKey, ThemeColorInputState_v2>
|
|
21
17
|
|
|
22
|
-
/**
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
18
|
+
/** @public */
|
|
25
19
|
export type ThemeColorInput_v2 = Record<ThemeColorInputModeKey, ThemeColorInputMode_v2>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import {ThemeColorStateKey, ThemeColorStateToneKey} from './_system'
|
|
2
2
|
import {ThemeColorState_v2} from './state'
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
4
|
+
/** @public */
|
|
7
5
|
export type ThemeColorSelectableTone_v2 = Record<ThemeColorStateKey, ThemeColorState_v2>
|
|
8
6
|
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
7
|
+
/** @public */
|
|
12
8
|
export type ThemeColorSelectable_v2 = Record<ThemeColorStateToneKey, ThemeColorSelectableTone_v2>
|
|
@@ -3,9 +3,7 @@ import {ThemeColorAvatar_v2} from './avatar'
|
|
|
3
3
|
import {ThemeColorBadge_v2} from './badge'
|
|
4
4
|
import {ThemeColorKBD} from './kbd'
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
6
|
+
/** @public */
|
|
9
7
|
export interface ThemeColorState_v2 {
|
|
10
8
|
/** @internal */
|
|
11
9
|
_blend?: ThemeColorBlendModeKey
|
package/src/theme/v2/input.ts
CHANGED
package/src/theme/v2/theme.ts
CHANGED
|
@@ -7,9 +7,7 @@ import {ThemeAvatar_v2} from './avatar'
|
|
|
7
7
|
import {ThemeColorCard_v2, ThemeColorSchemes_v2} from './color'
|
|
8
8
|
import {ThemeInput_v2} from './input'
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
10
|
+
/** @public */
|
|
13
11
|
export interface RootTheme_v2 {
|
|
14
12
|
_version: 2
|
|
15
13
|
avatar: ThemeAvatar_v2
|
|
@@ -35,9 +33,7 @@ export interface RootTheme_v2 {
|
|
|
35
33
|
/** @internal */
|
|
36
34
|
style?: ThemeStyles
|
|
37
35
|
}
|
|
38
|
-
/**
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
36
|
+
/** @public */
|
|
41
37
|
export type Theme_v2 = Omit<RootTheme_v2, 'color'> & {
|
|
42
38
|
color: ThemeColorCard_v2
|
|
43
39
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {defaultThemeConfig} from '../defaults/config'
|
|
2
2
|
import {defaultThemeFonts} from '../defaults/fonts'
|
|
3
3
|
import {buildColor_v3} from './color/buildColor_v3'
|
|
4
|
-
import {defaultTokens} from './
|
|
4
|
+
import {defaultTokens} from './defaultTokens'
|
|
5
5
|
import {resolveTokens} from './resolveTokens'
|
|
6
6
|
import {Theme_v3, ThemeOptions} from './types'
|
|
7
7
|
|
|
8
|
+
/** @public */
|
|
8
9
|
export function buildTheme_v3(options?: ThemeOptions): Theme_v3 {
|
|
9
10
|
const {v2} = options ?? {}
|
|
10
11
|
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
ThemeColorStateToneKey,
|
|
7
7
|
} from '../../v2'
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** @public */
|
|
11
10
|
export interface ThemeColorElement {
|
|
12
11
|
_hue: Hue
|
|
13
12
|
bg: {
|
|
@@ -24,12 +23,13 @@ export interface ThemeColorElement {
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
|
|
26
|
+
/** @public */
|
|
27
27
|
export type ThemeColorVariant = Record<ThemeColorStateToneKey, ThemeColorElement>
|
|
28
28
|
|
|
29
|
+
/** @public */
|
|
29
30
|
export type ThemeColorVariantKey = 'tinted' | 'solid'
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
/** @public */
|
|
33
33
|
export interface ThemeColorCard_v3 {
|
|
34
34
|
_hue: Hue
|
|
35
35
|
avatar: ThemeColorAvatar_v2
|
|
@@ -90,9 +90,11 @@ export interface ThemeColorCard_v3 {
|
|
|
90
90
|
variant: Record<ThemeColorVariantKey, ThemeColorVariant>
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/** @public */
|
|
93
94
|
export interface ThemeColorScheme_v3 {
|
|
94
95
|
card: Record<ThemeColorCardToneKey, ThemeColorCard_v3>
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
/** @public */
|
|
97
99
|
// color[scheme].card[cardTone][colorVariant][elementTone][property][level]
|
|
98
100
|
export type ThemeColor_v3 = Record<ThemeColorSchemeKey, ThemeColorScheme_v3>
|
|
@@ -3,14 +3,17 @@ import {ThemeColorSchemeKey} from '../../v2'
|
|
|
3
3
|
import {parseColor} from './parseColor'
|
|
4
4
|
import {ColorToken} from './token'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/** @public */
|
|
7
|
+
export type CSSVariableKey = `--${string}`
|
|
7
8
|
|
|
9
|
+
/** @public */
|
|
8
10
|
export interface RenderColorContext {
|
|
9
11
|
bgVar: CSSVariableKey
|
|
10
12
|
hue: Hue
|
|
11
13
|
scheme: ThemeColorSchemeKey
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
/** @public */
|
|
14
17
|
export function renderColor(token: [ColorToken, ColorToken], context: RenderColorContext): string {
|
|
15
18
|
const {bgVar, hue, scheme} = context
|
|
16
19
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {PartialTokens, Tokens} from './tokens'
|
|
2
2
|
|
|
3
|
+
/** @internal */
|
|
3
4
|
export const defaultTokens: PartialTokens<Tokens> = {
|
|
4
5
|
color: {
|
|
5
6
|
'*': {
|
|
6
|
-
// backdrop: ['black/0.2', '200/0.2'],
|
|
7
7
|
backdrop: ['black/0.5', 'gray/100/0.5'],
|
|
8
8
|
code: {
|
|
9
9
|
bg: ['950', '50'],
|
|
@@ -61,7 +61,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
61
61
|
'*': {
|
|
62
62
|
bg: {
|
|
63
63
|
0: ['950', '50'],
|
|
64
|
-
4: ['
|
|
64
|
+
4: ['700', '300'],
|
|
65
65
|
},
|
|
66
66
|
border: {
|
|
67
67
|
0: ['700', '100'],
|
package/src/theme/v3/index.ts
CHANGED
|
@@ -52,48 +52,48 @@ function resolveCardColorTokens(
|
|
|
52
52
|
avatar: {
|
|
53
53
|
gray: {
|
|
54
54
|
_hue: tokens?.avatar?.gray?._hue ?? 'gray',
|
|
55
|
-
bg: tokens?.avatar?.gray?.bg ?? ['400', '
|
|
56
|
-
fg: tokens?.avatar?.gray?.fg ?? ['900', '
|
|
55
|
+
bg: tokens?.avatar?.gray?.bg ?? ['400', '500'],
|
|
56
|
+
fg: tokens?.avatar?.gray?.fg ?? ['900', 'white'],
|
|
57
57
|
},
|
|
58
58
|
blue: {
|
|
59
59
|
_hue: tokens?.avatar?.blue?._hue ?? 'blue',
|
|
60
|
-
bg: tokens?.avatar?.blue?.bg ?? ['400', '
|
|
61
|
-
fg: tokens?.avatar?.blue?.fg ?? ['900', '
|
|
60
|
+
bg: tokens?.avatar?.blue?.bg ?? ['400', '500'],
|
|
61
|
+
fg: tokens?.avatar?.blue?.fg ?? ['900', 'white'],
|
|
62
62
|
},
|
|
63
63
|
purple: {
|
|
64
64
|
_hue: tokens?.avatar?.purple?._hue ?? 'purple',
|
|
65
|
-
bg: tokens?.avatar?.purple?.bg ?? ['400', '
|
|
66
|
-
fg: tokens?.avatar?.purple?.fg ?? ['900', '
|
|
65
|
+
bg: tokens?.avatar?.purple?.bg ?? ['400', '500'],
|
|
66
|
+
fg: tokens?.avatar?.purple?.fg ?? ['900', 'white'],
|
|
67
67
|
},
|
|
68
68
|
magenta: {
|
|
69
69
|
_hue: tokens?.avatar?.magenta?._hue ?? 'magenta',
|
|
70
|
-
bg: tokens?.avatar?.magenta?.bg ?? ['400', '
|
|
71
|
-
fg: tokens?.avatar?.magenta?.fg ?? ['900', '
|
|
70
|
+
bg: tokens?.avatar?.magenta?.bg ?? ['400', '500'],
|
|
71
|
+
fg: tokens?.avatar?.magenta?.fg ?? ['900', 'white'],
|
|
72
72
|
},
|
|
73
73
|
red: {
|
|
74
74
|
_hue: tokens?.avatar?.red?._hue ?? 'red',
|
|
75
|
-
bg: tokens?.avatar?.red?.bg ?? ['400', '
|
|
76
|
-
fg: tokens?.avatar?.red?.fg ?? ['900', '
|
|
75
|
+
bg: tokens?.avatar?.red?.bg ?? ['400', '500'],
|
|
76
|
+
fg: tokens?.avatar?.red?.fg ?? ['900', 'white'],
|
|
77
77
|
},
|
|
78
78
|
orange: {
|
|
79
79
|
_hue: tokens?.avatar?.orange?._hue ?? 'orange',
|
|
80
|
-
bg: tokens?.avatar?.orange?.bg ?? ['400', '
|
|
81
|
-
fg: tokens?.avatar?.orange?.fg ?? ['900', '
|
|
80
|
+
bg: tokens?.avatar?.orange?.bg ?? ['400', '500'],
|
|
81
|
+
fg: tokens?.avatar?.orange?.fg ?? ['900', 'white'],
|
|
82
82
|
},
|
|
83
83
|
yellow: {
|
|
84
84
|
_hue: tokens?.avatar?.yellow?._hue ?? 'yellow',
|
|
85
|
-
bg: tokens?.avatar?.yellow?.bg ?? ['400', '
|
|
86
|
-
fg: tokens?.avatar?.yellow?.fg ?? ['900', '
|
|
85
|
+
bg: tokens?.avatar?.yellow?.bg ?? ['400', '500'],
|
|
86
|
+
fg: tokens?.avatar?.yellow?.fg ?? ['900', 'white'],
|
|
87
87
|
},
|
|
88
88
|
green: {
|
|
89
89
|
_hue: tokens?.avatar?.green?._hue ?? 'green',
|
|
90
|
-
bg: tokens?.avatar?.green?.bg ?? ['400', '
|
|
91
|
-
fg: tokens?.avatar?.green?.fg ?? ['900', '
|
|
90
|
+
bg: tokens?.avatar?.green?.bg ?? ['400', '500'],
|
|
91
|
+
fg: tokens?.avatar?.green?.fg ?? ['900', 'white'],
|
|
92
92
|
},
|
|
93
93
|
cyan: {
|
|
94
94
|
_hue: tokens?.avatar?.cyan?._hue ?? 'cyan',
|
|
95
|
-
bg: tokens?.avatar?.cyan?.bg ?? ['400', '
|
|
96
|
-
fg: tokens?.avatar?.cyan?.fg ?? ['900', '
|
|
95
|
+
bg: tokens?.avatar?.cyan?.bg ?? ['400', '500'],
|
|
96
|
+
fg: tokens?.avatar?.cyan?.fg ?? ['900', 'white'],
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
backdrop: tokens?.backdrop ?? ['900', '100'],
|