@astryxdesign/core 0.7.5 → 0.7.6-canary.bb18c81
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 +1 -1
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +5 -5
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +12 -3
- package/dist/BottomSheet/BottomSheet.js +1 -1
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +2 -1
- package/dist/BottomSheet/useSheetGestures.d.ts +12 -0
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +30 -3
- package/dist/Button/Button.js +4 -4
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +6 -5
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +4 -1
- package/dist/DateInput/MonthScroller.d.ts.map +1 -1
- package/dist/DateInput/MonthScroller.js +101 -15
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +1 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +4 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +34 -9
- package/dist/Dialog/DialogHeader.d.ts.map +1 -1
- package/dist/Dialog/DialogHeader.js +5 -4
- package/dist/Divider/Divider.d.ts.map +1 -1
- package/dist/Divider/Divider.js +2 -1
- package/dist/Drawer/Drawer.d.ts.map +1 -1
- package/dist/Drawer/Drawer.js +5 -0
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +4 -1
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -1
- package/dist/DropdownMenu/MenuBottomSheetActionList.js +6 -5
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts +10 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.d.ts.map +1 -1
- package/dist/DropdownMenu/lazyMenuBottomSheet.js +16 -2
- package/dist/DropdownMenu/renderDropdownItems.d.ts.map +1 -1
- package/dist/DropdownMenu/renderDropdownItems.js +21 -16
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +2 -1
- package/dist/Field/FieldLabel.d.ts +1 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +4 -4
- package/dist/Field/InputClearButton.js +3 -3
- package/dist/Field/PanelSearchInput.js +2 -2
- package/dist/FieldStatus/FieldStatus.js +2 -2
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +7 -1
- package/dist/Heading/Heading.js +1 -1
- package/dist/Icon/Icon.js +1 -1
- package/dist/Indicator/CheckIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckIndicator.js +2 -1
- package/dist/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +3 -1
- package/dist/Indicator/RadioIndicator.d.ts.map +1 -1
- package/dist/Indicator/RadioIndicator.js +3 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +2 -1
- package/dist/Item/ItemSwipeLayer.js +1 -1
- package/dist/Layout/Layout.js +1 -1
- package/dist/Layout/LayoutContent.js +1 -1
- package/dist/Layout/LayoutFooter.js +1 -1
- package/dist/Layout/LayoutHeader.js +1 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +5 -0
- package/dist/Lightbox/LightboxViewport.a11y.browser.spec.js +5 -4
- package/dist/List/List.js +1 -1
- package/dist/List/ListItem.js +3 -3
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +7 -2
- package/dist/MultiSelector/MultiSelector.d.ts +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +5 -2
- package/dist/NumberInput/NumberInput.d.ts +3 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +3 -3
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +16 -12
- package/dist/Resizable/useResizable.d.ts.map +1 -1
- package/dist/Resizable/useResizable.js +28 -2
- package/dist/SegmentedControl/SegmentedControlItem.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlItem.js +4 -1
- package/dist/Selector/useSelectorPresentation.d.ts +8 -1
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +20 -4
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +7 -1
- package/dist/Spinner/Spinner.js +2 -2
- package/dist/Stack/Stack.js +1 -1
- package/dist/Stack/StackItem.js +1 -1
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +16 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +9 -1
- package/dist/Text/Text.js +1 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +23 -5
- package/dist/TextArea/TextArea.d.ts +1 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +13 -2
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +3 -3
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +2 -2
- package/dist/Timestamp/TimestampHoverCard.js +4 -4
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +82 -51
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +13 -2
- package/dist/Tokenizer/TokenizerBottomSheet.js +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +2 -1
- package/dist/Typeahead/Typeahead.d.ts +1 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +9 -1
- package/dist/astryx.css +14 -1
- package/dist/gestures/PinchGestureRecognizer.d.ts +30 -0
- package/dist/gestures/PinchGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/PinchGestureRecognizer.js +125 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts +70 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/ScreenEdgePanGestureRecognizer.js +220 -0
- package/dist/gestures/SwipeGestureRecognizer.d.ts +36 -0
- package/dist/gestures/SwipeGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/SwipeGestureRecognizer.js +145 -0
- package/dist/gestures/VelocityTracker.d.ts +6 -2
- package/dist/gestures/VelocityTracker.d.ts.map +1 -1
- package/dist/gestures/VelocityTracker.js +7 -3
- package/dist/gestures/types.d.ts +11 -7
- package/dist/gestures/types.d.ts.map +1 -1
- package/dist/gestures/types.js +22 -2
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -1
- package/dist/hooks/useAdaptivePresentation.js +4 -1
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +12 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +3 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +3 -0
- package/dist/motion/animator.d.ts +7 -1
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +119 -27
- package/dist/theme/defineTheme.js +1 -1
- package/dist/theme/domainTokens/domainTokenDefaults.d.ts +3 -0
- package/dist/theme/domainTokens/domainTokenDefaults.d.ts.map +1 -0
- package/dist/theme/domainTokens/domainTokenDefaults.js +19 -0
- package/dist/theme/domainTokens/index.d.ts +5 -4
- package/dist/theme/domainTokens/index.d.ts.map +1 -1
- package/dist/theme/domainTokens/index.js +5 -9
- package/dist/utils/focusReturn.d.ts +17 -1
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +11 -4
- package/dist/utils/getNodeText.d.ts +8 -0
- package/dist/utils/getNodeText.d.ts.map +1 -0
- package/dist/utils/getNodeText.js +37 -0
- package/dist/utils/interactionModality.d.ts +11 -2
- package/dist/utils/interactionModality.d.ts.map +1 -1
- package/dist/utils/interactionModality.js +58 -5
- package/dist/utils/presentation.d.ts +50 -0
- package/dist/utils/presentation.d.ts.map +1 -0
- package/dist/utils/presentation.js +125 -0
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +5 -3
- package/dist/utils/touchPresentation.stylex.d.ts +15 -0
- package/dist/utils/touchPresentation.stylex.d.ts.map +1 -0
- package/dist/utils/touchPresentation.stylex.js +33 -0
- package/locales/en.json +13 -1
- package/locales/pseudo.json +9 -0
- package/package.json +5 -4
- package/src/AlertDialog/AlertDialog.tsx +6 -5
- package/src/AlertDialog/__tests__/AlertDialog.a11y.chromium.spec.ts +18 -6
- package/src/Avatar/Avatar.spec.md +22 -22
- package/src/Avatar/Avatar.tsx +18 -1
- package/src/Avatar/__tests__/AvatarForcedColors.a11y.chromium.spec.ts +126 -0
- package/src/BottomSheet/BottomSheet.test.tsx +46 -0
- package/src/BottomSheet/BottomSheet.tsx +1 -1
- package/src/BottomSheet/BottomSheetPanel.tsx +2 -1
- package/src/BottomSheet/useSheetGestures.test.ts +52 -0
- package/src/BottomSheet/useSheetGestures.ts +37 -6
- package/src/Breadcrumbs/__tests__/Breadcrumbs.a11y.chromium.spec.ts +18 -6
- package/src/Button/Button.tsx +4 -4
- package/src/Calendar/Calendar.spec.md +87 -48
- package/src/Calendar/__tests__/Calendar.a11y.chromium.spec.ts +21 -7
- package/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts +21 -7
- package/src/CheckboxInput/CheckboxInput.tsx +6 -5
- package/src/Collapsible/Collapsible.spec.md +2 -0
- package/src/Collapsible/CollapsibleGroup.spec.md +57 -29
- package/src/Collapsible/__tests__/Collapsible.a11y.chromium.spec.ts +18 -7
- package/src/Collapsible/__tests__/CollapsibleGroupAccordion.a11y.chromium.spec.ts +18 -6
- package/src/ContextMenu/ContextMenu.test.tsx +35 -0
- package/src/DateInput/DateInput.test.tsx +53 -2
- package/src/DateInput/DateInput.tsx +15 -11
- package/src/DateInput/MonthScroller.tsx +106 -20
- package/src/DateInput/MonthScrollerSettle.test.tsx +165 -0
- package/src/DateInput/__tests__/MonthScrollerSteps.interaction.browser.spec.ts +312 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +46 -3
- package/src/DateRangeInput/DateRangeInput.tsx +16 -12
- package/src/DateTimeInput/DateTimeInput.spec.md +71 -48
- package/src/DateTimeInput/DateTimeInput.test.tsx +61 -0
- package/src/DateTimeInput/DateTimeInput.tsx +15 -11
- package/src/Dialog/Dialog.test.tsx +216 -2
- package/src/Dialog/Dialog.tsx +42 -9
- package/src/Dialog/DialogHeader.tsx +5 -4
- package/src/Dialog/__tests__/DialogSecondDocument.a11y.browser.spec.ts +202 -0
- package/src/Divider/Divider.tsx +2 -1
- package/src/Drawer/Drawer.spec.md +111 -80
- package/src/Drawer/Drawer.test.tsx +22 -0
- package/src/Drawer/Drawer.tsx +5 -0
- package/src/Drawer/DrawerHeader.spec.md +181 -0
- package/src/DropdownMenu/DropdownMenu.test.tsx +41 -0
- package/src/DropdownMenu/DropdownMenu.tsx +7 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +34 -0
- package/src/DropdownMenu/MenuBottomSheetActionList.tsx +6 -5
- package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +19 -7
- package/src/DropdownMenu/__tests__/MenuButton.a11y.chromium.spec.ts +21 -9
- package/src/DropdownMenu/lazyMenuBottomSheet.test.ts +53 -0
- package/src/DropdownMenu/lazyMenuBottomSheet.ts +23 -6
- package/src/DropdownMenu/renderDropdownItems.tsx +24 -19
- package/src/EmptyState/EmptyState.tsx +2 -1
- package/src/Field/FieldLabel.tsx +5 -4
- package/src/Field/InputClearButton.tsx +3 -3
- package/src/Field/PanelSearchInput.tsx +2 -2
- package/src/FieldStatus/FieldStatus.tsx +2 -2
- package/src/FileInput/FileInput.test.tsx +21 -0
- package/src/FileInput/FileInput.tsx +4 -1
- package/src/FormLayout/FormLayout.spec.md +7 -8
- package/src/Heading/Heading.tsx +1 -1
- package/src/Icon/Icon.tsx +1 -1
- package/src/Indicator/CheckIndicator.spec.md +47 -42
- package/src/Indicator/CheckIndicator.tsx +2 -1
- package/src/Indicator/CheckboxIndicator.spec.md +40 -37
- package/src/Indicator/CheckboxIndicator.tsx +3 -1
- package/src/Indicator/Indicator.spec.md +188 -0
- package/src/Indicator/RadioIndicator.tsx +3 -1
- package/src/Item/Item.tsx +2 -1
- package/src/Item/ItemSwipeLayer.tsx +1 -1
- package/src/Layout/Layout.spec.md +127 -131
- package/src/Layout/Layout.tsx +1 -1
- package/src/Layout/LayoutContent.spec.md +205 -0
- package/src/Layout/LayoutContent.tsx +1 -1
- package/src/Layout/LayoutFooter.spec.md +190 -0
- package/src/Layout/LayoutFooter.tsx +1 -1
- package/src/Layout/LayoutHeader.spec.md +193 -0
- package/src/Layout/LayoutHeader.tsx +1 -1
- package/src/Layout/LayoutPanel.spec.md +194 -0
- package/src/Layout/__tests__/Layout.a11y.chromium.spec.ts +18 -6
- package/src/Lightbox/Lightbox.test.tsx +18 -0
- package/src/Lightbox/Lightbox.tsx +5 -0
- package/src/Lightbox/LightboxViewport.a11y.browser.spec.ts +8 -4
- package/src/Link/__tests__/Link.a11y.chromium.spec.ts +18 -8
- package/src/List/List.tsx +1 -1
- package/src/List/ListItem.tsx +3 -3
- package/src/MobileNav/MobileNav.test.tsx +15 -0
- package/src/MobileNav/MobileNav.tsx +9 -1
- package/src/MobileNav/__tests__/MobileNavHeader.a11y.chromium.spec.ts +89 -0
- package/src/MoreMenu/MoreMenu.test.tsx +11 -0
- package/src/MultiSelector/MultiSelector.spec.md +7 -4
- package/src/MultiSelector/MultiSelector.test.tsx +118 -1
- package/src/MultiSelector/MultiSelector.tsx +6 -2
- package/src/MultiSelector/__tests__/MultiSelector.listbox.a11y.test.tsx +8 -1
- package/src/NavMenu/NavHeadingMenu.spec.md +1 -5
- package/src/NumberInput/NumberInput.doc.mjs +13 -7
- package/src/NumberInput/NumberInput.spec.md +59 -37
- package/src/NumberInput/NumberInput.tsx +13 -3
- package/src/NumberInput/__tests__/NumberInput.coarse-pointer.a11y.chromium.spec.ts +102 -0
- package/src/ProgressBar/ProgressBar.test.tsx +108 -32
- package/src/ProgressBar/ProgressBar.tsx +58 -10
- package/src/ProgressBar/__tests__/ProgressBar.a11y.chromium.spec.ts +21 -9
- package/src/ProgressBar/__tests__/ProgressBarMotion.a11y.chromium.spec.ts +831 -0
- package/src/Resizable/__tests__/ResizeHandle.a11y.chromium.spec.ts +21 -14
- package/src/Resizable/useResizable.test.ts +43 -0
- package/src/Resizable/useResizable.ts +32 -9
- package/src/SegmentedControl/SegmentedControl.test.tsx +84 -0
- package/src/SegmentedControl/SegmentedControlItem.tsx +11 -5
- package/src/Selector/Selector.test.tsx +90 -1
- package/src/Selector/__tests__/Selector.combobox.a11y.test.tsx +8 -1
- package/src/Selector/__tests__/Selector.listbox.a11y.test.tsx +8 -1
- package/src/Selector/useSelectorPresentation.ts +31 -3
- package/src/SideNav/SideNav.test.tsx +27 -0
- package/src/Slider/Slider.test.tsx +12 -0
- package/src/Slider/Slider.tsx +4 -1
- package/src/Slider/__tests__/Slider.a11y.chromium.spec.ts +19 -7
- package/src/Spinner/Spinner.tsx +2 -2
- package/src/Stack/Stack.tsx +1 -1
- package/src/Stack/StackItem.tsx +1 -1
- package/src/TabList/TabList.test.tsx +52 -1
- package/src/TabList/TabList.tsx +16 -1
- package/src/TabList/__tests__/TabPressPointer.interaction.browser.spec.ts +163 -0
- package/src/Table/__tests__/Table.a11y.chromium.spec.ts +18 -6
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +22 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +8 -4
- package/src/Text/Text.tsx +1 -1
- package/src/Text/useTruncation.test.tsx +128 -1
- package/src/Text/useTruncation.ts +23 -5
- package/src/TextArea/TextArea.spec.md +10 -13
- package/src/TextArea/TextArea.test.tsx +60 -0
- package/src/TextArea/TextArea.tsx +15 -1
- package/src/TextInput/TextInput.test.tsx +21 -0
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/Timestamp/Timestamp.spec.md +6 -12
- package/src/Timestamp/Timestamp.test.tsx +30 -5
- package/src/Timestamp/Timestamp.tsx +6 -2
- package/src/Timestamp/TimestampHoverCard.tsx +4 -4
- package/src/Toast/Toast.spec.md +7 -10
- package/src/Toast/ToastViewport.test.tsx +575 -1
- package/src/Toast/ToastViewport.tsx +100 -50
- package/src/Tokenizer/Tokenizer.spec.md +5 -3
- package/src/Tokenizer/Tokenizer.test.tsx +68 -0
- package/src/Tokenizer/Tokenizer.tsx +14 -2
- package/src/Tokenizer/TokenizerBottomSheet.test.tsx +15 -4
- package/src/Tokenizer/TokenizerBottomSheet.tsx +3 -3
- package/src/Toolbar/Toolbar.spec.md +5 -6
- package/src/Toolbar/Toolbar.test.tsx +30 -0
- package/src/Toolbar/Toolbar.tsx +2 -1
- package/src/Toolbar/__tests__/Toolbar.a11y.chromium.spec.ts +18 -6
- package/src/Tooltip/__tests__/Tooltip.a11y.chromium.spec.ts +18 -7
- package/src/TopNav/TopNav.test.tsx +27 -0
- package/src/Typeahead/Typeahead.test.tsx +40 -0
- package/src/Typeahead/Typeahead.tsx +12 -1
- package/src/gestures/PinchGestureRecognizer.ts +144 -0
- package/src/gestures/ScreenEdgePanGestureRecognizer.ts +252 -0
- package/src/gestures/SwipeGestureRecognizer.ts +193 -0
- package/src/gestures/VelocityTracker.ts +10 -3
- package/src/gestures/__tests__/PanGestureRecognizer.test.ts +4 -4
- package/src/gestures/__tests__/PinchGestureRecognizer.test.ts +74 -0
- package/src/gestures/__tests__/ScreenEdgePanGestureRecognizer.test.ts +498 -0
- package/src/gestures/__tests__/SwipeGestureRecognizer.test.ts +108 -0
- package/src/gestures/__tests__/arenaPinchSwipeEdge.test.ts +188 -0
- package/src/gestures/__tests__/harness.ts +21 -2
- package/src/gestures/types.ts +23 -9
- package/src/hooks/useAdaptivePresentation.ts +4 -1
- package/src/hooks/useMenuHover.ts +15 -1
- package/src/i18n/generated-locales/en.generated.ts +4 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +4 -0
- package/src/motion/README.md +11 -1
- package/src/motion/animator.test.ts +151 -3
- package/src/motion/animator.ts +149 -33
- package/src/theme/defineTheme.ts +1 -1
- package/src/theme/derivedVarRegistry.test.ts +4 -0
- package/src/theme/domainTokens/domainTokenDefaults.ts +19 -0
- package/src/theme/domainTokens/index.ts +6 -10
- package/src/utils/focusReturn.ts +17 -6
- package/src/utils/getNodeText.test.ts +24 -0
- package/src/utils/getNodeText.ts +37 -0
- package/src/utils/interactionModality.test.ts +45 -1
- package/src/utils/interactionModality.ts +64 -5
- package/src/utils/presentation.test.ts +380 -0
- package/src/utils/presentation.ts +180 -0
- package/src/utils/pressPaintPriority.test.ts +80 -0
- package/src/utils/touchPresentation.stylex.ts +43 -0
- package/src/utils/touchPresentation.test.ts +140 -1
- package/src/utils/touchPresentation.ts +5 -3
package/dist/Toolbar/Toolbar.js
CHANGED
|
@@ -187,7 +187,8 @@ export function Toolbar({
|
|
|
187
187
|
handleKeyDown,
|
|
188
188
|
handleFocus
|
|
189
189
|
} = useListFocus({
|
|
190
|
-
|
|
190
|
+
// `a[href]` catches a Button rendered with `href`.
|
|
191
|
+
itemSelector: 'button, input, a[href], [tabindex]',
|
|
191
192
|
boundarySelector: '[role="toolbar"], [popover]',
|
|
192
193
|
orientation,
|
|
193
194
|
hasRovingTabIndex: true,
|
|
@@ -142,7 +142,7 @@ export interface TypeaheadProps<T extends SearchableItem> extends Omit<FieldInpu
|
|
|
142
142
|
/** Callback when dropdown opens/closes. */
|
|
143
143
|
onOpenChange?: (isOpen: boolean) => void;
|
|
144
144
|
}
|
|
145
|
-
export declare function Typeahead<T extends SearchableItem>({ ref, label, isLabelHidden, description, isRequired, isOptional, status, statusVariant, startIcon, labelTooltip, searchSource, value, onChange, renderItem, placeholder, hasEntriesOnFocus, maxMenuItems, minQueryLength, emptySearchText, isDisabled: isDisabledProp, disabledMessage, hasClear, hasAutoFocus, size: sizeProp, debounceMs, onChangeQuery, onOpenChange, onKeyDown, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, id: idProp, 'aria-describedby': ariaDescribedByProp, ...restProps }: TypeaheadProps<T>): React.JSX.Element;
|
|
145
|
+
export declare function Typeahead<T extends SearchableItem>({ ref, label, isLabelHidden, description, isRequired, isOptional, status, statusVariant, startIcon, labelTooltip, searchSource, value, onChange, renderItem, placeholder, hasEntriesOnFocus, maxMenuItems, minQueryLength, emptySearchText, isDisabled: isDisabledProp, disabledMessage, hasClear, hasAutoFocus, size: sizeProp, debounceMs, onChangeQuery, onOpenChange, onKeyDown, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, id: idProp, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...restProps }: TypeaheadProps<T>): React.JSX.Element;
|
|
146
146
|
export declare namespace Typeahead {
|
|
147
147
|
var displayName: string;
|
|
148
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/Typeahead/Typeahead.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAWf,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/Typeahead/Typeahead.tsx"],"names":[],"mappings":"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"}
|
|
@@ -35,6 +35,7 @@ import { groupStyles, inputGroupItemProps } from "../InputGroup/groupStyles.js";
|
|
|
35
35
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
36
36
|
import { InputGroupInternalContext } from "../InputGroup/InputGroupInternalContext.js";
|
|
37
37
|
import { getInputARIA, isImeKeyEvent, mergeProps } from "../utils/index.js";
|
|
38
|
+
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
38
39
|
import { TrailingKeyDownContext } from "./trailingKeyDown.js";
|
|
39
40
|
import { useFieldInputStyling } from "../Field/fieldParts.js";
|
|
40
41
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -186,6 +187,7 @@ export function Typeahead({
|
|
|
186
187
|
controlStyle,
|
|
187
188
|
id: idProp,
|
|
188
189
|
'aria-describedby': ariaDescribedByProp,
|
|
190
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
189
191
|
...restProps
|
|
190
192
|
}) {
|
|
191
193
|
const {
|
|
@@ -201,6 +203,7 @@ export function Typeahead({
|
|
|
201
203
|
const generatedInputId = useId();
|
|
202
204
|
const inputId = idProp ?? generatedInputId;
|
|
203
205
|
const inputLabelId = useId();
|
|
206
|
+
const fieldLabelId = useId();
|
|
204
207
|
const descriptionId = useId();
|
|
205
208
|
const statusMessageId = useId();
|
|
206
209
|
const inputGroup = useInputGroup();
|
|
@@ -362,6 +365,10 @@ export function Typeahead({
|
|
|
362
365
|
ariaLabelledBy,
|
|
363
366
|
ariaDescribedBy
|
|
364
367
|
} = getInputARIA(inputLabelId, [description ? descriptionId : null, status?.message ? statusMessageId : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null], inputGroup);
|
|
368
|
+
|
|
369
|
+
// A caller aria-labelledby names the input together with the field's own
|
|
370
|
+
// label (the Field label standalone, the group and input labels in a group).
|
|
371
|
+
const inputLabelledBy = ariaLabelledByProp != null ? joinAriaIDs(ariaLabelledBy ?? fieldLabelId, ariaLabelledByProp) : ariaLabelledBy;
|
|
365
372
|
const sizeStyle = wrapperSizeStyles[size];
|
|
366
373
|
const typeaheadContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
367
374
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
@@ -420,7 +427,7 @@ export function Typeahead({
|
|
|
420
427
|
isFocusableDisabled: showsDisabledMessage,
|
|
421
428
|
inputId: inputId,
|
|
422
429
|
ariaDescribedBy: [ariaDescribedByProp, ariaDescribedBy].filter(Boolean).join(' ') || undefined,
|
|
423
|
-
ariaLabelledBy:
|
|
430
|
+
ariaLabelledBy: inputLabelledBy,
|
|
424
431
|
onChangeQuery: onChangeQuery,
|
|
425
432
|
onOpenChange: onOpenChange,
|
|
426
433
|
debounceMs: debounceMs,
|
|
@@ -461,6 +468,7 @@ export function Typeahead({
|
|
|
461
468
|
isLabelHidden: isLabelHidden,
|
|
462
469
|
description: description,
|
|
463
470
|
inputID: inputId,
|
|
471
|
+
labelID: ariaLabelledByProp != null ? fieldLabelId : undefined,
|
|
464
472
|
descriptionID: description ? descriptionId : undefined,
|
|
465
473
|
isOptional: isOptional,
|
|
466
474
|
isRequired: isRequired,
|
package/dist/astryx.css
CHANGED
|
@@ -1386,6 +1386,7 @@
|
|
|
1386
1386
|
.xv5t66b:not(#\#):not(#\#):not(#\#){transform:translateX(12px)}
|
|
1387
1387
|
.x15481yp:not(#\#):not(#\#):not(#\#){transform:translateX(14px)}
|
|
1388
1388
|
.xitnhlw:not(#\#):not(#\#):not(#\#){transform:translateX(50%)}
|
|
1389
|
+
.x8mk83g:not(#\#):not(#\#):not(#\#){transform:translateX(calc(var(--_progress-bar-fill,0%) - 100%))}
|
|
1389
1390
|
.x105ttfm:not(#\#):not(#\#):not(#\#){transform:translateY(-100%)}
|
|
1390
1391
|
.x19xzu86:not(#\#):not(#\#):not(#\#){transform:translateY(-3px) scale(.985)}
|
|
1391
1392
|
.x1bvilyr:not(#\#):not(#\#):not(#\#){transform:translateY(-4px)}
|
|
@@ -1465,7 +1466,6 @@
|
|
|
1465
1466
|
.x13zkoj4:not(#\#):not(#\#):not(#\#){transition-property:transform,width}
|
|
1466
1467
|
.x11xpdln:not(#\#):not(#\#):not(#\#){transition-property:transform}
|
|
1467
1468
|
.x74b7sa:not(#\#):not(#\#):not(#\#){transition-property:visibility}
|
|
1468
|
-
.xxrbq2n:not(#\#):not(#\#):not(#\#){transition-property:width}
|
|
1469
1469
|
.xn34ekc:not(#\#):not(#\#):not(#\#){transition-timing-function:ease-out,ease-out}
|
|
1470
1470
|
.x9lcvmn:not(#\#):not(#\#):not(#\#){transition-timing-function:ease-out}
|
|
1471
1471
|
.xcj1dhv:not(#\#):not(#\#):not(#\#){transition-timing-function:linear}
|
|
@@ -1486,6 +1486,7 @@
|
|
|
1486
1486
|
.x126k92a:not(#\#):not(#\#):not(#\#){white-space:pre-wrap}
|
|
1487
1487
|
.x1sdyfia:not(#\#):not(#\#):not(#\#){white-space:pre}
|
|
1488
1488
|
.x1q1rmc8:not(#\#):not(#\#):not(#\#){will-change:transform,opacity}
|
|
1489
|
+
.x1so62im:not(#\#):not(#\#):not(#\#){will-change:transform}
|
|
1489
1490
|
.x1yn0g08:not(#\#):not(#\#):not(#\#){word-break:break-all}
|
|
1490
1491
|
.x13faqbe:not(#\#):not(#\#):not(#\#){word-break:break-word}
|
|
1491
1492
|
.x1lldw8n:not(#\#):not(#\#):not(#\#){word-break:normal}
|
|
@@ -1599,6 +1600,7 @@
|
|
|
1599
1600
|
.x3x83r7:has(:focus-visible):not(#\#):not(#\#):not(#\#){z-index:2}
|
|
1600
1601
|
.xbw113y:dir(rtl):not(#\#):not(#\#):not(#\#){transform:translateX(-100%)}
|
|
1601
1602
|
.x1eqdj8u:dir(rtl):not(#\#):not(#\#):not(#\#){transform:translateX(100%)}
|
|
1603
|
+
.x13s8k5t:dir(rtl):not(#\#):not(#\#):not(#\#){transform:translateX(calc(100% - var(--_progress-bar-fill,0%)))}
|
|
1602
1604
|
.x1xrp5p4:first-child:not(#\#):not(#\#):not(#\#){border-end-start-radius:var(--radius-element)}
|
|
1603
1605
|
.xyf0ibl:first-child:not(#\#):not(#\#):not(#\#){border-inline-start-style:none}
|
|
1604
1606
|
.x1pjv70x:first-child:not(#\#):not(#\#):not(#\#){border-inline-start-width:0}
|
|
@@ -1647,11 +1649,13 @@
|
|
|
1647
1649
|
@media (forced-colors: active){.x1sir5s4.x1sir5s4:not(#\#):not(#\#):not(#\#){background-color:HighlightText}}
|
|
1648
1650
|
@media (hover: hover){.x150ydqw.x150ydqw:not(#\#):not(#\#):not(#\#){background-color:transparent}}
|
|
1649
1651
|
@media (forced-colors: active){.xs5hli.xs5hli:not(#\#):not(#\#):not(#\#){color:CanvasText}}
|
|
1652
|
+
@media (forced-colors: active){.x1xt8qih.x1xt8qih:not(#\#):not(#\#):not(#\#){color:currentColor}}
|
|
1650
1653
|
@media (forced-colors: active){.x1bhcspo.x1bhcspo:not(#\#):not(#\#):not(#\#){color:GrayText}}
|
|
1651
1654
|
@media (forced-colors: active){.x1k5gbb1.x1k5gbb1:not(#\#):not(#\#):not(#\#){color:HighlightText}}
|
|
1652
1655
|
@media (hover: hover){.x2dt3px.x2dt3px:not(#\#):not(#\#):not(#\#){cursor:zoom-in}}
|
|
1653
1656
|
@media (hover: hover){.xqwu39o.xqwu39o:not(#\#):not(#\#):not(#\#){display:flex}}
|
|
1654
1657
|
@media (max-width: 480px){.xedohl4.xedohl4:not(#\#):not(#\#):not(#\#){display:flex}}
|
|
1658
|
+
@media (pointer: coarse){.xhj50sb.xhj50sb:not(#\#):not(#\#):not(#\#){display:none}}
|
|
1655
1659
|
@media (max-width: 480px){.x1rpgqan.x1rpgqan:not(#\#):not(#\#):not(#\#){flex-direction:column}}
|
|
1656
1660
|
@media (pointer: coarse){.x1jymrmb.x1jymrmb:not(#\#):not(#\#):not(#\#){margin-inline-start:auto}}
|
|
1657
1661
|
@media (prefers-reduced-motion: reduce) and (pointer: coarse){.x1m67veq.x1m67veq:not(#\#):not(#\#):not(#\#){opacity:0}}
|
|
@@ -1663,10 +1667,12 @@
|
|
|
1663
1667
|
@media (forced-colors: active){.x815t2r.x815t2r:not(#\#):not(#\#):not(#\#){outline-style:solid}}
|
|
1664
1668
|
@media (forced-colors: active){.xcthrzx.xcthrzx:not(#\#):not(#\#):not(#\#){outline-width:1px}}
|
|
1665
1669
|
@media (forced-colors: active){.x1xvue0r.x1xvue0r:not(#\#):not(#\#):not(#\#){outline-width:var(--border-width)}}
|
|
1670
|
+
@media (pointer: coarse){.x1r3kph8.x1r3kph8:not(#\#):not(#\#):not(#\#){padding-inline-end:var(--astryx-number-input-padding-inline-end,var(--astryx-number-input-padding-inline,var(--astryx-number-input-padding,var(--spacing-2))))}}
|
|
1666
1671
|
@media (pointer: coarse){.x1bjav06.x1bjav06:not(#\#):not(#\#):not(#\#){pointer-events:none}}
|
|
1667
1672
|
@media (prefers-reduced-motion: reduce){.xg83hb1.xg83hb1:not(#\#):not(#\#):not(#\#){scroll-behavior:auto}}
|
|
1668
1673
|
@media (forced-colors: active){.xrih18v.xrih18v:not(#\#):not(#\#):not(#\#){scrollbar-color:auto}}
|
|
1669
1674
|
@media (pointer: coarse) and (not (forced-colors: active)){.xk8rjfv.xk8rjfv:not(#\#):not(#\#):not(#\#){scrollbar-color:auto}}
|
|
1675
|
+
@media (forced-colors: active){.x10rjfdt.x10rjfdt:not(#\#):not(#\#):not(#\#){transform:none}}
|
|
1670
1676
|
@media (prefers-reduced-motion: reduce){.xuupxpy.xuupxpy:not(#\#):not(#\#):not(#\#){transform:none}}
|
|
1671
1677
|
@media (prefers-reduced-motion: reduce){.x1oe9tb1.x1oe9tb1:not(#\#):not(#\#):not(#\#){transform:translateY(0)}}
|
|
1672
1678
|
@media (prefers-reduced-motion: reduce){.x1k6wr6r.x1k6wr6r:not(#\#):not(#\#):not(#\#){transition-delay:0s,0s}}
|
|
@@ -1675,12 +1681,16 @@
|
|
|
1675
1681
|
@media (prefers-reduced-motion: reduce){.xzg1mie.xzg1mie:not(#\#):not(#\#):not(#\#){transition-duration:.01s}}
|
|
1676
1682
|
@media ((prefers-reduced-motion: reduce) and (pointer: coarse) and (not (prefers-reduced-motion: reduce))) or ((prefers-reduced-motion: reduce) and (pointer: coarse) and (not ((not (pointer: coarse))))){.xh0ie4q.xh0ie4q:not(#\#):not(#\#):not(#\#){transition-duration:.2s}}
|
|
1677
1683
|
@media (prefers-reduced-motion: reduce){.xsr0bmt.xsr0bmt:not(#\#):not(#\#):not(#\#){transition-duration:0s,0s}}
|
|
1684
|
+
@media ((prefers-reduced-motion: reduce) and (not (pointer: coarse)) and (not (prefers-reduced-motion: reduce))) or ((prefers-reduced-motion: reduce) and (not (pointer: coarse)) and (not (pointer: coarse))){.xo2sced.xo2sced:not(#\#):not(#\#):not(#\#){transition-duration:0s}}
|
|
1678
1685
|
@media (prefers-reduced-motion: reduce) and (not (pointer: coarse)){.xuh6ohu.xuh6ohu:not(#\#):not(#\#):not(#\#){transition-duration:0s}}
|
|
1686
|
+
@media (prefers-reduced-motion: reduce) and (pointer: coarse){.x1r9o9eb.x1r9o9eb:not(#\#):not(#\#):not(#\#){transition-duration:0s}}
|
|
1679
1687
|
@media (prefers-reduced-motion: reduce){.x12w9bfk.x12w9bfk:not(#\#):not(#\#):not(#\#){transition-duration:0s}}
|
|
1680
1688
|
@media (prefers-reduced-motion: reduce){.x4wkmsb.x4wkmsb:not(#\#):not(#\#):not(#\#){transition-property:none}}
|
|
1681
1689
|
@media (prefers-reduced-motion: reduce){.x3ya4ca.x3ya4ca:not(#\#):not(#\#):not(#\#){transition-property:opacity,overlay,display}}
|
|
1690
|
+
@media (forced-colors: active){.x18hto2h.x18hto2h:not(#\#):not(#\#):not(#\#){transition-property:width}}
|
|
1682
1691
|
@media (pointer: coarse){.x1s1rlkj.x1s1rlkj:not(#\#):not(#\#):not(#\#){transition-timing-function:cubic-bezier(.3,0,.6,.6)}}
|
|
1683
1692
|
@media (prefers-reduced-motion: reduce) and (pointer: coarse){.x19dgjhz.x19dgjhz:not(#\#):not(#\#):not(#\#){transition-timing-function:cubic-bezier(.42,0,.58,1)}}
|
|
1693
|
+
@media (forced-colors: active){.x1mfxj9n.x1mfxj9n:not(#\#):not(#\#):not(#\#){will-change:auto}}
|
|
1684
1694
|
.x1anq1lc.x1anq1lc:active:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){background-color:var(--color-overlay-pressed)}
|
|
1685
1695
|
.xzmimnh.xzmimnh:active:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){background-image:linear-gradient(var(--color-overlay-pressed),var(--color-overlay-pressed)),linear-gradient(var(--color-neutral),var(--color-neutral))}
|
|
1686
1696
|
.x7uyq82.x7uyq82:active:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){background-image:linear-gradient(var(--color-overlay-pressed),var(--color-overlay-pressed))}
|
|
@@ -1724,6 +1734,7 @@
|
|
|
1724
1734
|
@media (hover: hover){.x7jm8ul.x7jm8ul.x7jm8ul:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){color:color-mix(in srgb,var(--color-text-secondary),var(--color-tint-hover) 15%)}}
|
|
1725
1735
|
@media (hover: hover){.xo5jvnm.xo5jvnm.xo5jvnm:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){color:var(--color-text-primary)}}
|
|
1726
1736
|
@media (pointer: coarse){.xom6oz5.xom6oz5.xom6oz5:active:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){transform:scale(1)}}
|
|
1737
|
+
@media (forced-colors: active){.x1xwfpud.x1xwfpud:dir(rtl):not(#\#):not(#\#):not(#\#){transform:none}}
|
|
1727
1738
|
@container (max-width: 399px){.x1alyx8p.x1alyx8p:not(#\#):not(#\#):not(#\#){flex-wrap:wrap}}
|
|
1728
1739
|
@media (forced-colors: active){.x1vo6n7o.x1vo6n7o:active:not(#\#):not(#\#):not(#\#){background-color:Highlight}}
|
|
1729
1740
|
@media (hover: hover){.x1otsd3y.x1otsd3y.x1otsd3y:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#):not(#\#){background-image:linear-gradient(var(--color-overlay-hover),var(--color-overlay-hover)),linear-gradient(var(--color-neutral),var(--color-neutral))}}
|
|
@@ -1931,6 +1942,7 @@
|
|
|
1931
1942
|
.x1xf4nls:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--size-element-lg)}
|
|
1932
1943
|
.x1uogy3y:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--size-element-md)}
|
|
1933
1944
|
.x1gdqauq:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--size-element-sm)}
|
|
1945
|
+
.x3unnv6:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--spacing-12)}
|
|
1934
1946
|
.x175cymr:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--spacing-2)}
|
|
1935
1947
|
.ximsjs8:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--spacing-7)}
|
|
1936
1948
|
.xkoleio:not(#\#):not(#\#):not(#\#):not(#\#){min-height:var(--spacing-8)}
|
|
@@ -2145,6 +2157,7 @@
|
|
|
2145
2157
|
@media (pointer: coarse){.x1xrq5m.x1xrq5m:not(#\#):not(#\#):not(#\#):not(#\#){min-width:44px}}
|
|
2146
2158
|
@media (pointer: coarse){.xngvp7v.xngvp7v:not(#\#):not(#\#):not(#\#):not(#\#){min-width:44px}}
|
|
2147
2159
|
@media (any-pointer: coarse){.x1c4064q.x1c4064q:not(#\#):not(#\#):not(#\#):not(#\#){width:24px}}
|
|
2160
|
+
@media (forced-colors: active){.xtyencx.xtyencx:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--_progress-bar-fill,0%)}}
|
|
2148
2161
|
@media (max-width: 640px){.xci7e5a.xci7e5a:not(#\#):not(#\#):not(#\#):not(#\#){width:var(--x-fqzwsx)}}
|
|
2149
2162
|
@supports (-webkit-touch-callout: none){@media (pointer: coarse){.x9w4715.x9w4715.x9w4715:not(#\#):not(#\#):not(#\#):not(#\#){height:calc(max(1rem,var(--text-body-size)) * var(--text-body-leading));height:1lh}}}
|
|
2150
2163
|
.x8s9nux[data-astryx-press="fading"]:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#){animation-duration:.2s}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GestureRecognizer, type GestureRecognizerOptions, type NativeTouchBehavior } from './GestureRecognizer.js';
|
|
2
|
+
import type { GestureEventContext, GestureTouch, Point } from './types.js';
|
|
3
|
+
export interface PinchGestureRecognizerOptions extends GestureRecognizerOptions<PinchGestureRecognizer> {
|
|
4
|
+
hysteresis?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class PinchGestureRecognizer extends GestureRecognizer {
|
|
7
|
+
hysteresis: number;
|
|
8
|
+
private initialSpan;
|
|
9
|
+
private scaleValue;
|
|
10
|
+
private readonly tracker;
|
|
11
|
+
private lastTime;
|
|
12
|
+
constructor(options?: PinchGestureRecognizerOptions);
|
|
13
|
+
/** Current span over the span the fingers started at. */
|
|
14
|
+
get scale(): number;
|
|
15
|
+
/** Re-base: from now on the scale reads `value` at the current span. */
|
|
16
|
+
set scale(value: number);
|
|
17
|
+
/** Scale per second (UIKit's filter; measured for pans, assumed here). */
|
|
18
|
+
get velocity(): number;
|
|
19
|
+
/** The midpoint between the two fingers. */
|
|
20
|
+
focalPoint(): Point;
|
|
21
|
+
/** Two fingers on this view are this recognizer's, not the browser's zoom. */
|
|
22
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
23
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
24
|
+
protected touchesBegan(_touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
25
|
+
protected touchesMoved(_touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
26
|
+
protected touchesEnded(): void;
|
|
27
|
+
protected reset(): void;
|
|
28
|
+
private span;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=PinchGestureRecognizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PinchGestureRecognizer.d.ts","sourceRoot":"","sources":["../../src/gestures/PinchGestureRecognizer.ts"],"names":[],"mappings":"AAuBA,OAAO,EACL,iBAAiB,EAEjB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAC,mBAAmB,EAAE,YAAY,EAAE,KAAK,EAAC,MAAM,SAAS,CAAC;AAGtE,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,sBAAuB,SAAQ,iBAAiB;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAK;gBAET,OAAO,GAAE,6BAAkC;IAKvD,yDAAyD;IACzD,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,wEAAwE;IACxE,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAStB;IAED,0EAA0E;IAC1E,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,4CAA4C;IAC5C,UAAU,IAAI,KAAK;IAInB,8EAA8E;IAC9E,IAAa,mBAAmB,IAAI,mBAAmB,CAEtD;cAEkB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;cAI1C,YAAY,CAC7B,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EACrC,KAAK,EAAE,mBAAmB,GACzB,IAAI;cAUY,YAAY,CAC7B,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EACrC,KAAK,EAAE,mBAAmB,GACzB,IAAI;cA6BY,YAAY,IAAI,IAAI;cAIpB,KAAK,IAAI,IAAI;IAMhC,OAAO,CAAC,IAAI;CAIb"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file PinchGestureRecognizer.ts
|
|
5
|
+
* @input Touches from a GestureArena
|
|
6
|
+
* @output Exports PinchGestureRecognizer (UIPinchGestureRecognizer) and its
|
|
7
|
+
* options
|
|
8
|
+
* @position Continuous two-finger recognizer of packages/core/src/gestures
|
|
9
|
+
*
|
|
10
|
+
* Tracks the first two fingers; more are ignored. Begins once the distance
|
|
11
|
+
* between them has changed by `hysteresis` px. As in UIKit, `scale` is then
|
|
12
|
+
* the current distance over the starting distance moved by the hysteresis
|
|
13
|
+
* toward the pinch, so it does not jump (settable to re-base it); `velocity`
|
|
14
|
+
* is scale per second. Lifting either finger ends an
|
|
15
|
+
* active pinch and fails a possible one.
|
|
16
|
+
*
|
|
17
|
+
* A host gives every element WITHOUT a pinch recognizer `pinch-zoom` in its
|
|
18
|
+
* `touch-action`, so the page stays zoomable (WCAG 1.4.4); attaching one
|
|
19
|
+
* takes the two-finger gesture for this element only.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { UIKIT_PINCH } from "../motion/uikit/gestures.js";
|
|
23
|
+
import { centroid, distance } from "./geometry.js";
|
|
24
|
+
import { GestureRecognizer, isActive } from "./GestureRecognizer.js";
|
|
25
|
+
import { VelocityTracker } from "./VelocityTracker.js";
|
|
26
|
+
export class PinchGestureRecognizer extends GestureRecognizer {
|
|
27
|
+
initialSpan = 0;
|
|
28
|
+
scaleValue = 1;
|
|
29
|
+
tracker = new VelocityTracker();
|
|
30
|
+
lastTime = 0;
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
super(options);
|
|
33
|
+
this.hysteresis = options.hysteresis ?? UIKIT_PINCH.hysteresis.value;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Current span over the span the fingers started at. */
|
|
37
|
+
get scale() {
|
|
38
|
+
return this.scaleValue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Re-base: from now on the scale reads `value` at the current span. */
|
|
42
|
+
set scale(value) {
|
|
43
|
+
const span = this.span();
|
|
44
|
+
if (span > 0 && value > 0) {
|
|
45
|
+
this.initialSpan = span / value;
|
|
46
|
+
this.scaleValue = value;
|
|
47
|
+
// The velocity continues from the re-based value, without a jump.
|
|
48
|
+
this.tracker.reset();
|
|
49
|
+
this.tracker.add(value, 0, this.lastTime);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Scale per second (UIKit's filter; measured for pans, assumed here). */
|
|
54
|
+
get velocity() {
|
|
55
|
+
return this.tracker.velocity().x;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The midpoint between the two fingers. */
|
|
59
|
+
focalPoint() {
|
|
60
|
+
return centroid(this.touches.values());
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Two fingers on this view are this recognizer's, not the browser's zoom. */
|
|
64
|
+
get nativeTouchBehavior() {
|
|
65
|
+
return {
|
|
66
|
+
panX: true,
|
|
67
|
+
panY: true,
|
|
68
|
+
pinchZoom: false,
|
|
69
|
+
doubleTapZoom: false
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
acceptsTouch(touch) {
|
|
73
|
+
return this.numberOfTouches < 2 && super.acceptsTouch(touch);
|
|
74
|
+
}
|
|
75
|
+
touchesBegan(_touches, event) {
|
|
76
|
+
this.lastTime = event.time;
|
|
77
|
+
if (this.numberOfTouches === 2) {
|
|
78
|
+
this.initialSpan = this.span();
|
|
79
|
+
this.scaleValue = 1;
|
|
80
|
+
this.tracker.reset();
|
|
81
|
+
this.tracker.add(1, 0, event.time);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
touchesMoved(_touches, event) {
|
|
85
|
+
if (this.numberOfTouches < 2 || this.initialSpan <= 0) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.lastTime = event.time;
|
|
89
|
+
const span = this.span();
|
|
90
|
+
// Once recognized, a pinch waiting on a recognizer it requires to fail
|
|
91
|
+
// keeps its re-based start: its moves only follow the fingers.
|
|
92
|
+
if (this.state === 'possible' && this.pending == null) {
|
|
93
|
+
if (Math.abs(span - this.initialSpan) >= this.hysteresis) {
|
|
94
|
+
// UIKit measures from the start moved by the hysteresis, and its
|
|
95
|
+
// first velocity spans from the touch-down (scale 1) to here.
|
|
96
|
+
this.initialSpan += Math.sign(span - this.initialSpan) * this.hysteresis;
|
|
97
|
+
this.scaleValue = span / this.initialSpan;
|
|
98
|
+
this.tracker.add(this.scaleValue, 0, event.time);
|
|
99
|
+
this.setState('began');
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.scaleValue = span / this.initialSpan;
|
|
104
|
+
// Every move of the fingers is a sample: a span that holds while they
|
|
105
|
+
// move reads as no change, so the velocity never goes stale.
|
|
106
|
+
this.tracker.add(this.scaleValue, 0, event.time, {
|
|
107
|
+
isMotion: true
|
|
108
|
+
});
|
|
109
|
+
if (isActive(this.state)) {
|
|
110
|
+
this.setState('changed');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
touchesEnded() {
|
|
114
|
+
this.setState(isActive(this.state) ? 'ended' : 'failed');
|
|
115
|
+
}
|
|
116
|
+
reset() {
|
|
117
|
+
this.initialSpan = 0;
|
|
118
|
+
this.scaleValue = 1;
|
|
119
|
+
this.tracker.reset();
|
|
120
|
+
}
|
|
121
|
+
span() {
|
|
122
|
+
const [a, b] = this.trackedTouches;
|
|
123
|
+
return a == null || b == null ? 0 : distance(a, b);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type NativeTouchBehavior } from './GestureRecognizer.js';
|
|
2
|
+
import { PanGestureRecognizer, type PanGestureRecognizerOptions } from './PanGestureRecognizer.js';
|
|
3
|
+
import type { GestureEventContext, GestureTouch } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* An edge by writing direction: under RTL the leading edge is the right one.
|
|
6
|
+
* Top and bottom edges land with their first user.
|
|
7
|
+
*/
|
|
8
|
+
export type ScreenEdge = 'leading' | 'trailing';
|
|
9
|
+
/** A physical horizontal edge of the viewport. */
|
|
10
|
+
type PhysicalEdge = 'left' | 'right';
|
|
11
|
+
/**
|
|
12
|
+
* A screen-edge pan is a finger's: it takes no `allowedPointerTypes`
|
|
13
|
+
* (`spec:AST-094` FR43).
|
|
14
|
+
*/
|
|
15
|
+
export interface ScreenEdgePanGestureRecognizerOptions extends Omit<PanGestureRecognizerOptions, 'direction' | 'allowedPointerTypes'> {
|
|
16
|
+
/** The edges a touch may start from. @default ['leading'] */
|
|
17
|
+
edges?: ReadonlyArray<ScreenEdge>;
|
|
18
|
+
/** Width of the band at each edge, px. */
|
|
19
|
+
edgeRegion?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class ScreenEdgePanGestureRecognizer extends PanGestureRecognizer {
|
|
22
|
+
edges: ReadonlyArray<ScreenEdge>;
|
|
23
|
+
edgeRegion: number;
|
|
24
|
+
/** The physical edge the current gesture started from. */
|
|
25
|
+
activeEdge: PhysicalEdge | null;
|
|
26
|
+
/**
|
|
27
|
+
* @internal Set by the host while attached: called when the edge-zone
|
|
28
|
+
* answer changes, so the element's `touch-action` follows it
|
|
29
|
+
* (spec:AST-094 FR19, DEC-22).
|
|
30
|
+
*/
|
|
31
|
+
onTouchBehaviorChange: (() => void) | null;
|
|
32
|
+
/** The hysteresis where the pan takes its axis (UIKit's 15 px). */
|
|
33
|
+
private readonly edgeHysteresis;
|
|
34
|
+
/** What the pan measured of its view (see EdgeLayout), until a layout change. */
|
|
35
|
+
private layout;
|
|
36
|
+
constructor(options?: ScreenEdgePanGestureRecognizerOptions);
|
|
37
|
+
/**
|
|
38
|
+
* The pan takes the horizontal axis only in its edge zone, a view within
|
|
39
|
+
* the band of an edge it watches; elsewhere it leaves the browser every
|
|
40
|
+
* touch behavior, so the author's scrolling is untouched (spec:AST-094
|
|
41
|
+
* FR18), never claiming across a whole wider element.
|
|
42
|
+
*/
|
|
43
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
44
|
+
/**
|
|
45
|
+
* @internal Whether the edge zone depends on the viewport's width: the pan
|
|
46
|
+
* watches the right side, whose band moves with the viewport, so the host
|
|
47
|
+
* reports a viewport resize to it as well as its own box's (FR19, FR24).
|
|
48
|
+
*/
|
|
49
|
+
get watchesViewport(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @internal The view's box may have changed (a resize): its edges' sides
|
|
52
|
+
* and the edge zone are measured again, and a changed answer calls
|
|
53
|
+
* onTouchBehaviorChange.
|
|
54
|
+
*/
|
|
55
|
+
layoutChanged(): void;
|
|
56
|
+
protected touchesBegan(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
57
|
+
/**
|
|
58
|
+
* The physical sides the pan's edges resolve to under the view's writing
|
|
59
|
+
* direction, and the sides whose band the view lies within, measured
|
|
60
|
+
* together once until a layout change: the view starts at that side and
|
|
61
|
+
* reaches no farther than `edgeRegion` from it, within layout's rounding
|
|
62
|
+
* (a strip authored at the 40.2 px region lays out at 40.203 px, on
|
|
63
|
+
* 1/64 px). A view that cannot be measured lies within none.
|
|
64
|
+
*/
|
|
65
|
+
private measured;
|
|
66
|
+
protected reset(): void;
|
|
67
|
+
private edgeAt;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=ScreenEdgePanGestureRecognizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenEdgePanGestureRecognizer.d.ts","sourceRoot":"","sources":["../../src/gestures/ScreenEdgePanGestureRecognizer.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAmB,KAAK,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,EACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAS/D;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEhD,kDAAkD;AAClD,KAAK,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAarC;;;GAGG;AACH,MAAM,WAAW,qCAAsC,SAAQ,IAAI,CACjE,2BAA2B,EAC3B,WAAW,GAAG,qBAAqB,CACpC;IACC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAClC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,8BAA+B,SAAQ,oBAAoB;IACtE,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,EAAE,YAAY,GAAG,IAAI,CAAQ;IACvC;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAQ;IAClD,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,iFAAiF;IACjF,OAAO,CAAC,MAAM,CAA2B;gBAE7B,OAAO,GAAE,qCAA0C;IAe/D;;;;;OAKG;IACH,IAAa,mBAAmB,IAAI,mBAAmB,CAWtD;IAED;;;;OAIG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;;;OAIG;IACH,aAAa,IAAI,IAAI;cAcF,YAAY,CAC7B,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,EACpC,KAAK,EAAE,mBAAmB,GACzB,IAAI;IAiCP;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;cAyBG,KAAK,IAAI,IAAI;IAKhC,OAAO,CAAC,MAAM;CAaf"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file ScreenEdgePanGestureRecognizer.ts
|
|
5
|
+
* @input Touches from a GestureArena; the viewport size and writing
|
|
6
|
+
* direction from its environment
|
|
7
|
+
* @output Exports ScreenEdgePanGestureRecognizer
|
|
8
|
+
* (UIScreenEdgePanGestureRecognizer), its options and edge type
|
|
9
|
+
* @position Continuous recognizer of packages/core/src/gestures, a pan that
|
|
10
|
+
* only starts from a band at the edge of the viewport
|
|
11
|
+
*
|
|
12
|
+
* A touch that lands outside every requested band fails at once, so a
|
|
13
|
+
* recognizer that requires this one to fail is not held up by a touch in the
|
|
14
|
+
* middle of the screen. Inside a band, the pan begins on movement away from
|
|
15
|
+
* that edge. `leading` and `trailing` resolve against the view's writing
|
|
16
|
+
* direction: under RTL the leading edge is the right one, as the
|
|
17
|
+
* interactive pop gesture's is.
|
|
18
|
+
*
|
|
19
|
+
* Attach it to the edge zone: an element that lies within the band at its
|
|
20
|
+
* edge. There the pan takes the horizontal axis from the browser, which has
|
|
21
|
+
* nothing to scroll in so thin a band, so a touch in the band decides at
|
|
22
|
+
* UIKit's 15 px screen-edge hysteresis. On any other view, whose
|
|
23
|
+
* `touch-action` cannot claim per touch, it leaves the browser every touch
|
|
24
|
+
* behavior, so the author's scrolling there is untouched, and a touch in the
|
|
25
|
+
* band decides at FR19's 10 px like every other claim (spec:AST-094 FR18,
|
|
26
|
+
* DEC-22). The edges' physical sides and the edge zone are measured once,
|
|
27
|
+
* together, and serve both the element's `touch-action` and the touch-down
|
|
28
|
+
* decision; the host reports a layout change (layoutChanged), and a changed
|
|
29
|
+
* answer is announced (onTouchBehaviorChange) so `touch-action` follows it
|
|
30
|
+
* (FR19). The writing direction is read again at each touch-down: a view
|
|
31
|
+
* switched to RTL in place, with no resize, is measured again there and the
|
|
32
|
+
* change announced, so a `leading` back swipe follows the new leading edge
|
|
33
|
+
* (`design:bidirectionality` DR13). That touch landed under the touch-action
|
|
34
|
+
* from before, so it decides at FR19's 10 px unless that one claimed the
|
|
35
|
+
* axis.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { UIKIT_PAN, UIKIT_SCREEN_EDGE_PAN } from "../motion/uikit/gestures.js";
|
|
39
|
+
import { ALL_NATIVE_TOUCH } from "./GestureRecognizer.js";
|
|
40
|
+
import { PanGestureRecognizer } from "./PanGestureRecognizer.js";
|
|
41
|
+
/**
|
|
42
|
+
* How far past `edgeRegion` a view still counts as the edge zone, px: layout
|
|
43
|
+
* snaps sizes to 1/64 px, so a strip authored at the region measures a hair
|
|
44
|
+
* wider; half a pixel takes that and nothing a pixel wider.
|
|
45
|
+
*/
|
|
46
|
+
const EDGE_ZONE_TOLERANCE = 0.5;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An edge by writing direction: under RTL the leading edge is the right one.
|
|
50
|
+
* Top and bottom edges land with their first user.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/** A physical horizontal edge of the viewport. */
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* What the pan measures of its view, once until a layout change: the
|
|
57
|
+
* writing direction it read, the physical sides its edges resolve to under
|
|
58
|
+
* that direction, and the sides whose band the view lies within.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A screen-edge pan is a finger's: it takes no `allowedPointerTypes`
|
|
63
|
+
* (`spec:AST-094` FR43).
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
export class ScreenEdgePanGestureRecognizer extends PanGestureRecognizer {
|
|
67
|
+
/** The physical edge the current gesture started from. */
|
|
68
|
+
activeEdge = null;
|
|
69
|
+
/**
|
|
70
|
+
* @internal Set by the host while attached: called when the edge-zone
|
|
71
|
+
* answer changes, so the element's `touch-action` follows it
|
|
72
|
+
* (spec:AST-094 FR19, DEC-22).
|
|
73
|
+
*/
|
|
74
|
+
onTouchBehaviorChange = null;
|
|
75
|
+
/** The hysteresis where the pan takes its axis (UIKit's 15 px). */
|
|
76
|
+
|
|
77
|
+
/** What the pan measured of its view (see EdgeLayout), until a layout change. */
|
|
78
|
+
layout = null;
|
|
79
|
+
constructor(options = {}) {
|
|
80
|
+
super({
|
|
81
|
+
maximumNumberOfTouches: 1,
|
|
82
|
+
hysteresis: UIKIT_SCREEN_EDGE_PAN.hysteresis.value,
|
|
83
|
+
...options,
|
|
84
|
+
// A finger's only: under a mouse, a trackpad or a pen the screen-edge
|
|
85
|
+
// pan stays off (`spec:AST-094` FR43), whatever a caller passes.
|
|
86
|
+
allowedPointerTypes: ['touch']
|
|
87
|
+
});
|
|
88
|
+
this.edges = options.edges ?? ['leading'];
|
|
89
|
+
this.edgeRegion = options.edgeRegion ?? UIKIT_SCREEN_EDGE_PAN.edgeRegion.value;
|
|
90
|
+
this.edgeHysteresis = this.hysteresis;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The pan takes the horizontal axis only in its edge zone, a view within
|
|
95
|
+
* the band of an edge it watches; elsewhere it leaves the browser every
|
|
96
|
+
* touch behavior, so the author's scrolling is untouched (spec:AST-094
|
|
97
|
+
* FR18), never claiming across a whole wider element.
|
|
98
|
+
*/
|
|
99
|
+
get nativeTouchBehavior() {
|
|
100
|
+
const {
|
|
101
|
+
watched,
|
|
102
|
+
zone
|
|
103
|
+
} = this.measured();
|
|
104
|
+
if (!watched.some(edge => zone.has(edge))) {
|
|
105
|
+
return ALL_NATIVE_TOUCH;
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
panX: false,
|
|
109
|
+
panY: true,
|
|
110
|
+
pinchZoom: true,
|
|
111
|
+
doubleTapZoom: false
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @internal Whether the edge zone depends on the viewport's width: the pan
|
|
117
|
+
* watches the right side, whose band moves with the viewport, so the host
|
|
118
|
+
* reports a viewport resize to it as well as its own box's (FR19, FR24).
|
|
119
|
+
*/
|
|
120
|
+
get watchesViewport() {
|
|
121
|
+
return this.measured().watched.includes('right');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @internal The view's box may have changed (a resize): its edges' sides
|
|
126
|
+
* and the edge zone are measured again, and a changed answer calls
|
|
127
|
+
* onTouchBehaviorChange.
|
|
128
|
+
*/
|
|
129
|
+
layoutChanged() {
|
|
130
|
+
const before = this.layout;
|
|
131
|
+
this.layout = null;
|
|
132
|
+
const after = this.measured();
|
|
133
|
+
if (before == null || before.watched.join() !== after.watched.join() || before.zone.size !== after.zone.size || [...after.zone].some(edge => !before.zone.has(edge))) {
|
|
134
|
+
this.onTouchBehaviorChange?.();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
touchesBegan(touches, event) {
|
|
138
|
+
if (this.numberOfTouches === touches.length) {
|
|
139
|
+
// The touch-action the browser applies to this touch was derived from
|
|
140
|
+
// the layout in force as it landed: whether that claimed the axis.
|
|
141
|
+
const inForce = this.measured();
|
|
142
|
+
const claimedAxis = inForce.watched.some(side => inForce.zone.has(side));
|
|
143
|
+
// A direction switched in place (no resize) moves the leading edge:
|
|
144
|
+
// measure again, and announce it so touch-action follows for the next
|
|
145
|
+
// touch (DR13).
|
|
146
|
+
if (inForce.isRtl !== this.environment.isRtl(this.view)) {
|
|
147
|
+
this.layoutChanged();
|
|
148
|
+
}
|
|
149
|
+
const edge = this.edgeAt(touches[0]);
|
|
150
|
+
if (edge == null) {
|
|
151
|
+
this.setState('failed');
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.activeEdge = edge;
|
|
155
|
+
// On an element within the band, which takes the axis across the edge,
|
|
156
|
+
// a touch decides at UIKit's 15 px; on any other, which leaves the
|
|
157
|
+
// browser that axis, at FR19's 10 px, before the browser commits to a
|
|
158
|
+
// scroll (spec:AST-094 FR18, DEC-22). The answer is the one this
|
|
159
|
+
// touch's touch-action was derived from: a touch that measured again
|
|
160
|
+
// decides at 10 px unless the layout in force claimed the axis.
|
|
161
|
+
const offZone = !claimedAxis || !this.measured().zone.has(edge);
|
|
162
|
+
this.hysteresis = offZone ? Math.min(this.edgeHysteresis, UIKIT_PAN.hysteresis.value) : this.edgeHysteresis;
|
|
163
|
+
this.direction = edge === 'left' ? 'right' : 'left';
|
|
164
|
+
}
|
|
165
|
+
super.touchesBegan(touches, event);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The physical sides the pan's edges resolve to under the view's writing
|
|
170
|
+
* direction, and the sides whose band the view lies within, measured
|
|
171
|
+
* together once until a layout change: the view starts at that side and
|
|
172
|
+
* reaches no farther than `edgeRegion` from it, within layout's rounding
|
|
173
|
+
* (a strip authored at the 40.2 px region lays out at 40.203 px, on
|
|
174
|
+
* 1/64 px). A view that cannot be measured lies within none.
|
|
175
|
+
*/
|
|
176
|
+
measured() {
|
|
177
|
+
if (this.layout != null) {
|
|
178
|
+
return this.layout;
|
|
179
|
+
}
|
|
180
|
+
const isRtl = this.environment.isRtl(this.view);
|
|
181
|
+
const watched = this.edges.map(edge => edge === 'leading' !== isRtl ? 'left' : 'right');
|
|
182
|
+
const zone = new Set();
|
|
183
|
+
const rect = this.environment.viewRect?.(this.view);
|
|
184
|
+
if (rect != null && rect.width > 0) {
|
|
185
|
+
const {
|
|
186
|
+
width
|
|
187
|
+
} = this.environment.viewportSize();
|
|
188
|
+
const right = rect.left + rect.width;
|
|
189
|
+
const band = this.edgeRegion + EDGE_ZONE_TOLERANCE;
|
|
190
|
+
if (rect.left >= -EDGE_ZONE_TOLERANCE && right <= band) {
|
|
191
|
+
zone.add('left');
|
|
192
|
+
}
|
|
193
|
+
if (rect.left >= width - band && right <= width + EDGE_ZONE_TOLERANCE) {
|
|
194
|
+
zone.add('right');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
this.layout = {
|
|
198
|
+
isRtl,
|
|
199
|
+
watched,
|
|
200
|
+
zone
|
|
201
|
+
};
|
|
202
|
+
return this.layout;
|
|
203
|
+
}
|
|
204
|
+
reset() {
|
|
205
|
+
super.reset();
|
|
206
|
+
this.activeEdge = null;
|
|
207
|
+
}
|
|
208
|
+
edgeAt(touch) {
|
|
209
|
+
const {
|
|
210
|
+
width
|
|
211
|
+
} = this.environment.viewportSize();
|
|
212
|
+
for (const physical of this.measured().watched) {
|
|
213
|
+
const inBand = physical === 'left' ? touch.startX <= this.edgeRegion : touch.startX >= width - this.edgeRegion;
|
|
214
|
+
if (inBand) {
|
|
215
|
+
return physical;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
}
|