@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
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* `@astryxdesign/core/internal/selectable-card`. It is not public API, so
|
|
12
12
|
* SelectableCard's public props do not change.
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
15
15
|
|
|
16
16
|
/** The native input a group gives one card. */
|
|
17
17
|
|
|
18
18
|
/** Without a provider, a card renders its own checkbox. */
|
|
19
|
-
export const SelectableCardInputContext =
|
|
19
|
+
export const SelectableCardInputContext = createSharedContext('SelectableCardInputContext', 1, null);
|
|
20
20
|
SelectableCardInputContext.displayName = 'SelectableCardInputContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectorRowLayoutContext.d.ts","sourceRoot":"","sources":["../../src/Selector/SelectorRowLayoutContext.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErD,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"SelectorRowLayoutContext.d.ts","sourceRoot":"","sources":["../../src/Selector/SelectorRowLayoutContext.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAErD,eAAO,MAAM,wBAAwB,4CAKlC,CAAC;AAGJ;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAExD"}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* depend on it — a node that ignores this context still cannot grow the row.
|
|
16
16
|
*/
|
|
17
17
|
import { use } from 'react';
|
|
18
|
-
import { createLayerScopedContext
|
|
19
|
-
export const SelectorRowLayoutContext =
|
|
18
|
+
import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
19
|
+
export const SelectorRowLayoutContext = createLayerScopedContext('SelectorRowLayoutContext', 1, 'stacked');
|
|
20
20
|
SelectorRowLayoutContext.displayName = 'SelectorRowLayoutContext';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -19,9 +19,10 @@ import type { ElementSize } from '../SizeContext/SizeContext.js';
|
|
|
19
19
|
export interface SideNavCollapseButtonProps extends BaseProps<HTMLButtonElement> {
|
|
20
20
|
ref?: React.Ref<HTMLButtonElement>;
|
|
21
21
|
/**
|
|
22
|
-
* The same controlled `collapsible` config given to SideNav
|
|
23
|
-
* (`
|
|
24
|
-
* rendered outside the sidenav, where collapse context
|
|
22
|
+
* The same controlled `collapsible` config given to SideNav, with all its
|
|
23
|
+
* keys (`isCollapsed` and `onCollapsedChange` are required). Needed only
|
|
24
|
+
* when the button is rendered outside the sidenav, where collapse context
|
|
25
|
+
* cannot reach it.
|
|
25
26
|
*/
|
|
26
27
|
collapsible?: SideNavControlledCollapsible;
|
|
27
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavCollapseButton.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAAmB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAK9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAyC5D,MAAM,WAAW,0BAA2B,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC9E,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC
|
|
1
|
+
{"version":3,"file":"SideNavCollapseButton.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAAmB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAK9D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAyC5D,MAAM,WAAW,0BAA2B,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC9E,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAE3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,+BAA+B,GAAG,IAAI,CAAC,CAAC;IAEpE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,GAAG,EACH,WAAW,EACX,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,GAAG,KAAK,EACT,EAAE,0BAA0B,4BA+D5B;yBAxEe,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavCollapseContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideNavCollapseContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavCollapseContext.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,kCAAkC;IAClC,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,mDAAmD;AACnD,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC9C,gBAAgB,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAC;CACrD;AAED,eAAO,MAAM,sBAAsB,+CAQlC,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,oBAAoB,CAEzD"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file SideNavCollapseContext.ts
|
|
7
|
-
* @input
|
|
7
|
+
* @input createSharedContext, use
|
|
8
8
|
* @output Exports SideNavCollapseContext and useSideNavCollapse hook
|
|
9
9
|
* @position Internal context for sidenav collapse state
|
|
10
10
|
*
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* A button rendered outside the SideNav tree is out of context's reach and
|
|
14
14
|
* takes the controlled `collapsible` config as a prop instead.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { use } from 'react';
|
|
17
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
17
18
|
|
|
18
19
|
/** Object form of SideNav's `collapsible` prop. */
|
|
19
20
|
|
|
@@ -28,7 +29,7 @@ import { createContext, use } from 'react';
|
|
|
28
29
|
* button through props rather than through a ref.
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
|
-
export const SideNavCollapseContext =
|
|
32
|
+
export const SideNavCollapseContext = createSharedContext('SideNavCollapseContext', 1, {
|
|
32
33
|
isCollapsed: false,
|
|
33
34
|
toggle: () => {},
|
|
34
35
|
isCollapsible: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavFocusTargetsContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavFocusTargetsContext.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IACzE,+DAA+D;IAC/D,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"SideNavFocusTargetsContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavFocusTargetsContext.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;IACzE,+DAA+D;IAC/D,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,0BAA0B,qDAKpC,CAAC"}
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
* provides it; SideNavItem registers its row and SideNavCollapseButton,
|
|
12
12
|
* rendered inside the SideNav, registers itself (`component:SideNav` AR3).
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
15
|
-
export const SideNavFocusTargetsContext =
|
|
14
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
15
|
+
export const SideNavFocusTargetsContext = createSharedContext('SideNavFocusTargetsContext', 1, null);
|
|
16
16
|
SideNavFocusTargetsContext.displayName = 'SideNavFocusTargetsContext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavItem.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"SideNavItem.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAYf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAIrD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAgB,KAAK,WAAW,EAAC,MAAM,iCAAiC,CAAC;AA4UhF,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EACR,OAAO,GACP;QACE,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;KACpD,CAAC;IACN;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,UAAkB,EAClB,UAAkB,EAClB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EAAE,eAAe,EAC5B,IAAW,EACX,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,MAAM,EACN,GAAG,IAAI,EACR,EAAE,gBAAgB,sCA4clB;yBA9de,WAAW"}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* - /apps/storybook/stories/SideNav.stories.tsx
|
|
34
34
|
* - /packages/cli/assets/templates/blocks/components/SideNav/ (showcase blocks)
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
36
|
+
import { use, useCallback, useId, useMemo, useState } from 'react';
|
|
37
37
|
import * as stylex from '@stylexjs/stylex';
|
|
38
38
|
import "../theme/tokens.stylex.js";
|
|
39
39
|
import { colorVars, spacingVars, sizeVars, fontWeightVars, typeScaleVars, durationVars, easeVars, radiusVars } from "../theme/tokens.stylex.js";
|
|
@@ -58,6 +58,7 @@ import { SideNavFocusTargetsContext } from "./SideNavFocusTargetsContext.js";
|
|
|
58
58
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
59
59
|
import english from "../i18n/generated-english/SideNav/SideNavItem.generated.js";
|
|
60
60
|
import { isRenderable } from "../utils/isRenderable.js";
|
|
61
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
61
62
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
62
63
|
registerEnglishFallback(english);
|
|
63
64
|
// =============================================================================
|
|
@@ -186,7 +187,7 @@ const indentStyles = {
|
|
|
186
187
|
* 1 inside one parent, and so on. A collapsed rail's flyout resets it to 0,
|
|
187
188
|
* since the flyout lists a parent's children as its own top level.
|
|
188
189
|
*/
|
|
189
|
-
const SideNavItemDepthContext =
|
|
190
|
+
const SideNavItemDepthContext = createSharedContext('SideNavItemDepthContext', 1, 0);
|
|
190
191
|
SideNavItemDepthContext.displayName = 'SideNavItemDepthContext';
|
|
191
192
|
|
|
192
193
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNavRenderContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavRenderContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideNavRenderContext.d.ts","sourceRoot":"","sources":["../../src/SideNav/SideNavRenderContext.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,iBAAiB,GAC3B,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAErD,eAAO,MAAM,oBAAoB,4CAIhC,CAAC;AAGF;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAExD"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file SideNavRenderContext.ts
|
|
7
|
-
* @input
|
|
7
|
+
* @input createSharedContext, use
|
|
8
8
|
* @output Exports SideNavRenderContext and useSideNavRenderMode hook
|
|
9
9
|
* @position Internal context for controlling SideNav rendering mode
|
|
10
10
|
*
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* - 'topbar': heading + footerIcons only, laid out horizontally (mobile top bar)
|
|
15
15
|
* - 'drawer': children only, skip heading + footerIcons (mobile drawer)
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import { use } from 'react';
|
|
18
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
19
|
+
export const SideNavRenderContext = createSharedContext('SideNavRenderContext', 1, 'default');
|
|
19
20
|
SideNavRenderContext.displayName = 'SideNavRenderContext';
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file railMotion.ts
|
|
3
|
+
* @input The rail's outer element, the animated-layout module's handle,
|
|
4
|
+
* motion and two-state edge reveal (motion/animatedLayout.ts)
|
|
5
|
+
* @output Exports `SideNavShellContext` (what AppShell lends its SideNav),
|
|
6
|
+
* `createRailLayout`, `snapshotRail` and `playRail`: the rail's collapse
|
|
7
|
+
* motion
|
|
8
|
+
* @position Internal to SideNav (`component:SideNav` FR6, DEC-2); AppShell's
|
|
9
|
+
* content area moves through the context (`component:AppShell` FR17)
|
|
10
|
+
*
|
|
11
|
+
* Collapsing or expanding the rail plays one motion on one clock: the
|
|
12
|
+
* theme's move curve, which the animated-layout module plays. The rail is
|
|
13
|
+
* FR9's edge reveal in its inline two-state form, which
|
|
14
|
+
* the module produces (`architecture:react-component-runtime` INV12): layout
|
|
15
|
+
* snaps to the final rail width at once, nothing animates a width, and the
|
|
16
|
+
* module clips the rail's inline-end edge from the width it shows to the new
|
|
17
|
+
* one. A collapse covers the old, expanded rail, held as one transient copy,
|
|
18
|
+
* with the real collapsed rail raised above it; an expand reveals the real
|
|
19
|
+
* rail under the old, collapsed one. In AppShell that edge rides the content
|
|
20
|
+
* column's glide, frame by frame, so the two never part, also when a change
|
|
21
|
+
* interrupts a running one. Every starting clip applies in the commit's
|
|
22
|
+
* layout effect, before the first frame paints. Under Reduce Motion it
|
|
23
|
+
* follows `design:reduced-motion`: opacity only under a coarse primary
|
|
24
|
+
* pointer (DR2), an immediate change otherwise (DR3). Without Web
|
|
25
|
+
* Animations, the change lands at once.
|
|
26
|
+
*
|
|
27
|
+
* What this file adds is the rail's own fades, on the same progress:
|
|
28
|
+
* - A collapse fades the copy's text over the first 40% and the copy over
|
|
29
|
+
* the last 30%, while the real collapsed rail, its icons, fades in over the
|
|
30
|
+
* last 30%, so the real rail, icons only, is all that remains.
|
|
31
|
+
* - An expand fades the real rail's text in over the last 60%, so no label
|
|
32
|
+
* shows at the collapsed width, while the old, collapsed rail fades over
|
|
33
|
+
* the first 60%: the first frame is the frame before the click.
|
|
34
|
+
* - A change made during a running motion starts from what the rail shows:
|
|
35
|
+
* its width, its labels' opacity and its collapsed icons' opacity, so the
|
|
36
|
+
* rail stays continuous.
|
|
37
|
+
*
|
|
38
|
+
* SYNC: When modified, update SideNav.tsx, AppShell.tsx and
|
|
39
|
+
* SideNavRailMotion.test.tsx.
|
|
40
|
+
*/
|
|
1
41
|
import { type AnimatedLayout, type LayoutEdgeHold, type LayoutSwap } from '../motion/animatedLayout.js';
|
|
2
42
|
/** What AppShell lends its SideNav; outside AppShell, nothing. */
|
|
3
43
|
export interface SideNavShell {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"railMotion.d.ts","sourceRoot":"","sources":["../../src/SideNav/railMotion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"railMotion.d.ts","sourceRoot":"","sources":["../../src/SideNav/railMotion.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAGlC,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,6DAA6D;IAC7D,IAAI,IAAI,WAAW,GAAG,IAAI,CAAC;IAC3B,wDAAwD;IACxD,MAAM,IAAI,WAAW,GAAG,IAAI,CAAC;IAC7B,0EAA0E;IAC1E,gBAAgB,IAAI,IAAI,CAAC;IACzB,uEAAuE;IACvE,eAAe,IAAI,MAAM,IAAI,CAAC;IAC9B,wEAAwE;IACxE,WAAW,IAAI,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,mBAAmB,8CAI/B,CAAC;AAGF,uEAAuE;AACvE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,WAAW,GAAG,IAAI,GAC7B,cAAc,CAEhB;AAED,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;CAC3B;AAED,6BAA6B;AAC7B,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,GAAG,IAAI,IAAI,CAAC;IACZ,4DAA4D;IAC5D,KAAK,IAAI,SAAS,GAAG,IAAI,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,WAAW,EAAE,OAAO,GACnB,YAAY,GAAG,IAAI,CAkBrB;AAaD;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,MAAM,EAAE,cAAc,EACtB,MAAM,GAAE,WAAW,GAAG,IAAW,GAChC,UAAU,CAmDZ"}
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
* SYNC: When modified, update SideNav.tsx, AppShell.tsx and
|
|
43
43
|
* SideNavRailMotion.test.tsx.
|
|
44
44
|
*/
|
|
45
|
-
import { createContext } from 'react';
|
|
46
45
|
import { createAnimatedLayout, holdLayoutEdge, playLayoutEdge } from "../motion/animatedLayout.js";
|
|
46
|
+
import { createSharedContext } from "../utils/sharedContext.js";
|
|
47
47
|
|
|
48
48
|
/** What AppShell lends its SideNav; outside AppShell, nothing. */
|
|
49
49
|
|
|
50
|
-
export const SideNavShellContext =
|
|
50
|
+
export const SideNavShellContext = createSharedContext('SideNavShellContext', 1, null);
|
|
51
51
|
SideNavShellContext.displayName = 'SideNavShellContext';
|
|
52
52
|
|
|
53
53
|
/** A SideNav outside AppShell holds its own handle over its parent. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SizeContext.d.ts","sourceRoot":"","sources":["../../src/SizeContext/SizeContext.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"SizeContext.d.ts","sourceRoot":"","sources":["../../src/SizeContext/SizeContext.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,WAAW,6CAIvB,CAAC;AAGF;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,EACpD,QAAQ,CAAC,EAAE,CAAC,EACZ,WAAW,GAAE,CAAa,GACzB,CAAC,CAGH;AAED,eAAO,MAAM,YAAY,8CAAuB,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* fallback — an explicit `size` prop always wins.
|
|
14
14
|
*/
|
|
15
15
|
import { use } from 'react';
|
|
16
|
-
import { createLayerScopedContext
|
|
16
|
+
import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Standard element sizes used across interactive components.
|
|
@@ -24,7 +24,7 @@ import { createLayerScopedContext as createContext } from "../Layer/layerScopedC
|
|
|
24
24
|
*
|
|
25
25
|
* `null` means no container is providing a size — components use their own default.
|
|
26
26
|
*/
|
|
27
|
-
export const SizeContext =
|
|
27
|
+
export const SizeContext = createLayerScopedContext('SizeContext', 1, null);
|
|
28
28
|
SizeContext.displayName = 'SizeContext';
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapPaging.d.ts","sourceRoot":"","sources":["../../src/SnapPaging/SnapPaging.ts"],"names":[],"mappings":"AAmBA,OAAO,
|
|
1
|
+
{"version":3,"file":"SnapPaging.d.ts","sourceRoot":"","sources":["../../src/SnapPaging/SnapPaging.ts"],"names":[],"mappings":"AAmBA,OAAO,EAIL,KAAK,UAAU,EAEf,KAAK,iBAAiB,EAEvB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAC,UAAU,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAmBzE"}
|
|
@@ -16,7 +16,7 @@ import { createPager } from "../hooks/usePager.js";
|
|
|
16
16
|
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
17
17
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
18
18
|
import { animatorFor } from "../motion/animator.js";
|
|
19
|
-
import { makeSnapPaging, snapStops } from "./snapPagingValue.js";
|
|
19
|
+
import { makeSnapPaging, rowScale, snapStops } from "./snapPagingValue.js";
|
|
20
20
|
/**
|
|
21
21
|
* Snap paging for Carousel: `<Carousel hasSnap={useSnapPaging()}>`. Carousel
|
|
22
22
|
* attaches the value to its scroll area. A flick moves one view by default, or
|
|
@@ -43,7 +43,7 @@ export function useSnapPaging(options = {}) {
|
|
|
43
43
|
return optionsRef.current.pages;
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
return makeSnapPaging(element => attachPaging(element, live));
|
|
46
|
+
return makeSnapPaging((element, onHeld) => attachPaging(element, live, onHeld));
|
|
47
47
|
});
|
|
48
48
|
return value;
|
|
49
49
|
}
|
|
@@ -99,16 +99,28 @@ function combined(handles) {
|
|
|
99
99
|
* offset holds, and every child moves by the same translate from there. The
|
|
100
100
|
* settle hands the position back to native scrolling.
|
|
101
101
|
*/
|
|
102
|
-
function childTrack(element) {
|
|
102
|
+
function childTrack(element, onHeld) {
|
|
103
103
|
let isMoving = false;
|
|
104
104
|
let heldOffset = 0;
|
|
105
105
|
let heldTravel = 0;
|
|
106
|
+
// The direction and the lead child, read at the takeover, so a frame of the
|
|
107
|
+
// hold reads no style or layout.
|
|
108
|
+
let heldSign = 1;
|
|
109
|
+
let lead = null;
|
|
110
|
+
let followFrame = 0;
|
|
111
|
+
// The row's travel, the children's span and the row's width at the
|
|
112
|
+
// takeover. A resize while the row is held moves the travel by the change in
|
|
113
|
+
// span and width.
|
|
114
|
+
let takeoverTravel = 0;
|
|
115
|
+
let heldSpan = 0;
|
|
116
|
+
let heldWidth = 0;
|
|
106
117
|
// The row's own inline snap type, back at the hand-back.
|
|
107
118
|
let ownSnapType = '';
|
|
108
119
|
const children = () => Array.from(element.children).filter(child => child instanceof HTMLElement);
|
|
109
120
|
const isRtl = () => isRtlElement(element);
|
|
110
|
-
// The pager's x for a position, and what a child's translate adds to it.
|
|
111
|
-
|
|
121
|
+
// The pager's x for a position, and what a child's translate adds to it. A
|
|
122
|
+
// held row keeps the direction it was taken over with.
|
|
123
|
+
const sign = () => isMoving ? heldSign : isRtl() ? -1 : 1;
|
|
112
124
|
const xOf = position => -sign() * position;
|
|
113
125
|
const nativePosition = () => Math.abs(element.scrollLeft);
|
|
114
126
|
const padding = () => {
|
|
@@ -132,8 +144,61 @@ function childTrack(element) {
|
|
|
132
144
|
return -sign() * (animatorFor(first).get('x') - sign() * heldOffset);
|
|
133
145
|
}
|
|
134
146
|
|
|
147
|
+
// Reports where the held row is shown, once a frame, from the lead child's
|
|
148
|
+
// own animator.
|
|
149
|
+
function follow() {
|
|
150
|
+
if (onHeld == null || !isMoving) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const offset = lead == null ? heldOffset : -heldSign * (animatorFor(lead).get('x') - heldSign * heldOffset);
|
|
154
|
+
onHeld({
|
|
155
|
+
offset,
|
|
156
|
+
travel: heldTravel
|
|
157
|
+
});
|
|
158
|
+
followFrame = requestAnimationFrame(follow);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Every child carries the same translate, so a held row's span is its
|
|
162
|
+
// layout's.
|
|
163
|
+
function span() {
|
|
164
|
+
const items = children();
|
|
165
|
+
if (items.length === 0) {
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
let start = Infinity;
|
|
169
|
+
let end = -Infinity;
|
|
170
|
+
for (const child of items) {
|
|
171
|
+
const rect = child.getBoundingClientRect();
|
|
172
|
+
start = Math.min(start, rect.left);
|
|
173
|
+
end = Math.max(end, rect.right);
|
|
174
|
+
}
|
|
175
|
+
return (end - start) / rowScale(element, element.getBoundingClientRect());
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// A resize while the row is held moves its travel with the row's width and
|
|
179
|
+
// the children's span. A frame of the hold reads the result, not the row.
|
|
180
|
+
function remeasure() {
|
|
181
|
+
if (!isMoving) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const nextSpan = span();
|
|
185
|
+
const nextWidth = element.clientWidth;
|
|
186
|
+
const native = nativePosition();
|
|
187
|
+
// WebKit truncates a fractional scroll offset, so the travel stays a whole
|
|
188
|
+
// number of pixels, as the scroll width is. It rounds once, from the
|
|
189
|
+
// takeover, so a resize over many frames adds up no rounding.
|
|
190
|
+
heldTravel = Math.max(0, Math.round(takeoverTravel + (nextSpan - heldSpan) - (nextWidth - heldWidth)));
|
|
191
|
+
// A shorter travel clamps the row's own scroll offset. The children take
|
|
192
|
+
// up the clamp, so the row still shows where the pager holds it.
|
|
193
|
+
if (native !== heldOffset) {
|
|
194
|
+
const at = position();
|
|
195
|
+
heldOffset = native;
|
|
196
|
+
place(at);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
135
200
|
// A held row's translate widens its overflow, so its travel is the one it
|
|
136
|
-
// was taken over with.
|
|
201
|
+
// was taken over with, moved by any resize since.
|
|
137
202
|
function travel() {
|
|
138
203
|
return isMoving ? heldTravel : Math.max(0, element.scrollWidth - element.clientWidth);
|
|
139
204
|
}
|
|
@@ -148,32 +213,45 @@ function childTrack(element) {
|
|
|
148
213
|
return Math.max(1, element.clientWidth - start - end);
|
|
149
214
|
}
|
|
150
215
|
function place(at) {
|
|
216
|
+
const x = toChild(xOf(at));
|
|
151
217
|
for (const child of children()) {
|
|
152
|
-
animatorFor(child)
|
|
153
|
-
|
|
154
|
-
|
|
218
|
+
const animator = animatorFor(child);
|
|
219
|
+
// A set reads the element's style back, so a child already there
|
|
220
|
+
// gets none.
|
|
221
|
+
if (animator.get('x') !== x) {
|
|
222
|
+
animator.set({
|
|
223
|
+
x
|
|
224
|
+
});
|
|
225
|
+
}
|
|
155
226
|
}
|
|
156
227
|
}
|
|
157
228
|
function takeOver() {
|
|
158
229
|
if (isMoving) {
|
|
159
230
|
return;
|
|
160
231
|
}
|
|
161
|
-
|
|
162
|
-
|
|
232
|
+
// Every read comes before the first write, so the takeover forces no
|
|
233
|
+
// layout of its own.
|
|
234
|
+
const offset = nativePosition();
|
|
235
|
+
const rowTravel = Math.max(0, element.scrollWidth - element.clientWidth);
|
|
236
|
+
const rowSign = isRtl() ? -1 : 1;
|
|
237
|
+
const items = children();
|
|
238
|
+
const rowSpan = span();
|
|
239
|
+
const rowWidth = element.clientWidth;
|
|
240
|
+
heldOffset = offset;
|
|
241
|
+
heldTravel = rowTravel;
|
|
242
|
+
takeoverTravel = rowTravel;
|
|
243
|
+
heldSpan = rowSpan;
|
|
244
|
+
heldWidth = rowWidth;
|
|
245
|
+
heldSign = rowSign;
|
|
246
|
+
lead = items[0] ?? null;
|
|
163
247
|
isMoving = true;
|
|
164
248
|
// A snap type would snap the row again as its children move.
|
|
165
249
|
ownSnapType = element.style.getPropertyValue('scroll-snap-type');
|
|
166
250
|
element.style.setProperty('scroll-snap-type', 'none');
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
const box = element.getBoundingClientRect();
|
|
170
|
-
for (const child of children()) {
|
|
171
|
-
const rect = child.getBoundingClientRect();
|
|
172
|
-
if (rect.right >= box.left - box.width && rect.left <= box.right + box.width) {
|
|
173
|
-
child.style.setProperty('will-change', 'transform');
|
|
174
|
-
}
|
|
175
|
-
}
|
|
251
|
+
// Each child's animator gives it a layer while it moves and takes the layer
|
|
252
|
+
// away after the motion. So the takeover writes no will-change itself.
|
|
176
253
|
place(heldOffset);
|
|
254
|
+
follow();
|
|
177
255
|
}
|
|
178
256
|
function handBack() {
|
|
179
257
|
if (!isMoving) {
|
|
@@ -187,7 +265,6 @@ function childTrack(element) {
|
|
|
187
265
|
x: 0
|
|
188
266
|
});
|
|
189
267
|
child.style.removeProperty('translate');
|
|
190
|
-
child.style.removeProperty('will-change');
|
|
191
268
|
}
|
|
192
269
|
isMoving = false;
|
|
193
270
|
if (ownSnapType === '') {
|
|
@@ -199,6 +276,14 @@ function childTrack(element) {
|
|
|
199
276
|
left: isRtl() ? -at : at,
|
|
200
277
|
behavior: 'instant'
|
|
201
278
|
});
|
|
279
|
+
if (onHeld != null) {
|
|
280
|
+
cancelAnimationFrame(followFrame);
|
|
281
|
+
onHeld({
|
|
282
|
+
offset: at,
|
|
283
|
+
travel: heldTravel
|
|
284
|
+
});
|
|
285
|
+
onHeld(null);
|
|
286
|
+
}
|
|
202
287
|
}
|
|
203
288
|
const animator = {
|
|
204
289
|
get(property, time) {
|
|
@@ -256,6 +341,7 @@ function childTrack(element) {
|
|
|
256
341
|
},
|
|
257
342
|
position,
|
|
258
343
|
travel,
|
|
344
|
+
remeasure,
|
|
259
345
|
stops,
|
|
260
346
|
viewWidth,
|
|
261
347
|
place,
|
|
@@ -269,10 +355,38 @@ function childTrack(element) {
|
|
|
269
355
|
* the row over, and the settle gives it back. A mouse drag and a mouse wheel
|
|
270
356
|
* leave the row to native scrolling.
|
|
271
357
|
*/
|
|
272
|
-
function attachPaging(element, options) {
|
|
273
|
-
const track = childTrack(element);
|
|
358
|
+
function attachPaging(element, options, onHeld) {
|
|
359
|
+
const track = childTrack(element, onHeld);
|
|
360
|
+
// A child's animator reads its stylesheet's will-change in a later task. So
|
|
361
|
+
// a press that moves the row reads no style in its own task.
|
|
362
|
+
for (const child of Array.from(element.children)) {
|
|
363
|
+
if (child instanceof HTMLElement) {
|
|
364
|
+
animatorFor(child);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
274
367
|
// The stop that view pages count from, set when a gesture takes over.
|
|
275
368
|
let anchor = 0;
|
|
369
|
+
// The row's stops and view width, read before a takeover's first write.
|
|
370
|
+
let measured = null;
|
|
371
|
+
const takeOverShown = at => {
|
|
372
|
+
// Every read comes before the takeover's first write.
|
|
373
|
+
const stops = track.stops();
|
|
374
|
+
const viewWidth = track.viewWidth();
|
|
375
|
+
anchor = stops.reduce((best, stop, i) => Math.abs(stop - at) < Math.abs(stops[best] - at) ? i : best, 0);
|
|
376
|
+
measured = {
|
|
377
|
+
stops,
|
|
378
|
+
viewWidth
|
|
379
|
+
};
|
|
380
|
+
pager.setOptions({});
|
|
381
|
+
measured = null;
|
|
382
|
+
// The pager learns its page while the row is at rest, which moves
|
|
383
|
+
// nothing. The takeover then holds the row where it is shown.
|
|
384
|
+
pager.goTo(pager.nearestPage(at), {
|
|
385
|
+
animated: false,
|
|
386
|
+
reason: 'controlled'
|
|
387
|
+
});
|
|
388
|
+
track.takeOver();
|
|
389
|
+
};
|
|
276
390
|
const pager = createPager({
|
|
277
391
|
count: 1,
|
|
278
392
|
pages: 'children',
|
|
@@ -282,22 +396,15 @@ function attachPaging(element, options) {
|
|
|
282
396
|
allowedPointerTypes: ['touch', 'pen']
|
|
283
397
|
},
|
|
284
398
|
measurePages: () => {
|
|
285
|
-
|
|
286
|
-
|
|
399
|
+
// A resize while the row is held moves its travel first.
|
|
400
|
+
track.remeasure();
|
|
401
|
+
const stops = measured?.stops ?? track.stops();
|
|
402
|
+
return (options.pages ?? 'view') === 'item' ? stops : viewPages(stops, Math.min(anchor, stops.length - 1), measured?.viewWidth ?? track.viewWidth());
|
|
287
403
|
},
|
|
288
404
|
shouldBeginPan: () => {
|
|
405
|
+
// The finger catches the row where it is shown.
|
|
289
406
|
if (!track.isMoving) {
|
|
290
|
-
|
|
291
|
-
const stops = track.stops();
|
|
292
|
-
anchor = stops.reduce((best, stop, i) => Math.abs(stop - at) < Math.abs(stops[best] - at) ? i : best, 0);
|
|
293
|
-
track.takeOver();
|
|
294
|
-
pager.setOptions({});
|
|
295
|
-
pager.goTo(pager.nearestPage(at), {
|
|
296
|
-
animated: false,
|
|
297
|
-
reason: 'controlled'
|
|
298
|
-
});
|
|
299
|
-
// The finger catches the row where it is shown.
|
|
300
|
-
track.place(at);
|
|
407
|
+
takeOverShown(track.position());
|
|
301
408
|
}
|
|
302
409
|
return true;
|
|
303
410
|
},
|
|
@@ -316,6 +423,25 @@ function attachPaging(element, options) {
|
|
|
316
423
|
pager.dispose();
|
|
317
424
|
track.handBack();
|
|
318
425
|
},
|
|
426
|
+
move: target => {
|
|
427
|
+
// A finger on the row keeps it.
|
|
428
|
+
if (pager.isDragging) {
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
// The target reads the row too, so every read comes before the
|
|
432
|
+
// takeover's first write.
|
|
433
|
+
const at = track.position();
|
|
434
|
+
const end = track.travel();
|
|
435
|
+
const to = Math.min(Math.max(target(at, end), 0), end);
|
|
436
|
+
// A move from rest is the pager's own too. So a touch catches it as it
|
|
437
|
+
// catches a settle, and the release rests on a page.
|
|
438
|
+
if (!track.isMoving) {
|
|
439
|
+
takeOverShown(at);
|
|
440
|
+
}
|
|
441
|
+
pager.goTo(pager.nearestPage(to), {
|
|
442
|
+
offset: to
|
|
443
|
+
});
|
|
444
|
+
},
|
|
319
445
|
moveHeld: target => {
|
|
320
446
|
if (!track.isMoving) {
|
|
321
447
|
return false;
|
|
@@ -18,14 +18,35 @@ export interface SnapPaging {
|
|
|
18
18
|
/** The paging attached to one row. */
|
|
19
19
|
export interface SnapPagingAttachment {
|
|
20
20
|
readonly detach: () => void;
|
|
21
|
+
readonly move: (target: (at: number, end: number) => number) => void;
|
|
21
22
|
readonly moveHeld: (target: (at: number, end: number) => number) => boolean;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Where a row the paging holds is shown: its offset toward the end, and the
|
|
26
|
+
* travel it was taken over with.
|
|
27
|
+
*/
|
|
28
|
+
export interface HeldRow {
|
|
29
|
+
readonly offset: number;
|
|
30
|
+
readonly travel: number;
|
|
31
|
+
}
|
|
32
|
+
/** Hears a held row on each frame of the hold, and null at the hand-back. */
|
|
33
|
+
export type HeldRowListener = (held: HeldRow | null) => void;
|
|
34
|
+
type Attach = (element: HTMLElement, onHeld?: HeldRowListener) => SnapPagingAttachment;
|
|
23
35
|
/** A `SnapPaging` value that attaches with `attach`. */
|
|
24
|
-
export declare function makeSnapPaging(attach:
|
|
36
|
+
export declare function makeSnapPaging(attach: Attach): SnapPaging;
|
|
25
37
|
/** Whether `value` came from `useSnapPaging`. */
|
|
26
38
|
export declare function isSnapPaging(value: unknown): value is SnapPaging;
|
|
27
|
-
/**
|
|
28
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Attaches snap paging to `element`; the returned function detaches it.
|
|
41
|
+
* `onHeld` hears where the row is shown while the paging holds it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function attachSnapPaging(value: SnapPaging, element: HTMLElement, onHeld?: HeldRowListener): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Moves the row through the paging to `target(shown, end)`, an offset toward
|
|
46
|
+
* the end, and takes the row over first when it is at rest. `end` is its
|
|
47
|
+
* travel. False when no paging is attached.
|
|
48
|
+
*/
|
|
49
|
+
export declare function moveSnapPaging(element: HTMLElement, target: (shown: number, end: number) => number): boolean;
|
|
29
50
|
/**
|
|
30
51
|
* Moves a row the paging holds to `target(shown, end)`, an offset toward the
|
|
31
52
|
* end. `end` is its travel when taken over. False when it is not held.
|
|
@@ -33,6 +54,11 @@ export declare function attachSnapPaging(value: SnapPaging, element: HTMLElement
|
|
|
33
54
|
export declare function moveHeldSnapPaging(element: HTMLElement, target: (shown: number, end: number) => number): boolean;
|
|
34
55
|
/** The stop nearest `at`, or `at` itself when the row has no stops. */
|
|
35
56
|
export declare function nearestStop(stops: ReadonlyArray<number>, at: number): number;
|
|
57
|
+
/**
|
|
58
|
+
* The scale a scaled ancestor gives the row's rects: the rect's width over the
|
|
59
|
+
* row's layout width. Scroll offsets do not have it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function rowScale(element: HTMLElement, box: DOMRect): number;
|
|
36
62
|
/**
|
|
37
63
|
* Each item's snap stop: the scroll offset that aligns its start edge with
|
|
38
64
|
* the scroll padding, clamped to `end`. Read from the items' rects, with the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapPagingValue.d.ts","sourceRoot":"","sources":["../../src/SnapPaging/snapPagingValue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"snapPagingValue.d.ts","sourceRoot":"","sources":["../../src/SnapPaging/snapPagingValue.ts"],"names":[],"mappings":"AAcA,kCAAkC;AAClC,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAED,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;CAClC;AAED,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,KAAK,OAAO,CAAC;CAC7E;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;AAE7D,KAAK,MAAM,GAAG,CACZ,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,eAAe,KACrB,oBAAoB,CAAC;AAU1B,wDAAwD;AACxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAIzD;AAED,iDAAiD;AACjD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,eAAe,GACvB,MAAM,IAAI,CAUZ;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAC7C,OAAO,CAOT;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAC7C,OAAO,CAET;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAK5E;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAInE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CA0BV"}
|