@astryxdesign/core 0.7.7 → 0.7.8-canary.0588a13
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 +46 -6
- package/dist/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +11 -3
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +1 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +55 -18
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +5 -0
- package/dist/BottomSheet/bottomSheetStack.js +1 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +3 -1
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +16 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +17 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +18 -22
- package/dist/Calendar/getWeekdayHeaderNames.d.ts +16 -0
- package/dist/Calendar/getWeekdayHeaderNames.d.ts.map +1 -0
- package/dist/Calendar/getWeekdayHeaderNames.js +70 -0
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +2 -10
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.d.ts → weekdayHeaderNames.generated.d.ts} +14 -14
- package/dist/Calendar/weekdayHeaderNames.generated.d.ts.map +1 -0
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.js → weekdayHeaderNames.generated.js} +12 -12
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -0
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +6 -1
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +2 -1
- package/dist/Chat/useChatDictation.d.ts.map +1 -1
- package/dist/Chat/useChatDictation.js +2 -0
- package/dist/Chat/useChatNewMessages.js +1 -1
- package/dist/Chat/useChatStreamScroll.d.ts.map +1 -1
- package/dist/Chat/useChatStreamScroll.js +2 -0
- package/dist/Chat/useSpeechRecognition.d.ts.map +1 -1
- package/dist/Chat/useSpeechRecognition.js +3 -0
- package/dist/Chat/useTriggerMenu.js +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +17 -12
- package/dist/CheckboxList/CheckboxList.d.ts +20 -2
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +12 -4
- package/dist/CheckboxList/CheckboxListContext.d.ts +7 -0
- package/dist/CheckboxList/CheckboxListContext.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListContext.js +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +14 -2
- package/dist/CheckboxList/requiredGroup.d.ts +22 -0
- package/dist/CheckboxList/requiredGroup.d.ts.map +1 -0
- package/dist/CheckboxList/requiredGroup.js +52 -0
- package/dist/CodeBlock/CodeBlock.d.ts +10 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +28 -11
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +2 -0
- package/dist/CommandPalette/CommandPaletteItem.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteItem.js +2 -0
- 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/ContextMenu/ContextMenu.js +2 -2
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +5 -2
- package/dist/DateInput/PickerWheel.d.ts +19 -0
- package/dist/DateInput/PickerWheel.d.ts.map +1 -0
- package/dist/DateInput/PickerWheel.js +646 -0
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +9 -30
- package/dist/DateInput/Wheel.d.ts +18 -37
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +133 -120
- package/dist/DateInput/datePickerTouch.d.ts +13 -0
- package/dist/DateInput/datePickerTouch.d.ts.map +1 -0
- package/dist/DateInput/datePickerTouch.js +14 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts +10 -0
- package/dist/DateInput/useOwnScrollGesture.d.ts.map +1 -1
- package/dist/DateInput/useOwnScrollGesture.js +16 -3
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +2 -0
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
- package/dist/DateInput/useScrollSettle.js +3 -0
- package/dist/DateInput/useWheelListbox.d.ts +59 -0
- package/dist/DateInput/useWheelListbox.d.ts.map +1 -0
- package/dist/DateInput/useWheelListbox.js +88 -0
- package/dist/DateInput/wheelOptions.d.ts +94 -0
- package/dist/DateInput/wheelOptions.d.ts.map +1 -0
- package/dist/DateInput/wheelOptions.js +110 -0
- package/dist/DateInput/wheelPhysics.d.ts +127 -0
- package/dist/DateInput/wheelPhysics.d.ts.map +1 -0
- package/dist/DateInput/wheelPhysics.js +341 -0
- package/dist/DateInput/wheelStrip.d.ts +92 -0
- package/dist/DateInput/wheelStrip.d.ts.map +1 -0
- package/dist/DateInput/wheelStrip.js +258 -0
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +70 -127
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +9 -32
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -1
- package/dist/Drawer/useDrawerDialogPresence.js +3 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -1
- package/dist/DropdownMenu/useMenuOverflow.js +5 -0
- package/dist/Field/Field.js +2 -2
- package/dist/FieldStatus/useFieldStatusAnnouncement.d.ts.map +1 -1
- package/dist/FieldStatus/useFieldStatusAnnouncement.js +1 -0
- package/dist/FormLayout/FormLayout.d.ts +5 -1
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.d.ts +6 -4
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +48 -3
- package/dist/HoverCard/useHoverCard.d.ts +5 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +26 -34
- package/dist/Icon/Icon.d.ts +5 -1
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +20 -3
- package/dist/InfoTip/InfoTip.d.ts +5 -5
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +58 -19
- package/dist/Item/useSwipeAction.d.ts.map +1 -1
- package/dist/Item/useSwipeAction.js +3 -0
- package/dist/Layer/modalOutlet.d.ts.map +1 -1
- package/dist/Layer/modalOutlet.js +2 -0
- package/dist/Layer/outsidePress.d.ts.map +1 -1
- package/dist/Layer/outsidePress.js +1 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +4 -1
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -1
- package/dist/Layer/useLayerDismissal.js +3 -0
- package/dist/Layer/useTouchTrigger.d.ts +13 -7
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +20 -6
- package/dist/Layout/index.d.ts +1 -1
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +1 -1
- package/dist/Layout/layoutReset.js +1 -1
- package/dist/Layout/overlayPaddingReset.stylex.d.ts +68 -0
- package/dist/Layout/overlayPaddingReset.stylex.d.ts.map +1 -0
- package/dist/Layout/overlayPaddingReset.stylex.js +72 -0
- package/dist/Layout/padding.stylex.d.ts +5 -129
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +9 -143
- package/dist/Layout/paddingStyles.stylex.d.ts +83 -0
- package/dist/Layout/paddingStyles.stylex.d.ts.map +1 -0
- package/dist/Layout/paddingStyles.stylex.js +99 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +20 -1
- package/dist/MobileNav/MobileNav.d.ts +3 -2
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +10 -26
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +2 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +2 -1
- package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
- package/dist/Outline/useOutlineFromDOM.js +3 -0
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +3 -0
- package/dist/OverflowList/OverflowList.d.ts.map +1 -1
- package/dist/OverflowList/OverflowList.js +3 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +7 -2
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +6 -0
- package/dist/Popover/usePopover.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts +41 -4
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +441 -134
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +125 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -0
- package/dist/PowerSearch/PowerSearchBottomSheet.js +2041 -0
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +35 -2
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +43 -10
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +4 -2
- package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +3 -2
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts +38 -3
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +273 -86
- package/dist/PowerSearch/formatFilterValue.d.ts +14 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +31 -23
- package/dist/PowerSearch/formatTokenValue.d.ts +28 -0
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -0
- package/dist/PowerSearch/formatTokenValue.js +161 -0
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.d.ts.map +1 -1
- package/dist/PowerSearch/powerSearchDateZone.d.ts +25 -0
- package/dist/PowerSearch/powerSearchDateZone.d.ts.map +1 -0
- package/dist/PowerSearch/powerSearchDateZone.js +57 -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/PowerSearch/types.d.ts +8 -1
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBarTouch.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBarTouch.js +2 -0
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -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 +2 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +116 -92
- package/dist/Resizable/createResizable.d.ts +199 -0
- package/dist/Resizable/createResizable.d.ts.map +1 -0
- package/dist/Resizable/createResizable.js +733 -0
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.d.ts +3 -3
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +252 -459
- package/dist/SegmentedControl/useSegmentedSelectionMotion.d.ts.map +1 -1
- package/dist/SegmentedControl/useSegmentedSelectionMotion.js +3 -3
- package/dist/SelectableCard/SelectableCard.d.ts +2 -0
- package/dist/SelectableCard/SelectableCard.d.ts.map +1 -1
- package/dist/SelectableCard/SelectableCard.js +36 -11
- package/dist/SelectableCard/selectableCardInput.d.ts +12 -0
- package/dist/SelectableCard/selectableCardInput.d.ts.map +1 -0
- package/dist/SelectableCard/selectableCardInput.js +20 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +7 -9
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +36 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +16 -11
- package/dist/Slider/sliderTouchController.js +2 -2
- package/dist/Spinner/Spinner.d.ts +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +60 -58
- package/dist/Stepper/Stepper.d.ts.map +1 -1
- package/dist/Stepper/Stepper.js +10 -15
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -10
- package/dist/Switch/useSwitchTouch.js +4 -4
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +29 -8
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +3 -1
- package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
- package/dist/Table/plugins/filtering/useTableFiltering.js +2 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +12 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +17 -3
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +2 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +27 -14
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -1
- package/dist/TextInput/TextInput.d.ts +2 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +12 -8
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +2 -0
- package/dist/TimeInput/TimeWheels.d.ts +32 -0
- package/dist/TimeInput/TimeWheels.d.ts.map +1 -0
- package/dist/TimeInput/TimeWheels.js +144 -0
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +63 -116
- package/dist/TimeInput/timeWheelRules.d.ts +124 -0
- package/dist/TimeInput/timeWheelRules.d.ts.map +1 -0
- package/dist/TimeInput/timeWheelRules.js +277 -0
- package/dist/Timer/Timer.d.ts.map +1 -1
- package/dist/Timer/Timer.js +2 -0
- package/dist/Timestamp/Timestamp.js +1 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +1 -23
- package/dist/Toast/Toast.d.ts +11 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +25 -15
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +97 -34
- package/dist/Toast/types.d.ts +9 -3
- package/dist/Toast/types.d.ts.map +1 -1
- package/dist/Toast/useToast.d.ts.map +1 -1
- package/dist/Toast/useToast.js +1 -0
- package/dist/Tokenizer/Tokenizer.d.ts +44 -46
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +20 -21
- package/dist/Tokenizer/TokenizerBottomSheet.d.ts +1 -1
- package/dist/Tokenizer/TokenizerBottomSheet.js +12 -18
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.d.ts +2 -23
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -29
- package/dist/Tooltip/useTooltip.d.ts +23 -30
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +200 -108
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +27 -18
- package/dist/Typeahead/TypeaheadItem.d.ts +2 -1
- package/dist/Typeahead/TypeaheadItem.d.ts.map +1 -1
- 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 +53 -8
- package/dist/gestures/GestureHost.d.ts +16 -1
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +4 -1
- package/dist/gestures/PressTracker.d.ts.map +1 -1
- package/dist/gestures/PressTracker.js +4 -3
- package/dist/hooks/ModalAnnounceProvider.d.ts.map +1 -1
- package/dist/hooks/ModalAnnounceProvider.js +1 -0
- package/dist/hooks/actionGroupTracker.d.ts +4 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +18 -7
- 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/longPressDetector.d.ts +66 -0
- package/dist/hooks/longPressDetector.d.ts.map +1 -0
- package/dist/hooks/longPressDetector.js +200 -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/rootScrollStyles.d.ts +48 -0
- package/dist/hooks/rootScrollStyles.d.ts.map +1 -0
- package/dist/hooks/rootScrollStyles.js +207 -0
- package/dist/hooks/scrollLockTouchGuard.d.ts +13 -0
- package/dist/hooks/scrollLockTouchGuard.d.ts.map +1 -0
- package/dist/hooks/scrollLockTouchGuard.js +117 -0
- package/dist/hooks/scrollbarGutter.d.ts +4 -4
- package/dist/hooks/scrollbarGutter.d.ts.map +1 -1
- package/dist/hooks/scrollbarGutter.js +36 -23
- 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/useAnnounceRenderedText.d.ts.map +1 -1
- package/dist/hooks/useAnnounceRenderedText.js +1 -0
- package/dist/hooks/useAttachment.d.ts +1 -1
- package/dist/hooks/useAttachment.js +1 -1
- package/dist/hooks/useAutoMediaMode.d.ts.map +1 -1
- package/dist/hooks/useAutoMediaMode.js +1 -0
- package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -1
- package/dist/hooks/useBusyAnnouncement.js +2 -0
- package/dist/hooks/useDevWarning.d.ts.map +1 -1
- package/dist/hooks/useDevWarning.js +2 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +2 -0
- package/dist/hooks/useGridFocus.d.ts +8 -5
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +4 -3
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +3 -0
- package/dist/hooks/useImageMode.d.ts.map +1 -1
- package/dist/hooks/useImageMode.js +3 -0
- 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/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/hooks/useKeyboardHint.js +1 -1
- package/dist/hooks/useLongPress.d.ts +8 -9
- package/dist/hooks/useLongPress.d.ts.map +1 -1
- package/dist/hooks/useLongPress.js +23 -106
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +2 -0
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +3 -0
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +2 -1
- package/dist/hooks/usePressFeedback.d.ts.map +1 -1
- package/dist/hooks/usePressFeedback.js +1 -0
- package/dist/hooks/useResolvedRequired.d.ts +3 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -1
- package/dist/hooks/useResolvedRequired.js +3 -0
- package/dist/hooks/useScrollLock.d.ts +8 -9
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +50 -48
- package/dist/hooks/useScrollableArea.d.ts.map +1 -1
- package/dist/hooks/useScrollableArea.js +5 -0
- package/dist/hooks/useStreamingText.d.ts.map +1 -1
- package/dist/hooks/useStreamingText.js +3 -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 +45 -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/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.js +3 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.js +3 -1
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts +8 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/TimeInput/TimeWheels.generated.js +17 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +37 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +37 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/internal/indicatorPress.stylex.d.ts +20 -0
- package/dist/internal/indicatorPress.stylex.d.ts.map +1 -0
- package/dist/internal/indicatorPress.stylex.js +26 -0
- package/dist/internal/selectable-card.d.ts +21 -0
- package/dist/internal/selectable-card.d.ts.map +1 -0
- package/dist/internal/selectable-card.js +20 -0
- package/dist/internal/sheetDraft.d.ts +2 -2
- package/dist/internal/sheetDraft.js +2 -2
- package/dist/keyboard/index.d.ts +17 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/keyboard/index.js +19 -0
- package/dist/keyboard/keyboardHeight.d.ts +149 -0
- package/dist/keyboard/keyboardHeight.d.ts.map +1 -0
- package/dist/keyboard/keyboardHeight.js +432 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts +59 -0
- package/dist/keyboard/keyboardLayoutGuide.d.ts.map +1 -0
- package/dist/keyboard/keyboardLayoutGuide.js +207 -0
- package/dist/keyboard/keyboardModel.d.ts +93 -0
- package/dist/keyboard/keyboardModel.d.ts.map +1 -0
- package/dist/keyboard/keyboardModel.js +220 -0
- package/dist/keyboard/rideKeyboard.d.ts +42 -0
- package/dist/keyboard/rideKeyboard.d.ts.map +1 -0
- package/dist/keyboard/rideKeyboard.js +77 -0
- package/dist/keyboard/useMobileKeyboard.d.ts +61 -0
- package/dist/keyboard/useMobileKeyboard.d.ts.map +1 -0
- package/dist/keyboard/useMobileKeyboard.js +699 -0
- package/dist/motion/android/index.d.ts +16 -0
- package/dist/motion/android/index.d.ts.map +1 -0
- package/dist/motion/android/index.js +18 -0
- package/dist/motion/android/keyboard.d.ts +83 -0
- package/dist/motion/android/keyboard.d.ts.map +1 -0
- package/dist/motion/android/keyboard.js +96 -0
- package/dist/motion/animatedLayout.d.ts +8 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +246 -53
- package/dist/motion/animator.d.ts +14 -14
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +45 -26
- package/dist/motion/frameBlock.d.ts +14 -0
- package/dist/motion/frameBlock.d.ts.map +1 -0
- package/dist/motion/frameBlock.js +16 -0
- package/dist/motion/progress.d.ts +88 -0
- package/dist/motion/progress.d.ts.map +1 -0
- package/dist/motion/progress.js +128 -0
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +3 -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/datePicker.d.ts +58 -0
- package/dist/motion/uikit/datePicker.d.ts.map +1 -0
- package/dist/motion/uikit/datePicker.js +60 -0
- package/dist/motion/uikit/index.d.ts +6 -4
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +6 -4
- package/dist/motion/uikit/picker.d.ts +96 -0
- package/dist/motion/uikit/picker.d.ts.map +1 -0
- package/dist/motion/uikit/picker.js +117 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts +22 -0
- package/dist/privateAttributes/pressGroupItem.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressGroupItem.stylex.js +36 -0
- package/dist/privateAttributes/reducedMotion.stylex.d.ts +23 -0
- package/dist/privateAttributes/reducedMotion.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/reducedMotion.stylex.js +40 -0
- package/dist/theme/Theme.d.ts.map +1 -1
- package/dist/theme/Theme.js +29 -4
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -13
- package/dist/theme/motionKnobs.d.ts +4 -3
- package/dist/theme/motionKnobs.d.ts.map +1 -1
- package/dist/theme/motionKnobs.js +3 -2
- package/dist/theme/themeMotion.d.ts +6 -0
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +15 -2
- package/dist/theme/tokens.stylex.d.ts +3 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +4 -1
- package/dist/utils/dateParser.d.ts.map +1 -1
- package/dist/utils/dateParser.js +12 -0
- package/dist/utils/disabledInteraction.d.ts +10 -2
- package/dist/utils/disabledInteraction.d.ts.map +1 -1
- package/dist/utils/disabledInteraction.js +16 -2
- package/dist/utils/focusReturn.d.ts +22 -25
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +36 -29
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +4 -0
- package/dist/utils/interactionOverlay.stylex.d.ts +6 -4
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +6 -4
- package/dist/utils/isFocusDetached.d.ts +27 -0
- package/dist/utils/isFocusDetached.d.ts.map +1 -0
- package/dist/utils/isFocusDetached.js +32 -0
- package/dist/utils/layoutViewport.d.ts +25 -0
- package/dist/utils/layoutViewport.d.ts.map +1 -0
- package/dist/utils/layoutViewport.js +102 -0
- package/dist/utils/plainDate.d.ts +31 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +68 -4
- package/dist/utils/pressFeedback.d.ts +6 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +97 -18
- package/dist/utils/pressGesture.d.ts +4 -2
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +3 -1
- package/dist/utils/selectionLock.d.ts +10 -1
- package/dist/utils/selectionLock.d.ts.map +1 -1
- package/dist/utils/selectionLock.js +31 -5
- package/dist/utils/sharedMutationObserver.d.ts +2 -1
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +2 -1
- package/dist/utils/timeParser.d.ts +2 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +29 -3
- package/dist/utils/triggerFocus.d.ts +36 -0
- package/dist/utils/triggerFocus.d.ts.map +1 -0
- package/dist/utils/triggerFocus.js +65 -0
- package/locales/en.json +148 -0
- package/locales/pseudo.json +111 -0
- package/package.json +14 -9
- package/src/AlertDialog/AlertDialog.doc.mjs +2 -2
- package/src/AlertDialog/AlertDialog.tsx +46 -5
- package/src/AppShell/AppShell.tsx +13 -4
- package/src/BottomSheet/BottomSheet.doc.mjs +1 -1
- package/src/BottomSheet/BottomSheet.tsx +1 -0
- package/src/BottomSheet/BottomSheetPanel.tsx +80 -16
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/BottomSheet/BottomSheetSwitcher.tsx +5 -0
- package/src/BottomSheet/bottomSheetStack.ts +1 -1
- package/src/BottomSheet/useSheetGestures.ts +16 -1
- package/src/Button/Button.tsx +26 -4
- package/src/Calendar/Calendar.tsx +40 -32
- package/src/Calendar/getWeekdayHeaderNames.ts +88 -0
- package/src/Calendar/hooks/useCalendarDays.ts +5 -10
- package/src/Calendar/{standaloneShortWeekdayNames.generated.ts → weekdayHeaderNames.generated.ts} +14 -14
- package/src/Carousel/Carousel.tsx +1 -0
- package/src/Chat/ChatComposerInput.tsx +4 -7
- package/src/Chat/ChatMessageList.tsx +2 -1
- package/src/Chat/useChatDictation.ts +1 -0
- package/src/Chat/useChatNewMessages.ts +1 -1
- package/src/Chat/useChatStreamScroll.ts +2 -0
- package/src/Chat/useSpeechRecognition.ts +2 -0
- package/src/Chat/useTriggerMenu.tsx +1 -1
- package/src/CheckboxInput/CheckboxInput.doc.mjs +18 -0
- package/src/CheckboxInput/CheckboxInput.tsx +38 -15
- package/src/CheckboxList/CheckboxList.doc.mjs +14 -0
- package/src/CheckboxList/CheckboxList.tsx +43 -2
- package/src/CheckboxList/CheckboxListContext.tsx +9 -1
- package/src/CheckboxList/CheckboxListItem.tsx +23 -2
- package/src/CheckboxList/requiredGroup.ts +77 -0
- package/src/CodeBlock/CodeBlock.doc.mjs +9 -1
- package/src/CodeBlock/CodeBlock.tsx +41 -4
- package/src/CommandPalette/CommandPalette.tsx +1 -0
- package/src/CommandPalette/CommandPaletteItem.tsx +1 -0
- package/src/ComplexSelector/ComplexSelector.tsx +20 -5
- package/src/ContextMenu/ContextMenu.tsx +2 -2
- package/src/DateInput/MonthScroller.tsx +8 -2
- package/src/DateInput/PickerWheel.tsx +796 -0
- package/src/DateInput/TouchDateField.tsx +6 -32
- package/src/DateInput/Wheel.tsx +188 -171
- package/src/DateInput/datePickerTouch.ts +15 -0
- package/src/DateInput/useOwnScrollGesture.ts +25 -3
- package/src/DateInput/usePointerDragScroll.ts +1 -0
- package/src/DateInput/useScrollSettle.ts +2 -0
- package/src/DateInput/useWheelListbox.ts +112 -0
- package/src/DateInput/wheelOptions.ts +184 -0
- package/src/DateInput/wheelPhysics.ts +406 -0
- package/src/DateInput/wheelStrip.ts +341 -0
- package/src/DateTimeInput/TouchDateTimeField.tsx +100 -189
- package/src/Dialog/Dialog.tsx +12 -32
- package/src/Drawer/useDrawerDialogPresence.ts +2 -0
- package/src/DropdownMenu/useMenuOverflow.ts +3 -0
- package/src/Field/Field.tsx +2 -2
- package/src/FieldStatus/useFieldStatusAnnouncement.ts +1 -0
- package/src/FormLayout/FormLayout.doc.mjs +181 -46
- package/src/FormLayout/FormLayout.tsx +5 -1
- package/src/HoverCard/HoverCard.doc.mjs +10 -8
- package/src/HoverCard/HoverCard.tsx +58 -6
- package/src/HoverCard/useHoverCard.doc.mjs +178 -36
- package/src/HoverCard/useHoverCard.tsx +55 -55
- package/src/Icon/Icon.doc.mjs +51 -10
- package/src/Icon/Icon.tsx +31 -8
- package/src/IconButton/IconButton.doc.mjs +141 -21
- package/src/InfoTip/InfoTip.tsx +72 -16
- package/src/Item/useSwipeAction.ts +2 -0
- package/src/Layer/modalOutlet.ts +2 -0
- package/src/Layer/outsidePress.ts +1 -0
- package/src/Layer/useLayer.tsx +3 -1
- package/src/Layer/useLayerDismissal.ts +2 -0
- package/src/Layer/useTouchTrigger.ts +19 -6
- package/src/Layout/index.ts +1 -1
- package/src/Layout/layoutReset.ts +1 -1
- package/src/Layout/overlayPaddingReset.stylex.ts +73 -0
- package/src/Layout/padding.stylex.ts +9 -133
- package/src/Layout/paddingStyles.stylex.ts +87 -0
- package/src/Lightbox/Lightbox.tsx +20 -1
- package/src/Lightbox/useLightbox.doc.mjs +167 -0
- package/src/MobileNav/MobileNav.tsx +10 -31
- package/src/MultiSelector/MultiSelector.tsx +2 -7
- package/src/NumberInput/NumberInput.tsx +2 -7
- package/src/Outline/useOutlineFromDOM.ts +2 -0
- package/src/Outline/useScrollSpy.ts +2 -0
- package/src/OverflowList/OverflowList.tsx +2 -0
- package/src/Overlay/Overlay.tsx +7 -2
- package/src/Popover/Popover.tsx +4 -0
- package/src/Popover/usePopover.tsx +2 -2
- package/src/PowerSearch/PowerSearch.doc.mjs +60 -8
- package/src/PowerSearch/PowerSearch.tsx +622 -157
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +2700 -0
- package/src/PowerSearch/PowerSearchEditPopover.tsx +65 -9
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +2 -0
- package/src/PowerSearch/PowerSearchToken.tsx +2 -0
- package/src/PowerSearch/PowerSearchValueEditor.tsx +340 -59
- package/src/PowerSearch/formatFilterValue.ts +49 -27
- package/src/PowerSearch/formatTokenValue.ts +220 -0
- package/src/PowerSearch/index.ts +5 -1
- package/src/PowerSearch/powerSearchDateZone.ts +95 -0
- package/src/PowerSearch/powerSearchSheetUtils.ts +224 -0
- package/src/PowerSearch/types.ts +8 -1
- package/src/ProgressBar/ProgressBarTouch.ts +2 -0
- package/src/RadioList/RadioList.tsx +3 -2
- package/src/RadioList/RadioListItem.tsx +5 -3
- package/src/Resizable/Resizable.doc.mjs +5 -4
- package/src/Resizable/ResizeHandle.tsx +187 -135
- package/src/Resizable/createResizable.ts +1046 -0
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +292 -623
- package/src/SegmentedControl/useSegmentedSelectionMotion.ts +6 -3
- package/src/SelectableCard/SelectableCard.tsx +39 -10
- package/src/SelectableCard/selectableCardInput.ts +30 -0
- package/src/Selector/Selector.tsx +7 -19
- package/src/SideNav/SideNav.tsx +41 -5
- package/src/Slider/Slider.tsx +20 -11
- package/src/Slider/sliderTouchController.ts +2 -2
- package/src/Spinner/Spinner.tsx +77 -63
- package/src/Stepper/Stepper.tsx +10 -27
- package/src/Switch/Switch.tsx +2 -6
- package/src/Switch/useSwitchTouch.ts +4 -4
- package/src/Table/BaseTable.tsx +46 -12
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +2 -1
- package/src/Table/plugins/filtering/useTableFiltering.tsx +1 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +31 -7
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +2 -0
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -20
- package/src/Table/useTableRowExpansion.doc.mjs +9 -0
- package/src/Table/useTableTreeData.doc.mjs +15 -3
- package/src/TextArea/TextArea.tsx +2 -7
- package/src/TextInput/TextInput.tsx +13 -17
- package/src/TimeInput/TimeInput.tsx +2 -0
- package/src/TimeInput/TimeWheels.tsx +218 -0
- package/src/TimeInput/TouchTimeField.tsx +93 -155
- package/src/TimeInput/timeWheelRules.ts +352 -0
- package/src/Timer/Timer.tsx +1 -0
- package/src/Timestamp/Timestamp.tsx +1 -1
- package/src/Timestamp/formatInstant.ts +1 -33
- package/src/Toast/Toast.doc.mjs +4 -3
- package/src/Toast/Toast.tsx +52 -32
- package/src/Toast/ToastViewport.tsx +123 -35
- package/src/Toast/types.ts +9 -3
- package/src/Toast/useToast.tsx +1 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +10 -10
- package/src/Tokenizer/Tokenizer.tsx +61 -62
- package/src/Tokenizer/TokenizerBottomSheet.tsx +17 -23
- package/src/Tokenizer/index.ts +1 -0
- package/src/Tooltip/Tooltip.tsx +6 -42
- package/src/Tooltip/useTooltip.doc.mjs +24 -0
- package/src/Tooltip/useTooltip.tsx +243 -134
- package/src/Typeahead/BaseTypeahead.tsx +27 -17
- package/src/Typeahead/TypeaheadItem.doc.mjs +6 -3
- package/src/Typeahead/TypeaheadItem.tsx +2 -1
- package/src/animator/createAnimator.doc.mjs +153 -0
- package/src/animator/createAnimator.ts +324 -0
- package/src/gestures/GestureHost.ts +6 -5
- package/src/gestures/PressTracker.ts +4 -3
- package/src/gestures/README.md +10 -4
- package/src/hooks/ModalAnnounceProvider.tsx +1 -0
- package/src/hooks/actionGroupTracker.ts +25 -9
- package/src/hooks/index.ts +2 -0
- package/src/hooks/longPressDetector.ts +273 -0
- package/src/hooks/pressGroupContext.ts +21 -0
- package/src/hooks/rootScrollStyles.ts +247 -0
- package/src/hooks/scrollLockTouchGuard.ts +149 -0
- package/src/hooks/scrollbarGutter.ts +41 -26
- 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/useAnnounceRenderedText.ts +1 -0
- package/src/hooks/useAttachment.ts +1 -1
- package/src/hooks/useAutoMediaMode.ts +1 -0
- package/src/hooks/useBusyAnnouncement.ts +2 -0
- package/src/hooks/useDevWarning.ts +2 -0
- package/src/hooks/useFocusTrap.ts +2 -0
- package/src/hooks/useGridFocus.doc.mjs +6 -6
- package/src/hooks/useGridFocus.ts +10 -7
- package/src/hooks/useHotkeys.ts +2 -0
- package/src/hooks/useImageMode.ts +2 -0
- package/src/hooks/useInputStatusIcon.tsx +3 -2
- package/src/hooks/useKeyboardHint.tsx +1 -1
- package/src/hooks/useLongPress.doc.mjs +2 -2
- package/src/hooks/useLongPress.ts +32 -122
- package/src/hooks/useMenuHover.ts +1 -0
- package/src/hooks/useMenuPress.ts +2 -0
- package/src/hooks/useOverflow.ts +2 -1
- package/src/hooks/usePressFeedback.ts +1 -0
- package/src/hooks/useResolvedRequired.ts +3 -0
- package/src/hooks/useScrollLock.doc.mjs +51 -12
- package/src/hooks/useScrollLock.ts +53 -60
- package/src/hooks/useScrollableArea.ts +4 -0
- package/src/hooks/useStreamingText.ts +2 -0
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +46 -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/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.ts +3 -1
- package/src/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.ts +3 -1
- package/src/i18n/generated-english/TimeInput/TimeWheels.generated.ts +18 -0
- package/src/i18n/generated-locales/en.generated.ts +47 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +48 -0
- package/src/index.ts +13 -0
- package/src/internal/indicatorPress.stylex.ts +24 -0
- package/src/internal/selectable-card.ts +21 -0
- package/src/internal/sheetDraft.ts +2 -2
- package/src/keyboard/README.md +197 -0
- package/src/keyboard/index.ts +48 -0
- package/src/keyboard/keyboardHeight.ts +543 -0
- package/src/keyboard/keyboardLayoutGuide.ts +266 -0
- package/src/keyboard/keyboardModel.ts +301 -0
- package/src/keyboard/rideKeyboard.ts +100 -0
- package/src/keyboard/useMobileKeyboard.ts +866 -0
- package/src/motion/MEASUREMENTS.md +28 -0
- package/src/motion/README.md +12 -5
- package/src/motion/android/index.ts +18 -0
- package/src/motion/android/keyboard.ts +96 -0
- package/src/motion/animatedLayout.ts +323 -60
- package/src/motion/animator.ts +66 -37
- package/src/motion/frameBlock.ts +16 -0
- package/src/motion/progress.ts +155 -0
- package/src/motion/reducedMotion.ts +3 -1
- package/src/motion/uikit/alert.ts +43 -0
- package/src/motion/uikit/datePicker.ts +60 -0
- package/src/motion/uikit/index.ts +6 -4
- package/src/motion/uikit/picker.ts +116 -0
- package/src/privateAttributes/pressGroupItem.stylex.ts +44 -0
- package/src/privateAttributes/reducedMotion.stylex.ts +45 -0
- package/src/theme/Theme.tsx +37 -3
- package/src/theme/generateThemeRules.ts +14 -12
- package/src/theme/motionKnobs.ts +4 -3
- package/src/theme/themeMotion.ts +17 -2
- package/src/theme/tokens.stylex.ts +2 -0
- package/src/utils/dateParser.ts +16 -0
- package/src/utils/disabledInteraction.ts +23 -2
- package/src/utils/focusReturn.ts +38 -31
- package/src/utils/index.ts +1 -1
- package/src/utils/interactionModality.ts +4 -0
- package/src/utils/interactionOverlay.stylex.ts +6 -4
- package/src/utils/isFocusDetached.ts +34 -0
- package/src/utils/layoutViewport.ts +104 -0
- package/src/utils/plainDate.ts +80 -4
- package/src/utils/pressFeedback.ts +126 -30
- package/src/utils/pressGesture.ts +4 -2
- package/src/utils/selectionLock.ts +40 -6
- package/src/utils/sharedMutationObserver.ts +2 -1
- package/src/utils/timeParser.ts +40 -3
- package/src/utils/triggerFocus.ts +80 -0
- package/dist/BottomSheet/useMobileKeyboard.d.ts +0 -21
- package/dist/BottomSheet/useMobileKeyboard.d.ts.map +0 -1
- package/dist/BottomSheet/useMobileKeyboard.js +0 -407
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +0 -14
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +0 -1
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +0 -26
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +0 -1
- package/dist/Layer/usePressPin.d.ts +0 -93
- package/dist/Layer/usePressPin.d.ts.map +0 -1
- package/dist/Layer/usePressPin.js +0 -363
- package/dist/internal/touch-sheet.d.ts +0 -21
- package/dist/internal/touch-sheet.d.ts.map +0 -1
- package/dist/internal/touch-sheet.js +0 -19
- package/src/BottomSheet/useMobileKeyboard.ts +0 -538
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +0 -38
- package/src/Layer/usePressPin.ts +0 -510
- package/src/internal/touch-sheet.ts +0 -21
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file createResizable.ts
|
|
5
|
+
* @input A handle element, or null for a region with no handle yet, and the
|
|
6
|
+
* region's options
|
|
7
|
+
* @output createResizable; readInitialResizableState for the hook's first
|
|
8
|
+
* render; createResizableAs and the internal channel for the hooks
|
|
9
|
+
* @position The Resizable family's factory, internal to the package. Its
|
|
10
|
+
* input is resizeGesture.ts: it listens with it on a plain handle, and
|
|
11
|
+
* ResizeHandle drives the region through its model. The
|
|
12
|
+
* configuration-object useResizable builds on it. No DOM work on import
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {registerEnglishFallback} from '../i18n/englishFallback';
|
|
16
|
+
import english from '../i18n/generated-english/Resizable/createResizable.generated';
|
|
17
|
+
import {observeResize} from '../utils/sharedResizeObserver';
|
|
18
|
+
import {devWarn} from '../utils/devWarning';
|
|
19
|
+
import type {SizeValue} from '../utils/types';
|
|
20
|
+
import {
|
|
21
|
+
DEFAULT_COLLAPSED_SIZE,
|
|
22
|
+
DEFAULT_MIN,
|
|
23
|
+
DEFAULT_SIZE_FALLBACK,
|
|
24
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
25
|
+
SERVER_BASIS,
|
|
26
|
+
clampSize,
|
|
27
|
+
dependsOnBasis,
|
|
28
|
+
loadPersistedState,
|
|
29
|
+
measureContentBox,
|
|
30
|
+
parseSize,
|
|
31
|
+
persistState,
|
|
32
|
+
resolveBound,
|
|
33
|
+
type PersistedResizableState,
|
|
34
|
+
type ResizableDirection,
|
|
35
|
+
} from './resizableModel';
|
|
36
|
+
import {
|
|
37
|
+
createResizeGesture,
|
|
38
|
+
type ResizeGesture,
|
|
39
|
+
type ResizeGestureModel,
|
|
40
|
+
type ResizeGestureState,
|
|
41
|
+
} from './resizeGesture';
|
|
42
|
+
import {separatorAttributes} from './separatorAttributes';
|
|
43
|
+
import type {ResizableSize} from './utils';
|
|
44
|
+
|
|
45
|
+
// The English for the two messages it names, and nothing more of the catalog.
|
|
46
|
+
registerEnglishFallback(english);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The catalog's messages for a plain handle: its name and what it announces
|
|
50
|
+
* while collapsed, when the options give neither `label` nor
|
|
51
|
+
* `collapsedLabel`. The factory uses the shipped English messages.
|
|
52
|
+
*/
|
|
53
|
+
const LABEL_KEY = '@astryx.resizable.handle.label';
|
|
54
|
+
const COLLAPSED_LABEL_KEY = '@astryx.resizable.collapsed';
|
|
55
|
+
|
|
56
|
+
export interface CreateResizableOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Initial size. A number or an exact `Npx` is pixels, and an exact `N%` is
|
|
59
|
+
* a share of the basis. `percent(value, {min | max: pixel(value)})` adds one
|
|
60
|
+
* pixel floor or ceiling. A value that depends on the basis resolves once
|
|
61
|
+
* into pixels. @default 250
|
|
62
|
+
*/
|
|
63
|
+
defaultSize?: ResizableSize | SizeValue;
|
|
64
|
+
/** The minimum size, in the same forms. @default 50 */
|
|
65
|
+
minSize?: ResizableSize;
|
|
66
|
+
/** The maximum size, in the same forms. Unbounded when omitted. */
|
|
67
|
+
maxSize?: ResizableSize;
|
|
68
|
+
/** Pixel values the region rests on; it can rest only on one of them. */
|
|
69
|
+
snaps?: number[];
|
|
70
|
+
/** Whether the region can collapse to 0. @default false */
|
|
71
|
+
collapsible?: boolean;
|
|
72
|
+
/** Size in px under which a drag collapses the region. @default 40 */
|
|
73
|
+
collapsedSize?: number;
|
|
74
|
+
/**
|
|
75
|
+
* The element a percentage is a share of, read as `containerRef.current`.
|
|
76
|
+
* Omitted, percentages are a share of the viewport. A plain `{current}`
|
|
77
|
+
* object serves outside React.
|
|
78
|
+
*/
|
|
79
|
+
containerRef?: {readonly current: HTMLElement | null};
|
|
80
|
+
/** The axis the region resizes along. @default 'horizontal' */
|
|
81
|
+
direction?: ResizableDirection;
|
|
82
|
+
/** Key under which the size and collapse state persist in localStorage. */
|
|
83
|
+
autoSaveId?: string;
|
|
84
|
+
/** Initial collapse state; a persisted entry wins over it. */
|
|
85
|
+
defaultIsCollapsed?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Controlled collapse state. When set, the caller owns collapse. A collapse
|
|
88
|
+
* or expand request reports through `onCollapseChange`. Nothing changes
|
|
89
|
+
* until the caller passes the new value through `update`.
|
|
90
|
+
*/
|
|
91
|
+
isCollapsed?: boolean;
|
|
92
|
+
/** Called when an interaction changes the size. */
|
|
93
|
+
onSizeChange?: (size: number) => void;
|
|
94
|
+
/** Called when an interaction collapses or expands the region. */
|
|
95
|
+
onCollapseChange?: (isCollapsed: boolean) => void;
|
|
96
|
+
/**
|
|
97
|
+
* The handle sits before the panel it resizes (the panel is at the end), so
|
|
98
|
+
* a drag toward the start grows it.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
isReversed?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Ignores pointer and keyboard input and says so; a plain element keeps its
|
|
104
|
+
* tab stop.
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
isDisabled?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* A plain element's accessible name, when it has none of its own. Without
|
|
110
|
+
* it, the factory uses the message catalog's English message.
|
|
111
|
+
* @default 'Resize handle'
|
|
112
|
+
*/
|
|
113
|
+
label?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Replaces the catalog's "Collapsed" that the handle announces as its
|
|
116
|
+
* `aria-valuetext` while the region is collapsed. Absent, the factory
|
|
117
|
+
* announces the shipped English message.
|
|
118
|
+
* @default 'Collapsed'
|
|
119
|
+
*/
|
|
120
|
+
collapsedLabel?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface ResizableController {
|
|
124
|
+
/** The region's size in px, 0 while collapsed. */
|
|
125
|
+
readonly size: number;
|
|
126
|
+
readonly isCollapsed: boolean;
|
|
127
|
+
/** Collapses the region, when it is collapsible. */
|
|
128
|
+
collapse(): void;
|
|
129
|
+
/** Expands the region to the size it had before it collapsed. */
|
|
130
|
+
expand(): void;
|
|
131
|
+
/** Resizes the region to `size` px, within its bounds. */
|
|
132
|
+
resize(size: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Takes the full set of options, as a new render does: an option left out
|
|
135
|
+
* returns to its default. The region keeps its size and collapse state,
|
|
136
|
+
* within the new options.
|
|
137
|
+
*/
|
|
138
|
+
update(options: CreateResizableOptions): void;
|
|
139
|
+
/**
|
|
140
|
+
* Calls `listener` after every change to `size` or `isCollapsed`, a
|
|
141
|
+
* correction a newly measured basis makes included. Returns the function
|
|
142
|
+
* that stops it.
|
|
143
|
+
*/
|
|
144
|
+
subscribe(listener: () => void): () => void;
|
|
145
|
+
/**
|
|
146
|
+
* Removes every listener, observer and attribute the factory added and the
|
|
147
|
+
* body's drag cursor; a drag in flight ends as cancelled.
|
|
148
|
+
*/
|
|
149
|
+
destroy(): void;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** The viewport width, the basis without a container. */
|
|
153
|
+
function readViewportBasis(): number {
|
|
154
|
+
return typeof window === 'undefined' ? SERVER_BASIS : window.innerWidth;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The window's extent along the axis, for an unbounded region's maximum. */
|
|
158
|
+
function readWindowExtent(direction: ResizableDirection): number | null {
|
|
159
|
+
if (typeof window === 'undefined') {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return direction === 'vertical' ? window.innerHeight : window.innerWidth;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Starts as warned: the factory warns, and this first-render read does not. */
|
|
166
|
+
const QUIET = {current: true};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The state a region with `options` starts in, before its handle exists: the
|
|
170
|
+
* server's render and a hook's first render. A container is not measured
|
|
171
|
+
* yet, so a percentage of it resolves against the deterministic 1200px basis
|
|
172
|
+
* until the factory measures it. `'server'` reads the state the server
|
|
173
|
+
* rendered, for a render that hydrates it: the 1200px basis for a viewport
|
|
174
|
+
* percentage too, and nothing saved.
|
|
175
|
+
*/
|
|
176
|
+
export function readInitialResizableState(
|
|
177
|
+
options: CreateResizableOptions = {},
|
|
178
|
+
environment: 'client' | 'server' = 'client',
|
|
179
|
+
): ResizableSnapshot {
|
|
180
|
+
const {
|
|
181
|
+
defaultSize,
|
|
182
|
+
minSize,
|
|
183
|
+
maxSize,
|
|
184
|
+
containerRef,
|
|
185
|
+
collapsible = false,
|
|
186
|
+
snaps = [],
|
|
187
|
+
autoSaveId,
|
|
188
|
+
defaultIsCollapsed,
|
|
189
|
+
isCollapsed: controlled,
|
|
190
|
+
} = options;
|
|
191
|
+
const isServer = environment === 'server';
|
|
192
|
+
const persisted =
|
|
193
|
+
autoSaveId && !isServer ? loadPersistedState(autoSaveId) : null;
|
|
194
|
+
const parsedDefault = parseSize(defaultSize);
|
|
195
|
+
const parsedMin = parseSize(minSize);
|
|
196
|
+
const parsedMax = parseSize(maxSize);
|
|
197
|
+
const hasContainer = containerRef != null;
|
|
198
|
+
const needsContainer =
|
|
199
|
+
hasContainer &&
|
|
200
|
+
(dependsOnBasis(parsedMin) ||
|
|
201
|
+
dependsOnBasis(parsedMax) ||
|
|
202
|
+
(persisted?.size == null && dependsOnBasis(parsedDefault)));
|
|
203
|
+
const basis = hasContainer || isServer ? SERVER_BASIS : readViewportBasis();
|
|
204
|
+
const min = resolveBound(
|
|
205
|
+
minSize,
|
|
206
|
+
parsedMin,
|
|
207
|
+
basis,
|
|
208
|
+
DEFAULT_MIN,
|
|
209
|
+
'minSize',
|
|
210
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
211
|
+
QUIET,
|
|
212
|
+
);
|
|
213
|
+
const max = resolveBound(
|
|
214
|
+
maxSize,
|
|
215
|
+
parsedMax,
|
|
216
|
+
basis,
|
|
217
|
+
Infinity,
|
|
218
|
+
'maxSize',
|
|
219
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
220
|
+
QUIET,
|
|
221
|
+
);
|
|
222
|
+
const defaultPx = resolveBound(
|
|
223
|
+
defaultSize,
|
|
224
|
+
parsedDefault,
|
|
225
|
+
basis,
|
|
226
|
+
DEFAULT_SIZE_FALLBACK,
|
|
227
|
+
'defaultSize',
|
|
228
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
229
|
+
QUIET,
|
|
230
|
+
);
|
|
231
|
+
const chosen =
|
|
232
|
+
persisted?.size ??
|
|
233
|
+
(needsContainer ? null : clampSize(defaultPx, min, max, snaps));
|
|
234
|
+
const size = clampSize(chosen ?? defaultPx, min, max, snaps);
|
|
235
|
+
const isCollapsed =
|
|
236
|
+
collapsible &&
|
|
237
|
+
(controlled !== undefined
|
|
238
|
+
? controlled
|
|
239
|
+
: (persisted?.isCollapsed ?? defaultIsCollapsed ?? false));
|
|
240
|
+
// A container is not measured yet; without one the window's extent stands
|
|
241
|
+
// in for a missing maximum, as the factory reports it.
|
|
242
|
+
const windowExtent =
|
|
243
|
+
hasContainer || isServer
|
|
244
|
+
? null
|
|
245
|
+
: readWindowExtent(options.direction ?? 'horizontal');
|
|
246
|
+
return {
|
|
247
|
+
size: isCollapsed ? 0 : size,
|
|
248
|
+
isCollapsed,
|
|
249
|
+
expandedSize: size,
|
|
250
|
+
minPx: min,
|
|
251
|
+
maxPx: max,
|
|
252
|
+
effectiveMaxPx:
|
|
253
|
+
max !== Infinity
|
|
254
|
+
? max
|
|
255
|
+
: windowExtent == null
|
|
256
|
+
? undefined
|
|
257
|
+
: Math.max(windowExtent, isCollapsed ? min : size),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* What a React form of the region renders. A change to any part replaces it
|
|
263
|
+
* as a whole. It holds the size (0 while collapsed), the collapse state, the
|
|
264
|
+
* size as expanded, and the bounds the handle announces.
|
|
265
|
+
*/
|
|
266
|
+
export interface ResizableSnapshot {
|
|
267
|
+
readonly size: number;
|
|
268
|
+
readonly isCollapsed: boolean;
|
|
269
|
+
readonly expandedSize: number;
|
|
270
|
+
readonly minPx: number;
|
|
271
|
+
readonly maxPx: number;
|
|
272
|
+
/** The maximum the handle reports: a configured one, or a measured extent. */
|
|
273
|
+
readonly effectiveMaxPx: number | undefined;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* The package's own channel into a factory, for useResizable: kept off the
|
|
278
|
+
* exported ResizableController, so it adds no public member.
|
|
279
|
+
*/
|
|
280
|
+
interface ResizableInternals {
|
|
281
|
+
snapshot(): ResizableSnapshot;
|
|
282
|
+
/** Calls `listener` after every change to the snapshot. */
|
|
283
|
+
subscribeSnapshot(listener: () => void): () => void;
|
|
284
|
+
/**
|
|
285
|
+
* Follows the element behind `containerRef` when it has changed without
|
|
286
|
+
* new options, as a React caller's commit may have swapped it.
|
|
287
|
+
*/
|
|
288
|
+
syncContainer(): void;
|
|
289
|
+
/**
|
|
290
|
+
* Lets go of the page and keeps the region. A gesture in flight ends as
|
|
291
|
+
* cancelled, and the handle's listeners, its attributes and the observers
|
|
292
|
+
* go. Collapse, expand and resize still apply and report. For a React caller
|
|
293
|
+
* whose component unmounts or an `<Activity>` hides.
|
|
294
|
+
*/
|
|
295
|
+
suspend(): void;
|
|
296
|
+
/** Takes the page back after `suspend`: the handle, and the observers. */
|
|
297
|
+
resume(): void;
|
|
298
|
+
/**
|
|
299
|
+
* The region's side of a gesture the factory does not own: the drag and
|
|
300
|
+
* keys of a ResizeHandle given the configuration object's props.
|
|
301
|
+
*/
|
|
302
|
+
model: ResizeGestureModel;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const internals = new WeakMap<ResizableController, ResizableInternals>();
|
|
306
|
+
|
|
307
|
+
/** The factory's internal channel, or undefined for anything else. */
|
|
308
|
+
export function readResizableInternals(
|
|
309
|
+
controller: ResizableController,
|
|
310
|
+
): ResizableInternals | undefined {
|
|
311
|
+
return internals.get(controller);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** An attribute's value as the DOM takes it; undefined removes it. */
|
|
315
|
+
function toAttribute(
|
|
316
|
+
value: string | number | boolean | undefined,
|
|
317
|
+
): string | null {
|
|
318
|
+
return value == null ? null : String(value);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** The attributes the factory writes on a handle, restored by `destroy`. */
|
|
322
|
+
const MANAGED_ATTRIBUTES = [
|
|
323
|
+
'role',
|
|
324
|
+
'tabindex',
|
|
325
|
+
'aria-label',
|
|
326
|
+
'aria-orientation',
|
|
327
|
+
'aria-valuenow',
|
|
328
|
+
'aria-valuemin',
|
|
329
|
+
'aria-valuemax',
|
|
330
|
+
'aria-valuetext',
|
|
331
|
+
'aria-disabled',
|
|
332
|
+
'data-resizing',
|
|
333
|
+
] as const;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Make `handle` a window splitter that resizes a region. The factory never
|
|
337
|
+
* sizes the panel: it reports the size, and the caller applies it.
|
|
338
|
+
*
|
|
339
|
+
* It gives the handle `role="separator"`, its orientation and its value. It
|
|
340
|
+
* adds a tab stop and an accessible name when the handle has none. It answers
|
|
341
|
+
* a pointer drag, the arrow keys, Home and End, and holds the pointer for a
|
|
342
|
+
* whole drag. Enter and a double-click collapse and restore. A horizontal
|
|
343
|
+
* region resizes along the inline axis, and under right-to-left the drag
|
|
344
|
+
* follows the pointer. `destroy` takes all of it away. With a null handle the
|
|
345
|
+
* region still answers collapse, expand, resize and subscribe, and touches no
|
|
346
|
+
* element. Outside a provider, its name and its collapsed text are the
|
|
347
|
+
* shipped English messages. `label` names it, and `collapsedLabel` replaces
|
|
348
|
+
* its collapsed text in another language.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```
|
|
352
|
+
* const sidebar = document.querySelector('#sidebar');
|
|
353
|
+
* const resizable = createResizable(document.querySelector('#divider'), {
|
|
354
|
+
* defaultSize: 260,
|
|
355
|
+
* minSize: 180,
|
|
356
|
+
* maxSize: 480,
|
|
357
|
+
* collapsible: true,
|
|
358
|
+
* autoSaveId: 'sidebar',
|
|
359
|
+
* });
|
|
360
|
+
* const paint = () => {
|
|
361
|
+
* sidebar.style.width = `${resizable.size}px`;
|
|
362
|
+
* };
|
|
363
|
+
* paint();
|
|
364
|
+
* resizable.subscribe(paint);
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
export function createResizable(
|
|
368
|
+
handle: HTMLElement | null,
|
|
369
|
+
options: CreateResizableOptions = {},
|
|
370
|
+
): ResizableController {
|
|
371
|
+
return createResizableAs('createResizable', handle, options);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Who a factory's development warnings speak for: the bare factory, or the
|
|
376
|
+
* configuration-object useResizable built on it, whose warnings keep the
|
|
377
|
+
* hook's name and words.
|
|
378
|
+
*/
|
|
379
|
+
export type ResizableWarningSource = 'createResizable' | 'useResizable';
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* createResizable, with its development warnings in the words of `source`:
|
|
383
|
+
* the package's own entry, for useResizable.
|
|
384
|
+
*/
|
|
385
|
+
export function createResizableAs(
|
|
386
|
+
source: ResizableWarningSource,
|
|
387
|
+
handle: HTMLElement | null,
|
|
388
|
+
options: CreateResizableOptions = {},
|
|
389
|
+
): ResizableController {
|
|
390
|
+
// The configuration-object useResizable keeps its warnings word for word.
|
|
391
|
+
const isHook = source === 'useResizable';
|
|
392
|
+
let opts = options;
|
|
393
|
+
let isDestroyed = false;
|
|
394
|
+
// Let go of the page by `suspend`, with the region kept.
|
|
395
|
+
let isSuspended = false;
|
|
396
|
+
const listeners = new Set<() => void>();
|
|
397
|
+
const isReversed = (): boolean => opts.isReversed ?? false;
|
|
398
|
+
const isDisabled = (): boolean => opts.isDisabled ?? false;
|
|
399
|
+
const didWarn = {
|
|
400
|
+
min: {current: false},
|
|
401
|
+
max: {current: false},
|
|
402
|
+
defaultSize: {current: false},
|
|
403
|
+
inverted: false,
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
let persistedKey = opts.autoSaveId;
|
|
407
|
+
let persisted: PersistedResizableState | null = persistedKey
|
|
408
|
+
? loadPersistedState(persistedKey)
|
|
409
|
+
: null;
|
|
410
|
+
|
|
411
|
+
// The percentage basis. The container is followed through the shared
|
|
412
|
+
// observer only while some option needs it; the viewport only while a
|
|
413
|
+
// percentage bound needs it.
|
|
414
|
+
let containerElement: HTMLElement | null = null;
|
|
415
|
+
let observedDirection: ResizableDirection | null = null;
|
|
416
|
+
let containerBasis: number | null = null;
|
|
417
|
+
let stopObservingContainer: (() => void) | null = null;
|
|
418
|
+
let isSubscribing = false;
|
|
419
|
+
let isObservingViewport = false;
|
|
420
|
+
|
|
421
|
+
// One stable basis per gesture: a container that resizes mid-drag would
|
|
422
|
+
// otherwise move the bound under the pointer.
|
|
423
|
+
let gestureBasis: number | null = null;
|
|
424
|
+
let isGestureActive = false;
|
|
425
|
+
let dragStartSize = 0;
|
|
426
|
+
|
|
427
|
+
let initialDefault: {px: number; isFinal: boolean} | null = null;
|
|
428
|
+
let chosenSize: number | null | undefined;
|
|
429
|
+
let committedBounds: {min: number; max: number} | null = null;
|
|
430
|
+
let uncontrolledIsCollapsed =
|
|
431
|
+
persisted?.isCollapsed ?? opts.defaultIsCollapsed ?? false;
|
|
432
|
+
|
|
433
|
+
let derived = {
|
|
434
|
+
size: 0,
|
|
435
|
+
isCollapsed: false,
|
|
436
|
+
min: DEFAULT_MIN,
|
|
437
|
+
max: Infinity,
|
|
438
|
+
effectiveMax: undefined as number | undefined,
|
|
439
|
+
isBasisMeasured: true,
|
|
440
|
+
};
|
|
441
|
+
let notified: {size: number; isCollapsed: boolean} | null = null;
|
|
442
|
+
let written: {key: string; size: number; isCollapsed: boolean} | null = null;
|
|
443
|
+
let mustWrite = false;
|
|
444
|
+
let snapshot: ResizableSnapshot | null = null;
|
|
445
|
+
const snapshotListeners = new Set<() => void>();
|
|
446
|
+
|
|
447
|
+
const direction = (): ResizableDirection => opts.direction ?? 'horizontal';
|
|
448
|
+
const collapsible = (): boolean => opts.collapsible ?? false;
|
|
449
|
+
const isControlled = (): boolean => opts.isCollapsed !== undefined;
|
|
450
|
+
const snaps = (): number[] => opts.snaps ?? [];
|
|
451
|
+
|
|
452
|
+
const onViewportResize = () => {
|
|
453
|
+
commit();
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/** Which bases the options need followed right now. */
|
|
457
|
+
function observation() {
|
|
458
|
+
const parsedDefault = parseSize(opts.defaultSize);
|
|
459
|
+
const boundsDependOnBasis =
|
|
460
|
+
dependsOnBasis(parseSize(opts.minSize)) ||
|
|
461
|
+
dependsOnBasis(parseSize(opts.maxSize));
|
|
462
|
+
const defaultNeedsInitialBasis =
|
|
463
|
+
persisted?.size == null &&
|
|
464
|
+
dependsOnBasis(parsedDefault) &&
|
|
465
|
+
initialDefault?.isFinal !== true;
|
|
466
|
+
const hasContainer = opts.containerRef != null;
|
|
467
|
+
return {
|
|
468
|
+
hasContainer,
|
|
469
|
+
container:
|
|
470
|
+
hasContainer && (boundsDependOnBasis || defaultNeedsInitialBasis),
|
|
471
|
+
viewport: !hasContainer && boundsDependOnBasis,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** Follow the bases `observation()` names, and nothing else. */
|
|
476
|
+
function syncObservation(): void {
|
|
477
|
+
const needs = observation();
|
|
478
|
+
const element = needs.container
|
|
479
|
+
? (opts.containerRef?.current ?? null)
|
|
480
|
+
: null;
|
|
481
|
+
if (element !== containerElement || observedDirection !== direction()) {
|
|
482
|
+
stopObservingContainer?.();
|
|
483
|
+
stopObservingContainer = null;
|
|
484
|
+
containerElement = element;
|
|
485
|
+
containerBasis = null;
|
|
486
|
+
observedDirection = direction();
|
|
487
|
+
if (element != null) {
|
|
488
|
+
// The observer measures once as it registers; that measurement is
|
|
489
|
+
// read by the computation this call is part of.
|
|
490
|
+
isSubscribing = true;
|
|
491
|
+
const observed = element;
|
|
492
|
+
stopObservingContainer = observeResize(observed, entry => {
|
|
493
|
+
containerBasis = measureContentBox(observed, direction(), entry);
|
|
494
|
+
if (!isSubscribing) {
|
|
495
|
+
commit();
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
isSubscribing = false;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const watchViewport = needs.viewport && typeof window !== 'undefined';
|
|
502
|
+
if (watchViewport && !isObservingViewport) {
|
|
503
|
+
window.addEventListener('resize', onViewportResize);
|
|
504
|
+
isObservingViewport = true;
|
|
505
|
+
} else if (!watchViewport && isObservingViewport) {
|
|
506
|
+
window.removeEventListener('resize', onViewportResize);
|
|
507
|
+
isObservingViewport = false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** The region's state from its options, its basis and its selection. */
|
|
512
|
+
function compute(): void {
|
|
513
|
+
const needs = observation();
|
|
514
|
+
const hasPositiveMeasurement = containerBasis != null && containerBasis > 0;
|
|
515
|
+
// Before a supplied container is measured, the deterministic 1200px
|
|
516
|
+
// stands in. It also stands in while the container measures 0, as a
|
|
517
|
+
// hidden or detached one does. The first real measurement replaces it.
|
|
518
|
+
const liveBasis = needs.hasContainer
|
|
519
|
+
? hasPositiveMeasurement
|
|
520
|
+
? (containerBasis as number)
|
|
521
|
+
: SERVER_BASIS
|
|
522
|
+
: readViewportBasis();
|
|
523
|
+
const isBasisMeasured = needs.container ? hasPositiveMeasurement : true;
|
|
524
|
+
const basis = gestureBasis ?? liveBasis;
|
|
525
|
+
|
|
526
|
+
const min = resolveBound(
|
|
527
|
+
opts.minSize,
|
|
528
|
+
parseSize(opts.minSize),
|
|
529
|
+
basis,
|
|
530
|
+
DEFAULT_MIN,
|
|
531
|
+
'minSize',
|
|
532
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
533
|
+
didWarn.min,
|
|
534
|
+
source,
|
|
535
|
+
);
|
|
536
|
+
const max = resolveBound(
|
|
537
|
+
opts.maxSize,
|
|
538
|
+
parseSize(opts.maxSize),
|
|
539
|
+
basis,
|
|
540
|
+
Infinity,
|
|
541
|
+
'maxSize',
|
|
542
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
543
|
+
didWarn.max,
|
|
544
|
+
source,
|
|
545
|
+
);
|
|
546
|
+
// A basis-dependent default resolves ONCE into a pixel size; it is final
|
|
547
|
+
// once its basis is real.
|
|
548
|
+
if (initialDefault == null || !initialDefault.isFinal) {
|
|
549
|
+
initialDefault = {
|
|
550
|
+
px: resolveBound(
|
|
551
|
+
opts.defaultSize,
|
|
552
|
+
parseSize(opts.defaultSize),
|
|
553
|
+
basis,
|
|
554
|
+
DEFAULT_SIZE_FALLBACK,
|
|
555
|
+
'defaultSize',
|
|
556
|
+
RESIZABLE_SIZE_GUIDANCE,
|
|
557
|
+
didWarn.defaultSize,
|
|
558
|
+
source,
|
|
559
|
+
),
|
|
560
|
+
isFinal: isBasisMeasured,
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
const defaultPx = initialDefault.px;
|
|
564
|
+
if (chosenSize === undefined) {
|
|
565
|
+
chosenSize =
|
|
566
|
+
persisted?.size ??
|
|
567
|
+
(isBasisMeasured ? clampSize(defaultPx, min, max, snaps()) : null);
|
|
568
|
+
}
|
|
569
|
+
if (isBasisMeasured && chosenSize == null) {
|
|
570
|
+
// The container is measured now: the selection the temporary basis
|
|
571
|
+
// stood in for is made against the real one. Not an interaction, so it
|
|
572
|
+
// reports nothing through onSizeChange.
|
|
573
|
+
chosenSize = clampSize(defaultPx, min, max, snaps());
|
|
574
|
+
}
|
|
575
|
+
// A re-resolved bound clamps the SELECTION, once the basis is final and
|
|
576
|
+
// no gesture holds it.
|
|
577
|
+
if (
|
|
578
|
+
isBasisMeasured &&
|
|
579
|
+
gestureBasis == null &&
|
|
580
|
+
(committedBounds == null ||
|
|
581
|
+
committedBounds.min !== min ||
|
|
582
|
+
committedBounds.max !== max)
|
|
583
|
+
) {
|
|
584
|
+
committedBounds = {min, max};
|
|
585
|
+
if (chosenSize != null) {
|
|
586
|
+
chosenSize = clampSize(chosenSize, min, max, snaps());
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
const size = clampSize(chosenSize ?? defaultPx, min, max, snaps());
|
|
590
|
+
const isCollapsed =
|
|
591
|
+
collapsible() &&
|
|
592
|
+
(isControlled() ? Boolean(opts.isCollapsed) : uncontrolledIsCollapsed);
|
|
593
|
+
|
|
594
|
+
if (min > max && !didWarn.inverted) {
|
|
595
|
+
didWarn.inverted = true;
|
|
596
|
+
devWarn(
|
|
597
|
+
source,
|
|
598
|
+
`the resolved minimum (${min}px) is above the resolved maximum ` +
|
|
599
|
+
`(${max}px). The maximum wins${isHook ? ', as it always has' : ''}.`,
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// The maximum the handle REPORTS: a configured maximum, or a measured
|
|
604
|
+
// extent standing in for it, never below what the handle announces.
|
|
605
|
+
const measuredForMax = needs.hasContainer
|
|
606
|
+
? hasPositiveMeasurement && needs.container
|
|
607
|
+
? containerBasis
|
|
608
|
+
: null
|
|
609
|
+
: readWindowExtent(direction());
|
|
610
|
+
const effectiveMax =
|
|
611
|
+
max !== Infinity
|
|
612
|
+
? max
|
|
613
|
+
: measuredForMax == null
|
|
614
|
+
? undefined
|
|
615
|
+
: Math.max(measuredForMax, isCollapsed ? min : size);
|
|
616
|
+
|
|
617
|
+
derived = {size, isCollapsed, min, max, effectiveMax, isBasisMeasured};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/** Recompute, then bring the observers, the handle, storage and subscribers along. */
|
|
621
|
+
function commit(): void {
|
|
622
|
+
if (isDestroyed) {
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (isSuspended) {
|
|
626
|
+
// No observers and no handle: the last measured basis stands.
|
|
627
|
+
compute();
|
|
628
|
+
} else {
|
|
629
|
+
// The observation a computation needs can change with it (a default
|
|
630
|
+
// made final stops following its container): settle both.
|
|
631
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
632
|
+
const before = observation();
|
|
633
|
+
syncObservation();
|
|
634
|
+
compute();
|
|
635
|
+
const after = observation();
|
|
636
|
+
if (
|
|
637
|
+
before.container === after.container &&
|
|
638
|
+
before.viewport === after.viewport
|
|
639
|
+
) {
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (handle != null && !isSuspended) {
|
|
645
|
+
announce();
|
|
646
|
+
}
|
|
647
|
+
persist();
|
|
648
|
+
const reported = {
|
|
649
|
+
size: derived.isCollapsed ? 0 : derived.size,
|
|
650
|
+
isCollapsed: derived.isCollapsed,
|
|
651
|
+
};
|
|
652
|
+
const next: ResizableSnapshot = {
|
|
653
|
+
size: reported.size,
|
|
654
|
+
isCollapsed: reported.isCollapsed,
|
|
655
|
+
expandedSize: derived.size,
|
|
656
|
+
minPx: derived.min,
|
|
657
|
+
maxPx: derived.max,
|
|
658
|
+
effectiveMaxPx: derived.effectiveMax,
|
|
659
|
+
};
|
|
660
|
+
const isSnapshotChanged =
|
|
661
|
+
snapshot == null ||
|
|
662
|
+
(Object.keys(next) as (keyof ResizableSnapshot)[]).some(
|
|
663
|
+
key => snapshot?.[key] !== next[key],
|
|
664
|
+
);
|
|
665
|
+
if (isSnapshotChanged) {
|
|
666
|
+
snapshot = next;
|
|
667
|
+
}
|
|
668
|
+
if (
|
|
669
|
+
notified == null ||
|
|
670
|
+
notified.size !== reported.size ||
|
|
671
|
+
notified.isCollapsed !== reported.isCollapsed
|
|
672
|
+
) {
|
|
673
|
+
const isFirst = notified == null;
|
|
674
|
+
notified = reported;
|
|
675
|
+
if (!isFirst) {
|
|
676
|
+
for (const listener of [...listeners]) {
|
|
677
|
+
listener();
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (isSnapshotChanged) {
|
|
682
|
+
for (const listener of [...snapshotListeners]) {
|
|
683
|
+
listener();
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** Nothing is written while the basis stands in, nor while a gesture runs. */
|
|
689
|
+
function persist(): void {
|
|
690
|
+
const key = opts.autoSaveId;
|
|
691
|
+
if (key == null || key === '' || !derived.isBasisMeasured) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
if (isGestureActive) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const next = {key, size: derived.size, isCollapsed: derived.isCollapsed};
|
|
698
|
+
if (
|
|
699
|
+
mustWrite ||
|
|
700
|
+
written == null ||
|
|
701
|
+
written.key !== next.key ||
|
|
702
|
+
written.size !== next.size ||
|
|
703
|
+
written.isCollapsed !== next.isCollapsed
|
|
704
|
+
) {
|
|
705
|
+
mustWrite = false;
|
|
706
|
+
written = next;
|
|
707
|
+
persistState(key, {size: next.size, isCollapsed: next.isCollapsed});
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const original = new Map<string, string | null>();
|
|
712
|
+
if (handle != null) {
|
|
713
|
+
for (const name of MANAGED_ATTRIBUTES) {
|
|
714
|
+
original.set(name, handle.getAttribute(name));
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
const hasOwnName =
|
|
718
|
+
handle != null &&
|
|
719
|
+
(handle.hasAttribute('aria-label') ||
|
|
720
|
+
handle.hasAttribute('aria-labelledby'));
|
|
721
|
+
|
|
722
|
+
const setAttribute = (name: string, value: string | null) => {
|
|
723
|
+
if (handle == null) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
if (value == null) {
|
|
727
|
+
handle.removeAttribute(name);
|
|
728
|
+
} else if (handle.getAttribute(name) !== value) {
|
|
729
|
+
handle.setAttribute(name, value);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
function announce(): void {
|
|
734
|
+
if (original.get('role') == null) {
|
|
735
|
+
setAttribute('role', 'separator');
|
|
736
|
+
}
|
|
737
|
+
if (!hasOwnName) {
|
|
738
|
+
setAttribute('aria-label', opts.label ?? english[LABEL_KEY]);
|
|
739
|
+
}
|
|
740
|
+
const {size, isCollapsed, min, effectiveMax} = derived;
|
|
741
|
+
// The attributes ResizeHandle renders, from the same derivation.
|
|
742
|
+
const aria = separatorAttributes({
|
|
743
|
+
direction: direction(),
|
|
744
|
+
isDisabled: isDisabled(),
|
|
745
|
+
value: {
|
|
746
|
+
size: isCollapsed ? 0 : size,
|
|
747
|
+
minPx: min,
|
|
748
|
+
maxPx: effectiveMax,
|
|
749
|
+
isCollapsed,
|
|
750
|
+
collapsedText: opts.collapsedLabel ?? english[COLLAPSED_LABEL_KEY],
|
|
751
|
+
},
|
|
752
|
+
});
|
|
753
|
+
if (original.get('tabindex') == null) {
|
|
754
|
+
setAttribute('tabindex', String(aria.tabIndex));
|
|
755
|
+
}
|
|
756
|
+
setAttribute('aria-orientation', aria['aria-orientation']);
|
|
757
|
+
setAttribute('aria-valuenow', toAttribute(aria['aria-valuenow']));
|
|
758
|
+
setAttribute('aria-valuemin', toAttribute(aria['aria-valuemin']));
|
|
759
|
+
setAttribute('aria-valuemax', toAttribute(aria['aria-valuemax']));
|
|
760
|
+
setAttribute('aria-valuetext', toAttribute(aria['aria-valuetext']));
|
|
761
|
+
setAttribute('aria-disabled', toAttribute(aria['aria-disabled']));
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const setCollapsed = (value: boolean) => {
|
|
765
|
+
if (!isControlled()) {
|
|
766
|
+
uncontrolledIsCollapsed = value;
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
function collapse(): void {
|
|
771
|
+
if (isDestroyed || !collapsible() || derived.isCollapsed) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
setCollapsed(true);
|
|
775
|
+
commit();
|
|
776
|
+
opts.onCollapseChange?.(true);
|
|
777
|
+
opts.onSizeChange?.(0);
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function expand(): void {
|
|
781
|
+
if (isDestroyed) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const wasCollapsed = derived.isCollapsed;
|
|
785
|
+
setCollapsed(false);
|
|
786
|
+
commit();
|
|
787
|
+
if (wasCollapsed) {
|
|
788
|
+
opts.onCollapseChange?.(false);
|
|
789
|
+
}
|
|
790
|
+
opts.onSizeChange?.(derived.size);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function resize(next: number): void {
|
|
794
|
+
if (isDestroyed) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
// An invalid size repairs nothing: it must not replace a legal selection
|
|
798
|
+
// with NaN, which would reach storage and aria-valuenow.
|
|
799
|
+
if (!Number.isFinite(next) || next < 0) {
|
|
800
|
+
devWarn(
|
|
801
|
+
source,
|
|
802
|
+
`resize(${String(next)}) is not a pixel size. Keeping the current ` +
|
|
803
|
+
`size. Percentages configure the ${isHook ? 'hook' : 'region'}; ` +
|
|
804
|
+
'they are not a programmatic input.',
|
|
805
|
+
);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const clamped = clampSize(next, derived.min, derived.max, snaps());
|
|
809
|
+
const wasCollapsed = derived.isCollapsed;
|
|
810
|
+
chosenSize = clamped;
|
|
811
|
+
setCollapsed(false);
|
|
812
|
+
commit();
|
|
813
|
+
// Resizing out of the collapsed state is an implicit expand.
|
|
814
|
+
if (wasCollapsed) {
|
|
815
|
+
opts.onCollapseChange?.(false);
|
|
816
|
+
}
|
|
817
|
+
opts.onSizeChange?.(clamped);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
const model: ResizeGestureModel = {
|
|
821
|
+
state(): ResizeGestureState {
|
|
822
|
+
return {
|
|
823
|
+
size: derived.isCollapsed ? 0 : derived.size,
|
|
824
|
+
isCollapsed: derived.isCollapsed,
|
|
825
|
+
minPx: derived.min,
|
|
826
|
+
maxPx: derived.max,
|
|
827
|
+
snaps: snaps(),
|
|
828
|
+
collapsedSize: opts.collapsedSize ?? DEFAULT_COLLAPSED_SIZE,
|
|
829
|
+
collapsible: collapsible(),
|
|
830
|
+
};
|
|
831
|
+
},
|
|
832
|
+
start() {
|
|
833
|
+
// The basis holds still for the whole gesture.
|
|
834
|
+
gestureBasis = readLiveBasis();
|
|
835
|
+
isGestureActive = true;
|
|
836
|
+
dragStartSize = derived.isCollapsed ? 0 : derived.size;
|
|
837
|
+
},
|
|
838
|
+
move(delta) {
|
|
839
|
+
const raw = dragStartSize + delta;
|
|
840
|
+
const collapsedSize = opts.collapsedSize ?? DEFAULT_COLLAPSED_SIZE;
|
|
841
|
+
if (collapsible() && raw < collapsedSize) {
|
|
842
|
+
if (!derived.isCollapsed) {
|
|
843
|
+
setCollapsed(true);
|
|
844
|
+
commit();
|
|
845
|
+
opts.onCollapseChange?.(true);
|
|
846
|
+
opts.onSizeChange?.(0);
|
|
847
|
+
}
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
const reopens = derived.isCollapsed && raw >= collapsedSize;
|
|
851
|
+
if (reopens) {
|
|
852
|
+
setCollapsed(false);
|
|
853
|
+
}
|
|
854
|
+
const clamped = clampSize(raw, derived.min, derived.max, snaps());
|
|
855
|
+
chosenSize = clamped;
|
|
856
|
+
commit();
|
|
857
|
+
if (reopens) {
|
|
858
|
+
opts.onCollapseChange?.(false);
|
|
859
|
+
}
|
|
860
|
+
opts.onSizeChange?.(clamped);
|
|
861
|
+
},
|
|
862
|
+
end() {
|
|
863
|
+
endGesture();
|
|
864
|
+
},
|
|
865
|
+
// A cancelled gesture is still over: the basis it held comes back, and
|
|
866
|
+
// the size it reached is saved once, like a completed one.
|
|
867
|
+
cancel() {
|
|
868
|
+
endGesture();
|
|
869
|
+
},
|
|
870
|
+
collapse,
|
|
871
|
+
expand,
|
|
872
|
+
};
|
|
873
|
+
|
|
874
|
+
function readLiveBasis(): number {
|
|
875
|
+
const needs = observation();
|
|
876
|
+
if (!needs.hasContainer) {
|
|
877
|
+
return readViewportBasis();
|
|
878
|
+
}
|
|
879
|
+
return containerBasis != null && containerBasis > 0
|
|
880
|
+
? containerBasis
|
|
881
|
+
: SERVER_BASIS;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function endGesture(): void {
|
|
885
|
+
if (!isGestureActive) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
gestureBasis = null;
|
|
889
|
+
isGestureActive = false;
|
|
890
|
+
mustWrite = true;
|
|
891
|
+
commit();
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
const gesture: ResizeGesture = createResizeGesture(
|
|
895
|
+
() => handle,
|
|
896
|
+
model,
|
|
897
|
+
() => ({
|
|
898
|
+
direction: direction(),
|
|
899
|
+
isReversed: isReversed(),
|
|
900
|
+
isDisabled: isDisabled(),
|
|
901
|
+
}),
|
|
902
|
+
dragging => {
|
|
903
|
+
setAttribute('data-resizing', dragging ? '' : null);
|
|
904
|
+
},
|
|
905
|
+
);
|
|
906
|
+
|
|
907
|
+
const onPointerDown = (event: PointerEvent) => {
|
|
908
|
+
gesture.pointerDown(event);
|
|
909
|
+
};
|
|
910
|
+
const onPointerMove = (event: PointerEvent) => {
|
|
911
|
+
gesture.pointerMove(event);
|
|
912
|
+
};
|
|
913
|
+
const onPointerUp = (event: PointerEvent) => {
|
|
914
|
+
gesture.pointerUp(event);
|
|
915
|
+
};
|
|
916
|
+
const onPointerCancel = (event: PointerEvent) => {
|
|
917
|
+
gesture.pointerCancel(event);
|
|
918
|
+
};
|
|
919
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
920
|
+
gesture.keyDown(event);
|
|
921
|
+
};
|
|
922
|
+
const onDoubleClick = () => {
|
|
923
|
+
gesture.doubleClick();
|
|
924
|
+
};
|
|
925
|
+
function bindHandle(): void {
|
|
926
|
+
handle?.addEventListener('pointerdown', onPointerDown);
|
|
927
|
+
handle?.addEventListener('pointermove', onPointerMove);
|
|
928
|
+
handle?.addEventListener('pointerup', onPointerUp);
|
|
929
|
+
handle?.addEventListener('pointercancel', onPointerCancel);
|
|
930
|
+
handle?.addEventListener('lostpointercapture', onPointerCancel);
|
|
931
|
+
handle?.addEventListener('keydown', onKeyDown);
|
|
932
|
+
handle?.addEventListener('dblclick', onDoubleClick);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* The handle's listeners and the observers go, and the handle gets its own
|
|
937
|
+
* attributes back; a gesture in flight has ended first.
|
|
938
|
+
*/
|
|
939
|
+
function letGoOfPage(): void {
|
|
940
|
+
handle?.removeEventListener('pointerdown', onPointerDown);
|
|
941
|
+
handle?.removeEventListener('pointermove', onPointerMove);
|
|
942
|
+
handle?.removeEventListener('pointerup', onPointerUp);
|
|
943
|
+
handle?.removeEventListener('pointercancel', onPointerCancel);
|
|
944
|
+
handle?.removeEventListener('lostpointercapture', onPointerCancel);
|
|
945
|
+
handle?.removeEventListener('keydown', onKeyDown);
|
|
946
|
+
handle?.removeEventListener('dblclick', onDoubleClick);
|
|
947
|
+
stopObservingContainer?.();
|
|
948
|
+
stopObservingContainer = null;
|
|
949
|
+
containerElement = null;
|
|
950
|
+
if (isObservingViewport) {
|
|
951
|
+
window.removeEventListener('resize', onViewportResize);
|
|
952
|
+
isObservingViewport = false;
|
|
953
|
+
}
|
|
954
|
+
for (const [name, value] of original) {
|
|
955
|
+
setAttribute(name, value);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
bindHandle();
|
|
960
|
+
commit();
|
|
961
|
+
|
|
962
|
+
const controller: ResizableController = {
|
|
963
|
+
get size() {
|
|
964
|
+
return derived.isCollapsed ? 0 : derived.size;
|
|
965
|
+
},
|
|
966
|
+
get isCollapsed() {
|
|
967
|
+
return derived.isCollapsed;
|
|
968
|
+
},
|
|
969
|
+
collapse,
|
|
970
|
+
expand,
|
|
971
|
+
resize,
|
|
972
|
+
update(next) {
|
|
973
|
+
if (isDestroyed) {
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
opts = next;
|
|
977
|
+
if (opts.autoSaveId !== persistedKey) {
|
|
978
|
+
persistedKey = opts.autoSaveId;
|
|
979
|
+
persisted = persistedKey ? loadPersistedState(persistedKey) : null;
|
|
980
|
+
}
|
|
981
|
+
commit();
|
|
982
|
+
},
|
|
983
|
+
subscribe(listener) {
|
|
984
|
+
listeners.add(listener);
|
|
985
|
+
return () => {
|
|
986
|
+
listeners.delete(listener);
|
|
987
|
+
};
|
|
988
|
+
},
|
|
989
|
+
destroy() {
|
|
990
|
+
if (isDestroyed) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
// A drag in flight ends first, as cancelled, so the size it reached is
|
|
994
|
+
// saved and the pointer and the body's cursor are released.
|
|
995
|
+
gesture.interrupt();
|
|
996
|
+
// A gesture a ResizeHandle drove through the region's model, rather
|
|
997
|
+
// than the factory's own, ends the same way.
|
|
998
|
+
endGesture();
|
|
999
|
+
isDestroyed = true;
|
|
1000
|
+
if (!isSuspended) {
|
|
1001
|
+
letGoOfPage();
|
|
1002
|
+
}
|
|
1003
|
+
listeners.clear();
|
|
1004
|
+
snapshotListeners.clear();
|
|
1005
|
+
},
|
|
1006
|
+
};
|
|
1007
|
+
internals.set(controller, {
|
|
1008
|
+
snapshot: () => snapshot as ResizableSnapshot,
|
|
1009
|
+
subscribeSnapshot(listener) {
|
|
1010
|
+
snapshotListeners.add(listener);
|
|
1011
|
+
return () => {
|
|
1012
|
+
snapshotListeners.delete(listener);
|
|
1013
|
+
};
|
|
1014
|
+
},
|
|
1015
|
+
model,
|
|
1016
|
+
suspend() {
|
|
1017
|
+
if (isDestroyed || isSuspended) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
gesture.interrupt();
|
|
1021
|
+
endGesture();
|
|
1022
|
+
isSuspended = true;
|
|
1023
|
+
letGoOfPage();
|
|
1024
|
+
},
|
|
1025
|
+
resume() {
|
|
1026
|
+
if (isDestroyed || !isSuspended) {
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
isSuspended = false;
|
|
1030
|
+
bindHandle();
|
|
1031
|
+
commit();
|
|
1032
|
+
},
|
|
1033
|
+
syncContainer() {
|
|
1034
|
+
if (isDestroyed || isSuspended) {
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const element = observation().container
|
|
1038
|
+
? (opts.containerRef?.current ?? null)
|
|
1039
|
+
: null;
|
|
1040
|
+
if (element !== containerElement) {
|
|
1041
|
+
commit();
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
});
|
|
1045
|
+
return controller;
|
|
1046
|
+
}
|