@sanity/ui 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.mjs +38 -13
- package/dist/index.d.ts +500 -600
- package/dist/index.esm.js +1243 -6208
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1525 -6286
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs.mjs +54 -0
- package/dist/theme.d.ts +1528 -0
- package/dist/theme.esm.js +4345 -0
- package/dist/theme.esm.js.map +1 -0
- package/dist/theme.js +4400 -0
- package/dist/theme.js.map +1 -0
- package/exports/index.ts +1 -0
- package/exports/theme.ts +1 -0
- package/package.json +89 -68
- package/src/{__workshop__ → core/__workshop__}/constants.ts +4 -5
- package/src/core/__workshop__/fontsPlugin.tsx +36 -0
- package/src/core/_compat.ts +115 -0
- package/src/{components → core/components}/autocomplete/__workshop__/async.tsx +4 -5
- package/src/{components → core/components}/autocomplete/__workshop__/constrainedHeight.tsx +27 -22
- package/src/{components → core/components}/autocomplete/__workshop__/custom.tsx +36 -31
- package/src/{components → core/components}/autocomplete/__workshop__/example.tsx +2 -2
- package/src/{components → core/components}/autocomplete/__workshop__/focusAndBlur.tsx +5 -3
- package/src/{components → core/components}/autocomplete/autocomplete.tsx +7 -1
- package/src/{components → core/components}/dialog/__workshop__/activate.tsx +0 -1
- package/src/{components → core/components}/dialog/__workshop__/layering.tsx +5 -1
- package/src/{components → core/components}/dialog/__workshop__/panes.tsx +2 -7
- package/src/{components → core/components}/dialog/dialog.tsx +34 -96
- package/src/core/components/dialog/styles.ts +76 -0
- package/src/{components → core/components}/hotkeys/hotkeys.tsx +6 -2
- package/src/{components → core/components}/menu/__workshop__/asComponent.tsx +4 -4
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +50 -0
- package/src/{components → core/components}/menu/__workshop__/closableMenuButton.tsx +2 -2
- package/src/{components → core/components}/menu/__workshop__/customMenuItem.tsx +9 -3
- package/src/{components → core/components}/menu/__workshop__/disableFocusOnClose.tsx +2 -2
- package/src/{components → core/components}/menu/__workshop__/index.ts +5 -0
- package/src/{components → core/components}/menu/__workshop__/menuButton.tsx +1 -1
- package/src/{components → core/components}/menu/menu.test.tsx +1 -1
- package/src/{components → core/components}/menu/menu.tsx +2 -0
- package/src/{components → core/components}/menu/menuButton.tsx +3 -1
- package/src/{components → core/components}/menu/menuDivider.ts +1 -2
- package/src/{components → core/components}/menu/menuGroup.tsx +2 -2
- package/src/{components → core/components}/menu/menuItem.tsx +11 -5
- package/src/{components → core/components}/skeleton/styles.ts +7 -8
- package/src/{components → core/components}/skeleton/textSkeleton.tsx +12 -14
- package/src/{components → core/components}/tab/tab.tsx +4 -2
- package/src/{components → core/components}/toast/toast.test.tsx +1 -1
- package/src/{components → core/components}/toast/toast.tsx +13 -4
- package/src/{components → core/components}/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/{components → core/components}/tree/style.ts +23 -25
- package/src/{components → core/components}/tree/treeItem.tsx +3 -3
- package/src/{constants.ts → core/constants.ts} +1 -0
- package/src/{hooks → core/hooks}/useElementRect/__workshop__/example.tsx +3 -1
- package/src/{hooks → core/hooks}/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/{hooks → core/hooks}/useMediaIndex/useMediaIndex.test.tsx +4 -3
- package/src/{hooks → core/hooks}/useMediaIndex/useMediaIndex.ts +2 -3
- package/src/{index.ts → core/index.ts} +2 -0
- package/src/{lib → core/lib}/isRecord.ts +1 -1
- package/src/{primitives → core/primitives}/_selectable/style.ts +24 -26
- package/src/{primitives → core/primitives}/avatar/__workshop__/asButton.tsx +1 -1
- package/src/{primitives → core/primitives}/avatar/__workshop__/stack.tsx +1 -1
- package/src/{primitives → core/primitives}/avatar/avatar.tsx +49 -30
- package/src/{primitives → core/primitives}/avatar/avatarCounter.tsx +25 -15
- package/src/{primitives → core/primitives}/avatar/avatarStack.tsx +4 -4
- package/src/{primitives → core/primitives}/avatar/styles.ts +21 -12
- package/src/{primitives → core/primitives}/avatar/types.ts +2 -15
- package/src/{primitives → core/primitives}/badge/__workshop__/props.tsx +1 -1
- package/src/{primitives → core/primitives}/badge/__workshop__/tones.tsx +1 -1
- package/src/{primitives → core/primitives}/badge/badge.test.tsx +1 -1
- package/src/{primitives → core/primitives}/badge/badge.tsx +6 -3
- package/src/core/primitives/badge/styles.ts +19 -0
- package/src/{primitives → core/primitives}/badge/types.ts +1 -2
- package/src/{primitives → core/primitives}/box/__workshop__/responsive.tsx +2 -2
- package/src/{primitives → core/primitives}/box/box.tsx +3 -0
- package/src/{primitives → core/primitives}/button/__workshop__/sanityUploadButton.tsx +2 -1
- package/src/{primitives → core/primitives}/button/__workshop__/stacked.tsx +1 -1
- package/src/{primitives → core/primitives}/button/button.test.tsx +1 -1
- package/src/{primitives → core/primitives}/button/button.tsx +12 -9
- package/src/core/primitives/button/styles.ts +116 -0
- package/src/{primitives → core/primitives}/card/__workshop__/asButton.tsx +6 -6
- package/src/{primitives → core/primitives}/card/__workshop__/asComponent.tsx +1 -1
- package/src/{primitives → core/primitives}/card/__workshop__/selected.tsx +18 -27
- package/src/{primitives → core/primitives}/card/card.tsx +12 -43
- package/src/{primitives → core/primitives}/card/styles.ts +31 -45
- package/src/{primitives → core/primitives}/card/types.ts +1 -3
- package/src/{primitives → core/primitives}/checkbox/__workshop__/example.tsx +1 -1
- package/src/{primitives → core/primitives}/checkbox/__workshop__/props.tsx +1 -1
- package/src/{primitives → core/primitives}/checkbox/__workshop__/readOnly.tsx +1 -1
- package/src/{primitives → core/primitives}/checkbox/checkbox.tsx +2 -0
- package/src/{primitives → core/primitives}/checkbox/styles.ts +23 -23
- package/src/{primitives → core/primitives}/code/code.tsx +4 -15
- package/src/core/primitives/code/styles.ts +77 -0
- package/src/{primitives → core/primitives}/container/container.tsx +2 -0
- package/src/{primitives → core/primitives}/container/styles.ts +2 -3
- package/src/{primitives → core/primitives}/flex/flex.tsx +2 -1
- package/src/{primitives → core/primitives}/grid/grid.tsx +2 -0
- package/src/{primitives → core/primitives}/heading/heading.tsx +3 -1
- package/src/{primitives → core/primitives}/heading/styles.ts +9 -8
- package/src/{primitives → core/primitives}/inline/inline.tsx +3 -0
- package/src/{primitives → core/primitives}/inline/styles.ts +6 -6
- package/src/{primitives → core/primitives}/kbd/kbd.tsx +10 -4
- package/src/{primitives → core/primitives}/label/label.tsx +3 -1
- package/src/{primitives → core/primitives}/label/styles.ts +6 -6
- package/src/{primitives → core/primitives}/popover/__workshop__/RecursiveStory.tsx +2 -9
- package/src/{primitives → core/primitives}/popover/__workshop__/TestStory.tsx +6 -3
- package/src/{primitives → core/primitives}/popover/constants.ts +3 -2
- package/src/{primitives → core/primitives}/popover/helpers.ts +3 -4
- package/src/{primitives → core/primitives}/popover/popover.tsx +19 -11
- package/src/{primitives → core/primitives}/popover/popoverCard.tsx +24 -22
- package/src/{primitives → core/primitives}/popover/types.ts +1 -1
- package/src/{primitives → core/primitives}/radio/radio.tsx +2 -0
- package/src/{primitives → core/primitives}/radio/styles.ts +17 -19
- package/src/{primitives → core/primitives}/select/select.tsx +4 -2
- package/src/{primitives → core/primitives}/select/styles.ts +32 -33
- package/src/{primitives → core/primitives}/spinner/spinner.tsx +2 -0
- package/src/{primitives → core/primitives}/stack/stack.tsx +2 -0
- package/src/{primitives → core/primitives}/stack/styles.ts +2 -3
- package/src/{primitives → core/primitives}/switch/__workshop__/example.tsx +1 -1
- package/src/core/primitives/switch/__workshop__/props.tsx +21 -0
- package/src/{primitives → core/primitives}/switch/styles.ts +18 -21
- package/src/{primitives → core/primitives}/switch/switch.tsx +4 -0
- package/src/core/primitives/text/__workshop__/colored.tsx +29 -0
- package/src/{primitives → core/primitives}/text/styles.ts +18 -14
- package/src/{primitives → core/primitives}/text/text.tsx +4 -1
- package/src/{primitives → core/primitives}/textArea/__workshop__/plain.tsx +1 -1
- package/src/{primitives → core/primitives}/textArea/textArea.tsx +15 -7
- package/src/{primitives → core/primitives}/textInput/__workshop__/plain.tsx +1 -1
- package/src/{primitives → core/primitives}/textInput/__workshop__/states.tsx +3 -3
- package/src/{primitives → core/primitives}/textInput/textInput.tsx +22 -12
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +99 -0
- package/src/core/primitives/tooltip/__workshop__/index.ts +29 -0
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +73 -0
- package/src/{primitives → core/primitives}/tooltip/__workshop__/props.tsx +3 -20
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +85 -0
- package/src/core/primitives/tooltip/conditionalWrapper.tsx +15 -0
- package/src/core/primitives/tooltip/constants.ts +23 -0
- package/src/{primitives → core/primitives}/tooltip/tooltip.test.tsx +192 -20
- package/src/{primitives → core/primitives}/tooltip/tooltip.tsx +202 -79
- package/src/{primitives → core/primitives}/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +4 -10
- package/src/{primitives → core/primitives}/types.ts +4 -0
- package/src/core/styles/border/borderStyle.ts +55 -0
- package/src/{styles → core/styles}/box/boxStyle.ts +5 -9
- package/src/core/styles/card/_cardColorStyle.ts +99 -0
- package/src/core/styles/card/index.ts +1 -0
- package/src/{styles → core/styles}/flex/flexItemStyle.ts +2 -3
- package/src/{styles → core/styles}/flex/flexStyle.ts +6 -11
- package/src/{styles → core/styles}/focusRing/index.ts +5 -7
- package/src/{styles → core/styles}/font/codeFontStyle.ts +1 -1
- package/src/{styles → core/styles}/font/headingFontStyle.ts +1 -1
- package/src/{styles → core/styles}/font/labelFontStyle.ts +1 -1
- package/src/{styles → core/styles}/font/responsiveFont.ts +5 -5
- package/src/{styles → core/styles}/font/textAlignStyle.ts +3 -3
- package/src/{styles → core/styles}/font/textFontStyle.ts +1 -1
- package/src/{styles → core/styles}/font/types.ts +1 -1
- package/src/{styles → core/styles}/grid/gridItemStyle.ts +7 -13
- package/src/{styles → core/styles}/grid/gridStyle.ts +9 -17
- package/src/{styles → core/styles}/helpers.ts +6 -4
- package/src/{styles → core/styles}/input/responsiveInputPaddingStyle.ts +6 -6
- package/src/core/styles/input/textInputStyle.ts +232 -0
- package/src/{styles → core/styles}/margin/marginStyle.ts +1 -1
- package/src/{styles → core/styles}/margin/marginsStyle.test.ts +2 -2
- package/src/{styles → core/styles}/padding/paddingStyle.test.ts +2 -2
- package/src/{styles → core/styles}/padding/paddingStyle.ts +1 -1
- package/src/{styles → core/styles}/radius/radiusStyle.ts +2 -3
- package/src/core/styles/shadow/shadowStyle.ts +29 -0
- package/src/{styles → core/styles}/types.ts +1 -1
- package/src/core/theme/__workshop__/build/Root.tsx +350 -0
- package/src/core/theme/__workshop__/build/helpers.ts +46 -0
- package/src/core/theme/__workshop__/build/story.tsx +453 -0
- package/src/core/theme/__workshop__/canvas.tsx +350 -0
- package/src/{theme → core/theme}/__workshop__/color.tsx +5 -8
- package/src/{theme → core/theme}/__workshop__/index.ts +10 -0
- package/src/core/theme/index.ts +5 -0
- package/src/{theme → core/theme}/theme.test.tsx +3 -36
- package/src/{theme → core/theme}/themeColorProvider.tsx +2 -4
- package/src/{theme → core/theme}/themeContext.ts +2 -2
- package/src/core/theme/themeProvider.tsx +61 -0
- package/src/core/theme/types.ts +12 -0
- package/src/core/theme/useRootTheme.ts +16 -0
- package/src/core/theme/useTheme.ts +16 -0
- package/src/{types → core/types}/avatar.ts +1 -1
- package/src/core/types/badge.ts +12 -0
- package/src/core/types/button.ts +22 -0
- package/src/core/types/card.ts +6 -0
- package/src/{types → core/types}/index.ts +0 -1
- package/src/core/types/selectable.ts +6 -0
- package/src/core/utils/arrow/arrow.tsx +121 -0
- package/src/core/utils/arrow/cmds.ts +91 -0
- package/src/core/utils/arrow/index.ts +1 -0
- package/src/{utils → core/utils}/boundaryElement/__workshop__/plain.tsx +2 -6
- package/src/{utils → core/utils}/boundaryElement/boundaryElement.test.tsx +1 -1
- package/src/{utils → core/utils}/elementQuery/__workshop__/customMedia.tsx +3 -4
- package/src/{utils → core/utils}/elementQuery/elementQuery.tsx +3 -3
- package/src/{utils → core/utils}/index.ts +1 -0
- package/src/{utils → core/utils}/layer/__workshop__/_debug.tsx +1 -1
- package/src/{utils → core/utils}/layer/layer.test.tsx +1 -1
- package/src/{utils → core/utils}/portal/__workshop__/named.tsx +3 -3
- package/src/{utils → core/utils}/portal/portal.test.tsx +1 -1
- package/src/{utils → core/utils}/virtualList/virtualList.tsx +2 -2
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +76 -0
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +54 -0
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +22 -0
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +55 -0
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +60 -0
- package/src/theme/build/_deprecated/color/color.test.ts +63 -0
- package/src/theme/build/_deprecated/color/defaults.ts +390 -0
- package/src/theme/build/_deprecated/color/factory.ts +142 -0
- package/src/theme/build/_deprecated/color/index.ts +1 -0
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +81 -0
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +54 -0
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +20 -0
- package/src/theme/build/buildColorTheme.test.ts +183 -0
- package/src/theme/build/buildColorTheme.ts +484 -0
- package/src/theme/build/buildTheme.test.ts +87 -0
- package/src/theme/build/buildTheme.ts +36 -0
- package/src/theme/build/colorToken.ts +39 -0
- package/src/theme/build/index.ts +3 -0
- package/src/theme/{lib → build/lib}/color-fns/blend/index.ts +1 -0
- package/src/theme/build/lib/color-fns/blend/mix.ts +21 -0
- package/src/theme/{lib → build/lib}/color-fns/blend/multiply.ts +3 -7
- package/src/theme/{lib → build/lib}/color-fns/blend/screen.ts +3 -7
- package/src/theme/{lib → build/lib}/color-fns/color-fns.test.ts +10 -7
- package/src/theme/build/lib/color-fns/contrastRatio.ts +31 -0
- package/src/theme/{lib → build/lib}/color-fns/convert.ts +10 -1
- package/src/theme/{lib → build/lib}/color-fns/index.ts +2 -1
- package/src/theme/{lib/color-fns/helpers → build/lib/color-fns}/rgba.ts +1 -1
- package/src/theme/build/lib/isRecord.ts +3 -0
- package/src/theme/build/lib/utils.ts +19 -0
- package/src/theme/build/merge.ts +28 -0
- package/src/theme/build/mixThemeColor.test.ts +21 -0
- package/src/theme/build/mixThemeColor.ts +53 -0
- package/src/theme/build/renderColorTheme.ts +536 -0
- package/src/theme/build/renderColorValue.ts +77 -0
- package/src/theme/build/resolveColorTokens.ts +331 -0
- package/src/theme/build/theme.test.ts +27 -0
- package/src/theme/config/helpers.ts +55 -0
- package/src/theme/config/index.ts +4 -0
- package/src/theme/config/system.ts +112 -0
- package/src/theme/config/tokens/color/index.ts +1 -0
- package/src/theme/config/tokens/color/types.ts +135 -0
- package/src/theme/config/tokens/index.ts +4 -0
- package/src/theme/config/tokens/parseTokenKey.test.ts +64 -0
- package/src/theme/config/tokens/parseTokenKey.ts +66 -0
- package/src/theme/config/tokens/parseTokenValue.test.ts +45 -0
- package/src/theme/config/tokens/parseTokenValue.ts +102 -0
- package/src/theme/config/tokens/types.ts +51 -0
- package/src/theme/config/types.ts +45 -0
- package/src/theme/defaults/colorPalette.ts +5 -0
- package/src/theme/defaults/colorTokens.ts +552 -0
- package/src/theme/{studioTheme/theme.ts → defaults/config.ts} +38 -42
- package/src/theme/{studioTheme → defaults}/fonts.ts +67 -59
- package/src/theme/getScopedTheme.ts +81 -0
- package/src/theme/index.ts +12 -8
- package/src/theme/system/avatar.ts +14 -0
- package/src/theme/system/color/_constants.ts +38 -0
- package/src/theme/system/color/_helpers.ts +23 -0
- package/src/theme/system/color/_system.ts +39 -0
- package/src/theme/system/color/avatar.ts +25 -0
- package/src/theme/system/color/badge.ts +20 -0
- package/src/theme/system/color/button.ts +33 -0
- package/src/theme/system/color/color.ts +34 -0
- package/src/theme/system/color/index.ts +13 -0
- package/src/theme/system/color/input.ts +33 -0
- package/src/theme/system/color/kbd.ts +8 -0
- package/src/theme/system/color/selectable.ts +23 -0
- package/src/theme/system/color/shadow.ts +7 -0
- package/src/theme/system/color/state.ts +37 -0
- package/src/theme/system/color/syntax.ts +41 -0
- package/src/theme/system/css.ts +9 -0
- package/src/theme/system/focusRing.ts +7 -0
- package/src/theme/{lib/theme → system}/index.ts +6 -1
- package/src/theme/system/input.ts +33 -0
- package/src/theme/{lib/theme → system}/layer.ts +1 -2
- package/src/theme/system/shadow.ts +25 -0
- package/src/theme/system/styles.ts +19 -0
- package/src/theme/system/theme.ts +128 -0
- package/src/theme/{lib/theme → system/v0}/avatar.ts +1 -3
- package/src/theme/system/v0/color/_generic.ts +35 -0
- package/src/theme/system/v0/color/_system.ts +13 -0
- package/src/theme/system/v0/color/base.ts +21 -0
- package/src/theme/system/v0/color/button.ts +42 -0
- package/src/theme/system/v0/color/card.ts +19 -0
- package/src/theme/system/v0/color/color.ts +40 -0
- package/src/theme/system/v0/color/index.ts +11 -0
- package/src/theme/system/v0/color/input.ts +34 -0
- package/src/theme/system/v0/color/muted.ts +26 -0
- package/src/theme/system/v0/color/selectable.ts +31 -0
- package/src/theme/system/v0/color/solid.ts +26 -0
- package/src/theme/system/v0/color/spot.ts +13 -0
- package/src/theme/system/v0/index.ts +3 -0
- package/src/theme/{lib/theme → system/v0}/input.ts +1 -11
- package/src/theme/versioning/getTheme_v2.ts +56 -0
- package/src/theme/versioning/index.ts +5 -0
- package/src/theme/versioning/is_v0.ts +6 -0
- package/src/theme/versioning/is_v2.ts +6 -0
- package/src/theme/versioning/themeColor_v0_v2.ts +217 -0
- package/src/theme/versioning/v0_v2.ts +90 -0
- package/src/theme/versioning/v2_v0.ts +126 -0
- package/src/components/dialog/constants.ts +0 -4
- package/src/components/dialog/styles.ts +0 -37
- package/src/primitives/avatar/spotColors.ts +0 -53
- package/src/primitives/badge/styles.ts +0 -19
- package/src/primitives/button/styles.ts +0 -166
- package/src/primitives/code/styles.ts +0 -83
- package/src/primitives/popover/popoverArrow.tsx +0 -77
- package/src/primitives/switch/__workshop__/props.tsx +0 -41
- package/src/primitives/text/__workshop__/colored.tsx +0 -27
- package/src/primitives/tooltip/__workshop__/index.ts +0 -14
- package/src/primitives/tooltip/constants.ts +0 -16
- package/src/primitives/tooltip/tooltipArrow.tsx +0 -90
- package/src/styles/border/borderStyle.ts +0 -58
- package/src/styles/colorVars/colorVarsStyle.ts +0 -84
- package/src/styles/colorVars/index.ts +0 -1
- package/src/styles/input/textInputStyle.ts +0 -214
- package/src/styles/shadow/shadowStyle.ts +0 -28
- package/src/theme/defaults.ts +0 -7
- package/src/theme/lib/color-fns/helpers/index.ts +0 -1
- package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +0 -7
- package/src/theme/lib/theme/color/_legacy/index.ts +0 -1
- package/src/theme/lib/theme/color/_legacy/legacyColor.ts +0 -3997
- package/src/theme/lib/theme/color/cssVariables/cardVariables.ts +0 -88
- package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +0 -31
- package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +0 -262
- package/src/theme/lib/theme/color/cssVariables/index.ts +0 -1
- package/src/theme/lib/theme/color/cssVariables/tints.ts +0 -312
- package/src/theme/lib/theme/color/cssVariables/tones.ts +0 -67
- package/src/theme/lib/theme/color/cssVariables/utils.test.ts +0 -15
- package/src/theme/lib/theme/color/cssVariables/utils.ts +0 -9
- package/src/theme/lib/theme/color/index.ts +0 -5
- package/src/theme/lib/theme/color/types.ts +0 -41
- package/src/theme/lib/theme/shadow.ts +0 -20
- package/src/theme/lib/theme/theme.ts +0 -43
- package/src/theme/studioTheme/color.ts +0 -11
- package/src/theme/studioTheme/helpers.ts +0 -31
- package/src/theme/studioTheme/index.ts +0 -1
- package/src/theme/themeProvider.tsx +0 -81
- package/src/theme/toneContext/toneContext.ts +0 -12
- package/src/theme/toneContext/toneProvider.tsx +0 -31
- package/src/theme/toneContext/types.ts +0 -10
- package/src/theme/toneContext/useToneContext.tsx +0 -26
- package/src/theme/types.ts +0 -45
- package/src/theme/useRootTheme.ts +0 -25
- package/src/theme/useTheme.ts +0 -10
- package/src/types/badge.ts +0 -9
- package/src/types/button.ts +0 -14
- package/src/types/card.ts +0 -6
- package/src/types/selectable.ts +0 -4
- package/src/types/styled.ts +0 -9
- /package/src/{components → core/components}/autocomplete/__fixtures__/countries.ts +0 -0
- /package/src/{components → core/components}/autocomplete/__mocks__/apiStore.ts +0 -0
- /package/src/{components → core/components}/autocomplete/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/autocomplete/__workshop__/fullscreen.tsx +0 -0
- /package/src/{components → core/components}/autocomplete/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/autocomplete/__workshop__/types.ts +0 -0
- /package/src/{components → core/components}/autocomplete/autocomplete.styles.tsx +0 -0
- /package/src/{components → core/components}/autocomplete/autocompleteOption.tsx +0 -0
- /package/src/{components → core/components}/autocomplete/autocompleteReducer.ts +0 -0
- /package/src/{components → core/components}/autocomplete/constants.ts +0 -0
- /package/src/{components → core/components}/autocomplete/index.ts +0 -0
- /package/src/{components → core/components}/autocomplete/types.ts +0 -0
- /package/src/{components → core/components}/breadcrumbs/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/breadcrumbs/__workshop__/example.tsx +0 -0
- /package/src/{components → core/components}/breadcrumbs/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/breadcrumbs/breadcrumbs.styles.ts +0 -0
- /package/src/{components → core/components}/breadcrumbs/breadcrumbs.tsx +0 -0
- /package/src/{components → core/components}/breadcrumbs/index.ts +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/autoFocus.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/nested.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/onScroll.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/position.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/props.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/provider.tsx +0 -0
- /package/src/{components → core/components}/dialog/__workshop__/wrapped.tsx +0 -0
- /package/src/{components → core/components}/dialog/dialogContext.ts +0 -0
- /package/src/{components → core/components}/dialog/dialogProvider.tsx +0 -0
- /package/src/{components → core/components}/dialog/index.ts +0 -0
- /package/src/{components → core/components}/dialog/useDialog.ts +0 -0
- /package/src/{components → core/components}/hotkeys/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/hotkeys/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/hotkeys/__workshop__/plain.tsx +0 -0
- /package/src/{components → core/components}/hotkeys/index.ts +0 -0
- /package/src/{components → core/components}/index.ts +0 -0
- /package/src/{components → core/components}/menu/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/menu/__workshop__/constrainedInBoundary.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/groups.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/menuGroupRight.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/nestedMenu.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/onCloseMenuButton.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/selectedItem.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/shouldFocus.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/tones.tsx +0 -0
- /package/src/{components → core/components}/menu/__workshop__/withoutArrow.tsx +0 -0
- /package/src/{components → core/components}/menu/helpers.ts +0 -0
- /package/src/{components → core/components}/menu/index.ts +0 -0
- /package/src/{components → core/components}/menu/menuContext.ts +0 -0
- /package/src/{components → core/components}/menu/useMenu.ts +0 -0
- /package/src/{components → core/components}/menu/useMenuController.ts +0 -0
- /package/src/{components → core/components}/skeleton/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/skeleton/__workshop__/delay.tsx +0 -0
- /package/src/{components → core/components}/skeleton/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/skeleton/__workshop__/skeleton.tsx +0 -0
- /package/src/{components → core/components}/skeleton/index.ts +0 -0
- /package/src/{components → core/components}/skeleton/skeleton.tsx +0 -0
- /package/src/{components → core/components}/tab/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/tab/__workshop__/example.tsx +0 -0
- /package/src/{components → core/components}/tab/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/tab/index.ts +0 -0
- /package/src/{components → core/components}/tab/tabList.tsx +0 -0
- /package/src/{components → core/components}/tab/tabPanel.tsx +0 -0
- /package/src/{components → core/components}/toast/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/toast/__workshop__/hook.tsx +0 -0
- /package/src/{components → core/components}/toast/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/toast/__workshop__/toast.tsx +0 -0
- /package/src/{components → core/components}/toast/index.ts +0 -0
- /package/src/{components → core/components}/toast/toastContext.ts +0 -0
- /package/src/{components → core/components}/toast/toastProvider.tsx +0 -0
- /package/src/{components → core/components}/toast/types.ts +0 -0
- /package/src/{components → core/components}/toast/useToast.ts +0 -0
- /package/src/{components → core/components}/tree/__workshop__/.eslintrc +0 -0
- /package/src/{components → core/components}/tree/__workshop__/basic.perf.ts +0 -0
- /package/src/{components → core/components}/tree/__workshop__/basic.tsx +0 -0
- /package/src/{components → core/components}/tree/__workshop__/index.ts +0 -0
- /package/src/{components → core/components}/tree/helpers.ts +0 -0
- /package/src/{components → core/components}/tree/index.ts +0 -0
- /package/src/{components → core/components}/tree/tree.tsx +0 -0
- /package/src/{components → core/components}/tree/treeContext.ts +0 -0
- /package/src/{components → core/components}/tree/treeGroup.tsx +0 -0
- /package/src/{components → core/components}/tree/types.ts +0 -0
- /package/src/{components → core/components}/tree/useTree.ts +0 -0
- /package/src/{global.ts → core/global.ts} +0 -0
- /package/src/{helpers → core/helpers}/animation.ts +0 -0
- /package/src/{helpers → core/helpers}/element.ts +0 -0
- /package/src/{helpers → core/helpers}/focus.ts +0 -0
- /package/src/{helpers → core/helpers}/index.ts +0 -0
- /package/src/{helpers → core/helpers}/scroll.ts +0 -0
- /package/src/{hooks → core/hooks}/_internal/index.ts +0 -0
- /package/src/{hooks → core/hooks}/_internal/useUnique.ts +0 -0
- /package/src/{hooks → core/hooks}/index.ts +0 -0
- /package/src/{hooks → core/hooks}/useArrayProp.ts +0 -0
- /package/src/{hooks → core/hooks}/useClickOutside.ts +0 -0
- /package/src/{hooks → core/hooks}/useCustomValidity.ts +0 -0
- /package/src/{hooks → core/hooks}/useDelayed.test.ts +0 -0
- /package/src/{hooks → core/hooks}/useDelayedState.ts +0 -0
- /package/src/{hooks → core/hooks}/useElementRect/__workshop__/.eslintrc +0 -0
- /package/src/{hooks → core/hooks}/useElementRect/__workshop__/index.ts +0 -0
- /package/src/{hooks → core/hooks}/useElementRect/index.ts +0 -0
- /package/src/{hooks → core/hooks}/useElementRect/useElementRect.ts +0 -0
- /package/src/{hooks → core/hooks}/useElementSize.ts +0 -0
- /package/src/{hooks → core/hooks}/useForwardedRef.ts +0 -0
- /package/src/{hooks → core/hooks}/useGlobalKeyDown.ts +0 -0
- /package/src/{hooks → core/hooks}/useIsomorphicEffect.ts +0 -0
- /package/src/{hooks → core/hooks}/useMediaIndex/__workshop__/.eslintrc +0 -0
- /package/src/{hooks → core/hooks}/useMediaIndex/__workshop__/index.ts +0 -0
- /package/src/{hooks → core/hooks}/useMediaIndex/index.ts +0 -0
- /package/src/{hooks → core/hooks}/useMounted.ts +0 -0
- /package/src/{hooks → core/hooks}/usePrefersDark.hydration.test.tsx +0 -0
- /package/src/{hooks → core/hooks}/usePrefersDark.test.tsx +0 -0
- /package/src/{hooks → core/hooks}/usePrefersDark.ts +0 -0
- /package/src/{hooks → core/hooks}/usePrefersReducedMotion.hydration.test.tsx +0 -0
- /package/src/{hooks → core/hooks}/usePrefersReducedMotion.test.tsx +0 -0
- /package/src/{hooks → core/hooks}/usePrefersReducedMotion.ts +0 -0
- /package/src/{lib → core/lib}/globalScope.ts +0 -0
- /package/src/{observers → core/observers}/elementSizeObserver.ts +0 -0
- /package/src/{observers → core/observers}/index.ts +0 -0
- /package/src/{observers → core/observers}/resizeObserver.ts +0 -0
- /package/src/{primitives → core/primitives}/_selectable/index.ts +0 -0
- /package/src/{primitives → core/primitives}/_selectable/selectable.tsx +0 -0
- /package/src/{primitives → core/primitives}/avatar/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/avatar/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/avatar/index.ts +0 -0
- /package/src/{primitives → core/primitives}/badge/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/badge/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/badge/index.ts +0 -0
- /package/src/{primitives → core/primitives}/box/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/box/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/box/__workshop__/props.tsx +0 -0
- /package/src/{primitives → core/primitives}/box/index.ts +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/custom.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/customIcons.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/mixedChildren.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/props.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/styled1.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/styled2.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/__workshop__/uploadButton.tsx +0 -0
- /package/src/{primitives → core/primitives}/button/index.ts +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/allTones.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/checkered.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/interactive.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/listNavigation.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/props.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/__workshop__/styled.tsx +0 -0
- /package/src/{primitives → core/primitives}/card/index.ts +0 -0
- /package/src/{primitives → core/primitives}/checkbox/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/checkbox/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/checkbox/__workshop__/tones.tsx +0 -0
- /package/src/{primitives → core/primitives}/checkbox/index.ts +0 -0
- /package/src/{primitives → core/primitives}/code/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/code/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/code/__workshop__/opticalAlignment.tsx +0 -0
- /package/src/{primitives → core/primitives}/code/__workshop__/props.tsx +0 -0
- /package/src/{primitives → core/primitives}/code/index.ts +0 -0
- /package/src/{primitives → core/primitives}/container/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/container/__workshop__/example.tsx +0 -0
- /package/src/{primitives → core/primitives}/container/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/container/index.ts +0 -0
- /package/src/{primitives → core/primitives}/container/types.ts +0 -0
- /package/src/{primitives → core/primitives}/flex/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/flex/__workshop__/example.tsx +0 -0
- /package/src/{primitives → core/primitives}/flex/__workshop__/gap.tsx +0 -0
- /package/src/{primitives → core/primitives}/flex/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/flex/index.ts +0 -0
- /package/src/{primitives → core/primitives}/grid/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/grid/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/grid/__workshop__/responsive.tsx +0 -0
- /package/src/{primitives → core/primitives}/grid/index.ts +0 -0
- /package/src/{primitives → core/primitives}/heading/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/heading/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/heading/__workshop__/opticalAlignment.tsx +0 -0
- /package/src/{primitives → core/primitives}/heading/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/heading/index.ts +0 -0
- /package/src/{primitives → core/primitives}/heading/types.ts +0 -0
- /package/src/{primitives → core/primitives}/helpers.ts +0 -0
- /package/src/{primitives → core/primitives}/index.ts +0 -0
- /package/src/{primitives → core/primitives}/inline/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/inline/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/inline/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/inline/index.ts +0 -0
- /package/src/{primitives → core/primitives}/inline/types.ts +0 -0
- /package/src/{primitives → core/primitives}/kbd/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/kbd/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/kbd/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/kbd/index.tsx +0 -0
- /package/src/{primitives → core/primitives}/label/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/label/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/label/__workshop__/opticalAlignment.tsx +0 -0
- /package/src/{primitives → core/primitives}/label/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/label/index.ts +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/AlignedStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/MarginsStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/OpenOnMountStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/PlainStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/SidePanelStory.tsx +0 -0
- /package/src/{primitives → core/primitives}/popover/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/popover/floating-ui/size.ts +0 -0
- /package/src/{primitives → core/primitives}/popover/index.ts +0 -0
- /package/src/{primitives → core/primitives}/radio/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/radio/__workshop__/example.tsx +0 -0
- /package/src/{primitives → core/primitives}/radio/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/radio/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/radio/index.ts +0 -0
- /package/src/{primitives → core/primitives}/select/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/select/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/select/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/select/__workshop__/readOnly.tsx +0 -0
- /package/src/{primitives → core/primitives}/select/index.ts +0 -0
- /package/src/{primitives → core/primitives}/spinner/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/spinner/__workshop__/Props.tsx +0 -0
- /package/src/{primitives → core/primitives}/spinner/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/spinner/index.ts +0 -0
- /package/src/{primitives → core/primitives}/stack/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/stack/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/stack/__workshop__/plain.tsx +0 -0
- /package/src/{primitives → core/primitives}/stack/index.ts +0 -0
- /package/src/{primitives → core/primitives}/switch/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/switch/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/switch/index.ts +0 -0
- /package/src/{primitives → core/primitives}/text/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/text/__workshop__/example.tsx +0 -0
- /package/src/{primitives → core/primitives}/text/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/text/__workshop__/opticalAlignment.tsx +0 -0
- /package/src/{primitives → core/primitives}/text/index.ts +0 -0
- /package/src/{primitives → core/primitives}/textArea/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/textArea/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/textArea/index.ts +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/clearButton.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/customValidity.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/index.ts +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/multipleTones.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/readOnly.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/tones.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/__workshop__/typed.tsx +0 -0
- /package/src/{primitives → core/primitives}/textInput/index.ts +0 -0
- /package/src/{primitives → core/primitives}/tooltip/__workshop__/.eslintrc +0 -0
- /package/src/{primitives → core/primitives}/tooltip/index.ts +0 -0
- /package/src/{primitives → core/primitives}/tooltip/tooltipDelayGroup/index.ts +0 -0
- /package/src/{primitives → core/primitives}/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +0 -0
- /package/src/{primitives → core/primitives}/tooltip/tooltipDelayGroup/types.ts +0 -0
- /package/src/{primitives → core/primitives}/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +0 -0
- /package/src/{styles → core/styles}/border/index.ts +0 -0
- /package/src/{styles → core/styles}/border/types.ts +0 -0
- /package/src/{styles → core/styles}/box/index.ts +0 -0
- /package/src/{styles → core/styles}/box/types.ts +0 -0
- /package/src/{styles → core/styles}/flex/index.ts +0 -0
- /package/src/{styles → core/styles}/flex/types.ts +0 -0
- /package/src/{styles → core/styles}/font/index.ts +0 -0
- /package/src/{styles → core/styles}/grid/index.ts +0 -0
- /package/src/{styles → core/styles}/grid/types.ts +0 -0
- /package/src/{styles → core/styles}/index.ts +0 -0
- /package/src/{styles → core/styles}/input/index.ts +0 -0
- /package/src/{styles → core/styles}/internal.ts +0 -0
- /package/src/{styles → core/styles}/margin/index.ts +0 -0
- /package/src/{styles → core/styles}/margin/types.ts +0 -0
- /package/src/{styles → core/styles}/padding/index.ts +0 -0
- /package/src/{styles → core/styles}/padding/types.ts +0 -0
- /package/src/{styles → core/styles}/radius/index.ts +0 -0
- /package/src/{styles → core/styles}/radius/types.ts +0 -0
- /package/src/{styles → core/styles}/shadow/index.ts +0 -0
- /package/src/{styles → core/styles}/shadow/types.ts +0 -0
- /package/src/{theme → core/theme}/__workshop__/.eslintrc +0 -0
- /package/src/{theme → core/theme}/__workshop__/layer.tsx +0 -0
- /package/src/{theme → core/theme}/__workshop__/nestedProvider.tsx +0 -0
- /package/src/{types → core/types}/box.ts +0 -0
- /package/src/{types → core/types}/dialog.ts +0 -0
- /package/src/{types → core/types}/flex.ts +0 -0
- /package/src/{types → core/types}/grid.ts +0 -0
- /package/src/{types → core/types}/gridItem.ts +0 -0
- /package/src/{types → core/types}/placement.ts +0 -0
- /package/src/{types → core/types}/popover.ts +0 -0
- /package/src/{types → core/types}/radius.ts +0 -0
- /package/src/{types → core/types}/text.ts +0 -0
- /package/src/{utils → core/utils}/boundaryElement/__workshop__/.eslintrc +0 -0
- /package/src/{utils → core/utils}/boundaryElement/__workshop__/index.ts +0 -0
- /package/src/{utils → core/utils}/boundaryElement/boundaryElementContext.ts +0 -0
- /package/src/{utils → core/utils}/boundaryElement/boundaryElementProvider.tsx +0 -0
- /package/src/{utils → core/utils}/boundaryElement/index.ts +0 -0
- /package/src/{utils → core/utils}/boundaryElement/types.ts +0 -0
- /package/src/{utils → core/utils}/boundaryElement/useBoundaryElement.ts +0 -0
- /package/src/{utils → core/utils}/elementQuery/__workshop__/.eslintrc +0 -0
- /package/src/{utils → core/utils}/elementQuery/__workshop__/index.ts +0 -0
- /package/src/{utils → core/utils}/elementQuery/helpers.ts +0 -0
- /package/src/{utils → core/utils}/elementQuery/index.ts +0 -0
- /package/src/{utils → core/utils}/errorBoundary.tsx +0 -0
- /package/src/{utils → core/utils}/layer/__workshop__/.eslintrc +0 -0
- /package/src/{utils → core/utils}/layer/__workshop__/index.ts +0 -0
- /package/src/{utils → core/utils}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/{utils → core/utils}/layer/__workshop__/nested.tsx +0 -0
- /package/src/{utils → core/utils}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/{utils → core/utils}/layer/getLayerContext.test.ts +0 -0
- /package/src/{utils → core/utils}/layer/getLayerContext.ts +0 -0
- /package/src/{utils → core/utils}/layer/index.ts +0 -0
- /package/src/{utils → core/utils}/layer/layer.tsx +0 -0
- /package/src/{utils → core/utils}/layer/layerContext.ts +0 -0
- /package/src/{utils → core/utils}/layer/layerProvider.tsx +0 -0
- /package/src/{utils → core/utils}/layer/types.ts +0 -0
- /package/src/{utils → core/utils}/layer/useLayer.ts +0 -0
- /package/src/{utils → core/utils}/portal/__workshop__/.eslintrc +0 -0
- /package/src/{utils → core/utils}/portal/__workshop__/index.ts +0 -0
- /package/src/{utils → core/utils}/portal/index.ts +0 -0
- /package/src/{utils → core/utils}/portal/portal.ts +0 -0
- /package/src/{utils → core/utils}/portal/portalContext.ts +0 -0
- /package/src/{utils → core/utils}/portal/portalProvider.tsx +0 -0
- /package/src/{utils → core/utils}/portal/types.ts +0 -0
- /package/src/{utils → core/utils}/portal/usePortal.ts +0 -0
- /package/src/{utils → core/utils}/srOnly/index.ts +0 -0
- /package/src/{utils → core/utils}/srOnly/srOnly.tsx +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/.eslintrc +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/index.ts +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/{utils → core/utils}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/{utils → core/utils}/virtualList/index.ts +0 -0
- /package/src/theme/{lib → build/lib}/color-fns/parse.ts +0 -0
- /package/src/theme/{lib → build/lib}/color-fns/types.ts +0 -0
- /package/src/theme/{lib/theme/fonts.ts → system/font.ts} +0 -0
|
@@ -0,0 +1,4345 @@
|
|
|
1
|
+
import { COLOR_HUES, COLOR_TINTS, color } from '@sanity/color';
|
|
2
|
+
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
3
|
+
return {
|
|
4
|
+
default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
|
|
5
|
+
primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
|
|
6
|
+
positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
|
|
7
|
+
caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
|
|
8
|
+
critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
12
|
+
return {
|
|
13
|
+
enabled: opts.selectable({
|
|
14
|
+
base,
|
|
15
|
+
dark,
|
|
16
|
+
solid,
|
|
17
|
+
muted,
|
|
18
|
+
state: "enabled",
|
|
19
|
+
tone
|
|
20
|
+
}),
|
|
21
|
+
hovered: opts.selectable({
|
|
22
|
+
base,
|
|
23
|
+
dark,
|
|
24
|
+
solid,
|
|
25
|
+
muted,
|
|
26
|
+
state: "hovered",
|
|
27
|
+
tone
|
|
28
|
+
}),
|
|
29
|
+
pressed: opts.selectable({
|
|
30
|
+
base,
|
|
31
|
+
dark,
|
|
32
|
+
solid,
|
|
33
|
+
muted,
|
|
34
|
+
state: "pressed",
|
|
35
|
+
tone
|
|
36
|
+
}),
|
|
37
|
+
selected: opts.selectable({
|
|
38
|
+
base,
|
|
39
|
+
dark,
|
|
40
|
+
solid,
|
|
41
|
+
muted,
|
|
42
|
+
state: "selected",
|
|
43
|
+
tone
|
|
44
|
+
}),
|
|
45
|
+
disabled: opts.selectable({
|
|
46
|
+
base,
|
|
47
|
+
dark,
|
|
48
|
+
solid,
|
|
49
|
+
muted,
|
|
50
|
+
state: "disabled",
|
|
51
|
+
tone
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function createSolidTones(opts, base, dark, name) {
|
|
56
|
+
return {
|
|
57
|
+
default: {
|
|
58
|
+
enabled: opts.solid({
|
|
59
|
+
base,
|
|
60
|
+
dark,
|
|
61
|
+
tone: "default",
|
|
62
|
+
name,
|
|
63
|
+
state: "enabled"
|
|
64
|
+
}),
|
|
65
|
+
disabled: opts.solid({
|
|
66
|
+
base,
|
|
67
|
+
dark,
|
|
68
|
+
tone: "default",
|
|
69
|
+
name,
|
|
70
|
+
state: "disabled"
|
|
71
|
+
}),
|
|
72
|
+
hovered: opts.solid({
|
|
73
|
+
base,
|
|
74
|
+
dark,
|
|
75
|
+
tone: "default",
|
|
76
|
+
name,
|
|
77
|
+
state: "hovered"
|
|
78
|
+
}),
|
|
79
|
+
pressed: opts.solid({
|
|
80
|
+
base,
|
|
81
|
+
dark,
|
|
82
|
+
tone: "default",
|
|
83
|
+
name,
|
|
84
|
+
state: "pressed"
|
|
85
|
+
}),
|
|
86
|
+
selected: opts.solid({
|
|
87
|
+
base,
|
|
88
|
+
dark,
|
|
89
|
+
tone: "default",
|
|
90
|
+
name,
|
|
91
|
+
state: "selected"
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
transparent: {
|
|
95
|
+
enabled: opts.solid({
|
|
96
|
+
base,
|
|
97
|
+
dark,
|
|
98
|
+
tone: "transparent",
|
|
99
|
+
name,
|
|
100
|
+
state: "enabled"
|
|
101
|
+
}),
|
|
102
|
+
disabled: opts.solid({
|
|
103
|
+
base,
|
|
104
|
+
dark,
|
|
105
|
+
tone: "transparent",
|
|
106
|
+
name,
|
|
107
|
+
state: "disabled"
|
|
108
|
+
}),
|
|
109
|
+
hovered: opts.solid({
|
|
110
|
+
base,
|
|
111
|
+
dark,
|
|
112
|
+
tone: "transparent",
|
|
113
|
+
name,
|
|
114
|
+
state: "hovered"
|
|
115
|
+
}),
|
|
116
|
+
pressed: opts.solid({
|
|
117
|
+
base,
|
|
118
|
+
dark,
|
|
119
|
+
tone: "transparent",
|
|
120
|
+
name,
|
|
121
|
+
state: "pressed"
|
|
122
|
+
}),
|
|
123
|
+
selected: opts.solid({
|
|
124
|
+
base,
|
|
125
|
+
dark,
|
|
126
|
+
tone: "transparent",
|
|
127
|
+
name,
|
|
128
|
+
state: "selected"
|
|
129
|
+
})
|
|
130
|
+
},
|
|
131
|
+
primary: {
|
|
132
|
+
enabled: opts.solid({
|
|
133
|
+
base,
|
|
134
|
+
dark,
|
|
135
|
+
tone: "primary",
|
|
136
|
+
name,
|
|
137
|
+
state: "enabled"
|
|
138
|
+
}),
|
|
139
|
+
disabled: opts.solid({
|
|
140
|
+
base,
|
|
141
|
+
dark,
|
|
142
|
+
tone: "primary",
|
|
143
|
+
name,
|
|
144
|
+
state: "disabled"
|
|
145
|
+
}),
|
|
146
|
+
hovered: opts.solid({
|
|
147
|
+
base,
|
|
148
|
+
dark,
|
|
149
|
+
tone: "primary",
|
|
150
|
+
name,
|
|
151
|
+
state: "hovered"
|
|
152
|
+
}),
|
|
153
|
+
pressed: opts.solid({
|
|
154
|
+
base,
|
|
155
|
+
dark,
|
|
156
|
+
tone: "primary",
|
|
157
|
+
name,
|
|
158
|
+
state: "pressed"
|
|
159
|
+
}),
|
|
160
|
+
selected: opts.solid({
|
|
161
|
+
base,
|
|
162
|
+
dark,
|
|
163
|
+
tone: "primary",
|
|
164
|
+
name,
|
|
165
|
+
state: "selected"
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
positive: {
|
|
169
|
+
enabled: opts.solid({
|
|
170
|
+
base,
|
|
171
|
+
dark,
|
|
172
|
+
tone: "positive",
|
|
173
|
+
name,
|
|
174
|
+
state: "enabled"
|
|
175
|
+
}),
|
|
176
|
+
disabled: opts.solid({
|
|
177
|
+
base,
|
|
178
|
+
dark,
|
|
179
|
+
tone: "positive",
|
|
180
|
+
name,
|
|
181
|
+
state: "disabled"
|
|
182
|
+
}),
|
|
183
|
+
hovered: opts.solid({
|
|
184
|
+
base,
|
|
185
|
+
dark,
|
|
186
|
+
tone: "positive",
|
|
187
|
+
name,
|
|
188
|
+
state: "hovered"
|
|
189
|
+
}),
|
|
190
|
+
pressed: opts.solid({
|
|
191
|
+
base,
|
|
192
|
+
dark,
|
|
193
|
+
tone: "positive",
|
|
194
|
+
name,
|
|
195
|
+
state: "pressed"
|
|
196
|
+
}),
|
|
197
|
+
selected: opts.solid({
|
|
198
|
+
base,
|
|
199
|
+
dark,
|
|
200
|
+
tone: "positive",
|
|
201
|
+
name,
|
|
202
|
+
state: "selected"
|
|
203
|
+
})
|
|
204
|
+
},
|
|
205
|
+
caution: {
|
|
206
|
+
enabled: opts.solid({
|
|
207
|
+
base,
|
|
208
|
+
dark,
|
|
209
|
+
tone: "caution",
|
|
210
|
+
name,
|
|
211
|
+
state: "enabled"
|
|
212
|
+
}),
|
|
213
|
+
disabled: opts.solid({
|
|
214
|
+
base,
|
|
215
|
+
dark,
|
|
216
|
+
tone: "caution",
|
|
217
|
+
name,
|
|
218
|
+
state: "disabled"
|
|
219
|
+
}),
|
|
220
|
+
hovered: opts.solid({
|
|
221
|
+
base,
|
|
222
|
+
dark,
|
|
223
|
+
tone: "caution",
|
|
224
|
+
name,
|
|
225
|
+
state: "hovered"
|
|
226
|
+
}),
|
|
227
|
+
pressed: opts.solid({
|
|
228
|
+
base,
|
|
229
|
+
dark,
|
|
230
|
+
tone: "caution",
|
|
231
|
+
name,
|
|
232
|
+
state: "pressed"
|
|
233
|
+
}),
|
|
234
|
+
selected: opts.solid({
|
|
235
|
+
base,
|
|
236
|
+
dark,
|
|
237
|
+
tone: "caution",
|
|
238
|
+
name,
|
|
239
|
+
state: "selected"
|
|
240
|
+
})
|
|
241
|
+
},
|
|
242
|
+
critical: {
|
|
243
|
+
enabled: opts.solid({
|
|
244
|
+
base,
|
|
245
|
+
dark,
|
|
246
|
+
tone: "critical",
|
|
247
|
+
name,
|
|
248
|
+
state: "enabled"
|
|
249
|
+
}),
|
|
250
|
+
disabled: opts.solid({
|
|
251
|
+
base,
|
|
252
|
+
dark,
|
|
253
|
+
tone: "critical",
|
|
254
|
+
name,
|
|
255
|
+
state: "disabled"
|
|
256
|
+
}),
|
|
257
|
+
hovered: opts.solid({
|
|
258
|
+
base,
|
|
259
|
+
dark,
|
|
260
|
+
tone: "critical",
|
|
261
|
+
name,
|
|
262
|
+
state: "hovered"
|
|
263
|
+
}),
|
|
264
|
+
pressed: opts.solid({
|
|
265
|
+
base,
|
|
266
|
+
dark,
|
|
267
|
+
tone: "critical",
|
|
268
|
+
name,
|
|
269
|
+
state: "pressed"
|
|
270
|
+
}),
|
|
271
|
+
selected: opts.solid({
|
|
272
|
+
base,
|
|
273
|
+
dark,
|
|
274
|
+
tone: "critical",
|
|
275
|
+
name,
|
|
276
|
+
state: "selected"
|
|
277
|
+
})
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
282
|
+
return {
|
|
283
|
+
default: opts.button({
|
|
284
|
+
base,
|
|
285
|
+
dark,
|
|
286
|
+
solid: solid.default,
|
|
287
|
+
muted: muted.default,
|
|
288
|
+
mode
|
|
289
|
+
}),
|
|
290
|
+
primary: opts.button({
|
|
291
|
+
base,
|
|
292
|
+
dark,
|
|
293
|
+
solid: solid.primary,
|
|
294
|
+
muted: muted.primary,
|
|
295
|
+
mode
|
|
296
|
+
}),
|
|
297
|
+
positive: opts.button({
|
|
298
|
+
base,
|
|
299
|
+
dark,
|
|
300
|
+
solid: solid.positive,
|
|
301
|
+
muted: muted.positive,
|
|
302
|
+
mode
|
|
303
|
+
}),
|
|
304
|
+
caution: opts.button({
|
|
305
|
+
base,
|
|
306
|
+
dark,
|
|
307
|
+
solid: solid.caution,
|
|
308
|
+
muted: muted.caution,
|
|
309
|
+
mode
|
|
310
|
+
}),
|
|
311
|
+
critical: opts.button({
|
|
312
|
+
base,
|
|
313
|
+
dark,
|
|
314
|
+
solid: solid.critical,
|
|
315
|
+
muted: muted.critical,
|
|
316
|
+
mode
|
|
317
|
+
})
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function createButtonModes(opts, base, dark, solid, muted) {
|
|
321
|
+
return {
|
|
322
|
+
default: createButtonTones(opts, base, dark, solid, muted, "default"),
|
|
323
|
+
ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
|
|
324
|
+
bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function createCardStates(opts, base, dark, name, solid, muted) {
|
|
328
|
+
return {
|
|
329
|
+
enabled: opts.card({
|
|
330
|
+
base,
|
|
331
|
+
dark,
|
|
332
|
+
name,
|
|
333
|
+
state: "enabled",
|
|
334
|
+
solid,
|
|
335
|
+
muted
|
|
336
|
+
}),
|
|
337
|
+
disabled: opts.card({
|
|
338
|
+
base,
|
|
339
|
+
dark,
|
|
340
|
+
name,
|
|
341
|
+
state: "disabled",
|
|
342
|
+
solid,
|
|
343
|
+
muted
|
|
344
|
+
}),
|
|
345
|
+
hovered: opts.card({
|
|
346
|
+
base,
|
|
347
|
+
dark,
|
|
348
|
+
name,
|
|
349
|
+
state: "hovered",
|
|
350
|
+
solid,
|
|
351
|
+
muted
|
|
352
|
+
}),
|
|
353
|
+
pressed: opts.card({
|
|
354
|
+
base,
|
|
355
|
+
dark,
|
|
356
|
+
name,
|
|
357
|
+
state: "pressed",
|
|
358
|
+
solid,
|
|
359
|
+
muted
|
|
360
|
+
}),
|
|
361
|
+
selected: opts.card({
|
|
362
|
+
base,
|
|
363
|
+
dark,
|
|
364
|
+
name,
|
|
365
|
+
state: "selected",
|
|
366
|
+
solid,
|
|
367
|
+
muted
|
|
368
|
+
})
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
const black = "hsl(0, 0%, 0%)";
|
|
372
|
+
const white = "hsl(0, 0%, 100%)";
|
|
373
|
+
const colors = {
|
|
374
|
+
default: {
|
|
375
|
+
lightest: "hsl(0, 0%, 95%)",
|
|
376
|
+
lighter: "hsl(0, 0%, 70%)",
|
|
377
|
+
light: "hsl(0, 0%, 65%)",
|
|
378
|
+
base: "hsl(0, 0%, 50%)",
|
|
379
|
+
dark: "hsl(0, 0%, 35%)",
|
|
380
|
+
darker: "hsl(0, 0%, 20%)",
|
|
381
|
+
darkest: "hsl(0, 0%, 5%)"
|
|
382
|
+
},
|
|
383
|
+
transparent: {
|
|
384
|
+
lightest: "hsl(240, 100%, 95%)",
|
|
385
|
+
lighter: "hsl(240, 100%, 70%)",
|
|
386
|
+
light: "hsl(240, 100%, 65%)",
|
|
387
|
+
base: "hsl(240, 100%, 50%)",
|
|
388
|
+
dark: "hsl(240, 100%, 35%)",
|
|
389
|
+
darker: "hsl(240, 100%, 20%)",
|
|
390
|
+
darkest: "hsl(240, 100%, 5%)"
|
|
391
|
+
},
|
|
392
|
+
primary: {
|
|
393
|
+
lightest: "hsl(240, 100%, 95%)",
|
|
394
|
+
lighter: "hsl(240, 100%, 70%)",
|
|
395
|
+
light: "hsl(240, 100%, 65%)",
|
|
396
|
+
base: "hsl(240, 100%, 50%)",
|
|
397
|
+
dark: "hsl(240, 100%, 35%)",
|
|
398
|
+
darker: "hsl(240, 100%, 20%)",
|
|
399
|
+
darkest: "hsl(240, 100%, 5%)"
|
|
400
|
+
},
|
|
401
|
+
positive: {
|
|
402
|
+
lightest: "hsl(120, 100%, 95%)",
|
|
403
|
+
lighter: "hsl(120, 100%, 70%)",
|
|
404
|
+
light: "hsl(120, 100%, 65%)",
|
|
405
|
+
base: "hsl(120, 100%, 50%)",
|
|
406
|
+
dark: "hsl(120, 100%, 35%)",
|
|
407
|
+
darker: "hsl(120, 100%, 20%)",
|
|
408
|
+
darkest: "hsl(120, 100%, 5%)"
|
|
409
|
+
},
|
|
410
|
+
caution: {
|
|
411
|
+
lightest: "hsl(60, 100%, 95%)",
|
|
412
|
+
lighter: "hsl(60, 100%, 70%)",
|
|
413
|
+
light: "hsl(60, 100%, 65%)",
|
|
414
|
+
base: "hsl(60, 100%, 50%)",
|
|
415
|
+
dark: "hsl(60, 100%, 35%)",
|
|
416
|
+
darker: "hsl(60, 100%, 20%)",
|
|
417
|
+
darkest: "hsl(60, 100%, 5%)"
|
|
418
|
+
},
|
|
419
|
+
critical: {
|
|
420
|
+
lightest: "hsl(0, 100%, 95%)",
|
|
421
|
+
lighter: "hsl(0, 100%, 70%)",
|
|
422
|
+
light: "hsl(0, 100%, 65%)",
|
|
423
|
+
base: "hsl(0, 100%, 50%)",
|
|
424
|
+
dark: "hsl(0, 100%, 35%)",
|
|
425
|
+
darker: "hsl(0, 100%, 20%)",
|
|
426
|
+
darkest: "hsl(0, 100%, 5%)"
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
const spots = {
|
|
430
|
+
gray: "hsl(0, 0%, 50%)",
|
|
431
|
+
red: "hsl(0, 100%, 50%)",
|
|
432
|
+
orange: "hsl(30, 100%, 50%)",
|
|
433
|
+
yellow: "hsl(60, 100%, 50%)",
|
|
434
|
+
green: "hsl(120, 100%, 50%)",
|
|
435
|
+
cyan: "hsl(180, 100%, 50%)",
|
|
436
|
+
blue: "hsl(240, 100%, 50%)",
|
|
437
|
+
purple: "hsl(270, 100%, 50%)",
|
|
438
|
+
magenta: "hsl(300, 100%, 50%)"
|
|
439
|
+
};
|
|
440
|
+
const tones = {
|
|
441
|
+
transparent: {
|
|
442
|
+
bg: [colors.transparent.darkest, colors.transparent.lightest],
|
|
443
|
+
fg: [colors.transparent.lightest, colors.transparent.darkest],
|
|
444
|
+
border: [colors.transparent.darker, colors.transparent.lighter],
|
|
445
|
+
focusRing: [colors.transparent.base, colors.transparent.base]
|
|
446
|
+
},
|
|
447
|
+
primary: {
|
|
448
|
+
bg: [colors.primary.darkest, colors.primary.lightest],
|
|
449
|
+
fg: [colors.primary.lightest, colors.primary.darkest],
|
|
450
|
+
border: [colors.primary.darker, colors.primary.lighter],
|
|
451
|
+
focusRing: [colors.primary.base, colors.primary.base]
|
|
452
|
+
},
|
|
453
|
+
positive: {
|
|
454
|
+
bg: [colors.positive.darkest, colors.positive.lightest],
|
|
455
|
+
fg: [colors.positive.lightest, colors.positive.darkest],
|
|
456
|
+
border: [colors.positive.darker, colors.positive.lighter],
|
|
457
|
+
focusRing: [colors.positive.base, colors.positive.base]
|
|
458
|
+
},
|
|
459
|
+
caution: {
|
|
460
|
+
bg: [colors.caution.darkest, colors.caution.lightest],
|
|
461
|
+
fg: [colors.caution.lightest, colors.caution.darkest],
|
|
462
|
+
border: [colors.caution.darker, colors.caution.lighter],
|
|
463
|
+
focusRing: [colors.caution.base, colors.caution.base]
|
|
464
|
+
},
|
|
465
|
+
critical: {
|
|
466
|
+
bg: [colors.critical.darkest, colors.critical.lightest],
|
|
467
|
+
fg: [colors.critical.lightest, colors.critical.darkest],
|
|
468
|
+
border: [colors.critical.darker, colors.critical.lighter],
|
|
469
|
+
focusRing: [colors.critical.base, colors.critical.base]
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const defaultOpts = {
|
|
473
|
+
base: _ref => {
|
|
474
|
+
let {
|
|
475
|
+
dark,
|
|
476
|
+
name
|
|
477
|
+
} = _ref;
|
|
478
|
+
if (name === "default") {
|
|
479
|
+
return {
|
|
480
|
+
bg: dark ? black : white,
|
|
481
|
+
fg: dark ? white : black,
|
|
482
|
+
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
483
|
+
focusRing: colors.primary.base,
|
|
484
|
+
shadow: {
|
|
485
|
+
outline: black,
|
|
486
|
+
umbra: black,
|
|
487
|
+
penumbra: black,
|
|
488
|
+
ambient: black
|
|
489
|
+
},
|
|
490
|
+
skeleton: {
|
|
491
|
+
from: dark ? white : black,
|
|
492
|
+
to: dark ? white : black
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
return {
|
|
497
|
+
bg: tones[name].bg[dark ? 0 : 1],
|
|
498
|
+
fg: tones[name].fg[dark ? 0 : 1],
|
|
499
|
+
border: tones[name].border[dark ? 0 : 1],
|
|
500
|
+
focusRing: tones[name].focusRing[dark ? 0 : 1],
|
|
501
|
+
shadow: {
|
|
502
|
+
outline: black,
|
|
503
|
+
umbra: black,
|
|
504
|
+
penumbra: black,
|
|
505
|
+
ambient: black
|
|
506
|
+
},
|
|
507
|
+
skeleton: {
|
|
508
|
+
from: dark ? white : black,
|
|
509
|
+
to: dark ? white : black
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
},
|
|
513
|
+
solid: _ref2 => {
|
|
514
|
+
let {
|
|
515
|
+
base,
|
|
516
|
+
dark,
|
|
517
|
+
state,
|
|
518
|
+
tone
|
|
519
|
+
} = _ref2;
|
|
520
|
+
const color = colors[tone];
|
|
521
|
+
if (state === "hovered") {
|
|
522
|
+
return {
|
|
523
|
+
bg: dark ? color.light : color.dark,
|
|
524
|
+
bg2: dark ? color.light : color.dark,
|
|
525
|
+
border: dark ? color.lighter : color.darker,
|
|
526
|
+
fg: dark ? color.darkest : color.lightest,
|
|
527
|
+
icon: dark ? color.darkest : color.lightest,
|
|
528
|
+
muted: {
|
|
529
|
+
fg: black
|
|
530
|
+
},
|
|
531
|
+
accent: {
|
|
532
|
+
fg: black
|
|
533
|
+
},
|
|
534
|
+
link: {
|
|
535
|
+
fg: black
|
|
536
|
+
},
|
|
537
|
+
code: {
|
|
538
|
+
bg: black,
|
|
539
|
+
fg: black
|
|
540
|
+
},
|
|
541
|
+
skeleton: base.skeleton
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
return {
|
|
545
|
+
bg: color.base,
|
|
546
|
+
bg2: color.base,
|
|
547
|
+
border: dark ? color.light : color.dark,
|
|
548
|
+
fg: dark ? color.darkest : color.lightest,
|
|
549
|
+
icon: dark ? color.darkest : color.lightest,
|
|
550
|
+
muted: {
|
|
551
|
+
fg: black
|
|
552
|
+
},
|
|
553
|
+
accent: {
|
|
554
|
+
fg: black
|
|
555
|
+
},
|
|
556
|
+
link: {
|
|
557
|
+
fg: black
|
|
558
|
+
},
|
|
559
|
+
code: {
|
|
560
|
+
bg: black,
|
|
561
|
+
fg: black
|
|
562
|
+
},
|
|
563
|
+
skeleton: base.skeleton
|
|
564
|
+
};
|
|
565
|
+
},
|
|
566
|
+
muted: _ref3 => {
|
|
567
|
+
let {
|
|
568
|
+
base,
|
|
569
|
+
dark,
|
|
570
|
+
state,
|
|
571
|
+
tone
|
|
572
|
+
} = _ref3;
|
|
573
|
+
const color = colors[tone];
|
|
574
|
+
if (state === "hovered") {
|
|
575
|
+
return {
|
|
576
|
+
bg: dark ? color.darker : color.lighter,
|
|
577
|
+
bg2: dark ? color.darker : color.lighter,
|
|
578
|
+
border: dark ? color.lighter : color.darker,
|
|
579
|
+
fg: dark ? color.lightest : color.darkest,
|
|
580
|
+
icon: dark ? color.lightest : color.darkest,
|
|
581
|
+
muted: {
|
|
582
|
+
fg: black
|
|
583
|
+
},
|
|
584
|
+
accent: {
|
|
585
|
+
fg: black
|
|
586
|
+
},
|
|
587
|
+
link: {
|
|
588
|
+
fg: black
|
|
589
|
+
},
|
|
590
|
+
code: {
|
|
591
|
+
bg: black,
|
|
592
|
+
fg: black
|
|
593
|
+
},
|
|
594
|
+
skeleton: base.skeleton
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
bg: dark ? color.darkest : color.lightest,
|
|
599
|
+
bg2: dark ? color.darkest : color.lightest,
|
|
600
|
+
border: dark ? color.darker : color.lighter,
|
|
601
|
+
fg: dark ? color.lighter : color.darker,
|
|
602
|
+
icon: dark ? color.lighter : color.darker,
|
|
603
|
+
muted: {
|
|
604
|
+
fg: black
|
|
605
|
+
},
|
|
606
|
+
accent: {
|
|
607
|
+
fg: black
|
|
608
|
+
},
|
|
609
|
+
link: {
|
|
610
|
+
fg: black
|
|
611
|
+
},
|
|
612
|
+
code: {
|
|
613
|
+
bg: black,
|
|
614
|
+
fg: black
|
|
615
|
+
},
|
|
616
|
+
skeleton: base.skeleton
|
|
617
|
+
};
|
|
618
|
+
},
|
|
619
|
+
button: _ref4 => {
|
|
620
|
+
let {
|
|
621
|
+
base,
|
|
622
|
+
mode,
|
|
623
|
+
muted,
|
|
624
|
+
solid
|
|
625
|
+
} = _ref4;
|
|
626
|
+
if (mode === "bleed") {
|
|
627
|
+
return {
|
|
628
|
+
...muted,
|
|
629
|
+
enabled: {
|
|
630
|
+
bg: "transparent",
|
|
631
|
+
bg2: "transparent",
|
|
632
|
+
fg: muted.enabled.fg,
|
|
633
|
+
icon: muted.enabled.fg,
|
|
634
|
+
border: "transparent",
|
|
635
|
+
muted: {
|
|
636
|
+
fg: black
|
|
637
|
+
},
|
|
638
|
+
accent: {
|
|
639
|
+
fg: black
|
|
640
|
+
},
|
|
641
|
+
link: {
|
|
642
|
+
fg: black
|
|
643
|
+
},
|
|
644
|
+
code: {
|
|
645
|
+
bg: black,
|
|
646
|
+
fg: black
|
|
647
|
+
},
|
|
648
|
+
skeleton: base.skeleton
|
|
649
|
+
},
|
|
650
|
+
hovered: {
|
|
651
|
+
bg: muted.enabled.bg,
|
|
652
|
+
bg2: muted.enabled.bg,
|
|
653
|
+
fg: muted.hovered.fg,
|
|
654
|
+
icon: muted.hovered.fg,
|
|
655
|
+
border: "transparent",
|
|
656
|
+
muted: {
|
|
657
|
+
fg: black
|
|
658
|
+
},
|
|
659
|
+
accent: {
|
|
660
|
+
fg: black
|
|
661
|
+
},
|
|
662
|
+
link: {
|
|
663
|
+
fg: black
|
|
664
|
+
},
|
|
665
|
+
code: {
|
|
666
|
+
bg: black,
|
|
667
|
+
fg: black
|
|
668
|
+
},
|
|
669
|
+
skeleton: base.skeleton
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
if (mode === "ghost") return {
|
|
674
|
+
...solid,
|
|
675
|
+
enabled: muted.enabled
|
|
676
|
+
};
|
|
677
|
+
return solid;
|
|
678
|
+
},
|
|
679
|
+
card: _ref5 => {
|
|
680
|
+
let {
|
|
681
|
+
base
|
|
682
|
+
} = _ref5;
|
|
683
|
+
return {
|
|
684
|
+
bg: black,
|
|
685
|
+
bg2: black,
|
|
686
|
+
fg: black,
|
|
687
|
+
icon: black,
|
|
688
|
+
border: black,
|
|
689
|
+
muted: {
|
|
690
|
+
fg: black
|
|
691
|
+
},
|
|
692
|
+
accent: {
|
|
693
|
+
fg: black
|
|
694
|
+
},
|
|
695
|
+
link: {
|
|
696
|
+
fg: black
|
|
697
|
+
},
|
|
698
|
+
code: {
|
|
699
|
+
bg: black,
|
|
700
|
+
fg: black
|
|
701
|
+
},
|
|
702
|
+
skeleton: base.skeleton
|
|
703
|
+
};
|
|
704
|
+
},
|
|
705
|
+
input: () => {
|
|
706
|
+
return {
|
|
707
|
+
bg: black,
|
|
708
|
+
bg2: black,
|
|
709
|
+
fg: black,
|
|
710
|
+
border: black,
|
|
711
|
+
placeholder: black
|
|
712
|
+
};
|
|
713
|
+
},
|
|
714
|
+
selectable: _ref6 => {
|
|
715
|
+
let {
|
|
716
|
+
muted,
|
|
717
|
+
state,
|
|
718
|
+
tone
|
|
719
|
+
} = _ref6;
|
|
720
|
+
return muted[tone][state];
|
|
721
|
+
},
|
|
722
|
+
spot: _ref7 => {
|
|
723
|
+
let {
|
|
724
|
+
key
|
|
725
|
+
} = _ref7;
|
|
726
|
+
return spots[key];
|
|
727
|
+
},
|
|
728
|
+
syntax: () => ({
|
|
729
|
+
atrule: black,
|
|
730
|
+
attrName: black,
|
|
731
|
+
attrValue: black,
|
|
732
|
+
attribute: black,
|
|
733
|
+
boolean: black,
|
|
734
|
+
builtin: black,
|
|
735
|
+
cdata: black,
|
|
736
|
+
char: black,
|
|
737
|
+
class: black,
|
|
738
|
+
className: black,
|
|
739
|
+
comment: black,
|
|
740
|
+
constant: black,
|
|
741
|
+
deleted: black,
|
|
742
|
+
doctype: black,
|
|
743
|
+
entity: black,
|
|
744
|
+
function: black,
|
|
745
|
+
hexcode: black,
|
|
746
|
+
id: black,
|
|
747
|
+
important: black,
|
|
748
|
+
inserted: black,
|
|
749
|
+
keyword: black,
|
|
750
|
+
number: black,
|
|
751
|
+
operator: black,
|
|
752
|
+
prolog: black,
|
|
753
|
+
property: black,
|
|
754
|
+
pseudoClass: black,
|
|
755
|
+
pseudoElement: black,
|
|
756
|
+
punctuation: black,
|
|
757
|
+
regex: black,
|
|
758
|
+
selector: black,
|
|
759
|
+
string: black,
|
|
760
|
+
symbol: black,
|
|
761
|
+
tag: black,
|
|
762
|
+
unit: black,
|
|
763
|
+
url: black,
|
|
764
|
+
variable: black
|
|
765
|
+
})
|
|
766
|
+
};
|
|
767
|
+
function createInputModes(opts, base, dark, solid, muted) {
|
|
768
|
+
return {
|
|
769
|
+
default: {
|
|
770
|
+
enabled: opts.input({
|
|
771
|
+
base,
|
|
772
|
+
dark,
|
|
773
|
+
mode: "default",
|
|
774
|
+
state: "enabled",
|
|
775
|
+
solid: solid.default,
|
|
776
|
+
muted: muted.default
|
|
777
|
+
}),
|
|
778
|
+
disabled: opts.input({
|
|
779
|
+
base,
|
|
780
|
+
dark,
|
|
781
|
+
mode: "default",
|
|
782
|
+
state: "disabled",
|
|
783
|
+
solid: solid.default,
|
|
784
|
+
muted: muted.default
|
|
785
|
+
}),
|
|
786
|
+
hovered: opts.input({
|
|
787
|
+
base,
|
|
788
|
+
dark,
|
|
789
|
+
mode: "default",
|
|
790
|
+
state: "hovered",
|
|
791
|
+
solid: solid.default,
|
|
792
|
+
muted: muted.default
|
|
793
|
+
}),
|
|
794
|
+
readOnly: opts.input({
|
|
795
|
+
base,
|
|
796
|
+
dark,
|
|
797
|
+
mode: "default",
|
|
798
|
+
state: "readOnly",
|
|
799
|
+
solid: solid.default,
|
|
800
|
+
muted: muted.default
|
|
801
|
+
})
|
|
802
|
+
},
|
|
803
|
+
invalid: {
|
|
804
|
+
enabled: opts.input({
|
|
805
|
+
base,
|
|
806
|
+
dark,
|
|
807
|
+
mode: "invalid",
|
|
808
|
+
state: "enabled",
|
|
809
|
+
solid: solid.default,
|
|
810
|
+
muted: muted.default
|
|
811
|
+
}),
|
|
812
|
+
disabled: opts.input({
|
|
813
|
+
base,
|
|
814
|
+
dark,
|
|
815
|
+
mode: "invalid",
|
|
816
|
+
state: "disabled",
|
|
817
|
+
solid: solid.default,
|
|
818
|
+
muted: muted.default
|
|
819
|
+
}),
|
|
820
|
+
hovered: opts.input({
|
|
821
|
+
base,
|
|
822
|
+
dark,
|
|
823
|
+
mode: "invalid",
|
|
824
|
+
state: "hovered",
|
|
825
|
+
solid: solid.default,
|
|
826
|
+
muted: muted.default
|
|
827
|
+
}),
|
|
828
|
+
readOnly: opts.input({
|
|
829
|
+
base,
|
|
830
|
+
dark,
|
|
831
|
+
mode: "invalid",
|
|
832
|
+
state: "readOnly",
|
|
833
|
+
solid: solid.default,
|
|
834
|
+
muted: muted.default
|
|
835
|
+
})
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
function createMutedTones(opts, base, dark, name) {
|
|
840
|
+
return {
|
|
841
|
+
default: {
|
|
842
|
+
enabled: opts.muted({
|
|
843
|
+
base,
|
|
844
|
+
dark,
|
|
845
|
+
tone: "default",
|
|
846
|
+
name,
|
|
847
|
+
state: "enabled"
|
|
848
|
+
}),
|
|
849
|
+
disabled: opts.muted({
|
|
850
|
+
base,
|
|
851
|
+
dark,
|
|
852
|
+
tone: "default",
|
|
853
|
+
name,
|
|
854
|
+
state: "disabled"
|
|
855
|
+
}),
|
|
856
|
+
hovered: opts.muted({
|
|
857
|
+
base,
|
|
858
|
+
dark,
|
|
859
|
+
tone: "default",
|
|
860
|
+
name,
|
|
861
|
+
state: "hovered"
|
|
862
|
+
}),
|
|
863
|
+
pressed: opts.muted({
|
|
864
|
+
base,
|
|
865
|
+
dark,
|
|
866
|
+
tone: "default",
|
|
867
|
+
name,
|
|
868
|
+
state: "pressed"
|
|
869
|
+
}),
|
|
870
|
+
selected: opts.muted({
|
|
871
|
+
base,
|
|
872
|
+
dark,
|
|
873
|
+
tone: "default",
|
|
874
|
+
name,
|
|
875
|
+
state: "selected"
|
|
876
|
+
})
|
|
877
|
+
},
|
|
878
|
+
transparent: {
|
|
879
|
+
enabled: opts.muted({
|
|
880
|
+
base,
|
|
881
|
+
dark,
|
|
882
|
+
tone: "transparent",
|
|
883
|
+
name,
|
|
884
|
+
state: "enabled"
|
|
885
|
+
}),
|
|
886
|
+
disabled: opts.muted({
|
|
887
|
+
base,
|
|
888
|
+
dark,
|
|
889
|
+
tone: "transparent",
|
|
890
|
+
name,
|
|
891
|
+
state: "disabled"
|
|
892
|
+
}),
|
|
893
|
+
hovered: opts.muted({
|
|
894
|
+
base,
|
|
895
|
+
dark,
|
|
896
|
+
tone: "transparent",
|
|
897
|
+
name,
|
|
898
|
+
state: "hovered"
|
|
899
|
+
}),
|
|
900
|
+
pressed: opts.muted({
|
|
901
|
+
base,
|
|
902
|
+
dark,
|
|
903
|
+
tone: "transparent",
|
|
904
|
+
name,
|
|
905
|
+
state: "pressed"
|
|
906
|
+
}),
|
|
907
|
+
selected: opts.muted({
|
|
908
|
+
base,
|
|
909
|
+
dark,
|
|
910
|
+
tone: "transparent",
|
|
911
|
+
name,
|
|
912
|
+
state: "selected"
|
|
913
|
+
})
|
|
914
|
+
},
|
|
915
|
+
primary: {
|
|
916
|
+
enabled: opts.muted({
|
|
917
|
+
base,
|
|
918
|
+
dark,
|
|
919
|
+
tone: "primary",
|
|
920
|
+
name,
|
|
921
|
+
state: "enabled"
|
|
922
|
+
}),
|
|
923
|
+
disabled: opts.muted({
|
|
924
|
+
base,
|
|
925
|
+
dark,
|
|
926
|
+
tone: "primary",
|
|
927
|
+
name,
|
|
928
|
+
state: "disabled"
|
|
929
|
+
}),
|
|
930
|
+
hovered: opts.muted({
|
|
931
|
+
base,
|
|
932
|
+
dark,
|
|
933
|
+
tone: "primary",
|
|
934
|
+
name,
|
|
935
|
+
state: "hovered"
|
|
936
|
+
}),
|
|
937
|
+
pressed: opts.muted({
|
|
938
|
+
base,
|
|
939
|
+
dark,
|
|
940
|
+
tone: "primary",
|
|
941
|
+
name,
|
|
942
|
+
state: "pressed"
|
|
943
|
+
}),
|
|
944
|
+
selected: opts.muted({
|
|
945
|
+
base,
|
|
946
|
+
dark,
|
|
947
|
+
tone: "primary",
|
|
948
|
+
name,
|
|
949
|
+
state: "selected"
|
|
950
|
+
})
|
|
951
|
+
},
|
|
952
|
+
positive: {
|
|
953
|
+
enabled: opts.muted({
|
|
954
|
+
base,
|
|
955
|
+
dark,
|
|
956
|
+
tone: "positive",
|
|
957
|
+
name,
|
|
958
|
+
state: "enabled"
|
|
959
|
+
}),
|
|
960
|
+
disabled: opts.muted({
|
|
961
|
+
base,
|
|
962
|
+
dark,
|
|
963
|
+
tone: "positive",
|
|
964
|
+
name,
|
|
965
|
+
state: "disabled"
|
|
966
|
+
}),
|
|
967
|
+
hovered: opts.muted({
|
|
968
|
+
base,
|
|
969
|
+
dark,
|
|
970
|
+
tone: "positive",
|
|
971
|
+
name,
|
|
972
|
+
state: "hovered"
|
|
973
|
+
}),
|
|
974
|
+
pressed: opts.muted({
|
|
975
|
+
base,
|
|
976
|
+
dark,
|
|
977
|
+
tone: "positive",
|
|
978
|
+
name,
|
|
979
|
+
state: "pressed"
|
|
980
|
+
}),
|
|
981
|
+
selected: opts.muted({
|
|
982
|
+
base,
|
|
983
|
+
dark,
|
|
984
|
+
tone: "positive",
|
|
985
|
+
name,
|
|
986
|
+
state: "selected"
|
|
987
|
+
})
|
|
988
|
+
},
|
|
989
|
+
caution: {
|
|
990
|
+
enabled: opts.muted({
|
|
991
|
+
base,
|
|
992
|
+
dark,
|
|
993
|
+
tone: "caution",
|
|
994
|
+
name,
|
|
995
|
+
state: "enabled"
|
|
996
|
+
}),
|
|
997
|
+
disabled: opts.muted({
|
|
998
|
+
base,
|
|
999
|
+
dark,
|
|
1000
|
+
tone: "caution",
|
|
1001
|
+
name,
|
|
1002
|
+
state: "disabled"
|
|
1003
|
+
}),
|
|
1004
|
+
hovered: opts.muted({
|
|
1005
|
+
base,
|
|
1006
|
+
dark,
|
|
1007
|
+
tone: "caution",
|
|
1008
|
+
name,
|
|
1009
|
+
state: "hovered"
|
|
1010
|
+
}),
|
|
1011
|
+
pressed: opts.muted({
|
|
1012
|
+
base,
|
|
1013
|
+
dark,
|
|
1014
|
+
tone: "caution",
|
|
1015
|
+
name,
|
|
1016
|
+
state: "pressed"
|
|
1017
|
+
}),
|
|
1018
|
+
selected: opts.muted({
|
|
1019
|
+
base,
|
|
1020
|
+
dark,
|
|
1021
|
+
tone: "caution",
|
|
1022
|
+
name,
|
|
1023
|
+
state: "selected"
|
|
1024
|
+
})
|
|
1025
|
+
},
|
|
1026
|
+
critical: {
|
|
1027
|
+
enabled: opts.muted({
|
|
1028
|
+
base,
|
|
1029
|
+
dark,
|
|
1030
|
+
tone: "critical",
|
|
1031
|
+
name,
|
|
1032
|
+
state: "enabled"
|
|
1033
|
+
}),
|
|
1034
|
+
disabled: opts.muted({
|
|
1035
|
+
base,
|
|
1036
|
+
dark,
|
|
1037
|
+
tone: "critical",
|
|
1038
|
+
name,
|
|
1039
|
+
state: "disabled"
|
|
1040
|
+
}),
|
|
1041
|
+
hovered: opts.muted({
|
|
1042
|
+
base,
|
|
1043
|
+
dark,
|
|
1044
|
+
tone: "critical",
|
|
1045
|
+
name,
|
|
1046
|
+
state: "hovered"
|
|
1047
|
+
}),
|
|
1048
|
+
pressed: opts.muted({
|
|
1049
|
+
base,
|
|
1050
|
+
dark,
|
|
1051
|
+
tone: "critical",
|
|
1052
|
+
name,
|
|
1053
|
+
state: "pressed"
|
|
1054
|
+
}),
|
|
1055
|
+
selected: opts.muted({
|
|
1056
|
+
base,
|
|
1057
|
+
dark,
|
|
1058
|
+
tone: "critical",
|
|
1059
|
+
name,
|
|
1060
|
+
state: "selected"
|
|
1061
|
+
})
|
|
1062
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
function createSpot(opts, base, dark) {
|
|
1066
|
+
return {
|
|
1067
|
+
gray: opts.spot({
|
|
1068
|
+
base,
|
|
1069
|
+
dark,
|
|
1070
|
+
key: "gray"
|
|
1071
|
+
}),
|
|
1072
|
+
blue: opts.spot({
|
|
1073
|
+
base,
|
|
1074
|
+
dark,
|
|
1075
|
+
key: "blue"
|
|
1076
|
+
}),
|
|
1077
|
+
purple: opts.spot({
|
|
1078
|
+
base,
|
|
1079
|
+
dark,
|
|
1080
|
+
key: "purple"
|
|
1081
|
+
}),
|
|
1082
|
+
magenta: opts.spot({
|
|
1083
|
+
base,
|
|
1084
|
+
dark,
|
|
1085
|
+
key: "magenta"
|
|
1086
|
+
}),
|
|
1087
|
+
red: opts.spot({
|
|
1088
|
+
base,
|
|
1089
|
+
dark,
|
|
1090
|
+
key: "red"
|
|
1091
|
+
}),
|
|
1092
|
+
orange: opts.spot({
|
|
1093
|
+
base,
|
|
1094
|
+
dark,
|
|
1095
|
+
key: "orange"
|
|
1096
|
+
}),
|
|
1097
|
+
yellow: opts.spot({
|
|
1098
|
+
base,
|
|
1099
|
+
dark,
|
|
1100
|
+
key: "yellow"
|
|
1101
|
+
}),
|
|
1102
|
+
green: opts.spot({
|
|
1103
|
+
base,
|
|
1104
|
+
dark,
|
|
1105
|
+
key: "green"
|
|
1106
|
+
}),
|
|
1107
|
+
cyan: opts.spot({
|
|
1108
|
+
base,
|
|
1109
|
+
dark,
|
|
1110
|
+
key: "cyan"
|
|
1111
|
+
})
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
function createColorTheme() {
|
|
1115
|
+
let partialOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1116
|
+
const builders = {
|
|
1117
|
+
...defaultOpts,
|
|
1118
|
+
...partialOpts
|
|
1119
|
+
};
|
|
1120
|
+
return {
|
|
1121
|
+
light: _createColorScheme(builders, false),
|
|
1122
|
+
dark: _createColorScheme(builders, true)
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
function _createColorScheme(opts, dark) {
|
|
1126
|
+
return {
|
|
1127
|
+
default: _createColor(opts, dark, "default"),
|
|
1128
|
+
transparent: _createColor(opts, dark, "transparent"),
|
|
1129
|
+
primary: _createColor(opts, dark, "primary"),
|
|
1130
|
+
positive: _createColor(opts, dark, "positive"),
|
|
1131
|
+
caution: _createColor(opts, dark, "caution"),
|
|
1132
|
+
critical: _createColor(opts, dark, "critical")
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
function _createColor(opts, dark, name) {
|
|
1136
|
+
const base = opts.base({
|
|
1137
|
+
dark,
|
|
1138
|
+
name
|
|
1139
|
+
});
|
|
1140
|
+
const solid = createSolidTones(opts, base, dark, name);
|
|
1141
|
+
const muted = createMutedTones(opts, base, dark, name);
|
|
1142
|
+
return {
|
|
1143
|
+
base,
|
|
1144
|
+
button: createButtonModes(opts, base, dark, solid, muted),
|
|
1145
|
+
card: createCardStates(opts, base, dark, name, solid, muted),
|
|
1146
|
+
dark,
|
|
1147
|
+
input: createInputModes(opts, base, dark, solid, muted),
|
|
1148
|
+
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
1149
|
+
spot: createSpot(opts, base, dark),
|
|
1150
|
+
syntax: opts.syntax({
|
|
1151
|
+
base,
|
|
1152
|
+
dark
|
|
1153
|
+
}),
|
|
1154
|
+
solid,
|
|
1155
|
+
muted
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
const BORDER_WIDTH = 1;
|
|
1159
|
+
const OUTLINE_WIDTH = 0.5;
|
|
1160
|
+
const defaultThemeConfig = {
|
|
1161
|
+
_version: 2,
|
|
1162
|
+
avatar: {
|
|
1163
|
+
sizes: [{
|
|
1164
|
+
distance: -4,
|
|
1165
|
+
size: 19
|
|
1166
|
+
}, {
|
|
1167
|
+
distance: -4,
|
|
1168
|
+
size: 25
|
|
1169
|
+
}, {
|
|
1170
|
+
distance: -8,
|
|
1171
|
+
size: 33
|
|
1172
|
+
}, {
|
|
1173
|
+
distance: -12,
|
|
1174
|
+
size: 49
|
|
1175
|
+
}],
|
|
1176
|
+
focusRing: {
|
|
1177
|
+
offset: 1,
|
|
1178
|
+
width: 1
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
button: {
|
|
1182
|
+
textWeight: "medium",
|
|
1183
|
+
border: {
|
|
1184
|
+
width: BORDER_WIDTH
|
|
1185
|
+
},
|
|
1186
|
+
focusRing: {
|
|
1187
|
+
offset: -1,
|
|
1188
|
+
width: 1
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
card: {
|
|
1192
|
+
border: {
|
|
1193
|
+
width: BORDER_WIDTH
|
|
1194
|
+
},
|
|
1195
|
+
focusRing: {
|
|
1196
|
+
offset: -1,
|
|
1197
|
+
width: 1
|
|
1198
|
+
},
|
|
1199
|
+
shadow: {
|
|
1200
|
+
outline: OUTLINE_WIDTH
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
container: [480, 640, 960, 1280, 1600, 1920],
|
|
1204
|
+
media: [360, 600, 900, 1200, 1800, 2400],
|
|
1205
|
+
layer: {
|
|
1206
|
+
dialog: {
|
|
1207
|
+
zOffset: 600
|
|
1208
|
+
},
|
|
1209
|
+
popover: {
|
|
1210
|
+
zOffset: 400
|
|
1211
|
+
},
|
|
1212
|
+
tooltip: {
|
|
1213
|
+
zOffset: 200
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
radius: [0, 1, 3, 6, 9, 12, 21],
|
|
1217
|
+
shadow: [null, {
|
|
1218
|
+
umbra: [0, 0, 0, 0],
|
|
1219
|
+
penumbra: [0, 0, 0, 0],
|
|
1220
|
+
ambient: [0, 0, 0, 0]
|
|
1221
|
+
}, {
|
|
1222
|
+
umbra: [0, 3, 5, -2],
|
|
1223
|
+
penumbra: [0, 6, 10, 0],
|
|
1224
|
+
ambient: [0, 1, 18, 1]
|
|
1225
|
+
}, {
|
|
1226
|
+
umbra: [0, 7, 8, -4],
|
|
1227
|
+
penumbra: [0, 12, 17, 2],
|
|
1228
|
+
ambient: [0, 5, 22, 4]
|
|
1229
|
+
}, {
|
|
1230
|
+
umbra: [0, 9, 11, -5],
|
|
1231
|
+
penumbra: [0, 18, 28, 2],
|
|
1232
|
+
ambient: [0, 7, 34, 6]
|
|
1233
|
+
}, {
|
|
1234
|
+
umbra: [0, 11, 15, -7],
|
|
1235
|
+
penumbra: [0, 24, 38, 3],
|
|
1236
|
+
ambient: [0, 9, 46, 8]
|
|
1237
|
+
}],
|
|
1238
|
+
space: [0, 4, 8, 12, 20, 32, 52, 84, 136, 220],
|
|
1239
|
+
input: {
|
|
1240
|
+
border: {
|
|
1241
|
+
width: BORDER_WIDTH
|
|
1242
|
+
},
|
|
1243
|
+
checkbox: {
|
|
1244
|
+
size: 17,
|
|
1245
|
+
focusRing: {
|
|
1246
|
+
offset: -1,
|
|
1247
|
+
width: 1
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
radio: {
|
|
1251
|
+
size: 17,
|
|
1252
|
+
markSize: 9,
|
|
1253
|
+
focusRing: {
|
|
1254
|
+
offset: -1,
|
|
1255
|
+
width: 1
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
switch: {
|
|
1259
|
+
width: 25,
|
|
1260
|
+
height: 17,
|
|
1261
|
+
padding: 2,
|
|
1262
|
+
transitionDurationMs: 150,
|
|
1263
|
+
transitionTimingFunction: "ease-out",
|
|
1264
|
+
focusRing: {
|
|
1265
|
+
offset: 1,
|
|
1266
|
+
width: 1
|
|
1267
|
+
}
|
|
1268
|
+
},
|
|
1269
|
+
select: {
|
|
1270
|
+
focusRing: {
|
|
1271
|
+
offset: -1,
|
|
1272
|
+
width: 1
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
text: {
|
|
1276
|
+
focusRing: {
|
|
1277
|
+
offset: -1,
|
|
1278
|
+
width: 1
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
},
|
|
1282
|
+
style: {
|
|
1283
|
+
button: {
|
|
1284
|
+
root: {
|
|
1285
|
+
transition: "background-color 100ms,border-color 100ms,color 100ms"
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
// card: {
|
|
1289
|
+
// root: {
|
|
1290
|
+
// transition: 'background-color 100ms,border-color 100ms,color 100ms',
|
|
1291
|
+
// },
|
|
1292
|
+
// },
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
const defaultThemeFonts = {
|
|
1296
|
+
code: {
|
|
1297
|
+
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
1298
|
+
weights: {
|
|
1299
|
+
regular: 400,
|
|
1300
|
+
medium: 500,
|
|
1301
|
+
semibold: 600,
|
|
1302
|
+
bold: 700
|
|
1303
|
+
},
|
|
1304
|
+
sizes: [{
|
|
1305
|
+
ascenderHeight: 4,
|
|
1306
|
+
descenderHeight: 4,
|
|
1307
|
+
fontSize: 10,
|
|
1308
|
+
iconSize: 17,
|
|
1309
|
+
lineHeight: 15,
|
|
1310
|
+
letterSpacing: 0
|
|
1311
|
+
}, {
|
|
1312
|
+
ascenderHeight: 5,
|
|
1313
|
+
descenderHeight: 5,
|
|
1314
|
+
fontSize: 13,
|
|
1315
|
+
iconSize: 21,
|
|
1316
|
+
lineHeight: 19,
|
|
1317
|
+
letterSpacing: 0
|
|
1318
|
+
}, {
|
|
1319
|
+
ascenderHeight: 6,
|
|
1320
|
+
descenderHeight: 6,
|
|
1321
|
+
fontSize: 16,
|
|
1322
|
+
iconSize: 25,
|
|
1323
|
+
lineHeight: 23,
|
|
1324
|
+
letterSpacing: 0
|
|
1325
|
+
}, {
|
|
1326
|
+
ascenderHeight: 7,
|
|
1327
|
+
descenderHeight: 7,
|
|
1328
|
+
fontSize: 19,
|
|
1329
|
+
iconSize: 29,
|
|
1330
|
+
lineHeight: 27,
|
|
1331
|
+
letterSpacing: 0
|
|
1332
|
+
}, {
|
|
1333
|
+
ascenderHeight: 8,
|
|
1334
|
+
descenderHeight: 8,
|
|
1335
|
+
fontSize: 22,
|
|
1336
|
+
iconSize: 33,
|
|
1337
|
+
lineHeight: 31,
|
|
1338
|
+
letterSpacing: 0
|
|
1339
|
+
}]
|
|
1340
|
+
},
|
|
1341
|
+
heading: {
|
|
1342
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
1343
|
+
weights: {
|
|
1344
|
+
regular: 700,
|
|
1345
|
+
medium: 800,
|
|
1346
|
+
semibold: 900,
|
|
1347
|
+
bold: 900
|
|
1348
|
+
},
|
|
1349
|
+
sizes: [{
|
|
1350
|
+
ascenderHeight: 5,
|
|
1351
|
+
descenderHeight: 5,
|
|
1352
|
+
fontSize: 13,
|
|
1353
|
+
iconSize: 17,
|
|
1354
|
+
lineHeight: 19,
|
|
1355
|
+
letterSpacing: 0
|
|
1356
|
+
}, {
|
|
1357
|
+
ascenderHeight: 6,
|
|
1358
|
+
descenderHeight: 6,
|
|
1359
|
+
fontSize: 16,
|
|
1360
|
+
iconSize: 25,
|
|
1361
|
+
lineHeight: 23,
|
|
1362
|
+
letterSpacing: 0
|
|
1363
|
+
}, {
|
|
1364
|
+
ascenderHeight: 7,
|
|
1365
|
+
descenderHeight: 7,
|
|
1366
|
+
fontSize: 21,
|
|
1367
|
+
iconSize: 33,
|
|
1368
|
+
lineHeight: 29,
|
|
1369
|
+
letterSpacing: 0
|
|
1370
|
+
}, {
|
|
1371
|
+
ascenderHeight: 8,
|
|
1372
|
+
descenderHeight: 8,
|
|
1373
|
+
fontSize: 27,
|
|
1374
|
+
iconSize: 41,
|
|
1375
|
+
lineHeight: 35,
|
|
1376
|
+
letterSpacing: 0
|
|
1377
|
+
}, {
|
|
1378
|
+
ascenderHeight: 9.5,
|
|
1379
|
+
descenderHeight: 8.5,
|
|
1380
|
+
fontSize: 33,
|
|
1381
|
+
iconSize: 49,
|
|
1382
|
+
lineHeight: 41,
|
|
1383
|
+
letterSpacing: 0
|
|
1384
|
+
}, {
|
|
1385
|
+
ascenderHeight: 10.5,
|
|
1386
|
+
descenderHeight: 9.5,
|
|
1387
|
+
fontSize: 38,
|
|
1388
|
+
iconSize: 53,
|
|
1389
|
+
lineHeight: 47,
|
|
1390
|
+
letterSpacing: 0
|
|
1391
|
+
}]
|
|
1392
|
+
},
|
|
1393
|
+
label: {
|
|
1394
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
1395
|
+
weights: {
|
|
1396
|
+
regular: 600,
|
|
1397
|
+
medium: 700,
|
|
1398
|
+
semibold: 800,
|
|
1399
|
+
bold: 900
|
|
1400
|
+
},
|
|
1401
|
+
sizes: [{
|
|
1402
|
+
ascenderHeight: 2,
|
|
1403
|
+
descenderHeight: 2,
|
|
1404
|
+
fontSize: 8.1,
|
|
1405
|
+
iconSize: 13,
|
|
1406
|
+
lineHeight: 10,
|
|
1407
|
+
letterSpacing: 0.5
|
|
1408
|
+
}, {
|
|
1409
|
+
ascenderHeight: 2,
|
|
1410
|
+
descenderHeight: 2,
|
|
1411
|
+
fontSize: 9.5,
|
|
1412
|
+
iconSize: 15,
|
|
1413
|
+
lineHeight: 11,
|
|
1414
|
+
letterSpacing: 0.5
|
|
1415
|
+
}, {
|
|
1416
|
+
ascenderHeight: 2,
|
|
1417
|
+
descenderHeight: 2,
|
|
1418
|
+
fontSize: 10.8,
|
|
1419
|
+
iconSize: 17,
|
|
1420
|
+
lineHeight: 12,
|
|
1421
|
+
letterSpacing: 0.5
|
|
1422
|
+
}, {
|
|
1423
|
+
ascenderHeight: 2,
|
|
1424
|
+
descenderHeight: 2,
|
|
1425
|
+
fontSize: 12.25,
|
|
1426
|
+
iconSize: 19,
|
|
1427
|
+
lineHeight: 13,
|
|
1428
|
+
letterSpacing: 0.5
|
|
1429
|
+
}, {
|
|
1430
|
+
ascenderHeight: 2,
|
|
1431
|
+
descenderHeight: 2,
|
|
1432
|
+
fontSize: 13.6,
|
|
1433
|
+
iconSize: 21,
|
|
1434
|
+
lineHeight: 14,
|
|
1435
|
+
letterSpacing: 0.5
|
|
1436
|
+
}, {
|
|
1437
|
+
ascenderHeight: 2,
|
|
1438
|
+
descenderHeight: 2,
|
|
1439
|
+
fontSize: 15,
|
|
1440
|
+
iconSize: 23,
|
|
1441
|
+
lineHeight: 15,
|
|
1442
|
+
letterSpacing: 0.5
|
|
1443
|
+
}]
|
|
1444
|
+
},
|
|
1445
|
+
text: {
|
|
1446
|
+
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
1447
|
+
weights: {
|
|
1448
|
+
regular: 400,
|
|
1449
|
+
medium: 500,
|
|
1450
|
+
semibold: 600,
|
|
1451
|
+
bold: 700
|
|
1452
|
+
},
|
|
1453
|
+
sizes: [{
|
|
1454
|
+
ascenderHeight: 4,
|
|
1455
|
+
descenderHeight: 4,
|
|
1456
|
+
fontSize: 10,
|
|
1457
|
+
iconSize: 17,
|
|
1458
|
+
lineHeight: 15,
|
|
1459
|
+
letterSpacing: 0
|
|
1460
|
+
}, {
|
|
1461
|
+
ascenderHeight: 5,
|
|
1462
|
+
descenderHeight: 5,
|
|
1463
|
+
fontSize: 13,
|
|
1464
|
+
iconSize: 21,
|
|
1465
|
+
lineHeight: 19,
|
|
1466
|
+
letterSpacing: 0
|
|
1467
|
+
}, {
|
|
1468
|
+
ascenderHeight: 6,
|
|
1469
|
+
descenderHeight: 6,
|
|
1470
|
+
fontSize: 15,
|
|
1471
|
+
iconSize: 25,
|
|
1472
|
+
lineHeight: 23,
|
|
1473
|
+
letterSpacing: 0
|
|
1474
|
+
}, {
|
|
1475
|
+
ascenderHeight: 7,
|
|
1476
|
+
descenderHeight: 7,
|
|
1477
|
+
fontSize: 18,
|
|
1478
|
+
iconSize: 29,
|
|
1479
|
+
lineHeight: 27,
|
|
1480
|
+
letterSpacing: 0
|
|
1481
|
+
}, {
|
|
1482
|
+
ascenderHeight: 8,
|
|
1483
|
+
descenderHeight: 8,
|
|
1484
|
+
fontSize: 21,
|
|
1485
|
+
iconSize: 33,
|
|
1486
|
+
lineHeight: 31,
|
|
1487
|
+
letterSpacing: 0
|
|
1488
|
+
}]
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
const cache$4 = /* @__PURE__ */new WeakMap();
|
|
1492
|
+
function themeColor_v0_v2(color_v0) {
|
|
1493
|
+
var _a, _b, _c;
|
|
1494
|
+
const cached_v2 = cache$4.get(color_v0);
|
|
1495
|
+
if (cached_v2) return cached_v2;
|
|
1496
|
+
const base = stateThemeColor_v0_v2(color_v0, color_v0.card.enabled);
|
|
1497
|
+
const color_v2 = {
|
|
1498
|
+
_blend: color_v0._blend || (color_v0.dark ? "screen" : "multiply"),
|
|
1499
|
+
_dark: color_v0.dark,
|
|
1500
|
+
accent: base.accent,
|
|
1501
|
+
avatar: base.avatar,
|
|
1502
|
+
backdrop: color_v0.base.shadow.ambient,
|
|
1503
|
+
badge: base.badge,
|
|
1504
|
+
bg: color_v0.base.bg,
|
|
1505
|
+
border: color_v0.base.border,
|
|
1506
|
+
button: {
|
|
1507
|
+
default: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.default),
|
|
1508
|
+
ghost: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.ghost),
|
|
1509
|
+
bleed: stateTonesThemeColor_v0_v2(color_v0, color_v0.button.bleed)
|
|
1510
|
+
},
|
|
1511
|
+
code: base.code,
|
|
1512
|
+
fg: color_v0.base.fg,
|
|
1513
|
+
focusRing: color_v0.base.focusRing,
|
|
1514
|
+
icon: base.muted.fg,
|
|
1515
|
+
input: {
|
|
1516
|
+
default: inputStatesThemeColor_v0_v2(color_v0.input.default),
|
|
1517
|
+
invalid: inputStatesThemeColor_v0_v2(color_v0.input.invalid)
|
|
1518
|
+
},
|
|
1519
|
+
kbd: base.kbd,
|
|
1520
|
+
link: base.link,
|
|
1521
|
+
muted: {
|
|
1522
|
+
...base.muted,
|
|
1523
|
+
bg: ((_a = color_v0.selectable) == null ? void 0 : _a.default.enabled.bg2) || color_v0.base.bg
|
|
1524
|
+
},
|
|
1525
|
+
selectable: stateTonesThemeColor_v0_v2(color_v0, color_v0.selectable || color_v0.muted),
|
|
1526
|
+
shadow: color_v0.base.shadow,
|
|
1527
|
+
skeleton: {
|
|
1528
|
+
from: ((_b = color_v0.skeleton) == null ? void 0 : _b.from) || color_v0.base.border,
|
|
1529
|
+
to: ((_c = color_v0.skeleton) == null ? void 0 : _c.to) || color_v0.base.border
|
|
1530
|
+
},
|
|
1531
|
+
syntax: color_v0.syntax
|
|
1532
|
+
};
|
|
1533
|
+
cache$4.set(color_v0, color_v2);
|
|
1534
|
+
return color_v2;
|
|
1535
|
+
}
|
|
1536
|
+
function stateTonesThemeColor_v0_v2(v0, t) {
|
|
1537
|
+
return {
|
|
1538
|
+
default: {
|
|
1539
|
+
enabled: stateThemeColor_v0_v2(v0, t.default.enabled),
|
|
1540
|
+
hovered: stateThemeColor_v0_v2(v0, t.default.hovered),
|
|
1541
|
+
pressed: stateThemeColor_v0_v2(v0, t.default.pressed),
|
|
1542
|
+
selected: stateThemeColor_v0_v2(v0, t.default.selected),
|
|
1543
|
+
disabled: stateThemeColor_v0_v2(v0, t.default.disabled)
|
|
1544
|
+
},
|
|
1545
|
+
primary: {
|
|
1546
|
+
enabled: stateThemeColor_v0_v2(v0, t.primary.enabled),
|
|
1547
|
+
hovered: stateThemeColor_v0_v2(v0, t.primary.hovered),
|
|
1548
|
+
pressed: stateThemeColor_v0_v2(v0, t.primary.pressed),
|
|
1549
|
+
selected: stateThemeColor_v0_v2(v0, t.primary.selected),
|
|
1550
|
+
disabled: stateThemeColor_v0_v2(v0, t.primary.disabled)
|
|
1551
|
+
},
|
|
1552
|
+
positive: {
|
|
1553
|
+
enabled: stateThemeColor_v0_v2(v0, t.positive.enabled),
|
|
1554
|
+
hovered: stateThemeColor_v0_v2(v0, t.positive.hovered),
|
|
1555
|
+
pressed: stateThemeColor_v0_v2(v0, t.positive.pressed),
|
|
1556
|
+
selected: stateThemeColor_v0_v2(v0, t.positive.selected),
|
|
1557
|
+
disabled: stateThemeColor_v0_v2(v0, t.positive.disabled)
|
|
1558
|
+
},
|
|
1559
|
+
caution: {
|
|
1560
|
+
enabled: stateThemeColor_v0_v2(v0, t.caution.enabled),
|
|
1561
|
+
hovered: stateThemeColor_v0_v2(v0, t.caution.hovered),
|
|
1562
|
+
pressed: stateThemeColor_v0_v2(v0, t.caution.pressed),
|
|
1563
|
+
selected: stateThemeColor_v0_v2(v0, t.caution.selected),
|
|
1564
|
+
disabled: stateThemeColor_v0_v2(v0, t.caution.disabled)
|
|
1565
|
+
},
|
|
1566
|
+
critical: {
|
|
1567
|
+
enabled: stateThemeColor_v0_v2(v0, t.critical.enabled),
|
|
1568
|
+
hovered: stateThemeColor_v0_v2(v0, t.critical.hovered),
|
|
1569
|
+
pressed: stateThemeColor_v0_v2(v0, t.critical.pressed),
|
|
1570
|
+
selected: stateThemeColor_v0_v2(v0, t.critical.selected),
|
|
1571
|
+
disabled: stateThemeColor_v0_v2(v0, t.critical.disabled)
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
function stateThemeColor_v0_v2(v0, state) {
|
|
1576
|
+
var _a, _b;
|
|
1577
|
+
return {
|
|
1578
|
+
...state,
|
|
1579
|
+
avatar: {
|
|
1580
|
+
gray: {
|
|
1581
|
+
bg: v0.spot.gray,
|
|
1582
|
+
fg: v0.base.bg
|
|
1583
|
+
},
|
|
1584
|
+
blue: {
|
|
1585
|
+
bg: v0.spot.blue,
|
|
1586
|
+
fg: v0.base.bg
|
|
1587
|
+
},
|
|
1588
|
+
purple: {
|
|
1589
|
+
bg: v0.spot.purple,
|
|
1590
|
+
fg: v0.base.bg
|
|
1591
|
+
},
|
|
1592
|
+
magenta: {
|
|
1593
|
+
bg: v0.spot.magenta,
|
|
1594
|
+
fg: v0.base.bg
|
|
1595
|
+
},
|
|
1596
|
+
red: {
|
|
1597
|
+
bg: v0.spot.red,
|
|
1598
|
+
fg: v0.base.bg
|
|
1599
|
+
},
|
|
1600
|
+
orange: {
|
|
1601
|
+
bg: v0.spot.orange,
|
|
1602
|
+
fg: v0.base.bg
|
|
1603
|
+
},
|
|
1604
|
+
yellow: {
|
|
1605
|
+
bg: v0.spot.yellow,
|
|
1606
|
+
fg: v0.base.bg
|
|
1607
|
+
},
|
|
1608
|
+
green: {
|
|
1609
|
+
bg: v0.spot.green,
|
|
1610
|
+
fg: v0.base.bg
|
|
1611
|
+
},
|
|
1612
|
+
cyan: {
|
|
1613
|
+
bg: v0.spot.cyan,
|
|
1614
|
+
fg: v0.base.bg
|
|
1615
|
+
}
|
|
1616
|
+
},
|
|
1617
|
+
badge: {
|
|
1618
|
+
default: {
|
|
1619
|
+
bg: v0.muted.default.enabled.bg,
|
|
1620
|
+
fg: v0.muted.default.enabled.fg,
|
|
1621
|
+
dot: v0.muted.default.enabled.muted.fg,
|
|
1622
|
+
icon: v0.muted.default.enabled.muted.fg
|
|
1623
|
+
},
|
|
1624
|
+
primary: {
|
|
1625
|
+
bg: v0.muted.primary.enabled.bg,
|
|
1626
|
+
fg: v0.muted.primary.enabled.fg,
|
|
1627
|
+
dot: v0.muted.primary.enabled.muted.fg,
|
|
1628
|
+
icon: v0.muted.primary.enabled.muted.fg
|
|
1629
|
+
},
|
|
1630
|
+
positive: {
|
|
1631
|
+
bg: v0.muted.positive.enabled.bg,
|
|
1632
|
+
fg: v0.muted.positive.enabled.fg,
|
|
1633
|
+
dot: v0.muted.positive.enabled.muted.fg,
|
|
1634
|
+
icon: v0.muted.positive.enabled.muted.fg
|
|
1635
|
+
},
|
|
1636
|
+
caution: {
|
|
1637
|
+
bg: v0.muted.caution.enabled.bg,
|
|
1638
|
+
fg: v0.muted.caution.enabled.fg,
|
|
1639
|
+
dot: v0.muted.caution.enabled.muted.fg,
|
|
1640
|
+
icon: v0.muted.caution.enabled.muted.fg
|
|
1641
|
+
},
|
|
1642
|
+
critical: {
|
|
1643
|
+
bg: v0.muted.critical.enabled.bg,
|
|
1644
|
+
fg: v0.muted.critical.enabled.fg,
|
|
1645
|
+
dot: v0.muted.critical.enabled.muted.fg,
|
|
1646
|
+
icon: v0.muted.critical.enabled.muted.fg
|
|
1647
|
+
}
|
|
1648
|
+
},
|
|
1649
|
+
kbd: {
|
|
1650
|
+
bg: v0.muted.default.enabled.bg,
|
|
1651
|
+
fg: v0.muted.default.enabled.fg,
|
|
1652
|
+
border: v0.muted.default.enabled.border
|
|
1653
|
+
},
|
|
1654
|
+
muted: {
|
|
1655
|
+
...v0.muted.default.enabled.muted,
|
|
1656
|
+
bg: state.bg2 || state.bg
|
|
1657
|
+
},
|
|
1658
|
+
skeleton: {
|
|
1659
|
+
from: ((_a = state.skeleton) == null ? void 0 : _a.from) || state.border,
|
|
1660
|
+
to: ((_b = state.skeleton) == null ? void 0 : _b.to) || state.border
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
function inputStatesThemeColor_v0_v2(states) {
|
|
1665
|
+
return {
|
|
1666
|
+
enabled: inputStateThemeColor_v0_v2(states.enabled),
|
|
1667
|
+
disabled: inputStateThemeColor_v0_v2(states.disabled),
|
|
1668
|
+
readOnly: inputStateThemeColor_v0_v2(states.readOnly),
|
|
1669
|
+
hovered: inputStateThemeColor_v0_v2(states.hovered)
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
function inputStateThemeColor_v0_v2(state) {
|
|
1673
|
+
return {
|
|
1674
|
+
bg: state.bg,
|
|
1675
|
+
border: state.border,
|
|
1676
|
+
fg: state.fg,
|
|
1677
|
+
muted: {
|
|
1678
|
+
bg: state.bg2
|
|
1679
|
+
},
|
|
1680
|
+
placeholder: state.placeholder
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
const cache$3 = /* @__PURE__ */new WeakMap();
|
|
1684
|
+
function getTheme_v2(theme) {
|
|
1685
|
+
var _a;
|
|
1686
|
+
if (theme.sanity.v2) return theme.sanity.v2;
|
|
1687
|
+
const cached_v2 = cache$3.get(theme);
|
|
1688
|
+
if (cached_v2) return cached_v2;
|
|
1689
|
+
const v2 = {
|
|
1690
|
+
_version: 2,
|
|
1691
|
+
avatar: {
|
|
1692
|
+
...defaultThemeConfig.avatar,
|
|
1693
|
+
...theme.sanity.avatar
|
|
1694
|
+
},
|
|
1695
|
+
button: {
|
|
1696
|
+
...defaultThemeConfig.button,
|
|
1697
|
+
...theme.sanity.button
|
|
1698
|
+
},
|
|
1699
|
+
card: defaultThemeConfig.card,
|
|
1700
|
+
color: themeColor_v0_v2(theme.sanity.color),
|
|
1701
|
+
container: theme.sanity.container,
|
|
1702
|
+
font: theme.sanity.fonts,
|
|
1703
|
+
input: {
|
|
1704
|
+
...defaultThemeConfig.input,
|
|
1705
|
+
...theme.sanity.input,
|
|
1706
|
+
checkbox: {
|
|
1707
|
+
...defaultThemeConfig.input.checkbox,
|
|
1708
|
+
...theme.sanity.input.checkbox
|
|
1709
|
+
},
|
|
1710
|
+
radio: {
|
|
1711
|
+
...defaultThemeConfig.input.radio,
|
|
1712
|
+
...theme.sanity.input.radio
|
|
1713
|
+
},
|
|
1714
|
+
switch: {
|
|
1715
|
+
...defaultThemeConfig.input.switch,
|
|
1716
|
+
...theme.sanity.input.switch
|
|
1717
|
+
}
|
|
1718
|
+
},
|
|
1719
|
+
layer: (_a = theme.sanity.layer) != null ? _a : defaultThemeConfig.layer,
|
|
1720
|
+
media: theme.sanity.media,
|
|
1721
|
+
radius: theme.sanity.radius,
|
|
1722
|
+
shadow: theme.sanity.shadows,
|
|
1723
|
+
space: theme.sanity.space,
|
|
1724
|
+
style: theme.sanity.styles
|
|
1725
|
+
};
|
|
1726
|
+
cache$3.set(theme, v2);
|
|
1727
|
+
return v2;
|
|
1728
|
+
}
|
|
1729
|
+
function is_v0(themeProp) {
|
|
1730
|
+
return themeProp._version === 0;
|
|
1731
|
+
}
|
|
1732
|
+
function is_v2(themeProp) {
|
|
1733
|
+
return themeProp._version === 2;
|
|
1734
|
+
}
|
|
1735
|
+
const cache$2 = /* @__PURE__ */new WeakMap();
|
|
1736
|
+
function v0_v2(v0) {
|
|
1737
|
+
if (v0.v2) return v0.v2;
|
|
1738
|
+
const cached_v2 = cache$2.get(v0);
|
|
1739
|
+
if (cached_v2) return cached_v2;
|
|
1740
|
+
const {
|
|
1741
|
+
avatar,
|
|
1742
|
+
button,
|
|
1743
|
+
color,
|
|
1744
|
+
container,
|
|
1745
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1746
|
+
focusRing: _unused_focusRing,
|
|
1747
|
+
fonts: font,
|
|
1748
|
+
input,
|
|
1749
|
+
layer,
|
|
1750
|
+
media,
|
|
1751
|
+
radius,
|
|
1752
|
+
shadows: shadow,
|
|
1753
|
+
space,
|
|
1754
|
+
styles: style
|
|
1755
|
+
} = v0;
|
|
1756
|
+
const v2 = {
|
|
1757
|
+
_version: 2,
|
|
1758
|
+
avatar: {
|
|
1759
|
+
...defaultThemeConfig.avatar,
|
|
1760
|
+
...avatar
|
|
1761
|
+
},
|
|
1762
|
+
button: {
|
|
1763
|
+
...defaultThemeConfig.button,
|
|
1764
|
+
...button
|
|
1765
|
+
},
|
|
1766
|
+
card: defaultThemeConfig.card,
|
|
1767
|
+
color: {
|
|
1768
|
+
light: {
|
|
1769
|
+
transparent: themeColor_v0_v2(color.light.transparent),
|
|
1770
|
+
default: themeColor_v0_v2(color.light.default),
|
|
1771
|
+
primary: themeColor_v0_v2(color.light.primary),
|
|
1772
|
+
positive: themeColor_v0_v2(color.light.positive),
|
|
1773
|
+
caution: themeColor_v0_v2(color.light.caution),
|
|
1774
|
+
critical: themeColor_v0_v2(color.light.critical)
|
|
1775
|
+
},
|
|
1776
|
+
dark: {
|
|
1777
|
+
transparent: themeColor_v0_v2(color.dark.transparent),
|
|
1778
|
+
default: themeColor_v0_v2(color.dark.default),
|
|
1779
|
+
primary: themeColor_v0_v2(color.dark.primary),
|
|
1780
|
+
positive: themeColor_v0_v2(color.dark.positive),
|
|
1781
|
+
caution: themeColor_v0_v2(color.dark.caution),
|
|
1782
|
+
critical: themeColor_v0_v2(color.dark.critical)
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
container,
|
|
1786
|
+
font,
|
|
1787
|
+
input: {
|
|
1788
|
+
...defaultThemeConfig.input,
|
|
1789
|
+
...input,
|
|
1790
|
+
checkbox: {
|
|
1791
|
+
...defaultThemeConfig.input.checkbox,
|
|
1792
|
+
...input.checkbox
|
|
1793
|
+
},
|
|
1794
|
+
radio: {
|
|
1795
|
+
...defaultThemeConfig.input.radio,
|
|
1796
|
+
...input.radio
|
|
1797
|
+
},
|
|
1798
|
+
switch: {
|
|
1799
|
+
...defaultThemeConfig.input.switch,
|
|
1800
|
+
...input.switch
|
|
1801
|
+
}
|
|
1802
|
+
},
|
|
1803
|
+
layer: layer != null ? layer : defaultThemeConfig.layer,
|
|
1804
|
+
media,
|
|
1805
|
+
radius,
|
|
1806
|
+
shadow,
|
|
1807
|
+
space,
|
|
1808
|
+
style
|
|
1809
|
+
};
|
|
1810
|
+
cache$2.set(v0, v2);
|
|
1811
|
+
return v2;
|
|
1812
|
+
}
|
|
1813
|
+
const cache$1 = /* @__PURE__ */new WeakMap();
|
|
1814
|
+
function v2_v0(v2) {
|
|
1815
|
+
const cachedTheme = cache$1.get(v2);
|
|
1816
|
+
if (cachedTheme) return cachedTheme;
|
|
1817
|
+
const {
|
|
1818
|
+
avatar,
|
|
1819
|
+
button,
|
|
1820
|
+
color,
|
|
1821
|
+
container,
|
|
1822
|
+
font: fonts,
|
|
1823
|
+
input,
|
|
1824
|
+
media,
|
|
1825
|
+
radius,
|
|
1826
|
+
shadow: shadows,
|
|
1827
|
+
space,
|
|
1828
|
+
style: styles
|
|
1829
|
+
} = v2;
|
|
1830
|
+
return {
|
|
1831
|
+
_version: 0,
|
|
1832
|
+
avatar,
|
|
1833
|
+
button,
|
|
1834
|
+
container,
|
|
1835
|
+
color: {
|
|
1836
|
+
light: {
|
|
1837
|
+
transparent: themeColor_v2_v0(color.light.transparent),
|
|
1838
|
+
default: themeColor_v2_v0(color.light.default),
|
|
1839
|
+
primary: themeColor_v2_v0(color.light.primary),
|
|
1840
|
+
positive: themeColor_v2_v0(color.light.positive),
|
|
1841
|
+
caution: themeColor_v2_v0(color.light.caution),
|
|
1842
|
+
critical: themeColor_v2_v0(color.light.critical)
|
|
1843
|
+
},
|
|
1844
|
+
dark: {
|
|
1845
|
+
transparent: themeColor_v2_v0(color.dark.transparent),
|
|
1846
|
+
default: themeColor_v2_v0(color.dark.default),
|
|
1847
|
+
primary: themeColor_v2_v0(color.dark.primary),
|
|
1848
|
+
positive: themeColor_v2_v0(color.dark.positive),
|
|
1849
|
+
caution: themeColor_v2_v0(color.dark.caution),
|
|
1850
|
+
critical: themeColor_v2_v0(color.dark.critical)
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
focusRing: input.text.focusRing,
|
|
1854
|
+
fonts,
|
|
1855
|
+
input,
|
|
1856
|
+
media,
|
|
1857
|
+
radius,
|
|
1858
|
+
shadows,
|
|
1859
|
+
space,
|
|
1860
|
+
styles,
|
|
1861
|
+
v2
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
function themeColor_v2_v0(color_v2) {
|
|
1865
|
+
return {
|
|
1866
|
+
base: {
|
|
1867
|
+
bg: color_v2.bg,
|
|
1868
|
+
fg: color_v2.fg,
|
|
1869
|
+
border: color_v2.border,
|
|
1870
|
+
focusRing: color_v2.focusRing,
|
|
1871
|
+
shadow: color_v2.shadow
|
|
1872
|
+
},
|
|
1873
|
+
button: color_v2.button,
|
|
1874
|
+
card: color_v2.selectable.default,
|
|
1875
|
+
dark: color_v2._dark,
|
|
1876
|
+
input: {
|
|
1877
|
+
default: inputStatesThemeColor_v2_v0(color_v2.input.default),
|
|
1878
|
+
invalid: inputStatesThemeColor_v2_v0(color_v2.input.invalid)
|
|
1879
|
+
},
|
|
1880
|
+
muted: {
|
|
1881
|
+
...color_v2.button.ghost,
|
|
1882
|
+
transparent: color_v2.button.ghost.default
|
|
1883
|
+
},
|
|
1884
|
+
solid: {
|
|
1885
|
+
...color_v2.button.default,
|
|
1886
|
+
transparent: color_v2.button.default.default
|
|
1887
|
+
},
|
|
1888
|
+
spot: {
|
|
1889
|
+
gray: color_v2.avatar.gray.bg,
|
|
1890
|
+
blue: color_v2.avatar.blue.bg,
|
|
1891
|
+
purple: color_v2.avatar.purple.bg,
|
|
1892
|
+
magenta: color_v2.avatar.magenta.bg,
|
|
1893
|
+
red: color_v2.avatar.red.bg,
|
|
1894
|
+
orange: color_v2.avatar.orange.bg,
|
|
1895
|
+
yellow: color_v2.avatar.yellow.bg,
|
|
1896
|
+
green: color_v2.avatar.green.bg,
|
|
1897
|
+
cyan: color_v2.avatar.cyan.bg
|
|
1898
|
+
},
|
|
1899
|
+
syntax: color_v2.syntax
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
function inputStatesThemeColor_v2_v0(t) {
|
|
1903
|
+
return {
|
|
1904
|
+
enabled: inputStateThemeColor_v2_v0(t.enabled),
|
|
1905
|
+
disabled: inputStateThemeColor_v2_v0(t.disabled),
|
|
1906
|
+
readOnly: inputStateThemeColor_v2_v0(t.readOnly),
|
|
1907
|
+
hovered: inputStateThemeColor_v2_v0(t.hovered)
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
function inputStateThemeColor_v2_v0(t) {
|
|
1911
|
+
return {
|
|
1912
|
+
bg: t.bg,
|
|
1913
|
+
bg2: t.muted.bg,
|
|
1914
|
+
border: t.border,
|
|
1915
|
+
fg: t.fg,
|
|
1916
|
+
placeholder: t.placeholder
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
const THEME_COLOR_BLEND_MODES = ["multiply", "screen"];
|
|
1920
|
+
const THEME_COLOR_CARD_TONES = ["transparent", "default", "primary",
|
|
1921
|
+
// todo: rename to `accent` in the next breaking major version
|
|
1922
|
+
"positive", "caution", "critical"];
|
|
1923
|
+
const THEME_COLOR_STATE_TONES = ["default", "primary",
|
|
1924
|
+
// todo: rename to `accent` in the next breaking major version
|
|
1925
|
+
"positive", "caution", "critical"];
|
|
1926
|
+
const THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
|
|
1927
|
+
const THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
|
|
1928
|
+
const THEME_COLOR_INPUT_MODES = ["default", "invalid"];
|
|
1929
|
+
const THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"];
|
|
1930
|
+
const THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1931
|
+
function isColorBlendModeValue(str) {
|
|
1932
|
+
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1933
|
+
}
|
|
1934
|
+
function isColorHueKey(str) {
|
|
1935
|
+
return COLOR_HUES.includes(str);
|
|
1936
|
+
}
|
|
1937
|
+
function isColorTintKey(str) {
|
|
1938
|
+
return COLOR_TINTS.includes(str);
|
|
1939
|
+
}
|
|
1940
|
+
function isColorButtonMode(str) {
|
|
1941
|
+
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1942
|
+
}
|
|
1943
|
+
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"];
|
|
1944
|
+
const COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"];
|
|
1945
|
+
const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
|
|
1946
|
+
const COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS];
|
|
1947
|
+
const COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES];
|
|
1948
|
+
const COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES];
|
|
1949
|
+
const COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES];
|
|
1950
|
+
const COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES];
|
|
1951
|
+
const COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1952
|
+
function parseTokenKey(str) {
|
|
1953
|
+
const segments = str.split("/");
|
|
1954
|
+
const segment0 = segments.shift() || "";
|
|
1955
|
+
if (isColorConfigBaseTone(segment0)) {
|
|
1956
|
+
const key = segments.join("/");
|
|
1957
|
+
if (isColorConfigBaseKey(key)) {
|
|
1958
|
+
return {
|
|
1959
|
+
type: "base",
|
|
1960
|
+
tone: segment0,
|
|
1961
|
+
key
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
if (isColorConfigBlendKey(key)) {
|
|
1965
|
+
return {
|
|
1966
|
+
type: "base",
|
|
1967
|
+
tone: segment0,
|
|
1968
|
+
key
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
if (segment0 === "button") {
|
|
1973
|
+
const segment1 = segments.shift() || "";
|
|
1974
|
+
if (isColorConfigStateTone(segment1)) {
|
|
1975
|
+
const segment2 = segments.shift() || "";
|
|
1976
|
+
if (isColorButtonMode(segment2)) {
|
|
1977
|
+
const key = segments.join("/");
|
|
1978
|
+
if (isColorConfigStateKey(key)) {
|
|
1979
|
+
return {
|
|
1980
|
+
type: "button",
|
|
1981
|
+
tone: segment1,
|
|
1982
|
+
mode: segment2,
|
|
1983
|
+
key
|
|
1984
|
+
};
|
|
1985
|
+
}
|
|
1986
|
+
if (isColorConfigBlendKey(key)) {
|
|
1987
|
+
return {
|
|
1988
|
+
type: "button",
|
|
1989
|
+
tone: segment1,
|
|
1990
|
+
mode: segment2,
|
|
1991
|
+
key
|
|
1992
|
+
};
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return void 0;
|
|
1998
|
+
}
|
|
1999
|
+
function parseTokenValue(str) {
|
|
2000
|
+
const segments = str.split("/");
|
|
2001
|
+
const segment0 = segments.shift() || "";
|
|
2002
|
+
if (isColorTintKey(segment0)) {
|
|
2003
|
+
const tint = segment0;
|
|
2004
|
+
const segment1 = segments.shift() || "";
|
|
2005
|
+
if (isColorOpacityValue(segment1)) {
|
|
2006
|
+
const opacity = Number(segment1);
|
|
2007
|
+
return {
|
|
2008
|
+
type: "color",
|
|
2009
|
+
tint,
|
|
2010
|
+
opacity
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
return {
|
|
2014
|
+
type: "color",
|
|
2015
|
+
tint
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
if (isColorValue(segment0)) {
|
|
2019
|
+
const key = segment0;
|
|
2020
|
+
const segment1 = segments.shift() || "";
|
|
2021
|
+
if (isColorOpacityValue(segment1)) {
|
|
2022
|
+
const opacity = Number(segment1);
|
|
2023
|
+
return {
|
|
2024
|
+
type: "color",
|
|
2025
|
+
key,
|
|
2026
|
+
opacity
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
return {
|
|
2030
|
+
type: "color",
|
|
2031
|
+
key
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
if (isColorHueKey(segment0)) {
|
|
2035
|
+
const hue = segment0;
|
|
2036
|
+
const segment1 = segments.shift() || "";
|
|
2037
|
+
if (isColorTintKey(segment1)) {
|
|
2038
|
+
const tint = segment1;
|
|
2039
|
+
const segment2 = segments.shift() || "";
|
|
2040
|
+
if (isColorOpacityValue(segment2)) {
|
|
2041
|
+
const opacity = Number(segment2);
|
|
2042
|
+
return {
|
|
2043
|
+
type: "color",
|
|
2044
|
+
key: "".concat(hue, "/").concat(tint),
|
|
2045
|
+
hue,
|
|
2046
|
+
tint,
|
|
2047
|
+
opacity
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
return {
|
|
2051
|
+
type: "color",
|
|
2052
|
+
key: "".concat(hue, "/").concat(tint),
|
|
2053
|
+
hue,
|
|
2054
|
+
tint
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
return {
|
|
2058
|
+
type: "hue",
|
|
2059
|
+
value: "".concat(hue)
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
if (isColorOpacityValue(segment0)) {
|
|
2063
|
+
const opacity = Number(segment0);
|
|
2064
|
+
return {
|
|
2065
|
+
type: "color",
|
|
2066
|
+
opacity
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
if (isColorBlendModeValue(segment0)) {
|
|
2070
|
+
const value = segment0;
|
|
2071
|
+
return {
|
|
2072
|
+
type: "blendMode",
|
|
2073
|
+
value
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
return void 0;
|
|
2077
|
+
}
|
|
2078
|
+
function isColorConfigBaseTone(str) {
|
|
2079
|
+
return COLOR_CONFIG_CARD_TONES.includes(str);
|
|
2080
|
+
}
|
|
2081
|
+
function isColorConfigBaseKey(str) {
|
|
2082
|
+
return COLOR_CONFIG_CARD_KEYS.includes(str);
|
|
2083
|
+
}
|
|
2084
|
+
function isColorConfigStateKey(str) {
|
|
2085
|
+
return COLOR_CONFIG_STATE_KEYS.includes(str);
|
|
2086
|
+
}
|
|
2087
|
+
function isColorConfigStateTone(str) {
|
|
2088
|
+
return COLOR_CONFIG_STATE_TONES.includes(str);
|
|
2089
|
+
}
|
|
2090
|
+
function isColorConfigBlendKey(str) {
|
|
2091
|
+
return COLOR_CONFIG_BLEND_KEYS.includes(str);
|
|
2092
|
+
}
|
|
2093
|
+
function isColorTokenValue(str) {
|
|
2094
|
+
var _a, _b;
|
|
2095
|
+
return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
|
|
2096
|
+
}
|
|
2097
|
+
function isColorValue(str) {
|
|
2098
|
+
return str === "black" || str === "white";
|
|
2099
|
+
}
|
|
2100
|
+
function isColorOpacityValue(str) {
|
|
2101
|
+
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
2102
|
+
}
|
|
2103
|
+
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
2104
|
+
function resolveColorTokenValue(context) {
|
|
2105
|
+
let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_COLOR_TOKEN_VALUE;
|
|
2106
|
+
const {
|
|
2107
|
+
hue,
|
|
2108
|
+
scheme
|
|
2109
|
+
} = context;
|
|
2110
|
+
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
2111
|
+
if (!node || node.type !== "color") {
|
|
2112
|
+
throw new Error("Invalid color token: ".concat(value[0]));
|
|
2113
|
+
}
|
|
2114
|
+
return compileColorTokenValue({
|
|
2115
|
+
...node,
|
|
2116
|
+
hue: node.hue || hue
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
function compileColorTokenValue(node) {
|
|
2120
|
+
let key = "";
|
|
2121
|
+
if (node.key === "black" || node.key === "white") {
|
|
2122
|
+
key = node.key;
|
|
2123
|
+
} else {
|
|
2124
|
+
key = "".concat(node.hue, "/").concat(node.tint);
|
|
2125
|
+
}
|
|
2126
|
+
if (node.opacity !== void 0) {
|
|
2127
|
+
key += "/".concat(node.opacity);
|
|
2128
|
+
}
|
|
2129
|
+
return key;
|
|
2130
|
+
}
|
|
2131
|
+
const defaultColorTokens = {
|
|
2132
|
+
base: {
|
|
2133
|
+
"*": {
|
|
2134
|
+
_blend: ["multiply", "screen"],
|
|
2135
|
+
avatar: {
|
|
2136
|
+
"*": {
|
|
2137
|
+
_blend: ["screen", "multiply"],
|
|
2138
|
+
bg: ["500", "400"],
|
|
2139
|
+
fg: ["white", "black"]
|
|
2140
|
+
},
|
|
2141
|
+
yellow: {
|
|
2142
|
+
bg: ["600", "400"]
|
|
2143
|
+
},
|
|
2144
|
+
green: {
|
|
2145
|
+
bg: ["600", "400"]
|
|
2146
|
+
},
|
|
2147
|
+
cyan: {
|
|
2148
|
+
bg: ["600", "400"]
|
|
2149
|
+
}
|
|
2150
|
+
},
|
|
2151
|
+
backdrop: ["gray/200/0.2", "black/0.5"],
|
|
2152
|
+
badge: {
|
|
2153
|
+
"*": {
|
|
2154
|
+
bg: ["100", "900"],
|
|
2155
|
+
fg: ["600", "400"]
|
|
2156
|
+
},
|
|
2157
|
+
positive: {
|
|
2158
|
+
bg: ["200/0.6", "900"],
|
|
2159
|
+
fg: ["700", "500"]
|
|
2160
|
+
},
|
|
2161
|
+
caution: {
|
|
2162
|
+
bg: ["200/0.7", "900"],
|
|
2163
|
+
fg: ["700", "500"]
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
bg: ["50", "950"],
|
|
2167
|
+
border: ["200", "800"],
|
|
2168
|
+
code: {
|
|
2169
|
+
bg: ["50", "950"],
|
|
2170
|
+
fg: ["600", "400"]
|
|
2171
|
+
},
|
|
2172
|
+
fg: ["800", "200"],
|
|
2173
|
+
focusRing: ["blue/500", "blue/500"],
|
|
2174
|
+
kbd: {
|
|
2175
|
+
bg: ["white", "black"],
|
|
2176
|
+
fg: ["600", "400"],
|
|
2177
|
+
border: ["200", "800"]
|
|
2178
|
+
},
|
|
2179
|
+
link: {
|
|
2180
|
+
fg: ["blue/600", "blue/400"]
|
|
2181
|
+
},
|
|
2182
|
+
muted: {
|
|
2183
|
+
bg: ["50", "950"],
|
|
2184
|
+
fg: ["600", "400"]
|
|
2185
|
+
},
|
|
2186
|
+
shadow: {
|
|
2187
|
+
outline: ["500/0.3", "500/0.4"],
|
|
2188
|
+
umbra: ["gray/500/0.1", "black/0.2"],
|
|
2189
|
+
penumbra: ["gray/500/0.07", "black/0.14"],
|
|
2190
|
+
ambient: ["gray/500/0.06", "black/0.12"]
|
|
2191
|
+
},
|
|
2192
|
+
skeleton: {
|
|
2193
|
+
from: ["100", "900"],
|
|
2194
|
+
to: ["100/0.5", "900/0.5"]
|
|
2195
|
+
}
|
|
2196
|
+
},
|
|
2197
|
+
transparent: {
|
|
2198
|
+
bg: ["50", "black"],
|
|
2199
|
+
fg: ["600", "400"]
|
|
2200
|
+
},
|
|
2201
|
+
default: {
|
|
2202
|
+
bg: ["white", "950"],
|
|
2203
|
+
fg: ["black", "200"]
|
|
2204
|
+
},
|
|
2205
|
+
primary: {
|
|
2206
|
+
_hue: "blue"
|
|
2207
|
+
},
|
|
2208
|
+
positive: {
|
|
2209
|
+
_hue: "green",
|
|
2210
|
+
shadow: {
|
|
2211
|
+
outline: ["600/0.3", "500/0.25"]
|
|
2212
|
+
}
|
|
2213
|
+
},
|
|
2214
|
+
caution: {
|
|
2215
|
+
_hue: "yellow",
|
|
2216
|
+
shadow: {
|
|
2217
|
+
outline: ["600/0.3", "500/0.25"]
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
critical: {
|
|
2221
|
+
_hue: "red",
|
|
2222
|
+
shadow: {
|
|
2223
|
+
outline: ["500/0.3", "500/0.3"]
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
},
|
|
2227
|
+
button: {
|
|
2228
|
+
default: {
|
|
2229
|
+
"*": {
|
|
2230
|
+
"*": {
|
|
2231
|
+
_blend: ["screen", "multiply"],
|
|
2232
|
+
accent: {
|
|
2233
|
+
fg: ["purple/200", "purple/700"]
|
|
2234
|
+
},
|
|
2235
|
+
badge: {
|
|
2236
|
+
"*": {
|
|
2237
|
+
dot: ["300", "700"],
|
|
2238
|
+
icon: ["600", "400"]
|
|
2239
|
+
}
|
|
2240
|
+
},
|
|
2241
|
+
bg: ["500", "400"],
|
|
2242
|
+
border: ["500/0", "400/0"],
|
|
2243
|
+
code: {
|
|
2244
|
+
bg: ["500/0.2", "400/0.2"],
|
|
2245
|
+
fg: ["200", "700"]
|
|
2246
|
+
},
|
|
2247
|
+
fg: ["white", "black"],
|
|
2248
|
+
icon: ["200", "800"],
|
|
2249
|
+
kbd: {
|
|
2250
|
+
bg: ["900", "50"],
|
|
2251
|
+
fg: ["white", "black"],
|
|
2252
|
+
border: ["800", "200"]
|
|
2253
|
+
},
|
|
2254
|
+
link: {
|
|
2255
|
+
fg: ["blue/200", "blue/700"]
|
|
2256
|
+
},
|
|
2257
|
+
muted: {
|
|
2258
|
+
bg: ["900", "50"],
|
|
2259
|
+
fg: ["200", "700"]
|
|
2260
|
+
},
|
|
2261
|
+
skeleton: {
|
|
2262
|
+
from: ["900", "100"],
|
|
2263
|
+
to: ["900/0.5", "100/0.5"]
|
|
2264
|
+
}
|
|
2265
|
+
},
|
|
2266
|
+
hovered: {
|
|
2267
|
+
bg: ["600", "300"],
|
|
2268
|
+
border: ["600/0", "300/0"]
|
|
2269
|
+
},
|
|
2270
|
+
pressed: {
|
|
2271
|
+
bg: ["700", "200"]
|
|
2272
|
+
},
|
|
2273
|
+
selected: {
|
|
2274
|
+
bg: ["700", "200"]
|
|
2275
|
+
},
|
|
2276
|
+
disabled: {
|
|
2277
|
+
_hue: "gray",
|
|
2278
|
+
bg: ["200", "800"],
|
|
2279
|
+
icon: ["white", "black"]
|
|
2280
|
+
}
|
|
2281
|
+
},
|
|
2282
|
+
default: {
|
|
2283
|
+
"*": {
|
|
2284
|
+
bg: ["800", "200"]
|
|
2285
|
+
},
|
|
2286
|
+
hovered: {
|
|
2287
|
+
bg: ["900", "100"]
|
|
2288
|
+
},
|
|
2289
|
+
pressed: {
|
|
2290
|
+
bg: ["black", "white"]
|
|
2291
|
+
},
|
|
2292
|
+
selected: {
|
|
2293
|
+
bg: ["black", "white"]
|
|
2294
|
+
}
|
|
2295
|
+
},
|
|
2296
|
+
positive: {
|
|
2297
|
+
"*": {
|
|
2298
|
+
bg: ["600", "400"]
|
|
2299
|
+
},
|
|
2300
|
+
hovered: {
|
|
2301
|
+
bg: ["700", "300"]
|
|
2302
|
+
},
|
|
2303
|
+
pressed: {
|
|
2304
|
+
bg: ["800", "200"]
|
|
2305
|
+
},
|
|
2306
|
+
selected: {
|
|
2307
|
+
bg: ["800", "200"]
|
|
2308
|
+
}
|
|
2309
|
+
},
|
|
2310
|
+
caution: {
|
|
2311
|
+
"*": {
|
|
2312
|
+
bg: ["600", "400"]
|
|
2313
|
+
},
|
|
2314
|
+
hovered: {
|
|
2315
|
+
bg: ["700", "300"]
|
|
2316
|
+
},
|
|
2317
|
+
pressed: {
|
|
2318
|
+
bg: ["800", "200"]
|
|
2319
|
+
},
|
|
2320
|
+
selected: {
|
|
2321
|
+
bg: ["800", "200"]
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
},
|
|
2325
|
+
ghost: {
|
|
2326
|
+
"*": {
|
|
2327
|
+
"*": {
|
|
2328
|
+
_blend: ["multiply", "screen"],
|
|
2329
|
+
bg: ["50", "950"],
|
|
2330
|
+
fg: ["700", "400"],
|
|
2331
|
+
icon: ["600", "500"],
|
|
2332
|
+
border: ["100", "900"],
|
|
2333
|
+
accent: {
|
|
2334
|
+
fg: ["purple/700/0.6", "purple/400/0.8"]
|
|
2335
|
+
},
|
|
2336
|
+
link: {
|
|
2337
|
+
fg: ["blue/700/0.6", "blue/400/0.8"]
|
|
2338
|
+
},
|
|
2339
|
+
muted: {
|
|
2340
|
+
bg: ["100", "950"],
|
|
2341
|
+
fg: ["700/0.6", "400/0.6"]
|
|
2342
|
+
},
|
|
2343
|
+
code: {
|
|
2344
|
+
bg: ["500/0.1", "400/0.1"],
|
|
2345
|
+
fg: ["700/0.6", "400/0.6"]
|
|
2346
|
+
},
|
|
2347
|
+
skeleton: {
|
|
2348
|
+
from: ["100", "900"],
|
|
2349
|
+
to: ["100/0.5", "900/0.5"]
|
|
2350
|
+
},
|
|
2351
|
+
badge: {
|
|
2352
|
+
"*": {
|
|
2353
|
+
dot: ["300", "700"],
|
|
2354
|
+
icon: ["600", "400"]
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
},
|
|
2358
|
+
hovered: {
|
|
2359
|
+
bg: ["100", "900"],
|
|
2360
|
+
fg: ["700", "300"]
|
|
2361
|
+
},
|
|
2362
|
+
pressed: {
|
|
2363
|
+
bg: ["100", "900"],
|
|
2364
|
+
fg: ["800", "200"]
|
|
2365
|
+
},
|
|
2366
|
+
selected: {
|
|
2367
|
+
bg: ["100", "900"],
|
|
2368
|
+
fg: ["800", "200"]
|
|
2369
|
+
},
|
|
2370
|
+
disabled: {
|
|
2371
|
+
_hue: "gray",
|
|
2372
|
+
fg: ["200", "800"],
|
|
2373
|
+
icon: ["200", "800"],
|
|
2374
|
+
border: ["100", "900"],
|
|
2375
|
+
muted: {
|
|
2376
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2377
|
+
},
|
|
2378
|
+
accent: {
|
|
2379
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2380
|
+
},
|
|
2381
|
+
link: {
|
|
2382
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2383
|
+
},
|
|
2384
|
+
code: {
|
|
2385
|
+
bg: ["50/0.5", "950/0.5"],
|
|
2386
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
},
|
|
2390
|
+
positive: {
|
|
2391
|
+
"*": {
|
|
2392
|
+
border: ["600/0.2", "800"]
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
caution: {
|
|
2396
|
+
"*": {
|
|
2397
|
+
border: ["600/0.2", "800"]
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
},
|
|
2401
|
+
bleed: {
|
|
2402
|
+
"*": {
|
|
2403
|
+
"*": {
|
|
2404
|
+
_blend: ["multiply", "screen"],
|
|
2405
|
+
bg: ["white", "black"],
|
|
2406
|
+
fg: ["700", "300"],
|
|
2407
|
+
icon: ["700/0.7", "300/0.7"],
|
|
2408
|
+
border: ["white/0", "black/0"],
|
|
2409
|
+
muted: {
|
|
2410
|
+
bg: ["100", "950"],
|
|
2411
|
+
fg: ["700/0.7", "300/0.7"]
|
|
2412
|
+
},
|
|
2413
|
+
accent: {
|
|
2414
|
+
fg: ["purple/700/0.7", "purple/300/0.7"]
|
|
2415
|
+
},
|
|
2416
|
+
link: {
|
|
2417
|
+
fg: ["blue/700/0.7", "blue/300/0.7"]
|
|
2418
|
+
},
|
|
2419
|
+
code: {
|
|
2420
|
+
bg: ["100", "950"],
|
|
2421
|
+
fg: ["600", "300"]
|
|
2422
|
+
},
|
|
2423
|
+
skeleton: {
|
|
2424
|
+
from: ["100", "900"],
|
|
2425
|
+
to: ["100/0.5", "900/0.5"]
|
|
2426
|
+
},
|
|
2427
|
+
badge: {
|
|
2428
|
+
"*": {
|
|
2429
|
+
dot: ["300", "700"],
|
|
2430
|
+
icon: ["600", "400"]
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
hovered: {
|
|
2435
|
+
bg: ["50", "950"],
|
|
2436
|
+
fg: ["700", "300"],
|
|
2437
|
+
icon: ["700/0.7", "400/0.7"]
|
|
2438
|
+
},
|
|
2439
|
+
pressed: {
|
|
2440
|
+
bg: ["100", "900"],
|
|
2441
|
+
fg: ["800", "200"],
|
|
2442
|
+
icon: ["800/0.7", "200/0.7"]
|
|
2443
|
+
},
|
|
2444
|
+
selected: {
|
|
2445
|
+
bg: ["100", "900"],
|
|
2446
|
+
fg: ["800", "200"],
|
|
2447
|
+
icon: ["800/0.7", "200/0.7"]
|
|
2448
|
+
},
|
|
2449
|
+
disabled: {
|
|
2450
|
+
_hue: "gray",
|
|
2451
|
+
fg: ["200", "800"],
|
|
2452
|
+
muted: {
|
|
2453
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2454
|
+
},
|
|
2455
|
+
accent: {
|
|
2456
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2457
|
+
},
|
|
2458
|
+
link: {
|
|
2459
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2460
|
+
},
|
|
2461
|
+
code: {
|
|
2462
|
+
bg: ["50/0.5", "950/0.5"],
|
|
2463
|
+
fg: ["200/0.6", "900/0.6"]
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
},
|
|
2469
|
+
input: {
|
|
2470
|
+
"*": {
|
|
2471
|
+
"*": {
|
|
2472
|
+
_blend: ["multiply", "screen"],
|
|
2473
|
+
bg: ["white", "black"],
|
|
2474
|
+
border: ["200", "800"],
|
|
2475
|
+
fg: ["black", "200"],
|
|
2476
|
+
muted: {
|
|
2477
|
+
bg: ["50", "950"]
|
|
2478
|
+
},
|
|
2479
|
+
placeholder: ["400", "600/0.5"]
|
|
2480
|
+
},
|
|
2481
|
+
hovered: {
|
|
2482
|
+
border: ["300", "800"]
|
|
2483
|
+
},
|
|
2484
|
+
readOnly: {
|
|
2485
|
+
border: ["200/0", "900/0"],
|
|
2486
|
+
bg: ["100", "950"],
|
|
2487
|
+
fg: ["800", "200"]
|
|
2488
|
+
},
|
|
2489
|
+
disabled: {
|
|
2490
|
+
fg: ["200", "800"],
|
|
2491
|
+
border: ["100", "900"]
|
|
2492
|
+
}
|
|
2493
|
+
},
|
|
2494
|
+
invalid: {
|
|
2495
|
+
"*": {
|
|
2496
|
+
_hue: "red",
|
|
2497
|
+
bg: ["100", "950"]
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
},
|
|
2501
|
+
selectable: {
|
|
2502
|
+
"*": {
|
|
2503
|
+
"*": {
|
|
2504
|
+
_blend: ["multiply", "screen"],
|
|
2505
|
+
bg: ["white", "black"],
|
|
2506
|
+
fg: ["800", "200"],
|
|
2507
|
+
icon: ["700/0.7", "300/0.7"],
|
|
2508
|
+
avatar: {
|
|
2509
|
+
"*": {
|
|
2510
|
+
_blend: ["screen", "multiply"],
|
|
2511
|
+
bg: ["500", "400"],
|
|
2512
|
+
fg: ["white", "black"]
|
|
2513
|
+
}
|
|
2514
|
+
// yellow: {bg: ['600', '400']},
|
|
2515
|
+
// green: {bg: ['600', '400']},
|
|
2516
|
+
// cyan: {bg: ['600', '400']},
|
|
2517
|
+
},
|
|
2518
|
+
border: ["200", "800"],
|
|
2519
|
+
muted: {
|
|
2520
|
+
bg: ["50", "950"],
|
|
2521
|
+
fg: ["700", "300"]
|
|
2522
|
+
},
|
|
2523
|
+
accent: {
|
|
2524
|
+
fg: ["purple/600", "purple/400"]
|
|
2525
|
+
},
|
|
2526
|
+
link: {
|
|
2527
|
+
fg: ["blue/700", "blue/300"]
|
|
2528
|
+
},
|
|
2529
|
+
code: {
|
|
2530
|
+
bg: ["100", "950"],
|
|
2531
|
+
fg: ["700", "300"]
|
|
2532
|
+
},
|
|
2533
|
+
skeleton: {
|
|
2534
|
+
from: ["100", "900"],
|
|
2535
|
+
to: ["100/0.5", "900/0.5"]
|
|
2536
|
+
},
|
|
2537
|
+
badge: {
|
|
2538
|
+
"*": {
|
|
2539
|
+
// _blend: ['multiply', 'screen'],
|
|
2540
|
+
bg: ["100", "900"],
|
|
2541
|
+
fg: ["600", "200"],
|
|
2542
|
+
dot: ["300", "700"],
|
|
2543
|
+
icon: ["600", "400"]
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
kbd: {
|
|
2547
|
+
// _blend: ['multiply', 'screen'],
|
|
2548
|
+
bg: ["white", "black"],
|
|
2549
|
+
fg: ["600", "400"],
|
|
2550
|
+
border: ["200", "800"]
|
|
2551
|
+
}
|
|
2552
|
+
},
|
|
2553
|
+
hovered: {
|
|
2554
|
+
bg: ["50", "950"]
|
|
2555
|
+
},
|
|
2556
|
+
pressed: {
|
|
2557
|
+
bg: ["100", "900"]
|
|
2558
|
+
},
|
|
2559
|
+
selected: {
|
|
2560
|
+
_blend: ["screen", "multiply"],
|
|
2561
|
+
bg: ["500", "400"],
|
|
2562
|
+
fg: ["white", "black"],
|
|
2563
|
+
icon: ["200", "800"],
|
|
2564
|
+
avatar: {
|
|
2565
|
+
"*": {
|
|
2566
|
+
_blend: ["multiply", "screen"],
|
|
2567
|
+
bg: ["white", "black"],
|
|
2568
|
+
fg: ["black", "white"]
|
|
2569
|
+
}
|
|
2570
|
+
// magenta: {_hue: 'green'},
|
|
2571
|
+
// yellow: {bg: ['600', '400']},
|
|
2572
|
+
// green: {bg: ['600', '400']},
|
|
2573
|
+
// cyan: {bg: ['600', '400']},
|
|
2574
|
+
},
|
|
2575
|
+
badge: {
|
|
2576
|
+
"*": {
|
|
2577
|
+
// _blend: ['multiply', 'screen'],
|
|
2578
|
+
// _blend: ['screen', 'multiply'],
|
|
2579
|
+
bg: ["700", "300"],
|
|
2580
|
+
fg: ["white", "black"]
|
|
2581
|
+
}
|
|
2582
|
+
},
|
|
2583
|
+
border: ["500/0.2", "400/0.2"],
|
|
2584
|
+
muted: {
|
|
2585
|
+
bg: ["900", "50"],
|
|
2586
|
+
fg: ["200", "800"]
|
|
2587
|
+
},
|
|
2588
|
+
accent: {
|
|
2589
|
+
fg: ["purple/200", "purple/800"]
|
|
2590
|
+
},
|
|
2591
|
+
kbd: {
|
|
2592
|
+
bg: ["black/0", "white/0"],
|
|
2593
|
+
fg: ["white", "black"],
|
|
2594
|
+
border: ["gray/700", "gray/300"]
|
|
2595
|
+
},
|
|
2596
|
+
link: {
|
|
2597
|
+
fg: ["blue/200", "blue/800"]
|
|
2598
|
+
},
|
|
2599
|
+
code: {
|
|
2600
|
+
bg: ["500/0.2", "400/0.2"],
|
|
2601
|
+
fg: ["200", "700"]
|
|
2602
|
+
},
|
|
2603
|
+
skeleton: {
|
|
2604
|
+
from: ["900", "100"],
|
|
2605
|
+
to: ["900/0.5", "100/0.5"]
|
|
2606
|
+
}
|
|
2607
|
+
// badge: {
|
|
2608
|
+
// '*': {
|
|
2609
|
+
// _blend: ['multiply', 'screen'],
|
|
2610
|
+
// bg: ['900', '100'],
|
|
2611
|
+
// fg: ['white', 'black'],
|
|
2612
|
+
// dot: ['700', '300'],
|
|
2613
|
+
// icon: ['400', '600'],
|
|
2614
|
+
// },
|
|
2615
|
+
// },
|
|
2616
|
+
},
|
|
2617
|
+
disabled: {
|
|
2618
|
+
fg: ["200", "800"],
|
|
2619
|
+
icon: ["200", "800"],
|
|
2620
|
+
muted: {
|
|
2621
|
+
fg: ["200", "800/0.5"]
|
|
2622
|
+
},
|
|
2623
|
+
accent: {
|
|
2624
|
+
fg: ["purple/200", "purple/800/0.5"]
|
|
2625
|
+
},
|
|
2626
|
+
link: {
|
|
2627
|
+
fg: ["blue/200", "blue/800/0.5"]
|
|
2628
|
+
},
|
|
2629
|
+
code: {
|
|
2630
|
+
bg: ["100", "950/0.5"],
|
|
2631
|
+
fg: ["200", "800/0.5"]
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
},
|
|
2635
|
+
default: {
|
|
2636
|
+
selected: {
|
|
2637
|
+
_hue: "blue"
|
|
2638
|
+
// bg: ['500', '400'],
|
|
2639
|
+
}
|
|
2640
|
+
},
|
|
2641
|
+
critical: {
|
|
2642
|
+
disabled: {
|
|
2643
|
+
bg: ["50/0.5", "950/0.5"]
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
},
|
|
2647
|
+
syntax: {
|
|
2648
|
+
atrule: ["purple/700", "purple/400"],
|
|
2649
|
+
attrName: ["green/700", "green/400"],
|
|
2650
|
+
attrValue: ["yellow/700", "yellow/400"],
|
|
2651
|
+
attribute: ["yellow/700", "yellow/400"],
|
|
2652
|
+
boolean: ["purple/700", "purple/400"],
|
|
2653
|
+
builtin: ["purple/700", "purple/400"],
|
|
2654
|
+
cdata: ["yellow/700", "yellow/400"],
|
|
2655
|
+
char: ["yellow/700", "yellow/400"],
|
|
2656
|
+
class: ["orange/700", "orange/400"],
|
|
2657
|
+
className: ["cyan/700", "cyan/400"],
|
|
2658
|
+
comment: ["gray/700/0.5", "gray/400/0.5"],
|
|
2659
|
+
constant: ["purple/700", "purple/400"],
|
|
2660
|
+
deleted: ["red/700", "red/400"],
|
|
2661
|
+
entity: ["red/700", "red/400"],
|
|
2662
|
+
function: ["green/700", "green/400"],
|
|
2663
|
+
hexcode: ["blue/700", "blue/400"],
|
|
2664
|
+
id: ["purple/700", "purple/400"],
|
|
2665
|
+
important: ["purple/700", "purple/400"],
|
|
2666
|
+
inserted: ["yellow/700", "yellow/400"],
|
|
2667
|
+
keyword: ["magenta/700", "magenta/400"],
|
|
2668
|
+
number: ["purple/700", "purple/400"],
|
|
2669
|
+
operator: ["magenta/700", "magenta/400"],
|
|
2670
|
+
property: ["blue/700", "blue/400"],
|
|
2671
|
+
pseudoClass: ["yellow/700", "yellow/400"],
|
|
2672
|
+
pseudoElement: ["yellow/700", "yellow/400"],
|
|
2673
|
+
punctuation: ["gray/700", "gray/400"],
|
|
2674
|
+
regex: ["blue/700", "blue/400"],
|
|
2675
|
+
selector: ["red/700", "red/400"],
|
|
2676
|
+
string: ["yellow/700", "yellow/400"],
|
|
2677
|
+
symbol: ["purple/700", "purple/400"],
|
|
2678
|
+
tag: ["red/700", "red/400"],
|
|
2679
|
+
unit: ["orange/700", "orange/400"],
|
|
2680
|
+
url: ["red/700", "red/400"],
|
|
2681
|
+
variable: ["red/700", "red/400"]
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
function isRecord(value) {
|
|
2685
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
2686
|
+
}
|
|
2687
|
+
function merge() {
|
|
2688
|
+
for (var _len = arguments.length, records = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2689
|
+
records[_key] = arguments[_key];
|
|
2690
|
+
}
|
|
2691
|
+
const _records = records.filter(Boolean);
|
|
2692
|
+
if (_records.length === 0) {
|
|
2693
|
+
return {};
|
|
2694
|
+
}
|
|
2695
|
+
return _records.reduce(_merge, {});
|
|
2696
|
+
}
|
|
2697
|
+
function _merge(acc, source) {
|
|
2698
|
+
for (const key of Object.keys(source)) {
|
|
2699
|
+
const prevValue = acc[key];
|
|
2700
|
+
const nextValue = source[key];
|
|
2701
|
+
if (isRecord(prevValue) && isRecord(nextValue)) {
|
|
2702
|
+
acc[key] = merge(prevValue, nextValue);
|
|
2703
|
+
} else {
|
|
2704
|
+
acc[key] = nextValue;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
return acc;
|
|
2708
|
+
}
|
|
2709
|
+
function resolveColorTokens(inputTokens) {
|
|
2710
|
+
const tokens = merge(defaultColorTokens, inputTokens);
|
|
2711
|
+
return {
|
|
2712
|
+
base: resolveBaseColorTokens(tokens),
|
|
2713
|
+
button: resolveButtonColorTokens(tokens),
|
|
2714
|
+
input: resolveInputColorTokens(tokens),
|
|
2715
|
+
selectable: resolveSelectableColorTokens(tokens),
|
|
2716
|
+
syntax: tokens.syntax
|
|
2717
|
+
};
|
|
2718
|
+
}
|
|
2719
|
+
function resolveBaseColorTokens(sparseTokens) {
|
|
2720
|
+
const tokens = {};
|
|
2721
|
+
for (const tone of THEME_COLOR_CARD_TONES) {
|
|
2722
|
+
tokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
2723
|
+
}
|
|
2724
|
+
return tokens;
|
|
2725
|
+
}
|
|
2726
|
+
function resolveBaseColorTones(inputTokens, tone) {
|
|
2727
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
|
|
2728
|
+
const spec = merge((_a = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _a["*"], (_b = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _b[tone]);
|
|
2729
|
+
const hue = spec._hue || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue) || "gray";
|
|
2730
|
+
return {
|
|
2731
|
+
...spec,
|
|
2732
|
+
_hue: hue,
|
|
2733
|
+
avatar: {
|
|
2734
|
+
gray: merge({
|
|
2735
|
+
_hue: "gray"
|
|
2736
|
+
}, (_e = spec.avatar) == null ? void 0 : _e["*"], (_f = spec.avatar) == null ? void 0 : _f.gray),
|
|
2737
|
+
blue: merge({
|
|
2738
|
+
_hue: "blue"
|
|
2739
|
+
}, (_g = spec.avatar) == null ? void 0 : _g["*"], (_h = spec.avatar) == null ? void 0 : _h.blue),
|
|
2740
|
+
purple: merge({
|
|
2741
|
+
_hue: "purple"
|
|
2742
|
+
}, (_i = spec.avatar) == null ? void 0 : _i["*"], (_j = spec.avatar) == null ? void 0 : _j.purple),
|
|
2743
|
+
magenta: merge({
|
|
2744
|
+
_hue: "magenta"
|
|
2745
|
+
}, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.magenta),
|
|
2746
|
+
red: merge({
|
|
2747
|
+
_hue: "red"
|
|
2748
|
+
}, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.red),
|
|
2749
|
+
orange: merge({
|
|
2750
|
+
_hue: "orange"
|
|
2751
|
+
}, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.orange),
|
|
2752
|
+
yellow: merge({
|
|
2753
|
+
_hue: "yellow"
|
|
2754
|
+
}, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.yellow),
|
|
2755
|
+
green: merge({
|
|
2756
|
+
_hue: "green"
|
|
2757
|
+
}, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.green),
|
|
2758
|
+
cyan: merge({
|
|
2759
|
+
_hue: "cyan"
|
|
2760
|
+
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.cyan)
|
|
2761
|
+
},
|
|
2762
|
+
badge: {
|
|
2763
|
+
default: {
|
|
2764
|
+
_hue: ((_x = (_w = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _w.default) == null ? void 0 : _x._hue) || hue,
|
|
2765
|
+
...((_y = spec.badge) == null ? void 0 : _y["*"]),
|
|
2766
|
+
...((_z = spec.badge) == null ? void 0 : _z.default)
|
|
2767
|
+
},
|
|
2768
|
+
primary: {
|
|
2769
|
+
_hue: ((_B = (_A = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _A.primary) == null ? void 0 : _B._hue) || hue,
|
|
2770
|
+
...((_C = spec.badge) == null ? void 0 : _C["*"]),
|
|
2771
|
+
...((_D = spec.badge) == null ? void 0 : _D.primary)
|
|
2772
|
+
},
|
|
2773
|
+
positive: {
|
|
2774
|
+
_hue: ((_F = (_E = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _E.positive) == null ? void 0 : _F._hue) || hue,
|
|
2775
|
+
...((_G = spec.badge) == null ? void 0 : _G["*"]),
|
|
2776
|
+
...((_H = spec.badge) == null ? void 0 : _H.positive)
|
|
2777
|
+
},
|
|
2778
|
+
caution: {
|
|
2779
|
+
_hue: ((_J = (_I = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _I.caution) == null ? void 0 : _J._hue) || hue,
|
|
2780
|
+
...((_K = spec.badge) == null ? void 0 : _K["*"]),
|
|
2781
|
+
...((_L = spec.badge) == null ? void 0 : _L.caution)
|
|
2782
|
+
},
|
|
2783
|
+
critical: {
|
|
2784
|
+
_hue: ((_N = (_M = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _M.critical) == null ? void 0 : _N._hue) || hue,
|
|
2785
|
+
...((_O = spec.badge) == null ? void 0 : _O["*"]),
|
|
2786
|
+
...((_P = spec.badge) == null ? void 0 : _P.critical)
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
function resolveButtonColorTokens(inputTokens) {
|
|
2792
|
+
const tokens = {};
|
|
2793
|
+
for (const mode of THEME_COLOR_BUTTON_MODES) {
|
|
2794
|
+
tokens[mode] = resolveButtonToneColorTokens(inputTokens, mode);
|
|
2795
|
+
}
|
|
2796
|
+
return tokens;
|
|
2797
|
+
}
|
|
2798
|
+
function resolveButtonToneColorTokens(inputTokens, mode) {
|
|
2799
|
+
const tokens = {};
|
|
2800
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
2801
|
+
tokens[tone] = resolveButtonModeColorTokens(inputTokens, mode, tone);
|
|
2802
|
+
}
|
|
2803
|
+
return tokens;
|
|
2804
|
+
}
|
|
2805
|
+
function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
2806
|
+
const tokens = {};
|
|
2807
|
+
for (const state of THEME_COLOR_STATES) {
|
|
2808
|
+
tokens[state] = resolveButtonStateColorTokens(inputTokens, tone, mode, state);
|
|
2809
|
+
}
|
|
2810
|
+
return tokens;
|
|
2811
|
+
}
|
|
2812
|
+
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2813
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z;
|
|
2814
|
+
const spec = merge((_c = (_b = (_a = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _a[mode]) == null ? void 0 : _b["*"]) == null ? void 0 : _c["*"], (_f = (_e = (_d = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _d[mode]) == null ? void 0 : _e[tone]) == null ? void 0 : _f["*"], (_i = (_h = (_g = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _g[mode]) == null ? void 0 : _h["*"]) == null ? void 0 : _i[state], (_l = (_k = (_j = inputTokens == null ? void 0 : inputTokens.button) == null ? void 0 : _j[mode]) == null ? void 0 : _k[tone]) == null ? void 0 : _l[state]);
|
|
2815
|
+
const hue = spec._hue || ((_n = (_m = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue);
|
|
2816
|
+
return {
|
|
2817
|
+
...spec,
|
|
2818
|
+
_hue: hue,
|
|
2819
|
+
avatar: {
|
|
2820
|
+
gray: merge({
|
|
2821
|
+
_hue: "gray"
|
|
2822
|
+
}, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.gray),
|
|
2823
|
+
blue: merge({
|
|
2824
|
+
_hue: "blue"
|
|
2825
|
+
}, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.blue),
|
|
2826
|
+
purple: merge({
|
|
2827
|
+
_hue: "purple"
|
|
2828
|
+
}, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.purple),
|
|
2829
|
+
magenta: merge({
|
|
2830
|
+
_hue: "magenta"
|
|
2831
|
+
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.magenta),
|
|
2832
|
+
red: merge({
|
|
2833
|
+
_hue: "red"
|
|
2834
|
+
}, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.red),
|
|
2835
|
+
orange: merge({
|
|
2836
|
+
_hue: "orange"
|
|
2837
|
+
}, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.orange),
|
|
2838
|
+
yellow: merge({
|
|
2839
|
+
_hue: "yellow"
|
|
2840
|
+
}, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.yellow),
|
|
2841
|
+
green: merge({
|
|
2842
|
+
_hue: "green"
|
|
2843
|
+
}, (_C = spec.avatar) == null ? void 0 : _C["*"], (_D = spec.avatar) == null ? void 0 : _D.green),
|
|
2844
|
+
cyan: merge({
|
|
2845
|
+
_hue: "cyan"
|
|
2846
|
+
}, (_E = spec.avatar) == null ? void 0 : _E["*"], (_F = spec.avatar) == null ? void 0 : _F.cyan)
|
|
2847
|
+
},
|
|
2848
|
+
badge: {
|
|
2849
|
+
default: {
|
|
2850
|
+
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.default) == null ? void 0 : _H._hue,
|
|
2851
|
+
...((_I = spec.badge) == null ? void 0 : _I["*"]),
|
|
2852
|
+
...((_J = spec.badge) == null ? void 0 : _J.default)
|
|
2853
|
+
},
|
|
2854
|
+
primary: {
|
|
2855
|
+
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.primary) == null ? void 0 : _L._hue,
|
|
2856
|
+
...((_M = spec.badge) == null ? void 0 : _M["*"]),
|
|
2857
|
+
...((_N = spec.badge) == null ? void 0 : _N.primary)
|
|
2858
|
+
},
|
|
2859
|
+
positive: {
|
|
2860
|
+
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.positive) == null ? void 0 : _P._hue,
|
|
2861
|
+
...((_Q = spec.badge) == null ? void 0 : _Q["*"]),
|
|
2862
|
+
...((_R = spec.badge) == null ? void 0 : _R.positive)
|
|
2863
|
+
},
|
|
2864
|
+
caution: {
|
|
2865
|
+
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.caution) == null ? void 0 : _T._hue,
|
|
2866
|
+
...((_U = spec.badge) == null ? void 0 : _U["*"]),
|
|
2867
|
+
...((_V = spec.badge) == null ? void 0 : _V.caution)
|
|
2868
|
+
},
|
|
2869
|
+
critical: {
|
|
2870
|
+
_hue: (_X = (_W = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _W.critical) == null ? void 0 : _X._hue,
|
|
2871
|
+
...((_Y = spec.badge) == null ? void 0 : _Y["*"]),
|
|
2872
|
+
...((_Z = spec.badge) == null ? void 0 : _Z.critical)
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
function resolveInputColorTokens(inputTokens) {
|
|
2878
|
+
const tokens = {};
|
|
2879
|
+
for (const mode of THEME_COLOR_INPUT_MODES) {
|
|
2880
|
+
tokens[mode] = resolveInputModeColorTokens(inputTokens, mode);
|
|
2881
|
+
}
|
|
2882
|
+
return tokens;
|
|
2883
|
+
}
|
|
2884
|
+
function resolveInputModeColorTokens(inputTokens, mode) {
|
|
2885
|
+
const states = {};
|
|
2886
|
+
for (const state of THEME_COLOR_INPUT_STATES) {
|
|
2887
|
+
states[state] = resolveInputStateColorTokens(inputTokens, mode, state);
|
|
2888
|
+
}
|
|
2889
|
+
return states;
|
|
2890
|
+
}
|
|
2891
|
+
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2892
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2893
|
+
const spec = merge((_b = (_a = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"], (_d = (_c = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _c[mode]) == null ? void 0 : _d["*"], (_f = (_e = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state], (_h = (_g = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _g[mode]) == null ? void 0 : _h[state]);
|
|
2894
|
+
const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.input) == null ? void 0 : _i[mode]) == null ? void 0 : _j._hue);
|
|
2895
|
+
return {
|
|
2896
|
+
...spec,
|
|
2897
|
+
_hue: hue
|
|
2898
|
+
};
|
|
2899
|
+
}
|
|
2900
|
+
function resolveSelectableColorTokens(inputTokens) {
|
|
2901
|
+
const tokens = {};
|
|
2902
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
2903
|
+
tokens[tone] = resolveSelectableToneColorTokens(inputTokens, tone);
|
|
2904
|
+
}
|
|
2905
|
+
return tokens;
|
|
2906
|
+
}
|
|
2907
|
+
function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
2908
|
+
var _a, _b, _c, _d;
|
|
2909
|
+
const states = {
|
|
2910
|
+
_hue: ((_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a[tone]) == null ? void 0 : _b._hue) || ((_d = (_c = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _c[tone]) == null ? void 0 : _d._hue)
|
|
2911
|
+
};
|
|
2912
|
+
for (const state of THEME_COLOR_STATES) {
|
|
2913
|
+
states[state] = resolveSelectableStateColorTokens(inputTokens, tone, state);
|
|
2914
|
+
}
|
|
2915
|
+
return states;
|
|
2916
|
+
}
|
|
2917
|
+
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2918
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V;
|
|
2919
|
+
const spec = merge((_b = (_a = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _a["*"]) == null ? void 0 : _b["*"], (_d = (_c = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _c[tone]) == null ? void 0 : _d["*"], (_f = (_e = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _e["*"]) == null ? void 0 : _f[state], (_h = (_g = inputTokens == null ? void 0 : inputTokens.selectable) == null ? void 0 : _g[tone]) == null ? void 0 : _h[state]);
|
|
2920
|
+
const hue = spec._hue || ((_j = (_i = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _i[tone]) == null ? void 0 : _j._hue);
|
|
2921
|
+
return {
|
|
2922
|
+
...spec,
|
|
2923
|
+
_hue: hue,
|
|
2924
|
+
avatar: {
|
|
2925
|
+
gray: merge({
|
|
2926
|
+
_hue: "gray"
|
|
2927
|
+
}, (_k = spec.avatar) == null ? void 0 : _k["*"], (_l = spec.avatar) == null ? void 0 : _l.gray),
|
|
2928
|
+
blue: merge({
|
|
2929
|
+
_hue: "blue"
|
|
2930
|
+
}, (_m = spec.avatar) == null ? void 0 : _m["*"], (_n = spec.avatar) == null ? void 0 : _n.blue),
|
|
2931
|
+
purple: merge({
|
|
2932
|
+
_hue: "purple"
|
|
2933
|
+
}, (_o = spec.avatar) == null ? void 0 : _o["*"], (_p = spec.avatar) == null ? void 0 : _p.purple),
|
|
2934
|
+
magenta: merge({
|
|
2935
|
+
_hue: "magenta"
|
|
2936
|
+
}, (_q = spec.avatar) == null ? void 0 : _q["*"], (_r = spec.avatar) == null ? void 0 : _r.magenta),
|
|
2937
|
+
red: merge({
|
|
2938
|
+
_hue: "red"
|
|
2939
|
+
}, (_s = spec.avatar) == null ? void 0 : _s["*"], (_t = spec.avatar) == null ? void 0 : _t.red),
|
|
2940
|
+
orange: merge({
|
|
2941
|
+
_hue: "orange"
|
|
2942
|
+
}, (_u = spec.avatar) == null ? void 0 : _u["*"], (_v = spec.avatar) == null ? void 0 : _v.orange),
|
|
2943
|
+
yellow: merge({
|
|
2944
|
+
_hue: "yellow"
|
|
2945
|
+
}, (_w = spec.avatar) == null ? void 0 : _w["*"], (_x = spec.avatar) == null ? void 0 : _x.yellow),
|
|
2946
|
+
green: merge({
|
|
2947
|
+
_hue: "green"
|
|
2948
|
+
}, (_y = spec.avatar) == null ? void 0 : _y["*"], (_z = spec.avatar) == null ? void 0 : _z.green),
|
|
2949
|
+
cyan: merge({
|
|
2950
|
+
_hue: "cyan"
|
|
2951
|
+
}, (_A = spec.avatar) == null ? void 0 : _A["*"], (_B = spec.avatar) == null ? void 0 : _B.cyan)
|
|
2952
|
+
},
|
|
2953
|
+
badge: {
|
|
2954
|
+
default: {
|
|
2955
|
+
_hue: (_D = (_C = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _C.default) == null ? void 0 : _D._hue,
|
|
2956
|
+
...((_E = spec.badge) == null ? void 0 : _E["*"]),
|
|
2957
|
+
...((_F = spec.badge) == null ? void 0 : _F.default)
|
|
2958
|
+
},
|
|
2959
|
+
primary: {
|
|
2960
|
+
_hue: (_H = (_G = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _G.primary) == null ? void 0 : _H._hue,
|
|
2961
|
+
...((_I = spec.badge) == null ? void 0 : _I["*"]),
|
|
2962
|
+
...((_J = spec.badge) == null ? void 0 : _J.primary)
|
|
2963
|
+
},
|
|
2964
|
+
positive: {
|
|
2965
|
+
_hue: (_L = (_K = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _K.positive) == null ? void 0 : _L._hue,
|
|
2966
|
+
...((_M = spec.badge) == null ? void 0 : _M["*"]),
|
|
2967
|
+
...((_N = spec.badge) == null ? void 0 : _N.positive)
|
|
2968
|
+
},
|
|
2969
|
+
caution: {
|
|
2970
|
+
_hue: (_P = (_O = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _O.caution) == null ? void 0 : _P._hue,
|
|
2971
|
+
...((_Q = spec.badge) == null ? void 0 : _Q["*"]),
|
|
2972
|
+
...((_R = spec.badge) == null ? void 0 : _R.caution)
|
|
2973
|
+
},
|
|
2974
|
+
critical: {
|
|
2975
|
+
_hue: (_T = (_S = inputTokens == null ? void 0 : inputTokens.base) == null ? void 0 : _S.critical) == null ? void 0 : _T._hue,
|
|
2976
|
+
...((_U = spec.badge) == null ? void 0 : _U["*"]),
|
|
2977
|
+
...((_V = spec.badge) == null ? void 0 : _V.critical)
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
};
|
|
2981
|
+
}
|
|
2982
|
+
function buildColorTheme(config) {
|
|
2983
|
+
const resolvedConfig = {
|
|
2984
|
+
...config,
|
|
2985
|
+
color: resolveColorTokens(config == null ? void 0 : config.color)
|
|
2986
|
+
};
|
|
2987
|
+
return {
|
|
2988
|
+
light: buildColorScheme({
|
|
2989
|
+
scheme: "light"
|
|
2990
|
+
}, resolvedConfig),
|
|
2991
|
+
dark: buildColorScheme({
|
|
2992
|
+
scheme: "dark"
|
|
2993
|
+
}, resolvedConfig)
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
function buildColorScheme(options, config) {
|
|
2997
|
+
const {
|
|
2998
|
+
scheme
|
|
2999
|
+
} = options;
|
|
3000
|
+
return {
|
|
3001
|
+
transparent: buildCardColorTheme({
|
|
3002
|
+
scheme,
|
|
3003
|
+
tone: "transparent"
|
|
3004
|
+
}, config),
|
|
3005
|
+
default: buildCardColorTheme({
|
|
3006
|
+
scheme,
|
|
3007
|
+
tone: "default"
|
|
3008
|
+
}, config),
|
|
3009
|
+
primary: buildCardColorTheme({
|
|
3010
|
+
scheme,
|
|
3011
|
+
tone: "primary"
|
|
3012
|
+
}, config),
|
|
3013
|
+
positive: buildCardColorTheme({
|
|
3014
|
+
scheme,
|
|
3015
|
+
tone: "positive"
|
|
3016
|
+
}, config),
|
|
3017
|
+
caution: buildCardColorTheme({
|
|
3018
|
+
scheme,
|
|
3019
|
+
tone: "caution"
|
|
3020
|
+
}, config),
|
|
3021
|
+
critical: buildCardColorTheme({
|
|
3022
|
+
scheme,
|
|
3023
|
+
tone: "critical"
|
|
3024
|
+
}, config)
|
|
3025
|
+
};
|
|
3026
|
+
}
|
|
3027
|
+
function buildCardColorTheme(options, config) {
|
|
3028
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
3029
|
+
const {
|
|
3030
|
+
scheme,
|
|
3031
|
+
tone
|
|
3032
|
+
} = options;
|
|
3033
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
|
|
3034
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3035
|
+
const context = {
|
|
3036
|
+
hue,
|
|
3037
|
+
scheme
|
|
3038
|
+
};
|
|
3039
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["multiply", "screen"];
|
|
3040
|
+
return {
|
|
3041
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3042
|
+
_dark: scheme === "dark",
|
|
3043
|
+
accent: {
|
|
3044
|
+
fg: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _c.fg)
|
|
3045
|
+
},
|
|
3046
|
+
avatar: buildAvatarColorTheme({
|
|
3047
|
+
scheme
|
|
3048
|
+
}, tokens),
|
|
3049
|
+
backdrop: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.backdrop),
|
|
3050
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3051
|
+
scheme
|
|
3052
|
+
}, config),
|
|
3053
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3054
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3055
|
+
button: buildButtonColorTheme({
|
|
3056
|
+
scheme
|
|
3057
|
+
}, config),
|
|
3058
|
+
code: {
|
|
3059
|
+
bg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.code) == null ? void 0 : _d.bg),
|
|
3060
|
+
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.fg)
|
|
3061
|
+
},
|
|
3062
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3063
|
+
focusRing: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.focusRing),
|
|
3064
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
3065
|
+
input: buildInputColorTheme({
|
|
3066
|
+
scheme,
|
|
3067
|
+
tone
|
|
3068
|
+
}, config),
|
|
3069
|
+
kbd: {
|
|
3070
|
+
bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _f.bg),
|
|
3071
|
+
fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _g.fg),
|
|
3072
|
+
border: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _h.border)
|
|
3073
|
+
},
|
|
3074
|
+
link: {
|
|
3075
|
+
fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.link) == null ? void 0 : _i.fg)
|
|
3076
|
+
},
|
|
3077
|
+
muted: {
|
|
3078
|
+
bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _j.bg),
|
|
3079
|
+
fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _k.fg)
|
|
3080
|
+
},
|
|
3081
|
+
selectable: buildSelectableColorTheme({
|
|
3082
|
+
scheme
|
|
3083
|
+
}, config),
|
|
3084
|
+
shadow: buildShadowColorTheme({
|
|
3085
|
+
scheme,
|
|
3086
|
+
tone
|
|
3087
|
+
}, config),
|
|
3088
|
+
skeleton: {
|
|
3089
|
+
from: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _l.from),
|
|
3090
|
+
to: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.to)
|
|
3091
|
+
},
|
|
3092
|
+
syntax: buildSyntaxColorTheme({
|
|
3093
|
+
scheme
|
|
3094
|
+
}, config)
|
|
3095
|
+
};
|
|
3096
|
+
}
|
|
3097
|
+
function buildShadowColorTheme(options, config) {
|
|
3098
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3099
|
+
const {
|
|
3100
|
+
scheme,
|
|
3101
|
+
tone
|
|
3102
|
+
} = options;
|
|
3103
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone];
|
|
3104
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3105
|
+
const context = {
|
|
3106
|
+
hue,
|
|
3107
|
+
scheme
|
|
3108
|
+
};
|
|
3109
|
+
return {
|
|
3110
|
+
outline: resolveColorTokenValue(context, (_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline),
|
|
3111
|
+
umbra: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra),
|
|
3112
|
+
penumbra: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra),
|
|
3113
|
+
ambient: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient)
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
function buildAvatarColorTheme(options, stateTokens) {
|
|
3117
|
+
const {
|
|
3118
|
+
scheme
|
|
3119
|
+
} = options;
|
|
3120
|
+
return {
|
|
3121
|
+
gray: _buildAvatarColorTheme({
|
|
3122
|
+
color: "gray",
|
|
3123
|
+
scheme
|
|
3124
|
+
}, stateTokens),
|
|
3125
|
+
blue: _buildAvatarColorTheme({
|
|
3126
|
+
color: "blue",
|
|
3127
|
+
scheme
|
|
3128
|
+
}, stateTokens),
|
|
3129
|
+
purple: _buildAvatarColorTheme({
|
|
3130
|
+
color: "purple",
|
|
3131
|
+
scheme
|
|
3132
|
+
}, stateTokens),
|
|
3133
|
+
magenta: _buildAvatarColorTheme({
|
|
3134
|
+
color: "magenta",
|
|
3135
|
+
scheme
|
|
3136
|
+
}, stateTokens),
|
|
3137
|
+
red: _buildAvatarColorTheme({
|
|
3138
|
+
color: "red",
|
|
3139
|
+
scheme
|
|
3140
|
+
}, stateTokens),
|
|
3141
|
+
orange: _buildAvatarColorTheme({
|
|
3142
|
+
color: "orange",
|
|
3143
|
+
scheme
|
|
3144
|
+
}, stateTokens),
|
|
3145
|
+
yellow: _buildAvatarColorTheme({
|
|
3146
|
+
color: "yellow",
|
|
3147
|
+
scheme
|
|
3148
|
+
}, stateTokens),
|
|
3149
|
+
green: _buildAvatarColorTheme({
|
|
3150
|
+
color: "green",
|
|
3151
|
+
scheme
|
|
3152
|
+
}, stateTokens),
|
|
3153
|
+
cyan: _buildAvatarColorTheme({
|
|
3154
|
+
color: "cyan",
|
|
3155
|
+
scheme
|
|
3156
|
+
}, stateTokens)
|
|
3157
|
+
};
|
|
3158
|
+
}
|
|
3159
|
+
function _buildAvatarColorTheme(options, stateTokens) {
|
|
3160
|
+
var _a;
|
|
3161
|
+
const {
|
|
3162
|
+
color,
|
|
3163
|
+
scheme
|
|
3164
|
+
} = options;
|
|
3165
|
+
const tokens = (_a = stateTokens == null ? void 0 : stateTokens.avatar) == null ? void 0 : _a[color];
|
|
3166
|
+
const context = {
|
|
3167
|
+
hue: (tokens == null ? void 0 : tokens._hue) || "gray",
|
|
3168
|
+
scheme
|
|
3169
|
+
};
|
|
3170
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3171
|
+
return {
|
|
3172
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3173
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3174
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg)
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
function buildBadgeColorTheme(tokens, options, config) {
|
|
3178
|
+
const {
|
|
3179
|
+
scheme
|
|
3180
|
+
} = options;
|
|
3181
|
+
return {
|
|
3182
|
+
default: _buildBadgeColorTheme(tokens, {
|
|
3183
|
+
scheme,
|
|
3184
|
+
tone: "default"
|
|
3185
|
+
}, config),
|
|
3186
|
+
primary: _buildBadgeColorTheme(tokens, {
|
|
3187
|
+
scheme,
|
|
3188
|
+
tone: "primary"
|
|
3189
|
+
}, config),
|
|
3190
|
+
positive: _buildBadgeColorTheme(tokens, {
|
|
3191
|
+
scheme,
|
|
3192
|
+
tone: "positive"
|
|
3193
|
+
}, config),
|
|
3194
|
+
caution: _buildBadgeColorTheme(tokens, {
|
|
3195
|
+
scheme,
|
|
3196
|
+
tone: "caution"
|
|
3197
|
+
}, config),
|
|
3198
|
+
critical: _buildBadgeColorTheme(tokens, {
|
|
3199
|
+
scheme,
|
|
3200
|
+
tone: "critical"
|
|
3201
|
+
}, config)
|
|
3202
|
+
};
|
|
3203
|
+
}
|
|
3204
|
+
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
3205
|
+
var _a, _b, _c;
|
|
3206
|
+
const {
|
|
3207
|
+
scheme,
|
|
3208
|
+
tone
|
|
3209
|
+
} = options;
|
|
3210
|
+
const tokens = parentTokens == null ? void 0 : parentTokens[tone];
|
|
3211
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || ((_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.base) == null ? void 0 : _b[tone]) == null ? void 0 : _c._hue) || "gray";
|
|
3212
|
+
const context = {
|
|
3213
|
+
hue,
|
|
3214
|
+
scheme
|
|
3215
|
+
};
|
|
3216
|
+
return {
|
|
3217
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3218
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3219
|
+
dot: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.dot),
|
|
3220
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon)
|
|
3221
|
+
};
|
|
3222
|
+
}
|
|
3223
|
+
function buildButtonColorTheme(options, config) {
|
|
3224
|
+
const {
|
|
3225
|
+
scheme
|
|
3226
|
+
} = options;
|
|
3227
|
+
const modes = {};
|
|
3228
|
+
for (const mode of THEME_COLOR_BUTTON_MODES) {
|
|
3229
|
+
modes[mode] = buildButtonTonesColorTheme({
|
|
3230
|
+
scheme,
|
|
3231
|
+
mode
|
|
3232
|
+
}, config);
|
|
3233
|
+
}
|
|
3234
|
+
return modes;
|
|
3235
|
+
}
|
|
3236
|
+
function buildButtonTonesColorTheme(options, config) {
|
|
3237
|
+
const {
|
|
3238
|
+
mode,
|
|
3239
|
+
scheme
|
|
3240
|
+
} = options;
|
|
3241
|
+
const tones = {};
|
|
3242
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
3243
|
+
tones[tone] = buildButtonStatesColorTheme({
|
|
3244
|
+
mode,
|
|
3245
|
+
scheme,
|
|
3246
|
+
tone
|
|
3247
|
+
}, config);
|
|
3248
|
+
}
|
|
3249
|
+
return tones;
|
|
3250
|
+
}
|
|
3251
|
+
function buildButtonStatesColorTheme(options, config) {
|
|
3252
|
+
const {
|
|
3253
|
+
mode,
|
|
3254
|
+
scheme,
|
|
3255
|
+
tone
|
|
3256
|
+
} = options;
|
|
3257
|
+
const states = {};
|
|
3258
|
+
for (const state of THEME_COLOR_STATES) {
|
|
3259
|
+
states[state] = buildButtonStateColorTheme({
|
|
3260
|
+
mode,
|
|
3261
|
+
tone,
|
|
3262
|
+
scheme,
|
|
3263
|
+
state
|
|
3264
|
+
}, config);
|
|
3265
|
+
}
|
|
3266
|
+
return states;
|
|
3267
|
+
}
|
|
3268
|
+
function buildButtonStateColorTheme(options, config) {
|
|
3269
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
3270
|
+
const {
|
|
3271
|
+
mode,
|
|
3272
|
+
tone,
|
|
3273
|
+
scheme,
|
|
3274
|
+
state
|
|
3275
|
+
} = options;
|
|
3276
|
+
const tokens = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.button) == null ? void 0 : _b[mode]) == null ? void 0 : _c[tone]) == null ? void 0 : _d[state];
|
|
3277
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3278
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3279
|
+
const context = {
|
|
3280
|
+
hue,
|
|
3281
|
+
scheme
|
|
3282
|
+
};
|
|
3283
|
+
return {
|
|
3284
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3285
|
+
accent: {
|
|
3286
|
+
fg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _e.fg)
|
|
3287
|
+
},
|
|
3288
|
+
avatar: buildAvatarColorTheme({
|
|
3289
|
+
scheme
|
|
3290
|
+
}, tokens),
|
|
3291
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3292
|
+
scheme
|
|
3293
|
+
}, config),
|
|
3294
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3295
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3296
|
+
code: {
|
|
3297
|
+
bg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.bg),
|
|
3298
|
+
fg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.code) == null ? void 0 : _g.fg)
|
|
3299
|
+
},
|
|
3300
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3301
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
3302
|
+
muted: {
|
|
3303
|
+
bg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.bg),
|
|
3304
|
+
fg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _i.fg)
|
|
3305
|
+
},
|
|
3306
|
+
kbd: {
|
|
3307
|
+
bg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.bg),
|
|
3308
|
+
fg: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.fg),
|
|
3309
|
+
border: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _l.border)
|
|
3310
|
+
},
|
|
3311
|
+
link: {
|
|
3312
|
+
fg: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.link) == null ? void 0 : _m.fg)
|
|
3313
|
+
},
|
|
3314
|
+
skeleton: {
|
|
3315
|
+
from: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.from),
|
|
3316
|
+
to: resolveColorTokenValue(context, (_o = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _o.to)
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3320
|
+
function buildInputColorTheme(options, config) {
|
|
3321
|
+
const {
|
|
3322
|
+
scheme,
|
|
3323
|
+
tone
|
|
3324
|
+
} = options;
|
|
3325
|
+
return {
|
|
3326
|
+
default: buildInputStatesColorTheme({
|
|
3327
|
+
mode: "default",
|
|
3328
|
+
scheme,
|
|
3329
|
+
tone
|
|
3330
|
+
}, config),
|
|
3331
|
+
invalid: buildInputStatesColorTheme({
|
|
3332
|
+
mode: "invalid",
|
|
3333
|
+
scheme,
|
|
3334
|
+
tone
|
|
3335
|
+
}, config)
|
|
3336
|
+
};
|
|
3337
|
+
}
|
|
3338
|
+
function buildInputStatesColorTheme(options, config) {
|
|
3339
|
+
const {
|
|
3340
|
+
mode,
|
|
3341
|
+
scheme,
|
|
3342
|
+
tone
|
|
3343
|
+
} = options;
|
|
3344
|
+
return {
|
|
3345
|
+
enabled: buildInputStateColorTheme({
|
|
3346
|
+
mode,
|
|
3347
|
+
scheme,
|
|
3348
|
+
state: "enabled",
|
|
3349
|
+
tone
|
|
3350
|
+
}, config),
|
|
3351
|
+
hovered: buildInputStateColorTheme({
|
|
3352
|
+
mode,
|
|
3353
|
+
scheme,
|
|
3354
|
+
state: "hovered",
|
|
3355
|
+
tone
|
|
3356
|
+
}, config),
|
|
3357
|
+
readOnly: buildInputStateColorTheme({
|
|
3358
|
+
mode,
|
|
3359
|
+
scheme,
|
|
3360
|
+
state: "readOnly",
|
|
3361
|
+
tone
|
|
3362
|
+
}, config),
|
|
3363
|
+
disabled: buildInputStateColorTheme({
|
|
3364
|
+
mode,
|
|
3365
|
+
scheme,
|
|
3366
|
+
state: "disabled",
|
|
3367
|
+
tone
|
|
3368
|
+
}, config)
|
|
3369
|
+
};
|
|
3370
|
+
}
|
|
3371
|
+
function buildInputStateColorTheme(options, config) {
|
|
3372
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3373
|
+
const {
|
|
3374
|
+
mode,
|
|
3375
|
+
tone,
|
|
3376
|
+
scheme,
|
|
3377
|
+
state
|
|
3378
|
+
} = options;
|
|
3379
|
+
const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.input) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
|
|
3380
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || ((_f = (_e = (_d = config == null ? void 0 : config.color) == null ? void 0 : _d.base) == null ? void 0 : _e[tone]) == null ? void 0 : _f._hue) || "gray";
|
|
3381
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3382
|
+
const context = {
|
|
3383
|
+
hue,
|
|
3384
|
+
scheme
|
|
3385
|
+
};
|
|
3386
|
+
return {
|
|
3387
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3388
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3389
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3390
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3391
|
+
muted: {
|
|
3392
|
+
bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg)
|
|
3393
|
+
},
|
|
3394
|
+
placeholder: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.placeholder)
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
function buildSelectableColorTheme(options, config) {
|
|
3398
|
+
const {
|
|
3399
|
+
scheme
|
|
3400
|
+
} = options;
|
|
3401
|
+
const tones = {};
|
|
3402
|
+
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
3403
|
+
tones[tone] = buildSelectableStatesColorTheme({
|
|
3404
|
+
scheme,
|
|
3405
|
+
tone
|
|
3406
|
+
}, config);
|
|
3407
|
+
}
|
|
3408
|
+
return tones;
|
|
3409
|
+
}
|
|
3410
|
+
function buildSelectableStatesColorTheme(options, config) {
|
|
3411
|
+
const {
|
|
3412
|
+
scheme,
|
|
3413
|
+
tone
|
|
3414
|
+
} = options;
|
|
3415
|
+
const states = {};
|
|
3416
|
+
for (const state of THEME_COLOR_STATES) {
|
|
3417
|
+
states[state] = buildSelectableStateColorTheme({
|
|
3418
|
+
tone,
|
|
3419
|
+
scheme,
|
|
3420
|
+
state
|
|
3421
|
+
}, config);
|
|
3422
|
+
}
|
|
3423
|
+
return states;
|
|
3424
|
+
}
|
|
3425
|
+
function buildSelectableStateColorTheme(options, config) {
|
|
3426
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3427
|
+
const {
|
|
3428
|
+
scheme,
|
|
3429
|
+
state,
|
|
3430
|
+
tone
|
|
3431
|
+
} = options;
|
|
3432
|
+
const tokens = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.selectable) == null ? void 0 : _b[tone]) == null ? void 0 : _c[state];
|
|
3433
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
3434
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
3435
|
+
const context = {
|
|
3436
|
+
hue,
|
|
3437
|
+
scheme
|
|
3438
|
+
};
|
|
3439
|
+
return {
|
|
3440
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
3441
|
+
accent: {
|
|
3442
|
+
fg: resolveColorTokenValue(context, (_d = tokens == null ? void 0 : tokens.accent) == null ? void 0 : _d.fg)
|
|
3443
|
+
},
|
|
3444
|
+
avatar: buildAvatarColorTheme({
|
|
3445
|
+
scheme
|
|
3446
|
+
}, tokens),
|
|
3447
|
+
badge: buildBadgeColorTheme(tokens == null ? void 0 : tokens.badge, {
|
|
3448
|
+
scheme
|
|
3449
|
+
}, config),
|
|
3450
|
+
bg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.bg),
|
|
3451
|
+
border: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.border),
|
|
3452
|
+
code: {
|
|
3453
|
+
bg: resolveColorTokenValue(context, (_e = tokens == null ? void 0 : tokens.code) == null ? void 0 : _e.bg),
|
|
3454
|
+
fg: resolveColorTokenValue(context, (_f = tokens == null ? void 0 : tokens.code) == null ? void 0 : _f.fg)
|
|
3455
|
+
},
|
|
3456
|
+
fg: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.fg),
|
|
3457
|
+
icon: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.icon),
|
|
3458
|
+
muted: {
|
|
3459
|
+
bg: resolveColorTokenValue(context, (_g = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _g.bg),
|
|
3460
|
+
fg: resolveColorTokenValue(context, (_h = tokens == null ? void 0 : tokens.muted) == null ? void 0 : _h.fg)
|
|
3461
|
+
},
|
|
3462
|
+
kbd: {
|
|
3463
|
+
bg: resolveColorTokenValue(context, (_i = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _i.bg),
|
|
3464
|
+
fg: resolveColorTokenValue(context, (_j = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _j.fg),
|
|
3465
|
+
border: resolveColorTokenValue(context, (_k = tokens == null ? void 0 : tokens.kbd) == null ? void 0 : _k.border)
|
|
3466
|
+
},
|
|
3467
|
+
link: {
|
|
3468
|
+
fg: resolveColorTokenValue(context, (_l = tokens == null ? void 0 : tokens.link) == null ? void 0 : _l.fg)
|
|
3469
|
+
},
|
|
3470
|
+
skeleton: {
|
|
3471
|
+
from: resolveColorTokenValue(context, (_m = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _m.from),
|
|
3472
|
+
to: resolveColorTokenValue(context, (_n = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _n.to)
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
}
|
|
3476
|
+
function buildSyntaxColorTheme(options, config) {
|
|
3477
|
+
var _a;
|
|
3478
|
+
const {
|
|
3479
|
+
scheme
|
|
3480
|
+
} = options;
|
|
3481
|
+
const tokens = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.syntax;
|
|
3482
|
+
const context = {
|
|
3483
|
+
hue: "gray",
|
|
3484
|
+
scheme
|
|
3485
|
+
};
|
|
3486
|
+
return {
|
|
3487
|
+
atrule: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.atrule),
|
|
3488
|
+
attrName: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrName),
|
|
3489
|
+
attrValue: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attrValue),
|
|
3490
|
+
attribute: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.attribute),
|
|
3491
|
+
boolean: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.boolean),
|
|
3492
|
+
builtin: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.builtin),
|
|
3493
|
+
cdata: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.cdata),
|
|
3494
|
+
char: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.char),
|
|
3495
|
+
class: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.class),
|
|
3496
|
+
className: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.className),
|
|
3497
|
+
comment: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.comment),
|
|
3498
|
+
constant: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.constant),
|
|
3499
|
+
deleted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.deleted),
|
|
3500
|
+
doctype: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.doctype),
|
|
3501
|
+
entity: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.entity),
|
|
3502
|
+
function: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.function),
|
|
3503
|
+
hexcode: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.hexcode),
|
|
3504
|
+
id: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.id),
|
|
3505
|
+
important: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.important),
|
|
3506
|
+
inserted: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.inserted),
|
|
3507
|
+
keyword: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.keyword),
|
|
3508
|
+
number: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.number),
|
|
3509
|
+
operator: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.operator),
|
|
3510
|
+
prolog: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.prolog),
|
|
3511
|
+
property: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.property),
|
|
3512
|
+
pseudoClass: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoClass),
|
|
3513
|
+
pseudoElement: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.pseudoElement),
|
|
3514
|
+
punctuation: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.punctuation),
|
|
3515
|
+
regex: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.regex),
|
|
3516
|
+
selector: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.selector),
|
|
3517
|
+
string: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.string),
|
|
3518
|
+
symbol: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.symbol),
|
|
3519
|
+
tag: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.tag),
|
|
3520
|
+
unit: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.unit),
|
|
3521
|
+
url: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.url),
|
|
3522
|
+
variable: resolveColorTokenValue(context, tokens == null ? void 0 : tokens.variable)
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
const defaultColorPalette = color;
|
|
3526
|
+
function mixChannel(b, s, weight) {
|
|
3527
|
+
const diff = s - b;
|
|
3528
|
+
const delta = diff * weight;
|
|
3529
|
+
return b + delta;
|
|
3530
|
+
}
|
|
3531
|
+
function mix(b, s, weight) {
|
|
3532
|
+
return {
|
|
3533
|
+
r: mixChannel(b.r, s.r, weight),
|
|
3534
|
+
g: mixChannel(b.g, s.g, weight),
|
|
3535
|
+
b: mixChannel(b.b, s.b, weight)
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
function multiplyChannel(b, s) {
|
|
3539
|
+
return b * s;
|
|
3540
|
+
}
|
|
3541
|
+
function multiply(b, s) {
|
|
3542
|
+
return {
|
|
3543
|
+
r: multiplyChannel(b.r / 255, s.r / 255) * 255,
|
|
3544
|
+
g: multiplyChannel(b.g / 255, s.g / 255) * 255,
|
|
3545
|
+
b: multiplyChannel(b.b / 255, s.b / 255) * 255
|
|
3546
|
+
};
|
|
3547
|
+
}
|
|
3548
|
+
function screenChannel(b, s) {
|
|
3549
|
+
return b + s - b * s;
|
|
3550
|
+
}
|
|
3551
|
+
function screen(b, s) {
|
|
3552
|
+
return {
|
|
3553
|
+
r: screenChannel(b.r / 255, s.r / 255) * 255,
|
|
3554
|
+
g: screenChannel(b.g / 255, s.g / 255) * 255,
|
|
3555
|
+
b: screenChannel(b.b / 255, s.b / 255) * 255
|
|
3556
|
+
};
|
|
3557
|
+
}
|
|
3558
|
+
function lerp(x, y, a) {
|
|
3559
|
+
return x * (1 - a) + y * a;
|
|
3560
|
+
}
|
|
3561
|
+
function invlerp(x, y, a) {
|
|
3562
|
+
return clamp((a - x) / (y - x));
|
|
3563
|
+
}
|
|
3564
|
+
function clamp(a) {
|
|
3565
|
+
let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3566
|
+
let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
3567
|
+
return Math.min(max, Math.max(min, a));
|
|
3568
|
+
}
|
|
3569
|
+
function range(x1, y1, x2, y2, a) {
|
|
3570
|
+
return lerp(x2, y2, invlerp(x1, y1, a));
|
|
3571
|
+
}
|
|
3572
|
+
function round(value) {
|
|
3573
|
+
return Math.round(value);
|
|
3574
|
+
}
|
|
3575
|
+
function hexToRgb(hex) {
|
|
3576
|
+
if (hex.length === 4) {
|
|
3577
|
+
const hexR = hex.slice(1, 2);
|
|
3578
|
+
const hexG = hex.slice(2, 3);
|
|
3579
|
+
const hexB = hex.slice(3, 4);
|
|
3580
|
+
return {
|
|
3581
|
+
r: parseInt(hexR + hexR, 16),
|
|
3582
|
+
g: parseInt(hexG + hexG, 16),
|
|
3583
|
+
b: parseInt(hexB + hexB, 16)
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
return {
|
|
3587
|
+
r: parseInt(hex.slice(1, 3), 16),
|
|
3588
|
+
g: parseInt(hex.slice(3, 5), 16),
|
|
3589
|
+
b: parseInt(hex.slice(5, 7), 16)
|
|
3590
|
+
};
|
|
3591
|
+
}
|
|
3592
|
+
function rgbaToRGBA(rgba) {
|
|
3593
|
+
const values = rgba.replace(/rgba\(|\)/g, "").split(",");
|
|
3594
|
+
return {
|
|
3595
|
+
r: parseInt(values[0]),
|
|
3596
|
+
g: parseInt(values[1]),
|
|
3597
|
+
b: parseInt(values[2]),
|
|
3598
|
+
a: parseFloat(values[3])
|
|
3599
|
+
};
|
|
3600
|
+
}
|
|
3601
|
+
function rgbToHex(color) {
|
|
3602
|
+
const r = round(clamp(Math.round(color.r), 0, 255));
|
|
3603
|
+
const g = round(clamp(Math.round(color.g), 0, 255));
|
|
3604
|
+
const b = round(clamp(Math.round(color.b), 0, 255));
|
|
3605
|
+
if ("a" in color) {
|
|
3606
|
+
return "rgba(".concat(r, ",").concat(g, ",").concat(b, ",").concat(color.a, ")");
|
|
3607
|
+
}
|
|
3608
|
+
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
3609
|
+
}
|
|
3610
|
+
function rgbToHsl(_ref8) {
|
|
3611
|
+
let {
|
|
3612
|
+
r,
|
|
3613
|
+
g,
|
|
3614
|
+
b
|
|
3615
|
+
} = _ref8;
|
|
3616
|
+
r /= 255;
|
|
3617
|
+
g /= 255;
|
|
3618
|
+
b /= 255;
|
|
3619
|
+
const cmin = Math.min(r, g, b);
|
|
3620
|
+
const cmax = Math.max(r, g, b);
|
|
3621
|
+
const delta = cmax - cmin;
|
|
3622
|
+
let h = 0;
|
|
3623
|
+
let s = 0;
|
|
3624
|
+
let l = 0;
|
|
3625
|
+
if (delta == 0) h = 0;else if (cmax == r) h = (g - b) / delta % 6;else if (cmax == g) h = (b - r) / delta + 2;else h = (r - g) / delta + 4;
|
|
3626
|
+
h = Math.round(h * 60);
|
|
3627
|
+
if (h < 0) h += 360;
|
|
3628
|
+
l = (cmax + cmin) / 2;
|
|
3629
|
+
s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
3630
|
+
s = +(s * 100).toFixed(1);
|
|
3631
|
+
l = +(l * 100).toFixed(1);
|
|
3632
|
+
return {
|
|
3633
|
+
h,
|
|
3634
|
+
s,
|
|
3635
|
+
l
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
function hslToRgb(hsl) {
|
|
3639
|
+
const s = hsl.s / 100;
|
|
3640
|
+
const l = hsl.l / 100;
|
|
3641
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
3642
|
+
const x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1));
|
|
3643
|
+
const m = l - c / 2;
|
|
3644
|
+
let r = 0;
|
|
3645
|
+
let g = 0;
|
|
3646
|
+
let b = 0;
|
|
3647
|
+
if (0 <= hsl.h && hsl.h < 60) {
|
|
3648
|
+
r = c;
|
|
3649
|
+
g = x;
|
|
3650
|
+
b = 0;
|
|
3651
|
+
} else if (60 <= hsl.h && hsl.h < 120) {
|
|
3652
|
+
r = x;
|
|
3653
|
+
g = c;
|
|
3654
|
+
b = 0;
|
|
3655
|
+
} else if (120 <= hsl.h && hsl.h < 180) {
|
|
3656
|
+
r = 0;
|
|
3657
|
+
g = c;
|
|
3658
|
+
b = x;
|
|
3659
|
+
} else if (180 <= hsl.h && hsl.h < 240) {
|
|
3660
|
+
r = 0;
|
|
3661
|
+
g = x;
|
|
3662
|
+
b = c;
|
|
3663
|
+
} else if (240 <= hsl.h && hsl.h < 300) {
|
|
3664
|
+
r = x;
|
|
3665
|
+
g = 0;
|
|
3666
|
+
b = c;
|
|
3667
|
+
} else if (300 <= hsl.h && hsl.h < 360) {
|
|
3668
|
+
r = c;
|
|
3669
|
+
g = 0;
|
|
3670
|
+
b = x;
|
|
3671
|
+
}
|
|
3672
|
+
return {
|
|
3673
|
+
r: Math.round((r + m) * 255),
|
|
3674
|
+
g: Math.round((g + m) * 255),
|
|
3675
|
+
b: Math.round((b + m) * 255)
|
|
3676
|
+
};
|
|
3677
|
+
}
|
|
3678
|
+
const HEX_CHARS = "0123456789ABCDEFabcdef";
|
|
3679
|
+
const HSL_RE = /hsl\(\s*(\d+)\s*,\s*((\d+(?:\.\d+)?)%)\s*,\s*((\d+(?:\.\d+)?)%)\s*\)/i;
|
|
3680
|
+
function isHexChars(str) {
|
|
3681
|
+
for (const c of str) {
|
|
3682
|
+
if (HEX_CHARS.indexOf(c) === -1) {
|
|
3683
|
+
return false;
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
return true;
|
|
3687
|
+
}
|
|
3688
|
+
function isHex(str) {
|
|
3689
|
+
if (str[0] !== "#") return false;
|
|
3690
|
+
if (!(str.length === 4 || str.length === 7)) return false;
|
|
3691
|
+
return isHexChars(str.slice(1));
|
|
3692
|
+
}
|
|
3693
|
+
function parseHsl(str) {
|
|
3694
|
+
const res = HSL_RE.exec(str);
|
|
3695
|
+
if (!res) {
|
|
3696
|
+
throw new Error('parseHsl: string is not a HSL color: "'.concat(str, '"'));
|
|
3697
|
+
}
|
|
3698
|
+
return {
|
|
3699
|
+
h: parseInt(res[1]),
|
|
3700
|
+
s: parseFloat(res[3]),
|
|
3701
|
+
l: parseFloat(res[5])
|
|
3702
|
+
};
|
|
3703
|
+
}
|
|
3704
|
+
function parseColor(color) {
|
|
3705
|
+
if (!color) return {
|
|
3706
|
+
r: 0,
|
|
3707
|
+
g: 0,
|
|
3708
|
+
b: 0
|
|
3709
|
+
};
|
|
3710
|
+
if (typeof color !== "string") {
|
|
3711
|
+
throw new Error("parseColor: expected a string");
|
|
3712
|
+
}
|
|
3713
|
+
if (isHex(color)) {
|
|
3714
|
+
return hexToRgb(color);
|
|
3715
|
+
}
|
|
3716
|
+
if (color.startsWith("hsl(")) {
|
|
3717
|
+
return hslToRgb(parseHsl(color));
|
|
3718
|
+
}
|
|
3719
|
+
if (color.startsWith("rgba(")) {
|
|
3720
|
+
return rgbaToRGBA(color);
|
|
3721
|
+
}
|
|
3722
|
+
throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
|
|
3723
|
+
}
|
|
3724
|
+
function getContrastRatio(bg, fg) {
|
|
3725
|
+
const rgb1 = parseColor(bg);
|
|
3726
|
+
const rgb2 = parseColor(fg);
|
|
3727
|
+
const c1 = rgb_lrgb(rgb1);
|
|
3728
|
+
const c2 = rgb_lrgb(rgb2);
|
|
3729
|
+
const l1 = lrgb_luminance(c1);
|
|
3730
|
+
const l2 = lrgb_luminance(c2);
|
|
3731
|
+
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
3732
|
+
}
|
|
3733
|
+
function rgb_lrgb(_ref9) {
|
|
3734
|
+
let {
|
|
3735
|
+
r,
|
|
3736
|
+
g,
|
|
3737
|
+
b
|
|
3738
|
+
} = _ref9;
|
|
3739
|
+
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
3740
|
+
}
|
|
3741
|
+
function rgb_lrgb1(v) {
|
|
3742
|
+
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
3743
|
+
}
|
|
3744
|
+
function lrgb_luminance(_ref10) {
|
|
3745
|
+
let [r, g, b] = _ref10;
|
|
3746
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
3747
|
+
}
|
|
3748
|
+
function rgba(color, a) {
|
|
3749
|
+
const rgb = parseColor(color);
|
|
3750
|
+
return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
|
|
3751
|
+
}
|
|
3752
|
+
const RGB_RANGE = [0, 255];
|
|
3753
|
+
function mixThemeColor(value, options) {
|
|
3754
|
+
const {
|
|
3755
|
+
blendMode
|
|
3756
|
+
} = options;
|
|
3757
|
+
const color = parseColor(value);
|
|
3758
|
+
const black = parseColor(options.black);
|
|
3759
|
+
const white = parseColor(options.white);
|
|
3760
|
+
const bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white : black;
|
|
3761
|
+
const paletteRange = {
|
|
3762
|
+
r: [black.r, white.r],
|
|
3763
|
+
g: [black.g, white.g],
|
|
3764
|
+
b: [black.b, white.b]
|
|
3765
|
+
};
|
|
3766
|
+
const convertedBgColor = {
|
|
3767
|
+
r: clamp(range(...paletteRange.r, ...RGB_RANGE, bg.r), ...RGB_RANGE),
|
|
3768
|
+
g: clamp(range(...paletteRange.g, ...RGB_RANGE, bg.g), ...RGB_RANGE),
|
|
3769
|
+
b: clamp(range(...paletteRange.b, ...RGB_RANGE, bg.b), ...RGB_RANGE)
|
|
3770
|
+
};
|
|
3771
|
+
const convertedColor = {
|
|
3772
|
+
r: clamp(range(...paletteRange.r, ...RGB_RANGE, color.r), ...RGB_RANGE),
|
|
3773
|
+
g: clamp(range(...paletteRange.g, ...RGB_RANGE, color.g), ...RGB_RANGE),
|
|
3774
|
+
b: clamp(range(...paletteRange.b, ...RGB_RANGE, color.b), ...RGB_RANGE)
|
|
3775
|
+
};
|
|
3776
|
+
const resultColor = blendMode === "multiply" ? multiply(convertedBgColor, convertedColor) : screen(convertedBgColor, convertedColor);
|
|
3777
|
+
const v = {
|
|
3778
|
+
r: clamp(range(...RGB_RANGE, ...paletteRange.r, resultColor.r), ...paletteRange.r),
|
|
3779
|
+
g: clamp(range(...RGB_RANGE, ...paletteRange.g, resultColor.g), ...paletteRange.g),
|
|
3780
|
+
b: clamp(range(...RGB_RANGE, ...paletteRange.b, resultColor.b), ...paletteRange.b)
|
|
3781
|
+
};
|
|
3782
|
+
return rgbToHex(v);
|
|
3783
|
+
}
|
|
3784
|
+
function renderColorValue(str, options) {
|
|
3785
|
+
const {
|
|
3786
|
+
bg,
|
|
3787
|
+
blendMode,
|
|
3788
|
+
colorPalette
|
|
3789
|
+
} = options;
|
|
3790
|
+
if (bg === "white") {
|
|
3791
|
+
throw new Error("Cannot blend with white background");
|
|
3792
|
+
}
|
|
3793
|
+
const node = parseTokenValue(str);
|
|
3794
|
+
if (!node || node.type !== "color") {
|
|
3795
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
3796
|
+
}
|
|
3797
|
+
let hex = "";
|
|
3798
|
+
if (node.key === "black") {
|
|
3799
|
+
hex = renderColorHex(colorPalette.black);
|
|
3800
|
+
}
|
|
3801
|
+
if (node.key === "white") {
|
|
3802
|
+
hex = renderColorHex(colorPalette.white);
|
|
3803
|
+
}
|
|
3804
|
+
if (node.hue && node.tint) {
|
|
3805
|
+
hex = renderColorHex(colorPalette[node.hue][node.tint]);
|
|
3806
|
+
}
|
|
3807
|
+
if (!hex) {
|
|
3808
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
3809
|
+
}
|
|
3810
|
+
const hexBeforeMix = hex;
|
|
3811
|
+
const mixOptions = {
|
|
3812
|
+
blendMode,
|
|
3813
|
+
bg,
|
|
3814
|
+
black: renderColorHex(colorPalette.black),
|
|
3815
|
+
// opacity: node.opacity,
|
|
3816
|
+
white: renderColorHex(colorPalette.white)
|
|
3817
|
+
};
|
|
3818
|
+
try {
|
|
3819
|
+
hex = mixThemeColor(hex, mixOptions);
|
|
3820
|
+
} catch (err) {
|
|
3821
|
+
console.log("could not blend", hex, mixOptions);
|
|
3822
|
+
throw err;
|
|
3823
|
+
}
|
|
3824
|
+
if (hex === "#aN") {
|
|
3825
|
+
console.warn("invalid color token value: ".concat(str));
|
|
3826
|
+
hex = hexBeforeMix;
|
|
3827
|
+
}
|
|
3828
|
+
if (node.opacity !== void 0) {
|
|
3829
|
+
hex = rgba(hex, node.opacity);
|
|
3830
|
+
}
|
|
3831
|
+
return hex;
|
|
3832
|
+
}
|
|
3833
|
+
function renderColorHex(color) {
|
|
3834
|
+
return typeof color === "string" ? color : color.hex;
|
|
3835
|
+
}
|
|
3836
|
+
function renderThemeColorSchemes(value, config) {
|
|
3837
|
+
var _a;
|
|
3838
|
+
const colorPalette = (_a = config == null ? void 0 : config.palette) != null ? _a : defaultColorPalette;
|
|
3839
|
+
return {
|
|
3840
|
+
light: renderThemeColorScheme(colorPalette, value.light),
|
|
3841
|
+
dark: renderThemeColorScheme(colorPalette, value.dark)
|
|
3842
|
+
};
|
|
3843
|
+
}
|
|
3844
|
+
function renderThemeColorScheme(colorPalette, value) {
|
|
3845
|
+
const toneEntries = Object.entries(value);
|
|
3846
|
+
const [, transparentTone] = toneEntries.find(_ref11 => {
|
|
3847
|
+
let [k] = _ref11;
|
|
3848
|
+
return k === "transparent";
|
|
3849
|
+
});
|
|
3850
|
+
const [, defaultTone] = toneEntries.find(_ref12 => {
|
|
3851
|
+
let [k] = _ref12;
|
|
3852
|
+
return k === "default";
|
|
3853
|
+
});
|
|
3854
|
+
const renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3855
|
+
colorPalette
|
|
3856
|
+
});
|
|
3857
|
+
const renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3858
|
+
colorPalette
|
|
3859
|
+
});
|
|
3860
|
+
const bg = renderedDefaultTone.bg;
|
|
3861
|
+
if (bg === "white") {
|
|
3862
|
+
throw new Error("Cannot blend with white background");
|
|
3863
|
+
}
|
|
3864
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref13 => {
|
|
3865
|
+
let [k] = _ref13;
|
|
3866
|
+
return k !== "default" && k !== "transparent";
|
|
3867
|
+
}).map(_ref14 => {
|
|
3868
|
+
let [k, v] = _ref14;
|
|
3869
|
+
return [k, renderThemeColor(v, {
|
|
3870
|
+
bg,
|
|
3871
|
+
colorPalette
|
|
3872
|
+
})];
|
|
3873
|
+
})]);
|
|
3874
|
+
}
|
|
3875
|
+
function renderThemeColor(value, options) {
|
|
3876
|
+
const {
|
|
3877
|
+
colorPalette,
|
|
3878
|
+
bg
|
|
3879
|
+
} = options;
|
|
3880
|
+
const blendMode = value._blend || "multiply";
|
|
3881
|
+
const baseBg = renderColorValue(value.bg, {
|
|
3882
|
+
colorPalette,
|
|
3883
|
+
bg,
|
|
3884
|
+
blendMode
|
|
3885
|
+
});
|
|
3886
|
+
const colorOptions = {
|
|
3887
|
+
colorPalette,
|
|
3888
|
+
bg: baseBg,
|
|
3889
|
+
blendMode
|
|
3890
|
+
};
|
|
3891
|
+
const button = renderThemeColorButton(value.button, {
|
|
3892
|
+
baseBg,
|
|
3893
|
+
blendMode,
|
|
3894
|
+
colorPalette
|
|
3895
|
+
});
|
|
3896
|
+
const selectable = renderThemeColorSelectable(value.selectable, {
|
|
3897
|
+
colorPalette,
|
|
3898
|
+
baseBg,
|
|
3899
|
+
blendMode
|
|
3900
|
+
});
|
|
3901
|
+
const shadow = {
|
|
3902
|
+
outline: renderColorValue(value.shadow.outline, colorOptions),
|
|
3903
|
+
umbra: renderColorValue(value.shadow.umbra, {
|
|
3904
|
+
...colorOptions,
|
|
3905
|
+
bg: void 0,
|
|
3906
|
+
colorPalette: {
|
|
3907
|
+
...colorPalette,
|
|
3908
|
+
black: "#000000"
|
|
3909
|
+
}
|
|
3910
|
+
}),
|
|
3911
|
+
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
3912
|
+
...colorOptions,
|
|
3913
|
+
bg: void 0,
|
|
3914
|
+
colorPalette: {
|
|
3915
|
+
...colorPalette,
|
|
3916
|
+
black: "#000000"
|
|
3917
|
+
}
|
|
3918
|
+
}),
|
|
3919
|
+
ambient: renderColorValue(value.shadow.ambient, {
|
|
3920
|
+
...colorOptions,
|
|
3921
|
+
bg: void 0,
|
|
3922
|
+
colorPalette: {
|
|
3923
|
+
...colorPalette,
|
|
3924
|
+
black: "#000000"
|
|
3925
|
+
}
|
|
3926
|
+
})
|
|
3927
|
+
};
|
|
3928
|
+
return {
|
|
3929
|
+
_blend: blendMode,
|
|
3930
|
+
_dark: value._dark,
|
|
3931
|
+
accent: {
|
|
3932
|
+
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
3933
|
+
},
|
|
3934
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3935
|
+
baseBg,
|
|
3936
|
+
colorPalette,
|
|
3937
|
+
blendMode
|
|
3938
|
+
}),
|
|
3939
|
+
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
3940
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3941
|
+
baseBg,
|
|
3942
|
+
colorPalette,
|
|
3943
|
+
blendMode
|
|
3944
|
+
}),
|
|
3945
|
+
bg: baseBg,
|
|
3946
|
+
border: renderColorValue(value.border, colorOptions),
|
|
3947
|
+
button,
|
|
3948
|
+
code: {
|
|
3949
|
+
bg: renderColorValue(value.code.bg, colorOptions),
|
|
3950
|
+
fg: renderColorValue(value.code.fg, colorOptions)
|
|
3951
|
+
},
|
|
3952
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
3953
|
+
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
3954
|
+
icon: renderColorValue(value.icon, colorOptions),
|
|
3955
|
+
input: renderThemeColorInput(value.input, {
|
|
3956
|
+
baseBg,
|
|
3957
|
+
colorPalette,
|
|
3958
|
+
blendMode
|
|
3959
|
+
}),
|
|
3960
|
+
kbd: renderThemeColorKBD(value.kbd, {
|
|
3961
|
+
baseBg,
|
|
3962
|
+
colorPalette,
|
|
3963
|
+
blendMode
|
|
3964
|
+
}),
|
|
3965
|
+
link: {
|
|
3966
|
+
fg: renderColorValue(value.link.fg, colorOptions)
|
|
3967
|
+
},
|
|
3968
|
+
muted: {
|
|
3969
|
+
bg: renderColorValue(value.muted.bg, colorOptions),
|
|
3970
|
+
fg: renderColorValue(value.muted.fg, colorOptions)
|
|
3971
|
+
},
|
|
3972
|
+
shadow,
|
|
3973
|
+
skeleton: {
|
|
3974
|
+
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
3975
|
+
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
3976
|
+
},
|
|
3977
|
+
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3978
|
+
baseBg,
|
|
3979
|
+
colorPalette,
|
|
3980
|
+
blendMode
|
|
3981
|
+
}),
|
|
3982
|
+
selectable
|
|
3983
|
+
};
|
|
3984
|
+
}
|
|
3985
|
+
function renderThemeColorKBD(value, options) {
|
|
3986
|
+
const {
|
|
3987
|
+
baseBg,
|
|
3988
|
+
blendMode,
|
|
3989
|
+
colorPalette
|
|
3990
|
+
} = options;
|
|
3991
|
+
const rootOptions = {
|
|
3992
|
+
bg: baseBg,
|
|
3993
|
+
blendMode,
|
|
3994
|
+
colorPalette
|
|
3995
|
+
};
|
|
3996
|
+
const bg = renderColorValue(value.bg, rootOptions);
|
|
3997
|
+
const colorOptions = {
|
|
3998
|
+
bg,
|
|
3999
|
+
blendMode,
|
|
4000
|
+
colorPalette
|
|
4001
|
+
};
|
|
4002
|
+
return {
|
|
4003
|
+
bg,
|
|
4004
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
4005
|
+
border: renderColorValue(value.border, colorOptions)
|
|
4006
|
+
};
|
|
4007
|
+
}
|
|
4008
|
+
function renderThemeColorAvatar(value, options) {
|
|
4009
|
+
return {
|
|
4010
|
+
gray: renderThemeColorAvatarColor(value.gray, options),
|
|
4011
|
+
blue: renderThemeColorAvatarColor(value.blue, options),
|
|
4012
|
+
purple: renderThemeColorAvatarColor(value.purple, options),
|
|
4013
|
+
magenta: renderThemeColorAvatarColor(value.magenta, options),
|
|
4014
|
+
red: renderThemeColorAvatarColor(value.red, options),
|
|
4015
|
+
orange: renderThemeColorAvatarColor(value.orange, options),
|
|
4016
|
+
yellow: renderThemeColorAvatarColor(value.yellow, options),
|
|
4017
|
+
green: renderThemeColorAvatarColor(value.green, options),
|
|
4018
|
+
cyan: renderThemeColorAvatarColor(value.cyan, options)
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
function renderThemeColorAvatarColor(value, options) {
|
|
4022
|
+
const {
|
|
4023
|
+
baseBg,
|
|
4024
|
+
blendMode: rootBlendMode,
|
|
4025
|
+
colorPalette
|
|
4026
|
+
} = options;
|
|
4027
|
+
const blendMode = value._blend || "multiply";
|
|
4028
|
+
const rootOptions = {
|
|
4029
|
+
bg: baseBg,
|
|
4030
|
+
blendMode: rootBlendMode,
|
|
4031
|
+
colorPalette
|
|
4032
|
+
};
|
|
4033
|
+
const bg = renderColorValue(value.bg, rootOptions);
|
|
4034
|
+
const colorOptions = {
|
|
4035
|
+
bg,
|
|
4036
|
+
blendMode,
|
|
4037
|
+
colorPalette
|
|
4038
|
+
};
|
|
4039
|
+
return {
|
|
4040
|
+
_blend: blendMode,
|
|
4041
|
+
bg,
|
|
4042
|
+
fg: renderColorValue(value.fg, colorOptions)
|
|
4043
|
+
};
|
|
4044
|
+
}
|
|
4045
|
+
function renderThemeColorBadge(value, options) {
|
|
4046
|
+
return {
|
|
4047
|
+
default: renderThemeColorBadgeColor(value.default, options),
|
|
4048
|
+
primary: renderThemeColorBadgeColor(value.primary, options),
|
|
4049
|
+
positive: renderThemeColorBadgeColor(value.positive, options),
|
|
4050
|
+
caution: renderThemeColorBadgeColor(value.caution, options),
|
|
4051
|
+
critical: renderThemeColorBadgeColor(value.critical, options)
|
|
4052
|
+
};
|
|
4053
|
+
}
|
|
4054
|
+
function renderThemeColorBadgeColor(value, options) {
|
|
4055
|
+
const {
|
|
4056
|
+
baseBg,
|
|
4057
|
+
blendMode: rootBlendMode,
|
|
4058
|
+
colorPalette
|
|
4059
|
+
} = options;
|
|
4060
|
+
const blendMode = rootBlendMode;
|
|
4061
|
+
const rootOptions = {
|
|
4062
|
+
bg: baseBg,
|
|
4063
|
+
blendMode: rootBlendMode,
|
|
4064
|
+
colorPalette
|
|
4065
|
+
};
|
|
4066
|
+
const bg = renderColorValue(value.bg, rootOptions);
|
|
4067
|
+
const colorOptions = {
|
|
4068
|
+
bg,
|
|
4069
|
+
blendMode,
|
|
4070
|
+
colorPalette
|
|
4071
|
+
};
|
|
4072
|
+
return {
|
|
4073
|
+
// _blend: blendMode,
|
|
4074
|
+
bg,
|
|
4075
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
4076
|
+
dot: renderColorValue(value.dot, colorOptions),
|
|
4077
|
+
icon: renderColorValue(value.icon, colorOptions)
|
|
4078
|
+
};
|
|
4079
|
+
}
|
|
4080
|
+
function renderThemeColorButton(value, options) {
|
|
4081
|
+
return {
|
|
4082
|
+
default: renderThemeColorButtonTones(value.default, options),
|
|
4083
|
+
ghost: renderThemeColorButtonTones(value.ghost, options),
|
|
4084
|
+
bleed: renderThemeColorButtonTones(value.bleed, options)
|
|
4085
|
+
};
|
|
4086
|
+
}
|
|
4087
|
+
function renderThemeColorButtonTones(value, options) {
|
|
4088
|
+
return {
|
|
4089
|
+
default: renderThemeColorButtonStates(value.default, options),
|
|
4090
|
+
primary: renderThemeColorButtonStates(value.primary, options),
|
|
4091
|
+
positive: renderThemeColorButtonStates(value.positive, options),
|
|
4092
|
+
caution: renderThemeColorButtonStates(value.caution, options),
|
|
4093
|
+
critical: renderThemeColorButtonStates(value.critical, options)
|
|
4094
|
+
};
|
|
4095
|
+
}
|
|
4096
|
+
function renderThemeColorButtonStates(value, options) {
|
|
4097
|
+
return {
|
|
4098
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
4099
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
4100
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
4101
|
+
selected: renderThemeColorState(value.selected, options),
|
|
4102
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
4103
|
+
};
|
|
4104
|
+
}
|
|
4105
|
+
function renderThemeColorState(value, options) {
|
|
4106
|
+
var _a, _b;
|
|
4107
|
+
const {
|
|
4108
|
+
baseBg,
|
|
4109
|
+
blendMode: rootBlendMode,
|
|
4110
|
+
colorPalette
|
|
4111
|
+
} = options;
|
|
4112
|
+
const blendMode = value._blend || "multiply";
|
|
4113
|
+
const rootOptions = {
|
|
4114
|
+
bg: baseBg,
|
|
4115
|
+
blendMode: rootBlendMode,
|
|
4116
|
+
colorPalette
|
|
4117
|
+
};
|
|
4118
|
+
const bg = renderColorValue(value.bg, rootOptions);
|
|
4119
|
+
const colorOptions = {
|
|
4120
|
+
bg,
|
|
4121
|
+
blendMode,
|
|
4122
|
+
colorPalette
|
|
4123
|
+
};
|
|
4124
|
+
return {
|
|
4125
|
+
_blend: blendMode,
|
|
4126
|
+
accent: {
|
|
4127
|
+
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
4128
|
+
},
|
|
4129
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
4130
|
+
baseBg,
|
|
4131
|
+
colorPalette,
|
|
4132
|
+
blendMode
|
|
4133
|
+
}),
|
|
4134
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
4135
|
+
baseBg,
|
|
4136
|
+
colorPalette,
|
|
4137
|
+
blendMode
|
|
4138
|
+
}),
|
|
4139
|
+
bg,
|
|
4140
|
+
border: renderColorValue(value.border, colorOptions),
|
|
4141
|
+
code: {
|
|
4142
|
+
bg: renderColorValue(value.code.bg, colorOptions),
|
|
4143
|
+
fg: renderColorValue(value.code.fg, colorOptions)
|
|
4144
|
+
},
|
|
4145
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
4146
|
+
icon: renderColorValue(value.icon, colorOptions),
|
|
4147
|
+
link: {
|
|
4148
|
+
fg: renderColorValue(value.link.fg, colorOptions)
|
|
4149
|
+
},
|
|
4150
|
+
muted: {
|
|
4151
|
+
bg: renderColorValue(value.muted.bg, colorOptions),
|
|
4152
|
+
fg: renderColorValue(value.muted.fg, colorOptions)
|
|
4153
|
+
},
|
|
4154
|
+
kbd: {
|
|
4155
|
+
bg: renderColorValue(value.kbd.bg, colorOptions),
|
|
4156
|
+
fg: renderColorValue(value.kbd.fg, colorOptions),
|
|
4157
|
+
border: renderColorValue(value.kbd.border, colorOptions)
|
|
4158
|
+
},
|
|
4159
|
+
skeleton: {
|
|
4160
|
+
from: renderColorValue((_a = value.skeleton) == null ? void 0 : _a.from, colorOptions),
|
|
4161
|
+
to: renderColorValue((_b = value.skeleton) == null ? void 0 : _b.to, colorOptions)
|
|
4162
|
+
}
|
|
4163
|
+
};
|
|
4164
|
+
}
|
|
4165
|
+
function renderThemeColorInput(value, options) {
|
|
4166
|
+
return {
|
|
4167
|
+
default: renderInputStatesColorTheme(value.default, options),
|
|
4168
|
+
invalid: renderInputStatesColorTheme(value.invalid, options)
|
|
4169
|
+
};
|
|
4170
|
+
}
|
|
4171
|
+
function renderInputStatesColorTheme(value, options) {
|
|
4172
|
+
return {
|
|
4173
|
+
enabled: renderInputStateColorTheme(value.enabled, options),
|
|
4174
|
+
hovered: renderInputStateColorTheme(value.hovered, options),
|
|
4175
|
+
readOnly: renderInputStateColorTheme(value.readOnly, options),
|
|
4176
|
+
disabled: renderInputStateColorTheme(value.disabled, options)
|
|
4177
|
+
};
|
|
4178
|
+
}
|
|
4179
|
+
function renderInputStateColorTheme(value, options) {
|
|
4180
|
+
const {
|
|
4181
|
+
baseBg,
|
|
4182
|
+
blendMode: rootBlendMode,
|
|
4183
|
+
colorPalette
|
|
4184
|
+
} = options;
|
|
4185
|
+
const blendMode = value._blend || "multiply";
|
|
4186
|
+
const rootOptions = {
|
|
4187
|
+
colorPalette,
|
|
4188
|
+
bg: baseBg,
|
|
4189
|
+
blendMode: rootBlendMode
|
|
4190
|
+
};
|
|
4191
|
+
const bg = renderColorValue(value.bg, rootOptions);
|
|
4192
|
+
const colorOptions = {
|
|
4193
|
+
colorPalette,
|
|
4194
|
+
bg,
|
|
4195
|
+
blendMode
|
|
4196
|
+
};
|
|
4197
|
+
return {
|
|
4198
|
+
_blend: blendMode,
|
|
4199
|
+
bg,
|
|
4200
|
+
border: renderColorValue(value.border, colorOptions),
|
|
4201
|
+
fg: renderColorValue(value.fg, colorOptions),
|
|
4202
|
+
muted: {
|
|
4203
|
+
bg: renderColorValue(value.muted.bg, colorOptions)
|
|
4204
|
+
},
|
|
4205
|
+
placeholder: renderColorValue(value.placeholder, colorOptions)
|
|
4206
|
+
};
|
|
4207
|
+
}
|
|
4208
|
+
function renderThemeColorSelectable(value, options) {
|
|
4209
|
+
return {
|
|
4210
|
+
default: renderThemeColorSelectableStates(value.default, options),
|
|
4211
|
+
primary: renderThemeColorSelectableStates(value.primary, options),
|
|
4212
|
+
positive: renderThemeColorSelectableStates(value.positive, options),
|
|
4213
|
+
caution: renderThemeColorSelectableStates(value.caution, options),
|
|
4214
|
+
critical: renderThemeColorSelectableStates(value.critical, options)
|
|
4215
|
+
};
|
|
4216
|
+
}
|
|
4217
|
+
function renderThemeColorSelectableStates(value, options) {
|
|
4218
|
+
return {
|
|
4219
|
+
enabled: renderThemeColorState(value.enabled, options),
|
|
4220
|
+
hovered: renderThemeColorState(value.hovered, options),
|
|
4221
|
+
pressed: renderThemeColorState(value.pressed, options),
|
|
4222
|
+
selected: renderThemeColorState(value.selected, options),
|
|
4223
|
+
disabled: renderThemeColorState(value.disabled, options)
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
4226
|
+
function renderSyntaxColorTheme(value, options) {
|
|
4227
|
+
const {
|
|
4228
|
+
colorPalette,
|
|
4229
|
+
baseBg,
|
|
4230
|
+
blendMode
|
|
4231
|
+
} = options;
|
|
4232
|
+
const colorOptions = {
|
|
4233
|
+
colorPalette,
|
|
4234
|
+
bg: baseBg,
|
|
4235
|
+
blendMode
|
|
4236
|
+
};
|
|
4237
|
+
return {
|
|
4238
|
+
atrule: renderColorValue(value.atrule, colorOptions),
|
|
4239
|
+
attrName: renderColorValue(value.attrName, colorOptions),
|
|
4240
|
+
attrValue: renderColorValue(value.attrValue, colorOptions),
|
|
4241
|
+
attribute: renderColorValue(value.attribute, colorOptions),
|
|
4242
|
+
boolean: renderColorValue(value.boolean, colorOptions),
|
|
4243
|
+
builtin: renderColorValue(value.builtin, colorOptions),
|
|
4244
|
+
cdata: renderColorValue(value.cdata, colorOptions),
|
|
4245
|
+
char: renderColorValue(value.char, colorOptions),
|
|
4246
|
+
class: renderColorValue(value.class, colorOptions),
|
|
4247
|
+
className: renderColorValue(value.className, colorOptions),
|
|
4248
|
+
comment: renderColorValue(value.comment, colorOptions),
|
|
4249
|
+
constant: renderColorValue(value.constant, colorOptions),
|
|
4250
|
+
deleted: renderColorValue(value.deleted, colorOptions),
|
|
4251
|
+
doctype: renderColorValue(value.doctype, colorOptions),
|
|
4252
|
+
entity: renderColorValue(value.entity, colorOptions),
|
|
4253
|
+
function: renderColorValue(value.function, colorOptions),
|
|
4254
|
+
hexcode: renderColorValue(value.hexcode, colorOptions),
|
|
4255
|
+
id: renderColorValue(value.id, colorOptions),
|
|
4256
|
+
important: renderColorValue(value.important, colorOptions),
|
|
4257
|
+
inserted: renderColorValue(value.inserted, colorOptions),
|
|
4258
|
+
keyword: renderColorValue(value.keyword, colorOptions),
|
|
4259
|
+
number: renderColorValue(value.number, colorOptions),
|
|
4260
|
+
operator: renderColorValue(value.operator, colorOptions),
|
|
4261
|
+
prolog: renderColorValue(value.prolog, colorOptions),
|
|
4262
|
+
property: renderColorValue(value.property, colorOptions),
|
|
4263
|
+
pseudoClass: renderColorValue(value.pseudoClass, colorOptions),
|
|
4264
|
+
pseudoElement: renderColorValue(value.pseudoElement, colorOptions),
|
|
4265
|
+
punctuation: renderColorValue(value.punctuation, colorOptions),
|
|
4266
|
+
regex: renderColorValue(value.regex, colorOptions),
|
|
4267
|
+
selector: renderColorValue(value.selector, colorOptions),
|
|
4268
|
+
string: renderColorValue(value.string, colorOptions),
|
|
4269
|
+
symbol: renderColorValue(value.symbol, colorOptions),
|
|
4270
|
+
tag: renderColorValue(value.tag, colorOptions),
|
|
4271
|
+
unit: renderColorValue(value.unit, colorOptions),
|
|
4272
|
+
url: renderColorValue(value.url, colorOptions),
|
|
4273
|
+
variable: renderColorValue(value.variable, colorOptions)
|
|
4274
|
+
};
|
|
4275
|
+
}
|
|
4276
|
+
function buildTheme(config) {
|
|
4277
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
4278
|
+
const colorTheme = buildColorTheme(config);
|
|
4279
|
+
const v2 = {
|
|
4280
|
+
_version: 2,
|
|
4281
|
+
avatar: (_a = config == null ? void 0 : config.avatar) != null ? _a : defaultThemeConfig.avatar,
|
|
4282
|
+
button: (_b = config == null ? void 0 : config.button) != null ? _b : defaultThemeConfig.button,
|
|
4283
|
+
card: (_c = config == null ? void 0 : config.card) != null ? _c : defaultThemeConfig.card,
|
|
4284
|
+
// How colors are generated:
|
|
4285
|
+
// 1. Merge custom tokens with default tokens
|
|
4286
|
+
// 2. Generate tree of color keys (gray/500, black, white, etc.)
|
|
4287
|
+
// 3. Apply mixing and render to hex values
|
|
4288
|
+
// render(build(mergeWithDefaults()))
|
|
4289
|
+
color: renderThemeColorSchemes(colorTheme, config),
|
|
4290
|
+
container: (_d = config == null ? void 0 : config.container) != null ? _d : defaultThemeConfig.container,
|
|
4291
|
+
font: (_e = config == null ? void 0 : config.font) != null ? _e : defaultThemeFonts,
|
|
4292
|
+
input: (_f = config == null ? void 0 : config.input) != null ? _f : defaultThemeConfig.input,
|
|
4293
|
+
layer: (_g = config == null ? void 0 : config.layer) != null ? _g : defaultThemeConfig.layer,
|
|
4294
|
+
media: (_h = config == null ? void 0 : config.media) != null ? _h : defaultThemeConfig.media,
|
|
4295
|
+
radius: (_i = config == null ? void 0 : config.radius) != null ? _i : defaultThemeConfig.radius,
|
|
4296
|
+
shadow: (_j = config == null ? void 0 : config.shadow) != null ? _j : defaultThemeConfig.shadow,
|
|
4297
|
+
space: (_k = config == null ? void 0 : config.space) != null ? _k : defaultThemeConfig.space,
|
|
4298
|
+
style: (_l = config == null ? void 0 : config.style) != null ? _l : defaultThemeConfig.style
|
|
4299
|
+
};
|
|
4300
|
+
return v2_v0(v2);
|
|
4301
|
+
}
|
|
4302
|
+
const cache = /* @__PURE__ */new Map();
|
|
4303
|
+
function getScopedTheme(themeProp, scheme, tone) {
|
|
4304
|
+
const cachedTheme = _getCachedTheme(themeProp, scheme, tone);
|
|
4305
|
+
if (cachedTheme) return cachedTheme;
|
|
4306
|
+
const v0 = is_v2(themeProp) ? v2_v0(themeProp) : themeProp;
|
|
4307
|
+
const v2 = is_v2(themeProp) ? themeProp : v0_v2(themeProp);
|
|
4308
|
+
const colorScheme_v0 = v0.color[scheme] || v0.color.light;
|
|
4309
|
+
const color_v0 = colorScheme_v0[tone] || colorScheme_v0.default;
|
|
4310
|
+
const layer_v0 = v0.layer || defaultThemeConfig.layer;
|
|
4311
|
+
const colorScheme_v2 = v2.color[scheme] || v2.color.light;
|
|
4312
|
+
const color_v2 = colorScheme_v2[tone] || colorScheme_v2.default;
|
|
4313
|
+
const layer_v2 = v2.layer || defaultThemeConfig.layer;
|
|
4314
|
+
const theme = {
|
|
4315
|
+
sanity: {
|
|
4316
|
+
...v0,
|
|
4317
|
+
color: color_v0,
|
|
4318
|
+
layer: layer_v0,
|
|
4319
|
+
v2: {
|
|
4320
|
+
...v2,
|
|
4321
|
+
color: color_v2,
|
|
4322
|
+
layer: layer_v2
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
};
|
|
4326
|
+
_setCachedTheme(themeProp, scheme, tone, theme);
|
|
4327
|
+
return theme;
|
|
4328
|
+
}
|
|
4329
|
+
function _getCachedTheme(rootTheme, scheme, tone) {
|
|
4330
|
+
const schemeCache = cache.get(scheme);
|
|
4331
|
+
if (!schemeCache) return void 0;
|
|
4332
|
+
const toneCache = schemeCache.get(tone);
|
|
4333
|
+
if (!toneCache) return void 0;
|
|
4334
|
+
return toneCache.get(rootTheme);
|
|
4335
|
+
}
|
|
4336
|
+
function _setCachedTheme(rootTheme, scheme, tone, theme) {
|
|
4337
|
+
if (!cache.has(scheme)) cache.set(scheme, /* @__PURE__ */new Map());
|
|
4338
|
+
const schemeCache = cache.get(scheme);
|
|
4339
|
+
if (!schemeCache.has(tone)) schemeCache.set(tone, /* @__PURE__ */new WeakMap());
|
|
4340
|
+
const toneCache = schemeCache.get(tone);
|
|
4341
|
+
toneCache.set(rootTheme, theme);
|
|
4342
|
+
}
|
|
4343
|
+
const defaultTheme = buildTheme();
|
|
4344
|
+
export { COLOR_CONFIG_AVATAR_COLORS, COLOR_CONFIG_BLEND_KEYS, COLOR_CONFIG_CARD_KEYS, COLOR_CONFIG_CARD_TONES, COLOR_CONFIG_INPUT_MODES, COLOR_CONFIG_INPUT_STATES, COLOR_CONFIG_STATES, COLOR_CONFIG_STATE_KEYS, COLOR_CONFIG_STATE_TONES, THEME_COLOR_AVATAR_COLORS, THEME_COLOR_BLEND_MODES, THEME_COLOR_BUTTON_MODES, THEME_COLOR_CARD_TONES, THEME_COLOR_INPUT_MODES, THEME_COLOR_INPUT_STATES, THEME_COLOR_STATES, THEME_COLOR_STATE_TONES, buildTheme, createColorTheme, defaultTheme, getContrastRatio, getScopedTheme, getTheme_v2, hexToRgb, hslToRgb, isColorBlendModeValue, isColorButtonMode, isColorConfigBaseKey, isColorConfigBaseTone, isColorConfigBlendKey, isColorConfigStateKey, isColorConfigStateTone, isColorHueKey, isColorOpacityValue, isColorTintKey, isColorTokenValue, isColorValue, is_v0, is_v2, mix, multiply, parseColor, parseTokenKey, parseTokenValue, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen, v0_v2, v2_v0 };
|
|
4345
|
+
//# sourceMappingURL=theme.esm.js.map
|