@sanity/ui 3.0.0-static.0 → 3.0.0-static.10
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/LICENSE +1 -1
- package/bin/ui.js +0 -1
- package/dist/_chunks-cjs/_visual-editing.js +3138 -0
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -0
- package/dist/_chunks-cjs/buildCommand.js +17 -2821
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js +27 -0
- package/dist/_chunks-cjs/refractor.js.map +1 -0
- package/dist/_chunks-es/_visual-editing.mjs +3145 -0
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -0
- package/dist/_chunks-es/refractor.mjs +26 -0
- package/dist/_chunks-es/refractor.mjs.map +1 -0
- package/dist/_visual-editing.d.mts +811 -0
- package/dist/_visual-editing.d.ts +811 -0
- package/dist/_visual-editing.js +31 -0
- package/dist/_visual-editing.js.map +1 -0
- package/dist/_visual-editing.mjs +31 -0
- package/dist/_visual-editing.mjs.map +1 -0
- package/dist/cli.js +340 -6
- package/dist/cli.js.map +1 -1
- package/dist/css.d.mts +970 -440
- package/dist/css.d.ts +970 -440
- package/dist/css.js +4257 -2514
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +4259 -2515
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +499 -561
- package/dist/index.d.ts +499 -561
- package/dist/index.js +1160 -5463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1089 -5401
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +1 -0
- package/dist/sanity-theme.css +1 -25
- package/dist/system.css +23226 -2941
- package/dist/theme.d.mts +399 -112
- package/dist/theme.d.ts +399 -112
- package/dist/theme.js +2174 -2060
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +2207 -2095
- package/dist/theme.mjs.map +1 -1
- package/exports/_visual-editing.ts +31 -0
- package/exports/index.ts +1 -1
- package/package.json +96 -85
- package/src/cli/buildCommand.ts +48 -0
- package/src/cli/index.ts +38 -0
- package/src/css/_comp.test.ts +7 -0
- package/src/css/_comp.ts +11 -0
- package/src/css/_mergeStyles.ts +31 -0
- package/src/css/_resp.ts +16 -6
- package/src/css/_responsiveRule.ts +38 -0
- package/src/css/aspects/border/border.style.ts +13 -0
- package/src/css/aspects/border/border.ts +14 -0
- package/src/css/aspects/display/display.style.ts +34 -0
- package/src/css/aspects/display/display.ts +7 -0
- package/src/css/aspects/display/index.ts +2 -0
- package/src/css/aspects/display/types.ts +17 -0
- package/src/css/aspects/flex/flex.style.ts +30 -0
- package/src/css/aspects/flex/flex.ts +13 -0
- package/src/css/aspects/flex/flexAlign.style.ts +12 -0
- package/src/css/aspects/flex/flexDirection.style.ts +11 -0
- package/src/css/aspects/flex/flexJustify.style.ts +13 -0
- package/src/css/aspects/flex/flexWrap.style.ts +10 -0
- package/src/css/aspects/flexItem/flex.style.ts +22 -0
- package/src/css/aspects/flexItem/flexItem.ts +8 -0
- package/src/css/aspects/flexItem/types.ts +27 -0
- package/src/css/aspects/font/font.style.ts +151 -0
- package/src/css/aspects/font/font.ts +12 -0
- package/src/css/aspects/font/types.ts +12 -0
- package/src/css/aspects/gap/gap.style.ts +21 -0
- package/src/css/aspects/gap/gap.ts +8 -0
- package/src/css/aspects/gap/types.ts +10 -0
- package/src/css/aspects/grid/grid.ts +13 -0
- package/src/css/aspects/grid/gridAutoColumns.style.ts +11 -0
- package/src/css/aspects/grid/gridAutoFlow.style.ts +11 -0
- package/src/css/aspects/grid/gridAutoRows.style.ts +11 -0
- package/src/css/aspects/grid/gridColumns.style.ts +18 -0
- package/src/css/aspects/grid/gridRows.style.ts +18 -0
- package/src/css/aspects/grid/index.ts +2 -0
- package/src/css/aspects/grid/types.ts +29 -0
- package/src/css/aspects/gridItem/gridColumn.style.ts +20 -0
- package/src/css/aspects/gridItem/gridColumnEnd.style.ts +20 -0
- package/src/css/aspects/gridItem/gridColumnStart.style.ts +20 -0
- package/src/css/aspects/gridItem/gridItem.ts +15 -0
- package/src/css/aspects/gridItem/gridRow.style.ts +20 -0
- package/src/css/aspects/gridItem/gridRowEnd.style.ts +20 -0
- package/src/css/aspects/gridItem/gridRowStart.style.ts +20 -0
- package/src/css/aspects/height/height.style.ts +9 -0
- package/src/css/aspects/height/height.ts +17 -0
- package/src/css/aspects/height/index.ts +1 -0
- package/src/css/aspects/index.ts +21 -0
- package/src/css/aspects/inset/index.ts +2 -0
- package/src/css/aspects/inset/inset.style.ts +12 -0
- package/src/css/aspects/inset/inset.ts +13 -0
- package/src/css/aspects/inset/types.ts +13 -0
- package/src/css/aspects/margin/margin.style.ts +46 -0
- package/src/css/aspects/margin/margin.ts +15 -0
- package/src/css/aspects/maxWidth/maxWidth.style.ts +16 -0
- package/src/css/aspects/maxWidth/types.ts +7 -0
- package/src/css/aspects/minWidth/index.ts +2 -0
- package/src/css/aspects/minWidth/minWidth.style.ts +13 -0
- package/src/css/aspects/minWidth/minWidth.ts +6 -0
- package/src/css/aspects/minWidth/types.ts +7 -0
- package/src/css/aspects/outline/outline.style.ts +9 -0
- package/src/css/aspects/overflow/index.ts +2 -0
- package/src/css/aspects/overflow/overflow.style.ts +11 -0
- package/src/css/aspects/overflow/overflow.ts +11 -0
- package/src/css/aspects/overflow/types.ts +11 -0
- package/src/css/aspects/padding/padding.style.ts +46 -0
- package/src/css/aspects/padding/padding.ts +15 -0
- package/src/css/aspects/padding/types.ts +14 -0
- package/src/css/aspects/pointerEvents/pointerEvents.style.ts +13 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +6 -0
- package/src/css/aspects/position/position.style.ts +12 -0
- package/src/css/aspects/position/position.ts +7 -0
- package/src/css/aspects/position/types.ts +9 -0
- package/src/css/aspects/radius/radius.style.ts +16 -0
- package/src/css/aspects/radius/radius.ts +8 -0
- package/src/css/aspects/radius/types.ts +8 -0
- package/src/css/aspects/shadow/index.ts +2 -0
- package/src/css/aspects/shadow/shadow.style.ts +49 -0
- package/src/css/aspects/shadow/shadow.ts +7 -0
- package/src/css/aspects/shadow/types.ts +8 -0
- package/src/css/aspects/textOverflow/index.ts +2 -0
- package/src/css/aspects/textOverflow/textOverflow.style.ts +21 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +6 -0
- package/src/css/aspects/textOverflow/types.ts +8 -0
- package/src/css/aspects/width/index.ts +2 -0
- package/src/css/aspects/width/rules.ts +8 -0
- package/src/css/aspects/width/types.ts +9 -0
- package/src/css/aspects/width/width.style.ts +11 -0
- package/src/css/compile/compilePalette.ts +27 -0
- package/src/css/compile/compileRule.ts +50 -11
- package/src/css/compile/compileRules.test.ts +36 -0
- package/src/css/compile/compileRules.ts +43 -0
- package/src/css/compile/compileStyle.ts +148 -0
- package/src/css/compile/compileSystem.ts +6 -3
- package/src/css/compile/compileTheme.ts +8 -502
- package/src/css/compile/compileTheme_v3.ts +401 -0
- package/src/css/compile/types.ts +6 -0
- package/src/css/components/breadcrumbs/breadcrumbs.style.ts +9 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +3 -3
- package/src/css/components/breadcrumbs/rules.ts +18 -0
- package/src/css/components/dialog/dialog.style.ts +79 -0
- package/src/css/components/dialog/dialog.ts +30 -0
- package/src/css/components/dialog/index.ts +1 -1
- package/src/css/components/dialog/rules.ts +4 -1
- package/src/css/components/menu/index.ts +1 -0
- package/src/css/components/menu/menu.style.ts +17 -0
- package/src/css/components/menu/menu.ts +9 -0
- package/src/css/components/menu/rules.ts +15 -0
- package/src/css/components/skeleton/index.ts +2 -0
- package/src/css/components/skeleton/rules.ts +113 -0
- package/src/css/components/skeleton/skeleton.style.ts +96 -0
- package/src/css/components/skeleton/skeleton.ts +31 -0
- package/src/css/components/skeleton/types.ts +26 -0
- package/src/css/components/toast/index.ts +1 -0
- package/src/css/components/toast/rules.ts +18 -0
- package/src/css/components/toast/toast.style.ts +20 -0
- package/src/css/components/toast/toast.ts +21 -0
- package/src/css/components/tree/rules.ts +118 -2
- package/src/css/components/tree/tree.style.ts +55 -0
- package/src/css/components/tree/tree.ts +3 -3
- package/src/css/composeClassNames.ts +16 -2
- package/src/css/constants.ts +1 -0
- package/src/css/index.ts +15 -21
- package/src/css/primitives/_arrow/_arrow.style.ts +73 -0
- package/src/css/primitives/_arrow/_arrow.ts +14 -0
- package/src/css/primitives/_arrow/index.ts +1 -0
- package/src/css/primitives/_input/__workshop__/customInput.tsx +16 -0
- package/src/css/primitives/_input/__workshop__/index.ts +14 -0
- package/src/css/primitives/_input/_input.style.ts +162 -0
- package/src/css/primitives/_input/index.ts +2 -0
- package/src/css/primitives/_input/input.ts +25 -0
- package/src/css/primitives/_input/types.ts +12 -0
- package/src/css/primitives/_selectable/__style.ts +117 -0
- package/src/css/primitives/_selectable/_contants.ts +11 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +132 -0
- package/src/css/primitives/_selectable/selectable.ts +9 -0
- package/src/css/primitives/_selectable/types.ts +8 -0
- package/src/css/primitives/avatar/avatar.style.ts +175 -0
- package/src/css/primitives/avatar/avatar.ts +13 -18
- package/src/css/primitives/avatar/rules.ts +85 -99
- package/src/css/primitives/avatar/types.ts +1 -2
- package/src/css/primitives/badge/badge.style.ts +22 -0
- package/src/css/primitives/badge/badge.ts +4 -4
- package/src/css/primitives/badge/types.ts +2 -2
- package/src/css/primitives/box/box.style.ts +31 -0
- package/src/css/primitives/box/box.ts +34 -16
- package/src/css/primitives/box/types.ts +31 -29
- package/src/css/primitives/button/_constants.ts +17 -0
- package/src/css/primitives/button/button.style.ts +201 -0
- package/src/css/primitives/button/button.ts +29 -14
- package/src/css/primitives/button/rules.ts +284 -40
- package/src/css/primitives/card/_constants.ts +13 -0
- package/src/css/primitives/card/card.style.ts +270 -0
- package/src/css/primitives/card/card.ts +9 -16
- package/src/css/primitives/card/index.ts +1 -0
- package/src/css/primitives/card/types.ts +10 -0
- package/src/css/primitives/checkbox/__styles.ts +115 -113
- package/src/css/primitives/checkbox/checkbox.style.ts +154 -0
- package/src/css/primitives/checkbox/checkbox.ts +5 -5
- package/src/css/primitives/checkbox/rules.ts +31 -15
- package/src/css/primitives/code/code.style.ts +62 -0
- package/src/css/primitives/code/code.ts +4 -4
- package/src/css/primitives/code/rules.ts +27 -2
- package/src/css/primitives/code/types.ts +1 -1
- package/src/css/primitives/container/container.style.ts +10 -0
- package/src/css/primitives/container/container.ts +4 -4
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/heading/heading.style.ts +47 -0
- package/src/css/primitives/heading/heading.ts +6 -5
- package/src/css/primitives/heading/rules.ts +77 -6
- package/src/css/primitives/heading/types.ts +2 -2
- package/src/css/primitives/kbd/kbd.style.ts +22 -0
- package/src/css/primitives/kbd/kbd.ts +4 -4
- package/src/css/primitives/kbd/rules.ts +5 -5
- package/src/css/primitives/kbd/types.ts +3 -1
- package/src/css/primitives/label/label.style.ts +48 -0
- package/src/css/primitives/label/label.ts +4 -4
- package/src/css/primitives/label/rules.ts +54 -2
- package/src/css/primitives/label/types.ts +1 -1
- package/src/css/primitives/popover/popover.style.ts +5 -0
- package/src/css/primitives/popover/popover.ts +7 -3
- package/src/css/primitives/radio/radio.style.ts +123 -0
- package/src/css/primitives/radio/radio.ts +3 -3
- package/src/css/primitives/radio/rules.ts +117 -1
- package/src/css/primitives/select/index.ts +1 -0
- package/src/css/primitives/select/rules.ts +18 -1
- package/src/css/primitives/select/select.style.ts +24 -0
- package/src/css/primitives/select/select.ts +9 -2
- package/src/css/primitives/select/types.ts +5 -0
- package/src/css/primitives/spinner/rules.ts +6 -7
- package/src/css/primitives/spinner/spinner.style.ts +22 -0
- package/src/css/primitives/spinner/spinner.ts +7 -3
- package/src/css/primitives/stack/stack.style.ts +9 -0
- package/src/css/primitives/stack/stack.ts +6 -0
- package/src/css/primitives/switch/rules.ts +264 -56
- package/src/css/primitives/switch/switch.style.ts +94 -0
- package/src/css/primitives/switch/switch.ts +19 -3
- package/src/css/primitives/text/rules.ts +93 -4
- package/src/css/primitives/text/text.style.ts +64 -0
- package/src/css/primitives/text/text.ts +5 -4
- package/src/css/primitives/text/types.ts +2 -2
- package/src/css/primitives/textArea/index.ts +1 -0
- package/src/css/primitives/textArea/rules.ts +3 -1
- package/src/css/primitives/textArea/textArea.style.ts +9 -0
- package/src/css/primitives/textArea/textArea.ts +5 -2
- package/src/css/primitives/textArea/types.ts +5 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +94 -96
- package/src/css/primitives/textInput/textInput.style.ts +167 -0
- package/src/css/primitives/textInput/textInput.ts +5 -4
- package/src/css/primitives/textInput/types.ts +11 -0
- package/src/css/primitives/token/rules.ts +37 -37
- package/src/css/primitives/token/token.style.ts +49 -0
- package/src/css/primitives/tooltip/rules.ts +2 -0
- package/src/css/primitives/tooltip/tooltip.style.ts +21 -0
- package/src/css/primitives/tooltip/tooltip.ts +5 -5
- package/src/css/scopeClassName.ts +6 -0
- package/src/css/system.style.ts +158 -0
- package/src/css/types.ts +630 -369
- package/src/css/util.ts +27 -0
- package/src/css/utils/srOnly/srOnly.style.ts +14 -0
- package/src/css/utils/srOnly/srOnly.ts +5 -0
- package/src/css/varNames.ts +395 -256
- package/src/css/vars.ts +422 -246
- package/src/theme/_constants.ts +26 -0
- package/src/theme/_types.ts +41 -0
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +1 -1
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +1 -6
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +2 -2
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +2 -2
- package/src/theme/build/_deprecated/color/factory.ts +8 -9
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +1 -1
- package/src/theme/build/buildColorTheme.ts +62 -52
- package/src/theme/build/buildTheme.ts +8 -32
- package/src/theme/build/colorToken/colorToken.ts +1 -1
- package/src/theme/build/lib/color-fns/rgba.ts +4 -0
- package/src/theme/build/merge.ts +0 -2
- package/src/theme/build/mixThemeColor.ts +1 -1
- package/src/theme/build/renderColorTheme.ts +34 -37
- package/src/theme/build/renderColorValue.ts +4 -3
- package/src/theme/build/resolveColorTokens.ts +57 -120
- package/src/theme/config/helpers.ts +2 -2
- package/src/theme/config/system.ts +3 -2
- package/src/theme/config/tokens/color/types.ts +5 -18
- package/src/theme/config/tokens/parseTokenKey.ts +1 -1
- package/src/theme/config/tokens/parseTokenValue.ts +1 -1
- package/src/theme/config/tokens/types.ts +3 -2
- package/src/theme/config/types.ts +4 -4
- package/src/theme/defaults/colorTokens.ts +8 -6
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +17 -16
- package/src/theme/getScopedTheme.ts +10 -4
- package/src/theme/index.ts +7 -1
- package/src/theme/palette/constants.ts +13 -0
- package/src/theme/palette/index.ts +2 -0
- package/src/theme/palette/types.ts +4 -0
- package/src/theme/types.ts +32 -0
- package/src/theme/v0/color/_generic.ts +35 -0
- package/src/theme/v0/color/_system.ts +17 -0
- package/src/theme/v0/color/color.ts +40 -0
- package/src/theme/v0/color/index.ts +11 -0
- package/src/theme/v0/color/input.ts +34 -0
- package/src/theme/v0/color/spot.ts +13 -0
- package/src/theme/v0/css.ts +8 -0
- package/src/theme/v0/font.ts +53 -0
- package/src/theme/v0/index.ts +10 -0
- package/src/theme/v0/theme.ts +72 -0
- package/src/theme/v2/avatar.ts +14 -0
- package/src/theme/v2/color/_constants.ts +45 -0
- package/src/theme/v2/color/_helpers.ts +24 -0
- package/src/theme/v2/color/_system.ts +40 -0
- package/src/theme/v2/color/badge.ts +16 -0
- package/src/theme/v2/color/color.ts +34 -0
- package/src/theme/v2/index.ts +4 -0
- package/src/theme/v2/input.ts +33 -0
- package/src/theme/v2/theme.ts +49 -0
- package/src/theme/v3/buildTheme_v3.test.ts +40 -0
- package/src/theme/v3/buildTheme_v3.ts +29 -0
- package/src/theme/v3/color/buildColor_v3.ts +198 -0
- package/src/theme/v3/color/card.ts +121 -0
- package/src/theme/v3/color/color.ts +98 -0
- package/src/theme/v3/color/element.ts +19 -0
- package/src/theme/v3/color/index.ts +7 -0
- package/src/theme/v3/color/parseColor.test.ts +79 -0
- package/src/theme/v3/color/parseColor.ts +167 -0
- package/src/theme/v3/color/renderColor.test.ts +19 -0
- package/src/theme/v3/color/renderColor.ts +33 -0
- package/src/theme/v3/color/token.ts +17 -0
- package/src/theme/v3/color/tokens.ts +5 -0
- package/src/theme/v3/defaults.ts +202 -0
- package/src/theme/v3/index.ts +6 -0
- package/src/theme/v3/merge.ts +22 -0
- package/src/theme/v3/resolveTokens.ts +204 -0
- package/src/theme/v3/tokens.ts +16 -0
- package/src/theme/v3/types.ts +45 -0
- package/src/theme/versioning/getTheme_v2.ts +2 -1
- package/src/theme/versioning/index.ts +0 -4
- package/src/theme/versioning/is_v0.ts +2 -1
- package/src/theme/versioning/is_v2.ts +2 -1
- package/src/theme/versioning/themeColor_v0_v2.ts +33 -5
- package/src/theme/versioning/themeColor_v2_v2_9.ts +49 -0
- package/src/theme/versioning/themeColor_v3_v2.ts +206 -0
- package/src/theme/versioning/v0_v2.ts +6 -1
- package/src/theme/versioning/v2_v0.ts +6 -6
- package/src/theme/versioning/v3_v2.ts +108 -0
- package/src/ui/StyleTags.tsx +24 -0
- package/src/ui/_compat/index.ts +9 -0
- package/src/ui/_compat/styles/_responsive.ts +19 -0
- package/src/ui/_compat/styles/index.ts +1 -0
- package/src/ui/_compat/theme/index.ts +5 -0
- package/src/ui/_compat/theme/theme.test.tsx +73 -0
- package/src/ui/_compat/theme/themeColorProvider.tsx +30 -0
- package/src/ui/_compat/theme/themeContext.ts +10 -0
- package/src/ui/_compat/theme/themeProvider.tsx +74 -0
- package/src/ui/_compat/theme/useRootTheme.ts +17 -0
- package/src/ui/_compat/theme/useTheme.ts +16 -0
- package/src/ui/_compat/types.ts +274 -0
- package/src/ui/components/autocomplete/__mocks__/apiStore.ts +49 -0
- package/src/ui/components/autocomplete/__workshop__/async.tsx +156 -0
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +131 -0
- package/src/ui/components/autocomplete/__workshop__/custom.tsx +90 -0
- package/src/ui/components/autocomplete/__workshop__/example.tsx +80 -0
- package/src/ui/components/autocomplete/__workshop__/fullscreen.tsx +293 -0
- package/src/ui/components/autocomplete/autocomplete.tsx +722 -0
- package/src/ui/components/autocomplete/autocompleteOption.tsx +45 -0
- package/src/ui/components/autocomplete/types.ts +108 -0
- package/src/ui/components/breadcrumbs/__workshop__/example.tsx +62 -0
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +127 -0
- package/src/ui/components/dialog/__workshop__/activate.tsx +134 -0
- package/src/ui/components/dialog/__workshop__/nested.tsx +72 -0
- package/src/ui/components/dialog/__workshop__/onScroll.tsx +39 -0
- package/src/ui/components/dialog/__workshop__/panes.tsx +82 -0
- package/src/ui/components/dialog/__workshop__/position.tsx +30 -0
- package/src/ui/components/dialog/__workshop__/props.tsx +77 -0
- package/src/ui/components/dialog/__workshop__/wrapped.tsx +76 -0
- package/src/ui/components/dialog/dialog.tsx +432 -0
- package/src/ui/components/dialog/dialogProvider.tsx +35 -0
- package/src/ui/components/dialog/useDialog.ts +11 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +54 -0
- package/src/ui/components/menu/__workshop__/asComponent.tsx +45 -0
- package/src/ui/components/menu/__workshop__/avatarMenu.tsx +51 -0
- package/src/ui/components/menu/__workshop__/constrainedInBoundary.tsx +134 -0
- package/src/ui/components/menu/__workshop__/customSelectedState.tsx +39 -0
- package/src/ui/components/menu/__workshop__/menuButton.tsx +80 -0
- package/src/ui/components/menu/__workshop__/shouldFocus.tsx +47 -0
- package/src/ui/components/menu/__workshop__/tones.tsx +25 -0
- package/src/ui/components/menu/menu.test.tsx +128 -0
- package/src/ui/components/menu/menu.tsx +200 -0
- package/src/ui/components/menu/menuButton.tsx +275 -0
- package/src/ui/components/menu/menuContext.ts +31 -0
- package/src/ui/components/menu/menuDivider.tsx +22 -0
- package/src/ui/components/menu/menuGroup.tsx +228 -0
- package/src/ui/components/menu/menuItem.tsx +180 -0
- package/src/ui/components/menu/useMenu.ts +21 -0
- package/src/ui/components/menu/useMenuController.ts +241 -0
- package/src/ui/components/skeleton/__workshop__/delay.tsx +70 -0
- package/src/ui/components/skeleton/__workshop__/skeleton.tsx +64 -0
- package/src/ui/components/skeleton/skeleton.tsx +53 -0
- package/src/ui/components/skeleton/textSkeleton.tsx +132 -0
- package/src/ui/components/tab/tab.tsx +105 -0
- package/src/ui/components/tab/tabList.tsx +74 -0
- package/src/ui/components/tab/tabPanel.tsx +40 -0
- package/src/ui/components/toast/__workshop__/hook.tsx +71 -0
- package/src/ui/components/toast/__workshop__/toast.tsx +26 -0
- package/src/ui/components/toast/toast.test.tsx +101 -0
- package/src/ui/components/toast/toast.tsx +211 -0
- package/src/ui/components/toast/toastLayer.tsx +38 -0
- package/src/ui/components/toast/toastProvider.tsx +113 -0
- package/src/ui/components/toast/toastState.ts +6 -0
- package/src/ui/components/toast/types.ts +28 -0
- package/src/ui/components/toast/useToast.ts +25 -0
- package/src/ui/components/tree/__workshop__/basic.tsx +105 -0
- package/src/ui/components/tree/__workshop__/tabFromElement.tsx +84 -0
- package/src/ui/components/tree/tree.tsx +244 -0
- package/src/ui/components/tree/treeGroup.tsx +30 -0
- package/src/ui/components/tree/treeItem.tsx +220 -0
- package/src/ui/components/tree/useTree.ts +17 -0
- package/src/ui/constants.ts +85 -0
- package/src/ui/helpers/focus.ts +100 -0
- package/src/ui/helpers/index.ts +5 -0
- package/src/ui/helpers/props.ts +10 -0
- package/src/ui/hooks/useArrayProp.ts +29 -0
- package/src/ui/hooks/useClickOutside.test.tsx +482 -0
- package/src/ui/hooks/useClickOutside.ts +117 -0
- package/src/ui/hooks/useClickOutsideEvent.test.tsx +115 -0
- package/src/ui/hooks/useClickOutsideEvent.ts +73 -0
- package/src/ui/hooks/useDelayed.test.ts +68 -0
- package/src/ui/hooks/useDelayedState.ts +28 -0
- package/src/ui/hooks/useElementRect/__workshop__/example.tsx +32 -0
- package/src/ui/hooks/useElementSize.ts +19 -0
- package/src/ui/hooks/useForwardedRef.ts +19 -0
- package/src/ui/hooks/useGlobalKeyDown.ts +17 -0
- package/src/ui/hooks/useMatchMedia.ts +28 -0
- package/src/ui/hooks/useMediaIndex/useMediaIndex.test.tsx +36 -0
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +102 -0
- package/src/ui/hooks/usePrefersDark.hydration.test.tsx +56 -0
- package/src/ui/hooks/usePrefersDark.test.tsx +19 -0
- package/src/ui/hooks/usePrefersDark.ts +16 -0
- package/src/ui/hooks/usePrefersReducedMotion.hydration.test.tsx +56 -0
- package/src/ui/hooks/usePrefersReducedMotion.test.tsx +19 -0
- package/src/ui/hooks/usePrefersReducedMotion.ts +16 -0
- package/src/ui/index.ts +9 -0
- package/src/ui/lib/createGlobalScopedContext.ts +34 -0
- package/src/ui/lib/globalScope.ts +19 -0
- package/src/ui/primitives/_selectable/selectable.tsx +31 -0
- package/src/ui/primitives/avatar/__workshop__/asButton.tsx +14 -0
- package/src/ui/primitives/avatar/__workshop__/stack.tsx +25 -0
- package/src/ui/primitives/avatar/__workshop__/withinButton.tsx +63 -0
- package/src/ui/primitives/avatar/__workshop__/withinMenuItem.tsx +72 -0
- package/src/ui/primitives/avatar/avatar.tsx +158 -0
- package/src/ui/primitives/avatar/avatarCounter.tsx +62 -0
- package/src/ui/primitives/avatar/avatarStack.tsx +82 -0
- package/src/ui/primitives/avatar/types.ts +17 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +30 -0
- package/src/ui/primitives/badge/__workshop__/tones.tsx +21 -0
- package/src/ui/primitives/badge/badge.test.tsx +16 -0
- package/src/ui/primitives/badge/badge.tsx +64 -0
- package/src/ui/primitives/box/__workshop__/props.tsx +20 -0
- package/src/ui/primitives/box/box.tsx +162 -0
- package/src/ui/primitives/button/__workshop__/custom.tsx +50 -0
- package/src/ui/primitives/button/__workshop__/disabled.tsx +74 -0
- package/src/ui/primitives/button/__workshop__/props.tsx +58 -0
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +36 -0
- package/src/ui/primitives/button/__workshop__/stacked.tsx +59 -0
- package/src/ui/primitives/button/__workshop__/styled1.tsx +17 -0
- package/src/ui/primitives/button/__workshop__/styled2.tsx +19 -0
- package/src/ui/primitives/button/button.test.tsx +44 -0
- package/src/ui/primitives/button/button.tsx +207 -0
- package/src/ui/primitives/card/__workshop__/allTones.tsx +27 -0
- package/src/ui/primitives/card/__workshop__/asButton.tsx +107 -0
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +27 -0
- package/src/ui/primitives/card/__workshop__/checkered.tsx +26 -0
- package/src/ui/primitives/card/__workshop__/interactive.tsx +30 -0
- package/src/ui/primitives/card/__workshop__/listNavigation.tsx +80 -0
- package/src/ui/primitives/card/__workshop__/props.tsx +55 -0
- package/src/ui/primitives/card/__workshop__/selected.tsx +93 -0
- package/src/ui/primitives/card/__workshop__/styled.tsx +14 -0
- package/src/ui/primitives/card/card.tsx +118 -0
- package/src/ui/primitives/card/cardContext.ts +10 -0
- package/src/ui/primitives/card/cardProvider.tsx +19 -0
- package/src/ui/primitives/card/index.ts +4 -0
- package/src/ui/primitives/card/types.ts +27 -0
- package/src/ui/primitives/card/useCard.ts +7 -0
- package/src/ui/primitives/checkbox/__workshop__/tones.tsx +28 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +74 -0
- package/src/ui/primitives/code/__workshop__/props.tsx +21 -0
- package/src/ui/primitives/code/code.tsx +49 -0
- package/src/ui/primitives/code/refractor.tsx +20 -0
- package/src/ui/primitives/container/__workshop__/example.tsx +20 -0
- package/src/ui/primitives/container/container.tsx +35 -0
- package/src/ui/primitives/flex/__workshop__/example.tsx +34 -0
- package/src/ui/primitives/flex/__workshop__/gap.tsx +25 -0
- package/src/ui/primitives/flex/flex.tsx +29 -0
- package/src/ui/primitives/grid/__workshop__/responsive.tsx +54 -0
- package/src/ui/primitives/grid/grid.tsx +30 -0
- package/src/ui/primitives/heading/__workshop__/opticalAlignment.tsx +54 -0
- package/src/ui/primitives/heading/__workshop__/plain.tsx +32 -0
- package/src/ui/primitives/heading/heading.tsx +62 -0
- package/src/ui/primitives/inline/__workshop__/plain.tsx +27 -0
- package/src/ui/primitives/inline/inline.tsx +50 -0
- package/src/ui/primitives/kbd/kbd.tsx +55 -0
- package/src/ui/primitives/label/__workshop__/opticalAlignment.tsx +54 -0
- package/src/ui/primitives/label/__workshop__/plain.tsx +37 -0
- package/src/ui/primitives/label/label.tsx +67 -0
- package/src/ui/primitives/popover/__workshop__/AlignedStory.tsx +77 -0
- package/src/ui/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +32 -0
- package/src/ui/primitives/popover/__workshop__/OpenOnMountStory.tsx +11 -0
- package/src/ui/primitives/popover/__workshop__/PlainStory.tsx +71 -0
- package/src/ui/primitives/popover/__workshop__/SidePanelStory.tsx +93 -0
- package/src/ui/primitives/popover/__workshop__/TestStory.tsx +98 -0
- package/src/ui/primitives/popover/floating-ui/size.ts +83 -0
- package/src/ui/primitives/popover/helpers.ts +32 -0
- package/src/ui/primitives/popover/popover.tsx +422 -0
- package/src/ui/primitives/popover/popoverCard.tsx +161 -0
- package/src/ui/primitives/radio/__workshop__/plain.tsx +28 -0
- package/src/ui/primitives/radio/radio.tsx +49 -0
- package/src/ui/primitives/select/__workshop__/plain.tsx +30 -0
- package/src/ui/primitives/select/__workshop__/readOnly.tsx +23 -0
- package/src/ui/primitives/select/select.tsx +85 -0
- package/src/ui/primitives/spinner/__workshop__/Props.tsx +16 -0
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +16 -0
- package/src/ui/primitives/spinner/spinner.tsx +33 -0
- package/src/ui/primitives/stack/__workshop__/plain.tsx +32 -0
- package/src/ui/primitives/stack/index.ts +1 -0
- package/src/ui/primitives/stack/stack.tsx +45 -0
- package/src/ui/primitives/switch/switch.tsx +75 -0
- package/src/ui/primitives/text/__workshop__/colored.tsx +23 -0
- package/src/ui/primitives/text/__workshop__/example.tsx +39 -0
- package/src/ui/primitives/text/__workshop__/opticalAlignment.tsx +48 -0
- package/src/ui/primitives/text/text.tsx +64 -0
- package/src/ui/primitives/textArea/__workshop__/plain.tsx +50 -0
- package/src/ui/primitives/textArea/textArea.tsx +71 -0
- package/src/ui/primitives/textInput/__workshop__/index.ts +44 -0
- package/src/ui/primitives/textInput/__workshop__/plain.tsx +104 -0
- package/src/ui/primitives/textInput/__workshop__/readOnly.tsx +9 -0
- package/src/ui/primitives/textInput/__workshop__/tones.tsx +277 -0
- package/src/ui/primitives/textInput/__workshop__/typed.tsx +23 -0
- package/src/ui/primitives/textInput/textInput.tsx +286 -0
- package/src/ui/primitives/tooltip/__workshop__/customPortal.tsx +102 -0
- package/src/ui/primitives/tooltip/__workshop__/overflowingBoundary.tsx +74 -0
- package/src/ui/primitives/tooltip/__workshop__/props.tsx +111 -0
- package/src/ui/primitives/tooltip/__workshop__/resizableBoundary.tsx +86 -0
- package/src/ui/primitives/tooltip/tooltip.test.tsx +453 -0
- package/src/ui/primitives/tooltip/tooltip.tsx +466 -0
- package/src/ui/primitives/tooltip/tooltipCard.tsx +115 -0
- package/src/ui/primitives/tooltip/tooltipDelayGroup/index.ts +4 -0
- package/src/ui/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +55 -0
- package/src/ui/primitives/tooltip/tooltipDelayGroup/types.ts +10 -0
- package/src/ui/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +13 -0
- package/src/ui/primitives/types.ts +166 -0
- package/src/ui/types/box.ts +22 -0
- package/src/ui/types/button.ts +24 -0
- package/src/ui/types/flex.ts +27 -0
- package/src/ui/types/grid.ts +17 -0
- package/src/ui/types/gridItem.ts +32 -0
- package/src/ui/types/index.ts +15 -0
- package/src/ui/types/props.ts +18 -0
- package/src/ui/types/selectable.ts +7 -0
- package/src/ui/types/text.ts +7 -0
- package/src/ui/utils/arrow/arrow.tsx +59 -0
- package/src/ui/utils/boundaryElement/boundaryElement.test.tsx +100 -0
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +24 -0
- package/src/ui/utils/boundaryElement/index.ts +3 -0
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +26 -0
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +23 -0
- package/src/ui/utils/elementQuery/__workshop__/customMedia.tsx +30 -0
- package/src/ui/utils/elementQuery/elementQuery.tsx +53 -0
- package/src/ui/utils/errorBoundary.tsx +48 -0
- package/src/ui/utils/getElementRef.ts +26 -0
- package/src/ui/utils/layer/__workshop__/multipleRoots.tsx +49 -0
- package/src/ui/utils/layer/__workshop__/nested.tsx +98 -0
- package/src/ui/utils/layer/__workshop__/responsiveZOffset.tsx +13 -0
- package/src/ui/utils/layer/index.ts +4 -0
- package/src/ui/utils/layer/layer.test.tsx +108 -0
- package/src/ui/utils/layer/layer.tsx +112 -0
- package/src/ui/utils/layer/layerProvider.tsx +110 -0
- package/src/ui/utils/layer/useLayer.ts +26 -0
- package/src/ui/utils/portal/portal.test.tsx +103 -0
- package/src/ui/utils/portal/portal.ts +46 -0
- package/src/ui/utils/portal/portalProvider.tsx +79 -0
- package/src/ui/utils/portal/usePortal.ts +25 -0
- package/src/ui/utils/spanWithTextOverflow.tsx +10 -0
- package/src/ui/utils/srOnly/index.ts +1 -0
- package/src/ui/utils/srOnly/srOnly.tsx +35 -0
- package/src/ui/utils/virtualList/virtualList.tsx +189 -0
- package/dist/_chunks-cjs/getTheme_v2.js +0 -316
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -317
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/dist/_legacy/getTheme_v2.esm.js +0 -317
- package/dist/_legacy/getTheme_v2.esm.js.map +0 -1
- package/dist/css.esm.js +0 -3135
- package/dist/css.esm.js.map +0 -1
- package/dist/index.esm.js +0 -5843
- package/dist/index.esm.js.map +0 -1
- package/dist/theme.esm.js +0 -3088
- package/dist/theme.esm.js.map +0 -1
- package/src/core/__workshop__/constants.ts +0 -296
- package/src/core/__workshop__/fontsPlugin.tsx +0 -76
- package/src/core/_compat.ts +0 -264
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -155
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -136
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -88
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -78
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -293
- package/src/core/components/autocomplete/autocomplete.styles.tsx +0 -38
- package/src/core/components/autocomplete/autocomplete.tsx +0 -735
- package/src/core/components/autocomplete/autocompleteOption.tsx +0 -44
- package/src/core/components/autocomplete/types.ts +0 -108
- package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -55
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +0 -17
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +0 -111
- package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -133
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -81
- package/src/core/components/dialog/__workshop__/position.tsx +0 -29
- package/src/core/components/dialog/__workshop__/props.tsx +0 -74
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -78
- package/src/core/components/dialog/dialog.tsx +0 -414
- package/src/core/components/dialog/dialogProvider.tsx +0 -34
- package/src/core/components/dialog/useDialog.ts +0 -10
- package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
- package/src/core/components/hotkeys/hotkeys.tsx +0 -50
- package/src/core/components/menu/__workshop__/.eslintrc +0 -5
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -44
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -50
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -133
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -38
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -79
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -46
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/menu.test.tsx +0 -129
- package/src/core/components/menu/menu.tsx +0 -175
- package/src/core/components/menu/menuButton.tsx +0 -289
- package/src/core/components/menu/menuContext.ts +0 -29
- package/src/core/components/menu/menuDivider.ts +0 -13
- package/src/core/components/menu/menuGroup.tsx +0 -210
- package/src/core/components/menu/menuItem.tsx +0 -187
- package/src/core/components/menu/useMenu.ts +0 -20
- package/src/core/components/menu/useMenuController.ts +0 -230
- package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -69
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -63
- package/src/core/components/skeleton/skeleton.tsx +0 -58
- package/src/core/components/skeleton/styles.ts +0 -50
- package/src/core/components/skeleton/textSkeleton.tsx +0 -122
- package/src/core/components/tab/__workshop__/.eslintrc +0 -5
- package/src/core/components/tab/tab.tsx +0 -99
- package/src/core/components/tab/tabList.tsx +0 -78
- package/src/core/components/tab/tabPanel.tsx +0 -38
- package/src/core/components/toast/__workshop__/.eslintrc +0 -5
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/toast.tsx +0 -25
- package/src/core/components/toast/styles.ts +0 -61
- package/src/core/components/toast/toast.test.tsx +0 -102
- package/src/core/components/toast/toast.tsx +0 -109
- package/src/core/components/toast/toastProvider.tsx +0 -202
- package/src/core/components/toast/types.ts +0 -20
- package/src/core/components/toast/useToast.ts +0 -24
- package/src/core/components/tree/__workshop__/.eslintrc +0 -5
- package/src/core/components/tree/__workshop__/basic.tsx +0 -104
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -83
- package/src/core/components/tree/style.ts +0 -104
- package/src/core/components/tree/tree.tsx +0 -242
- package/src/core/components/tree/treeGroup.tsx +0 -29
- package/src/core/components/tree/treeItem.tsx +0 -217
- package/src/core/components/tree/useTree.ts +0 -16
- package/src/core/constants.ts +0 -57
- package/src/core/helpers/focus.ts +0 -100
- package/src/core/helpers/index.ts +0 -4
- package/src/core/hooks/useArrayProp.ts +0 -25
- package/src/core/hooks/useClickOutside.test.tsx +0 -483
- package/src/core/hooks/useClickOutside.ts +0 -116
- package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -116
- package/src/core/hooks/useClickOutsideEvent.ts +0 -72
- package/src/core/hooks/useDelayed.test.ts +0 -67
- package/src/core/hooks/useDelayedState.ts +0 -29
- package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -31
- package/src/core/hooks/useElementSize.ts +0 -18
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useGlobalKeyDown.ts +0 -12
- package/src/core/hooks/useMatchMedia.ts +0 -46
- package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +0 -35
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +0 -101
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -57
- package/src/core/hooks/usePrefersDark.test.tsx +0 -18
- package/src/core/hooks/usePrefersDark.ts +0 -16
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -57
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +0 -18
- package/src/core/hooks/usePrefersReducedMotion.ts +0 -16
- package/src/core/index.ts +0 -11
- package/src/core/lib/createGlobalScopedContext.ts +0 -33
- package/src/core/lib/globalScope.ts +0 -20
- package/src/core/lib/styled/elements.ts +0 -135
- package/src/core/lib/styled/index.ts +0 -2
- package/src/core/lib/styled/members.ts +0 -15
- package/src/core/lib/styled/styled.ts +0 -79
- package/src/core/primitives/_selectable/selectable.tsx +0 -27
- package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -13
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -24
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -62
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -69
- package/src/core/primitives/avatar/avatar.tsx +0 -217
- package/src/core/primitives/avatar/avatarCounter.tsx +0 -93
- package/src/core/primitives/avatar/avatarStack.tsx +0 -100
- package/src/core/primitives/avatar/styles.ts +0 -166
- package/src/core/primitives/avatar/types.ts +0 -16
- package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -29
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -20
- package/src/core/primitives/badge/badge.test.tsx +0 -15
- package/src/core/primitives/badge/badge.tsx +0 -59
- package/src/core/primitives/badge/styles.ts +0 -19
- package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/box/__workshop__/props.tsx +0 -19
- package/src/core/primitives/box/box.tsx +0 -118
- package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -47
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -73
- package/src/core/primitives/button/__workshop__/props.tsx +0 -52
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -57
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/button.test.tsx +0 -43
- package/src/core/primitives/button/button.tsx +0 -181
- package/src/core/primitives/button/styles.ts +0 -116
- package/src/core/primitives/card/RootCardContext.ts +0 -3
- package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -27
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -88
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -16
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -23
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -77
- package/src/core/primitives/card/__workshop__/props.tsx +0 -49
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -91
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/card/card.tsx +0 -113
- package/src/core/primitives/card/index.ts +0 -2
- package/src/core/primitives/card/styles.ts +0 -146
- package/src/core/primitives/card/types.ts +0 -11
- package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -22
- package/src/core/primitives/checkbox/checkbox.tsx +0 -70
- package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/code/__workshop__/props.tsx +0 -20
- package/src/core/primitives/code/code.tsx +0 -51
- package/src/core/primitives/code/styles.ts +0 -77
- package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/container/__workshop__/example.tsx +0 -19
- package/src/core/primitives/container/container.tsx +0 -32
- package/src/core/primitives/container/styles.ts +0 -22
- package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -33
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/flex.tsx +0 -44
- package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/grid/grid.tsx +0 -48
- package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -66
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -31
- package/src/core/primitives/heading/heading.tsx +0 -99
- package/src/core/primitives/heading/styles.ts +0 -63
- package/src/core/primitives/heading/types.ts +0 -7
- package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -26
- package/src/core/primitives/inline/inline.tsx +0 -56
- package/src/core/primitives/inline/styles.ts +0 -31
- package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/kbd/kbd.tsx +0 -53
- package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -23
- package/src/core/primitives/label/label.tsx +0 -96
- package/src/core/primitives/label/styles.ts +0 -44
- package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -76
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -70
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -86
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -96
- package/src/core/primitives/popover/floating-ui/size.ts +0 -82
- package/src/core/primitives/popover/helpers.ts +0 -31
- package/src/core/primitives/popover/popover.tsx +0 -476
- package/src/core/primitives/popover/popoverCard.tsx +0 -153
- package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/radio/radio.tsx +0 -50
- package/src/core/primitives/radio/styles.ts +0 -116
- package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/select/select.tsx +0 -86
- package/src/core/primitives/select/styles.ts +0 -166
- package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -14
- package/src/core/primitives/spinner/spinner.tsx +0 -31
- package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -31
- package/src/core/primitives/stack/stack.tsx +0 -41
- package/src/core/primitives/stack/styles.ts +0 -31
- package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/switch/styles.ts +0 -172
- package/src/core/primitives/switch/switch.tsx +0 -66
- package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -29
- package/src/core/primitives/text/__workshop__/example.tsx +0 -38
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -58
- package/src/core/primitives/text/styles.ts +0 -73
- package/src/core/primitives/text/text.tsx +0 -85
- package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -49
- package/src/core/primitives/textArea/textArea.tsx +0 -118
- package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -49
- package/src/core/primitives/textInput/__workshop__/multipleTones.tsx +0 -20
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -5
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -239
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -22
- package/src/core/primitives/textInput/textInput.tsx +0 -440
- package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -101
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -73
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -106
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -85
- package/src/core/primitives/tooltip/tooltip.test.tsx +0 -451
- package/src/core/primitives/tooltip/tooltip.tsx +0 -464
- package/src/core/primitives/tooltip/tooltipCard.tsx +0 -110
- package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +0 -4
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +0 -57
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +0 -11
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -12
- package/src/core/primitives/types.ts +0 -165
- package/src/core/styles/border/borderStyle.ts +0 -61
- package/src/core/styles/border/index.ts +0 -2
- package/src/core/styles/border/types.ts +0 -11
- package/src/core/styles/box/boxStyle.ts +0 -74
- package/src/core/styles/box/index.ts +0 -2
- package/src/core/styles/box/types.ts +0 -11
- package/src/core/styles/card/_cardColorStyle.ts +0 -101
- package/src/core/styles/card/index.ts +0 -1
- package/src/core/styles/flex/flexItemStyle.ts +0 -26
- package/src/core/styles/flex/flexStyle.ts +0 -69
- package/src/core/styles/flex/index.ts +0 -3
- package/src/core/styles/flex/types.ts +0 -24
- package/src/core/styles/focusRing/index.ts +0 -25
- package/src/core/styles/font/codeFontStyle.ts +0 -12
- package/src/core/styles/font/headingFontStyle.ts +0 -12
- package/src/core/styles/font/index.ts +0 -6
- package/src/core/styles/font/labelFontStyle.ts +0 -12
- package/src/core/styles/font/responsiveFont.ts +0 -101
- package/src/core/styles/font/textAlignStyle.ts +0 -18
- package/src/core/styles/font/textFontStyle.ts +0 -12
- package/src/core/styles/font/types.ts +0 -34
- package/src/core/styles/grid/gridItemStyle.ts +0 -81
- package/src/core/styles/grid/gridStyle.ts +0 -97
- package/src/core/styles/grid/index.ts +0 -3
- package/src/core/styles/grid/types.ts +0 -37
- package/src/core/styles/helpers.ts +0 -81
- package/src/core/styles/index.ts +0 -5
- package/src/core/styles/input/index.ts +0 -2
- package/src/core/styles/input/responsiveInputPaddingStyle.ts +0 -77
- package/src/core/styles/input/textInputStyle.ts +0 -263
- package/src/core/styles/internal.ts +0 -12
- package/src/core/styles/margin/index.ts +0 -2
- package/src/core/styles/margin/marginStyle.ts +0 -20
- package/src/core/styles/margin/marginsStyle.test.ts +0 -32
- package/src/core/styles/margin/types.ts +0 -9
- package/src/core/styles/padding/index.ts +0 -2
- package/src/core/styles/padding/paddingStyle.test.ts +0 -32
- package/src/core/styles/padding/paddingStyle.ts +0 -20
- package/src/core/styles/padding/types.ts +0 -12
- package/src/core/styles/radius/index.ts +0 -2
- package/src/core/styles/radius/radiusStyle.ts +0 -22
- package/src/core/styles/radius/types.ts +0 -8
- package/src/core/styles/shadow/index.ts +0 -2
- package/src/core/styles/shadow/shadowStyle.ts +0 -29
- package/src/core/styles/shadow/types.ts +0 -6
- package/src/core/styles/types.ts +0 -8
- package/src/core/theme/__workshop__/.eslintrc +0 -5
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -459
- package/src/core/theme/__workshop__/canvas.tsx +0 -350
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -401
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/theme/index.ts +0 -5
- package/src/core/theme/theme.test.tsx +0 -73
- package/src/core/theme/themeColorProvider.tsx +0 -28
- package/src/core/theme/themeContext.ts +0 -10
- package/src/core/theme/themeProvider.tsx +0 -63
- package/src/core/theme/useRootTheme.ts +0 -16
- package/src/core/theme/useTheme.ts +0 -16
- package/src/core/types/box.ts +0 -19
- package/src/core/types/button.ts +0 -22
- package/src/core/types/flex.ts +0 -31
- package/src/core/types/grid.ts +0 -14
- package/src/core/types/gridItem.ts +0 -37
- package/src/core/types/index.ts +0 -14
- package/src/core/types/selectable.ts +0 -6
- package/src/core/types/text.ts +0 -4
- package/src/core/utils/arrow/arrow.tsx +0 -122
- package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -101
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +0 -23
- package/src/core/utils/boundaryElement/index.ts +0 -3
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +0 -25
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +0 -21
- package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/elementQuery.tsx +0 -53
- package/src/core/utils/errorBoundary.tsx +0 -47
- package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -48
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -97
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -12
- package/src/core/utils/layer/index.ts +0 -4
- package/src/core/utils/layer/layer.test.tsx +0 -109
- package/src/core/utils/layer/layer.tsx +0 -108
- package/src/core/utils/layer/layerProvider.tsx +0 -109
- package/src/core/utils/layer/useLayer.ts +0 -25
- package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
- package/src/core/utils/portal/portal.test.tsx +0 -104
- package/src/core/utils/portal/portal.ts +0 -31
- package/src/core/utils/portal/portalProvider.tsx +0 -78
- package/src/core/utils/portal/usePortal.ts +0 -24
- package/src/core/utils/srOnly/srOnly.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
- package/src/core/utils/virtualList/virtualList.tsx +0 -170
- package/src/css/cli/buildCommand.ts +0 -36
- package/src/css/cli/index.ts +0 -38
- package/src/css/compile/comileRules.ts +0 -59
- package/src/css/components/dialog/classes.ts +0 -29
- package/src/css/primitives/badge/rules.ts +0 -25
- package/src/css/primitives/box/rules.ts +0 -25
- package/src/css/primitives/card/rules.ts +0 -93
- package/src/css/primitives/selectable/__style.ts +0 -115
- package/src/css/primitives/selectable/rules.ts +0 -27
- package/src/css/primitives/selectable/selectable.ts +0 -9
- package/src/css/primitives/selectable/types.ts +0 -6
- package/src/css/rules.ts +0 -121
- package/src/css/styles/border/border.ts +0 -22
- package/src/css/styles/border/rules.ts +0 -24
- package/src/css/styles/display/rules.ts +0 -62
- package/src/css/styles/flex/flex.ts +0 -20
- package/src/css/styles/flex/rules.ts +0 -28
- package/src/css/styles/flexItem/flexItem.ts +0 -8
- package/src/css/styles/flexItem/rules.ts +0 -11
- package/src/css/styles/flexItem/types.ts +0 -11
- package/src/css/styles/font/font.ts +0 -12
- package/src/css/styles/font/rules.ts +0 -125
- package/src/css/styles/font/types.ts +0 -6
- package/src/css/styles/gap/gap.ts +0 -8
- package/src/css/styles/gap/rules.ts +0 -33
- package/src/css/styles/gap/types.ts +0 -9
- package/src/css/styles/grid/rules.ts +0 -35
- package/src/css/styles/gridItem/gridItem.ts +0 -15
- package/src/css/styles/gridItem/rules.ts +0 -96
- package/src/css/styles/margin/margin.ts +0 -15
- package/src/css/styles/margin/rules.ts +0 -59
- package/src/css/styles/maxWidth/rules.ts +0 -36
- package/src/css/styles/maxWidth/types.ts +0 -6
- package/src/css/styles/overflow/rules.ts +0 -9
- package/src/css/styles/padding/padding.ts +0 -15
- package/src/css/styles/padding/rules.ts +0 -59
- package/src/css/styles/padding/types.ts +0 -12
- package/src/css/styles/pointerEvents/pointerEvents.ts +0 -6
- package/src/css/styles/pointerEvents/rules.ts +0 -11
- package/src/css/styles/position/position.ts +0 -7
- package/src/css/styles/position/rules.ts +0 -31
- package/src/css/styles/position/types.ts +0 -13
- package/src/css/styles/radius/radius.ts +0 -8
- package/src/css/styles/radius/rules.ts +0 -13
- package/src/css/styles/radius/types.ts +0 -7
- package/src/css/styles/shadow/rules.ts +0 -53
- package/src/css/styles/width/index.ts +0 -2
- package/src/css/styles/width/rules.ts +0 -7
- package/src/css/styles/width/types.ts +0 -8
- package/src/theme/system/_constants.ts +0 -25
- package/src/theme/system/_types.ts +0 -41
- package/src/theme/system/avatar.ts +0 -14
- package/src/theme/system/color/_constants.ts +0 -41
- package/src/theme/system/color/_helpers.ts +0 -23
- package/src/theme/system/color/_system.ts +0 -40
- package/src/theme/system/color/badge.ts +0 -20
- package/src/theme/system/color/color.ts +0 -34
- package/src/theme/system/css.ts +0 -9
- package/src/theme/system/font.ts +0 -52
- package/src/theme/system/index.ts +0 -14
- package/src/theme/system/input.ts +0 -33
- package/src/theme/system/theme.ts +0 -138
- package/src/theme/system/v0/color/_generic.ts +0 -35
- package/src/theme/system/v0/color/_system.ts +0 -13
- package/src/theme/system/v0/color/color.ts +0 -39
- package/src/theme/system/v0/color/index.ts +0 -11
- package/src/theme/system/v0/color/input.ts +0 -34
- package/src/theme/system/v0/color/spot.ts +0 -13
- package/src/theme/system/v0/index.ts +0 -3
- package/theme.js +0 -2
- /package/src/css/{styles → aspects}/border/index.ts +0 -0
- /package/src/css/{styles → aspects}/border/types.ts +0 -0
- /package/src/css/{styles → aspects}/flex/index.ts +0 -0
- /package/src/css/{styles → aspects}/flex/types.ts +0 -0
- /package/src/css/{styles → aspects}/flexItem/index.ts +0 -0
- /package/src/css/{styles → aspects}/font/index.ts +0 -0
- /package/src/css/{styles → aspects}/gap/index.ts +0 -0
- /package/src/css/{styles → aspects}/gridItem/index.ts +0 -0
- /package/src/css/{styles → aspects}/gridItem/types.ts +0 -0
- /package/src/css/{styles → aspects}/height/rules.ts +0 -0
- /package/src/css/{styles → aspects}/margin/index.ts +0 -0
- /package/src/css/{styles → aspects}/margin/types.ts +0 -0
- /package/src/css/{styles → aspects}/maxWidth/index.ts +0 -0
- /package/src/css/{styles → aspects}/maxWidth/maxWidth.ts +0 -0
- /package/src/css/{styles → aspects}/padding/index.ts +0 -0
- /package/src/css/{styles → aspects}/pointerEvents/index.ts +0 -0
- /package/src/css/{styles → aspects}/pointerEvents/types.ts +0 -0
- /package/src/css/{styles → aspects}/position/index.ts +0 -0
- /package/src/css/{styles → aspects}/radius/index.ts +0 -0
- /package/src/css/{styles → aspects}/width/width.ts +0 -0
- /package/src/css/primitives/{selectable → _selectable}/index.ts +0 -0
- /package/src/{core → css}/primitives/stack/index.ts +0 -0
- /package/src/{core → css}/utils/srOnly/index.ts +0 -0
- /package/src/theme/{system/v0 → v0}/avatar.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/base.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/button.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/card.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/muted.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/selectable.ts +0 -0
- /package/src/theme/{system/v0 → v0}/color/solid.ts +0 -0
- /package/src/theme/{system → v0}/focusRing.ts +0 -0
- /package/src/theme/{system/v0 → v0}/input.ts +0 -0
- /package/src/theme/{system → v0}/layer.ts +0 -0
- /package/src/theme/{system → v0}/shadow.ts +0 -0
- /package/src/theme/{system → v0}/styles.ts +0 -0
- /package/src/theme/{system → v2}/color/avatar.ts +0 -0
- /package/src/theme/{system → v2}/color/button.ts +0 -0
- /package/src/theme/{system → v2}/color/index.ts +0 -0
- /package/src/theme/{system → v2}/color/input.ts +0 -0
- /package/src/theme/{system → v2}/color/kbd.ts +0 -0
- /package/src/theme/{system → v2}/color/selectable.ts +0 -0
- /package/src/theme/{system → v2}/color/shadow.ts +0 -0
- /package/src/theme/{system → v2}/color/state.ts +0 -0
- /package/src/theme/{system → v2}/color/syntax.ts +0 -0
- /package/src/{core → ui/_compat}/theme/types.ts +0 -0
- /package/src/{core/components/autocomplete/__fixtures__ → ui/components/autocomplete/__mocks__}/countries.ts +0 -0
- /package/src/{core → ui}/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -0
- /package/src/{core → ui}/components/autocomplete/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/autocomplete/__workshop__/types.ts +0 -0
- /package/src/{core → ui}/components/autocomplete/autocompleteReducer.ts +0 -0
- /package/src/{core → ui}/components/autocomplete/constants.ts +0 -0
- /package/src/{core → ui}/components/autocomplete/index.ts +0 -0
- /package/src/{core → ui}/components/breadcrumbs/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/breadcrumbs/index.ts +0 -0
- /package/src/{core → ui}/components/dialog/__workshop__/autoFocus.tsx +0 -0
- /package/src/{core → ui}/components/dialog/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/dialog/__workshop__/layering.tsx +0 -0
- /package/src/{core → ui}/components/dialog/__workshop__/provider.tsx +0 -0
- /package/src/{core → ui}/components/dialog/dialogContext.ts +0 -0
- /package/src/{core → ui}/components/dialog/index.ts +0 -0
- /package/src/{core → ui}/components/hotkeys/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/hotkeys/__workshop__/plain.tsx +0 -0
- /package/src/{core → ui}/components/hotkeys/index.ts +0 -0
- /package/src/{core → ui}/components/index.ts +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/closableMenuButton.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/customMenuItem.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/disableFocusOnClose.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/groups.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/menuGroupRight.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/nestedMenu.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/onCloseMenuButton.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/selectedItem.tsx +0 -0
- /package/src/{core → ui}/components/menu/__workshop__/withoutArrow.tsx +0 -0
- /package/src/{core → ui}/components/menu/helpers.ts +0 -0
- /package/src/{core → ui}/components/menu/index.ts +0 -0
- /package/src/{core → ui}/components/skeleton/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/skeleton/index.ts +0 -0
- /package/src/{core → ui}/components/tab/__workshop__/example.tsx +0 -0
- /package/src/{core → ui}/components/tab/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/tab/index.ts +0 -0
- /package/src/{core → ui}/components/toast/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/toast/index.ts +0 -0
- /package/src/{core → ui}/components/toast/toastContext.ts +0 -0
- /package/src/{core → ui}/components/tree/__workshop__/basic.perf.ts +0 -0
- /package/src/{core → ui}/components/tree/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/components/tree/helpers.ts +0 -0
- /package/src/{core → ui}/components/tree/index.ts +0 -0
- /package/src/{core → ui}/components/tree/treeContext.ts +0 -0
- /package/src/{core → ui}/components/tree/types.ts +0 -0
- /package/src/{core → ui}/global.ts +0 -0
- /package/src/{core → ui}/helpers/animation.ts +0 -0
- /package/src/{core → ui}/helpers/element.ts +0 -0
- /package/src/{core → ui}/helpers/scroll.ts +0 -0
- /package/src/{core → ui}/hooks/index.ts +0 -0
- /package/src/{core → ui}/hooks/useCustomValidity.ts +0 -0
- /package/src/{core → ui}/hooks/useElementRect/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/hooks/useElementRect/index.ts +0 -0
- /package/src/{core → ui}/hooks/useElementRect/useElementRect.ts +0 -0
- /package/src/{core → ui}/hooks/useIsomorphicEffect.ts +0 -0
- /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/hooks/useMediaIndex/__workshop__/test.tsx +0 -0
- /package/src/{core → ui}/hooks/useMediaIndex/index.ts +0 -0
- /package/src/{core → ui}/hooks/useMounted.ts +0 -0
- /package/src/{core → ui}/lib/isRecord.ts +0 -0
- /package/src/{core → ui}/middleware/origin.ts +0 -0
- /package/src/{core → ui}/observers/elementSizeObserver.ts +0 -0
- /package/src/{core → ui}/observers/index.ts +0 -0
- /package/src/{core → ui}/observers/resizeObserver.ts +0 -0
- /package/src/{core → ui}/primitives/_selectable/index.ts +0 -0
- /package/src/{core → ui}/primitives/avatar/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/avatar/index.ts +0 -0
- /package/src/{core → ui}/primitives/badge/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/badge/index.ts +0 -0
- /package/src/{core → ui}/primitives/badge/types.ts +0 -0
- /package/src/{core → ui}/primitives/box/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/box/__workshop__/responsive.tsx +0 -0
- /package/src/{core → ui}/primitives/box/index.ts +0 -0
- /package/src/{core → ui}/primitives/button/__workshop__/customIcons.tsx +0 -0
- /package/src/{core → ui}/primitives/button/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/button/__workshop__/mixedChildren.tsx +0 -0
- /package/src/{core → ui}/primitives/button/__workshop__/uploadButton.tsx +0 -0
- /package/src/{core → ui}/primitives/button/index.ts +0 -0
- /package/src/{core → ui}/primitives/card/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/checkbox/__workshop__/example.tsx +0 -0
- /package/src/{core → ui}/primitives/checkbox/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/checkbox/__workshop__/props.tsx +0 -0
- /package/src/{core → ui}/primitives/checkbox/__workshop__/readOnly.tsx +0 -0
- /package/src/{core → ui}/primitives/checkbox/index.ts +0 -0
- /package/src/{core → ui}/primitives/code/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/code/__workshop__/opticalAlignment.tsx +0 -0
- /package/src/{core → ui}/primitives/code/index.ts +0 -0
- /package/src/{core → ui}/primitives/container/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/container/index.ts +0 -0
- /package/src/{core → ui}/primitives/container/types.ts +0 -0
- /package/src/{core → ui}/primitives/flex/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/flex/index.ts +0 -0
- /package/src/{core → ui}/primitives/grid/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/grid/index.ts +0 -0
- /package/src/{core → ui}/primitives/heading/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/heading/index.ts +0 -0
- /package/src/{core → ui}/primitives/index.ts +0 -0
- /package/src/{core → ui}/primitives/inline/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/inline/index.ts +0 -0
- /package/src/{core → ui}/primitives/inline/types.ts +0 -0
- /package/src/{core → ui}/primitives/kbd/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/kbd/__workshop__/plain.tsx +0 -0
- /package/src/{core/primitives/kbd/index.tsx → ui/primitives/kbd/index.ts} +0 -0
- /package/src/{core → ui}/primitives/label/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/label/index.ts +0 -0
- /package/src/{core → ui}/primitives/popover/__workshop__/MarginsStory.tsx +0 -0
- /package/src/{core → ui}/primitives/popover/__workshop__/RecursiveStory.tsx +0 -0
- /package/src/{core → ui}/primitives/popover/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/popover/constants.ts +0 -0
- /package/src/{core → ui}/primitives/popover/index.ts +0 -0
- /package/src/{core → ui}/primitives/popover/types.ts +0 -0
- /package/src/{core → ui}/primitives/radio/__workshop__/example.tsx +0 -0
- /package/src/{core → ui}/primitives/radio/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/radio/index.ts +0 -0
- /package/src/{core → ui}/primitives/select/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/select/index.ts +0 -0
- /package/src/{core → ui}/primitives/spinner/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/spinner/index.ts +0 -0
- /package/src/{core → ui}/primitives/stack/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/switch/__workshop__/example.tsx +0 -0
- /package/src/{core → ui}/primitives/switch/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/switch/__workshop__/props.tsx +0 -0
- /package/src/{core → ui}/primitives/switch/index.ts +0 -0
- /package/src/{core → ui}/primitives/text/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/text/index.ts +0 -0
- /package/src/{core → ui}/primitives/textArea/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/textArea/index.ts +0 -0
- /package/src/{core → ui}/primitives/textInput/__workshop__/clearButton.tsx +0 -0
- /package/src/{core → ui}/primitives/textInput/__workshop__/customValidity.tsx +0 -0
- /package/src/{core → ui}/primitives/textInput/__workshop__/states.tsx +0 -0
- /package/src/{core → ui}/primitives/textInput/index.ts +0 -0
- /package/src/{core → ui}/primitives/tooltip/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/primitives/tooltip/constants.ts +0 -0
- /package/src/{core → ui}/primitives/tooltip/index.ts +0 -0
- /package/src/{core → ui}/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -0
- /package/src/{core → ui}/types/avatar.ts +0 -0
- /package/src/{core → ui}/types/badge.ts +0 -0
- /package/src/{core → ui}/types/card.ts +0 -0
- /package/src/{core → ui}/types/dialog.ts +0 -0
- /package/src/{core → ui}/types/placement.ts +0 -0
- /package/src/{core → ui}/types/popover.ts +0 -0
- /package/src/{core → ui}/types/radius.ts +0 -0
- /package/src/{core → ui}/utils/arrow/cmds.ts +0 -0
- /package/src/{core → ui}/utils/arrow/index.ts +0 -0
- /package/src/{core → ui}/utils/boundaryElement/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/utils/boundaryElement/__workshop__/plain.tsx +0 -0
- /package/src/{core → ui}/utils/boundaryElement/boundaryElementContext.ts +0 -0
- /package/src/{core → ui}/utils/boundaryElement/types.ts +0 -0
- /package/src/{core → ui}/utils/conditionalWrapper/index.ts +0 -0
- /package/src/{core → ui}/utils/elementQuery/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/utils/elementQuery/helpers.ts +0 -0
- /package/src/{core → ui}/utils/elementQuery/index.ts +0 -0
- /package/src/{core → ui}/utils/index.ts +0 -0
- /package/src/{core → ui}/utils/layer/__workshop__/_debug.tsx +0 -0
- /package/src/{core → ui}/utils/layer/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/utils/layer/getLayerContext.test.ts +0 -0
- /package/src/{core → ui}/utils/layer/getLayerContext.ts +0 -0
- /package/src/{core → ui}/utils/layer/layerContext.ts +0 -0
- /package/src/{core → ui}/utils/layer/types.ts +0 -0
- /package/src/{core → ui}/utils/portal/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/utils/portal/__workshop__/named.tsx +0 -0
- /package/src/{core → ui}/utils/portal/index.ts +0 -0
- /package/src/{core → ui}/utils/portal/portalContext.ts +0 -0
- /package/src/{core → ui}/utils/portal/types.ts +0 -0
- /package/src/{core → ui}/utils/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/{core → ui}/utils/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/{core → ui}/utils/virtualList/__workshop__/index.ts +0 -0
- /package/src/{core → ui}/utils/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/{core → ui}/utils/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/{core → ui}/utils/virtualList/index.ts +0 -0
package/dist/theme.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var
|
|
3
|
+
var color = require("@sanity/color");
|
|
4
|
+
const AVATAR_SIZE = [0, 1, 2, 3], CONTAINER = [0, 1, 2, 3, 4, 5, "auto"], 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], FONT_HEADING_SIZE = [0, 1, 2, 3, 4, 5], FONT_LABEL_SIZE = [0, 1, 2, 3, 4, 5], FONT_TEXT_SIZE = [0, 1, 2, 3, 4], SHADOW = [0, 1, 2, 3, 4, 5];
|
|
4
5
|
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
5
6
|
return {
|
|
6
7
|
default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
|
|
@@ -57,46 +58,226 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
|
57
58
|
function createSolidTones(opts, base, dark, name) {
|
|
58
59
|
return {
|
|
59
60
|
default: {
|
|
60
|
-
enabled: opts.solid({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
enabled: opts.solid({
|
|
62
|
+
base,
|
|
63
|
+
dark,
|
|
64
|
+
tone: "default",
|
|
65
|
+
name,
|
|
66
|
+
state: "enabled"
|
|
67
|
+
}),
|
|
68
|
+
disabled: opts.solid({
|
|
69
|
+
base,
|
|
70
|
+
dark,
|
|
71
|
+
tone: "default",
|
|
72
|
+
name,
|
|
73
|
+
state: "disabled"
|
|
74
|
+
}),
|
|
75
|
+
hovered: opts.solid({
|
|
76
|
+
base,
|
|
77
|
+
dark,
|
|
78
|
+
tone: "default",
|
|
79
|
+
name,
|
|
80
|
+
state: "hovered"
|
|
81
|
+
}),
|
|
82
|
+
pressed: opts.solid({
|
|
83
|
+
base,
|
|
84
|
+
dark,
|
|
85
|
+
tone: "default",
|
|
86
|
+
name,
|
|
87
|
+
state: "pressed"
|
|
88
|
+
}),
|
|
89
|
+
selected: opts.solid({
|
|
90
|
+
base,
|
|
91
|
+
dark,
|
|
92
|
+
tone: "default",
|
|
93
|
+
name,
|
|
94
|
+
state: "selected"
|
|
95
|
+
})
|
|
65
96
|
},
|
|
66
97
|
transparent: {
|
|
67
|
-
enabled: opts.solid({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
enabled: opts.solid({
|
|
99
|
+
base,
|
|
100
|
+
dark,
|
|
101
|
+
tone: "transparent",
|
|
102
|
+
name,
|
|
103
|
+
state: "enabled"
|
|
104
|
+
}),
|
|
105
|
+
disabled: opts.solid({
|
|
106
|
+
base,
|
|
107
|
+
dark,
|
|
108
|
+
tone: "transparent",
|
|
109
|
+
name,
|
|
110
|
+
state: "disabled"
|
|
111
|
+
}),
|
|
112
|
+
hovered: opts.solid({
|
|
113
|
+
base,
|
|
114
|
+
dark,
|
|
115
|
+
tone: "transparent",
|
|
116
|
+
name,
|
|
117
|
+
state: "hovered"
|
|
118
|
+
}),
|
|
119
|
+
pressed: opts.solid({
|
|
120
|
+
base,
|
|
121
|
+
dark,
|
|
122
|
+
tone: "transparent",
|
|
123
|
+
name,
|
|
124
|
+
state: "pressed"
|
|
125
|
+
}),
|
|
126
|
+
selected: opts.solid({
|
|
127
|
+
base,
|
|
128
|
+
dark,
|
|
129
|
+
tone: "transparent",
|
|
130
|
+
name,
|
|
131
|
+
state: "selected"
|
|
132
|
+
})
|
|
72
133
|
},
|
|
73
134
|
primary: {
|
|
74
|
-
enabled: opts.solid({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
135
|
+
enabled: opts.solid({
|
|
136
|
+
base,
|
|
137
|
+
dark,
|
|
138
|
+
tone: "primary",
|
|
139
|
+
name,
|
|
140
|
+
state: "enabled"
|
|
141
|
+
}),
|
|
142
|
+
disabled: opts.solid({
|
|
143
|
+
base,
|
|
144
|
+
dark,
|
|
145
|
+
tone: "primary",
|
|
146
|
+
name,
|
|
147
|
+
state: "disabled"
|
|
148
|
+
}),
|
|
149
|
+
hovered: opts.solid({
|
|
150
|
+
base,
|
|
151
|
+
dark,
|
|
152
|
+
tone: "primary",
|
|
153
|
+
name,
|
|
154
|
+
state: "hovered"
|
|
155
|
+
}),
|
|
156
|
+
pressed: opts.solid({
|
|
157
|
+
base,
|
|
158
|
+
dark,
|
|
159
|
+
tone: "primary",
|
|
160
|
+
name,
|
|
161
|
+
state: "pressed"
|
|
162
|
+
}),
|
|
163
|
+
selected: opts.solid({
|
|
164
|
+
base,
|
|
165
|
+
dark,
|
|
166
|
+
tone: "primary",
|
|
167
|
+
name,
|
|
168
|
+
state: "selected"
|
|
169
|
+
})
|
|
79
170
|
},
|
|
80
171
|
positive: {
|
|
81
|
-
enabled: opts.solid({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
172
|
+
enabled: opts.solid({
|
|
173
|
+
base,
|
|
174
|
+
dark,
|
|
175
|
+
tone: "positive",
|
|
176
|
+
name,
|
|
177
|
+
state: "enabled"
|
|
178
|
+
}),
|
|
179
|
+
disabled: opts.solid({
|
|
180
|
+
base,
|
|
181
|
+
dark,
|
|
182
|
+
tone: "positive",
|
|
183
|
+
name,
|
|
184
|
+
state: "disabled"
|
|
185
|
+
}),
|
|
186
|
+
hovered: opts.solid({
|
|
187
|
+
base,
|
|
188
|
+
dark,
|
|
189
|
+
tone: "positive",
|
|
190
|
+
name,
|
|
191
|
+
state: "hovered"
|
|
192
|
+
}),
|
|
193
|
+
pressed: opts.solid({
|
|
194
|
+
base,
|
|
195
|
+
dark,
|
|
196
|
+
tone: "positive",
|
|
197
|
+
name,
|
|
198
|
+
state: "pressed"
|
|
199
|
+
}),
|
|
200
|
+
selected: opts.solid({
|
|
201
|
+
base,
|
|
202
|
+
dark,
|
|
203
|
+
tone: "positive",
|
|
204
|
+
name,
|
|
205
|
+
state: "selected"
|
|
206
|
+
})
|
|
86
207
|
},
|
|
87
208
|
caution: {
|
|
88
|
-
enabled: opts.solid({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
209
|
+
enabled: opts.solid({
|
|
210
|
+
base,
|
|
211
|
+
dark,
|
|
212
|
+
tone: "caution",
|
|
213
|
+
name,
|
|
214
|
+
state: "enabled"
|
|
215
|
+
}),
|
|
216
|
+
disabled: opts.solid({
|
|
217
|
+
base,
|
|
218
|
+
dark,
|
|
219
|
+
tone: "caution",
|
|
220
|
+
name,
|
|
221
|
+
state: "disabled"
|
|
222
|
+
}),
|
|
223
|
+
hovered: opts.solid({
|
|
224
|
+
base,
|
|
225
|
+
dark,
|
|
226
|
+
tone: "caution",
|
|
227
|
+
name,
|
|
228
|
+
state: "hovered"
|
|
229
|
+
}),
|
|
230
|
+
pressed: opts.solid({
|
|
231
|
+
base,
|
|
232
|
+
dark,
|
|
233
|
+
tone: "caution",
|
|
234
|
+
name,
|
|
235
|
+
state: "pressed"
|
|
236
|
+
}),
|
|
237
|
+
selected: opts.solid({
|
|
238
|
+
base,
|
|
239
|
+
dark,
|
|
240
|
+
tone: "caution",
|
|
241
|
+
name,
|
|
242
|
+
state: "selected"
|
|
243
|
+
})
|
|
93
244
|
},
|
|
94
245
|
critical: {
|
|
95
|
-
enabled: opts.solid({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
246
|
+
enabled: opts.solid({
|
|
247
|
+
base,
|
|
248
|
+
dark,
|
|
249
|
+
tone: "critical",
|
|
250
|
+
name,
|
|
251
|
+
state: "enabled"
|
|
252
|
+
}),
|
|
253
|
+
disabled: opts.solid({
|
|
254
|
+
base,
|
|
255
|
+
dark,
|
|
256
|
+
tone: "critical",
|
|
257
|
+
name,
|
|
258
|
+
state: "disabled"
|
|
259
|
+
}),
|
|
260
|
+
hovered: opts.solid({
|
|
261
|
+
base,
|
|
262
|
+
dark,
|
|
263
|
+
tone: "critical",
|
|
264
|
+
name,
|
|
265
|
+
state: "hovered"
|
|
266
|
+
}),
|
|
267
|
+
pressed: opts.solid({
|
|
268
|
+
base,
|
|
269
|
+
dark,
|
|
270
|
+
tone: "critical",
|
|
271
|
+
name,
|
|
272
|
+
state: "pressed"
|
|
273
|
+
}),
|
|
274
|
+
selected: opts.solid({
|
|
275
|
+
base,
|
|
276
|
+
dark,
|
|
277
|
+
tone: "critical",
|
|
278
|
+
name,
|
|
279
|
+
state: "selected"
|
|
280
|
+
})
|
|
100
281
|
}
|
|
101
282
|
};
|
|
102
283
|
}
|
|
@@ -287,7 +468,10 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
287
468
|
focusRing: [colors.critical.base, colors.critical.base]
|
|
288
469
|
}
|
|
289
470
|
}, defaultOpts = {
|
|
290
|
-
base: ({
|
|
471
|
+
base: ({
|
|
472
|
+
dark,
|
|
473
|
+
name
|
|
474
|
+
}) => name === "default" ? {
|
|
291
475
|
bg: dark ? black : white,
|
|
292
476
|
fg: dark ? white : black,
|
|
293
477
|
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
@@ -318,7 +502,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
318
502
|
to: dark ? white : black
|
|
319
503
|
}
|
|
320
504
|
},
|
|
321
|
-
solid: ({
|
|
505
|
+
solid: ({
|
|
506
|
+
base,
|
|
507
|
+
dark,
|
|
508
|
+
state,
|
|
509
|
+
tone
|
|
510
|
+
}) => {
|
|
322
511
|
const color2 = colors[tone];
|
|
323
512
|
return state === "hovered" ? {
|
|
324
513
|
bg: dark ? color2.light : color2.dark,
|
|
@@ -362,7 +551,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
362
551
|
skeleton: base.skeleton
|
|
363
552
|
};
|
|
364
553
|
},
|
|
365
|
-
muted: ({
|
|
554
|
+
muted: ({
|
|
555
|
+
base,
|
|
556
|
+
dark,
|
|
557
|
+
state,
|
|
558
|
+
tone
|
|
559
|
+
}) => {
|
|
366
560
|
const color2 = colors[tone];
|
|
367
561
|
return state === "hovered" ? {
|
|
368
562
|
bg: dark ? color2.darker : color2.lighter,
|
|
@@ -406,7 +600,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
406
600
|
skeleton: base.skeleton
|
|
407
601
|
};
|
|
408
602
|
},
|
|
409
|
-
button: ({
|
|
603
|
+
button: ({
|
|
604
|
+
base,
|
|
605
|
+
mode,
|
|
606
|
+
muted,
|
|
607
|
+
solid
|
|
608
|
+
}) => mode === "bleed" ? {
|
|
410
609
|
...muted,
|
|
411
610
|
enabled: {
|
|
412
611
|
bg: "transparent",
|
|
@@ -454,7 +653,9 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
454
653
|
...solid,
|
|
455
654
|
enabled: muted.enabled
|
|
456
655
|
} : solid,
|
|
457
|
-
card: ({
|
|
656
|
+
card: ({
|
|
657
|
+
base
|
|
658
|
+
}) => ({
|
|
458
659
|
bg: black,
|
|
459
660
|
bg2: black,
|
|
460
661
|
fg: black,
|
|
@@ -482,8 +683,14 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
482
683
|
border: black,
|
|
483
684
|
placeholder: black
|
|
484
685
|
}),
|
|
485
|
-
selectable: ({
|
|
486
|
-
|
|
686
|
+
selectable: ({
|
|
687
|
+
muted,
|
|
688
|
+
state,
|
|
689
|
+
tone
|
|
690
|
+
}) => muted[tone][state],
|
|
691
|
+
spot: ({
|
|
692
|
+
key
|
|
693
|
+
}) => spots[key],
|
|
487
694
|
syntax: () => ({
|
|
488
695
|
atrule: black,
|
|
489
696
|
attrName: black,
|
|
@@ -598,64 +805,283 @@ function createInputModes(opts, base, dark, solid, muted) {
|
|
|
598
805
|
function createMutedTones(opts, base, dark, name) {
|
|
599
806
|
return {
|
|
600
807
|
default: {
|
|
601
|
-
enabled: opts.muted({
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
808
|
+
enabled: opts.muted({
|
|
809
|
+
base,
|
|
810
|
+
dark,
|
|
811
|
+
tone: "default",
|
|
812
|
+
name,
|
|
813
|
+
state: "enabled"
|
|
814
|
+
}),
|
|
815
|
+
disabled: opts.muted({
|
|
816
|
+
base,
|
|
817
|
+
dark,
|
|
818
|
+
tone: "default",
|
|
819
|
+
name,
|
|
820
|
+
state: "disabled"
|
|
821
|
+
}),
|
|
822
|
+
hovered: opts.muted({
|
|
823
|
+
base,
|
|
824
|
+
dark,
|
|
825
|
+
tone: "default",
|
|
826
|
+
name,
|
|
827
|
+
state: "hovered"
|
|
828
|
+
}),
|
|
829
|
+
pressed: opts.muted({
|
|
830
|
+
base,
|
|
831
|
+
dark,
|
|
832
|
+
tone: "default",
|
|
833
|
+
name,
|
|
834
|
+
state: "pressed"
|
|
835
|
+
}),
|
|
836
|
+
selected: opts.muted({
|
|
837
|
+
base,
|
|
838
|
+
dark,
|
|
839
|
+
tone: "default",
|
|
840
|
+
name,
|
|
841
|
+
state: "selected"
|
|
842
|
+
})
|
|
606
843
|
},
|
|
607
844
|
transparent: {
|
|
608
|
-
enabled: opts.muted({
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
845
|
+
enabled: opts.muted({
|
|
846
|
+
base,
|
|
847
|
+
dark,
|
|
848
|
+
tone: "transparent",
|
|
849
|
+
name,
|
|
850
|
+
state: "enabled"
|
|
851
|
+
}),
|
|
852
|
+
disabled: opts.muted({
|
|
853
|
+
base,
|
|
854
|
+
dark,
|
|
855
|
+
tone: "transparent",
|
|
856
|
+
name,
|
|
857
|
+
state: "disabled"
|
|
858
|
+
}),
|
|
859
|
+
hovered: opts.muted({
|
|
860
|
+
base,
|
|
861
|
+
dark,
|
|
862
|
+
tone: "transparent",
|
|
863
|
+
name,
|
|
864
|
+
state: "hovered"
|
|
865
|
+
}),
|
|
866
|
+
pressed: opts.muted({
|
|
867
|
+
base,
|
|
868
|
+
dark,
|
|
869
|
+
tone: "transparent",
|
|
870
|
+
name,
|
|
871
|
+
state: "pressed"
|
|
872
|
+
}),
|
|
873
|
+
selected: opts.muted({
|
|
874
|
+
base,
|
|
875
|
+
dark,
|
|
876
|
+
tone: "transparent",
|
|
877
|
+
name,
|
|
878
|
+
state: "selected"
|
|
879
|
+
})
|
|
613
880
|
},
|
|
614
881
|
primary: {
|
|
615
|
-
enabled: opts.muted({
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
882
|
+
enabled: opts.muted({
|
|
883
|
+
base,
|
|
884
|
+
dark,
|
|
885
|
+
tone: "primary",
|
|
886
|
+
name,
|
|
887
|
+
state: "enabled"
|
|
888
|
+
}),
|
|
889
|
+
disabled: opts.muted({
|
|
890
|
+
base,
|
|
891
|
+
dark,
|
|
892
|
+
tone: "primary",
|
|
893
|
+
name,
|
|
894
|
+
state: "disabled"
|
|
895
|
+
}),
|
|
896
|
+
hovered: opts.muted({
|
|
897
|
+
base,
|
|
898
|
+
dark,
|
|
899
|
+
tone: "primary",
|
|
900
|
+
name,
|
|
901
|
+
state: "hovered"
|
|
902
|
+
}),
|
|
903
|
+
pressed: opts.muted({
|
|
904
|
+
base,
|
|
905
|
+
dark,
|
|
906
|
+
tone: "primary",
|
|
907
|
+
name,
|
|
908
|
+
state: "pressed"
|
|
909
|
+
}),
|
|
910
|
+
selected: opts.muted({
|
|
911
|
+
base,
|
|
912
|
+
dark,
|
|
913
|
+
tone: "primary",
|
|
914
|
+
name,
|
|
915
|
+
state: "selected"
|
|
916
|
+
})
|
|
620
917
|
},
|
|
621
918
|
positive: {
|
|
622
|
-
enabled: opts.muted({
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
919
|
+
enabled: opts.muted({
|
|
920
|
+
base,
|
|
921
|
+
dark,
|
|
922
|
+
tone: "positive",
|
|
923
|
+
name,
|
|
924
|
+
state: "enabled"
|
|
925
|
+
}),
|
|
926
|
+
disabled: opts.muted({
|
|
927
|
+
base,
|
|
928
|
+
dark,
|
|
929
|
+
tone: "positive",
|
|
930
|
+
name,
|
|
931
|
+
state: "disabled"
|
|
932
|
+
}),
|
|
933
|
+
hovered: opts.muted({
|
|
934
|
+
base,
|
|
935
|
+
dark,
|
|
936
|
+
tone: "positive",
|
|
937
|
+
name,
|
|
938
|
+
state: "hovered"
|
|
939
|
+
}),
|
|
940
|
+
pressed: opts.muted({
|
|
941
|
+
base,
|
|
942
|
+
dark,
|
|
943
|
+
tone: "positive",
|
|
944
|
+
name,
|
|
945
|
+
state: "pressed"
|
|
946
|
+
}),
|
|
947
|
+
selected: opts.muted({
|
|
948
|
+
base,
|
|
949
|
+
dark,
|
|
950
|
+
tone: "positive",
|
|
951
|
+
name,
|
|
952
|
+
state: "selected"
|
|
953
|
+
})
|
|
627
954
|
},
|
|
628
955
|
caution: {
|
|
629
|
-
enabled: opts.muted({
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
956
|
+
enabled: opts.muted({
|
|
957
|
+
base,
|
|
958
|
+
dark,
|
|
959
|
+
tone: "caution",
|
|
960
|
+
name,
|
|
961
|
+
state: "enabled"
|
|
962
|
+
}),
|
|
963
|
+
disabled: opts.muted({
|
|
964
|
+
base,
|
|
965
|
+
dark,
|
|
966
|
+
tone: "caution",
|
|
967
|
+
name,
|
|
968
|
+
state: "disabled"
|
|
969
|
+
}),
|
|
970
|
+
hovered: opts.muted({
|
|
971
|
+
base,
|
|
972
|
+
dark,
|
|
973
|
+
tone: "caution",
|
|
974
|
+
name,
|
|
975
|
+
state: "hovered"
|
|
976
|
+
}),
|
|
977
|
+
pressed: opts.muted({
|
|
978
|
+
base,
|
|
979
|
+
dark,
|
|
980
|
+
tone: "caution",
|
|
981
|
+
name,
|
|
982
|
+
state: "pressed"
|
|
983
|
+
}),
|
|
984
|
+
selected: opts.muted({
|
|
985
|
+
base,
|
|
986
|
+
dark,
|
|
987
|
+
tone: "caution",
|
|
988
|
+
name,
|
|
989
|
+
state: "selected"
|
|
990
|
+
})
|
|
634
991
|
},
|
|
635
992
|
critical: {
|
|
636
|
-
enabled: opts.muted({
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
993
|
+
enabled: opts.muted({
|
|
994
|
+
base,
|
|
995
|
+
dark,
|
|
996
|
+
tone: "critical",
|
|
997
|
+
name,
|
|
998
|
+
state: "enabled"
|
|
999
|
+
}),
|
|
1000
|
+
disabled: opts.muted({
|
|
1001
|
+
base,
|
|
1002
|
+
dark,
|
|
1003
|
+
tone: "critical",
|
|
1004
|
+
name,
|
|
1005
|
+
state: "disabled"
|
|
1006
|
+
}),
|
|
1007
|
+
hovered: opts.muted({
|
|
1008
|
+
base,
|
|
1009
|
+
dark,
|
|
1010
|
+
tone: "critical",
|
|
1011
|
+
name,
|
|
1012
|
+
state: "hovered"
|
|
1013
|
+
}),
|
|
1014
|
+
pressed: opts.muted({
|
|
1015
|
+
base,
|
|
1016
|
+
dark,
|
|
1017
|
+
tone: "critical",
|
|
1018
|
+
name,
|
|
1019
|
+
state: "pressed"
|
|
1020
|
+
}),
|
|
1021
|
+
selected: opts.muted({
|
|
1022
|
+
base,
|
|
1023
|
+
dark,
|
|
1024
|
+
tone: "critical",
|
|
1025
|
+
name,
|
|
1026
|
+
state: "selected"
|
|
1027
|
+
})
|
|
641
1028
|
}
|
|
642
1029
|
};
|
|
643
1030
|
}
|
|
644
1031
|
function createSpot(opts, base, dark) {
|
|
645
1032
|
return {
|
|
646
|
-
gray: opts.spot({
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1033
|
+
gray: opts.spot({
|
|
1034
|
+
base,
|
|
1035
|
+
dark,
|
|
1036
|
+
key: "gray"
|
|
1037
|
+
}),
|
|
1038
|
+
blue: opts.spot({
|
|
1039
|
+
base,
|
|
1040
|
+
dark,
|
|
1041
|
+
key: "blue"
|
|
1042
|
+
}),
|
|
1043
|
+
purple: opts.spot({
|
|
1044
|
+
base,
|
|
1045
|
+
dark,
|
|
1046
|
+
key: "purple"
|
|
1047
|
+
}),
|
|
1048
|
+
magenta: opts.spot({
|
|
1049
|
+
base,
|
|
1050
|
+
dark,
|
|
1051
|
+
key: "magenta"
|
|
1052
|
+
}),
|
|
1053
|
+
red: opts.spot({
|
|
1054
|
+
base,
|
|
1055
|
+
dark,
|
|
1056
|
+
key: "red"
|
|
1057
|
+
}),
|
|
1058
|
+
orange: opts.spot({
|
|
1059
|
+
base,
|
|
1060
|
+
dark,
|
|
1061
|
+
key: "orange"
|
|
1062
|
+
}),
|
|
1063
|
+
yellow: opts.spot({
|
|
1064
|
+
base,
|
|
1065
|
+
dark,
|
|
1066
|
+
key: "yellow"
|
|
1067
|
+
}),
|
|
1068
|
+
green: opts.spot({
|
|
1069
|
+
base,
|
|
1070
|
+
dark,
|
|
1071
|
+
key: "green"
|
|
1072
|
+
}),
|
|
1073
|
+
cyan: opts.spot({
|
|
1074
|
+
base,
|
|
1075
|
+
dark,
|
|
1076
|
+
key: "cyan"
|
|
1077
|
+
})
|
|
655
1078
|
};
|
|
656
1079
|
}
|
|
657
1080
|
function createColorTheme(partialOpts = {}) {
|
|
658
|
-
const builders = {
|
|
1081
|
+
const builders = {
|
|
1082
|
+
...defaultOpts,
|
|
1083
|
+
...partialOpts
|
|
1084
|
+
};
|
|
659
1085
|
return {
|
|
660
1086
|
light: _createColorScheme(builders, !1),
|
|
661
1087
|
dark: _createColorScheme(builders, !0)
|
|
@@ -672,7 +1098,10 @@ function _createColorScheme(opts, dark) {
|
|
|
672
1098
|
};
|
|
673
1099
|
}
|
|
674
1100
|
function _createColor(opts, dark, name) {
|
|
675
|
-
const base = opts.base({
|
|
1101
|
+
const base = opts.base({
|
|
1102
|
+
dark,
|
|
1103
|
+
name
|
|
1104
|
+
}), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
676
1105
|
return {
|
|
677
1106
|
base,
|
|
678
1107
|
button: createButtonModes(opts, base, dark, solid, muted),
|
|
@@ -681,12 +1110,136 @@ function _createColor(opts, dark, name) {
|
|
|
681
1110
|
input: createInputModes(opts, base, dark, solid, muted),
|
|
682
1111
|
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
683
1112
|
spot: createSpot(opts, base, dark),
|
|
684
|
-
syntax: opts.syntax({
|
|
1113
|
+
syntax: opts.syntax({
|
|
1114
|
+
base,
|
|
1115
|
+
dark
|
|
1116
|
+
}),
|
|
685
1117
|
solid,
|
|
686
1118
|
muted
|
|
687
1119
|
};
|
|
688
1120
|
}
|
|
689
|
-
const
|
|
1121
|
+
const defaultThemeConfig = {
|
|
1122
|
+
avatar: {
|
|
1123
|
+
sizes: [{
|
|
1124
|
+
distance: -4,
|
|
1125
|
+
size: 19
|
|
1126
|
+
}, {
|
|
1127
|
+
distance: -4,
|
|
1128
|
+
size: 25
|
|
1129
|
+
}, {
|
|
1130
|
+
distance: -8,
|
|
1131
|
+
size: 33
|
|
1132
|
+
}, {
|
|
1133
|
+
distance: -12,
|
|
1134
|
+
size: 49
|
|
1135
|
+
}],
|
|
1136
|
+
focusRing: {
|
|
1137
|
+
offset: 1,
|
|
1138
|
+
width: 1
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
button: {
|
|
1142
|
+
textWeight: "medium",
|
|
1143
|
+
border: {
|
|
1144
|
+
width: 1
|
|
1145
|
+
},
|
|
1146
|
+
focusRing: {
|
|
1147
|
+
offset: -1,
|
|
1148
|
+
width: 1
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
card: {
|
|
1152
|
+
border: {
|
|
1153
|
+
width: 1
|
|
1154
|
+
},
|
|
1155
|
+
focusRing: {
|
|
1156
|
+
offset: -1,
|
|
1157
|
+
width: 1
|
|
1158
|
+
},
|
|
1159
|
+
shadow: {
|
|
1160
|
+
outline: 0.5
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
container: [320, 640, 960, 1280, 1600, 1920],
|
|
1164
|
+
media: [360, 600, 900, 1200, 1800, 2400],
|
|
1165
|
+
layer: {
|
|
1166
|
+
dialog: {
|
|
1167
|
+
zOffset: 600
|
|
1168
|
+
},
|
|
1169
|
+
popover: {
|
|
1170
|
+
zOffset: 400
|
|
1171
|
+
},
|
|
1172
|
+
tooltip: {
|
|
1173
|
+
zOffset: 200
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
|
|
1177
|
+
shadow: [null, {
|
|
1178
|
+
umbra: [0, 0, 0, 0],
|
|
1179
|
+
penumbra: [0, 0, 0, 0],
|
|
1180
|
+
ambient: [0, 0, 0, 0]
|
|
1181
|
+
}, {
|
|
1182
|
+
umbra: [0, 3, 5, -2],
|
|
1183
|
+
penumbra: [0, 6, 10, 0],
|
|
1184
|
+
ambient: [0, 1, 18, 1]
|
|
1185
|
+
}, {
|
|
1186
|
+
umbra: [0, 7, 8, -4],
|
|
1187
|
+
penumbra: [0, 12, 17, 2],
|
|
1188
|
+
ambient: [0, 5, 22, 4]
|
|
1189
|
+
}, {
|
|
1190
|
+
umbra: [0, 9, 11, -5],
|
|
1191
|
+
penumbra: [0, 18, 28, 2],
|
|
1192
|
+
ambient: [0, 7, 34, 6]
|
|
1193
|
+
}, {
|
|
1194
|
+
umbra: [0, 11, 15, -7],
|
|
1195
|
+
penumbra: [0, 24, 38, 3],
|
|
1196
|
+
ambient: [0, 9, 46, 8]
|
|
1197
|
+
}],
|
|
1198
|
+
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1199
|
+
input: {
|
|
1200
|
+
border: {
|
|
1201
|
+
width: 1
|
|
1202
|
+
},
|
|
1203
|
+
checkbox: {
|
|
1204
|
+
size: 17,
|
|
1205
|
+
focusRing: {
|
|
1206
|
+
offset: -1,
|
|
1207
|
+
width: 1
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
radio: {
|
|
1211
|
+
size: 17,
|
|
1212
|
+
markSize: 9,
|
|
1213
|
+
focusRing: {
|
|
1214
|
+
offset: -1,
|
|
1215
|
+
width: 1
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1218
|
+
switch: {
|
|
1219
|
+
width: 25,
|
|
1220
|
+
height: 17,
|
|
1221
|
+
padding: 5,
|
|
1222
|
+
transitionDurationMs: 150,
|
|
1223
|
+
transitionTimingFunction: "ease-out",
|
|
1224
|
+
focusRing: {
|
|
1225
|
+
offset: 1,
|
|
1226
|
+
width: 1
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
select: {
|
|
1230
|
+
focusRing: {
|
|
1231
|
+
offset: -1,
|
|
1232
|
+
width: 1
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
text: {
|
|
1236
|
+
focusRing: {
|
|
1237
|
+
offset: -1,
|
|
1238
|
+
width: 1
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}, defaultThemeFonts = {
|
|
690
1243
|
code: {
|
|
691
1244
|
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
692
1245
|
weights: {
|
|
@@ -695,166 +1248,147 @@ const defaultThemeFonts = {
|
|
|
695
1248
|
semibold: 600,
|
|
696
1249
|
bold: 700
|
|
697
1250
|
},
|
|
698
|
-
sizes: [
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
fontSize: 22,
|
|
735
|
-
iconSize: 33,
|
|
736
|
-
lineHeight: 31,
|
|
737
|
-
letterSpacing: 0
|
|
738
|
-
}
|
|
739
|
-
]
|
|
1251
|
+
sizes: [{
|
|
1252
|
+
ascenderHeight: 4,
|
|
1253
|
+
descenderHeight: 4,
|
|
1254
|
+
fontSize: 10,
|
|
1255
|
+
iconSize: 17,
|
|
1256
|
+
lineHeight: 15,
|
|
1257
|
+
letterSpacing: 0
|
|
1258
|
+
}, {
|
|
1259
|
+
ascenderHeight: 5,
|
|
1260
|
+
descenderHeight: 5,
|
|
1261
|
+
fontSize: 13,
|
|
1262
|
+
iconSize: 21,
|
|
1263
|
+
lineHeight: 19,
|
|
1264
|
+
letterSpacing: 0
|
|
1265
|
+
}, {
|
|
1266
|
+
ascenderHeight: 6,
|
|
1267
|
+
descenderHeight: 6,
|
|
1268
|
+
fontSize: 16,
|
|
1269
|
+
iconSize: 25,
|
|
1270
|
+
lineHeight: 23,
|
|
1271
|
+
letterSpacing: 0
|
|
1272
|
+
}, {
|
|
1273
|
+
ascenderHeight: 7,
|
|
1274
|
+
descenderHeight: 7,
|
|
1275
|
+
fontSize: 19,
|
|
1276
|
+
iconSize: 29,
|
|
1277
|
+
lineHeight: 27,
|
|
1278
|
+
letterSpacing: 0
|
|
1279
|
+
}, {
|
|
1280
|
+
ascenderHeight: 8,
|
|
1281
|
+
descenderHeight: 8,
|
|
1282
|
+
fontSize: 22,
|
|
1283
|
+
iconSize: 33,
|
|
1284
|
+
lineHeight: 31,
|
|
1285
|
+
letterSpacing: 0
|
|
1286
|
+
}]
|
|
740
1287
|
},
|
|
741
1288
|
heading: {
|
|
742
1289
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
1290
|
+
featureSettings: "'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1",
|
|
743
1291
|
weights: {
|
|
744
|
-
regular:
|
|
745
|
-
medium:
|
|
746
|
-
semibold:
|
|
1292
|
+
regular: 600,
|
|
1293
|
+
medium: 700,
|
|
1294
|
+
semibold: 800,
|
|
747
1295
|
bold: 900
|
|
748
1296
|
},
|
|
749
|
-
sizes: [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
descenderHeight: 9.5,
|
|
793
|
-
fontSize: 38,
|
|
794
|
-
iconSize: 53,
|
|
795
|
-
lineHeight: 47,
|
|
796
|
-
letterSpacing: 0
|
|
797
|
-
}
|
|
798
|
-
]
|
|
1297
|
+
sizes: [{
|
|
1298
|
+
ascenderHeight: 5,
|
|
1299
|
+
descenderHeight: 5,
|
|
1300
|
+
fontSize: 13,
|
|
1301
|
+
iconSize: 17,
|
|
1302
|
+
lineHeight: 19,
|
|
1303
|
+
letterSpacing: 0
|
|
1304
|
+
}, {
|
|
1305
|
+
ascenderHeight: 6,
|
|
1306
|
+
descenderHeight: 6,
|
|
1307
|
+
fontSize: 16,
|
|
1308
|
+
iconSize: 25,
|
|
1309
|
+
lineHeight: 23,
|
|
1310
|
+
letterSpacing: 0
|
|
1311
|
+
}, {
|
|
1312
|
+
ascenderHeight: 7,
|
|
1313
|
+
descenderHeight: 7,
|
|
1314
|
+
fontSize: 21,
|
|
1315
|
+
iconSize: 33,
|
|
1316
|
+
lineHeight: 29,
|
|
1317
|
+
letterSpacing: -0.25
|
|
1318
|
+
}, {
|
|
1319
|
+
ascenderHeight: 8,
|
|
1320
|
+
descenderHeight: 8,
|
|
1321
|
+
fontSize: 27,
|
|
1322
|
+
iconSize: 41,
|
|
1323
|
+
lineHeight: 35,
|
|
1324
|
+
letterSpacing: -0.5
|
|
1325
|
+
}, {
|
|
1326
|
+
ascenderHeight: 9.5,
|
|
1327
|
+
descenderHeight: 8.5,
|
|
1328
|
+
fontSize: 33,
|
|
1329
|
+
iconSize: 49,
|
|
1330
|
+
lineHeight: 41,
|
|
1331
|
+
letterSpacing: -1
|
|
1332
|
+
}, {
|
|
1333
|
+
ascenderHeight: 10.5,
|
|
1334
|
+
descenderHeight: 9.5,
|
|
1335
|
+
fontSize: 38,
|
|
1336
|
+
iconSize: 53,
|
|
1337
|
+
lineHeight: 47,
|
|
1338
|
+
letterSpacing: -1
|
|
1339
|
+
}]
|
|
799
1340
|
},
|
|
800
1341
|
label: {
|
|
801
1342
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
802
1343
|
weights: {
|
|
803
|
-
regular:
|
|
804
|
-
medium:
|
|
805
|
-
semibold:
|
|
806
|
-
bold:
|
|
807
|
-
},
|
|
808
|
-
sizes: [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
descenderHeight: 2,
|
|
852
|
-
fontSize: 15,
|
|
853
|
-
iconSize: 23,
|
|
854
|
-
lineHeight: 15,
|
|
855
|
-
letterSpacing: 0.5
|
|
856
|
-
}
|
|
857
|
-
]
|
|
1344
|
+
regular: 500,
|
|
1345
|
+
medium: 600,
|
|
1346
|
+
semibold: 700,
|
|
1347
|
+
bold: 800
|
|
1348
|
+
},
|
|
1349
|
+
sizes: [{
|
|
1350
|
+
ascenderHeight: 2,
|
|
1351
|
+
descenderHeight: 2,
|
|
1352
|
+
fontSize: 8.1,
|
|
1353
|
+
iconSize: 13,
|
|
1354
|
+
lineHeight: 10,
|
|
1355
|
+
letterSpacing: 0.5
|
|
1356
|
+
}, {
|
|
1357
|
+
ascenderHeight: 1.5,
|
|
1358
|
+
descenderHeight: 2.5,
|
|
1359
|
+
fontSize: 9.5,
|
|
1360
|
+
iconSize: 15,
|
|
1361
|
+
lineHeight: 11,
|
|
1362
|
+
letterSpacing: 0.5
|
|
1363
|
+
}, {
|
|
1364
|
+
ascenderHeight: 2,
|
|
1365
|
+
descenderHeight: 2,
|
|
1366
|
+
fontSize: 10.8,
|
|
1367
|
+
iconSize: 17,
|
|
1368
|
+
lineHeight: 12,
|
|
1369
|
+
letterSpacing: 0.5
|
|
1370
|
+
}, {
|
|
1371
|
+
ascenderHeight: 2,
|
|
1372
|
+
descenderHeight: 2,
|
|
1373
|
+
fontSize: 12.25,
|
|
1374
|
+
iconSize: 19,
|
|
1375
|
+
lineHeight: 13,
|
|
1376
|
+
letterSpacing: 0.5
|
|
1377
|
+
}, {
|
|
1378
|
+
ascenderHeight: 1.5,
|
|
1379
|
+
descenderHeight: 2.5,
|
|
1380
|
+
fontSize: 13.6,
|
|
1381
|
+
iconSize: 21,
|
|
1382
|
+
lineHeight: 14,
|
|
1383
|
+
letterSpacing: 0.5
|
|
1384
|
+
}, {
|
|
1385
|
+
ascenderHeight: 2,
|
|
1386
|
+
descenderHeight: 2,
|
|
1387
|
+
fontSize: 15,
|
|
1388
|
+
iconSize: 23,
|
|
1389
|
+
lineHeight: 15,
|
|
1390
|
+
letterSpacing: 0.5
|
|
1391
|
+
}]
|
|
858
1392
|
},
|
|
859
1393
|
text: {
|
|
860
1394
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -864,135 +1398,700 @@ const defaultThemeFonts = {
|
|
|
864
1398
|
semibold: 600,
|
|
865
1399
|
bold: 700
|
|
866
1400
|
},
|
|
867
|
-
sizes: [
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1401
|
+
sizes: [{
|
|
1402
|
+
ascenderHeight: 4,
|
|
1403
|
+
descenderHeight: 4,
|
|
1404
|
+
fontSize: 10,
|
|
1405
|
+
iconSize: 17,
|
|
1406
|
+
lineHeight: 15,
|
|
1407
|
+
letterSpacing: 0
|
|
1408
|
+
}, {
|
|
1409
|
+
ascenderHeight: 5,
|
|
1410
|
+
descenderHeight: 5,
|
|
1411
|
+
fontSize: 13,
|
|
1412
|
+
iconSize: 21,
|
|
1413
|
+
lineHeight: 19,
|
|
1414
|
+
letterSpacing: 0
|
|
1415
|
+
}, {
|
|
1416
|
+
ascenderHeight: 6,
|
|
1417
|
+
descenderHeight: 6,
|
|
1418
|
+
fontSize: 15,
|
|
1419
|
+
iconSize: 25,
|
|
1420
|
+
lineHeight: 23,
|
|
1421
|
+
letterSpacing: 0
|
|
1422
|
+
}, {
|
|
1423
|
+
ascenderHeight: 7,
|
|
1424
|
+
descenderHeight: 7,
|
|
1425
|
+
fontSize: 18,
|
|
1426
|
+
iconSize: 29,
|
|
1427
|
+
lineHeight: 27,
|
|
1428
|
+
letterSpacing: 0
|
|
1429
|
+
}, {
|
|
1430
|
+
ascenderHeight: 8,
|
|
1431
|
+
descenderHeight: 8,
|
|
1432
|
+
fontSize: 21,
|
|
1433
|
+
iconSize: 33,
|
|
1434
|
+
lineHeight: 31,
|
|
1435
|
+
letterSpacing: 0
|
|
1436
|
+
}]
|
|
1437
|
+
}
|
|
1438
|
+
}, THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1439
|
+
"transparent",
|
|
1440
|
+
"default",
|
|
1441
|
+
"neutral",
|
|
1442
|
+
"primary",
|
|
1443
|
+
// deprecated
|
|
1444
|
+
"suggest",
|
|
1445
|
+
"positive",
|
|
1446
|
+
"caution",
|
|
1447
|
+
"critical"
|
|
1448
|
+
], THEME_COLOR_STATE_TONES = [
|
|
1449
|
+
"default",
|
|
1450
|
+
"neutral",
|
|
1451
|
+
"primary",
|
|
1452
|
+
// deprecated
|
|
1453
|
+
"suggest",
|
|
1454
|
+
"positive",
|
|
1455
|
+
"caution",
|
|
1456
|
+
"critical"
|
|
1457
|
+
], 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.COLOR_HUES;
|
|
1458
|
+
function isColorBlendModeValue(str) {
|
|
1459
|
+
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1460
|
+
}
|
|
1461
|
+
function isColorHueKey(str) {
|
|
1462
|
+
return color.COLOR_HUES.includes(str);
|
|
1463
|
+
}
|
|
1464
|
+
function isColorTintKey(str) {
|
|
1465
|
+
return color.COLOR_TINTS.includes(str);
|
|
1466
|
+
}
|
|
1467
|
+
function isColorButtonMode(str) {
|
|
1468
|
+
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1469
|
+
}
|
|
1470
|
+
const HUES = ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"], TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], RE_PERCENTAGE = /^([0-9]+)%/, RE_OPACITY = /^(1|0\.[0-9]+)?/;
|
|
1471
|
+
function parseColor$1(str) {
|
|
1472
|
+
let cursor = 0;
|
|
1473
|
+
const color2 = getColor();
|
|
1474
|
+
if (!color2)
|
|
1475
|
+
throw new Error(`Invalid color: ${str}`);
|
|
1476
|
+
const opacity = getOpacity(), mix2 = getMixPercentage();
|
|
1477
|
+
return {
|
|
1478
|
+
color: color2,
|
|
1479
|
+
mix: mix2,
|
|
1480
|
+
opacity
|
|
1481
|
+
};
|
|
1482
|
+
function _consume(s) {
|
|
1483
|
+
if (str.startsWith(s, cursor))
|
|
1484
|
+
return cursor += s.length, s;
|
|
1485
|
+
}
|
|
1486
|
+
function _peek() {
|
|
1487
|
+
return str[cursor];
|
|
1488
|
+
}
|
|
1489
|
+
function getColor() {
|
|
1490
|
+
ignoreWhitespace();
|
|
1491
|
+
let v = _consume("black") || _consume("white");
|
|
1492
|
+
if (v)
|
|
1493
|
+
return {
|
|
1494
|
+
type: v
|
|
1495
|
+
};
|
|
1496
|
+
for (const hue of HUES)
|
|
1497
|
+
if (v = _consume(String(hue)), v) {
|
|
1498
|
+
if (_peek() !== "/")
|
|
1499
|
+
throw new Error("Expected slash after hue");
|
|
1500
|
+
cursor += 1;
|
|
1501
|
+
const tint2 = getTint();
|
|
1502
|
+
if (!tint2)
|
|
1503
|
+
throw new Error("Expected tint after hue");
|
|
1504
|
+
return {
|
|
1505
|
+
type: "hue",
|
|
1506
|
+
hue,
|
|
1507
|
+
tint: tint2
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
const tint = getTint();
|
|
1511
|
+
if (tint)
|
|
1512
|
+
return {
|
|
1513
|
+
type: "hue",
|
|
1514
|
+
hue: void 0,
|
|
1515
|
+
tint
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
function getTint() {
|
|
1519
|
+
ignoreWhitespace();
|
|
1520
|
+
let v = Number(str.slice(cursor, cursor + 3));
|
|
1521
|
+
if (TINTS.includes(v))
|
|
1522
|
+
return cursor += 3, v;
|
|
1523
|
+
if (v = Number(str.slice(cursor, cursor + 2)), TINTS.includes(v))
|
|
1524
|
+
return cursor += 2, v;
|
|
1525
|
+
}
|
|
1526
|
+
function getMixPercentage() {
|
|
1527
|
+
ignoreWhitespace();
|
|
1528
|
+
const match = RE_PERCENTAGE.exec(str.slice(cursor));
|
|
1529
|
+
if (match)
|
|
1530
|
+
return cursor += match[0].length, parseFloat(match[1]);
|
|
1531
|
+
}
|
|
1532
|
+
function getOpacity() {
|
|
1533
|
+
if (ignoreWhitespace(), _peek() === "/") {
|
|
1534
|
+
cursor += 1;
|
|
1535
|
+
const match = RE_OPACITY.exec(str.slice(cursor));
|
|
1536
|
+
if (match)
|
|
1537
|
+
return cursor += match[0].length, parseFloat(match[1]);
|
|
1538
|
+
cursor -= 1;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function ignoreWhitespace() {
|
|
1542
|
+
for (; _peek() === " "; )
|
|
1543
|
+
cursor++;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
function renderColor(token, context) {
|
|
1547
|
+
const {
|
|
1548
|
+
bgVar,
|
|
1549
|
+
hue,
|
|
1550
|
+
scheme
|
|
1551
|
+
} = context, result = parseColor$1(token[scheme === "dark" ? 0 : 1]), colorVar = result.color.type === "hue" ? `--${result.color.hue ?? hue}-${result.color.tint}` : `--${result.color.type}`;
|
|
1552
|
+
return result.mix !== void 0 ? `color-mix(in srgb, var(${bgVar}), var(${colorVar}) ${result.mix}%)` : result.opacity !== void 0 ? `color-mix(in srgb, transparent, var(${colorVar}) ${result.opacity * 100}%)` : `var(${colorVar})`;
|
|
1553
|
+
}
|
|
1554
|
+
function buildColor_v3(tokens) {
|
|
1555
|
+
return {
|
|
1556
|
+
dark: buildColorScheme_v3(tokens, {
|
|
1557
|
+
scheme: "dark"
|
|
1558
|
+
}),
|
|
1559
|
+
light: buildColorScheme_v3(tokens, {
|
|
1560
|
+
scheme: "light"
|
|
1561
|
+
})
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
function buildColorScheme_v3(tokens, options) {
|
|
1565
|
+
const {
|
|
1566
|
+
scheme
|
|
1567
|
+
} = options;
|
|
1568
|
+
return {
|
|
1569
|
+
card: THEME_COLOR_CARD_TONES.reduce((acc, tone) => (acc[tone] = buildColorCard_v3(tokens[tone], {
|
|
1570
|
+
scheme
|
|
1571
|
+
}), acc), {})
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
function buildColorCard_v3(tokens, options) {
|
|
1575
|
+
const {
|
|
1576
|
+
scheme
|
|
1577
|
+
} = options, context = {
|
|
1578
|
+
bgVar: "--color-bg-1",
|
|
1579
|
+
hue: tokens._hue,
|
|
1580
|
+
scheme
|
|
1581
|
+
};
|
|
1582
|
+
return {
|
|
1583
|
+
_hue: tokens._hue ?? "gray",
|
|
1584
|
+
avatar: THEME_COLOR_AVATAR_COLORS.reduce((acc, hue) => {
|
|
1585
|
+
const avatarTokens = tokens.avatar[hue];
|
|
1586
|
+
return acc[hue] = {
|
|
1587
|
+
bg: renderColor(avatarTokens.bg, {
|
|
1588
|
+
bgVar: "--color-bg-1",
|
|
1589
|
+
hue: avatarTokens._hue,
|
|
1590
|
+
scheme
|
|
1591
|
+
}),
|
|
1592
|
+
fg: renderColor(avatarTokens.fg, {
|
|
1593
|
+
bgVar: "--color-bg-1",
|
|
1594
|
+
hue: avatarTokens._hue,
|
|
1595
|
+
scheme
|
|
1596
|
+
})
|
|
1597
|
+
}, acc;
|
|
1598
|
+
}, {}),
|
|
1599
|
+
backdrop: renderColor(tokens.backdrop, context),
|
|
1600
|
+
code: {
|
|
1601
|
+
bg: renderColor(tokens.code.bg, context),
|
|
1602
|
+
fg: renderColor(tokens.code.fg, context),
|
|
1603
|
+
token: {
|
|
1604
|
+
atrule: renderColor(tokens.code.token.atrule, context),
|
|
1605
|
+
attrName: renderColor(tokens.code.token.attrName, context),
|
|
1606
|
+
attrValue: renderColor(tokens.code.token.attrValue, context),
|
|
1607
|
+
attribute: renderColor(tokens.code.token.attribute, context),
|
|
1608
|
+
boolean: renderColor(tokens.code.token.boolean, context),
|
|
1609
|
+
builtin: renderColor(tokens.code.token.builtin, context),
|
|
1610
|
+
cdata: renderColor(tokens.code.token.cdata, context),
|
|
1611
|
+
char: renderColor(tokens.code.token.char, context),
|
|
1612
|
+
class: renderColor(tokens.code.token.class, context),
|
|
1613
|
+
className: renderColor(tokens.code.token.className, context),
|
|
1614
|
+
comment: renderColor(tokens.code.token.comment, context),
|
|
1615
|
+
constant: renderColor(tokens.code.token.constant, context),
|
|
1616
|
+
deleted: renderColor(tokens.code.token.deleted, context),
|
|
1617
|
+
doctype: renderColor(tokens.code.token.doctype, context),
|
|
1618
|
+
entity: renderColor(tokens.code.token.entity, context),
|
|
1619
|
+
function: renderColor(tokens.code.token.function, context),
|
|
1620
|
+
hexcode: renderColor(tokens.code.token.hexcode, context),
|
|
1621
|
+
id: renderColor(tokens.code.token.id, context),
|
|
1622
|
+
important: renderColor(tokens.code.token.important, context),
|
|
1623
|
+
inserted: renderColor(tokens.code.token.inserted, context),
|
|
1624
|
+
keyword: renderColor(tokens.code.token.keyword, context),
|
|
1625
|
+
number: renderColor(tokens.code.token.number, context),
|
|
1626
|
+
operator: renderColor(tokens.code.token.operator, context),
|
|
1627
|
+
prolog: renderColor(tokens.code.token.prolog, context),
|
|
1628
|
+
property: renderColor(tokens.code.token.property, context),
|
|
1629
|
+
pseudoClass: renderColor(tokens.code.token.pseudoClass, context),
|
|
1630
|
+
pseudoElement: renderColor(tokens.code.token.pseudoElement, context),
|
|
1631
|
+
punctuation: renderColor(tokens.code.token.punctuation, context),
|
|
1632
|
+
regex: renderColor(tokens.code.token.regex, context),
|
|
1633
|
+
selector: renderColor(tokens.code.token.selector, context),
|
|
1634
|
+
string: renderColor(tokens.code.token.string, context),
|
|
1635
|
+
symbol: renderColor(tokens.code.token.symbol, context),
|
|
1636
|
+
tag: renderColor(tokens.code.token.tag, context),
|
|
1637
|
+
unit: renderColor(tokens.code.token.unit, context),
|
|
1638
|
+
url: renderColor(tokens.code.token.url, context),
|
|
1639
|
+
variable: renderColor(tokens.code.token.variable, context)
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1642
|
+
focusRing: renderColor(tokens.focusRing, context),
|
|
1643
|
+
shadow: {
|
|
1644
|
+
outline: renderColor(tokens.shadow.outline, context),
|
|
1645
|
+
umbra: renderColor(tokens.shadow.umbra, context),
|
|
1646
|
+
penumbra: renderColor(tokens.shadow.penumbra, context),
|
|
1647
|
+
ambient: renderColor(tokens.shadow.ambient, context)
|
|
1648
|
+
},
|
|
1649
|
+
skeleton: {
|
|
1650
|
+
from: renderColor(tokens.skeleton.from, context),
|
|
1651
|
+
to: renderColor(tokens.skeleton.to, context)
|
|
1652
|
+
},
|
|
1653
|
+
variant: {
|
|
1654
|
+
solid: {
|
|
1655
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1656
|
+
...acc,
|
|
1657
|
+
[tone]: buildColorElement_v3(tokens.variant.solid[tone], {
|
|
1658
|
+
scheme
|
|
1659
|
+
})
|
|
1660
|
+
}), {})
|
|
1661
|
+
},
|
|
1662
|
+
tinted: {
|
|
1663
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => ({
|
|
1664
|
+
...acc,
|
|
1665
|
+
[tone]: buildColorElement_v3(tokens.variant.tinted[tone], {
|
|
1666
|
+
scheme
|
|
1667
|
+
})
|
|
1668
|
+
}), {})
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
function buildColorElement_v3(tokens, options) {
|
|
1674
|
+
const {
|
|
1675
|
+
scheme
|
|
1676
|
+
} = options, context = {
|
|
1677
|
+
bgVar: "--bg",
|
|
1678
|
+
hue: tokens._hue,
|
|
1679
|
+
scheme
|
|
1680
|
+
};
|
|
1681
|
+
return {
|
|
1682
|
+
_hue: tokens._hue ?? "gray",
|
|
1683
|
+
bg: {
|
|
1684
|
+
0: renderColor(tokens.bg[0], context),
|
|
1685
|
+
4: renderColor(tokens.bg[4], context)
|
|
1686
|
+
},
|
|
1687
|
+
border: {
|
|
1688
|
+
0: renderColor(tokens.border[0], context),
|
|
1689
|
+
4: renderColor(tokens.border[4], context)
|
|
1690
|
+
},
|
|
1691
|
+
fg: {
|
|
1692
|
+
0: renderColor(tokens.fg[0], context),
|
|
1693
|
+
4: renderColor(tokens.fg[4], context)
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
const defaultTokens = {
|
|
1698
|
+
color: {
|
|
1699
|
+
"*": {
|
|
1700
|
+
// backdrop: ['black/0.2', '200/0.2'],
|
|
1701
|
+
backdrop: ["black/0.5", "gray/100/0.5"],
|
|
1702
|
+
code: {
|
|
1703
|
+
bg: ["950", "50"],
|
|
1704
|
+
fg: ["300", "700"],
|
|
1705
|
+
token: {
|
|
1706
|
+
atrule: ["purple/300", "purple/600"],
|
|
1707
|
+
attrName: ["green/300", "green/600"],
|
|
1708
|
+
attrValue: ["yellow/300", "yellow/600"],
|
|
1709
|
+
attribute: ["yellow/300", "yellow/600"],
|
|
1710
|
+
boolean: ["purple/300", "purple/600"],
|
|
1711
|
+
builtin: ["purple/300", "purple/600"],
|
|
1712
|
+
cdata: ["yellow/300", "yellow/600"],
|
|
1713
|
+
char: ["yellow/300", "yellow/600"],
|
|
1714
|
+
class: ["orange/300", "orange/600"],
|
|
1715
|
+
className: ["cyan/300", "cyan/600"],
|
|
1716
|
+
comment: ["gray/600", "gray/300"],
|
|
1717
|
+
constant: ["purple/300", "purple/600"],
|
|
1718
|
+
deleted: ["red/300", "red/600"],
|
|
1719
|
+
entity: ["red/300", "red/600"],
|
|
1720
|
+
function: ["green/300", "green/600"],
|
|
1721
|
+
hexcode: ["blue/300", "blue/600"],
|
|
1722
|
+
id: ["purple/300", "purple/600"],
|
|
1723
|
+
important: ["purple/300", "purple/600"],
|
|
1724
|
+
inserted: ["green/300", "green/600"],
|
|
1725
|
+
keyword: ["magenta/300", "magenta/600"],
|
|
1726
|
+
number: ["purple/300", "purple/600"],
|
|
1727
|
+
operator: ["magenta/300", "magenta/600"],
|
|
1728
|
+
prolog: ["gray/300", "gray/600"],
|
|
1729
|
+
property: ["blue/300", "blue/600"],
|
|
1730
|
+
pseudoClass: ["yellow/300", "yellow/600"],
|
|
1731
|
+
pseudoElement: ["yellow/300", "yellow/600"],
|
|
1732
|
+
punctuation: ["gray/300", "gray/600"],
|
|
1733
|
+
regex: ["blue/300", "blue/600"],
|
|
1734
|
+
selector: ["red/300", "red/600"],
|
|
1735
|
+
string: ["yellow/300", "yellow/600"],
|
|
1736
|
+
symbol: ["purple/300", "purple/600"],
|
|
1737
|
+
tag: ["red/300", "red/600"],
|
|
1738
|
+
unit: ["orange/300", "orange/600"],
|
|
1739
|
+
url: ["red/300", "red/600"],
|
|
1740
|
+
variable: ["red/300", "red/600"]
|
|
1741
|
+
}
|
|
883
1742
|
},
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
fontSize: 15,
|
|
888
|
-
iconSize: 25,
|
|
889
|
-
lineHeight: 23,
|
|
890
|
-
letterSpacing: 0
|
|
1743
|
+
focusRing: ["blue/500", "blue/500"],
|
|
1744
|
+
link: {
|
|
1745
|
+
fg: ["blue/400", "blue/600"]
|
|
891
1746
|
},
|
|
892
|
-
{
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
lineHeight: 27,
|
|
898
|
-
letterSpacing: 0
|
|
1747
|
+
shadow: {
|
|
1748
|
+
outline: ["500/0.4", "500/0.3"],
|
|
1749
|
+
umbra: ["black/0.2", "500/0.1"],
|
|
1750
|
+
penumbra: ["black/0.14", "500/0.07"],
|
|
1751
|
+
ambient: ["black/0.12", "500/0.06"]
|
|
899
1752
|
},
|
|
900
|
-
{
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1753
|
+
variant: {
|
|
1754
|
+
tinted: {
|
|
1755
|
+
"*": {
|
|
1756
|
+
bg: {
|
|
1757
|
+
0: ["950", "50"],
|
|
1758
|
+
4: ["800", "200"]
|
|
1759
|
+
},
|
|
1760
|
+
border: {
|
|
1761
|
+
0: ["700", "100"],
|
|
1762
|
+
4: ["500", "300"]
|
|
1763
|
+
},
|
|
1764
|
+
fg: {
|
|
1765
|
+
0: ["100", "900"],
|
|
1766
|
+
4: ["300", "700"]
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
primary: {
|
|
1770
|
+
_hue: "blue"
|
|
1771
|
+
},
|
|
1772
|
+
suggest: {
|
|
1773
|
+
_hue: "purple"
|
|
1774
|
+
},
|
|
1775
|
+
positive: {
|
|
1776
|
+
_hue: "green"
|
|
1777
|
+
},
|
|
1778
|
+
caution: {
|
|
1779
|
+
_hue: "yellow"
|
|
1780
|
+
},
|
|
1781
|
+
critical: {
|
|
1782
|
+
_hue: "red"
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
solid: {
|
|
1786
|
+
"*": {
|
|
1787
|
+
bg: {
|
|
1788
|
+
0: ["400", "500"],
|
|
1789
|
+
4: ["300", "600"]
|
|
1790
|
+
},
|
|
1791
|
+
border: {
|
|
1792
|
+
0: ["200", "400"],
|
|
1793
|
+
4: ["100", "500"]
|
|
1794
|
+
},
|
|
1795
|
+
fg: {
|
|
1796
|
+
0: ["black", "white"],
|
|
1797
|
+
4: ["600", "400"]
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
default: {
|
|
1801
|
+
bg: {
|
|
1802
|
+
0: ["200", "800"],
|
|
1803
|
+
4: ["white", "black"]
|
|
1804
|
+
},
|
|
1805
|
+
border: {
|
|
1806
|
+
0: ["300", "700"],
|
|
1807
|
+
4: ["200", "800"]
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
primary: {
|
|
1811
|
+
_hue: "blue"
|
|
1812
|
+
},
|
|
1813
|
+
suggest: {
|
|
1814
|
+
_hue: "purple"
|
|
1815
|
+
},
|
|
1816
|
+
positive: {
|
|
1817
|
+
_hue: "green"
|
|
1818
|
+
},
|
|
1819
|
+
caution: {
|
|
1820
|
+
_hue: "yellow"
|
|
1821
|
+
},
|
|
1822
|
+
critical: {
|
|
1823
|
+
_hue: "red"
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
},
|
|
1828
|
+
transparent: {
|
|
1829
|
+
variant: {
|
|
1830
|
+
tinted: {
|
|
1831
|
+
"*": {
|
|
1832
|
+
bg: {
|
|
1833
|
+
0: ["black", "gray/50"],
|
|
1834
|
+
4: ["800", "300 50%"]
|
|
1835
|
+
},
|
|
1836
|
+
border: {
|
|
1837
|
+
0: ["800", "300 40%"],
|
|
1838
|
+
4: ["600", "300"]
|
|
1839
|
+
},
|
|
1840
|
+
fg: {
|
|
1841
|
+
0: ["100", "black"],
|
|
1842
|
+
4: ["400", "700"]
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
default: {
|
|
1849
|
+
variant: {
|
|
1850
|
+
tinted: {
|
|
1851
|
+
"*": {
|
|
1852
|
+
bg: {
|
|
1853
|
+
0: ["950", "white"],
|
|
1854
|
+
4: ["800", "200"]
|
|
1855
|
+
},
|
|
1856
|
+
border: {
|
|
1857
|
+
0: ["800", "100"],
|
|
1858
|
+
4: ["600", "300"]
|
|
1859
|
+
},
|
|
1860
|
+
fg: {
|
|
1861
|
+
0: ["white", "black"],
|
|
1862
|
+
4: ["400", "600"]
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
},
|
|
1868
|
+
neutral: {
|
|
1869
|
+
variant: {
|
|
1870
|
+
tinted: {
|
|
1871
|
+
"*": {
|
|
1872
|
+
bg: {
|
|
1873
|
+
0: ["900", "50"],
|
|
1874
|
+
4: ["700", "200"]
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
907
1878
|
}
|
|
908
|
-
|
|
1879
|
+
},
|
|
1880
|
+
primary: {
|
|
1881
|
+
_hue: "blue"
|
|
1882
|
+
},
|
|
1883
|
+
suggest: {
|
|
1884
|
+
_hue: "purple"
|
|
1885
|
+
},
|
|
1886
|
+
positive: {
|
|
1887
|
+
_hue: "green"
|
|
1888
|
+
},
|
|
1889
|
+
caution: {
|
|
1890
|
+
_hue: "yellow"
|
|
1891
|
+
},
|
|
1892
|
+
critical: {
|
|
1893
|
+
_hue: "red"
|
|
1894
|
+
}
|
|
909
1895
|
}
|
|
910
1896
|
};
|
|
911
|
-
function
|
|
912
|
-
return
|
|
1897
|
+
function merge(...records) {
|
|
1898
|
+
return records.filter(Boolean).reduce(_merge, {});
|
|
913
1899
|
}
|
|
914
|
-
function
|
|
915
|
-
|
|
1900
|
+
function _merge(acc, source) {
|
|
1901
|
+
for (const key of Object.keys(source)) {
|
|
1902
|
+
const prevValue = acc[key], nextValue = source[key];
|
|
1903
|
+
isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
|
|
1904
|
+
}
|
|
1905
|
+
return acc;
|
|
916
1906
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1907
|
+
function isRecord(value) {
|
|
1908
|
+
return value !== null && typeof value == "object" && !Array.isArray(value);
|
|
1909
|
+
}
|
|
1910
|
+
const defaultElementTokens = {
|
|
1911
|
+
bg: {
|
|
1912
|
+
0: ["950", "50"],
|
|
1913
|
+
4: ["700", "300"]
|
|
1914
|
+
},
|
|
1915
|
+
border: {
|
|
1916
|
+
0: ["700", "300"],
|
|
1917
|
+
4: ["400", "600"]
|
|
1918
|
+
},
|
|
1919
|
+
fg: {
|
|
1920
|
+
0: ["100", "900"],
|
|
1921
|
+
4: ["400", "600"]
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
function resolveTokens(tokens = {}) {
|
|
1925
|
+
return {
|
|
1926
|
+
color: {
|
|
1927
|
+
"*": resolveCardColorTokens(tokens.color?.["*"]),
|
|
1928
|
+
...THEME_COLOR_CARD_TONES.reduce((acc, tone) => ({
|
|
1929
|
+
...acc,
|
|
1930
|
+
[tone]: resolveCardColorTokens(merge(tokens.color?.["*"], tokens.color?.[tone]))
|
|
1931
|
+
}), {})
|
|
1932
|
+
}
|
|
1933
|
+
};
|
|
1934
|
+
}
|
|
1935
|
+
function resolveCardColorTokens(tokens) {
|
|
1936
|
+
return {
|
|
1937
|
+
_hue: tokens?._hue ?? "gray",
|
|
939
1938
|
avatar: {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1939
|
+
gray: {
|
|
1940
|
+
_hue: tokens?.avatar?.gray?._hue ?? "gray",
|
|
1941
|
+
bg: tokens?.avatar?.gray?.bg ?? ["400", "400"],
|
|
1942
|
+
fg: tokens?.avatar?.gray?.fg ?? ["900", "900"]
|
|
1943
|
+
},
|
|
1944
|
+
blue: {
|
|
1945
|
+
_hue: tokens?.avatar?.blue?._hue ?? "blue",
|
|
1946
|
+
bg: tokens?.avatar?.blue?.bg ?? ["400", "400"],
|
|
1947
|
+
fg: tokens?.avatar?.blue?.fg ?? ["900", "900"]
|
|
1948
|
+
},
|
|
1949
|
+
purple: {
|
|
1950
|
+
_hue: tokens?.avatar?.purple?._hue ?? "purple",
|
|
1951
|
+
bg: tokens?.avatar?.purple?.bg ?? ["400", "400"],
|
|
1952
|
+
fg: tokens?.avatar?.purple?.fg ?? ["900", "900"]
|
|
1953
|
+
},
|
|
1954
|
+
magenta: {
|
|
1955
|
+
_hue: tokens?.avatar?.magenta?._hue ?? "magenta",
|
|
1956
|
+
bg: tokens?.avatar?.magenta?.bg ?? ["400", "400"],
|
|
1957
|
+
fg: tokens?.avatar?.magenta?.fg ?? ["900", "900"]
|
|
1958
|
+
},
|
|
1959
|
+
red: {
|
|
1960
|
+
_hue: tokens?.avatar?.red?._hue ?? "red",
|
|
1961
|
+
bg: tokens?.avatar?.red?.bg ?? ["400", "400"],
|
|
1962
|
+
fg: tokens?.avatar?.red?.fg ?? ["900", "900"]
|
|
1963
|
+
},
|
|
1964
|
+
orange: {
|
|
1965
|
+
_hue: tokens?.avatar?.orange?._hue ?? "orange",
|
|
1966
|
+
bg: tokens?.avatar?.orange?.bg ?? ["400", "400"],
|
|
1967
|
+
fg: tokens?.avatar?.orange?.fg ?? ["900", "900"]
|
|
1968
|
+
},
|
|
1969
|
+
yellow: {
|
|
1970
|
+
_hue: tokens?.avatar?.yellow?._hue ?? "yellow",
|
|
1971
|
+
bg: tokens?.avatar?.yellow?.bg ?? ["400", "400"],
|
|
1972
|
+
fg: tokens?.avatar?.yellow?.fg ?? ["900", "900"]
|
|
1973
|
+
},
|
|
1974
|
+
green: {
|
|
1975
|
+
_hue: tokens?.avatar?.green?._hue ?? "green",
|
|
1976
|
+
bg: tokens?.avatar?.green?.bg ?? ["400", "400"],
|
|
1977
|
+
fg: tokens?.avatar?.green?.fg ?? ["900", "900"]
|
|
1978
|
+
},
|
|
1979
|
+
cyan: {
|
|
1980
|
+
_hue: tokens?.avatar?.cyan?._hue ?? "cyan",
|
|
1981
|
+
bg: tokens?.avatar?.cyan?.bg ?? ["400", "400"],
|
|
1982
|
+
fg: tokens?.avatar?.cyan?.fg ?? ["900", "900"]
|
|
1983
|
+
}
|
|
946
1984
|
},
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1985
|
+
backdrop: tokens?.backdrop ?? ["900", "100"],
|
|
1986
|
+
code: {
|
|
1987
|
+
bg: tokens?.code?.bg ?? ["950", "50"],
|
|
1988
|
+
fg: tokens?.code?.fg ?? ["400", "600"],
|
|
1989
|
+
token: {
|
|
1990
|
+
atrule: tokens?.code?.token?.atrule ?? ["400", "600"],
|
|
1991
|
+
attribute: tokens?.code?.token?.attribute ?? ["400", "600"],
|
|
1992
|
+
attrName: tokens?.code?.token?.attrName ?? ["400", "600"],
|
|
1993
|
+
attrValue: tokens?.code?.token?.attrValue ?? ["400", "600"],
|
|
1994
|
+
boolean: tokens?.code?.token?.boolean ?? ["400", "600"],
|
|
1995
|
+
builtin: tokens?.code?.token?.builtin ?? ["400", "600"],
|
|
1996
|
+
cdata: tokens?.code?.token?.cdata ?? ["400", "600"],
|
|
1997
|
+
char: tokens?.code?.token?.char ?? ["400", "600"],
|
|
1998
|
+
class: tokens?.code?.token?.class ?? ["400", "600"],
|
|
1999
|
+
className: tokens?.code?.token?.className ?? ["400", "600"],
|
|
2000
|
+
comment: tokens?.code?.token?.comment ?? ["600", "400"],
|
|
2001
|
+
constant: tokens?.code?.token?.constant ?? ["400", "600"],
|
|
2002
|
+
deleted: tokens?.code?.token?.deleted ?? ["400", "600"],
|
|
2003
|
+
doctype: tokens?.code?.token?.doctype ?? ["400", "600"],
|
|
2004
|
+
entity: tokens?.code?.token?.entity ?? ["400", "600"],
|
|
2005
|
+
function: tokens?.code?.token?.function ?? ["400", "600"],
|
|
2006
|
+
hexcode: tokens?.code?.token?.hexcode ?? ["400", "600"],
|
|
2007
|
+
id: tokens?.code?.token?.id ?? ["400", "600"],
|
|
2008
|
+
important: tokens?.code?.token?.important ?? ["400", "600"],
|
|
2009
|
+
inserted: tokens?.code?.token?.inserted ?? ["400", "600"],
|
|
2010
|
+
keyword: tokens?.code?.token?.keyword ?? ["400", "600"],
|
|
2011
|
+
number: tokens?.code?.token?.number ?? ["400", "600"],
|
|
2012
|
+
operator: tokens?.code?.token?.operator ?? ["400", "600"],
|
|
2013
|
+
prolog: tokens?.code?.token?.prolog ?? ["400", "600"],
|
|
2014
|
+
property: tokens?.code?.token?.property ?? ["400", "600"],
|
|
2015
|
+
pseudoClass: tokens?.code?.token?.pseudoClass ?? ["400", "600"],
|
|
2016
|
+
pseudoElement: tokens?.code?.token?.pseudoElement ?? ["400", "600"],
|
|
2017
|
+
punctuation: tokens?.code?.token?.punctuation ?? ["400", "600"],
|
|
2018
|
+
regex: tokens?.code?.token?.regex ?? ["400", "600"],
|
|
2019
|
+
selector: tokens?.code?.token?.selector ?? ["400", "600"],
|
|
2020
|
+
string: tokens?.code?.token?.string ?? ["400", "600"],
|
|
2021
|
+
symbol: tokens?.code?.token?.symbol ?? ["400", "600"],
|
|
2022
|
+
tag: tokens?.code?.token?.tag ?? ["400", "600"],
|
|
2023
|
+
unit: tokens?.code?.token?.unit ?? ["400", "600"],
|
|
2024
|
+
url: tokens?.code?.token?.url ?? ["400", "600"],
|
|
2025
|
+
variable: tokens?.code?.token?.variable ?? ["400", "600"]
|
|
964
2026
|
}
|
|
965
2027
|
},
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
2028
|
+
focusRing: tokens?.focusRing ?? ["500", "500"],
|
|
2029
|
+
link: {
|
|
2030
|
+
fg: tokens?.link?.fg ?? ["400", "600"]
|
|
2031
|
+
},
|
|
2032
|
+
shadow: {
|
|
2033
|
+
outline: tokens?.shadow?.outline ?? ["500", "500"],
|
|
2034
|
+
umbra: tokens?.shadow?.umbra ?? ["500", "500"],
|
|
2035
|
+
penumbra: tokens?.shadow?.penumbra ?? ["500", "500"],
|
|
2036
|
+
ambient: tokens?.shadow?.ambient ?? ["500", "500"]
|
|
2037
|
+
},
|
|
2038
|
+
skeleton: {
|
|
2039
|
+
from: tokens?.skeleton?.from ?? ["900", "100"],
|
|
2040
|
+
to: tokens?.skeleton?.to ?? ["950", "50"]
|
|
2041
|
+
},
|
|
2042
|
+
variant: {
|
|
2043
|
+
solid: {
|
|
2044
|
+
"*": resolveElementTokens(tokens?.variant?.solid?.["*"]),
|
|
2045
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.solid?.["*"], tokens?.variant?.solid?.[tone])), acc), {})
|
|
978
2046
|
},
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
...
|
|
2047
|
+
tinted: {
|
|
2048
|
+
"*": resolveElementTokens(tokens?.variant?.tinted?.["*"]),
|
|
2049
|
+
...THEME_COLOR_STATE_TONES.reduce((acc, tone) => (acc[tone] = resolveElementTokens(merge(tokens, tokens?.variant?.tinted?.["*"], tokens?.variant?.tinted?.[tone])), acc), {})
|
|
982
2050
|
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
function resolveElementTokens(tokens) {
|
|
2055
|
+
return {
|
|
2056
|
+
_hue: tokens?._hue ?? "gray",
|
|
2057
|
+
bg: {
|
|
2058
|
+
0: tokens?.bg?.[0] ?? defaultElementTokens.bg[0],
|
|
2059
|
+
4: tokens?.bg?.[4] ?? defaultElementTokens.bg[4]
|
|
2060
|
+
},
|
|
2061
|
+
border: {
|
|
2062
|
+
0: tokens?.border?.[0] ?? defaultElementTokens.border[0],
|
|
2063
|
+
4: tokens?.border?.[4] ?? defaultElementTokens.border[4]
|
|
2064
|
+
},
|
|
2065
|
+
fg: {
|
|
2066
|
+
0: tokens?.fg?.[0] ?? defaultElementTokens.fg[0],
|
|
2067
|
+
4: tokens?.fg?.[4] ?? defaultElementTokens.fg[4]
|
|
2068
|
+
}
|
|
990
2069
|
};
|
|
991
|
-
return cache$2.set(v0, v2), v2;
|
|
992
2070
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
2071
|
+
function buildTheme_v3(options) {
|
|
2072
|
+
const {
|
|
2073
|
+
v2
|
|
2074
|
+
} = options ?? {}, tokens = resolveTokens(options?.tokens ?? defaultTokens);
|
|
2075
|
+
return {
|
|
2076
|
+
_version: 3,
|
|
2077
|
+
_tokens: tokens,
|
|
2078
|
+
avatar: v2?.avatar ?? defaultThemeConfig.avatar,
|
|
2079
|
+
button: v2?.button ?? defaultThemeConfig.button,
|
|
2080
|
+
card: v2?.card ?? defaultThemeConfig.card,
|
|
2081
|
+
color: buildColor_v3(tokens.color),
|
|
2082
|
+
container: v2?.container ?? defaultThemeConfig.container,
|
|
2083
|
+
font: v2?.font ?? defaultThemeFonts,
|
|
2084
|
+
input: v2?.input ?? defaultThemeConfig.input,
|
|
2085
|
+
layer: v2?.layer ?? defaultThemeConfig.layer,
|
|
2086
|
+
media: v2?.media ?? defaultThemeConfig.media,
|
|
2087
|
+
radius: v2?.radius ?? defaultThemeConfig.radius,
|
|
2088
|
+
shadow: v2?.shadow ?? defaultThemeConfig.shadow,
|
|
2089
|
+
space: v2?.space ?? defaultThemeConfig.space
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
const cache$4 = /* @__PURE__ */ new WeakMap();
|
|
2093
|
+
function v2_v0(v2, v3) {
|
|
2094
|
+
const cachedTheme = cache$4.get(v2);
|
|
996
2095
|
if (cachedTheme) return cachedTheme;
|
|
997
2096
|
const {
|
|
998
2097
|
avatar,
|
|
@@ -1038,7 +2137,8 @@ function v2_v0(v2) {
|
|
|
1038
2137
|
shadows,
|
|
1039
2138
|
space,
|
|
1040
2139
|
styles,
|
|
1041
|
-
v2
|
|
2140
|
+
v2,
|
|
2141
|
+
v3
|
|
1042
2142
|
};
|
|
1043
2143
|
}
|
|
1044
2144
|
function themeColor_v2_v0(color_v2) {
|
|
@@ -1097,59 +2197,378 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1097
2197
|
placeholder: t.placeholder
|
|
1098
2198
|
};
|
|
1099
2199
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
2200
|
+
function themeColor_v3_v2(options) {
|
|
2201
|
+
const {
|
|
2202
|
+
color: color2,
|
|
2203
|
+
dark
|
|
2204
|
+
} = options;
|
|
2205
|
+
return {
|
|
2206
|
+
_blend: "screen",
|
|
2207
|
+
_dark: dark,
|
|
2208
|
+
...buildColorState({
|
|
2209
|
+
cardColor: color2,
|
|
2210
|
+
state: "enabled",
|
|
2211
|
+
tone: "default",
|
|
2212
|
+
variant: "tinted"
|
|
2213
|
+
}),
|
|
2214
|
+
backdrop: color2.backdrop,
|
|
2215
|
+
button: THEME_COLOR_BUTTON_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
|
|
2216
|
+
cardColor: color2,
|
|
2217
|
+
state,
|
|
2218
|
+
tone,
|
|
2219
|
+
variant: mode === "default" ? "solid" : "tinted"
|
|
2220
|
+
}), mode === "bleed" && (states[state].border = "transparent"), states), {}), tones2), {}), modes), {}),
|
|
2221
|
+
focusRing: color2.focusRing,
|
|
2222
|
+
input: THEME_COLOR_INPUT_MODES.reduce((modes, mode) => (modes[mode] = THEME_COLOR_INPUT_STATES.reduce((states, state) => (states[state] = buildInputState(color2.variant.tinted.default), states), {}), modes), {}),
|
|
2223
|
+
selectable: THEME_COLOR_STATE_TONES.reduce((tones2, tone) => (tones2[tone] = THEME_COLOR_STATES.reduce((states, state) => (states[state] = buildColorState({
|
|
2224
|
+
cardColor: color2,
|
|
2225
|
+
// cardVars: vars,
|
|
2226
|
+
state,
|
|
2227
|
+
tone,
|
|
2228
|
+
variant: "tinted"
|
|
2229
|
+
}), states), {}), tones2), {}),
|
|
2230
|
+
shadow: color2.shadow,
|
|
2231
|
+
syntax: color2.code.token
|
|
2232
|
+
};
|
|
2233
|
+
}
|
|
2234
|
+
const stateShades = {
|
|
2235
|
+
enabled: {
|
|
2236
|
+
bg: [0, 1, 2],
|
|
2237
|
+
border: [0, 1, 2],
|
|
2238
|
+
fg: [0, 1, 2]
|
|
2239
|
+
},
|
|
2240
|
+
hovered: {
|
|
2241
|
+
bg: [1, 2, 3],
|
|
2242
|
+
border: [1, 2, 3],
|
|
2243
|
+
fg: [1, 2, 3]
|
|
2244
|
+
},
|
|
2245
|
+
pressed: {
|
|
2246
|
+
bg: [2, 3, 4],
|
|
2247
|
+
border: [2, 3, 4],
|
|
2248
|
+
fg: [2, 3, 4]
|
|
2249
|
+
},
|
|
2250
|
+
selected: {
|
|
2251
|
+
bg: [3, 4, 4],
|
|
2252
|
+
border: [3, 4, 4],
|
|
2253
|
+
fg: [3, 4, 4]
|
|
2254
|
+
},
|
|
2255
|
+
disabled: {
|
|
2256
|
+
bg: [4, 4, 4],
|
|
2257
|
+
border: [4, 4, 4],
|
|
2258
|
+
fg: [4, 4, 4]
|
|
2259
|
+
}
|
|
2260
|
+
};
|
|
2261
|
+
function mix$1(tokens, index) {
|
|
2262
|
+
return index === 0 ? tokens[0] : index === 4 ? tokens[4] : `color-mix(in oklch, ${tokens[0]}, ${tokens[4]} ${index * 25}%)`;
|
|
2263
|
+
}
|
|
2264
|
+
function buildColorState(options) {
|
|
2265
|
+
const {
|
|
2266
|
+
cardColor,
|
|
2267
|
+
state,
|
|
2268
|
+
tone,
|
|
2269
|
+
variant
|
|
2270
|
+
} = options, color2 = cardColor.variant[variant][tone], shades = stateShades[state];
|
|
2271
|
+
return {
|
|
2272
|
+
accent: {
|
|
2273
|
+
fg: color2.fg[4]
|
|
2274
|
+
},
|
|
2275
|
+
avatar: cardColor.avatar,
|
|
2276
|
+
badge: THEME_COLOR_STATE_TONES.reduce((tones2, tone2) => (tones2[tone2] = {
|
|
2277
|
+
bg: mix$1(color2.bg, 1),
|
|
2278
|
+
fg: mix$1(color2.fg, 1),
|
|
2279
|
+
dot: mix$1(color2.fg, 3),
|
|
2280
|
+
icon: mix$1(color2.fg, 3)
|
|
2281
|
+
}, tones2), {}),
|
|
2282
|
+
bg: mix$1(color2.bg, shades.bg[0]),
|
|
2283
|
+
border: mix$1(color2.border, shades.border[0]),
|
|
2284
|
+
fg: mix$1(color2.fg, shades.fg[0]),
|
|
2285
|
+
code: {
|
|
2286
|
+
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2287
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2288
|
+
},
|
|
2289
|
+
icon: mix$1(color2.fg, shades.fg[2]),
|
|
2290
|
+
kbd: {
|
|
2291
|
+
bg: mix$1(color2.bg, 0),
|
|
2292
|
+
fg: mix$1(color2.fg, 0),
|
|
2293
|
+
border: mix$1(color2.bg, 0)
|
|
2294
|
+
},
|
|
2295
|
+
link: {
|
|
2296
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2297
|
+
},
|
|
2298
|
+
muted: {
|
|
2299
|
+
bg: mix$1(color2.bg, shades.bg[1]),
|
|
2300
|
+
fg: mix$1(color2.fg, shades.fg[2])
|
|
2301
|
+
},
|
|
2302
|
+
skeleton: cardColor.skeleton
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
function buildInputState(colorElement) {
|
|
2306
|
+
return {
|
|
2307
|
+
bg: colorElement.bg[0],
|
|
2308
|
+
border: colorElement.bg[0],
|
|
2309
|
+
fg: colorElement.fg[0],
|
|
2310
|
+
muted: {
|
|
2311
|
+
bg: colorElement.bg[0]
|
|
2312
|
+
},
|
|
2313
|
+
placeholder: colorElement.fg[0]
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
function v3_v2(theme_v3) {
|
|
2317
|
+
return {
|
|
2318
|
+
_version: 2,
|
|
2319
|
+
avatar: theme_v3.avatar,
|
|
2320
|
+
button: theme_v3.button,
|
|
2321
|
+
card: theme_v3.card,
|
|
2322
|
+
color: {
|
|
2323
|
+
dark: {
|
|
2324
|
+
transparent: themeColor_v3_v2({
|
|
2325
|
+
color: theme_v3.color.dark.card.transparent,
|
|
2326
|
+
dark: !0
|
|
2327
|
+
// vars: vars.color.dark.transparent,
|
|
2328
|
+
}),
|
|
2329
|
+
default: themeColor_v3_v2({
|
|
2330
|
+
color: theme_v3.color.dark.card.default,
|
|
2331
|
+
dark: !0
|
|
2332
|
+
// vars: vars.color.dark.default,
|
|
2333
|
+
}),
|
|
2334
|
+
neutral: themeColor_v3_v2({
|
|
2335
|
+
color: theme_v3.color.dark.card.neutral,
|
|
2336
|
+
dark: !0
|
|
2337
|
+
// vars: vars.color.dark.neutral,
|
|
2338
|
+
}),
|
|
2339
|
+
primary: themeColor_v3_v2({
|
|
2340
|
+
color: theme_v3.color.dark.card.primary,
|
|
2341
|
+
dark: !0
|
|
2342
|
+
// vars: vars.color.dark.primary,
|
|
2343
|
+
}),
|
|
2344
|
+
suggest: themeColor_v3_v2({
|
|
2345
|
+
color: theme_v3.color.dark.card.suggest,
|
|
2346
|
+
dark: !0
|
|
2347
|
+
// vars: vars.color.dark.suggest,
|
|
2348
|
+
}),
|
|
2349
|
+
positive: themeColor_v3_v2({
|
|
2350
|
+
color: theme_v3.color.dark.card.positive,
|
|
2351
|
+
dark: !0
|
|
2352
|
+
// vars: vars.color.dark.positive,
|
|
2353
|
+
}),
|
|
2354
|
+
caution: themeColor_v3_v2({
|
|
2355
|
+
color: theme_v3.color.dark.card.caution,
|
|
2356
|
+
dark: !0
|
|
2357
|
+
// vars: vars.color.dark.caution,
|
|
2358
|
+
}),
|
|
2359
|
+
critical: themeColor_v3_v2({
|
|
2360
|
+
color: theme_v3.color.dark.card.critical,
|
|
2361
|
+
dark: !0
|
|
2362
|
+
// vars: vars.color.dark.critical,
|
|
2363
|
+
})
|
|
2364
|
+
},
|
|
2365
|
+
light: {
|
|
2366
|
+
transparent: themeColor_v3_v2({
|
|
2367
|
+
color: theme_v3.color.light.card.transparent,
|
|
2368
|
+
dark: !1
|
|
2369
|
+
// vars: vars.color.light.transparent,
|
|
2370
|
+
}),
|
|
2371
|
+
default: themeColor_v3_v2({
|
|
2372
|
+
color: theme_v3.color.light.card.default,
|
|
2373
|
+
dark: !1
|
|
2374
|
+
// vars: vars.color.light.default,
|
|
2375
|
+
}),
|
|
2376
|
+
neutral: themeColor_v3_v2({
|
|
2377
|
+
color: theme_v3.color.light.card.neutral,
|
|
2378
|
+
dark: !1
|
|
2379
|
+
// vars: vars.color.light.neutral,
|
|
2380
|
+
}),
|
|
2381
|
+
primary: themeColor_v3_v2({
|
|
2382
|
+
color: theme_v3.color.light.card.primary,
|
|
2383
|
+
dark: !1
|
|
2384
|
+
// vars: vars.color.light.primary,
|
|
2385
|
+
}),
|
|
2386
|
+
suggest: themeColor_v3_v2({
|
|
2387
|
+
color: theme_v3.color.light.card.suggest,
|
|
2388
|
+
dark: !1
|
|
2389
|
+
// vars: vars.color.light.suggest,
|
|
2390
|
+
}),
|
|
2391
|
+
positive: themeColor_v3_v2({
|
|
2392
|
+
color: theme_v3.color.light.card.positive,
|
|
2393
|
+
dark: !1
|
|
2394
|
+
// vars: vars.color.light.positive,
|
|
2395
|
+
}),
|
|
2396
|
+
caution: themeColor_v3_v2({
|
|
2397
|
+
color: theme_v3.color.light.card.caution,
|
|
2398
|
+
dark: !1
|
|
2399
|
+
// vars: vars.color.light.caution,
|
|
2400
|
+
}),
|
|
2401
|
+
critical: themeColor_v3_v2({
|
|
2402
|
+
color: theme_v3.color.light.card.critical,
|
|
2403
|
+
dark: !1
|
|
2404
|
+
// vars: vars.color.light.critical,
|
|
2405
|
+
})
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
container: theme_v3.container,
|
|
2409
|
+
font: theme_v3.font,
|
|
2410
|
+
input: theme_v3.input,
|
|
2411
|
+
layer: theme_v3.layer,
|
|
2412
|
+
media: theme_v3.media,
|
|
2413
|
+
radius: theme_v3.radius,
|
|
2414
|
+
shadow: theme_v3.shadow,
|
|
2415
|
+
space: theme_v3.space
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
function buildTheme(_config) {
|
|
2419
|
+
const v3 = buildTheme_v3({
|
|
2420
|
+
v2: _config
|
|
2421
|
+
});
|
|
2422
|
+
return v2_v0(v3_v2(v3), v3);
|
|
2423
|
+
}
|
|
2424
|
+
function mixChannel(b, s, weight) {
|
|
2425
|
+
const delta = (s - b) * weight;
|
|
2426
|
+
return b + delta;
|
|
2427
|
+
}
|
|
2428
|
+
function mix(b, s, weight) {
|
|
2429
|
+
return {
|
|
2430
|
+
r: mixChannel(b.r, s.r, weight),
|
|
2431
|
+
g: mixChannel(b.g, s.g, weight),
|
|
2432
|
+
b: mixChannel(b.b, s.b, weight)
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function multiplyChannel(b, s) {
|
|
2436
|
+
return b * s;
|
|
2437
|
+
}
|
|
2438
|
+
function multiply(b, s) {
|
|
2439
|
+
return {
|
|
2440
|
+
r: multiplyChannel(b.r / 255, s.r / 255) * 255,
|
|
2441
|
+
g: multiplyChannel(b.g / 255, s.g / 255) * 255,
|
|
2442
|
+
b: multiplyChannel(b.b / 255, s.b / 255) * 255
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
function screenChannel(b, s) {
|
|
2446
|
+
return b + s - b * s;
|
|
2447
|
+
}
|
|
2448
|
+
function screen(b, s) {
|
|
2449
|
+
return {
|
|
2450
|
+
r: screenChannel(b.r / 255, s.r / 255) * 255,
|
|
2451
|
+
g: screenChannel(b.g / 255, s.g / 255) * 255,
|
|
2452
|
+
b: screenChannel(b.b / 255, s.b / 255) * 255
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
function clamp(a, min = 0, max = 1) {
|
|
2456
|
+
return Math.min(max, Math.max(min, a));
|
|
2457
|
+
}
|
|
2458
|
+
function round(value) {
|
|
2459
|
+
return Math.round(value);
|
|
2460
|
+
}
|
|
2461
|
+
function hexToRgb(hex) {
|
|
2462
|
+
if (hex.length === 4) {
|
|
2463
|
+
const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
|
|
2464
|
+
return {
|
|
2465
|
+
r: parseInt(hexR + hexR, 16),
|
|
2466
|
+
g: parseInt(hexG + hexG, 16),
|
|
2467
|
+
b: parseInt(hexB + hexB, 16)
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2470
|
+
return {
|
|
2471
|
+
r: parseInt(hex.slice(1, 3), 16),
|
|
2472
|
+
g: parseInt(hex.slice(3, 5), 16),
|
|
2473
|
+
b: parseInt(hex.slice(5, 7), 16)
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
function rgbaToRGBA(rgba2) {
|
|
2477
|
+
const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
|
|
2478
|
+
return {
|
|
2479
|
+
r: parseInt(values[0]),
|
|
2480
|
+
g: parseInt(values[1]),
|
|
2481
|
+
b: parseInt(values[2]),
|
|
2482
|
+
a: parseFloat(values[3])
|
|
2483
|
+
};
|
|
2484
|
+
}
|
|
2485
|
+
function rgbToHex(color2) {
|
|
2486
|
+
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
2487
|
+
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2488
|
+
}
|
|
2489
|
+
function rgbToHsl({
|
|
2490
|
+
r,
|
|
2491
|
+
g,
|
|
2492
|
+
b
|
|
2493
|
+
}) {
|
|
2494
|
+
r /= 255, g /= 255, b /= 255;
|
|
2495
|
+
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2496
|
+
let h = 0, s = 0, l = 0;
|
|
2497
|
+
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
2498
|
+
h,
|
|
2499
|
+
s,
|
|
2500
|
+
l
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
function hslToRgb(hsl) {
|
|
2504
|
+
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
2505
|
+
let r = 0, g = 0, b = 0;
|
|
2506
|
+
return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
|
|
2507
|
+
r: Math.round((r + m) * 255),
|
|
2508
|
+
g: Math.round((g + m) * 255),
|
|
2509
|
+
b: Math.round((b + m) * 255)
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
|
|
2513
|
+
function isHexChars(str) {
|
|
2514
|
+
for (const c of str)
|
|
2515
|
+
if (HEX_CHARS.indexOf(c) === -1)
|
|
2516
|
+
return !1;
|
|
2517
|
+
return !0;
|
|
2518
|
+
}
|
|
2519
|
+
function isHex(str) {
|
|
2520
|
+
return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
|
|
2521
|
+
}
|
|
2522
|
+
function parseHsl(str) {
|
|
2523
|
+
const res = HSL_RE.exec(str);
|
|
2524
|
+
if (!res)
|
|
2525
|
+
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2526
|
+
return {
|
|
2527
|
+
h: parseInt(res[1]),
|
|
2528
|
+
s: parseFloat(res[3]),
|
|
2529
|
+
l: parseFloat(res[5])
|
|
2530
|
+
};
|
|
2531
|
+
}
|
|
2532
|
+
function parseColor(color2) {
|
|
2533
|
+
if (!color2) return {
|
|
2534
|
+
r: 0,
|
|
2535
|
+
g: 0,
|
|
2536
|
+
b: 0
|
|
2537
|
+
};
|
|
2538
|
+
if (typeof color2 != "string")
|
|
2539
|
+
throw new Error("parseColor: expected a string");
|
|
2540
|
+
if (isHex(color2))
|
|
2541
|
+
return hexToRgb(color2);
|
|
2542
|
+
if (color2.startsWith("hsl("))
|
|
2543
|
+
return hslToRgb(parseHsl(color2));
|
|
2544
|
+
if (color2.startsWith("rgba("))
|
|
2545
|
+
return rgbaToRGBA(color2);
|
|
2546
|
+
throw new Error(`parseColor: unexpected color format: "${color2}"`);
|
|
2547
|
+
}
|
|
2548
|
+
function getContrastRatio(bg, fg) {
|
|
2549
|
+
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2550
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2551
|
+
}
|
|
2552
|
+
function rgb_lrgb({
|
|
2553
|
+
r,
|
|
2554
|
+
g,
|
|
2555
|
+
b
|
|
2556
|
+
}) {
|
|
2557
|
+
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2558
|
+
}
|
|
2559
|
+
function rgb_lrgb1(v) {
|
|
2560
|
+
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
2561
|
+
}
|
|
2562
|
+
function lrgb_luminance([r, g, b]) {
|
|
2563
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
2564
|
+
}
|
|
2565
|
+
function rgba(color2, a) {
|
|
2566
|
+
if (typeof color2 == "string" && color2.startsWith("var("))
|
|
2567
|
+
return `color-mix(in srgb, transparent, ${color2} ${a * 100}%)`;
|
|
2568
|
+
const rgb = parseColor(color2);
|
|
2569
|
+
return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
|
|
2570
|
+
}
|
|
2571
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1153
2572
|
function parseTokenKey(str) {
|
|
1154
2573
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1155
2574
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -1309,1694 +2728,341 @@ function isColorValue(str) {
|
|
|
1309
2728
|
function isColorOpacityValue(str) {
|
|
1310
2729
|
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1311
2730
|
}
|
|
1312
|
-
function
|
|
1313
|
-
|
|
1314
|
-
|
|
2731
|
+
function is_v2(themeProp) {
|
|
2732
|
+
return themeProp._version === 2;
|
|
2733
|
+
}
|
|
2734
|
+
function themeColor_v0_v2_9(color2) {
|
|
2735
|
+
if ("neutral" in color2.badge)
|
|
2736
|
+
return color2;
|
|
2737
|
+
const colors2 = color2;
|
|
2738
|
+
return {
|
|
2739
|
+
...colors2,
|
|
2740
|
+
badge: {
|
|
2741
|
+
...colors2.badge,
|
|
2742
|
+
neutral: colors2.badge.default,
|
|
2743
|
+
suggest: colors2.badge.primary
|
|
2744
|
+
},
|
|
2745
|
+
button: {
|
|
2746
|
+
bleed: {
|
|
2747
|
+
...colors2.button.bleed,
|
|
2748
|
+
neutral: colors2.button.bleed.default,
|
|
2749
|
+
suggest: colors2.button.bleed.primary
|
|
2750
|
+
},
|
|
2751
|
+
default: {
|
|
2752
|
+
...colors2.button.default,
|
|
2753
|
+
neutral: colors2.button.default.default,
|
|
2754
|
+
suggest: colors2.button.default.primary
|
|
2755
|
+
},
|
|
2756
|
+
ghost: {
|
|
2757
|
+
...colors2.button.ghost,
|
|
2758
|
+
neutral: colors2.button.ghost.default,
|
|
2759
|
+
suggest: colors2.button.ghost.primary
|
|
2760
|
+
}
|
|
2761
|
+
},
|
|
2762
|
+
selectable: {
|
|
2763
|
+
...colors2.selectable,
|
|
2764
|
+
neutral: colors2.selectable.default,
|
|
2765
|
+
suggest: colors2.selectable.primary
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
1315
2768
|
}
|
|
1316
|
-
const
|
|
1317
|
-
function
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1321
|
-
|
|
2769
|
+
const cache$3 = /* @__PURE__ */ new WeakMap();
|
|
2770
|
+
function themeColor_v0_v2(color_v0) {
|
|
2771
|
+
const cached_v2 = cache$3.get(color_v0);
|
|
2772
|
+
if (cached_v2) return cached_v2;
|
|
2773
|
+
const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled), color_v2 = {
|
|
2774
|
+
_blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
|
|
2775
|
+
_dark: color_v0.dark,
|
|
2776
|
+
accent: base.accent,
|
|
2777
|
+
avatar: base.avatar,
|
|
2778
|
+
backdrop: color_v0.base.shadow.ambient,
|
|
2779
|
+
badge: base.badge,
|
|
2780
|
+
bg: color_v0.base.bg,
|
|
2781
|
+
border: color_v0.base.border,
|
|
2782
|
+
button: {
|
|
2783
|
+
default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
|
|
2784
|
+
ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
|
|
2785
|
+
bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
|
|
2786
|
+
},
|
|
2787
|
+
code: base.code,
|
|
2788
|
+
fg: color_v0.base.fg,
|
|
2789
|
+
focusRing: color_v0.base.focusRing,
|
|
2790
|
+
icon: base.muted.fg,
|
|
2791
|
+
input: {
|
|
2792
|
+
default: inputStatesThemeColor_v0_v2(color_v0.input.default),
|
|
2793
|
+
invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
|
|
2794
|
+
},
|
|
2795
|
+
kbd: base.kbd,
|
|
2796
|
+
link: base.link,
|
|
2797
|
+
muted: {
|
|
2798
|
+
...base.muted,
|
|
2799
|
+
bg: color_v0.selectable?.default.enabled.bg2 || color_v0.base.bg
|
|
2800
|
+
},
|
|
2801
|
+
selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
|
|
2802
|
+
shadow: color_v0.base.shadow,
|
|
2803
|
+
skeleton: {
|
|
2804
|
+
from: color_v0.skeleton?.from || color_v0.base.border,
|
|
2805
|
+
to: color_v0.skeleton?.to || color_v0.base.border
|
|
2806
|
+
},
|
|
2807
|
+
syntax: color_v0.syntax
|
|
2808
|
+
};
|
|
2809
|
+
return cache$3.set(color_v0, color_v2), color_v2;
|
|
1322
2810
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
2811
|
+
function stateTonesThemeColor_v0_v2(v0, t) {
|
|
2812
|
+
return {
|
|
2813
|
+
default: {
|
|
2814
|
+
enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
|
|
2815
|
+
hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
|
|
2816
|
+
pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
|
|
2817
|
+
selected: stateThemeColor_v0_v2(v0, t.default.selected),
|
|
2818
|
+
disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
|
|
2819
|
+
},
|
|
2820
|
+
neutral: {
|
|
2821
|
+
enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
|
|
2822
|
+
hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
|
|
2823
|
+
pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
|
|
2824
|
+
selected: stateThemeColor_v0_v2(v0, t.default.selected),
|
|
2825
|
+
disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
|
|
2826
|
+
},
|
|
2827
|
+
primary: {
|
|
2828
|
+
enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
|
|
2829
|
+
hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
|
|
2830
|
+
pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
|
|
2831
|
+
selected: stateThemeColor_v0_v2(v0, t.primary.selected),
|
|
2832
|
+
disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
|
|
2833
|
+
},
|
|
2834
|
+
suggest: {
|
|
2835
|
+
enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
|
|
2836
|
+
hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
|
|
2837
|
+
pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
|
|
2838
|
+
selected: stateThemeColor_v0_v2(v0, t.primary.selected),
|
|
2839
|
+
disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
|
|
2840
|
+
},
|
|
2841
|
+
positive: {
|
|
2842
|
+
enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
|
|
2843
|
+
hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
|
|
2844
|
+
pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
|
|
2845
|
+
selected: stateThemeColor_v0_v2(v0, t.positive.selected),
|
|
2846
|
+
disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
|
|
2847
|
+
},
|
|
2848
|
+
caution: {
|
|
2849
|
+
enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
|
|
2850
|
+
hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
|
|
2851
|
+
pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
|
|
2852
|
+
selected: stateThemeColor_v0_v2(v0, t.caution.selected),
|
|
2853
|
+
disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
|
|
2854
|
+
},
|
|
2855
|
+
critical: {
|
|
2856
|
+
enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
|
|
2857
|
+
hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
|
|
2858
|
+
pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
|
|
2859
|
+
selected: stateThemeColor_v0_v2(v0, t.critical.selected),
|
|
2860
|
+
disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
function stateThemeColor_v0_v2(v0, state) {
|
|
2865
|
+
return {
|
|
2866
|
+
...state,
|
|
2867
|
+
avatar: {
|
|
2868
|
+
gray: {
|
|
2869
|
+
bg: v0.spot.gray,
|
|
2870
|
+
fg: v0.base.bg
|
|
1329
2871
|
},
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
bg: ["500", "400"],
|
|
1334
|
-
fg: ["white", "black"]
|
|
1335
|
-
}
|
|
2872
|
+
blue: {
|
|
2873
|
+
bg: v0.spot.blue,
|
|
2874
|
+
fg: v0.base.bg
|
|
1336
2875
|
},
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
bg: ["100", "900"],
|
|
1341
|
-
fg: ["600", "400"],
|
|
1342
|
-
icon: ["500", "500"],
|
|
1343
|
-
dot: ["500", "500"]
|
|
1344
|
-
},
|
|
1345
|
-
positive: {
|
|
1346
|
-
bg: ["200 50%", "900"],
|
|
1347
|
-
fg: ["600", "500"]
|
|
1348
|
-
},
|
|
1349
|
-
caution: {
|
|
1350
|
-
bg: ["200 50%", "900"],
|
|
1351
|
-
fg: ["600", "500"]
|
|
1352
|
-
}
|
|
2876
|
+
purple: {
|
|
2877
|
+
bg: v0.spot.purple,
|
|
2878
|
+
fg: v0.base.bg
|
|
1353
2879
|
},
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
bg: ["50", "950"],
|
|
1358
|
-
fg: ["600", "400"]
|
|
2880
|
+
magenta: {
|
|
2881
|
+
bg: v0.spot.magenta,
|
|
2882
|
+
fg: v0.base.bg
|
|
1359
2883
|
},
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
kbd: {
|
|
1364
|
-
bg: ["white", "black"],
|
|
1365
|
-
fg: ["600", "400"],
|
|
1366
|
-
border: ["200", "800"]
|
|
2884
|
+
red: {
|
|
2885
|
+
bg: v0.spot.red,
|
|
2886
|
+
fg: v0.base.bg
|
|
1367
2887
|
},
|
|
1368
|
-
|
|
1369
|
-
|
|
2888
|
+
orange: {
|
|
2889
|
+
bg: v0.spot.orange,
|
|
2890
|
+
fg: v0.base.bg
|
|
1370
2891
|
},
|
|
1371
|
-
|
|
1372
|
-
bg:
|
|
1373
|
-
fg:
|
|
2892
|
+
yellow: {
|
|
2893
|
+
bg: v0.spot.yellow,
|
|
2894
|
+
fg: v0.base.bg
|
|
1374
2895
|
},
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
penumbra: ["gray/500/0.07", "black/0.14"],
|
|
1379
|
-
ambient: ["gray/500/0.06", "black/0.12"]
|
|
2896
|
+
green: {
|
|
2897
|
+
bg: v0.spot.green,
|
|
2898
|
+
fg: v0.base.bg
|
|
1380
2899
|
},
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
2900
|
+
cyan: {
|
|
2901
|
+
bg: v0.spot.cyan,
|
|
2902
|
+
fg: v0.base.bg
|
|
1384
2903
|
}
|
|
1385
2904
|
},
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
2905
|
+
badge: {
|
|
2906
|
+
default: {
|
|
2907
|
+
bg: v0.muted.default.enabled.bg,
|
|
2908
|
+
fg: v0.muted.default.enabled.fg,
|
|
2909
|
+
dot: v0.muted.default.enabled.muted.fg,
|
|
2910
|
+
icon: v0.muted.default.enabled.muted.fg
|
|
2911
|
+
},
|
|
2912
|
+
neutral: {
|
|
2913
|
+
bg: v0.muted.transparent.enabled.bg,
|
|
2914
|
+
fg: v0.muted.transparent.enabled.fg,
|
|
2915
|
+
dot: v0.muted.transparent.enabled.muted.fg,
|
|
2916
|
+
icon: v0.muted.transparent.enabled.muted.fg
|
|
2917
|
+
},
|
|
2918
|
+
primary: {
|
|
2919
|
+
bg: v0.muted.primary.enabled.bg,
|
|
2920
|
+
fg: v0.muted.primary.enabled.fg,
|
|
2921
|
+
dot: v0.muted.primary.enabled.muted.fg,
|
|
2922
|
+
icon: v0.muted.primary.enabled.muted.fg
|
|
2923
|
+
},
|
|
2924
|
+
suggest: {
|
|
2925
|
+
bg: v0.muted.primary.enabled.bg,
|
|
2926
|
+
fg: v0.muted.primary.enabled.fg,
|
|
2927
|
+
dot: v0.muted.primary.enabled.muted.fg,
|
|
2928
|
+
icon: v0.muted.primary.enabled.muted.fg
|
|
2929
|
+
},
|
|
2930
|
+
positive: {
|
|
2931
|
+
bg: v0.muted.positive.enabled.bg,
|
|
2932
|
+
fg: v0.muted.positive.enabled.fg,
|
|
2933
|
+
dot: v0.muted.positive.enabled.muted.fg,
|
|
2934
|
+
icon: v0.muted.positive.enabled.muted.fg
|
|
2935
|
+
},
|
|
2936
|
+
caution: {
|
|
2937
|
+
bg: v0.muted.caution.enabled.bg,
|
|
2938
|
+
fg: v0.muted.caution.enabled.fg,
|
|
2939
|
+
dot: v0.muted.caution.enabled.muted.fg,
|
|
2940
|
+
icon: v0.muted.caution.enabled.muted.fg
|
|
2941
|
+
},
|
|
2942
|
+
critical: {
|
|
2943
|
+
bg: v0.muted.critical.enabled.bg,
|
|
2944
|
+
fg: v0.muted.critical.enabled.fg,
|
|
2945
|
+
dot: v0.muted.critical.enabled.muted.fg,
|
|
2946
|
+
icon: v0.muted.critical.enabled.muted.fg
|
|
1394
2947
|
}
|
|
1395
2948
|
},
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
2949
|
+
kbd: {
|
|
2950
|
+
bg: v0.muted.default.enabled.bg,
|
|
2951
|
+
fg: v0.muted.default.enabled.fg,
|
|
2952
|
+
border: v0.muted.default.enabled.border
|
|
1400
2953
|
},
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
2954
|
+
muted: {
|
|
2955
|
+
...v0.muted.default.enabled.muted,
|
|
2956
|
+
bg: state.bg2 || state.bg
|
|
1404
2957
|
},
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
default: {
|
|
1409
|
-
"*": {
|
|
1410
|
-
"*": {
|
|
1411
|
-
_blend: ["screen", "multiply"],
|
|
1412
|
-
accent: {
|
|
1413
|
-
fg: ["purple/300", "purple/700"]
|
|
1414
|
-
},
|
|
1415
|
-
avatar: {
|
|
1416
|
-
"*": {
|
|
1417
|
-
_blend: ["screen", "multiply"],
|
|
1418
|
-
bg: ["500", "400"],
|
|
1419
|
-
fg: ["white", "black"]
|
|
1420
|
-
}
|
|
1421
|
-
},
|
|
1422
|
-
badge: {
|
|
1423
|
-
"*": {
|
|
1424
|
-
bg: ["900", "100"],
|
|
1425
|
-
fg: ["400", "600"],
|
|
1426
|
-
dot: ["500", "500"],
|
|
1427
|
-
icon: ["500", "500"]
|
|
1428
|
-
}
|
|
1429
|
-
},
|
|
1430
|
-
bg: ["500", "400"],
|
|
1431
|
-
border: ["500/0", "400/0"],
|
|
1432
|
-
code: {
|
|
1433
|
-
bg: ["500 20%", "400 20%"],
|
|
1434
|
-
fg: ["200", "600"]
|
|
1435
|
-
},
|
|
1436
|
-
fg: ["white", "black"],
|
|
1437
|
-
icon: ["100 70%", "900 70%"],
|
|
1438
|
-
kbd: {
|
|
1439
|
-
bg: ["black", "white"],
|
|
1440
|
-
fg: ["200", "600"],
|
|
1441
|
-
border: ["800", "200"]
|
|
1442
|
-
},
|
|
1443
|
-
link: {
|
|
1444
|
-
fg: ["blue/200", "blue/600"]
|
|
1445
|
-
},
|
|
1446
|
-
muted: {
|
|
1447
|
-
bg: ["950", "50"],
|
|
1448
|
-
fg: ["100 70%", "900 70%"]
|
|
1449
|
-
},
|
|
1450
|
-
skeleton: {
|
|
1451
|
-
from: ["900", "100"],
|
|
1452
|
-
to: ["900 50%", "100 50%"]
|
|
1453
|
-
}
|
|
1454
|
-
},
|
|
1455
|
-
hovered: {
|
|
1456
|
-
bg: ["700", "300"],
|
|
1457
|
-
border: ["700/0", "300/0"]
|
|
1458
|
-
},
|
|
1459
|
-
pressed: {
|
|
1460
|
-
bg: ["700", "300"]
|
|
1461
|
-
},
|
|
1462
|
-
selected: {
|
|
1463
|
-
bg: ["700", "300"]
|
|
1464
|
-
},
|
|
1465
|
-
disabled: {
|
|
1466
|
-
_hue: "gray",
|
|
1467
|
-
accent: {
|
|
1468
|
-
fg: ["100 70%", "900 70%"]
|
|
1469
|
-
},
|
|
1470
|
-
avatar: {
|
|
1471
|
-
"*": {
|
|
1472
|
-
_blend: ["screen", "multiply"],
|
|
1473
|
-
bg: ["gray/500", "gray/400"],
|
|
1474
|
-
fg: ["white", "black"]
|
|
1475
|
-
}
|
|
1476
|
-
},
|
|
1477
|
-
badge: {
|
|
1478
|
-
"*": {
|
|
1479
|
-
bg: ["gray/700", "gray/300"],
|
|
1480
|
-
fg: ["white", "black"],
|
|
1481
|
-
dot: ["white", "black"],
|
|
1482
|
-
icon: ["white", "black"]
|
|
1483
|
-
}
|
|
1484
|
-
},
|
|
1485
|
-
bg: ["300", "600"],
|
|
1486
|
-
code: {
|
|
1487
|
-
bg: ["950", "50"],
|
|
1488
|
-
fg: ["300", "600"]
|
|
1489
|
-
},
|
|
1490
|
-
fg: ["300", "600"],
|
|
1491
|
-
muted: {
|
|
1492
|
-
bg: ["950", "50"],
|
|
1493
|
-
fg: ["300", "600"]
|
|
1494
|
-
},
|
|
1495
|
-
kbd: {
|
|
1496
|
-
bg: ["black", "white"],
|
|
1497
|
-
fg: ["white", "black"],
|
|
1498
|
-
border: ["700", "300"]
|
|
1499
|
-
},
|
|
1500
|
-
link: {
|
|
1501
|
-
fg: ["100 70%", "900 70%"]
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
},
|
|
1505
|
-
default: {
|
|
1506
|
-
"*": {
|
|
1507
|
-
avatar: {
|
|
1508
|
-
"*": {
|
|
1509
|
-
_blend: ["screen", "multiply"],
|
|
1510
|
-
bg: ["500", "400"],
|
|
1511
|
-
fg: ["white", "black"]
|
|
1512
|
-
}
|
|
1513
|
-
},
|
|
1514
|
-
bg: ["800", "200"],
|
|
1515
|
-
muted: {
|
|
1516
|
-
bg: ["950", "50"],
|
|
1517
|
-
fg: ["400", "600"]
|
|
1518
|
-
}
|
|
1519
|
-
},
|
|
1520
|
-
hovered: {
|
|
1521
|
-
bg: ["900", "100"]
|
|
1522
|
-
},
|
|
1523
|
-
pressed: {
|
|
1524
|
-
bg: ["black", "white"]
|
|
1525
|
-
},
|
|
1526
|
-
selected: {
|
|
1527
|
-
bg: ["black", "white"]
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
},
|
|
1531
|
-
ghost: {
|
|
1532
|
-
"*": {
|
|
1533
|
-
"*": {
|
|
1534
|
-
_blend: ["multiply", "screen"],
|
|
1535
|
-
accent: {
|
|
1536
|
-
fg: ["purple/700 60%", "purple/300 70%"]
|
|
1537
|
-
},
|
|
1538
|
-
avatar: {
|
|
1539
|
-
"*": {
|
|
1540
|
-
_blend: ["screen", "multiply"],
|
|
1541
|
-
bg: ["500", "400"],
|
|
1542
|
-
fg: ["white", "black"]
|
|
1543
|
-
}
|
|
1544
|
-
},
|
|
1545
|
-
badge: {
|
|
1546
|
-
"*": {
|
|
1547
|
-
bg: ["100", "900"],
|
|
1548
|
-
fg: ["600", "400"],
|
|
1549
|
-
dot: ["500", "500"],
|
|
1550
|
-
icon: ["500", "500"]
|
|
1551
|
-
}
|
|
1552
|
-
},
|
|
1553
|
-
bg: ["50", "950"],
|
|
1554
|
-
border: ["100", "900"],
|
|
1555
|
-
code: {
|
|
1556
|
-
bg: ["500 10%", "400 10%"],
|
|
1557
|
-
fg: ["700 60%", "400 60%"]
|
|
1558
|
-
},
|
|
1559
|
-
fg: ["600", "400"],
|
|
1560
|
-
icon: ["700 60%", "300 60%"],
|
|
1561
|
-
kbd: {
|
|
1562
|
-
bg: ["white", "black"],
|
|
1563
|
-
fg: ["600", "400"],
|
|
1564
|
-
border: ["200", "800"]
|
|
1565
|
-
},
|
|
1566
|
-
link: {
|
|
1567
|
-
fg: ["blue/700 60%", "blue/300 60%"]
|
|
1568
|
-
},
|
|
1569
|
-
muted: {
|
|
1570
|
-
bg: ["100", "950"],
|
|
1571
|
-
fg: ["700 60%", "300 60%"]
|
|
1572
|
-
},
|
|
1573
|
-
skeleton: {
|
|
1574
|
-
from: ["100", "900"],
|
|
1575
|
-
to: ["100 50%", "900 50%"]
|
|
1576
|
-
}
|
|
1577
|
-
},
|
|
1578
|
-
hovered: {
|
|
1579
|
-
bg: ["100", "900"],
|
|
1580
|
-
fg: ["700", "300"]
|
|
1581
|
-
},
|
|
1582
|
-
pressed: {
|
|
1583
|
-
bg: ["100", "900"],
|
|
1584
|
-
fg: ["800", "200"]
|
|
1585
|
-
},
|
|
1586
|
-
selected: {
|
|
1587
|
-
bg: ["100", "900"],
|
|
1588
|
-
fg: ["800", "200"]
|
|
1589
|
-
},
|
|
1590
|
-
disabled: {
|
|
1591
|
-
_hue: "gray",
|
|
1592
|
-
accent: {
|
|
1593
|
-
fg: ["200", "800"]
|
|
1594
|
-
},
|
|
1595
|
-
avatar: {
|
|
1596
|
-
"*": {
|
|
1597
|
-
_blend: ["screen", "multiply"],
|
|
1598
|
-
bg: ["gray/100", "gray/900"],
|
|
1599
|
-
fg: ["white", "black"]
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
badge: {
|
|
1603
|
-
"*": {
|
|
1604
|
-
_hue: "gray",
|
|
1605
|
-
bg: ["50", "950"],
|
|
1606
|
-
fg: ["gray/200", "gray/800"],
|
|
1607
|
-
dot: ["gray/200", "gray/800"],
|
|
1608
|
-
icon: ["gray/200", "gray/800"]
|
|
1609
|
-
}
|
|
1610
|
-
},
|
|
1611
|
-
border: ["100", "900"],
|
|
1612
|
-
code: {
|
|
1613
|
-
bg: ["50", "950"],
|
|
1614
|
-
fg: ["200", "800"]
|
|
1615
|
-
},
|
|
1616
|
-
fg: ["400", "600"],
|
|
1617
|
-
icon: ["300", "700"],
|
|
1618
|
-
muted: {
|
|
1619
|
-
fg: ["300", "700"]
|
|
1620
|
-
},
|
|
1621
|
-
kbd: {
|
|
1622
|
-
bg: ["white", "black"],
|
|
1623
|
-
fg: ["200", "800"],
|
|
1624
|
-
border: ["100", "900"]
|
|
1625
|
-
},
|
|
1626
|
-
link: {
|
|
1627
|
-
fg: ["200", "800"]
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
},
|
|
1631
|
-
positive: {
|
|
1632
|
-
"*": {
|
|
1633
|
-
border: ["600 20%", "800"]
|
|
1634
|
-
}
|
|
1635
|
-
},
|
|
1636
|
-
caution: {
|
|
1637
|
-
"*": {
|
|
1638
|
-
border: ["600 20%", "800"]
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
},
|
|
1642
|
-
bleed: {
|
|
1643
|
-
"*": {
|
|
1644
|
-
"*": {
|
|
1645
|
-
_blend: ["multiply", "screen"],
|
|
1646
|
-
accent: {
|
|
1647
|
-
fg: ["purple/700 70%", "purple/300 70%"]
|
|
1648
|
-
},
|
|
1649
|
-
avatar: {
|
|
1650
|
-
"*": {
|
|
1651
|
-
_blend: ["screen", "multiply"],
|
|
1652
|
-
bg: ["500", "400"],
|
|
1653
|
-
fg: ["white", "black"]
|
|
1654
|
-
}
|
|
1655
|
-
},
|
|
1656
|
-
badge: {
|
|
1657
|
-
"*": {
|
|
1658
|
-
bg: ["100", "900"],
|
|
1659
|
-
fg: ["600", "400"],
|
|
1660
|
-
dot: ["500", "500"],
|
|
1661
|
-
icon: ["500", "500"]
|
|
1662
|
-
}
|
|
1663
|
-
},
|
|
1664
|
-
bg: ["white", "black"],
|
|
1665
|
-
border: ["white/0", "black/0"],
|
|
1666
|
-
code: {
|
|
1667
|
-
bg: ["50", "950"],
|
|
1668
|
-
fg: ["700 75%", "300 75%"]
|
|
1669
|
-
},
|
|
1670
|
-
fg: ["700", "300"],
|
|
1671
|
-
icon: ["700 75%", "300 75%"],
|
|
1672
|
-
kbd: {
|
|
1673
|
-
bg: ["white", "black"],
|
|
1674
|
-
fg: ["700", "300"],
|
|
1675
|
-
border: ["200", "800"]
|
|
1676
|
-
},
|
|
1677
|
-
link: {
|
|
1678
|
-
fg: ["blue/700 70%", "blue/300 70%"]
|
|
1679
|
-
},
|
|
1680
|
-
muted: {
|
|
1681
|
-
bg: ["100", "950"],
|
|
1682
|
-
fg: ["700 75%", "300 75%"]
|
|
1683
|
-
},
|
|
1684
|
-
skeleton: {
|
|
1685
|
-
from: ["100", "900"],
|
|
1686
|
-
to: ["100 50%", "900 50%"]
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
hovered: {
|
|
1690
|
-
bg: ["50", "950"],
|
|
1691
|
-
icon: ["700 70%", "400 70%"]
|
|
1692
|
-
},
|
|
1693
|
-
pressed: {
|
|
1694
|
-
bg: ["100", "900"],
|
|
1695
|
-
fg: ["800", "200"],
|
|
1696
|
-
icon: ["800 70%", "200 70%"]
|
|
1697
|
-
},
|
|
1698
|
-
selected: {
|
|
1699
|
-
bg: ["100", "900"],
|
|
1700
|
-
fg: ["800", "200"],
|
|
1701
|
-
icon: ["800 60%", "200 60%"]
|
|
1702
|
-
},
|
|
1703
|
-
disabled: {
|
|
1704
|
-
_hue: "gray",
|
|
1705
|
-
accent: {
|
|
1706
|
-
fg: ["200", "800"]
|
|
1707
|
-
},
|
|
1708
|
-
avatar: {
|
|
1709
|
-
"*": {
|
|
1710
|
-
_blend: ["screen", "multiply"],
|
|
1711
|
-
bg: ["gray/100", "gray/900"],
|
|
1712
|
-
fg: ["white", "black"]
|
|
1713
|
-
}
|
|
1714
|
-
},
|
|
1715
|
-
badge: {
|
|
1716
|
-
"*": {
|
|
1717
|
-
_hue: "gray",
|
|
1718
|
-
bg: ["50", "950"],
|
|
1719
|
-
fg: ["gray/200", "gray/800"],
|
|
1720
|
-
dot: ["gray/200", "gray/800"],
|
|
1721
|
-
icon: ["gray/200", "gray/800"]
|
|
1722
|
-
}
|
|
1723
|
-
},
|
|
1724
|
-
code: {
|
|
1725
|
-
bg: ["50", "950"],
|
|
1726
|
-
fg: ["200", "800"]
|
|
1727
|
-
},
|
|
1728
|
-
fg: ["400", "600"],
|
|
1729
|
-
icon: ["300", "700"],
|
|
1730
|
-
muted: {
|
|
1731
|
-
fg: ["400", "600"]
|
|
1732
|
-
},
|
|
1733
|
-
kbd: {
|
|
1734
|
-
bg: ["white", "black"],
|
|
1735
|
-
fg: ["200", "800"],
|
|
1736
|
-
border: ["100", "900"]
|
|
1737
|
-
},
|
|
1738
|
-
link: {
|
|
1739
|
-
fg: ["200", "800"]
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
},
|
|
1745
|
-
input: {
|
|
1746
|
-
"*": {
|
|
1747
|
-
"*": {
|
|
1748
|
-
_blend: ["multiply", "screen"],
|
|
1749
|
-
bg: ["white", "black"],
|
|
1750
|
-
border: ["200", "700"],
|
|
1751
|
-
fg: ["black", "200"],
|
|
1752
|
-
muted: {
|
|
1753
|
-
bg: ["50", "950"]
|
|
1754
|
-
},
|
|
1755
|
-
placeholder: ["400", "600"]
|
|
1756
|
-
},
|
|
1757
|
-
hovered: {
|
|
1758
|
-
border: ["300", "700"]
|
|
1759
|
-
},
|
|
1760
|
-
readOnly: {
|
|
1761
|
-
bg: ["50", "950"],
|
|
1762
|
-
border: ["200", "800"],
|
|
1763
|
-
fg: ["800", "200"]
|
|
1764
|
-
},
|
|
1765
|
-
disabled: {
|
|
1766
|
-
bg: ["50", "950"],
|
|
1767
|
-
fg: ["400", "600"],
|
|
1768
|
-
border: ["100", "900"],
|
|
1769
|
-
placeholder: ["200", "800 50%"]
|
|
1770
|
-
}
|
|
1771
|
-
},
|
|
1772
|
-
invalid: {
|
|
1773
|
-
"*": {
|
|
1774
|
-
_hue: "red",
|
|
1775
|
-
bg: ["100", "950"]
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
},
|
|
1779
|
-
selectable: {
|
|
1780
|
-
"*": {
|
|
1781
|
-
"*": {
|
|
1782
|
-
_blend: ["multiply", "screen"],
|
|
1783
|
-
accent: {
|
|
1784
|
-
fg: ["purple/700 70%", "purple/300 70%"]
|
|
1785
|
-
},
|
|
1786
|
-
avatar: {
|
|
1787
|
-
"*": {
|
|
1788
|
-
_blend: ["screen", "multiply"],
|
|
1789
|
-
bg: ["500", "400"],
|
|
1790
|
-
fg: ["white", "black"]
|
|
1791
|
-
}
|
|
1792
|
-
},
|
|
1793
|
-
badge: {
|
|
1794
|
-
"*": {
|
|
1795
|
-
bg: ["100", "900"],
|
|
1796
|
-
fg: ["600", "400"],
|
|
1797
|
-
dot: ["500", "500"],
|
|
1798
|
-
icon: ["500", "500"]
|
|
1799
|
-
}
|
|
1800
|
-
},
|
|
1801
|
-
bg: ["white", "black"],
|
|
1802
|
-
border: ["200", "800"],
|
|
1803
|
-
code: {
|
|
1804
|
-
bg: ["50", "950"],
|
|
1805
|
-
fg: ["600", "400"]
|
|
1806
|
-
},
|
|
1807
|
-
fg: ["700", "300"],
|
|
1808
|
-
icon: ["700 75%", "300 75%"],
|
|
1809
|
-
kbd: {
|
|
1810
|
-
bg: ["white", "black"],
|
|
1811
|
-
fg: ["600", "400"],
|
|
1812
|
-
border: ["200", "800"]
|
|
1813
|
-
},
|
|
1814
|
-
link: {
|
|
1815
|
-
fg: ["blue/700 70%", "blue/300 70%"]
|
|
1816
|
-
},
|
|
1817
|
-
muted: {
|
|
1818
|
-
bg: ["50", "950"],
|
|
1819
|
-
fg: ["700 75%", "300 75%"]
|
|
1820
|
-
},
|
|
1821
|
-
skeleton: {
|
|
1822
|
-
from: ["100", "900"],
|
|
1823
|
-
to: ["100 50%", "900 50%"]
|
|
1824
|
-
}
|
|
1825
|
-
},
|
|
1826
|
-
hovered: {
|
|
1827
|
-
bg: ["50", "950"]
|
|
1828
|
-
},
|
|
1829
|
-
pressed: {
|
|
1830
|
-
bg: ["100", "900"]
|
|
1831
|
-
},
|
|
1832
|
-
selected: {
|
|
1833
|
-
_blend: ["screen", "multiply"],
|
|
1834
|
-
accent: {
|
|
1835
|
-
fg: ["purple/300", "purple/700"]
|
|
1836
|
-
},
|
|
1837
|
-
avatar: {
|
|
1838
|
-
"*": {
|
|
1839
|
-
_blend: ["multiply", "screen"],
|
|
1840
|
-
bg: ["white", "black"],
|
|
1841
|
-
fg: ["black", "white"]
|
|
1842
|
-
}
|
|
1843
|
-
},
|
|
1844
|
-
badge: {
|
|
1845
|
-
"*": {
|
|
1846
|
-
bg: ["900", "100"],
|
|
1847
|
-
fg: ["400", "600"],
|
|
1848
|
-
dot: ["500", "500"],
|
|
1849
|
-
icon: ["500", "500"]
|
|
1850
|
-
}
|
|
1851
|
-
},
|
|
1852
|
-
bg: ["500", "400"],
|
|
1853
|
-
border: ["500 20%", "400 20%"],
|
|
1854
|
-
code: {
|
|
1855
|
-
bg: ["500 20%", "400 20%"],
|
|
1856
|
-
fg: ["200", "600"]
|
|
1857
|
-
},
|
|
1858
|
-
fg: ["white", "black"],
|
|
1859
|
-
icon: ["100 70%", "900 70%"],
|
|
1860
|
-
kbd: {
|
|
1861
|
-
bg: ["black", "white"],
|
|
1862
|
-
fg: ["200", "600"],
|
|
1863
|
-
border: ["800", "200"]
|
|
1864
|
-
},
|
|
1865
|
-
link: {
|
|
1866
|
-
fg: ["blue/200", "blue/600"]
|
|
1867
|
-
},
|
|
1868
|
-
muted: {
|
|
1869
|
-
bg: ["500 10%", "400 10%"],
|
|
1870
|
-
fg: ["100 70%", "900 70%"]
|
|
1871
|
-
},
|
|
1872
|
-
skeleton: {
|
|
1873
|
-
from: ["900", "100"],
|
|
1874
|
-
to: ["900 50%", "100 50%"]
|
|
1875
|
-
}
|
|
1876
|
-
},
|
|
1877
|
-
disabled: {
|
|
1878
|
-
_hue: "gray",
|
|
1879
|
-
accent: {
|
|
1880
|
-
fg: ["200", "800"]
|
|
1881
|
-
},
|
|
1882
|
-
avatar: {
|
|
1883
|
-
"*": {
|
|
1884
|
-
_blend: ["screen", "multiply"],
|
|
1885
|
-
bg: ["gray/100", "gray/900"],
|
|
1886
|
-
fg: ["white", "black"]
|
|
1887
|
-
}
|
|
1888
|
-
},
|
|
1889
|
-
badge: {
|
|
1890
|
-
"*": {
|
|
1891
|
-
_hue: "gray",
|
|
1892
|
-
bg: ["50", "950"],
|
|
1893
|
-
fg: ["gray/200", "gray/800"],
|
|
1894
|
-
dot: ["gray/200", "gray/800"],
|
|
1895
|
-
icon: ["gray/200", "gray/800"]
|
|
1896
|
-
}
|
|
1897
|
-
},
|
|
1898
|
-
border: ["100", "900"],
|
|
1899
|
-
code: {
|
|
1900
|
-
bg: ["50", "950"],
|
|
1901
|
-
fg: ["200", "800"]
|
|
1902
|
-
},
|
|
1903
|
-
fg: ["200", "800"],
|
|
1904
|
-
icon: ["200", "800"],
|
|
1905
|
-
kbd: {
|
|
1906
|
-
bg: ["white", "black"],
|
|
1907
|
-
fg: ["200", "800"],
|
|
1908
|
-
border: ["100", "900"]
|
|
1909
|
-
},
|
|
1910
|
-
link: {
|
|
1911
|
-
fg: ["200", "800"]
|
|
1912
|
-
},
|
|
1913
|
-
muted: {
|
|
1914
|
-
bg: ["50 50%", "950 50%"],
|
|
1915
|
-
fg: ["200", "800"]
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
},
|
|
1919
|
-
default: {
|
|
1920
|
-
selected: {
|
|
1921
|
-
_hue: "blue"
|
|
1922
|
-
}
|
|
1923
|
-
},
|
|
1924
|
-
critical: {
|
|
1925
|
-
disabled: {
|
|
1926
|
-
bg: ["50 50%", "950 50%"]
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
},
|
|
1930
|
-
syntax: {
|
|
1931
|
-
atrule: ["purple/600", "purple/400"],
|
|
1932
|
-
attrName: ["green/600", "green/400"],
|
|
1933
|
-
attrValue: ["yellow/600", "yellow/400"],
|
|
1934
|
-
attribute: ["yellow/600", "yellow/400"],
|
|
1935
|
-
boolean: ["purple/600", "purple/400"],
|
|
1936
|
-
builtin: ["purple/600", "purple/400"],
|
|
1937
|
-
cdata: ["yellow/600", "yellow/400"],
|
|
1938
|
-
char: ["yellow/600", "yellow/400"],
|
|
1939
|
-
class: ["orange/600", "orange/400"],
|
|
1940
|
-
className: ["cyan/600", "cyan/400"],
|
|
1941
|
-
comment: ["gray/400", "gray/600"],
|
|
1942
|
-
constant: ["purple/600", "purple/400"],
|
|
1943
|
-
deleted: ["red/600", "red/400"],
|
|
1944
|
-
entity: ["red/600", "red/400"],
|
|
1945
|
-
function: ["green/600", "green/400"],
|
|
1946
|
-
hexcode: ["blue/600", "blue/400"],
|
|
1947
|
-
id: ["purple/600", "purple/400"],
|
|
1948
|
-
important: ["purple/600", "purple/400"],
|
|
1949
|
-
inserted: ["yellow/600", "yellow/400"],
|
|
1950
|
-
keyword: ["magenta/600", "magenta/400"],
|
|
1951
|
-
number: ["purple/600", "purple/400"],
|
|
1952
|
-
operator: ["magenta/600", "magenta/400"],
|
|
1953
|
-
property: ["blue/600", "blue/400"],
|
|
1954
|
-
pseudoClass: ["yellow/600", "yellow/400"],
|
|
1955
|
-
pseudoElement: ["yellow/600", "yellow/400"],
|
|
1956
|
-
punctuation: ["gray/600", "gray/400"],
|
|
1957
|
-
regex: ["blue/600", "blue/400"],
|
|
1958
|
-
selector: ["red/600", "red/400"],
|
|
1959
|
-
string: ["yellow/600", "yellow/400"],
|
|
1960
|
-
symbol: ["purple/600", "purple/400"],
|
|
1961
|
-
tag: ["red/600", "red/400"],
|
|
1962
|
-
unit: ["orange/600", "orange/400"],
|
|
1963
|
-
url: ["red/600", "red/400"],
|
|
1964
|
-
variable: ["red/600", "red/400"]
|
|
1965
|
-
}
|
|
1966
|
-
};
|
|
1967
|
-
function isRecord(value) {
|
|
1968
|
-
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
1969
|
-
}
|
|
1970
|
-
function merge(...records) {
|
|
1971
|
-
const _records = records.filter(Boolean);
|
|
1972
|
-
return _records.length === 0 ? {} : _records.reduce(_merge, {});
|
|
1973
|
-
}
|
|
1974
|
-
function _merge(acc, source) {
|
|
1975
|
-
for (const key of Object.keys(source)) {
|
|
1976
|
-
const prevValue = acc[key], nextValue = source[key];
|
|
1977
|
-
isRecord(prevValue) && isRecord(nextValue) ? acc[key] = merge(prevValue, nextValue) : acc[key] = nextValue;
|
|
1978
|
-
}
|
|
1979
|
-
return acc;
|
|
1980
|
-
}
|
|
1981
|
-
function resolveColorTokens(inputTokens) {
|
|
1982
|
-
const tokens = merge(defaultColorTokens, inputTokens);
|
|
1983
|
-
return {
|
|
1984
|
-
base: resolveBaseColorTokens(tokens),
|
|
1985
|
-
button: resolveButtonColorTokens(tokens),
|
|
1986
|
-
input: resolveInputColorTokens(tokens),
|
|
1987
|
-
selectable: resolveSelectableColorTokens(tokens),
|
|
1988
|
-
syntax: tokens.syntax
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
function resolveBaseColorTokens(sparseTokens) {
|
|
1992
|
-
const tokens = {};
|
|
1993
|
-
for (const tone of THEME_COLOR_CARD_TONES)
|
|
1994
|
-
tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
1995
|
-
return tokens;
|
|
1996
|
-
}
|
|
1997
|
-
function resolveBaseColorTones(inputTokens, tone) {
|
|
1998
|
-
const spec = merge(inputTokens?.base?.["*"], inputTokens?.base?.[tone]), hue = spec._hue || inputTokens?.base?.[tone]?._hue || "gray";
|
|
1999
|
-
return {
|
|
2000
|
-
...spec,
|
|
2001
|
-
_hue: hue,
|
|
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,
|
|
2036
|
-
...spec.badge?.["*"],
|
|
2037
|
-
...spec.badge?.critical
|
|
2038
|
-
}
|
|
2039
|
-
}
|
|
2040
|
-
};
|
|
2041
|
-
}
|
|
2042
|
-
function resolveButtonColorTokens(inputTokens) {
|
|
2043
|
-
const tokens = {};
|
|
2044
|
-
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2045
|
-
tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
|
|
2046
|
-
return tokens;
|
|
2047
|
-
}
|
|
2048
|
-
function resolveButtonToneColorTokens(inputTokens, mode) {
|
|
2049
|
-
const tokens = {};
|
|
2050
|
-
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2051
|
-
tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
|
|
2052
|
-
return tokens;
|
|
2053
|
-
}
|
|
2054
|
-
function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
2055
|
-
const tokens = {};
|
|
2056
|
-
for (const state of THEME_COLOR_STATES)
|
|
2057
|
-
tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
|
|
2058
|
-
return tokens;
|
|
2059
|
-
}
|
|
2060
|
-
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2061
|
-
const spec = merge(
|
|
2062
|
-
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2063
|
-
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2064
|
-
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2065
|
-
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2066
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2067
|
-
return {
|
|
2068
|
-
...spec,
|
|
2069
|
-
_hue: hue,
|
|
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,
|
|
2094
|
-
...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
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
};
|
|
2109
|
-
}
|
|
2110
|
-
function resolveInputColorTokens(inputTokens) {
|
|
2111
|
-
const tokens = {};
|
|
2112
|
-
for (const mode of THEME_COLOR_INPUT_MODES)
|
|
2113
|
-
tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
|
|
2114
|
-
return tokens;
|
|
2115
|
-
}
|
|
2116
|
-
function resolveInputModeColorTokens(inputTokens, mode) {
|
|
2117
|
-
const states = {};
|
|
2118
|
-
for (const state of THEME_COLOR_INPUT_STATES)
|
|
2119
|
-
states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
|
|
2120
|
-
return states;
|
|
2121
|
-
}
|
|
2122
|
-
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2123
|
-
const spec = merge(
|
|
2124
|
-
inputTokens?.input?.["*"]?.["*"],
|
|
2125
|
-
inputTokens?.input?.[mode]?.["*"],
|
|
2126
|
-
inputTokens?.input?.["*"]?.[state],
|
|
2127
|
-
inputTokens?.input?.[mode]?.[state]
|
|
2128
|
-
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2129
|
-
return { ...spec, _hue: hue };
|
|
2130
|
-
}
|
|
2131
|
-
function resolveSelectableColorTokens(inputTokens) {
|
|
2132
|
-
const tokens = {};
|
|
2133
|
-
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2134
|
-
tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
|
|
2135
|
-
return tokens;
|
|
2136
|
-
}
|
|
2137
|
-
function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
2138
|
-
const states = {
|
|
2139
|
-
_hue: inputTokens?.selectable?.[tone]?._hue || inputTokens?.base?.[tone]?._hue
|
|
2140
|
-
};
|
|
2141
|
-
for (const state of THEME_COLOR_STATES)
|
|
2142
|
-
states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
|
|
2143
|
-
return states;
|
|
2144
|
-
}
|
|
2145
|
-
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2146
|
-
const spec = merge(
|
|
2147
|
-
inputTokens?.selectable?.["*"]?.["*"],
|
|
2148
|
-
inputTokens?.selectable?.[tone]?.["*"],
|
|
2149
|
-
inputTokens?.selectable?.["*"]?.[state],
|
|
2150
|
-
inputTokens?.selectable?.[tone]?.[state]
|
|
2151
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2152
|
-
return {
|
|
2153
|
-
...spec,
|
|
2154
|
-
_hue: hue,
|
|
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,
|
|
2189
|
-
...spec.badge?.["*"],
|
|
2190
|
-
...spec.badge?.critical
|
|
2191
|
-
}
|
|
2192
|
-
}
|
|
2193
|
-
};
|
|
2194
|
-
}
|
|
2195
|
-
function buildColorTheme(config) {
|
|
2196
|
-
const resolvedConfig = {
|
|
2197
|
-
...config,
|
|
2198
|
-
color: resolveColorTokens(config?.color)
|
|
2199
|
-
};
|
|
2200
|
-
return {
|
|
2201
|
-
light: buildColorScheme({ scheme: "light" }, resolvedConfig),
|
|
2202
|
-
dark: buildColorScheme({ scheme: "dark" }, resolvedConfig)
|
|
2203
|
-
};
|
|
2204
|
-
}
|
|
2205
|
-
function buildColorScheme(options, config) {
|
|
2206
|
-
const { scheme } = options;
|
|
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
|
-
};
|
|
2215
|
-
}
|
|
2216
|
-
function buildCardColorTheme(options, config) {
|
|
2217
|
-
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2218
|
-
return {
|
|
2219
|
-
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2220
|
-
_dark: scheme === "dark",
|
|
2221
|
-
accent: {
|
|
2222
|
-
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2223
|
-
},
|
|
2224
|
-
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2225
|
-
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2226
|
-
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2227
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2228
|
-
border: resolveColorTokenValue(context, tokens?.border),
|
|
2229
|
-
button: buildButtonColorTheme({ scheme }, config),
|
|
2230
|
-
code: {
|
|
2231
|
-
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2232
|
-
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2233
|
-
},
|
|
2234
|
-
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2235
|
-
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2236
|
-
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2237
|
-
input: buildInputColorTheme({ scheme, tone }, config),
|
|
2238
|
-
kbd: {
|
|
2239
|
-
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2240
|
-
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2241
|
-
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2242
|
-
},
|
|
2243
|
-
link: {
|
|
2244
|
-
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2245
|
-
},
|
|
2246
|
-
muted: {
|
|
2247
|
-
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2248
|
-
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2249
|
-
},
|
|
2250
|
-
selectable: buildSelectableColorTheme({ scheme }, config),
|
|
2251
|
-
shadow: buildShadowColorTheme({ scheme, tone }, config),
|
|
2252
|
-
skeleton: {
|
|
2253
|
-
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2254
|
-
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2255
|
-
},
|
|
2256
|
-
syntax: buildSyntaxColorTheme({ scheme }, config)
|
|
2257
|
-
};
|
|
2258
|
-
}
|
|
2259
|
-
function buildShadowColorTheme(options, config) {
|
|
2260
|
-
const { scheme, tone } = options, tokens = config?.color?.base?.[tone], context = { hue: tokens?._hue || "gray", scheme };
|
|
2261
|
-
return {
|
|
2262
|
-
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2263
|
-
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
2264
|
-
penumbra: resolveColorTokenValue(context, tokens?.shadow?.penumbra),
|
|
2265
|
-
ambient: resolveColorTokenValue(context, tokens?.shadow?.ambient)
|
|
2266
|
-
};
|
|
2267
|
-
}
|
|
2268
|
-
function buildAvatarColorTheme(options, stateTokens) {
|
|
2269
|
-
const { scheme } = options;
|
|
2270
|
-
return {
|
|
2271
|
-
gray: _buildAvatarColorTheme({ color: "gray", scheme }, stateTokens),
|
|
2272
|
-
blue: _buildAvatarColorTheme({ color: "blue", scheme }, stateTokens),
|
|
2273
|
-
purple: _buildAvatarColorTheme({ color: "purple", scheme }, stateTokens),
|
|
2274
|
-
magenta: _buildAvatarColorTheme({ color: "magenta", scheme }, stateTokens),
|
|
2275
|
-
red: _buildAvatarColorTheme({ color: "red", scheme }, stateTokens),
|
|
2276
|
-
orange: _buildAvatarColorTheme({ color: "orange", scheme }, stateTokens),
|
|
2277
|
-
yellow: _buildAvatarColorTheme({ color: "yellow", scheme }, stateTokens),
|
|
2278
|
-
green: _buildAvatarColorTheme({ color: "green", scheme }, stateTokens),
|
|
2279
|
-
cyan: _buildAvatarColorTheme({ color: "cyan", scheme }, stateTokens)
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
|
-
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2283
|
-
const { color: color2, scheme } = options, tokens = stateTokens?.avatar?.[color2], context = { hue: tokens?._hue || "gray", scheme };
|
|
2284
|
-
return {
|
|
2285
|
-
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2286
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2287
|
-
fg: resolveColorTokenValue(context, tokens?.fg)
|
|
2288
|
-
};
|
|
2289
|
-
}
|
|
2290
|
-
function buildBadgeColorTheme(tokens, options, config) {
|
|
2291
|
-
const { scheme } = options;
|
|
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
|
-
};
|
|
2299
|
-
}
|
|
2300
|
-
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2301
|
-
const { scheme, tone } = options, tokens = parentTokens?.[tone], context = { hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", scheme };
|
|
2302
|
-
return {
|
|
2303
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2304
|
-
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2305
|
-
dot: resolveColorTokenValue(context, tokens?.dot),
|
|
2306
|
-
icon: resolveColorTokenValue(context, tokens?.icon)
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
function buildButtonColorTheme(options, config) {
|
|
2310
|
-
const { scheme } = options, modes = {};
|
|
2311
|
-
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2312
|
-
modes[mode] = buildButtonTonesColorTheme({ scheme, mode }, config);
|
|
2313
|
-
return modes;
|
|
2314
|
-
}
|
|
2315
|
-
function buildButtonTonesColorTheme(options, config) {
|
|
2316
|
-
const { mode, scheme } = options, tones2 = {};
|
|
2317
|
-
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2318
|
-
tones2[tone] = buildButtonStatesColorTheme({ mode, scheme, tone }, config);
|
|
2319
|
-
return tones2;
|
|
2320
|
-
}
|
|
2321
|
-
function buildButtonStatesColorTheme(options, config) {
|
|
2322
|
-
const { mode, scheme, tone } = options, states = {};
|
|
2323
|
-
for (const state of THEME_COLOR_STATES)
|
|
2324
|
-
states[state] = buildButtonStateColorTheme({ mode, tone, scheme, state }, config);
|
|
2325
|
-
return states;
|
|
2326
|
-
}
|
|
2327
|
-
function buildButtonStateColorTheme(options, config) {
|
|
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 };
|
|
2329
|
-
return {
|
|
2330
|
-
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2331
|
-
accent: {
|
|
2332
|
-
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2333
|
-
},
|
|
2334
|
-
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2335
|
-
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2336
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2337
|
-
border: resolveColorTokenValue(context, tokens?.border),
|
|
2338
|
-
code: {
|
|
2339
|
-
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2340
|
-
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2341
|
-
},
|
|
2342
|
-
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2343
|
-
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2344
|
-
muted: {
|
|
2345
|
-
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2346
|
-
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2347
|
-
},
|
|
2348
|
-
kbd: {
|
|
2349
|
-
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2350
|
-
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2351
|
-
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2352
|
-
},
|
|
2353
|
-
link: {
|
|
2354
|
-
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2355
|
-
},
|
|
2356
|
-
skeleton: {
|
|
2357
|
-
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2358
|
-
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2359
|
-
}
|
|
2360
|
-
};
|
|
2361
|
-
}
|
|
2362
|
-
function buildInputColorTheme(options, config) {
|
|
2363
|
-
const { scheme, tone } = options;
|
|
2364
|
-
return {
|
|
2365
|
-
default: buildInputStatesColorTheme({ mode: "default", scheme, tone }, config),
|
|
2366
|
-
invalid: buildInputStatesColorTheme({ mode: "invalid", scheme, tone }, config)
|
|
2367
|
-
};
|
|
2368
|
-
}
|
|
2369
|
-
function buildInputStatesColorTheme(options, config) {
|
|
2370
|
-
const { mode, scheme, tone } = options;
|
|
2371
|
-
return {
|
|
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)
|
|
2376
|
-
};
|
|
2377
|
-
}
|
|
2378
|
-
function buildInputStateColorTheme(options, config) {
|
|
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 };
|
|
2380
|
-
return {
|
|
2381
|
-
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2382
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2383
|
-
border: resolveColorTokenValue(context, tokens?.border),
|
|
2384
|
-
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2385
|
-
muted: {
|
|
2386
|
-
bg: resolveColorTokenValue(context, tokens?.muted?.bg)
|
|
2387
|
-
},
|
|
2388
|
-
placeholder: resolveColorTokenValue(context, tokens?.placeholder)
|
|
2389
|
-
};
|
|
2390
|
-
}
|
|
2391
|
-
function buildSelectableColorTheme(options, config) {
|
|
2392
|
-
const { scheme } = options, tones2 = {};
|
|
2393
|
-
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2394
|
-
tones2[tone] = buildSelectableStatesColorTheme({ scheme, tone }, config);
|
|
2395
|
-
return tones2;
|
|
2396
|
-
}
|
|
2397
|
-
function buildSelectableStatesColorTheme(options, config) {
|
|
2398
|
-
const { scheme, tone } = options, states = {};
|
|
2399
|
-
for (const state of THEME_COLOR_STATES)
|
|
2400
|
-
states[state] = buildSelectableStateColorTheme({ tone, scheme, state }, config);
|
|
2401
|
-
return states;
|
|
2402
|
-
}
|
|
2403
|
-
function buildSelectableStateColorTheme(options, config) {
|
|
2404
|
-
const { scheme, state, tone } = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = { hue, scheme };
|
|
2405
|
-
return {
|
|
2406
|
-
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2407
|
-
accent: {
|
|
2408
|
-
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2409
|
-
},
|
|
2410
|
-
avatar: buildAvatarColorTheme({ scheme }, tokens),
|
|
2411
|
-
badge: buildBadgeColorTheme(tokens?.badge, { scheme }, config),
|
|
2412
|
-
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2413
|
-
border: resolveColorTokenValue(context, tokens?.border),
|
|
2414
|
-
code: {
|
|
2415
|
-
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2416
|
-
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
2417
|
-
},
|
|
2418
|
-
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2419
|
-
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2420
|
-
muted: {
|
|
2421
|
-
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2422
|
-
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2423
|
-
},
|
|
2424
|
-
kbd: {
|
|
2425
|
-
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2426
|
-
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
2427
|
-
border: resolveColorTokenValue(context, tokens?.kbd?.border)
|
|
2428
|
-
},
|
|
2429
|
-
link: {
|
|
2430
|
-
fg: resolveColorTokenValue(context, tokens?.link?.fg)
|
|
2431
|
-
},
|
|
2432
|
-
skeleton: {
|
|
2433
|
-
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2434
|
-
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2435
|
-
}
|
|
2436
|
-
};
|
|
2437
|
-
}
|
|
2438
|
-
function buildSyntaxColorTheme(options, config) {
|
|
2439
|
-
const { scheme } = options, tokens = config?.color?.syntax, context = { hue: "gray", scheme };
|
|
2440
|
-
return {
|
|
2441
|
-
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
2442
|
-
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
2443
|
-
attrValue: resolveColorTokenValue(context, tokens?.attrValue),
|
|
2444
|
-
attribute: resolveColorTokenValue(context, tokens?.attribute),
|
|
2445
|
-
boolean: resolveColorTokenValue(context, tokens?.boolean),
|
|
2446
|
-
builtin: resolveColorTokenValue(context, tokens?.builtin),
|
|
2447
|
-
cdata: resolveColorTokenValue(context, tokens?.cdata),
|
|
2448
|
-
char: resolveColorTokenValue(context, tokens?.char),
|
|
2449
|
-
class: resolveColorTokenValue(context, tokens?.class),
|
|
2450
|
-
className: resolveColorTokenValue(context, tokens?.className),
|
|
2451
|
-
comment: resolveColorTokenValue(context, tokens?.comment),
|
|
2452
|
-
constant: resolveColorTokenValue(context, tokens?.constant),
|
|
2453
|
-
deleted: resolveColorTokenValue(context, tokens?.deleted),
|
|
2454
|
-
doctype: resolveColorTokenValue(context, tokens?.doctype),
|
|
2455
|
-
entity: resolveColorTokenValue(context, tokens?.entity),
|
|
2456
|
-
function: resolveColorTokenValue(context, tokens?.function),
|
|
2457
|
-
hexcode: resolveColorTokenValue(context, tokens?.hexcode),
|
|
2458
|
-
id: resolveColorTokenValue(context, tokens?.id),
|
|
2459
|
-
important: resolveColorTokenValue(context, tokens?.important),
|
|
2460
|
-
inserted: resolveColorTokenValue(context, tokens?.inserted),
|
|
2461
|
-
keyword: resolveColorTokenValue(context, tokens?.keyword),
|
|
2462
|
-
number: resolveColorTokenValue(context, tokens?.number),
|
|
2463
|
-
operator: resolveColorTokenValue(context, tokens?.operator),
|
|
2464
|
-
prolog: resolveColorTokenValue(context, tokens?.prolog),
|
|
2465
|
-
property: resolveColorTokenValue(context, tokens?.property),
|
|
2466
|
-
pseudoClass: resolveColorTokenValue(context, tokens?.pseudoClass),
|
|
2467
|
-
pseudoElement: resolveColorTokenValue(context, tokens?.pseudoElement),
|
|
2468
|
-
punctuation: resolveColorTokenValue(context, tokens?.punctuation),
|
|
2469
|
-
regex: resolveColorTokenValue(context, tokens?.regex),
|
|
2470
|
-
selector: resolveColorTokenValue(context, tokens?.selector),
|
|
2471
|
-
string: resolveColorTokenValue(context, tokens?.string),
|
|
2472
|
-
symbol: resolveColorTokenValue(context, tokens?.symbol),
|
|
2473
|
-
tag: resolveColorTokenValue(context, tokens?.tag),
|
|
2474
|
-
unit: resolveColorTokenValue(context, tokens?.unit),
|
|
2475
|
-
url: resolveColorTokenValue(context, tokens?.url),
|
|
2476
|
-
variable: resolveColorTokenValue(context, tokens?.variable)
|
|
2477
|
-
};
|
|
2478
|
-
}
|
|
2479
|
-
const defaultColorPalette = color.color;
|
|
2480
|
-
function mixChannel(b, s, weight) {
|
|
2481
|
-
const delta = (s - b) * weight;
|
|
2482
|
-
return b + delta;
|
|
2483
|
-
}
|
|
2484
|
-
function mix(b, s, weight) {
|
|
2485
|
-
return {
|
|
2486
|
-
r: mixChannel(b.r, s.r, weight),
|
|
2487
|
-
g: mixChannel(b.g, s.g, weight),
|
|
2488
|
-
b: mixChannel(b.b, s.b, weight)
|
|
2489
|
-
};
|
|
2490
|
-
}
|
|
2491
|
-
function multiplyChannel(b, s) {
|
|
2492
|
-
return b * s;
|
|
2493
|
-
}
|
|
2494
|
-
function multiply(b, s) {
|
|
2495
|
-
return {
|
|
2496
|
-
r: multiplyChannel(b.r / 255, s.r / 255) * 255,
|
|
2497
|
-
g: multiplyChannel(b.g / 255, s.g / 255) * 255,
|
|
2498
|
-
b: multiplyChannel(b.b / 255, s.b / 255) * 255
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
function screenChannel(b, s) {
|
|
2502
|
-
return b + s - b * s;
|
|
2503
|
-
}
|
|
2504
|
-
function screen(b, s) {
|
|
2505
|
-
return {
|
|
2506
|
-
r: screenChannel(b.r / 255, s.r / 255) * 255,
|
|
2507
|
-
g: screenChannel(b.g / 255, s.g / 255) * 255,
|
|
2508
|
-
b: screenChannel(b.b / 255, s.b / 255) * 255
|
|
2509
|
-
};
|
|
2510
|
-
}
|
|
2511
|
-
function lerp(x, y, a) {
|
|
2512
|
-
return x * (1 - a) + y * a;
|
|
2513
|
-
}
|
|
2514
|
-
function invlerp(x, y, a) {
|
|
2515
|
-
return clamp((a - x) / (y - x));
|
|
2516
|
-
}
|
|
2517
|
-
function clamp(a, min = 0, max = 1) {
|
|
2518
|
-
return Math.min(max, Math.max(min, a));
|
|
2519
|
-
}
|
|
2520
|
-
function range(x1, y1, x2, y2, a) {
|
|
2521
|
-
return lerp(x2, y2, invlerp(x1, y1, a));
|
|
2522
|
-
}
|
|
2523
|
-
function round(value) {
|
|
2524
|
-
return Math.round(value);
|
|
2525
|
-
}
|
|
2526
|
-
function hexToRgb(hex) {
|
|
2527
|
-
if (hex.length === 4) {
|
|
2528
|
-
const hexR = hex.slice(1, 2), hexG = hex.slice(2, 3), hexB = hex.slice(3, 4);
|
|
2529
|
-
return {
|
|
2530
|
-
r: parseInt(hexR + hexR, 16),
|
|
2531
|
-
g: parseInt(hexG + hexG, 16),
|
|
2532
|
-
b: parseInt(hexB + hexB, 16)
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
return {
|
|
2536
|
-
r: parseInt(hex.slice(1, 3), 16),
|
|
2537
|
-
g: parseInt(hex.slice(3, 5), 16),
|
|
2538
|
-
b: parseInt(hex.slice(5, 7), 16)
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
function rgbaToRGBA(rgba2) {
|
|
2542
|
-
const values = rgba2.replace(/rgba\(|\)/g, "").split(",");
|
|
2543
|
-
return {
|
|
2544
|
-
r: parseInt(values[0]),
|
|
2545
|
-
g: parseInt(values[1]),
|
|
2546
|
-
b: parseInt(values[2]),
|
|
2547
|
-
a: parseFloat(values[3])
|
|
2548
|
-
};
|
|
2549
|
-
}
|
|
2550
|
-
function rgbToHex(color2) {
|
|
2551
|
-
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
2552
|
-
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2553
|
-
}
|
|
2554
|
-
function rgbToHsl({ r, g, b }) {
|
|
2555
|
-
r /= 255, g /= 255, b /= 255;
|
|
2556
|
-
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2557
|
-
let h = 0, s = 0, l = 0;
|
|
2558
|
-
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), { h, s, l };
|
|
2559
|
-
}
|
|
2560
|
-
function hslToRgb(hsl) {
|
|
2561
|
-
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
2562
|
-
let r = 0, g = 0, b = 0;
|
|
2563
|
-
return 0 <= hsl.h && hsl.h < 60 ? (r = c, g = x, b = 0) : 60 <= hsl.h && hsl.h < 120 ? (r = x, g = c, b = 0) : 120 <= hsl.h && hsl.h < 180 ? (r = 0, g = c, b = x) : 180 <= hsl.h && hsl.h < 240 ? (r = 0, g = x, b = c) : 240 <= hsl.h && hsl.h < 300 ? (r = x, g = 0, b = c) : 300 <= hsl.h && hsl.h < 360 && (r = c, g = 0, b = x), {
|
|
2564
|
-
r: Math.round((r + m) * 255),
|
|
2565
|
-
g: Math.round((g + m) * 255),
|
|
2566
|
-
b: Math.round((b + m) * 255)
|
|
2567
|
-
};
|
|
2568
|
-
}
|
|
2569
|
-
const HEX_CHARS = "0123456789ABCDEFabcdef", HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
|
|
2570
|
-
function isHexChars(str) {
|
|
2571
|
-
for (const c of str)
|
|
2572
|
-
if (HEX_CHARS.indexOf(c) === -1)
|
|
2573
|
-
return !1;
|
|
2574
|
-
return !0;
|
|
2575
|
-
}
|
|
2576
|
-
function isHex(str) {
|
|
2577
|
-
return str[0] !== "#" || !(str.length === 4 || str.length === 7) ? !1 : isHexChars(str.slice(1));
|
|
2578
|
-
}
|
|
2579
|
-
function parseHsl(str) {
|
|
2580
|
-
const res = HSL_RE.exec(str);
|
|
2581
|
-
if (!res)
|
|
2582
|
-
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2583
|
-
return { h: parseInt(res[1]), s: parseFloat(res[3]), l: parseFloat(res[5]) };
|
|
2584
|
-
}
|
|
2585
|
-
function parseColor(color2) {
|
|
2586
|
-
if (!color2) return { r: 0, g: 0, b: 0 };
|
|
2587
|
-
if (typeof color2 != "string")
|
|
2588
|
-
throw new Error("parseColor: expected a string");
|
|
2589
|
-
if (isHex(color2))
|
|
2590
|
-
return hexToRgb(color2);
|
|
2591
|
-
if (color2.startsWith("hsl("))
|
|
2592
|
-
return hslToRgb(parseHsl(color2));
|
|
2593
|
-
if (color2.startsWith("rgba("))
|
|
2594
|
-
return rgbaToRGBA(color2);
|
|
2595
|
-
throw new Error(`parseColor: unexpected color format: "${color2}"`);
|
|
2596
|
-
}
|
|
2597
|
-
function getContrastRatio(bg, fg) {
|
|
2598
|
-
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2599
|
-
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2600
|
-
}
|
|
2601
|
-
function rgb_lrgb({ r, g, b }) {
|
|
2602
|
-
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2603
|
-
}
|
|
2604
|
-
function rgb_lrgb1(v) {
|
|
2605
|
-
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
2606
|
-
}
|
|
2607
|
-
function lrgb_luminance([r, g, b]) {
|
|
2608
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
2609
|
-
}
|
|
2610
|
-
function rgba(color2, a) {
|
|
2611
|
-
const rgb = parseColor(color2);
|
|
2612
|
-
return `rgba(${rgb.r},${rgb.g},${rgb.b},${a})`;
|
|
2613
|
-
}
|
|
2614
|
-
const RGB_RANGE = [0, 255];
|
|
2615
|
-
function mixThemeColor(value, options) {
|
|
2616
|
-
const { blendMode } = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2617
|
-
r: [black2.r, white2.r],
|
|
2618
|
-
g: [black2.g, white2.g],
|
|
2619
|
-
b: [black2.b, white2.b]
|
|
2620
|
-
}, convertedBgColor = {
|
|
2621
|
-
r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
|
|
2622
|
-
g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
|
|
2623
|
-
b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
|
|
2624
|
-
}, convertedColor = {
|
|
2625
|
-
r: clamp(range(...paletteRange.r, ...RGB_RANGE, color2.r), ...RGB_RANGE),
|
|
2626
|
-
g: clamp(range(...paletteRange.g, ...RGB_RANGE, color2.g), ...RGB_RANGE),
|
|
2627
|
-
b: clamp(range(...paletteRange.b, ...RGB_RANGE, color2.b), ...RGB_RANGE)
|
|
2628
|
-
}, resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor), v = {
|
|
2629
|
-
r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
|
|
2630
|
-
g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
|
|
2631
|
-
b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
|
|
2632
|
-
};
|
|
2633
|
-
return rgbToHex(v);
|
|
2634
|
-
}
|
|
2635
|
-
function renderColorValue(str, options) {
|
|
2636
|
-
const { bg, blendMode, colorPalette } = options;
|
|
2637
|
-
if (bg === "white")
|
|
2638
|
-
throw new Error("Cannot blend with white background");
|
|
2639
|
-
const node = parseTokenValue(str);
|
|
2640
|
-
if (!node || node.type !== "color")
|
|
2641
|
-
throw new Error(`Invalid color token value: ${str}`);
|
|
2642
|
-
let hex = "";
|
|
2643
|
-
if (node.key === "black" && (hex = renderColorHex(colorPalette.black)), node.key === "white" && (hex = renderColorHex(colorPalette.white)), node.hue && node.tint && (hex = renderColorHex(colorPalette[node.hue][node.tint])), !hex)
|
|
2644
|
-
throw new Error(`Invalid color token value: ${str}`);
|
|
2645
|
-
const hexBeforeMix = hex, mixOptions = {
|
|
2646
|
-
blendMode,
|
|
2647
|
-
bg,
|
|
2648
|
-
black: renderColorHex(colorPalette.black),
|
|
2649
|
-
// opacity: node.opacity,
|
|
2650
|
-
white: renderColorHex(colorPalette.white)
|
|
2651
|
-
};
|
|
2652
|
-
try {
|
|
2653
|
-
if (hex = mixThemeColor(hex, mixOptions), bg && node.mix !== void 0) {
|
|
2654
|
-
const from = hexToRgb(bg), to = hexToRgb(hex);
|
|
2655
|
-
hex = rgbToHex(mix(from, to, node.mix));
|
|
2958
|
+
skeleton: {
|
|
2959
|
+
from: state.skeleton?.from || state.border,
|
|
2960
|
+
to: state.skeleton?.to || state.border
|
|
2656
2961
|
}
|
|
2657
|
-
}
|
|
2658
|
-
throw console.warn("could not blend", hex, mixOptions), err;
|
|
2659
|
-
}
|
|
2660
|
-
return hex === "#aN" && (console.warn(`invalid color token value: ${str}`), hex = hexBeforeMix), node.opacity !== void 0 && (hex = rgba(hex, node.opacity)), hex;
|
|
2661
|
-
}
|
|
2662
|
-
function renderColorHex(color2) {
|
|
2663
|
-
return typeof color2 == "string" ? color2 : color2.hex;
|
|
2962
|
+
};
|
|
2664
2963
|
}
|
|
2665
|
-
function
|
|
2666
|
-
const colorPalette = config?.palette ?? defaultColorPalette;
|
|
2964
|
+
function inputStatesThemeColor_v0_v2(states) {
|
|
2667
2965
|
return {
|
|
2668
|
-
|
|
2669
|
-
|
|
2966
|
+
enabled: inputStateThemeColor_v0_v2(states.enabled),
|
|
2967
|
+
disabled: inputStateThemeColor_v0_v2(states.disabled),
|
|
2968
|
+
readOnly: inputStateThemeColor_v0_v2(states.readOnly),
|
|
2969
|
+
hovered: inputStateThemeColor_v0_v2(states.hovered)
|
|
2670
2970
|
};
|
|
2671
2971
|
}
|
|
2672
|
-
function
|
|
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;
|
|
2674
|
-
if (bg === "white")
|
|
2675
|
-
throw new Error("Cannot blend with white background");
|
|
2676
|
-
return Object.fromEntries([
|
|
2677
|
-
["transparent", renderedTransparentTone],
|
|
2678
|
-
["default", renderedDefaultTone],
|
|
2679
|
-
...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, { bg, colorPalette })])
|
|
2680
|
-
]);
|
|
2681
|
-
}
|
|
2682
|
-
function renderThemeColor(value, options) {
|
|
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, {
|
|
2684
|
-
baseBg,
|
|
2685
|
-
blendMode,
|
|
2686
|
-
colorPalette
|
|
2687
|
-
}), selectable = renderThemeColorSelectable(value.selectable, {
|
|
2688
|
-
colorPalette,
|
|
2689
|
-
baseBg,
|
|
2690
|
-
blendMode
|
|
2691
|
-
}), shadow = {
|
|
2692
|
-
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
2693
|
-
umbra: renderColorValue(value.shadow.umbra, {
|
|
2694
|
-
...colorOptions,
|
|
2695
|
-
bg: void 0,
|
|
2696
|
-
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2697
|
-
}),
|
|
2698
|
-
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
2699
|
-
...colorOptions,
|
|
2700
|
-
bg: void 0,
|
|
2701
|
-
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2702
|
-
}),
|
|
2703
|
-
ambient: renderColorValue(value.shadow.ambient, {
|
|
2704
|
-
...colorOptions,
|
|
2705
|
-
bg: void 0,
|
|
2706
|
-
colorPalette: { ...colorPalette, black: "#000000" }
|
|
2707
|
-
})
|
|
2708
|
-
};
|
|
2972
|
+
function inputStateThemeColor_v0_v2(state) {
|
|
2709
2973
|
return {
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2714
|
-
},
|
|
2715
|
-
avatar: renderThemeColorAvatar(value.avatar, { baseBg, colorPalette, blendMode }),
|
|
2716
|
-
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2717
|
-
badge: renderThemeColorBadge(value.badge, { baseBg, colorPalette, blendMode }),
|
|
2718
|
-
bg: baseBg,
|
|
2719
|
-
border: renderColorValue(value.border, colorOptions),
|
|
2720
|
-
button,
|
|
2721
|
-
code: {
|
|
2722
|
-
bg: renderColorValue(value.code.bg, colorOptions),
|
|
2723
|
-
fg: renderColorValue(value.code.fg, colorOptions)
|
|
2724
|
-
},
|
|
2725
|
-
fg: renderColorValue(value.fg, colorOptions),
|
|
2726
|
-
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2727
|
-
icon: renderColorValue(value.icon, colorOptions),
|
|
2728
|
-
input: renderThemeColorInput(value.input, { baseBg, colorPalette, blendMode }),
|
|
2729
|
-
kbd: renderThemeColorKBD(value.kbd, { baseBg, colorPalette, blendMode }),
|
|
2730
|
-
link: {
|
|
2731
|
-
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2732
|
-
},
|
|
2974
|
+
bg: state.bg,
|
|
2975
|
+
border: state.border,
|
|
2976
|
+
fg: state.fg,
|
|
2733
2977
|
muted: {
|
|
2734
|
-
bg:
|
|
2735
|
-
fg: renderColorValue(value.muted.fg, colorOptions)
|
|
2736
|
-
},
|
|
2737
|
-
shadow,
|
|
2738
|
-
skeleton: {
|
|
2739
|
-
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
2740
|
-
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
2978
|
+
bg: state.bg2
|
|
2741
2979
|
},
|
|
2742
|
-
|
|
2743
|
-
selectable
|
|
2744
|
-
};
|
|
2745
|
-
}
|
|
2746
|
-
function renderThemeColorKBD(value, options) {
|
|
2747
|
-
const { baseBg, blendMode, colorPalette } = options, rootOptions = {
|
|
2748
|
-
bg: baseBg,
|
|
2749
|
-
blendMode,
|
|
2750
|
-
colorPalette
|
|
2751
|
-
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
2752
|
-
bg,
|
|
2753
|
-
blendMode,
|
|
2754
|
-
colorPalette
|
|
2755
|
-
};
|
|
2756
|
-
return {
|
|
2757
|
-
bg,
|
|
2758
|
-
fg: renderColorValue(value.fg, colorOptions),
|
|
2759
|
-
border: renderColorValue(value.border, colorOptions)
|
|
2760
|
-
};
|
|
2761
|
-
}
|
|
2762
|
-
function renderThemeColorAvatar(value, options) {
|
|
2763
|
-
return {
|
|
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)
|
|
2773
|
-
};
|
|
2774
|
-
}
|
|
2775
|
-
function renderThemeColorAvatarColor(value, options) {
|
|
2776
|
-
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2777
|
-
bg: baseBg,
|
|
2778
|
-
blendMode: rootBlendMode,
|
|
2779
|
-
colorPalette
|
|
2780
|
-
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
2781
|
-
bg,
|
|
2782
|
-
blendMode,
|
|
2783
|
-
colorPalette
|
|
2784
|
-
};
|
|
2785
|
-
return {
|
|
2786
|
-
_blend: blendMode,
|
|
2787
|
-
bg,
|
|
2788
|
-
fg: renderColorValue(value.fg, colorOptions)
|
|
2789
|
-
};
|
|
2790
|
-
}
|
|
2791
|
-
function renderThemeColorBadge(value, options) {
|
|
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
|
-
};
|
|
2799
|
-
}
|
|
2800
|
-
function renderThemeColorBadgeColor(value, options) {
|
|
2801
|
-
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = rootBlendMode, rootOptions = {
|
|
2802
|
-
bg: baseBg,
|
|
2803
|
-
blendMode: rootBlendMode,
|
|
2804
|
-
colorPalette
|
|
2805
|
-
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
2806
|
-
bg,
|
|
2807
|
-
blendMode,
|
|
2808
|
-
colorPalette
|
|
2809
|
-
};
|
|
2810
|
-
return {
|
|
2811
|
-
bg,
|
|
2812
|
-
dot: renderColorValue(value.dot, colorOptions),
|
|
2813
|
-
fg: renderColorValue(value.fg, colorOptions),
|
|
2814
|
-
icon: renderColorValue(value.icon, colorOptions)
|
|
2815
|
-
};
|
|
2816
|
-
}
|
|
2817
|
-
function renderThemeColorButton(value, options) {
|
|
2818
|
-
return {
|
|
2819
|
-
default: renderThemeColorButtonTones(value.default, options),
|
|
2820
|
-
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
2821
|
-
bleed: renderThemeColorButtonTones(value.bleed, options)
|
|
2822
|
-
};
|
|
2823
|
-
}
|
|
2824
|
-
function renderThemeColorButtonTones(value, options) {
|
|
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)
|
|
2980
|
+
placeholder: state.placeholder
|
|
2831
2981
|
};
|
|
2832
2982
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
},
|
|
2857
|
-
avatar: renderThemeColorAvatar(value.avatar, { baseBg: bg, colorPalette, blendMode }),
|
|
2858
|
-
badge: renderThemeColorBadge(value.badge, { baseBg: bg, colorPalette, blendMode }),
|
|
2859
|
-
bg,
|
|
2860
|
-
border: renderColorValue(value.border, colorOptions),
|
|
2861
|
-
code: {
|
|
2862
|
-
bg: renderColorValue(value.code.bg, colorOptions),
|
|
2863
|
-
fg: renderColorValue(value.code.fg, colorOptions)
|
|
2864
|
-
},
|
|
2865
|
-
fg: renderColorValue(value.fg, colorOptions),
|
|
2866
|
-
icon: renderColorValue(value.icon, colorOptions),
|
|
2867
|
-
link: {
|
|
2868
|
-
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2983
|
+
const cache$2 = /* @__PURE__ */ new WeakMap();
|
|
2984
|
+
function v0_v2(v0) {
|
|
2985
|
+
if (v0.v2) return v0.v2;
|
|
2986
|
+
const cached_v2 = cache$2.get(v0);
|
|
2987
|
+
if (cached_v2) return cached_v2;
|
|
2988
|
+
const {
|
|
2989
|
+
avatar,
|
|
2990
|
+
button,
|
|
2991
|
+
color: color2,
|
|
2992
|
+
container,
|
|
2993
|
+
fonts: font,
|
|
2994
|
+
input,
|
|
2995
|
+
layer,
|
|
2996
|
+
media,
|
|
2997
|
+
radius,
|
|
2998
|
+
shadows: shadow,
|
|
2999
|
+
space,
|
|
3000
|
+
styles: style
|
|
3001
|
+
} = v0, v2 = {
|
|
3002
|
+
_version: 2,
|
|
3003
|
+
avatar: {
|
|
3004
|
+
...defaultThemeConfig.avatar,
|
|
3005
|
+
...avatar
|
|
2869
3006
|
},
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
3007
|
+
button: {
|
|
3008
|
+
...defaultThemeConfig.button,
|
|
3009
|
+
...button
|
|
2873
3010
|
},
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
3011
|
+
card: defaultThemeConfig.card,
|
|
3012
|
+
color: {
|
|
3013
|
+
light: {
|
|
3014
|
+
transparent: themeColor_v0_v2(color2.light.transparent),
|
|
3015
|
+
default: themeColor_v0_v2(color2.light.default),
|
|
3016
|
+
neutral: themeColor_v0_v2(color2.light.transparent),
|
|
3017
|
+
primary: themeColor_v0_v2(color2.light.primary),
|
|
3018
|
+
suggest: themeColor_v0_v2(color2.light.primary),
|
|
3019
|
+
positive: themeColor_v0_v2(color2.light.positive),
|
|
3020
|
+
caution: themeColor_v0_v2(color2.light.caution),
|
|
3021
|
+
critical: themeColor_v0_v2(color2.light.critical)
|
|
3022
|
+
},
|
|
3023
|
+
dark: {
|
|
3024
|
+
transparent: themeColor_v0_v2(color2.dark.transparent),
|
|
3025
|
+
default: themeColor_v0_v2(color2.dark.default),
|
|
3026
|
+
neutral: themeColor_v0_v2(color2.dark.transparent),
|
|
3027
|
+
primary: themeColor_v0_v2(color2.dark.primary),
|
|
3028
|
+
suggest: themeColor_v0_v2(color2.dark.primary),
|
|
3029
|
+
positive: themeColor_v0_v2(color2.dark.positive),
|
|
3030
|
+
caution: themeColor_v0_v2(color2.dark.caution),
|
|
3031
|
+
critical: themeColor_v0_v2(color2.dark.critical)
|
|
3032
|
+
}
|
|
2878
3033
|
},
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
disabled: renderInputStateColorTheme(value.disabled, options)
|
|
2897
|
-
};
|
|
2898
|
-
}
|
|
2899
|
-
function renderInputStateColorTheme(value, options) {
|
|
2900
|
-
const { baseBg, blendMode: rootBlendMode, colorPalette } = options, blendMode = value._blend || "multiply", rootOptions = { colorPalette, bg: baseBg, blendMode: rootBlendMode }, bg = renderColorValue(value.bg, rootOptions), colorOptions = { colorPalette, bg, blendMode };
|
|
2901
|
-
return {
|
|
2902
|
-
_blend: blendMode,
|
|
2903
|
-
bg,
|
|
2904
|
-
border: renderColorValue(value.border, colorOptions),
|
|
2905
|
-
fg: renderColorValue(value.fg, colorOptions),
|
|
2906
|
-
muted: {
|
|
2907
|
-
bg: renderColorValue(value.muted.bg, colorOptions)
|
|
3034
|
+
container,
|
|
3035
|
+
font,
|
|
3036
|
+
input: {
|
|
3037
|
+
...defaultThemeConfig.input,
|
|
3038
|
+
...input,
|
|
3039
|
+
checkbox: {
|
|
3040
|
+
...defaultThemeConfig.input.checkbox,
|
|
3041
|
+
...input.checkbox
|
|
3042
|
+
},
|
|
3043
|
+
radio: {
|
|
3044
|
+
...defaultThemeConfig.input.radio,
|
|
3045
|
+
...input.radio
|
|
3046
|
+
},
|
|
3047
|
+
switch: {
|
|
3048
|
+
...defaultThemeConfig.input.switch,
|
|
3049
|
+
...input.switch
|
|
3050
|
+
}
|
|
2908
3051
|
},
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
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
|
-
};
|
|
2920
|
-
}
|
|
2921
|
-
function renderThemeColorSelectableStates(value, options) {
|
|
2922
|
-
return {
|
|
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)
|
|
2928
|
-
};
|
|
2929
|
-
}
|
|
2930
|
-
function renderSyntaxColorTheme(value, options) {
|
|
2931
|
-
const { colorPalette, baseBg, blendMode } = options, colorOptions = { colorPalette, bg: baseBg, blendMode };
|
|
2932
|
-
return {
|
|
2933
|
-
atrule: renderColorValue(value.atrule, colorOptions),
|
|
2934
|
-
attrName: renderColorValue(value.attrName, colorOptions),
|
|
2935
|
-
attrValue: renderColorValue(value.attrValue, colorOptions),
|
|
2936
|
-
attribute: renderColorValue(value.attribute, colorOptions),
|
|
2937
|
-
boolean: renderColorValue(value.boolean, colorOptions),
|
|
2938
|
-
builtin: renderColorValue(value.builtin, colorOptions),
|
|
2939
|
-
cdata: renderColorValue(value.cdata, colorOptions),
|
|
2940
|
-
char: renderColorValue(value.char, colorOptions),
|
|
2941
|
-
class: renderColorValue(value.class, colorOptions),
|
|
2942
|
-
className: renderColorValue(value.className, colorOptions),
|
|
2943
|
-
comment: renderColorValue(value.comment, colorOptions),
|
|
2944
|
-
constant: renderColorValue(value.constant, colorOptions),
|
|
2945
|
-
deleted: renderColorValue(value.deleted, colorOptions),
|
|
2946
|
-
doctype: renderColorValue(value.doctype, colorOptions),
|
|
2947
|
-
entity: renderColorValue(value.entity, colorOptions),
|
|
2948
|
-
function: renderColorValue(value.function, colorOptions),
|
|
2949
|
-
hexcode: renderColorValue(value.hexcode, colorOptions),
|
|
2950
|
-
id: renderColorValue(value.id, colorOptions),
|
|
2951
|
-
important: renderColorValue(value.important, colorOptions),
|
|
2952
|
-
inserted: renderColorValue(value.inserted, colorOptions),
|
|
2953
|
-
keyword: renderColorValue(value.keyword, colorOptions),
|
|
2954
|
-
number: renderColorValue(value.number, colorOptions),
|
|
2955
|
-
operator: renderColorValue(value.operator, colorOptions),
|
|
2956
|
-
prolog: renderColorValue(value.prolog, colorOptions),
|
|
2957
|
-
property: renderColorValue(value.property, colorOptions),
|
|
2958
|
-
pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
|
|
2959
|
-
pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
|
|
2960
|
-
punctuation: renderColorValue(value.punctuation, colorOptions),
|
|
2961
|
-
regex: renderColorValue(value.regex, colorOptions),
|
|
2962
|
-
selector: renderColorValue(value.selector, colorOptions),
|
|
2963
|
-
string: renderColorValue(value.string, colorOptions),
|
|
2964
|
-
symbol: renderColorValue(value.symbol, colorOptions),
|
|
2965
|
-
tag: renderColorValue(value.tag, colorOptions),
|
|
2966
|
-
unit: renderColorValue(value.unit, colorOptions),
|
|
2967
|
-
url: renderColorValue(value.url, colorOptions),
|
|
2968
|
-
variable: renderColorValue(value.variable, colorOptions)
|
|
2969
|
-
};
|
|
2970
|
-
}
|
|
2971
|
-
function buildTheme(config) {
|
|
2972
|
-
const colorTheme = buildColorTheme(config), v2 = {
|
|
2973
|
-
_version: 2,
|
|
2974
|
-
avatar: config?.avatar ?? getTheme_v2.defaultThemeConfig.avatar,
|
|
2975
|
-
button: config?.button ?? getTheme_v2.defaultThemeConfig.button,
|
|
2976
|
-
card: config?.card ?? getTheme_v2.defaultThemeConfig.card,
|
|
2977
|
-
// How colors are generated:
|
|
2978
|
-
// 1. Merge custom tokens with default tokens
|
|
2979
|
-
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
2980
|
-
// 3. Apply mixing and render to hex values
|
|
2981
|
-
// render(build(mergeWithDefaults()))
|
|
2982
|
-
color: renderThemeColorSchemes(colorTheme, config),
|
|
2983
|
-
container: config?.container ?? getTheme_v2.defaultThemeConfig.container,
|
|
2984
|
-
font: config?.font ?? defaultThemeFonts,
|
|
2985
|
-
input: config?.input ?? getTheme_v2.defaultThemeConfig.input,
|
|
2986
|
-
layer: config?.layer ?? getTheme_v2.defaultThemeConfig.layer,
|
|
2987
|
-
media: config?.media ?? getTheme_v2.defaultThemeConfig.media,
|
|
2988
|
-
radius: config?.radius ?? getTheme_v2.defaultThemeConfig.radius,
|
|
2989
|
-
shadow: config?.shadow ?? getTheme_v2.defaultThemeConfig.shadow,
|
|
2990
|
-
space: config?.space ?? getTheme_v2.defaultThemeConfig.space,
|
|
2991
|
-
style: config?.style ?? getTheme_v2.defaultThemeConfig.style
|
|
3052
|
+
layer: layer ?? defaultThemeConfig.layer,
|
|
3053
|
+
media,
|
|
3054
|
+
radius,
|
|
3055
|
+
shadow,
|
|
3056
|
+
space,
|
|
3057
|
+
style
|
|
2992
3058
|
};
|
|
2993
|
-
return
|
|
3059
|
+
return cache$2.set(v0, v2), v2;
|
|
2994
3060
|
}
|
|
2995
|
-
const cache = /* @__PURE__ */ new Map();
|
|
3061
|
+
const cache$1 = /* @__PURE__ */ new Map();
|
|
2996
3062
|
function getScopedTheme(themeProp, scheme, tone) {
|
|
2997
3063
|
const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
|
|
2998
3064
|
if (cachedTheme) return cachedTheme;
|
|
2999
|
-
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer ||
|
|
3065
|
+
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp, v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp), colorScheme_v0 = v0.color[scheme] || v0.color.light, color_v0 = colorScheme_v0[tone] || colorScheme_v0.default, layer_v0 = v0.layer || defaultThemeConfig.layer, colorScheme_v2 = v2.color[scheme] || v2.color.light, color_v2 = colorScheme_v2[tone] || colorScheme_v2.default, color_v2_9 = themeColor_v0_v2_9(color_v2), layer_v2 = v2.layer || defaultThemeConfig.layer, theme = {
|
|
3000
3066
|
sanity: {
|
|
3001
3067
|
...v0,
|
|
3002
3068
|
color: color_v0,
|
|
@@ -3004,7 +3070,7 @@ function getScopedTheme(themeProp, scheme, tone) {
|
|
|
3004
3070
|
v2: {
|
|
3005
3071
|
...v2,
|
|
3006
3072
|
_resolved: !0,
|
|
3007
|
-
color:
|
|
3073
|
+
color: color_v2_9,
|
|
3008
3074
|
layer: layer_v2
|
|
3009
3075
|
}
|
|
3010
3076
|
}
|
|
@@ -3012,18 +3078,62 @@ function getScopedTheme(themeProp, scheme, tone) {
|
|
|
3012
3078
|
return _setCachedTheme(themeProp, scheme, tone, theme), theme;
|
|
3013
3079
|
}
|
|
3014
3080
|
function _getCachedTheme(rootTheme, scheme, tone) {
|
|
3015
|
-
const schemeCache = cache.get(scheme);
|
|
3081
|
+
const schemeCache = cache$1.get(scheme);
|
|
3016
3082
|
if (!schemeCache) return;
|
|
3017
3083
|
const toneCache = schemeCache.get(tone);
|
|
3018
3084
|
if (toneCache)
|
|
3019
3085
|
return toneCache.get(rootTheme);
|
|
3020
3086
|
}
|
|
3021
3087
|
function _setCachedTheme(rootTheme, scheme, tone, theme) {
|
|
3022
|
-
cache.has(scheme) || cache.set(scheme, /* @__PURE__ */ new Map());
|
|
3023
|
-
const schemeCache = cache.get(scheme);
|
|
3088
|
+
cache$1.has(scheme) || cache$1.set(scheme, /* @__PURE__ */ new Map());
|
|
3089
|
+
const schemeCache = cache$1.get(scheme);
|
|
3024
3090
|
schemeCache.has(tone) || schemeCache.set(tone, /* @__PURE__ */ new WeakMap()), schemeCache.get(tone).set(rootTheme, theme);
|
|
3025
3091
|
}
|
|
3026
|
-
|
|
3092
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3093
|
+
function getTheme_v2(theme) {
|
|
3094
|
+
if (theme.sanity.v2?._resolved) return theme.sanity.v2;
|
|
3095
|
+
const cached_v2 = cache.get(theme);
|
|
3096
|
+
if (cached_v2) return cached_v2;
|
|
3097
|
+
const v2 = {
|
|
3098
|
+
_version: 2,
|
|
3099
|
+
_resolved: !0,
|
|
3100
|
+
avatar: {
|
|
3101
|
+
...defaultThemeConfig.avatar,
|
|
3102
|
+
...theme.sanity.avatar
|
|
3103
|
+
},
|
|
3104
|
+
button: {
|
|
3105
|
+
...defaultThemeConfig.button,
|
|
3106
|
+
...theme.sanity.button
|
|
3107
|
+
},
|
|
3108
|
+
card: defaultThemeConfig.card,
|
|
3109
|
+
color: themeColor_v0_v2(theme.sanity.color),
|
|
3110
|
+
container: theme.sanity.container,
|
|
3111
|
+
font: theme.sanity.fonts,
|
|
3112
|
+
input: {
|
|
3113
|
+
...defaultThemeConfig.input,
|
|
3114
|
+
...theme.sanity.input,
|
|
3115
|
+
checkbox: {
|
|
3116
|
+
...defaultThemeConfig.input.checkbox,
|
|
3117
|
+
...theme.sanity.input.checkbox
|
|
3118
|
+
},
|
|
3119
|
+
radio: {
|
|
3120
|
+
...defaultThemeConfig.input.radio,
|
|
3121
|
+
...theme.sanity.input.radio
|
|
3122
|
+
},
|
|
3123
|
+
switch: {
|
|
3124
|
+
...defaultThemeConfig.input.switch,
|
|
3125
|
+
...theme.sanity.input.switch
|
|
3126
|
+
}
|
|
3127
|
+
},
|
|
3128
|
+
layer: theme.sanity.layer ?? defaultThemeConfig.layer,
|
|
3129
|
+
media: theme.sanity.media,
|
|
3130
|
+
radius: theme.sanity.radius,
|
|
3131
|
+
shadow: theme.sanity.shadows,
|
|
3132
|
+
space: theme.sanity.space,
|
|
3133
|
+
style: theme.sanity.styles
|
|
3134
|
+
};
|
|
3135
|
+
return cache.set(theme, v2), v2;
|
|
3136
|
+
}
|
|
3027
3137
|
exports.AVATAR_SIZE = AVATAR_SIZE;
|
|
3028
3138
|
exports.COLOR_CONFIG_AVATAR_COLORS = COLOR_CONFIG_AVATAR_COLORS;
|
|
3029
3139
|
exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
|
|
@@ -3039,6 +3149,7 @@ exports.FONT_CODE_SIZE = FONT_CODE_SIZE;
|
|
|
3039
3149
|
exports.FONT_HEADING_SIZE = FONT_HEADING_SIZE;
|
|
3040
3150
|
exports.FONT_LABEL_SIZE = FONT_LABEL_SIZE;
|
|
3041
3151
|
exports.FONT_TEXT_SIZE = FONT_TEXT_SIZE;
|
|
3152
|
+
exports.HUES = HUES;
|
|
3042
3153
|
exports.RADIUS = RADIUS;
|
|
3043
3154
|
exports.SHADOW = SHADOW;
|
|
3044
3155
|
exports.SPACE = SPACE;
|
|
@@ -3051,10 +3162,15 @@ exports.THEME_COLOR_INPUT_STATES = THEME_COLOR_INPUT_STATES;
|
|
|
3051
3162
|
exports.THEME_COLOR_SCHEMES = THEME_COLOR_SCHEMES;
|
|
3052
3163
|
exports.THEME_COLOR_STATES = THEME_COLOR_STATES;
|
|
3053
3164
|
exports.THEME_COLOR_STATE_TONES = THEME_COLOR_STATE_TONES;
|
|
3165
|
+
exports.TINTS = TINTS;
|
|
3166
|
+
exports.buildColor_v3 = buildColor_v3;
|
|
3054
3167
|
exports.buildTheme = buildTheme;
|
|
3168
|
+
exports.buildTheme_v3 = buildTheme_v3;
|
|
3055
3169
|
exports.createColorTheme = createColorTheme;
|
|
3170
|
+
exports.defaultTokens = defaultTokens;
|
|
3056
3171
|
exports.getContrastRatio = getContrastRatio;
|
|
3057
3172
|
exports.getScopedTheme = getScopedTheme;
|
|
3173
|
+
exports.getTheme_v2 = getTheme_v2;
|
|
3058
3174
|
exports.hexToRgb = hexToRgb;
|
|
3059
3175
|
exports.hslToRgb = hslToRgb;
|
|
3060
3176
|
exports.isColorBlendModeValue = isColorBlendModeValue;
|
|
@@ -3069,18 +3185,16 @@ exports.isColorOpacityValue = isColorOpacityValue;
|
|
|
3069
3185
|
exports.isColorTintKey = isColorTintKey;
|
|
3070
3186
|
exports.isColorTokenValue = isColorTokenValue;
|
|
3071
3187
|
exports.isColorValue = isColorValue;
|
|
3072
|
-
exports.is_v0 = is_v0;
|
|
3073
|
-
exports.is_v2 = is_v2;
|
|
3074
3188
|
exports.mix = mix;
|
|
3075
3189
|
exports.multiply = multiply;
|
|
3076
3190
|
exports.parseColor = parseColor;
|
|
3077
3191
|
exports.parseTokenKey = parseTokenKey;
|
|
3078
3192
|
exports.parseTokenValue = parseTokenValue;
|
|
3193
|
+
exports.renderColor = renderColor;
|
|
3194
|
+
exports.resolveTokens = resolveTokens;
|
|
3079
3195
|
exports.rgbToHex = rgbToHex;
|
|
3080
3196
|
exports.rgbToHsl = rgbToHsl;
|
|
3081
3197
|
exports.rgba = rgba;
|
|
3082
3198
|
exports.rgbaToRGBA = rgbaToRGBA;
|
|
3083
3199
|
exports.screen = screen;
|
|
3084
|
-
exports.v0_v2 = v0_v2;
|
|
3085
|
-
exports.v2_v0 = v2_v0;
|
|
3086
3200
|
//# sourceMappingURL=theme.js.map
|