@cube-dev/ui-kit 0.152.0 → 0.154.0
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 +17 -0
- package/dist/CHANGELOG.md +111 -0
- package/dist/README.md +17 -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 +3 -2
- package/dist/components/GlobalStyles.js.map +1 -1
- package/dist/components/GridProvider.js +1 -1
- package/dist/components/HiddenInput.js +1 -1
- package/dist/components/Root.d.ts +16 -0
- package/dist/components/Root.js +7 -3
- package/dist/components/Root.js.map +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/InfoBadge/InfoBadge.js +1 -1
- package/dist/components/content/InlineInput/InlineInput.js +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.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/TreeNode.js.map +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.d.ts +2 -2
- package/dist/components/fields/Checkbox/Checkbox.js +2 -2
- package/dist/components/fields/Checkbox/Checkbox.js.map +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/CommandTextArea/CommandTextArea.js +1 -1
- package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
- package/dist/components/fields/CommandTextArea/useCaretAnchor.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/MonthPicker.d.ts +12 -0
- package/dist/components/fields/DatePicker/MonthPicker.js +19 -0
- package/dist/components/fields/DatePicker/MonthPicker.js.map +1 -0
- package/dist/components/fields/DatePicker/PeriodPicker.d.ts +28 -0
- package/dist/components/fields/DatePicker/PeriodPicker.js +131 -0
- package/dist/components/fields/DatePicker/PeriodPicker.js.map +1 -0
- package/dist/components/fields/DatePicker/QuarterPicker.d.ts +12 -0
- package/dist/components/fields/DatePicker/QuarterPicker.js +19 -0
- package/dist/components/fields/DatePicker/QuarterPicker.js.map +1 -0
- package/dist/components/fields/DatePicker/TimeInput.js +1 -1
- package/dist/components/fields/DatePicker/WeekPicker.d.ts +12 -0
- package/dist/components/fields/DatePicker/WeekPicker.js +19 -0
- package/dist/components/fields/DatePicker/WeekPicker.js.map +1 -0
- package/dist/components/fields/DatePicker/YearPicker.d.ts +12 -0
- package/dist/components/fields/DatePicker/YearPicker.js +19 -0
- package/dist/components/fields/DatePicker/YearPicker.js.map +1 -0
- package/dist/components/fields/DatePicker/index.d.ts +7 -1
- package/dist/components/fields/DatePicker/parseDate.js +1 -1
- package/dist/components/fields/DatePicker/period.d.ts +35 -0
- package/dist/components/fields/DatePicker/period.js +58 -0
- package/dist/components/fields/DatePicker/period.js.map +1 -0
- 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/ListBoxPopover/ListBoxPopover.js +1 -1
- package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
- package/dist/components/fields/ListBoxPopover/useCompositeFocus.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 +2 -2
- package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
- package/dist/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/fields/RadioGroup/context.js +1 -1
- package/dist/components/fields/SearchComboBox/SearchComboBox.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.d.ts +2 -2
- package/dist/components/fields/Switch/Switch.js +1 -1
- package/dist/components/fields/Switch/Switch.js.map +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/fields/index.d.ts +6 -0
- package/dist/components/form/FieldWrapper/FieldWrapper.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/validation/ValidationIndicator.js +1 -1
- package/dist/components/form/validation/resolve-validation-props.js +1 -1
- package/dist/components/form/validation/use-validation-props.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/Board/Board.js +1 -1
- package/dist/components/layout/Board/BoardProvider.js +1 -1
- package/dist/components/layout/Board/BoardResponsive.js +1 -1
- package/dist/components/layout/Board/Widget.js +1 -1
- package/dist/components/layout/Board/WidgetHost.js +1 -1
- package/dist/components/layout/Board/board-context.js +1 -1
- package/dist/components/layout/Board/board-store.js +1 -1
- package/dist/components/layout/Board/grid-core/calculate.js +1 -1
- package/dist/components/layout/Board/grid-core/collision.js +1 -1
- package/dist/components/layout/Board/grid-core/compactors.js +1 -1
- package/dist/components/layout/Board/grid-core/constraints.js +1 -1
- package/dist/components/layout/Board/grid-core/layout.js +1 -1
- package/dist/components/layout/Board/grid-core/sort.js +1 -1
- package/dist/components/layout/Board/index.js +1 -1
- package/dist/components/layout/Board/responsive-utils.js +1 -1
- package/dist/components/layout/Board/use-board-layout.js +1 -1
- package/dist/components/layout/Board/use-board-registry.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 +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/popover-placement.js +1 -1
- package/dist/components/navigation/Tabs/styled.js +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 +12 -3
- package/dist/components/other/Calendar/Calendar.js.map +1 -1
- package/dist/components/other/Calendar/CalendarCell.js +4 -2
- package/dist/components/other/Calendar/CalendarCell.js.map +1 -1
- package/dist/components/other/Calendar/CalendarGrid.js +35 -13
- package/dist/components/other/Calendar/CalendarGrid.js.map +1 -1
- package/dist/components/other/Calendar/PeriodCalendar.js +229 -0
- package/dist/components/other/Calendar/PeriodCalendar.js.map +1 -0
- package/dist/components/other/Calendar/RangeCalendar.js +1 -1
- package/dist/components/other/CubeLogo/CubeLogo.d.ts +10 -3
- package/dist/components/other/CubeLogo/CubeLogo.js +31 -4
- package/dist/components/other/CubeLogo/CubeLogo.js.map +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 +1 -1
- package/dist/data/themes.d.ts +5 -5
- package/dist/data/themes.js +6 -6
- package/dist/data/themes.js.map +1 -1
- package/dist/eslint-plugin/defaults.generated.js +1 -1
- package/dist/eslint-plugin/index.js +1 -1
- package/dist/eslint-plugin/rules/no-redundant-default-prop.js +1 -1
- package/dist/i18n/I18nProvider.js +1 -1
- package/dist/i18n/createFormatter.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/locales/de-DE/uikit.js +1 -1
- package/dist/i18n/locales/en-US/uikit.js +1 -1
- package/dist/i18n/locales/es-ES/uikit.js +1 -1
- package/dist/i18n/locales/es-MX/uikit.js +1 -1
- package/dist/i18n/locales/fr-FR/uikit.js +1 -1
- package/dist/i18n/locales/it-IT/uikit.js +1 -1
- package/dist/i18n/locales/ja-JP/uikit.js +1 -1
- package/dist/i18n/locales/nb-NO/uikit.js +1 -1
- package/dist/i18n/locales/pt-BR/uikit.js +1 -1
- package/dist/i18n/locales/pt-PT/uikit.js +1 -1
- package/dist/i18n/locales/sv-SE/uikit.js +1 -1
- package/dist/i18n/locales/vi-VN/uikit.js +1 -1
- package/dist/i18n/locales.js +1 -1
- package/dist/i18n/useFormatter.js +1 -1
- package/dist/i18n/useI18n.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.d.ts +12 -5
- package/dist/index.js +12 -5
- package/dist/index.js.map +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/shared/form.d.ts +27 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/tokens/base.js +1 -1
- package/dist/tokens/colors.d.ts +41 -2
- package/dist/tokens/colors.js +77 -9
- package/dist/tokens/colors.js.map +1 -1
- package/dist/tokens/index.d.ts +3 -2
- package/dist/tokens/index.js +23 -16
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/layout.js +1 -1
- package/dist/tokens/lazy-styles.js +10 -6
- package/dist/tokens/lazy-styles.js.map +1 -1
- package/dist/tokens/palette-config.d.ts +222 -0
- package/dist/tokens/palette-config.js +309 -0
- package/dist/tokens/palette-config.js.map +1 -0
- package/dist/tokens/palette.d.ts +45 -5
- package/dist/tokens/palette.js +578 -405
- 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 +3 -3
- package/docs/Colors.md +4 -0
- package/docs/Theming.md +375 -0
- package/docs/Usage.md +30 -3
- package/docs/components/Root.md +1 -0
- package/docs/components/fields/PeriodPicker.md +75 -0
- package/docs/components/other/CubeLogo.md +27 -1
- package/docs/glaze/api.md +156 -8
- package/docs/glaze/methodology.md +21 -1
- package/docs/glaze/okhst.md +13 -0
- package/docs/tasty/README.md +1 -0
- package/docs/tasty/ai-agents.md +206 -0
- package/docs/tasty/injector.md +15 -0
- package/docs/tasty/react-api.md +21 -2
- package/package.json +3 -3
package/docs/glaze/api.md
CHANGED
|
@@ -10,6 +10,7 @@ Full reference for every public method, option, and type exported by `@tenphi/gl
|
|
|
10
10
|
- [DTCG Resolver-Module](#themedtcgresolveroptions)
|
|
11
11
|
- [Tailwind CSS](#themetailwindoptions)
|
|
12
12
|
- [High-contrast pairs](#high-contrast-pairs)
|
|
13
|
+
- [Manual contrast level](#manual-contrast-level)
|
|
13
14
|
- [Color definitions](#color-definitions)
|
|
14
15
|
- [Dark seed](#dark-seed-darkhue--darksaturation)
|
|
15
16
|
- [Standalone color tokens](#standalone-color-tokens)
|
|
@@ -408,6 +409,144 @@ promotion for that color.
|
|
|
408
409
|
|
|
409
410
|
---
|
|
410
411
|
|
|
412
|
+
## Manual contrast level
|
|
413
|
+
|
|
414
|
+
`contrastLevel` turns contrast from a two-tier switch into a `0–100` slider.
|
|
415
|
+
It is a config field, so it works globally, per theme, per token, and through
|
|
416
|
+
`extend()`:
|
|
417
|
+
|
|
418
|
+
```ts
|
|
419
|
+
glaze.configure({ contrastLevel: 60 });
|
|
420
|
+
const theme = glaze(280, 80, { contrastLevel: 60 });
|
|
421
|
+
glaze.color('#26fcb2', { contrastLevel: 60 });
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
| Value | Meaning |
|
|
425
|
+
| ---------------- | -------------------------------------------------------------------- |
|
|
426
|
+
| `'auto'` | Default. The two-tier model: normal variants plus a high-contrast tier. |
|
|
427
|
+
| `0` | Normal contrast, with **no** high-contrast tier. |
|
|
428
|
+
| `100` | The high-contrast scheme as the only scheme. |
|
|
429
|
+
| anything between | Resolved *at* that level. |
|
|
430
|
+
|
|
431
|
+
Levels `0` and `100` reproduce the classic `light` / `dark` and
|
|
432
|
+
`lightContrast` / `darkContrast` output **bit for bit**.
|
|
433
|
+
|
|
434
|
+
### What the level interpolates
|
|
435
|
+
|
|
436
|
+
Exactly the three things that make a high-contrast variant differ from its
|
|
437
|
+
normal counterpart:
|
|
438
|
+
|
|
439
|
+
| Mechanism | At level `L` |
|
|
440
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
441
|
+
| Authored `HCPair`s — `tone`, `contrast`, shadow `intensity`, mix `value` | the two ends are interpolated |
|
|
442
|
+
| The tone-window bypass | each endpoint moves toward the full range: light `10→0`, dark `15→0 / 95→100` |
|
|
443
|
+
| Contrast escalation — `AA → AAA`, APCA `+15 Lc` | the two numeric targets are interpolated (`AA` at level 50 solves for 5.75) |
|
|
444
|
+
|
|
445
|
+
The interpolated values are then fed through the ordinary resolve, so a
|
|
446
|
+
contrast floor at any level is **solved**, not approximated, and `autoFlip`
|
|
447
|
+
decides once per level.
|
|
448
|
+
|
|
449
|
+
Everything that does not vary by high contrast today — hue, saturation,
|
|
450
|
+
`darkDesaturation`, `opacity`, `pastel` — is unaffected by the level.
|
|
451
|
+
|
|
452
|
+
### Un-interpolable tone pairs switch at 50
|
|
453
|
+
|
|
454
|
+
Two ends of different kinds have no midpoint, because blending them would
|
|
455
|
+
change *which* resolution rule applies partway up the ramp. These switch from
|
|
456
|
+
the normal entry to the high-contrast one at level 50:
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
tone: [50, 'max']; // absolute vs. extreme
|
|
460
|
+
tone: [50, '+20']; // absolute vs. relative
|
|
461
|
+
tone: ['max', 'min']; // opposite extremes
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Same-kind pairs (`[30, 20]`, `['-6', '-12']`, `{ wcag: [4.5, 7] }`,
|
|
465
|
+
`[{ apca: 60 }, { apca: 90 }]`) interpolate smoothly.
|
|
466
|
+
|
|
467
|
+
A `contrast` pair may **not** switch metric — `[4.5, { apca: 75 }]` throws. A
|
|
468
|
+
WCAG ratio and an APCA Lc are different scales, so no target exists between
|
|
469
|
+
them, and even in `'auto'` mode the two variants would be incomparable. Pair
|
|
470
|
+
values inside one metric instead: `{ wcag: [4.5, 7] }` or `{ apca: [60, 90] }`.
|
|
471
|
+
|
|
472
|
+
### A color never swaps sides mid-slider
|
|
473
|
+
|
|
474
|
+
[`autoFlip`](#autoflip) decides per solve, and its tie-break — when both
|
|
475
|
+
directions meet the floor, take the one nearer the authored tone — depends on
|
|
476
|
+
the target. Along a ramp of targets that criterion shifts, so a naive
|
|
477
|
+
implementation lets a color leap across its own base as the slider moves.
|
|
478
|
+
|
|
479
|
+
Under a manual level the side is instead decided once, from the nearer
|
|
480
|
+
endpoint's target, and preferred at every level in that half of the ramp.
|
|
481
|
+
Consequences:
|
|
482
|
+
|
|
483
|
+
- A color whose two ends land on the same side of its base **never** changes
|
|
484
|
+
side, at any level.
|
|
485
|
+
- A color whose ends genuinely disagree — no single side can satisfy both its
|
|
486
|
+
normal and its high-contrast floor — changes side exactly once, at level 50,
|
|
487
|
+
the same place un-interpolable tone pairs switch.
|
|
488
|
+
- Flipping is not disabled, only re-ordered, so a side that physically cannot
|
|
489
|
+
reach the requested contrast still falls back to the opposite one. The floor
|
|
490
|
+
is met at every level.
|
|
491
|
+
|
|
492
|
+
The underlying solver option is `preferInitial` on
|
|
493
|
+
[`findToneForContrast`](#contrast-solver), should you need the same behavior
|
|
494
|
+
directly.
|
|
495
|
+
|
|
496
|
+
### High-contrast output
|
|
497
|
+
|
|
498
|
+
A manual level already carries the contrast preference, so there is no second
|
|
499
|
+
tier to emit:
|
|
500
|
+
|
|
501
|
+
- `resolve()` still returns four variants, but `lightContrast` / `darkContrast`
|
|
502
|
+
**mirror** `light` / `dark`.
|
|
503
|
+
- A **global** level turns high-contrast output off outright, so
|
|
504
|
+
`tokens()` / `tasty()` / `json()` / `dtcg()` / `dtcgResolver()` / `tailwind()`
|
|
505
|
+
emit no high-contrast tier. `modes.highContrast` goes inert — it reads as
|
|
506
|
+
"emit a separate high-contrast set *when* contrast is automatic" — so leaving
|
|
507
|
+
`highContrast: true` set in a build config while a user switches their
|
|
508
|
+
preference from auto to manual is fine, and silent.
|
|
509
|
+
- `css()` always returns four strings and ignores `modes`, so its
|
|
510
|
+
`lightContrast` / `darkContrast` strings repeat the normal declarations —
|
|
511
|
+
an existing `@media (prefers-contrast: more)` block keeps matching the base
|
|
512
|
+
block as the level changes, with nothing to rewire.
|
|
513
|
+
- A level on a **single theme or token** does not change which modes are
|
|
514
|
+
emitted. Sibling themes in a palette keep their real high-contrast tier, and
|
|
515
|
+
the manual one reports its own resolved values there.
|
|
516
|
+
|
|
517
|
+
### Driving it at runtime
|
|
518
|
+
|
|
519
|
+
`configure()` bumps the config version, which invalidates every theme and token
|
|
520
|
+
cache, so a slider only needs to re-export:
|
|
521
|
+
|
|
522
|
+
```ts
|
|
523
|
+
slider.oninput = () => {
|
|
524
|
+
glaze.configure({ contrastLevel: slider.valueAsNumber });
|
|
525
|
+
apply(theme.css());
|
|
526
|
+
};
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Because a manual level skips the two high-contrast passes, a manual resolve is
|
|
530
|
+
also half the work of an `'auto'` one.
|
|
531
|
+
|
|
532
|
+
### Clearing it, exporting it, base links
|
|
533
|
+
|
|
534
|
+
- **`configure()` never clears a field by omission.** Pass `'auto'` explicitly
|
|
535
|
+
to leave manual mode — globally, or on one theme of a palette.
|
|
536
|
+
- **`.export()` freezes only an *authored* level.** A level set on the instance
|
|
537
|
+
(or passed to `.export()`) is authored intent and is written to the snapshot;
|
|
538
|
+
a level merely inherited from the global config is a live user preference and
|
|
539
|
+
is left out, so a restored theme still follows the current slider. This
|
|
540
|
+
matches how `modes` and `states` are treated.
|
|
541
|
+
- **Set the level globally, or on both sides of a base link.** A per-token level
|
|
542
|
+
on a dependent but not on its base anchors the two at different levels — the
|
|
543
|
+
same caveat as a per-instance `lightTone` override.
|
|
544
|
+
|
|
545
|
+
`resolveContrastForLevel(spec, level, polarity?)` is exported for advanced use;
|
|
546
|
+
see [Contrast solver](#contrast-solver).
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
411
550
|
## Color definitions
|
|
412
551
|
|
|
413
552
|
`ColorDef` is a discriminated union:
|
|
@@ -490,7 +629,7 @@ type ContrastSpec =
|
|
|
490
629
|
| number // bare WCAG ratio
|
|
491
630
|
| ContrastPreset // named WCAG preset
|
|
492
631
|
| { wcag: HCPair<number | ContrastPreset> }
|
|
493
|
-
| { apca: HCPair<number> }; // APCA Lc target
|
|
632
|
+
| { apca: HCPair<number | ApcaPreset> }; // APCA Lc target
|
|
494
633
|
```
|
|
495
634
|
|
|
496
635
|
| Preset | WCAG ratio |
|
|
@@ -1553,6 +1692,7 @@ glaze.configure({
|
|
|
1553
1692
|
alphaMax: 0.6,
|
|
1554
1693
|
bgHueBlend: 0.2,
|
|
1555
1694
|
},
|
|
1695
|
+
contrastLevel: 'auto', // or 0–100 for a manual contrast slider
|
|
1556
1696
|
});
|
|
1557
1697
|
```
|
|
1558
1698
|
|
|
@@ -1565,16 +1705,17 @@ boundaries, not the tone transfer.
|
|
|
1565
1705
|
|
|
1566
1706
|
| Field | Default | Description |
|
|
1567
1707
|
| --------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1568
|
-
| `lightTone` | `[10, 100]` | Light scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC.
|
|
1569
|
-
| `darkTone` | `[15, 95]` | Dark scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC.
|
|
1708
|
+
| `lightTone` | `[10, 100]` | Light scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC; widened continuously by [`contrastLevel`](#manual-contrast-level). |
|
|
1709
|
+
| `darkTone` | `[15, 95]` | Dark scheme tone window: `[lo, hi]`, `{ lo, hi, eps }`, or `false` to disable clamping. Bypassed in HC; widened continuously by [`contrastLevel`](#manual-contrast-level). |
|
|
1570
1710
|
| `darkDesaturation` | `0.1` | Saturation reduction in dark scheme (0–1). |
|
|
1571
1711
|
| `states.dark` | `'@media(prefers-color-scheme: dark)'` | State alias for dark mode tokens ([Tasty](https://tasty.style) export). Defaults to a media query so tokens react to the OS preference without registering custom states. |
|
|
1572
1712
|
| `states.highContrast` | `'@media(prefers-contrast: more)'` | State alias for HC tokens ([Tasty](https://tasty.style) export). |
|
|
1573
1713
|
| `modes.dark` | `true` | Include dark variants in exports. |
|
|
1574
|
-
| `modes.highContrast` | `false` | Include HC variants.
|
|
1714
|
+
| `modes.highContrast` | `false` | Include HC variants. Inert while a global [`contrastLevel`](#manual-contrast-level) is set — a manual level has no separate HC tier, so this reads as "emit HC variants when contrast is automatic". |
|
|
1575
1715
|
| `shadowTuning` | `undefined` | Default tuning for all shadow colors. Per-color tuning merges field-by-field. |
|
|
1576
1716
|
| `autoFlip` | `true` | Default for each color's `autoFlip`. When solving `contrast` (or applying a relative `tone` that overshoots `[0, 100]`), allow crossing to the opposite side instead of clamping. With `false`, only the requested direction is considered; unmet contrasts pin the tone to that direction's extreme (and emit a warning) and overshooting offsets clamp to the boundary. Override per color via [`autoFlip`](#autoflip). |
|
|
1577
1717
|
| `inferRole` | `true` | Infer each color's [`role`](#roles) from its name when no explicit `role` is set. Set to `false` to opt out of name-based inference (the base-opposite and foreground-default fallbacks still apply). |
|
|
1718
|
+
| `contrastLevel` | `'auto'` | Manual contrast level, `0`–`100`, replacing the two-tier high-contrast model with a slider. `0` reproduces the normal output and `100` the high-contrast output, bit for bit. See [Manual contrast level](#manual-contrast-level). |
|
|
1578
1719
|
|
|
1579
1720
|
| Method | Description |
|
|
1580
1721
|
| ------------------------- | ----------------------------------------------------------------------------------- |
|
|
@@ -1582,7 +1723,7 @@ boundaries, not the tone transfer.
|
|
|
1582
1723
|
| `glaze.getConfig()` | Snapshot the current resolved config (shallow copy). |
|
|
1583
1724
|
| `glaze.resetConfig()` | Reset to defaults (also bumps the version counter). |
|
|
1584
1725
|
|
|
1585
|
-
Themes and standalone color tokens keep a sparse local `GlazeConfigOverride` and merge the live global at resolve time for omitted fields. Authoring `.export(override?)` freezes the effective merge at call time; restored instances pin that freeze. `pastel` is instance-only (theme/token override or per-color) — not set via `configure()`.
|
|
1726
|
+
Themes and standalone color tokens keep a sparse local `GlazeConfigOverride` and merge the live global at resolve time for omitted fields. Authoring `.export(override?)` freezes the effective merge at call time; restored instances pin that freeze. `pastel` is instance-only (theme/token override or per-color) — not set via `configure()`. `contrastLevel` is the one field the freeze treats as a live preference: only an instance-authored level is written to the snapshot ([why](#two-rules-worth-knowing)).
|
|
1586
1727
|
|
|
1587
1728
|
---
|
|
1588
1729
|
|
|
@@ -1604,9 +1745,12 @@ palette.tokens({ modes: { dark: true, highContrast: true } });
|
|
|
1604
1745
|
|
|
1605
1746
|
Resolution priority (highest first):
|
|
1606
1747
|
|
|
1607
|
-
1.
|
|
1608
|
-
|
|
1609
|
-
|
|
1748
|
+
1. A global [`contrastLevel`](#manual-contrast-level) — pins
|
|
1749
|
+
`highContrast: false`, since a manual level leaves no separate high-contrast
|
|
1750
|
+
tier to emit. `highContrast` is inert while it is set.
|
|
1751
|
+
2. Per-call `modes` option on `tokens` / `tasty` / `json`.
|
|
1752
|
+
3. `glaze.configure({ modes })` — global config.
|
|
1753
|
+
4. Built-in default: `{ dark: true, highContrast: false }`.
|
|
1610
1754
|
|
|
1611
1755
|
---
|
|
1612
1756
|
|
|
@@ -1621,6 +1765,7 @@ available result.
|
|
|
1621
1765
|
| Condition | Behavior |
|
|
1622
1766
|
| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
1623
1767
|
| `contrast` without `base` in a **theme** color | Validation error |
|
|
1768
|
+
| `contrast` pair switching metric (`[4.5, { apca: 75 }]`) | Validation error — a WCAG ratio and an APCA Lc are different scales |
|
|
1624
1769
|
| Relative `tone` without `base` in a **theme** color | Validation error |
|
|
1625
1770
|
| `contrast` without `base` in `glaze.color()` | Anchors against the literal seed (no error) |
|
|
1626
1771
|
| Relative `tone` without `base` in `glaze.color()` | Anchors against the literal seed (no error) |
|
|
@@ -1732,6 +1877,7 @@ import {
|
|
|
1732
1877
|
findToneForContrast,
|
|
1733
1878
|
findValueForMixContrast,
|
|
1734
1879
|
resolveContrastForMode,
|
|
1880
|
+
resolveContrastForLevel,
|
|
1735
1881
|
resolveMinContrast,
|
|
1736
1882
|
apcaContrast,
|
|
1737
1883
|
} from '@tenphi/glaze';
|
|
@@ -1742,6 +1888,7 @@ import {
|
|
|
1742
1888
|
| `findToneForContrast(opts)` | Binary-search for the tone (0–1) that meets a contrast floor (WCAG or APCA) against a base color. Returns `{ tone, contrast, met, branch, flipped? }`. |
|
|
1743
1889
|
| `findValueForMixContrast(opts)` | Same, but searches for a mix `value` (0–1) that meets a contrast floor between a base and a target. |
|
|
1744
1890
|
| `resolveContrastForMode(spec, isHC, polarity?, outerExplicitHC?)` | Resolves a `ContrastSpec` to `{ metric: 'wcag' \| 'apca', target }` for the requested mode (picks the normal or HC entry of any pair). In HC, applies the metric's auto-enhancement unless `outerExplicitHC` is set or the inner metric pair carries an explicit HC value: APCA +15 Lc (clamped to 106); WCAG AA → AAA / AA-large → AAA-large (AAA-family and bare numbers unchanged). |
|
|
1891
|
+
| `resolveContrastForLevel(spec, level, polarity?)` | Resolves a `ContrastSpec` — including its outer `[normal, highContrast]` pair — at a [manual contrast level](#manual-contrast-level) (0–100), interpolating the two numeric targets. Levels 0 / 100 delegate verbatim to `resolveContrastForMode`; a WCAG-vs-APCA metric switch across the pair has no midpoint and switches at 50. |
|
|
1745
1892
|
| `resolveMinContrast(value)` | Resolves a `MinContrast` (WCAG preset or number) to a numeric ratio. |
|
|
1746
1893
|
| `apcaContrast(yText, yBg)` | APCA Lc magnitude (0–106) for two relative luminances. |
|
|
1747
1894
|
|
|
@@ -1761,5 +1908,6 @@ Exported constants: `APCA_PRESETS`, `APCA_HC_ENHANCEMENT` (`15`, the Enhanced Le
|
|
|
1761
1908
|
| `maxIterations` | `18` | Max binary-search iterations per branch. |
|
|
1762
1909
|
| `initialDirection` | higher-contrast side | Direction to search first (`'lighter'` or `'darker'`). |
|
|
1763
1910
|
| `flip` | `false` | When `true`, try the opposite direction if the initial one doesn't meet the target. When `false`, only the initial direction is searched — unmet contrasts pin the result to that direction's extreme. |
|
|
1911
|
+
| `preferInitial` | `false` | With `flip` on and **both** directions meeting the target, keep `initialDirection` instead of taking whichever result lands nearer `preferredTone`. Makes the chosen side independent of the target — what [`contrastLevel`](#manual-contrast-level) uses to keep a color on one side of its base across the ramp. The flip fallback is unaffected. |
|
|
1764
1912
|
|
|
1765
1913
|
Result: `{ tone, contrast, met, branch: 'lighter' | 'darker' | 'preferred', flipped? }`. `flipped: true` indicates the initial direction failed and the opposite direction satisfied the target.
|
|
@@ -642,6 +642,25 @@ In HC variants, Glaze bypasses the normal tone window and uses the full
|
|
|
642
642
|
`[0, 100]` range. Edge tones can reach the edge; contrast floors have more room
|
|
643
643
|
to solve.
|
|
644
644
|
|
|
645
|
+
### A slider instead of a tier
|
|
646
|
+
|
|
647
|
+
The two-tier model assumes contrast is a binary OS preference. When contrast is
|
|
648
|
+
instead a setting *your users* control, set
|
|
649
|
+
[`contrastLevel`](api.md#manual-contrast-level) to a number and the HC tier
|
|
650
|
+
becomes a `0–100` ramp: level `0` is your normal palette, `100` is the HC
|
|
651
|
+
palette you already authored, and everything between is resolved at that level.
|
|
652
|
+
|
|
653
|
+
The authoring work is the same — the HC pairs above are what the slider ramps
|
|
654
|
+
toward, so a palette tuned for high contrast needs no new fields. Two
|
|
655
|
+
consequences worth planning for:
|
|
656
|
+
|
|
657
|
+
- The separate HC tier stops being emitted, so wire the level itself into your
|
|
658
|
+
build or runtime rather than a `prefers-contrast: more` block. Existing
|
|
659
|
+
media-query wiring keeps working; it just receives the same values as the base
|
|
660
|
+
block.
|
|
661
|
+
- `contrastLevel: 0` is a useful state in its own right: normal contrast with no
|
|
662
|
+
HC tier at all, for products that ship the slider but default it off.
|
|
663
|
+
|
|
645
664
|
## Checklist
|
|
646
665
|
|
|
647
666
|
Before shipping a palette, verify:
|
|
@@ -654,7 +673,8 @@ Before shipping a palette, verify:
|
|
|
654
673
|
- Low-stakes visual relationships use tone deltas instead of fake contrast
|
|
655
674
|
floors.
|
|
656
675
|
- `inherit: false` is set on default-only tokens so status themes stay focused.
|
|
657
|
-
- HC pairs exist where high contrast should visibly tighten
|
|
676
|
+
- HC pairs exist where high contrast should visibly tighten (they double as the
|
|
677
|
+
ramp for a manual `contrastLevel`).
|
|
658
678
|
- `glaze.configure({ states, modes })` matches the states registered in the app.
|
|
659
679
|
- Every emitted scheme (`light`, `dark`, `lightContrast`, `darkContrast`) has
|
|
660
680
|
been reviewed on complete screens, not only in a token grid.
|
package/docs/glaze/okhst.md
CHANGED
|
@@ -85,6 +85,19 @@ lightTone: { lo: 10, hi: 100, eps: 0.05 }
|
|
|
85
85
|
Pass `false` to use the full range. High-contrast variants always bypass the
|
|
86
86
|
ordinary boundaries and use the full range.
|
|
87
87
|
|
|
88
|
+
A [manual contrast level](api.md#manual-contrast-level) generalizes that bypass
|
|
89
|
+
continuously: with `contrastLevel: L` (`f = L / 100`), each boundary moves toward
|
|
90
|
+
the full range instead of jumping to it —
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
lo(f) = lo + (0 - lo) * f
|
|
94
|
+
hi(f) = hi + (100 - hi) * f
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
— so the light default walks `[10, 100] → [0, 100]` and the dark default
|
|
98
|
+
`[15, 95] → [0, 100]`. The render `eps` is not interpolated, and a `false` window
|
|
99
|
+
is already the full range and therefore level-invariant.
|
|
100
|
+
|
|
88
101
|
## Scheme adaptation
|
|
89
102
|
|
|
90
103
|
Each regular color has an adaptation `mode`:
|
package/docs/tasty/README.md
CHANGED
|
@@ -24,6 +24,7 @@ Tasty is a styling engine for design systems that turns component state into det
|
|
|
24
24
|
## By Task
|
|
25
25
|
|
|
26
26
|
- **Learn the style language**: [Style DSL](dsl.md)
|
|
27
|
+
- **Brief an AI agent (or yourself) on writing correct styles**: [Style Rules for AI Agents](ai-agents.md)
|
|
27
28
|
- **Look up a property handler**: [Style Properties](styles.md)
|
|
28
29
|
- **Define tokens, units, recipes, keyframes, or properties globally**: [Configuration](configuration.md)
|
|
29
30
|
- **Debug generated CSS or cache behavior**: [Debug Utilities](debug.md)
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Tasty Style Rules for AI Agents
|
|
2
|
+
|
|
3
|
+
A compact ruleset for **writing correct `@tenphi/tasty` styles**. It is not an API tour — every rule here is machine-checked by [`@tenphi/eslint-plugin-tasty`](https://www.npmjs.com/package/@tenphi/eslint-plugin-tasty), so following it means clean lint output. For explanations and the complete API, see [Style DSL](dsl.md), [Style Properties](styles.md), [React API](react-api.md).
|
|
4
|
+
|
|
5
|
+
Notation: ❌ wrong → ✅ correct.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 0. Read the project config first
|
|
10
|
+
|
|
11
|
+
Color tokens (`#name`), custom properties (`$name`), `preset` names, `recipe` names, state aliases (`@mobile`) and extra units are **project-defined** in `tasty.config.ts` or a `configure({ … })` call. Look them up before writing styles. Never invent a name — reuse an existing one, or add it to the config.
|
|
12
|
+
|
|
13
|
+
## 1. Where styles go
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
const Card = tasty({ as: 'div', styles: { … }, styleProps: ['padding'] }); // new component
|
|
17
|
+
const Hero = tasty(Card, { styles: { … } }); // extend a component
|
|
18
|
+
const cls = useStyles({ … }); // ad-hoc class name
|
|
19
|
+
tastyStatic('.card', { … }); // build-time, zero runtime
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Wrap, don't pass styles per instance: ❌ `<Box styles={{ padding: '2x' }} />` → ✅ `const Box = tasty({ styles: { padding: '2x' } })`.
|
|
23
|
+
- Style values are **static**. Route anything conditional through a state map plus `mods` (or `tokens` / `styleProps`):
|
|
24
|
+
❌ `fill: isOpen ? '#primary' : '#surface'` → ✅ `fill: { '': '#surface', open: '#primary' }` with `mods={{ open: isOpen }}`.
|
|
25
|
+
|
|
26
|
+
## 2. Property names
|
|
27
|
+
|
|
28
|
+
Keys are camelCase — a Tasty property or a real CSS property. No kebab-case, no invented names.
|
|
29
|
+
|
|
30
|
+
Prefer the Tasty shorthand over its CSS equivalents:
|
|
31
|
+
|
|
32
|
+
| Use | Instead of |
|
|
33
|
+
|-----|------------|
|
|
34
|
+
| `fill` | `backgroundColor`, `background` |
|
|
35
|
+
| `image` | `backgroundImage` |
|
|
36
|
+
| `border` | `borderColor`, `borderWidth`, `borderStyle`, `borderTop`/`Right`/`Bottom`/`Left` |
|
|
37
|
+
| `radius` | `borderRadius` |
|
|
38
|
+
| `outline` | `outlineColor`, `outlineWidth`, `outlineStyle`, `outlineOffset` |
|
|
39
|
+
| `shadow` | `boxShadow` |
|
|
40
|
+
| `padding` | `paddingTop`/`Right`/`Bottom`/`Left` |
|
|
41
|
+
| `margin` | `marginTop`/`Right`/`Bottom`/`Left` |
|
|
42
|
+
| `inset` | `top`, `right`, `bottom`, `left` |
|
|
43
|
+
| `width` / `height` | `minWidth`/`maxWidth`, `minHeight`/`maxHeight` |
|
|
44
|
+
| `flow` | `flexDirection`, `flexWrap`, `flexFlow`, `gridAutoFlow` |
|
|
45
|
+
| `preset` | `fontSize`, `lineHeight`, `letterSpacing`, `fontWeight`, `fontStyle`, `textTransform` |
|
|
46
|
+
| `font` | `fontFamily` |
|
|
47
|
+
| `scrollbar` | `scrollbarWidth`, `scrollbarColor`, `scrollbarGutter` |
|
|
48
|
+
| `gridColumns` / `gridRows` / `gridAreas` | `gridTemplateColumns` / `Rows` / `Areas` |
|
|
49
|
+
| `textOverflow: 'ellipsis / 3'` | `lineClamp` |
|
|
50
|
+
| `hide: true` | `display: 'none'` |
|
|
51
|
+
| `flexGrow` / `flexShrink` / `flexBasis` | `flex` |
|
|
52
|
+
|
|
53
|
+
The last row goes the other way — longhands over the shorthand — because `flex` is lossy: it resets the components you omit to non-initial values (`flex: '0'` silently sets `flex-basis: 0%`) and cannot express `flexShrink: 0` at all. The longhands also carry separate state maps.
|
|
54
|
+
|
|
55
|
+
## 3. Values
|
|
56
|
+
|
|
57
|
+
### Tokens
|
|
58
|
+
|
|
59
|
+
| Syntax | Meaning |
|
|
60
|
+
|--------|---------|
|
|
61
|
+
| `#name` | color token → `var(--name-color)` |
|
|
62
|
+
| `#name.50` | token at 50% opacity (`0`–`100`) |
|
|
63
|
+
| `#name.$opacity` | opacity from a custom property |
|
|
64
|
+
| `#clear` / `#current` | `transparent` / `currentcolor` |
|
|
65
|
+
| `$name` | custom property → `var(--name)` |
|
|
66
|
+
| `(#a, #b)` | fallback chain |
|
|
67
|
+
| `$$name` / `##name` | the property *name* — only inside `transition` |
|
|
68
|
+
|
|
69
|
+
- ❌ `#f5f5f5`, `rgb(0 0 0)`, `oklch(…)`, `okhsl(…)`, `red` → ✅ `#surface` (add the token to the config if it doesn't exist).
|
|
70
|
+
- ❌ `var(--gap)` → ✅ `$gap` · ❌ `$accent-color` → ✅ `#accent` · ❌ `transparent` → ✅ `#clear` · ❌ `currentColor` → ✅ `#current`.
|
|
71
|
+
- A `$name` must be declared as a `'$name': value` key in the same styles object, or in the config.
|
|
72
|
+
|
|
73
|
+
### Units
|
|
74
|
+
|
|
75
|
+
Tasty units: `x` (gap multiple), `r` (radius), `cr` (card radius), `bw` (border width), `ow` (outline width), `sf` (`minmax(0, Nfr)`). All CSS units work too, plus anything in `units` in the config. Any other unit is an error.
|
|
76
|
+
|
|
77
|
+
Prefer units over raw pixels: `8px` → `1x` … `64px` → `8x`; `radius: '6px'` → `'1r'`; `border: '1px …'` → `'1bw …'`.
|
|
78
|
+
|
|
79
|
+
### Math
|
|
80
|
+
|
|
81
|
+
❌ `calc(100% - 2x)` → ✅ `(100% - 2x)`. Parentheses are wrapped in `calc()` automatically — and must be balanced.
|
|
82
|
+
|
|
83
|
+
### `true`
|
|
84
|
+
|
|
85
|
+
`true` means "the design-system default" and is accepted **only** by: `border`, `radius`, `outline`, `shadow`, `padding`, `margin`, `gap`, `inset`, `width`, `height`, `fill`, `color`, `preset`, `font`, `scrollbar`, `hide`. Anywhere else it is an error.
|
|
86
|
+
|
|
87
|
+
### `!important`
|
|
88
|
+
|
|
89
|
+
Never use it. Tasty owns specificity through doubled selectors and state ordering; `!important` breaks that. Express the exception as a state instead.
|
|
90
|
+
|
|
91
|
+
### Modifiers
|
|
92
|
+
|
|
93
|
+
A value is `[values…] [modifiers…]`, and several groups can be comma-separated (later groups override earlier ones). Only the modifiers a property knows are valid:
|
|
94
|
+
|
|
95
|
+
| Property | Modifiers |
|
|
96
|
+
|----------|-----------|
|
|
97
|
+
| `padding`, `margin`, `inset`, `fade` | `top` `right` `bottom` `left` |
|
|
98
|
+
| `border` | the four directions + `solid` `dashed` `dotted` `double` `groove` `ridge` `inset` `outset` `none` `hidden` |
|
|
99
|
+
| `outline` | the style keywords above |
|
|
100
|
+
| `radius` | `top` `right` `bottom` `left` + shapes `round` `ellipse` `leaf` `backleaf` |
|
|
101
|
+
| `width`, `height` | `min` `max` `fixed` |
|
|
102
|
+
| `flow` | `row` `column` `row-reverse` `column-reverse` `wrap` `nowrap` `dense` |
|
|
103
|
+
| `overflow` | `visible` `hidden` `scroll` `clip` `auto` `overlay` |
|
|
104
|
+
| `position` | `static` `relative` `absolute` `fixed` `sticky` |
|
|
105
|
+
| `shadow` | `inset` |
|
|
106
|
+
| `preset` | `name / strong` (or `bold`) `italic` `icon` `tight` |
|
|
107
|
+
| box properties | `longhand` — emit CSS longhands instead of the shorthand |
|
|
108
|
+
|
|
109
|
+
Directional modifiers beat placeholder zeros:
|
|
110
|
+
|
|
111
|
+
- ❌ `padding: '0 0 2x 0'` → ✅ `padding: '2x bottom'`
|
|
112
|
+
- ❌ `padding: '1x 1x 2x 1x'` → ✅ `padding: '1x, 2x bottom'`
|
|
113
|
+
- ❌ `border: '0 0 1bw 0'` — four tokens parse as *one* border value, so this renders no border at all → ✅ `border: '1bw bottom'`
|
|
114
|
+
|
|
115
|
+
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, `tabSize`, `paddingInline`, `paddingBlock`. `fill` and `color` take a color (plus `none` / `transparent`); `caretColor` and `accentColor` take a color only.
|
|
116
|
+
|
|
117
|
+
### `transition`
|
|
118
|
+
|
|
119
|
+
Use semantic names, not CSS property names: `fade` `fill` `color` `theme` `border` `radius` `shadow` `outline` `preset` `text` `gap` `opacity` `translate` `rotate` `scale` `filter` `image` `background` `width` `height` `zIndex` `inset` `flow` `dimension`.
|
|
120
|
+
|
|
121
|
+
❌ `transition: 'background-color 0.2s'` → ✅ `transition: 'fill 0.2s'`
|
|
122
|
+
|
|
123
|
+
## 4. State maps
|
|
124
|
+
|
|
125
|
+
A property value can be an object of `state: value`. Key order is priority — later keys win.
|
|
126
|
+
|
|
127
|
+
| Key | Generated selector |
|
|
128
|
+
|-----|--------------------|
|
|
129
|
+
| `hovered` | `[data-hovered]` (boolean modifier from `mods`) |
|
|
130
|
+
| `theme=danger` | `[data-theme="danger"]` (value modifier) |
|
|
131
|
+
| `:hover` | pseudo-class |
|
|
132
|
+
| `.active` | class selector |
|
|
133
|
+
| `[aria-expanded="true"]` | attribute selector |
|
|
134
|
+
| `hovered & .active` | AND |
|
|
135
|
+
| `hovered \| focused` | OR (`,` also means OR) |
|
|
136
|
+
| `!disabled` | NOT |
|
|
137
|
+
| `hovered ^ focused` | XOR — exactly one (keep chains ≤ 4 operands) |
|
|
138
|
+
|
|
139
|
+
Precedence `!` > `^` > `|` > `&`; use parentheses to override.
|
|
140
|
+
|
|
141
|
+
Rules:
|
|
142
|
+
|
|
143
|
+
1. **`''` comes first.** The bare default is the lowest-priority state; placing it later would override everything above it.
|
|
144
|
+
2. **Every state map needs `''` or `_`** — except when extending (`tasty(Parent, …)`), where omitting `''` merges into the parent's states and including `''` replaces them wholesale.
|
|
145
|
+
3. **`_` is standalone-only** and always first (with `''` right after it, if present). `_` is a never-negated fallback floor for cases where a higher-priority branch may be *unknown* (`@supports`, container queries). If a map contains only `_` and `''`, drop the `''`.
|
|
146
|
+
4. **No nested maps:** ❌ `{ hovered: { pressed: 'x' } }` → ✅ `{ 'hovered & pressed': 'x' }`
|
|
147
|
+
5. **State keys never sit at the top level** of a styles object — `:hover`, `.active`, `[open]` belong inside a property value.
|
|
148
|
+
|
|
149
|
+
```jsx
|
|
150
|
+
color: { '': '#text', hovered: '#accent', disabled: '#text.40' }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Advanced states:
|
|
154
|
+
|
|
155
|
+
| Prefix | Use | Example |
|
|
156
|
+
|--------|-----|---------|
|
|
157
|
+
| `@media(…)` | media query; dimensions `w` `h`; types `@media:print` `:screen` `:all` `:speech` | `@media(w < 768px)`, `@media(600px <= w < 1200px)` |
|
|
158
|
+
| `@(…)` | container query; dimensions `w` `h` `is` `bs` | `@(layout, w >= 600px)`, `@($variant=primary)` |
|
|
159
|
+
| `@supports(…)` | feature query; `$` first argument tests a selector | `@supports(display: grid)`, `@supports($, :has(*))` |
|
|
160
|
+
| `@root(…)` | condition on `:root` | `@root(schema=dark)` |
|
|
161
|
+
| `@parent(…)` | condition on an ancestor; `, >` for the direct parent | `@parent(hovered, >)` |
|
|
162
|
+
| `@own(…)` | a sub-element's own state — **only inside sub-element styles** | `@own(:hover)` |
|
|
163
|
+
| `@starting` | `@starting-style` entry animation | `@starting` |
|
|
164
|
+
| `@name` | project state alias | `@mobile` |
|
|
165
|
+
|
|
166
|
+
- At root level write the selector directly: ❌ `'@own(:hover)'` → ✅ `':hover'`.
|
|
167
|
+
- `@name` aliases must exist in `states` in the config or be declared locally as an `'@name': '<state expression>'` key; alias keys start with `@` and their value must be a valid state expression.
|
|
168
|
+
- `:is()` / `:has()` / `:not()` / `:where()` work in state keys but support at most 2 levels of nested parentheses, and `:has()` is expensive — prefer `@parent()`, `@own()` and modifiers.
|
|
169
|
+
|
|
170
|
+
When extending a parent's state map: `'@inherit'` reuses the parent's value for that state, `null` removes a state (or resets a property, letting recipes fill in), `false` is a tombstone that blocks it entirely.
|
|
171
|
+
|
|
172
|
+
## 5. Sub-elements
|
|
173
|
+
|
|
174
|
+
A **capitalized** key targets `[data-element="Name"]`, and its value must be a style object.
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
styles: { Title: { preset: 'h3' }, Icon: { $: '>@:last-child', color: '#accent' } }
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
❌ nested-selector keys (`'& .title'`, `'&:hover'`) → ✅ sub-elements and state maps. Use the `$` affix property inside a sub-element to control how its selector attaches (`>` direct child, `@` placeholder for the element itself, `&::before` for a root pseudo-element).
|
|
181
|
+
|
|
182
|
+
## 6. Special top-level keys
|
|
183
|
+
|
|
184
|
+
| Key | Shape |
|
|
185
|
+
|-----|-------|
|
|
186
|
+
| `@keyframes` | `{ name: { '0%': styles, … } }` |
|
|
187
|
+
| `@properties` | `{ '$name': { syntax, inherits, initialValue } }` |
|
|
188
|
+
| `@fontFace` | `{ 'Family Name': descriptors \| descriptors[] }` |
|
|
189
|
+
| `@counterStyle` | `{ name: descriptors }` |
|
|
190
|
+
| `recipe` | a **string** of configured recipe names: `'card elevated'`, `'reset input / autofill'`, `'none / disabled'` |
|
|
191
|
+
|
|
192
|
+
## 7. `tastyStatic()`
|
|
193
|
+
|
|
194
|
+
The selector must be a string literal and valid CSS. Values must be static — strings, numbers, booleans, `null`, or objects/arrays of those. No variables, template literals, function calls, or spreads.
|
|
195
|
+
|
|
196
|
+
## 8. Checklist
|
|
197
|
+
|
|
198
|
+
- Token, preset, recipe, unit and `@alias` names exist in the project config.
|
|
199
|
+
- Tasty shorthand chosen over CSS longhands; `flexGrow`/`flexShrink`/`flexBasis` over `flex`; `hide: true` over `display: 'none'`.
|
|
200
|
+
- Colors are `#tokens`, not hex/rgb/oklch/named; `$prop` not `var(--prop)`.
|
|
201
|
+
- Spacing uses `x`/`r`/`bw`/`ow` units; math uses `(…)`, not `calc(…)`.
|
|
202
|
+
- `true` only on the properties that accept it; no `!important`.
|
|
203
|
+
- Modifiers valid for the property; directional shorthand instead of placeholder zeros.
|
|
204
|
+
- Every state map starts with `''` (or `_`), is flat, and lives inside a property value.
|
|
205
|
+
- `@own()` only inside sub-elements; sub-element keys are capitalized and hold objects.
|
|
206
|
+
- Values are static; dynamic behavior comes from `mods` / `tokens` / `styleProps`.
|
package/docs/tasty/injector.md
CHANGED
|
@@ -226,6 +226,21 @@ configure({
|
|
|
226
226
|
- `devMode`: Automatically enabled in development environments (detected via `isDevEnv()`)
|
|
227
227
|
- `forceTextInjection`: Automatically enabled in test environments (Jest, Vitest, Mocha, happy-dom, jsdom)
|
|
228
228
|
|
|
229
|
+
**Injection Modes:**
|
|
230
|
+
|
|
231
|
+
Each sheet picks its write mode once, when it is created, and keeps it for its
|
|
232
|
+
lifetime:
|
|
233
|
+
|
|
234
|
+
| Mode | How rules are written | How rules are removed |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| CSSOM (default) | `styleSheet.insertRule(rule, index)` | `styleSheet.deleteRule(index)` |
|
|
237
|
+
| Text (`forceTextInjection`, or when `styleElement.sheet` is unavailable) | appended to `<style>.textContent` | rule texts are tracked per sheet and the element's text is rebuilt without them |
|
|
238
|
+
| Adopted (ShadowRoot with constructable sheets) | `insertRule` on the constructable sheet | `deleteRule` on the constructable sheet |
|
|
239
|
+
|
|
240
|
+
Text mode cannot edit a single rule in place the way CSSOM can, so the sheet
|
|
241
|
+
keeps the inserted rule texts in index order and rewrites the element on delete.
|
|
242
|
+
Dispose, ref-counted cleanup and GC therefore behave identically in every mode.
|
|
243
|
+
|
|
229
244
|
**Configuration Notes:**
|
|
230
245
|
- Most options have sensible defaults and auto-detection
|
|
231
246
|
- `configure()` is optional - the injector works with defaults
|
package/docs/tasty/react-api.md
CHANGED
|
@@ -419,6 +419,15 @@ function ThemeStyles() {
|
|
|
419
419
|
}
|
|
420
420
|
```
|
|
421
421
|
|
|
422
|
+
A slot — the `id`, or the selector when no `id` is given — holds exactly one
|
|
423
|
+
injection **per `root`**. So:
|
|
424
|
+
|
|
425
|
+
- Changing the styles replaces the previous CSS rather than adding to it.
|
|
426
|
+
- Passing styles that produce no CSS (for example `{}`) clears the slot.
|
|
427
|
+
- The same selector used in two shadow roots keeps a separate injection in each.
|
|
428
|
+
- Two independent call sites that share a selector share a slot, and the last
|
|
429
|
+
render wins. Give them distinct `id`s if they should coexist.
|
|
430
|
+
|
|
422
431
|
### useRawCSS
|
|
423
432
|
|
|
424
433
|
Inject raw CSS strings. Accepts an optional `id` in the options for update tracking — when the CSS changes for the same id, the previous injection is replaced:
|
|
@@ -435,6 +444,9 @@ function GlobalReset() {
|
|
|
435
444
|
}
|
|
436
445
|
```
|
|
437
446
|
|
|
447
|
+
An `id` slot holds one injection per `root`. Without an `id` the CSS is deduped
|
|
448
|
+
by content and permanent — there is nothing to replace it with later.
|
|
449
|
+
|
|
438
450
|
### useKeyframes
|
|
439
451
|
|
|
440
452
|
Inject `@keyframes` rules and return the generated animation name:
|
|
@@ -455,7 +467,7 @@ function Spinner() {
|
|
|
455
467
|
}
|
|
456
468
|
```
|
|
457
469
|
|
|
458
|
-
`useKeyframes()` also supports a factory function.
|
|
470
|
+
`useKeyframes()` also supports a factory function. Without a `name` the factory runs on every invocation and deduplication is handled internally by content hash; with a `name`, matching deps skip the factory entirely:
|
|
459
471
|
|
|
460
472
|
```tsx
|
|
461
473
|
function Pulse({ scale }: { scale: number }) {
|
|
@@ -464,13 +476,20 @@ function Pulse({ scale }: { scale: number }) {
|
|
|
464
476
|
'0%': { transform: 'scale(1)' },
|
|
465
477
|
'100%': { transform: `scale(${scale})` },
|
|
466
478
|
}),
|
|
467
|
-
[scale]
|
|
479
|
+
[scale],
|
|
480
|
+
{ name: 'pulse' }
|
|
468
481
|
);
|
|
469
482
|
|
|
470
483
|
return <div style={{ animation: `${pulse} 500ms ease-in-out alternate infinite` }} />;
|
|
471
484
|
}
|
|
472
485
|
```
|
|
473
486
|
|
|
487
|
+
Passing `name` claims a slot owned by that one call site, per `root` — much like
|
|
488
|
+
`id` in `useGlobalStyles()` and `useRawCSS()`. When the steps change the previous
|
|
489
|
+
`@keyframes` rule is disposed and the name is reused, so the rules don't
|
|
490
|
+
accumulate and the returned name stays stable. Anonymous keyframes are permanent
|
|
491
|
+
and shared by content.
|
|
492
|
+
|
|
474
493
|
### useProperty
|
|
475
494
|
|
|
476
495
|
Register a CSS `@property` rule so a custom property can animate smoothly:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cube-dev/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.154.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "UIKit for Cube Projects",
|
|
6
6
|
"repository": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"@react-types/shared": "^3.32.1",
|
|
53
53
|
"@tabler/icons-react": "^3.31.0",
|
|
54
54
|
"@tanstack/react-virtual": "^3.13.12",
|
|
55
|
-
"@tenphi/glaze": "1.
|
|
56
|
-
"@tenphi/tasty": "2.11.
|
|
55
|
+
"@tenphi/glaze": "1.3.0",
|
|
56
|
+
"@tenphi/tasty": "2.11.2",
|
|
57
57
|
"clipboard-copy": "^4.0.1",
|
|
58
58
|
"clsx": "^1.1.1",
|
|
59
59
|
"diff": "^8.0.3",
|