@astryxdesign/core 0.7.7-canary.550ff21 → 0.7.7-canary.58c5b8a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/AlertDialog.d.ts +4 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +36 -6
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts +13 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.d.ts.map +1 -0
- package/dist/AppShell/useCloseMobileDrawerOnActivate.js +45 -0
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +1 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +79 -9
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +23 -4
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +5 -4
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +3 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +2 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +9 -4
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +50 -5
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +7 -1
- package/dist/CheckboxList/CheckboxListContext.d.ts +6 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +10 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts +4 -1
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +14 -4
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +13 -27
- package/dist/DateInput/Wheel.d.ts +17 -1
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +161 -20
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +63 -49
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +5 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +53 -15
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +15 -11
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +9 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +20 -4
- package/dist/Field/Field.js +2 -2
- package/dist/Field/PanelSearchInput.d.ts +9 -1
- package/dist/Field/PanelSearchInput.d.ts.map +1 -1
- package/dist/Field/PanelSearchInput.js +3 -1
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +27 -2
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +5 -2
- package/dist/InfoTip/InfoTip.d.ts +63 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -0
- package/dist/InfoTip/InfoTip.js +126 -0
- package/dist/InfoTip/index.d.ts +10 -0
- package/dist/InfoTip/index.d.ts.map +1 -0
- package/dist/InfoTip/index.js +12 -0
- package/dist/Layer/layerAnimations.stylex.d.ts +7 -8
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +25 -20
- package/dist/Layer/layerClickBoundary.d.ts +7 -1
- package/dist/Layer/layerClickBoundary.d.ts.map +1 -1
- package/dist/Layer/layerClickBoundary.js +2 -2
- package/dist/Layer/useBackdropPress.d.ts +27 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -0
- package/dist/Layer/useBackdropPress.js +53 -0
- package/dist/Layer/usePressPin.d.ts +105 -0
- package/dist/Layer/usePressPin.d.ts.map +1 -0
- package/dist/Layer/usePressPin.js +413 -0
- package/dist/Layer/useTouchTrigger.d.ts +23 -1
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +45 -7
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +2 -1
- package/dist/MobileNav/MobileNav.js +0 -1
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +2 -4
- package/dist/Outline/Outline.d.ts +2 -4
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +4 -52
- package/dist/Outline/useOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromMarkdown.js +1 -0
- package/dist/Outline/useScrollSpy.js +3 -3
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +56 -7
- package/dist/PowerSearch/PowerSearch.d.ts +36 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +571 -302
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +100 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +1913 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +32 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +17 -6
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +170 -61
- package/dist/PowerSearch/formatFilterValue.d.ts +7 -0
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +11 -1
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +160 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts +65 -0
- package/dist/PowerSearch/powerSearchSheetUtils.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchSheetUtils.js +168 -0
- package/dist/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +33 -6
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +8 -2
- package/dist/RadioList/RadioListItem.d.ts +1 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -3
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +118 -260
- package/dist/Resizable/resizeGesture.d.ts +91 -0
- package/dist/Resizable/resizeGesture.d.ts.map +1 -0
- package/dist/Resizable/resizeGesture.js +251 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +3 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +115 -8
- package/dist/SegmentedControl/SegmentedControlContext.d.ts +6 -0
- package/dist/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.d.ts +1 -0
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +10 -2
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts +357 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +1349 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts +70 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -0
- package/dist/SegmentedControl/useSegmentedTouchTracking.js +264 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +96 -67
- package/dist/Selector/optionShape.d.ts +24 -0
- package/dist/Selector/optionShape.d.ts.map +1 -0
- package/dist/Selector/optionShape.js +48 -0
- package/dist/Selector/selectableOptionEntries.d.ts +20 -0
- package/dist/Selector/selectableOptionEntries.d.ts.map +1 -0
- package/dist/Selector/selectableOptionEntries.js +38 -0
- package/dist/Selector/utils.d.ts +2 -17
- package/dist/Selector/utils.d.ts.map +1 -1
- package/dist/Selector/utils.js +3 -51
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +3 -9
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +200 -46
- package/dist/Switch/switchFill.d.ts +31 -0
- package/dist/Switch/switchFill.d.ts.map +1 -0
- package/dist/Switch/switchFill.js +88 -0
- package/dist/Switch/switchTouch.d.ts +74 -0
- package/dist/Switch/switchTouch.d.ts.map +1 -0
- package/dist/Switch/switchTouch.js +125 -0
- package/dist/Switch/useSwitchTouch.d.ts +276 -0
- package/dist/Switch/useSwitchTouch.d.ts.map +1 -0
- package/dist/Switch/useSwitchTouch.js +939 -0
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +4 -3
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +10 -7
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +5 -0
- package/dist/Token/Token.d.ts +2 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +13 -4
- package/dist/Token/TokenNamingContext.d.ts +14 -0
- package/dist/Token/TokenNamingContext.d.ts.map +1 -0
- package/dist/Token/TokenNamingContext.js +23 -0
- package/dist/Tokenizer/Tokenizer.d.ts +46 -59
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +44 -60
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +25 -28
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts.map +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +157 -54
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts +3 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerItemRemovableContext.js +19 -0
- package/dist/Tooltip/Tooltip.d.ts +24 -5
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +29 -5
- package/dist/Tooltip/useTooltip.d.ts +48 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +90 -20
- package/dist/TopNav/TopNavItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavItem.js +4 -7
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +4 -7
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +4 -7
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +26 -15
- package/dist/animator/createAnimator.d.ts +98 -0
- package/dist/animator/createAnimator.d.ts.map +1 -0
- package/dist/animator/createAnimator.js +259 -0
- package/dist/astryx.css +142 -7
- package/dist/gestures/GestureHost.d.ts +27 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +161 -22
- package/dist/gestures/PressTracker.d.ts +6 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +3 -0
- package/dist/gestures/types.d.ts +6 -0
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.d.ts.map +1 -1
- package/dist/gestures/usePressTracker.js +1 -0
- package/dist/gestures/wheelSegmenter.d.ts +14 -3
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +32 -8
- package/dist/hooks/actionGroupTracker.d.ts +7 -4
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +19 -56
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/pressGroupContext.d.ts +6 -0
- package/dist/hooks/pressGroupContext.d.ts.map +1 -0
- package/dist/hooks/pressGroupContext.js +20 -0
- package/dist/hooks/useActionGroupTracking.d.ts +53 -0
- package/dist/hooks/useActionGroupTracking.d.ts.map +1 -0
- package/dist/hooks/useActionGroupTracking.js +174 -0
- package/dist/hooks/useAnimator.d.ts +41 -0
- package/dist/hooks/useAnimator.d.ts.map +1 -0
- package/dist/hooks/useAnimator.js +70 -0
- package/dist/hooks/useAttachment.d.ts +16 -8
- package/dist/hooks/useAttachment.d.ts.map +1 -1
- package/dist/hooks/useAttachment.js +35 -15
- package/dist/hooks/useFocusTrap.d.ts +15 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +13 -2
- package/dist/hooks/useHighlightedOptionScroll.d.ts +11 -1
- package/dist/hooks/useHighlightedOptionScroll.d.ts.map +1 -1
- package/dist/hooks/useHighlightedOptionScroll.js +112 -11
- package/dist/hooks/useInputStatusIcon.d.ts +1 -1
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +2 -2
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +7 -4
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +4 -2
- package/dist/hooks/usePager.d.ts +261 -0
- package/dist/hooks/usePager.d.ts.map +1 -0
- package/dist/hooks/usePager.js +1169 -0
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts +8 -0
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/InfoTip/InfoTip.generated.js +12 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearch.generated.js +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +42 -0
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.js +6 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts +8 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/PowerSearch/formatTokenValue.generated.js +14 -0
- package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.js +7 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +33 -1
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +33 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/internal/SheetConfirmation.d.ts +11 -0
- package/dist/internal/SheetConfirmation.d.ts.map +1 -0
- package/dist/internal/SheetConfirmation.js +92 -0
- package/dist/internal/sheetDraft.d.ts +35 -0
- package/dist/internal/sheetDraft.d.ts.map +1 -0
- package/dist/internal/sheetDraft.js +65 -0
- package/dist/internal/touch-sheet.d.ts +21 -0
- package/dist/internal/touch-sheet.d.ts.map +1 -0
- package/dist/internal/touch-sheet.js +19 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts +24 -0
- package/dist/internal/useDismissSearchOnTouchDrag.d.ts.map +1 -0
- package/dist/internal/useDismissSearchOnTouchDrag.js +56 -0
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +41 -18
- package/dist/motion/paging.d.ts +16 -5
- package/dist/motion/paging.d.ts.map +1 -1
- package/dist/motion/paging.js +34 -14
- package/dist/motion/reducedMotion.d.ts +24 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +78 -1
- package/dist/motion/roles.d.ts +7 -1
- package/dist/motion/roles.d.ts.map +1 -1
- package/dist/motion/roles.js +20 -1
- package/dist/motion/uikit/alert.d.ts +41 -0
- package/dist/motion/uikit/alert.d.ts.map +1 -0
- package/dist/motion/uikit/alert.js +43 -0
- package/dist/motion/uikit/index.d.ts +7 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +7 -4
- package/dist/motion/uikit/paging.d.ts +31 -20
- package/dist/motion/uikit/paging.d.ts.map +1 -1
- package/dist/motion/uikit/paging.js +41 -11
- package/dist/motion/uikit/progressBar.d.ts +27 -7
- package/dist/motion/uikit/progressBar.d.ts.map +1 -1
- package/dist/motion/uikit/progressBar.js +31 -11
- package/dist/motion/uikit/segmented.d.ts +55 -0
- package/dist/motion/uikit/segmented.d.ts.map +1 -0
- package/dist/motion/uikit/segmented.js +77 -0
- package/dist/motion/uikit/springs.d.ts +8 -42
- package/dist/motion/uikit/springs.d.ts.map +1 -1
- package/dist/motion/uikit/springs.js +12 -42
- package/dist/motion/uikit/switch.d.ts +166 -0
- package/dist/motion/uikit/switch.d.ts.map +1 -0
- package/dist/motion/uikit/switch.js +186 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +15 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +23 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts +18 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHoldsDrag.stylex.js +28 -0
- package/dist/privateAttributes/segmentTitle.stylex.d.ts +5 -0
- package/dist/privateAttributes/segmentTitle.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/segmentTitle.stylex.js +22 -0
- package/dist/utils/browserClickWait.d.ts +35 -0
- package/dist/utils/browserClickWait.d.ts.map +1 -0
- package/dist/utils/browserClickWait.js +123 -0
- package/dist/utils/clickGuard.d.ts +14 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +46 -1
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +24 -6
- package/locales/en.json +128 -0
- package/locales/pseudo.json +96 -0
- package/package.json +13 -8
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +37 -5
- package/src/AppShell/useCloseMobileDrawerOnActivate.ts +52 -0
- package/src/Avatar/Avatar.tsx +3 -1
- package/src/BottomSheet/BottomSheet.tsx +95 -10
- package/src/BottomSheet/BottomSheetPanel.tsx +40 -5
- package/src/BottomSheet/bottomSheetStack.ts +8 -4
- package/src/BottomSheet/useSheetGestures.ts +3 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +17 -4
- package/src/Button/Button.tsx +66 -7
- package/src/CheckboxList/CheckboxList.doc.mjs +4 -2
- package/src/CheckboxList/CheckboxList.tsx +6 -0
- package/src/CheckboxList/CheckboxListContext.tsx +6 -0
- package/src/CheckboxList/CheckboxListItem.tsx +11 -2
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/DateInput/DateInput.tsx +8 -2
- package/src/DateInput/MonthScroller.tsx +18 -22
- package/src/DateInput/Wheel.tsx +172 -14
- package/src/DateRangeInput/DateRangeInput.doc.mjs +3 -2
- package/src/DateRangeInput/DateRangeInput.tsx +117 -71
- package/src/DateTimeInput/DateTimeInput.tsx +8 -2
- package/src/Dialog/Dialog.tsx +81 -15
- package/src/Drawer/Drawer.tsx +28 -11
- package/src/Drawer/useDrawerDialogPresence.ts +9 -1
- package/src/DropdownMenu/DropdownMenu.tsx +28 -6
- package/src/Field/Field.tsx +2 -2
- package/src/Field/PanelSearchInput.tsx +11 -0
- package/src/HoverCard/HoverCard.tsx +31 -1
- package/src/Icon/Icon.doc.mjs +49 -8
- package/src/Icon/Icon.tsx +15 -7
- package/src/InfoTip/InfoTip.doc.mjs +192 -0
- package/src/InfoTip/InfoTip.tsx +186 -0
- package/src/InfoTip/index.ts +14 -0
- package/src/Layer/layerAnimations.stylex.ts +24 -16
- package/src/Layer/layerClickBoundary.ts +2 -2
- package/src/Layer/useBackdropPress.ts +81 -0
- package/src/Layer/usePressPin.ts +576 -0
- package/src/Layer/useTouchTrigger.ts +56 -6
- package/src/Lightbox/Lightbox.tsx +2 -1
- package/src/MobileNav/MobileNav.tsx +1 -1
- package/src/MultiSelector/hooks.ts +2 -4
- package/src/Outline/Outline.doc.mjs +177 -51
- package/src/Outline/Outline.tsx +5 -57
- package/src/Outline/useOutlineFromMarkdown.doc.mjs +157 -0
- package/src/Outline/useOutlineFromMarkdown.ts +1 -0
- package/src/Outline/useScrollSpy.ts +3 -3
- package/src/Popover/usePopover.tsx +71 -9
- package/src/PowerSearch/PowerSearch.doc.mjs +55 -6
- package/src/PowerSearch/PowerSearch.tsx +798 -324
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2515 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +28 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +203 -38
- package/src/PowerSearch/formatFilterValue.ts +18 -1
- package/src/PowerSearch/formatTokenValue.ts +215 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +4 -2
- package/src/ProgressBar/ProgressBar.tsx +67 -7
- package/src/RadioList/RadioList.doc.mjs +4 -2
- package/src/RadioList/RadioList.tsx +7 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/Resizable/ResizeHandle.tsx +133 -328
- package/src/Resizable/resizeGesture.ts +368 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +3 -3
- package/src/SegmentedControl/SegmentedControl.tsx +179 -5
- package/src/SegmentedControl/SegmentedControlContext.ts +6 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +14 -2
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +1640 -0
- package/src/SegmentedControl/useSegmentedTouchTracking.ts +308 -0
- package/src/Selector/Selector.tsx +136 -89
- package/src/Selector/optionShape.ts +64 -0
- package/src/Selector/selectableOptionEntries.ts +39 -0
- package/src/Selector/utils.ts +9 -68
- package/src/SideNav/SideNavItem.tsx +3 -7
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Switch/Switch.doc.mjs +3 -3
- package/src/Switch/Switch.tsx +412 -86
- package/src/Switch/switchFill.ts +106 -0
- package/src/Switch/switchTouch.ts +186 -0
- package/src/Switch/useSwitchTouch.ts +1051 -0
- package/src/TabList/Tab.tsx +5 -3
- package/src/Table/BaseTable.tsx +46 -12
- package/src/TextInput/TextInput.tsx +11 -10
- package/src/Toast/Toast.tsx +5 -0
- package/src/Token/Token.tsx +15 -4
- package/src/Token/TokenNamingContext.ts +28 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Tokenizer/Tokenizer.tsx +93 -88
- package/src/Tokenizer/TokenizerBottomSheet.tsx +219 -93
- package/src/Tokenizer/TokenizerItemRemovableContext.ts +24 -0
- package/src/Tooltip/Tooltip.doc.mjs +123 -39
- package/src/Tooltip/Tooltip.tsx +43 -9
- package/src/Tooltip/useTooltip.doc.mjs +171 -31
- package/src/Tooltip/useTooltip.tsx +137 -22
- package/src/TopNav/TopNavItem.tsx +6 -5
- package/src/TopNav/TopNavMegaMenuItem.tsx +6 -5
- package/src/TopNav/TopNavMenu.tsx +6 -5
- package/src/Typeahead/Typeahead.tsx +29 -15
- package/src/animator/createAnimator.doc.mjs +153 -0
- package/src/animator/createAnimator.ts +324 -0
- package/src/gestures/GestureHost.ts +205 -21
- package/src/gestures/PressTracker.ts +10 -0
- package/src/gestures/types.ts +6 -0
- package/src/gestures/usePressTracker.ts +2 -0
- package/src/gestures/wheelSegmenter.ts +36 -7
- package/src/hooks/actionGroupTracker.ts +32 -61
- package/src/hooks/index.ts +2 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- package/src/hooks/useActionGroupTracking.ts +224 -0
- package/src/hooks/useAnimator.doc.mjs +109 -0
- package/src/hooks/useAnimator.ts +67 -0
- package/src/hooks/useAttachment.ts +56 -14
- package/src/hooks/useFocusTrap.ts +26 -2
- package/src/hooks/useHighlightedOptionScroll.ts +123 -15
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useMediaQuery.doc.mjs +2 -2
- package/src/hooks/useMediaQuery.ts +13 -4
- package/src/hooks/useMenuPress.ts +8 -2
- package/src/hooks/usePager.ts +1446 -0
- package/src/i18n/generated-english/InfoTip/InfoTip.generated.ts +13 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearch.generated.ts +1 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +43 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchValueEditor.generated.ts +6 -0
- package/src/i18n/generated-english/PowerSearch/formatTokenValue.generated.ts +15 -0
- package/src/i18n/generated-english/Tokenizer/TokenizerBottomSheet.generated.ts +7 -1
- package/src/i18n/generated-locales/en.generated.ts +43 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +44 -0
- package/src/index.ts +14 -0
- package/src/internal/SheetConfirmation.tsx +101 -0
- package/src/internal/sheetDraft.ts +80 -0
- package/src/internal/touch-sheet.ts +21 -0
- package/src/internal/useDismissSearchOnTouchDrag.ts +69 -0
- package/src/motion/MEASUREMENTS.md +36 -27
- package/src/motion/README.md +11 -6
- package/src/motion/animator.ts +61 -29
- package/src/motion/paging.ts +37 -14
- package/src/motion/reducedMotion.ts +79 -1
- package/src/motion/roles.ts +20 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/motion/uikit/index.ts +6 -5
- package/src/motion/uikit/paging.ts +41 -10
- package/src/motion/uikit/progressBar.ts +31 -11
- package/src/motion/uikit/segmented.ts +74 -0
- package/src/motion/uikit/springs.ts +12 -42
- package/src/motion/uikit/switch.ts +174 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +23 -0
- package/src/privateAttributes/pressHoldsDrag.stylex.ts +28 -0
- package/src/privateAttributes/segmentTitle.stylex.ts +22 -0
- package/src/utils/browserClickWait.ts +133 -0
- package/src/utils/clickGuard.ts +64 -1
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/pressFeedback.ts +24 -6
- package/dist/internal/tokenizer-presentation.d.ts +0 -21
- package/dist/internal/tokenizer-presentation.d.ts.map +0 -1
- package/dist/internal/tokenizer-presentation.js +0 -21
- package/src/internal/tokenizer-presentation.ts +0 -25
|
@@ -31,7 +31,8 @@ export interface ActionGroupTrackerOptions {
|
|
|
31
31
|
* target past the group's ends commits the lift there wherever the finger
|
|
32
32
|
* lifts.
|
|
33
33
|
* @default the target whose rect, grown by `highlightExpansion`, holds the
|
|
34
|
-
* point; none between or
|
|
34
|
+
* point, the one the press landed on where several do; none between or
|
|
35
|
+
* outside them
|
|
35
36
|
*/
|
|
36
37
|
resolveTarget?: (x: number, y: number, targets: ReadonlyArray<ActionGroupTarget>) => HTMLElement | null;
|
|
37
38
|
/** Every finger position it is given (the begin and each move), first. */
|
|
@@ -42,9 +43,9 @@ export interface ActionGroupTrackerOptions {
|
|
|
42
43
|
*/
|
|
43
44
|
onActivated?: (item: HTMLElement, cancelled: boolean) => void;
|
|
44
45
|
/**
|
|
45
|
-
* After the lift ran an action,
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* After the lift ran an action, the shared click guard takes the browser's
|
|
47
|
+
* own click for that touch, so the action runs once. A recognizer that did
|
|
48
|
+
* not claim the touch leaves that click to the browser. @default false
|
|
48
49
|
*/
|
|
49
50
|
swallowsNativeClick?: boolean;
|
|
50
51
|
}
|
|
@@ -52,9 +53,11 @@ export interface ActionGroupTracker {
|
|
|
52
53
|
/**
|
|
53
54
|
* A press began at viewport (x, y): read the actions' rects once and
|
|
54
55
|
* highlight the one under it. An inert press is taken but tracks nothing.
|
|
56
|
+
* `landed` is the node the press landed on.
|
|
55
57
|
*/
|
|
56
58
|
begin(x: number, y: number, options?: {
|
|
57
59
|
inert?: boolean;
|
|
60
|
+
landed?: Node | null;
|
|
58
61
|
}): void;
|
|
59
62
|
/** The finger moved to viewport (x, y). */
|
|
60
63
|
move(x: number, y: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionGroupTracker.d.ts","sourceRoot":"","sources":["../../src/hooks/actionGroupTracker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actionGroupTracker.d.ts","sourceRoot":"","sources":["../../src/hooks/actionGroupTracker.ts"],"names":[],"mappings":"AAsBA,wEAAwE;AAC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ACT,CAAC,EAAE,MAAM,EACT,OAAO,CAAC,EAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;KAAC,GAChD,IAAI,CAAC;IACR,2CAA2C;IAC3C,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;;;;OAKG;IACH,GAAG,IAAI,WAAW,GAAG,IAAI,CAAC;IAC1B,+EAA+E;IAC/E,MAAM,IAAI,IAAI,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC;;;;OAIG;IACH,SAAS,IAAI,IAAI,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAUD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,yBAAyB,GAC1C,kBAAkB,CAyOpB"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* SYNC: When modified, update actionGroupTracker.test.ts
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { clickAndReport, clickForLift } from "../utils/browserClickWait.js";
|
|
16
|
+
import { armClickGuard } from "../utils/clickGuard.js";
|
|
15
17
|
import { PRESSED_ATTRIBUTE } from "../utils/pressFeedback.js";
|
|
16
18
|
import { PRESS_FADE_MS } from "../utils/pressGesture.js";
|
|
17
19
|
|
|
@@ -20,54 +22,6 @@ const DISABLED = ':disabled, [aria-disabled="true"]';
|
|
|
20
22
|
|
|
21
23
|
/** A target the tracker measured: its element and viewport rect, px. */
|
|
22
24
|
|
|
23
|
-
/**
|
|
24
|
-
* Swallow the browser's own click for a touch that the lift already acted
|
|
25
|
-
* on. The listeners exist only from that lift until the click, the next
|
|
26
|
-
* press, or the next key. An activation with `detail === 0` (a key or
|
|
27
|
-
* assistive technology) always passes, and the swallower keeps waiting
|
|
28
|
-
* (`AST-094`).
|
|
29
|
-
*/
|
|
30
|
-
function swallowNextClick(view) {
|
|
31
|
-
const disarm = () => {
|
|
32
|
-
view.removeEventListener('click', onClick, true);
|
|
33
|
-
view.removeEventListener('pointerdown', disarm, true);
|
|
34
|
-
view.removeEventListener('keydown', disarm, true);
|
|
35
|
-
};
|
|
36
|
-
const onClick = event => {
|
|
37
|
-
if (!event.isTrusted || event.detail === 0) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
disarm();
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
event.stopImmediatePropagation();
|
|
43
|
-
};
|
|
44
|
-
view.addEventListener('click', onClick, true);
|
|
45
|
-
view.addEventListener('pointerdown', disarm, true);
|
|
46
|
-
view.addEventListener('keydown', disarm, true);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Click `element` (its own `click()`, so its activation behavior and every
|
|
51
|
-
* handler run as for any click) and report whether a handler cancelled it.
|
|
52
|
-
* The event is read from a capture listener that exists only for the call.
|
|
53
|
-
*/
|
|
54
|
-
function clickAndReport(element) {
|
|
55
|
-
const view = element.ownerDocument.defaultView;
|
|
56
|
-
let clicked = null;
|
|
57
|
-
const grab = event => {
|
|
58
|
-
if (clicked == null && event.target === element) {
|
|
59
|
-
clicked = event;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
view?.addEventListener('click', grab, true);
|
|
63
|
-
try {
|
|
64
|
-
element.click();
|
|
65
|
-
} finally {
|
|
66
|
-
view?.removeEventListener('click', grab, true);
|
|
67
|
-
}
|
|
68
|
-
return clicked?.defaultPrevented === true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
25
|
/**
|
|
72
26
|
* Create a tracker. `getOptions` is read on every call, so a hook can pass
|
|
73
27
|
* the latest props without recreating it.
|
|
@@ -88,6 +42,7 @@ export function createActionGroupTracker(getOptions) {
|
|
|
88
42
|
let actions = [];
|
|
89
43
|
let highlighted = null;
|
|
90
44
|
let beganOn = null;
|
|
45
|
+
let landedOn = null;
|
|
91
46
|
let isTracking = false;
|
|
92
47
|
let isInert = false;
|
|
93
48
|
// The finger's last position: `remeasure` resolves it again.
|
|
@@ -177,23 +132,31 @@ export function createActionGroupTracker(getOptions) {
|
|
|
177
132
|
if (resolveTarget != null) {
|
|
178
133
|
return actions.length === 0 ? null : resolveTarget(x, y, actions);
|
|
179
134
|
}
|
|
135
|
+
// Rects that share an edge, or that have no layout (a test renderer), can
|
|
136
|
+
// both hold the point: the one the press landed on wins.
|
|
137
|
+
let first = null;
|
|
180
138
|
for (const action of actions) {
|
|
181
139
|
if (x >= action.left - margin && x <= action.right + margin && y >= action.top - margin && y <= action.bottom + margin) {
|
|
182
|
-
|
|
140
|
+
if (landedOn != null && action.element.contains(landedOn)) {
|
|
141
|
+
return action.element;
|
|
142
|
+
}
|
|
143
|
+
first ??= action.element;
|
|
183
144
|
}
|
|
184
145
|
}
|
|
185
|
-
return
|
|
146
|
+
return first;
|
|
186
147
|
};
|
|
187
148
|
const reset = () => {
|
|
188
149
|
actions = [];
|
|
189
150
|
highlighted = null;
|
|
190
151
|
beganOn = null;
|
|
152
|
+
landedOn = null;
|
|
191
153
|
isTracking = false;
|
|
192
154
|
isInert = false;
|
|
193
155
|
};
|
|
194
156
|
return {
|
|
195
157
|
begin(x, y, {
|
|
196
|
-
inert = false
|
|
158
|
+
inert = false,
|
|
159
|
+
landed = null
|
|
197
160
|
} = {}) {
|
|
198
161
|
// A press can begin while another is tracked, when a second recognizer
|
|
199
162
|
// takes over the finger (a trigger's held press, then the menu's): the
|
|
@@ -207,6 +170,7 @@ export function createActionGroupTracker(getOptions) {
|
|
|
207
170
|
highlighted = null;
|
|
208
171
|
isTracking = true;
|
|
209
172
|
isInert = inert;
|
|
173
|
+
landedOn = landed;
|
|
210
174
|
lastX = x;
|
|
211
175
|
lastY = y;
|
|
212
176
|
getOptions().onMove?.(x, y);
|
|
@@ -247,14 +211,13 @@ export function createActionGroupTracker(getOptions) {
|
|
|
247
211
|
} = getOptions();
|
|
248
212
|
if (onActivate != null) {
|
|
249
213
|
onActivate(lifted);
|
|
214
|
+
if (swallowsNativeClick === true) {
|
|
215
|
+
armClickGuard(lifted.ownerDocument);
|
|
216
|
+
}
|
|
250
217
|
} else {
|
|
251
|
-
const cancelled = clickAndReport(lifted);
|
|
218
|
+
const cancelled = swallowsNativeClick === true ? clickForLift(lifted) : clickAndReport(lifted);
|
|
252
219
|
onActivated?.(lifted, cancelled);
|
|
253
220
|
}
|
|
254
|
-
const view = lifted.ownerDocument.defaultView;
|
|
255
|
-
if (swallowsNativeClick === true && view != null) {
|
|
256
|
-
swallowNextClick(view);
|
|
257
|
-
}
|
|
258
221
|
return lifted;
|
|
259
222
|
},
|
|
260
223
|
cancel() {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { useInputStatusIcon } from './useInputStatusIcon.js';
|
|
|
53
53
|
export type { UseInputStatusIconOptions, UseInputStatusIconReturn, } from './useInputStatusIcon.js';
|
|
54
54
|
export { useInteractiveRole } from './useInteractiveRole.js';
|
|
55
55
|
export type { InteractiveRole, UseInteractiveRoleOptions, } from './useInteractiveRole.js';
|
|
56
|
+
export { useAnimator } from './useAnimator.js';
|
|
56
57
|
export { useLongPress } from './useLongPress.js';
|
|
57
58
|
export type { UseLongPressOptions, UseLongPressHandlers } from './useLongPress.js';
|
|
58
59
|
export { usePressFeedback } from './usePressFeedback.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH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,EAAC,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EACV,eAAe,EACf,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAC,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { useClickableContainer, INTERACTIVE_SELECTORS, hasInteractiveAncestor, h
|
|
|
35
35
|
export { useInputContainer } from "./useInputContainer.js";
|
|
36
36
|
export { useInputStatusIcon } from "./useInputStatusIcon.js";
|
|
37
37
|
export { useInteractiveRole } from "./useInteractiveRole.js";
|
|
38
|
+
export { useAnimator } from "./useAnimator.js";
|
|
38
39
|
export { useLongPress } from "./useLongPress.js";
|
|
39
40
|
export { usePressFeedback } from "./usePressFeedback.js";
|
|
40
41
|
export { useDevWarning } from "./useDevWarning.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True inside a group whose tracker paints a pointer's press on its actions.
|
|
3
|
+
* Those actions take no `:active` paint, so one press never lights two.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PressGroupContext: import("react").Context<boolean>;
|
|
6
|
+
//# sourceMappingURL=pressGroupContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pressGroupContext.d.ts","sourceRoot":"","sources":["../../src/hooks/pressGroupContext.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kCAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file pressGroupContext.ts
|
|
7
|
+
* @input Nothing
|
|
8
|
+
* @output PressGroupContext: true inside a group whose own tracker paints
|
|
9
|
+
* its actions' press
|
|
10
|
+
* @position Internal; not exported from the hooks entry. AlertDialog
|
|
11
|
+
* provides it around its tracked actions, and Button reads it.
|
|
12
|
+
*/
|
|
13
|
+
import { createContext } from 'react';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* True inside a group whose tracker paints a pointer's press on its actions.
|
|
17
|
+
* Those actions take no `:active` paint, so one press never lights two.
|
|
18
|
+
*/
|
|
19
|
+
export const PressGroupContext = /*#__PURE__*/createContext(false);
|
|
20
|
+
PressGroupContext.displayName = 'PressGroupContext';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useActionGroupTracking.ts
|
|
3
|
+
* @input A ref to a group of sibling actions, the actions' selector, and the
|
|
4
|
+
* component's tracking constants
|
|
5
|
+
* @output Exports useActionGroupTracking and ActionGroupTrackingOptions
|
|
6
|
+
* @position Internal hook, not exported from the hooks entry. A long press
|
|
7
|
+
* drives the shared action-group tracker (hooks/actionGroupTracker.ts) for
|
|
8
|
+
* a group that a held pointer slides across. AlertDialog consumes it.
|
|
9
|
+
*
|
|
10
|
+
* SYNC: When modified, update useActionGroupTracking.test.tsx
|
|
11
|
+
*/
|
|
12
|
+
import { type RefObject } from 'react';
|
|
13
|
+
import { LongPressGestureRecognizer } from '../gestures/LongPressGestureRecognizer.js';
|
|
14
|
+
import type { GestureTouch, PointerKind } from '../gestures/types.js';
|
|
15
|
+
export interface ActionGroupTrackingOptions {
|
|
16
|
+
/** Selects the actions inside the tracked element. */
|
|
17
|
+
itemSelector: string;
|
|
18
|
+
/** How long after touch-down the touched action highlights, ms. */
|
|
19
|
+
highlightOnsetMs: number;
|
|
20
|
+
/**
|
|
21
|
+
* How far outside an action a finger keeps it highlighted, px. A mouse or a
|
|
22
|
+
* pen hit-tests the actions' exact rects.
|
|
23
|
+
*/
|
|
24
|
+
highlightExpansion: number;
|
|
25
|
+
/** Pointers that are tracked; others keep the browser's click. @default every pointer */
|
|
26
|
+
pointerTypes?: ReadonlyArray<PointerKind>;
|
|
27
|
+
/** A press whose target this rejects is not tracked. */
|
|
28
|
+
shouldTrack?: (target: unknown) => boolean;
|
|
29
|
+
/** Off, nothing is attached and nothing is tracked. @default true */
|
|
30
|
+
isEnabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Let the gesture host write the group's `touch-action` and refuse a text
|
|
33
|
+
* selection while a finger or a pen holds it.
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
manageStyle?: boolean;
|
|
37
|
+
/** Runs the action under the finger at the lift. @default its own click */
|
|
38
|
+
onActivate?: (item: HTMLElement) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The group's press: a long press that a second finger on the group ends with
|
|
42
|
+
* nothing acting. A plain long press ignores a second finger.
|
|
43
|
+
*/
|
|
44
|
+
declare class ActionGroupPress extends LongPressGestureRecognizer {
|
|
45
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Track a held pointer on the group behind `ref` across the actions inside
|
|
49
|
+
* it, through the shared action-group tracker.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useActionGroupTracking(ref: RefObject<HTMLElement | null>, options: ActionGroupTrackingOptions): ActionGroupPress;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=useActionGroupTracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionGroupTracking.d.ts","sourceRoot":"","sources":["../../src/hooks/useActionGroupTracking.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAElE,OAAO,EAAC,0BAA0B,EAAC,MAAM,wCAAwC,CAAC;AAElF,OAAO,KAAK,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAOjE,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,YAAY,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAC1C,wDAAwD;IACxD,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAC3C,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AASD;;;GAGG;AACH,cAAM,gBAAiB,SAAQ,0BAA0B;cACpC,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;CAO9D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CAoHlB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useActionGroupTracking.ts
|
|
7
|
+
* @input A ref to a group of sibling actions, the actions' selector, and the
|
|
8
|
+
* component's tracking constants
|
|
9
|
+
* @output Exports useActionGroupTracking and ActionGroupTrackingOptions
|
|
10
|
+
* @position Internal hook, not exported from the hooks entry. A long press
|
|
11
|
+
* drives the shared action-group tracker (hooks/actionGroupTracker.ts) for
|
|
12
|
+
* a group that a held pointer slides across. AlertDialog consumes it.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update useActionGroupTracking.test.tsx
|
|
15
|
+
*/
|
|
16
|
+
import { useEffect, useRef, useState } from 'react';
|
|
17
|
+
import { isActive } from "../gestures/GestureRecognizer.js";
|
|
18
|
+
import { LongPressGestureRecognizer } from "../gestures/LongPressGestureRecognizer.js";
|
|
19
|
+
import { lockSelection } from "../utils/selectionLock.js";
|
|
20
|
+
import { useGestureRecognizer } from "../gestures/useGestureRecognizer.js";
|
|
21
|
+
import { UIKIT_PRESS } from "../motion/uikit/gestures.js";
|
|
22
|
+
import { isIosWebKit } from "../utils/touchQueries.js";
|
|
23
|
+
import { createActionGroupTracker } from "./actionGroupTracker.js";
|
|
24
|
+
import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
25
|
+
const PRESS = UIKIT_PRESS;
|
|
26
|
+
|
|
27
|
+
/** The ref handed to the recognizer while tracking is off: no element. */
|
|
28
|
+
const DETACHED = {
|
|
29
|
+
current: null
|
|
30
|
+
};
|
|
31
|
+
const EVERY_POINTER = ['touch', 'pen', 'mouse'];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The group's press: a long press that a second finger on the group ends with
|
|
35
|
+
* nothing acting. A plain long press ignores a second finger.
|
|
36
|
+
*/
|
|
37
|
+
class ActionGroupPress extends LongPressGestureRecognizer {
|
|
38
|
+
acceptsTouch(touch) {
|
|
39
|
+
if (isActive(this.state)) {
|
|
40
|
+
this.setState('cancelled');
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return super.acceptsTouch(touch);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Track a held pointer on the group behind `ref` across the actions inside
|
|
49
|
+
* it, through the shared action-group tracker.
|
|
50
|
+
*/
|
|
51
|
+
export function useActionGroupTracking(ref, options) {
|
|
52
|
+
const optionsRef = useRef(options);
|
|
53
|
+
// Keeps the recognizer's delegate and the tracker, which run outside
|
|
54
|
+
// render, reading the latest options.
|
|
55
|
+
useIsomorphicLayoutEffect(() => {
|
|
56
|
+
optionsRef.current = options;
|
|
57
|
+
});
|
|
58
|
+
// The pointer that started the current press. Only a finger gets the hit
|
|
59
|
+
// expansion; a mouse or a pen hit-tests the actions' exact rects.
|
|
60
|
+
const pointerRef = useRef('touch');
|
|
61
|
+
const landedRef = useRef(null);
|
|
62
|
+
const [tracker] = useState(() => createActionGroupTracker(() => ({
|
|
63
|
+
roots: () => [ref.current],
|
|
64
|
+
itemSelector: optionsRef.current.itemSelector,
|
|
65
|
+
highlightExpansion: pointerRef.current === 'touch' ? optionsRef.current.highlightExpansion : 0,
|
|
66
|
+
onActivate: optionsRef.current.onActivate,
|
|
67
|
+
// The browser's own click for a press the group ran is taken, so the
|
|
68
|
+
// action runs once. The gesture host swallows it for a press it claims.
|
|
69
|
+
// This covers one it does not claim, a mouse under a coarse pointer.
|
|
70
|
+
swallowsNativeClick: true
|
|
71
|
+
})));
|
|
72
|
+
const isEnabled = options.isEnabled ?? true;
|
|
73
|
+
// Synchronizes the tracker with tracking on and mounted. Turning tracking
|
|
74
|
+
// off, or unmounting, drops a tracked press and ends its release fades.
|
|
75
|
+
// The host reports no cancellation to a disabled recognizer, and the lift
|
|
76
|
+
// that runs an action often closes the owner before its fade ends.
|
|
77
|
+
useEffect(() => () => {
|
|
78
|
+
tracker.cancel();
|
|
79
|
+
tracker.dispose();
|
|
80
|
+
}, [tracker, isEnabled]);
|
|
81
|
+
return useGestureRecognizer(isEnabled ? ref : DETACHED, () => new ActionGroupPress({
|
|
82
|
+
name: 'ActionGroupTracking',
|
|
83
|
+
minimumPressDuration: options.highlightOnsetMs,
|
|
84
|
+
allowableMovement: Number.POSITIVE_INFINITY,
|
|
85
|
+
allowedPointerTypes: options.pointerTypes ?? EVERY_POINTER,
|
|
86
|
+
delaysTouchesBegan: true,
|
|
87
|
+
// The hold picks an action, so a held finger or pen starts no text
|
|
88
|
+
// selection and opens no callout while down. A long press brings this
|
|
89
|
+
// lock by default; this hold has no minimum duration, so it names it.
|
|
90
|
+
selectionLock: lockSelection,
|
|
91
|
+
shouldReceiveTouch: (recognizer, touch) => {
|
|
92
|
+
if (recognizer.numberOfTouches === 0) {
|
|
93
|
+
pointerRef.current = touch.pointerType;
|
|
94
|
+
const target = touch.target;
|
|
95
|
+
landedRef.current = typeof target?.nodeType === 'number' ? target : null;
|
|
96
|
+
}
|
|
97
|
+
return receiveTouch(recognizer, touch, optionsRef.current);
|
|
98
|
+
}
|
|
99
|
+
}), recognizer => {
|
|
100
|
+
switch (recognizer.state) {
|
|
101
|
+
case 'began':
|
|
102
|
+
{
|
|
103
|
+
const {
|
|
104
|
+
x,
|
|
105
|
+
y
|
|
106
|
+
} = recognizer.location();
|
|
107
|
+
tracker.begin(x, y, {
|
|
108
|
+
landed: landedRef.current
|
|
109
|
+
});
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 'changed':
|
|
113
|
+
{
|
|
114
|
+
const {
|
|
115
|
+
x,
|
|
116
|
+
y
|
|
117
|
+
} = recognizer.location();
|
|
118
|
+
tracker.move(x, y);
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case 'ended':
|
|
122
|
+
{
|
|
123
|
+
const doc = ref.current?.ownerDocument;
|
|
124
|
+
const focusedBefore = doc?.activeElement ?? null;
|
|
125
|
+
const beganOn = tracker.beganOn;
|
|
126
|
+
// Whether a click on the lifted action would focus it. A mouse's or
|
|
127
|
+
// a pen's pointerdown already gave the engine's answer, on the action
|
|
128
|
+
// it began on. A tap focuses on a later mousedown, which the claimed
|
|
129
|
+
// touch cancels, so the platform answers for a finger.
|
|
130
|
+
// iOS WebKit focuses no tapped button; Chromium and Firefox do.
|
|
131
|
+
const clickFocuses = pointerRef.current === 'touch' ? !isIosWebKit(doc?.defaultView) : beganOn != null && focusedBefore === beganOn;
|
|
132
|
+
const lifted = tracker.end();
|
|
133
|
+
// The lift runs the action's own click(), which moves no focus. So
|
|
134
|
+
// focus moves to the lifted action, unless its click moved focus.
|
|
135
|
+
if (clickFocuses && lifted != null && lifted.isConnected && doc?.activeElement === focusedBefore && focusedBefore !== lifted) {
|
|
136
|
+
lifted.focus({
|
|
137
|
+
preventScroll: true,
|
|
138
|
+
focusVisible: false
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
case 'cancelled':
|
|
144
|
+
tracker.cancel();
|
|
145
|
+
break;
|
|
146
|
+
case 'possible':
|
|
147
|
+
case 'failed':
|
|
148
|
+
// Listeners are not called for these.
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
isEnabled,
|
|
153
|
+
manageStyle: options.manageStyle ?? true,
|
|
154
|
+
actionGroup: true
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The recognizer's should-receive delegate. It also picks the press's clock.
|
|
160
|
+
* Inside a scroller the press waits the content-touch delay and fails past
|
|
161
|
+
* the slop, so the scroller takes a flick. Elsewhere it begins at once, with
|
|
162
|
+
* no movement limit.
|
|
163
|
+
*/
|
|
164
|
+
function receiveTouch(recognizer, touch, options) {
|
|
165
|
+
if (options.shouldTrack?.(touch.target) === false) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
if (recognizer.numberOfTouches === 0) {
|
|
169
|
+
const isInsideScroller = touch.scroll?.isInsideScroller === true;
|
|
170
|
+
recognizer.minimumPressDuration = isInsideScroller ? PRESS.contentTouchDelay.value : options.highlightOnsetMs;
|
|
171
|
+
recognizer.allowableMovement = isInsideScroller ? PRESS.slop.value : Number.POSITIVE_INFINITY;
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useAnimator.ts
|
|
3
|
+
* @input React (useState), the element ref the caller owns, the public
|
|
4
|
+
* animator factory (animator/createAnimator.ts) and useAttachment
|
|
5
|
+
* @output Exports `useAnimator(ref)`: the public animator for the element
|
|
6
|
+
* behind `ref`
|
|
7
|
+
* @position Public hook, exported from `@astryxdesign/core/hooks`. A thin
|
|
8
|
+
* wrapper over `createAnimator` with no behavior of its own.
|
|
9
|
+
*
|
|
10
|
+
* SYNC: When modified, update:
|
|
11
|
+
* - /packages/core/src/hooks/useAnimator.test.tsx
|
|
12
|
+
* - /packages/core/src/hooks/useAnimator.doc.mjs
|
|
13
|
+
*/
|
|
14
|
+
import { type RefObject } from 'react';
|
|
15
|
+
import { type AnimatorHandle } from '../animator/createAnimator.js';
|
|
16
|
+
/**
|
|
17
|
+
* Animates the element behind `ref` with the motion Core uses. Call
|
|
18
|
+
* `animate`, `decay`, `set`, `get`, `getVelocity` or `stop` on the returned
|
|
19
|
+
* animator from event handlers and effects. Pass the same `ref` to a gesture
|
|
20
|
+
* hook to drag and animate one element.
|
|
21
|
+
*
|
|
22
|
+
* The hook makes the animator once, and animating never re-renders the
|
|
23
|
+
* component. After each commit, the animator follows the element behind
|
|
24
|
+
* `ref`, also a node that replaces it. An unmount stops running motion and
|
|
25
|
+
* drops the values. A remount, or a node that replaces the element, starts
|
|
26
|
+
* at rest. While no element is attached, every call does nothing, and
|
|
27
|
+
* `animate` and `decay` resolve at once.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```
|
|
31
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
32
|
+
* const animator = useAnimator(ref);
|
|
33
|
+
* return (
|
|
34
|
+
* <div ref={ref} onClick={() => animator.animate({scale: 1.2})}>
|
|
35
|
+
* Card
|
|
36
|
+
* </div>
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useAnimator(ref: RefObject<HTMLElement | null>): AnimatorHandle;
|
|
41
|
+
//# sourceMappingURL=useAnimator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimator.d.ts","sourceRoot":"","sources":["../../src/hooks/useAnimator.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAW,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAGpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACjC,cAAc,CAehB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useAnimator.ts
|
|
7
|
+
* @input React (useState), the element ref the caller owns, the public
|
|
8
|
+
* animator factory (animator/createAnimator.ts) and useAttachment
|
|
9
|
+
* @output Exports `useAnimator(ref)`: the public animator for the element
|
|
10
|
+
* behind `ref`
|
|
11
|
+
* @position Public hook, exported from `@astryxdesign/core/hooks`. A thin
|
|
12
|
+
* wrapper over `createAnimator` with no behavior of its own.
|
|
13
|
+
*
|
|
14
|
+
* SYNC: When modified, update:
|
|
15
|
+
* - /packages/core/src/hooks/useAnimator.test.tsx
|
|
16
|
+
* - /packages/core/src/hooks/useAnimator.doc.mjs
|
|
17
|
+
*/
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import { createAttachableAnimator } from "../animator/createAnimator.js";
|
|
20
|
+
import { useAttachment } from "./useAttachment.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Animates the element behind `ref` with the motion Core uses. Call
|
|
24
|
+
* `animate`, `decay`, `set`, `get`, `getVelocity` or `stop` on the returned
|
|
25
|
+
* animator from event handlers and effects. Pass the same `ref` to a gesture
|
|
26
|
+
* hook to drag and animate one element.
|
|
27
|
+
*
|
|
28
|
+
* The hook makes the animator once, and animating never re-renders the
|
|
29
|
+
* component. After each commit, the animator follows the element behind
|
|
30
|
+
* `ref`, also a node that replaces it. An unmount stops running motion and
|
|
31
|
+
* drops the values. A remount, or a node that replaces the element, starts
|
|
32
|
+
* at rest. While no element is attached, every call does nothing, and
|
|
33
|
+
* `animate` and `decay` resolve at once.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
38
|
+
* const animator = useAnimator(ref);
|
|
39
|
+
* return (
|
|
40
|
+
* <div ref={ref} onClick={() => animator.animate({scale: 1.2})}>
|
|
41
|
+
* Card
|
|
42
|
+
* </div>
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function useAnimator(ref) {
|
|
47
|
+
const [{
|
|
48
|
+
handle,
|
|
49
|
+
attach
|
|
50
|
+
}] = useState(() => {
|
|
51
|
+
const {
|
|
52
|
+
animator,
|
|
53
|
+
attach: attachElement
|
|
54
|
+
} = createAttachableAnimator();
|
|
55
|
+
// The handle without `destroy`: the hook owns the element's lifetime.
|
|
56
|
+
const {
|
|
57
|
+
destroy: _destroy,
|
|
58
|
+
...handle
|
|
59
|
+
} = animator;
|
|
60
|
+
return {
|
|
61
|
+
handle,
|
|
62
|
+
attach: element => {
|
|
63
|
+
attachElement(element);
|
|
64
|
+
return () => attachElement(null);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
useAttachment(ref, attach, null);
|
|
69
|
+
return handle;
|
|
70
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file useAttachment.ts
|
|
3
|
-
* @input
|
|
3
|
+
* @input Node refs (an element's, or the document's), an attach function
|
|
4
4
|
* and a key
|
|
5
|
-
* @output Exports useAttachment
|
|
6
|
-
* the
|
|
7
|
-
* @position Internal React helper, not in hooks/index.ts: the one attach
|
|
8
|
-
*
|
|
9
|
-
* usePressTracker, useFingerScroll)
|
|
5
|
+
* @output Exports useAttachment and useAttachmentPair (two elements): they keep
|
|
6
|
+
* the attach function bound to the nodes the refs hold across commits
|
|
7
|
+
* @position Internal React helper, not in hooks/index.ts: the one attach and
|
|
8
|
+
* release lifecycle of the gesture hooks, the pager and useAnimator
|
|
10
9
|
*
|
|
11
|
-
* SYNC: When modified, update gestures/__tests__/useGestureRecognizer.test.tsx
|
|
12
|
-
*
|
|
10
|
+
* SYNC: When modified, update gestures/__tests__/useGestureRecognizer.test.tsx,
|
|
11
|
+
* gestures/__tests__/useFingerScroll.test.tsx and
|
|
12
|
+
* __tests__/useAttachmentPair.test.tsx.
|
|
13
13
|
*/
|
|
14
14
|
import { type RefObject } from 'react';
|
|
15
15
|
/**
|
|
@@ -19,4 +19,12 @@ import { type RefObject } from 'react';
|
|
|
19
19
|
* a commit that changes neither does nothing (react-component-runtime INV3).
|
|
20
20
|
*/
|
|
21
21
|
export declare function useAttachment<T extends Node = Element>(ref: RefObject<T | null>, attach: (element: T) => () => void, key: unknown): void;
|
|
22
|
+
/**
|
|
23
|
+
* `useAttachment` for two elements. It keeps `attach` bound to the pair the
|
|
24
|
+
* refs hold after each commit, once both are there. Replacing either element
|
|
25
|
+
* releases the attachment and attaches the new pair. A changed `key`
|
|
26
|
+
* re-attaches, and the last attachment is released on unmount. A commit that
|
|
27
|
+
* changes neither does nothing.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useAttachmentPair<A extends Element, B extends Element>(firstRef: RefObject<A | null>, secondRef: RefObject<B | null>, attach: (first: A, second: B) => () => void, key: unknown): void;
|
|
22
30
|
//# sourceMappingURL=useAttachment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAttachment.d.ts","sourceRoot":"","sources":["../../src/hooks/useAttachment.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAS,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,EACpD,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EACxB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,IAAI,EAClC,GAAG,EAAE,OAAO,GACX,IAAI,
|
|
1
|
+
{"version":3,"file":"useAttachment.d.ts","sourceRoot":"","sources":["../../src/hooks/useAttachment.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAS,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG7C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,GAAG,OAAO,EACpD,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EACxB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,IAAI,EAClC,GAAG,EAAE,OAAO,GACX,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,OAAO,EACpE,QAAQ,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EAC7B,SAAS,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,EAC9B,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,MAAM,IAAI,EAC3C,GAAG,EAAE,OAAO,GACX,IAAI,CAMN"}
|