@cube-dev/ui-kit 0.0.0-canary-1d46daa → 0.0.0-canary-736d057
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/CHANGELOG.md +6 -0
- package/es/_internal/hooks/index.js +1 -1
- package/es/_internal/hooks/use-chained-callback.js +1 -1
- package/es/_internal/hooks/use-debounced-value.js +1 -1
- package/es/_internal/hooks/use-deprecation-warning.js +1 -1
- package/es/_internal/hooks/use-effect-once.js +1 -1
- package/es/_internal/hooks/use-event.js +1 -1
- package/es/_internal/hooks/use-is-first-render.js +1 -1
- package/es/_internal/hooks/use-sync-ref.js +1 -1
- package/es/_internal/hooks/use-timer/index.js +1 -1
- package/es/_internal/hooks/use-timer/timer.js +1 -1
- package/es/_internal/hooks/use-timer/use-timer.js +1 -1
- package/es/_internal/hooks/use-update-effect.js +1 -1
- package/es/_internal/hooks/use-warn.js +1 -1
- package/es/_internal/index.js +1 -1
- package/es/components/Block.js +1 -1
- package/es/components/GlobalStyles.js +1 -1
- package/es/components/GridProvider.js +1 -1
- package/es/components/HiddenInput.js +1 -1
- package/es/components/Item.js +1 -1
- package/es/components/OpenTrasition.js +1 -1
- package/es/components/Root.js +2 -2
- package/es/components/actions/Action/Action.js +14 -18
- package/es/components/actions/Button/Button.js +2 -1
- package/es/components/actions/Button/index.js +1 -1
- package/es/components/actions/ButtonGroup/ButtonGroup.js +1 -1
- package/es/components/actions/CommandMenu/CommandMenu.js +1 -1
- package/es/components/actions/CommandMenu/index.js +1 -1
- package/es/components/actions/CommandMenu/styled.js +1 -1
- package/es/components/actions/ItemButton/ItemButton.js +1 -1
- package/es/components/actions/ItemButton/index.js +1 -1
- package/es/components/actions/Menu/Menu.js +1 -1
- package/es/components/actions/Menu/MenuItem.js +3 -8
- package/es/components/actions/Menu/MenuSection.js +1 -1
- package/es/components/actions/Menu/MenuTrigger.js +1 -1
- package/es/components/actions/Menu/SubMenuTrigger.js +1 -1
- package/es/components/actions/Menu/SubmenuTriggerContext.js +1 -1
- package/es/components/actions/Menu/context.js +1 -1
- package/es/components/actions/Menu/index.js +1 -1
- package/es/components/actions/Menu/styled.js +1 -1
- package/es/components/actions/index.js +1 -1
- package/es/components/actions/use-action.js +1 -1
- package/es/components/actions/use-anchored-menu.js +1 -1
- package/es/components/actions/use-context-menu.js +1 -1
- package/es/components/content/ActiveZone/ActiveZone.js +1 -1
- package/es/components/content/Alert/Alert.js +1 -1
- package/es/components/content/Alert/index.js +1 -1
- package/es/components/content/Alert/types.js +1 -1
- package/es/components/content/Alert/use-alert.js +1 -1
- package/es/components/content/Avatar/Avatar.js +1 -1
- package/es/components/content/Badge/Badge.js +1 -1
- package/es/components/content/Card/Card.js +1 -1
- package/es/components/content/Content.js +1 -1
- package/es/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
- package/es/components/content/CopyPasteBlock/index.js +1 -1
- package/es/components/content/CopySnippet/CopySnippet.js +1 -1
- package/es/components/content/CopySnippet/index.js +1 -1
- package/es/components/content/Divider.js +1 -1
- package/es/components/content/Footer.js +1 -1
- package/es/components/content/Header.js +1 -1
- package/es/components/content/HotKeys/HotKeys.js +1 -1
- package/es/components/content/HotKeys/index.js +1 -1
- package/es/components/content/ItemBase/ItemBase.js +8 -2
- package/es/components/content/ItemBase/index.js +1 -1
- package/es/components/content/List/SectionHeading.js +1 -1
- package/es/components/content/List/index.js +1 -1
- package/es/components/content/Paragraph.js +1 -1
- package/es/components/content/Placeholder/Placeholder.js +1 -1
- package/es/components/content/PrismCode/PrismCode.js +1 -1
- package/es/components/content/PrismCode/prismSetup.js +1 -1
- package/es/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
- package/es/components/content/Result/Result.js +1 -1
- package/es/components/content/Skeleton/Skeleton.js +1 -1
- package/es/components/content/Tag/Tag.js +1 -1
- package/es/components/content/Text.js +3 -3
- package/es/components/content/Title.js +3 -3
- package/es/components/fields/Checkbox/Checkbox.js +1 -1
- package/es/components/fields/Checkbox/CheckboxGroup.js +1 -1
- package/es/components/fields/Checkbox/context.js +1 -1
- package/es/components/fields/Checkbox/index.js +1 -1
- package/es/components/fields/ComboBox/ComboBox.js +1 -1
- package/es/components/fields/ComboBox/index.js +1 -1
- package/es/components/fields/DatePicker/DateInput.js +1 -1
- package/es/components/fields/DatePicker/DateInputBase.js +1 -1
- package/es/components/fields/DatePicker/DatePicker.js +1 -1
- package/es/components/fields/DatePicker/DatePickerButton.js +1 -1
- package/es/components/fields/DatePicker/DatePickerElement.js +1 -1
- package/es/components/fields/DatePicker/DatePickerInput.js +1 -1
- package/es/components/fields/DatePicker/DatePickerSegment.js +1 -1
- package/es/components/fields/DatePicker/DateRangePicker.js +1 -1
- package/es/components/fields/DatePicker/DateRangeSeparatedPicker.js +1 -1
- package/es/components/fields/DatePicker/TimeInput.js +1 -1
- package/es/components/fields/DatePicker/index.js +1 -1
- package/es/components/fields/DatePicker/intl.js +1 -1
- package/es/components/fields/DatePicker/parseDate.js +1 -1
- package/es/components/fields/DatePicker/props.js +1 -1
- package/es/components/fields/DatePicker/types.js +1 -1
- package/es/components/fields/DatePicker/utils.js +1 -1
- package/es/components/fields/FileInput/FileInput.js +1 -1
- package/es/components/fields/FilterListBox/FilterListBox.js +1 -1
- package/es/components/fields/FilterListBox/index.js +1 -1
- package/es/components/fields/FilterPicker/FilterPicker.js +1 -1
- package/es/components/fields/FilterPicker/index.js +1 -1
- package/es/components/fields/Input/Input.js +1 -1
- package/es/components/fields/Input/index.js +1 -1
- package/es/components/fields/ListBox/ListBox.js +1 -1
- package/es/components/fields/ListBox/index.js +1 -1
- package/es/components/fields/NumberInput/NumberInput.js +1 -1
- package/es/components/fields/NumberInput/StepButton.js +1 -1
- package/es/components/fields/PasswordInput/PasswordInput.js +1 -1
- package/es/components/fields/RadioGroup/Radio.js +1 -1
- package/es/components/fields/RadioGroup/RadioGroup.js +1 -1
- package/es/components/fields/RadioGroup/context.js +1 -1
- package/es/components/fields/RadioGroup/index.js +1 -1
- package/es/components/fields/SearchInput/SearchInput.js +1 -1
- package/es/components/fields/SearchInput/index.js +1 -1
- package/es/components/fields/Select/Select.js +1 -1
- package/es/components/fields/Select/index.js +1 -1
- package/es/components/fields/Slider/Gradation.js +1 -1
- package/es/components/fields/Slider/Header.js +1 -1
- package/es/components/fields/Slider/RangeSlider.js +1 -1
- package/es/components/fields/Slider/Slider.js +1 -1
- package/es/components/fields/Slider/SliderBase.js +1 -1
- package/es/components/fields/Slider/SliderInput.js +1 -1
- package/es/components/fields/Slider/SliderThumb.js +1 -1
- package/es/components/fields/Slider/SliderTrack.js +1 -1
- package/es/components/fields/Slider/elements.js +1 -1
- package/es/components/fields/Slider/index.js +1 -1
- package/es/components/fields/Slider/types.js +1 -1
- package/es/components/fields/Switch/Switch.js +1 -1
- package/es/components/fields/Switch/index.js +1 -1
- package/es/components/fields/TextArea/TextArea.js +1 -1
- package/es/components/fields/TextArea/index.js +1 -1
- package/es/components/fields/TextInput/TextInput.js +1 -1
- package/es/components/fields/TextInput/TextInputBase.js +3 -2
- package/es/components/fields/TextInput/index.js +1 -1
- package/es/components/fields/TextInputMapper/TextInputMapper.js +1 -1
- package/es/components/fields/TextInputMapper/index.js +1 -1
- package/es/components/fields/index.js +1 -1
- package/es/components/form/FieldWrapper/FieldWrapper.js +1 -1
- package/es/components/form/FieldWrapper/extract-field-wrapper-props.js +1 -1
- package/es/components/form/FieldWrapper/index.js +1 -1
- package/es/components/form/FieldWrapper/types.js +1 -1
- package/es/components/form/Form/Field.js +1 -1
- package/es/components/form/Form/Form.js +1 -1
- package/es/components/form/Form/ResetButton/ResetButton.js +1 -1
- package/es/components/form/Form/ResetButton/index.js +1 -1
- package/es/components/form/Form/SubmitButton/SubmitButton.js +1 -1
- package/es/components/form/Form/SubmitButton/index.js +1 -1
- package/es/components/form/Form/SubmitError.js +1 -1
- package/es/components/form/Form/index.js +1 -1
- package/es/components/form/Form/types.js +1 -1
- package/es/components/form/Form/use-field/index.js +1 -1
- package/es/components/form/Form/use-field/types.js +1 -1
- package/es/components/form/Form/use-field/use-field-props.js +1 -1
- package/es/components/form/Form/use-field/use-field.js +1 -1
- package/es/components/form/Form/use-form.js +1 -1
- package/es/components/form/Form/validation.js +1 -1
- package/es/components/form/Label.js +1 -1
- package/es/components/form/index.js +1 -1
- package/es/components/form/wrapper.js +1 -1
- package/es/components/layout/Flex.js +1 -1
- package/es/components/layout/Flow.js +1 -1
- package/es/components/layout/Grid.js +1 -1
- package/es/components/layout/Panel.js +1 -1
- package/es/components/layout/Prefix.js +1 -1
- package/es/components/layout/ResizablePanel.js +1 -1
- package/es/components/layout/Space.js +1 -1
- package/es/components/layout/Suffix.js +1 -1
- package/es/components/navigation/LegacyTabs/LegacyTabs.js +1 -1
- package/es/components/navigation/Link/Link.js +1 -1
- package/es/components/organisms/FileTabs/FileTabs.js +1 -1
- package/es/components/organisms/Modal/Modal.js +1 -1
- package/es/components/organisms/StatsCard/StatsCard.js +1 -1
- package/es/components/other/Base64Upload/Base64Upload.js +1 -1
- package/es/components/other/Calendar/Calendar.js +1 -1
- package/es/components/other/Calendar/CalendarCell.js +1 -1
- package/es/components/other/Calendar/CalendarGrid.js +1 -1
- package/es/components/other/Calendar/RangeCalendar.js +1 -1
- package/es/components/other/CloudLogo/CloudLogo.js +1 -1
- package/es/components/overlays/AlertDialog/AlertDialog.js +1 -1
- package/es/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
- package/es/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
- package/es/components/overlays/AlertDialog/index.js +1 -1
- package/es/components/overlays/AlertDialog/types.js +1 -1
- package/es/components/overlays/Dialog/Dialog.js +1 -1
- package/es/components/overlays/Dialog/DialogContainer.js +1 -1
- package/es/components/overlays/Dialog/DialogForm.js +1 -1
- package/es/components/overlays/Dialog/DialogTrigger.js +1 -1
- package/es/components/overlays/Dialog/context.js +1 -1
- package/es/components/overlays/Dialog/index.js +1 -1
- package/es/components/overlays/Dialog/use-dialog-container.js +1 -1
- package/es/components/overlays/Modal/Modal.js +1 -1
- package/es/components/overlays/Modal/OpenTransition.js +1 -1
- package/es/components/overlays/Modal/Overlay.js +1 -1
- package/es/components/overlays/Modal/Popover.js +1 -1
- package/es/components/overlays/Modal/Tray.js +1 -1
- package/es/components/overlays/Modal/Underlay.js +1 -1
- package/es/components/overlays/Modal/index.js +1 -1
- package/es/components/overlays/Modal/types.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/FloatingNotification.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/NotificationsBar.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/TransitionComponent.js +1 -1
- package/es/components/overlays/NewNotifications/Bar/index.js +1 -1
- package/es/components/overlays/NewNotifications/Dialog/NotificationsDialogTrigger.js +1 -1
- package/es/components/overlays/NewNotifications/Dialog/index.js +1 -1
- package/es/components/overlays/NewNotifications/Notification.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationAction.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationCloseButton.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationDescription.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationFooter.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationHeader.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationIcon.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationProvider.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/NotificationView.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationView/types.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/NotificationsContext.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/NotificationsProvider.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsContext/use-notifications.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/NotificationsList.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/NotificationsListItem.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/index.js +1 -1
- package/es/components/overlays/NewNotifications/NotificationsList/types.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/index.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/types.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notification-list-item.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-api.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-list.js +1 -1
- package/es/components/overlays/NewNotifications/hooks/use-notifications-observer.js +1 -1
- package/es/components/overlays/NewNotifications/index.js +1 -1
- package/es/components/overlays/NewNotifications/types.js +1 -1
- package/es/components/overlays/Notification/Notification.js +1 -1
- package/es/components/overlays/OverlayWrapper.js +1 -1
- package/es/components/overlays/Toasts/Toast.js +1 -1
- package/es/components/overlays/Toasts/index.js +1 -1
- package/es/components/overlays/Toasts/types.js +1 -1
- package/es/components/overlays/Toasts/use-toasts-api.js +1 -1
- package/es/components/overlays/Tooltip/Tooltip.js +1 -1
- package/es/components/overlays/Tooltip/TooltipProvider.js +1 -1
- package/es/components/overlays/Tooltip/TooltipTrigger.js +1 -1
- package/es/components/overlays/Tooltip/context.js +1 -1
- package/es/components/overlays/Tooltip/index.js +1 -1
- package/es/components/portal/Portal.js +1 -1
- package/es/components/portal/PortalProvider.js +1 -1
- package/es/components/portal/index.js +1 -1
- package/es/components/portal/types.js +1 -1
- package/es/components/portal/usePortal.js +1 -1
- package/es/components/shared/InvalidIcon.js +1 -1
- package/es/components/shared/ValidIcon.js +1 -1
- package/es/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
- package/es/components/status/LoadingAnimation/index.js +1 -1
- package/es/components/status/Spin/Cube.js +1 -1
- package/es/components/status/Spin/InternalSpinner.js +1 -1
- package/es/components/status/Spin/Spin.js +1 -1
- package/es/components/status/Spin/SpinsContainer.js +1 -1
- package/es/components/status/Spin/index.js +1 -1
- package/es/components/status/Spin/types.js +1 -1
- package/es/components/status/index.js +1 -1
- package/es/data/item-themes.js +1 -1
- package/es/data/themes.js +1 -1
- package/es/icons/AdjustmentsHorizontalIcon.js +1 -1
- package/es/icons/AdjustmentsIcon.js +1 -1
- package/es/icons/AiIcon.js +1 -1
- package/es/icons/AreaChartIcon.js +1 -1
- package/es/icons/BackwardIcon.js +1 -1
- package/es/icons/BarChartIcon.js +1 -1
- package/es/icons/BellFilledIcon.js +1 -1
- package/es/icons/BellIcon.js +1 -1
- package/es/icons/BooleanIcon.js +1 -1
- package/es/icons/CalendarEditIcon.js +1 -1
- package/es/icons/CalendarIcon.js +1 -1
- package/es/icons/CaretDownIcon.js +1 -1
- package/es/icons/CaretUpIcon.js +1 -1
- package/es/icons/ChartAreaStackedIcon.js +1 -1
- package/es/icons/ChartAreaStackedPercentageIcon.js +1 -1
- package/es/icons/ChartBarGroupedHorizontalIcon.js +1 -1
- package/es/icons/ChartBarGroupedIcon.js +1 -1
- package/es/icons/ChartBarHorizontalIcon.js +1 -1
- package/es/icons/ChartBarLineIcon.js +1 -1
- package/es/icons/ChartBarStackedHorizontalIcon.js +1 -1
- package/es/icons/ChartBarStackedIcon.js +1 -1
- package/es/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
- package/es/icons/ChartBarStackedPercentageIcon.js +1 -1
- package/es/icons/ChartBoxPlot2Icon.js +1 -1
- package/es/icons/ChartBoxPlotIcon.js +1 -1
- package/es/icons/ChartBubbleIcon.js +1 -1
- package/es/icons/ChartDonut2Icon.js +1 -1
- package/es/icons/ChartFunnelIcon.js +1 -1
- package/es/icons/ChartKPIIcon.js +1 -1
- package/es/icons/ChartPie2Icon.js +1 -1
- package/es/icons/ChartScatterIcon.js +1 -1
- package/es/icons/CheckCircleFilledIcon.js +1 -1
- package/es/icons/CheckCircleIcon.js +1 -1
- package/es/icons/CheckIcon.js +1 -1
- package/es/icons/CircleFilledIcon.js +1 -1
- package/es/icons/ClearIcon.js +1 -1
- package/es/icons/CloseCircleFilledIcon.js +1 -1
- package/es/icons/CloseCircleIcon.js +1 -1
- package/es/icons/CloseIcon.js +1 -1
- package/es/icons/CodeIcon.js +1 -1
- package/es/icons/CopyIcon.js +1 -1
- package/es/icons/CountIcon.js +1 -1
- package/es/icons/CubeIcon.js +1 -1
- package/es/icons/DangerIcon.js +1 -1
- package/es/icons/DashboardIcon.js +1 -1
- package/es/icons/DatabaseIcon.js +1 -1
- package/es/icons/DirectionIcon.js +1 -1
- package/es/icons/DonutIcon.js +1 -1
- package/es/icons/DownIcon.js +1 -1
- package/es/icons/EditIcon.js +1 -1
- package/es/icons/ExclamationCircleFilledIcon.js +1 -1
- package/es/icons/ExclamationCircleIcon.js +1 -1
- package/es/icons/ExclamationIcon.js +1 -1
- package/es/icons/EyeIcon.js +1 -1
- package/es/icons/EyeInvisibleIcon.js +1 -1
- package/es/icons/FilterIcon.js +1 -1
- package/es/icons/FolderFilledIcon.js +1 -1
- package/es/icons/FolderIcon.js +1 -1
- package/es/icons/FolderOpenFilledIcon.js +1 -1
- package/es/icons/FolderOpenIcon.js +1 -1
- package/es/icons/ForwardIcon.js +1 -1
- package/es/icons/HierarchyIcon.js +1 -1
- package/es/icons/Icon.js +1 -1
- package/es/icons/InfoCircleIcon.js +1 -1
- package/es/icons/InfoIcon.js +1 -1
- package/es/icons/KeyIcon.js +1 -1
- package/es/icons/LeftIcon.js +1 -1
- package/es/icons/LineChartIcon.js +1 -1
- package/es/icons/LoadingIcon.js +1 -1
- package/es/icons/LockFilledIcon.js +1 -1
- package/es/icons/LockIcon.js +1 -1
- package/es/icons/MoreIcon.js +1 -1
- package/es/icons/NotAllowedIcon.js +1 -1
- package/es/icons/NumberIcon.js +1 -1
- package/es/icons/PauseCircleFilledIcon.js +1 -1
- package/es/icons/PauseCircleIcon.js +1 -1
- package/es/icons/PauseIcon.js +1 -1
- package/es/icons/PieChartIcon.js +1 -1
- package/es/icons/PlayCircleIcon.js +1 -1
- package/es/icons/PlayIcon.js +1 -1
- package/es/icons/PlusIcon.js +1 -1
- package/es/icons/ReloadIcon.js +1 -1
- package/es/icons/ReportIcon.js +1 -1
- package/es/icons/ReturnIcon.js +1 -1
- package/es/icons/RightIcon.js +1 -1
- package/es/icons/SchemeIcon.js +1 -1
- package/es/icons/SearchIcon.js +1 -1
- package/es/icons/SettingsIcon.js +1 -1
- package/es/icons/ShieldFilledIcon.js +1 -1
- package/es/icons/ShieldIcon.js +1 -1
- package/es/icons/SlashIcon.js +1 -1
- package/es/icons/SparklesIcon.js +1 -1
- package/es/icons/SqlIcon.js +1 -1
- package/es/icons/StatsIcon.js +1 -1
- package/es/icons/StopIcon.js +1 -1
- package/es/icons/StringIcon.js +1 -1
- package/es/icons/SwitchIcon.js +1 -1
- package/es/icons/TableIcon.js +1 -1
- package/es/icons/ThumbsDownIcon.js +1 -1
- package/es/icons/ThumbsUpIcon.js +1 -1
- package/es/icons/ThunderboltCrossedIcon.js +1 -1
- package/es/icons/ThunderboltFilledIcon.js +1 -1
- package/es/icons/ThunderboltIcon.js +1 -1
- package/es/icons/TimeIcon.js +1 -1
- package/es/icons/UnlockIcon.js +1 -1
- package/es/icons/UpIcon.js +1 -1
- package/es/icons/UserGroupIcon.js +1 -1
- package/es/icons/UserIcon.js +1 -1
- package/es/icons/UserLockIcon.js +1 -1
- package/es/icons/ViewIcon.js +1 -1
- package/es/icons/WarningFilledIcon.js +1 -1
- package/es/icons/WarningIcon.js +1 -1
- package/es/icons/add-new-icon.js +1 -1
- package/es/icons/index.js +1 -1
- package/es/icons/wrap-icon.js +1 -1
- package/es/index.js +1 -1
- package/es/provider.js +1 -1
- package/es/providers/TrackingProvider.js +1 -1
- package/es/services/notification.js +1 -1
- package/es/shared/form.js +1 -1
- package/es/shared/index.js +1 -1
- package/es/stories/Form.legacy-stories.js +1 -1
- package/es/stories/FormFieldArgs.js +1 -1
- package/es/stories/Layout.stories.js +1 -1
- package/es/stories/Tasty.stories.js +1 -1
- package/es/stories/components/ConfirmDeletionDialogForm.js +1 -1
- package/es/stories/components/DialogFormApp.js +1 -1
- package/es/stories/components/StyledButton.js +1 -1
- package/es/stories/lists/baseProps.js +1 -2
- package/es/tasty/debug.js +431 -0
- package/es/tasty/index.js +3 -1
- package/es/tasty/injector/flatten.js +350 -0
- package/es/tasty/injector/index.js +165 -0
- package/es/tasty/injector/injector.js +293 -0
- package/es/tasty/injector/sheet-manager.js +492 -0
- package/es/tasty/injector/types.js +10 -0
- package/es/tasty/parser/classify.js +1 -1
- package/es/tasty/parser/const.js +1 -1
- package/es/tasty/parser/lru.js +38 -2
- package/es/tasty/parser/parser.js +1 -1
- package/es/tasty/parser/tokenizer.js +1 -1
- package/es/tasty/parser/types.js +1 -1
- package/es/tasty/providers/BreakpointsProvider.js +1 -1
- package/es/tasty/styles/align.js +1 -1
- package/es/tasty/styles/border.js +1 -1
- package/es/tasty/styles/boxShadow.combinator.js +1 -1
- package/es/tasty/styles/color.js +8 -12
- package/es/tasty/styles/createStyle.js +3 -3
- package/es/tasty/styles/dimension.js +1 -1
- package/es/tasty/styles/display.js +1 -1
- package/es/tasty/styles/fade.js +1 -1
- package/es/tasty/styles/fill.js +6 -8
- package/es/tasty/styles/flow.js +1 -1
- package/es/tasty/styles/font.js +1 -1
- package/es/tasty/styles/fontStyle.js +1 -1
- package/es/tasty/styles/gap.js +1 -1
- package/es/tasty/styles/groupRadius.js +1 -1
- package/es/tasty/styles/height.js +1 -1
- package/es/tasty/styles/index.js +1 -1
- package/es/tasty/styles/inset.js +1 -1
- package/es/tasty/styles/justify.js +1 -1
- package/es/tasty/styles/list.js +1 -1
- package/es/tasty/styles/margin.js +1 -1
- package/es/tasty/styles/marginBlock.js +1 -1
- package/es/tasty/styles/marginInline.js +1 -1
- package/es/tasty/styles/outline.js +1 -1
- package/es/tasty/styles/padding.js +1 -1
- package/es/tasty/styles/paddingBlock.js +1 -1
- package/es/tasty/styles/paddingInline.js +1 -1
- package/es/tasty/styles/place.js +1 -1
- package/es/tasty/styles/predefined.js +1 -3
- package/es/tasty/styles/preset.js +1 -1
- package/es/tasty/styles/radius.js +1 -1
- package/es/tasty/styles/reset.js +40 -44
- package/es/tasty/styles/scrollbar.js +1 -1
- package/es/tasty/styles/shadow.js +1 -1
- package/es/tasty/styles/styledScrollbar.js +1 -1
- package/es/tasty/styles/transition.js +1 -1
- package/es/tasty/styles/types.js +1 -1
- package/es/tasty/styles/width.js +1 -1
- package/es/tasty/tasty.js +92 -19
- package/es/tasty/types.js +1 -1
- package/es/tasty/utils/cache-wrapper.js +1 -1
- package/es/tasty/utils/case-converter.js +1 -1
- package/es/tasty/utils/colors.js +1 -1
- package/es/tasty/utils/dotize.js +1 -1
- package/es/tasty/utils/filterBaseProps.js +1 -1
- package/es/tasty/utils/getDisplayName.js +1 -1
- package/es/tasty/utils/getModCombinations.js +26 -30
- package/es/tasty/utils/mergeStyles.js +1 -1
- package/es/tasty/utils/modAttrs.js +1 -1
- package/es/tasty/utils/renderStyles.js +846 -57
- package/es/tasty/utils/responsive.js +1 -1
- package/es/tasty/utils/string.js +1 -1
- package/es/tasty/utils/styles.js +2 -218
- package/es/tasty/utils/warnings.js +1 -1
- package/es/tokens.js +1 -1
- package/es/type-checks.js +1 -1
- package/es/utils/ResizeSensor.js +1 -1
- package/es/utils/modules.js +1 -1
- package/es/utils/promise.js +1 -1
- package/es/utils/random.js +1 -1
- package/es/utils/range.js +1 -1
- package/es/utils/react/Slots.js +1 -1
- package/es/utils/react/chain.js +1 -1
- package/es/utils/react/forwardRefWithGenerics.js +1 -1
- package/es/utils/react/index.js +1 -1
- package/es/utils/react/interactions.js +1 -1
- package/es/utils/react/isTextOnly.js +1 -1
- package/es/utils/react/mapProps.js +1 -1
- package/es/utils/react/mergeProps.js +1 -1
- package/es/utils/react/nullableValue.js +1 -1
- package/es/utils/react/sharedStore.js +1 -1
- package/es/utils/react/useCombinedRefs.js +1 -1
- package/es/utils/react/useControlledFocusVisible.js +1 -1
- package/es/utils/react/useEventBus.js +1 -1
- package/es/utils/react/useId.js +1 -1
- package/es/utils/react/useIsDarwin.js +1 -1
- package/es/utils/react/useKeySymbols.js +1 -1
- package/es/utils/react/useLayoutEffect.js +1 -1
- package/es/utils/react/useQaProps.js +1 -1
- package/es/utils/react/useViewportSize.js +1 -1
- package/es/utils/react/wrapNodeIfPlain.js +1 -1
- package/es/utils/transitions.js +1 -1
- package/es/utils/tree.js +1 -1
- package/es/utils/warnings.js +1 -1
- package/es/version.js +2 -2
- package/package.json +1 -1
- package/types/components/actions/Button/Button.d.ts +1 -0
- package/types/components/actions/Menu/styled.d.ts +699 -702
- package/types/components/actions/use-action.d.ts +1 -1
- package/types/components/content/List/SectionHeading.d.ts +233 -234
- package/types/components/fields/DatePicker/DatePickerElement.d.ts +233 -234
- package/types/tasty/debug.d.ts +108 -0
- package/types/tasty/index.d.ts +2 -0
- package/types/tasty/injector/flatten.d.ts +16 -0
- package/types/tasty/injector/index.d.ts +64 -0
- package/types/tasty/injector/injector.d.ts +82 -0
- package/types/tasty/injector/sheet-manager.d.ts +78 -0
- package/types/tasty/injector/types.d.ts +68 -0
- package/types/tasty/parser/lru.d.ts +5 -1
- package/types/tasty/styles/color.d.ts +3 -1
- package/types/tasty/styles/reset.d.ts +1 -2
- package/types/tasty/types.d.ts +0 -2
- package/types/tasty/utils/getModCombinations.d.ts +9 -1
- package/types/tasty/utils/renderStyles.d.ts +25 -7
- package/types/tasty/utils/styles.d.ts +2 -87
|
@@ -1,15 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license MIT
|
|
3
3
|
* author: Cube Dev Team
|
|
4
|
-
* @cube-dev/ui-kit v0.0.0-canary-
|
|
4
|
+
* @cube-dev/ui-kit v0.0.0-canary-736d057
|
|
5
5
|
* Released under the MIT license.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Style rendering that works with structured style objects
|
|
10
|
+
* Eliminates CSS string parsing for better performance
|
|
11
|
+
*/
|
|
12
|
+
import { Lru } from '../parser/lru';
|
|
8
13
|
import { createStyle, STYLE_HANDLER_MAP } from '../styles';
|
|
9
|
-
import {
|
|
14
|
+
import { getModCombinationsIterative } from './getModCombinations';
|
|
15
|
+
import { mediaWrapper, normalizeStyleZones, pointsToZones, } from './responsive';
|
|
16
|
+
import { computeState, getModSelector, styleStateMapToStyleStateDataList, } from './styles';
|
|
17
|
+
// Detect if a value is a state map whose entries contain responsive arrays
|
|
18
|
+
function stateMapHasResponsiveArrays(value) {
|
|
19
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
20
|
+
return false;
|
|
21
|
+
return Object.values(value).some((v) => Array.isArray(v));
|
|
22
|
+
}
|
|
23
|
+
// Convert a state-map-of-arrays into an array-of-state-maps of length zoneNumber
|
|
24
|
+
// Example:
|
|
25
|
+
// { '': ['1x', '2x'], large: [null, '3x'] } →
|
|
26
|
+
// [ { '': '1x', large: null }, { '': '2x', large: '3x' } ]
|
|
27
|
+
function stateMapToArrayOfStateMaps(value, zoneNumber) {
|
|
28
|
+
const result = Array.from({ length: zoneNumber }, () => ({}));
|
|
29
|
+
for (const [state, stateValue] of Object.entries(value)) {
|
|
30
|
+
const perZone = Array.isArray(stateValue)
|
|
31
|
+
? normalizeStyleZones(stateValue, zoneNumber)
|
|
32
|
+
: Array(zoneNumber).fill(stateValue);
|
|
33
|
+
for (let i = 0; i < zoneNumber; i++) {
|
|
34
|
+
const v = perZone[i];
|
|
35
|
+
// Always include the state in the result, even if null or empty
|
|
36
|
+
// This preserves the state structure across all breakpoints
|
|
37
|
+
result[i][state] = v;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
// Normalize an array that may contain plain values and/or state maps into
|
|
43
|
+
// an array-of-state-maps of fixed length zoneNumber with propagation.
|
|
44
|
+
// Example:
|
|
45
|
+
// ['1x', { '': '1x', large: '2x' }] (zoneNumber=2) →
|
|
46
|
+
// [ { '': '1x' }, { '': '1x', large: '2x' } ]
|
|
47
|
+
function normalizeArrayWithStateMaps(valueArray, zoneNumber) {
|
|
48
|
+
const propagated = normalizeStyleZones(valueArray, zoneNumber);
|
|
49
|
+
return propagated.map((entry) => {
|
|
50
|
+
if (entry && typeof entry === 'object' && !Array.isArray(entry)) {
|
|
51
|
+
return entry;
|
|
52
|
+
}
|
|
53
|
+
return { '': entry };
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Normalize selector suffixes coming from `$` in style handler results.
|
|
57
|
+
// Some legacy handlers return suffixes starting with `&` (e.g. '& > *').
|
|
58
|
+
// The renderer expects suffixes without the ampersand because it adds
|
|
59
|
+
// the parent selector during materialization.
|
|
60
|
+
function normalizeDollarSelectorSuffix(suffix) {
|
|
61
|
+
if (!suffix)
|
|
62
|
+
return '';
|
|
63
|
+
return suffix.startsWith('&') ? suffix.slice(1) : suffix;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if a key represents a CSS selector
|
|
67
|
+
*/
|
|
10
68
|
export function isSelector(key) {
|
|
11
|
-
return key.startsWith('&') || key.startsWith('.') || key.match(/^[A-Z]/);
|
|
69
|
+
return (key.startsWith('&') || key.startsWith('.') || key.match(/^[A-Z]/) !== null);
|
|
12
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the selector suffix for a key
|
|
73
|
+
*/
|
|
13
74
|
function getSelector(key) {
|
|
14
75
|
if (key.startsWith('&')) {
|
|
15
76
|
return key.slice(1);
|
|
@@ -22,41 +83,306 @@ function getSelector(key) {
|
|
|
22
83
|
}
|
|
23
84
|
return null;
|
|
24
85
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
86
|
+
// Cache for parsed attribute selectors with bounded size to prevent memory leaks
|
|
87
|
+
const attributeSelectorCache = new Lru(5000);
|
|
88
|
+
function parseAttributeSelector(selector) {
|
|
89
|
+
// Check cache first
|
|
90
|
+
const cached = attributeSelectorCache.get(selector);
|
|
91
|
+
if (cached !== undefined) {
|
|
92
|
+
return cached;
|
|
93
|
+
}
|
|
94
|
+
// Match patterns like [data-size="medium"] or [data-is-selected]
|
|
95
|
+
const match = selector.match(/^\[([^=\]]+)(?:="([^"]+)")?\]$/);
|
|
96
|
+
const result = match
|
|
97
|
+
? {
|
|
98
|
+
attribute: match[1],
|
|
99
|
+
value: match[2] || 'true', // Handle boolean attributes
|
|
100
|
+
fullSelector: selector,
|
|
101
|
+
}
|
|
102
|
+
: null;
|
|
103
|
+
// Cache the result
|
|
104
|
+
attributeSelectorCache.set(selector, result);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
function hasConflictingAttributeSelectors(mods, parsedMods) {
|
|
108
|
+
const attributeMap = new Map();
|
|
109
|
+
for (const mod of mods) {
|
|
110
|
+
const parsed = parsedMods?.get(mod) ?? parseAttributeSelector(mod);
|
|
111
|
+
if (parsed && parsed.value !== 'true') {
|
|
112
|
+
if (!attributeMap.has(parsed.attribute)) {
|
|
113
|
+
attributeMap.set(parsed.attribute, []);
|
|
114
|
+
}
|
|
115
|
+
attributeMap.get(parsed.attribute).push(parsed.value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Check if any attribute has multiple values
|
|
119
|
+
for (const values of attributeMap.values()) {
|
|
120
|
+
if (values.length > 1)
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
31
125
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @param responsive - A list of responsive zones
|
|
35
|
-
* @param {string} [suffix]
|
|
36
|
-
* @return {string}
|
|
126
|
+
* Create a conflict checker function that uses precomputed attribute maps
|
|
127
|
+
* for efficient conflict detection during combination generation
|
|
37
128
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
129
|
+
function createAttributeConflictChecker(parsedMods) {
|
|
130
|
+
return (combination) => hasConflictingAttributeSelectors(combination, parsedMods);
|
|
131
|
+
}
|
|
132
|
+
// Build precomputed attribute maps for efficient not selector optimization
|
|
133
|
+
function buildAttributeMaps(currentMods, allMods) {
|
|
134
|
+
const allAttributes = new Map();
|
|
135
|
+
const currentAttributes = new Map();
|
|
136
|
+
const parsedMods = new Map();
|
|
137
|
+
// Parse all mods once and cache results
|
|
138
|
+
const allModsSet = new Set([...currentMods, ...allMods]);
|
|
139
|
+
for (const mod of allModsSet) {
|
|
140
|
+
if (!parsedMods.has(mod)) {
|
|
141
|
+
parsedMods.set(mod, parseAttributeSelector(mod));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Build map of all possible values for each attribute
|
|
145
|
+
for (const mod of allMods) {
|
|
146
|
+
const parsed = parsedMods.get(mod);
|
|
147
|
+
if (parsed && parsed.value !== 'true') {
|
|
148
|
+
if (!allAttributes.has(parsed.attribute)) {
|
|
149
|
+
allAttributes.set(parsed.attribute, new Set());
|
|
150
|
+
}
|
|
151
|
+
allAttributes.get(parsed.attribute).add(parsed.value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Build map of current mod attribute values
|
|
155
|
+
for (const mod of currentMods) {
|
|
156
|
+
const parsed = parsedMods.get(mod);
|
|
157
|
+
if (parsed && parsed.value !== 'true') {
|
|
158
|
+
currentAttributes.set(parsed.attribute, parsed.value);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return { allAttributes, currentAttributes, parsedMods };
|
|
162
|
+
}
|
|
163
|
+
function optimizeNotSelectors(currentMods, allMods, precomputedMaps) {
|
|
164
|
+
const maps = precomputedMaps || buildAttributeMaps(currentMods, allMods);
|
|
165
|
+
const notMods = allMods.filter((mod) => !currentMods.includes(mod));
|
|
166
|
+
const optimizedNotMods = [];
|
|
167
|
+
for (const mod of notMods) {
|
|
168
|
+
const parsed = maps.parsedMods.get(mod);
|
|
169
|
+
if (parsed && parsed.value !== 'true') {
|
|
170
|
+
// If we already have a value for this attribute, skip this not selector
|
|
171
|
+
// because it's already mutually exclusive
|
|
172
|
+
if (maps.currentAttributes.has(parsed.attribute)) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
optimizedNotMods.push(mod);
|
|
177
|
+
}
|
|
178
|
+
return optimizedNotMods;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Explode a style handler result into logical rules with proper mapping
|
|
182
|
+
* Phase 1: Handler fan-out ($ selectors, arrays)
|
|
183
|
+
* Phase 2: Responsive fan-out (breakpoint arrays)
|
|
184
|
+
* Phase 3: Rule materialization
|
|
185
|
+
*/
|
|
186
|
+
function explodeHandlerResult(result, zones, selectorSuffix = '', forceBreakpointIdx, responsiveOrigin = false) {
|
|
187
|
+
if (!result)
|
|
188
|
+
return [];
|
|
189
|
+
// Phase 1: Handler fan-out - normalize to array
|
|
190
|
+
const resultArray = Array.isArray(result) ? result : [result];
|
|
191
|
+
const logicalRules = [];
|
|
192
|
+
for (const item of resultArray) {
|
|
193
|
+
if (!item || typeof item !== 'object')
|
|
194
|
+
continue;
|
|
195
|
+
const { $, css, ...styleProps } = item;
|
|
196
|
+
// Phase 2: Responsive fan-out - handle array values
|
|
197
|
+
const breakpointGroups = new Map();
|
|
198
|
+
if (forceBreakpointIdx !== undefined) {
|
|
199
|
+
// When breakpoint is forced (from responsive processing), use all props for that breakpoint
|
|
200
|
+
const group = {};
|
|
201
|
+
for (const [prop, value] of Object.entries(styleProps)) {
|
|
202
|
+
if (value != null && value !== '') {
|
|
203
|
+
group[prop] = String(value);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (Object.keys(group).length > 0) {
|
|
207
|
+
breakpointGroups.set(forceBreakpointIdx, group);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// Normal processing - handle responsive arrays
|
|
212
|
+
const responsiveProps = [];
|
|
213
|
+
for (const [prop, value] of Object.entries(styleProps)) {
|
|
214
|
+
if (Array.isArray(value)) {
|
|
215
|
+
// Responsive array - create entry for each breakpoint
|
|
216
|
+
value.forEach((val, idx) => {
|
|
217
|
+
if (val != null && val !== '' && idx < zones.length) {
|
|
218
|
+
responsiveProps.push({ prop, value: val, breakpointIdx: idx });
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else if (value != null && value !== '') {
|
|
223
|
+
// Single value - goes to base breakpoint
|
|
224
|
+
responsiveProps.push({ prop, value, breakpointIdx: 0 });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Group by breakpoint index
|
|
228
|
+
for (const { prop, value, breakpointIdx } of responsiveProps) {
|
|
229
|
+
const group = breakpointGroups.get(breakpointIdx) || {};
|
|
230
|
+
group[prop] = String(value);
|
|
231
|
+
breakpointGroups.set(breakpointIdx, group);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Handle raw CSS if present (add to base breakpoint)
|
|
235
|
+
if (css && typeof css === 'string') {
|
|
236
|
+
const baseGroup = breakpointGroups.get(0) || {};
|
|
237
|
+
// For now, we'll add raw CSS as a special property
|
|
238
|
+
// This is a limitation - raw CSS should be parsed properly
|
|
239
|
+
baseGroup['--raw-css'] = css;
|
|
240
|
+
breakpointGroups.set(0, baseGroup);
|
|
241
|
+
}
|
|
242
|
+
// Phase 3: Selector fan-out - handle $ suffixes
|
|
243
|
+
// IMPORTANT: If we are already in a pseudo-element context (contains '::'),
|
|
244
|
+
// CSS does not allow further descendant/child selectors (e.g., '>*') after
|
|
245
|
+
// a pseudo-element. In such cases we must ignore only the `$`-derived
|
|
246
|
+
// selectors while still preserving base declarations for the current
|
|
247
|
+
// selector. Previously this branch returned early and accidentally dropped
|
|
248
|
+
// all declarations computed before, including valid base ones.
|
|
249
|
+
const inPseudoElementContext = selectorSuffix.includes('::');
|
|
250
|
+
if (inPseudoElementContext && $) {
|
|
251
|
+
// Skip this item entirely to avoid producing invalid selectors like
|
|
252
|
+
// `.t0::before>*`. Other items (without $) in the same handler result
|
|
253
|
+
// will still be processed and preserved.
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const suffixes = $
|
|
257
|
+
? (Array.isArray($) ? $ : [$]).map((s) => selectorSuffix + normalizeDollarSelectorSuffix(String(s)))
|
|
258
|
+
: [selectorSuffix];
|
|
259
|
+
// Early identical-breakpoint coalescing: skip duplicate declarations
|
|
260
|
+
const seenDeclarations = new Map();
|
|
261
|
+
// Process breakpoints in order to prefer lower breakpoint indices
|
|
262
|
+
const sortedBreakpoints = Array.from(breakpointGroups.entries()).sort(([a], [b]) => a - b);
|
|
263
|
+
for (const [breakpointIdx, declarations] of sortedBreakpoints) {
|
|
264
|
+
if (Object.keys(declarations).length === 0)
|
|
265
|
+
continue;
|
|
266
|
+
// Create a stable hash key for identical declarations
|
|
267
|
+
const declarationKeys = Object.keys(declarations).sort();
|
|
268
|
+
const declarationHash = declarationKeys
|
|
269
|
+
.map((key) => `${key}:${declarations[key]}`)
|
|
270
|
+
.join(';');
|
|
271
|
+
const existingBreakpointIdx = seenDeclarations.get(declarationHash);
|
|
272
|
+
if (existingBreakpointIdx !== undefined) {
|
|
273
|
+
// Skip this breakpoint as it has identical declarations to a previous one
|
|
274
|
+
// The CSS cascade will handle the responsive behavior correctly
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
// Mark this declaration set as seen
|
|
278
|
+
seenDeclarations.set(declarationHash, breakpointIdx);
|
|
279
|
+
// Create logical rules for this unique declaration set
|
|
280
|
+
for (const suffix of suffixes) {
|
|
281
|
+
logicalRules.push({
|
|
282
|
+
selectorSuffix: suffix,
|
|
283
|
+
breakpointIdx,
|
|
284
|
+
declarations,
|
|
285
|
+
responsiveSource: responsiveOrigin || forceBreakpointIdx !== undefined,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return logicalRules;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Convert handler result (CSSMap) to CSS string for global injection
|
|
294
|
+
*/
|
|
295
|
+
function convertHandlerResultToCSS(result, selectorSuffix = '') {
|
|
296
|
+
if (!result)
|
|
297
|
+
return '';
|
|
298
|
+
if (Array.isArray(result)) {
|
|
299
|
+
return result.reduce((css, item) => {
|
|
300
|
+
return css + convertHandlerResultToCSS(item, selectorSuffix);
|
|
301
|
+
}, '');
|
|
302
|
+
}
|
|
303
|
+
const { $, css, ...styleProps } = result;
|
|
304
|
+
let renderedStyles = Object.keys(styleProps).reduce((styleList, styleName) => {
|
|
305
|
+
const value = styleProps[styleName];
|
|
306
|
+
if (Array.isArray(value)) {
|
|
307
|
+
return (styleList +
|
|
308
|
+
value.reduce((css, val) => {
|
|
309
|
+
if (val) {
|
|
310
|
+
return css + `${styleName}: ${val};\n`;
|
|
311
|
+
}
|
|
312
|
+
return css;
|
|
313
|
+
}, ''));
|
|
314
|
+
}
|
|
315
|
+
if (value) {
|
|
316
|
+
return `${styleList}${styleName}: ${value};\n`;
|
|
317
|
+
}
|
|
318
|
+
return styleList;
|
|
319
|
+
}, '');
|
|
320
|
+
if (css) {
|
|
321
|
+
renderedStyles = css + '\n' + renderedStyles;
|
|
322
|
+
}
|
|
323
|
+
if (!renderedStyles) {
|
|
324
|
+
return '';
|
|
325
|
+
}
|
|
326
|
+
const finalSelectorSuffix = selectorSuffix || '';
|
|
327
|
+
if (Array.isArray($)) {
|
|
328
|
+
return $.reduce((rend, suffix) => {
|
|
329
|
+
const normalized = suffix
|
|
330
|
+
? normalizeDollarSelectorSuffix(String(suffix))
|
|
331
|
+
: '';
|
|
332
|
+
return (rend + `&${finalSelectorSuffix}${normalized}{\n${renderedStyles}}\n`);
|
|
333
|
+
}, '');
|
|
334
|
+
}
|
|
335
|
+
const normalizedSingle = $ ? normalizeDollarSelectorSuffix(String($)) : '';
|
|
336
|
+
return `&${finalSelectorSuffix}${normalizedSingle}{\n${renderedStyles}}\n`;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Convert logical rules to final StyleResult format
|
|
340
|
+
*/
|
|
341
|
+
function materializeRules(logicalRules, className, zones) {
|
|
342
|
+
return logicalRules.map((rule) => {
|
|
343
|
+
const selector = `.${className}${rule.selectorSuffix}`;
|
|
344
|
+
const declarations = Object.entries(rule.declarations)
|
|
345
|
+
.filter(([key]) => key !== '--raw-css') // Skip raw CSS for now
|
|
346
|
+
.map(([prop, value]) => `${prop}: ${value};`)
|
|
347
|
+
.join(' ');
|
|
348
|
+
const q = rule.breakpointIdx > 0
|
|
349
|
+
? zones[rule.breakpointIdx]?.mediaQuery
|
|
350
|
+
: rule.responsiveSource
|
|
351
|
+
? zones[0]?.mediaQuery
|
|
352
|
+
: undefined;
|
|
353
|
+
const atRules = q ? [`@media ${q}`] : undefined;
|
|
354
|
+
return {
|
|
355
|
+
selector,
|
|
356
|
+
declarations,
|
|
357
|
+
atRules,
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Render styles without CSS string conversion
|
|
363
|
+
* This is a performance-optimized version of renderStyles
|
|
364
|
+
*/
|
|
365
|
+
export function renderStyles(styles, responsive = [], className = 'unknown') {
|
|
366
|
+
if (!styles) {
|
|
367
|
+
return { rules: [] };
|
|
368
|
+
}
|
|
369
|
+
const zones = pointsToZones(responsive || []);
|
|
370
|
+
// Collect all logical rules
|
|
371
|
+
const allLogicalRules = [];
|
|
372
|
+
// Process styles recursively, preserving mod selectors and combining with nested selector suffixes
|
|
373
|
+
function processStyles(currentStyles, parentSuffix = '') {
|
|
374
|
+
const keys = Object.keys(currentStyles || {});
|
|
52
375
|
const selectorKeys = keys.filter((key) => isSelector(key));
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
376
|
+
// Recurse into nested selectors first to compute proper suffix chaining
|
|
377
|
+
for (const key of selectorKeys) {
|
|
378
|
+
const suffix = getSelector(key);
|
|
379
|
+
if (suffix && currentStyles[key]) {
|
|
380
|
+
processStyles(currentStyles[key], `${parentSuffix}${suffix}`);
|
|
381
|
+
}
|
|
59
382
|
}
|
|
383
|
+
// Build handler queue for style properties at this level
|
|
384
|
+
const handlerQueue = [];
|
|
385
|
+
const seenHandlers = new Set();
|
|
60
386
|
keys.forEach((styleName) => {
|
|
61
387
|
if (isSelector(styleName))
|
|
62
388
|
return;
|
|
@@ -64,40 +390,54 @@ export function renderStyles(styles, responsive = [], suffix) {
|
|
|
64
390
|
if (!handlers) {
|
|
65
391
|
handlers = STYLE_HANDLER_MAP[styleName] = [createStyle(styleName)];
|
|
66
392
|
}
|
|
67
|
-
handlers.forEach((
|
|
68
|
-
if (
|
|
393
|
+
handlers.forEach((handler) => {
|
|
394
|
+
if (seenHandlers.has(handler)) {
|
|
69
395
|
return;
|
|
396
|
+
}
|
|
397
|
+
seenHandlers.add(handler);
|
|
70
398
|
let isResponsive = false;
|
|
71
|
-
const lookupStyles =
|
|
399
|
+
const lookupStyles = handler.__lookupStyles;
|
|
72
400
|
const filteredStyleMap = lookupStyles.reduce((map, name) => {
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
401
|
+
const value = currentStyles?.[name];
|
|
402
|
+
if (value !== undefined) {
|
|
403
|
+
// Case 1: state-map-of-arrays → array-of-state-maps
|
|
404
|
+
if (value &&
|
|
405
|
+
typeof value === 'object' &&
|
|
406
|
+
!Array.isArray(value) &&
|
|
407
|
+
stateMapHasResponsiveArrays(value)) {
|
|
408
|
+
map[name] = stateMapToArrayOfStateMaps(value, zones.length);
|
|
409
|
+
isResponsive = true;
|
|
77
410
|
}
|
|
78
|
-
else {
|
|
79
|
-
|
|
80
|
-
|
|
411
|
+
else if (Array.isArray(value)) {
|
|
412
|
+
// Case 2: array that may contain state maps → normalize to array-of-state-maps
|
|
413
|
+
if (value.length > 0) {
|
|
414
|
+
map[name] = normalizeArrayWithStateMaps(value, zones.length);
|
|
415
|
+
isResponsive = true;
|
|
81
416
|
}
|
|
82
|
-
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
map[name] = value;
|
|
83
420
|
}
|
|
84
421
|
}
|
|
85
422
|
return map;
|
|
86
423
|
}, {});
|
|
87
424
|
handlerQueue.push({
|
|
88
|
-
handler
|
|
425
|
+
handler,
|
|
89
426
|
styleMap: filteredStyleMap,
|
|
90
427
|
isResponsive,
|
|
91
428
|
});
|
|
92
429
|
});
|
|
93
430
|
});
|
|
431
|
+
// Process handlers using the three-phase approach
|
|
94
432
|
handlerQueue.forEach(({ handler, styleMap, isResponsive }) => {
|
|
95
433
|
const lookupStyles = handler.__lookupStyles;
|
|
96
434
|
if (isResponsive) {
|
|
435
|
+
// For responsive styles, resolve arrays using normalizeStyleZones
|
|
97
436
|
const valueMap = lookupStyles.reduce((map, style) => {
|
|
98
437
|
map[style] = normalizeStyleZones(styleMap[style], zones.length);
|
|
99
438
|
return map;
|
|
100
439
|
}, {});
|
|
440
|
+
// Create props for each breakpoint
|
|
101
441
|
const propsByPoint = zones.map((zone, i) => {
|
|
102
442
|
const pointProps = {};
|
|
103
443
|
lookupStyles.forEach((style) => {
|
|
@@ -107,23 +447,472 @@ export function renderStyles(styles, responsive = [], suffix) {
|
|
|
107
447
|
});
|
|
108
448
|
return pointProps;
|
|
109
449
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
450
|
+
// Call handler for each breakpoint, with state map processing if needed
|
|
451
|
+
propsByPoint.forEach((pointProps, breakpointIdx) => {
|
|
452
|
+
const hasStateMapsAtPoint = lookupStyles.some((style) => {
|
|
453
|
+
const v = pointProps[style];
|
|
454
|
+
return v && typeof v === 'object' && !Array.isArray(v);
|
|
455
|
+
});
|
|
456
|
+
if (hasStateMapsAtPoint) {
|
|
457
|
+
const allMods = new Set();
|
|
458
|
+
const styleStates = {};
|
|
459
|
+
lookupStyles.forEach((style) => {
|
|
460
|
+
const v = pointProps[style];
|
|
461
|
+
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
462
|
+
const { states, mods } = styleStateMapToStyleStateDataList(v);
|
|
463
|
+
styleStates[style] = states;
|
|
464
|
+
mods.forEach((m) => allMods.add(m));
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
styleStates[style] = [{ mods: [], notMods: [], value: v }];
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
const allModsArray = Array.from(allMods);
|
|
471
|
+
// Precompute attribute maps once for all combinations
|
|
472
|
+
const attributeMaps = buildAttributeMaps([], allModsArray);
|
|
473
|
+
// Generate combinations with conflict-aware pruning
|
|
474
|
+
const conflictChecker = createAttributeConflictChecker(attributeMaps.parsedMods);
|
|
475
|
+
const combinations = getModCombinationsIterative(allModsArray, true, conflictChecker);
|
|
476
|
+
combinations.forEach((modCombination) => {
|
|
477
|
+
const stateProps = {};
|
|
478
|
+
lookupStyles.forEach((style) => {
|
|
479
|
+
const states = styleStates[style];
|
|
480
|
+
const matchingState = states.find((state) => computeState(state.model, (mod) => modCombination.includes(mod)));
|
|
481
|
+
if (matchingState) {
|
|
482
|
+
stateProps[style] = matchingState.value;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
// Use precomputed maps for efficient not selector optimization
|
|
486
|
+
const currentMaps = buildAttributeMaps(modCombination, allModsArray);
|
|
487
|
+
const optimizedNotMods = optimizeNotSelectors(modCombination, allModsArray, currentMaps);
|
|
488
|
+
const modsSelectors = `${modCombination
|
|
489
|
+
.map(getModSelector)
|
|
490
|
+
.join('')}${optimizedNotMods
|
|
491
|
+
.map((mod) => {
|
|
492
|
+
const sel = getModSelector(mod);
|
|
493
|
+
return sel.startsWith(':not(')
|
|
494
|
+
? sel.slice(5, -1)
|
|
495
|
+
: `:not(${sel})`;
|
|
496
|
+
})
|
|
497
|
+
.join('')}`;
|
|
498
|
+
const result = handler(stateProps);
|
|
499
|
+
if (!result)
|
|
500
|
+
return;
|
|
501
|
+
const logicalRules = explodeHandlerResult(result, zones || [], `${modsSelectors}${parentSuffix}`, breakpointIdx, true);
|
|
502
|
+
allLogicalRules.push(...logicalRules);
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
const result = handler(pointProps);
|
|
507
|
+
if (!result)
|
|
508
|
+
return;
|
|
509
|
+
const logicalRules = explodeHandlerResult(result, zones || [], parentSuffix, breakpointIdx, true);
|
|
510
|
+
allLogicalRules.push(...logicalRules);
|
|
511
|
+
}
|
|
113
512
|
});
|
|
114
513
|
}
|
|
115
514
|
else {
|
|
116
|
-
|
|
117
|
-
|
|
515
|
+
// For non-responsive styles, check if any values have state maps
|
|
516
|
+
const hasStateMaps = lookupStyles.some((style) => {
|
|
517
|
+
const value = styleMap[style];
|
|
518
|
+
return value && typeof value === 'object' && !Array.isArray(value);
|
|
519
|
+
});
|
|
520
|
+
if (hasStateMaps) {
|
|
521
|
+
// Process each style property individually for state resolution
|
|
522
|
+
const allMods = new Set();
|
|
523
|
+
const styleStates = {};
|
|
524
|
+
lookupStyles.forEach((style) => {
|
|
525
|
+
const value = styleMap[style];
|
|
526
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
527
|
+
const { states, mods } = styleStateMapToStyleStateDataList(value);
|
|
528
|
+
styleStates[style] = states;
|
|
529
|
+
mods.forEach((mod) => allMods.add(mod));
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
// Simple value, create a single state
|
|
533
|
+
styleStates[style] = [{ mods: [], notMods: [], value }];
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
// Generate all possible mod combinations
|
|
537
|
+
const allModsArray = Array.from(allMods);
|
|
538
|
+
// Precompute attribute maps once for all combinations
|
|
539
|
+
const attributeMaps = buildAttributeMaps([], allModsArray);
|
|
540
|
+
// Generate combinations with conflict-aware pruning
|
|
541
|
+
const conflictChecker = createAttributeConflictChecker(attributeMaps.parsedMods);
|
|
542
|
+
const combinations = getModCombinationsIterative(allModsArray, true, conflictChecker);
|
|
543
|
+
combinations.forEach((modCombination) => {
|
|
544
|
+
const stateProps = {};
|
|
545
|
+
lookupStyles.forEach((style) => {
|
|
546
|
+
const states = styleStates[style];
|
|
547
|
+
// Find the matching state for this mod combination
|
|
548
|
+
const matchingState = states.find((state) => {
|
|
549
|
+
return computeState(state.model, (mod) => modCombination.includes(mod));
|
|
550
|
+
});
|
|
551
|
+
if (matchingState) {
|
|
552
|
+
stateProps[style] = matchingState.value;
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
// Use precomputed maps for efficient not selector optimization
|
|
556
|
+
const currentMaps = buildAttributeMaps(modCombination, allModsArray);
|
|
557
|
+
const optimizedNotMods = optimizeNotSelectors(modCombination, allModsArray, currentMaps);
|
|
558
|
+
const modsSelectors = `${modCombination
|
|
559
|
+
.map(getModSelector)
|
|
560
|
+
.join('')}${optimizedNotMods
|
|
561
|
+
.map((mod) => {
|
|
562
|
+
const sel = getModSelector(mod);
|
|
563
|
+
return sel.startsWith(':not(')
|
|
564
|
+
? sel.slice(5, -1)
|
|
565
|
+
: `:not(${sel})`;
|
|
566
|
+
})
|
|
567
|
+
.join('')}`;
|
|
568
|
+
// If any state value is responsive (array), fan-out by breakpoint
|
|
569
|
+
const hasResponsiveStateValues = lookupStyles.some((style) => Array.isArray(stateProps[style]));
|
|
570
|
+
if (hasResponsiveStateValues) {
|
|
571
|
+
const propsByPoint = zones.map((_, i) => {
|
|
572
|
+
const pointProps = {};
|
|
573
|
+
lookupStyles.forEach((style) => {
|
|
574
|
+
const v = stateProps[style];
|
|
575
|
+
if (Array.isArray(v)) {
|
|
576
|
+
const arr = normalizeStyleZones(v, zones.length);
|
|
577
|
+
pointProps[style] = arr?.[i];
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
pointProps[style] = v;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
return pointProps;
|
|
584
|
+
});
|
|
585
|
+
propsByPoint.forEach((props, breakpointIdx) => {
|
|
586
|
+
const res = handler(props);
|
|
587
|
+
if (!res)
|
|
588
|
+
return;
|
|
589
|
+
const logical = explodeHandlerResult(res, zones || [], `${modsSelectors}${parentSuffix}`, breakpointIdx, true);
|
|
590
|
+
allLogicalRules.push(...logical);
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
// Simple non-responsive state values
|
|
595
|
+
const result = handler(stateProps);
|
|
596
|
+
if (!result)
|
|
597
|
+
return;
|
|
598
|
+
const logical = explodeHandlerResult(result, zones || [], `${modsSelectors}${parentSuffix}`);
|
|
599
|
+
allLogicalRules.push(...logical);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
// Simple case: no state maps, call handler directly
|
|
605
|
+
const result = handler(styleMap);
|
|
606
|
+
if (result) {
|
|
607
|
+
const logical = explodeHandlerResult(result, zones || [], parentSuffix);
|
|
608
|
+
allLogicalRules.push(...logical);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
118
611
|
}
|
|
119
612
|
});
|
|
120
|
-
STYLE_CACHE[cacheKey] = `&${suffix || ''}{outline: none;\n&[hidden]{display: none !important;}}${rawStyles}${responsive &&
|
|
121
|
-
responsive.length &&
|
|
122
|
-
responsiveStyles.filter((s) => s).length
|
|
123
|
-
? mediaWrapper(responsiveStyles, zones)
|
|
124
|
-
: ''}${innerStyles}`;
|
|
125
613
|
}
|
|
126
|
-
|
|
614
|
+
// Kick off processing from the root styles with empty suffix
|
|
615
|
+
processStyles(styles, '');
|
|
616
|
+
// Accumulate declarations before materialization to reduce duplication
|
|
617
|
+
const accumulatedRules = new Map();
|
|
618
|
+
for (const rule of allLogicalRules) {
|
|
619
|
+
// Create a key based on breakpointIdx, selectorSuffix, and responsiveOrigin
|
|
620
|
+
const ruleKey = `${rule.breakpointIdx}|${rule.selectorSuffix}|${rule.responsiveSource}`;
|
|
621
|
+
const existing = accumulatedRules.get(ruleKey);
|
|
622
|
+
if (existing) {
|
|
623
|
+
// Merge declarations from this rule into the existing one
|
|
624
|
+
Object.assign(existing.declarations, rule.declarations);
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
// Create a new accumulated rule
|
|
628
|
+
accumulatedRules.set(ruleKey, {
|
|
629
|
+
selectorSuffix: rule.selectorSuffix,
|
|
630
|
+
breakpointIdx: rule.breakpointIdx,
|
|
631
|
+
declarations: { ...rule.declarations },
|
|
632
|
+
responsiveSource: rule.responsiveSource,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
// Materialize the accumulated logical rules into final format
|
|
637
|
+
const finalRulesRaw = materializeRules(Array.from(accumulatedRules.values()), className, zones || []);
|
|
638
|
+
// Simplified deduplication (should be much less work now)
|
|
639
|
+
const seen = new Set();
|
|
640
|
+
const finalRules = finalRulesRaw.filter((rule) => {
|
|
641
|
+
const at = rule.atRules && rule.atRules.length ? `@${rule.atRules.join('|')}` : '';
|
|
642
|
+
const key = `${rule.selector}|${rule.declarations}|${at}`;
|
|
643
|
+
if (seen.has(key))
|
|
644
|
+
return false;
|
|
645
|
+
seen.add(key);
|
|
646
|
+
return true;
|
|
647
|
+
});
|
|
648
|
+
return {
|
|
649
|
+
rules: finalRules,
|
|
650
|
+
className,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Render styles for global injection (without class names)
|
|
655
|
+
* Returns CSS with & selectors that injectGlobal can process
|
|
656
|
+
*/
|
|
657
|
+
export function renderStylesForGlobal(styles, responsive = []) {
|
|
658
|
+
if (!styles) {
|
|
659
|
+
return '';
|
|
660
|
+
}
|
|
661
|
+
const zones = pointsToZones(responsive || []);
|
|
662
|
+
const handlerQueue = [];
|
|
663
|
+
const keys = Object.keys(styles);
|
|
664
|
+
const selectorKeys = keys.filter((key) => isSelector(key));
|
|
665
|
+
const declarations = [];
|
|
666
|
+
const responsiveStyles = Array.from(Array(zones.length)).map(() => '');
|
|
667
|
+
let innerStyles = '';
|
|
668
|
+
// Handle nested selectors (like &:hover, .SubElement)
|
|
669
|
+
for (const key of selectorKeys) {
|
|
670
|
+
const selectorSuffix = getSelector(key);
|
|
671
|
+
if (selectorSuffix && styles[key]) {
|
|
672
|
+
const nestedStyles = styles[key];
|
|
673
|
+
innerStyles += renderStylesForGlobal(nestedStyles, responsive).replace(/&/g, `&${selectorSuffix}`);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// Build handler queue for base styles
|
|
677
|
+
const seenHandlers = new Set();
|
|
678
|
+
keys.forEach((styleName) => {
|
|
679
|
+
if (isSelector(styleName))
|
|
680
|
+
return;
|
|
681
|
+
let handlers = STYLE_HANDLER_MAP[styleName];
|
|
682
|
+
if (!handlers) {
|
|
683
|
+
handlers = STYLE_HANDLER_MAP[styleName] = [createStyle(styleName)];
|
|
684
|
+
}
|
|
685
|
+
handlers.forEach((handler) => {
|
|
686
|
+
if (seenHandlers.has(handler)) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
seenHandlers.add(handler);
|
|
690
|
+
let isResponsive = false;
|
|
691
|
+
const lookupStyles = handler.__lookupStyles;
|
|
692
|
+
const filteredStyleMap = lookupStyles.reduce((map, name) => {
|
|
693
|
+
const value = styles?.[name];
|
|
694
|
+
if (value !== undefined) {
|
|
695
|
+
if (value &&
|
|
696
|
+
typeof value === 'object' &&
|
|
697
|
+
!Array.isArray(value) &&
|
|
698
|
+
stateMapHasResponsiveArrays(value)) {
|
|
699
|
+
map[name] = stateMapToArrayOfStateMaps(value, zones.length);
|
|
700
|
+
isResponsive = true;
|
|
701
|
+
}
|
|
702
|
+
else if (Array.isArray(value)) {
|
|
703
|
+
if (value.length > 0) {
|
|
704
|
+
map[name] = normalizeArrayWithStateMaps(value, zones.length);
|
|
705
|
+
isResponsive = true;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
map[name] = value;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return map;
|
|
713
|
+
}, {});
|
|
714
|
+
handlerQueue.push({
|
|
715
|
+
handler,
|
|
716
|
+
styleMap: filteredStyleMap,
|
|
717
|
+
isResponsive,
|
|
718
|
+
});
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
// Process handlers using approach
|
|
722
|
+
handlerQueue.forEach(({ handler, styleMap, isResponsive }) => {
|
|
723
|
+
const lookupStyles = handler.__lookupStyles;
|
|
724
|
+
if (isResponsive) {
|
|
725
|
+
// For responsive styles, resolve arrays using normalizeStyleZones
|
|
726
|
+
const valueMap = lookupStyles.reduce((map, style) => {
|
|
727
|
+
map[style] = normalizeStyleZones(styleMap[style], zones.length);
|
|
728
|
+
return map;
|
|
729
|
+
}, {});
|
|
730
|
+
// Create props for each breakpoint
|
|
731
|
+
const propsByPoint = zones.map((zone, i) => {
|
|
732
|
+
const pointProps = {};
|
|
733
|
+
lookupStyles.forEach((style) => {
|
|
734
|
+
if (valueMap != null && valueMap[style] != null) {
|
|
735
|
+
pointProps[style] = valueMap[style][i];
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
return pointProps;
|
|
739
|
+
});
|
|
740
|
+
// Call handler for each breakpoint and convert to CSS, with state processing
|
|
741
|
+
propsByPoint.forEach((pointProps, i) => {
|
|
742
|
+
const hasStateMapsAtPoint = lookupStyles.some((style) => {
|
|
743
|
+
const v = pointProps[style];
|
|
744
|
+
return v && typeof v === 'object' && !Array.isArray(v);
|
|
745
|
+
});
|
|
746
|
+
if (hasStateMapsAtPoint) {
|
|
747
|
+
const allMods = new Set();
|
|
748
|
+
const styleStates = {};
|
|
749
|
+
lookupStyles.forEach((style) => {
|
|
750
|
+
const v = pointProps[style];
|
|
751
|
+
if (v && typeof v === 'object' && !Array.isArray(v)) {
|
|
752
|
+
const { states, mods } = styleStateMapToStyleStateDataList(v);
|
|
753
|
+
styleStates[style] = states;
|
|
754
|
+
mods.forEach((m) => allMods.add(m));
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
styleStates[style] = [{ mods: [], notMods: [], value: v }];
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
const allModsArray = Array.from(allMods);
|
|
761
|
+
// Precompute attribute maps once for all combinations
|
|
762
|
+
const attributeMaps = buildAttributeMaps([], allModsArray);
|
|
763
|
+
// Generate combinations with conflict-aware pruning
|
|
764
|
+
const conflictChecker = createAttributeConflictChecker(attributeMaps.parsedMods);
|
|
765
|
+
const combinations = getModCombinationsIterative(allModsArray, true, conflictChecker);
|
|
766
|
+
combinations.forEach((modCombination) => {
|
|
767
|
+
const stateProps = {};
|
|
768
|
+
lookupStyles.forEach((style) => {
|
|
769
|
+
const states = styleStates[style];
|
|
770
|
+
const matchingState = states.find((state) => computeState(state.model, (mod) => modCombination.includes(mod)));
|
|
771
|
+
if (matchingState) {
|
|
772
|
+
stateProps[style] = matchingState.value;
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
// Use precomputed maps for efficient not selector optimization
|
|
776
|
+
const currentMaps = buildAttributeMaps(modCombination, allModsArray);
|
|
777
|
+
const optimizedNotMods = optimizeNotSelectors(modCombination, allModsArray, currentMaps);
|
|
778
|
+
const modsSelectors = `${modCombination
|
|
779
|
+
.map(getModSelector)
|
|
780
|
+
.join('')}${optimizedNotMods
|
|
781
|
+
.map((mod) => {
|
|
782
|
+
const sel = getModSelector(mod);
|
|
783
|
+
return sel.startsWith(':not(')
|
|
784
|
+
? sel.slice(5, -1)
|
|
785
|
+
: `:not(${sel})`;
|
|
786
|
+
})
|
|
787
|
+
.join('')}`;
|
|
788
|
+
const result = handler(stateProps);
|
|
789
|
+
if (!result)
|
|
790
|
+
return;
|
|
791
|
+
const cssResult = convertHandlerResultToCSS(result, modsSelectors);
|
|
792
|
+
if (cssResult) {
|
|
793
|
+
responsiveStyles[i] += cssResult;
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
const result = handler(pointProps);
|
|
799
|
+
if (!result)
|
|
800
|
+
return;
|
|
801
|
+
const cssResult = convertHandlerResultToCSS(result);
|
|
802
|
+
if (cssResult) {
|
|
803
|
+
responsiveStyles[i] += cssResult;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
// For non-responsive styles, check if any values have state maps
|
|
810
|
+
const hasStateMaps = lookupStyles.some((style) => {
|
|
811
|
+
const value = styleMap[style];
|
|
812
|
+
return value && typeof value === 'object' && !Array.isArray(value);
|
|
813
|
+
});
|
|
814
|
+
if (hasStateMaps) {
|
|
815
|
+
// Process each style property individually for state resolution
|
|
816
|
+
const allMods = new Set();
|
|
817
|
+
const styleStates = {};
|
|
818
|
+
lookupStyles.forEach((style) => {
|
|
819
|
+
const value = styleMap[style];
|
|
820
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
821
|
+
const { states, mods } = styleStateMapToStyleStateDataList(value);
|
|
822
|
+
styleStates[style] = states;
|
|
823
|
+
mods.forEach((mod) => allMods.add(mod));
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
// Simple value, create a single state
|
|
827
|
+
styleStates[style] = [{ mods: [], notMods: [], value }];
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
// Generate all possible mod combinations
|
|
831
|
+
const allModsArray = Array.from(allMods);
|
|
832
|
+
// Precompute attribute maps once for all combinations
|
|
833
|
+
const attributeMaps = buildAttributeMaps([], allModsArray);
|
|
834
|
+
// Generate combinations with conflict-aware pruning
|
|
835
|
+
const conflictChecker = createAttributeConflictChecker(attributeMaps.parsedMods);
|
|
836
|
+
const combinations = getModCombinationsIterative(allModsArray, true, conflictChecker);
|
|
837
|
+
combinations.forEach((modCombination) => {
|
|
838
|
+
const stateProps = {};
|
|
839
|
+
lookupStyles.forEach((style) => {
|
|
840
|
+
const states = styleStates[style];
|
|
841
|
+
// Find the matching state for this mod combination
|
|
842
|
+
const matchingState = states.find((state) => {
|
|
843
|
+
return computeState(state.model, (mod) => modCombination.includes(mod));
|
|
844
|
+
});
|
|
845
|
+
if (matchingState) {
|
|
846
|
+
stateProps[style] = matchingState.value;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
const result = handler(stateProps);
|
|
850
|
+
if (!result)
|
|
851
|
+
return;
|
|
852
|
+
// Use precomputed maps for efficient not selector optimization
|
|
853
|
+
const currentMaps = buildAttributeMaps(modCombination, allModsArray);
|
|
854
|
+
const optimizedNotMods = optimizeNotSelectors(modCombination, allModsArray, currentMaps);
|
|
855
|
+
const modsSelectors = `${modCombination
|
|
856
|
+
.map(getModSelector)
|
|
857
|
+
.join('')}${optimizedNotMods
|
|
858
|
+
.map((mod) => {
|
|
859
|
+
const sel = getModSelector(mod);
|
|
860
|
+
return sel.startsWith(':not(')
|
|
861
|
+
? sel.slice(5, -1)
|
|
862
|
+
: `:not(${sel})`;
|
|
863
|
+
})
|
|
864
|
+
.join('')}`;
|
|
865
|
+
// Convert to CSS with proper selectors
|
|
866
|
+
const cssResult = convertHandlerResultToCSS(result, modsSelectors);
|
|
867
|
+
if (cssResult) {
|
|
868
|
+
if (cssResult.startsWith('& {') && !cssResult.includes('&', 2)) {
|
|
869
|
+
// Simple rule: "& { declarations }"
|
|
870
|
+
const declarationBlock = cssResult.slice(3, -1).trim();
|
|
871
|
+
if (declarationBlock) {
|
|
872
|
+
declarations.push(declarationBlock);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
// Complex rule with nested selectors or state modifiers
|
|
877
|
+
innerStyles += cssResult;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
// Simple case: no state maps, call handler directly
|
|
884
|
+
const result = handler(styleMap);
|
|
885
|
+
if (result) {
|
|
886
|
+
const cssResult = convertHandlerResultToCSS(result);
|
|
887
|
+
if (cssResult) {
|
|
888
|
+
if (cssResult.startsWith('& {') && !cssResult.includes('&', 2)) {
|
|
889
|
+
// Simple rule: "& { declarations }"
|
|
890
|
+
const declarationBlock = cssResult.slice(3, -1).trim();
|
|
891
|
+
if (declarationBlock) {
|
|
892
|
+
declarations.push(declarationBlock);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
else {
|
|
896
|
+
// Complex rule with nested selectors or state modifiers
|
|
897
|
+
innerStyles += cssResult;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
});
|
|
904
|
+
// Build final CSS similar to original renderStyles
|
|
905
|
+
// Merge all declarations into a single rule
|
|
906
|
+
const baseRule = declarations.length > 0 ? `& { ${declarations.join('\n')} }` : '';
|
|
907
|
+
const mediaRules = responsive && responsive.length && responsiveStyles.some((s) => s)
|
|
908
|
+
? mediaWrapper(responsiveStyles, zones)
|
|
909
|
+
: '';
|
|
910
|
+
// Ensure we always separate the base rule, inner complex selectors and media rules with
|
|
911
|
+
// a newline so the selector replacement step ( & -> actual selector ) cannot accidentally
|
|
912
|
+
// concatenate two selectors and create the invalid form "..selector selector".
|
|
913
|
+
const parts = [baseRule, innerStyles, mediaRules].filter(Boolean);
|
|
914
|
+
const result = parts.join('\n');
|
|
915
|
+
return result;
|
|
127
916
|
}
|
|
128
917
|
|
|
129
918
|
|