@sanity/ui 3.0.0-static.17 → 3.0.0-static.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/_visual-editing.cjs +138 -137
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/buildCommand.cjs +21 -22
- package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +139 -138
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +12 -22
- package/dist/_visual-editing.d.ts +12 -22
- package/dist/cli.cjs +1 -1
- package/dist/css.cjs +1589 -2016
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +9427 -874
- package/dist/css.d.ts +9427 -874
- package/dist/css.js +1591 -2018
- package/dist/css.js.map +1 -1
- package/dist/index.cjs +28 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -23
- package/dist/index.d.ts +26 -23
- package/dist/index.js +30 -42
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2749 -2756
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +242 -161
- package/dist/theme.d.ts +242 -161
- package/dist/theme.js +2750 -2757
- package/dist/theme.js.map +1 -1
- package/dist/ui-system.css +15719 -16097
- package/dist/ui-system.min.css +1 -1
- package/dist/ui-theme.css +850 -4568
- package/dist/ui-theme.min.css +1 -1
- package/dist/ui.css +16569 -20772
- package/dist/ui.min.css +1 -1
- package/package.json +10 -15
- package/src/cli/buildCommand.ts +13 -30
- package/src/core/StyleTags.tsx +4 -12
- package/src/core/_compat/styles/_responsive.ts +1 -1
- package/src/core/_compat/theme/theme.test.tsx +4 -5
- package/src/core/_compat/theme/themeColorProvider.tsx +2 -2
- package/src/core/_compat/theme/themeContext.ts +2 -2
- package/src/core/_compat/theme/themeProvider.tsx +2 -2
- package/src/core/_compat/theme/types.ts +1 -1
- package/src/core/_compat/theme/useRootTheme.ts +1 -1
- package/src/core/_compat/theme/useTheme.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/async.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +11 -11
- package/src/core/components/autocomplete/__workshop__/example.tsx +6 -7
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/autocomplete/autocompleteReducer.ts +1 -1
- package/src/core/components/autocomplete/constants.ts +1 -1
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -7
- package/src/core/components/dialog/__workshop__/activate.tsx +4 -4
- package/src/core/components/dialog/__workshop__/position.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +1 -1
- package/src/core/components/dialog/__workshop__/wrapped.tsx +2 -2
- package/src/core/components/dialog/dialog.tsx +15 -8
- package/src/core/components/dialog/dialogCard.tsx +18 -3
- package/src/core/components/dialog/dialogContext.ts +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +3 -3
- package/src/core/components/dialog/useDialog.ts +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -4
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +5 -4
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +2 -2
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +3 -3
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +2 -2
- package/src/core/components/menu/__workshop__/menuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +1 -1
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +13 -4
- package/src/core/components/menu/__workshop__/selectedItem.tsx +2 -2
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +6 -7
- package/src/core/components/menu/menu.tsx +2 -2
- package/src/core/components/menu/menuButton.tsx +9 -9
- package/src/core/components/menu/menuContext.ts +1 -1
- package/src/core/components/menu/menuDivider.tsx +3 -3
- package/src/core/components/menu/menuGroup.tsx +9 -9
- package/src/core/components/menu/menuItem.tsx +9 -6
- package/src/core/components/menu/useMenu.ts +1 -1
- package/src/core/components/menu/useMenuController.ts +4 -4
- package/src/core/components/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/components/skeleton/codeSkeleton.tsx +5 -5
- package/src/core/components/skeleton/headingSkeleton.tsx +5 -5
- package/src/core/components/skeleton/labelSkeleton.tsx +5 -5
- package/src/core/components/skeleton/skeleton.tsx +4 -4
- package/src/core/components/skeleton/textSkeleton.tsx +5 -5
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/tab.tsx +7 -7
- package/src/core/components/tab/tabList.tsx +14 -7
- package/src/core/components/tab/tabPanel.tsx +10 -7
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +5 -5
- package/src/core/components/toast/toast.tsx +6 -7
- package/src/core/components/toast/toastContext.ts +1 -1
- package/src/core/components/toast/toastLayer.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/toast/types.ts +1 -1
- package/src/core/components/toast/useToast.ts +1 -1
- package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
- package/src/core/components/tree/__workshop__/basic.tsx +1 -1
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/helpers.ts +1 -1
- package/src/core/components/tree/tree.tsx +6 -6
- package/src/core/components/tree/treeContext.ts +1 -1
- package/src/core/components/tree/treeGroup.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +15 -15
- package/src/core/components/tree/types.ts +2 -2
- package/src/core/components/tree/useTree.ts +1 -1
- package/src/core/hooks/useClickOutside.test.tsx +15 -16
- package/src/core/hooks/useClickOutsideEvent.test.tsx +4 -5
- package/src/core/hooks/useDelayed.test.ts +6 -7
- package/src/core/hooks/useDelayedState.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -1
- package/src/core/hooks/useElementSize.ts +1 -1
- package/src/core/hooks/useForwardedRef.ts +1 -1
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -18
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +10 -10
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersDark.test.tsx +1 -0
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +1 -0
- package/src/core/middleware/origin.ts +1 -1
- package/src/core/primitives/_selectable/selectable.tsx +3 -3
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +6 -6
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +7 -7
- package/src/core/primitives/avatar/types.ts +1 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +3 -3
- package/src/core/primitives/box/__workshop__/responsive.tsx +2 -1
- package/src/core/primitives/box/box.tsx +4 -2
- package/src/core/primitives/button/__workshop__/custom.tsx +2 -2
- package/src/core/primitives/button/__workshop__/customIcons.tsx +3 -3
- package/src/core/primitives/button/__workshop__/disabled.tsx +9 -9
- package/src/core/primitives/button/__workshop__/props.tsx +3 -4
- package/src/core/primitives/button/__workshop__/stacked.tsx +4 -5
- package/src/core/primitives/button/button.test.tsx +2 -3
- package/src/core/primitives/button/button.tsx +11 -6
- package/src/core/primitives/card/__workshop__/asButton.tsx +16 -7
- package/src/core/primitives/card/__workshop__/checkered.tsx +1 -1
- package/src/core/primitives/card/__workshop__/index.ts +1 -1
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +3 -3
- package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
- package/src/core/primitives/card/__workshop__/{allTones.tsx → tones.tsx} +3 -3
- package/src/core/primitives/card/card.tsx +4 -4
- package/src/core/primitives/card/cardContext.ts +2 -2
- package/src/core/primitives/card/cardProvider.tsx +3 -3
- package/src/core/primitives/card/types.ts +2 -2
- package/src/core/primitives/card/useCard.ts +2 -1
- package/src/core/primitives/checkbox/__workshop__/props.tsx +2 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +11 -20
- package/src/core/primitives/checkbox/checkbox.tsx +5 -7
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/code.tsx +3 -3
- package/src/core/primitives/container/container.tsx +4 -4
- package/src/core/primitives/flex/flex.tsx +2 -2
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +2 -2
- package/src/core/primitives/inline/types.ts +1 -0
- package/src/core/primitives/kbd/kbd.tsx +5 -5
- package/src/core/primitives/label/label.tsx +5 -5
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -4
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -4
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -3
- package/src/core/primitives/popover/constants.ts +1 -1
- package/src/core/primitives/popover/floating-ui/size.ts +2 -2
- package/src/core/primitives/popover/helpers.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverLayer.tsx +4 -4
- package/src/core/primitives/popover/types.ts +3 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +5 -5
- package/src/core/primitives/select/__workshop__/plain.tsx +15 -3
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +4 -10
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -2
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +3 -3
- package/src/core/primitives/spinner/spinner.tsx +3 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -5
- package/src/core/primitives/switch/switch.tsx +3 -3
- package/src/core/primitives/text/__workshop__/colored.tsx +5 -5
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +6 -6
- package/src/core/primitives/textArea/__workshop__/plain.tsx +35 -23
- package/src/core/primitives/textArea/textArea.tsx +14 -5
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +9 -15
- package/src/core/primitives/textInput/__workshop__/states.tsx +4 -4
- package/src/core/primitives/textInput/__workshop__/tones.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +13 -11
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -2
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +5 -4
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +61 -60
- package/src/core/primitives/tooltip/tooltip.tsx +11 -6
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +3 -3
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +4 -4
- package/src/core/primitives/types.ts +15 -24
- package/src/core/types/badge.ts +1 -1
- package/src/core/types/button.ts +1 -1
- package/src/core/types/card.ts +1 -1
- package/src/core/types/selectable.ts +1 -1
- package/src/core/utils/arrow/arrow.tsx +5 -14
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +5 -5
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +1 -1
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +15 -8
- package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/core/utils/errorBoundary.tsx +4 -4
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +5 -5
- package/src/core/utils/layer/__workshop__/nested.tsx +3 -3
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +9 -5
- package/src/core/utils/layer/getLayerContext.test.ts +3 -1
- package/src/core/utils/layer/getLayerContext.ts +1 -1
- package/src/core/utils/layer/layer.test.tsx +5 -5
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/layer/layerCard.tsx +3 -3
- package/src/core/utils/layer/layerContext.ts +1 -1
- package/src/core/utils/layer/layerProvider.tsx +10 -2
- package/src/core/utils/layer/useLayer.ts +1 -1
- package/src/core/utils/portal/__workshop__/named.tsx +3 -3
- package/src/core/utils/portal/portal.test.tsx +5 -5
- package/src/core/utils/portal/portal.tsx +3 -2
- package/src/core/utils/portal/portalContext.ts +1 -1
- package/src/core/utils/portal/portalProvider.tsx +2 -2
- package/src/core/utils/portal/usePortal.ts +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +3 -3
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +3 -3
- package/src/css/_assign.ts +3 -0
- package/src/css/_compileStyle.ts +12 -4
- package/src/css/_compileTheme.ts +10 -13
- package/src/css/_composeClassNames.ts +12 -0
- package/src/css/_fromEntries.ts +3 -0
- package/src/css/_getClassNames.ts +9 -0
- package/src/css/_hash.ts +9 -0
- package/src/css/_mergeStyles.ts +1 -1
- package/src/css/_resp.ts +6 -12
- package/src/css/_scopeClassName.ts +9 -0
- package/src/css/_scopeClassNames.ts +12 -0
- package/src/css/_system.style.ts +2 -0
- package/src/css/aspects/border/border.style.ts +2 -2
- package/src/css/aspects/border/border.ts +3 -3
- package/src/css/aspects/border/types.ts +1 -1
- package/src/css/aspects/boxSizing/boxSizing.style.ts +10 -0
- package/src/css/aspects/boxSizing/boxSizing.ts +8 -0
- package/src/css/aspects/boxSizing/index.ts +2 -0
- package/src/css/aspects/boxSizing/types.ts +9 -0
- package/src/css/aspects/display/display.style.ts +8 -8
- package/src/css/aspects/display/display.ts +3 -3
- package/src/css/aspects/display/types.ts +1 -1
- package/src/css/aspects/flex/flex.ts +3 -3
- package/src/css/aspects/flex/types.ts +1 -1
- package/src/css/aspects/flexItem/flex.style.ts +1 -1
- package/src/css/aspects/flexItem/flexItem.ts +3 -3
- package/src/css/aspects/flexItem/types.ts +1 -1
- package/src/css/aspects/font/font.style.ts +33 -22
- package/src/css/aspects/font/font.ts +3 -3
- package/src/css/aspects/font/types.ts +1 -1
- package/src/css/aspects/gap/gap.style.ts +2 -2
- package/src/css/aspects/gap/gap.ts +3 -3
- package/src/css/aspects/gap/types.ts +2 -2
- package/src/css/aspects/grid/grid.ts +3 -3
- package/src/css/aspects/grid/types.ts +1 -1
- package/src/css/aspects/gridItem/gridItem.ts +3 -3
- package/src/css/aspects/gridItem/types.ts +1 -1
- package/src/css/aspects/height/height.ts +3 -3
- package/src/css/aspects/index.ts +1 -0
- package/src/css/aspects/inset/inset.ts +3 -3
- package/src/css/aspects/inset/types.ts +1 -1
- package/src/css/aspects/margin/margin.style.ts +10 -10
- package/src/css/aspects/margin/margin.ts +3 -3
- package/src/css/aspects/margin/types.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.style.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.ts +4 -3
- package/src/css/aspects/maxWidth/types.ts +2 -2
- package/src/css/aspects/minWidth/minWidth.ts +4 -3
- package/src/css/aspects/minWidth/types.ts +1 -1
- package/src/css/aspects/overflow/overflow.ts +3 -3
- package/src/css/aspects/overflow/types.ts +1 -1
- package/src/css/aspects/padding/padding.style.ts +2 -5
- package/src/css/aspects/padding/padding.ts +3 -3
- package/src/css/aspects/padding/types.ts +2 -2
- package/src/css/aspects/pointerEvents/pointerEvents.ts +3 -3
- package/src/css/aspects/position/position.ts +3 -3
- package/src/css/aspects/position/types.ts +1 -1
- package/src/css/aspects/radius/radius.style.ts +1 -1
- package/src/css/aspects/radius/radius.ts +3 -3
- package/src/css/aspects/radius/types.ts +2 -2
- package/src/css/aspects/shadow/shadow.style.ts +7 -7
- package/src/css/aspects/shadow/shadow.ts +3 -3
- package/src/css/aspects/shadow/types.ts +2 -2
- package/src/css/aspects/textAlign/textAlign.style.ts +1 -1
- package/src/css/aspects/textAlign/textAlign.ts +3 -3
- package/src/css/aspects/textOverflow/textOverflow.ts +3 -3
- package/src/css/aspects/width/types.ts +2 -2
- package/src/css/aspects/width/width.style.ts +1 -1
- package/src/css/aspects/width/width.ts +4 -3
- package/src/css/components/breadcrumbs/breadcrumbs.style.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.ts +2 -2
- package/src/css/components/dialog/dialog.style.ts +14 -16
- package/src/css/components/dialog/dialog.ts +9 -8
- package/src/css/components/menu/menu.style.ts +2 -2
- package/src/css/components/menu/menu.ts +3 -3
- package/src/css/components/skeleton/skeleton.style.ts +24 -17
- package/src/css/components/skeleton/skeleton.ts +8 -7
- package/src/css/components/skeleton/types.ts +4 -6
- package/src/css/components/toast/toast.style.ts +1 -1
- package/src/css/components/toast/toast.ts +6 -6
- package/src/css/components/tree/tree.style.ts +7 -23
- package/src/css/components/tree/tree.ts +2 -2
- package/src/css/constants.ts +1 -3
- package/src/css/index.ts +3 -5
- package/src/css/prefix/constants.ts +6 -0
- package/src/css/prefix/types.ts +1 -0
- package/src/css/primitives/_arrow/_arrow.style.ts +11 -13
- package/src/css/primitives/_arrow/_arrow.ts +5 -5
- package/src/css/primitives/_input/_input.style.ts +171 -75
- package/src/css/primitives/_input/input.ts +13 -10
- package/src/css/primitives/_input/types.ts +3 -3
- package/src/css/primitives/_selectable/_selectable.style.ts +5 -6
- package/src/css/primitives/_selectable/selectable.ts +4 -3
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.style.ts +38 -39
- package/src/css/primitives/avatar/avatar.ts +8 -8
- package/src/css/primitives/avatar/types.ts +3 -3
- package/src/css/primitives/badge/badge.style.ts +2 -3
- package/src/css/primitives/badge/badge.ts +7 -3
- package/src/css/primitives/badge/types.ts +2 -2
- package/src/css/primitives/box/box.style.ts +5 -15
- package/src/css/primitives/box/box.ts +7 -9
- package/src/css/primitives/box/types.ts +3 -6
- package/src/css/primitives/button/button.style.ts +189 -162
- package/src/css/primitives/button/button.ts +11 -4
- package/src/css/primitives/button/types.ts +1 -1
- package/src/css/primitives/card/card.style.ts +102 -68
- package/src/css/primitives/card/card.ts +5 -7
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.style.ts +125 -101
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.style.ts +24 -26
- package/src/css/primitives/code/code.ts +7 -3
- package/src/css/primitives/code/types.ts +2 -2
- package/src/css/primitives/container/container.style.ts +1 -1
- package/src/css/primitives/container/container.ts +4 -3
- package/src/css/primitives/container/types.ts +2 -2
- package/src/css/primitives/heading/heading.style.ts +31 -23
- package/src/css/primitives/heading/heading.ts +10 -8
- package/src/css/primitives/heading/types.ts +3 -2
- package/src/css/primitives/kbd/kbd.style.ts +7 -7
- package/src/css/primitives/kbd/kbd.ts +4 -3
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.style.ts +27 -24
- package/src/css/primitives/label/label.ts +5 -8
- package/src/css/primitives/label/types.ts +4 -3
- package/src/css/primitives/popover/popover.style.ts +6 -2
- package/src/css/primitives/popover/popover.ts +3 -3
- package/src/css/primitives/radio/radio.style.ts +37 -76
- package/src/css/primitives/radio/radio.ts +2 -2
- package/src/css/primitives/select/select.style.ts +3 -3
- package/src/css/primitives/select/select.ts +5 -5
- package/src/css/primitives/select/types.ts +1 -1
- package/src/css/primitives/spinner/spinner.style.ts +1 -1
- package/src/css/primitives/spinner/spinner.ts +3 -3
- package/src/css/primitives/stack/stack.style.ts +6 -2
- package/src/css/primitives/stack/stack.ts +2 -2
- package/src/css/primitives/switch/switch.style.ts +47 -39
- package/src/css/primitives/switch/switch.ts +6 -6
- package/src/css/primitives/text/text.style.ts +28 -23
- package/src/css/primitives/text/text.ts +5 -8
- package/src/css/primitives/text/types.ts +2 -2
- package/src/css/primitives/textArea/textArea.style.ts +6 -2
- package/src/css/primitives/textArea/textArea.ts +4 -4
- package/src/css/primitives/textArea/types.ts +1 -1
- package/src/css/primitives/textInput/textInput.style.ts +23 -17
- package/src/css/primitives/textInput/textInput.ts +4 -4
- package/src/css/primitives/textInput/types.ts +2 -8
- package/src/css/primitives/token/token.style.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.style.ts +5 -4
- package/src/css/primitives/tooltip/tooltip.ts +3 -3
- package/src/css/renderColor.ts +31 -0
- package/src/css/theme/index.ts +14 -0
- package/src/css/theme/lib/contract/buildVarContract.ts +76 -0
- package/src/css/theme/lib/contract/index.ts +2 -0
- package/src/css/theme/lib/contract/types.ts +15 -0
- package/src/css/theme/resolveTheme.ts +852 -0
- package/src/css/types.ts +26 -910
- package/src/css/utils/srOnly/srOnly.style.ts +1 -1
- package/src/css/utils/srOnly/srOnly.ts +3 -3
- package/src/theme/getScopedTheme.ts +4 -4
- package/src/theme/index.ts +0 -5
- package/src/theme/types.ts +4 -4
- package/src/theme/v0/color/_generic.ts +1 -1
- package/src/theme/v0/color/button.ts +1 -1
- package/src/theme/v0/color/card.ts +1 -1
- package/src/theme/v0/color/color.ts +11 -11
- package/src/theme/v0/color/input.ts +1 -1
- package/src/theme/v0/color/muted.ts +1 -1
- package/src/theme/v0/color/selectable.ts +1 -1
- package/src/theme/v0/color/solid.ts +1 -1
- package/src/theme/v0/color/spot.ts +1 -1
- package/src/theme/v0/styles.ts +1 -1
- package/src/theme/v0/theme.ts +7 -7
- package/src/theme/v2/avatar.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/_selectable/createSelectableTones.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/_solid/createSolidTones.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonTones.ts +4 -4
- package/src/theme/{build → v2/build}/_deprecated/color/card/createCardStates.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/color.test.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/defaults.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/factory.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/input/createInputModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/spot/createSpot.ts +2 -2
- package/src/theme/{build → v2/build}/buildColorTheme.test.ts +3 -1
- package/src/theme/{build → v2/build}/buildColorTheme.ts +24 -24
- package/src/theme/{build → v2/build}/buildTheme.test.ts +10 -8
- package/src/theme/{build → v2/build}/buildTheme.ts +4 -4
- package/src/theme/{build → v2/build}/colorToken/colorToken.ts +2 -2
- package/src/theme/{build → v2/build}/colorToken/compileColorToken.ts +1 -1
- package/src/theme/{build → v2/build}/colorToken/types.ts +2 -2
- package/src/theme/{build → v2/build}/lib/color-fns/blend/mix.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/multiply.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/screen.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/color-fns.test.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/contrastRatio.ts +5 -2
- package/src/theme/{build → v2/build}/lib/color-fns/convert.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/parse.ts +1 -1
- package/src/theme/{build → v2/build}/mixThemeColor.test.ts +2 -0
- package/src/theme/{build → v2/build}/mixThemeColor.ts +1 -1
- package/src/theme/{build → v2/build}/renderColorTheme.ts +27 -27
- package/src/theme/{build → v2/build}/renderColorValue.ts +3 -3
- package/src/theme/{build → v2/build}/resolveColorTokens.ts +13 -13
- package/src/theme/v2/color/_helpers.ts +2 -2
- package/src/theme/v2/color/_system.ts +1 -1
- package/src/theme/v2/color/avatar.ts +1 -1
- package/src/theme/v2/color/badge.ts +1 -1
- package/src/theme/v2/color/button.ts +2 -2
- package/src/theme/v2/color/color.ts +7 -7
- package/src/theme/v2/color/input.ts +5 -1
- package/src/theme/v2/color/selectable.ts +2 -2
- package/src/theme/v2/color/state.ts +4 -4
- package/src/theme/{config → v2/config}/helpers.ts +6 -13
- package/src/theme/{config → v2/config}/system.ts +11 -12
- package/src/theme/{config → v2/config}/tokens/color/types.ts +14 -10
- package/src/theme/{config → v2/config}/tokens/index.ts +0 -1
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.ts +2 -2
- package/src/theme/{config → v2/config}/tokens/types.ts +3 -3
- package/src/theme/{config → v2/config}/types.ts +8 -6
- package/src/theme/{defaults → v2/defaults}/colorPalette.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/colorTokens.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/config.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/fonts.ts +1 -1
- package/src/theme/v2/index.ts +2 -0
- package/src/theme/v2/input.ts +1 -1
- package/src/theme/v2/theme.ts +8 -8
- package/src/theme/{_constants.ts → v3/_constants.ts} +6 -3
- package/src/theme/v3/_parseColorToken.ts +185 -0
- package/src/theme/v3/buildTheme_v3.ts +11 -7
- package/src/theme/v3/color/_constants.ts +15 -0
- package/src/theme/v3/color/avatar.ts +14 -0
- package/src/theme/v3/color/card.ts +53 -53
- package/src/theme/v3/color/color.ts +66 -68
- package/src/theme/v3/color/element.ts +8 -8
- package/src/theme/v3/color/index.ts +2 -2
- package/src/theme/v3/color/token.ts +18 -4
- package/src/theme/v3/color/tokens.ts +2 -2
- package/src/theme/v3/defaultTokens.ts +73 -85
- package/src/theme/v3/index.ts +3 -0
- package/src/theme/v3/palette/index.ts +2 -0
- package/src/theme/v3/resolveTokens.ts +65 -65
- package/src/theme/v3/tokens.ts +2 -2
- package/src/theme/v3/types.ts +61 -7
- package/src/theme/versioning/getTheme_v2.ts +3 -3
- package/src/theme/versioning/is_v0.ts +2 -2
- package/src/theme/versioning/is_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -1
- package/src/theme/versioning/themeColor_v3_v2.ts +229 -52
- package/src/theme/versioning/v0_v2.ts +3 -3
- package/src/theme/versioning/v2_v0.ts +4 -4
- package/src/theme/versioning/v3_v2.ts +38 -38
- package/dist/ui-palette.css +0 -105
- package/dist/ui-palette.min.css +0 -1
- package/src/css/_comp.test.ts +0 -7
- package/src/css/_comp.ts +0 -11
- package/src/css/_compilePalette.ts +0 -32
- package/src/css/_compileTheme_v3.ts +0 -440
- package/src/css/aspects/flex/flex.style.ts +0 -30
- package/src/css/composeClassNames.ts +0 -19
- package/src/css/primitives/_selectable/__style.ts +0 -117
- package/src/css/primitives/checkbox/__styles.ts +0 -129
- package/src/css/scopeClassName.ts +0 -7
- package/src/css/varNames.ts +0 -607
- package/src/css/vars.ts +0 -520
- package/src/theme/_types.ts +0 -41
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/v3/buildTheme_v3.test.ts +0 -40
- package/src/theme/v3/color/buildColor_v3.ts +0 -226
- package/src/theme/v3/color/parseColor.test.ts +0 -79
- package/src/theme/v3/color/parseColor.ts +0 -167
- package/src/theme/v3/color/renderColor.test.ts +0 -20
- package/src/theme/v3/color/renderColor.ts +0 -43
- /package/src/{theme/palette → css/prefix}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/_deprecated/color/index.ts +0 -0
- /package/src/theme/{build → v2/build}/colorToken/index.ts +0 -0
- /package/src/theme/{build → v2/build}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/blend/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/rgba.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/types.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/isRecord.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/utils.ts +0 -0
- /package/src/theme/{build → v2/build}/merge.ts +0 -0
- /package/src/theme/{config → v2/config}/index.ts +0 -0
- /package/src/theme/{config → v2/config}/tokens/color/index.ts +0 -0
- /package/src/theme/{palette → v3/palette}/constants.ts +0 -0
- /package/src/theme/{palette → v3/palette}/types.ts +0 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_parseColorToken,
|
|
3
|
+
AVATAR_COLORS,
|
|
4
|
+
AVATAR_SIZE,
|
|
5
|
+
COLOR_VARIANTS,
|
|
6
|
+
type ColorToken,
|
|
7
|
+
CONTAINER_SCALE,
|
|
8
|
+
FONT_CODE_SIZE,
|
|
9
|
+
FONT_HEADING_SIZE,
|
|
10
|
+
FONT_LABEL_SIZE,
|
|
11
|
+
FONT_TEXT_SIZE,
|
|
12
|
+
type Hue,
|
|
13
|
+
HUES,
|
|
14
|
+
RADIUS,
|
|
15
|
+
SHADOW,
|
|
16
|
+
SPACE,
|
|
17
|
+
THEME_COLOR_CARD_TONES,
|
|
18
|
+
THEME_COLOR_STATE_TONES,
|
|
19
|
+
type Theme_v3,
|
|
20
|
+
type ThemeBoxShadow,
|
|
21
|
+
type ThemeColorCard_v3,
|
|
22
|
+
type ThemeColorCardToneKey,
|
|
23
|
+
type ThemeColorSchemeKey,
|
|
24
|
+
type ThemeColorStateToneKey,
|
|
25
|
+
type ThemeColorVariantKey,
|
|
26
|
+
TINTS,
|
|
27
|
+
} from '@sanity/ui/theme'
|
|
28
|
+
|
|
29
|
+
import {_fromEntries} from '../_fromEntries'
|
|
30
|
+
import {buildVarContract} from './lib/contract'
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Resolve CSS theme
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export function resolveTheme(options: {theme: Theme_v3}) {
|
|
38
|
+
const {theme} = options
|
|
39
|
+
|
|
40
|
+
const paletteResult = buildVarContract(
|
|
41
|
+
{
|
|
42
|
+
palette: {
|
|
43
|
+
black: theme.palette.black.hex,
|
|
44
|
+
white: theme.palette.white.hex,
|
|
45
|
+
..._fromEntries(
|
|
46
|
+
HUES.map((hue) => [
|
|
47
|
+
hue,
|
|
48
|
+
_fromEntries(TINTS.map((tint) => [tint, theme.palette.hues[hue][tint].hex])),
|
|
49
|
+
]),
|
|
50
|
+
),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{layer: 'palette', prefix: 's'},
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const themeResult = buildVarContract(
|
|
57
|
+
{
|
|
58
|
+
arrow: {
|
|
59
|
+
size: null,
|
|
60
|
+
},
|
|
61
|
+
avatar: {
|
|
62
|
+
distance: null,
|
|
63
|
+
size: null,
|
|
64
|
+
focusRing: {
|
|
65
|
+
offset: px(theme.avatar.focusRing.offset),
|
|
66
|
+
width: px(theme.avatar.focusRing.width),
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
sizes: _fromEntries(
|
|
70
|
+
AVATAR_SIZE.map((s) => [
|
|
71
|
+
s,
|
|
72
|
+
{
|
|
73
|
+
distance: rem(theme.avatar.sizes[s].distance),
|
|
74
|
+
size: rem(theme.avatar.sizes[s].size),
|
|
75
|
+
},
|
|
76
|
+
]),
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
button: {
|
|
80
|
+
boxShadow: null,
|
|
81
|
+
focusRing: {
|
|
82
|
+
offset: px(theme.button.focusRing.offset),
|
|
83
|
+
width: px(theme.button.focusRing.width),
|
|
84
|
+
},
|
|
85
|
+
border: {
|
|
86
|
+
width: px(theme.button.border.width),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
card: {
|
|
90
|
+
shadow: {
|
|
91
|
+
outline: px(theme.card.shadow.outline),
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
color: {
|
|
95
|
+
backdrop: null,
|
|
96
|
+
bg: null,
|
|
97
|
+
border: null,
|
|
98
|
+
|
|
99
|
+
code: {
|
|
100
|
+
bg: null,
|
|
101
|
+
fg: null,
|
|
102
|
+
|
|
103
|
+
token: {
|
|
104
|
+
atrule: null,
|
|
105
|
+
attrName: null,
|
|
106
|
+
attrValue: null,
|
|
107
|
+
attribute: null,
|
|
108
|
+
boolean: null,
|
|
109
|
+
builtin: null,
|
|
110
|
+
cdata: null,
|
|
111
|
+
char: null,
|
|
112
|
+
class: null,
|
|
113
|
+
className: null,
|
|
114
|
+
comment: null,
|
|
115
|
+
constant: null,
|
|
116
|
+
deleted: null,
|
|
117
|
+
doctype: null,
|
|
118
|
+
entity: null,
|
|
119
|
+
function: null,
|
|
120
|
+
hexcode: null,
|
|
121
|
+
id: null,
|
|
122
|
+
important: null,
|
|
123
|
+
inserted: null,
|
|
124
|
+
keyword: null,
|
|
125
|
+
number: null,
|
|
126
|
+
operator: null,
|
|
127
|
+
prolog: null,
|
|
128
|
+
property: null,
|
|
129
|
+
pseudoClass: null,
|
|
130
|
+
pseudoElement: null,
|
|
131
|
+
punctuation: null,
|
|
132
|
+
regex: null,
|
|
133
|
+
selector: null,
|
|
134
|
+
string: null,
|
|
135
|
+
symbol: null,
|
|
136
|
+
tag: null,
|
|
137
|
+
unit: null,
|
|
138
|
+
url: null,
|
|
139
|
+
variable: null,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
fg: null,
|
|
144
|
+
focusRing: null,
|
|
145
|
+
|
|
146
|
+
link: {
|
|
147
|
+
fg: null,
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
avatar: {
|
|
151
|
+
bg: null,
|
|
152
|
+
fg: null,
|
|
153
|
+
|
|
154
|
+
..._fromEntries(
|
|
155
|
+
AVATAR_COLORS.map((c) => [
|
|
156
|
+
c,
|
|
157
|
+
{
|
|
158
|
+
bg: null,
|
|
159
|
+
fg: null,
|
|
160
|
+
},
|
|
161
|
+
]),
|
|
162
|
+
),
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
button: {},
|
|
166
|
+
|
|
167
|
+
input: {
|
|
168
|
+
checkbox: {
|
|
169
|
+
bg: null,
|
|
170
|
+
border: null,
|
|
171
|
+
fg: null,
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
radio: {
|
|
175
|
+
bg: null,
|
|
176
|
+
border: null,
|
|
177
|
+
fg: null,
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
text: {
|
|
181
|
+
bg: null,
|
|
182
|
+
fg: null,
|
|
183
|
+
border: null,
|
|
184
|
+
placeholder: null,
|
|
185
|
+
invalid: {
|
|
186
|
+
bg: null,
|
|
187
|
+
border: null,
|
|
188
|
+
fg: null,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
switch: {
|
|
193
|
+
bg: null,
|
|
194
|
+
fg: null,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
muted: {
|
|
199
|
+
bg: null,
|
|
200
|
+
fg: null,
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
shadow: {
|
|
204
|
+
outline: null,
|
|
205
|
+
umbra: null,
|
|
206
|
+
penumbra: null,
|
|
207
|
+
ambient: null,
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
skeleton: {
|
|
211
|
+
from: null,
|
|
212
|
+
to: null,
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
light: _fromEntries(
|
|
216
|
+
THEME_COLOR_CARD_TONES.map((t) => [
|
|
217
|
+
t,
|
|
218
|
+
buildCardContract({
|
|
219
|
+
theme,
|
|
220
|
+
scheme: 'light',
|
|
221
|
+
tone: t,
|
|
222
|
+
}),
|
|
223
|
+
]),
|
|
224
|
+
),
|
|
225
|
+
|
|
226
|
+
dark: _fromEntries(
|
|
227
|
+
THEME_COLOR_CARD_TONES.map((t) => [
|
|
228
|
+
t,
|
|
229
|
+
buildCardContract({
|
|
230
|
+
theme,
|
|
231
|
+
scheme: 'dark',
|
|
232
|
+
tone: t,
|
|
233
|
+
}),
|
|
234
|
+
]),
|
|
235
|
+
),
|
|
236
|
+
|
|
237
|
+
// tones
|
|
238
|
+
..._fromEntries(
|
|
239
|
+
THEME_COLOR_CARD_TONES.map((t) => [
|
|
240
|
+
t,
|
|
241
|
+
{
|
|
242
|
+
avatar: {
|
|
243
|
+
..._fromEntries(AVATAR_COLORS.map((c) => [c, {bg: null, fg: null}])),
|
|
244
|
+
},
|
|
245
|
+
backdrop: null,
|
|
246
|
+
code: {
|
|
247
|
+
bg: null,
|
|
248
|
+
fg: null,
|
|
249
|
+
|
|
250
|
+
token: {
|
|
251
|
+
atrule: null,
|
|
252
|
+
attrName: null,
|
|
253
|
+
attrValue: null,
|
|
254
|
+
attribute: null,
|
|
255
|
+
boolean: null,
|
|
256
|
+
builtin: null,
|
|
257
|
+
cdata: null,
|
|
258
|
+
char: null,
|
|
259
|
+
class: null,
|
|
260
|
+
className: null,
|
|
261
|
+
comment: null,
|
|
262
|
+
constant: null,
|
|
263
|
+
deleted: null,
|
|
264
|
+
doctype: null,
|
|
265
|
+
entity: null,
|
|
266
|
+
function: null,
|
|
267
|
+
hexcode: null,
|
|
268
|
+
id: null,
|
|
269
|
+
important: null,
|
|
270
|
+
inserted: null,
|
|
271
|
+
keyword: null,
|
|
272
|
+
number: null,
|
|
273
|
+
operator: null,
|
|
274
|
+
prolog: null,
|
|
275
|
+
property: null,
|
|
276
|
+
pseudoClass: null,
|
|
277
|
+
pseudoElement: null,
|
|
278
|
+
punctuation: null,
|
|
279
|
+
regex: null,
|
|
280
|
+
selector: null,
|
|
281
|
+
string: null,
|
|
282
|
+
symbol: null,
|
|
283
|
+
tag: null,
|
|
284
|
+
unit: null,
|
|
285
|
+
url: null,
|
|
286
|
+
variable: null,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
focusRing: null,
|
|
290
|
+
link: {
|
|
291
|
+
fg: null,
|
|
292
|
+
},
|
|
293
|
+
shadow: {
|
|
294
|
+
outline: null,
|
|
295
|
+
umbra: null,
|
|
296
|
+
penumbra: null,
|
|
297
|
+
ambient: null,
|
|
298
|
+
},
|
|
299
|
+
skeleton: {
|
|
300
|
+
from: null,
|
|
301
|
+
to: null,
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
..._fromEntries(
|
|
305
|
+
COLOR_VARIANTS.map((v) => [
|
|
306
|
+
v,
|
|
307
|
+
{
|
|
308
|
+
bg: {
|
|
309
|
+
0: null,
|
|
310
|
+
1: null,
|
|
311
|
+
2: null,
|
|
312
|
+
3: null,
|
|
313
|
+
4: null,
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
fg: {
|
|
317
|
+
0: null,
|
|
318
|
+
1: null,
|
|
319
|
+
2: null,
|
|
320
|
+
3: null,
|
|
321
|
+
4: null,
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
border: {
|
|
325
|
+
0: null,
|
|
326
|
+
1: null,
|
|
327
|
+
2: null,
|
|
328
|
+
3: null,
|
|
329
|
+
4: null,
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
..._fromEntries(
|
|
333
|
+
THEME_COLOR_STATE_TONES.map((t) => [
|
|
334
|
+
t,
|
|
335
|
+
{
|
|
336
|
+
bg: {
|
|
337
|
+
0: null,
|
|
338
|
+
1: null,
|
|
339
|
+
2: null,
|
|
340
|
+
3: null,
|
|
341
|
+
4: null,
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
fg: {
|
|
345
|
+
0: null,
|
|
346
|
+
1: null,
|
|
347
|
+
2: null,
|
|
348
|
+
3: null,
|
|
349
|
+
4: null,
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
border: {
|
|
353
|
+
0: null,
|
|
354
|
+
1: null,
|
|
355
|
+
2: null,
|
|
356
|
+
3: null,
|
|
357
|
+
4: null,
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
]),
|
|
361
|
+
),
|
|
362
|
+
},
|
|
363
|
+
]),
|
|
364
|
+
),
|
|
365
|
+
},
|
|
366
|
+
]),
|
|
367
|
+
),
|
|
368
|
+
|
|
369
|
+
..._fromEntries(
|
|
370
|
+
COLOR_VARIANTS.map((v) => [
|
|
371
|
+
v,
|
|
372
|
+
{
|
|
373
|
+
bg: {
|
|
374
|
+
0: null,
|
|
375
|
+
1: null,
|
|
376
|
+
2: null,
|
|
377
|
+
3: null,
|
|
378
|
+
4: null,
|
|
379
|
+
},
|
|
380
|
+
|
|
381
|
+
fg: {
|
|
382
|
+
0: null,
|
|
383
|
+
1: null,
|
|
384
|
+
2: null,
|
|
385
|
+
3: null,
|
|
386
|
+
4: null,
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
border: {
|
|
390
|
+
0: null,
|
|
391
|
+
1: null,
|
|
392
|
+
2: null,
|
|
393
|
+
3: null,
|
|
394
|
+
4: null,
|
|
395
|
+
},
|
|
396
|
+
|
|
397
|
+
..._fromEntries(
|
|
398
|
+
THEME_COLOR_STATE_TONES.map((t) => [
|
|
399
|
+
t,
|
|
400
|
+
{
|
|
401
|
+
bg: {
|
|
402
|
+
0: null,
|
|
403
|
+
1: null,
|
|
404
|
+
2: null,
|
|
405
|
+
3: null,
|
|
406
|
+
4: null,
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
fg: {
|
|
410
|
+
0: null,
|
|
411
|
+
1: null,
|
|
412
|
+
2: null,
|
|
413
|
+
3: null,
|
|
414
|
+
4: null,
|
|
415
|
+
},
|
|
416
|
+
|
|
417
|
+
border: {
|
|
418
|
+
0: null,
|
|
419
|
+
1: null,
|
|
420
|
+
2: null,
|
|
421
|
+
3: null,
|
|
422
|
+
4: null,
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
]),
|
|
426
|
+
),
|
|
427
|
+
},
|
|
428
|
+
]),
|
|
429
|
+
),
|
|
430
|
+
},
|
|
431
|
+
container: _fromEntries(CONTAINER_SCALE.map((c) => [c, px(theme.container[c])])),
|
|
432
|
+
font: {
|
|
433
|
+
family: null,
|
|
434
|
+
fontSize: null,
|
|
435
|
+
letterSpacing: null,
|
|
436
|
+
lineHeight: null,
|
|
437
|
+
ascenderHeight: null,
|
|
438
|
+
descenderHeight: null,
|
|
439
|
+
iconSize: null,
|
|
440
|
+
featureSettings: null,
|
|
441
|
+
fontWeight: null,
|
|
442
|
+
iconOffset: null,
|
|
443
|
+
|
|
444
|
+
code: {
|
|
445
|
+
family: theme.font.code.family,
|
|
446
|
+
featureSettings: theme.font.code.featureSettings ?? 'normal',
|
|
447
|
+
weight: {
|
|
448
|
+
regular: String(theme.font.code.weights.regular),
|
|
449
|
+
medium: String(theme.font.code.weights.medium),
|
|
450
|
+
semibold: String(theme.font.code.weights.semibold),
|
|
451
|
+
bold: String(theme.font.code.weights.bold),
|
|
452
|
+
},
|
|
453
|
+
sizes: _fromEntries(
|
|
454
|
+
FONT_CODE_SIZE.map((s) => [
|
|
455
|
+
s,
|
|
456
|
+
{
|
|
457
|
+
fontSize: rem(theme.font.code.sizes[s].fontSize),
|
|
458
|
+
lineHeight: rem(theme.font.code.sizes[s].lineHeight),
|
|
459
|
+
letterSpacing: rem(theme.font.code.sizes[s].letterSpacing),
|
|
460
|
+
ascenderHeight: rem(theme.font.code.sizes[s].ascenderHeight),
|
|
461
|
+
descenderHeight: rem(theme.font.code.sizes[s].descenderHeight),
|
|
462
|
+
iconSize: rem(theme.font.code.sizes[s].iconSize),
|
|
463
|
+
},
|
|
464
|
+
]),
|
|
465
|
+
),
|
|
466
|
+
},
|
|
467
|
+
|
|
468
|
+
heading: {
|
|
469
|
+
family: theme.font.heading.family,
|
|
470
|
+
featureSettings: theme.font.heading.featureSettings ?? 'normal',
|
|
471
|
+
weight: {
|
|
472
|
+
regular: String(theme.font.heading.weights.regular),
|
|
473
|
+
medium: String(theme.font.heading.weights.medium),
|
|
474
|
+
semibold: String(theme.font.heading.weights.semibold),
|
|
475
|
+
bold: String(theme.font.heading.weights.bold),
|
|
476
|
+
},
|
|
477
|
+
sizes: _fromEntries(
|
|
478
|
+
FONT_HEADING_SIZE.map((s) => [
|
|
479
|
+
s,
|
|
480
|
+
{
|
|
481
|
+
fontSize: rem(theme.font.heading.sizes[s].fontSize),
|
|
482
|
+
lineHeight: rem(theme.font.heading.sizes[s].lineHeight),
|
|
483
|
+
letterSpacing: rem(theme.font.heading.sizes[s].letterSpacing),
|
|
484
|
+
ascenderHeight: rem(theme.font.heading.sizes[s].ascenderHeight),
|
|
485
|
+
descenderHeight: rem(theme.font.heading.sizes[s].descenderHeight),
|
|
486
|
+
iconSize: rem(theme.font.heading.sizes[s].iconSize),
|
|
487
|
+
},
|
|
488
|
+
]),
|
|
489
|
+
),
|
|
490
|
+
},
|
|
491
|
+
|
|
492
|
+
label: {
|
|
493
|
+
family: theme.font.label.family,
|
|
494
|
+
featureSettings: theme.font.label.featureSettings ?? 'normal',
|
|
495
|
+
weight: {
|
|
496
|
+
regular: String(theme.font.label.weights.regular),
|
|
497
|
+
medium: String(theme.font.label.weights.medium),
|
|
498
|
+
semibold: String(theme.font.label.weights.semibold),
|
|
499
|
+
bold: String(theme.font.label.weights.bold),
|
|
500
|
+
},
|
|
501
|
+
sizes: _fromEntries(
|
|
502
|
+
FONT_LABEL_SIZE.map((s) => [
|
|
503
|
+
s,
|
|
504
|
+
{
|
|
505
|
+
fontSize: rem(theme.font.label.sizes[s].fontSize),
|
|
506
|
+
lineHeight: rem(theme.font.label.sizes[s].lineHeight),
|
|
507
|
+
letterSpacing: rem(theme.font.label.sizes[s].letterSpacing),
|
|
508
|
+
ascenderHeight: rem(theme.font.label.sizes[s].ascenderHeight),
|
|
509
|
+
descenderHeight: rem(theme.font.label.sizes[s].descenderHeight),
|
|
510
|
+
iconSize: rem(theme.font.label.sizes[s].iconSize),
|
|
511
|
+
},
|
|
512
|
+
]),
|
|
513
|
+
),
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
text: {
|
|
517
|
+
family: theme.font.text.family,
|
|
518
|
+
featureSettings: theme.font.text.featureSettings ?? 'normal',
|
|
519
|
+
weight: {
|
|
520
|
+
regular: String(theme.font.text.weights.regular),
|
|
521
|
+
medium: String(theme.font.text.weights.medium),
|
|
522
|
+
semibold: String(theme.font.text.weights.semibold),
|
|
523
|
+
bold: String(theme.font.text.weights.bold),
|
|
524
|
+
},
|
|
525
|
+
sizes: _fromEntries(
|
|
526
|
+
FONT_TEXT_SIZE.map((s) => [
|
|
527
|
+
s,
|
|
528
|
+
{
|
|
529
|
+
fontSize: rem(theme.font.text.sizes[s].fontSize),
|
|
530
|
+
lineHeight: rem(theme.font.text.sizes[s].lineHeight),
|
|
531
|
+
letterSpacing: rem(theme.font.text.sizes[s].letterSpacing),
|
|
532
|
+
ascenderHeight: rem(theme.font.text.sizes[s].ascenderHeight),
|
|
533
|
+
descenderHeight: rem(theme.font.text.sizes[s].descenderHeight),
|
|
534
|
+
iconSize: rem(theme.font.text.sizes[s].iconSize),
|
|
535
|
+
},
|
|
536
|
+
]),
|
|
537
|
+
),
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
skeleton: {
|
|
541
|
+
lineHeight: null,
|
|
542
|
+
ascenderHeight: null,
|
|
543
|
+
descenderHeight: null,
|
|
544
|
+
},
|
|
545
|
+
|
|
546
|
+
weight: {
|
|
547
|
+
regular: null,
|
|
548
|
+
medium: null,
|
|
549
|
+
semibold: null,
|
|
550
|
+
bold: null,
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
input: {
|
|
554
|
+
gap: null,
|
|
555
|
+
descenderHeight: null,
|
|
556
|
+
ascenderHeight: null,
|
|
557
|
+
fontSize: null,
|
|
558
|
+
lineHeight: null,
|
|
559
|
+
letterSpacing: null,
|
|
560
|
+
padding: null,
|
|
561
|
+
|
|
562
|
+
border: {
|
|
563
|
+
width: px(theme.input.border.width),
|
|
564
|
+
},
|
|
565
|
+
|
|
566
|
+
checkbox: {
|
|
567
|
+
size: px(theme.input.checkbox.size),
|
|
568
|
+
|
|
569
|
+
focusRing: {
|
|
570
|
+
offset: px(theme.input.checkbox.focusRing.offset),
|
|
571
|
+
width: px(theme.input.checkbox.focusRing.width),
|
|
572
|
+
},
|
|
573
|
+
},
|
|
574
|
+
|
|
575
|
+
radio: {
|
|
576
|
+
focusRing: {
|
|
577
|
+
offset: px(theme.input.radio.focusRing.offset),
|
|
578
|
+
width: px(theme.input.radio.focusRing.width),
|
|
579
|
+
},
|
|
580
|
+
|
|
581
|
+
markSize: px(theme.input.radio.markSize),
|
|
582
|
+
size: px(theme.input.radio.size),
|
|
583
|
+
},
|
|
584
|
+
|
|
585
|
+
select: {
|
|
586
|
+
focusRing: {
|
|
587
|
+
offset: px(theme.input.select.focusRing.offset),
|
|
588
|
+
width: px(theme.input.select.focusRing.width),
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
|
|
592
|
+
text: {
|
|
593
|
+
focusRing: {
|
|
594
|
+
offset: px(theme.input.text.focusRing.offset),
|
|
595
|
+
width: px(theme.input.text.focusRing.width),
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
switch: {
|
|
600
|
+
width: px(theme.input.switch.width),
|
|
601
|
+
height: px(theme.input.switch.height),
|
|
602
|
+
|
|
603
|
+
focusRing: {
|
|
604
|
+
offset: px(theme.input.switch.focusRing.offset),
|
|
605
|
+
width: px(theme.input.switch.focusRing.width),
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
padding: px(theme.input.switch.padding),
|
|
609
|
+
|
|
610
|
+
thumb: {
|
|
611
|
+
offset: null,
|
|
612
|
+
size: null,
|
|
613
|
+
},
|
|
614
|
+
|
|
615
|
+
transitionDurationMs: `${theme.input.switch.transitionDurationMs}ms`,
|
|
616
|
+
transitionTimingFunction: theme.input.switch.transitionTimingFunction,
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
radius: _fromEntries(RADIUS.map((r) => [r, px(theme.radius[r])])),
|
|
620
|
+
shadow: _fromEntries(
|
|
621
|
+
SHADOW.map((s) => [
|
|
622
|
+
s,
|
|
623
|
+
{
|
|
624
|
+
umbra: toBoxShadow(theme.shadow[s]?.umbra),
|
|
625
|
+
penumbra: toBoxShadow(theme.shadow[s]?.penumbra),
|
|
626
|
+
ambient: toBoxShadow(theme.shadow[s]?.ambient),
|
|
627
|
+
},
|
|
628
|
+
]),
|
|
629
|
+
),
|
|
630
|
+
space: _fromEntries(SPACE.map((s) => [s, px(theme.space[s])])),
|
|
631
|
+
},
|
|
632
|
+
{layer: 'theme', prefix: 's'},
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
return {
|
|
636
|
+
vars: Object.freeze({
|
|
637
|
+
...paletteResult.vars,
|
|
638
|
+
...themeResult.vars,
|
|
639
|
+
}),
|
|
640
|
+
varNames: Object.freeze({
|
|
641
|
+
...paletteResult.varNames,
|
|
642
|
+
...themeResult.varNames,
|
|
643
|
+
}),
|
|
644
|
+
properties: Object.freeze({
|
|
645
|
+
...paletteResult.properties,
|
|
646
|
+
...themeResult.properties,
|
|
647
|
+
}),
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function renderColor(t: ColorToken, options: {bgValue?: string; defaultHue: Hue}) {
|
|
651
|
+
const {bgValue = 'transparent'} = options
|
|
652
|
+
|
|
653
|
+
const color = _parseColorToken(t, options)
|
|
654
|
+
|
|
655
|
+
if (color.type === 'inherit') {
|
|
656
|
+
return bgValue
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
let value = '#000'
|
|
660
|
+
|
|
661
|
+
if (color.type === 'color') {
|
|
662
|
+
value = paletteResult.vars.palette[color.name]
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (color.type === 'tint') {
|
|
666
|
+
value = paletteResult.vars.palette[color.hue][color.tint]
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (color.opacity < 1) {
|
|
670
|
+
value = `color-mix(in srgb, transparent, ${value} ${color.opacity * 100}%)`
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if (color.mix < 1) {
|
|
674
|
+
value = `color-mix(in srgb, ${bgValue}, ${value} ${color.mix * 100}%)`
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return value
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
function buildCardContract(options: {
|
|
681
|
+
theme: Theme_v3
|
|
682
|
+
scheme: ThemeColorSchemeKey
|
|
683
|
+
tone: ThemeColorCardToneKey
|
|
684
|
+
}) {
|
|
685
|
+
const {theme, scheme, tone} = options
|
|
686
|
+
const card = theme.color[tone]
|
|
687
|
+
const cardOptions = {defaultHue: card._hue}
|
|
688
|
+
const i = scheme === 'dark' ? 1 : 0
|
|
689
|
+
|
|
690
|
+
const defaultElement = buildElementContract({
|
|
691
|
+
card,
|
|
692
|
+
variant: 'tinted',
|
|
693
|
+
tone: 'default',
|
|
694
|
+
scheme,
|
|
695
|
+
})
|
|
696
|
+
|
|
697
|
+
return {
|
|
698
|
+
avatar: _fromEntries(
|
|
699
|
+
AVATAR_COLORS.map((c) => [
|
|
700
|
+
c,
|
|
701
|
+
{
|
|
702
|
+
bg: renderColor(card.avatar[c].bg[i], {defaultHue: c}),
|
|
703
|
+
fg: renderColor(card.avatar[c].fg[i], {defaultHue: c}),
|
|
704
|
+
},
|
|
705
|
+
]),
|
|
706
|
+
),
|
|
707
|
+
backdrop: renderColor(card.backdrop[i], cardOptions),
|
|
708
|
+
code: {
|
|
709
|
+
bg: renderColor(card.code.bg[i], cardOptions),
|
|
710
|
+
fg: renderColor(card.code.fg[i], cardOptions),
|
|
711
|
+
token: {
|
|
712
|
+
atrule: renderColor(card.code.token.atrule[i], cardOptions),
|
|
713
|
+
attrName: renderColor(card.code.token.attrName[i], cardOptions),
|
|
714
|
+
attrValue: renderColor(card.code.token.attrValue[i], cardOptions),
|
|
715
|
+
attribute: renderColor(card.code.token.attribute[i], cardOptions),
|
|
716
|
+
boolean: renderColor(card.code.token.boolean[i], cardOptions),
|
|
717
|
+
builtin: renderColor(card.code.token.builtin[i], cardOptions),
|
|
718
|
+
cdata: renderColor(card.code.token.cdata[i], cardOptions),
|
|
719
|
+
char: renderColor(card.code.token.char[i], cardOptions),
|
|
720
|
+
class: renderColor(card.code.token.class[i], cardOptions),
|
|
721
|
+
className: renderColor(card.code.token.className[i], cardOptions),
|
|
722
|
+
comment: renderColor(card.code.token.comment[i], cardOptions),
|
|
723
|
+
constant: renderColor(card.code.token.constant[i], cardOptions),
|
|
724
|
+
deleted: renderColor(card.code.token.deleted[i], cardOptions),
|
|
725
|
+
doctype: renderColor(card.code.token.doctype[i], cardOptions),
|
|
726
|
+
entity: renderColor(card.code.token.entity[i], cardOptions),
|
|
727
|
+
function: renderColor(card.code.token.function[i], cardOptions),
|
|
728
|
+
hexcode: renderColor(card.code.token.hexcode[i], cardOptions),
|
|
729
|
+
id: renderColor(card.code.token.id[i], cardOptions),
|
|
730
|
+
important: renderColor(card.code.token.important[i], cardOptions),
|
|
731
|
+
inserted: renderColor(card.code.token.inserted[i], cardOptions),
|
|
732
|
+
keyword: renderColor(card.code.token.keyword[i], cardOptions),
|
|
733
|
+
number: renderColor(card.code.token.number[i], cardOptions),
|
|
734
|
+
operator: renderColor(card.code.token.operator[i], cardOptions),
|
|
735
|
+
prolog: renderColor(card.code.token.prolog[i], cardOptions),
|
|
736
|
+
property: renderColor(card.code.token.property[i], cardOptions),
|
|
737
|
+
pseudoClass: renderColor(card.code.token.pseudoClass[i], cardOptions),
|
|
738
|
+
pseudoElement: renderColor(card.code.token.pseudoElement[i], cardOptions),
|
|
739
|
+
punctuation: renderColor(card.code.token.punctuation[i], cardOptions),
|
|
740
|
+
regex: renderColor(card.code.token.regex[i], cardOptions),
|
|
741
|
+
selector: renderColor(card.code.token.selector[i], cardOptions),
|
|
742
|
+
string: renderColor(card.code.token.string[i], cardOptions),
|
|
743
|
+
symbol: renderColor(card.code.token.symbol[i], cardOptions),
|
|
744
|
+
tag: renderColor(card.code.token.tag[i], cardOptions),
|
|
745
|
+
unit: renderColor(card.code.token.unit[i], cardOptions),
|
|
746
|
+
url: renderColor(card.code.token.url[i], cardOptions),
|
|
747
|
+
variable: renderColor(card.code.token.variable[i], cardOptions),
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
focusRing: renderColor(card.focusRing[i], cardOptions),
|
|
751
|
+
link: {
|
|
752
|
+
fg: renderColor(card.link.fg[i], cardOptions),
|
|
753
|
+
},
|
|
754
|
+
shadow: {
|
|
755
|
+
outline: renderColor(card.shadow.outline[i], cardOptions),
|
|
756
|
+
umbra: renderColor(card.shadow.umbra[i], cardOptions),
|
|
757
|
+
penumbra: renderColor(card.shadow.penumbra[i], cardOptions),
|
|
758
|
+
ambient: renderColor(card.shadow.ambient[i], cardOptions),
|
|
759
|
+
},
|
|
760
|
+
skeleton: {
|
|
761
|
+
from: renderColor(card.skeleton.from[i], cardOptions),
|
|
762
|
+
to: renderColor(card.skeleton.to[i], cardOptions),
|
|
763
|
+
},
|
|
764
|
+
|
|
765
|
+
..._fromEntries(
|
|
766
|
+
COLOR_VARIANTS.map((v) => [
|
|
767
|
+
v,
|
|
768
|
+
_fromEntries(
|
|
769
|
+
THEME_COLOR_STATE_TONES.map((e) => [
|
|
770
|
+
e,
|
|
771
|
+
v === 'tinted' && e === 'default'
|
|
772
|
+
? defaultElement
|
|
773
|
+
: buildElementContract({
|
|
774
|
+
card,
|
|
775
|
+
variant: v,
|
|
776
|
+
tone: e,
|
|
777
|
+
scheme,
|
|
778
|
+
bgValue: defaultElement.bg[0],
|
|
779
|
+
}),
|
|
780
|
+
]),
|
|
781
|
+
),
|
|
782
|
+
]),
|
|
783
|
+
),
|
|
784
|
+
} as const
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function buildElementContract(options: {
|
|
788
|
+
bgValue?: string
|
|
789
|
+
card: ThemeColorCard_v3
|
|
790
|
+
variant: ThemeColorVariantKey
|
|
791
|
+
tone: ThemeColorStateToneKey
|
|
792
|
+
scheme: ThemeColorSchemeKey
|
|
793
|
+
}) {
|
|
794
|
+
const {bgValue, card, variant: v, tone: e, scheme} = options
|
|
795
|
+
const element = card.variant[v][e]
|
|
796
|
+
const elementOptions = {bgValue, defaultHue: element._hue}
|
|
797
|
+
const i = scheme === 'dark' ? 1 : 0
|
|
798
|
+
|
|
799
|
+
const bg = {
|
|
800
|
+
0: renderColor(element.bg[0][i], elementOptions),
|
|
801
|
+
4: renderColor(element.bg[4][i], elementOptions),
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const border = {
|
|
805
|
+
0: renderColor(element.border[0][i], elementOptions),
|
|
806
|
+
4: renderColor(element.border[4][i], elementOptions),
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
const fg = {
|
|
810
|
+
0: renderColor(element.fg[0][i], elementOptions),
|
|
811
|
+
4: renderColor(element.fg[4][i], elementOptions),
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return {
|
|
815
|
+
bg: {
|
|
816
|
+
0: bg[0],
|
|
817
|
+
1: `color-mix(in srgb, ${bg[0]}, ${bg[4]} 25%)`,
|
|
818
|
+
2: `color-mix(in srgb, ${bg[0]}, ${bg[4]} 50%)`,
|
|
819
|
+
3: `color-mix(in srgb, ${bg[0]}, ${bg[4]} 75%)`,
|
|
820
|
+
4: bg[4],
|
|
821
|
+
},
|
|
822
|
+
border: {
|
|
823
|
+
0: border[0],
|
|
824
|
+
1: `color-mix(in srgb, ${border[0]}, ${border[4]} 25%)`,
|
|
825
|
+
2: `color-mix(in srgb, ${border[0]}, ${border[4]} 50%)`,
|
|
826
|
+
3: `color-mix(in srgb, ${border[0]}, ${border[4]} 75%)`,
|
|
827
|
+
4: border[4],
|
|
828
|
+
},
|
|
829
|
+
fg: {
|
|
830
|
+
0: fg[0],
|
|
831
|
+
1: `color-mix(in srgb, ${fg[0]}, ${fg[4]} 25%)`,
|
|
832
|
+
2: `color-mix(in srgb, ${fg[0]}, ${fg[4]} 50%)`,
|
|
833
|
+
3: `color-mix(in srgb, ${fg[0]}, ${fg[4]} 75%)`,
|
|
834
|
+
4: fg[4],
|
|
835
|
+
},
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function px(value: number): string {
|
|
841
|
+
return `${value}px`
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function rem(value: number): string {
|
|
845
|
+
return `${value / 16}rem`
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function toBoxShadow(value: ThemeBoxShadow | undefined): string {
|
|
849
|
+
if (!value) return 'none'
|
|
850
|
+
|
|
851
|
+
return value.map((n) => px(n)).join(' ')
|
|
852
|
+
}
|