@astryxdesign/core 0.7.6-canary.ec128c4 → 0.7.6-canary.f73623d
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/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +183 -5
- package/dist/AppShell/observeMainOverflow.d.ts +9 -0
- package/dist/AppShell/observeMainOverflow.d.ts.map +1 -0
- package/dist/AppShell/observeMainOverflow.js +125 -0
- package/dist/Carousel/Carousel.d.ts +3 -1
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +12 -3
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +41 -4
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +11 -7
- package/dist/DateInput/usePointerDragScroll.d.ts +10 -1
- package/dist/DateInput/usePointerDragScroll.d.ts.map +1 -1
- package/dist/DateInput/usePointerDragScroll.js +25 -9
- package/dist/DateInput/useScrollSettle.d.ts +3 -1
- package/dist/DateInput/useScrollSettle.d.ts.map +1 -1
- package/dist/DateInput/useScrollSettle.js +37 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +28 -19
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +19 -6
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +27 -6
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +8 -3
- package/dist/Markdown/plugins/headingLinks.a11y.chromium.spec.js +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +5 -29
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +23 -2
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +27 -0
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +32 -12
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +10 -3
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +37 -30
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +11 -3
- package/dist/SideNav/SideNavItem.d.ts +2 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +18 -7
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +1 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Stepper/Step.d.ts.map +1 -1
- package/dist/Stepper/Step.js +26 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +10 -3
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/Table.js +36 -10
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +46 -58
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +19 -3
- package/dist/ToggleButton/ToggleButtonGroup.d.ts +7 -1
- package/dist/ToggleButton/ToggleButtonGroup.d.ts.map +1 -1
- package/dist/ToggleButton/ToggleButtonGroup.js +16 -2
- package/dist/Token/Token.d.ts.map +1 -1
- package/dist/Token/Token.js +37 -5
- package/dist/Token/TokenLink.d.ts.map +1 -1
- package/dist/Token/TokenLink.js +14 -2
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +15 -4
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts +2 -0
- package/dist/Tokenizer/TokenizerClearAllMessageContext.d.ts.map +1 -0
- package/dist/Tokenizer/TokenizerClearAllMessageContext.js +17 -0
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +27 -4
- package/dist/Typeahead/BaseTypeahead.d.ts +4 -4
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +43 -7
- package/dist/astryx.css +10 -3
- package/dist/gestures/GestureArena.d.ts +26 -1
- package/dist/gestures/GestureArena.d.ts.map +1 -1
- package/dist/gestures/GestureArena.js +71 -9
- package/dist/gestures/GestureHost.d.ts +2 -3
- package/dist/gestures/GestureHost.d.ts.map +1 -1
- package/dist/gestures/GestureHost.js +7 -7
- package/dist/gestures/GestureRecognizer.d.ts +3 -1
- package/dist/gestures/GestureRecognizer.d.ts.map +1 -1
- package/dist/gestures/GestureRecognizer.js +3 -1
- package/dist/gestures/PressTracker.d.ts +112 -0
- package/dist/gestures/PressTracker.d.ts.map +1 -0
- package/dist/gestures/PressTracker.js +267 -0
- package/dist/gestures/index.d.ts +37 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +25 -0
- package/dist/gestures/useGestureRecognizer.d.ts +56 -0
- package/dist/gestures/useGestureRecognizer.d.ts.map +1 -0
- package/dist/gestures/useGestureRecognizer.js +226 -0
- package/dist/hooks/scrollKeyboardDelegation.d.ts.map +1 -1
- package/dist/hooks/scrollKeyboardDelegation.js +7 -3
- package/dist/hooks/useScrollOverflow.d.ts +2 -1
- package/dist/hooks/useScrollOverflow.d.ts.map +1 -1
- package/dist/hooks/useScrollOverflow.js +56 -10
- package/dist/i18n/generated-locales/af-ZA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/af-ZA.generated.js +0 -5
- package/dist/i18n/generated-locales/ar-SA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ar-SA.generated.js +0 -5
- package/dist/i18n/generated-locales/ca-ES.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ca-ES.generated.js +0 -5
- package/dist/i18n/generated-locales/cs-CZ.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/cs-CZ.generated.js +0 -5
- package/dist/i18n/generated-locales/da-DK.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/da-DK.generated.js +0 -5
- package/dist/i18n/generated-locales/de-DE.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/de-DE.generated.js +0 -5
- package/dist/i18n/generated-locales/el-GR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/el-GR.generated.js +0 -5
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +3 -5
- package/dist/i18n/generated-locales/es-ES.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/es-ES.generated.js +0 -5
- package/dist/i18n/generated-locales/fi-FI.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/fi-FI.generated.js +0 -5
- package/dist/i18n/generated-locales/fr-FR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/fr-FR.generated.js +0 -5
- package/dist/i18n/generated-locales/he-IL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/he-IL.generated.js +0 -5
- package/dist/i18n/generated-locales/hu-HU.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/hu-HU.generated.js +0 -5
- package/dist/i18n/generated-locales/it-IT.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/it-IT.generated.js +0 -5
- package/dist/i18n/generated-locales/ja-JP.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ja-JP.generated.js +0 -5
- package/dist/i18n/generated-locales/ko-KR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ko-KR.generated.js +0 -5
- package/dist/i18n/generated-locales/nl-NL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/nl-NL.generated.js +0 -5
- package/dist/i18n/generated-locales/no-NO.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/no-NO.generated.js +0 -5
- package/dist/i18n/generated-locales/pl-PL.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pl-PL.generated.js +0 -5
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +3 -5
- package/dist/i18n/generated-locales/pt-BR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pt-BR.generated.js +0 -5
- package/dist/i18n/generated-locales/pt-PT.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pt-PT.generated.js +0 -5
- package/dist/i18n/generated-locales/ro-RO.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ro-RO.generated.js +0 -5
- package/dist/i18n/generated-locales/ru-RU.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/ru-RU.generated.js +0 -5
- package/dist/i18n/generated-locales/sr-SP.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/sr-SP.generated.js +0 -5
- package/dist/i18n/generated-locales/sv-SE.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/sv-SE.generated.js +0 -5
- package/dist/i18n/generated-locales/tr-TR.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/tr-TR.generated.js +0 -5
- package/dist/i18n/generated-locales/uk-UA.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/uk-UA.generated.js +0 -5
- package/dist/i18n/generated-locales/vi-VN.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/vi-VN.generated.js +0 -5
- package/dist/i18n/generated-locales/zh-CN.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/zh-CN.generated.js +0 -5
- package/dist/i18n/generated-locales/zh-TW.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/zh-TW.generated.js +0 -5
- package/dist/motion/animator.d.ts +76 -7
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +589 -99
- package/dist/motion/coast.d.ts +4 -1
- package/dist/motion/coast.d.ts.map +1 -1
- package/dist/motion/coast.js +4 -2
- package/dist/motion/reducedMotion.d.ts.map +1 -1
- package/dist/motion/reducedMotion.js +6 -2
- package/dist/motion/reducedMotionPlan.d.ts +7 -0
- package/dist/motion/reducedMotionPlan.d.ts.map +1 -1
- package/dist/motion/reducedMotionPlan.js +14 -1
- package/dist/motion/resolveMotion.d.ts +42 -0
- package/dist/motion/resolveMotion.d.ts.map +1 -0
- package/dist/motion/resolveMotion.js +43 -0
- package/dist/motion/roleValue.d.ts +2 -1
- package/dist/motion/roleValue.d.ts.map +1 -1
- package/dist/motion/roleValue.js +2 -1
- package/dist/motion/uikit/timing.d.ts +7 -1
- package/dist/motion/uikit/timing.d.ts.map +1 -1
- package/dist/motion/uikit/timing.js +19 -1
- package/dist/theme/defineTheme.d.ts +19 -5
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +63 -3
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/motionKnobs.d.ts +56 -0
- package/dist/theme/motionKnobs.d.ts.map +1 -0
- package/dist/theme/motionKnobs.js +48 -0
- package/dist/theme/resolveThemeValues.d.ts +11 -4
- package/dist/theme/resolveThemeValues.d.ts.map +1 -1
- package/dist/theme/resolveThemeValues.js +40 -4
- package/dist/theme/themeAdaptations.d.ts +7 -3
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +36 -7
- package/dist/theme/themeMotion.d.ts +96 -0
- package/dist/theme/themeMotion.d.ts.map +1 -0
- package/dist/theme/themeMotion.js +177 -0
- package/dist/theme/tokenReferences.d.ts +31 -0
- package/dist/theme/tokenReferences.d.ts.map +1 -0
- package/dist/theme/tokenReferences.js +132 -0
- package/dist/theme/tokens.d.ts +1 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +9 -129
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +12 -0
- package/dist/utils/focusOutline.stylex.d.ts +6 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +7 -0
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +17 -8
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +20 -1
- package/dist/utils/sharedMutationObserver.d.ts +19 -11
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -1
- package/dist/utils/sharedMutationObserver.js +66 -26
- package/dist/utils/touchPresentation.d.ts +2 -2
- package/dist/utils/touchPresentation.d.ts.map +1 -1
- package/dist/utils/touchPresentation.js +8 -5
- package/dist/utils/touchQueries.d.ts +13 -0
- package/dist/utils/touchQueries.d.ts.map +1 -0
- package/dist/utils/touchQueries.js +15 -0
- package/dist/utils/useFocusAcrossSwap.d.ts +19 -0
- package/dist/utils/useFocusAcrossSwap.d.ts.map +1 -0
- package/dist/utils/useFocusAcrossSwap.js +41 -0
- package/locales/af-ZA.json +0 -21
- package/locales/ar-SA.json +0 -21
- package/locales/ca-ES.json +0 -21
- package/locales/cs-CZ.json +0 -21
- package/locales/da-DK.json +0 -21
- package/locales/de-DE.json +0 -21
- package/locales/el-GR.json +0 -21
- package/locales/en.json +12 -20
- package/locales/es-ES.json +0 -21
- package/locales/fi-FI.json +0 -21
- package/locales/fr-FR.json +0 -21
- package/locales/he-IL.json +0 -21
- package/locales/hu-HU.json +0 -21
- package/locales/it-IT.json +0 -21
- package/locales/ja-JP.json +0 -21
- package/locales/ko-KR.json +0 -21
- package/locales/nl-NL.json +0 -21
- package/locales/no-NO.json +0 -21
- package/locales/pl-PL.json +0 -21
- package/locales/pseudo.json +8 -14
- package/locales/pt-BR.json +0 -21
- package/locales/pt-PT.json +0 -21
- package/locales/ro-RO.json +0 -21
- package/locales/ru-RU.json +0 -21
- package/locales/sr-SP.json +0 -21
- package/locales/sv-SE.json +0 -21
- package/locales/tr-TR.json +0 -21
- package/locales/uk-UA.json +0 -21
- package/locales/vi-VN.json +0 -21
- package/locales/zh-CN.json +0 -21
- package/locales/zh-TW.json +0 -21
- package/package.json +4 -4
- package/src/AppShell/AppShell.doc.mjs +1 -1
- package/src/AppShell/AppShell.spec.md +9 -12
- package/src/AppShell/AppShell.test.tsx +164 -2
- package/src/AppShell/AppShell.tsx +225 -5
- package/src/AppShell/__tests__/AppShellMainKeyboard.a11y.browser.spec.ts +534 -0
- package/src/AppShell/observeMainOverflow.test.ts +173 -0
- package/src/AppShell/observeMainOverflow.ts +143 -0
- package/src/Carousel/Carousel.doc.mjs +1 -1
- package/src/Carousel/Carousel.spec.md +9 -9
- package/src/Carousel/Carousel.test.tsx +124 -3
- package/src/Carousel/Carousel.tsx +10 -2
- package/src/Carousel/__tests__/Carousel.a11y.known-failures.ts +1 -16
- package/src/Chat/ChatComposer.spec.md +75 -59
- package/src/Chat/ChatComposerTokenElement.spec.md +45 -33
- package/src/Chat/ChatDictationButton.spec.md +126 -81
- package/src/Chat/ChatLayout.spec.md +41 -36
- package/src/Chat/ChatLayoutScrollButton.spec.md +87 -103
- package/src/Chat/ChatSendButton.spec.md +78 -67
- package/src/CodeBlock/__tests__/CodeBlockCopyClearance.a11y.chromium.spec.ts +38 -3
- package/src/ComplexSelector/ComplexSelector.test.tsx +111 -0
- package/src/ComplexSelector/ComplexSelector.tsx +41 -4
- package/src/ContextMenu/ContextMenu.spec.md +84 -56
- package/src/ContextMenu/ContextMenuItem.spec.md +132 -0
- package/src/DateInput/DateInputTouch.test.tsx +44 -0
- package/src/DateInput/Wheel.tsx +9 -6
- package/src/DateInput/usePointerDragScroll.ts +34 -10
- package/src/DateInput/useScrollSettle.ts +38 -7
- package/src/DropdownMenu/DropdownMenu.spec.md +198 -218
- package/src/DropdownMenu/DropdownMenu.test.tsx +117 -0
- package/src/DropdownMenu/DropdownMenu.tsx +33 -18
- package/src/DropdownMenu/DropdownMenuCheckboxItem.spec.md +192 -0
- package/src/DropdownMenu/DropdownMenuDivider.spec.md +25 -31
- package/src/DropdownMenu/DropdownMenuGroup.spec.md +145 -0
- package/src/DropdownMenu/DropdownMenuItem.spec.md +48 -42
- package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +34 -37
- package/src/DropdownMenu/DropdownMenuRadioItem.spec.md +54 -53
- package/src/DropdownMenu/DropdownMenuSubMenu.spec.md +47 -41
- package/src/EmptyState/EmptyState.spec.md +35 -29
- package/src/Item/Item.test.tsx +60 -0
- package/src/Item/Item.tsx +14 -7
- package/src/Layer/useLayer.test.tsx +78 -3
- package/src/Layer/useLayer.tsx +27 -6
- package/src/Link/Link.spec.md +3 -2
- package/src/Link/Link.tsx +11 -0
- package/src/Link/__tests__/Link.truncation.a11y.chromium.spec.ts +58 -0
- package/src/Markdown/plugins/headingLinks.a11y.chromium.spec.ts +1 -1
- package/src/NavMenu/NavHeadingMenuItem.tsx +5 -39
- package/src/NumberInput/NumberInput.test.tsx +68 -7
- package/src/NumberInput/NumberInput.tsx +31 -1
- package/src/Outline/Outline.spec.md +165 -69
- package/src/Outline/Outline.test.tsx +67 -2
- package/src/Outline/Outline.tsx +23 -0
- package/src/Outline/modules/parseOutlineFromMarkdown.spec.md +3 -4
- package/src/OverflowList/OverflowList.spec.md +102 -55
- package/src/Pagination/Pagination.spec.md +158 -84
- package/src/Popover/Popover.test.tsx +84 -0
- package/src/Popover/Popover.tsx +34 -14
- package/src/Popover/__tests__/PopoverSecondDocument.a11y.chromium.spec.ts +70 -8
- package/src/Popover/usePopover.tsx +10 -3
- package/src/PowerSearch/PowerSearch.test.tsx +24 -0
- package/src/PowerSearch/PowerSearch.tsx +42 -31
- package/src/RadioList/RadioList.spec.md +1 -1
- package/src/RadioList/RadioList.test.tsx +84 -0
- package/src/RadioList/RadioListItem.tsx +11 -2
- package/src/Resizable/Resizable.spec.md +144 -124
- package/src/SideNav/SideNav.test.tsx +124 -4
- package/src/SideNav/SideNavItem.spec.md +14 -24
- package/src/SideNav/SideNavItem.tsx +27 -10
- package/src/Skeleton/Skeleton.tsx +3 -1
- package/src/Spinner/Spinner.tsx +3 -1
- package/src/Stepper/Step.spec.md +36 -42
- package/src/Stepper/Step.tsx +33 -6
- package/src/Stepper/Stepper.doc.mjs +1 -1
- package/src/Stepper/Stepper.test.tsx +69 -7
- package/src/Switch/Switch.spec.md +1 -1
- package/src/Switch/Switch.test.tsx +66 -1
- package/src/Switch/Switch.tsx +11 -3
- package/src/Table/Table.spec.md +1 -1
- package/src/Table/Table.test.tsx +32 -0
- package/src/Table/Table.tsx +43 -11
- package/src/Table/__tests__/Table.a11y.states.ts +1 -5
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +73 -144
- package/src/Table/plugins/sortable/useTableSortable.tsx +44 -73
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +9 -21
- package/src/TimeInput/TimeInput.spec.md +13 -13
- package/src/Toast/Toast.spec.md +2 -5
- package/src/Toast/ToastViewport.test.tsx +79 -0
- package/src/Toast/ToastViewport.tsx +21 -3
- package/src/ToggleButton/ToggleButton.test.tsx +27 -0
- package/src/ToggleButton/ToggleButtonGroup.tsx +20 -1
- package/src/Token/Token.doc.mjs +2 -2
- package/src/Token/Token.spec.md +41 -51
- package/src/Token/Token.test.tsx +67 -0
- package/src/Token/Token.tsx +60 -5
- package/src/Token/TokenLink.tsx +21 -7
- package/src/Tokenizer/Tokenizer.spec.md +13 -1
- package/src/Tokenizer/Tokenizer.test.tsx +27 -0
- package/src/Tokenizer/Tokenizer.tsx +24 -10
- package/src/Tokenizer/TokenizerBottomSheet.test.tsx +8 -0
- package/src/Tokenizer/TokenizerClearAllMessageContext.ts +21 -0
- package/src/TreeList/TreeList.test.tsx +26 -0
- package/src/TreeList/TreeListItem.tsx +26 -4
- package/src/Typeahead/BaseTypeahead.doc.mjs +3 -3
- package/src/Typeahead/BaseTypeahead.spec.md +45 -45
- package/src/Typeahead/BaseTypeahead.tsx +48 -9
- package/src/Typeahead/Typeahead.test.tsx +120 -0
- package/src/__tests__/internalModulesNotExperimental.test.ts +88 -0
- package/src/__tests__/pressState.ts +8 -4
- package/src/gestures/GestureArena.ts +76 -11
- package/src/gestures/GestureHost.ts +6 -7
- package/src/gestures/GestureRecognizer.ts +3 -1
- package/src/gestures/PressTracker.ts +386 -0
- package/src/gestures/README.md +420 -0
- package/src/gestures/__tests__/GestureHost.test.ts +50 -1
- package/src/gestures/__tests__/PressTracker.test.ts +275 -0
- package/src/gestures/__tests__/arena.test.ts +35 -0
- package/src/gestures/__tests__/harness.ts +31 -2
- package/src/gestures/__tests__/pressTrackerFactory.test.ts +59 -0
- package/src/gestures/__tests__/useGestureRecognizer.test.tsx +570 -0
- package/src/gestures/index.ts +79 -0
- package/src/gestures/useGestureRecognizer.ts +305 -0
- package/src/hooks/scrollKeyboardDelegation.test.ts +33 -0
- package/src/hooks/scrollKeyboardDelegation.ts +9 -3
- package/src/hooks/useScrollOverflow.doc.mjs +1 -1
- package/src/hooks/useScrollOverflow.test.tsx +102 -1
- package/src/hooks/useScrollOverflow.ts +59 -10
- package/src/i18n/generated-locales/af-ZA.generated.ts +0 -7
- package/src/i18n/generated-locales/ar-SA.generated.ts +0 -6
- package/src/i18n/generated-locales/ca-ES.generated.ts +0 -7
- package/src/i18n/generated-locales/cs-CZ.generated.ts +0 -6
- package/src/i18n/generated-locales/da-DK.generated.ts +0 -6
- package/src/i18n/generated-locales/de-DE.generated.ts +0 -6
- package/src/i18n/generated-locales/el-GR.generated.ts +0 -7
- package/src/i18n/generated-locales/en.generated.ts +3 -6
- package/src/i18n/generated-locales/es-ES.generated.ts +0 -7
- package/src/i18n/generated-locales/fi-FI.generated.ts +0 -6
- package/src/i18n/generated-locales/fr-FR.generated.ts +0 -7
- package/src/i18n/generated-locales/he-IL.generated.ts +0 -6
- package/src/i18n/generated-locales/hu-HU.generated.ts +0 -6
- package/src/i18n/generated-locales/it-IT.generated.ts +0 -7
- package/src/i18n/generated-locales/ja-JP.generated.ts +0 -6
- package/src/i18n/generated-locales/ko-KR.generated.ts +0 -6
- package/src/i18n/generated-locales/nl-NL.generated.ts +0 -6
- package/src/i18n/generated-locales/no-NO.generated.ts +0 -6
- package/src/i18n/generated-locales/pl-PL.generated.ts +0 -7
- package/src/i18n/generated-locales/pseudo.generated.ts +3 -6
- package/src/i18n/generated-locales/pt-BR.generated.ts +0 -7
- package/src/i18n/generated-locales/pt-PT.generated.ts +0 -7
- package/src/i18n/generated-locales/ro-RO.generated.ts +0 -6
- package/src/i18n/generated-locales/ru-RU.generated.ts +0 -7
- package/src/i18n/generated-locales/sr-SP.generated.ts +0 -6
- package/src/i18n/generated-locales/sv-SE.generated.ts +0 -6
- package/src/i18n/generated-locales/tr-TR.generated.ts +0 -7
- package/src/i18n/generated-locales/uk-UA.generated.ts +0 -7
- package/src/i18n/generated-locales/vi-VN.generated.ts +0 -6
- package/src/i18n/generated-locales/zh-CN.generated.ts +0 -6
- package/src/i18n/generated-locales/zh-TW.generated.ts +0 -6
- package/src/motion/MEASUREMENTS.md +2 -1
- package/src/motion/README.md +102 -32
- package/src/motion/__tests__/animator.interaction.browser.spec.ts +843 -0
- package/src/motion/__tests__/motionBundle.ts +14 -0
- package/src/motion/animator.test.ts +978 -33
- package/src/motion/animator.ts +790 -104
- package/src/motion/coast.ts +10 -3
- package/src/motion/reducedMotion.ts +12 -2
- package/src/motion/reducedMotionPlan.test.ts +26 -0
- package/src/motion/reducedMotionPlan.ts +20 -1
- package/src/motion/resolveMotion.test.ts +123 -0
- package/src/motion/resolveMotion.ts +68 -0
- package/src/motion/roleValue.ts +2 -1
- package/src/motion/roles.test.ts +21 -4
- package/src/motion/uikit/tableImports.test.ts +293 -0
- package/src/motion/uikit/timing.ts +15 -1
- package/src/motion/uikit/values.test.ts +23 -12
- package/src/theme/Theme.doc.mjs +1 -1
- package/src/theme/defineTheme.ts +116 -7
- package/src/theme/expandMotionScale.test.ts +1 -1
- package/src/theme/index.ts +5 -0
- package/src/theme/motionKnobs.ts +82 -0
- package/src/theme/resolveThemeValues.ts +68 -6
- package/src/theme/themeAdaptations.ts +52 -12
- package/src/theme/themeMotion.test.ts +620 -0
- package/src/theme/themeMotion.ts +221 -0
- package/src/theme/tokenReferences.ts +149 -0
- package/src/theme/tokens.stylex.ts +10 -0
- package/src/theme/tokens.ts +15 -158
- package/src/utils/focusOutline.stylex.ts +28 -0
- package/src/utils/interactionOverlay.stylex.ts +12 -3
- package/src/utils/pressFeedback.test.ts +138 -0
- package/src/utils/pressFeedback.ts +34 -11
- package/src/utils/pressGesture.test.ts +9 -0
- package/src/utils/sharedMutationObserver.test.ts +54 -1
- package/src/utils/sharedMutationObserver.ts +87 -29
- package/src/utils/touchPresentation.ts +8 -5
- package/src/utils/touchQueries.ts +15 -0
- package/src/utils/useFocusAcrossSwap.ts +55 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureRecognizer.d.ts","sourceRoot":"","sources":["../../src/gestures/GestureRecognizer.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,iBAAiB;IAC7D,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2FAA2F;IAC3F,mBAAmB,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACjD,sFAAsF;IACtF,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,+EAA+E;IAC/E,WAAW,CAAC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|
|
@@ -49,7 +49,9 @@ export function isActive(state) {
|
|
|
49
49
|
return state === 'began' || state === 'changed';
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* The browser behaviors `touch-action` can keep or remove.
|
|
54
|
+
*/
|
|
53
55
|
|
|
54
56
|
export const ALL_NATIVE_TOUCH = {
|
|
55
57
|
panX: true,
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { GestureRecognizer } from './GestureRecognizer.js';
|
|
2
|
+
import type { GestureTouch, TouchConsumer } from './types.js';
|
|
3
|
+
export type ControlEvent = 'touchDown' | 'touchDragInside' | 'touchDragOutside' | 'touchDragEnter' | 'touchDragExit' | 'touchUpInside' | 'touchUpOutside' | 'touchCancel';
|
|
4
|
+
export interface PressBounds {
|
|
5
|
+
readonly left: number;
|
|
6
|
+
readonly top: number;
|
|
7
|
+
readonly right: number;
|
|
8
|
+
readonly bottom: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PressTrackerOptions {
|
|
11
|
+
/** The control's bounds in client px, read when a finger lands. */
|
|
12
|
+
getBounds: () => PressBounds | null;
|
|
13
|
+
/** The view the tracker belongs to; recognizers on it are not ancestors. */
|
|
14
|
+
view?: unknown;
|
|
15
|
+
onControlEvent?: (event: ControlEvent, touch: GestureTouch) => void;
|
|
16
|
+
onHighlightChange?: (isHighlighted: boolean) => void;
|
|
17
|
+
trackingExpansion?: number;
|
|
18
|
+
/**
|
|
19
|
+
* When the highlight waits `contentTouchDelay`: inside a scroller (a
|
|
20
|
+
* control or a cell), always, or never. @default 'inScrollers'
|
|
21
|
+
*/
|
|
22
|
+
highlightDelay?: PressHighlightDelay;
|
|
23
|
+
/**
|
|
24
|
+
* Travel (px) past which the press is cancelled for good, with no
|
|
25
|
+
* re-highlight on the way back (a cell whose scroll view took the touch).
|
|
26
|
+
* Unset, the finger is tracked in and out of the expanded bounds.
|
|
27
|
+
*/
|
|
28
|
+
cancelTravel?: number;
|
|
29
|
+
/**
|
|
30
|
+
* How long a tap quicker than the delay shows the highlight at the lift,
|
|
31
|
+
* ms; 0 highlights and releases at once. @default the quick-tap flash
|
|
32
|
+
*/
|
|
33
|
+
quickTapFlash?: number;
|
|
34
|
+
/** Which ancestor recognizers the control's own action beats. */
|
|
35
|
+
vetoesAncestorRecognizer?: (recognizer: GestureRecognizer) => boolean;
|
|
36
|
+
/** @default () => true */
|
|
37
|
+
isEnabled?: () => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether this finger is braking a scroll it set moving (see
|
|
40
|
+
* GestureHost.isScrollBraking): a native list highlights nothing for one,
|
|
41
|
+
* and the control does not track it at all. Asked only for a finger: a
|
|
42
|
+
* mouse or a pen never brakes (`spec:AST-094` FR11).
|
|
43
|
+
*/
|
|
44
|
+
isBraking?: (touch: GestureTouch) => boolean;
|
|
45
|
+
}
|
|
46
|
+
export type PressHighlightDelay = 'inScrollers' | 'always' | 'never';
|
|
47
|
+
/**
|
|
48
|
+
* How a kind of pressable tracks a finger and how long its release takes.
|
|
49
|
+
*/
|
|
50
|
+
export interface PressProfile {
|
|
51
|
+
readonly highlightDelay: PressHighlightDelay;
|
|
52
|
+
readonly cancelTravel?: number;
|
|
53
|
+
readonly quickTapFlash: number;
|
|
54
|
+
/** The release (`fading`) clock a painter uses, ms. */
|
|
55
|
+
readonly releaseMs: number;
|
|
56
|
+
}
|
|
57
|
+
export declare const PRESS_PROFILES: {
|
|
58
|
+
/** UIControl: same-frame highlight outside scrollers, 70 pt tracking. */
|
|
59
|
+
readonly control: {
|
|
60
|
+
readonly highlightDelay: "inScrollers";
|
|
61
|
+
readonly quickTapFlash: 100;
|
|
62
|
+
readonly releaseMs: 200;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* A table or collection cell: inside a scroll view it highlights after the
|
|
66
|
+
* content-touch delay, outside one at once (AST-094 FR11: the delay applies
|
|
67
|
+
* only inside scroll views); cancelled by the scroll.
|
|
68
|
+
*/
|
|
69
|
+
readonly cell: {
|
|
70
|
+
readonly highlightDelay: "inScrollers";
|
|
71
|
+
readonly cancelTravel: 10;
|
|
72
|
+
readonly quickTapFlash: 0;
|
|
73
|
+
readonly releaseMs: 200;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export type PressProfileName = keyof typeof PRESS_PROFILES;
|
|
77
|
+
/**
|
|
78
|
+
* UIButton's rule, the tracker's default ancestor veto: an ancestor's
|
|
79
|
+
* single-finger single tap. A tap is told apart by its `kind`
|
|
80
|
+
* (`architecture:react-component-runtime` INV13).
|
|
81
|
+
*/
|
|
82
|
+
export declare function vetoesSingleTap(recognizer: GestureRecognizer): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* A control's touch tracking, the gesture host's consumer for one element
|
|
85
|
+
* (UIControl's `beginTracking` / `continueTracking` / `endTracking`): it
|
|
86
|
+
* reports control events and the highlight. Built by
|
|
87
|
+
* {@link createPressTracker}.
|
|
88
|
+
*/
|
|
89
|
+
export interface PressTracker extends TouchConsumer {
|
|
90
|
+
/** Whether the control paints its pressed highlight now. */
|
|
91
|
+
readonly isHighlighted: boolean;
|
|
92
|
+
/** Whether a touch is being tracked. */
|
|
93
|
+
readonly isTracking: boolean;
|
|
94
|
+
/** Whether the tracked touch is inside the bounds plus the expansion. */
|
|
95
|
+
readonly isTouchInside: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* How far past its bounds a tracked touch still counts as inside, px; its
|
|
98
|
+
* hook keeps it in step with the option.
|
|
99
|
+
*/
|
|
100
|
+
trackingExpansion: number;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the control takes touches now: a disabled one gives the host no
|
|
103
|
+
* reason to listen (`spec:AST-094` FR24).
|
|
104
|
+
*/
|
|
105
|
+
isEnabled(): boolean;
|
|
106
|
+
allowsAncestorRecognizer(recognizer: unknown): boolean;
|
|
107
|
+
/** Drop any highlight and timers (the control unmounted or was disabled). */
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
|
110
|
+
/** Track a control's touches (see {@link PressTracker}). */
|
|
111
|
+
export declare function createPressTracker(options: PressTrackerOptions): PressTracker;
|
|
112
|
+
//# sourceMappingURL=PressTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PressTracker.d.ts","sourceRoot":"","sources":["../../src/gestures/PressTracker.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAEzD,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,aAAa,CAAC;AAElB,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,wBAAwB,CAAC,EAAE,CAAC,UAAU,EAAE,i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1,267 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file PressTracker.ts
|
|
5
|
+
* @input Touches the arena delivers to a pressable view (TouchConsumer)
|
|
6
|
+
* @output Exports createPressTracker and its PressTracker interface
|
|
7
|
+
* (UIControl's touch tracking, built by a factory per
|
|
8
|
+
* architecture:react-component-runtime INV13), its options, the
|
|
9
|
+
* control event type, and PRESS_PROFILES (a control's and a table cell's
|
|
10
|
+
* tracking and release clock)
|
|
11
|
+
* @position View-level consumer of packages/core/src/gestures: what a
|
|
12
|
+
* UIControl does with the touches no gesture recognizer took
|
|
13
|
+
*
|
|
14
|
+
* UIControl semantics, event for event:
|
|
15
|
+
*
|
|
16
|
+
* - `touchDown` when the finger lands; the highlight comes on in the same
|
|
17
|
+
* frame, unless the control sits in a scroller, where it waits
|
|
18
|
+
* `contentTouchDelay` (UIScrollView.delaysContentTouches) so a flick
|
|
19
|
+
* paints nothing.
|
|
20
|
+
* - `touchDragInside` / `touchDragOutside` on every move, `touchDragExit` /
|
|
21
|
+
* `touchDragEnter` when the finger crosses the control's bounds EXPANDED
|
|
22
|
+
* by `trackingExpansion` (a fingertip dragged a little off a button is
|
|
23
|
+
* still on it). The highlight follows inside / outside.
|
|
24
|
+
* - `touchUpInside` / `touchUpOutside` at the lift. A tap quicker than the
|
|
25
|
+
* scroller delay shows the highlight at the lift for `quickTapFlash`.
|
|
26
|
+
* - `touchCancel` when a recognizer took the touch (`cancelsTouchesInView`)
|
|
27
|
+
* or the browser took it to scroll: the highlight goes at once, with no
|
|
28
|
+
* release, one frame before the content moves.
|
|
29
|
+
*
|
|
30
|
+
* Two profiles (PRESS_PROFILES) cover what UIKit does:
|
|
31
|
+
*
|
|
32
|
+
* - `control` (a button, a switch): as above.
|
|
33
|
+
* - `cell` (a table or collection row): the highlight waits the
|
|
34
|
+
* content-touch delay inside a scroll view and comes on at once outside one
|
|
35
|
+
* (`spec:AST-094` FR11), travel past the pan hysteresis cancels the press
|
|
36
|
+
* for good (the scroll view took the touch), and a quicker tap highlights
|
|
37
|
+
* at the lift straight into the release, with no flash.
|
|
38
|
+
*
|
|
39
|
+
* And UIControl's iOS 6 rule: a single-finger single tap recognizer on an
|
|
40
|
+
* ANCESTOR does not beat the control's own action for a touch on it (the
|
|
41
|
+
* default veto; `vetoesAncestorRecognizer` replaces it, as a slider vetoes a
|
|
42
|
+
* pan along its track).
|
|
43
|
+
*
|
|
44
|
+
* The bounds are read once, when the finger lands; nothing reads layout
|
|
45
|
+
* during the press. Activation stays the browser's click, which the arena
|
|
46
|
+
* swallows for a touch a recognizer took.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
import { UIKIT_GESTURES } from "../motion/uikit/gestures.js";
|
|
50
|
+
import { timing } from "../motion/uikit/timing.js";
|
|
51
|
+
import { travel } from "./geometry.js";
|
|
52
|
+
const PRESS = UIKIT_GESTURES.press;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* How a kind of pressable tracks a finger and how long its release takes.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export const PRESS_PROFILES = {
|
|
59
|
+
/** UIControl: same-frame highlight outside scrollers, 70 pt tracking. */
|
|
60
|
+
control: {
|
|
61
|
+
highlightDelay: 'inScrollers',
|
|
62
|
+
quickTapFlash: PRESS.quickTapFlash.value,
|
|
63
|
+
// The shared press styles release every surface on the deselect clock
|
|
64
|
+
// until a control runs its own release (UIButton's 250 ms), so a
|
|
65
|
+
// painter's `fading` never outlasts the fade it shows.
|
|
66
|
+
releaseMs: timing.press.highlightOutMs
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* A table or collection cell: inside a scroll view it highlights after the
|
|
70
|
+
* content-touch delay, outside one at once (AST-094 FR11: the delay applies
|
|
71
|
+
* only inside scroll views); cancelled by the scroll.
|
|
72
|
+
*/
|
|
73
|
+
cell: {
|
|
74
|
+
highlightDelay: 'inScrollers',
|
|
75
|
+
cancelTravel: UIKIT_GESTURES.pan.hysteresis.value,
|
|
76
|
+
quickTapFlash: 0,
|
|
77
|
+
releaseMs: timing.press.highlightOutMs
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* UIButton's rule, the tracker's default ancestor veto: an ancestor's
|
|
82
|
+
* single-finger single tap. A tap is told apart by its `kind`
|
|
83
|
+
* (`architecture:react-component-runtime` INV13).
|
|
84
|
+
*/
|
|
85
|
+
export function vetoesSingleTap(recognizer) {
|
|
86
|
+
if (recognizer.kind !== 'tap') {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const tap = recognizer;
|
|
90
|
+
return tap.numberOfTapsRequired === 1 && tap.numberOfTouchesRequired === 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* A control's touch tracking, the gesture host's consumer for one element
|
|
95
|
+
* (UIControl's `beginTracking` / `continueTracking` / `endTracking`): it
|
|
96
|
+
* reports control events and the highlight. Built by
|
|
97
|
+
* {@link createPressTracker}.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/** Track a control's touches (see {@link PressTracker}). */
|
|
101
|
+
export function createPressTracker(options) {
|
|
102
|
+
let touchId = null;
|
|
103
|
+
let bounds = null;
|
|
104
|
+
let highlightTimer = null;
|
|
105
|
+
let flashTimer = null;
|
|
106
|
+
/** A pending highlight whose finger travelled: it will never paint. */
|
|
107
|
+
let isPendingDead = false;
|
|
108
|
+
const state = {
|
|
109
|
+
isHighlighted: false,
|
|
110
|
+
isTracking: false,
|
|
111
|
+
isTouchInside: false
|
|
112
|
+
};
|
|
113
|
+
const contains = touch => {
|
|
114
|
+
if (bounds == null) {
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
const margin = tracker.trackingExpansion;
|
|
118
|
+
return touch.x >= bounds.left - margin && touch.x <= bounds.right + margin && touch.y >= bounds.top - margin && touch.y <= bounds.bottom + margin;
|
|
119
|
+
};
|
|
120
|
+
const emit = (event, touch) => {
|
|
121
|
+
options.onControlEvent?.(event, touch);
|
|
122
|
+
};
|
|
123
|
+
const setHighlighted = value => {
|
|
124
|
+
if (state.isHighlighted === value) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
state.isHighlighted = value;
|
|
128
|
+
options.onHighlightChange?.(value);
|
|
129
|
+
};
|
|
130
|
+
const clearHighlightTimer = () => {
|
|
131
|
+
if (highlightTimer != null) {
|
|
132
|
+
clearTimeout(highlightTimer);
|
|
133
|
+
highlightTimer = null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const clearFlash = () => {
|
|
137
|
+
if (flashTimer != null) {
|
|
138
|
+
clearTimeout(flashTimer);
|
|
139
|
+
flashTimer = null;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const finish = () => {
|
|
143
|
+
touchId = null;
|
|
144
|
+
state.isTracking = false;
|
|
145
|
+
state.isTouchInside = false;
|
|
146
|
+
bounds = null;
|
|
147
|
+
};
|
|
148
|
+
const touchCancelled = touch => {
|
|
149
|
+
if (touch.id !== touchId) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
clearHighlightTimer();
|
|
153
|
+
emit('touchCancel', touch);
|
|
154
|
+
setHighlighted(false);
|
|
155
|
+
finish();
|
|
156
|
+
};
|
|
157
|
+
const tracker = {
|
|
158
|
+
get isHighlighted() {
|
|
159
|
+
return state.isHighlighted;
|
|
160
|
+
},
|
|
161
|
+
get isTracking() {
|
|
162
|
+
return state.isTracking;
|
|
163
|
+
},
|
|
164
|
+
get isTouchInside() {
|
|
165
|
+
return state.isTouchInside;
|
|
166
|
+
},
|
|
167
|
+
trackingExpansion: options.trackingExpansion ?? UIKIT_GESTURES.control.trackingExpansion.value,
|
|
168
|
+
isEnabled() {
|
|
169
|
+
return options.isEnabled?.() !== false;
|
|
170
|
+
},
|
|
171
|
+
touchBegan(touch) {
|
|
172
|
+
if (touchId != null || options.isEnabled?.() === false ||
|
|
173
|
+
// The scroll brake is a finger's (`spec:AST-094` FR11, DEC-21).
|
|
174
|
+
touch.pointerType === 'touch' && options.isBraking?.(touch) === true) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
clearFlash();
|
|
178
|
+
touchId = touch.id;
|
|
179
|
+
bounds = options.getBounds();
|
|
180
|
+
state.isTracking = true;
|
|
181
|
+
state.isTouchInside = true;
|
|
182
|
+
isPendingDead = false;
|
|
183
|
+
emit('touchDown', touch);
|
|
184
|
+
const delay = options.highlightDelay ?? 'inScrollers';
|
|
185
|
+
const delays = touch.pointerType === 'touch' && (delay === 'always' || delay === 'inScrollers' && touch.scroll?.isInsideScroller === true);
|
|
186
|
+
if (delays) {
|
|
187
|
+
highlightTimer = setTimeout(() => {
|
|
188
|
+
highlightTimer = null;
|
|
189
|
+
if (state.isTouchInside) {
|
|
190
|
+
setHighlighted(true);
|
|
191
|
+
}
|
|
192
|
+
}, PRESS.contentTouchDelay.value);
|
|
193
|
+
} else {
|
|
194
|
+
setHighlighted(true);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
touchMoved(touch) {
|
|
198
|
+
if (touch.id !== touchId) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const cancelTravel = options.cancelTravel;
|
|
202
|
+
if (cancelTravel != null && travel(touch) > cancelTravel) {
|
|
203
|
+
// A cell's scroll view took the touch: the press is over.
|
|
204
|
+
touchCancelled(touch);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (highlightTimer != null && travel(touch) > PRESS.slop.value) {
|
|
208
|
+
// A finger travelling before the delay ran out is scrolling: the
|
|
209
|
+
// press it began never paints, as a flick on a list paints nothing.
|
|
210
|
+
clearTimeout(highlightTimer);
|
|
211
|
+
highlightTimer = null;
|
|
212
|
+
isPendingDead = true;
|
|
213
|
+
}
|
|
214
|
+
const inside = contains(touch);
|
|
215
|
+
if (inside !== state.isTouchInside) {
|
|
216
|
+
state.isTouchInside = inside;
|
|
217
|
+
emit(inside ? 'touchDragEnter' : 'touchDragExit', touch);
|
|
218
|
+
if (highlightTimer == null && !isPendingDead) {
|
|
219
|
+
setHighlighted(inside);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
emit(inside ? 'touchDragInside' : 'touchDragOutside', touch);
|
|
223
|
+
},
|
|
224
|
+
touchEnded(touch) {
|
|
225
|
+
if (touch.id !== touchId) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const inside = contains(touch);
|
|
229
|
+
const wasPending = highlightTimer != null;
|
|
230
|
+
clearHighlightTimer();
|
|
231
|
+
emit(inside ? 'touchUpInside' : 'touchUpOutside', touch);
|
|
232
|
+
const flash = options.quickTapFlash ?? PRESS.quickTapFlash.value;
|
|
233
|
+
if (wasPending && inside) {
|
|
234
|
+
// Quicker than the delay: the highlight shows at the lift, for the
|
|
235
|
+
// flash, or (a cell) straight into the release.
|
|
236
|
+
setHighlighted(true);
|
|
237
|
+
if (flash > 0) {
|
|
238
|
+
flashTimer = setTimeout(() => {
|
|
239
|
+
flashTimer = null;
|
|
240
|
+
setHighlighted(false);
|
|
241
|
+
}, flash);
|
|
242
|
+
} else {
|
|
243
|
+
setHighlighted(false);
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
setHighlighted(false);
|
|
247
|
+
}
|
|
248
|
+
finish();
|
|
249
|
+
},
|
|
250
|
+
touchCancelled,
|
|
251
|
+
allowsAncestorRecognizer(recognizer) {
|
|
252
|
+
const candidate = recognizer;
|
|
253
|
+
if (candidate.view != null && candidate.view === options.view) {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
const vetoes = options.vetoesAncestorRecognizer ?? vetoesSingleTap;
|
|
257
|
+
return !vetoes(candidate);
|
|
258
|
+
},
|
|
259
|
+
dispose() {
|
|
260
|
+
clearHighlightTimer();
|
|
261
|
+
clearFlash();
|
|
262
|
+
setHighlighted(false);
|
|
263
|
+
finish();
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
return tracker;
|
|
267
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @input The modules of packages/core/src/gestures
|
|
4
|
+
* @output Re-exports the gesture system for core's own components
|
|
5
|
+
* @position Core's own barrel. Not exported from the package.
|
|
6
|
+
*/
|
|
7
|
+
export { GestureArena, browserClock } from './GestureArena.js';
|
|
8
|
+
export type { ArenaBeganInput, ClickDisposition, GestureArenaOptions, GestureClock, } from './GestureArena.js';
|
|
9
|
+
export { GestureHost, getGestureHost } from './GestureHost.js';
|
|
10
|
+
export type { AttachOptions, GestureHostOptions } from './GestureHost.js';
|
|
11
|
+
export { GestureRecognizer, isActive, isTerminal, isTransitionAllowed, } from './GestureRecognizer.js';
|
|
12
|
+
export type { GestureListener, GestureRecognizerOptions, GestureTransitionListener, NativeTouchBehavior, } from './GestureRecognizer.js';
|
|
13
|
+
export { attachTapHaptic, canVibrate, playHaptic, supportsSwitchControl, } from './haptics.js';
|
|
14
|
+
export { LongPressGestureRecognizer } from './LongPressGestureRecognizer.js';
|
|
15
|
+
export type { LongPressGestureRecognizerOptions } from './LongPressGestureRecognizer.js';
|
|
16
|
+
export { createNativeScrollProbe, parseTouchAction } from './nativeScroll.js';
|
|
17
|
+
export { PanGestureRecognizer } from './PanGestureRecognizer.js';
|
|
18
|
+
export type { PanDirection, PanGestureRecognizerOptions, } from './PanGestureRecognizer.js';
|
|
19
|
+
export { PinchGestureRecognizer } from './PinchGestureRecognizer.js';
|
|
20
|
+
export type { PinchGestureRecognizerOptions } from './PinchGestureRecognizer.js';
|
|
21
|
+
export { PRESS_PROFILES, createPressTracker } from './PressTracker.js';
|
|
22
|
+
export type { ControlEvent, PressBounds, PressHighlightDelay, PressProfile, PressProfileName, PressTracker, PressTrackerOptions, } from './PressTracker.js';
|
|
23
|
+
export { ScreenEdgePanGestureRecognizer } from './ScreenEdgePanGestureRecognizer.js';
|
|
24
|
+
export type { ScreenEdge, ScreenEdgePanGestureRecognizerOptions, } from './ScreenEdgePanGestureRecognizer.js';
|
|
25
|
+
export { SwipeGestureRecognizer } from './SwipeGestureRecognizer.js';
|
|
26
|
+
export type { SwipeDirection, SwipeGestureRecognizerOptions, } from './SwipeGestureRecognizer.js';
|
|
27
|
+
export { TapGestureRecognizer } from './TapGestureRecognizer.js';
|
|
28
|
+
export type { TapGestureRecognizerOptions } from './TapGestureRecognizer.js';
|
|
29
|
+
export { deriveTouchAction, gestureHostStyle } from './touchAction.js';
|
|
30
|
+
export type { GestureHostStyle } from './touchAction.js';
|
|
31
|
+
export type * from './types.js';
|
|
32
|
+
export { DEFAULT_ENVIRONMENT } from './types.js';
|
|
33
|
+
export { useGestureRecognizer, usePressTracker } from './useGestureRecognizer.js';
|
|
34
|
+
export type { UseGestureRecognizerOptions, UsePressTrackerOptions, } from './useGestureRecognizer.js';
|
|
35
|
+
export { VelocityTracker } from './VelocityTracker.js';
|
|
36
|
+
export type { VelocityTrackerOptions } from './VelocityTracker.js';
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gestures/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC1D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM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OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAC7E,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAC,sBAAsB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file index.ts
|
|
5
|
+
* @input The modules of packages/core/src/gestures
|
|
6
|
+
* @output Re-exports the gesture system for core's own components
|
|
7
|
+
* @position Core's own barrel. Not exported from the package.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { GestureArena, browserClock } from "./GestureArena.js";
|
|
11
|
+
export { GestureHost, getGestureHost } from "./GestureHost.js";
|
|
12
|
+
export { GestureRecognizer, isActive, isTerminal, isTransitionAllowed } from "./GestureRecognizer.js";
|
|
13
|
+
export { attachTapHaptic, canVibrate, playHaptic, supportsSwitchControl } from "./haptics.js";
|
|
14
|
+
export { LongPressGestureRecognizer } from "./LongPressGestureRecognizer.js";
|
|
15
|
+
export { createNativeScrollProbe, parseTouchAction } from "./nativeScroll.js";
|
|
16
|
+
export { PanGestureRecognizer } from "./PanGestureRecognizer.js";
|
|
17
|
+
export { PinchGestureRecognizer } from "./PinchGestureRecognizer.js";
|
|
18
|
+
export { PRESS_PROFILES, createPressTracker } from "./PressTracker.js";
|
|
19
|
+
export { ScreenEdgePanGestureRecognizer } from "./ScreenEdgePanGestureRecognizer.js";
|
|
20
|
+
export { SwipeGestureRecognizer } from "./SwipeGestureRecognizer.js";
|
|
21
|
+
export { TapGestureRecognizer } from "./TapGestureRecognizer.js";
|
|
22
|
+
export { deriveTouchAction, gestureHostStyle } from "./touchAction.js";
|
|
23
|
+
export { DEFAULT_ENVIRONMENT } from "./types.js";
|
|
24
|
+
export { useGestureRecognizer, usePressTracker } from "./useGestureRecognizer.js";
|
|
25
|
+
export { VelocityTracker } from "./VelocityTracker.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useGestureRecognizer.ts
|
|
3
|
+
* @input An element ref, a recognizer factory and a gesture listener; or an
|
|
4
|
+
* element ref and press tracker options
|
|
5
|
+
* @output Exports useGestureRecognizer and usePressTracker
|
|
6
|
+
* @position React face of packages/core/src/gestures
|
|
7
|
+
*
|
|
8
|
+
* The recognizer is created once and keeps its identity for the life of the
|
|
9
|
+
* component, so relationships set up at creation (`requireToFail`,
|
|
10
|
+
* `recognizeSimultaneouslyWith`) hold. The listener is read through a ref:
|
|
11
|
+
* passing a new function each render re-attaches nothing, and a gesture
|
|
12
|
+
* costs no React render at all — the listener runs inside the input event
|
|
13
|
+
* and writes to the DOM itself. The recognizer attaches in a layout effect,
|
|
14
|
+
* so its `touch-action` is in place before the browser can see a finger.
|
|
15
|
+
*
|
|
16
|
+
* SYNC: When modified, update useGestureRecognizer.test.tsx and README.md.
|
|
17
|
+
*/
|
|
18
|
+
import { type RefObject } from 'react';
|
|
19
|
+
import type { GestureRecognizer } from './GestureRecognizer.js';
|
|
20
|
+
import { type PressTracker, type PressTrackerOptions } from './PressTracker.js';
|
|
21
|
+
export interface UseGestureRecognizerOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Live toggle; turning it off mid-gesture cancels the gesture. That cancel
|
|
24
|
+
* does not call `onGesture`: it comes from the render that turned the
|
|
25
|
+
* recognizer off, and the code that turned it off already knows.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
isEnabled?: boolean;
|
|
29
|
+
/** Let the host set touch-action (and long-press callout) styles. @default true */
|
|
30
|
+
manageStyle?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Attach a recognizer to the element behind `ref`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* const pan = useGestureRecognizer(
|
|
38
|
+
* ref,
|
|
39
|
+
* () => new PanGestureRecognizer({direction: 'vertical'}),
|
|
40
|
+
* recognizer => {
|
|
41
|
+
* ref.current.style.transform = `translateY(${recognizer.translation().y}px)`;
|
|
42
|
+
* },
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function useGestureRecognizer<R extends GestureRecognizer>(ref: RefObject<Element | null>, create: () => R, onGesture?: (recognizer: R) => void, options?: UseGestureRecognizerOptions): R;
|
|
47
|
+
export type UsePressTrackerOptions = Omit<PressTrackerOptions, 'getBounds' | 'view'>;
|
|
48
|
+
/**
|
|
49
|
+
* Track presses on the element behind `ref` with UIControl semantics. The
|
|
50
|
+
* callbacks are read through a ref, like a recognizer's listener. Releasing
|
|
51
|
+
* the element (unmount, or a replaced node) ends any press without calling
|
|
52
|
+
* them: that release runs in an Effect, which never calls a caller's
|
|
53
|
+
* callback (react-component-runtime INV2, INV3).
|
|
54
|
+
*/
|
|
55
|
+
export declare function usePressTracker(ref: RefObject<Element | null>, options?: UsePressTrackerOptions): PressTracker;
|
|
56
|
+
//# sourceMappingURL=useGestureRecognizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGestureRecognizer.d.ts","sourceRoot":"","sources":["../../src/gestures/useGestureRecognizer.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAuC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG3E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mFAAmF;IACnF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA2CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,EAC9D,GAAG,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAC9B,MAAM,EAAE,MAAM,CAAC,EACf,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,IAAI,EACnC,OAAO,GAAE,2BAAgC,GACxC,CAAC,CAqDH;AAED,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,mBAAmB,EACnB,WAAW,GAAG,MAAM,CACrB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC,EAC9B,OAAO,GAAE,sBAA2B,GACnC,YAAY,CAqFd"}
|