@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
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file listLayoutUpdates.ts
|
|
7
|
+
* @input A List's element, its `animatedLayout` handle and the one
|
|
8
|
+
* size-change module (motion/animatedLayout.ts)
|
|
9
|
+
* @output `useListLayoutUpdates`, which reports each row inserted, removed or
|
|
10
|
+
* moved between two renders to the handle, and `keepPresentation`, for a
|
|
11
|
+
* row that leaves the list
|
|
12
|
+
* @position Internal. List calls it with its `animatedLayout` prop.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update List/List.tsx, List/ListItem.tsx and
|
|
15
|
+
* List/__tests__/ListUpdates.interaction.browser.spec.ts.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// - The module exits only rows it measured, so `measure` reports each row in
|
|
19
|
+
// view. It also reports the last row, so content after the list glides when
|
|
20
|
+
// no row is in view.
|
|
21
|
+
// - The module's walk reads rows only within its band around the visible
|
|
22
|
+
// part, so a long list's far rows are never read. With one row in view and
|
|
23
|
+
// the last row far from it, an insert above the last row moves it at once.
|
|
24
|
+
// - Of two rows that cross, the one with the longer glide rides above. The
|
|
25
|
+
// list's surface is behind it, as an opaque UIKit cell passes over its
|
|
26
|
+
// neighbors.
|
|
27
|
+
// - A row without an `itemKey` has no identity, so its own change lands at
|
|
28
|
+
// once. It still glides when a keyed row's change moves it.
|
|
29
|
+
|
|
30
|
+
import {useCallback, useRef, type RefObject} from 'react';
|
|
31
|
+
import {useIsomorphicLayoutEffect} from '../hooks/useIsomorphicLayoutEffect';
|
|
32
|
+
import {
|
|
33
|
+
holdLayoutExit,
|
|
34
|
+
landLayoutGlideSideways,
|
|
35
|
+
playLayoutChange,
|
|
36
|
+
reportLayoutChange,
|
|
37
|
+
type AnimatedLayout,
|
|
38
|
+
type LayoutChange,
|
|
39
|
+
} from '../motion/animatedLayout';
|
|
40
|
+
import {itemKeyOf} from '../privateAttributes/itemKey.stylex';
|
|
41
|
+
import {isLeaving, markLeaving} from '../privateAttributes/leaving.stylex';
|
|
42
|
+
import {markTravelling} from '../privateAttributes/travelling.stylex';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The rows each list reported for the commit in progress, the only rows that
|
|
46
|
+
* can exit. A row that leaves keeps what it showed on screen for its exit
|
|
47
|
+
* (`keepPresentation`) only when its list reported it.
|
|
48
|
+
*/
|
|
49
|
+
const reportedRows = new WeakMap<Element, ReadonlySet<Element>>();
|
|
50
|
+
|
|
51
|
+
/** Whether `row`'s list reported it for the commit in progress. */
|
|
52
|
+
export function isReportedRow(row: Element): boolean {
|
|
53
|
+
const list = row.parentElement;
|
|
54
|
+
return list != null && (reportedRows.get(list)?.has(row) ?? false);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Moves under half a pixel are layout noise, not updates. */
|
|
58
|
+
const MIN_MOVE_PX = 0.5;
|
|
59
|
+
|
|
60
|
+
/** What `measure` saw, for the layout effect of the same commit. */
|
|
61
|
+
interface Measured {
|
|
62
|
+
/** Every keyed row, by its key, in order. */
|
|
63
|
+
readonly rows: ReadonlyMap<string, HTMLElement>;
|
|
64
|
+
readonly order: ReadonlyArray<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Where each row near the visible part was (its top), the indices from
|
|
67
|
+
* `near[0]` to `near[1]` of `order`: only those can glide in view.
|
|
68
|
+
*/
|
|
69
|
+
readonly tops: ReadonlyMap<string, number>;
|
|
70
|
+
readonly near: readonly [number, number] | null;
|
|
71
|
+
/** The rows reported to the module, the only ones whose exit it holds. */
|
|
72
|
+
readonly reported: ReadonlySet<HTMLElement>;
|
|
73
|
+
readonly changes: ReadonlyArray<LayoutChange>;
|
|
74
|
+
/** Near rows with a translation of their own, read before the commit. */
|
|
75
|
+
readonly translations: ReadonlyArray<Translation>;
|
|
76
|
+
/** The list's keyed and leaving rows before the commit, in order. */
|
|
77
|
+
readonly sequence: ReadonlyArray<HTMLElement>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The first and last indices of `rows` whose box meets the vertical span from
|
|
82
|
+
* `start` to `end`, in viewport pixels, or null when none does. Rows sit in
|
|
83
|
+
* order down the list, so halving finds them by reading a few rows' places,
|
|
84
|
+
* never every row's.
|
|
85
|
+
*/
|
|
86
|
+
function rowsMeeting(
|
|
87
|
+
rows: ReadonlyArray<HTMLElement>,
|
|
88
|
+
start: number,
|
|
89
|
+
end: number,
|
|
90
|
+
): readonly [number, number] | null {
|
|
91
|
+
let low = 0;
|
|
92
|
+
let high = rows.length;
|
|
93
|
+
while (low < high) {
|
|
94
|
+
const middle = (low + high) >> 1;
|
|
95
|
+
if (rows[middle].getBoundingClientRect().bottom > start) {
|
|
96
|
+
high = middle;
|
|
97
|
+
} else {
|
|
98
|
+
low = middle + 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const first = low;
|
|
102
|
+
high = rows.length;
|
|
103
|
+
while (low < high) {
|
|
104
|
+
const middle = (low + high) >> 1;
|
|
105
|
+
if (rows[middle].getBoundingClientRect().top < end) {
|
|
106
|
+
low = middle + 1;
|
|
107
|
+
} else {
|
|
108
|
+
high = middle;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const last = low - 1;
|
|
112
|
+
return first <= last ? [first, last] : null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The list's rows that have an item key, by it, in order. A row without one
|
|
117
|
+
* has no identity to match across renders: its own insertion, removal or
|
|
118
|
+
* move is never reported, and changes at once.
|
|
119
|
+
*/
|
|
120
|
+
function keyedRows(list: HTMLElement): Map<string, HTMLElement> {
|
|
121
|
+
const rows = new Map<string, HTMLElement>();
|
|
122
|
+
for (const child of list.children) {
|
|
123
|
+
if (!(child instanceof HTMLElement) || isLeaving(child)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const key = itemKeyOf(child);
|
|
127
|
+
if (key != null) {
|
|
128
|
+
rows.set(key, child);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return rows;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The inline styles that a leaving row and its parts showed as they left,
|
|
136
|
+
* such as a swipe's travel. `keepPresentation` records them, and the row's
|
|
137
|
+
* exit writes them back.
|
|
138
|
+
*/
|
|
139
|
+
const keptStyles = new WeakMap<
|
|
140
|
+
HTMLElement,
|
|
141
|
+
ReadonlyArray<readonly [HTMLElement | SVGElement, string]>
|
|
142
|
+
>();
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Records what the Web Animations running on `row` and its parts present (a
|
|
146
|
+
* swipe's travel, on the compositor) as inline styles. A removed row is
|
|
147
|
+
* detached from the document, which drops those animations. Its exit puts it
|
|
148
|
+
* back and writes the record, so it shows what was on screen when it left.
|
|
149
|
+
* ListItem calls it as React detaches the row, while the row is still in the
|
|
150
|
+
* document. React also detaches the ref of a row that stays, when the ref
|
|
151
|
+
* changes. So nothing stays written. Animations on pseudo-elements, or that
|
|
152
|
+
* cannot write their values, are left alone.
|
|
153
|
+
*/
|
|
154
|
+
export function keepPresentation(row: HTMLElement): void {
|
|
155
|
+
if (typeof row.getAnimations !== 'function') {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const parts = [row, ...row.querySelectorAll<HTMLElement | SVGElement>('*')];
|
|
159
|
+
const before = parts.map(part => part.getAttribute('style'));
|
|
160
|
+
// commitStyles is the only way to read what an animation presents. It
|
|
161
|
+
// writes the values into the target's style, so each part gets its own
|
|
162
|
+
// style back once the values are read.
|
|
163
|
+
for (const animation of row.getAnimations({subtree: true})) {
|
|
164
|
+
try {
|
|
165
|
+
animation.commitStyles();
|
|
166
|
+
} catch {
|
|
167
|
+
// A pseudo-element's or an unrendered target's animation: nothing to
|
|
168
|
+
// keep.
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// The parts' owners clean up after the row does, and may reset its style.
|
|
172
|
+
// A swipe gives its row back its own translation. The record keeps it.
|
|
173
|
+
const styled: (readonly [HTMLElement | SVGElement, string])[] = [];
|
|
174
|
+
parts.forEach((part, index) => {
|
|
175
|
+
if (part.style.length > 0) {
|
|
176
|
+
styled.push([part, part.style.cssText]);
|
|
177
|
+
}
|
|
178
|
+
const style = before[index];
|
|
179
|
+
if (part.getAttribute('style') !== style) {
|
|
180
|
+
if (style == null) {
|
|
181
|
+
part.removeAttribute('style');
|
|
182
|
+
} else {
|
|
183
|
+
// Through the CSSOM, which a strict Content Security Policy allows.
|
|
184
|
+
part.style.cssText = style;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
keptStyles.set(row, styled);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The rows of `list` in order: its keyed rows and the rows still leaving. Each
|
|
193
|
+
* leaving row's place is counted against the keyed rows around it.
|
|
194
|
+
*/
|
|
195
|
+
function rowSequence(list: HTMLElement): HTMLElement[] {
|
|
196
|
+
const rows: HTMLElement[] = [];
|
|
197
|
+
for (const child of list.children) {
|
|
198
|
+
if (
|
|
199
|
+
child instanceof HTMLElement &&
|
|
200
|
+
(isLeaving(child) || itemKeyOf(child) != null)
|
|
201
|
+
) {
|
|
202
|
+
rows.push(child);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return rows;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Marks a row that left as leaving. The exit makes it inert. Until then it is
|
|
210
|
+
* hidden from assistive technology, so no later commit counts it as a row.
|
|
211
|
+
*/
|
|
212
|
+
function markLeavingRow(element: HTMLElement): void {
|
|
213
|
+
markLeaving(element);
|
|
214
|
+
element.setAttribute('aria-hidden', 'true');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* After a row that left is back in the document, its parts' animations would
|
|
219
|
+
* apply again over what they showed as it left. This stops them, so it shows
|
|
220
|
+
* what was on screen.
|
|
221
|
+
*/
|
|
222
|
+
function showAsItLeft(element: HTMLElement): void {
|
|
223
|
+
if (typeof element.getAnimations === 'function') {
|
|
224
|
+
for (const animation of element.getAnimations({subtree: true})) {
|
|
225
|
+
animation.cancel();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
for (const [part, cssText] of keptStyles.get(element) ?? []) {
|
|
229
|
+
part.style.cssText = cssText;
|
|
230
|
+
}
|
|
231
|
+
keptStyles.delete(element);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Puts `rows` right before `anchor`, or at the list's end when it is null, in
|
|
236
|
+
* their order. A row already in its place stays where it is.
|
|
237
|
+
*/
|
|
238
|
+
function placeBefore(
|
|
239
|
+
list: HTMLElement,
|
|
240
|
+
rows: ReadonlyArray<HTMLElement>,
|
|
241
|
+
anchor: HTMLElement | null,
|
|
242
|
+
): void {
|
|
243
|
+
let next = anchor;
|
|
244
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
245
|
+
const row = rows[index];
|
|
246
|
+
const before =
|
|
247
|
+
next == null ? list.lastElementChild : next.previousElementSibling;
|
|
248
|
+
if (before !== row) {
|
|
249
|
+
list.insertBefore(row, next);
|
|
250
|
+
}
|
|
251
|
+
next = row;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** What `readTranslation` reads off a row, before anything is written. */
|
|
256
|
+
interface Translation {
|
|
257
|
+
readonly view: Window & typeof globalThis;
|
|
258
|
+
readonly row: HTMLElement;
|
|
259
|
+
readonly x: number;
|
|
260
|
+
readonly y: number;
|
|
261
|
+
readonly children: ReadonlyArray<HTMLElement | SVGElement>;
|
|
262
|
+
readonly transforms: ReadonlyArray<string>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Reads a row's own translation, such as a swipe's, and its children's
|
|
267
|
+
* transforms before the commit. Returns null when the row has none.
|
|
268
|
+
*/
|
|
269
|
+
function readTranslation(row: HTMLElement): Translation | null {
|
|
270
|
+
const view = row.ownerDocument.defaultView;
|
|
271
|
+
if (view == null || typeof view.DOMMatrix !== 'function') {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
const transform = view.getComputedStyle(row).transform;
|
|
275
|
+
if (transform === '' || transform === 'none') {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
const own = new view.DOMMatrix(transform);
|
|
279
|
+
if (
|
|
280
|
+
!own.is2D ||
|
|
281
|
+
own.a !== 1 ||
|
|
282
|
+
own.b !== 0 ||
|
|
283
|
+
own.c !== 0 ||
|
|
284
|
+
own.d !== 1 ||
|
|
285
|
+
(own.e === 0 && own.f === 0)
|
|
286
|
+
) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
const children = [...row.children].filter(
|
|
290
|
+
(child): child is HTMLElement | SVGElement =>
|
|
291
|
+
child instanceof view.HTMLElement || child instanceof view.SVGElement,
|
|
292
|
+
);
|
|
293
|
+
return {
|
|
294
|
+
view,
|
|
295
|
+
row,
|
|
296
|
+
x: own.e,
|
|
297
|
+
y: own.f,
|
|
298
|
+
children,
|
|
299
|
+
// A translation composes the same way whatever a child's transform
|
|
300
|
+
// origin.
|
|
301
|
+
transforms: children.map(child => view.getComputedStyle(child).transform),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Moves a row's own translation onto its children. The row's box then lies
|
|
307
|
+
* where the row lies in the list, while it shows the same thing. A row that
|
|
308
|
+
* leaves exits on that box, in view. Its exit's clip keeps the action that
|
|
309
|
+
* a swipe uncovered and cuts the content that the swipe carried away. With
|
|
310
|
+
* the translation on the row, a row that a swipe carried out of the list's
|
|
311
|
+
* box would lie out of view.
|
|
312
|
+
*/
|
|
313
|
+
function settleTranslation({
|
|
314
|
+
view,
|
|
315
|
+
row,
|
|
316
|
+
x,
|
|
317
|
+
y,
|
|
318
|
+
children,
|
|
319
|
+
transforms,
|
|
320
|
+
}: Translation): void {
|
|
321
|
+
row.style.setProperty('transform', 'none');
|
|
322
|
+
children.forEach((child, index) => {
|
|
323
|
+
const current = transforms[index];
|
|
324
|
+
const shift = new view.DOMMatrix().translate(x, y);
|
|
325
|
+
const moved =
|
|
326
|
+
current === '' || current === 'none'
|
|
327
|
+
? shift
|
|
328
|
+
: shift.multiply(new view.DOMMatrix(current));
|
|
329
|
+
child.style.setProperty('transform', moved.toString());
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Marks each row that crosses another on the longer of the two glides, for
|
|
335
|
+
* the length of its glide, so it rides above. It reads the glides once the
|
|
336
|
+
* module has started them, after the commit's layout effects. It marks the
|
|
337
|
+
* rows then too, after the module has read the commit's layout. One pass each
|
|
338
|
+
* way over the rows near the visible part, in their old order, finds the rows
|
|
339
|
+
* that cross any other. Only those are compared, so a removal or an insert,
|
|
340
|
+
* which crosses nothing, costs the two passes.
|
|
341
|
+
*/
|
|
342
|
+
function markCrossings(
|
|
343
|
+
measured: Measured,
|
|
344
|
+
now: ReadonlyMap<string, HTMLElement>,
|
|
345
|
+
): void {
|
|
346
|
+
const {near, order, tops} = measured;
|
|
347
|
+
if (near == null) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const rows: {element: HTMLElement; from: number; to: number}[] = [];
|
|
351
|
+
for (let index = near[0]; index <= near[1]; index++) {
|
|
352
|
+
const key = order[index];
|
|
353
|
+
const from = tops.get(key);
|
|
354
|
+
const element = now.get(key);
|
|
355
|
+
if (from != null && element != null) {
|
|
356
|
+
rows.push({element, from, to: element.getBoundingClientRect().top});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// A row crosses another when an earlier row ends below it, or a later row
|
|
360
|
+
// ends above it.
|
|
361
|
+
const crosses = rows.map(() => false);
|
|
362
|
+
let lowest = -Infinity;
|
|
363
|
+
for (let index = 0; index < rows.length; index++) {
|
|
364
|
+
crosses[index] = lowest > rows[index].to;
|
|
365
|
+
lowest = Math.max(lowest, rows[index].to);
|
|
366
|
+
}
|
|
367
|
+
let highest = Infinity;
|
|
368
|
+
for (let index = rows.length - 1; index >= 0; index--) {
|
|
369
|
+
crosses[index] ||= highest < rows[index].to;
|
|
370
|
+
highest = Math.min(highest, rows[index].to);
|
|
371
|
+
}
|
|
372
|
+
const crossing = rows.filter((_, index) => crosses[index]);
|
|
373
|
+
const raised = new Set<HTMLElement>();
|
|
374
|
+
for (let a = 0; a < crossing.length; a++) {
|
|
375
|
+
for (let b = a + 1; b < crossing.length; b++) {
|
|
376
|
+
const upper = crossing[a];
|
|
377
|
+
const lower = crossing[b];
|
|
378
|
+
if (upper.to > lower.to) {
|
|
379
|
+
// On a tie, the row gliding up rides above.
|
|
380
|
+
const rider =
|
|
381
|
+
Math.abs(upper.to - upper.from) > Math.abs(lower.to - lower.from)
|
|
382
|
+
? upper
|
|
383
|
+
: lower;
|
|
384
|
+
if (Math.abs(rider.to - rider.from) >= MIN_MOVE_PX) {
|
|
385
|
+
raised.add(rider.element);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const travelling = [...raised];
|
|
391
|
+
if (travelling.length === 0) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
// After the module's own microtask has read the layout and started the
|
|
395
|
+
// glides. A mark set before that read would make it lay the page out again.
|
|
396
|
+
queueMicrotask(() => {
|
|
397
|
+
for (const element of travelling) {
|
|
398
|
+
const glide =
|
|
399
|
+
typeof element.getAnimations === 'function'
|
|
400
|
+
? element.getAnimations().at(-1)
|
|
401
|
+
: undefined;
|
|
402
|
+
if (glide != null) {
|
|
403
|
+
const end = markTravelling(element);
|
|
404
|
+
glide.finished.then(end, end);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Reports the list's row changes to `animatedLayout`. Returns the callback
|
|
412
|
+
* that measures them, which LayoutChangeSnapshot calls before each commit.
|
|
413
|
+
* Its layout effect plays them after the commit.
|
|
414
|
+
*/
|
|
415
|
+
export function useListLayoutUpdates(
|
|
416
|
+
listRef: RefObject<HTMLElement | null>,
|
|
417
|
+
animatedLayout: AnimatedLayout | undefined,
|
|
418
|
+
): () => void {
|
|
419
|
+
const measuredRef = useRef<Measured | null>(null);
|
|
420
|
+
const measure = useCallback(() => {
|
|
421
|
+
measuredRef.current = null;
|
|
422
|
+
const list = listRef.current;
|
|
423
|
+
if (list == null || animatedLayout == null) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
const rows = keyedRows(list);
|
|
427
|
+
if (rows.size === 0) {
|
|
428
|
+
// No keyed row yet: the list's last child, or the list while it is
|
|
429
|
+
// empty, stands in. A first keyed row then enters, and the content
|
|
430
|
+
// after the list glides.
|
|
431
|
+
const last = list.lastElementChild;
|
|
432
|
+
const target = last instanceof HTMLElement ? last : list;
|
|
433
|
+
const change = reportLayoutChange(animatedLayout, () => target);
|
|
434
|
+
change.measureBefore();
|
|
435
|
+
measuredRef.current = {
|
|
436
|
+
rows,
|
|
437
|
+
order: [],
|
|
438
|
+
tops: new Map(),
|
|
439
|
+
near: null,
|
|
440
|
+
reported: new Set([target]),
|
|
441
|
+
changes: [change],
|
|
442
|
+
translations: [],
|
|
443
|
+
sequence: rowSequence(list),
|
|
444
|
+
};
|
|
445
|
+
reportedRows.set(list, measuredRef.current.reported);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
const order = [...rows.keys()];
|
|
449
|
+
const elements = [...rows.values()];
|
|
450
|
+
const height = list.ownerDocument.defaultView?.innerHeight ?? 0;
|
|
451
|
+
// The rows near the visible part (a viewport's height above and below
|
|
452
|
+
// it): only they can glide in view, so only their places are read.
|
|
453
|
+
const near = rowsMeeting(elements, -height, 2 * height);
|
|
454
|
+
const translations: Translation[] = [];
|
|
455
|
+
const tops = new Map<string, number>();
|
|
456
|
+
if (near != null) {
|
|
457
|
+
// One pass reads every near row's translation and place. A row's place
|
|
458
|
+
// is its box without its own translation. The measurement writes
|
|
459
|
+
// nothing, so no read here lays the page out again.
|
|
460
|
+
for (let index = near[0]; index <= near[1]; index++) {
|
|
461
|
+
const translation = readTranslation(elements[index]);
|
|
462
|
+
const {top} = elements[index].getBoundingClientRect();
|
|
463
|
+
tops.set(order[index], top - (translation?.y ?? 0));
|
|
464
|
+
if (translation != null) {
|
|
465
|
+
translations.push(translation);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
// The module exits only rows it measured, so every row in view is
|
|
470
|
+
// reported. The last row is reported too, so content after the list
|
|
471
|
+
// glides when no row is in view.
|
|
472
|
+
const shown = rowsMeeting(elements, 0, height);
|
|
473
|
+
const targets: HTMLElement[] = [];
|
|
474
|
+
if (shown != null) {
|
|
475
|
+
for (let index = shown[0]; index <= shown[1]; index++) {
|
|
476
|
+
targets.push(elements[index]);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (shown == null || shown[1] !== elements.length - 1) {
|
|
480
|
+
targets.push(elements[elements.length - 1]);
|
|
481
|
+
}
|
|
482
|
+
const changes = targets.map(target => {
|
|
483
|
+
const change = reportLayoutChange(animatedLayout, () => target);
|
|
484
|
+
change.measureBefore();
|
|
485
|
+
return change;
|
|
486
|
+
});
|
|
487
|
+
measuredRef.current = {
|
|
488
|
+
rows,
|
|
489
|
+
order,
|
|
490
|
+
tops,
|
|
491
|
+
near,
|
|
492
|
+
reported: new Set(targets),
|
|
493
|
+
changes,
|
|
494
|
+
translations,
|
|
495
|
+
sequence: rowSequence(list),
|
|
496
|
+
};
|
|
497
|
+
reportedRows.set(list, measuredRef.current.reported);
|
|
498
|
+
}, [animatedLayout, listRef]);
|
|
499
|
+
|
|
500
|
+
// Syncs with external systems. One is the shared size-change module's batch
|
|
501
|
+
// for the handle's area, measured before this commit, which this plays. The
|
|
502
|
+
// other is the rows reported for the commit, which a leaving row reads as
|
|
503
|
+
// it unmounts, before this runs.
|
|
504
|
+
useIsomorphicLayoutEffect(() => {
|
|
505
|
+
const measured = measuredRef.current;
|
|
506
|
+
measuredRef.current = null;
|
|
507
|
+
const list = listRef.current;
|
|
508
|
+
if (list != null) {
|
|
509
|
+
reportedRows.delete(list);
|
|
510
|
+
}
|
|
511
|
+
if (measured == null || list == null || animatedLayout == null) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const now = keyedRows(list);
|
|
515
|
+
const order = [...now.keys()];
|
|
516
|
+
if (
|
|
517
|
+
order.length === measured.order.length &&
|
|
518
|
+
order.every((key, index) => key === measured.order[index])
|
|
519
|
+
) {
|
|
520
|
+
// The same rows in the same order: nothing to play (the measurement
|
|
521
|
+
// is dropped by the next frame).
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
// Each row that left, and each row still leaving, keeps its place: after
|
|
525
|
+
// as many staying rows as came before it. React moves only its own rows,
|
|
526
|
+
// so this also keeps a leaving row in place when the rows around it move.
|
|
527
|
+
const current = [...now.values()];
|
|
528
|
+
const staying = new Set(current);
|
|
529
|
+
const places = new Map<HTMLElement | null, HTMLElement[]>();
|
|
530
|
+
const leaving: HTMLElement[] = [];
|
|
531
|
+
let before = 0;
|
|
532
|
+
for (const element of measured.sequence) {
|
|
533
|
+
if (staying.has(element)) {
|
|
534
|
+
before += 1;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (!isLeaving(element)) {
|
|
538
|
+
// Only a row the module measured can exit; any other went with the
|
|
539
|
+
// commit (it was out of view).
|
|
540
|
+
if (!measured.reported.has(element)) {
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
markLeavingRow(element);
|
|
544
|
+
leaving.push(element);
|
|
545
|
+
}
|
|
546
|
+
const anchor = current[before] ?? null;
|
|
547
|
+
places.set(anchor, [...(places.get(anchor) ?? []), element]);
|
|
548
|
+
}
|
|
549
|
+
for (const [anchor, rows] of places) {
|
|
550
|
+
placeBefore(list, rows, anchor);
|
|
551
|
+
}
|
|
552
|
+
for (const element of leaving) {
|
|
553
|
+
showAsItLeft(element);
|
|
554
|
+
}
|
|
555
|
+
for (const change of measured.changes) {
|
|
556
|
+
change.animate();
|
|
557
|
+
}
|
|
558
|
+
// A row that leaves exits on its own box, in view: its translation moves
|
|
559
|
+
// onto its children before its exit starts. The commit has already
|
|
560
|
+
// changed the layout, so this costs no layout of its own.
|
|
561
|
+
const settled: HTMLElement[] = [];
|
|
562
|
+
for (const translation of measured.translations) {
|
|
563
|
+
if (leaving.includes(translation.row)) {
|
|
564
|
+
settleTranslation(translation);
|
|
565
|
+
settled.push(translation.row);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
if (settled.length > 0) {
|
|
569
|
+
// The module read the row's old place with the translation on it, so
|
|
570
|
+
// its glide adds that translation to the row's move in the list. The
|
|
571
|
+
// row already shows where it showed, so before the frame paints, the
|
|
572
|
+
// glide keeps only its move in the list.
|
|
573
|
+
queueMicrotask(() => {
|
|
574
|
+
for (const row of settled) {
|
|
575
|
+
landLayoutGlideSideways(row);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
for (const element of leaving) {
|
|
580
|
+
if (!holdLayoutExit(animatedLayout, element, () => element.remove())) {
|
|
581
|
+
// An exit the module does not hold (out of view, Reduce Motion with
|
|
582
|
+
// a fine pointer): the row goes now, before this frame paints.
|
|
583
|
+
element.remove();
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
// A row that appeared in view enters (the module plays an entrance only
|
|
587
|
+
// in view): the rows in view are found by halving again.
|
|
588
|
+
const height = list.ownerDocument.defaultView?.innerHeight ?? 0;
|
|
589
|
+
const shown = rowsMeeting(current, 0, height);
|
|
590
|
+
if (shown != null) {
|
|
591
|
+
for (let index = shown[0]; index <= shown[1]; index++) {
|
|
592
|
+
const element = current[index];
|
|
593
|
+
const key = itemKeyOf(element);
|
|
594
|
+
if (key != null && !measured.rows.has(key)) {
|
|
595
|
+
playLayoutChange(animatedLayout, element);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
markCrossings(measured, now);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
return measure;
|
|
603
|
+
}
|