@astryxdesign/core 0.7.17-canary.gffd1c8e → 0.7.17
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 +334 -0
- package/README.md +26 -9
- package/dist/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +6 -8
- package/dist/AppShell/AppShell.d.ts +7 -3
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +74 -36
- package/dist/AppShell/unreadWidthPoint.d.ts +29 -0
- package/dist/AppShell/unreadWidthPoint.d.ts.map +1 -0
- package/dist/AppShell/unreadWidthPoint.js +134 -0
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +5 -1
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +2 -2
- package/dist/Banner/Banner.d.ts +6 -4
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +32 -29
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +3 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +11 -7
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +57 -2
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts +5 -0
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +6 -14
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +12 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +4 -0
- package/dist/Calendar/Calendar.js +8 -2
- package/dist/Calendar/styles.d.ts +10 -6
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +7 -3
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +23 -4
- package/dist/Chat/ChatComposer.d.ts +1 -1
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +4 -4
- package/dist/Chat/ChatComposerDrawer.d.ts.map +1 -1
- package/dist/Chat/ChatComposerDrawer.js +8 -4
- package/dist/Chat/ChatDictationButton.d.ts.map +1 -1
- package/dist/Chat/ChatDictationButton.js +7 -0
- package/dist/Chat/ChatPastedTextToken.d.ts.map +1 -1
- package/dist/Chat/ChatPastedTextToken.js +3 -9
- package/dist/Chat/ChatSendButton.d.ts.map +1 -1
- package/dist/Chat/ChatSendButton.js +3 -0
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +1 -0
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +8 -0
- package/dist/Chat/pastedTextLabel.d.ts +4 -0
- package/dist/Chat/pastedTextLabel.d.ts.map +1 -0
- package/dist/Chat/pastedTextLabel.js +21 -0
- package/dist/Chat/useChatPasteAsToken.d.ts.map +1 -1
- package/dist/Chat/useChatPasteAsToken.js +8 -8
- package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +3 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +69 -18
- package/dist/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +8 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +17 -3
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +2 -0
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +1 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +8 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +32 -5
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +1 -0
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +3 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +2 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +8 -8
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +5 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +7 -0
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +2 -1
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +2 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +104 -18
- package/dist/Dialog/DialogContext.d.ts +5 -4
- package/dist/Dialog/DialogContext.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +38 -12
- package/dist/Drawer/DrawerHeader.d.ts.map +1 -1
- package/dist/Drawer/DrawerHeader.js +23 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +23 -17
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -3
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +19 -2
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +6 -3
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +31 -7
- package/dist/DropdownMenu/menuRowCorners.stylex.d.ts +24 -0
- package/dist/DropdownMenu/menuRowCorners.stylex.d.ts.map +1 -0
- package/dist/DropdownMenu/menuRowCorners.stylex.js +29 -0
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +2 -2
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +2 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -0
- package/dist/Field/inputDisabledFocus.d.ts.map +1 -1
- package/dist/Field/inputDisabledFocus.js +5 -0
- package/dist/Field/inputStyles.stylex.d.ts +31 -4
- package/dist/Field/inputStyles.stylex.d.ts.map +1 -1
- package/dist/Field/inputStyles.stylex.js +30 -5
- package/dist/Grid/Grid.d.ts +2 -1
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +5 -2
- package/dist/Heading/Heading.d.ts +1 -1
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +15 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +32 -2
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +12 -6
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -1
- package/dist/Indicator/RadioIndicator.js +18 -4
- package/dist/Indicator/indicatorRegistry.d.ts +3 -26
- package/dist/Indicator/indicatorRegistry.d.ts.map +1 -1
- package/dist/Indicator/indicatorRegistry.js +2 -11
- package/dist/Indicator/themeIndicators.d.ts +15 -0
- package/dist/Indicator/themeIndicators.d.ts.map +1 -0
- package/dist/Indicator/themeIndicators.js +21 -0
- package/dist/Indicator/types.d.ts +14 -0
- package/dist/Indicator/types.d.ts.map +1 -1
- package/dist/Indicator/useThemeIndicator.d.ts +3 -0
- package/dist/Indicator/useThemeIndicator.d.ts.map +1 -0
- package/dist/Indicator/useThemeIndicator.js +19 -0
- package/dist/Item/Item.d.ts +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +30 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +9 -2
- package/dist/Layer/layerExitCopy.d.ts.map +1 -1
- package/dist/Layer/layerExitCopy.js +1 -1
- package/dist/Layer/layerSlideRules.d.ts +23 -15
- package/dist/Layer/layerSlideRules.d.ts.map +1 -1
- package/dist/Layer/layerSlideRules.js +54 -54
- package/dist/Layer/useLayer.d.ts +41 -29
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +199 -126
- package/dist/Layer/useLayerKeyboardClearance.d.ts +5 -5
- package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
- package/dist/Layer/useLayerKeyboardClearance.js +5 -5
- package/dist/Layout/LayoutContainerContext.d.ts +4 -0
- package/dist/Layout/LayoutContainerContext.d.ts.map +1 -0
- package/dist/Layout/LayoutContainerContext.js +20 -0
- package/dist/Layout/LayoutContainerScope.d.ts +15 -0
- package/dist/Layout/LayoutContainerScope.d.ts.map +1 -0
- package/dist/Layout/LayoutContainerScope.js +23 -0
- package/dist/Layout/LayoutContent.d.ts +2 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +7 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutFooter.js +5 -1
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.js +5 -1
- package/dist/Layout/containerCorners.stylex.d.ts +15 -7
- package/dist/Layout/containerCorners.stylex.d.ts.map +1 -1
- package/dist/Layout/containerCorners.stylex.js +16 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +324 -6
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +14 -6
- package/dist/List/ListContext.d.ts +38 -1
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +50 -2
- package/dist/List/ListItem.js +2 -2
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +85 -96
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.js +12 -5
- package/dist/Markdown/plugins/protocol.js +3 -3
- package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListItem.js +11 -3
- package/dist/MobileNav/MobileNav.d.ts +1 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +6 -3
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +33 -9
- package/dist/NavMenu/NavHeadingMenu.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenu.js +5 -2
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +1 -0
- package/dist/NavMenu/NavMenuContext.d.ts +7 -0
- package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
- package/dist/NavMenu/NavMenuContext.js +9 -0
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +8 -2
- package/dist/Outline/Outline.d.ts +7 -3
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +11 -3
- package/dist/Outline/useScrollSpy.d.ts +1 -1
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +6 -2
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +51 -25
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +33 -13
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +5 -1
- package/dist/Popover/popoverAnchor.d.ts +11 -0
- package/dist/Popover/popoverAnchor.d.ts.map +1 -0
- package/dist/Popover/popoverAnchor.js +33 -0
- package/dist/Popover/usePopover.d.ts +20 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +110 -10
- package/dist/PowerSearch/PowerSearch.d.ts +1 -0
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +46 -9
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +7 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +7 -0
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +2 -4
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +6 -13
- package/dist/ProgressBar/ProgressBar.d.ts +5 -4
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +26 -26
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +51 -0
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +1 -1
- package/dist/Resizable/ResizeHandle.d.ts +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +1 -1
- package/dist/Resizable/resizableModel.d.ts +45 -3
- package/dist/Resizable/resizableModel.d.ts.map +1 -1
- package/dist/Resizable/resizableModel.js +91 -3
- package/dist/Resizable/resizeGesture.d.ts +3 -0
- package/dist/Resizable/resizeGesture.d.ts.map +1 -1
- package/dist/Resizable/resizeGesture.js +6 -0
- package/dist/Resizable/useResizable.d.ts +1 -33
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +8 -72
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +1 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +27 -5
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +70 -8
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +34 -14
- package/dist/Selector/hooks.d.ts +5 -0
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +72 -16
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +9 -3
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +18 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +47 -33
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +21 -12
- package/dist/Swipe/useSwipeAction.js +3 -3
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +64 -46
- package/dist/Switch/useSwitchTouch.d.ts +22 -1
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +54 -3
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +3 -3
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +37 -18
- package/dist/Table/Table.d.ts +4 -3
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +32 -14
- package/dist/Table/TableBody.d.ts.map +1 -1
- package/dist/Table/TableBody.js +5 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +6 -0
- package/dist/Table/TableHeaderCell.d.ts +1 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +42 -9
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +9 -1
- package/dist/Table/TableRowPlacementContext.d.ts +18 -0
- package/dist/Table/TableRowPlacementContext.d.ts.map +1 -0
- package/dist/Table/TableRowPlacementContext.js +41 -0
- package/dist/Table/TableSelectionToolbar.d.ts.map +1 -1
- package/dist/Table/TableSelectionToolbar.js +7 -0
- package/dist/Table/columnUtils.d.ts +5 -0
- package/dist/Table/columnUtils.d.ts.map +1 -1
- package/dist/Table/columnUtils.js +9 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +2 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +8 -3
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +10 -6
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +5 -1
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +2 -1
- package/dist/Table/table.stylex.d.ts +31 -5
- package/dist/Table/table.stylex.d.ts.map +1 -1
- package/dist/Table/table.stylex.js +33 -5
- package/dist/Table/types.d.ts +3 -1
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.d.ts.map +1 -1
- package/dist/Text/TruncationTooltip.js +17 -6
- package/dist/Text/text.stylex.d.ts +2 -2
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +23 -4
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +15 -1
- package/dist/TextInput/TextInput.d.ts +9 -3
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +19 -18
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +13 -4
- package/dist/Timer/Timer.d.ts.map +1 -1
- package/dist/Timer/Timer.js +10 -7
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +55 -4
- package/dist/Toast/Toast.d.ts +1 -6
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +77 -44
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +48 -21
- package/dist/Toast/types.d.ts +8 -0
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +14 -7
- package/dist/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButton.js +2 -1
- package/dist/Token/Token.d.ts +1 -1
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +6 -2
- package/dist/Tokenizer/Tokenizer.d.ts +2 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +102 -62
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +33 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +20 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +24 -8
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +21 -9
- package/dist/TopNav/TopNavMegaMenu.js +1 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +9 -2
- package/dist/TopNav/TopNavRenderContext.d.ts +13 -0
- package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavRenderContext.js +24 -9
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +7 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +20 -2
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +24 -9
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- package/dist/Typeahead/TypeaheadItem.js +7 -0
- package/dist/astryx.css +211 -56
- package/dist/gestures/GestureHost.d.ts +7 -0
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +37 -0
- package/dist/hooks/anchoredHint.d.ts.map +1 -1
- package/dist/hooks/anchoredHint.js +0 -1
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +7 -0
- package/dist/hooks/focusableSelector.d.ts +16 -9
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +53 -2
- package/dist/hooks/scrollEdgeFade.d.ts +34 -0
- package/dist/hooks/scrollEdgeFade.d.ts.map +1 -0
- package/dist/hooks/scrollEdgeFade.js +173 -0
- package/dist/hooks/statusButtonPress.d.ts +15 -0
- package/dist/hooks/statusButtonPress.d.ts.map +1 -0
- package/dist/hooks/statusButtonPress.js +19 -0
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +2 -1
- package/dist/hooks/useFocusTrap.d.ts +26 -16
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +75 -112
- package/dist/hooks/useGroupPressTracking.d.ts +1 -1
- package/dist/hooks/useGroupPressTracking.js +1 -1
- package/dist/hooks/useOverflow.d.ts +25 -2
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +137 -8
- package/dist/hooks/useResolvedRequired.d.ts +27 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -1
- package/dist/hooks/useResolvedRequired.js +30 -1
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +4 -2
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +8 -8
- package/dist/i18n/InternationalizationContext.d.ts +13 -6
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +11 -6
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +7 -0
- package/dist/i18n/defaultTranslator.d.ts +17 -0
- package/dist/i18n/defaultTranslator.d.ts.map +1 -0
- package/dist/i18n/defaultTranslator.js +18 -0
- package/dist/i18n/firstStrongDirection.d.ts +3 -2
- package/dist/i18n/firstStrongDirection.d.ts.map +1 -1
- package/dist/i18n/firstStrongDirection.js +50 -12
- package/dist/i18n/generated-english/Chat/ChatPastedTextToken.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Chat/ChatPastedTextToken.generated.js +1 -2
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Chat/pastedTextLabel.generated.js +12 -0
- package/dist/i18n/generated-english/Chat/useTriggerMenu.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Chat/useTriggerMenu.generated.js +1 -0
- package/dist/i18n/generated-english/CodeBlock/CodeBlock.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/CodeBlock/CodeBlock.generated.js +2 -1
- package/dist/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.js +2 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/MultiSelector/MultiSelector.generated.js +1 -0
- package/dist/i18n/generated-english/Slider/Slider.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Slider/Slider.generated.js +2 -1
- package/dist/i18n/generated-english/TextArea/TextArea.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/TextArea/TextArea.generated.js +1 -0
- package/dist/i18n/generated-english/TextInput/TextInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/TextInput/TextInput.generated.js +1 -0
- package/dist/i18n/generated-english/Timestamp/Timestamp.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Timestamp/Timestamp.generated.js +2 -1
- package/dist/i18n/generated-english/Tokenizer/Tokenizer.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Tokenizer/Tokenizer.generated.js +1 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +9 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +9 -0
- package/dist/i18n/publicContext.d.ts.map +1 -1
- package/dist/i18n/publicContext.js +4 -2
- package/dist/i18n/translatingContext.d.ts +2 -0
- package/dist/i18n/translatingContext.d.ts.map +1 -0
- package/dist/i18n/translatingContext.js +25 -0
- package/dist/i18n/useComponentTranslator.d.ts.map +1 -1
- package/dist/i18n/useComponentTranslator.js +3 -2
- package/dist/i18n/useListFormatter.d.ts.map +1 -1
- package/dist/i18n/useListFormatter.js +3 -2
- package/dist/i18n/useTranslator.d.ts.map +1 -1
- package/dist/i18n/useTranslator.js +3 -2
- package/dist/internal/touch.d.ts +2 -0
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +5 -1
- package/dist/keyboard/keyboardHeight.d.ts +34 -3
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -1
- package/dist/keyboard/keyboardHeight.js +101 -24
- package/dist/keyboard/keyboardTarget.d.ts +19 -16
- package/dist/keyboard/keyboardTarget.d.ts.map +1 -1
- package/dist/keyboard/keyboardTarget.js +529 -72
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -1
- package/dist/keyboard/useMobileKeyboard.js +1 -8
- package/dist/palette/color.d.ts +23 -0
- package/dist/palette/color.d.ts.map +1 -0
- package/dist/palette/color.js +126 -0
- package/dist/palette/generator.d.ts +69 -0
- package/dist/palette/generator.d.ts.map +1 -0
- package/dist/palette/generator.js +778 -0
- package/dist/palette/index.d.ts +12 -0
- package/dist/palette/index.d.ts.map +1 -0
- package/dist/palette/index.js +13 -0
- package/dist/palette/mapping.d.ts +319 -0
- package/dist/palette/mapping.d.ts.map +1 -0
- package/dist/palette/mapping.js +1312 -0
- package/dist/palette/themePalette.d.ts +20 -0
- package/dist/palette/themePalette.d.ts.map +1 -0
- package/dist/palette/themePalette.js +145 -0
- package/dist/palette/types.d.ts +178 -0
- package/dist/palette/types.d.ts.map +1 -0
- package/dist/palette/types.js +1 -0
- package/dist/privateAttributes/mediaDarkPage.d.ts +5 -0
- package/dist/privateAttributes/mediaDarkPage.d.ts.map +1 -0
- package/dist/privateAttributes/mediaDarkPage.js +27 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +2 -1
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/pressGroupItem.stylex.js +2 -1
- package/dist/privateAttributes/scheme.d.ts +10 -0
- package/dist/privateAttributes/scheme.d.ts.map +1 -0
- package/dist/privateAttributes/scheme.js +34 -0
- package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/travelling.stylex.js +2 -2
- package/dist/theme/MediaDarkPage.d.ts +18 -0
- package/dist/theme/MediaDarkPage.d.ts.map +1 -0
- package/dist/theme/MediaDarkPage.js +35 -0
- package/dist/theme/MediaTheme.d.ts.map +1 -1
- package/dist/theme/MediaTheme.js +9 -1
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +99 -31
- package/dist/theme/defineTheme.d.ts +31 -6
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +65 -29
- package/dist/theme/derivedVarRegistry.d.ts +19 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +49 -4
- package/dist/theme/expandRadiusScale.d.ts +1 -2
- package/dist/theme/expandRadiusScale.d.ts.map +1 -1
- package/dist/theme/expandRadiusScale.js +1 -5
- package/dist/theme/generateThemeRules.d.ts +10 -3
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +310 -207
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/invertedSurfaceSide.d.ts +17 -0
- package/dist/theme/invertedSurfaceSide.d.ts.map +1 -0
- package/dist/theme/invertedSurfaceSide.js +47 -0
- package/dist/theme/resolveThemeValues.d.ts +5 -2
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +7 -1
- package/dist/theme/statusRoleDefaults.d.ts +43 -0
- package/dist/theme/statusRoleDefaults.d.ts.map +1 -0
- package/dist/theme/statusRoleDefaults.js +196 -0
- package/dist/theme/statusRoleDerivation.d.ts +4 -0
- package/dist/theme/statusRoleDerivation.d.ts.map +1 -1
- package/dist/theme/statusRoleDerivation.js +3 -1
- package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
- package/dist/theme/syntax/SyntaxTheme.js +7 -0
- package/dist/theme/themeAdaptations.d.ts +24 -1
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +48 -5
- package/dist/theme/tokenDefaults.d.ts +3 -0
- package/dist/theme/tokenDefaults.d.ts.map +1 -0
- package/dist/theme/tokenDefaults.js +30 -0
- package/dist/theme/tokenValues.d.ts +26 -0
- package/dist/theme/tokenValues.d.ts.map +1 -0
- package/dist/theme/tokenValues.js +180 -0
- package/dist/theme/tokens.d.ts +3 -2
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +7 -161
- package/dist/theme/tokens.stylex.d.ts +4 -4
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +7 -5
- package/dist/theme/useTheme.d.ts +40 -3
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +137 -32
- package/dist/utils/devWarning.d.ts +17 -0
- package/dist/utils/devWarning.d.ts.map +1 -1
- package/dist/utils/devWarning.js +20 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +7 -4
- package/dist/utils/focusReturn.d.ts +110 -0
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +418 -12
- package/dist/utils/hitArea.d.ts +28 -0
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +52 -18
- package/dist/utils/inputStream.d.ts +27 -0
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +72 -5
- package/dist/utils/nodeType.d.ts +2 -0
- package/dist/utils/nodeType.d.ts.map +1 -1
- package/dist/utils/nodeType.js +10 -0
- package/dist/utils/timeFormat.d.ts +14 -4
- package/dist/utils/timeFormat.d.ts.map +1 -1
- package/dist/utils/timeFormat.js +42 -4
- package/dist/utils/touchPresentation.d.ts +2 -2
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +10 -7
- package/dist/utils/touchPresentation.stylex.d.ts +4 -3
- package/dist/utils/touchPresentation.stylex.d.ts.map +1 -1
- package/dist/utils/touchPresentation.stylex.js +3 -3
- package/dist/utils/touchQueries.d.ts +3 -2
- package/dist/utils/touchQueries.d.ts.map +1 -1
- package/dist/utils/touchQueries.js +3 -2
- package/dist/utils/typeaheadMatch.d.ts +13 -0
- package/dist/utils/typeaheadMatch.d.ts.map +1 -1
- package/dist/utils/typeaheadMatch.js +15 -1
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -1
- package/dist/virtualization/useInlineListWindow.js +38 -22
- package/locales/en.json +36 -0
- package/locales/pseudo.json +27 -0
- package/package.json +10 -5
- package/scripts/agent-doc-state.mjs +71 -4
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -1
- package/src/AlertDialog/AlertDialog.tsx +34 -7
- package/src/AppShell/AppShell.doc.mjs +22 -0
- package/src/AppShell/AppShell.tsx +112 -65
- package/src/AppShell/unreadWidthPoint.ts +162 -0
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +6 -1
- package/src/Badge/Badge.tsx +5 -2
- package/src/Banner/Banner.doc.mjs +15 -0
- package/src/Banner/Banner.tsx +56 -45
- package/src/BottomSheet/BottomSheet.doc.mjs +6 -3
- package/src/BottomSheet/BottomSheet.tsx +3 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +15 -7
- package/src/BottomSheet/BottomSheetSwitcher.tsx +73 -1
- package/src/BottomSheet/BottomSheetSwitcherContext.ts +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +6 -14
- package/src/Breadcrumbs/BreadcrumbItem.tsx +14 -1
- package/src/Button/Button.doc.mjs +6 -0
- package/src/Button/Button.tsx +6 -0
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.tsx +32 -20
- package/src/Calendar/styles.ts +12 -3
- package/src/Card/Card.doc.mjs +2 -2
- package/src/Card/Card.tsx +22 -3
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatComposer.doc.mjs +3 -3
- package/src/Chat/ChatComposer.tsx +11 -5
- package/src/Chat/ChatComposerDrawer.tsx +11 -7
- package/src/Chat/ChatDictationButton.tsx +12 -0
- package/src/Chat/ChatMessageBubble.tsx +2 -2
- package/src/Chat/ChatPastedTextToken.tsx +3 -9
- package/src/Chat/ChatSendButton.tsx +5 -0
- package/src/Chat/ChatSystemMessage.tsx +1 -0
- package/src/Chat/ChatToolCalls.tsx +16 -0
- package/src/Chat/pastedTextLabel.ts +23 -0
- package/src/Chat/useChatPasteAsToken.ts +9 -8
- package/src/Chat/useTriggerMenu.tsx +4 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +20 -0
- package/src/CheckboxInput/CheckboxInput.tsx +83 -26
- package/src/CheckboxList/CheckboxList.doc.mjs +15 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/Citation/Citation.tsx +16 -1
- package/src/CodeBlock/CodeBlock.tsx +29 -2
- package/src/Collapsible/Collapsible.tsx +2 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -0
- package/src/ComplexSelector/ComplexSelector.doc.mjs +30 -2
- package/src/ComplexSelector/ComplexSelector.tsx +19 -1
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -1
- package/src/ContextMenu/ContextMenu.tsx +44 -5
- package/src/ContextMenu/ContextMenuItem.doc.mjs +55 -5
- package/src/DateInput/MonthScroller.tsx +1 -0
- package/src/DateInput/PickerWheel.tsx +1 -0
- package/src/DateInput/TouchDateField.tsx +2 -0
- package/src/DateInput/Wheel.tsx +1 -0
- package/src/DateInput/usePointerDragScroll.ts +6 -2
- package/src/DateRangeInput/DateRangeInput.tsx +16 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +2 -0
- package/src/Dialog/Dialog.doc.mjs +11 -1
- package/src/Dialog/Dialog.tsx +116 -19
- package/src/Dialog/DialogContext.ts +5 -4
- package/src/Dialog/DialogHeader.tsx +50 -12
- package/src/Drawer/DrawerHeader.tsx +31 -6
- package/src/DropdownMenu/DropdownMenu.doc.mjs +20 -1
- package/src/DropdownMenu/DropdownMenu.tsx +29 -22
- package/src/DropdownMenu/DropdownMenuCheckboxItem.doc.mjs +4 -4
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +3 -2
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +5 -5
- package/src/DropdownMenu/DropdownMenuItem.tsx +3 -1
- package/src/DropdownMenu/DropdownMenuRadioItem.doc.mjs +4 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +3 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +3 -3
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +23 -1
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +37 -9
- package/src/DropdownMenu/menuRowCorners.stylex.ts +40 -0
- package/src/EmptyState/EmptyState.tsx +2 -0
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/FieldLabel.doc.mjs +3 -3
- package/src/Field/FieldLabel.tsx +9 -2
- package/src/Field/inputDisabledFocus.ts +18 -0
- package/src/Field/inputStyles.stylex.ts +52 -1
- package/src/Grid/Grid.doc.mjs +6 -3
- package/src/Grid/Grid.tsx +5 -2
- package/src/Heading/Heading.tsx +24 -1
- package/src/Icon/Icon.doc.mjs +1 -1
- package/src/Icon/Icon.tsx +40 -2
- package/src/Indicator/CheckboxIndicator.tsx +11 -6
- package/src/Indicator/Indicator.doc.mjs +1 -1
- package/src/Indicator/RadioIndicator.tsx +31 -4
- package/src/Indicator/indicatorRegistry.ts +7 -23
- package/src/Indicator/themeIndicators.ts +29 -0
- package/src/Indicator/types.ts +14 -0
- package/src/Indicator/useThemeIndicator.ts +24 -0
- package/src/Item/Item.doc.mjs +3 -3
- package/src/Item/Item.tsx +48 -7
- package/src/Kbd/Kbd.doc.mjs +6 -2
- package/src/Kbd/Kbd.tsx +16 -1
- package/src/Layer/layerExitCopy.ts +0 -1
- package/src/Layer/layerSlideRules.ts +62 -74
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Layer/useLayer.tsx +293 -137
- package/src/Layer/useLayerKeyboardClearance.ts +9 -12
- package/src/Layout/Layout.doc.mjs +3 -3
- package/src/Layout/LayoutContainerContext.ts +27 -0
- package/src/Layout/LayoutContainerScope.tsx +32 -0
- package/src/Layout/LayoutContent.tsx +5 -2
- package/src/Layout/LayoutFooter.tsx +3 -1
- package/src/Layout/LayoutHeader.tsx +3 -1
- package/src/Layout/containerCorners.stylex.ts +44 -7
- package/src/Lightbox/Lightbox.tsx +460 -8
- package/src/Link/Link.doc.mjs +18 -0
- package/src/Link/Link.tsx +3 -1
- package/src/List/List.tsx +14 -2
- package/src/List/ListContext.tsx +60 -1
- package/src/List/ListItem.doc.mjs +11 -9
- package/src/List/ListItem.tsx +4 -4
- package/src/Markdown/Markdown.doc.mjs +1 -1
- package/src/Markdown/Markdown.tsx +189 -190
- package/src/Markdown/plugins/HeadingLinksRenderer.tsx +14 -4
- package/src/Markdown/plugins/protocol.ts +3 -3
- package/src/MetadataList/MetadataListItem.tsx +18 -3
- package/src/MobileNav/MobileNav.doc.mjs +134 -52
- package/src/MobileNav/MobileNav.tsx +13 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +2 -2
- package/src/MultiSelector/MultiSelector.tsx +51 -8
- package/src/NavMenu/NavHeadingMenu.tsx +5 -1
- package/src/NavMenu/NavHeadingMenuItem.tsx +1 -0
- package/src/NavMenu/NavMenu.doc.mjs +105 -2
- package/src/NavMenu/NavMenuContext.tsx +13 -0
- package/src/NumberInput/NumberInput.doc.mjs +12 -10
- package/src/NumberInput/NumberInput.tsx +19 -11
- package/src/Outline/Outline.doc.mjs +26 -8
- package/src/Outline/Outline.tsx +35 -5
- package/src/Outline/useScrollSpy.ts +8 -3
- package/src/OverflowList/OverflowList.doc.mjs +15 -0
- package/src/OverflowList/OverflowList.tsx +62 -26
- package/src/Pagination/Pagination.doc.mjs +12 -0
- package/src/Pagination/Pagination.tsx +40 -6
- package/src/Popover/Popover.doc.mjs +10 -0
- package/src/Popover/Popover.tsx +8 -4
- package/src/Popover/popoverAnchor.ts +47 -0
- package/src/Popover/usePopover.doc.mjs +16 -2
- package/src/Popover/usePopover.tsx +152 -16
- package/src/PowerSearch/PowerSearch.doc.mjs +8 -8
- package/src/PowerSearch/PowerSearch.tsx +65 -12
- package/src/PowerSearch/PowerSearchEditPopover.tsx +1 -0
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +12 -0
- package/src/PowerSearch/PowerSearchToken.tsx +12 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +14 -19
- package/src/ProgressBar/ProgressBar.doc.mjs +2 -2
- package/src/ProgressBar/ProgressBar.tsx +44 -30
- package/src/RadioList/RadioList.tsx +63 -0
- package/src/RadioList/RadioListItem.tsx +4 -1
- package/src/Resizable/ResizeHandle.tsx +2 -3
- package/src/Resizable/resizableModel.ts +105 -3
- package/src/Resizable/resizeGesture.ts +14 -0
- package/src/Resizable/useResizable.ts +14 -75
- package/src/SegmentedControl/SegmentedControlItem.tsx +1 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +76 -12
- package/src/Selector/Selector.doc.mjs +34 -7
- package/src/Selector/Selector.tsx +55 -25
- package/src/Selector/SelectorOption.doc.mjs +5 -5
- package/src/Selector/hooks.ts +92 -17
- package/src/Selector/useSelectorPresentation.ts +18 -3
- package/src/SideNav/SideNavHeading.tsx +15 -4
- package/src/SideNav/SideNavItem.doc.mjs +10 -10
- package/src/Slider/Slider.tsx +4 -1
- package/src/Spinner/Spinner.tsx +56 -41
- package/src/Stepper/Step.tsx +18 -3
- package/src/Stepper/Stepper.doc.mjs +14 -2
- package/src/Swipe/useSwipeAction.ts +3 -3
- package/src/Switch/Switch.doc.mjs +61 -5
- package/src/Switch/Switch.tsx +72 -35
- package/src/Switch/useSwitchTouch.ts +68 -3
- package/src/TabList/Tab.tsx +6 -0
- package/src/Table/BaseTable.tsx +73 -35
- package/src/Table/Table.doc.mjs +109 -5
- package/src/Table/Table.tsx +42 -17
- package/src/Table/TableBody.tsx +10 -1
- package/src/Table/TableCell.tsx +6 -0
- package/src/Table/TableHeaderCell.tsx +52 -7
- package/src/Table/TableRow.tsx +8 -1
- package/src/Table/TableRowPlacementContext.ts +58 -0
- package/src/Table/TableSelectionToolbar.tsx +12 -0
- package/src/Table/columnUtils.ts +9 -1
- package/src/Table/plugins/columnSettings/useTableColumnSettingsState.doc.mjs +1 -1
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +15 -2
- package/src/Table/plugins/sortable/useTableSortableState.doc.mjs +5 -5
- package/src/Table/plugins/sortable/useTableSortableState.tsx +15 -8
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +8 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +2 -4
- package/src/Table/table.stylex.ts +44 -5
- package/src/Table/types.ts +3 -1
- package/src/Table/useTableColumnResize.doc.mjs +3 -3
- package/src/Table/useTableColumnSettings.doc.mjs +3 -3
- package/src/Table/useTableFilterState.doc.mjs +6 -3
- package/src/Table/useTableFiltering.doc.mjs +71 -4
- package/src/Table/useTableInfiniteScroll.doc.mjs +2 -2
- package/src/Table/useTablePagination.doc.mjs +24 -3
- package/src/Table/useTableSelection.doc.mjs +30 -6
- package/src/Table/useTableSelectionState.doc.mjs +30 -2
- package/src/Table/useTableSortable.doc.mjs +104 -17
- package/src/Table/useTableStickyColumns.doc.mjs +3 -3
- package/src/Text/Heading.doc.mjs +2 -2
- package/src/Text/Text.doc.mjs +1 -1
- package/src/Text/TruncationTooltip.tsx +18 -11
- package/src/Text/useTruncation.ts +20 -4
- package/src/TextArea/TextArea.doc.mjs +5 -5
- package/src/TextArea/TextArea.tsx +20 -1
- package/src/TextInput/TextInput.doc.mjs +5 -5
- package/src/TextInput/TextInput.tsx +23 -18
- package/src/Thumbnail/Thumbnail.tsx +2 -1
- package/src/Timer/Timer.tsx +21 -6
- package/src/Timestamp/Timestamp.tsx +67 -4
- package/src/Toast/Toast.doc.mjs +15 -5
- package/src/Toast/Toast.tsx +83 -62
- package/src/Toast/ToastViewport.tsx +62 -23
- package/src/Toast/types.ts +8 -0
- package/src/Toast/useToast.doc.mjs +80 -15
- package/src/Toast/useToast.tsx +18 -7
- package/src/ToggleButton/ToggleButton.doc.mjs +1 -1
- package/src/ToggleButton/ToggleButton.tsx +1 -0
- package/src/Token/Token.tsx +5 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +15 -3
- package/src/Tokenizer/Tokenizer.tsx +130 -75
- package/src/Toolbar/Toolbar.tsx +55 -4
- package/src/Tooltip/useTooltip.tsx +26 -0
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TopNav/TopNav.tsx +13 -3
- package/src/TopNav/TopNavHeading.tsx +22 -9
- package/src/TopNav/TopNavMegaMenu.tsx +4 -4
- package/src/TopNav/TopNavMenu.tsx +13 -0
- package/src/TopNav/TopNavRenderContext.ts +30 -9
- package/src/TreeList/TreeList.tsx +12 -0
- package/src/TreeList/TreeListItem.tsx +26 -5
- package/src/Typeahead/BaseTypeahead.doc.mjs +6 -0
- package/src/Typeahead/BaseTypeahead.tsx +2 -0
- package/src/Typeahead/Typeahead.doc.mjs +15 -2
- package/src/Typeahead/Typeahead.tsx +37 -13
- package/src/Typeahead/TypeaheadItem.tsx +12 -0
- package/src/gestures/GestureHost.ts +34 -0
- package/src/gestures/README.md +9 -6
- package/src/hooks/anchoredHint.tsx +1 -2
- package/src/hooks/computeOverflow.ts +10 -0
- package/src/hooks/focusableSelector.ts +59 -2
- package/src/hooks/scrollEdgeFade.ts +129 -0
- package/src/hooks/statusButtonPress.ts +26 -0
- package/src/hooks/useAnnounce.ts +2 -1
- package/src/hooks/useFocusTrap.ts +110 -141
- package/src/hooks/useGroupPressTracking.ts +1 -1
- package/src/hooks/useOverflow.ts +227 -13
- package/src/hooks/useResolvedRequired.ts +50 -1
- package/src/hooks/useTreeFocus.ts +8 -4
- package/src/hooks/useTypeahead.ts +12 -10
- package/src/i18n/InternationalizationContext.ts +16 -7
- package/src/i18n/InternationalizationProvider.doc.mjs +1 -1
- package/src/i18n/InternationalizationProvider.tsx +12 -0
- package/src/i18n/defaultTranslator.ts +25 -0
- package/src/i18n/firstStrongDirection.ts +54 -13
- package/src/i18n/generated-english/Chat/ChatPastedTextToken.generated.ts +1 -2
- package/src/i18n/generated-english/Chat/pastedTextLabel.generated.ts +13 -0
- package/src/i18n/generated-english/Chat/useTriggerMenu.generated.ts +1 -0
- package/src/i18n/generated-english/CodeBlock/CodeBlock.generated.ts +2 -1
- package/src/i18n/generated-english/Markdown/plugins/HeadingLinksRenderer.generated.ts +2 -1
- package/src/i18n/generated-english/MultiSelector/MultiSelector.generated.ts +1 -0
- package/src/i18n/generated-english/Slider/Slider.generated.ts +2 -1
- package/src/i18n/generated-english/TextArea/TextArea.generated.ts +1 -0
- package/src/i18n/generated-english/TextInput/TextInput.generated.ts +1 -0
- package/src/i18n/generated-english/Timestamp/Timestamp.generated.ts +2 -1
- package/src/i18n/generated-english/Tokenizer/Tokenizer.generated.ts +1 -0
- package/src/i18n/generated-locales/en.generated.ts +11 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +11 -0
- package/src/i18n/publicContext.ts +4 -2
- package/src/i18n/translatingContext.ts +28 -0
- package/src/i18n/useComponentTranslator.ts +3 -2
- package/src/i18n/useListFormatter.ts +3 -2
- package/src/i18n/useTranslator.ts +3 -2
- package/src/internal/touch.ts +7 -0
- package/src/keyboard/README.md +58 -16
- package/src/keyboard/keyboardHeight.ts +138 -26
- package/src/keyboard/keyboardTarget.ts +667 -71
- package/src/keyboard/useMobileKeyboard.ts +1 -7
- package/src/palette/color.ts +205 -0
- package/src/palette/generator.ts +1134 -0
- package/src/palette/index.ts +35 -0
- package/src/palette/mapping.ts +1630 -0
- package/src/palette/themePalette.ts +175 -0
- package/src/palette/types.ts +194 -0
- package/src/privateAttributes/mediaDarkPage.ts +27 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +2 -1
- package/src/privateAttributes/scheme.ts +37 -0
- package/src/privateAttributes/travelling.stylex.ts +6 -4
- package/src/reset.css +1 -1
- package/src/theme/MediaDarkPage.tsx +41 -0
- package/src/theme/MediaTheme.tsx +8 -1
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +140 -35
- package/src/theme/defineTheme.ts +103 -40
- package/src/theme/derivedVarRegistry.ts +61 -4
- package/src/theme/expandRadiusScale.ts +1 -5
- package/src/theme/generateThemeRules.ts +398 -342
- package/src/theme/index.ts +2 -4
- package/src/theme/invertedSurfaceSide.ts +65 -0
- package/src/theme/resolveThemeValues.ts +8 -2
- package/src/theme/statusRoleDefaults.ts +330 -0
- package/src/theme/statusRoleDerivation.ts +2 -1
- package/src/theme/syntax/SyntaxTheme.tsx +12 -0
- package/src/theme/themeAdaptations.ts +53 -5
- package/src/theme/tokenDefaults.ts +44 -0
- package/src/theme/tokenValues.ts +193 -0
- package/src/theme/tokens.stylex.ts +7 -5
- package/src/theme/tokens.ts +14 -176
- package/src/theme/useTheme.ts +164 -35
- package/src/utils/devWarning.ts +24 -0
- package/src/utils/focusOutline.stylex.ts +7 -4
- package/src/utils/focusReturn.ts +578 -16
- package/src/utils/hitArea.ts +70 -33
- package/src/utils/inputStream.ts +81 -5
- package/src/utils/nodeType.ts +10 -0
- package/src/utils/timeFormat.ts +54 -4
- package/src/utils/touchPresentation.stylex.ts +7 -6
- package/src/utils/touchPresentation.ts +10 -7
- package/src/utils/touchQueries.ts +3 -2
- package/src/utils/typeaheadMatch.ts +20 -1
- package/src/virtualization/useInlineListWindow.ts +57 -33
|
@@ -38,19 +38,40 @@ import {
|
|
|
38
38
|
type ResolvedThemeAdaptationRule,
|
|
39
39
|
} from './themeAdaptations';
|
|
40
40
|
import {parseStyleKey} from '../utils/parseStyleKey';
|
|
41
|
-
import {
|
|
42
|
-
|
|
41
|
+
import {
|
|
42
|
+
LOGICAL_RADIUS_CORNERS,
|
|
43
|
+
PHYSICAL_RADIUS_CORNERS,
|
|
44
|
+
getDerivedVars,
|
|
45
|
+
} from './derivedVarRegistry';
|
|
46
|
+
import {
|
|
47
|
+
STATUS_NAMES,
|
|
48
|
+
deriveStatusRoleTokens,
|
|
49
|
+
resolveModes,
|
|
50
|
+
} from './statusRoleDerivation';
|
|
43
51
|
import {cssVar, classPrefix, dataAttrNamespace} from '../naming';
|
|
44
52
|
import {
|
|
45
53
|
analyzeDeclarationValue,
|
|
46
|
-
canonicalizeDeclarationName,
|
|
47
54
|
checkDeclarationName,
|
|
48
55
|
checkDeclarationValue,
|
|
49
56
|
} from './declarationBoundary';
|
|
57
|
+
import {
|
|
58
|
+
SCOPED_REFERENCE_DEFAULTS,
|
|
59
|
+
assignTokenCascade,
|
|
60
|
+
authoredStatusRoleEntries,
|
|
61
|
+
createTokenCascade,
|
|
62
|
+
effectiveAdaptationTokenValues,
|
|
63
|
+
generatedScopedStatusRoleDefaults,
|
|
64
|
+
reachableAdaptationMatchSets,
|
|
65
|
+
stringifyTokenValue,
|
|
66
|
+
tokenValuesWouldHaveCycleWithValue,
|
|
67
|
+
} from './statusRoleDefaults';
|
|
50
68
|
import {readerTextSizeEntries} from './dynamicType';
|
|
51
69
|
import {splitTopLevelWhitespace} from './tokenReferences';
|
|
52
70
|
import {withoutUnsetComponents} from './mergeComponents';
|
|
53
71
|
import {PRESS_BELIEVED_SELECTOR} from '../privateAttributes/press';
|
|
72
|
+
import {ROOT_SCHEME_UNNAMED, rootSchemeIs} from '../privateAttributes/scheme';
|
|
73
|
+
import {mediaDarkPageIs} from '../privateAttributes/mediaDarkPage';
|
|
74
|
+
import {darkPageSides} from './invertedSurfaceSide';
|
|
54
75
|
|
|
55
76
|
/**
|
|
56
77
|
* Theme @scope selectors.
|
|
@@ -68,9 +89,60 @@ function themeScopeStart(name: string): string {
|
|
|
68
89
|
/** Scope limit matching the theme attribute (nested-theme boundary). */
|
|
69
90
|
const THEME_SCOPE_TO = `[data-${dataAttrNamespace}-theme]`;
|
|
70
91
|
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Media-surface selector, e.g. for [data-astryx-media="dark"]. A dark-page
|
|
94
|
+
* surface key (`light@dark-page`) selects a surface that takes that side on a
|
|
95
|
+
* dark page, under the conditions that make the page dark; its
|
|
96
|
+
* `-preference` form holds the conditions a `prefers-color-scheme` block
|
|
97
|
+
* must wrap.
|
|
98
|
+
*/
|
|
99
|
+
function mediaSelector(surface: MediaSurface): string {
|
|
100
|
+
const [side, page] = surface.split('@') as [MediaSide, string | undefined];
|
|
101
|
+
const own = `[data-${dataAttrNamespace}-media="${side}"]`;
|
|
102
|
+
if (page === undefined) {
|
|
103
|
+
return own;
|
|
104
|
+
}
|
|
105
|
+
if (page.startsWith('unflipped')) {
|
|
106
|
+
// The side a surface names for a light page, except where a dark page
|
|
107
|
+
// takes the other side on it: there, none of this side's rules applies.
|
|
108
|
+
const other: MediaSide = side === 'dark' ? 'light' : 'dark';
|
|
109
|
+
const flipped = [
|
|
110
|
+
...darkPageConditions(false),
|
|
111
|
+
...(page === 'unflipped-preference' ? darkPageConditions(true) : []),
|
|
112
|
+
].map(condition => `${condition} ${mediaDarkPageIs(other)}`);
|
|
113
|
+
return `${own}:where(:not(${flipped.join(', ')}))`;
|
|
114
|
+
}
|
|
115
|
+
// The page's conditions add no specificity, as a root color-mode block's
|
|
116
|
+
// do: the copy weighs what the surface's own side selector weighs.
|
|
117
|
+
return darkPageConditions(page === 'dark-page-preference')
|
|
118
|
+
.map(condition => `:where(${condition}) ${mediaDarkPageIs(side)}`)
|
|
119
|
+
.join(', ');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The ancestors that make a theme's page dark, inside its `@scope`: a forced
|
|
124
|
+
* dark root, or a system root under no forced mode while the page root names
|
|
125
|
+
* dark. With `preference`, the conditions where the reader's preference
|
|
126
|
+
* decides instead, which a `prefers-color-scheme: dark` block wraps.
|
|
127
|
+
*/
|
|
128
|
+
function darkPageConditions(preference: boolean): string[] {
|
|
129
|
+
const system = `:scope:not([${THEME_MODE_ATTR}="light"], [${THEME_MODE_ATTR}="dark"])`;
|
|
130
|
+
const forcedAround = `:is([${THEME_MODE_ATTR}="light"], [${THEME_MODE_ATTR}="dark"])`;
|
|
131
|
+
const unforced = `${system}:not(${forcedAround} *)`;
|
|
132
|
+
return preference
|
|
133
|
+
? [
|
|
134
|
+
`${unforced}:where(${ROOT_SCHEME_UNNAMED} *)`,
|
|
135
|
+
`${forcedAround} ${system}`,
|
|
136
|
+
]
|
|
137
|
+
: [
|
|
138
|
+
`:scope[${THEME_MODE_ATTR}="dark"]`,
|
|
139
|
+
`${unforced}:where(${rootSchemeIs('dark')} *)`,
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** The side a surface key draws. */
|
|
144
|
+
function sideOf(surface: MediaSurface): MediaSide {
|
|
145
|
+
return surface.split('@')[0] as MediaSide;
|
|
74
146
|
}
|
|
75
147
|
|
|
76
148
|
/** Component base-class selector, e.g. '.astryx-button'. */
|
|
@@ -78,7 +150,18 @@ function componentClassSelector(component: string, suffix: string): string {
|
|
|
78
150
|
return `.${classPrefix}-${component}${suffix}`;
|
|
79
151
|
}
|
|
80
152
|
|
|
81
|
-
type
|
|
153
|
+
type MediaSide = 'dark' | 'light';
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* An on-media surface: a side, or a side a surface takes on a dark page
|
|
157
|
+
* (written beside the light-page side when the two differ).
|
|
158
|
+
*/
|
|
159
|
+
type MediaSurface =
|
|
160
|
+
| MediaSide
|
|
161
|
+
| `${MediaSide}@dark-page`
|
|
162
|
+
| `${MediaSide}@dark-page-preference`
|
|
163
|
+
| `${MediaSide}@unflipped`
|
|
164
|
+
| `${MediaSide}@unflipped-preference`;
|
|
82
165
|
|
|
83
166
|
/** Scope a component selector to an inverted media surface when requested. */
|
|
84
167
|
function componentSelector(
|
|
@@ -264,6 +347,67 @@ const CONTAINER_PADDING_PROPS = new Set([
|
|
|
264
347
|
...Object.keys(PHYSICAL_BLOCK_PADDING_PROPS),
|
|
265
348
|
]);
|
|
266
349
|
|
|
350
|
+
/**
|
|
351
|
+
* The corner longhands of `border-radius`, each with the corner name its
|
|
352
|
+
* derived variable takes. Physical and logical corners stay apart: which
|
|
353
|
+
* physical corner a logical one is depends on the direction, which only the
|
|
354
|
+
* component reading them knows (as with paddingLeft above).
|
|
355
|
+
*/
|
|
356
|
+
const RADIUS_CORNER_PROPS: Record<string, string> = {
|
|
357
|
+
borderTopLeftRadius: 'top-left',
|
|
358
|
+
borderTopRightRadius: 'top-right',
|
|
359
|
+
borderBottomRightRadius: 'bottom-right',
|
|
360
|
+
borderBottomLeftRadius: 'bottom-left',
|
|
361
|
+
borderStartStartRadius: 'start-start',
|
|
362
|
+
borderStartEndRadius: 'start-end',
|
|
363
|
+
borderEndStartRadius: 'end-start',
|
|
364
|
+
borderEndEndRadius: 'end-end',
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* The four corners of a `border-radius` value, as its longhands take them
|
|
369
|
+
* (top-left first, clockwise; an elliptical corner keeps both radii,
|
|
370
|
+
* `8px 4px`), or null when it is not one radius of one to four corners on
|
|
371
|
+
* each side of an optional `/`.
|
|
372
|
+
*
|
|
373
|
+
* @example radiusCorners('0 0 6px 6px') -> ['0', '0', '6px', '6px']
|
|
374
|
+
* @example radiusCorners('8px 4px / 2px') -> ['8px 2px', '4px 2px', '8px 2px', '4px 2px']
|
|
375
|
+
*/
|
|
376
|
+
export function radiusCorners(value: string): string[] | null {
|
|
377
|
+
// The `/` between the horizontal and the vertical radii, outside
|
|
378
|
+
// parentheses (`calc(1rem / 2)` is one length).
|
|
379
|
+
let depth = 0;
|
|
380
|
+
let slash = -1;
|
|
381
|
+
for (let i = 0; i < value.length; i++) {
|
|
382
|
+
const char = value[i];
|
|
383
|
+
if (char === '(') {
|
|
384
|
+
depth++;
|
|
385
|
+
} else if (char === ')') {
|
|
386
|
+
depth--;
|
|
387
|
+
} else if (char === '/' && depth === 0) {
|
|
388
|
+
if (slash !== -1) {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
slash = i;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const sides = (
|
|
395
|
+
slash === -1 ? [value] : [value.slice(0, slash), value.slice(slash + 1)]
|
|
396
|
+
).map(side => {
|
|
397
|
+
const parts = splitTopLevelWhitespace(side.trim());
|
|
398
|
+
if (parts.length < 1 || parts.length > 4) {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
const [a, b = a, c = a, d = b] = parts;
|
|
402
|
+
return [a, b, c, d];
|
|
403
|
+
});
|
|
404
|
+
if (sides.some(side => side == null)) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
const [h, v] = sides as string[][];
|
|
408
|
+
return h.map((x, i) => (v && v[i] !== x ? `${x} ${v[i]}` : x));
|
|
409
|
+
}
|
|
410
|
+
|
|
267
411
|
interface ParsedPadding {
|
|
268
412
|
blockStart?: string;
|
|
269
413
|
blockEnd?: string;
|
|
@@ -516,251 +660,12 @@ function joinDeclarations(
|
|
|
516
660
|
return lines.join('\n');
|
|
517
661
|
}
|
|
518
662
|
|
|
519
|
-
/**
|
|
520
|
-
* Public tokens whose canonical default references another public token: the
|
|
521
|
-
* status roles and `--duration-exit`. StyleX owns the document defaults. A
|
|
522
|
-
* theme that authors a source repeats its omitted token at the theme root so
|
|
523
|
-
* nested Theme regions bind the alias locally without changing authored-token
|
|
524
|
-
* metadata.
|
|
525
|
-
*
|
|
526
|
-
* Conditional scopes repeat an omitted alias only when the source changes on
|
|
527
|
-
* that scope. Explicit adaptation role writes are replayed after generated
|
|
528
|
-
* aliases (and on media descendants) so authored role precedence survives
|
|
529
|
-
* overlapping conditions without disabling the alias in non-matching states.
|
|
530
|
-
*/
|
|
531
|
-
const SCOPED_REFERENCE_DEFAULTS: ReadonlyArray<
|
|
532
|
-
readonly [role: string, source: string]
|
|
533
|
-
> = [
|
|
534
|
-
['--color-text-info', '--color-text-blue'],
|
|
535
|
-
['--color-text-success', '--color-text-green'],
|
|
536
|
-
['--color-text-warning', '--color-text-yellow'],
|
|
537
|
-
['--color-text-error', '--color-text-red'],
|
|
538
|
-
['--color-on-info-muted', '--color-text-blue'],
|
|
539
|
-
['--color-on-success-muted', '--color-text-green'],
|
|
540
|
-
['--color-on-warning-muted', '--color-text-yellow'],
|
|
541
|
-
['--color-on-error-muted', '--color-text-red'],
|
|
542
|
-
// Icon and border roles follow the text role, set or derived (INV17).
|
|
543
|
-
['--color-icon-info', '--color-text-info'],
|
|
544
|
-
['--color-icon-success', '--color-text-success'],
|
|
545
|
-
['--color-icon-warning', '--color-text-warning'],
|
|
546
|
-
['--color-icon-error', '--color-text-error'],
|
|
547
|
-
['--color-border-info', '--color-text-info'],
|
|
548
|
-
['--color-border-success', '--color-text-success'],
|
|
549
|
-
['--color-border-warning', '--color-text-warning'],
|
|
550
|
-
['--color-border-error', '--color-text-error'],
|
|
551
|
-
['--duration-exit', '--duration-fast'],
|
|
552
|
-
];
|
|
553
|
-
|
|
554
663
|
const SCOPED_REFERENCE_SOURCES = new Map(SCOPED_REFERENCE_DEFAULTS);
|
|
555
664
|
|
|
556
665
|
/** Colours INV17's derivation measures; a scope that sets one re-derives. */
|
|
557
666
|
const STATUS_MEASURED =
|
|
558
667
|
/^--color-(?:info|success|warning|error|on-|background-surface|background-card)/;
|
|
559
668
|
|
|
560
|
-
const STATUS_ROLE_ORDER = new Map(
|
|
561
|
-
SCOPED_REFERENCE_DEFAULTS.map(([role], index) => [role, index]),
|
|
562
|
-
);
|
|
563
|
-
|
|
564
|
-
type TokenValues = Record<string, unknown>;
|
|
565
|
-
|
|
566
|
-
function stringifyTokenValue(value: unknown): string {
|
|
567
|
-
if (typeof value === 'string') {
|
|
568
|
-
return value;
|
|
569
|
-
}
|
|
570
|
-
// Preserve the exact JavaScript interpolation behavior legacy themes received
|
|
571
|
-
// before declaration analysis accepted non-string token values.
|
|
572
|
-
return String(value);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
interface TokenCascadeState {
|
|
576
|
-
values: TokenValues;
|
|
577
|
-
important: Set<string>;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
function assignTokenCascade(
|
|
581
|
-
state: TokenCascadeState,
|
|
582
|
-
...tokenSets: ReadonlyArray<TokenValues | undefined>
|
|
583
|
-
): void {
|
|
584
|
-
for (const tokens of tokenSets) {
|
|
585
|
-
for (const [rawToken, rawValue] of Object.entries(tokens ?? {})) {
|
|
586
|
-
if (rawValue === undefined) {
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
const token = canonicalizeDeclarationName(rawToken);
|
|
590
|
-
const value = stringifyTokenValue(rawValue);
|
|
591
|
-
const analysis = analyzeDeclarationValue(value);
|
|
592
|
-
// Match joinDeclarations: declarations that cannot be emitted never
|
|
593
|
-
// participate in the browser cascade this safety model validates.
|
|
594
|
-
if (token === null || analysis.reason !== null) {
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
if (state.important.has(token) && !analysis.important) {
|
|
598
|
-
continue;
|
|
599
|
-
}
|
|
600
|
-
state.values[token] = value;
|
|
601
|
-
if (analysis.important) {
|
|
602
|
-
state.important.add(token);
|
|
603
|
-
} else {
|
|
604
|
-
state.important.delete(token);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
function createTokenCascade(
|
|
611
|
-
...tokenSets: ReadonlyArray<TokenValues | undefined>
|
|
612
|
-
): TokenCascadeState {
|
|
613
|
-
const state: TokenCascadeState = {values: {}, important: new Set()};
|
|
614
|
-
assignTokenCascade(state, ...tokenSets);
|
|
615
|
-
return state;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/** Check whether one candidate value closes a cycle through its own role. */
|
|
619
|
-
function tokenValuesWouldHaveCycleWithValue(
|
|
620
|
-
tokens: TokenValues,
|
|
621
|
-
relevantToken: string,
|
|
622
|
-
candidateValue: string,
|
|
623
|
-
): boolean {
|
|
624
|
-
const stack = [...analyzeDeclarationValue(candidateValue).references];
|
|
625
|
-
const visited = new Set<string>();
|
|
626
|
-
while (stack.length > 0) {
|
|
627
|
-
const token = stack.pop();
|
|
628
|
-
if (token === undefined) {
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
631
|
-
if (token === relevantToken) {
|
|
632
|
-
return true;
|
|
633
|
-
}
|
|
634
|
-
if (
|
|
635
|
-
visited.has(token) ||
|
|
636
|
-
!Object.prototype.hasOwnProperty.call(tokens, token)
|
|
637
|
-
) {
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
visited.add(token);
|
|
641
|
-
for (const reference of analyzeDeclarationValue(
|
|
642
|
-
stringifyTokenValue(tokens[token]),
|
|
643
|
-
).references) {
|
|
644
|
-
if (
|
|
645
|
-
reference === relevantToken ||
|
|
646
|
-
Object.prototype.hasOwnProperty.call(tokens, reference)
|
|
647
|
-
) {
|
|
648
|
-
stack.push(reference);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
return false;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
const WIDTH_CELL_RANK = {
|
|
656
|
-
sm: 1,
|
|
657
|
-
md: 2,
|
|
658
|
-
lg: 3,
|
|
659
|
-
xl: 4,
|
|
660
|
-
'2xl': 5,
|
|
661
|
-
} as const;
|
|
662
|
-
|
|
663
|
-
function adaptationConditionMatchesCell(
|
|
664
|
-
condition: ResolvedThemeAdaptationRule['when'],
|
|
665
|
-
widthRank: number,
|
|
666
|
-
pointer: 'coarse' | 'fine' | 'none',
|
|
667
|
-
contrast: 'more' | 'less' | 'no-preference' | 'custom',
|
|
668
|
-
motion: 'reduce' | 'no-preference',
|
|
669
|
-
): boolean {
|
|
670
|
-
const from = condition.width?.from;
|
|
671
|
-
if (from !== undefined && widthRank < WIDTH_CELL_RANK[from]) {
|
|
672
|
-
return false;
|
|
673
|
-
}
|
|
674
|
-
const below = condition.width?.below;
|
|
675
|
-
if (below !== undefined && widthRank >= WIDTH_CELL_RANK[below]) {
|
|
676
|
-
return false;
|
|
677
|
-
}
|
|
678
|
-
return (
|
|
679
|
-
(condition.pointer === undefined || condition.pointer === pointer) &&
|
|
680
|
-
(condition.contrast === undefined || condition.contrast === contrast) &&
|
|
681
|
-
(condition.motion === undefined || condition.motion === motion)
|
|
682
|
-
);
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
const REACHABLE_MATCH_SET_CACHE = new WeakMap<
|
|
686
|
-
ReadonlyArray<ResolvedThemeAdaptationRule>,
|
|
687
|
-
number[][]
|
|
688
|
-
>();
|
|
689
|
-
|
|
690
|
-
/** Every reachable ordered adaptation-rule match set, including the root. */
|
|
691
|
-
function reachableAdaptationMatchSets(
|
|
692
|
-
rules: ReadonlyArray<ResolvedThemeAdaptationRule>,
|
|
693
|
-
): number[][] {
|
|
694
|
-
const cached = REACHABLE_MATCH_SET_CACHE.get(rules);
|
|
695
|
-
if (cached !== undefined) {
|
|
696
|
-
return cached;
|
|
697
|
-
}
|
|
698
|
-
const matchSets = new Map<string, number[]>();
|
|
699
|
-
for (let widthRank = 0; widthRank <= 5; widthRank++) {
|
|
700
|
-
for (const pointer of ['coarse', 'fine', 'none'] as const) {
|
|
701
|
-
for (const contrast of [
|
|
702
|
-
'more',
|
|
703
|
-
'less',
|
|
704
|
-
'no-preference',
|
|
705
|
-
'custom',
|
|
706
|
-
] as const) {
|
|
707
|
-
for (const motion of ['reduce', 'no-preference'] as const) {
|
|
708
|
-
const indexes = rules.flatMap((rule, index) =>
|
|
709
|
-
adaptationConditionMatchesCell(
|
|
710
|
-
rule.when,
|
|
711
|
-
widthRank,
|
|
712
|
-
pointer,
|
|
713
|
-
contrast,
|
|
714
|
-
motion,
|
|
715
|
-
)
|
|
716
|
-
? [index]
|
|
717
|
-
: [],
|
|
718
|
-
);
|
|
719
|
-
matchSets.set(indexes.join(','), indexes);
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
const reachable = [...matchSets.values()];
|
|
725
|
-
REACHABLE_MATCH_SET_CACHE.set(rules, reachable);
|
|
726
|
-
return reachable;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
function effectiveAdaptationTokenValues(
|
|
730
|
-
rootTokens: Record<string, string>,
|
|
731
|
-
rootLocalTokens: Record<string, string> | undefined,
|
|
732
|
-
rootAliases: ReadonlyArray<readonly [string, string]>,
|
|
733
|
-
rules: ReadonlyArray<ResolvedThemeAdaptationRule>,
|
|
734
|
-
matchingRuleIndexes: ReadonlyArray<number>,
|
|
735
|
-
conditionalAliases: ReadonlyArray<
|
|
736
|
-
ReadonlyArray<readonly [string, string]>
|
|
737
|
-
> = [],
|
|
738
|
-
): TokenValues {
|
|
739
|
-
const effective = createTokenCascade(
|
|
740
|
-
rootTokens,
|
|
741
|
-
Object.fromEntries(rootAliases),
|
|
742
|
-
rootLocalTokens,
|
|
743
|
-
);
|
|
744
|
-
for (const index of matchingRuleIndexes) {
|
|
745
|
-
const rule = rules[index];
|
|
746
|
-
assignTokenCascade(
|
|
747
|
-
effective,
|
|
748
|
-
rule.tokens,
|
|
749
|
-
Object.fromEntries(conditionalAliases[index] ?? []),
|
|
750
|
-
rule.localTokens,
|
|
751
|
-
);
|
|
752
|
-
}
|
|
753
|
-
// Emission replays authored roles after every ordinary adaptation block so
|
|
754
|
-
// an explicit role beats aliases from any later overlapping rule.
|
|
755
|
-
for (const index of matchingRuleIndexes) {
|
|
756
|
-
assignTokenCascade(
|
|
757
|
-
effective,
|
|
758
|
-
Object.fromEntries(authoredStatusRoleEntries(rules[index].tokens)),
|
|
759
|
-
);
|
|
760
|
-
}
|
|
761
|
-
return effective.values;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
669
|
function retainedAdaptationRules(
|
|
765
670
|
theme: ThemeRuleSource,
|
|
766
671
|
): ResolvedThemeAdaptationRule[] {
|
|
@@ -770,76 +675,6 @@ function retainedAdaptationRules(
|
|
|
770
675
|
return resolvedAdaptationRules(theme as DefinedTheme);
|
|
771
676
|
}
|
|
772
677
|
|
|
773
|
-
/** Root status roles a theme leaves unset: INV17-derived values and INV16 aliases. */
|
|
774
|
-
export function generatedScopedStatusRoleDefaults(
|
|
775
|
-
tokens: Record<string, string>,
|
|
776
|
-
localTokens: Record<string, string> = {},
|
|
777
|
-
rules: ReadonlyArray<ResolvedThemeAdaptationRule> = [],
|
|
778
|
-
): [string, string][] {
|
|
779
|
-
// INV17: roles a theme leaves unset while setting their status source are
|
|
780
|
-
// computed against the theme's own surfaces first; the aliases below then
|
|
781
|
-
// treat them as present, so icon and border roles follow a derived text role.
|
|
782
|
-
const entries: [string, string][] = deriveStatusRoleTokens(
|
|
783
|
-
tokens,
|
|
784
|
-
localTokens,
|
|
785
|
-
);
|
|
786
|
-
const authoredRoot = createTokenCascade(
|
|
787
|
-
tokens,
|
|
788
|
-
Object.fromEntries(entries),
|
|
789
|
-
localTokens,
|
|
790
|
-
).values;
|
|
791
|
-
const states = reachableAdaptationMatchSets(rules).map(indexes => ({
|
|
792
|
-
indexes,
|
|
793
|
-
values: effectiveAdaptationTokenValues(
|
|
794
|
-
tokens,
|
|
795
|
-
localTokens,
|
|
796
|
-
entries,
|
|
797
|
-
rules,
|
|
798
|
-
indexes,
|
|
799
|
-
),
|
|
800
|
-
}));
|
|
801
|
-
|
|
802
|
-
for (const [role, source] of SCOPED_REFERENCE_DEFAULTS) {
|
|
803
|
-
const alias = `var(${source})`;
|
|
804
|
-
if (
|
|
805
|
-
authoredRoot[role] !== undefined ||
|
|
806
|
-
(authoredRoot[source] === undefined &&
|
|
807
|
-
!entries.some(([emitted]) => emitted === source))
|
|
808
|
-
) {
|
|
809
|
-
continue;
|
|
810
|
-
}
|
|
811
|
-
const isSafe = states.every(
|
|
812
|
-
({values}) =>
|
|
813
|
-
values[role] !== undefined ||
|
|
814
|
-
!tokenValuesWouldHaveCycleWithValue(values, role, alias),
|
|
815
|
-
);
|
|
816
|
-
if (isSafe) {
|
|
817
|
-
entries.push([role, alias]);
|
|
818
|
-
for (const {values} of states) {
|
|
819
|
-
if (values[role] === undefined) {
|
|
820
|
-
values[role] = alias;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
// One canonical order whether a role is derived or aliased, so themes that
|
|
826
|
-
// differ only in which roles needed computing still emit comparable rules.
|
|
827
|
-
return entries.sort(
|
|
828
|
-
([a], [b]) =>
|
|
829
|
-
(STATUS_ROLE_ORDER.get(a) ?? 0) - (STATUS_ROLE_ORDER.get(b) ?? 0),
|
|
830
|
-
);
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
function authoredStatusRoleEntries(
|
|
834
|
-
tokens: Record<string, string>,
|
|
835
|
-
): [string, string][] {
|
|
836
|
-
const canonicalTokens = createTokenCascade(tokens).values;
|
|
837
|
-
return SCOPED_REFERENCE_DEFAULTS.flatMap(([role]) => {
|
|
838
|
-
const value = canonicalTokens[role];
|
|
839
|
-
return value === undefined ? [] : [[role, stringifyTokenValue(value)]];
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
|
|
843
678
|
function tokenValueIsAliasOf(value: unknown, source: string): boolean {
|
|
844
679
|
return (
|
|
845
680
|
analyzeDeclarationValue(stringifyTokenValue(value)).singleVarReference ===
|
|
@@ -1232,7 +1067,12 @@ export function generateThemeRules(
|
|
|
1232
1067
|
// layer does: an undefined value is not set.
|
|
1233
1068
|
const components = withoutUnsetComponents(theme.components);
|
|
1234
1069
|
if (components) {
|
|
1235
|
-
generateComponentRules(components, parts, {
|
|
1070
|
+
generateComponentRules(components, parts, {
|
|
1071
|
+
sink,
|
|
1072
|
+
darkPageSides: darkPageSides(
|
|
1073
|
+
resolveModes({...theme.localTokens, ...theme.tokens}),
|
|
1074
|
+
),
|
|
1075
|
+
});
|
|
1236
1076
|
}
|
|
1237
1077
|
|
|
1238
1078
|
// 3. Prose HTML element rules (h1-h6, p, small, code, hr)
|
|
@@ -1358,6 +1198,11 @@ interface ComponentRuleOptions {
|
|
|
1358
1198
|
sink?: DiagnosticSink;
|
|
1359
1199
|
/** Location prefix for diagnostics, e.g. `onDark.` or `adaptations[0].`. */
|
|
1360
1200
|
location?: string;
|
|
1201
|
+
/**
|
|
1202
|
+
* The sides a media surface takes on a dark page beyond its light-page
|
|
1203
|
+
* side, whose color-mode blocks follow that side there.
|
|
1204
|
+
*/
|
|
1205
|
+
darkPageSides?: ReadonlySet<MediaSide>;
|
|
1361
1206
|
}
|
|
1362
1207
|
|
|
1363
1208
|
/**
|
|
@@ -1373,6 +1218,7 @@ function generateComponentRules(
|
|
|
1373
1218
|
surface,
|
|
1374
1219
|
sink = warnToConsole,
|
|
1375
1220
|
location: locationPrefix = '',
|
|
1221
|
+
darkPageSides = new Set<MediaSide>(),
|
|
1376
1222
|
}: ComponentRuleOptions = {},
|
|
1377
1223
|
): void {
|
|
1378
1224
|
for (const [component, rules] of Object.entries(components)) {
|
|
@@ -1427,11 +1273,46 @@ function generateComponentRules(
|
|
|
1427
1273
|
parts.push(wrap(` ${selector} {\n${declarations}\n }`));
|
|
1428
1274
|
}
|
|
1429
1275
|
for (const [pseudo, pseudoStyles] of nested) {
|
|
1430
|
-
|
|
1276
|
+
// A pseudo-class block expands like its resting rule. A hovered
|
|
1277
|
+
// row's fill then reaches pinned cells through --table-row-overlay.
|
|
1278
|
+
// A pseudo-element block (`::before`) is another box. A derived
|
|
1279
|
+
// variable set there never reaches the element that reads it, so
|
|
1280
|
+
// the compiler writes the block as authored. This includes the CSS2
|
|
1281
|
+
// one-colon forms (`:before`, `:after`, `:first-line`,
|
|
1282
|
+
// `:first-letter`).
|
|
1283
|
+
const pseudoClass =
|
|
1284
|
+
pseudo.startsWith(':') &&
|
|
1285
|
+
!pseudo.includes('::') &&
|
|
1286
|
+
!/:(before|after|first-line|first-letter)(?![-\w])/i.test(pseudo);
|
|
1287
|
+
// The boundary check reads the authored declarations first, as it
|
|
1288
|
+
// does for the resting rule. So the author sees one warning for a
|
|
1289
|
+
// rejected declaration, under the name the theme wrote.
|
|
1290
|
+
const pseudoLocation = `${location}[${JSON.stringify(pseudo)}]`;
|
|
1291
|
+
const accepted: [string, string][] = [];
|
|
1292
|
+
if (pseudoClass) {
|
|
1293
|
+
for (const [prop, value] of Object.entries(pseudoStyles)) {
|
|
1294
|
+
if (value === undefined) {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
const text = stringifyTokenValue(value);
|
|
1298
|
+
if (
|
|
1299
|
+
acceptDeclaration(toKebabCase(prop), text, pseudoLocation, sink)
|
|
1300
|
+
) {
|
|
1301
|
+
accepted.push([prop, text]);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
const pseudoEntries = pseudoClass
|
|
1306
|
+
? expandComponentDeclarations(
|
|
1307
|
+
component,
|
|
1308
|
+
accepted,
|
|
1309
|
+
resetInheritedPaddingSpecificity,
|
|
1310
|
+
)
|
|
1311
|
+
: Object.entries(pseudoStyles);
|
|
1431
1312
|
if (pseudo.startsWith(':') && pseudoEntries.length > 0) {
|
|
1432
1313
|
const declarations = joinDeclarations(
|
|
1433
1314
|
pseudoEntries,
|
|
1434
|
-
|
|
1315
|
+
pseudoLocation,
|
|
1435
1316
|
sink,
|
|
1436
1317
|
toKebabCase,
|
|
1437
1318
|
);
|
|
@@ -1462,7 +1343,7 @@ function generateComponentRules(
|
|
|
1462
1343
|
);
|
|
1463
1344
|
if (surface) {
|
|
1464
1345
|
// A media surface fixes the mode: only its own block applies.
|
|
1465
|
-
if (surface === name) {
|
|
1346
|
+
if (sideOf(surface) === name) {
|
|
1466
1347
|
modeEmit(selector, wrap);
|
|
1467
1348
|
}
|
|
1468
1349
|
continue;
|
|
@@ -1477,17 +1358,61 @@ function generateComponentRules(
|
|
|
1477
1358
|
`${inside(`:scope[${THEME_MODE_ATTR}="${name}"]`)}${outsideSurfaces}`,
|
|
1478
1359
|
wrap,
|
|
1479
1360
|
);
|
|
1361
|
+
// A system root under no forced mode draws in the page's scheme.
|
|
1362
|
+
// The root Theme names it on <html> when the page draws in one;
|
|
1363
|
+
// while none is named, the reader's preference decides. Under a
|
|
1364
|
+
// forced mode a system root follows the reader's preference.
|
|
1365
|
+
const system = `:scope:not([${THEME_MODE_ATTR}="light"], [${THEME_MODE_ATTR}="dark"])`;
|
|
1366
|
+
const forcedAround = `:is([${THEME_MODE_ATTR}="light"], [${THEME_MODE_ATTR}="dark"])`;
|
|
1367
|
+
const preference = (rule: string) =>
|
|
1368
|
+
wrap(` @media (prefers-color-scheme: ${name}) {\n${rule}\n }`);
|
|
1369
|
+
const unforcedSystem = `${inside(`${system}:not(${forcedAround} *)`)}${outsideSurfaces}`;
|
|
1370
|
+
modeEmit(`${unforcedSystem}:where(${rootSchemeIs(name)} *)`, wrap);
|
|
1480
1371
|
modeEmit(
|
|
1481
|
-
`${
|
|
1482
|
-
|
|
1483
|
-
)}${outsideSurfaces}`,
|
|
1484
|
-
rule =>
|
|
1485
|
-
wrap(` @media (prefers-color-scheme: ${name}) {\n${rule}\n }`),
|
|
1372
|
+
`${unforcedSystem}:where(${ROOT_SCHEME_UNNAMED} *)`,
|
|
1373
|
+
preference,
|
|
1486
1374
|
);
|
|
1487
1375
|
modeEmit(
|
|
1488
|
-
|
|
1489
|
-
|
|
1376
|
+
`${inside(`${forcedAround} ${system}`)}${outsideSurfaces}`,
|
|
1377
|
+
preference,
|
|
1490
1378
|
);
|
|
1379
|
+
const nearest = `:is(${selector}):where(${nearestSurfaceIs(name).join(', ')})`;
|
|
1380
|
+
// A surface that takes another side on a dark page draws
|
|
1381
|
+
// that side's block inside it there, and not this one, before any
|
|
1382
|
+
// script names its side in `data-astryx-media`. A surface nested
|
|
1383
|
+
// in it keeps its own side, as on the nearest-surface chain.
|
|
1384
|
+
const onDarkPage = (side: MediaSide, preference: boolean) =>
|
|
1385
|
+
darkPageConditions(preference).flatMap(condition =>
|
|
1386
|
+
darkPageNearestIs(`${condition} ${mediaDarkPageIs(side)}`, side),
|
|
1387
|
+
);
|
|
1388
|
+
const byPreference = (rule: string) =>
|
|
1389
|
+
wrap(` @media (prefers-color-scheme: dark) {\n${rule}\n }`);
|
|
1390
|
+
const others = [...darkPageSides].filter(side => side !== name);
|
|
1391
|
+
if (others.length === 0) {
|
|
1392
|
+
modeEmit(nearest, wrap);
|
|
1393
|
+
} else {
|
|
1394
|
+
const plain = others.flatMap(side => onDarkPage(side, false));
|
|
1395
|
+
const preferred = others.flatMap(side => onDarkPage(side, true));
|
|
1396
|
+
modeEmit(`${nearest}:where(:not(${plain.join(', ')}))`, rule =>
|
|
1397
|
+
wrap(
|
|
1398
|
+
` @media not all and (prefers-color-scheme: dark) {\n${rule}\n }`,
|
|
1399
|
+
),
|
|
1400
|
+
);
|
|
1401
|
+
modeEmit(
|
|
1402
|
+
`${nearest}:where(:not(${[...plain, ...preferred].join(', ')}))`,
|
|
1403
|
+
byPreference,
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
if (darkPageSides.has(name)) {
|
|
1407
|
+
modeEmit(
|
|
1408
|
+
`:is(${selector}):where(${onDarkPage(name, false).join(', ')})`,
|
|
1409
|
+
wrap,
|
|
1410
|
+
);
|
|
1411
|
+
modeEmit(
|
|
1412
|
+
`:is(${selector}):where(${onDarkPage(name, true).join(', ')})`,
|
|
1413
|
+
byPreference,
|
|
1414
|
+
);
|
|
1415
|
+
}
|
|
1491
1416
|
}
|
|
1492
1417
|
};
|
|
1493
1418
|
emit(
|
|
@@ -1530,9 +1455,30 @@ const NEAREST_SURFACE_DEPTH = 5;
|
|
|
1530
1455
|
* conditions 1 to NEAREST_SURFACE_DEPTH - 1, that reads R up to
|
|
1531
1456
|
* NEAREST_SURFACE_DEPTH.
|
|
1532
1457
|
*/
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1458
|
+
/**
|
|
1459
|
+
* Selectors for elements whose nearest surface draws `side`, where `outer`
|
|
1460
|
+
* is a surface that draws `side` (a flipped surface on a dark page): inside
|
|
1461
|
+
* it and no nearer surface of the other side, or inside a nested surface of
|
|
1462
|
+
* `side` that follows one of the other side, down to the same depth as
|
|
1463
|
+
* nearestSurfaceIs.
|
|
1464
|
+
*/
|
|
1465
|
+
function darkPageNearestIs(outer: string, side: MediaSide): string[] {
|
|
1466
|
+
const other: MediaSide = side === 'dark' ? 'light' : 'dark';
|
|
1467
|
+
const pair = `${mediaSelector(other)} ${mediaSelector(side)}`;
|
|
1468
|
+
return Array.from(
|
|
1469
|
+
{length: Math.floor((NEAREST_SURFACE_DEPTH - 1) / 2)},
|
|
1470
|
+
(_, depth) => {
|
|
1471
|
+
const chain = [outer, ...Array.from({length: depth}, () => pair)].join(
|
|
1472
|
+
' ',
|
|
1473
|
+
);
|
|
1474
|
+
return `${chain} *:not(${chain} ${mediaSelector(other)} *)`;
|
|
1475
|
+
},
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
function nearestSurfaceIs(mode: MediaSide): string[] {
|
|
1480
|
+
const other: MediaSide = mode === 'dark' ? 'light' : 'dark';
|
|
1481
|
+
const chain = (length: number, last: MediaSide) =>
|
|
1536
1482
|
Array.from({length}, (_, i) =>
|
|
1537
1483
|
mediaSelector(
|
|
1538
1484
|
(length - 1 - i) % 2 === 0 ? last : last === mode ? other : mode,
|
|
@@ -1566,7 +1512,43 @@ function expandComponentDeclarations(
|
|
|
1566
1512
|
let containerExpanded = false;
|
|
1567
1513
|
const replacedProps = new Set<string>();
|
|
1568
1514
|
|
|
1515
|
+
// A radius of each corner, written to the corner variables of a
|
|
1516
|
+
// `corners` entry. A later radius in the block replaces what an earlier one
|
|
1517
|
+
// gave a corner, as the cascade does on the element.
|
|
1518
|
+
const cornerProps = new Map<string, string>();
|
|
1519
|
+
const cornerVarRoots = getDerivedVars(component, 'borderRadius')
|
|
1520
|
+
.filter(entry => entry.corners)
|
|
1521
|
+
.flatMap(entry => entry.vars ?? []);
|
|
1522
|
+
|
|
1569
1523
|
for (const [prop, value] of props) {
|
|
1524
|
+
if (cornerVarRoots.length > 0) {
|
|
1525
|
+
if (prop === 'borderRadius') {
|
|
1526
|
+
// The shorthand sets every corner: each physical one, and no
|
|
1527
|
+
// logical one (a component reads a logical corner first), here or
|
|
1528
|
+
// from a rule it overrides. `initial` leaves a variable without a
|
|
1529
|
+
// value, so the reader falls back to the physical corner.
|
|
1530
|
+
const corners = radiusCorners(value);
|
|
1531
|
+
for (const varName of cornerVarRoots) {
|
|
1532
|
+
for (const name of Object.values(RADIUS_CORNER_PROPS)) {
|
|
1533
|
+
cornerProps.delete(`${varName}-${name}`);
|
|
1534
|
+
}
|
|
1535
|
+
if (corners) {
|
|
1536
|
+
PHYSICAL_RADIUS_CORNERS.forEach((name, i) => {
|
|
1537
|
+
cornerProps.set(`${varName}-${name}`, corners[i]);
|
|
1538
|
+
});
|
|
1539
|
+
for (const name of LOGICAL_RADIUS_CORNERS) {
|
|
1540
|
+
cornerProps.set(`${varName}-${name}`, 'initial');
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
} else if (prop in RADIUS_CORNER_PROPS) {
|
|
1545
|
+
for (const varName of cornerVarRoots) {
|
|
1546
|
+
const name = `${varName}-${RADIUS_CORNER_PROPS[prop]}`;
|
|
1547
|
+
cornerProps.delete(name);
|
|
1548
|
+
cornerProps.set(name, value);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1570
1552
|
const derived = getDerivedVars(component, prop);
|
|
1571
1553
|
// Padding longhands (paddingBlock, paddingInline, etc.) also
|
|
1572
1554
|
// match the 'padding' derived entry for container expansion.
|
|
@@ -1620,6 +1602,7 @@ function expandComponentDeclarations(
|
|
|
1620
1602
|
finalProps = finalProps.filter(([p]) => !replacedProps.has(p));
|
|
1621
1603
|
}
|
|
1622
1604
|
|
|
1605
|
+
derivedProps.push(...cornerProps);
|
|
1623
1606
|
if (derivedProps.length > 0) {
|
|
1624
1607
|
finalProps = [...finalProps, ...derivedProps];
|
|
1625
1608
|
}
|
|
@@ -1872,12 +1855,18 @@ export function generateOnMediaCSS(
|
|
|
1872
1855
|
[string, string][]
|
|
1873
1856
|
>();
|
|
1874
1857
|
|
|
1875
|
-
|
|
1876
|
-
|
|
1858
|
+
// One surface's token and component rules, into `out`.
|
|
1859
|
+
// A dark-page copy repeats rules already checked, so it reports nothing.
|
|
1860
|
+
const quiet: DiagnosticSink = () => {};
|
|
1861
|
+
const emitSurface = (surface: MediaSurface, out: string[]): void => {
|
|
1862
|
+
const surfaceSink =
|
|
1863
|
+
surface.includes('@') && !surface.endsWith('@unflipped') ? quiet : sink;
|
|
1864
|
+
const side = sideOf(surface);
|
|
1865
|
+
const onMedia = side === 'dark' ? theme.__onDark : theme.__onLight;
|
|
1877
1866
|
if (!onMedia) {
|
|
1878
|
-
|
|
1867
|
+
return;
|
|
1879
1868
|
}
|
|
1880
|
-
const location =
|
|
1869
|
+
const location = side === 'dark' ? 'onDark.' : 'onLight.';
|
|
1881
1870
|
|
|
1882
1871
|
// Token overrides. MediaTheme writes on a descendant surface, so a source
|
|
1883
1872
|
// alias must be local unless an authored root/adaptation role owns it.
|
|
@@ -1888,7 +1877,7 @@ export function generateOnMediaCSS(
|
|
|
1888
1877
|
rules,
|
|
1889
1878
|
rootAliases,
|
|
1890
1879
|
);
|
|
1891
|
-
mediaStatusRoleDefaults.set(
|
|
1880
|
+
mediaStatusRoleDefaults.set(side, statusRoleDefaults);
|
|
1892
1881
|
const tokenEntries = [
|
|
1893
1882
|
...Object.entries(onMedia.tokens),
|
|
1894
1883
|
...statusRoleDefaults,
|
|
@@ -1899,31 +1888,84 @@ export function generateOnMediaCSS(
|
|
|
1899
1888
|
const declarations = joinDeclarations(
|
|
1900
1889
|
readerTextSizeEntries(tokenEntries),
|
|
1901
1890
|
`${location}tokens`,
|
|
1902
|
-
|
|
1891
|
+
surfaceSink,
|
|
1903
1892
|
);
|
|
1904
|
-
|
|
1893
|
+
out.push(` ${mediaSelector(surface)} {\n${declarations}\n }`);
|
|
1905
1894
|
}
|
|
1906
1895
|
|
|
1907
1896
|
// Component overrides use the same lowering as root and adaptations so a
|
|
1908
1897
|
// surface writes the same derived leaf and can win by source order.
|
|
1909
1898
|
if (onMedia.components) {
|
|
1910
|
-
generateComponentRules(onMedia.components,
|
|
1899
|
+
generateComponentRules(onMedia.components, out, {
|
|
1911
1900
|
resetInheritedPaddingSpecificity: true,
|
|
1912
1901
|
surface,
|
|
1913
|
-
sink,
|
|
1902
|
+
sink: surfaceSink,
|
|
1914
1903
|
location,
|
|
1915
1904
|
});
|
|
1916
|
-
generateColorOverrides(onMedia.components,
|
|
1917
|
-
generateSizeOverrides(onMedia.components,
|
|
1905
|
+
generateColorOverrides(onMedia.components, out, surface);
|
|
1906
|
+
generateSizeOverrides(onMedia.components, out, surface);
|
|
1918
1907
|
|
|
1919
1908
|
// Apply the effective explicit Heading weight after media-specific type
|
|
1920
1909
|
// rules. A surface-authored target wins, followed by the inherited main
|
|
1921
1910
|
// target and then the built-in token fallback.
|
|
1922
|
-
generateHeadingWeightOverrides(onMedia.components,
|
|
1911
|
+
generateHeadingWeightOverrides(onMedia.components, out, {
|
|
1923
1912
|
surface,
|
|
1924
1913
|
inheritedComponents: theme.components,
|
|
1925
1914
|
});
|
|
1926
1915
|
}
|
|
1916
|
+
};
|
|
1917
|
+
// A surface that takes another side on a dark page (a toast's card, whose
|
|
1918
|
+
// fill flips with the page) carries that side as a second attribute, so
|
|
1919
|
+
// its first paint is right before any script measures it. Its rules come
|
|
1920
|
+
// after both sides' own and only for a theme whose surfaces flip.
|
|
1921
|
+
const flipped = darkPageSides(
|
|
1922
|
+
resolveModes({...theme.localTokens, ...theme.tokens}),
|
|
1923
|
+
);
|
|
1924
|
+
/** Every token this side writes, the other side's copy writes again. */
|
|
1925
|
+
const coveredBy = (side: MediaSide, other: MediaSide): boolean => {
|
|
1926
|
+
const own = side === 'dark' ? theme.__onDark : theme.__onLight;
|
|
1927
|
+
const its = other === 'dark' ? theme.__onDark : theme.__onLight;
|
|
1928
|
+
if (!own) {
|
|
1929
|
+
return true;
|
|
1930
|
+
}
|
|
1931
|
+
if (!its || own.components) {
|
|
1932
|
+
return false;
|
|
1933
|
+
}
|
|
1934
|
+
return Object.keys(own.tokens).every(token => token in its.tokens);
|
|
1935
|
+
};
|
|
1936
|
+
for (const side of ['dark', 'light'] as const) {
|
|
1937
|
+
const other: MediaSide = side === 'dark' ? 'light' : 'dark';
|
|
1938
|
+
if (!flipped.has(other) || coveredBy(side, other)) {
|
|
1939
|
+
emitSurface(side, parts);
|
|
1940
|
+
continue;
|
|
1941
|
+
}
|
|
1942
|
+
// Where a dark page flips the surface to the other side, this side's
|
|
1943
|
+
// rules leave it out, so what only this side sets (a fill it gives a
|
|
1944
|
+
// button) never reaches it there and the theme root's rules apply.
|
|
1945
|
+
const byScheme: string[] = [];
|
|
1946
|
+
emitSurface(`${side}@unflipped`, byScheme);
|
|
1947
|
+
if (byScheme.length > 0) {
|
|
1948
|
+
parts.push(
|
|
1949
|
+
` @media not all and (prefers-color-scheme: dark) {\n${byScheme.join('\n\n')}\n }`,
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1952
|
+
const byPreference: string[] = [];
|
|
1953
|
+
emitSurface(`${side}@unflipped-preference`, byPreference);
|
|
1954
|
+
if (byPreference.length > 0) {
|
|
1955
|
+
parts.push(
|
|
1956
|
+
` @media (prefers-color-scheme: dark) {\n${byPreference.join('\n\n')}\n }`,
|
|
1957
|
+
);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
for (const side of flipped) {
|
|
1961
|
+
emitSurface(`${side}@dark-page`, parts);
|
|
1962
|
+
const byPreference: string[] = [];
|
|
1963
|
+
emitSurface(`${side}@dark-page-preference`, byPreference);
|
|
1964
|
+
if (byPreference.length > 0) {
|
|
1965
|
+
parts.push(
|
|
1966
|
+
` @media (prefers-color-scheme: dark) {\n${byPreference.join('\n\n')}\n }`,
|
|
1967
|
+
);
|
|
1968
|
+
}
|
|
1927
1969
|
}
|
|
1928
1970
|
|
|
1929
1971
|
const adaptationMediaRoleBlocks: string[] = [];
|
|
@@ -1953,6 +1995,12 @@ export function generateOnMediaCSS(
|
|
|
1953
1995
|
sink,
|
|
1954
1996
|
);
|
|
1955
1997
|
roleParts.push(` ${mediaSelector(surface)} {\n${declarations}\n }`);
|
|
1998
|
+
if (flipped.has(surface)) {
|
|
1999
|
+
roleParts.push(
|
|
2000
|
+
` ${mediaSelector(`${surface}@dark-page`)} {\n${declarations}\n }`,
|
|
2001
|
+
` @media (prefers-color-scheme: dark) {\n ${mediaSelector(`${surface}@dark-page-preference`)} {\n${declarations}\n }\n }`,
|
|
2002
|
+
);
|
|
2003
|
+
}
|
|
1956
2004
|
}
|
|
1957
2005
|
if (roleParts.length > 0) {
|
|
1958
2006
|
adaptationMediaRoleBlocks.push(
|
|
@@ -1982,6 +2030,7 @@ function generateAdaptationRuleRules(
|
|
|
1982
2030
|
location: string,
|
|
1983
2031
|
sink: DiagnosticSink,
|
|
1984
2032
|
statusRoleDefaults: [string, string][],
|
|
2033
|
+
themeDarkPageSides: ReadonlySet<MediaSide>,
|
|
1985
2034
|
): string[] {
|
|
1986
2035
|
const parts: string[] = [];
|
|
1987
2036
|
const tokens = tokenBlock(rule, location, sink, [
|
|
@@ -1993,10 +2042,13 @@ function generateAdaptationRuleRules(
|
|
|
1993
2042
|
}
|
|
1994
2043
|
|
|
1995
2044
|
if (rule.components) {
|
|
2045
|
+
// An adaptation's color-mode blocks follow a flipped surface's
|
|
2046
|
+
// dark-page side as the root blocks do.
|
|
1996
2047
|
generateComponentRules(rule.components, parts, {
|
|
1997
2048
|
resetInheritedPaddingSpecificity: true,
|
|
1998
2049
|
sink,
|
|
1999
2050
|
location,
|
|
2051
|
+
darkPageSides: themeDarkPageSides,
|
|
2000
2052
|
});
|
|
2001
2053
|
generateColorOverrides(rule.components, parts);
|
|
2002
2054
|
generateSizeOverrides(rule.components, parts);
|
|
@@ -2055,6 +2107,9 @@ export function generateAdaptationCSS(
|
|
|
2055
2107
|
);
|
|
2056
2108
|
|
|
2057
2109
|
const statusRoleDefaults = adaptationStatusRoleDefaults(context);
|
|
2110
|
+
const themeDarkPageSides = darkPageSides(
|
|
2111
|
+
resolveModes({...theme.localTokens, ...theme.tokens}),
|
|
2112
|
+
);
|
|
2058
2113
|
|
|
2059
2114
|
// Emit ordinary rule writes first, without inherited Heading weight
|
|
2060
2115
|
// fallbacks. Carrying an earlier weight into a later block makes that value
|
|
@@ -2067,6 +2122,7 @@ export function generateAdaptationCSS(
|
|
|
2067
2122
|
`adaptations[${index}].`,
|
|
2068
2123
|
sink,
|
|
2069
2124
|
statusRoleDefaults[index],
|
|
2125
|
+
themeDarkPageSides,
|
|
2070
2126
|
);
|
|
2071
2127
|
if (parts.length === 0) {
|
|
2072
2128
|
continue;
|