@cube-dev/ui-kit 0.138.3 → 0.138.5
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/CHANGELOG.md +22 -0
- package/dist/_internal/hooks/use-chained-callback.js +1 -1
- package/dist/_internal/hooks/use-debounced-value.js +1 -1
- package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
- package/dist/_internal/hooks/use-event.js +1 -1
- package/dist/_internal/hooks/use-is-first-render.js +1 -1
- package/dist/_internal/hooks/use-sync-ref.js +1 -1
- package/dist/_internal/hooks/use-timer/timer.js +1 -1
- package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
- package/dist/_internal/hooks/use-warn.js +1 -1
- package/dist/components/Block.js +1 -1
- package/dist/components/CollectionItem.js +1 -1
- package/dist/components/GlobalStyles.js +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.js +1 -1
- package/dist/components/actions/Action/Action.js +1 -1
- package/dist/components/actions/Banner/Banner.js +1 -1
- package/dist/components/actions/Button/Button.js +1 -1
- package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
- package/dist/components/actions/ButtonSplit/context.js +1 -1
- package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/dist/components/actions/CommandMenu/styled.js +1 -1
- package/dist/components/actions/ItemAction/ItemAction.js +1 -1
- package/dist/components/actions/ItemActionContext.js +1 -1
- package/dist/components/actions/ItemButton/ItemButton.js +1 -1
- package/dist/components/actions/Link/Link.js +1 -1
- package/dist/components/actions/Menu/Menu.js +1 -1
- package/dist/components/actions/Menu/MenuItem.js +1 -1
- package/dist/components/actions/Menu/MenuSection.js +1 -1
- package/dist/components/actions/Menu/MenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/dist/components/actions/Menu/context.js +1 -1
- package/dist/components/actions/Menu/styled.js +1 -1
- package/dist/components/actions/index.js +1 -1
- package/dist/components/actions/use-action.js +1 -1
- package/dist/components/actions/use-anchored-menu.js +1 -1
- package/dist/components/actions/use-context-menu.js +1 -1
- package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
- package/dist/components/content/Alert/Alert.js +1 -1
- package/dist/components/content/Alert/use-alert.js +1 -1
- package/dist/components/content/Avatar/Avatar.js +1 -1
- package/dist/components/content/Badge/Badge.js +1 -1
- package/dist/components/content/Card/Card.js +1 -1
- package/dist/components/content/Content.js +1 -1
- package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
- package/dist/components/content/Disclosure/Disclosure.js +1 -1
- package/dist/components/content/Divider.js +1 -1
- package/dist/components/content/Footer.js +1 -1
- package/dist/components/content/Header.js +1 -1
- package/dist/components/content/HotKeys/HotKeys.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +23 -2
- package/dist/components/content/InlineInput/InlineInput.js.map +1 -1
- package/dist/components/content/Item/Item.js +1 -1
- package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
- package/dist/components/content/ItemCard/ItemCard.js +1 -1
- package/dist/components/content/Layout/GridLayout.js +1 -1
- package/dist/components/content/Layout/Layout.js +1 -1
- package/dist/components/content/Layout/LayoutBlock.js +1 -1
- package/dist/components/content/Layout/LayoutCenter.js +1 -1
- package/dist/components/content/Layout/LayoutContainer.js +1 -1
- package/dist/components/content/Layout/LayoutContent.js +1 -1
- package/dist/components/content/Layout/LayoutContext.js +1 -1
- package/dist/components/content/Layout/LayoutFlex.js +1 -1
- package/dist/components/content/Layout/LayoutFooter.js +1 -1
- package/dist/components/content/Layout/LayoutGrid.js +1 -1
- package/dist/components/content/Layout/LayoutHeader.js +1 -1
- package/dist/components/content/Layout/LayoutPane.js +1 -1
- package/dist/components/content/Layout/LayoutPanel.js +1 -1
- package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
- package/dist/components/content/Layout/LayoutToolbar.js +1 -1
- package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
- package/dist/components/content/Layout/index.js +1 -1
- package/dist/components/content/Layout/utils.js +1 -1
- package/dist/components/content/Paragraph.js +1 -1
- package/dist/components/content/Placeholder/Placeholder.js +1 -1
- package/dist/components/content/PrismCode/PrismCode.js +1 -1
- package/dist/components/content/PrismCode/prismSetup.js +1 -1
- package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/dist/components/content/Result/Result.js +1 -1
- package/dist/components/content/Skeleton/Skeleton.js +1 -1
- package/dist/components/content/Tag/Tag.js +1 -1
- package/dist/components/content/Text.d.ts +7 -7
- package/dist/components/content/Text.js +1 -1
- package/dist/components/content/TextItem/TextItem.js +1 -1
- package/dist/components/content/Title.js +1 -1
- package/dist/components/content/Tree/Tree.js +1 -1
- package/dist/components/content/Tree/TreeNode.js +1 -1
- package/dist/components/content/Tree/styled.js +1 -1
- package/dist/components/content/Tree/tree-index.js +1 -1
- package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
- package/dist/components/content/Tree/use-load-data.js +1 -1
- package/dist/components/content/highlightText.js +1 -1
- package/dist/components/content/use-auto-tooltip.js +1 -1
- package/dist/components/fields/Checkbox/Checkbox.js +1 -1
- package/dist/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/dist/components/fields/Checkbox/context.js +1 -1
- package/dist/components/fields/ComboBox/ComboBox.js +1 -1
- package/dist/components/fields/DatePicker/DateInput.js +1 -1
- package/dist/components/fields/DatePicker/DateInputBase.js +1 -1
- package/dist/components/fields/DatePicker/DatePicker.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/dist/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/intl.js +1 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/props.js +1 -1
- package/dist/components/fields/DatePicker/utils.js +1 -1
- package/dist/components/fields/FileInput/FileInput.js +1 -1
- package/dist/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/dist/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/dist/components/fields/Input/Input.js +1 -1
- package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
- package/dist/components/fields/ListBox/ListBox.js +1 -1
- package/dist/components/fields/NumberInput/NumberInput.js +1 -1
- package/dist/components/fields/NumberInput/StepButton.js +1 -1
- package/dist/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/dist/components/fields/Picker/Picker.js +1 -1
- package/dist/components/fields/RadioGroup/Radio.js +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +2 -2
- package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchInput/SearchInput.js +1 -1
- package/dist/components/fields/Select/Select.js +1 -1
- package/dist/components/fields/Slider/Gradation.js +1 -1
- package/dist/components/fields/Slider/HueSlider.js +1 -1
- package/dist/components/fields/Slider/RangeSlider.js +1 -1
- package/dist/components/fields/Slider/Slider.js +1 -1
- package/dist/components/fields/Slider/SliderBase.js +1 -1
- package/dist/components/fields/Slider/SliderThumb.js +1 -1
- package/dist/components/fields/Slider/SliderTrack.js +1 -1
- package/dist/components/fields/Slider/elements.js +1 -1
- package/dist/components/fields/Slider/index.js +1 -1
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/TextArea/TextArea.js +1 -1
- package/dist/components/fields/TextInput/TextInput.js +1 -1
- package/dist/components/fields/TextInput/TextInputBase.js +1 -1
- package/dist/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/dist/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/dist/components/form/FieldWrapper/extract-field-wrapper-props.js +1 -1
- package/dist/components/form/Form/Field.js +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/form/Form/SubmitError.js +1 -1
- package/dist/components/form/Form/index.js +1 -1
- package/dist/components/form/Form/use-field/use-field-props.js +1 -1
- package/dist/components/form/Form/use-field/use-field.js +1 -1
- package/dist/components/form/Form/use-form.js +1 -1
- package/dist/components/form/Form/validation.js +1 -1
- package/dist/components/form/Label.js +1 -1
- package/dist/components/form/wrapper.js +1 -1
- package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
- package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
- package/dist/components/layout/Flex.js +1 -1
- package/dist/components/layout/Flow.js +1 -1
- package/dist/components/layout/Grid.js +1 -1
- package/dist/components/layout/Panel.js +1 -1
- package/dist/components/layout/Prefix.js +1 -1
- package/dist/components/layout/ResizablePanel.js +1 -1
- package/dist/components/layout/Space.js +1 -1
- package/dist/components/layout/Suffix.js +1 -1
- package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
- package/dist/components/navigation/Tabs/TabButton.js +29 -2
- package/dist/components/navigation/Tabs/TabButton.js.map +1 -1
- package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
- package/dist/components/navigation/Tabs/TabPanel.js +1 -1
- package/dist/components/navigation/Tabs/TabPicker.js +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +1 -1
- package/dist/components/navigation/Tabs/TabsAction.js +1 -1
- package/dist/components/navigation/Tabs/TabsContext.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +2 -2
- package/dist/components/navigation/Tabs/styled.js.map +1 -1
- package/dist/components/navigation/Tabs/types.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
- package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
- package/dist/components/organisms/FileTabs/FileTabs.js +1 -1
- package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
- package/dist/components/other/Calendar/Calendar.js +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +1 -1
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/CloudLogo/CloudLogo.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +1 -1
- package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
- package/dist/components/overlays/Dialog/DialogForm.js +1 -1
- package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/dist/components/overlays/Dialog/context.js +1 -1
- package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/dist/components/overlays/Modal/Modal.js +1 -1
- package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
- package/dist/components/overlays/Modal/Overlay.js +1 -1
- package/dist/components/overlays/Modal/Popover.js +1 -1
- package/dist/components/overlays/Modal/Tray.js +1 -1
- package/dist/components/overlays/Modal/Underlay.js +1 -1
- package/dist/components/overlays/Notifications/Notification.js +1 -1
- package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
- package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
- package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
- package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
- package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
- package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
- package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
- package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
- package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
- package/dist/components/overlays/Notifications/index.js +1 -1
- package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
- package/dist/components/overlays/Notifications/use-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
- package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
- package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
- package/dist/components/overlays/Toast/ToastItem.js +1 -1
- package/dist/components/overlays/Toast/index.js +1 -1
- package/dist/components/overlays/Toast/useProgressToast.js +1 -1
- package/dist/components/overlays/Toast/useToast.js +1 -1
- package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/dist/components/overlays/Tooltip/context.js +1 -1
- package/dist/components/portal/Portal.js +1 -1
- package/dist/components/portal/PortalProvider.js +1 -1
- package/dist/components/portal/usePortal.js +1 -1
- package/dist/components/shared/DraggableCollection.js +1 -1
- package/dist/components/shared/InvalidIcon.js +1 -1
- package/dist/components/shared/ValidIcon.js +1 -1
- package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/dist/components/status/Spin/Cube.js +1 -1
- package/dist/components/status/Spin/InternalSpinner.js +1 -1
- package/dist/components/status/Spin/Spin.js +1 -1
- package/dist/components/status/Spin/SpinsContainer.js +1 -1
- package/dist/data/item-themes.js +15 -15
- package/dist/data/item-themes.js.map +1 -1
- package/dist/data/themes.js +1 -1
- package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/dist/icons/AdjustmentsIcon.js +1 -1
- package/dist/icons/AiIcon.js +1 -1
- package/dist/icons/AreaChartIcon.js +1 -1
- package/dist/icons/BackwardIcon.js +1 -1
- package/dist/icons/BarChartIcon.js +1 -1
- package/dist/icons/BellFilledIcon.js +1 -1
- package/dist/icons/BellIcon.js +1 -1
- package/dist/icons/BooleanIcon.js +1 -1
- package/dist/icons/CalendarEditIcon.js +1 -1
- package/dist/icons/CalendarIcon.js +1 -1
- package/dist/icons/CaretDownIcon.js +1 -1
- package/dist/icons/CaretUpIcon.js +1 -1
- package/dist/icons/ChartAreaStackedIcon.js +1 -1
- package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarGroupedIcon.js +1 -1
- package/dist/icons/ChartBarHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarLineIcon.js +1 -1
- package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/dist/icons/ChartBoxPlot2Icon.js +1 -1
- package/dist/icons/ChartBoxPlotIcon.js +1 -1
- package/dist/icons/ChartBubbleIcon.js +1 -1
- package/dist/icons/ChartDonut2Icon.js +1 -1
- package/dist/icons/ChartFunnelIcon.js +1 -1
- package/dist/icons/ChartHeatmapIcon.js +1 -1
- package/dist/icons/ChartKPIIcon.js +1 -1
- package/dist/icons/ChartPie2Icon.js +1 -1
- package/dist/icons/ChartScatterIcon.js +1 -1
- package/dist/icons/CheckCircleFilledIcon.js +1 -1
- package/dist/icons/CheckCircleIcon.js +1 -1
- package/dist/icons/CheckIcon.js +1 -1
- package/dist/icons/CircleFilledIcon.js +1 -1
- package/dist/icons/ClearIcon.js +1 -1
- package/dist/icons/CloseCircleFilledIcon.js +1 -1
- package/dist/icons/CloseCircleIcon.js +1 -1
- package/dist/icons/CloseIcon.js +1 -1
- package/dist/icons/CodeIcon.js +1 -1
- package/dist/icons/ColumnTotalIcon.js +1 -1
- package/dist/icons/CopyIcon.js +1 -1
- package/dist/icons/CountIcon.js +1 -1
- package/dist/icons/CubeIcon.js +1 -1
- package/dist/icons/CubePauseIcon.js +1 -1
- package/dist/icons/CubePlayIcon.js +1 -1
- package/dist/icons/CurrencyDollarIcon.js +1 -1
- package/dist/icons/DangerIcon.js +1 -1
- package/dist/icons/DashboardIcon.js +1 -1
- package/dist/icons/DatabaseIcon.js +1 -1
- package/dist/icons/DecimalDecreaseIcon.js +1 -1
- package/dist/icons/DecimalIncreaseIcon.js +1 -1
- package/dist/icons/DirectionIcon.js +1 -1
- package/dist/icons/DonutIcon.js +1 -1
- package/dist/icons/DownIcon.js +1 -1
- package/dist/icons/EditIcon.js +1 -1
- package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
- package/dist/icons/ExclamationCircleIcon.js +1 -1
- package/dist/icons/ExclamationIcon.js +1 -1
- package/dist/icons/EyeIcon.js +1 -1
- package/dist/icons/EyeInvisibleIcon.js +1 -1
- package/dist/icons/FilterIcon.js +1 -1
- package/dist/icons/FolderFilledIcon.js +1 -1
- package/dist/icons/FolderIcon.js +1 -1
- package/dist/icons/FolderOpenFilledIcon.js +1 -1
- package/dist/icons/FolderOpenIcon.js +1 -1
- package/dist/icons/ForwardIcon.js +1 -1
- package/dist/icons/GripVerticalIcon.js +1 -1
- package/dist/icons/HierarchyIcon.js +1 -1
- package/dist/icons/HierarchyOpenIcon.js +1 -1
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/InfoCircleIcon.js +1 -1
- package/dist/icons/InfoIcon.js +1 -1
- package/dist/icons/KeyIcon.js +1 -1
- package/dist/icons/LeftIcon.js +1 -1
- package/dist/icons/LineChartIcon.js +1 -1
- package/dist/icons/LoadingIcon.js +1 -1
- package/dist/icons/LockFilledIcon.js +1 -1
- package/dist/icons/LockIcon.js +1 -1
- package/dist/icons/MoreIcon.js +1 -1
- package/dist/icons/NotAllowedIcon.js +1 -1
- package/dist/icons/Number123Icon.js +1 -1
- package/dist/icons/NumberIcon.js +1 -1
- package/dist/icons/PauseCircleFilledIcon.js +1 -1
- package/dist/icons/PauseCircleIcon.js +1 -1
- package/dist/icons/PauseIcon.js +1 -1
- package/dist/icons/PercentageIcon.js +1 -1
- package/dist/icons/PieChartIcon.js +1 -1
- package/dist/icons/PlayCircleIcon.js +1 -1
- package/dist/icons/PlayIcon.js +1 -1
- package/dist/icons/PlusIcon.js +1 -1
- package/dist/icons/ProgressBarIcon.js +1 -1
- package/dist/icons/ReloadIcon.js +1 -1
- package/dist/icons/ReportIcon.js +1 -1
- package/dist/icons/ReturnIcon.js +1 -1
- package/dist/icons/RightIcon.js +1 -1
- package/dist/icons/RowTotalsIcon.js +1 -1
- package/dist/icons/SchemeIcon.js +1 -1
- package/dist/icons/SearchIcon.js +1 -1
- package/dist/icons/SemanticQueryIcon.js +1 -1
- package/dist/icons/SettingsIcon.js +1 -1
- package/dist/icons/ShieldFilledIcon.js +1 -1
- package/dist/icons/ShieldIcon.js +1 -1
- package/dist/icons/SlashIcon.js +1 -1
- package/dist/icons/SparklesIcon.js +1 -1
- package/dist/icons/SqlIcon.js +1 -1
- package/dist/icons/StatsIcon.js +1 -1
- package/dist/icons/StopIcon.js +1 -1
- package/dist/icons/StringIcon.js +1 -1
- package/dist/icons/SubtotalsIcon.js +1 -1
- package/dist/icons/SwitchIcon.js +1 -1
- package/dist/icons/TableIcon.js +1 -1
- package/dist/icons/ThumbsDownIcon.js +1 -1
- package/dist/icons/ThumbsUpIcon.js +1 -1
- package/dist/icons/ThunderboltCrossedIcon.js +1 -1
- package/dist/icons/ThunderboltFilledIcon.js +1 -1
- package/dist/icons/ThunderboltIcon.js +1 -1
- package/dist/icons/TimeIcon.js +1 -1
- package/dist/icons/TrashIcon.js +1 -1
- package/dist/icons/UnlockIcon.js +1 -1
- package/dist/icons/UpIcon.js +1 -1
- package/dist/icons/UserGroupIcon.js +1 -1
- package/dist/icons/UserIcon.js +1 -1
- package/dist/icons/UserLockIcon.js +1 -1
- package/dist/icons/ViewIcon.js +1 -1
- package/dist/icons/WarningFilledIcon.js +1 -1
- package/dist/icons/WarningIcon.js +1 -1
- package/dist/icons/wrap-icon.js +1 -1
- package/dist/index.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/providers/TrackingProvider.js +1 -1
- package/dist/providers/navigationAdapter.default.js +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.js +3 -3
- package/dist/tokens/colors.js.map +1 -1
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/palette.js +80 -4
- package/dist/tokens/palette.js.map +1 -1
- package/dist/tokens/shadows.js +1 -1
- package/dist/tokens/sizes.js +1 -1
- package/dist/tokens/spacing.js +1 -1
- package/dist/tokens/typography.js +1 -1
- package/dist/utils/ResizeSensor.js +1 -1
- package/dist/utils/is-dev-env.js +1 -1
- package/dist/utils/modules.js +1 -1
- package/dist/utils/promise.js +1 -1
- package/dist/utils/raf.js +1 -1
- package/dist/utils/random.js +1 -1
- package/dist/utils/range.js +1 -1
- package/dist/utils/react/RenderCache.js +1 -1
- package/dist/utils/react/Slots.js +1 -1
- package/dist/utils/react/chain.js +1 -1
- package/dist/utils/react/forwardRefWithGenerics.js +1 -1
- package/dist/utils/react/index.js +1 -1
- package/dist/utils/react/interactions.js +1 -1
- package/dist/utils/react/isTextOnly.js +1 -1
- package/dist/utils/react/mapProps.js +1 -1
- package/dist/utils/react/mergeProps.js +1 -1
- package/dist/utils/react/nullableValue.js +1 -1
- package/dist/utils/react/resolveIcon.js +1 -1
- package/dist/utils/react/sharedStore.js +1 -1
- package/dist/utils/react/useCombinedRefs.js +1 -1
- package/dist/utils/react/useControlledFocusVisible.js +1 -1
- package/dist/utils/react/useEventBus.js +1 -1
- package/dist/utils/react/useId.js +1 -1
- package/dist/utils/react/useIsDarwin.js +1 -1
- package/dist/utils/react/useKeySymbols.js +1 -1
- package/dist/utils/react/useLayoutEffect.js +1 -1
- package/dist/utils/react/useLocalStorage.js +1 -1
- package/dist/utils/react/useMergeStyles.js +1 -1
- package/dist/utils/react/usePopoverSync.js +1 -1
- package/dist/utils/react/useQaProps.js +1 -1
- package/dist/utils/react/useViewportSize.js +1 -1
- package/dist/utils/react/wrapNodeIfPlain.js +1 -1
- package/dist/utils/selection.js +1 -1
- package/dist/utils/styles.js +1 -1
- package/dist/utils/tree.js +1 -1
- package/dist/utils/warnings.js +1 -1
- package/dist/version.js +2 -2
- package/docs/Usage.md +1 -0
- package/docs/glaze/api.md +1074 -0
- package/docs/glaze/methodology.md +330 -0
- package/docs/glaze/migration.md +237 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Full reference for every public method, option, and type exported by `@tenphi/glaze`. Organized for lookup, not for reading top-to-bottom — see [methodology.md](methodology.md) for a guided walkthrough of how to use these primitives to build a real palette.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- [Theme creation](#theme-creation)
|
|
8
|
+
- [Theme methods](#theme-methods)
|
|
9
|
+
- [Color definitions](#color-definitions)
|
|
10
|
+
- [Standalone color tokens](#standalone-color-tokens)
|
|
11
|
+
- [Shadows](#shadows)
|
|
12
|
+
- [Mix colors](#mix-colors)
|
|
13
|
+
- [Palette](#palette)
|
|
14
|
+
- [Output formats](#output-formats)
|
|
15
|
+
- [Adaptation modes](#adaptation-modes)
|
|
16
|
+
- [Light / dark scheme mapping](#light--dark-scheme-mapping)
|
|
17
|
+
- [Configuration](#configuration)
|
|
18
|
+
- [Output modes](#output-modes)
|
|
19
|
+
- [Validation](#validation)
|
|
20
|
+
- [Color math utilities](#color-math-utilities)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Theme creation
|
|
25
|
+
|
|
26
|
+
| Method | Description |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `glaze(hue, saturation?)` | Create a theme from hue (0–360) and saturation (0–100). Default saturation: `100`. |
|
|
29
|
+
| `glaze({ hue, saturation })` | Create a theme from an options object. |
|
|
30
|
+
| `glaze.from(data)` | Create a theme from an exported configuration (`theme.export()` snapshot). |
|
|
31
|
+
| `glaze.fromHex(hex)` | Create a theme from a hex color (`#rgb` or `#rrggbb`). Extracts hue and saturation. |
|
|
32
|
+
| `glaze.fromRgb(r, g, b)` | Create a theme from RGB values (0–255). Extracts hue and saturation. |
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const a = glaze(280, 80);
|
|
36
|
+
const b = glaze({ hue: 280, saturation: 80 });
|
|
37
|
+
const c = glaze.fromHex('#7a4dbf');
|
|
38
|
+
const d = glaze.fromRgb(122, 77, 191);
|
|
39
|
+
const e = glaze.from(a.export());
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Theme methods
|
|
45
|
+
|
|
46
|
+
A `GlazeTheme` exposes:
|
|
47
|
+
|
|
48
|
+
| Method | Description |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `theme.hue` (readonly) | The hue seed (0–360). |
|
|
51
|
+
| `theme.saturation` (readonly) | The saturation seed (0–100). |
|
|
52
|
+
| `theme.colors(defs)` | Add/replace colors (additive merge — adds new, overwrites existing by name, doesn't remove others). |
|
|
53
|
+
| `theme.color(name)` | Get a color definition by name. |
|
|
54
|
+
| `theme.color(name, def)` | Set a single color definition. |
|
|
55
|
+
| `theme.remove(name \| names[])` | Remove one or more color definitions. |
|
|
56
|
+
| `theme.has(name)` | Check if a color is defined. |
|
|
57
|
+
| `theme.list()` | List all defined color names. |
|
|
58
|
+
| `theme.reset()` | Clear all color definitions. |
|
|
59
|
+
| `theme.export()` | Export the theme configuration as a JSON-safe object. |
|
|
60
|
+
| `theme.extend(options)` | Create a child theme inheriting all color definitions (see [`extend`](#themeextendoptions) below). |
|
|
61
|
+
| `theme.resolve()` | Resolve all colors and return a `Map<string, ResolvedColor>`. |
|
|
62
|
+
| `theme.tokens(options?)` | Export as a flat token map grouped by scheme variant. |
|
|
63
|
+
| `theme.tasty(options?)` | Export as Tasty style-to-state bindings. |
|
|
64
|
+
| `theme.json(options?)` | Export as plain JSON. |
|
|
65
|
+
| `theme.css(options?)` | Export as CSS custom property declarations. |
|
|
66
|
+
|
|
67
|
+
### `theme.colors(defs)`
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
theme.colors({ surface: { lightness: 97 } });
|
|
71
|
+
theme.colors({ text: { lightness: 30 } });
|
|
72
|
+
// Both 'surface' and 'text' are now defined.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `theme.color(name) / theme.color(name, def)`
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
theme.color('surface', { lightness: 97, saturation: 0.75 }); // set
|
|
79
|
+
const def = theme.color('surface'); // get
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### `theme.extend(options)`
|
|
83
|
+
|
|
84
|
+
Creates a new theme inheriting all color definitions, optionally replacing the hue / saturation seed and merging in per-theme overrides:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const danger = primary.extend({
|
|
88
|
+
hue: 23,
|
|
89
|
+
colors: { 'accent-fill': { lightness: 48, mode: 'fixed' } },
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`GlazeExtendOptions`:
|
|
94
|
+
|
|
95
|
+
| Field | Type | Description |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `hue` | `number` | Replace the hue seed. Defaults to the parent's hue. |
|
|
98
|
+
| `saturation` | `number` | Replace the saturation seed. Defaults to the parent's saturation. |
|
|
99
|
+
| `colors` | `ColorMap` | Per-theme overrides (additive merge over the inherited map). |
|
|
100
|
+
|
|
101
|
+
Colors marked with `inherit: false` on the parent are **not** copied into the child.
|
|
102
|
+
|
|
103
|
+
### `theme.tokens(options?)`
|
|
104
|
+
|
|
105
|
+
Flat token map grouped by scheme variant.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
theme.tokens()
|
|
109
|
+
// → { light: { surface: 'okhsl(...)' }, dark: { surface: 'okhsl(...)' } }
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`GlazeJsonOptions`:
|
|
113
|
+
|
|
114
|
+
| Option | Default | Description |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| `format` | `'okhsl'` | Output color format. One of `'okhsl' \| 'rgb' \| 'hsl' \| 'oklch'`. |
|
|
117
|
+
| `modes` | `{ dark: true, highContrast: false }` (or global config) | Which scheme variants to include. |
|
|
118
|
+
|
|
119
|
+
### `theme.tasty(options?)`
|
|
120
|
+
|
|
121
|
+
Tasty style-to-state bindings for the [Tasty style system](https://tasty.style/docs). Uses `#name` color token keys and state aliases (`''`, `@dark`, etc.).
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
theme.tasty()
|
|
125
|
+
// → {
|
|
126
|
+
// '#surface': { '': 'okhsl(...)', '@dark': 'okhsl(...)' },
|
|
127
|
+
// ...
|
|
128
|
+
// }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`GlazeTokenOptions`:
|
|
132
|
+
|
|
133
|
+
| Option | Default | Description |
|
|
134
|
+
|---|---|---|
|
|
135
|
+
| `format` | `'okhsl'` | Output color format. |
|
|
136
|
+
| `modes` | global config | Which scheme variants to include. |
|
|
137
|
+
| `states.dark` | `'@dark'` (or global config) | State alias for dark mode tokens. |
|
|
138
|
+
| `states.highContrast` | `'@high-contrast'` (or global config) | State alias for high-contrast tokens. |
|
|
139
|
+
| `prefix` | (palette only) | See [Palette](#palette). |
|
|
140
|
+
|
|
141
|
+
When both `dark` and `highContrast` modes are enabled, dark high-contrast variants are emitted under the combined key `<dark> & <highContrast>` (e.g. `'@dark & @high-contrast'`).
|
|
142
|
+
|
|
143
|
+
### `theme.json(options?)`
|
|
144
|
+
|
|
145
|
+
Per-color JSON map.
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
theme.json()
|
|
149
|
+
// → {
|
|
150
|
+
// surface: { light: 'okhsl(...)', dark: 'okhsl(...)' },
|
|
151
|
+
// text: { light: 'okhsl(...)', dark: 'okhsl(...)' },
|
|
152
|
+
// }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Same options as `tokens()`.
|
|
156
|
+
|
|
157
|
+
### `theme.css(options?)`
|
|
158
|
+
|
|
159
|
+
CSS custom property declaration strings, grouped by scheme variant.
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
theme.css();
|
|
163
|
+
// → {
|
|
164
|
+
// light: '--surface-color: rgb(...);\n--text-color: rgb(...);',
|
|
165
|
+
// dark: '--surface-color: rgb(...);\n--text-color: rgb(...);',
|
|
166
|
+
// lightContrast: '...',
|
|
167
|
+
// darkContrast: '...',
|
|
168
|
+
// }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`GlazeCssOptions`:
|
|
172
|
+
|
|
173
|
+
| Option | Default | Description |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| `format` | `'rgb'` | Output color format. |
|
|
176
|
+
| `suffix` | `'-color'` | Suffix appended to each CSS property name. Pass `''` for bare property names. |
|
|
177
|
+
|
|
178
|
+
`GlazeCssResult` always contains all four keys (`light`, `dark`, `lightContrast`, `darkContrast`); empty if no colors are defined for that variant.
|
|
179
|
+
|
|
180
|
+
### `theme.export()`
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const snapshot = theme.export();
|
|
184
|
+
// → { hue: 280, saturation: 80, colors: { surface: { ... }, ... } }
|
|
185
|
+
|
|
186
|
+
const restored = glaze.from(snapshot);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The export contains only the configuration — not resolved color values. Resolved values are recomputed on demand.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Color definitions
|
|
194
|
+
|
|
195
|
+
`ColorDef` is a discriminated union:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
type ColorDef = RegularColorDef | ShadowColorDef | MixColorDef;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### `RegularColorDef`
|
|
202
|
+
|
|
203
|
+
| Field | Type | Description |
|
|
204
|
+
|---|---|---|
|
|
205
|
+
| `lightness` | `HCPair<number \| RelativeValue>` | Number = absolute (0–100). String (`'+N'`/`'-N'`) = relative to base's lightness (requires `base`). Optional HC pair `[normal, hc]`. |
|
|
206
|
+
| `saturation` | `number` | Saturation factor applied to the seed saturation (0–1). Default: `1`. |
|
|
207
|
+
| `hue` | `number \| RelativeValue` | Number = absolute (0–360). String (`'+N'`/`'-N'`) = relative to the **theme seed hue** (never to a base color). |
|
|
208
|
+
| `base` | `string` | Name of another color in the same theme — makes this a *dependent* color. |
|
|
209
|
+
| `contrast` | `HCPair<MinContrast>` | WCAG contrast floor against `base`. Requires `base`. |
|
|
210
|
+
| `mode` | `'auto' \| 'fixed' \| 'static'` | Adaptation mode. Default: `'auto'`. See [Adaptation modes](#adaptation-modes). |
|
|
211
|
+
| `opacity` | `number` | Fixed alpha 0–1. Output includes alpha in the CSS value. Combining with `contrast` is not recommended (a `console.warn` is emitted). |
|
|
212
|
+
| `inherit` | `boolean` | Whether this color is inherited by child themes via `extend()`. Default: `true`. Set to `false` to make the color local to the current theme. |
|
|
213
|
+
|
|
214
|
+
#### Lightness values
|
|
215
|
+
|
|
216
|
+
| Form | Example | Meaning |
|
|
217
|
+
|---|---|---|
|
|
218
|
+
| Number (absolute) | `lightness: 45` | Absolute lightness 0–100. |
|
|
219
|
+
| String (relative) | `lightness: '-52'` | Relative to base color's lightness (requires `base`). |
|
|
220
|
+
| HC pair | `lightness: ['-7', '-20']` | `[normal, high-contrast]`. A single value applies to both. |
|
|
221
|
+
|
|
222
|
+
**Absolute lightness** on a dependent color (`base` set) positions the color independently. In dark mode it is dark-mapped on its own. The `contrast` solver acts as a safety net.
|
|
223
|
+
|
|
224
|
+
**Relative lightness** applies a signed delta to the base color's resolved lightness. In dark mode with `mode: 'auto'`, the sign flips automatically so a `'-52'` light-mode offset becomes a `+52` dark-mode offset.
|
|
225
|
+
|
|
226
|
+
A dependent color with `base` but no `lightness` inherits the base's lightness (equivalent to a delta of 0).
|
|
227
|
+
|
|
228
|
+
#### `contrast` (WCAG floor)
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
type MinContrast = number | 'AA' | 'AAA' | 'AA-large' | 'AAA-large';
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
| Preset | Ratio |
|
|
235
|
+
|---|---|
|
|
236
|
+
| `'AA-large'` | 3 |
|
|
237
|
+
| `'AA'` | 4.5 |
|
|
238
|
+
| `'AAA-large'` | 4.5 |
|
|
239
|
+
| `'AAA'` | 7 |
|
|
240
|
+
|
|
241
|
+
You can also pass any numeric ratio directly (e.g., `contrast: 4.5`, `contrast: 11`). The constraint is applied independently for each scheme — if the `lightness` already satisfies the floor it's kept, otherwise the solver adjusts lightness until the target is met.
|
|
242
|
+
|
|
243
|
+
**Full lightness spectrum in HC mode:** in high-contrast variants the `lightLightness` and `darkLightness` window constraints are bypassed entirely. Colors can reach the full 0–100 range, maximizing perceivable contrast.
|
|
244
|
+
|
|
245
|
+
#### Per-color hue override
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
const theme = glaze(280, 80);
|
|
249
|
+
theme.colors({
|
|
250
|
+
surface: { lightness: 97 },
|
|
251
|
+
gradientEnd: { lightness: 90, hue: '+20' }, // 280 + 20 = 300
|
|
252
|
+
warning: { lightness: 60, hue: 40 }, // absolute
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Relative hue is always relative to the **theme seed hue**, not to a base color.
|
|
257
|
+
|
|
258
|
+
### `ShadowColorDef`
|
|
259
|
+
|
|
260
|
+
| Field | Type | Description |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| `type` | `'shadow'` | Discriminator. |
|
|
263
|
+
| `bg` | `string` | Background color name — must reference a non-shadow color in the same theme. |
|
|
264
|
+
| `fg` | `string` | Optional foreground color name for tinting and intensity modulation. Must reference a non-shadow color. Omit for an achromatic shadow at full user-specified intensity. |
|
|
265
|
+
| `intensity` | `HCPair<number>` | Shadow intensity, 0–100. Supports HC pairs. |
|
|
266
|
+
| `tuning` | `ShadowTuning` | Per-color tuning overrides. Merged field-by-field with the global `shadowTuning`. |
|
|
267
|
+
| `inherit` | `boolean` | Inheritance flag, default `true`. |
|
|
268
|
+
|
|
269
|
+
See [Shadows](#shadows) below for the algorithm and tuning details.
|
|
270
|
+
|
|
271
|
+
### `MixColorDef`
|
|
272
|
+
|
|
273
|
+
| Field | Type | Description |
|
|
274
|
+
|---|---|---|
|
|
275
|
+
| `type` | `'mix'` | Discriminator. |
|
|
276
|
+
| `base` | `string` | "From" color name. |
|
|
277
|
+
| `target` | `string` | "To" color name. |
|
|
278
|
+
| `value` | `HCPair<number>` | Mix ratio 0–100 (0 = pure base, 100 = pure target). In `'transparent'` blend, this becomes the target's opacity. Supports HC pairs. |
|
|
279
|
+
| `blend` | `'opaque' \| 'transparent'` | Default `'opaque'`. |
|
|
280
|
+
| `space` | `'okhsl' \| 'srgb'` | Interpolation space for opaque blending. Default `'okhsl'`. Ignored for `'transparent'` (always composites in linear sRGB). |
|
|
281
|
+
| `contrast` | `HCPair<MinContrast>` | Optional WCAG floor against `base`. The solver adjusts the mix ratio (opaque) or opacity (transparent). |
|
|
282
|
+
| `inherit` | `boolean` | Inheritance flag, default `true`. |
|
|
283
|
+
|
|
284
|
+
See [Mix colors](#mix-colors) below.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Standalone color tokens
|
|
289
|
+
|
|
290
|
+
`glaze.color()` creates a single color token without a full theme. Two overloads:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
glaze.color(input: GlazeColorInput, scaling?: GlazeColorScaling): GlazeColorToken;
|
|
294
|
+
glaze.color(value: GlazeColorValue, overrides?: GlazeColorOverrides, scaling?: GlazeColorScaling): GlazeColorToken;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Input forms
|
|
298
|
+
|
|
299
|
+
`GlazeColorValue` (the value-shorthand input) accepts:
|
|
300
|
+
|
|
301
|
+
| Form | Example | Notes |
|
|
302
|
+
|---|---|---|
|
|
303
|
+
| Hex | `'#26fcb2'`, `'#26fcb2ff'`, `'#abc'` | 3, 6, or 8 digits. Alpha components are dropped with a `console.warn` — use `opacity` instead. |
|
|
304
|
+
| `rgb()` | `'rgb(38 252 178)'`, `'rgb(38 252 178 / 0.8)'` | Modern space syntax. Alpha dropped with warning. |
|
|
305
|
+
| `hsl()` | `'hsl(152 97% 57%)'` | Modern space syntax. Alpha dropped with warning. |
|
|
306
|
+
| `okhsl()` | `'okhsl(152 95% 74%)'` | Glaze's own emit format. Alpha dropped with warning. |
|
|
307
|
+
| `oklch()` | `'oklch(0.85 0.18 152)'` | Glaze's own emit format. Alpha dropped with warning. |
|
|
308
|
+
| `OkhslColor` object | `{ h: 152, s: 0.95, l: 0.74 }` | Glaze's native shape (h: 0–360, s/l: 0–1). Passing 0–100 for `s`/`l` throws with a hint to use the structured form. |
|
|
309
|
+
| RGB tuple | `[38, 252, 178]` | 0–255, same range as `glaze.fromRgb`. |
|
|
310
|
+
|
|
311
|
+
`GlazeColorInput` (the structured input) is `{ hue, saturation, lightness, ... }`:
|
|
312
|
+
|
|
313
|
+
| Field | Type | Description |
|
|
314
|
+
|---|---|---|
|
|
315
|
+
| `hue` | `number` | 0–360. |
|
|
316
|
+
| `saturation` | `number` | 0–100. |
|
|
317
|
+
| `lightness` | `HCPair<number>` | 0–100, optional HC pair. |
|
|
318
|
+
| `saturationFactor` | `number` | Multiplier on the seed (0–1). Default: `1`. |
|
|
319
|
+
| `mode` | `AdaptationMode` | Default: `'auto'`. |
|
|
320
|
+
| `opacity` | `number` | Fixed alpha 0–1. |
|
|
321
|
+
| `base` | `GlazeColorToken \| GlazeColorValue` | Optional dependency. See [Pairing colors](#pairing-colors). |
|
|
322
|
+
| `contrast` | `HCPair<MinContrast>` | WCAG floor against `base` (requires `base`). |
|
|
323
|
+
| `name` | `string` | Debug label for warnings; doesn't change output keys. Reserved names (`'value'`, `'seed'`, `'externalBase'`) are rejected. |
|
|
324
|
+
|
|
325
|
+
Named CSS colors (`'red'`, `'blueviolet'`) are not supported.
|
|
326
|
+
|
|
327
|
+
### Defaults
|
|
328
|
+
|
|
329
|
+
Every input form defaults to `mode: 'auto'` so the resolved token adapts between light and dark like an ordinary theme color. The *scaling* snapshot taken at create time differs by input form:
|
|
330
|
+
|
|
331
|
+
- **String value-shorthand** (`'#000'`, `'rgb(...)'`, etc.):
|
|
332
|
+
- Light variant preserves the input lightness exactly (`lightLightness: false`).
|
|
333
|
+
- Dark variant is Möbius-inverted into `[globalConfig.darkLightness[0], 100]`, so `glaze.color('#000')` renders as `#fff` in dark mode and `glaze.color('#fff')` falls to the dark `lo` floor (default `0.15`).
|
|
334
|
+
- **Object / tuple / structured inputs**:
|
|
335
|
+
- Both light and dark variants are mapped through `globalConfig.lightLightness` / `globalConfig.darkLightness` (defaults `[10, 100]` / `[15, 95]`) — the same windows a theme color uses.
|
|
336
|
+
- All windows are **snapshotted at color-creation time** so later `glaze.configure()` calls don't retroactively change exported tokens. `token.export()` round-trips byte-for-byte.
|
|
337
|
+
|
|
338
|
+
To opt back into the legacy fixed-linear default (no Möbius inversion), pass `{ mode: 'fixed' }` as the second arg, or supply an explicit `scaling` (see [`GlazeColorScaling`](#glazecolorscaling)).
|
|
339
|
+
|
|
340
|
+
### `GlazeColorOverrides`
|
|
341
|
+
|
|
342
|
+
Overrides for the value-shorthand overload's second argument:
|
|
343
|
+
|
|
344
|
+
| Option | Notes |
|
|
345
|
+
|---|---|
|
|
346
|
+
| `hue` | Number (absolute 0–360) or `'+N'`/`'-N'` (relative to seed — never to `base`). |
|
|
347
|
+
| `saturation` | Override seed saturation (0–100). |
|
|
348
|
+
| `lightness` | Number (absolute 0–100) or `'+N'`/`'-N'`. Without `base`, relative is anchored to the literal seed; with `base`, anchored to `base`'s lightness per scheme. Supports `[normal, hc]` pairs. |
|
|
349
|
+
| `saturationFactor` | Multiplier on the seed (0–1). Default: `1`. |
|
|
350
|
+
| `mode` | `'auto'` (default for every input form) / `'fixed'` / `'static'`. |
|
|
351
|
+
| `contrast` | WCAG floor. Without `base`, anchored to the literal seed; with `base`, solved per scheme against `base`'s resolved variant. When the target can't be met, a `console.warn` is emitted and the closest passing variant is returned. |
|
|
352
|
+
| `base` | `GlazeColorToken` **or** raw `GlazeColorValue`. Raw values are auto-wrapped via `glaze.color(value)`. When set, `contrast` and relative `lightness` anchor to it per scheme; relative `hue` still anchors to the seed. |
|
|
353
|
+
| `opacity` | Fixed alpha 0–1 applied to every variant. Combining with `contrast` is not recommended — `console.warn` is emitted. |
|
|
354
|
+
| `name` | Debug label only — surfaces in `console.warn` / Error messages. Does not change output keys. |
|
|
355
|
+
|
|
356
|
+
### `GlazeColorScaling`
|
|
357
|
+
|
|
358
|
+
Per-call lightness-window override. Mirrors `GlazeConfig`'s field names:
|
|
359
|
+
|
|
360
|
+
| Key | Default for string input | Default for object / tuple / structured input | Effect |
|
|
361
|
+
|---|---|---|---|
|
|
362
|
+
| `lightLightness` | `false` | `globalConfig.lightLightness` (snapshotted) | `false` = preserve input. Pass `[lo, hi]` to opt into a remap window. |
|
|
363
|
+
| `darkLightness` | `[globalConfig.darkLightness[0], 100]` (snapshotted) | `globalConfig.darkLightness` (snapshotted) | `false` = preserve input in dark too. Pass `[lo, hi]` to override the window. |
|
|
364
|
+
|
|
365
|
+
Passing `scaling` is **all-or-nothing** — both fields are replaced. To keep one field's default while overriding the other, restate the default explicitly.
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
// Preserve raw lightness in dark mode too
|
|
369
|
+
glaze.color('#26fcb2', undefined, { darkLightness: false });
|
|
370
|
+
|
|
371
|
+
// Opt back into a theme-style window
|
|
372
|
+
glaze.color('#26fcb2', undefined, {
|
|
373
|
+
lightLightness: [10, 100],
|
|
374
|
+
darkLightness: [15, 95],
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
// Structured form takes scaling as the second positional arg
|
|
378
|
+
glaze.color({ hue: 152, saturation: 95, lightness: 74 }, { darkLightness: false });
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Token methods
|
|
382
|
+
|
|
383
|
+
A `GlazeColorToken` exposes:
|
|
384
|
+
|
|
385
|
+
| Method | Description |
|
|
386
|
+
|---|---|
|
|
387
|
+
| `token.resolve()` | Resolve as a `ResolvedColor` (light/dark/lightContrast/darkContrast variants). |
|
|
388
|
+
| `token.token(options?)` | Flat token map (no color-name key). Options: `format`, `modes`, `states`. |
|
|
389
|
+
| `token.tasty(options?)` | Tasty state map (no color-name key). Same options as `token.token`. |
|
|
390
|
+
| `token.json(options?)` | JSON map (no color-name key). Options: `format`, `modes`. |
|
|
391
|
+
| `token.css({ name, format?, suffix? })` | CSS custom property declarations grouped by scheme variant. `name` is **required** and becomes the variable identifier (`'brand'` → `--brand-color`). Defaults: `format: 'rgb'`, `suffix: '-color'` (matches `theme.css`). |
|
|
392
|
+
| `token.export()` | JSON-safe snapshot — pass to `glaze.colorFrom(...)` to rehydrate. |
|
|
393
|
+
|
|
394
|
+
### `glaze.colorFrom(data)`
|
|
395
|
+
|
|
396
|
+
Inverse of `token.export()`. Captures the original input value, all overrides (with any `base` token recursively serialized), and the effective `scaling` so later `glaze.configure()` calls don't change exported tokens.
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
const text = glaze.color('#1a1a1a', { contrast: 'AA' });
|
|
400
|
+
const data = text.export();
|
|
401
|
+
const restored = glaze.colorFrom(data);
|
|
402
|
+
// restored.resolve() === text.resolve() byte-for-byte
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Both value-form and structured-form tokens round-trip.
|
|
406
|
+
|
|
407
|
+
### Pairing colors
|
|
408
|
+
|
|
409
|
+
Set `base` to anchor a standalone color to another standalone color or raw value. The WCAG contrast solver and relative `lightness` offsets switch their anchor from the literal seed to the base's resolved variant per scheme — so the same text color automatically lands at AA against its background in light, dark, and high-contrast modes.
|
|
410
|
+
|
|
411
|
+
```ts
|
|
412
|
+
const bg = glaze.color('#1a1a2e');
|
|
413
|
+
|
|
414
|
+
// Text guaranteed AA against `bg` in every scheme.
|
|
415
|
+
const text = glaze.color('#ffffff', { base: bg, contrast: 'AA' });
|
|
416
|
+
|
|
417
|
+
// Border 8 lightness units lighter than `bg` in each scheme.
|
|
418
|
+
const border = glaze.color('#000000', {
|
|
419
|
+
base: bg,
|
|
420
|
+
lightness: '+8',
|
|
421
|
+
mode: 'fixed',
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// Raw-value base — Glaze auto-wraps it via `glaze.color(value)`.
|
|
425
|
+
const text2 = glaze.color('#ffffff', { base: '#1a1a2e', contrast: 'AA' });
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Behavior with `base`:
|
|
429
|
+
|
|
430
|
+
- `contrast` is solved per scheme against `base`'s resolved variant (light / dark / lightContrast / darkContrast).
|
|
431
|
+
- Relative `lightness: '+N'` / `'-N'` is anchored to `base`'s lightness per scheme (matches theme behavior).
|
|
432
|
+
- Relative `hue: '+N'` / `'-N'` still anchors to the **seed** (the value passed to `glaze.color()`), not the base.
|
|
433
|
+
- `mode` works as a per-pair knob.
|
|
434
|
+
- The base token's `.resolve()` is called lazily on the first resolve of the dependent and the result is captured by reference; later mutations to the base don't apply.
|
|
435
|
+
- Raw-value bases inherit the same string-vs-object scaling defaults. To skip auto-invert on the base, wrap it yourself: `base: glaze.color(value, undefined, { darkLightness: false })`.
|
|
436
|
+
- When the contrast target is physically unreachable, `glaze` emits a single `console.warn` per `(name, scheme, target)` triple and returns the closest passing variant. Use the `name` override to make the warning identifiable.
|
|
437
|
+
|
|
438
|
+
Chains compose:
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
const bg = glaze.color('#000000');
|
|
442
|
+
const surface = glaze.color('#222222', { base: bg, contrast: 'AAA' });
|
|
443
|
+
const text = glaze.color('#ffffff', { base: surface, contrast: 'AA' });
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### `name` is a debug label
|
|
447
|
+
|
|
448
|
+
The `name` override appears in `console.warn` / Error messages but **does not** change output keys (`.token()`, `.tasty()`, `.json()`, `.css()` still use `''`, `light`, etc.). The CSS variable name comes from `css({ name })`, not from the override.
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## Shadows
|
|
453
|
+
|
|
454
|
+
### Defining shadow colors in a theme
|
|
455
|
+
|
|
456
|
+
```ts
|
|
457
|
+
theme.colors({
|
|
458
|
+
surface: { lightness: 95 },
|
|
459
|
+
text: { base: 'surface', lightness: '-52', contrast: 'AAA' },
|
|
460
|
+
|
|
461
|
+
'shadow-sm': { type: 'shadow', bg: 'surface', fg: 'text', intensity: 5 },
|
|
462
|
+
'shadow-md': { type: 'shadow', bg: 'surface', fg: 'text', intensity: 10 },
|
|
463
|
+
'shadow-lg': { type: 'shadow', bg: 'surface', fg: 'text', intensity: 20 },
|
|
464
|
+
});
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Shadow colors are included in all output methods (`tokens()`, `tasty()`, `css()`, `json()`) alongside regular colors and emit an alpha component:
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
'oklch(0.15 0.009 282 / 0.1)'
|
|
471
|
+
'rgb(34 28 42 / 0.1)'
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### How shadows work
|
|
475
|
+
|
|
476
|
+
1. **Contrast weight** — when `fg` is provided, shadow strength scales with `|l_bg − l_fg|`. Dark text on a light background produces a strong shadow; near-background-lightness elements produce barely visible shadows.
|
|
477
|
+
2. **Pigment color** — hue blended between fg and bg, low saturation, dark lightness.
|
|
478
|
+
3. **Alpha** — computed via a `tanh` curve that saturates smoothly toward `alphaMax` (default `1.0`), ensuring well-separated shadow levels even on dark backgrounds.
|
|
479
|
+
|
|
480
|
+
Omit `fg` for an achromatic shadow at full user-specified intensity:
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
theme.colors({
|
|
484
|
+
'drop-shadow': { type: 'shadow', bg: 'surface', intensity: 12 },
|
|
485
|
+
});
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
`intensity` supports `[normal, highContrast]` pairs:
|
|
489
|
+
|
|
490
|
+
```ts
|
|
491
|
+
'shadow-card': { type: 'shadow', bg: 'surface', fg: 'text', intensity: [10, 20] },
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### `ShadowTuning`
|
|
495
|
+
|
|
496
|
+
Fine-tune behavior per-color or globally via `glaze.configure({ shadowTuning })`. Per-color `tuning` is merged field-by-field with the global one.
|
|
497
|
+
|
|
498
|
+
| Parameter | Default | Description |
|
|
499
|
+
|---|---|---|
|
|
500
|
+
| `saturationFactor` | `0.18` | Fraction of fg saturation kept in pigment. |
|
|
501
|
+
| `maxSaturation` | `0.25` | Upper clamp on pigment saturation. |
|
|
502
|
+
| `lightnessFactor` | `0.25` | Multiplier for bg lightness → pigment lightness. |
|
|
503
|
+
| `lightnessBounds` | `[0.05, 0.20]` | Clamp range for pigment lightness. |
|
|
504
|
+
| `minGapTarget` | `0.05` | Target minimum gap between pigment and bg lightness. |
|
|
505
|
+
| `alphaMax` | `1.0` | Asymptotic maximum alpha. |
|
|
506
|
+
| `bgHueBlend` | `0.2` | Blend weight pulling pigment hue toward bg hue. `0` = pure fg hue, `1` = pure bg hue. |
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
theme.colors({
|
|
510
|
+
'shadow-soft': {
|
|
511
|
+
type: 'shadow', bg: 'surface', intensity: 10,
|
|
512
|
+
tuning: { alphaMax: 0.3, saturationFactor: 0.1 },
|
|
513
|
+
},
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
glaze.configure({
|
|
517
|
+
shadowTuning: { alphaMax: 0.5, bgHueBlend: 0.3 },
|
|
518
|
+
});
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Standalone shadow computation
|
|
522
|
+
|
|
523
|
+
`glaze.shadow(input)` computes a shadow outside of a theme. `bg` and `fg` accept any `GlazeColorValue`:
|
|
524
|
+
|
|
525
|
+
```ts
|
|
526
|
+
const v = glaze.shadow({
|
|
527
|
+
bg: '#f0eef5',
|
|
528
|
+
fg: '#1a1a2e',
|
|
529
|
+
intensity: 10,
|
|
530
|
+
});
|
|
531
|
+
// → { h: 280, s: 0.14, l: 0.2, alpha: 0.1 }
|
|
532
|
+
|
|
533
|
+
const css = glaze.format(v, 'oklch');
|
|
534
|
+
// → 'oklch(0.15 0.014 280 / 0.1)'
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
`GlazeShadowInput`:
|
|
538
|
+
|
|
539
|
+
| Field | Type | Description |
|
|
540
|
+
|---|---|---|
|
|
541
|
+
| `bg` | `GlazeColorValue` | Background. Any `GlazeColorValue` form. Alpha components dropped with warning. |
|
|
542
|
+
| `fg` | `GlazeColorValue` | Optional foreground. Same forms as `bg`. |
|
|
543
|
+
| `intensity` | `number` | 0–100. |
|
|
544
|
+
| `tuning` | `ShadowTuning` | Optional. |
|
|
545
|
+
|
|
546
|
+
### Fixed opacity (regular colors)
|
|
547
|
+
|
|
548
|
+
For a simple fixed-alpha color (no shadow algorithm), use `opacity` on a regular color:
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
theme.colors({
|
|
552
|
+
overlay: { lightness: 0, opacity: 0.5 },
|
|
553
|
+
});
|
|
554
|
+
// → 'oklch(0 0 0 / 0.5)'
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
## Mix colors
|
|
560
|
+
|
|
561
|
+
### Opaque mix
|
|
562
|
+
|
|
563
|
+
Produces a solid color by interpolating between `base` and `target`:
|
|
564
|
+
|
|
565
|
+
```ts
|
|
566
|
+
theme.colors({
|
|
567
|
+
surface: { lightness: 95 },
|
|
568
|
+
accent: { lightness: 30 },
|
|
569
|
+
tint: { type: 'mix', base: 'surface', target: 'accent', value: 30 },
|
|
570
|
+
});
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
- `value: 0` = pure base, `value: 100` = pure target.
|
|
574
|
+
- Result has alpha = 1.
|
|
575
|
+
- Adapts to light/dark/HC schemes automatically via the resolved base and target.
|
|
576
|
+
|
|
577
|
+
### Transparent mix
|
|
578
|
+
|
|
579
|
+
Produces the target color with controlled opacity — useful for hover overlays:
|
|
580
|
+
|
|
581
|
+
```ts
|
|
582
|
+
theme.colors({
|
|
583
|
+
surface: { lightness: 95 },
|
|
584
|
+
black: { lightness: 0, saturation: 0 },
|
|
585
|
+
hover: {
|
|
586
|
+
type: 'mix', base: 'surface', target: 'black',
|
|
587
|
+
value: 8, blend: 'transparent',
|
|
588
|
+
},
|
|
589
|
+
});
|
|
590
|
+
// hover → black with alpha = 0.08
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
The output color has `h`, `s`, `l` from the target and `alpha = value / 100`.
|
|
594
|
+
|
|
595
|
+
### Blend space (opaque only)
|
|
596
|
+
|
|
597
|
+
| `space` | Behavior | Best for |
|
|
598
|
+
|---|---|---|
|
|
599
|
+
| `'okhsl'` (default) | Perceptually uniform OKHSL interpolation. | Design token derivation. |
|
|
600
|
+
| `'srgb'` | Linear sRGB channel interpolation. | Matching browser compositing of CSS color-mix / overlay. |
|
|
601
|
+
|
|
602
|
+
Transparent blending always composites in linear sRGB (matches browser alpha compositing).
|
|
603
|
+
|
|
604
|
+
### Contrast solving on mixes
|
|
605
|
+
|
|
606
|
+
Mix colors support the same `contrast` prop as regular colors. The solver adjusts the mix ratio (opaque) or opacity (transparent) to meet the WCAG target:
|
|
607
|
+
|
|
608
|
+
```ts
|
|
609
|
+
'tint': {
|
|
610
|
+
type: 'mix', base: 'surface', target: 'accent',
|
|
611
|
+
value: 10, contrast: 'AA',
|
|
612
|
+
},
|
|
613
|
+
'overlay': {
|
|
614
|
+
type: 'mix', base: 'surface', target: 'accent',
|
|
615
|
+
value: 5, blend: 'transparent', contrast: 3,
|
|
616
|
+
},
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
Both `value` and `contrast` support `[normal, highContrast]` pairs.
|
|
620
|
+
|
|
621
|
+
### Achromatic colors
|
|
622
|
+
|
|
623
|
+
When mixing with achromatic colors (saturation near zero, e.g. white or black) in `okhsl` space, the hue comes from whichever color has saturation. Matches CSS `color-mix()` "missing component" behavior. For purely achromatic mixes prefer `space: 'srgb'` where hue is irrelevant.
|
|
624
|
+
|
|
625
|
+
### Mix chaining
|
|
626
|
+
|
|
627
|
+
Mix colors can reference other mix colors:
|
|
628
|
+
|
|
629
|
+
```ts
|
|
630
|
+
theme.colors({
|
|
631
|
+
white: { lightness: 100, saturation: 0 },
|
|
632
|
+
black: { lightness: 0, saturation: 0 },
|
|
633
|
+
gray: { type: 'mix', base: 'white', target: 'black', value: 50, space: 'srgb' },
|
|
634
|
+
lightGray: { type: 'mix', base: 'white', target: 'gray', value: 50, space: 'srgb' },
|
|
635
|
+
});
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Mix colors **cannot** reference shadow colors (same restriction as regular dependent colors).
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## Palette
|
|
643
|
+
|
|
644
|
+
`glaze.palette(themes, options?)` composes multiple themes into a single token namespace.
|
|
645
|
+
|
|
646
|
+
```ts
|
|
647
|
+
const palette = glaze.palette({ primary, danger, success, warning });
|
|
648
|
+
const palette = glaze.palette(
|
|
649
|
+
{ primary, danger, success },
|
|
650
|
+
{ primary: 'primary' },
|
|
651
|
+
);
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
`GlazePaletteOptions`:
|
|
655
|
+
|
|
656
|
+
| Option | Description |
|
|
657
|
+
|---|---|
|
|
658
|
+
| `primary` | Name of the primary theme. The primary's tokens are duplicated **without** prefix in all exports, providing convenient short aliases alongside the prefixed versions. Throws if the name doesn't match any theme. |
|
|
659
|
+
|
|
660
|
+
A `GlazePalette` exposes:
|
|
661
|
+
|
|
662
|
+
| Method | Description |
|
|
663
|
+
|---|---|
|
|
664
|
+
| `palette.tokens(options?)` | Flat token map grouped by scheme variant. |
|
|
665
|
+
| `palette.tasty(options?)` | Tasty style-to-state bindings. |
|
|
666
|
+
| `palette.json(options?)` | Per-theme JSON map (no prefix needed — keyed by theme name). |
|
|
667
|
+
| `palette.css(options?)` | CSS custom property declaration strings. |
|
|
668
|
+
|
|
669
|
+
### `GlazePaletteExportOptions`
|
|
670
|
+
|
|
671
|
+
Shared by `tokens`, `tasty`, and `css`:
|
|
672
|
+
|
|
673
|
+
| Option | Default | Description |
|
|
674
|
+
|---|---|---|
|
|
675
|
+
| `prefix` | `true` (= `"<themeName>-"`) | `false` disables prefixing. Or pass a custom map: `{ primary: 'brand-', danger: 'error-' }`. |
|
|
676
|
+
| `primary` | inherits from palette creation | `string` to override, `false` to disable for this call. |
|
|
677
|
+
|
|
678
|
+
Each export method also accepts its own format/options shape:
|
|
679
|
+
|
|
680
|
+
| Method | Additional options |
|
|
681
|
+
|---|---|
|
|
682
|
+
| `palette.tokens(options?)` | `format`, `modes` |
|
|
683
|
+
| `palette.tasty(options?)` | `format`, `modes`, `states` |
|
|
684
|
+
| `palette.css(options?)` | `format`, `suffix` |
|
|
685
|
+
|
|
686
|
+
`palette.css()` does not accept `modes`; it always returns all four CSS strings (`light`, `dark`, `lightContrast`, `darkContrast`).
|
|
687
|
+
|
|
688
|
+
### Prefix behavior
|
|
689
|
+
|
|
690
|
+
By default all palette tokens are prefixed:
|
|
691
|
+
|
|
692
|
+
```ts
|
|
693
|
+
palette.tokens();
|
|
694
|
+
// → {
|
|
695
|
+
// light: { 'primary-surface': 'okhsl(...)', 'danger-surface': 'okhsl(...)' },
|
|
696
|
+
// dark: { 'primary-surface': 'okhsl(...)', 'danger-surface': 'okhsl(...)' },
|
|
697
|
+
// }
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
Custom map (any theme not listed falls back to `"<themeName>-"`):
|
|
701
|
+
|
|
702
|
+
```ts
|
|
703
|
+
palette.tokens({ prefix: { primary: 'brand-', danger: 'error-' } });
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
Disable prefixing:
|
|
707
|
+
|
|
708
|
+
```ts
|
|
709
|
+
palette.tokens({ prefix: false });
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
### Collision detection
|
|
713
|
+
|
|
714
|
+
When two themes produce the same output key (via `prefix: false`, custom prefix maps, or primary unprefixed aliases), the **first-written value wins** and a `console.warn` is emitted:
|
|
715
|
+
|
|
716
|
+
```
|
|
717
|
+
glaze: token "surface" from theme "b" collides with theme "a" — skipping.
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Primary theme aliases
|
|
721
|
+
|
|
722
|
+
The primary theme's tokens are duplicated without prefix:
|
|
723
|
+
|
|
724
|
+
```ts
|
|
725
|
+
const palette = glaze.palette(
|
|
726
|
+
{ primary, danger, success },
|
|
727
|
+
{ primary: 'primary' },
|
|
728
|
+
);
|
|
729
|
+
palette.tokens();
|
|
730
|
+
// → {
|
|
731
|
+
// light: {
|
|
732
|
+
// 'primary-surface': 'okhsl(...)',
|
|
733
|
+
// 'danger-surface': 'okhsl(...)',
|
|
734
|
+
// 'success-surface': 'okhsl(...)',
|
|
735
|
+
// 'surface': 'okhsl(...)', // unprefixed alias
|
|
736
|
+
// },
|
|
737
|
+
// }
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
Override per-export:
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
palette.tokens({ primary: 'danger' });
|
|
744
|
+
palette.tokens({ primary: false });
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
The primary alias works alongside any prefix mode — when using a custom map, primary tokens are still duplicated without prefix:
|
|
748
|
+
|
|
749
|
+
```ts
|
|
750
|
+
palette.tokens({ prefix: { primary: 'p-', danger: 'd-' } });
|
|
751
|
+
// → 'p-surface' + 'surface' (alias) + 'd-surface'
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
### `palette.json()`
|
|
755
|
+
|
|
756
|
+
JSON export groups by theme name (no prefix needed):
|
|
757
|
+
|
|
758
|
+
```ts
|
|
759
|
+
palette.json();
|
|
760
|
+
// → {
|
|
761
|
+
// primary: { surface: { light: 'okhsl(...)', dark: 'okhsl(...)' } },
|
|
762
|
+
// danger: { surface: { light: 'okhsl(...)', dark: 'okhsl(...)' } },
|
|
763
|
+
// }
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
### `palette.css()`
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
const css = palette.css();
|
|
770
|
+
const stylesheet = `
|
|
771
|
+
:root { ${css.light} }
|
|
772
|
+
@media (prefers-color-scheme: dark) {
|
|
773
|
+
:root { ${css.dark} }
|
|
774
|
+
}
|
|
775
|
+
`;
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
`palette.css()` accepts the same `GlazeCssOptions` as `theme.css()` plus `GlazePaletteExportOptions`.
|
|
779
|
+
It does not accept `modes`; all four result fields are always returned.
|
|
780
|
+
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
## Output formats
|
|
784
|
+
|
|
785
|
+
Control the color format with the `format` option on any export method:
|
|
786
|
+
|
|
787
|
+
| Format | Output (alpha = 1) | Output (alpha < 1) | Notes |
|
|
788
|
+
|---|---|---|---|
|
|
789
|
+
| `'okhsl'` (default for tokens/tasty/json) | `okhsl(H S% L%)` | `okhsl(H S% L% / A)` | Glaze's native format, not a CSS function. |
|
|
790
|
+
| `'rgb'` (default for css) | `rgb(R G B)` | `rgb(R G B / A)` | Rounded integers, modern space syntax. |
|
|
791
|
+
| `'hsl'` | `hsl(H S% L%)` | `hsl(H S% L% / A)` | Modern space syntax. |
|
|
792
|
+
| `'oklch'` | `oklch(L C H)` | `oklch(L C H / A)` | OKLab-based LCH. |
|
|
793
|
+
|
|
794
|
+
```ts
|
|
795
|
+
theme.tokens(); // 'okhsl(280 60% 97%)'
|
|
796
|
+
theme.tokens({ format: 'rgb' }); // 'rgb(244 240 250)'
|
|
797
|
+
theme.tokens({ format: 'hsl' }); // 'hsl(270.5 45.2% 95.8%)'
|
|
798
|
+
theme.tokens({ format: 'oklch' }); // 'oklch(0.965 0.0123 280)'
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
All numeric output strips trailing zeros for cleaner CSS (e.g. `95` not `95.0`).
|
|
802
|
+
|
|
803
|
+
The `format` option works on every export: `theme.tokens()`, `theme.tasty()`, `theme.json()`, `theme.css()`, the same on `palette`, and on `token.token()` / `.tasty()` / `.json()` / `.css()`.
|
|
804
|
+
|
|
805
|
+
---
|
|
806
|
+
|
|
807
|
+
## Adaptation modes
|
|
808
|
+
|
|
809
|
+
`mode` controls how a color adapts across schemes:
|
|
810
|
+
|
|
811
|
+
| Mode | Behavior |
|
|
812
|
+
|---|---|
|
|
813
|
+
| `'auto'` (default) | Full adaptation. Light ↔ dark inversion via the Möbius curve. High-contrast boost. |
|
|
814
|
+
| `'fixed'` | Color stays recognizable. Lightness is *mapped* (not inverted) into the dark window. Use for brand buttons, CTAs, status banners. |
|
|
815
|
+
| `'static'` | No adaptation. Same value in every scheme. |
|
|
816
|
+
|
|
817
|
+
### How relative lightness adapts
|
|
818
|
+
|
|
819
|
+
**`auto`** — relative lightness sign flips in dark scheme:
|
|
820
|
+
|
|
821
|
+
```
|
|
822
|
+
Light: surface L=97, text lightness='-52' → L=45 (dark text on light bg)
|
|
823
|
+
Dark: surface inverts to L≈20 (Möbius), sign flips → L=20+52=72
|
|
824
|
+
contrast solver may push further (light text on dark bg)
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
**`fixed`** — lightness is mapped (not inverted), relative sign preserved:
|
|
828
|
+
|
|
829
|
+
```
|
|
830
|
+
Light: accent-fill L=52, accent-text lightness='+48' → L=100 (white on brand)
|
|
831
|
+
Dark: accent-fill maps to L≈51.6, sign preserved → L≈99.6
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
**`static`** — no adaptation, same value in every scheme.
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
## Light / dark scheme mapping
|
|
839
|
+
|
|
840
|
+
### Light scheme — lightness
|
|
841
|
+
|
|
842
|
+
Absolute lightness values (root colors and dependent colors with absolute lightness) are mapped linearly within the configured `lightLightness` window:
|
|
843
|
+
|
|
844
|
+
```ts
|
|
845
|
+
const [lo, hi] = lightLightness; // default: [10, 100]
|
|
846
|
+
const mappedL = (lightness * (hi - lo)) / 100 + lo;
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
Both `auto` and `fixed` modes use the same linear formula. `static` mode and HC variants bypass the mapping (identity: `mappedL = l`).
|
|
850
|
+
|
|
851
|
+
| Color | Raw L | Mapped L (default `[10, 100]`) |
|
|
852
|
+
|---|---|---|
|
|
853
|
+
| surface (L=97) | 97 | 97.3 |
|
|
854
|
+
| accent-fill (L=52) | 52 | 56.8 |
|
|
855
|
+
| near-black (L=0) | 0 | 10 |
|
|
856
|
+
|
|
857
|
+
### Dark scheme — lightness
|
|
858
|
+
|
|
859
|
+
**`auto`** — inverted with a Möbius transformation within the configured window:
|
|
860
|
+
|
|
861
|
+
```ts
|
|
862
|
+
const [lo, hi] = darkLightness; // default: [15, 95]
|
|
863
|
+
const t = (100 - lightness) / 100;
|
|
864
|
+
const invertedL = lo + (hi - lo) * t / (t + darkCurve * (1 - t));
|
|
865
|
+
// darkCurve default: 0.5
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
The `darkCurve` parameter (default `0.5`, range 0–1) controls how much the dark-mode inversion expands lightness deltas. Lower values produce stronger expansion; `1` gives linear (legacy) behavior. Accepts `[normal, highContrast]` pairs (e.g. `darkCurve: [0.5, 0.3]`).
|
|
869
|
+
|
|
870
|
+
Unlike a power curve, the Möbius transformation provides **proportional expansion** — small and large deltas are scaled by similar ratios, preserving the visual hierarchy of the light theme.
|
|
871
|
+
|
|
872
|
+
**`fixed`** — mapped without inversion (not affected by `darkCurve`):
|
|
873
|
+
|
|
874
|
+
```ts
|
|
875
|
+
const mappedL = (lightness * (hi - lo)) / 100 + lo;
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
| Color | Light L | Auto (curve=0.5) | Auto (curve=1, linear) | Fixed (mapped) |
|
|
879
|
+
|---|---|---|---|---|
|
|
880
|
+
| surface (L=97) | 97 | 19.7 | 17.4 | 92.6 |
|
|
881
|
+
| accent-fill (L=52) | 52 | 66.9 | 53.4 | 56.6 |
|
|
882
|
+
| accent-text (L=100) | 100 | 15 | 15 | 95 |
|
|
883
|
+
|
|
884
|
+
In high-contrast variants the `darkLightness` window is bypassed — `auto` uses the Möbius curve over the full `[0, 100]` range, `fixed` uses identity.
|
|
885
|
+
|
|
886
|
+
### Dark scheme — saturation
|
|
887
|
+
|
|
888
|
+
`darkDesaturation` reduces saturation for all colors in dark scheme:
|
|
889
|
+
|
|
890
|
+
```ts
|
|
891
|
+
S_dark = S_light * (1 - darkDesaturation) // default: 0.1
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
`static` mode skips desaturation.
|
|
895
|
+
|
|
896
|
+
---
|
|
897
|
+
|
|
898
|
+
## Configuration
|
|
899
|
+
|
|
900
|
+
```ts
|
|
901
|
+
glaze.configure({
|
|
902
|
+
lightLightness: [10, 100],
|
|
903
|
+
darkLightness: [15, 95],
|
|
904
|
+
darkDesaturation: 0.1,
|
|
905
|
+
darkCurve: 0.5, // or [normal, hc] pair
|
|
906
|
+
states: {
|
|
907
|
+
dark: '@dark',
|
|
908
|
+
highContrast: '@high-contrast',
|
|
909
|
+
},
|
|
910
|
+
modes: {
|
|
911
|
+
dark: true,
|
|
912
|
+
highContrast: false,
|
|
913
|
+
},
|
|
914
|
+
shadowTuning: {
|
|
915
|
+
alphaMax: 0.6,
|
|
916
|
+
bgHueBlend: 0.2,
|
|
917
|
+
},
|
|
918
|
+
});
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
`GlazeConfig`:
|
|
922
|
+
|
|
923
|
+
| Field | Default | Description |
|
|
924
|
+
|---|---|---|
|
|
925
|
+
| `lightLightness` | `[10, 100]` | Light scheme lightness window `[lo, hi]`. Bypassed in HC. |
|
|
926
|
+
| `darkLightness` | `[15, 95]` | Dark scheme lightness window. Bypassed in HC. |
|
|
927
|
+
| `darkDesaturation` | `0.1` | Saturation reduction in dark scheme (0–1). |
|
|
928
|
+
| `darkCurve` | `0.5` | Möbius beta for dark `auto`-inversion (0–1). Accepts `[normal, hc]` pair. |
|
|
929
|
+
| `states.dark` | `'@dark'` | State alias for dark mode tokens (Tasty export). |
|
|
930
|
+
| `states.highContrast` | `'@high-contrast'` | State alias for HC tokens. |
|
|
931
|
+
| `modes.dark` | `true` | Include dark variants in exports. |
|
|
932
|
+
| `modes.highContrast` | `false` | Include HC variants. |
|
|
933
|
+
| `shadowTuning` | `undefined` | Default tuning for all shadow colors. Per-color tuning merges field-by-field. |
|
|
934
|
+
|
|
935
|
+
| Method | Description |
|
|
936
|
+
|---|---|
|
|
937
|
+
| `glaze.configure(config)` | Merge into the global config. Bumps a config version that invalidates theme caches. |
|
|
938
|
+
| `glaze.getConfig()` | Snapshot the current resolved config (shallow copy). |
|
|
939
|
+
| `glaze.resetConfig()` | Reset to defaults (also bumps the version counter). |
|
|
940
|
+
|
|
941
|
+
Standalone `glaze.color()` tokens snapshot the relevant fields at create time, so later `configure()` calls don't change already-created tokens.
|
|
942
|
+
|
|
943
|
+
---
|
|
944
|
+
|
|
945
|
+
## Output modes
|
|
946
|
+
|
|
947
|
+
Control which scheme variants appear in `tokens()` / `tasty()` / `json()` exports:
|
|
948
|
+
|
|
949
|
+
```ts
|
|
950
|
+
// Light only
|
|
951
|
+
palette.tokens({ modes: { dark: false, highContrast: false } });
|
|
952
|
+
|
|
953
|
+
// Light + dark (default)
|
|
954
|
+
palette.tokens({ modes: { highContrast: false } });
|
|
955
|
+
|
|
956
|
+
// All four variants
|
|
957
|
+
palette.tokens({ modes: { dark: true, highContrast: true } });
|
|
958
|
+
// → { light, dark, lightContrast, darkContrast }
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
Resolution priority (highest first):
|
|
962
|
+
|
|
963
|
+
1. Per-call `modes` option on `tokens` / `tasty` / `json`.
|
|
964
|
+
2. `glaze.configure({ modes })` — global config.
|
|
965
|
+
3. Built-in default: `{ dark: true, highContrast: false }`.
|
|
966
|
+
|
|
967
|
+
---
|
|
968
|
+
|
|
969
|
+
## Validation
|
|
970
|
+
|
|
971
|
+
| Condition | Behavior |
|
|
972
|
+
|---|---|
|
|
973
|
+
| `contrast` without `base` | Validation error |
|
|
974
|
+
| Relative `lightness` without `base` | Validation error |
|
|
975
|
+
| `lightness` resolves outside 0–100 | Clamp silently |
|
|
976
|
+
| `saturation` outside 0–1 | Clamp silently |
|
|
977
|
+
| Circular `base` references | Validation error |
|
|
978
|
+
| `base` references non-existent name | Validation error |
|
|
979
|
+
| Shadow `bg` references non-existent color | Validation error |
|
|
980
|
+
| Shadow `fg` references non-existent color | Validation error |
|
|
981
|
+
| Shadow `bg` references another shadow color | Validation error |
|
|
982
|
+
| Shadow `fg` references another shadow color | Validation error |
|
|
983
|
+
| Regular color `base` references a shadow color | Validation error |
|
|
984
|
+
| Shadow `intensity` outside 0–100 | Clamp silently |
|
|
985
|
+
| `contrast` + `opacity` combined | `console.warn` |
|
|
986
|
+
| Mix `base` references non-existent color | Validation error |
|
|
987
|
+
| Mix `target` references non-existent color | Validation error |
|
|
988
|
+
| Mix `base` references a shadow color | Validation error |
|
|
989
|
+
| Mix `target` references a shadow color | Validation error |
|
|
990
|
+
| Mix `value` outside 0–100 | Clamp silently |
|
|
991
|
+
| Circular references involving mix colors | Validation error |
|
|
992
|
+
| Contrast target physically unreachable | `console.warn` (deduped per `(name, scheme, target)`); closest passing variant returned |
|
|
993
|
+
|
|
994
|
+
---
|
|
995
|
+
|
|
996
|
+
## Color math utilities
|
|
997
|
+
|
|
998
|
+
For advanced use, Glaze re-exports its internal color math.
|
|
999
|
+
|
|
1000
|
+
### Conversions
|
|
1001
|
+
|
|
1002
|
+
```ts
|
|
1003
|
+
import {
|
|
1004
|
+
okhslToLinearSrgb,
|
|
1005
|
+
okhslToSrgb,
|
|
1006
|
+
okhslToOklab,
|
|
1007
|
+
oklabToOkhsl,
|
|
1008
|
+
srgbToOkhsl,
|
|
1009
|
+
hslToSrgb,
|
|
1010
|
+
parseHex,
|
|
1011
|
+
parseHexAlpha,
|
|
1012
|
+
relativeLuminanceFromLinearRgb,
|
|
1013
|
+
contrastRatioFromLuminance,
|
|
1014
|
+
gamutClampedLuminance,
|
|
1015
|
+
} from '@tenphi/glaze';
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
| Function | Description |
|
|
1019
|
+
|---|---|
|
|
1020
|
+
| `okhslToLinearSrgb(h, s, l)` | OKHSL (h: 0–360, s/l: 0–1) → linear sRGB tuple. |
|
|
1021
|
+
| `okhslToSrgb(h, s, l)` | OKHSL → gamma-encoded sRGB tuple (0–1 per channel). |
|
|
1022
|
+
| `okhslToOklab([h, s, l])` | OKHSL → OKLab `[L, a, b]`. |
|
|
1023
|
+
| `oklabToOkhsl([L, a, b])` | OKLab → OKHSL. |
|
|
1024
|
+
| `srgbToOkhsl([r, g, b])` | Gamma sRGB (0–1) → OKHSL. |
|
|
1025
|
+
| `hslToSrgb(h, s, l)` | CSS HSL → sRGB tuple. |
|
|
1026
|
+
| `parseHex(hex)` | Parse `#rgb` / `#rrggbb` to sRGB tuple. Returns `null` on invalid input. |
|
|
1027
|
+
| `parseHexAlpha(hex)` | Parse `#rgb` / `#rrggbb` / `#rrggbbaa`; returns `[r, g, b, a?]`. |
|
|
1028
|
+
| `relativeLuminanceFromLinearRgb(rgb)` | WCAG relative luminance from linear sRGB. |
|
|
1029
|
+
| `contrastRatioFromLuminance(yA, yB)` | WCAG contrast ratio from two luminances. |
|
|
1030
|
+
| `gamutClampedLuminance(linearRgb)` | Relative luminance with channel clamping for out-of-gamut colors. |
|
|
1031
|
+
|
|
1032
|
+
### Format writers
|
|
1033
|
+
|
|
1034
|
+
```ts
|
|
1035
|
+
import { formatOkhsl, formatRgb, formatHsl, formatOklch } from '@tenphi/glaze';
|
|
1036
|
+
|
|
1037
|
+
formatOkhsl(280, 60, 95); // 'okhsl(280 60% 95%)'
|
|
1038
|
+
formatRgb(280, 60, 95); // 'rgb(244 240 250)'
|
|
1039
|
+
formatHsl(280, 60, 95); // 'hsl(280 60% 95%)'
|
|
1040
|
+
formatOklch(280, 60, 95); // 'oklch(0.95 ... 280)'
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
To attach an alpha component, use `glaze.format(variant, format)` on a `ResolvedColorVariant` (which carries the `alpha` channel) instead of these raw writers.
|
|
1044
|
+
|
|
1045
|
+
### Contrast solver
|
|
1046
|
+
|
|
1047
|
+
```ts
|
|
1048
|
+
import {
|
|
1049
|
+
findLightnessForContrast,
|
|
1050
|
+
findValueForMixContrast,
|
|
1051
|
+
resolveMinContrast,
|
|
1052
|
+
} from '@tenphi/glaze';
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
| Function | Description |
|
|
1056
|
+
|---|---|
|
|
1057
|
+
| `findLightnessForContrast(opts)` | Binary-search for the OKHSL lightness that meets a WCAG contrast floor against a base color. Returns `{ lightness, contrast, met, branch }`. |
|
|
1058
|
+
| `findValueForMixContrast(opts)` | Same, but searches for a mix `value` (0–1) that meets a contrast floor between a base and a target. |
|
|
1059
|
+
| `resolveMinContrast(value)` | Resolves a `MinContrast` (preset or number) to a numeric ratio. |
|
|
1060
|
+
|
|
1061
|
+
`findLightnessForContrast` options:
|
|
1062
|
+
|
|
1063
|
+
| Option | Default | Description |
|
|
1064
|
+
|---|---|---|
|
|
1065
|
+
| `hue` | — | Candidate hue (0–360). |
|
|
1066
|
+
| `saturation` | — | Candidate saturation (0–1). |
|
|
1067
|
+
| `preferredLightness` | — | Preferred candidate lightness (0–1). Kept if it already meets the target. |
|
|
1068
|
+
| `baseLinearRgb` | — | Base color as linear sRGB tuple. |
|
|
1069
|
+
| `contrast` | — | WCAG floor (`MinContrast`). |
|
|
1070
|
+
| `lightnessRange` | `[0, 1]` | Search bounds. |
|
|
1071
|
+
| `epsilon` | `1e-4` | Convergence threshold. |
|
|
1072
|
+
| `maxIterations` | `14` | Max binary-search iterations per branch. |
|
|
1073
|
+
|
|
1074
|
+
Result: `{ lightness, contrast, met, branch: 'lighter' | 'darker' | 'preferred' }`.
|