@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"interactionOverlay.stylex.d.ts","sourceRoot":"","sources":["../../src/utils/interactionOverlay.stylex.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AAmCH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAI3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;WAEpB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;IACtB,mEAAmE;;CAEnE,CAAC;AA8HH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8HnC,CAAC"}
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* @input StyleX and the semantic interaction-overlay color tokens
|
|
10
10
|
* @output Reusable background-color and background-image state styles, the
|
|
11
11
|
* touch press's registered strength variable (`pressVars`) and its clocks
|
|
12
|
-
* (`pressConsts`)
|
|
12
|
+
* (`pressConsts`). The list row's compositor press layer and its clocks
|
|
13
|
+
* are internal (privateAttributes/press.stylex.ts, utils/rowPressLayer.stylex.ts)
|
|
13
14
|
* @position Internal styling utility for interactive core surfaces
|
|
14
15
|
*
|
|
15
16
|
* SYNC: When modified, update pressFeedback.ts, pressGesture.ts (the fade
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
// background image, so a composer's color transition cannot fade the onset
|
|
42
43
|
// in. `on` sets the strength to 1 on the first frame. `fading` animates it
|
|
43
44
|
// from 1 to 0, not to the hover strength, because a finger has no hover. The
|
|
44
|
-
// theme's motion
|
|
45
|
+
// release plays the theme's exit motion tokens, which follow its tempo.
|
|
45
46
|
//
|
|
46
47
|
// The release is an animation, not a transition. Composers own their
|
|
47
48
|
// `transition-*` longhands, and StyleX is last-wins per property. A
|
|
@@ -54,8 +55,10 @@
|
|
|
54
55
|
// `animation-*` on the element that composes them. The touch arms own both.
|
|
55
56
|
|
|
56
57
|
import * as stylex from '@stylexjs/stylex';
|
|
58
|
+
import "../motion/reducedMotion.stylex.js";
|
|
59
|
+
import { reducedMotionFadeConsts } from "../motion/reducedMotion.stylex.js";
|
|
57
60
|
import "../theme/tokens.stylex.js";
|
|
58
|
-
import { colorVars } from "../theme/tokens.stylex.js";
|
|
61
|
+
import { colorVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
59
62
|
|
|
60
63
|
/**
|
|
61
64
|
* The touch press's strength on the surface the controller painted, 0 to 1.
|
|
@@ -74,25 +77,21 @@ export const pressVars = {
|
|
|
74
77
|
};
|
|
75
78
|
|
|
76
79
|
/**
|
|
77
|
-
* The touch press's
|
|
78
|
-
*
|
|
79
|
-
* `defineConsts`, so the one number is inlined here at build time and is the
|
|
80
|
-
* controller's constant at run time (`PRESS_FADE_MS` in pressGesture.ts):
|
|
81
|
-
* the release animation and the controller's clock cannot drift apart. When
|
|
82
|
-
* that clock runs out, the controller waits for a release animation that a
|
|
83
|
-
* busy main thread started late, then removes the attribute.
|
|
80
|
+
* The touch press's measured release clock, kept as a reference value. Press
|
|
81
|
+
* releases now play the theme's `--duration-exit`.
|
|
84
82
|
*/
|
|
85
83
|
export const pressConsts = {
|
|
86
84
|
releaseMs: 200
|
|
87
85
|
};
|
|
88
86
|
|
|
89
87
|
/**
|
|
90
|
-
* The release's clock
|
|
91
|
-
*
|
|
88
|
+
* The release's clock: the theme's exit duration. The token already
|
|
89
|
+
* follows the theme's tempo. The controller's timer reads the
|
|
90
|
+
* same property.
|
|
92
91
|
*/
|
|
93
|
-
const PRESS_RELEASE_DURATION =
|
|
94
|
-
/** The same clock under Reduce Motion
|
|
95
|
-
const PRESS_RELEASE_DURATION_REDUCED = `min(${
|
|
92
|
+
const PRESS_RELEASE_DURATION = durationVars['--duration-exit'];
|
|
93
|
+
/** The same clock under Reduce Motion, no longer than the Reduce Motion fade. */
|
|
94
|
+
const PRESS_RELEASE_DURATION_REDUCED = `min(${durationVars['--duration-exit']}, ${reducedMotionFadeConsts.duration})`;
|
|
96
95
|
const ENABLED = ':where(:not(:disabled,[aria-disabled="true"]))';
|
|
97
96
|
const HOVER_HOVER = '@media (hover: hover)';
|
|
98
97
|
const COARSE = '@media (pointer: coarse)';
|
|
@@ -138,13 +137,12 @@ const pressedOverlayImage = 'var(--_press-paint-image)';
|
|
|
138
137
|
const pressRelease = "x10jkm1t-B";
|
|
139
138
|
|
|
140
139
|
/**
|
|
141
|
-
* The release's curve:
|
|
142
|
-
* (
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* would read as half its clock.
|
|
140
|
+
* The release's curve: the theme's exit easing. The list row's layer
|
|
141
|
+
* (privateAttributes/press.stylex.ts) and Switch's press layers use the same
|
|
142
|
+
* token; interactionOverlay.cell.test.ts and Switch.test.tsx fail if they
|
|
143
|
+
* differ.
|
|
146
144
|
*/
|
|
147
|
-
const RELEASE_EASE = '
|
|
145
|
+
const RELEASE_EASE = easeVars['--ease-exit'];
|
|
148
146
|
|
|
149
147
|
/**
|
|
150
148
|
* The touch press's strength and its release, on the element the controller
|
|
@@ -198,8 +196,8 @@ export const interactionOverlayStyles = {
|
|
|
198
196
|
backgroundColor: {
|
|
199
197
|
"--astryx-press-alpha": "x11z29ks xli5ek3",
|
|
200
198
|
kKVMdj: "x14e4jsf",
|
|
201
|
-
k44tkh: "
|
|
202
|
-
kyAemX: "
|
|
199
|
+
k44tkh: "xem8lmn xogcwkh",
|
|
200
|
+
kyAemX: "x1t1ddl7",
|
|
203
201
|
kWV6AL: "xziyay6",
|
|
204
202
|
"--_press-paint": "xz2mauf",
|
|
205
203
|
"--_press-paint-image": "x1l7afqf",
|
|
@@ -210,8 +208,8 @@ export const interactionOverlayStyles = {
|
|
|
210
208
|
backgroundImage: {
|
|
211
209
|
"--astryx-press-alpha": "x11z29ks xli5ek3",
|
|
212
210
|
kKVMdj: "x14e4jsf",
|
|
213
|
-
k44tkh: "
|
|
214
|
-
kyAemX: "
|
|
211
|
+
k44tkh: "xem8lmn xogcwkh",
|
|
212
|
+
kyAemX: "x1t1ddl7",
|
|
215
213
|
kWV6AL: "xziyay6",
|
|
216
214
|
"--_press-paint": "xz2mauf",
|
|
217
215
|
"--_press-paint-image": "x1l7afqf",
|
|
@@ -221,8 +219,8 @@ export const interactionOverlayStyles = {
|
|
|
221
219
|
backgroundImageOnNeutral: {
|
|
222
220
|
"--astryx-press-alpha": "x11z29ks xli5ek3",
|
|
223
221
|
kKVMdj: "x14e4jsf",
|
|
224
|
-
k44tkh: "
|
|
225
|
-
kyAemX: "
|
|
222
|
+
k44tkh: "xem8lmn xogcwkh",
|
|
223
|
+
kyAemX: "x1t1ddl7",
|
|
226
224
|
kWV6AL: "xziyay6",
|
|
227
225
|
"--_press-paint": "xz2mauf",
|
|
228
226
|
"--_press-paint-image": "x1l7afqf",
|
|
@@ -232,8 +230,8 @@ export const interactionOverlayStyles = {
|
|
|
232
230
|
pressedBackgroundColor: {
|
|
233
231
|
"--astryx-press-alpha": "x11z29ks xli5ek3",
|
|
234
232
|
kKVMdj: "x14e4jsf",
|
|
235
|
-
k44tkh: "
|
|
236
|
-
kyAemX: "
|
|
233
|
+
k44tkh: "xem8lmn xogcwkh",
|
|
234
|
+
kyAemX: "x1t1ddl7",
|
|
237
235
|
kWV6AL: "xziyay6",
|
|
238
236
|
"--_press-paint": "xz2mauf",
|
|
239
237
|
"--_press-paint-image": "x1l7afqf",
|
|
@@ -244,8 +242,8 @@ export const interactionOverlayStyles = {
|
|
|
244
242
|
pressedAlpha: {
|
|
245
243
|
"--astryx-press-alpha": "x11z29ks xli5ek3",
|
|
246
244
|
kKVMdj: "x14e4jsf",
|
|
247
|
-
k44tkh: "
|
|
248
|
-
kyAemX: "
|
|
245
|
+
k44tkh: "xem8lmn xogcwkh",
|
|
246
|
+
kyAemX: "x1t1ddl7",
|
|
249
247
|
kWV6AL: "xziyay6",
|
|
250
248
|
"--_press-paint": "xz2mauf",
|
|
251
249
|
"--_press-paint-image": "x1l7afqf",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ISODateString, PlainDate } from './dateTypes.js';
|
|
8
8
|
import type { Locale } from '../i18n/types.js';
|
|
9
|
+
import { type CalendarSystem } from './calendarSystem.js';
|
|
9
10
|
export type { PlainDate } from './dateTypes.js';
|
|
10
11
|
export declare function plainDateCreate(year: number, month: number, day: number): PlainDate;
|
|
11
12
|
export declare function plainDateFromISO(str: ISODateString): PlainDate;
|
|
@@ -64,6 +65,21 @@ export declare function plainDateIsEqual(a: PlainDate, b: PlainDate): boolean;
|
|
|
64
65
|
export declare function plainDateMax(a: PlainDate, b: PlainDate): PlainDate;
|
|
65
66
|
export declare function plainDateMin(a: PlainDate, b: PlainDate): PlainDate;
|
|
66
67
|
export declare function plainDateIsInRange(pd: PlainDate, range: [PlainDate, PlainDate]): boolean;
|
|
68
|
+
export interface NearestAcceptedDateOptions {
|
|
69
|
+
min?: PlainDate | null;
|
|
70
|
+
max?: PlainDate | null;
|
|
71
|
+
/** Rejects a date inside the bounds, such as a date constraint. */
|
|
72
|
+
isDateDisabled?: (date: PlainDate) => boolean;
|
|
73
|
+
/** How many days to search on each side of the clamped date. */
|
|
74
|
+
searchDays?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The date nearest to `target` that a field accepts. It clamps `target` into
|
|
78
|
+
* [`min`, `max`], then searches outward one day at a time, inside the bounds,
|
|
79
|
+
* for a date that `isDateDisabled` allows. On a tie the later date wins. When
|
|
80
|
+
* no date inside the search window is allowed, it returns the clamped date.
|
|
81
|
+
*/
|
|
82
|
+
export declare function nearestAcceptedDate(target: PlainDate, { min, max, isDateDisabled, searchDays }: NearestAcceptedDateOptions): PlainDate;
|
|
67
83
|
export declare function plainDateSetFirstOfMonth(pd: PlainDate): PlainDate;
|
|
68
84
|
export declare function plainDateSetStartOfWeek(pd: PlainDate, weekStartsOn: number): PlainDate;
|
|
69
85
|
export declare function plainDateSetEndOfWeekExclusive(pd: PlainDate, weekStartsOn: number): PlainDate;
|
|
@@ -80,7 +96,7 @@ export declare const DATE_FORMAT_MONTH_YEAR: Intl.DateTimeFormatOptions;
|
|
|
80
96
|
* stand-alone forms (`component:Calendar` FR1). Internal: not re-exported from
|
|
81
97
|
* `utils/index.ts`.
|
|
82
98
|
*/
|
|
83
|
-
export declare function plainDateFormatStandaloneMonthYear(pd: PlainDate, locale: Locale): string;
|
|
99
|
+
export declare function plainDateFormatStandaloneMonthYear(pd: PlainDate, locale: Locale, calendar?: Intl.DateTimeFormatOptions['calendar']): string;
|
|
84
100
|
export declare const DATE_FORMAT_WEEKDAY_ONLY: Intl.DateTimeFormatOptions;
|
|
85
101
|
/**
|
|
86
102
|
* The platform's weekday names for a locale, Sunday first, in `Intl`'s
|
|
@@ -101,11 +117,23 @@ export declare const DATE_FORMAT_SHORT_WITH_YEAR: Intl.DateTimeFormatOptions;
|
|
|
101
117
|
* when `options.calendar` is omitted. The explicit option remains supported for
|
|
102
118
|
* compatibility with the public `Intl.DateTimeFormatOptions` signature; it is a
|
|
103
119
|
* display-only escape hatch and does not change PlainDate arithmetic, parsing,
|
|
104
|
-
* serialization, or any Astryx component's calendar semantics.
|
|
120
|
+
* serialization, or any Astryx component's calendar semantics. Another
|
|
121
|
+
* calendar names the month and day that Calendar shows in it.
|
|
105
122
|
*/
|
|
106
123
|
export declare function plainDateFormat(pd: PlainDate, options: Intl.DateTimeFormatOptions, locale?: Locale): string;
|
|
124
|
+
/**
|
|
125
|
+
* The parts of `plainDateFormat`'s output, from the same formatter and date.
|
|
126
|
+
* Internal: not re-exported from `utils/index.ts`.
|
|
127
|
+
*/
|
|
128
|
+
export declare function plainDateFormatToParts(pd: PlainDate, options: Intl.DateTimeFormatOptions, locale: Locale): Intl.DateTimeFormatPart[];
|
|
107
129
|
/** @internal plainDateFormat's formatter cache; not part of the public API. */
|
|
108
130
|
export declare function dateTimeFormatFor(locale: Locale, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
|
|
131
|
+
/**
|
|
132
|
+
* @internal `dateTimeFormatFor`, except that without `options.timeZone` it
|
|
133
|
+
* builds a formatter for the call. A cached formatter keeps the host zone it
|
|
134
|
+
* was built in.
|
|
135
|
+
*/
|
|
136
|
+
export declare function dateTimeFormatAtCall(locale: Locale, options: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
|
|
109
137
|
/**
|
|
110
138
|
* The locale's name for the "week of year" date field ("week", "Woche", "週"),
|
|
111
139
|
* from CLDR through `Intl.DisplayNames`. Calendar names its week-number
|
|
@@ -120,12 +148,13 @@ export declare function dateTimeFormatFor(locale: Locale, options: Intl.DateTime
|
|
|
120
148
|
export declare function plainDateWeekFieldName(locale?: Locale): string;
|
|
121
149
|
/**
|
|
122
150
|
* A day of the month or a week number in the locale's own digits: `15` in
|
|
123
|
-
* English, `۱۵` in Persian, `١٥` in Egyptian Arabic.
|
|
124
|
-
*
|
|
125
|
-
*
|
|
151
|
+
* English, `۱۵` in Persian, `١٥` in Egyptian Arabic. A `numberingSystem`
|
|
152
|
+
* replaces the locale's digits. Only the digits change. The number stays the
|
|
153
|
+
* value that it is given, so no calendar applies, and no grouping separator or
|
|
154
|
+
* unit word is added.
|
|
126
155
|
* Internal: not re-exported from `utils/index.ts`.
|
|
127
156
|
*/
|
|
128
|
-
export declare function plainDateFormatDayNumber(value: number, locale: Locale): string;
|
|
157
|
+
export declare function plainDateFormatDayNumber(value: number, locale: Locale, numberingSystem?: string): string;
|
|
129
158
|
/**
|
|
130
159
|
* The date-only members of Timestamp's `format` vocabulary that a
|
|
131
160
|
* calendar-date field (no time-of-day) can render. Both Timestamp and
|
|
@@ -153,6 +182,8 @@ export declare const SHARED_DATE_FORMAT_OPTIONS: Record<Exclude<SharedDateFormat
|
|
|
153
182
|
* members. The shared entry point DateInput uses for the named-format path;
|
|
154
183
|
* Timestamp maps the same members onto {@link SHARED_DATE_FORMAT_OPTIONS} in
|
|
155
184
|
* its own `formatTimestamp` switch (its input is a `Date`, not a `PlainDate`).
|
|
185
|
+
* The locale-aware members write the date in `calendar`, which defaults to
|
|
186
|
+
* Gregorian. `system_date` stays the Gregorian ISO date in every calendar.
|
|
156
187
|
*/
|
|
157
|
-
export declare function formatSharedDate(pd: PlainDate, format: SharedDateFormat, locale?: Locale): string;
|
|
188
|
+
export declare function formatSharedDate(pd: PlainDate, format: SharedDateFormat, locale?: Locale, calendar?: CalendarSystem): string;
|
|
158
189
|
//# sourceMappingURL=plainDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAI1B,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,SAAS,CAcX;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,CAG9D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,aAAa,CAK3D;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAMnD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,CAMpD;AAED,wBAAgB,cAAc,IAAI,SAAS,CAE1C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,E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,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAClC,IAAI,CAAC,cAAc,CAIrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,MAAa,GAAG,MAAM,CAYpE;AAID;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAWR;AAMD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAC1B,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,EACxC,IAAI,CAAC,qBAAqB,CAK3B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,gBAAgB,EACxB,MAAM,GAAE,MAAa,EACrB,QAAQ,GAAE,cAA0B,GACnC,MAAM,CASR"}
|
package/dist/utils/plainDate.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @position Shared utility; replaces scattered Date usage across Calendar hooks
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { formatCalendarDate, isCalendarSystem } from "./calendarSystem.js";
|
|
10
11
|
import { firstCharacter } from "./characters.js";
|
|
11
12
|
import { standaloneMonthCapitalLanguages } from "./standaloneMonthCapitals.generated.js";
|
|
12
13
|
export function plainDateCreate(year, month, day) {
|
|
@@ -207,6 +208,41 @@ export function plainDateMin(a, b) {
|
|
|
207
208
|
export function plainDateIsInRange(pd, range) {
|
|
208
209
|
return compare(pd, range[0]) >= 0 && compare(pd, range[1]) <= 0;
|
|
209
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* The date nearest to `target` that a field accepts. It clamps `target` into
|
|
213
|
+
* [`min`, `max`], then searches outward one day at a time, inside the bounds,
|
|
214
|
+
* for a date that `isDateDisabled` allows. On a tie the later date wins. When
|
|
215
|
+
* no date inside the search window is allowed, it returns the clamped date.
|
|
216
|
+
*/
|
|
217
|
+
export function nearestAcceptedDate(target, {
|
|
218
|
+
min,
|
|
219
|
+
max,
|
|
220
|
+
isDateDisabled,
|
|
221
|
+
searchDays = 366
|
|
222
|
+
}) {
|
|
223
|
+
let clamped = target;
|
|
224
|
+
if (min != null && compare(clamped, min) < 0) {
|
|
225
|
+
clamped = min;
|
|
226
|
+
}
|
|
227
|
+
if (max != null && compare(clamped, max) > 0) {
|
|
228
|
+
clamped = max;
|
|
229
|
+
}
|
|
230
|
+
if (isDateDisabled == null || !isDateDisabled(clamped)) {
|
|
231
|
+
return clamped;
|
|
232
|
+
}
|
|
233
|
+
const isAccepted = date => (min == null || compare(date, min) >= 0) && (max == null || compare(date, max) <= 0) && !isDateDisabled(date);
|
|
234
|
+
for (let offset = 1; offset <= searchDays; offset += 1) {
|
|
235
|
+
const later = plainDateAddDays(clamped, offset);
|
|
236
|
+
if (isAccepted(later)) {
|
|
237
|
+
return later;
|
|
238
|
+
}
|
|
239
|
+
const earlier = plainDateAddDays(clamped, -offset);
|
|
240
|
+
if (isAccepted(earlier)) {
|
|
241
|
+
return earlier;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return clamped;
|
|
245
|
+
}
|
|
210
246
|
export function plainDateSetFirstOfMonth(pd) {
|
|
211
247
|
return {
|
|
212
248
|
year: pd.year,
|
|
@@ -278,8 +314,11 @@ export const DATE_FORMAT_MONTH_YEAR = {
|
|
|
278
314
|
* stand-alone forms (`component:Calendar` FR1). Internal: not re-exported from
|
|
279
315
|
* `utils/index.ts`.
|
|
280
316
|
*/
|
|
281
|
-
export function plainDateFormatStandaloneMonthYear(pd, locale) {
|
|
282
|
-
const label = plainDateFormat(pd,
|
|
317
|
+
export function plainDateFormatStandaloneMonthYear(pd, locale, calendar = 'gregory') {
|
|
318
|
+
const label = plainDateFormat(pd, {
|
|
319
|
+
...DATE_FORMAT_MONTH_YEAR,
|
|
320
|
+
calendar
|
|
321
|
+
}, locale);
|
|
283
322
|
let language;
|
|
284
323
|
try {
|
|
285
324
|
language = new Intl.Locale(locale).language;
|
|
@@ -357,33 +396,51 @@ export const DATE_FORMAT_SHORT_WITH_YEAR = {
|
|
|
357
396
|
* when `options.calendar` is omitted. The explicit option remains supported for
|
|
358
397
|
* compatibility with the public `Intl.DateTimeFormatOptions` signature; it is a
|
|
359
398
|
* display-only escape hatch and does not change PlainDate arithmetic, parsing,
|
|
360
|
-
* serialization, or any Astryx component's calendar semantics.
|
|
399
|
+
* serialization, or any Astryx component's calendar semantics. Another
|
|
400
|
+
* calendar names the month and day that Calendar shows in it.
|
|
361
401
|
*/
|
|
362
402
|
export function plainDateFormat(pd, options, locale = 'en') {
|
|
403
|
+
const calendar = options.calendar ?? 'gregory';
|
|
404
|
+
if (calendar !== 'gregory' && isCalendarSystem(calendar)) {
|
|
405
|
+
return formatCalendarDate(calendar, pd, options, locale);
|
|
406
|
+
}
|
|
407
|
+
const [format, date] = plainDateFormatInput(pd, options, locale);
|
|
408
|
+
return format.format(date);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* The parts of `plainDateFormat`'s output, from the same formatter and date.
|
|
413
|
+
* Internal: not re-exported from `utils/index.ts`.
|
|
414
|
+
*/
|
|
415
|
+
export function plainDateFormatToParts(pd, options, locale) {
|
|
416
|
+
const [format, date] = plainDateFormatInput(pd, options, locale);
|
|
417
|
+
return format.formatToParts(date);
|
|
418
|
+
}
|
|
419
|
+
function plainDateFormatInput(pd, options, locale) {
|
|
363
420
|
const calendar = options.calendar ?? 'gregory';
|
|
364
421
|
if (options.timeZone != null) {
|
|
365
|
-
return dateTimeFormatFor(locale, {
|
|
422
|
+
return [dateTimeFormatFor(locale, {
|
|
366
423
|
...options,
|
|
367
424
|
calendar
|
|
368
|
-
})
|
|
425
|
+
}), plainDateToDate(pd)];
|
|
369
426
|
}
|
|
370
427
|
if (TIME_OF_DAY_FIELDS.some(field => options[field] != null)) {
|
|
371
428
|
// A zone name or a time of day reads local midnight in the zone current
|
|
372
429
|
// at the call. A cached formatter would keep the zone it was built in,
|
|
373
430
|
// so this one is built for the call.
|
|
374
|
-
return new Intl.DateTimeFormat(locale, {
|
|
431
|
+
return [new Intl.DateTimeFormat(locale, {
|
|
375
432
|
...options,
|
|
376
433
|
calendar
|
|
377
|
-
})
|
|
434
|
+
}), plainDateToDate(pd)];
|
|
378
435
|
}
|
|
379
436
|
// Date fields alone: UTC midnight formatted in UTC, so neither the cached
|
|
380
437
|
// formatter nor the date depends on the host's zone, which can change while
|
|
381
438
|
// a page is open.
|
|
382
|
-
return dateTimeFormatFor(locale, {
|
|
439
|
+
return [dateTimeFormatFor(locale, {
|
|
383
440
|
...options,
|
|
384
441
|
calendar,
|
|
385
442
|
timeZone: 'UTC'
|
|
386
|
-
})
|
|
443
|
+
}), utcTime(pd.year, pd.month - 1, pd.day)];
|
|
387
444
|
}
|
|
388
445
|
|
|
389
446
|
/** Options that print a time of day or a zone, which a PlainDate lacks. */
|
|
@@ -409,6 +466,15 @@ export function dateTimeFormatFor(locale, options) {
|
|
|
409
466
|
return format;
|
|
410
467
|
}
|
|
411
468
|
|
|
469
|
+
/**
|
|
470
|
+
* @internal `dateTimeFormatFor`, except that without `options.timeZone` it
|
|
471
|
+
* builds a formatter for the call. A cached formatter keeps the host zone it
|
|
472
|
+
* was built in.
|
|
473
|
+
*/
|
|
474
|
+
export function dateTimeFormatAtCall(locale, options) {
|
|
475
|
+
return options.timeZone === undefined ? new Intl.DateTimeFormat(locale, options) : dateTimeFormatFor(locale, options);
|
|
476
|
+
}
|
|
477
|
+
|
|
412
478
|
/**
|
|
413
479
|
* The locale's name for the "week of year" date field ("week", "Woche", "週"),
|
|
414
480
|
* from CLDR through `Intl.DisplayNames`. Calendar names its week-number
|
|
@@ -437,18 +503,21 @@ const dayNumberFormats = new Map();
|
|
|
437
503
|
|
|
438
504
|
/**
|
|
439
505
|
* A day of the month or a week number in the locale's own digits: `15` in
|
|
440
|
-
* English, `۱۵` in Persian, `١٥` in Egyptian Arabic.
|
|
441
|
-
*
|
|
442
|
-
*
|
|
506
|
+
* English, `۱۵` in Persian, `١٥` in Egyptian Arabic. A `numberingSystem`
|
|
507
|
+
* replaces the locale's digits. Only the digits change. The number stays the
|
|
508
|
+
* value that it is given, so no calendar applies, and no grouping separator or
|
|
509
|
+
* unit word is added.
|
|
443
510
|
* Internal: not re-exported from `utils/index.ts`.
|
|
444
511
|
*/
|
|
445
|
-
export function plainDateFormatDayNumber(value, locale) {
|
|
446
|
-
|
|
512
|
+
export function plainDateFormatDayNumber(value, locale, numberingSystem) {
|
|
513
|
+
const key = `${locale}|${numberingSystem ?? ''}`;
|
|
514
|
+
let format = dayNumberFormats.get(key);
|
|
447
515
|
if (format == null) {
|
|
448
516
|
format = new Intl.NumberFormat(locale, {
|
|
449
|
-
useGrouping: false
|
|
517
|
+
useGrouping: false,
|
|
518
|
+
numberingSystem
|
|
450
519
|
});
|
|
451
|
-
dayNumberFormats.set(
|
|
520
|
+
dayNumberFormats.set(key, format);
|
|
452
521
|
}
|
|
453
522
|
return format.format(value);
|
|
454
523
|
}
|
|
@@ -489,10 +558,15 @@ export const SHARED_DATE_FORMAT_OPTIONS = {
|
|
|
489
558
|
* members. The shared entry point DateInput uses for the named-format path;
|
|
490
559
|
* Timestamp maps the same members onto {@link SHARED_DATE_FORMAT_OPTIONS} in
|
|
491
560
|
* its own `formatTimestamp` switch (its input is a `Date`, not a `PlainDate`).
|
|
561
|
+
* The locale-aware members write the date in `calendar`, which defaults to
|
|
562
|
+
* Gregorian. `system_date` stays the Gregorian ISO date in every calendar.
|
|
492
563
|
*/
|
|
493
|
-
export function formatSharedDate(pd, format, locale = 'en') {
|
|
564
|
+
export function formatSharedDate(pd, format, locale = 'en', calendar = 'gregory') {
|
|
494
565
|
if (format === 'system_date') {
|
|
495
566
|
return plainDateToISO(pd);
|
|
496
567
|
}
|
|
497
|
-
return plainDateFormat(pd,
|
|
568
|
+
return plainDateFormat(pd, {
|
|
569
|
+
...SHARED_DATE_FORMAT_OPTIONS[format],
|
|
570
|
+
calendar
|
|
571
|
+
}, locale);
|
|
498
572
|
}
|
|
@@ -25,10 +25,18 @@ export declare const pressableProps: {
|
|
|
25
25
|
export declare const PRESS_GESTURE_MEMORY_MS = 3000;
|
|
26
26
|
/**
|
|
27
27
|
* The release fade's clock on `element`, read once, at the release, from the
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* token its stylesheet reads: the theme's `--duration-exit`. Without a
|
|
29
|
+
* readable value it is the token's default. Under Reduce Motion it is no
|
|
30
|
+
* longer than the Reduce Motion fade, as in the stylesheet.
|
|
30
31
|
*/
|
|
31
32
|
export declare function pressFadeMs(element: Element): number;
|
|
33
|
+
/**
|
|
34
|
+
* Ends the press the controller follows on `element`, and its paint, at once.
|
|
35
|
+
* A clickable container calls it when a press starts on an interactive
|
|
36
|
+
* element inside it: that press does not activate the container, so the
|
|
37
|
+
* container shows no press.
|
|
38
|
+
*/
|
|
39
|
+
export declare function cancelPress(element: Element): void;
|
|
32
40
|
/**
|
|
33
41
|
* Install the touch press controller on this document, once, however many
|
|
34
42
|
* times it is called: the listeners exist while at least one caller holds it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pressFeedback.d.ts","sourceRoot":"","sources":["../../src/utils/pressFeedback.ts"],"names":[],"mappings":"AAyDA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE;IAAC,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAA;CAE/D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AA0E5C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAcpD;AA6ND;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAOlD;AA4aD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,IAAI,CA0BjD"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file pressFeedback.ts
|
|
5
5
|
* @input The press state machine (pressGesture.ts), the menu-press and
|
|
6
|
-
* press-group markers and the document's pointer, keyboard, scroll and
|
|
6
|
+
* press-group markers, the scroll-view test (scrollView.ts) and the document's pointer, keyboard, scroll and
|
|
7
7
|
* visibility events
|
|
8
8
|
* @output PRESSABLE_ATTRIBUTE, PRESSED_ATTRIBUTE, pressableProps,
|
|
9
|
-
* pressFadeMs and
|
|
9
|
+
* pressFadeMs, installPressFeedback and cancelPress
|
|
10
10
|
* @position The DOM half of the touch press model. usePressFeedback installs
|
|
11
11
|
* it, and the CSS arms live in interactionOverlay.stylex.ts.
|
|
12
12
|
*
|
|
@@ -23,9 +23,13 @@
|
|
|
23
23
|
// Where the primary pointer is fine, the controller ignores the mouse and the
|
|
24
24
|
// keyboard, and CSS `:active` keeps their press. Under a coarse primary
|
|
25
25
|
// pointer the CSS drops `:active`, so the controller paints every press. A
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
26
|
+
// mouse, trackpad or Space press paints at once. The controller reads the
|
|
27
|
+
// same query as the stylesheet, so they agree.
|
|
28
|
+
//
|
|
29
|
+
// A finger waits only inside a scroller. Outside one, a surface highlights in
|
|
30
|
+
// the frame the finger lands, as a UIControl does. Inside one, it waits the
|
|
31
|
+
// content-touch delay, because the touch can become a scroll. Rows follow the
|
|
32
|
+
// same rule.
|
|
29
33
|
//
|
|
30
34
|
// A surface's hold does nothing, so it keeps the browser's long-press text
|
|
31
35
|
// selection (AST-094). Only an element whose hold does something suppresses
|
|
@@ -35,7 +39,10 @@
|
|
|
35
39
|
import { MENU_PRESS_MARKER } from "../hooks/menuPressMarker.js";
|
|
36
40
|
import { idlePressGesture, PRESS_FADE_MS, PRESS_FLASH_MS, PRESS_ONSET_MS, PRESS_SCROLL_BRAKE_MS, pressGestureStep } from "./pressGesture.js";
|
|
37
41
|
import { isCoarsePointer, watchCoarsePointer } from "./coarsePointer.js";
|
|
42
|
+
import { reducedMotionFadeConsts } from "../motion/reducedMotion.stylex.js";
|
|
43
|
+
import { parseMotionRoleValue } from "../motion/roles.js";
|
|
38
44
|
import { subscribeInput } from "./inputStream.js";
|
|
45
|
+
import { isInsideScrollView } from "./scrollView.js";
|
|
39
46
|
import { TOUCH_QUERY } from "./touchPresentation.js";
|
|
40
47
|
import { holdsPressThroughDrag } from "../privateAttributes/pressHoldsDrag.stylex.js";
|
|
41
48
|
import { isTrackedByGroup } from "../privateAttributes/pressGroupItem.stylex.js";
|
|
@@ -126,17 +133,15 @@ const TIMER_MS = {
|
|
|
126
133
|
|
|
127
134
|
/**
|
|
128
135
|
* The release fade's clock on `element`, read once, at the release, from the
|
|
129
|
-
*
|
|
130
|
-
*
|
|
136
|
+
* token its stylesheet reads: the theme's `--duration-exit`. Without a
|
|
137
|
+
* readable value it is the token's default. Under Reduce Motion it is no
|
|
138
|
+
* longer than the Reduce Motion fade, as in the stylesheet.
|
|
131
139
|
*/
|
|
132
140
|
export function pressFadeMs(element) {
|
|
133
|
-
const
|
|
134
|
-
const value = style.getPropertyValue('--_astryx-motion-tempo').trim();
|
|
135
|
-
const read = value === '' ? Number.NaN : Number(value);
|
|
136
|
-
const tempo = Number.isFinite(read) && read > 0 ? read : 1;
|
|
137
|
-
const scaled = PRESS_FADE_MS * tempo;
|
|
141
|
+
const exit = parseMotionRoleValue('duration', getComputedStyle(element).getPropertyValue('--duration-exit')) ?? PRESS_FADE_MS;
|
|
138
142
|
const reduced = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
139
|
-
|
|
143
|
+
const bound = parseMotionRoleValue('duration', reducedMotionFadeConsts.duration);
|
|
144
|
+
return reduced && bound != null ? Math.min(exit, bound) : exit;
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
/**
|
|
@@ -208,7 +213,11 @@ function paintElement(element, paint) {
|
|
|
208
213
|
element.removeAttribute(PRESSED_ATTRIBUTE);
|
|
209
214
|
return;
|
|
210
215
|
}
|
|
211
|
-
|
|
216
|
+
// A step that keeps the paint writes nothing, so the element sees one
|
|
217
|
+
// change per paint.
|
|
218
|
+
if (element.getAttribute(PRESSED_ATTRIBUTE) !== paint) {
|
|
219
|
+
element.setAttribute(PRESSED_ATTRIBUTE, paint);
|
|
220
|
+
}
|
|
212
221
|
}
|
|
213
222
|
function clearTimer(slot) {
|
|
214
223
|
if (slot.live?.timer != null) {
|
|
@@ -334,6 +343,21 @@ function finish(slot) {
|
|
|
334
343
|
}
|
|
335
344
|
}
|
|
336
345
|
|
|
346
|
+
/**
|
|
347
|
+
* Ends the press the controller follows on `element`, and its paint, at once.
|
|
348
|
+
* A clickable container calls it when a press starts on an interactive
|
|
349
|
+
* element inside it: that press does not activate the container, so the
|
|
350
|
+
* container shows no press.
|
|
351
|
+
*/
|
|
352
|
+
export function cancelPress(element) {
|
|
353
|
+
if (finger.live?.element === element) {
|
|
354
|
+
finish(finger);
|
|
355
|
+
}
|
|
356
|
+
if (button.live?.element === element) {
|
|
357
|
+
finish(button);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
337
361
|
/** A new press on an element owns its paint: the other slot's gesture there ends. */
|
|
338
362
|
function takeOver(other, element) {
|
|
339
363
|
if (other.live?.element === element) {
|
|
@@ -466,7 +490,8 @@ function onPointerDown(event) {
|
|
|
466
490
|
apply(finger, pressGestureStep(finger.live.gesture, {
|
|
467
491
|
kind: 'down',
|
|
468
492
|
x: event.clientX,
|
|
469
|
-
y: event.clientY
|
|
493
|
+
y: event.clientY,
|
|
494
|
+
delayed: isInsideScrollView(element)
|
|
470
495
|
}));
|
|
471
496
|
}
|
|
472
497
|
function onPointerMove(event) {
|
|
@@ -28,12 +28,12 @@ export declare const PRESS_SLOP_PX = 10;
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const PRESS_FLASH_MS = 100;
|
|
30
30
|
/**
|
|
31
|
-
* How long the paint takes to leave after a release
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* runs out, the controller waits for a release
|
|
36
|
-
* then removes the attribute.
|
|
31
|
+
* How long the paint takes to leave after a release when no theme sets
|
|
32
|
+
* `--duration-exit`: that token's default. The release plays the theme's
|
|
33
|
+
* exit motion tokens, so the controller reads the token on
|
|
34
|
+
* the pressed element (`pressFadeMs` in pressFeedback.ts) and falls back to
|
|
35
|
+
* this. When the clock runs out, the controller waits for a release
|
|
36
|
+
* animation that still runs, then removes the attribute.
|
|
37
37
|
*/
|
|
38
38
|
export declare const PRESS_FADE_MS: number;
|
|
39
39
|
/**
|
|
@@ -71,6 +71,12 @@ export type PressEvent = {
|
|
|
71
71
|
kind: 'down';
|
|
72
72
|
x: number;
|
|
73
73
|
y: number;
|
|
74
|
+
/**
|
|
75
|
+
* Whether this touch waits {@link PRESS_ONSET_MS} before it paints:
|
|
76
|
+
* a surface inside a scroller. Defaults to
|
|
77
|
+
* `true`.
|
|
78
|
+
*/
|
|
79
|
+
delayed?: boolean;
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* A mouse button or the Space key went down on the surface. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pressGesture.d.ts","sourceRoot":"","sources":["../../src/utils/pressGesture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pressGesture.d.ts","sourceRoot":"","sources":["../../src/utils/pressGesture.ts"],"names":[],"mappings":"A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