@sanity/ui 2.10.0-corel.0 → 3.0.0-static.0
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/bin/ui.js +6 -0
- package/dist/_chunks-cjs/buildCommand.js +2836 -0
- package/dist/_chunks-cjs/buildCommand.js.map +1 -0
- package/dist/_chunks-cjs/getTheme_v2.js +1 -27
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +1 -27
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +1 -27
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -0
- package/dist/css.d.mts +943 -0
- package/dist/css.d.ts +943 -0
- package/dist/css.esm.js +3135 -0
- package/dist/css.esm.js.map +1 -0
- package/dist/css.js +3135 -0
- package/dist/css.js.map +1 -0
- package/dist/css.mjs +3135 -0
- package/dist/css.mjs.map +1 -0
- package/dist/index.d.mts +175 -164
- package/dist/index.d.ts +175 -164
- package/dist/index.esm.js +864 -1955
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -1962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +864 -1955
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +25 -0
- package/dist/system.css +2953 -0
- package/dist/theme.d.mts +84 -22
- package/dist/theme.d.ts +84 -22
- package/dist/theme.esm.js +232 -283
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +232 -283
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +232 -283
- package/dist/theme.mjs.map +1 -1
- package/exports/css.ts +1 -0
- package/package.json +25 -4
- package/src/core/__workshop__/constants.ts +15 -15
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +12 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +14 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +14 -9
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +77 -92
- package/src/core/components/hotkeys/hotkeys.tsx +18 -29
- package/src/core/components/menu/menu.tsx +8 -5
- package/src/core/components/menu/menuDivider.ts +2 -1
- package/src/core/components/menu/menuGroup.tsx +16 -8
- package/src/core/components/menu/menuItem.tsx +23 -14
- package/src/core/components/skeleton/skeleton.tsx +1 -1
- package/src/core/components/skeleton/styles.ts +1 -1
- package/src/core/components/skeleton/textSkeleton.tsx +1 -1
- package/src/core/components/tab/tab.tsx +6 -7
- package/src/core/components/tab/tabList.tsx +3 -2
- package/src/core/components/toast/styles.ts +1 -1
- package/src/core/components/toast/toast.tsx +6 -4
- package/src/core/components/toast/toastProvider.tsx +31 -22
- package/src/core/components/tree/style.ts +1 -1
- package/src/core/components/tree/tree.tsx +8 -2
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +38 -25
- package/src/core/components/tree/types.ts +5 -1
- package/src/core/lib/styled/elements.ts +135 -0
- package/src/core/lib/styled/index.ts +2 -0
- package/src/core/lib/styled/members.ts +15 -0
- package/src/core/lib/styled/styled.ts +79 -0
- package/src/core/primitives/_selectable/selectable.tsx +27 -14
- package/src/core/primitives/avatar/avatar.tsx +52 -32
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +9 -16
- package/src/core/primitives/badge/badge.tsx +18 -20
- package/src/core/primitives/box/box.tsx +62 -74
- package/src/core/primitives/button/__workshop__/props.tsx +3 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/button.tsx +38 -45
- package/src/core/primitives/button/styles.ts +2 -2
- package/src/core/primitives/card/RootCardContext.ts +3 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +44 -46
- package/src/core/primitives/card/styles.ts +1 -1
- package/src/core/primitives/checkbox/checkbox.tsx +6 -8
- package/src/core/primitives/code/code.tsx +23 -12
- package/src/core/primitives/code/styles.ts +1 -1
- package/src/core/primitives/container/container.tsx +7 -15
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +6 -19
- package/src/core/primitives/grid/grid.tsx +2 -1
- package/src/core/primitives/heading/heading.tsx +32 -19
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +22 -13
- package/src/core/primitives/kbd/kbd.tsx +30 -37
- package/src/core/primitives/label/label.tsx +15 -4
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
- package/src/core/primitives/popover/popover.tsx +21 -15
- package/src/core/primitives/popover/popoverCard.tsx +36 -38
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +1 -1
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +1 -1
- package/src/core/primitives/spinner/spinner.tsx +6 -20
- package/src/core/primitives/stack/stack.tsx +12 -10
- package/src/core/primitives/switch/styles.ts +9 -9
- package/src/core/primitives/switch/switch.tsx +20 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -2
- package/src/core/primitives/text/text.tsx +17 -21
- package/src/core/primitives/textArea/textArea.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +176 -123
- package/src/core/primitives/tooltip/tooltip.test.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.tsx +13 -13
- package/src/core/primitives/tooltip/tooltipCard.tsx +15 -14
- package/src/core/primitives/types.ts +35 -16
- package/src/core/styles/border/borderStyle.ts +6 -0
- package/src/core/styles/border/types.ts +1 -0
- package/src/core/styles/box/boxStyle.ts +6 -0
- package/src/core/styles/card/_cardColorStyle.ts +0 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +0 -10
- package/src/core/styles/helpers.ts +9 -0
- package/src/core/styles/input/textInputStyle.ts +1 -1
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/types/avatar.ts +6 -1
- package/src/core/types/button.ts +1 -0
- package/src/core/types/flex.ts +27 -26
- package/src/core/types/gridItem.ts +32 -24
- package/src/core/types/radius.ts +7 -4
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +28 -11
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/_resp.ts +28 -0
- package/src/css/cli/buildCommand.ts +36 -0
- package/src/css/cli/index.ts +38 -0
- package/src/css/compile/comileRules.ts +59 -0
- package/src/css/compile/compileRule.ts +58 -0
- package/src/css/compile/compileSystem.ts +7 -0
- package/src/css/compile/compileTheme.ts +509 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -0
- package/src/css/components/breadcrumbs/index.ts +1 -0
- package/src/css/components/breadcrumbs/rules.ts +7 -0
- package/src/css/components/dialog/classes.ts +29 -0
- package/src/css/components/dialog/index.ts +1 -0
- package/src/css/components/dialog/rules.ts +75 -0
- package/src/css/components/tree/index.ts +1 -0
- package/src/css/components/tree/rules.ts +52 -0
- package/src/css/components/tree/tree.ts +5 -0
- package/src/css/composeClassNames.ts +3 -0
- package/src/css/index.ts +47 -0
- package/src/css/primitives/avatar/avatar.ts +32 -0
- package/src/css/primitives/avatar/index.ts +2 -0
- package/src/css/primitives/avatar/rules.ts +190 -0
- package/src/css/primitives/avatar/types.ts +9 -0
- package/src/css/primitives/badge/badge.ts +8 -0
- package/src/css/primitives/badge/index.ts +2 -0
- package/src/css/primitives/badge/rules.ts +25 -0
- package/src/css/primitives/badge/types.ts +8 -0
- package/src/css/primitives/box/box.ts +34 -0
- package/src/css/primitives/box/index.ts +2 -0
- package/src/css/primitives/box/rules.ts +25 -0
- package/src/css/primitives/box/types.ts +49 -0
- package/src/css/primitives/button/button.ts +26 -0
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/rules.ts +58 -0
- package/src/css/primitives/card/card.ts +21 -0
- package/src/css/primitives/card/index.ts +1 -0
- package/src/css/primitives/card/rules.ts +93 -0
- package/src/{core/primitives/checkbox/styles.ts → css/primitives/checkbox/__styles.ts} +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +9 -0
- package/src/css/primitives/checkbox/index.ts +1 -0
- package/src/css/primitives/checkbox/rules.ts +136 -0
- package/src/css/primitives/code/code.ts +9 -0
- package/src/css/primitives/code/index.ts +2 -0
- package/src/css/primitives/code/rules.ts +71 -0
- package/src/css/primitives/code/types.ts +10 -0
- package/src/css/primitives/container/container.ts +7 -0
- package/src/css/primitives/container/index.ts +2 -0
- package/src/css/primitives/container/rules.ts +8 -0
- package/src/css/primitives/container/types.ts +6 -0
- package/src/css/primitives/heading/heading.ts +16 -0
- package/src/css/primitives/heading/index.ts +2 -0
- package/src/css/primitives/heading/rules.ts +84 -0
- package/src/css/primitives/heading/types.ts +12 -0
- package/src/css/primitives/kbd/index.ts +2 -0
- package/src/css/primitives/kbd/kbd.ts +7 -0
- package/src/css/primitives/kbd/rules.ts +20 -0
- package/src/css/primitives/kbd/types.ts +5 -0
- package/src/css/primitives/label/index.ts +2 -0
- package/src/css/primitives/label/label.ts +16 -0
- package/src/css/primitives/label/rules.ts +85 -0
- package/src/css/primitives/label/types.ts +12 -0
- package/src/css/primitives/popover/index.ts +1 -0
- package/src/css/primitives/popover/popover.ts +5 -0
- package/src/css/primitives/popover/rules.ts +5 -0
- package/src/css/primitives/radio/index.ts +1 -0
- package/src/css/primitives/radio/radio.ts +5 -0
- package/src/css/primitives/radio/rules.ts +5 -0
- package/src/css/primitives/select/index.ts +1 -0
- package/src/css/primitives/select/rules.ts +5 -0
- package/src/css/primitives/select/select.ts +5 -0
- package/src/{core/primitives/_selectable/style.ts → css/primitives/selectable/__style.ts} +5 -4
- package/src/css/primitives/selectable/index.ts +2 -0
- package/src/css/primitives/selectable/rules.ts +27 -0
- package/src/css/primitives/selectable/selectable.ts +9 -0
- package/src/css/primitives/selectable/types.ts +6 -0
- package/src/css/primitives/spinner/index.ts +1 -0
- package/src/css/primitives/spinner/rules.ts +22 -0
- package/src/css/primitives/spinner/spinner.ts +5 -0
- package/src/css/primitives/switch/index.ts +1 -0
- package/src/css/primitives/switch/rules.ts +132 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/index.ts +2 -0
- package/src/css/primitives/text/rules.ts +75 -0
- package/src/css/primitives/text/text.ts +16 -0
- package/src/css/primitives/text/types.ts +11 -0
- package/src/css/primitives/textArea/index.ts +1 -0
- package/src/css/primitives/textArea/rules.ts +5 -0
- package/src/css/primitives/textArea/textArea.ts +5 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +226 -0
- package/src/css/primitives/textInput/textInput.ts +7 -0
- package/src/css/primitives/token/rules.ts +45 -0
- package/src/css/primitives/tooltip/index.ts +1 -0
- package/src/css/primitives/tooltip/rules.ts +17 -0
- package/src/css/primitives/tooltip/tooltip.ts +9 -0
- package/src/css/responsiveRules.ts +25 -0
- package/src/css/rules.ts +121 -0
- package/src/css/styles/border/border.ts +22 -0
- package/src/css/styles/border/index.ts +2 -0
- package/src/css/styles/border/rules.ts +24 -0
- package/src/css/styles/border/types.ts +10 -0
- package/src/css/styles/display/rules.ts +62 -0
- package/src/css/styles/flex/flex.ts +20 -0
- package/src/css/styles/flex/index.ts +2 -0
- package/src/css/styles/flex/rules.ts +28 -0
- package/src/css/styles/flex/types.ts +35 -0
- package/src/css/styles/flexItem/flexItem.ts +8 -0
- package/src/css/styles/flexItem/index.ts +2 -0
- package/src/css/styles/flexItem/rules.ts +11 -0
- package/src/css/styles/flexItem/types.ts +11 -0
- package/src/css/styles/font/font.ts +12 -0
- package/src/css/styles/font/index.ts +2 -0
- package/src/css/styles/font/rules.ts +125 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/gap.ts +8 -0
- package/src/css/styles/gap/index.ts +2 -0
- package/src/css/styles/gap/rules.ts +33 -0
- package/src/css/styles/gap/types.ts +9 -0
- package/src/css/styles/grid/rules.ts +35 -0
- package/src/css/styles/gridItem/gridItem.ts +15 -0
- package/src/css/styles/gridItem/index.ts +2 -0
- package/src/css/styles/gridItem/rules.ts +96 -0
- package/src/css/styles/gridItem/types.ts +41 -0
- package/src/css/styles/height/rules.ts +7 -0
- package/src/css/styles/margin/index.ts +2 -0
- package/src/css/styles/margin/margin.ts +15 -0
- package/src/css/styles/margin/rules.ts +59 -0
- package/src/css/styles/margin/types.ts +11 -0
- package/src/css/styles/maxWidth/index.ts +2 -0
- package/src/css/styles/maxWidth/maxWidth.ts +6 -0
- package/src/css/styles/maxWidth/rules.ts +36 -0
- package/src/css/styles/maxWidth/types.ts +6 -0
- package/src/css/styles/overflow/rules.ts +9 -0
- package/src/css/styles/padding/index.ts +2 -0
- package/src/css/styles/padding/padding.ts +15 -0
- package/src/css/styles/padding/rules.ts +59 -0
- package/src/css/styles/padding/types.ts +12 -0
- package/src/css/styles/pointerEvents/index.ts +2 -0
- package/src/css/styles/pointerEvents/pointerEvents.ts +6 -0
- package/src/css/styles/pointerEvents/rules.ts +11 -0
- package/src/css/styles/pointerEvents/types.ts +7 -0
- package/src/css/styles/position/index.ts +2 -0
- package/src/css/styles/position/position.ts +7 -0
- package/src/css/styles/position/rules.ts +31 -0
- package/src/css/styles/position/types.ts +13 -0
- package/src/css/styles/radius/index.ts +2 -0
- package/src/css/styles/radius/radius.ts +8 -0
- package/src/css/styles/radius/rules.ts +13 -0
- package/src/css/styles/radius/types.ts +7 -0
- package/src/css/styles/shadow/rules.ts +53 -0
- package/src/css/styles/width/index.ts +2 -0
- package/src/css/styles/width/rules.ts +7 -0
- package/src/css/styles/width/types.ts +8 -0
- package/src/css/styles/width/width.ts +6 -0
- package/src/css/types.ts +591 -0
- package/src/css/varNames.ts +381 -0
- package/src/css/vars.ts +313 -0
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +39 -45
- package/src/theme/build/renderColorTheme.ts +65 -239
- package/src/theme/build/resolveColorTokens.ts +115 -51
- package/src/theme/config/tokens/color/types.ts +18 -4
- package/src/theme/defaults/colorTokens.ts +10 -17
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +2 -9
- package/src/theme/system/_constants.ts +25 -0
- package/src/theme/system/_types.ts +41 -0
- package/src/theme/system/color/_constants.ts +0 -8
- package/src/theme/system/color/badge.ts +7 -3
- package/src/theme/system/index.ts +2 -0
- package/src/theme/system/v0/color/_system.ts +4 -8
- package/src/theme/system/v0/color/color.ts +2 -3
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -26
- package/src/theme/versioning/v0_v2.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/styles.ts +0 -76
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {ThemeColorPalette, ThemeConfig} from '../config'
|
|
2
2
|
import {defaultColorPalette} from '../defaults/colorPalette'
|
|
3
3
|
import {
|
|
4
|
-
THEME_COLOR_STATE_TONES,
|
|
5
4
|
ThemeColorAvatar_v2,
|
|
6
5
|
ThemeColorBadgeTone_v2,
|
|
7
6
|
ThemeColorBadge_v2,
|
|
@@ -32,18 +31,15 @@ export function renderThemeColorSchemes(
|
|
|
32
31
|
const colorPalette = config?.palette ?? defaultColorPalette
|
|
33
32
|
|
|
34
33
|
return {
|
|
35
|
-
light: renderThemeColorScheme(colorPalette, value.light
|
|
36
|
-
dark: renderThemeColorScheme(colorPalette, value.dark
|
|
34
|
+
light: renderThemeColorScheme(colorPalette, value.light),
|
|
35
|
+
dark: renderThemeColorScheme(colorPalette, value.dark),
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
function renderThemeColorScheme(
|
|
41
40
|
colorPalette: ThemeColorPalette,
|
|
42
41
|
value: ThemeColorScheme_v2,
|
|
43
|
-
options: {debugPath: string},
|
|
44
42
|
): ThemeColorScheme_v2 {
|
|
45
|
-
const {debugPath} = options
|
|
46
|
-
|
|
47
43
|
const toneEntries = Object.entries(value) as [ThemeColorCardToneKey, ThemeColorCard_v2][]
|
|
48
44
|
|
|
49
45
|
const [, transparentTone] = toneEntries.find(([k]) => k === 'transparent')!
|
|
@@ -52,14 +48,8 @@ function renderThemeColorScheme(
|
|
|
52
48
|
// The `transparent` and `default` tones are special cases, so we render them first
|
|
53
49
|
// (rendered without a `bg` option).
|
|
54
50
|
// But the rest of the tones are rendered on top of the `default` tone's `bg`.
|
|
55
|
-
const renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
56
|
-
|
|
57
|
-
debugPath: `${debugPath}.transparent`,
|
|
58
|
-
})
|
|
59
|
-
const renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
60
|
-
colorPalette,
|
|
61
|
-
debugPath: `${debugPath}.default`,
|
|
62
|
-
})
|
|
51
|
+
const renderedTransparentTone = renderThemeColor(transparentTone, {colorPalette})
|
|
52
|
+
const renderedDefaultTone = renderThemeColor(defaultTone, {colorPalette})
|
|
63
53
|
|
|
64
54
|
// Get the `default` tone's `bg` property
|
|
65
55
|
const bg = renderedDefaultTone.bg
|
|
@@ -73,14 +63,7 @@ function renderThemeColorScheme(
|
|
|
73
63
|
['default', renderedDefaultTone],
|
|
74
64
|
...toneEntries
|
|
75
65
|
.filter(([k]) => k !== 'default' && k !== 'transparent')
|
|
76
|
-
.map(([k, v]) => [
|
|
77
|
-
k,
|
|
78
|
-
renderThemeColor(v, {
|
|
79
|
-
bg,
|
|
80
|
-
colorPalette,
|
|
81
|
-
debugPath: `${debugPath}.${k}`,
|
|
82
|
-
}),
|
|
83
|
-
]),
|
|
66
|
+
.map(([k, v]) => [k, renderThemeColor(v, {bg, colorPalette})]),
|
|
84
67
|
]) as ThemeColorScheme_v2
|
|
85
68
|
}
|
|
86
69
|
|
|
@@ -89,12 +72,10 @@ function renderThemeColor(
|
|
|
89
72
|
options: {
|
|
90
73
|
bg?: string
|
|
91
74
|
colorPalette: ThemeColorPalette
|
|
92
|
-
debugPath: string
|
|
93
75
|
},
|
|
94
76
|
): ThemeColorCard_v2 {
|
|
95
|
-
const {colorPalette, bg
|
|
77
|
+
const {colorPalette, bg} = options
|
|
96
78
|
const blendMode = value._blend || 'multiply'
|
|
97
|
-
|
|
98
79
|
const baseBg = renderColorValue(value.bg, {colorPalette, bg, blendMode})
|
|
99
80
|
const colorOptions: RenderColorValueOptions = {colorPalette, bg: baseBg, blendMode}
|
|
100
81
|
|
|
@@ -102,14 +83,12 @@ function renderThemeColor(
|
|
|
102
83
|
baseBg,
|
|
103
84
|
blendMode,
|
|
104
85
|
colorPalette,
|
|
105
|
-
debugPath: `${debugPath}.button`,
|
|
106
86
|
})
|
|
107
87
|
|
|
108
88
|
const selectable = renderThemeColorSelectable(value.selectable, {
|
|
109
89
|
colorPalette,
|
|
110
90
|
baseBg,
|
|
111
91
|
blendMode,
|
|
112
|
-
debugPath: `${debugPath}.selectable`,
|
|
113
92
|
})
|
|
114
93
|
|
|
115
94
|
const shadow: ThemeColorShadow = {
|
|
@@ -137,19 +116,9 @@ function renderThemeColor(
|
|
|
137
116
|
accent: {
|
|
138
117
|
fg: renderColorValue(value.accent.fg, colorOptions),
|
|
139
118
|
},
|
|
140
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
141
|
-
baseBg,
|
|
142
|
-
colorPalette,
|
|
143
|
-
blendMode,
|
|
144
|
-
debugPath: `${debugPath}.avatar`,
|
|
145
|
-
}),
|
|
119
|
+
avatar: renderThemeColorAvatar(value.avatar, {baseBg, colorPalette, blendMode}),
|
|
146
120
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
147
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
148
|
-
baseBg,
|
|
149
|
-
colorPalette,
|
|
150
|
-
blendMode,
|
|
151
|
-
debugPath: `${debugPath}.badge`,
|
|
152
|
-
}),
|
|
121
|
+
badge: renderThemeColorBadge(value.badge, {baseBg, colorPalette, blendMode}),
|
|
153
122
|
bg: baseBg,
|
|
154
123
|
border: renderColorValue(value.border, colorOptions),
|
|
155
124
|
button,
|
|
@@ -160,18 +129,8 @@ function renderThemeColor(
|
|
|
160
129
|
fg: renderColorValue(value.fg, colorOptions),
|
|
161
130
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
162
131
|
icon: renderColorValue(value.icon, colorOptions),
|
|
163
|
-
input: renderThemeColorInput(value.input, {
|
|
164
|
-
|
|
165
|
-
colorPalette,
|
|
166
|
-
blendMode,
|
|
167
|
-
debugPath: `${debugPath}.input`,
|
|
168
|
-
}),
|
|
169
|
-
kbd: renderThemeColorKBD(value.kbd, {
|
|
170
|
-
baseBg,
|
|
171
|
-
colorPalette,
|
|
172
|
-
blendMode,
|
|
173
|
-
debugPath: `${debugPath}.kbd`,
|
|
174
|
-
}),
|
|
132
|
+
input: renderThemeColorInput(value.input, {baseBg, colorPalette, blendMode}),
|
|
133
|
+
kbd: renderThemeColorKBD(value.kbd, {baseBg, colorPalette, blendMode}),
|
|
175
134
|
link: {
|
|
176
135
|
fg: renderColorValue(value.link.fg, colorOptions),
|
|
177
136
|
},
|
|
@@ -184,12 +143,7 @@ function renderThemeColor(
|
|
|
184
143
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
185
144
|
to: renderColorValue(value.skeleton.to, colorOptions),
|
|
186
145
|
},
|
|
187
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
188
|
-
baseBg,
|
|
189
|
-
colorPalette,
|
|
190
|
-
blendMode,
|
|
191
|
-
debugPath: `${debugPath}.syntax`,
|
|
192
|
-
}),
|
|
146
|
+
syntax: renderSyntaxColorTheme(value.syntax, {baseBg, colorPalette, blendMode}),
|
|
193
147
|
selectable,
|
|
194
148
|
}
|
|
195
149
|
}
|
|
@@ -200,7 +154,6 @@ function renderThemeColorKBD(
|
|
|
200
154
|
baseBg: string
|
|
201
155
|
blendMode: ThemeColorBlendModeKey
|
|
202
156
|
colorPalette: ThemeColorPalette
|
|
203
|
-
debugPath: string
|
|
204
157
|
},
|
|
205
158
|
): ThemeColorKBD {
|
|
206
159
|
const {baseBg, blendMode, colorPalette} = options
|
|
@@ -232,48 +185,18 @@ function renderThemeColorAvatar(
|
|
|
232
185
|
baseBg: string
|
|
233
186
|
blendMode: ThemeColorBlendModeKey
|
|
234
187
|
colorPalette: ThemeColorPalette
|
|
235
|
-
debugPath: string
|
|
236
188
|
},
|
|
237
189
|
): ThemeColorAvatar_v2 {
|
|
238
|
-
const {debugPath} = options
|
|
239
|
-
|
|
240
190
|
return {
|
|
241
|
-
gray: renderThemeColorAvatarColor(value.gray,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
...options,
|
|
251
|
-
debugPath: `${debugPath}.purple`,
|
|
252
|
-
}),
|
|
253
|
-
magenta: renderThemeColorAvatarColor(value.magenta, {
|
|
254
|
-
...options,
|
|
255
|
-
debugPath: `${debugPath}.magenta`,
|
|
256
|
-
}),
|
|
257
|
-
red: renderThemeColorAvatarColor(value.red, {
|
|
258
|
-
...options,
|
|
259
|
-
debugPath: `${debugPath}.red`,
|
|
260
|
-
}),
|
|
261
|
-
orange: renderThemeColorAvatarColor(value.orange, {
|
|
262
|
-
...options,
|
|
263
|
-
debugPath: `${debugPath}.orange`,
|
|
264
|
-
}),
|
|
265
|
-
yellow: renderThemeColorAvatarColor(value.yellow, {
|
|
266
|
-
...options,
|
|
267
|
-
debugPath: `${debugPath}.yellow`,
|
|
268
|
-
}),
|
|
269
|
-
green: renderThemeColorAvatarColor(value.green, {
|
|
270
|
-
...options,
|
|
271
|
-
debugPath: `${debugPath}.green`,
|
|
272
|
-
}),
|
|
273
|
-
cyan: renderThemeColorAvatarColor(value.cyan, {
|
|
274
|
-
...options,
|
|
275
|
-
debugPath: `${debugPath}.cyan`,
|
|
276
|
-
}),
|
|
191
|
+
gray: renderThemeColorAvatarColor(value.gray, options),
|
|
192
|
+
blue: renderThemeColorAvatarColor(value.blue, options),
|
|
193
|
+
purple: renderThemeColorAvatarColor(value.purple, options),
|
|
194
|
+
magenta: renderThemeColorAvatarColor(value.magenta, options),
|
|
195
|
+
red: renderThemeColorAvatarColor(value.red, options),
|
|
196
|
+
orange: renderThemeColorAvatarColor(value.orange, options),
|
|
197
|
+
yellow: renderThemeColorAvatarColor(value.yellow, options),
|
|
198
|
+
green: renderThemeColorAvatarColor(value.green, options),
|
|
199
|
+
cyan: renderThemeColorAvatarColor(value.cyan, options),
|
|
277
200
|
}
|
|
278
201
|
}
|
|
279
202
|
|
|
@@ -283,7 +206,6 @@ function renderThemeColorAvatarColor(
|
|
|
283
206
|
baseBg: string
|
|
284
207
|
blendMode: ThemeColorBlendModeKey
|
|
285
208
|
colorPalette: ThemeColorPalette
|
|
286
|
-
debugPath: string
|
|
287
209
|
},
|
|
288
210
|
): ThemeColorAvatar_v2['gray'] {
|
|
289
211
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
@@ -316,19 +238,15 @@ function renderThemeColorBadge(
|
|
|
316
238
|
baseBg: string
|
|
317
239
|
blendMode: ThemeColorBlendModeKey
|
|
318
240
|
colorPalette: ThemeColorPalette
|
|
319
|
-
debugPath: string
|
|
320
241
|
},
|
|
321
242
|
): ThemeColorBadge_v2 {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return acc
|
|
331
|
-
}, {} as ThemeColorBadge_v2)
|
|
243
|
+
return {
|
|
244
|
+
default: renderThemeColorBadgeColor(value.default, options),
|
|
245
|
+
primary: renderThemeColorBadgeColor(value.primary, options),
|
|
246
|
+
positive: renderThemeColorBadgeColor(value.positive, options),
|
|
247
|
+
caution: renderThemeColorBadgeColor(value.caution, options),
|
|
248
|
+
critical: renderThemeColorBadgeColor(value.critical, options),
|
|
249
|
+
}
|
|
332
250
|
}
|
|
333
251
|
|
|
334
252
|
function renderThemeColorBadgeColor(
|
|
@@ -337,11 +255,12 @@ function renderThemeColorBadgeColor(
|
|
|
337
255
|
baseBg: string
|
|
338
256
|
blendMode: ThemeColorBlendModeKey
|
|
339
257
|
colorPalette: ThemeColorPalette
|
|
340
|
-
debugPath: string
|
|
341
258
|
},
|
|
342
259
|
): ThemeColorBadgeTone_v2 {
|
|
343
260
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
344
261
|
|
|
262
|
+
// const blendMode = value._blend || 'multiply'
|
|
263
|
+
|
|
345
264
|
const blendMode = rootBlendMode
|
|
346
265
|
|
|
347
266
|
const rootOptions: RenderColorValueOptions = {
|
|
@@ -372,24 +291,12 @@ function renderThemeColorButton(
|
|
|
372
291
|
baseBg: string
|
|
373
292
|
blendMode: ThemeColorBlendModeKey
|
|
374
293
|
colorPalette: ThemeColorPalette
|
|
375
|
-
debugPath: string
|
|
376
294
|
},
|
|
377
295
|
): ThemeColorButton_v2 {
|
|
378
|
-
const {debugPath} = options
|
|
379
|
-
|
|
380
296
|
return {
|
|
381
|
-
default: renderThemeColorButtonTones(value.default,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}),
|
|
385
|
-
ghost: renderThemeColorButtonTones(value.ghost, {
|
|
386
|
-
...options,
|
|
387
|
-
debugPath: `${debugPath}.ghost`,
|
|
388
|
-
}),
|
|
389
|
-
bleed: renderThemeColorButtonTones(value.bleed, {
|
|
390
|
-
...options,
|
|
391
|
-
debugPath: `${debugPath}.bleed`,
|
|
392
|
-
}),
|
|
297
|
+
default: renderThemeColorButtonTones(value.default, options),
|
|
298
|
+
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
299
|
+
bleed: renderThemeColorButtonTones(value.bleed, options),
|
|
393
300
|
}
|
|
394
301
|
}
|
|
395
302
|
|
|
@@ -399,19 +306,15 @@ function renderThemeColorButtonTones(
|
|
|
399
306
|
baseBg: string
|
|
400
307
|
blendMode: ThemeColorBlendModeKey
|
|
401
308
|
colorPalette: ThemeColorPalette
|
|
402
|
-
debugPath: string
|
|
403
309
|
},
|
|
404
310
|
): ThemeColorButtonMode_v2 {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return acc
|
|
414
|
-
}, {} as ThemeColorButtonMode_v2)
|
|
311
|
+
return {
|
|
312
|
+
default: renderThemeColorButtonStates(value.default, options),
|
|
313
|
+
primary: renderThemeColorButtonStates(value.primary, options),
|
|
314
|
+
positive: renderThemeColorButtonStates(value.positive, options),
|
|
315
|
+
caution: renderThemeColorButtonStates(value.caution, options),
|
|
316
|
+
critical: renderThemeColorButtonStates(value.critical, options),
|
|
317
|
+
}
|
|
415
318
|
}
|
|
416
319
|
|
|
417
320
|
function renderThemeColorButtonStates(
|
|
@@ -420,32 +323,14 @@ function renderThemeColorButtonStates(
|
|
|
420
323
|
baseBg: string
|
|
421
324
|
blendMode: ThemeColorBlendModeKey
|
|
422
325
|
colorPalette: ThemeColorPalette
|
|
423
|
-
debugPath: string
|
|
424
326
|
},
|
|
425
327
|
): ThemeColorButtonTone_v2 {
|
|
426
|
-
const {debugPath} = options
|
|
427
|
-
|
|
428
328
|
return {
|
|
429
|
-
enabled: renderThemeColorState(value.enabled,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
...options,
|
|
435
|
-
debugPath: `${debugPath}.hovered`,
|
|
436
|
-
}),
|
|
437
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
438
|
-
...options,
|
|
439
|
-
debugPath: `${debugPath}.pressed`,
|
|
440
|
-
}),
|
|
441
|
-
selected: renderThemeColorState(value.selected, {
|
|
442
|
-
...options,
|
|
443
|
-
debugPath: `${debugPath}.selected`,
|
|
444
|
-
}),
|
|
445
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
446
|
-
...options,
|
|
447
|
-
debugPath: `${debugPath}.disabled`,
|
|
448
|
-
}),
|
|
329
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
330
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
331
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
332
|
+
selected: renderThemeColorState(value.selected, options),
|
|
333
|
+
disabled: renderThemeColorState(value.disabled, options),
|
|
449
334
|
}
|
|
450
335
|
}
|
|
451
336
|
|
|
@@ -455,10 +340,9 @@ function renderThemeColorState(
|
|
|
455
340
|
baseBg: string
|
|
456
341
|
blendMode: ThemeColorBlendModeKey
|
|
457
342
|
colorPalette: ThemeColorPalette
|
|
458
|
-
debugPath: string
|
|
459
343
|
},
|
|
460
344
|
): ThemeColorState_v2 {
|
|
461
|
-
const {baseBg, blendMode: rootBlendMode, colorPalette
|
|
345
|
+
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
462
346
|
const blendMode = value._blend || 'multiply'
|
|
463
347
|
|
|
464
348
|
const rootOptions: RenderColorValueOptions = {
|
|
@@ -480,18 +364,8 @@ function renderThemeColorState(
|
|
|
480
364
|
accent: {
|
|
481
365
|
fg: renderColorValue(value.accent.fg, colorOptions),
|
|
482
366
|
},
|
|
483
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
484
|
-
|
|
485
|
-
colorPalette,
|
|
486
|
-
blendMode,
|
|
487
|
-
debugPath: `${debugPath}.avatar`,
|
|
488
|
-
}),
|
|
489
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
490
|
-
baseBg: bg,
|
|
491
|
-
colorPalette,
|
|
492
|
-
blendMode,
|
|
493
|
-
debugPath: `${debugPath}.badge`,
|
|
494
|
-
}),
|
|
367
|
+
avatar: renderThemeColorAvatar(value.avatar, {baseBg: bg, colorPalette, blendMode}),
|
|
368
|
+
badge: renderThemeColorBadge(value.badge, {baseBg: bg, colorPalette, blendMode}),
|
|
495
369
|
bg,
|
|
496
370
|
border: renderColorValue(value.border, colorOptions),
|
|
497
371
|
code: {
|
|
@@ -525,20 +399,11 @@ function renderThemeColorInput(
|
|
|
525
399
|
baseBg: string
|
|
526
400
|
blendMode: ThemeColorBlendModeKey
|
|
527
401
|
colorPalette: ThemeColorPalette
|
|
528
|
-
debugPath: string
|
|
529
402
|
},
|
|
530
403
|
): ThemeColorInput_v2 {
|
|
531
|
-
const {debugPath} = options
|
|
532
|
-
|
|
533
404
|
return {
|
|
534
|
-
default: renderInputStatesColorTheme(value.default,
|
|
535
|
-
|
|
536
|
-
debugPath: `${debugPath}.default`,
|
|
537
|
-
}),
|
|
538
|
-
invalid: renderInputStatesColorTheme(value.invalid, {
|
|
539
|
-
...options,
|
|
540
|
-
debugPath: `${debugPath}.invalid`,
|
|
541
|
-
}),
|
|
405
|
+
default: renderInputStatesColorTheme(value.default, options),
|
|
406
|
+
invalid: renderInputStatesColorTheme(value.invalid, options),
|
|
542
407
|
}
|
|
543
408
|
}
|
|
544
409
|
|
|
@@ -548,28 +413,13 @@ function renderInputStatesColorTheme(
|
|
|
548
413
|
baseBg: string
|
|
549
414
|
blendMode: ThemeColorBlendModeKey
|
|
550
415
|
colorPalette: ThemeColorPalette
|
|
551
|
-
debugPath: string
|
|
552
416
|
},
|
|
553
417
|
): ThemeColorInputMode_v2 {
|
|
554
|
-
const {debugPath} = options
|
|
555
|
-
|
|
556
418
|
return {
|
|
557
|
-
enabled: renderInputStateColorTheme(value.enabled,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
hovered: renderInputStateColorTheme(value.hovered, {
|
|
562
|
-
...options,
|
|
563
|
-
debugPath: `${debugPath}.hovered`,
|
|
564
|
-
}),
|
|
565
|
-
readOnly: renderInputStateColorTheme(value.readOnly, {
|
|
566
|
-
...options,
|
|
567
|
-
debugPath: `${debugPath}.readOnly`,
|
|
568
|
-
}),
|
|
569
|
-
disabled: renderInputStateColorTheme(value.disabled, {
|
|
570
|
-
...options,
|
|
571
|
-
debugPath: `${debugPath}.disabled`,
|
|
572
|
-
}),
|
|
419
|
+
enabled: renderInputStateColorTheme(value.enabled, options),
|
|
420
|
+
hovered: renderInputStateColorTheme(value.hovered, options),
|
|
421
|
+
readOnly: renderInputStateColorTheme(value.readOnly, options),
|
|
422
|
+
disabled: renderInputStateColorTheme(value.disabled, options),
|
|
573
423
|
}
|
|
574
424
|
}
|
|
575
425
|
|
|
@@ -579,7 +429,6 @@ function renderInputStateColorTheme(
|
|
|
579
429
|
baseBg: string
|
|
580
430
|
blendMode: ThemeColorBlendModeKey
|
|
581
431
|
colorPalette: ThemeColorPalette
|
|
582
|
-
debugPath: string
|
|
583
432
|
},
|
|
584
433
|
): ThemeColorInputState_v2 {
|
|
585
434
|
const {baseBg, blendMode: rootBlendMode, colorPalette} = options
|
|
@@ -606,19 +455,15 @@ function renderThemeColorSelectable(
|
|
|
606
455
|
baseBg: string
|
|
607
456
|
blendMode: ThemeColorBlendModeKey
|
|
608
457
|
colorPalette: ThemeColorPalette
|
|
609
|
-
debugPath: string
|
|
610
458
|
},
|
|
611
459
|
): ThemeColorSelectable_v2 {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return acc
|
|
621
|
-
}, {} as ThemeColorSelectable_v2)
|
|
460
|
+
return {
|
|
461
|
+
default: renderThemeColorSelectableStates(value.default, options),
|
|
462
|
+
primary: renderThemeColorSelectableStates(value.primary, options),
|
|
463
|
+
positive: renderThemeColorSelectableStates(value.positive, options),
|
|
464
|
+
caution: renderThemeColorSelectableStates(value.caution, options),
|
|
465
|
+
critical: renderThemeColorSelectableStates(value.critical, options),
|
|
466
|
+
}
|
|
622
467
|
}
|
|
623
468
|
|
|
624
469
|
function renderThemeColorSelectableStates(
|
|
@@ -627,32 +472,14 @@ function renderThemeColorSelectableStates(
|
|
|
627
472
|
baseBg: string
|
|
628
473
|
blendMode: ThemeColorBlendModeKey
|
|
629
474
|
colorPalette: ThemeColorPalette
|
|
630
|
-
debugPath: string
|
|
631
475
|
},
|
|
632
476
|
): ThemeColorSelectableTone_v2 {
|
|
633
|
-
const {debugPath} = options
|
|
634
|
-
|
|
635
477
|
return {
|
|
636
|
-
enabled: renderThemeColorState(value.enabled,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
...options,
|
|
642
|
-
debugPath: `${debugPath}.hovered`,
|
|
643
|
-
}),
|
|
644
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
645
|
-
...options,
|
|
646
|
-
debugPath: `${debugPath}.pressed`,
|
|
647
|
-
}),
|
|
648
|
-
selected: renderThemeColorState(value.selected, {
|
|
649
|
-
...options,
|
|
650
|
-
debugPath: `${debugPath}.selected`,
|
|
651
|
-
}),
|
|
652
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
653
|
-
...options,
|
|
654
|
-
debugPath: `${debugPath}.disabled`,
|
|
655
|
-
}),
|
|
478
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
479
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
480
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
481
|
+
selected: renderThemeColorState(value.selected, options),
|
|
482
|
+
disabled: renderThemeColorState(value.disabled, options),
|
|
656
483
|
}
|
|
657
484
|
}
|
|
658
485
|
|
|
@@ -662,7 +489,6 @@ function renderSyntaxColorTheme(
|
|
|
662
489
|
baseBg: string
|
|
663
490
|
blendMode: ThemeColorBlendModeKey
|
|
664
491
|
colorPalette: ThemeColorPalette
|
|
665
|
-
debugPath: string
|
|
666
492
|
},
|
|
667
493
|
): ThemeColorSyntax {
|
|
668
494
|
const {colorPalette, baseBg, blendMode} = options
|