@astryxdesign/core 0.1.4-canary.ff77e1c → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +18 -20
- package/dist/AlertDialog/useImperativeAlertDialog.js +3 -3
- package/dist/AppShell/AppShell.d.ts +1 -1
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +53 -55
- package/dist/AspectRatio/AspectRatio.d.ts +10 -48
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +12 -33
- package/dist/AspectRatio/index.d.ts +1 -1
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +25 -27
- package/dist/Avatar/AvatarStatusDot.js +5 -5
- package/dist/AvatarGroup/AvatarGroup.js +5 -5
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -5
- package/dist/Badge/Badge.js +3 -3
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +25 -32
- package/dist/Blockquote/Blockquote.js +7 -7
- package/dist/Breadcrumbs/BreadcrumbItem.js +17 -17
- package/dist/Breadcrumbs/Breadcrumbs.js +7 -7
- package/dist/Button/Button.js +19 -19
- package/dist/ButtonGroup/ButtonGroup.js +7 -7
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +48 -68
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +2 -2
- package/dist/Card/Card.d.ts +2 -4
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +10 -18
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +21 -24
- package/dist/Carousel/carousel.markers.stylex.d.ts +7 -0
- package/dist/Carousel/carousel.markers.stylex.d.ts.map +1 -0
- package/dist/Carousel/carousel.markers.stylex.js +12 -0
- package/dist/Center/Center.js +3 -3
- package/dist/Chat/ChatComposer.js +23 -23
- package/dist/Chat/ChatComposerDrawer.js +14 -14
- package/dist/Chat/ChatComposerInput.d.ts +1 -1
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +15 -27
- package/dist/Chat/ChatDictationButton.d.ts +1 -1
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +11 -13
- package/dist/Chat/ChatLayout.js +17 -17
- package/dist/Chat/ChatLayoutScrollButton.d.ts +1 -1
- package/dist/Chat/ChatLayoutScrollButton.d.ts.map +1 -1
- package/dist/Chat/ChatLayoutScrollButton.js +10 -12
- package/dist/Chat/ChatMessage.js +12 -12
- package/dist/Chat/ChatMessageBubble.js +7 -7
- package/dist/Chat/ChatMessageList.js +14 -14
- package/dist/Chat/ChatMessageMetadata.d.ts +1 -1
- package/dist/Chat/ChatMessageMetadata.d.ts.map +1 -1
- package/dist/Chat/ChatMessageMetadata.js +12 -14
- package/dist/Chat/ChatPastedTextToken.js +13 -13
- package/dist/Chat/ChatSendButton.js +3 -3
- package/dist/Chat/ChatSystemMessage.d.ts +1 -1
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +17 -17
- package/dist/Chat/ChatTokenizedText.d.ts +1 -1
- package/dist/Chat/ChatTokenizedText.d.ts.map +1 -1
- package/dist/Chat/ChatTokenizedText.js +15 -24
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +74 -81
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +15 -15
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +23 -25
- package/dist/CheckboxList/CheckboxList.js +9 -9
- package/dist/CheckboxList/CheckboxListItem.d.ts +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +6 -8
- package/dist/Citation/Citation.js +10 -10
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +9 -32
- package/dist/Code/Code.js +3 -3
- package/dist/CodeBlock/CodeBlock.d.ts +1 -10
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +52 -88
- package/dist/Collapsible/Collapsible.d.ts +3 -9
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +22 -110
- package/dist/Collapsible/CollapsibleGroup.d.ts +7 -39
- package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroup.js +12 -73
- package/dist/Collapsible/CollapsibleGroupContext.d.ts +0 -31
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -33
- package/dist/Collapsible/index.d.ts +0 -1
- package/dist/Collapsible/index.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.d.ts +1 -4
- package/dist/Collapsible/useCollapsible.d.ts.map +1 -1
- package/dist/Collapsible/useCollapsible.js +6 -20
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +34 -36
- package/dist/CommandPalette/CommandPaletteEmpty.js +3 -3
- package/dist/CommandPalette/CommandPaletteFooter.js +16 -16
- package/dist/CommandPalette/CommandPaletteGroup.js +5 -5
- package/dist/CommandPalette/CommandPaletteInput.js +13 -13
- package/dist/CommandPalette/CommandPaletteItem.js +3 -3
- package/dist/CommandPalette/CommandPaletteList.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +2 -7
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +43 -76
- package/dist/DateInput/DateInput.js +18 -18
- package/dist/DateRangeInput/DateRangeInput.js +21 -21
- package/dist/DateTimeInput/DateTimeInput.d.ts +2 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +26 -30
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -9
- package/dist/Dialog/DialogHeader.js +16 -16
- package/dist/Dialog/useImperativeDialog.js +3 -3
- package/dist/Divider/Divider.js +7 -7
- package/dist/DropdownMenu/DropdownMenu.js +10 -10
- package/dist/DropdownMenu/DropdownMenuItem.d.ts +17 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -3
- package/dist/DropdownMenu/renderDropdownItems.js +10 -10
- package/dist/EmptyState/EmptyState.js +9 -9
- package/dist/Field/Field.js +17 -17
- package/dist/Field/FieldLabel.js +15 -15
- package/dist/Field/InputClearButton.js +5 -5
- package/dist/FieldStatus/FieldStatus.js +3 -3
- package/dist/FileInput/FileInput.js +29 -29
- package/dist/FormLayout/FormLayout.js +5 -5
- package/dist/Grid/Grid.d.ts +3 -4
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +12 -29
- package/dist/Grid/GridSpan.js +3 -3
- package/dist/HStack/HStack.js +3 -3
- package/dist/Heading/Heading.js +10 -10
- package/dist/HoverCard/HoverCard.js +9 -9
- package/dist/HoverCard/useHoverCard.d.ts +1 -5
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +12 -16
- package/dist/Icon/defaultIcons.js +116 -116
- package/dist/IconButton/IconButton.js +3 -3
- package/dist/InputGroup/InputGroup.js +11 -11
- package/dist/InputGroup/InputGroupText.js +3 -3
- package/dist/Item/Item.js +18 -18
- package/dist/Kbd/Kbd.js +5 -5
- package/dist/Layer/LayerProvider.js +7 -7
- package/dist/Layer/useLayer.d.ts +2 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +31 -44
- package/dist/Layout/Layout.js +21 -21
- package/dist/Layout/LayoutContent.js +3 -3
- package/dist/Layout/LayoutFooter.js +5 -5
- package/dist/Layout/LayoutHeader.js +5 -5
- package/dist/Layout/LayoutPanel.js +3 -3
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +31 -55
- package/dist/Lightbox/useLightbox.js +3 -3
- package/dist/Link/Link.js +15 -15
- package/dist/Link/LinkProvider.js +3 -3
- package/dist/Link/useLinkify.js +3 -3
- package/dist/List/List.js +11 -11
- package/dist/List/ListItem.js +11 -11
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +102 -102
- package/dist/MetadataList/MetadataList.js +10 -10
- package/dist/MetadataList/MetadataListItem.js +15 -15
- package/dist/MobileNav/MobileNav.d.ts +1 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +23 -26
- package/dist/MobileNav/MobileNavToggle.js +5 -5
- package/dist/MoreMenu/MoreMenu.js +3 -3
- package/dist/MultiSelector/MultiSelector.js +56 -56
- package/dist/NavIcon/NavIcon.js +3 -3
- package/dist/NavMenu/NavHeadingMenu.js +5 -5
- package/dist/NavMenu/NavHeadingMenuItem.js +8 -8
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +32 -48
- package/dist/Outline/Outline.js +15 -15
- package/dist/OverflowList/OverflowList.js +8 -8
- package/dist/Overlay/Overlay.js +3 -3
- package/dist/Overlay/OverlayScrim.js +5 -5
- package/dist/Overlay/useOverlay.js +3 -3
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +72 -125
- package/dist/Popover/Popover.js +16 -16
- package/dist/Popover/usePopover.js +7 -7
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +92 -110
- package/dist/PowerSearch/PowerSearchEditPopover.js +84 -84
- package/dist/PowerSearch/PowerSearchFilterEditor.js +3 -3
- package/dist/PowerSearch/PowerSearchToken.js +5 -5
- package/dist/PowerSearch/PowerSearchValueEditor.js +54 -54
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +18 -25
- package/dist/RadioList/RadioList.js +7 -7
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +21 -24
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -28
- package/dist/Section/Section.js +5 -5
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +10 -32
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +12 -18
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Selector/Selector.js +46 -46
- package/dist/Selector/SelectorOption.js +3 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +34 -38
- package/dist/SideNav/SideNavCollapseButton.d.ts +1 -1
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +6 -8
- package/dist/SideNav/SideNavHeading.js +87 -87
- package/dist/SideNav/SideNavItem.js +42 -42
- package/dist/SideNav/SideNavSection.d.ts +1 -1
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +16 -18
- package/dist/Skeleton/Skeleton.js +3 -3
- package/dist/Slider/Slider.js +23 -23
- package/dist/Spinner/Spinner.js +9 -9
- package/dist/StatusDot/StatusDot.js +5 -5
- package/dist/Switch/Switch.d.ts +4 -8
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +29 -34
- package/dist/TabList/Tab.js +18 -18
- package/dist/TabList/TabList.js +5 -5
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +30 -57
- package/dist/TabList/tab.markers.stylex.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +39 -50
- package/dist/Table/Table.js +7 -7
- package/dist/Table/TableBody.d.ts +1 -1
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -9
- package/dist/Table/TableCell.js +3 -3
- package/dist/Table/TableFooter.d.ts +1 -1
- package/dist/Table/TableFooter.d.ts.map +1 -1
- package/dist/Table/TableFooter.js +5 -9
- package/dist/Table/TableHeader.d.ts +1 -1
- package/dist/Table/TableHeader.d.ts.map +1 -1
- package/dist/Table/TableHeader.js +5 -9
- package/dist/Table/TableHeaderCell.js +3 -3
- package/dist/Table/TableRow.js +5 -5
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +11 -14
- package/dist/Table/plugins/filtering/useTableFiltering.js +71 -71
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +1 -5
- package/dist/Table/plugins/pagination/useTablePagination.js +7 -7
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +22 -22
- package/dist/Table/plugins/selection/useTableSelection.js +18 -18
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.js +1 -11
- package/dist/Table/plugins/sortable/useTableSortable.js +17 -17
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -8
- package/dist/Table/tableContextMenu.js +9 -9
- package/dist/Text/Text.js +10 -10
- package/dist/TextArea/TextArea.js +14 -14
- package/dist/TextInput/TextInput.js +15 -15
- package/dist/Thumbnail/Thumbnail.d.ts +2 -3
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +29 -30
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +21 -26
- package/dist/Timestamp/Timestamp.d.ts +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +26 -37
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +17 -25
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +11 -23
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +4 -44
- package/dist/ToggleButton/ToggleButton.js +12 -12
- package/dist/ToggleButton/ToggleButtonGroup.js +5 -5
- package/dist/Token/Token.js +21 -21
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +34 -36
- package/dist/Toolbar/Toolbar.js +18 -18
- package/dist/Tooltip/Tooltip.js +11 -11
- package/dist/Tooltip/useTooltip.d.ts +1 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +3 -3
- package/dist/TopNav/TopNav.js +32 -32
- package/dist/TopNav/TopNavHeading.js +67 -67
- package/dist/TopNav/TopNavItem.js +5 -5
- package/dist/TopNav/TopNavMegaMenu.js +30 -30
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuFeaturedCard.js +14 -25
- package/dist/TopNav/TopNavMegaMenuItem.js +16 -16
- package/dist/TopNav/TopNavMenu.js +32 -32
- package/dist/TreeList/TreeList.js +8 -8
- package/dist/TreeList/TreeListBranches.js +11 -11
- package/dist/TreeList/TreeListItem.js +30 -30
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +20 -23
- package/dist/Typeahead/Typeahead.js +12 -12
- package/dist/Typeahead/TypeaheadItem.js +10 -10
- package/dist/VStack/VStack.js +3 -3
- package/dist/astryx.css +0 -7
- package/dist/astryx.umd.js +59 -59
- package/dist/astryx.umd.js.map +4 -4
- package/dist/docs-types.d.ts +2 -8
- package/dist/docs-types.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.d.ts +1 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +1 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useFocusTrap.d.ts +0 -3
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +1 -38
- package/dist/hooks/useInteractiveRole.d.ts +2 -6
- package/dist/hooks/useInteractiveRole.d.ts.map +1 -1
- package/dist/hooks/useInteractiveRole.js +2 -6
- package/dist/hooks/useKeyboardHint.js +9 -9
- package/dist/hooks/useStreamingText.d.ts +1 -3
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +5 -14
- package/dist/theme/MediaTheme.js +3 -3
- package/dist/theme/Theme.js +7 -7
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +3 -10
- package/dist/theme/hct.d.ts +15 -0
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +9 -9
- package/dist/theme/syntax/SyntaxTheme.js +5 -5
- package/dist/theme/tokens.d.ts +2 -10
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +4 -220
- package/dist/theme/useTheme.d.ts +2 -3
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +6 -73
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -3
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +5 -8
- package/package.json +3 -3
- package/src/AlertDialog/AlertDialog.doc.mjs +0 -4
- package/src/AlertDialog/AlertDialog.tsx +0 -2
- package/src/AppShell/AppShell.tsx +0 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +1 -28
- package/src/AspectRatio/AspectRatio.test.tsx +1 -142
- package/src/AspectRatio/AspectRatio.tsx +10 -70
- package/src/AspectRatio/index.ts +1 -5
- package/src/Avatar/Avatar.doc.mjs +0 -11
- package/src/Avatar/Avatar.test.tsx +1 -32
- package/src/Avatar/Avatar.tsx +20 -12
- package/src/AvatarGroup/AvatarGroup.doc.mjs +0 -1
- package/src/Banner/Banner.doc.mjs +0 -8
- package/src/Banner/Banner.test.tsx +0 -38
- package/src/Banner/Banner.tsx +1 -8
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +17 -122
- package/src/Calendar/Calendar.tsx +5 -26
- package/src/Calendar/dayCellUtils.ts +1 -3
- package/src/Calendar/styles.ts +2 -12
- package/src/Card/Card.doc.mjs +1 -1
- package/src/Card/Card.tsx +6 -16
- package/src/Carousel/Carousel.doc.mjs +12 -12
- package/src/Carousel/Carousel.test.tsx +0 -13
- package/src/Carousel/Carousel.tsx +2 -4
- package/src/Carousel/carousel.markers.stylex.ts +10 -0
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposerInput.test.tsx +1 -27
- package/src/Chat/ChatComposerInput.tsx +15 -20
- package/src/Chat/ChatDictationButton.tsx +4 -4
- package/src/Chat/ChatLayoutScrollButton.tsx +1 -3
- package/src/Chat/ChatMessageMetadata.tsx +6 -4
- package/src/Chat/ChatSystemMessage.test.tsx +11 -26
- package/src/Chat/ChatSystemMessage.tsx +7 -7
- package/src/Chat/ChatTokenizedText.test.tsx +16 -29
- package/src/Chat/ChatTokenizedText.tsx +8 -15
- package/src/Chat/ChatToolCalls.test.tsx +0 -55
- package/src/Chat/ChatToolCalls.tsx +12 -10
- package/src/Chat/index.ts +4 -1
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +4 -71
- package/src/CheckboxInput/CheckboxInput.tsx +0 -2
- package/src/CheckboxList/CheckboxList.test.tsx +0 -19
- package/src/CheckboxList/CheckboxListItem.tsx +2 -11
- package/src/Citation/Citation.doc.mjs +0 -5
- package/src/ClickableCard/ClickableCard.tsx +2 -45
- package/src/CodeBlock/CodeBlock.doc.mjs +2 -7
- package/src/CodeBlock/CodeBlock.test.tsx +3 -122
- package/src/CodeBlock/CodeBlock.tsx +4 -62
- package/src/Collapsible/Collapsible.doc.mjs +4 -8
- package/src/Collapsible/Collapsible.tsx +10 -86
- package/src/Collapsible/CollapsibleGroup.doc.mjs +3 -27
- package/src/Collapsible/CollapsibleGroup.test.tsx +0 -318
- package/src/Collapsible/CollapsibleGroup.tsx +9 -107
- package/src/Collapsible/CollapsibleGroupContext.tsx +2 -42
- package/src/Collapsible/index.ts +0 -4
- package/src/Collapsible/useCollapsible.ts +6 -20
- package/src/CommandPalette/CommandPalette.doc.mjs +0 -5
- package/src/CommandPalette/CommandPalette.tsx +3 -5
- package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +0 -5
- package/src/CommandPalette/CommandPaletteGroup.doc.mjs +0 -10
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteItem.doc.mjs +0 -6
- package/src/CommandPalette/CommandPaletteList.doc.mjs +0 -9
- package/src/ContextMenu/ContextMenu.doc.mjs +0 -15
- package/src/ContextMenu/ContextMenu.test.tsx +0 -87
- package/src/ContextMenu/ContextMenu.tsx +28 -87
- package/src/ContextMenu/ContextMenuItem.doc.mjs +0 -6
- package/src/DateInput/DateInput.test.tsx +20 -11
- package/src/DateRangeInput/DateRangeInput.test.tsx +44 -31
- package/src/DateTimeInput/DateTimeInput.doc.mjs +2 -3
- package/src/DateTimeInput/DateTimeInput.test.tsx +16 -118
- package/src/DateTimeInput/DateTimeInput.tsx +2 -8
- package/src/DateTimeInput/index.ts +0 -1
- package/src/Dialog/Dialog.doc.mjs +0 -4
- package/src/Dialog/DialogHeader.doc.mjs +0 -45
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +2 -22
- package/src/DropdownMenu/DropdownMenuItem.tsx +17 -5
- package/src/EmptyState/EmptyState.doc.mjs +1 -1
- package/src/Field/Field.test.tsx +4 -1
- package/src/Field/FieldLabel.test.tsx +2 -2
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +3 -0
- package/src/Grid/Grid.test.tsx +18 -43
- package/src/Grid/Grid.tsx +9 -26
- package/src/HoverCard/HoverCard.doc.mjs +6 -6
- package/src/HoverCard/useHoverCard.doc.mjs +5 -5
- package/src/HoverCard/useHoverCard.tsx +2 -9
- package/src/Icon/Icon.test.tsx +29 -41
- package/src/Icon/Icon.tsx +2 -6
- package/src/InputGroup/InputGroup.doc.mjs +0 -1
- package/src/InputGroup/InputGroup.tsx +2 -2
- package/src/Item/Item.tsx +1 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.test.tsx +2 -221
- package/src/Layer/useLayer.tsx +30 -69
- package/src/Layout/LayoutContent.doc.mjs +0 -12
- package/src/Layout/LayoutPanel.doc.mjs +0 -40
- package/src/Lightbox/Lightbox.doc.mjs +0 -5
- package/src/Lightbox/Lightbox.test.tsx +2 -123
- package/src/Lightbox/Lightbox.tsx +1 -29
- package/src/Markdown/Markdown.tsx +7 -9
- package/src/Markdown/parser.perf.test.ts +12 -34
- package/src/MobileNav/MobileNav.test.tsx +0 -56
- package/src/MobileNav/MobileNav.tsx +8 -13
- package/src/NavMenu/NavMenu.doc.mjs +0 -15
- package/src/NumberInput/NumberInput.test.tsx +3 -48
- package/src/NumberInput/NumberInput.tsx +15 -32
- package/src/Outline/Outline.doc.mjs +0 -2
- package/src/Overlay/Overlay.doc.mjs +0 -6
- package/src/Pagination/Pagination.test.tsx +0 -162
- package/src/Pagination/Pagination.tsx +26 -80
- package/src/Popover/Popover.doc.mjs +6 -6
- package/src/Popover/Popover.test.tsx +0 -65
- package/src/Popover/usePopover.doc.mjs +1 -1
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.test.tsx +1 -109
- package/src/PowerSearch/PowerSearch.tsx +16 -37
- package/src/ProgressBar/ProgressBar.doc.mjs +0 -2
- package/src/ProgressBar/ProgressBar.test.tsx +0 -30
- package/src/ProgressBar/ProgressBar.tsx +5 -12
- package/src/RadioList/RadioList.test.tsx +0 -19
- package/src/RadioList/RadioListItem.tsx +4 -9
- package/src/Resizable/ResizeHandle.tsx +4 -22
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/SegmentedControl/SegmentedControl.test.tsx +0 -192
- package/src/SegmentedControl/SegmentedControl.tsx +5 -27
- package/src/SegmentedControl/SegmentedControlItem.tsx +4 -9
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/Selector/Selector.test.tsx +1 -27
- package/src/SideNav/SideNav.doc.mjs +1 -7
- package/src/SideNav/SideNav.test.tsx +0 -66
- package/src/SideNav/SideNav.tsx +2 -6
- package/src/SideNav/SideNavCollapseButton.tsx +3 -4
- package/src/SideNav/SideNavSection.tsx +4 -6
- package/src/Switch/Switch.doc.mjs +7 -7
- package/src/Switch/Switch.test.tsx +3 -102
- package/src/Switch/Switch.tsx +7 -20
- package/src/TabList/TabList.test.tsx +1 -185
- package/src/TabList/TabMenu.tsx +9 -45
- package/src/Table/BaseTable.tsx +2 -13
- package/src/Table/Table.doc.mjs +0 -5
- package/src/Table/Table.test.tsx +0 -87
- package/src/Table/TableBody.tsx +2 -15
- package/src/Table/TableFooter.tsx +2 -15
- package/src/Table/TableHeader.tsx +2 -15
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +0 -13
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +1 -3
- package/src/Table/plugins/pagination/paginateData.ts +1 -5
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +0 -13
- package/src/Table/plugins/selection/useTableSelectionState.test.tsx +0 -23
- package/src/Table/plugins/selection/useTableSelectionState.tsx +6 -11
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +1 -35
- package/src/Table/plugins/sortable/useTableSortableState.tsx +4 -8
- package/src/TextArea/TextArea.test.tsx +3 -3
- package/src/TextInput/TextInput.test.tsx +3 -3
- package/src/Thumbnail/Thumbnail.test.tsx +2 -36
- package/src/Thumbnail/Thumbnail.tsx +2 -4
- package/src/TimeInput/TimeInput.test.tsx +0 -37
- package/src/TimeInput/TimeInput.tsx +1 -11
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Timestamp/Timestamp.test.tsx +0 -52
- package/src/Timestamp/Timestamp.tsx +16 -30
- package/src/Toast/Toast.tsx +3 -11
- package/src/Toast/ToastViewport.test.tsx +0 -64
- package/src/Toast/ToastViewport.tsx +0 -12
- package/src/Toast/useToast.tsx +0 -41
- package/src/ToggleButton/ToggleButton.doc.mjs +0 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/Tokenizer/Tokenizer.test.tsx +0 -54
- package/src/Tokenizer/Tokenizer.tsx +4 -5
- package/src/Tooltip/Tooltip.doc.mjs +6 -6
- package/src/Tooltip/useTooltip.doc.mjs +5 -5
- package/src/Tooltip/useTooltip.tsx +2 -12
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.test.tsx +7 -23
- package/src/TopNav/TopNavMegaMenuFeaturedCard.tsx +2 -9
- package/src/TreeList/TreeList.doc.mjs +2 -2
- package/src/Typeahead/BaseTypeahead.doc.mjs +0 -19
- package/src/Typeahead/BaseTypeahead.tsx +2 -5
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.test.tsx +1 -45
- package/src/docs-types.ts +1 -9
- package/src/hooks/focusableSelector.ts +1 -1
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useFocusTrap.doc.mjs +2 -4
- package/src/hooks/useFocusTrap.test.tsx +1 -149
- package/src/hooks/useFocusTrap.ts +1 -50
- package/src/hooks/useInteractiveRole.ts +4 -12
- package/src/hooks/useStreamingText.test.ts +19 -54
- package/src/hooks/useStreamingText.ts +5 -16
- package/src/hooks/useTreeFocus.test.tsx +3 -1
- package/src/reset.css +0 -29
- package/src/theme/SyntaxTheme.doc.mjs +4 -4
- package/src/theme/defineTheme.ts +13 -4
- package/src/theme/derivedVarRegistry.test.ts +2 -2
- package/src/theme/expandColorScale.test.ts +0 -29
- package/src/theme/expandColorScale.ts +6 -11
- package/src/theme/hct.ts +17 -9
- package/src/theme/tokens.test.ts +9 -182
- package/src/theme/tokens.ts +4 -239
- package/src/theme/useTheme.test.tsx +2 -126
- package/src/theme/useTheme.ts +6 -87
- package/src/utils/index.ts +0 -4
- package/src/utils/sharedResizeObserver.test.ts +2 -2
- package/src/utils/timeParser.test.ts +0 -13
- package/src/utils/timeParser.ts +5 -8
- package/dist/hooks/useHotkeys.d.ts +0 -51
- package/dist/hooks/useHotkeys.d.ts.map +0 -1
- package/dist/hooks/useHotkeys.js +0 -160
- package/dist/utils/color.d.ts +0 -42
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js +0 -150
- package/dist/utils/composeEventHandlers.d.ts +0 -30
- package/dist/utils/composeEventHandlers.d.ts.map +0 -1
- package/dist/utils/composeEventHandlers.js +0 -40
- package/src/Chat/ChatDictationButton.test.tsx +0 -43
- package/src/Chat/ChatLayoutScrollButton.test.tsx +0 -33
- package/src/Chat/ChatMessageMetadata.test.tsx +0 -32
- package/src/Collapsible/Collapsible.test.tsx +0 -405
- package/src/FieldStatus/FieldStatus.test.tsx +0 -282
- package/src/InteractiveRoleContext/InteractiveRoleContext.test.tsx +0 -185
- package/src/Layout/Layout.test.tsx +0 -285
- package/src/Layout/LayoutSlots.test.tsx +0 -364
- package/src/Outline/parseOutlineFromMarkdown.test.ts +0 -80
- package/src/OverflowList/OverflowList.test.tsx +0 -416
- package/src/Overlay/Overlay.test.tsx +0 -356
- package/src/Resizable/ResizeHandle.test.tsx +0 -218
- package/src/SizeContext/SizeContext.test.tsx +0 -226
- package/src/Toast/useToast.test.tsx +0 -258
- package/src/__tests__/TestIcon.tsx +0 -26
- package/src/__tests__/fastRoleQueries.ts +0 -66
- package/src/docPropReferences.test.ts +0 -178
- package/src/hooks/useHotkeys.doc.mjs +0 -52
- package/src/hooks/useHotkeys.test.ts +0 -245
- package/src/hooks/useHotkeys.ts +0 -203
- package/src/theme/themingTargets.test.ts +0 -353
- package/src/utils/color.test.ts +0 -133
- package/src/utils/color.ts +0 -148
- package/src/utils/composeEventHandlers.test.ts +0 -71
- package/src/utils/composeEventHandlers.ts +0 -44
- package/src/utils/mergeProps.test.ts +0 -166
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -8,11 +8,6 @@
|
|
|
8
8
|
* build-time theme adapters, chart configuration, canvas/SVG rendering, tests,
|
|
9
9
|
* or plain JS theme objects for other styling libraries.
|
|
10
10
|
*
|
|
11
|
-
* Derived tokens can reference other tokens (`var(--color-accent)`) and use CSS
|
|
12
|
-
* color functions (`color-mix`). The resolver follows those references through
|
|
13
|
-
* the theme iteratively and evaluates the supported color functions so callers
|
|
14
|
-
* receive concrete raw values, not CSS expressions.
|
|
15
|
-
*
|
|
16
11
|
* SYNC: When modified, update:
|
|
17
12
|
* - /packages/core/src/theme/useTheme.ts
|
|
18
13
|
* - /packages/core/src/theme/index.ts
|
|
@@ -56,11 +51,8 @@ export declare const tokenVars: Record<TokenName, string>;
|
|
|
56
51
|
* The result starts with `tokenDefaults`, applies `theme.tokens`, then
|
|
57
52
|
* reapplies `theme.__inputTokens` when available so explicit tuple overrides
|
|
58
53
|
* retain their original light/dark sides instead of relying on CSS parsing.
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* derived tokens like `--color-text-accent` return concrete values rather than
|
|
62
|
-
* `var(--color-accent)`. This mirrors the token resolution used by
|
|
63
|
-
* `useTheme()` but does not need React context or media queries.
|
|
54
|
+
* This mirrors the token resolution used by `useTheme()` but does not need
|
|
55
|
+
* React context or media queries.
|
|
64
56
|
*
|
|
65
57
|
* Pass `theme` as null/undefined to resolve defaults only.
|
|
66
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,kGAAkG;IAClG,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,2DAA2D;AAC3D,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,MAAM,CAEhE;AAED,sFAAsF;AACtF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAElB,CAAC;AAmF/B;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,OAAO,EAAE,yBAAyB,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBxB;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EAC/B,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAGR"}
|
package/dist/theme/tokens.js
CHANGED
|
@@ -10,18 +10,12 @@
|
|
|
10
10
|
* build-time theme adapters, chart configuration, canvas/SVG rendering, tests,
|
|
11
11
|
* or plain JS theme objects for other styling libraries.
|
|
12
12
|
*
|
|
13
|
-
* Derived tokens can reference other tokens (`var(--color-accent)`) and use CSS
|
|
14
|
-
* color functions (`color-mix`). The resolver follows those references through
|
|
15
|
-
* the theme iteratively and evaluates the supported color functions so callers
|
|
16
|
-
* receive concrete raw values, not CSS expressions.
|
|
17
|
-
*
|
|
18
13
|
* SYNC: When modified, update:
|
|
19
14
|
* - /packages/core/src/theme/useTheme.ts
|
|
20
15
|
* - /packages/core/src/theme/index.ts
|
|
21
16
|
*/
|
|
22
17
|
|
|
23
18
|
import { tokenDefaults } from "./defineTheme.js";
|
|
24
|
-
import { parseColor, formatColor } from "../utils/color.js";
|
|
25
19
|
|
|
26
20
|
/** Resolved color mode used when choosing the side of light/dark token values. */
|
|
27
21
|
|
|
@@ -121,224 +115,14 @@ function resolveXDSTokenValue(value, mode) {
|
|
|
121
115
|
return value;
|
|
122
116
|
}
|
|
123
117
|
|
|
124
|
-
// =============================================================================
|
|
125
|
-
// Reference resolution — turn token expressions into concrete raw values
|
|
126
|
-
// =============================================================================
|
|
127
|
-
//
|
|
128
|
-
// Generated themes emit derived tokens as references to other tokens rather
|
|
129
|
-
// than baked-in values, so a scoped CSS override of a base token re-themes the
|
|
130
|
-
// subtree that references it. The CSS cascade resolves those references, but
|
|
131
|
-
// non-CSS consumers (canvas, SVG, data-viz) need the concrete value. These
|
|
132
|
-
// helpers replay the same resolution in JS: follow `var()` references through
|
|
133
|
-
// the resolved token map (iteratively, guarding against cycles) and evaluate
|
|
134
|
-
// the CSS color functions used by the theme generator against those values.
|
|
135
|
-
|
|
136
|
-
/** Index of the `)` matching the `(` at `openIndex`, or -1 when unbalanced. */
|
|
137
|
-
function findMatchingParen(input, openIndex) {
|
|
138
|
-
let depth = 0;
|
|
139
|
-
for (let i = openIndex; i < input.length; i++) {
|
|
140
|
-
const char = input[i];
|
|
141
|
-
if (char === '(') {
|
|
142
|
-
depth++;
|
|
143
|
-
} else if (char === ')') {
|
|
144
|
-
depth--;
|
|
145
|
-
if (depth === 0) {
|
|
146
|
-
return i;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return -1;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** Split a color-mix component into its color and optional percentage. */
|
|
154
|
-
function parseMixComponent(part) {
|
|
155
|
-
const trimmed = part.trim();
|
|
156
|
-
const match = trimmed.match(/\s+([\d.]+)%$/);
|
|
157
|
-
if (match) {
|
|
158
|
-
return {
|
|
159
|
-
color: trimmed.slice(0, match.index).trim(),
|
|
160
|
-
percentage: parseFloat(match[1])
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
color: trimmed,
|
|
165
|
-
percentage: null
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Evaluate `color-mix(in <space>, c1 [p1], c2 [p2])` to a concrete color.
|
|
171
|
-
*
|
|
172
|
-
* Supports the `srgb` color space (the one the theme generator emits) using
|
|
173
|
-
* the CSS Color 5 algorithm: normalize the percentages, interpolate the
|
|
174
|
-
* premultiplied channels, then apply the alpha multiplier when the mix weights
|
|
175
|
-
* sum to less than 100%. Returns null for anything it can't evaluate so the
|
|
176
|
-
* original expression is preserved rather than guessed.
|
|
177
|
-
*/
|
|
178
|
-
function evaluateColorMix(body) {
|
|
179
|
-
const spaceMatch = body.match(/^in\s+([\w-]+)\s*,\s*(.+)$/s);
|
|
180
|
-
if (!spaceMatch) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
const [, colorSpace, rest] = spaceMatch;
|
|
184
|
-
if (colorSpace.toLowerCase() !== 'srgb') {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
const split = splitTopLevelComma(rest);
|
|
188
|
-
if (split === null) {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
const first = parseMixComponent(split[0]);
|
|
192
|
-
const second = parseMixComponent(split[1]);
|
|
193
|
-
if (first === null || second === null) {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
const c1 = parseColor(first.color);
|
|
197
|
-
const c2 = parseColor(second.color);
|
|
198
|
-
if (c1 === null || c2 === null) {
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Fill in omitted percentages, then normalize so they sum to 100%.
|
|
203
|
-
let p1;
|
|
204
|
-
let p2;
|
|
205
|
-
if (first.percentage !== null && second.percentage !== null) {
|
|
206
|
-
p1 = first.percentage;
|
|
207
|
-
p2 = second.percentage;
|
|
208
|
-
} else if (first.percentage !== null) {
|
|
209
|
-
p1 = first.percentage;
|
|
210
|
-
p2 = 100 - p1;
|
|
211
|
-
} else if (second.percentage !== null) {
|
|
212
|
-
p2 = second.percentage;
|
|
213
|
-
p1 = 100 - p2;
|
|
214
|
-
} else {
|
|
215
|
-
p1 = 50;
|
|
216
|
-
p2 = 50;
|
|
217
|
-
}
|
|
218
|
-
const sum = p1 + p2;
|
|
219
|
-
if (sum <= 0) {
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
const w1 = p1 / sum;
|
|
223
|
-
const w2 = p2 / sum;
|
|
224
|
-
const alphaMultiplier = sum < 100 ? sum / 100 : 1;
|
|
225
|
-
|
|
226
|
-
// Interpolate in premultiplied sRGB, then un-premultiply.
|
|
227
|
-
const mixedA = w1 * c1.a + w2 * c2.a;
|
|
228
|
-
const premix = (k1, k2) => w1 * k1 * c1.a + w2 * k2 * c2.a;
|
|
229
|
-
const rp = premix(c1.r, c2.r);
|
|
230
|
-
const gp = premix(c1.g, c2.g);
|
|
231
|
-
const bp = premix(c1.b, c2.b);
|
|
232
|
-
const rgb = mixedA === 0 ? {
|
|
233
|
-
r: 0,
|
|
234
|
-
g: 0,
|
|
235
|
-
b: 0
|
|
236
|
-
} : {
|
|
237
|
-
r: rp / mixedA,
|
|
238
|
-
g: gp / mixedA,
|
|
239
|
-
b: bp / mixedA
|
|
240
|
-
};
|
|
241
|
-
return formatColor({
|
|
242
|
-
...rgb,
|
|
243
|
-
a: mixedA * alphaMultiplier
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/** Evaluate every supported color function in an expression, innermost first. */
|
|
248
|
-
function evaluateColorFunctions(expr) {
|
|
249
|
-
const idx = expr.indexOf('color-mix(');
|
|
250
|
-
if (idx === -1) {
|
|
251
|
-
return expr;
|
|
252
|
-
}
|
|
253
|
-
const openIndex = idx + 'color-mix'.length;
|
|
254
|
-
const closeIndex = findMatchingParen(expr, openIndex);
|
|
255
|
-
if (closeIndex === -1) {
|
|
256
|
-
return expr;
|
|
257
|
-
}
|
|
258
|
-
const body = evaluateColorFunctions(expr.slice(openIndex + 1, closeIndex));
|
|
259
|
-
const evaluated = evaluateColorMix(body);
|
|
260
|
-
const replacement = evaluated ?? `color-mix(${body})`;
|
|
261
|
-
return expr.slice(0, idx) + replacement + evaluateColorFunctions(expr.slice(closeIndex + 1));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Substitute `var(--name[, fallback])` references with their resolved values.
|
|
266
|
-
* `seen` tracks the reference chain so cycles resolve to the literal reference
|
|
267
|
-
* instead of recursing forever.
|
|
268
|
-
*/
|
|
269
|
-
function substituteVars(expr, raw, cache, seen) {
|
|
270
|
-
const start = expr.indexOf('var(');
|
|
271
|
-
if (start === -1) {
|
|
272
|
-
return expr;
|
|
273
|
-
}
|
|
274
|
-
const openIndex = start + 'var'.length;
|
|
275
|
-
const closeIndex = findMatchingParen(expr, openIndex);
|
|
276
|
-
if (closeIndex === -1) {
|
|
277
|
-
return expr;
|
|
278
|
-
}
|
|
279
|
-
const inner = expr.slice(openIndex + 1, closeIndex);
|
|
280
|
-
const commaSplit = splitTopLevelComma(inner);
|
|
281
|
-
const name = (commaSplit ? commaSplit[0] : inner).trim();
|
|
282
|
-
const fallback = commaSplit ? commaSplit[1] : null;
|
|
283
|
-
let replacement;
|
|
284
|
-
if (seen.has(name)) {
|
|
285
|
-
replacement = expr.slice(start, closeIndex + 1);
|
|
286
|
-
} else if (name in raw) {
|
|
287
|
-
seen.add(name);
|
|
288
|
-
replacement = resolveReference(name, raw, cache, seen);
|
|
289
|
-
seen.delete(name);
|
|
290
|
-
} else if (fallback !== null) {
|
|
291
|
-
replacement = substituteVars(fallback.trim(), raw, cache, seen);
|
|
292
|
-
} else {
|
|
293
|
-
replacement = expr.slice(start, closeIndex + 1);
|
|
294
|
-
}
|
|
295
|
-
const rest = substituteVars(expr.slice(closeIndex + 1), raw, cache, seen);
|
|
296
|
-
return expr.slice(0, start) + replacement + rest;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/** Fully resolve a single expression: substitute references, then evaluate colors. */
|
|
300
|
-
function resolveExpression(expr, raw, cache, seen) {
|
|
301
|
-
if (!expr.includes('var(') && !expr.includes('color-mix(')) {
|
|
302
|
-
return expr;
|
|
303
|
-
}
|
|
304
|
-
const substituted = substituteVars(expr, raw, cache, seen);
|
|
305
|
-
return evaluateColorFunctions(substituted);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/** Resolve one token by name, memoizing the result in `cache`. */
|
|
309
|
-
function resolveReference(name, raw, cache, seen) {
|
|
310
|
-
if (name in cache) {
|
|
311
|
-
return cache[name];
|
|
312
|
-
}
|
|
313
|
-
const value = raw[name];
|
|
314
|
-
if (value === undefined) {
|
|
315
|
-
return '';
|
|
316
|
-
}
|
|
317
|
-
const resolved = resolveExpression(value, raw, cache, seen);
|
|
318
|
-
cache[name] = resolved;
|
|
319
|
-
return resolved;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/** Resolve every reference/color function in a raw token map to concrete values. */
|
|
323
|
-
function resolveReferences(raw) {
|
|
324
|
-
const cache = {};
|
|
325
|
-
for (const name of Object.keys(raw)) {
|
|
326
|
-
resolveReference(name, raw, cache, new Set());
|
|
327
|
-
}
|
|
328
|
-
return cache;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
118
|
/**
|
|
332
119
|
* Resolve all Astryx token values for a theme and effective color mode.
|
|
333
120
|
*
|
|
334
121
|
* The result starts with `tokenDefaults`, applies `theme.tokens`, then
|
|
335
122
|
* reapplies `theme.__inputTokens` when available so explicit tuple overrides
|
|
336
123
|
* retain their original light/dark sides instead of relying on CSS parsing.
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* derived tokens like `--color-text-accent` return concrete values rather than
|
|
340
|
-
* `var(--color-accent)`. This mirrors the token resolution used by
|
|
341
|
-
* `useTheme()` but does not need React context or media queries.
|
|
124
|
+
* This mirrors the token resolution used by `useTheme()` but does not need
|
|
125
|
+
* React context or media queries.
|
|
342
126
|
*
|
|
343
127
|
* Pass `theme` as null/undefined to resolve defaults only.
|
|
344
128
|
*/
|
|
@@ -351,7 +135,7 @@ export function resolveThemeTokens(theme, options) {
|
|
|
351
135
|
resolved[key] = resolveXDSTokenValue(value, mode);
|
|
352
136
|
}
|
|
353
137
|
if (theme == null) {
|
|
354
|
-
return
|
|
138
|
+
return resolved;
|
|
355
139
|
}
|
|
356
140
|
for (const [key, value] of Object.entries(theme.tokens)) {
|
|
357
141
|
resolved[key] = resolveXDSTokenValue(value, mode);
|
|
@@ -363,7 +147,7 @@ export function resolveThemeTokens(theme, options) {
|
|
|
363
147
|
}
|
|
364
148
|
}
|
|
365
149
|
}
|
|
366
|
-
return
|
|
150
|
+
return resolved;
|
|
367
151
|
}
|
|
368
152
|
|
|
369
153
|
/** Resolve one Astryx token value for a theme and effective color mode. */
|
package/dist/theme/useTheme.d.ts
CHANGED
|
@@ -57,9 +57,8 @@ export interface UseThemeReturn {
|
|
|
57
57
|
* (e.g. Vega, D3, Chart.js) that need concrete values rather than
|
|
58
58
|
* CSS custom property references.
|
|
59
59
|
*
|
|
60
|
-
* When called outside
|
|
61
|
-
*
|
|
62
|
-
* current system color mode otherwise.
|
|
60
|
+
* When called outside an <Theme> provider, returns the default theme
|
|
61
|
+
* tokens resolved against the current system color mode.
|
|
63
62
|
*
|
|
64
63
|
* @example
|
|
65
64
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/theme/useTheme.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAQhD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,+BAA+B;IAC/B,KAAK,EAAE,YAAY,CAAC;IACpB,0CAA0C;IAC1C,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAO1E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChC;;;;;;;OAOG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAMD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CA4BzC"}
|
package/dist/theme/useTheme.js
CHANGED
|
@@ -9,18 +9,13 @@
|
|
|
9
9
|
* @position Theme hook; used by data viz, canvas, and non-CSS consumers
|
|
10
10
|
*
|
|
11
11
|
* Provides synchronous access to theme token values resolved for the
|
|
12
|
-
* current color mode — no DOM reads
|
|
13
|
-
*
|
|
14
|
-
* sync by Theme) via a single shared, refcounted MutationObserver before
|
|
15
|
-
* assuming OS preference; provider-path consumers subscribe to a no-op
|
|
16
|
-
* store instead (the same args-switch technique useMediaQuery uses), so
|
|
17
|
-
* mounting under a Theme never creates an observer. Token resolution is
|
|
18
|
-
* shared with the server-safe helpers in ./tokens.ts.
|
|
12
|
+
* current color mode — no DOM reads, no double render. Token resolution
|
|
13
|
+
* is shared with the server-safe helpers in ./tokens.ts.
|
|
19
14
|
*
|
|
20
15
|
* SYNC: When modified, update:
|
|
21
16
|
* - /packages/core/src/theme/index.ts
|
|
22
17
|
*/
|
|
23
|
-
import { createContext, use, useMemo
|
|
18
|
+
import { createContext, use, useMemo } from 'react';
|
|
24
19
|
import { resolveThemeTokens } from "./tokens.js";
|
|
25
20
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
26
21
|
|
|
@@ -53,62 +48,6 @@ ThemeContext.displayName = 'ThemeContext';
|
|
|
53
48
|
// Hook
|
|
54
49
|
// =============================================================================
|
|
55
50
|
|
|
56
|
-
function getRootThemeAttrSnapshot() {
|
|
57
|
-
if (typeof document === 'undefined') {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
const attr = document.documentElement.getAttribute('data-theme');
|
|
61
|
-
return attr === 'light' || attr === 'dark' ? attr : null;
|
|
62
|
-
}
|
|
63
|
-
function getRootThemeAttrServerSnapshot() {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
function getNullThemeMode() {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Every no-context consumer wants the same <html data-theme> attribute, so
|
|
71
|
-
// one MutationObserver — refcounted via this listener set — serves all of
|
|
72
|
-
// them instead of one per consumer.
|
|
73
|
-
const rootThemeAttrListeners = new Set();
|
|
74
|
-
let rootThemeAttrObserver = null;
|
|
75
|
-
function notifyRootThemeAttrListeners() {
|
|
76
|
-
for (const listener of rootThemeAttrListeners) {
|
|
77
|
-
listener();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function subscribeRootThemeAttr(onStoreChange) {
|
|
81
|
-
rootThemeAttrListeners.add(onStoreChange);
|
|
82
|
-
if (rootThemeAttrListeners.size === 1 && typeof MutationObserver !== 'undefined') {
|
|
83
|
-
rootThemeAttrObserver = new MutationObserver(notifyRootThemeAttrListeners);
|
|
84
|
-
rootThemeAttrObserver.observe(document.documentElement, {
|
|
85
|
-
attributes: true,
|
|
86
|
-
attributeFilter: ['data-theme']
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return () => {
|
|
90
|
-
rootThemeAttrListeners.delete(onStoreChange);
|
|
91
|
-
if (rootThemeAttrListeners.size === 0 && rootThemeAttrObserver) {
|
|
92
|
-
rootThemeAttrObserver.disconnect();
|
|
93
|
-
rootThemeAttrObserver = null;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function subscribeNoop() {
|
|
98
|
-
return () => {};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Reads the root Theme's mode off `<html data-theme>`, live via the shared
|
|
103
|
-
* MutationObserver. Null means no root Theme has synced it (none present,
|
|
104
|
-
* or mode is 'system'). `hasCtx` switches which store this subscribes to —
|
|
105
|
-
* a no-op store when a ThemeContext exists — instead of skipping the hook
|
|
106
|
-
* call, so provider-path consumers never touch the DOM or the observer.
|
|
107
|
-
*/
|
|
108
|
-
function useRootThemeModeAttr(hasCtx) {
|
|
109
|
-
return useSyncExternalStore(hasCtx ? subscribeNoop : subscribeRootThemeAttr, hasCtx ? getNullThemeMode : getRootThemeAttrSnapshot, getRootThemeAttrServerSnapshot);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
51
|
/**
|
|
113
52
|
* Access the current Astryx theme's token values, resolved for the active color mode.
|
|
114
53
|
*
|
|
@@ -117,9 +56,8 @@ function useRootThemeModeAttr(hasCtx) {
|
|
|
117
56
|
* (e.g. Vega, D3, Chart.js) that need concrete values rather than
|
|
118
57
|
* CSS custom property references.
|
|
119
58
|
*
|
|
120
|
-
* When called outside
|
|
121
|
-
*
|
|
122
|
-
* current system color mode otherwise.
|
|
59
|
+
* When called outside an <Theme> provider, returns the default theme
|
|
60
|
+
* tokens resolved against the current system color mode.
|
|
123
61
|
*
|
|
124
62
|
* @example
|
|
125
63
|
* ```
|
|
@@ -137,14 +75,9 @@ function useRootThemeModeAttr(hasCtx) {
|
|
|
137
75
|
export function useTheme() {
|
|
138
76
|
const ctx = use(ThemeContext);
|
|
139
77
|
|
|
140
|
-
// Falls back to the root Theme's mode via <html data-theme> when there's
|
|
141
|
-
// no ThemeContext ancestor (e.g. useToast's detached fallback viewport).
|
|
142
|
-
// Resolves to null when `ctx` is present, so it has no effect there.
|
|
143
|
-
const rootAttrMode = useRootThemeModeAttr(ctx != null);
|
|
144
|
-
|
|
145
78
|
// Resolve 'system' to 'light' | 'dark' using the OS preference
|
|
146
79
|
const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
|
|
147
|
-
const mode = ctx?.mode ??
|
|
80
|
+
const mode = ctx?.mode ?? 'system';
|
|
148
81
|
const theme = ctx?.theme ?? null;
|
|
149
82
|
const effectiveMode = mode === 'system' ? prefersDark ? 'dark' : 'light' : mode;
|
|
150
83
|
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export { parseStyleKey } from './parseStyleKey';
|
|
|
14
14
|
export { getKey, type Key, type KeyFallback } from './getKey';
|
|
15
15
|
export { mergeProps } from './mergeProps';
|
|
16
16
|
export { mergeRefs } from './mergeRefs';
|
|
17
|
-
export { composeEventHandlers } from './composeEventHandlers';
|
|
18
17
|
export { themeProps, themeDataAttributes } from './themeProps';
|
|
19
18
|
export type { ClassValue, ClassProps, ThemeDataAttributes, ThemeProps, } from './themeProps';
|
|
20
19
|
export { groupItems, getItemGroup } from './groupItems';
|
|
@@ -23,6 +22,4 @@ export { observeResize, unobserveResize } from './sharedResizeObserver';
|
|
|
23
22
|
export { isRenderable } from './isRenderable';
|
|
24
23
|
export { getInputARIA } from './inputAria';
|
|
25
24
|
export type { InputARIA, InputARIAInputGroup } from './inputAria';
|
|
26
|
-
export { parseHex, parseRgb, parseColor, formatHex, formatColor } from './color';
|
|
27
|
-
export type { RGBA } from './color';
|
|
28
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,YAAY,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC,YAAY,EAAC,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAEhF,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,EACT,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAC,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,YAAY,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC,YAAY,EAAC,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAEhF,OAAO,EACL,cAAc,EACd,SAAS,EACT,QAAQ,EACR,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,SAAS,EACT,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAC,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAC7D,YAAY,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACtD,YAAY,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,YAAY,EAAC,SAAS,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -14,10 +14,8 @@ export { parseStyleKey } from "./parseStyleKey.js";
|
|
|
14
14
|
export { getKey } from "./getKey.js";
|
|
15
15
|
export { mergeProps } from "./mergeProps.js";
|
|
16
16
|
export { mergeRefs } from "./mergeRefs.js";
|
|
17
|
-
export { composeEventHandlers } from "./composeEventHandlers.js";
|
|
18
17
|
export { themeProps, themeDataAttributes } from "./themeProps.js";
|
|
19
18
|
export { groupItems, getItemGroup } from "./groupItems.js";
|
|
20
19
|
export { observeResize, unobserveResize } from "./sharedResizeObserver.js";
|
|
21
20
|
export { isRenderable } from "./isRenderable.js";
|
|
22
|
-
export { getInputARIA } from "./inputAria.js";
|
|
23
|
-
export { parseHex, parseRgb, parseColor, formatHex, formatColor } from "./color.js";
|
|
21
|
+
export { getInputARIA } from "./inputAria.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/timeParser.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6B5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAUf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,OAAe,GAC9B,aAAa,GAAG,IAAI,CAuGtB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,aAAa,GAAG,SAAS,EAC5B,CAAC,EAAE,aAAa,GAAG,SAAS,GAC3B,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAoBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,OAAe,GAC9B,aAAa,
|
|
1
|
+
{"version":3,"file":"timeParser.d.ts","sourceRoot":"","sources":["../../src/utils/timeParser.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAMvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6B5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAUf;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,GAAG,SAAS,EAC/B,cAAc,GAAE,OAAe,GAC9B,MAAM,CAmBR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,OAAe,GAC9B,aAAa,GAAG,IAAI,CAuGtB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,aAAa,GAAG,SAAS,EAC5B,CAAC,EAAE,aAAa,GAAG,SAAS,GAC3B,MAAM,CA4BR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,GAAG,CAAC,EAAE,aAAa,EACnB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAoBf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,GAAE,OAAe,GAC9B,aAAa,CAqBf"}
|
package/dist/utils/timeParser.js
CHANGED
|
@@ -305,16 +305,13 @@ export function adjustTime(time, deltaMinutes, includeSeconds = false) {
|
|
|
305
305
|
if (!parsed) {
|
|
306
306
|
return time;
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
// A non-finite delta would spin the wrap-around forever (-Infinity) or
|
|
310
|
-
// produce "NaN:NaN" (NaN) — return the input unchanged instead.
|
|
311
|
-
if (!Number.isFinite(deltaMinutes)) {
|
|
312
|
-
return time;
|
|
313
|
-
}
|
|
314
308
|
let totalMinutes = parsed.hour * 60 + parsed.minute + deltaMinutes;
|
|
315
309
|
|
|
316
|
-
// Wrap around midnight
|
|
317
|
-
|
|
310
|
+
// Wrap around midnight
|
|
311
|
+
while (totalMinutes < 0) {
|
|
312
|
+
totalMinutes += 24 * 60;
|
|
313
|
+
}
|
|
314
|
+
totalMinutes = totalMinutes % (24 * 60);
|
|
318
315
|
const newHour = Math.floor(totalMinutes / 60);
|
|
319
316
|
const newMinute = totalMinutes % 60;
|
|
320
317
|
return formatISOTime({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.1.4
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"displayName": "XDS Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -626,14 +626,14 @@
|
|
|
626
626
|
"CHANGELOG.md"
|
|
627
627
|
],
|
|
628
628
|
"peerDependencies": {
|
|
629
|
-
"@stylexjs/stylex": "^0.
|
|
629
|
+
"@stylexjs/stylex": "^0.18.3",
|
|
630
630
|
"react": ">=19.0.0",
|
|
631
631
|
"react-dom": ">=19.0.0"
|
|
632
632
|
},
|
|
633
633
|
"devDependencies": {
|
|
634
634
|
"@babel/cli": "^7.29.7",
|
|
635
635
|
"@babel/core": "^7.29.7",
|
|
636
|
-
"@babel/preset-react": "^
|
|
636
|
+
"@babel/preset-react": "^7.29.7",
|
|
637
637
|
"@babel/preset-typescript": "^7.29.7",
|
|
638
638
|
"@stylexjs/babel-plugin": "^0.19.0",
|
|
639
639
|
"@testing-library/dom": "^10.0.0",
|
|
@@ -28,10 +28,6 @@ export const docs = {
|
|
|
28
28
|
{guidance: false, description: 'Use AlertDialog for non-destructive actions; use a standard Dialog instead.'},
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
|
-
// Intentionally a contained isInline preview, not playground.overlay: the
|
|
32
|
-
// component stays visible on load and knobs stay live, whereas a real
|
|
33
|
-
// showModal() overlay makes the page inert — see PlaygroundConfig.overlay
|
|
34
|
-
// in docs-types.ts (#3657).
|
|
35
31
|
playground: {
|
|
36
32
|
defaults: {
|
|
37
33
|
isOpen: true,
|
|
@@ -132,7 +132,6 @@ export function AlertDialog({
|
|
|
132
132
|
className,
|
|
133
133
|
style,
|
|
134
134
|
'data-testid': testId,
|
|
135
|
-
...rest
|
|
136
135
|
}: AlertDialogProps) {
|
|
137
136
|
const titleId = useId();
|
|
138
137
|
const descriptionId = useId();
|
|
@@ -143,7 +142,6 @@ export function AlertDialog({
|
|
|
143
142
|
|
|
144
143
|
return (
|
|
145
144
|
<Dialog
|
|
146
|
-
{...rest}
|
|
147
145
|
ref={ref}
|
|
148
146
|
isOpen={isOpen}
|
|
149
147
|
isInline={isInline}
|
|
@@ -470,7 +470,6 @@ export function AppShell({
|
|
|
470
470
|
className,
|
|
471
471
|
style,
|
|
472
472
|
ref,
|
|
473
|
-
...rest
|
|
474
473
|
}: AppShellProps) {
|
|
475
474
|
// =========================================================================
|
|
476
475
|
// Parse mobileNav prop — normalize to config, custom element, or disabled
|
|
@@ -769,7 +768,6 @@ export function AppShell({
|
|
|
769
768
|
return (
|
|
770
769
|
<AppShellMobileContext value={mobileContextValue}>
|
|
771
770
|
<div
|
|
772
|
-
{...rest}
|
|
773
771
|
ref={mergeRefs(ref, shellRef)}
|
|
774
772
|
data-testid={dataTestId}
|
|
775
773
|
{...mergeProps(
|
|
@@ -13,7 +13,6 @@ export const docs = {
|
|
|
13
13
|
bestPractices: [
|
|
14
14
|
{guidance: true, description: 'Express the ratio as a fraction like `16/9` or `4/3` for readability.'},
|
|
15
15
|
{guidance: true, description: 'Use for media that needs consistent proportions across screen sizes.'},
|
|
16
|
-
{guidance: true, description: 'Use `fit="cover"` for images and video so the component sizes the child; the child should not repeat `width`/`height`/`objectFit` styles.'},
|
|
17
16
|
{guidance: false, description: 'Use for general layout containers; use standard layout components instead.'},
|
|
18
17
|
{guidance: false, description: 'Nest AspectRatio containers; one level is sufficient.'},
|
|
19
18
|
],
|
|
@@ -25,17 +24,6 @@ export const docs = {
|
|
|
25
24
|
description: 'Aspect ratio as width/height (e.g. 16/9, 1).',
|
|
26
25
|
required: true,
|
|
27
26
|
},
|
|
28
|
-
{
|
|
29
|
-
name: 'shape',
|
|
30
|
-
type: "'rectangle' | 'ellipse'",
|
|
31
|
-
description: 'Container shape. Both respect the `ratio`. `ellipse` clips to an oval (a circle when `ratio={1}`).',
|
|
32
|
-
default: "'rectangle'",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'fit',
|
|
36
|
-
type: "'cover' | 'contain' | 'center'",
|
|
37
|
-
description: 'How the child is sized inside the ratio box. `cover` fills and crops media, `contain` fills and letterboxes, `center` keeps the natural size centered. When omitted, the child styles itself.',
|
|
38
|
-
},
|
|
39
27
|
{
|
|
40
28
|
name: 'children',
|
|
41
29
|
type: 'ReactNode',
|
|
@@ -72,24 +60,12 @@ export const docsZh = {
|
|
|
72
60
|
bestPractices: [
|
|
73
61
|
{guidance: true, description: 'Express the ratio as a fraction like `16/9` or `4/3` for readability.'},
|
|
74
62
|
{guidance: true, description: 'Use for media that needs consistent proportions across screen sizes.'},
|
|
75
|
-
{guidance: true, description: 'Use `fit="cover"` for images and video so the component sizes the child; the child should not repeat `width`/`height`/`objectFit` styles.'},
|
|
76
63
|
{guidance: false, description: 'Use for general layout containers; use standard layout components instead.'},
|
|
77
64
|
{guidance: false, description: 'Nest AspectRatio containers; one level is sufficient.'},
|
|
78
65
|
],
|
|
79
66
|
},
|
|
80
67
|
props: [
|
|
81
68
|
{name: 'ratio', type: 'number', description: '宽高比,以宽/高表示(例如 16/9、1)。', required: true},
|
|
82
|
-
{
|
|
83
|
-
name: 'shape',
|
|
84
|
-
type: "'rectangle' | 'ellipse'",
|
|
85
|
-
description: '容器形状。两种形状都遵循 `ratio`。`ellipse` 裁剪为椭圆(`ratio={1}` 时为正圆)。',
|
|
86
|
-
default: "'rectangle'",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: 'fit',
|
|
90
|
-
type: "'cover' | 'contain' | 'center'",
|
|
91
|
-
description: '子元素在比例框内的布局方式。`cover` 填满并裁剪媒体,`contain` 填满并留边,`center` 保持原始尺寸居中。省略时子元素自行设置样式。',
|
|
92
|
-
},
|
|
93
69
|
{name: 'children', type: 'ReactNode', description: '通过绝对定位填充容器的内容。', required: true},
|
|
94
70
|
{
|
|
95
71
|
name: 'xstyle',
|
|
@@ -100,7 +76,7 @@ export const docsZh = {
|
|
|
100
76
|
],
|
|
101
77
|
theming: {
|
|
102
78
|
targets: [
|
|
103
|
-
{className: 'astryx-aspect-ratio'
|
|
79
|
+
{className: 'astryx-aspect-ratio'},
|
|
104
80
|
],
|
|
105
81
|
},
|
|
106
82
|
};
|
|
@@ -114,15 +90,12 @@ export const docsDense = {
|
|
|
114
90
|
bestPractices: [
|
|
115
91
|
{guidance: true, description: 'Express the ratio as a fraction like `16/9` or `4/3` for readability.'},
|
|
116
92
|
{guidance: true, description: 'Use for media that needs consistent proportions across screen sizes.'},
|
|
117
|
-
{guidance: true, description: 'Use `fit="cover"` for images and video so the component sizes the child; the child should not repeat `width`/`height`/`objectFit` styles.'},
|
|
118
93
|
{guidance: false, description: 'Use for general layout containers; use standard layout components instead.'},
|
|
119
94
|
{guidance: false, description: 'Nest AspectRatio containers; one level is sufficient.'},
|
|
120
95
|
],
|
|
121
96
|
},
|
|
122
97
|
propDescriptions: {
|
|
123
98
|
ratio: 'width/height ratio (e.g. 16/9, 1)',
|
|
124
|
-
shape: "container shape: 'rectangle' (default) | 'ellipse' (circle at ratio 1)",
|
|
125
|
-
fit: "child layout: 'cover' fill+crop | 'contain' fill+letterbox | 'center' natural size; omitted = child styles itself",
|
|
126
99
|
children: 'content positioned absolutely to fill container',
|
|
127
100
|
xstyle: 'StyleX layout customization via stylex.create()',
|
|
128
101
|
},
|