@sanity/ui 3.0.0-static.32 → 3.0.0-static.34
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/README.md +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +269 -378
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +270 -381
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -1
- package/dist/_visual-editing.cjs +0 -2
- package/dist/_visual-editing.cjs.map +1 -1
- package/dist/_visual-editing.d.cts +2 -894
- package/dist/_visual-editing.d.ts +2 -894
- package/dist/_visual-editing.js +2 -4
- package/dist/css/index.cjs +13 -13
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +805 -14697
- package/dist/css/index.d.ts +805 -14697
- package/dist/css/index.js +13 -13
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +242 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +990 -3085
- package/dist/index.d.ts +990 -3085
- package/dist/index.js +244 -361
- package/dist/index.js.map +1 -1
- package/dist/portalProvider-DgNIVviV.d.ts +575 -0
- package/dist/theme.cjs +367 -4288
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +272 -1806
- package/dist/theme.d.ts +272 -1806
- package/dist/theme.js +371 -4292
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +0 -2
- package/package.json +8 -9
- package/src/core/Root.tsx +6 -4
- package/src/core/RootProvider.tsx +4 -4
- package/src/core/__workshop__/boundary.tsx +1 -1
- package/src/core/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/example.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/mock/apiStore.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/mock/countries.ts +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +2 -2
- package/src/core/components/autocomplete/autocompleteOption.tsx +2 -2
- package/src/core/components/autocomplete/constants.ts +2 -2
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/__workshop__/index.ts +5 -3
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -11
- package/src/core/components/dialog/__workshop__/activate.tsx +1 -1
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +1 -1
- package/src/core/components/dialog/__workshop__/index.ts +5 -3
- package/src/core/components/dialog/__workshop__/layering.tsx +1 -1
- package/src/core/components/dialog/__workshop__/nested.tsx +2 -3
- package/src/core/components/dialog/__workshop__/onScroll.tsx +1 -1
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- 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__/provider.tsx +1 -1
- package/src/core/components/dialog/__workshop__/wrapped.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +5 -6
- package/src/core/components/dialog/dialogCard.tsx +2 -2
- package/src/core/components/dialog/dialogContext.ts +3 -4
- package/src/core/components/dialog/dialogProvider.tsx +2 -2
- package/src/core/components/hotkeys/__workshop__/index.ts +5 -3
- package/src/core/components/hotkeys/__workshop__/plain.tsx +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -15
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +3 -3
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -1
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +1 -1
- package/src/core/components/menu/__workshop__/index.ts +5 -3
- package/src/core/components/menu/__workshop__/menuButton.tsx +2 -2
- 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 +1 -1
- package/src/core/components/menu/__workshop__/selectedItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +3 -3
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +2 -1
- package/src/core/components/menu/menu.tsx +7 -22
- package/src/core/components/menu/menuButton.tsx +4 -50
- package/src/core/components/menu/menuContext.ts +3 -15
- package/src/core/components/menu/menuDivider.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +10 -15
- package/src/core/components/menu/menuItem.tsx +7 -18
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/__workshop__/index.ts +5 -3
- package/src/core/components/tab/tab.tsx +6 -4
- package/src/core/components/tab/tabList.tsx +3 -8
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/__workshop__/index.ts +5 -3
- package/src/core/components/toast/__workshop__/toast.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +2 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/toast/toastContext.ts +4 -4
- package/src/core/components/toast/toastLayer.tsx +3 -3
- 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__/index.ts +5 -3
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/tree.tsx +8 -9
- package/src/core/components/tree/treeContext.ts +4 -4
- package/src/core/components/tree/treeGroup.tsx +6 -8
- package/src/core/components/tree/treeItem.tsx +4 -4
- package/src/core/components/tree/types.ts +1 -1
- package/src/core/components/virtualList/__workshop__/changingProps.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/elementScroll.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/index.ts +5 -3
- package/src/core/components/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/windowScrolll.tsx +1 -1
- package/src/core/components/virtualList/virtualList.tsx +2 -2
- package/src/core/constants.ts +0 -18
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +5 -3
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +6 -1
- package/src/core/index.ts +1 -24
- package/src/core/lib/createGlobalScopedContext.ts +1 -1
- package/src/core/lib/globalScope.ts +1 -1
- package/src/core/observers/elementSize.ts +1 -1
- package/src/core/primitives/arrow/arrow.tsx +2 -2
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/index.ts +5 -3
- package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +3 -10
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -4
- package/src/core/primitives/avatar/types.ts +0 -32
- package/src/core/primitives/badge/__workshop__/index.ts +5 -3
- package/src/core/primitives/badge/__workshop__/props.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -1
- package/src/core/primitives/badge/badge.tsx +12 -11
- package/src/core/primitives/box/__workshop__/index.ts +5 -3
- package/src/core/primitives/box/__workshop__/props.tsx +1 -1
- package/src/core/primitives/box/__workshop__/responsive.tsx +1 -1
- package/src/core/primitives/box/box.tsx +28 -32
- package/src/core/primitives/button/__workshop__/custom.tsx +5 -5
- package/src/core/primitives/button/__workshop__/customIcons.tsx +1 -1
- package/src/core/primitives/button/__workshop__/disabled.tsx +3 -3
- package/src/core/primitives/button/__workshop__/index.ts +5 -3
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +1 -1
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +1 -1
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/core/primitives/button/button.test.tsx +2 -1
- package/src/core/primitives/button/button.tsx +4 -7
- package/src/core/primitives/button/types.ts +0 -20
- package/src/core/primitives/card/__workshop__/asButton.tsx +2 -2
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +3 -3
- package/src/core/primitives/card/__workshop__/index.ts +5 -3
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -1
- package/src/core/primitives/card/__workshop__/props.tsx +1 -1
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/card/card.tsx +4 -2
- package/src/core/primitives/card/cardContext.ts +1 -1
- package/src/core/primitives/card/cardProvider.tsx +4 -4
- package/src/core/primitives/card/types.ts +5 -19
- package/src/core/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/index.ts +5 -3
- package/src/core/primitives/checkbox/__workshop__/props.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/checkbox/checkbox.tsx +2 -2
- package/src/core/primitives/code/__workshop__/index.ts +5 -3
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/code/code.tsx +4 -2
- package/src/core/primitives/code/refractor.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/container/__workshop__/index.ts +5 -3
- package/src/core/primitives/container/container.tsx +2 -2
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/gap.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/index.ts +5 -3
- package/src/core/primitives/flex/flex.tsx +4 -2
- package/src/core/primitives/grid/__workshop__/index.ts +5 -3
- package/src/core/primitives/grid/__workshop__/responsive.tsx +3 -3
- package/src/core/primitives/grid/grid.tsx +4 -2
- package/src/core/primitives/heading/__workshop__/index.ts +5 -3
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -4
- package/src/core/primitives/inline/__workshop__/index.ts +5 -3
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +4 -11
- package/src/core/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/core/primitives/kbd/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +4 -2
- package/src/core/primitives/label/__workshop__/index.ts +5 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/label/label.tsx +2 -4
- package/src/core/primitives/layer/__workshop__/_debug.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/index.ts +5 -3
- package/src/core/primitives/layer/__workshop__/multipleRoots.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/nested.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/responsiveZOffset.tsx +1 -1
- package/src/core/primitives/layer/layer.test.tsx +2 -1
- package/src/core/primitives/layer/layer.tsx +2 -2
- package/src/core/primitives/layer/layerCard.tsx +2 -2
- package/src/core/primitives/layer/layerContext.ts +4 -4
- package/src/core/primitives/layer/layerProvider.tsx +2 -10
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/index.ts +5 -3
- package/src/core/primitives/popover/popover.tsx +34 -17
- package/src/core/primitives/popover/popoverLayer.tsx +2 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/__workshop__/index.ts +5 -3
- package/src/core/primitives/radio/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/select/__workshop__/index.ts +5 -3
- package/src/core/primitives/select/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +5 -15
- package/src/core/primitives/selectable/selectable.tsx +4 -4
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/primitives/skeleton/__workshop__/index.ts +5 -3
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/codeSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/headingSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/labelSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/textSkeleton.tsx +2 -2
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -1
- package/src/core/primitives/spinner/__workshop__/index.ts +5 -3
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +2 -2
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/srOnly/srOnly.tsx +2 -2
- package/src/core/primitives/stack/__workshop__/index.ts +5 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -10
- package/src/core/primitives/switch/__workshop__/example.tsx +1 -1
- package/src/core/primitives/switch/__workshop__/index.ts +5 -3
- package/src/core/primitives/switch/__workshop__/props.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +1 -1
- package/src/core/primitives/text/__workshop__/index.ts +5 -3
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +4 -4
- package/src/core/primitives/textArea/__workshop__/index.ts +5 -3
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textArea/textArea.tsx +5 -15
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +5 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/states.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/tones.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +6 -9
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/index.ts +5 -3
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +2 -4
- package/src/core/primitives/tooltip/tooltip.tsx +5 -9
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +4 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +5 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -2
- package/src/core/{types/props.ts → types.ts} +27 -0
- package/src/core/utils/boundaryElement/__workshop__/index.ts +5 -3
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +2 -1
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +7 -4
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/index.ts +5 -3
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/getElementRef.ts +1 -1
- package/src/core/utils/portal/__workshop__/index.ts +5 -3
- package/src/core/utils/portal/__workshop__/named.tsx +1 -1
- package/src/core/utils/portal/portal.test.tsx +2 -1
- package/src/core/utils/portal/portalContext.ts +5 -2
- package/src/core/utils/portal/portalProvider.tsx +5 -9
- package/src/css/_responsiveClassName.ts +2 -2
- package/src/css/_style.css.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.css.ts +1 -1
- package/src/css/components/dialog/dialog.css.ts +9 -17
- package/src/css/components/menu/menu.css.ts +2 -2
- package/src/css/components/menu/menu.ts +2 -2
- package/src/css/components/skeleton/skeleton.css.ts +2 -6
- package/src/css/components/toast/toast.css.ts +2 -2
- package/src/css/components/toast/toast.ts +2 -2
- package/src/css/components/tree/tree.css.ts +1 -1
- package/src/css/components/tree/tree.ts +1 -1
- package/src/css/defaultTheme.css.ts +59 -60
- package/src/css/layers.css.ts +4 -1
- package/src/css/primitives/_arrow/_arrow.css.ts +5 -5
- package/src/css/primitives/_input/_input.css.ts +4 -4
- package/src/css/primitives/_selectable/_selectable.css.ts +4 -4
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.css.ts +10 -10
- package/src/css/primitives/badge/badge.css.ts +4 -4
- package/src/css/primitives/badge/types.ts +8 -2
- package/src/css/primitives/box/box.css.ts +2 -2
- package/src/css/primitives/button/button.css.ts +6 -6
- package/src/css/primitives/button/button.ts +2 -2
- package/src/css/primitives/button/types.ts +3 -3
- package/src/css/primitives/card/__workshop__/color.tsx +9 -9
- package/src/css/primitives/card/__workshop__/index.ts +5 -3
- package/src/css/primitives/card/card.css.ts +12 -18
- package/src/css/primitives/card/types.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.css.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.css.ts +4 -3
- package/src/css/primitives/code/types.ts +3 -4
- package/src/css/primitives/container/container.css.ts +1 -1
- package/src/css/primitives/heading/heading.css.ts +5 -4
- package/src/css/primitives/heading/types.ts +3 -6
- package/src/css/primitives/kbd/kbd.css.ts +1 -1
- package/src/css/primitives/label/label.css.ts +5 -4
- package/src/css/primitives/label/types.ts +0 -8
- package/src/css/primitives/popover/popover.css.ts +2 -2
- package/src/css/primitives/popover/popover.ts +2 -2
- package/src/css/primitives/radio/radio.css.ts +3 -3
- package/src/css/primitives/radio/radio.ts +3 -3
- package/src/css/primitives/root/root.css.ts +2 -2
- package/src/css/primitives/root/root.ts +2 -2
- package/src/css/primitives/root/types.ts +3 -3
- package/src/css/primitives/select/select.css.ts +3 -3
- package/src/css/primitives/spinner/spinner.css.ts +2 -6
- package/src/css/primitives/spinner/spinner.ts +2 -2
- package/src/css/primitives/srOnly/srOnly.css.ts +1 -1
- package/src/css/primitives/srOnly/srOnly.ts +1 -1
- package/src/css/primitives/stack/stack.css.ts +1 -1
- package/src/css/primitives/stack/stack.ts +1 -1
- package/src/css/primitives/switch/switch.css.ts +5 -5
- package/src/css/primitives/text/text.css.ts +5 -4
- package/src/css/primitives/text/types.ts +3 -5
- package/src/css/primitives/textArea/textArea.css.ts +1 -1
- package/src/css/primitives/textInput/textInput.css.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.css.ts +1 -1
- package/src/css/props/alignItems/alignItems.ts +1 -1
- package/src/css/props/border/border.ts +1 -16
- package/src/css/props/boxSizing/boxSizing.css.ts +2 -1
- package/src/css/props/boxSizing/boxSizing.ts +0 -3
- package/src/css/props/display/display.ts +1 -10
- package/src/css/props/flex/flex.ts +1 -1
- package/src/css/props/flexDirection/flexDirection.ts +1 -1
- package/src/css/props/flexWrap/flexWrap.ts +1 -1
- package/src/css/props/font/font.css.ts +3 -2
- package/src/css/props/font/font.ts +1 -1
- package/src/css/props/gap/gap.ts +1 -1
- package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +2 -2
- package/src/css/props/gridAutoColumns/gridAutoColumns.ts +2 -2
- package/src/css/props/gridAutoColumns/types.ts +0 -10
- package/src/css/props/gridAutoFlow/gridAutoFlow.ts +2 -2
- package/src/css/props/gridAutoFlow/types.ts +0 -4
- package/src/css/props/gridAutoRows/gridAutoRows.ts +2 -2
- package/src/css/props/gridAutoRows/types.ts +0 -4
- package/src/css/props/gridColumn/gridColumn.ts +3 -3
- package/src/css/props/gridColumn/types.ts +0 -10
- package/src/css/props/gridColumnEnd/gridColumnEnd.ts +3 -3
- package/src/css/props/gridColumnEnd/types.ts +0 -10
- package/src/css/props/gridColumnStart/gridColumnStart.ts +3 -6
- package/src/css/props/gridColumnStart/types.ts +0 -10
- package/src/css/props/gridRow/gridRow.ts +3 -3
- package/src/css/props/gridRow/types.ts +0 -10
- package/src/css/props/gridRowEnd/gridRowEnd.ts +3 -3
- package/src/css/props/gridRowEnd/types.ts +0 -10
- package/src/css/props/gridRowStart/gridRowStart.ts +3 -3
- package/src/css/props/gridRowStart/types.ts +0 -10
- package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +2 -2
- package/src/css/props/gridTemplateColumns/types.ts +0 -10
- package/src/css/props/gridTemplateRows/gridTemplateRows.ts +2 -2
- package/src/css/props/gridTemplateRows/types.ts +0 -10
- package/src/css/props/height/height.ts +1 -1
- package/src/css/props/height/types.ts +0 -6
- package/src/css/props/inset/inset.ts +1 -1
- package/src/css/props/justifyContent/justifyContent.ts +1 -1
- package/src/css/props/margin/margin.ts +1 -1
- package/src/css/props/maxWidth/maxWidth.ts +1 -1
- package/src/css/props/minHeight/minHeight.ts +1 -1
- package/src/css/props/minWidth/minWidth.ts +1 -1
- package/src/css/props/outline/outline.ts +1 -1
- package/src/css/props/overflow/overflow.ts +1 -1
- package/src/css/props/overflow/types.ts +0 -6
- package/src/css/props/padding/padding.ts +1 -1
- package/src/css/props/pointerEvents/pointerEvents.ts +1 -1
- package/src/css/props/position/position.ts +1 -1
- package/src/css/props/radius/radius.ts +1 -1
- package/src/css/props/shadow/shadow.ts +1 -1
- package/src/css/props/textAlign/textAlign.ts +1 -1
- package/src/css/props/textOverflow/textOverflow.ts +1 -1
- package/src/css/props/width/width.ts +1 -1
- package/src/css/types.ts +225 -53
- package/src/css/util.ts +2 -2
- package/src/css/vars.css.ts +33 -36
- package/src/theme/{v3/_parseColorToken.ts → _parseColorToken.ts} +2 -2
- package/src/theme/buildTheme.ts +33 -0
- package/src/theme/constants.ts +90 -0
- package/src/theme/defaults/color.ts +197 -0
- package/src/theme/{v2/defaults/config.ts → defaults/common.ts} +3 -16
- package/src/theme/{v3/defaultFonts.ts → defaults/fonts.ts} +2 -2
- package/src/theme/index.ts +4 -5
- package/src/theme/{v3/resolveTokens.ts → resolveTokens.ts} +15 -15
- package/src/theme/types.ts +355 -15
- package/dist/css/layers.css +0 -4
- package/dist/css/primitives/popover/popover.css +0 -4
- package/src/core/__DEV__.ts +0 -5
- package/src/core/_compat/helpers.ts +0 -72
- package/src/core/_compat/styles/_responsive.ts +0 -19
- package/src/core/_compat/theme/theme.test.tsx +0 -73
- package/src/core/_compat/theme/themeColorProvider.tsx +0 -24
- package/src/core/_compat/theme/themeContext.ts +0 -10
- package/src/core/_compat/theme/themeProvider.tsx +0 -68
- package/src/core/_compat/theme/types.ts +0 -10
- package/src/core/_compat/theme/useRootTheme.ts +0 -15
- package/src/core/_compat/theme/useTheme.ts +0 -12
- package/src/core/_compat/types.ts +0 -191
- package/src/core/hooks/useArrayProp.ts +0 -26
- package/src/core/hooks/useClickOutside.test.tsx +0 -481
- package/src/core/hooks/useClickOutside.ts +0 -113
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -30
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useIsomorphicEffect.ts +0 -7
- package/src/core/primitives/badge/types.ts +0 -18
- package/src/core/primitives/box/types.ts +0 -22
- package/src/core/primitives/flex/types.ts +0 -27
- package/src/core/primitives/grid/types.ts +0 -17
- package/src/core/primitives/selectable/types.ts +0 -7
- package/src/core/primitives/types.ts +0 -153
- package/src/core/types/gridItem.ts +0 -32
- package/src/core/types/placement.ts +0 -18
- package/src/core/types/radius.ts +0 -7
- package/src/core/types/textAlign.ts +0 -7
- package/src/core/utils/spanWithTextOverflow.tsx +0 -10
- package/src/theme/getScopedTheme.ts +0 -88
- package/src/theme/v0/avatar.ts +0 -10
- package/src/theme/v0/color/_generic.ts +0 -35
- package/src/theme/v0/color/_system.ts +0 -17
- package/src/theme/v0/color/base.ts +0 -21
- package/src/theme/v0/color/button.ts +0 -42
- package/src/theme/v0/color/card.ts +0 -19
- package/src/theme/v0/color/color.ts +0 -40
- package/src/theme/v0/color/index.ts +0 -11
- package/src/theme/v0/color/input.ts +0 -34
- package/src/theme/v0/color/muted.ts +0 -26
- package/src/theme/v0/color/selectable.ts +0 -31
- package/src/theme/v0/color/solid.ts +0 -26
- package/src/theme/v0/color/spot.ts +0 -13
- package/src/theme/v0/css.ts +0 -10
- package/src/theme/v0/focusRing.ts +0 -5
- package/src/theme/v0/font.ts +0 -40
- package/src/theme/v0/index.ts +0 -10
- package/src/theme/v0/input.ts +0 -23
- package/src/theme/v0/layer.ts +0 -6
- package/src/theme/v0/shadow.ts +0 -15
- package/src/theme/v0/styles.ts +0 -13
- package/src/theme/v0/theme.ts +0 -72
- package/src/theme/v2/avatar.ts +0 -12
- package/src/theme/v2/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/v2/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/button/createButtonModes.ts +0 -22
- package/src/theme/v2/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/v2/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/v2/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/v2/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/v2/build/_deprecated/color/factory.ts +0 -141
- package/src/theme/v2/build/_deprecated/color/index.ts +0 -1
- package/src/theme/v2/build/_deprecated/color/input/createInputModes.ts +0 -86
- package/src/theme/v2/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/v2/build/buildColorTheme.test.ts +0 -185
- package/src/theme/v2/build/buildColorTheme.ts +0 -494
- package/src/theme/v2/build/buildTheme.test.ts +0 -89
- package/src/theme/v2/build/buildTheme.ts +0 -37
- package/src/theme/v2/build/colorToken/colorToken.ts +0 -19
- package/src/theme/v2/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/v2/build/colorToken/index.ts +0 -2
- package/src/theme/v2/build/colorToken/types.ts +0 -6
- package/src/theme/v2/build/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/v2/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/v2/build/lib/color-fns/contrastRatio.ts +0 -34
- package/src/theme/v2/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/v2/build/lib/color-fns/index.ts +0 -6
- package/src/theme/v2/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/v2/build/lib/color-fns/rgba.ts +0 -14
- package/src/theme/v2/build/lib/color-fns/types.ts +0 -28
- package/src/theme/v2/build/lib/isRecord.ts +0 -3
- package/src/theme/v2/build/lib/utils.ts +0 -19
- package/src/theme/v2/build/merge.ts +0 -28
- package/src/theme/v2/build/mixThemeColor.test.ts +0 -23
- package/src/theme/v2/build/mixThemeColor.ts +0 -53
- package/src/theme/v2/build/renderColorTheme.ts +0 -532
- package/src/theme/v2/build/renderColorValue.ts +0 -85
- package/src/theme/v2/build/resolveColorTokens.ts +0 -268
- package/src/theme/v2/color/_constants.ts +0 -45
- package/src/theme/v2/color/_helpers.ts +0 -24
- package/src/theme/v2/color/_system.ts +0 -38
- package/src/theme/v2/color/avatar.ts +0 -11
- package/src/theme/v2/color/badge.ts +0 -12
- package/src/theme/v2/color/button.ts +0 -11
- package/src/theme/v2/color/color.ts +0 -28
- package/src/theme/v2/color/index.ts +0 -13
- package/src/theme/v2/color/input.ts +0 -23
- package/src/theme/v2/color/kbd.ts +0 -6
- package/src/theme/v2/color/selectable.ts +0 -8
- package/src/theme/v2/color/shadow.ts +0 -7
- package/src/theme/v2/color/state.ts +0 -41
- package/src/theme/v2/color/syntax.ts +0 -39
- package/src/theme/v2/config/helpers.ts +0 -48
- package/src/theme/v2/config/index.ts +0 -4
- package/src/theme/v2/config/system.ts +0 -114
- package/src/theme/v2/config/tokens/color/index.ts +0 -1
- package/src/theme/v2/config/tokens/color/types.ts +0 -137
- package/src/theme/v2/config/tokens/index.ts +0 -3
- package/src/theme/v2/config/tokens/parseTokenValue.test.ts +0 -44
- package/src/theme/v2/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/v2/config/tokens/types.ts +0 -53
- package/src/theme/v2/config/types.ts +0 -47
- package/src/theme/v2/defaults/colorPalette.ts +0 -5
- package/src/theme/v2/defaults/colorTokens.ts +0 -648
- package/src/theme/v2/defaults/fonts.ts +0 -227
- package/src/theme/v2/index.ts +0 -6
- package/src/theme/v2/input.ts +0 -31
- package/src/theme/v2/theme.ts +0 -45
- package/src/theme/v3/_constants.ts +0 -29
- package/src/theme/v3/buildTheme_v3.ts +0 -39
- package/src/theme/v3/color/_constants.ts +0 -15
- package/src/theme/v3/color/avatar.ts +0 -14
- package/src/theme/v3/color/card.ts +0 -79
- package/src/theme/v3/color/color.ts +0 -98
- package/src/theme/v3/color/element.ts +0 -19
- package/src/theme/v3/color/index.ts +0 -7
- package/src/theme/v3/color/token.ts +0 -32
- package/src/theme/v3/color/tokens.ts +0 -5
- package/src/theme/v3/defaultTokens.ts +0 -199
- package/src/theme/v3/index.ts +0 -9
- package/src/theme/v3/palette/constants.ts +0 -15
- package/src/theme/v3/palette/index.ts +0 -2
- package/src/theme/v3/palette/types.ts +0 -7
- package/src/theme/v3/tokens.ts +0 -16
- package/src/theme/v3/types.ts +0 -133
- package/src/theme/versioning/getTheme_v2.ts +0 -58
- package/src/theme/versioning/index.ts +0 -1
- package/src/theme/versioning/is_v0.ts +0 -7
- package/src/theme/versioning/is_v2.ts +0 -7
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -245
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/themeColor_v3_v2.ts +0 -383
- package/src/theme/versioning/v0_v2.ts +0 -95
- package/src/theme/versioning/v2_v0.ts +0 -127
- package/src/theme/versioning/v3_v2.ts +0 -130
- /package/src/theme/{v3/merge.ts → merge.ts} +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import type {ColorTokens, PartialTokens} from '../types'
|
|
2
|
+
|
|
3
|
+
/** @internal */
|
|
4
|
+
export const defaultColor: PartialTokens<ColorTokens> = {
|
|
5
|
+
'*': {
|
|
6
|
+
backdrop: ['gray-100/0.5', 'black/0.5'],
|
|
7
|
+
code: {
|
|
8
|
+
bg: ['50', '950'],
|
|
9
|
+
fg: ['700', '300'],
|
|
10
|
+
token: {
|
|
11
|
+
atrule: ['purple-600', 'purple-400'],
|
|
12
|
+
attrName: ['green-600', 'green-400'],
|
|
13
|
+
attrValue: ['yellow-600', 'yellow-400'],
|
|
14
|
+
attribute: ['yellow-600', 'yellow-400'],
|
|
15
|
+
boolean: ['purple-600', 'purple-400'],
|
|
16
|
+
builtin: ['purple-600', 'purple-400'],
|
|
17
|
+
cdata: ['yellow-600', 'yellow-400'],
|
|
18
|
+
char: ['yellow-600', 'yellow-400'],
|
|
19
|
+
class: ['orange-600', 'orange-400'],
|
|
20
|
+
className: ['cyan-600', 'cyan-400'],
|
|
21
|
+
comment: ['gray-400', 'gray-600'],
|
|
22
|
+
constant: ['purple-600', 'purple-400'],
|
|
23
|
+
deleted: ['red-600', 'red-400'],
|
|
24
|
+
entity: ['red-600', 'red-400'],
|
|
25
|
+
function: ['green-600', 'green-400'],
|
|
26
|
+
hexcode: ['blue-600', 'blue-400'],
|
|
27
|
+
id: ['purple-600', 'purple-400'],
|
|
28
|
+
important: ['purple-600', 'purple-400'],
|
|
29
|
+
inserted: ['green-600', 'green-400'],
|
|
30
|
+
keyword: ['magenta-600', 'magenta-400'],
|
|
31
|
+
number: ['purple-600', 'purple-400'],
|
|
32
|
+
operator: ['magenta-600', 'magenta-400'],
|
|
33
|
+
prolog: ['gray-600', 'gray-400'],
|
|
34
|
+
property: ['blue-600', 'blue-400'],
|
|
35
|
+
pseudoClass: ['yellow-600', 'yellow-400'],
|
|
36
|
+
pseudoElement: ['yellow-600', 'yellow-400'],
|
|
37
|
+
punctuation: ['gray-600', 'gray-400'],
|
|
38
|
+
regex: ['blue-600', 'blue-400'],
|
|
39
|
+
selector: ['red-600', 'red-400'],
|
|
40
|
+
string: ['yellow-600', 'yellow-400'],
|
|
41
|
+
symbol: ['purple-600', 'purple-400'],
|
|
42
|
+
tag: ['red-600', 'red-400'],
|
|
43
|
+
unit: ['orange-600', 'orange-400'],
|
|
44
|
+
url: ['red-600', 'red-400'],
|
|
45
|
+
variable: ['red-600', 'red-400'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
focusRing: ['blue-500', 'blue-500'],
|
|
49
|
+
link: {
|
|
50
|
+
fg: ['blue-600', 'blue-400'],
|
|
51
|
+
},
|
|
52
|
+
shadow: {
|
|
53
|
+
outline: ['600/0.3', '500/0.4'],
|
|
54
|
+
umbra: ['600/0.1', 'black/0.2'],
|
|
55
|
+
penumbra: ['600/0.07', 'black/0.14'],
|
|
56
|
+
ambient: ['600/0.06', 'black/0.12'],
|
|
57
|
+
},
|
|
58
|
+
skeleton: {
|
|
59
|
+
from: ['200 70%', '800 35%'],
|
|
60
|
+
to: ['200 40%', '800 50%'],
|
|
61
|
+
},
|
|
62
|
+
variant: {
|
|
63
|
+
tinted: {
|
|
64
|
+
'*': {
|
|
65
|
+
bg: {
|
|
66
|
+
0: ['100 75%', '900 75%'],
|
|
67
|
+
4: ['300', '700'],
|
|
68
|
+
},
|
|
69
|
+
border: {
|
|
70
|
+
0: ['200', '700 50%'],
|
|
71
|
+
4: ['300 75%', '500'],
|
|
72
|
+
},
|
|
73
|
+
fg: {
|
|
74
|
+
0: ['900', '100'],
|
|
75
|
+
4: ['700', '300'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
'primary': {
|
|
79
|
+
_hue: 'blue',
|
|
80
|
+
bg: {0: ['inherit', 'inherit']},
|
|
81
|
+
},
|
|
82
|
+
'suggest': {
|
|
83
|
+
_hue: 'purple',
|
|
84
|
+
bg: {0: ['inherit', 'inherit']},
|
|
85
|
+
},
|
|
86
|
+
'positive': {
|
|
87
|
+
_hue: 'green',
|
|
88
|
+
bg: {0: ['inherit', 'inherit']},
|
|
89
|
+
},
|
|
90
|
+
'caution': {
|
|
91
|
+
_hue: 'yellow',
|
|
92
|
+
bg: {0: ['inherit', 'inherit']},
|
|
93
|
+
},
|
|
94
|
+
'critical': {
|
|
95
|
+
_hue: 'red',
|
|
96
|
+
bg: {0: ['inherit', 'inherit']},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
solid: {
|
|
100
|
+
'*': {
|
|
101
|
+
bg: {
|
|
102
|
+
0: ['500', '400'],
|
|
103
|
+
4: ['600', '300'],
|
|
104
|
+
},
|
|
105
|
+
border: {
|
|
106
|
+
0: ['400', '200'],
|
|
107
|
+
4: ['500', '100'],
|
|
108
|
+
},
|
|
109
|
+
fg: {
|
|
110
|
+
0: ['white', 'black'],
|
|
111
|
+
4: ['200', '700'],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
'default': {
|
|
115
|
+
bg: {
|
|
116
|
+
0: ['800', '200'],
|
|
117
|
+
4: ['black', 'white'],
|
|
118
|
+
},
|
|
119
|
+
border: {
|
|
120
|
+
0: ['700', '300'],
|
|
121
|
+
4: ['800', '200'],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
'primary': {
|
|
125
|
+
_hue: 'blue',
|
|
126
|
+
},
|
|
127
|
+
'suggest': {
|
|
128
|
+
_hue: 'purple',
|
|
129
|
+
},
|
|
130
|
+
'positive': {
|
|
131
|
+
_hue: 'green',
|
|
132
|
+
},
|
|
133
|
+
'caution': {
|
|
134
|
+
_hue: 'yellow',
|
|
135
|
+
},
|
|
136
|
+
'critical': {
|
|
137
|
+
_hue: 'red',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
'transparent': {
|
|
143
|
+
variant: {
|
|
144
|
+
tinted: {
|
|
145
|
+
'*': {
|
|
146
|
+
bg: {
|
|
147
|
+
0: ['gray-50', 'black'],
|
|
148
|
+
4: ['300 75%', '700 75%'],
|
|
149
|
+
},
|
|
150
|
+
border: {
|
|
151
|
+
0: ['200', '800 75%'],
|
|
152
|
+
4: ['400', '700'],
|
|
153
|
+
},
|
|
154
|
+
fg: {
|
|
155
|
+
0: ['black', '100'],
|
|
156
|
+
4: ['700', '400'],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
'default': {
|
|
163
|
+
variant: {
|
|
164
|
+
tinted: {
|
|
165
|
+
'*': {
|
|
166
|
+
bg: {
|
|
167
|
+
0: ['white', '950'],
|
|
168
|
+
4: ['300 75%', '700'],
|
|
169
|
+
},
|
|
170
|
+
border: {
|
|
171
|
+
0: ['200', '800 75%'],
|
|
172
|
+
4: ['400', '700'],
|
|
173
|
+
},
|
|
174
|
+
fg: {
|
|
175
|
+
0: ['black', 'white'],
|
|
176
|
+
4: ['600', '400'],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
'primary': {
|
|
183
|
+
_hue: 'blue',
|
|
184
|
+
},
|
|
185
|
+
'suggest': {
|
|
186
|
+
_hue: 'purple',
|
|
187
|
+
},
|
|
188
|
+
'positive': {
|
|
189
|
+
_hue: 'green',
|
|
190
|
+
},
|
|
191
|
+
'caution': {
|
|
192
|
+
_hue: 'yellow',
|
|
193
|
+
},
|
|
194
|
+
'critical': {
|
|
195
|
+
_hue: 'red',
|
|
196
|
+
},
|
|
197
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Theme} from '../types'
|
|
2
2
|
|
|
3
3
|
const BORDER_WIDTH = 1
|
|
4
4
|
const OUTLINE_WIDTH = 0.5
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
_version: 2,
|
|
6
|
+
export const defaultTheme: Omit<Theme, '_version' | '_tokens' | 'color' | 'font' | 'palette'> = {
|
|
8
7
|
avatar: {
|
|
9
8
|
sizes: [
|
|
10
9
|
{distance: -4, size: 19},
|
|
@@ -33,7 +32,7 @@ export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
|
|
|
33
32
|
},
|
|
34
33
|
radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
|
|
35
34
|
shadow: [
|
|
36
|
-
|
|
35
|
+
undefined,
|
|
37
36
|
{umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0]},
|
|
38
37
|
{umbra: [0, 3, 5, -2], penumbra: [0, 6, 10, 0], ambient: [0, 1, 18, 1]},
|
|
39
38
|
{umbra: [0, 7, 8, -4], penumbra: [0, 12, 17, 2], ambient: [0, 5, 22, 4]},
|
|
@@ -69,16 +68,4 @@ export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
|
|
|
69
68
|
focusRing: {offset: -1, width: 1},
|
|
70
69
|
},
|
|
71
70
|
},
|
|
72
|
-
style: {
|
|
73
|
-
button: {
|
|
74
|
-
root: {
|
|
75
|
-
transition: 'background-color 100ms,border-color 100ms,color 100ms',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
// card: {
|
|
79
|
-
// root: {
|
|
80
|
-
// transition: 'background-color 100ms,border-color 100ms,color 100ms',
|
|
81
|
-
// },
|
|
82
|
-
// },
|
|
83
|
-
},
|
|
84
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Fonts} from '../types'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const defaultFonts: Fonts = {
|
|
4
4
|
code: {
|
|
5
5
|
family: 'ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace',
|
|
6
6
|
weight: {
|
package/src/theme/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './_parseColorToken'
|
|
2
|
+
export * from './buildTheme'
|
|
3
|
+
export * from './constants'
|
|
4
|
+
export * from './resolveTokens'
|
|
2
5
|
export * from './types'
|
|
3
|
-
export * from './v0'
|
|
4
|
-
export * from './v2'
|
|
5
|
-
export * from './v3'
|
|
6
|
-
export * from './versioning'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
THEME_COLOR_CARD_TONES,
|
|
3
|
-
THEME_COLOR_STATE_TONES,
|
|
4
|
-
type ThemeColorCardToneKey,
|
|
5
|
-
type ThemeColorStateToneKey,
|
|
6
|
-
} from '../v2'
|
|
7
|
-
import type {CardColorTokens} from './color/card'
|
|
8
|
-
import type {ElementColorTokens} from './color/element'
|
|
1
|
+
import {CARD_TONES, ELEMENT_TONES} from './constants'
|
|
9
2
|
import {merge} from './merge'
|
|
10
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
CardColorTokens,
|
|
5
|
+
CardTone,
|
|
6
|
+
ElementColorTokens,
|
|
7
|
+
ElementTone,
|
|
8
|
+
PartialTokens,
|
|
9
|
+
Tokens,
|
|
10
|
+
} from './types'
|
|
11
11
|
|
|
12
12
|
const defaultElementTokens: ElementColorTokens = {
|
|
13
13
|
_hue: 'gray',
|
|
@@ -31,14 +31,14 @@ export function resolveTokens(tokens: PartialTokens<Tokens> = {}): Tokens {
|
|
|
31
31
|
color: {
|
|
32
32
|
'*': resolveCardColorTokens(tokens.color?.['*']),
|
|
33
33
|
|
|
34
|
-
...
|
|
34
|
+
...CARD_TONES.reduce(
|
|
35
35
|
(acc, tone) => {
|
|
36
36
|
return {
|
|
37
37
|
...acc,
|
|
38
38
|
[tone]: resolveCardColorTokens(merge(tokens.color?.['*'], tokens.color?.[tone])),
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
|
-
{} as Record<
|
|
41
|
+
{} as Record<CardTone, CardColorTokens>,
|
|
42
42
|
),
|
|
43
43
|
},
|
|
44
44
|
}
|
|
@@ -157,7 +157,7 @@ function resolveCardColorTokens(
|
|
|
157
157
|
variant: {
|
|
158
158
|
solid: {
|
|
159
159
|
'*': resolveElementTokens(tokens?.variant?.solid?.['*']),
|
|
160
|
-
...
|
|
160
|
+
...ELEMENT_TONES.reduce(
|
|
161
161
|
(acc, tone) => {
|
|
162
162
|
acc[tone] = resolveElementTokens(
|
|
163
163
|
merge(tokens, tokens?.variant?.solid?.['*'], tokens?.variant?.solid?.[tone]),
|
|
@@ -165,12 +165,12 @@ function resolveCardColorTokens(
|
|
|
165
165
|
|
|
166
166
|
return acc
|
|
167
167
|
},
|
|
168
|
-
{} as Record<
|
|
168
|
+
{} as Record<ElementTone, ElementColorTokens>,
|
|
169
169
|
),
|
|
170
170
|
},
|
|
171
171
|
tinted: {
|
|
172
172
|
'*': resolveElementTokens(tokens?.variant?.tinted?.['*']),
|
|
173
|
-
...
|
|
173
|
+
...ELEMENT_TONES.reduce(
|
|
174
174
|
(acc, tone) => {
|
|
175
175
|
acc[tone] = resolveElementTokens(
|
|
176
176
|
merge(tokens, tokens?.variant?.tinted?.['*'], tokens?.variant?.tinted?.[tone]),
|
|
@@ -178,7 +178,7 @@ function resolveCardColorTokens(
|
|
|
178
178
|
|
|
179
179
|
return acc
|
|
180
180
|
},
|
|
181
|
-
{} as Record<
|
|
181
|
+
{} as Record<ElementTone, ElementColorTokens>,
|
|
182
182
|
),
|
|
183
183
|
},
|
|
184
184
|
},
|
package/src/theme/types.ts
CHANGED
|
@@ -1,28 +1,368 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
|
|
1
|
+
import type {ColorHues, ColorTint} from '@sanity/color'
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AVATAR_COLORS,
|
|
5
|
+
AVATAR_SIZE,
|
|
6
|
+
BUTTON_MODES,
|
|
7
|
+
CARD_TONES,
|
|
8
|
+
COLOR_SCHEMES,
|
|
9
|
+
COLOR_VARIANTS,
|
|
10
|
+
CONTAINER,
|
|
11
|
+
CONTAINER_SCALE,
|
|
12
|
+
ELEMENT_TONES,
|
|
13
|
+
FONT_CODE_SIZE,
|
|
14
|
+
FONT_HEADING_SIZE,
|
|
15
|
+
FONT_LABEL_SIZE,
|
|
16
|
+
FONT_TEXT_SIZE,
|
|
17
|
+
HUES,
|
|
18
|
+
RADIUS,
|
|
19
|
+
SHADOW,
|
|
20
|
+
SPACE,
|
|
21
|
+
TINTS,
|
|
22
|
+
} from './constants'
|
|
23
|
+
|
|
24
|
+
/** @public */
|
|
25
|
+
export type Hue = (typeof HUES)[number]
|
|
26
|
+
|
|
27
|
+
/** @public */
|
|
28
|
+
export type Tint = (typeof TINTS)[number]
|
|
29
|
+
|
|
30
|
+
/** @public */
|
|
31
|
+
export type AvatarColor = (typeof AVATAR_COLORS)[number]
|
|
5
32
|
|
|
6
33
|
/** @public */
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
34
|
+
export type ColorTokenOpacityValue = `0` | `0.${number}` | `1`
|
|
35
|
+
|
|
36
|
+
/** @public */
|
|
37
|
+
export type ColorToken =
|
|
38
|
+
| `inherit`
|
|
39
|
+
| `black`
|
|
40
|
+
| `black/${ColorTokenOpacityValue}`
|
|
41
|
+
| `white`
|
|
42
|
+
| `white/${ColorTokenOpacityValue}`
|
|
43
|
+
| `${Hue}-${Tint}`
|
|
44
|
+
| `${Hue}-${Tint}/${ColorTokenOpacityValue}`
|
|
45
|
+
| `${Hue}-${Tint} ${number}%`
|
|
46
|
+
| `${Tint}`
|
|
47
|
+
| `${Tint}/${ColorTokenOpacityValue}`
|
|
48
|
+
| `${Tint} ${number}%`
|
|
49
|
+
|
|
50
|
+
/** @public */
|
|
51
|
+
export interface ResolvedColorToken {
|
|
52
|
+
color: {type: 'inherit'} | {type: 'black' | 'white'} | {type: 'hue'; hue: Hue; tint: Tint}
|
|
53
|
+
opacity: number
|
|
54
|
+
mix: number
|
|
10
55
|
}
|
|
11
56
|
|
|
12
57
|
/** @public */
|
|
13
|
-
export type
|
|
58
|
+
export type ColorTokens = Record<'*' | CardTone, CardColorTokens>
|
|
59
|
+
|
|
60
|
+
/** @public */
|
|
61
|
+
export interface Tokens {
|
|
62
|
+
color: ColorTokens
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** @public */
|
|
66
|
+
export type PartialTokens<T> = T extends [ColorToken, ColorToken]
|
|
67
|
+
? T
|
|
68
|
+
: T extends {} // eslint-disable-line @typescript-eslint/no-empty-object-type
|
|
69
|
+
? {
|
|
70
|
+
[P in keyof T]?: PartialTokens<T[P]>
|
|
71
|
+
}
|
|
72
|
+
: T
|
|
14
73
|
|
|
15
74
|
/**
|
|
16
|
-
*
|
|
75
|
+
* Theme color values are tuples of [light, dark] color tokens.
|
|
17
76
|
*
|
|
18
77
|
* @public
|
|
19
78
|
*/
|
|
79
|
+
export type ColorValue = [ColorToken, ColorToken]
|
|
80
|
+
|
|
81
|
+
/** @public */
|
|
82
|
+
export interface AvatarColorProperties {
|
|
83
|
+
_hue: Hue
|
|
84
|
+
bg: ColorValue
|
|
85
|
+
fg: ColorValue
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @public */
|
|
89
|
+
export type AvatarsColor = Record<AvatarColor, AvatarColorProperties>
|
|
90
|
+
|
|
91
|
+
/** @public */
|
|
92
|
+
export interface ElementColorTokens {
|
|
93
|
+
_hue: Hue
|
|
94
|
+
bg: {
|
|
95
|
+
0: ColorValue
|
|
96
|
+
4: ColorValue
|
|
97
|
+
}
|
|
98
|
+
border: {
|
|
99
|
+
0: ColorValue
|
|
100
|
+
4: ColorValue
|
|
101
|
+
}
|
|
102
|
+
fg: {
|
|
103
|
+
0: ColorValue
|
|
104
|
+
4: ColorValue
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @public */
|
|
109
|
+
export type ElementsColorTokens = Record<'*' | ElementTone, ElementColorTokens>
|
|
110
|
+
|
|
111
|
+
/** @public */
|
|
112
|
+
export type ColorVariant = (typeof COLOR_VARIANTS)[number]
|
|
113
|
+
|
|
114
|
+
/** @public */
|
|
115
|
+
export interface CardColorTokens {
|
|
116
|
+
_hue: Hue
|
|
117
|
+
avatar: AvatarsColor
|
|
118
|
+
backdrop: ColorValue
|
|
119
|
+
code: {
|
|
120
|
+
bg: ColorValue
|
|
121
|
+
fg: ColorValue
|
|
122
|
+
token: {
|
|
123
|
+
atrule: ColorValue
|
|
124
|
+
attrName: ColorValue
|
|
125
|
+
attrValue: ColorValue
|
|
126
|
+
attribute: ColorValue
|
|
127
|
+
boolean: ColorValue
|
|
128
|
+
builtin: ColorValue
|
|
129
|
+
cdata: ColorValue
|
|
130
|
+
char: ColorValue
|
|
131
|
+
class: ColorValue
|
|
132
|
+
className: ColorValue
|
|
133
|
+
comment: ColorValue
|
|
134
|
+
constant: ColorValue
|
|
135
|
+
deleted: ColorValue
|
|
136
|
+
doctype: ColorValue
|
|
137
|
+
entity: ColorValue
|
|
138
|
+
function: ColorValue
|
|
139
|
+
hexcode: ColorValue
|
|
140
|
+
id: ColorValue
|
|
141
|
+
important: ColorValue
|
|
142
|
+
inserted: ColorValue
|
|
143
|
+
keyword: ColorValue
|
|
144
|
+
number: ColorValue
|
|
145
|
+
operator: ColorValue
|
|
146
|
+
prolog: ColorValue
|
|
147
|
+
property: ColorValue
|
|
148
|
+
pseudoClass: ColorValue
|
|
149
|
+
pseudoElement: ColorValue
|
|
150
|
+
punctuation: ColorValue
|
|
151
|
+
regex: ColorValue
|
|
152
|
+
selector: ColorValue
|
|
153
|
+
string: ColorValue
|
|
154
|
+
symbol: ColorValue
|
|
155
|
+
tag: ColorValue
|
|
156
|
+
unit: ColorValue
|
|
157
|
+
url: ColorValue
|
|
158
|
+
variable: ColorValue
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
focusRing: ColorValue
|
|
162
|
+
link: {
|
|
163
|
+
fg: ColorValue
|
|
164
|
+
}
|
|
165
|
+
shadow: {
|
|
166
|
+
outline: ColorValue
|
|
167
|
+
umbra: ColorValue
|
|
168
|
+
penumbra: ColorValue
|
|
169
|
+
ambient: ColorValue
|
|
170
|
+
}
|
|
171
|
+
skeleton: {
|
|
172
|
+
from: ColorValue
|
|
173
|
+
to: ColorValue
|
|
174
|
+
}
|
|
175
|
+
variant: Record<ColorVariant, ElementsColorTokens>
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** @public */
|
|
179
|
+
export type Color = Record<CardTone, CardColorTokens>
|
|
180
|
+
|
|
181
|
+
/** @public */
|
|
182
|
+
export interface Input {
|
|
183
|
+
checkbox: {
|
|
184
|
+
size: number
|
|
185
|
+
focusRing: FocusRing
|
|
186
|
+
}
|
|
187
|
+
radio: {
|
|
188
|
+
size: number
|
|
189
|
+
markSize: number
|
|
190
|
+
focusRing: FocusRing
|
|
191
|
+
}
|
|
192
|
+
switch: {
|
|
193
|
+
width: number
|
|
194
|
+
height: number
|
|
195
|
+
padding: number
|
|
196
|
+
transitionDurationMs: number
|
|
197
|
+
transitionTimingFunction: string
|
|
198
|
+
focusRing: FocusRing
|
|
199
|
+
}
|
|
200
|
+
border: {
|
|
201
|
+
width: number
|
|
202
|
+
}
|
|
203
|
+
select: {
|
|
204
|
+
focusRing: FocusRing
|
|
205
|
+
}
|
|
206
|
+
text: {
|
|
207
|
+
focusRing: FocusRing
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** @public */
|
|
212
|
+
export type ColorScheme = (typeof COLOR_SCHEMES)[number]
|
|
213
|
+
|
|
214
|
+
/** @public */
|
|
215
|
+
export type CardTone = (typeof CARD_TONES)[number]
|
|
216
|
+
|
|
217
|
+
/** @public */
|
|
218
|
+
export type ElementTone = (typeof ELEMENT_TONES)[number]
|
|
219
|
+
|
|
220
|
+
/** @public */
|
|
221
|
+
export type ButtonMode = (typeof BUTTON_MODES)[number]
|
|
222
|
+
|
|
223
|
+
/** @public */
|
|
224
|
+
export interface ThemeAvatar {
|
|
225
|
+
sizes: {
|
|
226
|
+
/** Spacing between avatars in an <AvatarStack> component (px) */
|
|
227
|
+
distance: number
|
|
228
|
+
/** Diameter of the avatar (px) */
|
|
229
|
+
size: number
|
|
230
|
+
}[]
|
|
231
|
+
focusRing: FocusRing
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** @public */
|
|
235
|
+
export type BoxShadow = [
|
|
236
|
+
// offsetX, offsetY, blurRadius, spreadRadius
|
|
237
|
+
number,
|
|
238
|
+
number,
|
|
239
|
+
number,
|
|
240
|
+
number,
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
/** @public */
|
|
244
|
+
export interface ShadowProperties {
|
|
245
|
+
umbra: BoxShadow
|
|
246
|
+
penumbra: BoxShadow
|
|
247
|
+
ambient: BoxShadow
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** @public */
|
|
251
|
+
export interface Layer {
|
|
252
|
+
dialog: {zOffset: number}
|
|
253
|
+
popover: {zOffset: number}
|
|
254
|
+
tooltip: {zOffset: number}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** @public */
|
|
258
|
+
export interface FontWeights {
|
|
259
|
+
regular: number
|
|
260
|
+
medium: number
|
|
261
|
+
semibold: number
|
|
262
|
+
bold: number
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** @public */
|
|
266
|
+
export interface FocusRing {
|
|
267
|
+
offset: number
|
|
268
|
+
width: number
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** @public */
|
|
272
|
+
export type AvatarSize = (typeof AVATAR_SIZE)[number]
|
|
273
|
+
|
|
274
|
+
/** @public */
|
|
275
|
+
export type ContainerScale = (typeof CONTAINER_SCALE)[number]
|
|
276
|
+
|
|
277
|
+
/** @public */
|
|
278
|
+
export type ContainerWidth = (typeof CONTAINER)[number]
|
|
279
|
+
|
|
280
|
+
/** @public */
|
|
281
|
+
export type Radius = (typeof RADIUS)[number] // | 'full'
|
|
282
|
+
|
|
283
|
+
/** @public */
|
|
284
|
+
export type Space = (typeof SPACE)[number]
|
|
285
|
+
|
|
286
|
+
/** @public */
|
|
287
|
+
export type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold'
|
|
288
|
+
|
|
289
|
+
/** @public */
|
|
290
|
+
export type FontCodeSize = (typeof FONT_CODE_SIZE)[number]
|
|
291
|
+
|
|
292
|
+
/** @public */
|
|
293
|
+
export type FontHeadingSize = (typeof FONT_HEADING_SIZE)[number]
|
|
294
|
+
|
|
295
|
+
/** @public */
|
|
296
|
+
export type FontLabelSize = (typeof FONT_LABEL_SIZE)[number]
|
|
297
|
+
|
|
298
|
+
/** @public */
|
|
299
|
+
export type FontTextSize = (typeof FONT_TEXT_SIZE)[number]
|
|
300
|
+
|
|
301
|
+
/** @public */
|
|
302
|
+
export type Shadow = (typeof SHADOW)[number]
|
|
303
|
+
|
|
304
|
+
/** @public */
|
|
305
|
+
export interface Options {
|
|
306
|
+
tokens?: PartialTokens<Tokens>
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/** @public */
|
|
310
|
+
export interface Palette {
|
|
311
|
+
black: ColorTint
|
|
312
|
+
white: ColorTint
|
|
313
|
+
hues: ColorHues
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** @public */
|
|
317
|
+
export interface FontSize {
|
|
318
|
+
ascenderHeight: number
|
|
319
|
+
descenderHeight: number
|
|
320
|
+
fontSize: number
|
|
321
|
+
iconSize: number
|
|
322
|
+
letterSpacing: number
|
|
323
|
+
lineHeight: number
|
|
324
|
+
customIconSize: number
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** @public */
|
|
328
|
+
export interface Font {
|
|
329
|
+
family: string
|
|
330
|
+
featureSettings?: string
|
|
331
|
+
weight: FontWeights
|
|
332
|
+
scale: FontSize[]
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** @public */
|
|
336
|
+
export interface Fonts {
|
|
337
|
+
code: Font
|
|
338
|
+
heading: Font
|
|
339
|
+
label: Font
|
|
340
|
+
text: Font
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** @public */
|
|
20
344
|
export interface Theme {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
345
|
+
_version: 3
|
|
346
|
+
_tokens: Tokens
|
|
347
|
+
avatar: ThemeAvatar
|
|
348
|
+
button: {
|
|
349
|
+
border: {width: number}
|
|
350
|
+
focusRing: FocusRing
|
|
351
|
+
textWeight: FontWeight
|
|
352
|
+
}
|
|
353
|
+
card: {
|
|
354
|
+
border: {width: number}
|
|
355
|
+
focusRing: FocusRing
|
|
356
|
+
shadow: {outline: number}
|
|
27
357
|
}
|
|
358
|
+
color: Color
|
|
359
|
+
container: number[]
|
|
360
|
+
font: Fonts
|
|
361
|
+
input: Input
|
|
362
|
+
layer: Layer
|
|
363
|
+
media: number[]
|
|
364
|
+
palette: Palette
|
|
365
|
+
radius: Record<Radius, number>
|
|
366
|
+
shadow: Record<Shadow, ShadowProperties | undefined>
|
|
367
|
+
space: Record<Space, number>
|
|
28
368
|
}
|