@astryxdesign/core 0.7.11 → 0.7.12-canary.ccb4a6d
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/AppShell/AppShellMobileContext.d.ts.map +1 -1
- package/dist/AppShell/AppShellMobileContext.js +4 -3
- package/dist/AppShell/useAppShellMainId.d.ts.map +1 -1
- package/dist/AppShell/useAppShellMainId.js +3 -2
- package/dist/Avatar/AvatarSizeContext.d.ts.map +1 -1
- package/dist/Avatar/AvatarSizeContext.js +2 -2
- package/dist/Avatar/AvatarStatusLabelContext.d.ts +2 -2
- package/dist/Avatar/AvatarStatusLabelContext.d.ts.map +1 -1
- package/dist/Avatar/AvatarStatusLabelContext.js +3 -3
- package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupContext.js +2 -2
- package/dist/BottomSheet/BottomSheetHostContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetHostContext.js +3 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +48 -4
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcherContext.js +2 -2
- package/dist/BottomSheet/bottomSheetEscape.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetEscape.js +2 -2
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +2 -13
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +25 -42
- package/dist/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +12 -21
- package/dist/Button/buttonHitArea.d.ts.map +1 -1
- package/dist/Button/buttonHitArea.js +3 -3
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +13 -7
- package/dist/ButtonGroup/ButtonGroupContext.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroupContext.js +2 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +24 -15
- package/dist/Chat/ChatContext.d.ts.map +1 -1
- package/dist/Chat/ChatContext.js +6 -5
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +7 -22
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxRowPressContext.js +1 -1
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +3 -3
- package/dist/CommandPalette/CommandPaletteContext.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteContext.js +4 -3
- package/dist/CommandPalette/busyStartSettle.d.ts.map +1 -1
- package/dist/CommandPalette/busyStartSettle.js +2 -2
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +41 -4
- package/dist/Dialog/DialogContext.d.ts.map +1 -1
- package/dist/Dialog/DialogContext.js +3 -2
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.js +6 -5
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +4 -15
- package/dist/DropdownMenu/menuRegionStops.d.ts.map +1 -1
- package/dist/DropdownMenu/menuRegionStops.js +2 -37
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +2 -2
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +19 -16
- package/dist/HoverCard/HoverCard.d.ts +1 -2
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +1 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +5 -1
- package/dist/Icon/IconDefaultSizeContext.d.ts.map +1 -1
- package/dist/Icon/IconDefaultSizeContext.js +2 -2
- package/dist/InputGroup/InputGroupContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupContext.js +2 -2
- package/dist/InputGroup/InputGroupInternalContext.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupInternalContext.js +2 -2
- package/dist/InteractiveRoleContext/InteractiveRoleContext.d.ts.map +1 -1
- package/dist/InteractiveRoleContext/InteractiveRoleContext.js +5 -3
- package/dist/Item/ItemDescriptionContext.d.ts.map +1 -1
- package/dist/Item/ItemDescriptionContext.js +3 -3
- package/dist/Item/ItemListRowContext.d.ts.map +1 -1
- package/dist/Item/ItemListRowContext.js +3 -3
- package/dist/Item/ItemMarkerColumnsContext.d.ts +1 -1
- package/dist/Item/ItemMarkerColumnsContext.d.ts.map +1 -1
- package/dist/Item/ItemMarkerColumnsContext.js +2 -2
- package/dist/Layer/LayerContext.d.ts.map +1 -1
- package/dist/Layer/LayerContext.js +3 -2
- package/dist/Layer/LayerDepthContext.d.ts.map +1 -1
- package/dist/Layer/LayerDepthContext.js +3 -2
- package/dist/Layer/LayerTouch.d.ts +3 -2
- package/dist/Layer/LayerTouch.d.ts.map +1 -1
- package/dist/Layer/LayerTouch.js +3 -2
- package/dist/Layer/anchorName.d.ts.map +1 -1
- package/dist/Layer/anchorName.js +5 -1
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +115 -13
- package/dist/Layer/layerScopedContext.d.ts +5 -2
- package/dist/Layer/layerScopedContext.d.ts.map +1 -1
- package/dist/Layer/layerScopedContext.js +27 -10
- package/dist/Layer/layerSlideRules.d.ts +28 -26
- package/dist/Layer/layerSlideRules.d.ts.map +1 -1
- package/dist/Layer/layerSlideRules.js +41 -40
- package/dist/Layer/outsidePress.d.ts +21 -3
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +119 -29
- package/dist/Layer/settledBox.d.ts +9 -8
- package/dist/Layer/settledBox.d.ts.map +1 -1
- package/dist/Layer/settledBox.js +169 -49
- package/dist/Layer/toastHost.d.ts.map +1 -1
- package/dist/Layer/toastHost.js +3 -2
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +172 -60
- package/dist/Layer/useLayerKeyboardClearance.d.ts +14 -2
- package/dist/Layer/useLayerKeyboardClearance.d.ts.map +1 -1
- package/dist/Layer/useLayerKeyboardClearance.js +83 -12
- package/dist/Layer/useTouchTrigger.d.ts +21 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +61 -37
- package/dist/Layout/Layout.d.ts +1 -1
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +10 -6
- package/dist/Layout/LayoutAreaContext.d.ts.map +1 -1
- package/dist/Layout/LayoutAreaContext.js +3 -3
- package/dist/Layout/LayoutContent.d.ts +6 -6
- package/dist/Layout/LayoutContent.js +9 -9
- package/dist/Layout/LayoutDividerContext.d.ts.map +1 -1
- package/dist/Layout/LayoutDividerContext.js +2 -2
- package/dist/Layout/LayoutSlotsContext.d.ts.map +1 -1
- package/dist/Layout/LayoutSlotsContext.js +2 -2
- package/dist/Link/LinkContext.d.ts +16 -0
- package/dist/Link/LinkContext.d.ts.map +1 -1
- package/dist/Link/LinkContext.js +3 -3
- package/dist/List/List.d.ts +12 -1
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +29 -10
- package/dist/List/ListContext.d.ts +18 -3
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +9 -6
- package/dist/List/ListItem.d.ts +13 -4
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +37 -10
- package/dist/List/listLayoutUpdates.d.ts +34 -0
- package/dist/List/listLayoutUpdates.d.ts.map +1 -0
- package/dist/List/listLayoutUpdates.js +539 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +57 -10
- package/dist/Markdown/blockDirection.d.ts +26 -0
- package/dist/Markdown/blockDirection.d.ts.map +1 -0
- package/dist/Markdown/blockDirection.js +68 -0
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts +3 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.d.ts.map +1 -1
- package/dist/Markdown/plugins/HeadingLinksRenderer.js +3 -1
- package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListContext.js +2 -2
- package/dist/NavMenu/NavMenuContext.d.ts.map +1 -1
- package/dist/NavMenu/NavMenuContext.js +5 -4
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +9 -9
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +11 -8
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +2 -2
- package/dist/RadioList/RadioListReasonContext.d.ts.map +1 -1
- package/dist/RadioList/RadioListReasonContext.js +1 -1
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlContext.js +2 -2
- package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -1
- package/dist/SelectableCard/selectableCardInput.js +2 -2
- package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -1
- package/dist/Selector/SelectorRowLayoutContext.js +2 -2
- package/dist/SideNav/SideNavCollapseButton.d.ts +4 -3
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.js +4 -3
- package/dist/SideNav/SideNavFocusTargetsContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavFocusTargetsContext.js +2 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -2
- package/dist/SideNav/SideNavRenderContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavRenderContext.js +4 -3
- package/dist/SideNav/railMotion.d.ts +40 -0
- package/dist/SideNav/railMotion.d.ts.map +1 -1
- package/dist/SideNav/railMotion.js +2 -2
- package/dist/SizeContext/SizeContext.d.ts.map +1 -1
- package/dist/SizeContext/SizeContext.js +2 -2
- package/dist/SnapPaging/SnapPaging.d.ts.map +1 -1
- package/dist/SnapPaging/SnapPaging.js +162 -36
- package/dist/SnapPaging/snapPagingValue.d.ts +29 -3
- package/dist/SnapPaging/snapPagingValue.d.ts.map +1 -1
- package/dist/SnapPaging/snapPagingValue.js +38 -6
- package/dist/Spinner/SpinnerOwnerContext.d.ts.map +1 -1
- package/dist/Spinner/SpinnerOwnerContext.js +2 -2
- package/dist/Stepper/StepperContext.d.ts.map +1 -1
- package/dist/Stepper/StepperContext.js +3 -3
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -1
- package/dist/Switch/useSwitchTouch.js +8 -3
- package/dist/TabList/TabListContext.d.ts.map +1 -1
- package/dist/TabList/TabListContext.js +2 -2
- package/dist/Table/BaseTable.d.ts +3 -2
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +73 -16
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +3 -2
- package/dist/Table/TableContext.d.ts.map +1 -1
- package/dist/Table/TableContext.js +2 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +4 -3
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +5 -3
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +16 -18
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts.map +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +48 -39
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +4 -2
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +1 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +3 -2
- package/dist/Table/tableRowContextUsage.d.ts +21 -0
- package/dist/Table/tableRowContextUsage.d.ts.map +1 -0
- package/dist/Table/tableRowContextUsage.js +88 -0
- package/dist/Table/types.d.ts +58 -5
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +5 -2
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +18 -14
- package/dist/Text/TruncationTooltip.d.ts +45 -0
- package/dist/Text/TruncationTooltip.d.ts.map +1 -0
- package/dist/Text/TruncationTooltip.js +123 -0
- package/dist/Text/textClampContext.d.ts.map +1 -1
- package/dist/Text/textClampContext.js +1 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +4 -0
- package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.js +2 -2
- package/dist/Token/TokenNamingContext.d.ts.map +1 -1
- package/dist/Token/TokenNamingContext.js +2 -2
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerClearAllMessageContext.js +2 -2
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +12 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +2 -2
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +12 -6
- package/dist/Tooltip/tooltipPresentInterest.d.ts +29 -0
- package/dist/Tooltip/tooltipPresentInterest.d.ts.map +1 -0
- package/dist/Tooltip/tooltipPresentInterest.js +29 -0
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +30 -4
- package/dist/TopNav/TopNavContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavContext.js +2 -2
- package/dist/TopNav/TopNavMobileContentContext.d.ts +1 -1
- package/dist/TopNav/TopNavMobileContentContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavMobileContentContext.js +4 -3
- package/dist/TopNav/TopNavRenderContext.d.ts.map +1 -1
- package/dist/TopNav/TopNavRenderContext.js +4 -3
- package/dist/Typeahead/busyIndicatorLane.d.ts.map +1 -1
- package/dist/Typeahead/busyIndicatorLane.js +3 -2
- package/dist/Typeahead/committedChoicesKey.d.ts.map +1 -1
- package/dist/Typeahead/committedChoicesKey.js +3 -2
- package/dist/Typeahead/trailingKeyDown.d.ts.map +1 -1
- package/dist/Typeahead/trailingKeyDown.js +3 -2
- package/dist/astryx.css +18 -8
- package/dist/gestures/GestureArena.d.ts +2 -0
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +8 -1
- package/dist/gestures/GestureRecognizer.d.ts +6 -0
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +9 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +9 -4
- package/dist/hooks/focusableSelector.d.ts +13 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +22 -2
- package/dist/hooks/longPressDetector.d.ts.map +1 -1
- package/dist/hooks/longPressDetector.js +1 -25
- package/dist/hooks/pressGroupContext.d.ts.map +1 -1
- package/dist/hooks/pressGroupContext.js +1 -1
- package/dist/hooks/useActionGroupTracking.d.ts +18 -1
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -1
- package/dist/hooks/useActionGroupTracking.js +13 -2
- package/dist/hooks/useAnnounce.d.ts.map +1 -1
- package/dist/hooks/useAnnounce.js +3 -2
- package/dist/hooks/useFocusTrap.d.ts +11 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +47 -2
- package/dist/hooks/useListFocus.d.ts +7 -0
- package/dist/hooks/useListFocus.d.ts.map +1 -1
- package/dist/hooks/useListFocus.js +20 -3
- package/dist/hooks/usePager.d.ts.map +1 -1
- package/dist/hooks/usePager.js +26 -3
- package/dist/hooks/useScrollOverflow.d.ts +22 -0
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +67 -11
- package/dist/i18n/InternationalizationContext.d.ts +19 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationContext.js +3 -3
- package/dist/i18n/englishFallback.d.ts.map +1 -1
- package/dist/i18n/englishFallback.js +5 -1
- package/dist/i18n/firstStrongDirection.d.ts +7 -0
- package/dist/i18n/firstStrongDirection.d.ts.map +1 -0
- package/dist/i18n/firstStrongDirection.js +65 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/dist/internal/scroll-anchoring.d.ts +16 -0
- package/dist/internal/scroll-anchoring.d.ts.map +1 -0
- package/dist/internal/scroll-anchoring.js +16 -0
- package/dist/internal/touch.d.ts +2 -0
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +4 -1
- package/dist/motion/animatedLayout.d.ts +8 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +51 -3
- package/dist/motion/animator.d.ts +19 -2
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +72 -7
- package/dist/privateAttributes/itemKey.stylex.d.ts +5 -0
- package/dist/privateAttributes/itemKey.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/itemKey.stylex.js +25 -0
- package/dist/privateAttributes/leaving.stylex.d.ts +5 -0
- package/dist/privateAttributes/leaving.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/leaving.stylex.js +23 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/press.stylex.js +13 -3
- package/dist/privateAttributes/scrollAnchoring.stylex.d.ts +7 -0
- package/dist/privateAttributes/scrollAnchoring.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/scrollAnchoring.stylex.js +50 -0
- package/dist/privateAttributes/travelling.stylex.d.ts +27 -0
- package/dist/privateAttributes/travelling.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/travelling.stylex.js +51 -0
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +95 -49
- package/dist/theme/syntax/SyntaxTheme.d.ts.map +1 -1
- package/dist/theme/syntax/SyntaxTheme.js +3 -2
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +3 -2
- package/dist/utils/calendarSystem.d.ts.map +1 -1
- package/dist/utils/calendarSystem.js +4 -1
- package/dist/utils/flatTree.d.ts +13 -0
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +28 -4
- package/dist/utils/inputAge.d.ts +22 -0
- package/dist/utils/inputAge.d.ts.map +1 -0
- package/dist/utils/inputAge.js +54 -0
- package/dist/utils/inputStream.d.ts +8 -0
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +53 -3
- package/dist/utils/moduleLoader.d.ts +23 -0
- package/dist/utils/moduleLoader.d.ts.map +1 -0
- package/dist/utils/moduleLoader.js +31 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +13 -8
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +7 -14
- package/dist/utils/sharedContext.d.ts +18 -0
- package/dist/utils/sharedContext.d.ts.map +1 -0
- package/dist/utils/sharedContext.js +33 -0
- package/dist/utils/sharedRealm.d.ts +24 -0
- package/dist/utils/sharedRealm.d.ts.map +1 -0
- package/dist/utils/sharedRealm.js +38 -0
- package/locales/en.json +4 -0
- package/locales/pseudo.json +3 -0
- package/package.json +10 -5
- package/src/AppShell/AppShellMobileContext.tsx +8 -3
- package/src/AppShell/useAppShellMainId.ts +7 -2
- package/src/Avatar/AvatarSizeContext.ts +6 -2
- package/src/Avatar/AvatarStatusLabelContext.ts +8 -3
- package/src/AvatarGroup/AvatarGroupContext.ts +7 -4
- package/src/BottomSheet/BottomSheetHostContext.ts +7 -3
- package/src/BottomSheet/BottomSheetPanel.tsx +56 -7
- package/src/BottomSheet/BottomSheetSwitcherContext.ts +7 -2
- package/src/BottomSheet/bottomSheetEscape.ts +6 -2
- package/src/BottomSheet/bottomSheetStack.ts +6 -14
- package/src/BottomSheet/useSheetGestures.ts +28 -48
- package/src/Breadcrumbs/Breadcrumbs.tsx +6 -5
- package/src/Button/Button.doc.mjs +3 -3
- package/src/Button/Button.tsx +10 -22
- package/src/Button/buttonHitArea.ts +7 -4
- package/src/ButtonGroup/ButtonGroup.doc.mjs +3 -3
- package/src/ButtonGroup/ButtonGroup.tsx +27 -16
- package/src/ButtonGroup/ButtonGroupContext.ts +7 -4
- package/src/Carousel/Carousel.tsx +33 -15
- package/src/Chat/ChatContext.tsx +23 -7
- package/src/Chat/useChatStreamScroll.ts +7 -26
- package/src/CheckboxInput/CheckboxRowPressContext.ts +5 -1
- package/src/CheckboxList/CheckboxListContext.tsx +5 -1
- package/src/Collapsible/CollapsibleGroupContext.tsx +11 -3
- package/src/CommandPalette/CommandPaletteContext.ts +8 -3
- package/src/CommandPalette/busyStartSettle.ts +6 -2
- package/src/DateInput/TouchDateField.tsx +62 -4
- package/src/Dialog/DialogContext.ts +7 -2
- package/src/DropdownMenu/DropdownMenuContext.tsx +18 -5
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +6 -18
- package/src/DropdownMenu/menuRegionStops.ts +1 -49
- package/src/FormLayout/FormLayoutContext.ts +3 -3
- package/src/Heading/Heading.tsx +34 -18
- package/src/HoverCard/HoverCard.doc.mjs +3 -3
- package/src/HoverCard/HoverCard.tsx +1 -2
- package/src/HoverCard/useHoverCard.tsx +6 -2
- package/src/Icon/IconDefaultSizeContext.ts +6 -2
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/InputGroup/InputGroupContext.ts +7 -4
- package/src/InputGroup/InputGroupInternalContext.ts +6 -2
- package/src/InteractiveRoleContext/InteractiveRoleContext.ts +8 -3
- package/src/Item/ItemDescriptionContext.tsx +7 -3
- package/src/Item/ItemListRowContext.tsx +7 -3
- package/src/Item/ItemMarkerColumnsContext.tsx +7 -2
- package/src/Layer/LayerContext.ts +7 -2
- package/src/Layer/LayerDepthContext.tsx +3 -2
- package/src/Layer/LayerTouch.ts +6 -2
- package/src/Layer/anchorName.ts +8 -4
- package/src/Layer/inputHold.ts +138 -21
- package/src/Layer/layerScopedContext.tsx +34 -7
- package/src/Layer/layerSlideRules.ts +43 -40
- package/src/Layer/outsidePress.ts +144 -28
- package/src/Layer/settledBox.ts +216 -54
- package/src/Layer/toastHost.tsx +6 -2
- package/src/Layer/useLayer.tsx +200 -69
- package/src/Layer/useLayerKeyboardClearance.ts +90 -12
- package/src/Layer/useTouchTrigger.ts +89 -40
- package/src/Layout/Layout.doc.mjs +17 -0
- package/src/Layout/Layout.tsx +13 -9
- package/src/Layout/LayoutAreaContext.ts +8 -9
- package/src/Layout/LayoutContent.doc.mjs +11 -0
- package/src/Layout/LayoutContent.tsx +9 -9
- package/src/Layout/LayoutDividerContext.ts +6 -2
- package/src/Layout/LayoutSlotsContext.ts +6 -3
- package/src/Link/LinkContext.ts +7 -3
- package/src/List/List.doc.mjs +5 -0
- package/src/List/List.tsx +53 -5
- package/src/List/ListContext.tsx +28 -6
- package/src/List/ListItem.doc.mjs +11 -0
- package/src/List/ListItem.tsx +51 -14
- package/src/List/listLayoutUpdates.ts +603 -0
- package/src/Markdown/Markdown.tsx +93 -5
- package/src/Markdown/blockDirection.ts +100 -0
- package/src/Markdown/plugins/HeadingLinksRenderer.tsx +4 -0
- package/src/MetadataList/MetadataListContext.tsx +6 -2
- package/src/NavMenu/NavMenuContext.tsx +14 -5
- package/src/Popover/Popover.tsx +23 -16
- package/src/Popover/usePopover.tsx +21 -7
- package/src/RadioList/RadioList.tsx +7 -4
- package/src/RadioList/RadioListReasonContext.ts +1 -1
- package/src/Section/Section.doc.mjs +22 -0
- package/src/SegmentedControl/SegmentedControlContext.ts +6 -2
- package/src/SelectableCard/selectableCardInput.ts +6 -2
- package/src/Selector/SelectorRowLayoutContext.ts +6 -2
- package/src/SideNav/SideNavCollapseButton.doc.mjs +5 -5
- package/src/SideNav/SideNavCollapseButton.tsx +4 -3
- package/src/SideNav/SideNavCollapseContext.ts +12 -7
- package/src/SideNav/SideNavFocusTargetsContext.ts +6 -2
- package/src/SideNav/SideNavItem.tsx +6 -2
- package/src/SideNav/SideNavRenderContext.ts +9 -8
- package/src/SideNav/railMotion.ts +6 -2
- package/src/SizeContext/SizeContext.ts +6 -2
- package/src/SnapPaging/SnapPaging.ts +164 -39
- package/src/SnapPaging/snapPagingValue.ts +59 -12
- package/src/Spinner/SpinnerOwnerContext.ts +6 -2
- package/src/Stepper/StepperContext.ts +12 -3
- package/src/Switch/useSwitchTouch.ts +7 -5
- package/src/TabList/TabListContext.ts +7 -2
- package/src/Table/BaseTable.tsx +143 -19
- package/src/Table/Table.tsx +4 -3
- package/src/Table/TableContext.ts +6 -2
- package/src/Table/index.ts +2 -0
- package/src/Table/plugins/filtering/useTableFiltering.tsx +11 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +10 -3
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +38 -29
- package/src/Table/plugins/selection/useTableSelection.tsx +7 -2
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +1 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +6 -2
- package/src/Table/tableRowContextUsage.ts +105 -0
- package/src/Table/types.ts +60 -2
- package/src/Table/useBaseTablePlugins.ts +5 -2
- package/src/Table/useTableRowIndex.doc.mjs +6 -7
- package/src/Text/Text.tsx +34 -18
- package/src/Text/TruncationTooltip.tsx +179 -0
- package/src/Text/textClampContext.ts +5 -1
- package/src/TimeInput/TimeInput.tsx +4 -0
- package/src/ToggleButton/ToggleButtonGroup.tsx +6 -2
- package/src/Token/TokenNamingContext.ts +6 -2
- package/src/Tokenizer/TokenizerClearAllMessageContext.ts +4 -4
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +3 -3
- package/src/Toolbar/Toolbar.tsx +16 -9
- package/src/Tooltip/tooltipPresentInterest.ts +43 -0
- package/src/Tooltip/useTooltip.tsx +33 -0
- package/src/TopNav/TopNavContext.ts +6 -2
- package/src/TopNav/TopNavMobileContentContext.ts +8 -3
- package/src/TopNav/TopNavRenderContext.ts +8 -4
- package/src/Typeahead/busyIndicatorLane.tsx +7 -2
- package/src/Typeahead/committedChoicesKey.tsx +4 -3
- package/src/Typeahead/trailingKeyDown.tsx +7 -2
- package/src/gestures/GestureArena.ts +8 -1
- package/src/gestures/GestureRecognizer.ts +9 -0
- package/src/gestures/PressTracker.ts +13 -4
- package/src/hooks/focusableSelector.ts +29 -1
- package/src/hooks/longPressDetector.ts +1 -35
- package/src/hooks/pressGroupContext.ts +5 -1
- package/src/hooks/useActionGroupTracking.ts +29 -2
- package/src/hooks/useAnnounce.ts +8 -4
- package/src/hooks/useFocusTrap.ts +62 -2
- package/src/hooks/useListFocus.ts +34 -7
- package/src/hooks/usePager.ts +30 -3
- package/src/hooks/useScrollOverflow.ts +65 -7
- package/src/i18n/InternationalizationContext.ts +12 -8
- package/src/i18n/englishFallback.ts +7 -1
- package/src/i18n/firstStrongDirection.ts +69 -0
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
- package/src/internal/scroll-anchoring.ts +16 -0
- package/src/internal/touch.ts +4 -0
- package/src/motion/animatedLayout.ts +44 -3
- package/src/motion/animator.ts +97 -9
- package/src/privateAttributes/itemKey.stylex.ts +25 -0
- package/src/privateAttributes/leaving.stylex.ts +23 -0
- package/src/privateAttributes/press.stylex.ts +19 -7
- package/src/privateAttributes/scrollAnchoring.stylex.ts +50 -0
- package/src/privateAttributes/travelling.stylex.ts +88 -0
- package/src/theme/Theme.tsx +124 -60
- package/src/theme/syntax/SyntaxTheme.tsx +7 -2
- package/src/theme/useTheme.ts +7 -8
- package/src/utils/calendarSystem.ts +7 -1
- package/src/utils/flatTree.ts +31 -4
- package/src/utils/inputAge.ts +66 -0
- package/src/utils/inputStream.ts +52 -3
- package/src/utils/moduleLoader.ts +47 -0
- package/src/utils/pressFeedback.ts +16 -7
- package/src/utils/selectionLock.ts +8 -18
- package/src/utils/sharedContext.ts +42 -0
- package/src/utils/sharedRealm.ts +42 -0
package/src/theme/Theme.tsx
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
import React, {use, useId, useInsertionEffect, useMemo} from 'react';
|
|
38
|
+
import React, {use, useId, useInsertionEffect, useMemo, useState} from 'react';
|
|
39
39
|
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
40
40
|
import * as stylex from '@stylexjs/stylex';
|
|
41
41
|
import type {ThemeMode} from './types';
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
reducedMotionMarkProps,
|
|
51
51
|
setRootReducedMotionMark,
|
|
52
52
|
} from '../privateAttributes/reducedMotion.stylex';
|
|
53
|
+
import {createSharedContext} from '../utils/sharedContext';
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Theme provider props
|
|
@@ -101,17 +102,83 @@ const wrapperStyles = stylex.create({
|
|
|
101
102
|
* @internal Not exported from the theme barrel; useToast imports it from
|
|
102
103
|
* './theme/Theme' directly.
|
|
103
104
|
*/
|
|
104
|
-
export const ThemeNestingContext =
|
|
105
|
+
export const ThemeNestingContext = createSharedContext(
|
|
106
|
+
'ThemeNestingContext',
|
|
107
|
+
1,
|
|
108
|
+
false,
|
|
109
|
+
);
|
|
105
110
|
ThemeNestingContext.displayName = 'ThemeNestingContext';
|
|
106
111
|
|
|
107
112
|
// =============================================================================
|
|
108
113
|
// Style injection for unbuilt themes
|
|
109
114
|
// =============================================================================
|
|
110
115
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
116
|
+
/**
|
|
117
|
+
* The CSS is shared by the whole document. Remove it only when the last
|
|
118
|
+
* `Theme` that uses it unmounts.
|
|
119
|
+
*/
|
|
120
|
+
interface InjectedTheme {
|
|
121
|
+
/**
|
|
122
|
+
* Each mounted `Theme` that uses this name, with its theme and id. The key
|
|
123
|
+
* is one object per `Theme` instance: `useId` values can repeat across
|
|
124
|
+
* separate React roots.
|
|
125
|
+
*/
|
|
126
|
+
users: Map<object, {theme: DefinedTheme; id: string}>;
|
|
127
|
+
/** The `Theme` whose theme is in the document. */
|
|
128
|
+
owner: object;
|
|
129
|
+
/**
|
|
130
|
+
* The owner that last handed the CSS over. When the same `Theme` sets up
|
|
131
|
+
* again in the same commit (its own theme changed), it takes the CSS back.
|
|
132
|
+
*/
|
|
133
|
+
formerOwner: object | null;
|
|
134
|
+
/** The theme whose CSS is in the document. */
|
|
135
|
+
theme: DefinedTheme;
|
|
136
|
+
styles: HTMLStyleElement[];
|
|
137
|
+
}
|
|
138
|
+
const injectedThemes = new Map<string, InjectedTheme>();
|
|
113
139
|
const THEME_LAYER_ORDER = '@layer reset, astryx-base, astryx-theme;';
|
|
114
140
|
|
|
141
|
+
function writeThemeStyles(theme: DefinedTheme, id: string): HTMLStyleElement[] {
|
|
142
|
+
const {prose, component} = generateThemeCSS(theme);
|
|
143
|
+
const styles: HTMLStyleElement[] = [];
|
|
144
|
+
|
|
145
|
+
// Prose defaults go into @layer reset — lowest priority, scoped to
|
|
146
|
+
// the theme region. Any class-based style (StyleX, .xds-*) wins.
|
|
147
|
+
if (prose) {
|
|
148
|
+
const proseStyle = document.createElement('style');
|
|
149
|
+
proseStyle.setAttribute(dataAttr('theme-prose'), theme.name);
|
|
150
|
+
proseStyle.setAttribute(dataAttr('id'), id);
|
|
151
|
+
proseStyle.textContent = `${THEME_LAYER_ORDER}\n@layer reset {\n${prose}\n}`;
|
|
152
|
+
document.head.appendChild(proseStyle);
|
|
153
|
+
styles.push(proseStyle);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Component overrides go into @layer astryx-theme — above StyleX layers
|
|
157
|
+
// so themes can intentionally restyle components.
|
|
158
|
+
if (component) {
|
|
159
|
+
const compStyle = document.createElement('style');
|
|
160
|
+
compStyle.setAttribute(dataAttr('theme'), theme.name);
|
|
161
|
+
compStyle.setAttribute(dataAttr('id'), id);
|
|
162
|
+
compStyle.textContent = `${THEME_LAYER_ORDER}\n@layer astryx-theme {\n${component}\n}`;
|
|
163
|
+
document.head.appendChild(compStyle);
|
|
164
|
+
styles.push(compStyle);
|
|
165
|
+
}
|
|
166
|
+
return styles;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Replace an entry's CSS with `theme`'s. */
|
|
170
|
+
function rewriteThemeStyles(
|
|
171
|
+
entry: InjectedTheme,
|
|
172
|
+
theme: DefinedTheme,
|
|
173
|
+
id: string,
|
|
174
|
+
): void {
|
|
175
|
+
for (const style of entry.styles) {
|
|
176
|
+
style.remove();
|
|
177
|
+
}
|
|
178
|
+
entry.theme = theme;
|
|
179
|
+
entry.styles = writeThemeStyles(theme, id);
|
|
180
|
+
}
|
|
181
|
+
|
|
115
182
|
/**
|
|
116
183
|
* Hook to inject theme CSS into the document.
|
|
117
184
|
* Built themes (from `astryx theme build`) skip injection — their CSS
|
|
@@ -119,6 +186,7 @@ const THEME_LAYER_ORDER = '@layer reset, astryx-base, astryx-theme;';
|
|
|
119
186
|
*/
|
|
120
187
|
function useThemeStyleInjection(theme: DefinedTheme): void {
|
|
121
188
|
const id = useId();
|
|
189
|
+
const [instance] = useState(() => ({}));
|
|
122
190
|
|
|
123
191
|
// Syncs the document's stylesheets with the runtime theme CSS.
|
|
124
192
|
useInsertionEffect(() => {
|
|
@@ -127,69 +195,65 @@ function useThemeStyleInjection(theme: DefinedTheme): void {
|
|
|
127
195
|
return;
|
|
128
196
|
}
|
|
129
197
|
|
|
130
|
-
// Second and later `Theme`s using this theme do no work at all —
|
|
131
|
-
// generation included. Its CSS is document-wide and identical for each.
|
|
132
198
|
const themeKey = `astryx-theme-${theme.name}`;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// the theme region. Any class-based style (StyleX, .xds-*) wins.
|
|
155
|
-
if (prose) {
|
|
156
|
-
const proseStyle = document.createElement('style');
|
|
157
|
-
proseStyle.setAttribute(dataAttr('theme-prose'), theme.name);
|
|
158
|
-
proseStyle.setAttribute(dataAttr('id'), id);
|
|
159
|
-
proseStyle.textContent = `${THEME_LAYER_ORDER}\n@layer reset {\n${prose}\n}`;
|
|
160
|
-
document.head.appendChild(proseStyle);
|
|
199
|
+
let entry = injectedThemes.get(themeKey);
|
|
200
|
+
if (entry == null) {
|
|
201
|
+
// One-time perf hint per theme
|
|
202
|
+
warnOnce(
|
|
203
|
+
`theme-injection:${theme.name}`,
|
|
204
|
+
'Theme',
|
|
205
|
+
`"${theme.name}" is using runtime style injection. ` +
|
|
206
|
+
`For better performance, use the pre-built theme:\n\n` +
|
|
207
|
+
` import {${theme.name}Theme} from '@astryxdesign/theme-${theme.name}/built';\n` +
|
|
208
|
+
` import '@astryxdesign/theme-${theme.name}/theme.css';\n\n` +
|
|
209
|
+
`For custom themes, run \`npx @astryxdesign/cli theme build <file>\` to generate ` +
|
|
210
|
+
`the built artifacts.`,
|
|
211
|
+
);
|
|
212
|
+
entry = {
|
|
213
|
+
users: new Map(),
|
|
214
|
+
owner: instance,
|
|
215
|
+
formerOwner: null,
|
|
216
|
+
theme,
|
|
217
|
+
styles: writeThemeStyles(theme, id),
|
|
218
|
+
};
|
|
219
|
+
injectedThemes.set(themeKey, entry);
|
|
161
220
|
}
|
|
162
|
-
|
|
163
|
-
//
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (prose || component) {
|
|
174
|
-
cleanups.push(() => {
|
|
175
|
-
// Matched by the astryx id marker, which is always written above.
|
|
176
|
-
const proseEl = document.querySelector(
|
|
177
|
-
`style[${dataAttr('theme-prose')}="${theme.name}"][${dataAttr('id')}="${id}"]`,
|
|
178
|
-
);
|
|
179
|
-
const compEl = document.querySelector(
|
|
180
|
-
`style[${dataAttr('theme')}="${theme.name}"][${dataAttr('id')}="${id}"]`,
|
|
181
|
-
);
|
|
182
|
-
proseEl?.remove();
|
|
183
|
-
compEl?.remove();
|
|
184
|
-
});
|
|
221
|
+
// A later `Theme` does no generation. The CSS of the first `Theme` that
|
|
222
|
+
// injected the name stays in the document.
|
|
223
|
+
entry.users.set(instance, {theme, id});
|
|
224
|
+
if (entry.formerOwner === instance) {
|
|
225
|
+
// The owner's own theme changed: its new definition paints, as on main.
|
|
226
|
+
entry.owner = instance;
|
|
227
|
+
entry.formerOwner = null;
|
|
228
|
+
if (entry.theme !== theme) {
|
|
229
|
+
rewriteThemeStyles(entry, theme, id);
|
|
230
|
+
}
|
|
185
231
|
}
|
|
232
|
+
const current = entry;
|
|
186
233
|
|
|
187
234
|
return () => {
|
|
188
|
-
|
|
189
|
-
|
|
235
|
+
current.users.delete(instance);
|
|
236
|
+
if (current.users.size === 0) {
|
|
237
|
+
for (const style of current.styles) {
|
|
238
|
+
style.remove();
|
|
239
|
+
}
|
|
240
|
+
injectedThemes.delete(themeKey);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (current.owner !== instance) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
// The earliest-mounted `Theme` that remains takes over the CSS. If its
|
|
247
|
+
// theme differs, as after a redefinition under the same name, its CSS
|
|
248
|
+
// replaces the old one.
|
|
249
|
+
const [nextOwner, next] = [...current.users][0];
|
|
250
|
+
current.owner = nextOwner;
|
|
251
|
+
current.formerOwner = instance;
|
|
252
|
+
if (next.theme !== current.theme) {
|
|
253
|
+
rewriteThemeStyles(current, next.theme, next.id);
|
|
190
254
|
}
|
|
191
255
|
};
|
|
192
|
-
}, [theme, id]);
|
|
256
|
+
}, [theme, id, instance]);
|
|
193
257
|
}
|
|
194
258
|
|
|
195
259
|
// =============================================================================
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* @see https://github.com/meta/astryx/issues/1148
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import React, {
|
|
14
|
+
import React, {use, useMemo} from 'react';
|
|
15
15
|
import {
|
|
16
16
|
syntaxThemeStyle,
|
|
17
17
|
resolveSyntaxTokenForMode,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import {useMediaQuery} from '../../hooks/useMediaQuery';
|
|
23
23
|
import {useTheme} from '../useTheme';
|
|
24
24
|
import {formatColor, parseColor} from '../../utils/color';
|
|
25
|
+
import {createSharedContext} from '../../utils/sharedContext';
|
|
25
26
|
|
|
26
27
|
// =============================================================================
|
|
27
28
|
// Context
|
|
@@ -32,7 +33,11 @@ interface SyntaxThemeContextValue {
|
|
|
32
33
|
theme: SyntaxThemeDefinition;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const SyntaxThemeContext =
|
|
36
|
+
const SyntaxThemeContext = createSharedContext<SyntaxThemeContextValue | null>(
|
|
37
|
+
'SyntaxThemeContext',
|
|
38
|
+
1,
|
|
39
|
+
null,
|
|
40
|
+
);
|
|
36
41
|
SyntaxThemeContext.displayName = 'SyntaxThemeContext';
|
|
37
42
|
|
|
38
43
|
// =============================================================================
|
package/src/theme/useTheme.ts
CHANGED
|
@@ -23,19 +23,14 @@
|
|
|
23
23
|
* - /packages/core/src/theme/index.ts
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import {
|
|
27
|
-
createContext,
|
|
28
|
-
use,
|
|
29
|
-
useCallback,
|
|
30
|
-
useMemo,
|
|
31
|
-
useSyncExternalStore,
|
|
32
|
-
} from 'react';
|
|
26
|
+
import {use, useCallback, useMemo, useSyncExternalStore} from 'react';
|
|
33
27
|
import type {ThemeMode} from './types';
|
|
34
28
|
import type {DefinedTheme} from './defineTheme';
|
|
35
29
|
import {resolveThemeTokens} from './tokens';
|
|
36
30
|
import {getRegisteredTheme} from './themeRegistry';
|
|
37
31
|
import {dataAttr} from '../naming';
|
|
38
32
|
import {useMediaQuery} from '../hooks/useMediaQuery';
|
|
33
|
+
import {createSharedContext} from '../utils/sharedContext';
|
|
39
34
|
|
|
40
35
|
// =============================================================================
|
|
41
36
|
// Context
|
|
@@ -57,7 +52,11 @@ export interface ThemeContextValue {
|
|
|
57
52
|
* null when no provider is present.
|
|
58
53
|
* @internal
|
|
59
54
|
*/
|
|
60
|
-
export const ThemeContext =
|
|
55
|
+
export const ThemeContext = createSharedContext<ThemeContextValue | null>(
|
|
56
|
+
'ThemeContext',
|
|
57
|
+
1,
|
|
58
|
+
null,
|
|
59
|
+
);
|
|
61
60
|
ThemeContext.displayName = 'ThemeContext';
|
|
62
61
|
|
|
63
62
|
// =============================================================================
|
|
@@ -271,9 +271,15 @@ export function calendarMonthFromYearMonth(
|
|
|
271
271
|
{year, month}: CalendarYearMonth,
|
|
272
272
|
): CalendarMonth {
|
|
273
273
|
if (isGregorianAligned(calendar)) {
|
|
274
|
+
// A Gregorian year has 12 months. Past it, `getDaysInMonth` answers
|
|
275
|
+
// undefined, so constrain here as the Temporal branch below already does.
|
|
276
|
+
const monthOfYear = Math.min(
|
|
277
|
+
month,
|
|
278
|
+
calendarMonthsInCalendarYear(calendar, year),
|
|
279
|
+
);
|
|
274
280
|
return gregorianMonth(
|
|
275
281
|
year - (GREGORIAN_YEAR_OFFSETS[calendar] ?? 0),
|
|
276
|
-
|
|
282
|
+
monthOfYear,
|
|
277
283
|
);
|
|
278
284
|
}
|
|
279
285
|
// `with` replaces the year and month of any date in the calendar.
|
package/src/utils/flatTree.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* @file flatTree.ts
|
|
5
5
|
* @input A DOM node
|
|
6
6
|
* @output Exports parentAcrossShadow, containsAlongFlatTree, which walks it,
|
|
7
|
-
* and
|
|
7
|
+
* deepActiveElement, shadowHostOf, a shadow root's host, and
|
|
8
|
+
* shadowRootsOutward
|
|
8
9
|
* @position The flat-tree parent the browser scrolls and dispatches
|
|
9
|
-
* through
|
|
10
|
-
* selection lock
|
|
11
|
-
*
|
|
10
|
+
* through. The gesture host's native-scroll probe, the outside-press watch,
|
|
11
|
+
* the selection lock and the Layer module's input hold share it. The press
|
|
12
|
+
* feedback controller uses the selection lock without the gesture system
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import {isShadowRoot} from './nodeType';
|
|
@@ -52,3 +53,29 @@ export function deepActiveElement(
|
|
|
52
53
|
}
|
|
53
54
|
return active;
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The host of a shadow root, open or closed and from any window, and null for
|
|
59
|
+
* any other node.
|
|
60
|
+
*/
|
|
61
|
+
export function shadowHostOf(node: Node): Element | null {
|
|
62
|
+
return isShadowRoot(node) ? node.host : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The shadow roots from `node` out to its document, innermost first, each with
|
|
67
|
+
* its host. Empty when `node` is not a shadow root.
|
|
68
|
+
*/
|
|
69
|
+
export function shadowRootsOutward(
|
|
70
|
+
node: Node,
|
|
71
|
+
): {readonly root: ShadowRoot; readonly host: Element}[] {
|
|
72
|
+
const roots: {readonly root: ShadowRoot; readonly host: Element}[] = [];
|
|
73
|
+
for (
|
|
74
|
+
let at: Node = node, host = shadowHostOf(at);
|
|
75
|
+
host != null;
|
|
76
|
+
at = host.getRootNode(), host = shadowHostOf(at)
|
|
77
|
+
) {
|
|
78
|
+
roots.push({root: at as ShadowRoot, host});
|
|
79
|
+
}
|
|
80
|
+
return roots;
|
|
81
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file inputAge.ts
|
|
5
|
+
* @input An input's time stamp, and its event or the node it landed on
|
|
6
|
+
* @output clockOf, timeOn and msSinceInput: the clock of the window that
|
|
7
|
+
* stamped an input, its time on that clock, and how long ago it happened
|
|
8
|
+
* @position Internal utility. The content-touch delay (utils/pressFeedback.ts,
|
|
9
|
+
* gestures/PressTracker.ts) and the long-press hold
|
|
10
|
+
* (hooks/longPressDetector.ts) count from the touch with it.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {isDocument, isNode} from './nodeType';
|
|
14
|
+
|
|
15
|
+
/** The part of a window's performance timeline an input's age reads. */
|
|
16
|
+
export type EventClock = Pick<Performance, 'now'>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The clock of the window that stamped an input: an event's `view`, or the
|
|
20
|
+
* window of the node it landed on. A same-origin iframe's clock or a popup's
|
|
21
|
+
* starts later than the page's. With neither, the clock is this window's.
|
|
22
|
+
*/
|
|
23
|
+
export function clockOf(source: unknown): EventClock | null {
|
|
24
|
+
const view = isNode(source)
|
|
25
|
+
? (isDocument(source) ? source : source.ownerDocument)?.defaultView
|
|
26
|
+
: (source as {view?: unknown} | null | undefined)?.view;
|
|
27
|
+
return (
|
|
28
|
+
(view as {performance?: EventClock} | null | undefined)?.performance ??
|
|
29
|
+
(typeof performance === 'undefined' ? null : performance)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An event's time on its window's clock. jsdom stamps events with
|
|
35
|
+
* `Date.now()`. Such a stamp keeps its age on that clock, so a frozen system
|
|
36
|
+
* time keeps a delay's length. A stamp nearer `Date.now()` than the window's
|
|
37
|
+
* clock is that kind of stamp.
|
|
38
|
+
*/
|
|
39
|
+
export function timeOn(
|
|
40
|
+
clock: EventClock | null,
|
|
41
|
+
timeStamp: number | undefined,
|
|
42
|
+
): number | undefined {
|
|
43
|
+
// A stamp of 0 means the event carries no time, so a delay falls back to
|
|
44
|
+
// its full length on the page's timer.
|
|
45
|
+
if (timeStamp == null || !Number.isFinite(timeStamp) || timeStamp <= 0) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
if (
|
|
49
|
+
clock != null &&
|
|
50
|
+
Math.abs(Date.now() - timeStamp) < Math.abs(clock.now() - timeStamp)
|
|
51
|
+
) {
|
|
52
|
+
return clock.now() - (Date.now() - timeStamp);
|
|
53
|
+
}
|
|
54
|
+
return timeStamp;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* How long ago the input stamped `time` happened, on the clock of the window
|
|
59
|
+
* that stamped it (`clockOf(source)`). A busy main thread runs a listener
|
|
60
|
+
* late. An input with no time, or a time ahead of now, counts as now.
|
|
61
|
+
*/
|
|
62
|
+
export function msSinceInput(time: number, source?: unknown): number {
|
|
63
|
+
const clock = clockOf(source);
|
|
64
|
+
const at = timeOn(clock, time);
|
|
65
|
+
return clock == null || at == null ? 0 : Math.max(0, clock.now() - at);
|
|
66
|
+
}
|
package/src/utils/inputStream.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* @file inputStream.ts
|
|
5
5
|
* @input A window, and subscribers to its input events (the press feedback
|
|
6
6
|
* controller, the gesture host)
|
|
7
|
-
* @output subscribeInput, getLastPointerType
|
|
8
|
-
* type of the latest pointer event the stream
|
|
9
|
-
* latest mouse one was
|
|
7
|
+
* @output subscribeInput, getLastPointerType, getLastMousePoint and
|
|
8
|
+
* getDownPresses: the type of the latest pointer event the stream
|
|
9
|
+
* delivered, where the latest mouse one was, and where each finger and pen
|
|
10
|
+
* press that is down was last
|
|
10
11
|
* @position The one entry for document-wide input listeners in core: one
|
|
11
12
|
* native listener per event type on the window's capture phase, shared by
|
|
12
13
|
* every subscriber
|
|
@@ -72,6 +73,10 @@ const lastPointerTypes = new WeakMap<Window, string>();
|
|
|
72
73
|
/** Where the latest mouse pointer event each window's stream delivered was. */
|
|
73
74
|
const lastMousePoints = new WeakMap<Window, MousePoint>();
|
|
74
75
|
|
|
76
|
+
/** Each window's finger and pen presses that are down, by pointer id. */
|
|
77
|
+
const downPresses = new WeakMap<Window, Map<number, MousePoint>>();
|
|
78
|
+
const NO_PRESSES: ReadonlyMap<number, MousePoint> = new Map();
|
|
79
|
+
|
|
75
80
|
/** A point in the viewport, in CSS pixels. */
|
|
76
81
|
export interface MousePoint {
|
|
77
82
|
readonly x: number;
|
|
@@ -97,6 +102,17 @@ export function getLastMousePoint(view: Window): MousePoint | null {
|
|
|
97
102
|
return lastMousePoints.get(view) ?? null;
|
|
98
103
|
}
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* The finger and pen presses that are down in `view`, by pointer id, each at
|
|
107
|
+
* the point where the stream last heard it. The stream hears them only while
|
|
108
|
+
* subscribers listen to `pointerdown`, `pointerup` and `pointercancel` (and
|
|
109
|
+
* `pointermove` for a moving press), as press feedback and the gesture host
|
|
110
|
+
* do. Reading it adds no listener.
|
|
111
|
+
*/
|
|
112
|
+
export function getDownPresses(view: Window): ReadonlyMap<number, MousePoint> {
|
|
113
|
+
return downPresses.get(view) ?? NO_PRESSES;
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
/**
|
|
101
117
|
* Listen to `type` on `view`'s capture phase through its shared native
|
|
102
118
|
* listener. Returns the unsubscribe; calling it again does nothing.
|
|
@@ -148,6 +164,11 @@ export function subscribeInput<K extends keyof InputEventMap>(
|
|
|
148
164
|
register(view, type, current);
|
|
149
165
|
if (current.subscribers.length === 0) {
|
|
150
166
|
streams.get(view)?.delete(type);
|
|
167
|
+
// Without a listener the stream cannot hear a press end, so the
|
|
168
|
+
// presses it recorded may already have ended.
|
|
169
|
+
if (type === 'pointerup' || type === 'pointercancel') {
|
|
170
|
+
downPresses.delete(view);
|
|
171
|
+
}
|
|
151
172
|
}
|
|
152
173
|
};
|
|
153
174
|
}
|
|
@@ -190,6 +211,9 @@ function dispatch(view: Window, channel: Channel, event: Event): void {
|
|
|
190
211
|
) {
|
|
191
212
|
lastMousePoints.set(view, {x: clientX, y: clientY});
|
|
192
213
|
}
|
|
214
|
+
if (pointerType === 'touch' || pointerType === 'pen') {
|
|
215
|
+
recordPress(view, event);
|
|
216
|
+
}
|
|
193
217
|
// A subscriber may subscribe or unsubscribe while the event runs; the
|
|
194
218
|
// event goes to those subscribed when it arrived.
|
|
195
219
|
for (const subscriber of [...channel.subscribers]) {
|
|
@@ -206,6 +230,31 @@ function dispatch(view: Window, channel: Channel, event: Event): void {
|
|
|
206
230
|
}
|
|
207
231
|
}
|
|
208
232
|
|
|
233
|
+
function recordPress(view: Window, event: Event): void {
|
|
234
|
+
const {pointerId, clientX, clientY} = event as Partial<PointerEvent>;
|
|
235
|
+
if (typeof pointerId !== 'number') {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
let presses = downPresses.get(view);
|
|
239
|
+
if (event.type === 'pointerup' || event.type === 'pointercancel') {
|
|
240
|
+
presses?.delete(pointerId);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (
|
|
244
|
+
(event.type !== 'pointerdown' &&
|
|
245
|
+
!(event.type === 'pointermove' && presses?.has(pointerId) === true)) ||
|
|
246
|
+
typeof clientX !== 'number' ||
|
|
247
|
+
typeof clientY !== 'number'
|
|
248
|
+
) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (presses == null) {
|
|
252
|
+
presses = new Map();
|
|
253
|
+
downPresses.set(view, presses);
|
|
254
|
+
}
|
|
255
|
+
presses.set(pointerId, {x: clientX, y: clientY});
|
|
256
|
+
}
|
|
257
|
+
|
|
209
258
|
function report(error: unknown): void {
|
|
210
259
|
if (typeof globalThis.reportError === 'function') {
|
|
211
260
|
globalThis.reportError(error);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file moduleLoader.ts
|
|
5
|
+
* @input A function that imports a module on demand
|
|
6
|
+
* @output Exports `createModuleLoader`: one shared load of that module, and
|
|
7
|
+
* the module once it has loaded
|
|
8
|
+
* @position Internal utility. A component that loads a module before it is
|
|
9
|
+
* needed renders the loaded module directly, with no suspended render, so
|
|
10
|
+
* React does not hold back what it shows.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** One module, loaded once on demand. Internal. */
|
|
14
|
+
export interface ModuleLoader<T> {
|
|
15
|
+
/**
|
|
16
|
+
* Loads the module, or returns the load already running or done. A failed
|
|
17
|
+
* load is not kept: the next call asks the module loader again (a loader
|
|
18
|
+
* that retries then loads it; a browser does not fetch a native module again
|
|
19
|
+
* once its import failed).
|
|
20
|
+
*/
|
|
21
|
+
load(): Promise<T>;
|
|
22
|
+
/** The module once it has loaded, else null. */
|
|
23
|
+
loaded(): T | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function createModuleLoader<T>(
|
|
27
|
+
importModule: () => Promise<T>,
|
|
28
|
+
): ModuleLoader<T> {
|
|
29
|
+
let module: T | null = null;
|
|
30
|
+
let pending: Promise<T> | null = null;
|
|
31
|
+
return {
|
|
32
|
+
async load() {
|
|
33
|
+
pending ??= importModule().then(
|
|
34
|
+
loadedModule => {
|
|
35
|
+
module = loadedModule;
|
|
36
|
+
return loadedModule;
|
|
37
|
+
},
|
|
38
|
+
(error: unknown) => {
|
|
39
|
+
pending = null;
|
|
40
|
+
throw error;
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
return pending;
|
|
44
|
+
},
|
|
45
|
+
loaded: () => module,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file pressFeedback.ts
|
|
5
5
|
* @input The press state machine (pressGesture.ts), the menu-press and
|
|
6
|
-
* press-group markers
|
|
7
|
-
*
|
|
6
|
+
* press-group markers and the scroll-view test (scrollView.ts). Also the
|
|
7
|
+
* input clock (inputAge.ts) and the document's pointer, keyboard, scroll
|
|
8
|
+
* and visibility events
|
|
8
9
|
* @output PRESSABLE_ATTRIBUTE, PRESSED_ATTRIBUTE, pressableProps,
|
|
9
10
|
* pressFadeMs, installPressFeedback, cancelPress and installBoxHold
|
|
10
11
|
* @position The DOM half of the touch press model. usePressFeedback installs
|
|
@@ -28,8 +29,9 @@
|
|
|
28
29
|
//
|
|
29
30
|
// A finger waits only inside a scroller. Outside one, a surface highlights in
|
|
30
31
|
// the frame the finger lands, as a UIControl does. Inside one, it waits the
|
|
31
|
-
// content-touch delay, because the touch can become a scroll.
|
|
32
|
-
//
|
|
32
|
+
// content-touch delay, because the touch can become a scroll. The delay counts
|
|
33
|
+
// from the touch's own timestamp, so a late listener does not add to it. Rows
|
|
34
|
+
// follow the same rule.
|
|
33
35
|
//
|
|
34
36
|
// A surface's hold does nothing, so it keeps the browser's long-press text
|
|
35
37
|
// selection (AST-094). Only an element whose hold does something suppresses
|
|
@@ -51,6 +53,7 @@ import {reducedMotionFadeConsts} from '../motion/reducedMotion.stylex';
|
|
|
51
53
|
import {parseMotionRoleValue} from '../motion/roles';
|
|
52
54
|
import {subscribeInput} from './inputStream';
|
|
53
55
|
import {isInsideScrollView} from './scrollView';
|
|
56
|
+
import {msSinceInput} from './inputAge';
|
|
54
57
|
import {TOUCH_QUERY} from './touchPresentation';
|
|
55
58
|
import {holdsPressThroughDrag} from '../privateAttributes/pressHoldsDrag.stylex';
|
|
56
59
|
import {isTrackedByGroup} from '../privateAttributes/pressGroupItem.stylex';
|
|
@@ -329,7 +332,7 @@ function clearTimer(slot: Slot): void {
|
|
|
329
332
|
* - The same during the fade strands `fading` and the tracking slot, which
|
|
330
333
|
* holds an element that a virtualized list may have unmounted.
|
|
331
334
|
*/
|
|
332
|
-
function apply(slot: Slot, step: PressStep): void {
|
|
335
|
+
function apply(slot: Slot, step: PressStep, sinceEventMs = 0): void {
|
|
333
336
|
const live = slot.live;
|
|
334
337
|
if (live == null) {
|
|
335
338
|
return;
|
|
@@ -368,8 +371,13 @@ function apply(slot: Slot, step: PressStep): void {
|
|
|
368
371
|
} else {
|
|
369
372
|
// A TIMER, never `requestAnimationFrame`: iOS throttles frame callbacks
|
|
370
373
|
// while a scroll runs, so a frame-based delay would fire late, after the
|
|
371
|
-
// scroll, and paint a control nobody is pressing any more.
|
|
372
|
-
|
|
374
|
+
// scroll, and paint a control nobody is pressing any more. The onset
|
|
375
|
+
// counts from the touch, so the time the listener waited comes off it.
|
|
376
|
+
const delay =
|
|
377
|
+
kind === 'onset'
|
|
378
|
+
? Math.max(0, TIMER_MS.onset - sinceEventMs)
|
|
379
|
+
: TIMER_MS[kind];
|
|
380
|
+
const timer = setTimeout(fire, delay);
|
|
373
381
|
live.timer = () => clearTimeout(timer);
|
|
374
382
|
}
|
|
375
383
|
}
|
|
@@ -606,6 +614,7 @@ function onPointerDown(event: PointerEvent): void {
|
|
|
606
614
|
y: event.clientY,
|
|
607
615
|
delayed: isInsideScrollView(element),
|
|
608
616
|
}),
|
|
617
|
+
msSinceInput(event.timeStamp, event),
|
|
609
618
|
);
|
|
610
619
|
}
|
|
611
620
|
|