@astryxdesign/core 0.7.8 → 0.7.9-canary.0200dfe
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/observeMainOverflow.d.ts.map +1 -1
- package/dist/AppShell/observeMainOverflow.js +9 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +37 -3
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +40 -8
- package/dist/BottomSheet/bottomSheetStack.d.ts.map +1 -1
- package/dist/BottomSheet/bottomSheetStack.js +4 -3
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +61 -21
- package/dist/Calendar/Calendar.d.ts +14 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +63 -74
- package/dist/Calendar/getInitialFocusDate.d.ts +4 -1
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -1
- package/dist/Calendar/getInitialFocusDate.js +7 -5
- package/dist/Calendar/hooks/useCalendarDays.d.ts +19 -2
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +57 -64
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts +28 -3
- package/dist/Calendar/hooks/useCalendarNavigation.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarNavigation.js +33 -22
- package/dist/Calendar/styles.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +74 -18
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts +2 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.js +20 -0
- package/dist/CheckboxList/CheckboxListItem.d.ts +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +40 -14
- package/dist/ClickableCard/ClickableCard.d.ts +1 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +5 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +2 -0
- package/dist/DateInput/DateInput.d.ts +37 -6
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +97 -124
- package/dist/DateInput/MonthScroller.d.ts +5 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +26 -29
- package/dist/DateInput/MonthYearWheels.d.ts +10 -1
- package/dist/DateInput/MonthYearWheels.d.ts.map +1 -1
- package/dist/DateInput/MonthYearWheels.js +54 -42
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +7 -1
- package/dist/DateInput/TouchDateField.d.ts +1 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +26 -21
- package/dist/DateInput/monthGeometry.d.ts +42 -8
- package/dist/DateInput/monthGeometry.d.ts.map +1 -1
- package/dist/DateInput/monthGeometry.js +81 -7
- package/dist/DateInput/useCalendarPresentation.d.ts +10 -0
- package/dist/DateInput/useCalendarPresentation.d.ts.map +1 -0
- package/dist/DateInput/useCalendarPresentation.js +32 -0
- package/dist/DateInput/useTypedDate.d.ts +92 -0
- package/dist/DateInput/useTypedDate.d.ts.map +1 -0
- package/dist/DateInput/useTypedDate.js +269 -0
- package/dist/DateInput/wheelStrip.js +2 -2
- package/dist/DateRangeInput/DateRangeInput.d.ts +17 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +15 -8
- package/dist/DateTimeInput/DateTimeInput.d.ts +26 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +92 -88
- package/dist/DateTimeInput/TouchDateTimeField.d.ts +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +26 -20
- package/dist/Dialog/Dialog.d.ts +2 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +14 -3
- package/dist/Drawer/useDrawerDialogPresence.d.ts +2 -1
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +11 -2
- package/dist/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +11 -8
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuCheckboxItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuRadioItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioItem.js +3 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -2
- package/dist/Field/inputDisabledFocus.d.ts +4 -4
- package/dist/Field/inputStyles.stylex.d.ts +1 -1
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +16 -2
- package/dist/HoverCard/useHoverCard.d.ts +3 -1
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts +1 -0
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +6 -18
- package/dist/InputGroup/InputGroup.d.ts +4 -3
- package/dist/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/InputGroup/InputGroup.js +2 -2
- package/dist/InputGroup/InputGroupText.d.ts +2 -1
- package/dist/InputGroup/InputGroupText.d.ts.map +1 -1
- package/dist/InputGroup/InputGroupText.js +2 -1
- package/dist/InputGroup/groupStyles.d.ts +1 -1
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +1 -1
- package/dist/Item/Item.d.ts +20 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +97 -29
- package/dist/Item/ItemListRowContext.d.ts +2 -0
- package/dist/Item/ItemListRowContext.d.ts.map +1 -0
- package/dist/Item/ItemListRowContext.js +16 -0
- package/dist/Layer/holdEntranceInput.d.ts +24 -0
- package/dist/Layer/holdEntranceInput.d.ts.map +1 -0
- package/dist/Layer/holdEntranceInput.js +65 -0
- package/dist/Layer/inputHold.d.ts +49 -0
- package/dist/Layer/inputHold.d.ts.map +1 -0
- package/dist/Layer/inputHold.js +636 -0
- package/dist/Layer/outsidePress.d.ts +4 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +18 -1
- package/dist/Layer/preserveAnimations.d.ts +1 -5
- package/dist/Layer/preserveAnimations.d.ts.map +1 -1
- package/dist/Layer/preserveAnimations.js +12 -214
- package/dist/Layer/useBackdropPress.d.ts +8 -0
- package/dist/Layer/useBackdropPress.d.ts.map +1 -1
- package/dist/Layer/useBackdropPress.js +31 -2
- package/dist/Layer/useLayer.d.ts +3 -1
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +64 -4
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +4 -0
- package/dist/Layout/LayoutContent.d.ts +3 -1
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +12 -4
- package/dist/Layout/LayoutPanel.d.ts +13 -10
- package/dist/Layout/LayoutPanel.d.ts.map +1 -1
- package/dist/Layout/LayoutPanel.js +81 -11
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +4 -0
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +1 -0
- package/dist/List/ListItem.d.ts +5 -4
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +45 -9
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +56 -39
- package/dist/MetadataList/MetadataList.js +1 -1
- package/dist/MobileNav/MobileNav.d.ts +11 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +39 -1
- package/dist/MoreMenu/MoreMenu.d.ts +5 -3
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -9
- package/dist/NumberInput/NumberInput.d.ts +4 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +244 -11
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +7 -2
- package/dist/Popover/usePopover.d.ts +1 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +12 -5
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -1
- package/dist/PowerSearch/formatFilterValue.d.ts +9 -3
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +14 -11
- package/dist/PowerSearch/formatTokenValue.d.ts +6 -2
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +6 -3
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +16 -3
- package/dist/Resizable/ResizeHandle.d.ts +5 -5
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +44 -5
- package/dist/Resizable/resizablePane.d.ts +58 -0
- package/dist/Resizable/resizablePane.d.ts.map +1 -0
- package/dist/Resizable/resizablePane.js +137 -0
- package/dist/Resizable/useResizable.d.ts +7 -0
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +13 -0
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/SelectableCard/SelectableCard.d.ts +1 -1
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +5 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +51 -10
- package/dist/SideNav/SideNav.d.ts +9 -3
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +45 -10
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +14 -71
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.d.ts.map +1 -1
- package/dist/Spinner/spinnerRotor.d.ts +28 -0
- package/dist/Spinner/spinnerRotor.d.ts.map +1 -0
- package/dist/Spinner/spinnerRotor.js +98 -0
- package/dist/Stack/StackItem.d.ts +8 -4
- package/dist/Stack/StackItem.d.ts.map +1 -1
- package/dist/Stack/StackItem.js +17 -4
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +13 -10
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/TabList/Tab.d.ts.map +1 -1
- package/dist/TabList/Tab.js +5 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +1 -1
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -8
- package/dist/Timestamp/formatInstant.d.ts +10 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +13 -27
- package/dist/Timestamp/tooltipEntries.d.ts +5 -3
- package/dist/Timestamp/tooltipEntries.d.ts.map +1 -1
- package/dist/Timestamp/tooltipEntries.js +6 -4
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +9 -0
- package/dist/Token/TokenLink.d.ts +1 -1
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +4 -1
- package/dist/Tokenizer/Tokenizer.d.ts +14 -10
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +189 -89
- package/dist/Tooltip/useTooltip.d.ts +3 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +164 -59
- package/dist/TreeList/TreeListItem.d.ts +2 -1
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -3
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +2 -1
- package/dist/animator/createAnimator.js +2 -2
- package/dist/astryx.css +362 -325
- package/dist/gestures/GestureHost.d.ts +2 -2
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +21 -6
- package/dist/gestures/PanGestureRecognizer.d.ts +11 -1
- package/dist/gestures/PanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/PanGestureRecognizer.js +15 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +6 -1
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.d.ts +3 -6
- package/dist/gestures/nativeScroll.d.ts.map +1 -1
- package/dist/gestures/nativeScroll.js +7 -52
- package/dist/gestures/wheelSegmenter.d.ts +68 -1
- package/dist/gestures/wheelSegmenter.d.ts.map +1 -1
- package/dist/gestures/wheelSegmenter.js +199 -10
- package/dist/hooks/StackItemScrollRegion.d.ts +31 -0
- package/dist/hooks/StackItemScrollRegion.d.ts.map +1 -0
- package/dist/hooks/StackItemScrollRegion.js +40 -0
- package/dist/hooks/computeOverflow.d.ts +2 -0
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +1 -1
- package/dist/hooks/menuPressGesture.d.ts +133 -21
- package/dist/hooks/menuPressGesture.d.ts.map +1 -1
- package/dist/hooks/menuPressGesture.js +155 -30
- package/dist/hooks/menuPressValues.d.ts +16 -0
- package/dist/hooks/menuPressValues.d.ts.map +1 -0
- package/dist/hooks/menuPressValues.js +18 -0
- package/dist/hooks/useClickableContainer.d.ts +36 -7
- package/dist/hooks/useClickableContainer.d.ts.map +1 -1
- package/dist/hooks/useClickableContainer.js +63 -14
- package/dist/hooks/useFocusTrap.d.ts +10 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +225 -132
- package/dist/hooks/useKeyboardHighlight.d.ts +17 -0
- package/dist/hooks/useKeyboardHighlight.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHighlight.js +38 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +37 -12
- package/dist/hooks/useMenuPress.d.ts +34 -1
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +93 -5
- package/dist/hooks/useOverflow.d.ts +10 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +214 -23
- package/dist/hooks/usePressFeedback.d.ts +6 -6
- package/dist/hooks/usePressFeedback.js +6 -6
- package/dist/hooks/useScrollRegionProps.d.ts +35 -0
- package/dist/hooks/useScrollRegionProps.d.ts.map +1 -0
- package/dist/hooks/useScrollRegionProps.js +51 -0
- package/dist/i18n/InternationalizationContext.d.ts +6 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.d.ts +23 -3
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -1
- package/dist/i18n/InternationalizationProvider.js +8 -3
- package/dist/i18n/generated-english/DateInput/DateInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/DateInput.generated.js +0 -1
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts +8 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/DateInput/useTypedDate.generated.js +16 -0
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/DateTimeInput.generated.js +0 -1
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts +8 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/hooks/useScrollRegionProps.generated.js +12 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +5 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +5 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/useCalendarSystem.d.ts +19 -0
- package/dist/i18n/useCalendarSystem.d.ts.map +1 -0
- package/dist/i18n/useCalendarSystem.js +61 -0
- package/dist/internal/calendar-system.d.ts +18 -0
- package/dist/internal/calendar-system.d.ts.map +1 -0
- package/dist/internal/calendar-system.js +19 -0
- package/dist/internal/spinner-rotor.d.ts +16 -0
- package/dist/internal/spinner-rotor.d.ts.map +1 -0
- package/dist/internal/spinner-rotor.js +16 -0
- package/dist/internal/touch.d.ts +20 -2
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +29 -3
- package/dist/motion/animator.d.ts +5 -5
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +7 -6
- package/dist/motion/carryAnimations.d.ts +58 -0
- package/dist/motion/carryAnimations.d.ts.map +1 -0
- package/dist/motion/carryAnimations.js +305 -0
- package/dist/motion/transientCopy.d.ts +4 -2
- package/dist/motion/transientCopy.d.ts.map +1 -1
- package/dist/motion/transientCopy.js +34 -5
- package/dist/motion/uikit/gestures.d.ts +41 -0
- package/dist/motion/uikit/gestures.d.ts.map +1 -1
- package/dist/motion/uikit/gestures.js +25 -0
- package/dist/motion/uikit/index.d.ts +1 -1
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +1 -1
- package/dist/motion/uikit/timing.d.ts +14 -10
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +7 -5
- package/dist/privateAttributes/menuPressLit.stylex.d.ts +52 -0
- package/dist/privateAttributes/menuPressLit.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/menuPressLit.stylex.js +99 -0
- package/dist/privateAttributes/press.stylex.d.ts +142 -0
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/press.stylex.js +101 -0
- package/dist/theme/themeMotion.d.ts +3 -2
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +3 -2
- package/dist/theme/tokens.stylex.d.ts +2 -2
- package/dist/theme/tokens.stylex.js +1 -1
- package/dist/utils/calendarDateParser.d.ts +110 -0
- package/dist/utils/calendarDateParser.d.ts.map +1 -0
- package/dist/utils/calendarDateParser.js +1225 -0
- package/dist/utils/calendarSystem.d.ts +176 -0
- package/dist/utils/calendarSystem.d.ts.map +1 -0
- package/dist/utils/calendarSystem.js +569 -0
- package/dist/utils/coarsePointer.d.ts +5 -0
- package/dist/utils/coarsePointer.d.ts.map +1 -1
- package/dist/utils/coarsePointer.js +22 -13
- package/dist/utils/flatTree.d.ts +6 -3
- package/dist/utils/flatTree.d.ts.map +1 -1
- package/dist/utils/flatTree.js +13 -3
- package/dist/utils/focusReturn.d.ts +34 -13
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +64 -17
- package/dist/utils/hitArea.d.ts +8 -1
- package/dist/utils/hitArea.d.ts.map +1 -1
- package/dist/utils/hitArea.js +99 -9
- package/dist/utils/inputPresentation.d.ts +9 -1
- package/dist/utils/inputPresentation.d.ts.map +1 -1
- package/dist/utils/inputPresentation.js +15 -1
- package/dist/utils/inputStream.d.ts +14 -1
- package/dist/utils/inputStream.d.ts.map +1 -1
- package/dist/utils/inputStream.js +40 -9
- package/dist/utils/interactionOverlay.stylex.d.ts +5 -9
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +29 -31
- package/dist/utils/plainDate.d.ts +38 -7
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +92 -18
- package/dist/utils/pressFeedback.d.ts +10 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +40 -15
- package/dist/utils/pressGesture.d.ts +12 -6
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +26 -8
- package/dist/utils/scrollView.d.ts +25 -0
- package/dist/utils/scrollView.d.ts.map +1 -0
- package/dist/utils/scrollView.js +108 -0
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +1 -10
- package/dist/utils/touchHitArea.d.ts +30 -0
- package/dist/utils/touchHitArea.d.ts.map +1 -0
- package/dist/utils/touchHitArea.js +167 -0
- package/dist/utils/touchHitArea.stylex.d.ts +38 -0
- package/dist/utils/touchHitArea.stylex.d.ts.map +1 -0
- package/dist/utils/touchHitArea.stylex.js +48 -0
- package/dist/utils/triggerFocus.d.ts +5 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -1
- package/dist/utils/triggerFocus.js +9 -2
- package/locales/en.json +21 -1
- package/locales/pseudo.json +15 -0
- package/package.json +15 -4
- package/src/AppShell/observeMainOverflow.ts +9 -6
- package/src/BottomSheet/BottomSheet.tsx +45 -3
- package/src/BottomSheet/BottomSheetPanel.tsx +64 -7
- package/src/BottomSheet/bottomSheetStack.ts +4 -3
- package/src/BottomSheet/useSheetGestures.ts +83 -20
- package/src/Calendar/Calendar.doc.mjs +76 -6
- package/src/Calendar/Calendar.tsx +123 -104
- package/src/Calendar/getInitialFocusDate.ts +22 -8
- package/src/Calendar/hooks/useCalendarDays.ts +89 -63
- package/src/Calendar/hooks/useCalendarNavigation.ts +68 -26
- package/src/CheckboxInput/CheckboxInput.doc.mjs +5 -4
- package/src/CheckboxInput/CheckboxInput.tsx +105 -20
- package/src/CheckboxInput/CheckboxRowPressContext.ts +22 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/CheckboxList/CheckboxListItem.tsx +35 -14
- package/src/ClickableCard/ClickableCard.tsx +8 -1
- package/src/ContextMenu/ContextMenu.tsx +2 -0
- package/src/DateInput/DateInput.doc.mjs +45 -12
- package/src/DateInput/DateInput.tsx +165 -179
- package/src/DateInput/MonthScroller.tsx +39 -37
- package/src/DateInput/MonthYearWheels.tsx +68 -47
- package/src/DateInput/PickerWheel.tsx +7 -2
- package/src/DateInput/TouchDateField.tsx +45 -17
- package/src/DateInput/monthGeometry.ts +110 -8
- package/src/DateInput/useCalendarPresentation.ts +64 -0
- package/src/DateInput/useTypedDate.ts +469 -0
- package/src/DateInput/wheelStrip.ts +2 -2
- package/src/DateRangeInput/DateRangeInput.doc.mjs +9 -0
- package/src/DateRangeInput/DateRangeInput.tsx +43 -9
- package/src/DateTimeInput/DateTimeInput.doc.mjs +42 -9
- package/src/DateTimeInput/DateTimeInput.tsx +138 -148
- package/src/DateTimeInput/TouchDateTimeField.tsx +31 -16
- package/src/Dialog/Dialog.doc.mjs +1 -1
- package/src/Dialog/Dialog.tsx +14 -2
- package/src/Drawer/Drawer.doc.mjs +1 -1
- package/src/Drawer/useDrawerDialogPresence.ts +9 -2
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -2
- package/src/DropdownMenu/DropdownMenu.tsx +31 -7
- package/src/DropdownMenu/DropdownMenuCheckboxItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +8 -4
- package/src/DropdownMenu/DropdownMenuRadioItem.tsx +5 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +5 -1
- package/src/FileInput/FileInput.tsx +16 -2
- package/src/HoverCard/useHoverCard.tsx +3 -1
- package/src/Icon/useIcon.doc.mjs +94 -0
- package/src/InfoTip/InfoTip.doc.mjs +26 -2
- package/src/InfoTip/InfoTip.tsx +6 -27
- package/src/InputGroup/InputGroup.doc.mjs +4 -3
- package/src/InputGroup/InputGroup.tsx +4 -3
- package/src/InputGroup/InputGroupText.doc.mjs +45 -3
- package/src/InputGroup/InputGroupText.tsx +2 -1
- package/src/InputGroup/groupStyles.ts +3 -1
- package/src/Item/Item.tsx +139 -35
- package/src/Item/ItemListRowContext.tsx +18 -0
- package/src/Layer/holdEntranceInput.ts +84 -0
- package/src/Layer/inputHold.ts +734 -0
- package/src/Layer/outsidePress.ts +18 -1
- package/src/Layer/preserveAnimations.ts +12 -275
- package/src/Layer/useBackdropPress.ts +41 -1
- package/src/Layer/useLayer.tsx +77 -4
- package/src/Layer/useTouchTrigger.ts +4 -0
- package/src/Layout/LayoutContent.doc.mjs +6 -3
- package/src/Layout/LayoutContent.tsx +10 -4
- package/src/Layout/LayoutPanel.doc.mjs +14 -11
- package/src/Layout/LayoutPanel.tsx +113 -16
- package/src/Lightbox/Lightbox.tsx +4 -0
- package/src/List/List.doc.mjs +10 -1
- package/src/List/List.tsx +5 -0
- package/src/List/ListItem.tsx +63 -8
- package/src/Markdown/parser.ts +65 -42
- package/src/MetadataList/MetadataList.tsx +1 -1
- package/src/MobileNav/MobileNav.doc.mjs +3 -3
- package/src/MobileNav/MobileNav.tsx +39 -1
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -4
- package/src/MoreMenu/MoreMenu.tsx +5 -3
- package/src/MultiSelector/MultiSelector.tsx +7 -17
- package/src/NumberInput/NumberInput.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.tsx +259 -11
- package/src/OverflowList/OverflowList.tsx +15 -9
- package/src/Popover/usePopover.tsx +1 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +3 -3
- package/src/PowerSearch/PowerSearch.tsx +20 -3
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +4 -1
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/PowerSearch/formatFilterValue.ts +21 -11
- package/src/PowerSearch/formatTokenValue.ts +7 -1
- package/src/RadioList/RadioListItem.doc.mjs +3 -2
- package/src/RadioList/RadioListItem.tsx +16 -6
- package/src/Resizable/Resizable.doc.mjs +40 -12
- package/src/Resizable/ResizeHandle.tsx +68 -6
- package/src/Resizable/resizablePane.ts +179 -0
- package/src/Resizable/useResizable.ts +15 -0
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +3 -3
- package/src/SelectableCard/SelectableCard.tsx +8 -1
- package/src/Selector/Selector.tsx +83 -8
- package/src/SideNav/SideNav.doc.mjs +2 -2
- package/src/SideNav/SideNav.tsx +87 -12
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +7 -89
- package/src/Spinner/index.ts +1 -5
- package/src/Spinner/spinnerRotor.ts +113 -0
- package/src/Stack/Stack.doc.mjs +1 -1
- package/src/Stack/StackItem.tsx +27 -13
- package/src/Switch/Switch.tsx +7 -6
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/TabList/Tab.tsx +5 -1
- package/src/Table/plugins/sortable/useTableSortable.tsx +1 -1
- package/src/Timestamp/Timestamp.doc.mjs +3 -3
- package/src/Timestamp/Timestamp.tsx +13 -8
- package/src/Timestamp/formatInstant.ts +49 -28
- package/src/Timestamp/tooltipEntries.ts +7 -3
- package/src/Token/Token.tsx +18 -1
- package/src/Token/TokenLink.tsx +7 -1
- package/src/Tokenizer/Tokenizer.doc.mjs +3 -3
- package/src/Tokenizer/Tokenizer.tsx +252 -115
- package/src/Tooltip/useTooltip.tsx +180 -80
- package/src/TreeList/TreeListItem.tsx +36 -2
- package/src/Typeahead/BaseTypeahead.tsx +2 -0
- package/src/animator/createAnimator.ts +3 -3
- package/src/gestures/GestureHost.ts +21 -5
- package/src/gestures/PanGestureRecognizer.ts +19 -2
- package/src/gestures/README.md +14 -5
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +6 -1
- package/src/gestures/nativeScroll.ts +12 -68
- package/src/gestures/wheelSegmenter.ts +243 -10
- package/src/hooks/StackItemScrollRegion.tsx +57 -0
- package/src/hooks/computeOverflow.ts +1 -1
- package/src/hooks/menuPressGesture.ts +244 -38
- package/src/hooks/menuPressValues.ts +18 -0
- package/src/hooks/useClickableContainer.doc.mjs +8 -2
- package/src/hooks/useClickableContainer.ts +93 -15
- package/src/hooks/useFocusTrap.ts +268 -151
- package/src/hooks/useKeyboardHighlight.ts +71 -0
- package/src/hooks/useMediaQuery.ts +41 -12
- package/src/hooks/useMenuPress.ts +118 -11
- package/src/hooks/useOverflow.ts +321 -75
- package/src/hooks/usePressFeedback.doc.mjs +3 -3
- package/src/hooks/usePressFeedback.ts +6 -6
- package/src/hooks/useScrollRegionProps.ts +76 -0
- package/src/i18n/InternationalizationContext.ts +6 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +29 -1
- package/src/i18n/InternationalizationProvider.tsx +35 -3
- package/src/i18n/generated-english/DateInput/DateInput.generated.ts +0 -1
- package/src/i18n/generated-english/DateInput/useTypedDate.generated.ts +17 -0
- package/src/i18n/generated-english/DateTimeInput/DateTimeInput.generated.ts +0 -1
- package/src/i18n/generated-english/hooks/useScrollRegionProps.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +7 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +7 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/useCalendarSystem.ts +95 -0
- package/src/internal/calendar-system.ts +26 -0
- package/src/internal/spinner-rotor.ts +20 -0
- package/src/internal/touch.ts +43 -2
- package/src/motion/MEASUREMENTS.md +11 -0
- package/src/motion/README.md +3 -3
- package/src/motion/animator.ts +7 -7
- package/src/motion/carryAnimations.ts +389 -0
- package/src/motion/transientCopy.ts +45 -5
- package/src/motion/uikit/gestures.ts +22 -0
- package/src/motion/uikit/index.ts +1 -0
- package/src/motion/uikit/timing.ts +7 -5
- package/src/privateAttributes/menuPressLit.stylex.ts +104 -0
- package/src/privateAttributes/press.stylex.ts +261 -0
- package/src/theme/themeMotion.ts +3 -2
- package/src/theme/tokens.stylex.ts +1 -1
- package/src/utils/calendarDateParser.ts +1385 -0
- package/src/utils/calendarSystem.ts +832 -0
- package/src/utils/coarsePointer.ts +27 -14
- package/src/utils/flatTree.ts +15 -3
- package/src/utils/focusReturn.ts +78 -18
- package/src/utils/hitArea.ts +138 -9
- package/src/utils/inputPresentation.ts +21 -1
- package/src/utils/inputStream.ts +47 -10
- package/src/utils/interactionOverlay.stylex.ts +19 -22
- package/src/utils/plainDate.ts +130 -19
- package/src/utils/pressFeedback.ts +46 -14
- package/src/utils/pressGesture.ts +35 -9
- package/src/utils/scrollView.ts +135 -0
- package/src/utils/selectionLock.ts +5 -10
- package/src/utils/touchHitArea.stylex.ts +56 -0
- package/src/utils/touchHitArea.ts +177 -0
- package/src/utils/triggerFocus.ts +17 -4
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @input A wheel stream's deltas along one axis, with their event times
|
|
6
6
|
* @output Exports WheelSegmenter and isBunched. WheelSegmenter splits the
|
|
7
7
|
* stream into gestures and reads a trackpad's lift (the onset of momentum).
|
|
8
|
+
* It keeps a trackpad's late or merged glide wheels in their flick.
|
|
8
9
|
* isBunched tells one stall's merge from a frame.
|
|
9
10
|
* @position Read by GestureHost.ts's wheel input: the web reports no
|
|
10
11
|
* trackpad contact or phase, so both are inferred.
|
|
@@ -21,6 +22,25 @@ const BUNCHED_MS = 1.5;
|
|
|
21
22
|
const LIFT_RUN = 4;
|
|
22
23
|
/** And how much of its size the run has lost by then. */
|
|
23
24
|
const LIFT_DECAY = 0.8;
|
|
25
|
+
/** How near a wheel must lie to a sum of the glide's next steps, px. */
|
|
26
|
+
const FIT_PX = 1;
|
|
27
|
+
/** Or as a share of that sum, when the share is larger. */
|
|
28
|
+
const FIT_SHARE = 0.25;
|
|
29
|
+
/** The most glide steps one wheel is read as carrying. */
|
|
30
|
+
const MAX_STEPS = 64;
|
|
31
|
+
/** How near a late or rising wheel must lie to the glide's sum, as a share. */
|
|
32
|
+
const LATE_FIT_SHARE = 0.15;
|
|
33
|
+
/**
|
|
34
|
+
* How far a wheel may grow past the last unbunched one and still be the
|
|
35
|
+
* glide, px.
|
|
36
|
+
*/
|
|
37
|
+
const RISE_PX = 0.5;
|
|
38
|
+
/** A stream's frame interval until it shows its own, ms. */
|
|
39
|
+
const FRAME_MS = 16;
|
|
40
|
+
/** The longest frame interval a trackpad reports at: 60 Hz, ms. */
|
|
41
|
+
const SLOWEST_FRAME_MS = 1000 / 60;
|
|
42
|
+
/** The intervals that set a gesture's frame before its window applies. */
|
|
43
|
+
const FIRST_PACES = 3;
|
|
24
44
|
|
|
25
45
|
/**
|
|
26
46
|
* Whether a wheel `intervalMs` after the one before is one stall's merge, not
|
|
@@ -42,6 +62,16 @@ export function isBunched(intervalMs) {
|
|
|
42
62
|
* decay, or a pause of 50 ms starts a new gesture. A bunched wheel is never
|
|
43
63
|
* a jump. The decay reads it by its last step. Momentum never pauses,
|
|
44
64
|
* reverses or grows.
|
|
65
|
+
*
|
|
66
|
+
* A stalled page receives a trackpad's glide late, and the engine merges the
|
|
67
|
+
* wheels it held. In momentum, a trackpad wheel that the glide's decay
|
|
68
|
+
* explains stays in the flick. It may come after a pause, or rise after more
|
|
69
|
+
* than a frame. It is at or below the next step, or near the sum of the next
|
|
70
|
+
* steps its stall spans. After such a wheel, a trackpad wheel that grows
|
|
71
|
+
* starts a new gesture and takes the late wheel's travel. The decay also
|
|
72
|
+
* reads a trackpad merge in momentum, by its last step. It reads one in a
|
|
73
|
+
* shrinking run too, where it explains the merge better than steady steps
|
|
74
|
+
* do. Other wheels keep the rules above.
|
|
45
75
|
*/
|
|
46
76
|
export class WheelSegmenter {
|
|
47
77
|
gesture = 0;
|
|
@@ -52,40 +82,108 @@ export class WheelSegmenter {
|
|
|
52
82
|
count = 0;
|
|
53
83
|
run = 0;
|
|
54
84
|
runStart = 0;
|
|
55
|
-
|
|
85
|
+
/** The decay's step-to-step ratio, from the last two one-step wheels. */
|
|
86
|
+
ratio = 1;
|
|
87
|
+
/** The gesture's last on-pace intervals, ms: their median is its frame. */
|
|
88
|
+
paces = [];
|
|
89
|
+
/** The intervals in a row that came slower than the frame allows, ms. */
|
|
90
|
+
slower = [];
|
|
91
|
+
/** When the gesture's last wheel within two frames of the one before came. */
|
|
92
|
+
onPace = -Infinity;
|
|
93
|
+
/** The gesture's last wheel that was not bunched, px. */
|
|
94
|
+
paced = 0;
|
|
95
|
+
/** A wheel joined the glide late: a later one that grows is the fingers'. */
|
|
96
|
+
resumed = false;
|
|
97
|
+
/**
|
|
98
|
+
* The signed travel of the last wheel that joined the glide late, with any
|
|
99
|
+
* wheel merged with it.
|
|
100
|
+
*/
|
|
101
|
+
joined = 0;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Reads one wheel. `continuous` is whether it carries a trackpad's
|
|
105
|
+
* signature (`scrollTypeOf`). Only those wheels can join a glide late.
|
|
106
|
+
*/
|
|
107
|
+
push(time, delta, idleMs, continuous = false) {
|
|
56
108
|
const size = Math.abs(delta);
|
|
57
109
|
const sign = Math.sign(delta);
|
|
58
110
|
const gap = time - this.last;
|
|
59
111
|
const bunched = this.count > 0 && isBunched(gap);
|
|
112
|
+
const frame = this.frameMs();
|
|
60
113
|
let boundary = null;
|
|
114
|
+
let carriedSteps = null;
|
|
61
115
|
if (this.count === 0) {
|
|
62
116
|
boundary = this.gesture === 0 ? 'first' : 'idle';
|
|
63
117
|
} else if (this.phase === 'finger' && gap >= idleMs) {
|
|
64
118
|
boundary = 'idle';
|
|
65
119
|
} else if (this.phase === 'momentum') {
|
|
120
|
+
// A late wheel carries the steps of its whole stall, which began at the
|
|
121
|
+
// last wheel that came on pace.
|
|
122
|
+
const frames = Math.round((time - this.onPace) / frame);
|
|
123
|
+
const late = gap >= MOMENTUM_GAP_MS;
|
|
124
|
+
const rises = !bunched && size >= 2 && size > this.previous * 1.3 + 0.5;
|
|
66
125
|
if (sign !== 0 && this.sign !== 0 && sign !== this.sign) {
|
|
67
126
|
boundary = 'reversal';
|
|
68
|
-
} else if (
|
|
69
|
-
|
|
70
|
-
|
|
127
|
+
} else if (late || rises) {
|
|
128
|
+
// A wheel that rises on pace is the fingers'. One that rises after a
|
|
129
|
+
// skipped frame may carry the frames its stall held.
|
|
130
|
+
if (continuous && sign === this.sign && (late || gap >= 1.5 * frame)) {
|
|
131
|
+
carriedSteps = this.glideSteps(size, Math.max(1, frames), LATE_FIT_SHARE);
|
|
132
|
+
}
|
|
133
|
+
if (carriedSteps == null) {
|
|
134
|
+
boundary = late ? 'gap' : 'jump';
|
|
135
|
+
}
|
|
136
|
+
} else if (continuous && this.resumed && !bunched && size > FIT_PX && size > this.paced + RISE_PX) {
|
|
137
|
+
// A glide only falls, so after a late wheel one that grows is the
|
|
138
|
+
// fingers'. A whole-pixel glide repeats a step as it slows.
|
|
71
139
|
boundary = 'jump';
|
|
72
140
|
}
|
|
73
141
|
}
|
|
142
|
+
if (carriedSteps == null && boundary == null && bunched && continuous) {
|
|
143
|
+
if (this.phase === 'momentum') {
|
|
144
|
+
carriedSteps = this.glideSteps(size, MAX_STEPS);
|
|
145
|
+
} else if (this.run > 0) {
|
|
146
|
+
// In a shrinking run, the decay reads a merge only where it explains
|
|
147
|
+
// the merge better than steady steps do.
|
|
148
|
+
const decay = this.glideSteps(size, MAX_STEPS);
|
|
149
|
+
if (decay != null && decay > 1 && Math.abs(size - this.glideSum(decay)) < this.steadyOff(size)) {
|
|
150
|
+
carriedSteps = decay;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
74
154
|
// A bunched wheel carries the steps of the frames it merged. The decay
|
|
75
155
|
// goes on from its last step, so the steps after it read as they are.
|
|
76
|
-
const steps = boundary == null && bunched && this.previous > 0 ? Math.max(1, Math.round(size / this.previous)) : 1;
|
|
156
|
+
const steps = carriedSteps ?? (boundary == null && bunched && this.previous > 0 ? Math.max(1, Math.round(size / this.previous)) : 1);
|
|
157
|
+
// On the decay, a wheel of several steps ends at the decay's own step.
|
|
158
|
+
const onDecay = carriedSteps != null && carriedSteps > 1;
|
|
159
|
+
// A bunched wheel is read by its last step, as the decay goes on from it.
|
|
160
|
+
const step = onDecay ? this.previous * this.ratio ** steps : size / steps;
|
|
77
161
|
if (boundary != null) {
|
|
78
162
|
this.gesture += 1;
|
|
79
163
|
this.phase = 'finger';
|
|
80
164
|
this.count = 0;
|
|
81
165
|
this.run = 0;
|
|
166
|
+
this.ratio = 1;
|
|
167
|
+
this.resumed = false;
|
|
168
|
+
this.paces = [];
|
|
169
|
+
this.slower = [];
|
|
170
|
+
}
|
|
171
|
+
// The late wheel was the fingers' when the next one grows: the new
|
|
172
|
+
// gesture takes its travel.
|
|
173
|
+
const carried = boundary === 'jump' ? this.joined : 0;
|
|
174
|
+
const joinedLate = boundary == null && carriedSteps != null && !bunched;
|
|
175
|
+
if (joinedLate) {
|
|
176
|
+
this.resumed = true;
|
|
177
|
+
}
|
|
178
|
+
// A wheel merged with the late one is the same dispatch: it adds to it.
|
|
179
|
+
this.joined = joinedLate ? delta : bunched && boundary == null && this.joined !== 0 ? this.joined + delta : 0;
|
|
180
|
+
if (!bunched) {
|
|
181
|
+
this.paced = size;
|
|
82
182
|
}
|
|
83
183
|
let liftNow = false;
|
|
84
184
|
let decaying = false;
|
|
85
185
|
if (this.phase === 'finger' && this.count >= 3 && size > 0) {
|
|
86
|
-
|
|
87
|
-
const step = size / steps;
|
|
88
|
-
decaying = step <= this.previous * 0.995 && step >= this.previous * 0.5;
|
|
186
|
+
decaying = onDecay ? this.ratio <= 0.995 : step <= this.previous * 0.995 && step >= this.previous * 0.5;
|
|
89
187
|
if (decaying) {
|
|
90
188
|
if (this.run === 0) {
|
|
91
189
|
this.runStart = this.previous;
|
|
@@ -99,8 +197,17 @@ export class WheelSegmenter {
|
|
|
99
197
|
liftNow = true;
|
|
100
198
|
}
|
|
101
199
|
}
|
|
200
|
+
if (steps === 1 && this.count > 0 && this.previous > 0 && step > 0) {
|
|
201
|
+
this.ratio = Math.min(1, Math.max(0.5, step / this.previous));
|
|
202
|
+
}
|
|
203
|
+
if (!bunched && boundary == null && gap < MOMENTUM_GAP_MS) {
|
|
204
|
+
this.notePace(gap, frame);
|
|
205
|
+
}
|
|
206
|
+
if (boundary != null || !bunched && gap < 2 * frame) {
|
|
207
|
+
this.onPace = time;
|
|
208
|
+
}
|
|
102
209
|
this.count += 1;
|
|
103
|
-
this.previous =
|
|
210
|
+
this.previous = step;
|
|
104
211
|
if (sign !== 0) {
|
|
105
212
|
this.sign = sign;
|
|
106
213
|
}
|
|
@@ -111,10 +218,92 @@ export class WheelSegmenter {
|
|
|
111
218
|
gesture: this.gesture,
|
|
112
219
|
liftNow,
|
|
113
220
|
decaying: decaying && !liftNow,
|
|
114
|
-
bunched: boundary == null && bunched
|
|
221
|
+
bunched: boundary == null && bunched,
|
|
222
|
+
carried
|
|
115
223
|
};
|
|
116
224
|
}
|
|
117
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Keep an interval for the frame. The gesture's first FIRST_PACES set it.
|
|
228
|
+
* After them, only an interval within half a frame and one and a half
|
|
229
|
+
* frames counts: a stall's squeezed wheels come faster. FIRST_PACES slower
|
|
230
|
+
* intervals in a row set the frame again, so a squeezed start cannot hold
|
|
231
|
+
* it down.
|
|
232
|
+
*/
|
|
233
|
+
notePace(gap, frame) {
|
|
234
|
+
const inWindow = gap >= 0.5 * frame && gap <= 1.5 * frame;
|
|
235
|
+
if (this.paces.length < FIRST_PACES || inWindow) {
|
|
236
|
+
this.paces = [...this.paces.slice(-7), gap];
|
|
237
|
+
this.slower = [];
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.slower = gap > 1.5 * frame ? [...this.slower, gap] : [];
|
|
241
|
+
if (this.slower.length >= FIRST_PACES) {
|
|
242
|
+
this.paces = this.slower;
|
|
243
|
+
this.slower = [];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The gesture's frame interval: the median of its last on-pace intervals,
|
|
249
|
+
* or FRAME_MS before it shows one. A trackpad reports at 60 Hz or faster,
|
|
250
|
+
* so a longer median is a stall's.
|
|
251
|
+
*/
|
|
252
|
+
frameMs() {
|
|
253
|
+
if (this.paces.length === 0) {
|
|
254
|
+
return FRAME_MS;
|
|
255
|
+
}
|
|
256
|
+
const sorted = [...this.paces].sort((a, b) => a - b);
|
|
257
|
+
const middle = sorted.length >> 1;
|
|
258
|
+
const median = sorted.length % 2 === 1 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
259
|
+
return Math.min(median, SLOWEST_FRAME_MS);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** The sum of the decay's next `count` steps from `previous`. */
|
|
263
|
+
glideSum(count) {
|
|
264
|
+
let next = this.previous * this.ratio;
|
|
265
|
+
let sum = 0;
|
|
266
|
+
for (let i = 0; i < count; i++) {
|
|
267
|
+
sum += next;
|
|
268
|
+
next *= this.ratio;
|
|
269
|
+
}
|
|
270
|
+
return sum;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* How far a merge of `size` lies from whole steps of the run's steady
|
|
275
|
+
* size, or of its last step, whichever lies nearer.
|
|
276
|
+
*/
|
|
277
|
+
steadyOff(size) {
|
|
278
|
+
return Math.min(...[this.runStart, this.previous].filter(step => step > 0).map(step => Math.abs(size - Math.max(1, Math.round(size / step)) * step)));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* How many of the decay's next steps a trackpad wheel of `size` carries,
|
|
283
|
+
* at most `most`. A wheel at or below the next step carries one. A larger
|
|
284
|
+
* one carries the fewest steps whose sum lies within FIT_PX or `share` of
|
|
285
|
+
* it. The decay goes on from `previous` at `ratio` a step. Null when
|
|
286
|
+
* no sum lies that near.
|
|
287
|
+
*/
|
|
288
|
+
glideSteps(size, most, share = FIT_SHARE) {
|
|
289
|
+
if (this.previous <= 0 || size <= 0) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
let next = this.previous * this.ratio;
|
|
293
|
+
if (size <= next + FIT_PX) {
|
|
294
|
+
return 1;
|
|
295
|
+
}
|
|
296
|
+
let sum = next;
|
|
297
|
+
for (let count = 2; count <= Math.min(most, MAX_STEPS); count++) {
|
|
298
|
+
next *= this.ratio;
|
|
299
|
+
sum += next;
|
|
300
|
+
if (Math.abs(size - sum) <= Math.max(FIT_PX, sum * share)) {
|
|
301
|
+
return count;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
118
307
|
/** The gesture ended on its own (its timer): the next event starts one. */
|
|
119
308
|
end() {
|
|
120
309
|
this.count = 0;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file StackItemScrollRegion.tsx
|
|
3
|
+
* @input A scrollable `div` or `span` StackItem's props, ref and children
|
|
4
|
+
* @output StackItemScrollRegion (internal; not re-exported from
|
|
5
|
+
* hooks/index.ts), which renders that element and names it as a group
|
|
6
|
+
* while its content overflows
|
|
7
|
+
* @position Internal client island for StackItem, which itself stays a
|
|
8
|
+
* static render. Only a scrollable `div` or `span` item measures its
|
|
9
|
+
* overflow, on the client; another element keeps its own role.
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/Stack/StackItem.tsx
|
|
13
|
+
* - /packages/core/src/serverSafeComponents.test.ts
|
|
14
|
+
*/
|
|
15
|
+
import { type AriaRole, type ReactNode, type Ref } from 'react';
|
|
16
|
+
export interface StackItemScrollRegionProps {
|
|
17
|
+
as: 'div' | 'span';
|
|
18
|
+
ref?: Ref<HTMLElement>;
|
|
19
|
+
elementProps: {
|
|
20
|
+
role?: AriaRole;
|
|
21
|
+
'aria-label'?: string;
|
|
22
|
+
[prop: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export declare function StackItemScrollRegion({ as: element, ref, elementProps, children, }: StackItemScrollRegionProps): import("react").DetailedReactHTMLElement<{
|
|
27
|
+
ref: import("react").RefCallback<HTMLElement>;
|
|
28
|
+
role: AriaRole | undefined;
|
|
29
|
+
'aria-label': string | undefined;
|
|
30
|
+
}, HTMLElement>;
|
|
31
|
+
//# sourceMappingURL=StackItemScrollRegion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StackItemScrollRegion.d.ts","sourceRoot":"","sources":["../../src/hooks/StackItemScrollRegion.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAgB,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAI7E,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,KAAK,GAAG,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACvB,YAAY,EAAE;QACZ,IAAI,CAAC,EAAE,QAAQ,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,EAAE,EAAE,OAAO,EACX,GAAG,EACH,YAAY,EACZ,QAAQ,GACT,EAAE,0BAA0B;;;;gBAiB5B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file StackItemScrollRegion.tsx
|
|
7
|
+
* @input A scrollable `div` or `span` StackItem's props, ref and children
|
|
8
|
+
* @output StackItemScrollRegion (internal; not re-exported from
|
|
9
|
+
* hooks/index.ts), which renders that element and names it as a group
|
|
10
|
+
* while its content overflows
|
|
11
|
+
* @position Internal client island for StackItem, which itself stays a
|
|
12
|
+
* static render. Only a scrollable `div` or `span` item measures its
|
|
13
|
+
* overflow, on the client; another element keeps its own role.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update:
|
|
16
|
+
* - /packages/core/src/Stack/StackItem.tsx
|
|
17
|
+
* - /packages/core/src/serverSafeComponents.test.ts
|
|
18
|
+
*/
|
|
19
|
+
import { createElement } from 'react';
|
|
20
|
+
import { useMergedRefs } from "./useMergedRefs.js";
|
|
21
|
+
import { useScrollRegionProps } from "./useScrollRegionProps.js";
|
|
22
|
+
export function StackItemScrollRegion({
|
|
23
|
+
as: element,
|
|
24
|
+
ref,
|
|
25
|
+
elementProps,
|
|
26
|
+
children
|
|
27
|
+
}) {
|
|
28
|
+
const region = useScrollRegionProps({
|
|
29
|
+
isScrollable: true,
|
|
30
|
+
role: elementProps.role,
|
|
31
|
+
label: elementProps['aria-label']
|
|
32
|
+
});
|
|
33
|
+
const mergedRef = useMergedRefs(ref, region.ref);
|
|
34
|
+
return /*#__PURE__*/createElement(element, {
|
|
35
|
+
...elementProps,
|
|
36
|
+
ref: mergedRef,
|
|
37
|
+
role: region.role,
|
|
38
|
+
'aria-label': region['aria-label']
|
|
39
|
+
}, children);
|
|
40
|
+
}
|
|
@@ -38,6 +38,8 @@ export interface ComputeOverflowResult {
|
|
|
38
38
|
/** Number of rows the visible items occupy (always 1 for the single-line path). */
|
|
39
39
|
rows: number;
|
|
40
40
|
}
|
|
41
|
+
/** Count how many rows a set of items occupies when wrapped at availableWidth. */
|
|
42
|
+
export declare function countRows(orderedWidths: number[], gap: number, availableWidth: number): number;
|
|
41
43
|
/**
|
|
42
44
|
* Pure overflow computation. Given plain measurements and the configured
|
|
43
45
|
* limits, return how many items should be visible and how many rows they
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/computeOverflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"computeOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/computeOverflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;AAwHD,kFAAkF;AAClF,wBAAgB,SAAS,CACvB,aAAa,EAAE,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,MAAM,CAkBR;AA2CD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,qBAAqB,CAqDvB"}
|
|
@@ -107,7 +107,7 @@ function packRows(orderedWidths, gap, availableWidth, indicatorReserve, maxRows)
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/** Count how many rows a set of items occupies when wrapped at availableWidth. */
|
|
110
|
-
function countRows(orderedWidths, gap, availableWidth) {
|
|
110
|
+
export function countRows(orderedWidths, gap, availableWidth) {
|
|
111
111
|
if (orderedWidths.length === 0) {
|
|
112
112
|
return 0;
|
|
113
113
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @output The pure `menuPressStep` state machine, its state, event and effect
|
|
5
|
-
* types, and the settle constant
|
|
6
|
-
* @position Pure module under `useMenuPress`. It has no DOM and no React, so
|
|
7
|
-
* a unit test can check each transition without a browser.
|
|
8
|
-
*
|
|
9
|
-
* SYNC: When modified, update:
|
|
10
|
-
* - /packages/core/src/hooks/menuPressGesture.test.ts
|
|
11
|
-
* - /packages/core/src/hooks/useMenuPress.ts
|
|
2
|
+
* How long the opening press must last before its release may act, unless a
|
|
3
|
+
* finger's handoff applies.
|
|
12
4
|
*/
|
|
13
|
-
/** How long the opening press must last before its release may act. */
|
|
14
5
|
export declare const MENU_PRESS_SETTLE_MS = 300;
|
|
6
|
+
/**
|
|
7
|
+
* How far a finger that opened the menu travels, from the first sample the
|
|
8
|
+
* menu sees, before it starts picking (UIMenu's scrub handoff).
|
|
9
|
+
*/
|
|
10
|
+
export declare const MENU_PRESS_HANDOFF_PX: number;
|
|
15
11
|
export type MenuPressPointerType = 'mouse' | 'touch' | 'pen';
|
|
16
|
-
|
|
12
|
+
/** @internal The machine's own shape, with the finger's handoff; not public contract. */
|
|
13
|
+
export type MenuPressState<T> = {
|
|
17
14
|
phase: 'idle';
|
|
18
15
|
} | {
|
|
19
16
|
phase: 'triggerPress';
|
|
@@ -23,6 +20,15 @@ export type MenuPressGesture<T> = {
|
|
|
23
20
|
phase: 'open';
|
|
24
21
|
pointerType: MenuPressPointerType;
|
|
25
22
|
openedAt: number;
|
|
23
|
+
/**
|
|
24
|
+
* A finger's handoff: the first position the menu saw after it opened,
|
|
25
|
+
* which the scrub distance is counted from. Unset until that sample.
|
|
26
|
+
* @internal Not public contract.
|
|
27
|
+
*/
|
|
28
|
+
handoffFrom?: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
};
|
|
26
32
|
} | {
|
|
27
33
|
phase: 'tracking';
|
|
28
34
|
pointerType: MenuPressPointerType;
|
|
@@ -31,7 +37,8 @@ export type MenuPressGesture<T> = {
|
|
|
31
37
|
/** The enabled row currently under the pointer, if any. */
|
|
32
38
|
row: T | null;
|
|
33
39
|
};
|
|
34
|
-
|
|
40
|
+
/** @internal The machine's own shape, with the finger's handoff; not public contract. */
|
|
41
|
+
export type MenuPressInput<T> = {
|
|
35
42
|
type: 'down';
|
|
36
43
|
target: 'trigger' | 'menu';
|
|
37
44
|
pointerType: MenuPressPointerType;
|
|
@@ -48,18 +55,33 @@ export type MenuPressEvent<T> = {
|
|
|
48
55
|
row: T | null;
|
|
49
56
|
isInMenu: boolean;
|
|
50
57
|
time: number;
|
|
58
|
+
/**
|
|
59
|
+
* Viewport position, for a finger's handoff distance.
|
|
60
|
+
* @internal Not public contract.
|
|
61
|
+
*/
|
|
62
|
+
x?: number;
|
|
63
|
+
/** @internal See `x`. */
|
|
64
|
+
y?: number;
|
|
51
65
|
} | {
|
|
52
66
|
type: 'up';
|
|
53
67
|
row: T | null;
|
|
54
68
|
isInMenu: boolean;
|
|
55
69
|
isOnTrigger: boolean;
|
|
56
70
|
time: number;
|
|
71
|
+
/**
|
|
72
|
+
* Viewport position, for a finger's handoff distance.
|
|
73
|
+
* @internal Not public contract.
|
|
74
|
+
*/
|
|
75
|
+
x?: number;
|
|
76
|
+
/** @internal See `x`. */
|
|
77
|
+
y?: number;
|
|
57
78
|
}
|
|
58
79
|
/** The browser took the gesture: pointercancel, a second pointer, a scroll. */
|
|
59
80
|
| {
|
|
60
81
|
type: 'cancel';
|
|
61
82
|
};
|
|
62
|
-
|
|
83
|
+
/** @internal The machine's own shape, with the finger's handoff; not public contract. */
|
|
84
|
+
export type MenuPressOutcome<T> = {
|
|
63
85
|
type: 'none';
|
|
64
86
|
}
|
|
65
87
|
/** A mouse pressed the trigger: open the menu now, under the held pointer. */
|
|
@@ -77,18 +99,19 @@ export type MenuPressEffect<T> = {
|
|
|
77
99
|
/**
|
|
78
100
|
* The gesture ended without a row acting. `stray` says whether the browser
|
|
79
101
|
* will still report a `click` for this gesture that must not act; `dismiss`
|
|
80
|
-
* says the menu should close
|
|
102
|
+
* says the menu should close: a mouse released outside it.
|
|
81
103
|
*/
|
|
82
104
|
| {
|
|
83
105
|
type: 'settle';
|
|
84
106
|
stray: boolean;
|
|
85
107
|
dismiss: boolean;
|
|
86
108
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
109
|
+
/** @internal The machine's own shape, with the finger's handoff; not public contract. */
|
|
110
|
+
export interface MenuPressTransition<T> {
|
|
111
|
+
gesture: MenuPressState<T>;
|
|
112
|
+
effect: MenuPressOutcome<T>;
|
|
90
113
|
}
|
|
91
|
-
export declare const IDLE_MENU_PRESS:
|
|
114
|
+
export declare const IDLE_MENU_PRESS: MenuPressState<never>;
|
|
92
115
|
/**
|
|
93
116
|
* Advance the gesture by one event. Pure: same inputs, same output.
|
|
94
117
|
*
|
|
@@ -97,10 +120,15 @@ export declare const IDLE_MENU_PRESS: MenuPressGesture<never>;
|
|
|
97
120
|
* - `idle`: no gesture is live.
|
|
98
121
|
* - `triggerPress`: a finger rests on the trigger, and the menu is not open
|
|
99
122
|
* yet. A mouse press on the trigger skips this state and opens at once.
|
|
100
|
-
* - `open`: the menu opened under a held pointer, and the pointer
|
|
101
|
-
*
|
|
123
|
+
* - `open`: the menu opened under a held pointer, and the pointer does not
|
|
124
|
+
* pick yet.
|
|
102
125
|
* - `tracking`: the pointer is held, and the highlight follows it.
|
|
103
126
|
*
|
|
127
|
+
* A finger or a pen that opened the menu picks only after it travels
|
|
128
|
+
* `MENU_PRESS_HANDOFF_PX` from the first position the menu sees. UIMenu
|
|
129
|
+
* hands off the same way. Until then nothing lights, and its lift acts on
|
|
130
|
+
* nothing. A host that reports no positions keeps the settle rule.
|
|
131
|
+
*
|
|
104
132
|
* The settle rule: the release of the opening gesture acts only after the
|
|
105
133
|
* pointer entered the menu or the press lasted `MENU_PRESS_SETTLE_MS`. Else a
|
|
106
134
|
* menu that opens under the pointer would pick a row that nobody chose.
|
|
@@ -108,6 +136,90 @@ export declare const IDLE_MENU_PRESS: MenuPressGesture<never>;
|
|
|
108
136
|
* Rows are opaque (`T`). The hook feeds in the enabled row under the
|
|
109
137
|
* pointer, or `null` over a divider, a heading, a disabled row, or outside
|
|
110
138
|
* the menu.
|
|
139
|
+
*
|
|
140
|
+
* @internal The machine's own shape, with the finger's handoff; not public
|
|
141
|
+
* contract.
|
|
142
|
+
*/
|
|
143
|
+
export declare function menuPressTransition<T>(gesture: MenuPressState<T>, event: MenuPressInput<T>): MenuPressTransition<T>;
|
|
144
|
+
export type MenuPressGesture<T> = {
|
|
145
|
+
phase: 'idle';
|
|
146
|
+
} | {
|
|
147
|
+
phase: 'triggerPress';
|
|
148
|
+
pointerType: MenuPressPointerType;
|
|
149
|
+
startedAt: number;
|
|
150
|
+
} | {
|
|
151
|
+
phase: 'open';
|
|
152
|
+
pointerType: MenuPressPointerType;
|
|
153
|
+
openedAt: number;
|
|
154
|
+
} | {
|
|
155
|
+
phase: 'tracking';
|
|
156
|
+
pointerType: MenuPressPointerType;
|
|
157
|
+
/** Where the press began. */
|
|
158
|
+
origin: 'trigger' | 'menu';
|
|
159
|
+
/** The enabled row currently under the pointer, if any. */
|
|
160
|
+
row: T | null;
|
|
161
|
+
};
|
|
162
|
+
export type MenuPressEvent<T> = {
|
|
163
|
+
type: 'down';
|
|
164
|
+
target: 'trigger' | 'menu';
|
|
165
|
+
pointerType: MenuPressPointerType;
|
|
166
|
+
/** The enabled row under the press when it lands inside the menu. */
|
|
167
|
+
row: T | null;
|
|
168
|
+
time: number;
|
|
169
|
+
}
|
|
170
|
+
/** The menu opened while the trigger press is still held. */
|
|
171
|
+
| {
|
|
172
|
+
type: 'opened';
|
|
173
|
+
time: number;
|
|
174
|
+
} | {
|
|
175
|
+
type: 'move';
|
|
176
|
+
row: T | null;
|
|
177
|
+
isInMenu: boolean;
|
|
178
|
+
time: number;
|
|
179
|
+
} | {
|
|
180
|
+
type: 'up';
|
|
181
|
+
row: T | null;
|
|
182
|
+
isInMenu: boolean;
|
|
183
|
+
isOnTrigger: boolean;
|
|
184
|
+
time: number;
|
|
185
|
+
}
|
|
186
|
+
/** The browser took the gesture: pointercancel, a second pointer, a scroll. */
|
|
187
|
+
| {
|
|
188
|
+
type: 'cancel';
|
|
189
|
+
};
|
|
190
|
+
export type MenuPressEffect<T> = {
|
|
191
|
+
type: 'none';
|
|
192
|
+
}
|
|
193
|
+
/** A mouse pressed the trigger: open the menu now, under the held pointer. */
|
|
194
|
+
| {
|
|
195
|
+
type: 'open';
|
|
196
|
+
} | {
|
|
197
|
+
type: 'highlight';
|
|
198
|
+
row: T;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'clear';
|
|
201
|
+
} | {
|
|
202
|
+
type: 'act';
|
|
203
|
+
row: T;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The gesture ends without a row acting. Its `stray` flag is true when the
|
|
207
|
+
* browser still sends a `click` for this gesture. That click must not act.
|
|
208
|
+
* Its `dismiss` flag is true when the menu must close (a mouse released
|
|
209
|
+
* outside it).
|
|
210
|
+
*/
|
|
211
|
+
| {
|
|
212
|
+
type: 'settle';
|
|
213
|
+
stray: boolean;
|
|
214
|
+
dismiss: boolean;
|
|
215
|
+
};
|
|
216
|
+
export interface MenuPressStep<T> {
|
|
217
|
+
gesture: MenuPressGesture<T>;
|
|
218
|
+
effect: MenuPressEffect<T>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* The menu press machine, as released: one step from a gesture and an event
|
|
222
|
+
* to the next gesture and the effect to apply. Pure.
|
|
111
223
|
*/
|
|
112
224
|
export declare function menuPressStep<T>(gesture: MenuPressGesture<T>, event: MenuPressEvent<T>): MenuPressStep<T>;
|
|
113
225
|
//# sourceMappingURL=menuPressGesture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menuPressGesture.d.ts","sourceRoot":"","sources":["../../src/hooks/menuPressGesture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"menuPressGesture.d.ts","sourceRoot":"","sources":["../../src/hooks/menuPressGesture.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAoC,CAAC;AAEzE,MAAM,MAAM,oBAAoB,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