@sanity/ui 2.9.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
package/dist/theme.mjs
CHANGED
|
@@ -952,9 +952,7 @@ function v0_v2(v0) {
|
|
|
952
952
|
primary: themeColor_v0_v2(color2.light.primary),
|
|
953
953
|
positive: themeColor_v0_v2(color2.light.positive),
|
|
954
954
|
caution: themeColor_v0_v2(color2.light.caution),
|
|
955
|
-
critical: themeColor_v0_v2(color2.light.critical)
|
|
956
|
-
prospect: themeColor_v0_v2(color2.light.default),
|
|
957
|
-
explore: themeColor_v0_v2(color2.light.default)
|
|
955
|
+
critical: themeColor_v0_v2(color2.light.critical)
|
|
958
956
|
},
|
|
959
957
|
dark: {
|
|
960
958
|
transparent: themeColor_v0_v2(color2.dark.transparent),
|
|
@@ -962,9 +960,7 @@ function v0_v2(v0) {
|
|
|
962
960
|
primary: themeColor_v0_v2(color2.dark.primary),
|
|
963
961
|
positive: themeColor_v0_v2(color2.dark.positive),
|
|
964
962
|
caution: themeColor_v0_v2(color2.dark.caution),
|
|
965
|
-
critical: themeColor_v0_v2(color2.dark.critical)
|
|
966
|
-
prospect: themeColor_v0_v2(color2.dark.default),
|
|
967
|
-
explore: themeColor_v0_v2(color2.dark.default)
|
|
963
|
+
critical: themeColor_v0_v2(color2.dark.critical)
|
|
968
964
|
}
|
|
969
965
|
},
|
|
970
966
|
container,
|
|
@@ -1101,25 +1097,19 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1101
1097
|
placeholder: t.placeholder
|
|
1102
1098
|
};
|
|
1103
1099
|
}
|
|
1104
|
-
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1100
|
+
const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5], RADIUS = [0, 1, 2, 3, 4, 5, 6, "full"], SPACE = [0, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9], FONT_CODE_SIZE = [0, 1, 2, 3, 4, 5], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5, 6], FONT_TEXT_SIZE = [0, 1, 2, 3, 4, 5], SHADOW = [0, 1, 2, 3, 4, 5], THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1105
1101
|
"transparent",
|
|
1106
1102
|
"default",
|
|
1107
1103
|
"primary",
|
|
1108
1104
|
"positive",
|
|
1109
1105
|
"caution",
|
|
1110
|
-
"critical"
|
|
1111
|
-
// new
|
|
1112
|
-
"prospect",
|
|
1113
|
-
"explore"
|
|
1106
|
+
"critical"
|
|
1114
1107
|
], THEME_COLOR_STATE_TONES = [
|
|
1115
1108
|
"default",
|
|
1116
1109
|
"primary",
|
|
1117
1110
|
"positive",
|
|
1118
1111
|
"caution",
|
|
1119
|
-
"critical"
|
|
1120
|
-
// new
|
|
1121
|
-
"prospect",
|
|
1122
|
-
"explore"
|
|
1112
|
+
"critical"
|
|
1123
1113
|
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1124
1114
|
function isColorBlendModeValue(str) {
|
|
1125
1115
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
@@ -1352,9 +1342,6 @@ const defaultColorTokens = {
|
|
|
1352
1342
|
icon: ["500", "500"],
|
|
1353
1343
|
dot: ["500", "500"]
|
|
1354
1344
|
},
|
|
1355
|
-
default: {
|
|
1356
|
-
_hue: "gray"
|
|
1357
|
-
},
|
|
1358
1345
|
positive: {
|
|
1359
1346
|
bg: ["200 50%", "900"],
|
|
1360
1347
|
fg: ["600", "500"]
|
|
@@ -1371,7 +1358,7 @@ const defaultColorTokens = {
|
|
|
1371
1358
|
fg: ["600", "400"]
|
|
1372
1359
|
},
|
|
1373
1360
|
fg: ["800", "200"],
|
|
1374
|
-
focusRing: ["
|
|
1361
|
+
focusRing: ["blue/500", "blue/500"],
|
|
1375
1362
|
icon: ["600", "400"],
|
|
1376
1363
|
kbd: {
|
|
1377
1364
|
bg: ["white", "black"],
|
|
@@ -1379,7 +1366,7 @@ const defaultColorTokens = {
|
|
|
1379
1366
|
border: ["200", "800"]
|
|
1380
1367
|
},
|
|
1381
1368
|
link: {
|
|
1382
|
-
fg: ["
|
|
1369
|
+
fg: ["blue/600", "blue/300"]
|
|
1383
1370
|
},
|
|
1384
1371
|
muted: {
|
|
1385
1372
|
bg: ["50", "950"],
|
|
@@ -1406,7 +1393,7 @@ const defaultColorTokens = {
|
|
|
1406
1393
|
fg: ["600", "400"]
|
|
1407
1394
|
}
|
|
1408
1395
|
},
|
|
1409
|
-
primary: { _hue: "
|
|
1396
|
+
primary: { _hue: "blue" },
|
|
1410
1397
|
positive: {
|
|
1411
1398
|
_hue: "green",
|
|
1412
1399
|
shadow: { outline: ["500/0.4", "500/0.4"] }
|
|
@@ -1415,9 +1402,7 @@ const defaultColorTokens = {
|
|
|
1415
1402
|
_hue: "yellow",
|
|
1416
1403
|
shadow: { outline: ["600/0.3", "500/0.4"] }
|
|
1417
1404
|
},
|
|
1418
|
-
critical: { _hue: "red" }
|
|
1419
|
-
prospect: { _hue: "purple" },
|
|
1420
|
-
explore: { _hue: "cyan" }
|
|
1405
|
+
critical: { _hue: "red" }
|
|
1421
1406
|
},
|
|
1422
1407
|
button: {
|
|
1423
1408
|
default: {
|
|
@@ -1456,7 +1441,7 @@ const defaultColorTokens = {
|
|
|
1456
1441
|
border: ["800", "200"]
|
|
1457
1442
|
},
|
|
1458
1443
|
link: {
|
|
1459
|
-
fg: ["
|
|
1444
|
+
fg: ["blue/200", "blue/600"]
|
|
1460
1445
|
},
|
|
1461
1446
|
muted: {
|
|
1462
1447
|
bg: ["950", "50"],
|
|
@@ -1579,7 +1564,7 @@ const defaultColorTokens = {
|
|
|
1579
1564
|
border: ["200", "800"]
|
|
1580
1565
|
},
|
|
1581
1566
|
link: {
|
|
1582
|
-
fg: ["
|
|
1567
|
+
fg: ["blue/700 60%", "blue/300 60%"]
|
|
1583
1568
|
},
|
|
1584
1569
|
muted: {
|
|
1585
1570
|
bg: ["100", "950"],
|
|
@@ -1690,7 +1675,7 @@ const defaultColorTokens = {
|
|
|
1690
1675
|
border: ["200", "800"]
|
|
1691
1676
|
},
|
|
1692
1677
|
link: {
|
|
1693
|
-
fg: ["
|
|
1678
|
+
fg: ["blue/700 70%", "blue/300 70%"]
|
|
1694
1679
|
},
|
|
1695
1680
|
muted: {
|
|
1696
1681
|
bg: ["100", "950"],
|
|
@@ -1703,8 +1688,7 @@ const defaultColorTokens = {
|
|
|
1703
1688
|
},
|
|
1704
1689
|
hovered: {
|
|
1705
1690
|
bg: ["50", "950"],
|
|
1706
|
-
|
|
1707
|
-
icon: ["800 70%", "300 70%"]
|
|
1691
|
+
icon: ["700 70%", "400 70%"]
|
|
1708
1692
|
},
|
|
1709
1693
|
pressed: {
|
|
1710
1694
|
bg: ["100", "900"],
|
|
@@ -1828,7 +1812,7 @@ const defaultColorTokens = {
|
|
|
1828
1812
|
border: ["200", "800"]
|
|
1829
1813
|
},
|
|
1830
1814
|
link: {
|
|
1831
|
-
fg: ["
|
|
1815
|
+
fg: ["blue/700 70%", "blue/300 70%"]
|
|
1832
1816
|
},
|
|
1833
1817
|
muted: {
|
|
1834
1818
|
bg: ["50", "950"],
|
|
@@ -1843,7 +1827,6 @@ const defaultColorTokens = {
|
|
|
1843
1827
|
bg: ["50", "950"]
|
|
1844
1828
|
},
|
|
1845
1829
|
pressed: {
|
|
1846
|
-
// _hue: 'purple',
|
|
1847
1830
|
bg: ["100", "900"]
|
|
1848
1831
|
},
|
|
1849
1832
|
selected: {
|
|
@@ -1880,7 +1863,7 @@ const defaultColorTokens = {
|
|
|
1880
1863
|
border: ["800", "200"]
|
|
1881
1864
|
},
|
|
1882
1865
|
link: {
|
|
1883
|
-
fg: ["
|
|
1866
|
+
fg: ["blue/200", "blue/600"]
|
|
1884
1867
|
},
|
|
1885
1868
|
muted: {
|
|
1886
1869
|
bg: ["500 10%", "400 10%"],
|
|
@@ -1935,7 +1918,7 @@ const defaultColorTokens = {
|
|
|
1935
1918
|
},
|
|
1936
1919
|
default: {
|
|
1937
1920
|
selected: {
|
|
1938
|
-
_hue: "
|
|
1921
|
+
_hue: "blue"
|
|
1939
1922
|
}
|
|
1940
1923
|
},
|
|
1941
1924
|
critical: {
|
|
@@ -2016,18 +1999,44 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2016
1999
|
return {
|
|
2017
2000
|
...spec,
|
|
2018
2001
|
_hue: hue,
|
|
2019
|
-
avatar:
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
[
|
|
2026
|
-
|
|
2002
|
+
avatar: {
|
|
2003
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2004
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2005
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2006
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2007
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2008
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2009
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2010
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2011
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2012
|
+
},
|
|
2013
|
+
badge: {
|
|
2014
|
+
default: {
|
|
2015
|
+
_hue: inputTokens?.base?.default?._hue || hue,
|
|
2016
|
+
...spec.badge?.["*"],
|
|
2017
|
+
...spec.badge?.default
|
|
2018
|
+
},
|
|
2019
|
+
primary: {
|
|
2020
|
+
_hue: inputTokens?.base?.primary?._hue || hue,
|
|
2021
|
+
...spec.badge?.["*"],
|
|
2022
|
+
...spec.badge?.primary
|
|
2023
|
+
},
|
|
2024
|
+
positive: {
|
|
2025
|
+
_hue: inputTokens?.base?.positive?._hue || hue,
|
|
2026
|
+
...spec.badge?.["*"],
|
|
2027
|
+
...spec.badge?.positive
|
|
2028
|
+
},
|
|
2029
|
+
caution: {
|
|
2030
|
+
_hue: inputTokens?.base?.caution?._hue || hue,
|
|
2031
|
+
...spec.badge?.["*"],
|
|
2032
|
+
...spec.badge?.caution
|
|
2033
|
+
},
|
|
2034
|
+
critical: {
|
|
2035
|
+
_hue: inputTokens?.base?.critical?._hue || hue,
|
|
2027
2036
|
...spec.badge?.["*"],
|
|
2028
|
-
...spec.badge?.
|
|
2037
|
+
...spec.badge?.critical
|
|
2029
2038
|
}
|
|
2030
|
-
}
|
|
2039
|
+
}
|
|
2031
2040
|
};
|
|
2032
2041
|
}
|
|
2033
2042
|
function resolveButtonColorTokens(inputTokens) {
|
|
@@ -2058,18 +2067,44 @@ function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
|
2058
2067
|
return {
|
|
2059
2068
|
...spec,
|
|
2060
2069
|
_hue: hue,
|
|
2061
|
-
avatar:
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
[
|
|
2068
|
-
|
|
2070
|
+
avatar: {
|
|
2071
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2072
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2073
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2074
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2075
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2076
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2077
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2078
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2079
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2080
|
+
},
|
|
2081
|
+
badge: {
|
|
2082
|
+
default: {
|
|
2083
|
+
_hue: inputTokens?.base?.default?._hue,
|
|
2084
|
+
...spec.badge?.["*"],
|
|
2085
|
+
...spec.badge?.default
|
|
2086
|
+
},
|
|
2087
|
+
primary: {
|
|
2088
|
+
_hue: inputTokens?.base?.primary?._hue,
|
|
2089
|
+
...spec.badge?.["*"],
|
|
2090
|
+
...spec.badge?.primary
|
|
2091
|
+
},
|
|
2092
|
+
positive: {
|
|
2093
|
+
_hue: inputTokens?.base?.positive?._hue,
|
|
2069
2094
|
...spec.badge?.["*"],
|
|
2070
|
-
...spec.badge?.
|
|
2095
|
+
...spec.badge?.positive
|
|
2096
|
+
},
|
|
2097
|
+
caution: {
|
|
2098
|
+
_hue: inputTokens?.base?.caution?._hue,
|
|
2099
|
+
...spec.badge?.["*"],
|
|
2100
|
+
...spec.badge?.caution
|
|
2101
|
+
},
|
|
2102
|
+
critical: {
|
|
2103
|
+
_hue: inputTokens?.base?.critical?._hue,
|
|
2104
|
+
...spec.badge?.["*"],
|
|
2105
|
+
...spec.badge?.critical
|
|
2071
2106
|
}
|
|
2072
|
-
}
|
|
2107
|
+
}
|
|
2073
2108
|
};
|
|
2074
2109
|
}
|
|
2075
2110
|
function resolveInputColorTokens(inputTokens) {
|
|
@@ -2117,18 +2152,44 @@ function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
|
2117
2152
|
return {
|
|
2118
2153
|
...spec,
|
|
2119
2154
|
_hue: hue,
|
|
2120
|
-
avatar:
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
[
|
|
2127
|
-
|
|
2155
|
+
avatar: {
|
|
2156
|
+
gray: merge({ _hue: "gray" }, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2157
|
+
blue: merge({ _hue: "blue" }, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2158
|
+
purple: merge({ _hue: "purple" }, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2159
|
+
magenta: merge({ _hue: "magenta" }, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2160
|
+
red: merge({ _hue: "red" }, spec.avatar?.["*"], spec.avatar?.red),
|
|
2161
|
+
orange: merge({ _hue: "orange" }, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2162
|
+
yellow: merge({ _hue: "yellow" }, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2163
|
+
green: merge({ _hue: "green" }, spec.avatar?.["*"], spec.avatar?.green),
|
|
2164
|
+
cyan: merge({ _hue: "cyan" }, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2165
|
+
},
|
|
2166
|
+
badge: {
|
|
2167
|
+
default: {
|
|
2168
|
+
_hue: inputTokens?.base?.default?._hue,
|
|
2169
|
+
...spec.badge?.["*"],
|
|
2170
|
+
...spec.badge?.default
|
|
2171
|
+
},
|
|
2172
|
+
primary: {
|
|
2173
|
+
_hue: inputTokens?.base?.primary?._hue,
|
|
2174
|
+
...spec.badge?.["*"],
|
|
2175
|
+
...spec.badge?.primary
|
|
2176
|
+
},
|
|
2177
|
+
positive: {
|
|
2178
|
+
_hue: inputTokens?.base?.positive?._hue,
|
|
2179
|
+
...spec.badge?.["*"],
|
|
2180
|
+
...spec.badge?.positive
|
|
2181
|
+
},
|
|
2182
|
+
caution: {
|
|
2183
|
+
_hue: inputTokens?.base?.caution?._hue,
|
|
2184
|
+
...spec.badge?.["*"],
|
|
2185
|
+
...spec.badge?.caution
|
|
2186
|
+
},
|
|
2187
|
+
critical: {
|
|
2188
|
+
_hue: inputTokens?.base?.critical?._hue,
|
|
2128
2189
|
...spec.badge?.["*"],
|
|
2129
|
-
...spec.badge?.
|
|
2190
|
+
...spec.badge?.critical
|
|
2130
2191
|
}
|
|
2131
|
-
}
|
|
2192
|
+
}
|
|
2132
2193
|
};
|
|
2133
2194
|
}
|
|
2134
2195
|
function buildColorTheme(config) {
|
|
@@ -2143,7 +2204,14 @@ function buildColorTheme(config) {
|
|
|
2143
2204
|
}
|
|
2144
2205
|
function buildColorScheme(options, config) {
|
|
2145
2206
|
const { scheme } = options;
|
|
2146
|
-
return
|
|
2207
|
+
return {
|
|
2208
|
+
transparent: buildCardColorTheme({ scheme, tone: "transparent" }, config),
|
|
2209
|
+
default: buildCardColorTheme({ scheme, tone: "default" }, config),
|
|
2210
|
+
primary: buildCardColorTheme({ scheme, tone: "primary" }, config),
|
|
2211
|
+
positive: buildCardColorTheme({ scheme, tone: "positive" }, config),
|
|
2212
|
+
caution: buildCardColorTheme({ scheme, tone: "caution" }, config),
|
|
2213
|
+
critical: buildCardColorTheme({ scheme, tone: "critical" }, config)
|
|
2214
|
+
};
|
|
2147
2215
|
}
|
|
2148
2216
|
function buildCardColorTheme(options, config) {
|
|
2149
2217
|
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
@@ -2158,7 +2226,7 @@ function buildCardColorTheme(options, config) {
|
|
|
2158
2226
|
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2159
2227
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2160
2228
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2161
|
-
button: buildButtonColorTheme({ scheme
|
|
2229
|
+
button: buildButtonColorTheme({ scheme }, config),
|
|
2162
2230
|
code: {
|
|
2163
2231
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2164
2232
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2179,7 +2247,7 @@ function buildCardColorTheme(options, config) {
|
|
|
2179
2247
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2180
2248
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2181
2249
|
},
|
|
2182
|
-
selectable: buildSelectableColorTheme({ scheme
|
|
2250
|
+
selectable: buildSelectableColorTheme({ scheme }, config),
|
|
2183
2251
|
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
2184
2252
|
skeleton: {
|
|
2185
2253
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
@@ -2221,7 +2289,13 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2221
2289
|
}
|
|
2222
2290
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2223
2291
|
const { scheme } = options;
|
|
2224
|
-
return
|
|
2292
|
+
return {
|
|
2293
|
+
default: _buildBadgeColorTheme(tokens, { scheme, tone: "default" }, config),
|
|
2294
|
+
primary: _buildBadgeColorTheme(tokens, { scheme, tone: "primary" }, config),
|
|
2295
|
+
positive: _buildBadgeColorTheme(tokens, { scheme, tone: "positive" }, config),
|
|
2296
|
+
caution: _buildBadgeColorTheme(tokens, { scheme, tone: "caution" }, config),
|
|
2297
|
+
critical: _buildBadgeColorTheme(tokens, { scheme, tone: "critical" }, config)
|
|
2298
|
+
};
|
|
2225
2299
|
}
|
|
2226
2300
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2227
2301
|
const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
|
|
@@ -2233,25 +2307,25 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2233
2307
|
};
|
|
2234
2308
|
}
|
|
2235
2309
|
function buildButtonColorTheme(options, config) {
|
|
2236
|
-
const { scheme
|
|
2310
|
+
const { scheme } = options, modes = {};
|
|
2237
2311
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2238
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
2312
|
+
modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
|
|
2239
2313
|
return modes;
|
|
2240
2314
|
}
|
|
2241
2315
|
function buildButtonTonesColorTheme(options, config) {
|
|
2242
|
-
const {
|
|
2316
|
+
const { mode, scheme } = options, tones2 = {};
|
|
2243
2317
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2244
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
2318
|
+
tones2[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
|
|
2245
2319
|
return tones2;
|
|
2246
2320
|
}
|
|
2247
2321
|
function buildButtonStatesColorTheme(options, config) {
|
|
2248
|
-
const {
|
|
2322
|
+
const { mode, scheme, tone } = options, states = {};
|
|
2249
2323
|
for (const state of THEME_COLOR_STATES)
|
|
2250
|
-
states[state] = buildButtonStateColorTheme({
|
|
2324
|
+
states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
|
|
2251
2325
|
return states;
|
|
2252
2326
|
}
|
|
2253
2327
|
function buildButtonStateColorTheme(options, config) {
|
|
2254
|
-
const {
|
|
2328
|
+
const { mode, tone, scheme, state } = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2255
2329
|
return {
|
|
2256
2330
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2257
2331
|
accent: {
|
|
@@ -2295,14 +2369,14 @@ function buildInputColorTheme(options, config) {
|
|
|
2295
2369
|
function buildInputStatesColorTheme(options, config) {
|
|
2296
2370
|
const { mode, scheme, tone } = options;
|
|
2297
2371
|
return {
|
|
2298
|
-
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled",
|
|
2299
|
-
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered",
|
|
2300
|
-
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly",
|
|
2301
|
-
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled",
|
|
2372
|
+
enabled: buildInputStateColorTheme({ mode, scheme, state: "enabled", tone }, config),
|
|
2373
|
+
hovered: buildInputStateColorTheme({ mode, scheme, state: "hovered", tone }, config),
|
|
2374
|
+
readOnly: buildInputStateColorTheme({ mode, scheme, state: "readOnly", tone }, config),
|
|
2375
|
+
disabled: buildInputStateColorTheme({ mode, scheme, state: "disabled", tone }, config)
|
|
2302
2376
|
};
|
|
2303
2377
|
}
|
|
2304
2378
|
function buildInputStateColorTheme(options, config) {
|
|
2305
|
-
const {
|
|
2379
|
+
const { mode, tone, scheme, state } = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2306
2380
|
return {
|
|
2307
2381
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2308
2382
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2315,19 +2389,19 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2315
2389
|
};
|
|
2316
2390
|
}
|
|
2317
2391
|
function buildSelectableColorTheme(options, config) {
|
|
2318
|
-
const { scheme
|
|
2392
|
+
const { scheme } = options, tones2 = {};
|
|
2319
2393
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2320
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
2394
|
+
tones2[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
|
|
2321
2395
|
return tones2;
|
|
2322
2396
|
}
|
|
2323
2397
|
function buildSelectableStatesColorTheme(options, config) {
|
|
2324
|
-
const {
|
|
2398
|
+
const { scheme, tone } = options, states = {};
|
|
2325
2399
|
for (const state of THEME_COLOR_STATES)
|
|
2326
|
-
states[state] = buildSelectableStateColorTheme({
|
|
2400
|
+
states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
|
|
2327
2401
|
return states;
|
|
2328
2402
|
}
|
|
2329
2403
|
function buildSelectableStateColorTheme(options, config) {
|
|
2330
|
-
const {
|
|
2404
|
+
const { scheme, state, tone } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2331
2405
|
return {
|
|
2332
2406
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2333
2407
|
accent: {
|
|
@@ -2591,44 +2665,29 @@ function renderColorHex(color2) {
|
|
|
2591
2665
|
function renderThemeColorSchemes(value, config) {
|
|
2592
2666
|
const colorPalette = config?.palette ?? defaultColorPalette;
|
|
2593
2667
|
return {
|
|
2594
|
-
light: renderThemeColorScheme(colorPalette, value.light
|
|
2595
|
-
dark: renderThemeColorScheme(colorPalette, value.dark
|
|
2668
|
+
light: renderThemeColorScheme(colorPalette, value.light),
|
|
2669
|
+
dark: renderThemeColorScheme(colorPalette, value.dark)
|
|
2596
2670
|
};
|
|
2597
2671
|
}
|
|
2598
|
-
function renderThemeColorScheme(colorPalette, value
|
|
2599
|
-
const
|
|
2600
|
-
colorPalette,
|
|
2601
|
-
debugPath: `${debugPath}.transparent`
|
|
2602
|
-
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
2603
|
-
colorPalette,
|
|
2604
|
-
debugPath: `${debugPath}.default`
|
|
2605
|
-
}), bg = renderedDefaultTone.bg;
|
|
2672
|
+
function renderThemeColorScheme(colorPalette, value) {
|
|
2673
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, { colorPalette }), renderedDefaultTone = renderThemeColor(defaultTone, { colorPalette }), bg = renderedDefaultTone.bg;
|
|
2606
2674
|
if (bg === "white")
|
|
2607
2675
|
throw new Error("Cannot blend with white background");
|
|
2608
2676
|
return Object.fromEntries([
|
|
2609
2677
|
["transparent", renderedTransparentTone],
|
|
2610
2678
|
["default", renderedDefaultTone],
|
|
2611
|
-
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [
|
|
2612
|
-
k,
|
|
2613
|
-
renderThemeColor(v, {
|
|
2614
|
-
bg,
|
|
2615
|
-
colorPalette,
|
|
2616
|
-
debugPath: `${debugPath}.${k}`
|
|
2617
|
-
})
|
|
2618
|
-
])
|
|
2679
|
+
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
|
|
2619
2680
|
]);
|
|
2620
2681
|
}
|
|
2621
2682
|
function renderThemeColor(value, options) {
|
|
2622
|
-
const { colorPalette, bg
|
|
2683
|
+
const { colorPalette, bg } = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, { colorPalette, bg, blendMode }), colorOptions = { colorPalette, bg: baseBg, blendMode }, button = renderThemeColorButton(value.button, {
|
|
2623
2684
|
baseBg,
|
|
2624
2685
|
blendMode,
|
|
2625
|
-
colorPalette
|
|
2626
|
-
debugPath: `${debugPath}.button`
|
|
2686
|
+
colorPalette
|
|
2627
2687
|
}), selectable = renderThemeColorSelectable(value.selectable, {
|
|
2628
2688
|
colorPalette,
|
|
2629
2689
|
baseBg,
|
|
2630
|
-
blendMode
|
|
2631
|
-
debugPath: `${debugPath}.selectable`
|
|
2690
|
+
blendMode
|
|
2632
2691
|
}), shadow = {
|
|
2633
2692
|
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
2634
2693
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
@@ -2653,19 +2712,9 @@ function renderThemeColor(value, options) {
|
|
|
2653
2712
|
accent: {
|
|
2654
2713
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2655
2714
|
},
|
|
2656
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
2657
|
-
baseBg,
|
|
2658
|
-
colorPalette,
|
|
2659
|
-
blendMode,
|
|
2660
|
-
debugPath: `${debugPath}.avatar`
|
|
2661
|
-
}),
|
|
2715
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
2662
2716
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2663
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
2664
|
-
baseBg,
|
|
2665
|
-
colorPalette,
|
|
2666
|
-
blendMode,
|
|
2667
|
-
debugPath: `${debugPath}.badge`
|
|
2668
|
-
}),
|
|
2717
|
+
badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
|
|
2669
2718
|
bg: baseBg,
|
|
2670
2719
|
border: renderColorValue(value.border, colorOptions),
|
|
2671
2720
|
button,
|
|
@@ -2676,18 +2725,8 @@ function renderThemeColor(value, options) {
|
|
|
2676
2725
|
fg: renderColorValue(value.fg, colorOptions),
|
|
2677
2726
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2678
2727
|
icon: renderColorValue(value.icon, colorOptions),
|
|
2679
|
-
input: renderThemeColorInput(value.input, {
|
|
2680
|
-
|
|
2681
|
-
colorPalette,
|
|
2682
|
-
blendMode,
|
|
2683
|
-
debugPath: `${debugPath}.input`
|
|
2684
|
-
}),
|
|
2685
|
-
kbd: renderThemeColorKBD(value.kbd, {
|
|
2686
|
-
baseBg,
|
|
2687
|
-
colorPalette,
|
|
2688
|
-
blendMode,
|
|
2689
|
-
debugPath: `${debugPath}.kbd`
|
|
2690
|
-
}),
|
|
2728
|
+
input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
|
|
2729
|
+
kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
|
|
2691
2730
|
link: {
|
|
2692
2731
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2693
2732
|
},
|
|
@@ -2700,12 +2739,7 @@ function renderThemeColor(value, options) {
|
|
|
2700
2739
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
2701
2740
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
2702
2741
|
},
|
|
2703
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
2704
|
-
baseBg,
|
|
2705
|
-
colorPalette,
|
|
2706
|
-
blendMode,
|
|
2707
|
-
debugPath: `${debugPath}.syntax`
|
|
2708
|
-
}),
|
|
2742
|
+
syntax: renderSyntaxColorTheme(value.syntax, { baseBg, colorPalette, blendMode }),
|
|
2709
2743
|
selectable
|
|
2710
2744
|
};
|
|
2711
2745
|
}
|
|
@@ -2726,44 +2760,16 @@ function renderThemeColorKBD(value, options) {
|
|
|
2726
2760
|
};
|
|
2727
2761
|
}
|
|
2728
2762
|
function renderThemeColorAvatar(value, options) {
|
|
2729
|
-
const { debugPath } = options;
|
|
2730
2763
|
return {
|
|
2731
|
-
gray: renderThemeColorAvatarColor(value.gray,
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
...options,
|
|
2741
|
-
debugPath: `${debugPath}.purple`
|
|
2742
|
-
}),
|
|
2743
|
-
magenta: renderThemeColorAvatarColor(value.magenta, {
|
|
2744
|
-
...options,
|
|
2745
|
-
debugPath: `${debugPath}.magenta`
|
|
2746
|
-
}),
|
|
2747
|
-
red: renderThemeColorAvatarColor(value.red, {
|
|
2748
|
-
...options,
|
|
2749
|
-
debugPath: `${debugPath}.red`
|
|
2750
|
-
}),
|
|
2751
|
-
orange: renderThemeColorAvatarColor(value.orange, {
|
|
2752
|
-
...options,
|
|
2753
|
-
debugPath: `${debugPath}.orange`
|
|
2754
|
-
}),
|
|
2755
|
-
yellow: renderThemeColorAvatarColor(value.yellow, {
|
|
2756
|
-
...options,
|
|
2757
|
-
debugPath: `${debugPath}.yellow`
|
|
2758
|
-
}),
|
|
2759
|
-
green: renderThemeColorAvatarColor(value.green, {
|
|
2760
|
-
...options,
|
|
2761
|
-
debugPath: `${debugPath}.green`
|
|
2762
|
-
}),
|
|
2763
|
-
cyan: renderThemeColorAvatarColor(value.cyan, {
|
|
2764
|
-
...options,
|
|
2765
|
-
debugPath: `${debugPath}.cyan`
|
|
2766
|
-
})
|
|
2764
|
+
gray: renderThemeColorAvatarColor(value.gray, options),
|
|
2765
|
+
blue: renderThemeColorAvatarColor(value.blue, options),
|
|
2766
|
+
purple: renderThemeColorAvatarColor(value.purple, options),
|
|
2767
|
+
magenta: renderThemeColorAvatarColor(value.magenta, options),
|
|
2768
|
+
red: renderThemeColorAvatarColor(value.red, options),
|
|
2769
|
+
orange: renderThemeColorAvatarColor(value.orange, options),
|
|
2770
|
+
yellow: renderThemeColorAvatarColor(value.yellow, options),
|
|
2771
|
+
green: renderThemeColorAvatarColor(value.green, options),
|
|
2772
|
+
cyan: renderThemeColorAvatarColor(value.cyan, options)
|
|
2767
2773
|
};
|
|
2768
2774
|
}
|
|
2769
2775
|
function renderThemeColorAvatarColor(value, options) {
|
|
@@ -2783,11 +2789,13 @@ function renderThemeColorAvatarColor(value, options) {
|
|
|
2783
2789
|
};
|
|
2784
2790
|
}
|
|
2785
2791
|
function renderThemeColorBadge(value, options) {
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2792
|
+
return {
|
|
2793
|
+
default: renderThemeColorBadgeColor(value.default, options),
|
|
2794
|
+
primary: renderThemeColorBadgeColor(value.primary, options),
|
|
2795
|
+
positive: renderThemeColorBadgeColor(value.positive, options),
|
|
2796
|
+
caution: renderThemeColorBadgeColor(value.caution, options),
|
|
2797
|
+
critical: renderThemeColorBadgeColor(value.critical, options)
|
|
2798
|
+
};
|
|
2791
2799
|
}
|
|
2792
2800
|
function renderThemeColorBadgeColor(value, options) {
|
|
2793
2801
|
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
|
|
@@ -2807,56 +2815,32 @@ function renderThemeColorBadgeColor(value, options) {
|
|
|
2807
2815
|
};
|
|
2808
2816
|
}
|
|
2809
2817
|
function renderThemeColorButton(value, options) {
|
|
2810
|
-
const { debugPath } = options;
|
|
2811
2818
|
return {
|
|
2812
|
-
default: renderThemeColorButtonTones(value.default,
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
}),
|
|
2816
|
-
ghost: renderThemeColorButtonTones(value.ghost, {
|
|
2817
|
-
...options,
|
|
2818
|
-
debugPath: `${debugPath}.ghost`
|
|
2819
|
-
}),
|
|
2820
|
-
bleed: renderThemeColorButtonTones(value.bleed, {
|
|
2821
|
-
...options,
|
|
2822
|
-
debugPath: `${debugPath}.bleed`
|
|
2823
|
-
})
|
|
2819
|
+
default: renderThemeColorButtonTones(value.default, options),
|
|
2820
|
+
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
2821
|
+
bleed: renderThemeColorButtonTones(value.bleed, options)
|
|
2824
2822
|
};
|
|
2825
2823
|
}
|
|
2826
2824
|
function renderThemeColorButtonTones(value, options) {
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2825
|
+
return {
|
|
2826
|
+
default: renderThemeColorButtonStates(value.default, options),
|
|
2827
|
+
primary: renderThemeColorButtonStates(value.primary, options),
|
|
2828
|
+
positive: renderThemeColorButtonStates(value.positive, options),
|
|
2829
|
+
caution: renderThemeColorButtonStates(value.caution, options),
|
|
2830
|
+
critical: renderThemeColorButtonStates(value.critical, options)
|
|
2831
|
+
};
|
|
2832
2832
|
}
|
|
2833
2833
|
function renderThemeColorButtonStates(value, options) {
|
|
2834
|
-
const { debugPath } = options;
|
|
2835
2834
|
return {
|
|
2836
|
-
enabled: renderThemeColorState(value.enabled,
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
...options,
|
|
2842
|
-
debugPath: `${debugPath}.hovered`
|
|
2843
|
-
}),
|
|
2844
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
2845
|
-
...options,
|
|
2846
|
-
debugPath: `${debugPath}.pressed`
|
|
2847
|
-
}),
|
|
2848
|
-
selected: renderThemeColorState(value.selected, {
|
|
2849
|
-
...options,
|
|
2850
|
-
debugPath: `${debugPath}.selected`
|
|
2851
|
-
}),
|
|
2852
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
2853
|
-
...options,
|
|
2854
|
-
debugPath: `${debugPath}.disabled`
|
|
2855
|
-
})
|
|
2835
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
2836
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
2837
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
2838
|
+
selected: renderThemeColorState(value.selected, options),
|
|
2839
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
2856
2840
|
};
|
|
2857
2841
|
}
|
|
2858
2842
|
function renderThemeColorState(value, options) {
|
|
2859
|
-
const { baseBg, blendMode: rootBlendMode, colorPalette
|
|
2843
|
+
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2860
2844
|
bg: baseBg,
|
|
2861
2845
|
blendMode: rootBlendMode,
|
|
2862
2846
|
colorPalette
|
|
@@ -2870,18 +2854,8 @@ function renderThemeColorState(value, options) {
|
|
|
2870
2854
|
accent: {
|
|
2871
2855
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2872
2856
|
},
|
|
2873
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
2874
|
-
|
|
2875
|
-
colorPalette,
|
|
2876
|
-
blendMode,
|
|
2877
|
-
debugPath: `${debugPath}.avatar`
|
|
2878
|
-
}),
|
|
2879
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
2880
|
-
baseBg: bg,
|
|
2881
|
-
colorPalette,
|
|
2882
|
-
blendMode,
|
|
2883
|
-
debugPath: `${debugPath}.badge`
|
|
2884
|
-
}),
|
|
2857
|
+
avatar: renderThemeColorAvatar(value.avatar, { baseBg: bg, colorPalette, blendMode }),
|
|
2858
|
+
badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
|
|
2885
2859
|
bg,
|
|
2886
2860
|
border: renderColorValue(value.border, colorOptions),
|
|
2887
2861
|
code: {
|
|
@@ -2909,37 +2883,17 @@ function renderThemeColorState(value, options) {
|
|
|
2909
2883
|
};
|
|
2910
2884
|
}
|
|
2911
2885
|
function renderThemeColorInput(value, options) {
|
|
2912
|
-
const { debugPath } = options;
|
|
2913
2886
|
return {
|
|
2914
|
-
default: renderInputStatesColorTheme(value.default,
|
|
2915
|
-
|
|
2916
|
-
debugPath: `${debugPath}.default`
|
|
2917
|
-
}),
|
|
2918
|
-
invalid: renderInputStatesColorTheme(value.invalid, {
|
|
2919
|
-
...options,
|
|
2920
|
-
debugPath: `${debugPath}.invalid`
|
|
2921
|
-
})
|
|
2887
|
+
default: renderInputStatesColorTheme(value.default, options),
|
|
2888
|
+
invalid: renderInputStatesColorTheme(value.invalid, options)
|
|
2922
2889
|
};
|
|
2923
2890
|
}
|
|
2924
2891
|
function renderInputStatesColorTheme(value, options) {
|
|
2925
|
-
const { debugPath } = options;
|
|
2926
2892
|
return {
|
|
2927
|
-
enabled: renderInputStateColorTheme(value.enabled,
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
hovered: renderInputStateColorTheme(value.hovered, {
|
|
2932
|
-
...options,
|
|
2933
|
-
debugPath: `${debugPath}.hovered`
|
|
2934
|
-
}),
|
|
2935
|
-
readOnly: renderInputStateColorTheme(value.readOnly, {
|
|
2936
|
-
...options,
|
|
2937
|
-
debugPath: `${debugPath}.readOnly`
|
|
2938
|
-
}),
|
|
2939
|
-
disabled: renderInputStateColorTheme(value.disabled, {
|
|
2940
|
-
...options,
|
|
2941
|
-
debugPath: `${debugPath}.disabled`
|
|
2942
|
-
})
|
|
2893
|
+
enabled: renderInputStateColorTheme(value.enabled, options),
|
|
2894
|
+
hovered: renderInputStateColorTheme(value.hovered, options),
|
|
2895
|
+
readOnly: renderInputStateColorTheme(value.readOnly, options),
|
|
2896
|
+
disabled: renderInputStateColorTheme(value.disabled, options)
|
|
2943
2897
|
};
|
|
2944
2898
|
}
|
|
2945
2899
|
function renderInputStateColorTheme(value, options) {
|
|
@@ -2956,35 +2910,21 @@ function renderInputStateColorTheme(value, options) {
|
|
|
2956
2910
|
};
|
|
2957
2911
|
}
|
|
2958
2912
|
function renderThemeColorSelectable(value, options) {
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2913
|
+
return {
|
|
2914
|
+
default: renderThemeColorSelectableStates(value.default, options),
|
|
2915
|
+
primary: renderThemeColorSelectableStates(value.primary, options),
|
|
2916
|
+
positive: renderThemeColorSelectableStates(value.positive, options),
|
|
2917
|
+
caution: renderThemeColorSelectableStates(value.caution, options),
|
|
2918
|
+
critical: renderThemeColorSelectableStates(value.critical, options)
|
|
2919
|
+
};
|
|
2964
2920
|
}
|
|
2965
2921
|
function renderThemeColorSelectableStates(value, options) {
|
|
2966
|
-
const { debugPath } = options;
|
|
2967
2922
|
return {
|
|
2968
|
-
enabled: renderThemeColorState(value.enabled,
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
...options,
|
|
2974
|
-
debugPath: `${debugPath}.hovered`
|
|
2975
|
-
}),
|
|
2976
|
-
pressed: renderThemeColorState(value.pressed, {
|
|
2977
|
-
...options,
|
|
2978
|
-
debugPath: `${debugPath}.pressed`
|
|
2979
|
-
}),
|
|
2980
|
-
selected: renderThemeColorState(value.selected, {
|
|
2981
|
-
...options,
|
|
2982
|
-
debugPath: `${debugPath}.selected`
|
|
2983
|
-
}),
|
|
2984
|
-
disabled: renderThemeColorState(value.disabled, {
|
|
2985
|
-
...options,
|
|
2986
|
-
debugPath: `${debugPath}.disabled`
|
|
2987
|
-
})
|
|
2923
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
2924
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
2925
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
2926
|
+
selected: renderThemeColorState(value.selected, options),
|
|
2927
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
2988
2928
|
};
|
|
2989
2929
|
}
|
|
2990
2930
|
function renderSyntaxColorTheme(value, options) {
|
|
@@ -3084,6 +3024,7 @@ function _setCachedTheme(rootTheme, scheme, tone, theme) {
|
|
|
3084
3024
|
schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
|
|
3085
3025
|
}
|
|
3086
3026
|
export {
|
|
3027
|
+
AVATAR_SIZE,
|
|
3087
3028
|
COLOR_CONFIG_AVATAR_COLORS,
|
|
3088
3029
|
COLOR_CONFIG_BLEND_KEYS,
|
|
3089
3030
|
COLOR_CONFIG_CARD_KEYS,
|
|
@@ -3093,6 +3034,14 @@ export {
|
|
|
3093
3034
|
COLOR_CONFIG_STATES,
|
|
3094
3035
|
COLOR_CONFIG_STATE_KEYS,
|
|
3095
3036
|
COLOR_CONFIG_STATE_TONES,
|
|
3037
|
+
CONTAINER,
|
|
3038
|
+
FONT_CODE_SIZE,
|
|
3039
|
+
FONT_HEADING_SIZE,
|
|
3040
|
+
FONT_LABEL_SIZE,
|
|
3041
|
+
FONT_TEXT_SIZE,
|
|
3042
|
+
RADIUS,
|
|
3043
|
+
SHADOW,
|
|
3044
|
+
SPACE,
|
|
3096
3045
|
THEME_COLOR_AVATAR_COLORS,
|
|
3097
3046
|
THEME_COLOR_BLEND_MODES,
|
|
3098
3047
|
THEME_COLOR_BUTTON_MODES,
|