@astryx-vue/core 0.42.1 → 0.42.3
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/index.js +1 -1
- package/dist/{AlertDialog-Cld8wc2u.js → AlertDialog-sk5DEUX7.js} +6 -6
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-Y-rwHGxA.js → AppShell-CLi6skwa.js} +4 -4
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-z50mYJor.js → Avatar-BQz-P6TD.js} +1 -1
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-CU1zqtTi.js → AvatarGroup-BvJTbvr_.js} +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-5KOS4fe8.js → Banner-CW4g5z40.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.js +2 -2
- package/dist/{BottomSheet-u57AJshc.js → BottomSheet-DRimCV1O.js} +1 -1
- package/dist/{BottomSheet-B8frtWqm.js → BottomSheet-q49-srZ5.js} +8 -8
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-aups8a9Y.js → Breadcrumbs-CzEe4fKS.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-tVILPfaj.js → Button-CTVXQgV3.js} +4 -4
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-D7p8oEry.js → ButtonGroup-CknFA9IA.js} +2 -2
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-DlHeba5J.js → Carousel-B0ZOSlPH.js} +1 -1
- package/dist/Center/index.d.ts +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-B54dCjhV.js → Chat-DqwHn6hi.js} +5 -5
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-BhKf3JOh.js → CheckboxInput-ChbqO3Hp.js} +4 -4
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem-BhLPvY5v.js → CheckboxListItem-3y4ehVhz.js} +5 -5
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/ClickableCard/index.js +1 -1
- package/dist/{ClickableCard-DyBa2X4I.js → ClickableCard-Dkt25nJP.js} +1 -1
- package/dist/Code/index.js +2 -2
- package/dist/{Code-BtJV5J-h.js → Code-CXHaEk36.js} +1 -1
- package/dist/{CodeBlock-D1i3lEK3.js → CodeBlock-BGaaySc8.js} +2 -2
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-CXbcOn80.js → Collapsible-DqEriJMb.js} +2 -2
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-DyjB9xE_.js → CommandPalette-CIpvefL3.js} +3 -3
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-MRuOupEd.js → ComplexSelector-CipXIUa4.js} +2 -2
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-Bb8ALZmI.js → ContextMenu-F315dVbZ.js} +5 -5
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-DNWMgvU1.js → DateInput-D0TJlbEE.js} +5 -5
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-B8ZWK6sm.js → DateRangeInput-CcNQTdtg.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput--BzV0yww.js → DateTimeInput-BjtzVqV5.js} +5 -5
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-CjN3cV-b.js → Dialog-6rKG9kce.js} +1 -1
- package/dist/{Dialog-B2-5xYs2.js → Dialog-CEbICn0m.js} +2 -2
- package/dist/{DialogHeader-B4cnOihd.js → DialogHeader-rLh39zHH.js} +2 -2
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-dk9etcN3.js → Drawer-Dw1wyfvQ.js} +3 -3
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-DUGWNcnG.js → DropdownMenu-B6lOBGrw.js} +7 -7
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-uHOykbeo.js → EmptyState-DOMOEsvj.js} +2 -2
- package/dist/Field/index.js +3 -3
- package/dist/{Field-B_GThk2X.js → Field-DJGFZuwh.js} +1 -1
- package/dist/{FieldInfoTip-jhm02XZs.js → FieldInfoTip-l_ke1Zlh.js} +1 -1
- package/dist/{FieldLabel-C0XDwWCd.js → FieldLabel-BZiHqHsQ.js} +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-CbXrw3RO.js → FileInput-BOT35CQc.js} +3 -3
- package/dist/{GestureHost-DXCQkur5.js → GestureHost-CRgadcBb.js} +1 -1
- package/dist/Heading/index.js +1 -1
- package/dist/{Heading-BFJhZInd.js → Heading-CsSZgiqn.js} +1 -1
- package/dist/HoverCard/index.js +1 -1
- package/dist/{HoverCard-Cbxy2KEM.js → HoverCard-BmehvS0D.js} +4 -4
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-CU1kvO7X.js → IconButton-89mASa8g.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-BwxUx7Hk.js → InfoTip-B_7kJX7x.js} +2 -2
- package/dist/{InputClearButton-CN8J7JOl.js → InputClearButton-BC1ytQT5.js} +1 -1
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-Ca-SOzyp.js → InputGroup-M3mSe3lV.js} +1 -1
- package/dist/{Item-D8Ads8bS.js → Item-DznHXYbG.js} +7 -7
- package/dist/{LayerContentBoundary-tgsCvoNX.js → LayerContentBoundary-CMjCvF35.js} +1 -1
- package/dist/Layout/index.js +2 -2
- package/dist/{Layout-C7oS06UY.js → Layout-DdsbcT6Z.js} +1 -1
- package/dist/{LayoutPanel-BwvUhSM5.js → LayoutPanel-0yi1xept.js} +3 -3
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-CkxNUYwN.js → Lightbox-TatgdqWu.js} +13 -12
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-B5CJso43.js → Link-5KuMIFYl.js} +2 -2
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.js +4 -4
- package/dist/{List-KQNWaT-8.js → List-BVpWTW6J.js} +2 -2
- package/dist/{ListItem-C4BtWXV4.js → ListItem-BzOD8HbS.js} +3 -3
- package/dist/LongPressGestureRecognizer-C1JQQdg-.js +111 -0
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-BFV7g8oa.js → Markdown-qm8WwwjD.js} +3 -3
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-VB6SzHYo.js → MobileNavToggle-DYKJC6X6.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-D0HoYZU0.js → MoreMenu-CsPdGjuE.js} +6 -6
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-BLESAk-K.js → MultiSelector-BBetuRV7.js} +5 -5
- package/dist/{NavDisclosure-tEaEwaA0.js → NavDisclosure-D-vUD3Bl.js} +1 -1
- package/dist/{NavHeadingSurface-CwSYyXFb.js → NavHeadingSurface-D2UWKpSw.js} +1 -1
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavItem/index.js +1 -1
- package/dist/{NavItem-BR639emm.js → NavItem-BY24W2B0.js} +1 -1
- package/dist/NavMenu/index.js +3 -3
- package/dist/{NavMenu-CqhjkZuz.js → NavMenu-DF4JqIed.js} +2 -2
- package/dist/{NavMenuItem-C9e62bSc.js → NavMenuItem-CGGECLdG.js} +3 -3
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-C7cRBlQm.js → NumberInput-BuQf0mvj.js} +4 -4
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-BcZMmO9Y.js → Outline-CCnTR9Pe.js} +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-cjl0AaEP.js → OverflowList-uk0l80Zd.js} +2 -2
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BnA277o8.js → Pagination-9ZlklMvN.js} +2 -2
- package/dist/{PanGestureRecognizer-KxZE-pUT.js → PanGestureRecognizer-_yCWSqMD.js} +3 -3
- package/dist/{PickerWheel-YgYMcbJF.js → PickerWheel-DJqK1f2w.js} +10 -10
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-DfO-mkcm.js → Popover-BXB3DaAJ.js} +5 -5
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-BjAYndzP.js → PowerSearch-BHs855Bg.js} +26 -26
- package/dist/{PressTracker-C8_fTdjp.js → PressTracker-B_ffL9rM.js} +1 -1
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-D4br-4_x.js → ProgressBar-Otv4DLQP.js} +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-CVOlUPbf.js → RadioGroup-BYZ9mspa.js} +5 -5
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-5y613Xrt.js → RadioListItem-BjiT8DAp.js} +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{ResizeHandle-C7xEokaQ.js → ResizeHandle-Ch18ZZOk.js} +2 -2
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/ScrollableArea/index.js +1 -1
- package/dist/{ScrollableArea-Cflez3d4.js → ScrollableArea-CJsSDN45.js} +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-D32lkJFq.js → SegmentedControl-DgZ2y1ff.js} +7 -7
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/SelectableCard/index.js +1 -1
- package/dist/{SelectableCard-C2hl7HBW.js → SelectableCard-dUjsGX2o.js} +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-Dw_0e0zY.js → Selector-DERRZ5Hh.js} +3 -3
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-dsff7R2R.js → SideNav-D-ubf-w7.js} +8 -8
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-CUgeJ1z4.js → Slider-BrZeUJJF.js} +10 -10
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stack/index.js +1 -1
- package/dist/{Stack-Byxur1jV.js → Stack-Bj3MyHVh.js} +1 -1
- package/dist/StatusDot/index.js +1 -1
- package/dist/{StatusDot-arRs8rKk.js → StatusDot-Ce31aeru.js} +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-BYZasZK7.js → Stepper-BL01wjk9.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-BtcR2oin.js → Switch-MeieW4dP.js} +9 -9
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-O34fxJlZ.js → TabList-XKIbMcy5.js} +3 -3
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-BrvIqSdi.js → Table-DCUCpmv8.js} +11 -11
- package/dist/{TapGestureRecognizer-o0LVjFFm.js → TapGestureRecognizer-CH88amVE.js} +3 -3
- package/dist/Text/index.js +1 -1
- package/dist/{Text-DHm9r3Yh.js → Text-BLPg6wdX.js} +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-TO_A1D_W.js → TextArea-DilGjhXe.js} +5 -5
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-jIBboBDS.js → TextInput-Dd0BHZ5n.js} +5 -5
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-CRltyNsq.js → Thumbnail-CdAR7gMc.js} +3 -3
- package/dist/{TimeField-DBKAGPKU.js → TimeField-6UCe0-g2.js} +4 -4
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-CEUlNlhY.js → TimeInput-qDkdX2tw.js} +2 -2
- package/dist/Timer/index.js +1 -1
- package/dist/{Timer-zNCSMU7S.js → Timer-i3ujG9pH.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-s4Nksy5i.js → Timestamp-Di_Ge164.js} +3 -3
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-BsW7tvzK.js → Toast-BHbQcMjq.js} +3 -3
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-DZgHhJd7.js → ToggleButton-D5OyWtXD.js} +3 -3
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-B6mV8hyk.js → Token-BYl3tF1p.js} +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-BvCiuyhk.js → Tokenizer-DiekBXC-.js} +13 -13
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/{Tooltip-BuPbbGtv.js → Tooltip-CFQrHG0a.js} +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-xKD14HTR.js → TopNav-Bvjt444e.js} +5 -5
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-BOr0GpJC.js → TreeList-Db0dqCd9.js} +1 -1
- package/dist/Typeahead/index.js +2 -2
- package/dist/{Typeahead-C18-lx2P.js → Typeahead-oPhwt4z4.js} +5 -5
- package/dist/{VelocityTracker-D5wT6A0d.js → VelocityTracker-Cw1aVRnL.js} +1 -1
- package/dist/{accessibleName-Br2Ex6ub.js → accessibleName-BVk1Rzrl.js} +1 -1
- package/dist/{boxHold-BCbXt9_d.js → boxHold-DNjO01uo.js} +1 -1
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/index.js +10 -10
- package/dist/{composables-BTTLiP-q.js → composables-BOeRkIEw.js} +12 -11
- package/dist/{decay-CUtQFEXK.js → decay-ClFADeqT.js} +1 -1
- package/dist/{focusLeaving-BbZ69DYV.js → focusLeaving-Df0Dqr5v.js} +1 -1
- package/dist/{gestures-D_ih8YYG.js → gestures-BpGkqgpV.js} +1 -1
- package/dist/{haptics-BPQp81pc.js → haptics-DaX2u-jB.js} +1 -1
- package/dist/{index-CArP_6wv.d.ts → index-0RIgvtdm.d.ts} +1 -1
- package/dist/{index-WqOwd8r8.d.ts → index-B7vE2Dx8.d.ts} +2 -2
- package/dist/{index-D7ShT2c-.d.ts → index-BB9acgK8.d.ts} +2 -2
- package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
- package/dist/{index-ChHpLHhd.d.ts → index-BXvmomsn.d.ts} +41 -41
- package/dist/{index-maTGrWjF.d.ts → index-BenG-F5d.d.ts} +1 -1
- package/dist/{index-zjungCKE.d.ts → index-C0IsP4GS.d.ts} +4 -4
- package/dist/{index-MiZ3p4b6.d.ts → index-C3DG2coR.d.ts} +6 -6
- package/dist/{index-mK1ICsVg.d.ts → index-C3JmGujU.d.ts} +1 -1
- package/dist/{index-m-fFGq2e.d.ts → index-CCa_dvoF.d.ts} +2 -2
- package/dist/{index-BzaRSOA3.d.ts → index-CLbslOVk.d.ts} +1 -7
- package/dist/{index-CdvmnNMH.d.ts → index-COgrQZIL.d.ts} +1 -1
- package/dist/{index-MOtVbTwK.d.ts → index-CuW4AQ7M.d.ts} +2 -2
- package/dist/{index-HzXA230A.d.ts → index-CyNP_83A.d.ts} +2 -2
- package/dist/{index-J83fLEyo.d.ts → index-DgNCHxvu.d.ts} +2 -2
- package/dist/{index-3LdpzxQZ.d.ts → index-ZKBj_1nu.d.ts} +2 -2
- package/dist/{index-DwUUuRyC.d.ts → index-ZtHb6soN.d.ts} +2 -62
- package/dist/index.d.ts +19 -18
- package/dist/index.js +106 -105
- package/dist/internal/touch.d.ts +3591 -0
- package/dist/internal/touch.js +234 -0
- package/dist/{itemSlots-DA-FyuMF.js → itemSlots-CIQbrKkZ.js} +4 -4
- package/dist/{layerDepth-D576XVps.js → layerDepth-DxI-GE81.js} +1 -1
- package/dist/{lazyBottomSheet-gQtGKE8w.js → lazyBottomSheet-BfDsDl4w.js} +1 -1
- package/dist/{position-DD8UQJ2A.js → position--G96FPl4.js} +1 -1
- package/dist/{pressGesture-CwmZDuSC.js → pressGesture-VrM5-7aV.js} +1 -1
- package/dist/{pressSlot-31XyOhUS.js → pressSlot-DIN1AmiA.js} +1 -1
- package/dist/{projection-Ccz44WX4.js → projection-BafBD5NP.js} +1 -1
- package/dist/{resizableChannel-CABtOiJL.js → resizableChannel-C9UA4vam.js} +1 -1
- package/dist/{resolveSnapPoint-C7GZY6jT.js → resolveSnapPoint-Cm2KePTm.js} +1 -1
- package/dist/{rideKeyboard-BldiTgxS.js → rideKeyboard-SnVXHPCp.js} +1 -1
- package/dist/{rubberBand-Ct9HFML5.js → rubberBand-CE3LYEUx.js} +1 -1
- package/dist/scrollGeometry-CJXEydlQ.d.ts +21 -0
- package/dist/{scrollGeometry-ivD7aoBo.js → scrollGeometry-ajfQQRJt.js} +9 -1
- package/dist/{scrollKeyboardDelegation-DZ4t5PvC.js → scrollKeyboardDelegation-COtRAAWq.js} +1 -1
- package/dist/sharedResizeObserver-DojOEX9E.d.ts +62 -0
- package/dist/{snapPagingCatcher-BA7qwhj3.js → snapPagingCatcher-DUb8YU3G.js} +4 -112
- package/dist/{springs-B5hVbZta.js → springs-BqW2WrS-.js} +1 -1
- package/dist/{stillPointerGate-CCFCP1uz.js → stillPointerGate-D15jGSjP.js} +1 -1
- package/dist/{tooltipFocusRules-CfJwTrhE.js → tooltipFocusRules-D468Tl5q.js} +2 -2
- package/dist/{tooltipTriggerRules-DRhcB-wA.js → tooltipTriggerRules-BjnT3wIz.js} +1 -1
- package/dist/{useActionGroupTracking-CioHSqgG.js → useActionGroupTracking-CGikRIWR.js} +3 -3
- package/dist/{useDismiss-Dq7HNw2m.js → useDismiss-ChlwPVfw.js} +1 -1
- package/dist/{utils-DkwunocO.js → useFingerScroll-DO4LVzDf.js} +2 -136
- package/dist/{useGestureRecognizer-BSy0RhLT.js → useGestureRecognizer-CozA1twZ.js} +1 -1
- package/dist/{useInputStatusIcon-D0xNp9jO.js → useInputStatusIcon-CNYJtEbA.js} +1 -1
- package/dist/{useMenuPress-B2Zt5xc5.js → useMenuPress-CARtL4Wa.js} +1 -1
- package/dist/{useMobileKeyboard-CN6o0BrJ.js → useMobileKeyboard-DcvMptTe.js} +2 -2
- package/dist/{usePressFeedback-D4oohqP5.js → usePressFeedback-DkWA1son.js} +3 -3
- package/dist/{useResizable-Dme0X_ZM.js → useResizable-mkUwYfmy.js} +4 -4
- package/dist/{useScrollRegionProps-DwkPUb-O.js → useScrollRegionProps-D5fMvdfn.js} +1 -1
- package/dist/{useScrollableArea-BaHkGWbX.js → useScrollableArea-i2X5vvTv.js} +2 -2
- package/dist/{useTooltip-Dg2459oV.js → useTooltip-CdD6ivAv.js} +4 -4
- package/dist/{useTouchHitArea-rwyNMxFb.js → useTouchHitArea-CxqNaIyt.js} +1 -1
- package/dist/{useTouchTriggerInternal-DZ_e8l4G.js → useTouchTriggerInternal-B9YsuMRa.js} +1 -1
- package/dist/{useTruncationTooltip-CCVsMc8c.js → useTruncationTooltip-C37kvtXu.js} +3 -3
- package/dist/{useTypeaheadMenuConfig-CKEuRCOZ.js → useTypeaheadMenuConfig-DHX88vqs.js} +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils-BW62BpDR.js +135 -0
- package/package.json +5 -1
- package/dist/{index-J6YRJ7Ul.d.ts → index-5FGt4HsB.d.ts} +1 -1
|
@@ -0,0 +1,3591 @@
|
|
|
1
|
+
import { r as measureLogicalScrollAxis, t as LogicalAxisMapping } from "../scrollGeometry-CJXEydlQ.js";
|
|
2
|
+
import { i as useFingerScroll, r as UseFingerScrollOptions, t as observeResize } from "../sharedResizeObserver-DojOEX9E.js";
|
|
3
|
+
import { MaybeRefOrGetter } from "vue";
|
|
4
|
+
//#region src/motion/springParameters.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A spring, in Core Animation's physical vocabulary. Every other way of
|
|
7
|
+
* describing a spring converts to this one.
|
|
8
|
+
*/
|
|
9
|
+
interface Spring {
|
|
10
|
+
/** Mass m of the attached object (`CASpringAnimation.mass`). */
|
|
11
|
+
readonly mass: number;
|
|
12
|
+
/** Stiffness k (`CASpringAnimation.stiffness`). */
|
|
13
|
+
readonly stiffness: number;
|
|
14
|
+
/** Viscous damping coefficient c (`CASpringAnimation.damping`). */
|
|
15
|
+
readonly damping: number;
|
|
16
|
+
}
|
|
17
|
+
/** SwiftUI's two-parameter description: `Spring(duration:bounce:)`. */
|
|
18
|
+
interface DurationBounce {
|
|
19
|
+
/**
|
|
20
|
+
* Perceptual duration in seconds: the period of the undamped spring, "the
|
|
21
|
+
* pace of the spring".
|
|
22
|
+
*/
|
|
23
|
+
readonly duration: number;
|
|
24
|
+
/**
|
|
25
|
+
* 0 is critically damped (no overshoot), up to 1 (undamped oscillation);
|
|
26
|
+
* negative values, down to −1, are overdamped ("flattened") springs.
|
|
27
|
+
*/
|
|
28
|
+
readonly bounce: number;
|
|
29
|
+
}
|
|
30
|
+
/** WWDC18's design-friendly description: response and damping ratio. */
|
|
31
|
+
interface ResponseDamping {
|
|
32
|
+
/** Period of the undamped spring in seconds. */
|
|
33
|
+
readonly response: number;
|
|
34
|
+
/**
|
|
35
|
+
* Damping as a fraction of critical damping (SwiftUI's `dampingFraction`):
|
|
36
|
+
* 1 settles without overshoot, values toward 0 oscillate longer.
|
|
37
|
+
*/
|
|
38
|
+
readonly dampingRatio: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A spring in any of the vocabularies the constants table uses: physical
|
|
42
|
+
* (mass, stiffness, damping), SwiftUI (duration, bounce) or WWDC18
|
|
43
|
+
* (response, dampingRatio). Tables keep the vocabulary of their source so a
|
|
44
|
+
* value reads exactly as it was published.
|
|
45
|
+
*/
|
|
46
|
+
type SpringDescription = {
|
|
47
|
+
readonly mass?: number;
|
|
48
|
+
readonly stiffness: number;
|
|
49
|
+
readonly damping: number;
|
|
50
|
+
} | DurationBounce | ResponseDamping;
|
|
51
|
+
/**
|
|
52
|
+
* Normalizes a description to the physical `Spring`. A physical description
|
|
53
|
+
* gets `springFromPhysics`' treatment: overdamping is clamped to critical, as
|
|
54
|
+
* SwiftUI and Core Animation do by default.
|
|
55
|
+
*/
|
|
56
|
+
export declare function toSpring(description: SpringDescription): Spring;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/motion/spring.d.ts
|
|
59
|
+
/** A spring released from a value with a velocity, heading for a target. */
|
|
60
|
+
interface SpringCurve {
|
|
61
|
+
readonly spring: Spring;
|
|
62
|
+
readonly from: number;
|
|
63
|
+
readonly to: number;
|
|
64
|
+
/** Initial velocity, units/s. */
|
|
65
|
+
readonly initialVelocity: number;
|
|
66
|
+
/** Value at `t` seconds after release. */
|
|
67
|
+
value: (t: number) => number;
|
|
68
|
+
/** Velocity at `t` seconds after release, units/s. */
|
|
69
|
+
velocity: (t: number) => number;
|
|
70
|
+
/**
|
|
71
|
+
* The time after which |value(t) − to| stays below `threshold` (in the
|
|
72
|
+
* value's own units) for good: the envelope bound used by
|
|
73
|
+
* `settlingDuration`, applied in absolute units. 0 when already within.
|
|
74
|
+
* Infinity for an undamped spring that is displaced or moving.
|
|
75
|
+
*/
|
|
76
|
+
settleTime: (threshold: number) => number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Closed-form solution of the spring released at `from` with
|
|
80
|
+
* `initialVelocity` (units/s), heading for `to`.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```
|
|
84
|
+
* const curve = solveSpring(springFromDurationBounce({duration: 0.5, bounce: 0}), {from: 0, to: 300});
|
|
85
|
+
* curve.value(0.1); // px after 100 ms
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function solveSpring(spring: Spring, { from, to, velocity: initialVelocity }: {
|
|
89
|
+
from: number;
|
|
90
|
+
to: number;
|
|
91
|
+
velocity?: number;
|
|
92
|
+
}): SpringCurve;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/gestures/types.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* UIGestureRecognizer.State. A discrete recognizer goes straight from
|
|
97
|
+
* `possible` to `ended` (UIKit's `.recognized` is the same value).
|
|
98
|
+
*/
|
|
99
|
+
type GestureState = 'possible' | 'began' | 'changed' | 'ended' | 'cancelled' | 'failed';
|
|
100
|
+
/** What made the contact. A pen on an iPad is `pen`, not `touch`. */
|
|
101
|
+
type PointerKind = 'touch' | 'mouse' | 'pen';
|
|
102
|
+
/**
|
|
103
|
+
* Scroll input a recognizer can take, as UIKit's `UIScrollTypeMask`: a
|
|
104
|
+
* trackpad's two-finger scroll or pinch (`continuous`), or a mouse wheel's
|
|
105
|
+
* notches (`discrete`). A pan takes only a trackpad's; a pinch takes a
|
|
106
|
+
* ctrl-wheel of either.
|
|
107
|
+
*/
|
|
108
|
+
type ScrollType = 'continuous' | 'discrete';
|
|
109
|
+
interface Point {
|
|
110
|
+
readonly x: number;
|
|
111
|
+
readonly y: number;
|
|
112
|
+
}
|
|
113
|
+
/** One position of a contact at one instant, in client (viewport) CSS px. */
|
|
114
|
+
interface TouchSample {
|
|
115
|
+
readonly x: number;
|
|
116
|
+
readonly y: number;
|
|
117
|
+
/** Milliseconds on the `performance.now()` clock (an event's `timeStamp`). */
|
|
118
|
+
readonly time: number;
|
|
119
|
+
}
|
|
120
|
+
type TouchPhase = 'began' | 'moved' | 'ended' | 'cancelled';
|
|
121
|
+
/**
|
|
122
|
+
* The scrollers between a touch and the page, as the host sees them: enough
|
|
123
|
+
* for a recognizer to ask whether the browser would scroll something if the
|
|
124
|
+
* finger moved one way, without the recognizer touching the DOM.
|
|
125
|
+
*/
|
|
126
|
+
interface NativeScrollProbe {
|
|
127
|
+
/**
|
|
128
|
+
* Whether a finger moving by (dx, dy) would scroll some element under the
|
|
129
|
+
* touch (one that has room left in that direction and whose `touch-action`
|
|
130
|
+
* lets the browser pan that axis).
|
|
131
|
+
*/
|
|
132
|
+
canScroll: (dx: number, dy: number) => boolean;
|
|
133
|
+
/** Whether any element under the touch can scroll natively at all. */
|
|
134
|
+
readonly isInsideScroller: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether `touch-action` from the touch target to the page lets the
|
|
137
|
+
* browser pan at all: when it does not, the browser cannot have taken the
|
|
138
|
+
* touch for a scroll, whatever its events say.
|
|
139
|
+
*/
|
|
140
|
+
readonly allowsNativePan: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* One contact: UITouch. The arena owns it and updates it in place; a
|
|
144
|
+
* recognizer keeps a reference to every touch it receives.
|
|
145
|
+
*/
|
|
146
|
+
interface GestureTouch {
|
|
147
|
+
/** Unique among the contacts the arena tracks at once. */
|
|
148
|
+
readonly id: number;
|
|
149
|
+
readonly pointerType: PointerKind;
|
|
150
|
+
phase: TouchPhase;
|
|
151
|
+
/** Latest position, client CSS px. */
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
/** Timestamp of the latest position. */
|
|
155
|
+
time: number;
|
|
156
|
+
readonly startX: number;
|
|
157
|
+
readonly startY: number;
|
|
158
|
+
readonly startTime: number;
|
|
159
|
+
/**
|
|
160
|
+
* Positions since the previous event, oldest first, ending with the
|
|
161
|
+
* current one (coalesced samples where the platform has them). Velocity
|
|
162
|
+
* trackers read these; actions fire once per event.
|
|
163
|
+
*/
|
|
164
|
+
samples: TouchSample[];
|
|
165
|
+
/** The node the contact began on. Opaque to the arena. */
|
|
166
|
+
readonly target: unknown;
|
|
167
|
+
/** The native scrollers under the contact, when the host knows them. */
|
|
168
|
+
readonly scroll: NativeScrollProbe | null;
|
|
169
|
+
/** Set for a wheel's or a trackpad's scroll input, which is no contact. */
|
|
170
|
+
readonly scrollType?: ScrollType;
|
|
171
|
+
/** The browser took this contact for its own pan or zoom. */
|
|
172
|
+
takenByBrowser: boolean;
|
|
173
|
+
}
|
|
174
|
+
/** The input a host hands the arena for one contact in one event. */
|
|
175
|
+
interface TouchInput {
|
|
176
|
+
readonly id: number;
|
|
177
|
+
readonly x: number;
|
|
178
|
+
readonly y: number;
|
|
179
|
+
readonly time: number;
|
|
180
|
+
/** Extra positions since the previous event, oldest first (coalesced). */
|
|
181
|
+
readonly history?: ReadonlyArray<TouchSample>;
|
|
182
|
+
}
|
|
183
|
+
/** A new contact: where it is, what made it, and what it landed on. */
|
|
184
|
+
interface TouchBeganInput extends TouchInput {
|
|
185
|
+
readonly pointerType: PointerKind;
|
|
186
|
+
readonly target: unknown;
|
|
187
|
+
readonly scroll?: NativeScrollProbe | null;
|
|
188
|
+
/** Set for a wheel's or a trackpad's scroll input. */
|
|
189
|
+
readonly scrollType?: ScrollType;
|
|
190
|
+
}
|
|
191
|
+
/** What a recognizer is told alongside the touches that changed. */
|
|
192
|
+
interface GestureEventContext {
|
|
193
|
+
/** Timestamp of the event being processed. */
|
|
194
|
+
readonly time: number;
|
|
195
|
+
/** Every contact the arena currently tracks, not only this recognizer's. */
|
|
196
|
+
readonly allTouches: ReadonlyArray<GestureTouch>;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Facts about the page a recognizer may need and must not read from the DOM
|
|
200
|
+
* itself: the viewport for screen-edge pans, and the writing direction of a
|
|
201
|
+
* view for `leading` / `trailing`.
|
|
202
|
+
*/
|
|
203
|
+
interface GestureEnvironment {
|
|
204
|
+
viewportSize: () => {
|
|
205
|
+
readonly width: number;
|
|
206
|
+
readonly height: number;
|
|
207
|
+
};
|
|
208
|
+
isRtl: (view: unknown) => boolean;
|
|
209
|
+
/**
|
|
210
|
+
* The box of a recognizer's view in viewport coordinates, or null when it
|
|
211
|
+
* has none to measure. A screen-edge pan reads it to tell a view within
|
|
212
|
+
* its edge band from any other.
|
|
213
|
+
*/
|
|
214
|
+
viewRect?: (view: unknown) => {
|
|
215
|
+
readonly left: number;
|
|
216
|
+
readonly top: number;
|
|
217
|
+
readonly width: number;
|
|
218
|
+
readonly height: number;
|
|
219
|
+
} | null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A view-level touch consumer: what UIKit delivers `touchesBegan` /
|
|
223
|
+
* `touchesEnded` to when no gesture recognizer takes the touch (a UIControl).
|
|
224
|
+
* The arena delivers through it, honoring `delaysTouchesBegan`,
|
|
225
|
+
* `delaysTouchesEnded` and `cancelsTouchesInView`.
|
|
226
|
+
*/
|
|
227
|
+
interface TouchConsumer {
|
|
228
|
+
touchBegan: (touch: GestureTouch) => void;
|
|
229
|
+
touchMoved: (touch: GestureTouch) => void;
|
|
230
|
+
touchEnded: (touch: GestureTouch) => void;
|
|
231
|
+
touchCancelled: (touch: GestureTouch) => void;
|
|
232
|
+
/**
|
|
233
|
+
* UIControl's iOS 6 rule: a control's own action wins over an overlapping
|
|
234
|
+
* single-tap recognizer on an ancestor. Return false to stop `recognizer`
|
|
235
|
+
* (attached above this consumer) from beginning for a touch on it.
|
|
236
|
+
*/
|
|
237
|
+
allowsAncestorRecognizer?: (recognizer: unknown) => boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Whether the consumer holds this touch now (a control whose press was
|
|
240
|
+
* delivered for that touch): the host cancels the browser's pan for that
|
|
241
|
+
* finger only, as UIKit's `touchesShouldCancel(in:)` is false for a
|
|
242
|
+
* tracking control. A move before the press is delivered, and another
|
|
243
|
+
* finger the consumer is not tracking, still scroll.
|
|
244
|
+
*/
|
|
245
|
+
keepsTouch?: (touchId: number) => boolean;
|
|
246
|
+
/**
|
|
247
|
+
* A control whose own record defines a hold action (a stepper's
|
|
248
|
+
* hold-repeat) brings the lock that turns text selection and the callout
|
|
249
|
+
* off for that press only, as a recognizer created with one does
|
|
250
|
+
* (`spec:AST-094` FR41). A control whose hold does nothing leaves it
|
|
251
|
+
* undefined and keeps the browser's long-press selection.
|
|
252
|
+
*/
|
|
253
|
+
readonly selectionLock?: SelectionLock;
|
|
254
|
+
/**
|
|
255
|
+
* Whether this touch's press holds the browser's context menu closed now.
|
|
256
|
+
* A control whose hold acts uses it (a switch's hold toggles it). The host
|
|
257
|
+
* then cancels the menu, as for a claimed touch.
|
|
258
|
+
*/
|
|
259
|
+
holdsContextMenu?: (touchId: number) => boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Whether the consumer takes touches now (a disabled control does not).
|
|
262
|
+
* The host listens only while something enabled is attached
|
|
263
|
+
* (`spec:AST-094` FR24); after this changes, call `host.update(element)`.
|
|
264
|
+
* @default true
|
|
265
|
+
*/
|
|
266
|
+
isEnabled?: () => boolean;
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/gestures/arenaTypes.d.ts
|
|
270
|
+
interface GestureClock {
|
|
271
|
+
now: () => number;
|
|
272
|
+
setTimeout: (callback: () => void, ms: number) => unknown;
|
|
273
|
+
clearTimeout: (handle: unknown) => void;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* What the browser's click after a touch should do: pass, be swallowed, or
|
|
277
|
+
* be swallowed now and replayed if the recognizers holding it all fail.
|
|
278
|
+
*/
|
|
279
|
+
type ClickDisposition = 'allow' | 'suppress' | 'defer';
|
|
280
|
+
interface ArenaBeganInput extends TouchBeganInput {
|
|
281
|
+
/** The recognizers on the touch's hit path, innermost first. */
|
|
282
|
+
readonly recognizers: ReadonlyArray<GestureRecognizer>;
|
|
283
|
+
/** The innermost view-level consumer under the touch, if any. */
|
|
284
|
+
readonly consumer?: TouchConsumer | null;
|
|
285
|
+
}
|
|
286
|
+
interface GestureArenaOptions {
|
|
287
|
+
clock?: GestureClock;
|
|
288
|
+
environment?: GestureEnvironment;
|
|
289
|
+
/**
|
|
290
|
+
* Touches a recognizer now owns, and the recognizer that claimed them. A
|
|
291
|
+
* claim comes in any state: a recognizer that waits on another's failure
|
|
292
|
+
* claims while `possible`, and a swipe claims as `ended`. Each claim is
|
|
293
|
+
* reported once.
|
|
294
|
+
*/
|
|
295
|
+
onClaim?: (touchIds: ReadonlyArray<number>, claimer: GestureRecognizer) => void;
|
|
296
|
+
/** Claimed touches given back to the browser (releaseClaim). */
|
|
297
|
+
onRelease?: (touchIds: ReadonlyArray<number>) => void;
|
|
298
|
+
/** A click deferred at touch end resolved: replay it, or drop it. */
|
|
299
|
+
onDeferredClick?: (touch: GestureTouch, allowed: boolean) => void;
|
|
300
|
+
/**
|
|
301
|
+
* The arena dropped its last touch, as after a lifted touch's decision
|
|
302
|
+
* waited on a timer (a tap waiting on a double tap): its host may stop
|
|
303
|
+
* listening now (`spec:AST-094` FR24).
|
|
304
|
+
*/
|
|
305
|
+
onIdle?: () => void;
|
|
306
|
+
/**
|
|
307
|
+
* Whether the browser keeps a contact for itself while it is down. Then no
|
|
308
|
+
* claiming recognizer recognizes with it before its lift. So a mouse or pen
|
|
309
|
+
* drag that starts on selectable text selects that text. A recognition at
|
|
310
|
+
* the lift, such as a tap's, is unaffected.
|
|
311
|
+
*/
|
|
312
|
+
refusesClaim?: (touch: GestureTouch) => boolean;
|
|
313
|
+
/** Every recognizer transition, for debugging and tests. */
|
|
314
|
+
onTransition?: (recognizer: GestureRecognizer, from: GestureState, to: GestureState) => void;
|
|
315
|
+
}
|
|
316
|
+
type ViewDelivery = 'none' | 'held' | 'delivered' | 'endHeld' | 'done';
|
|
317
|
+
interface TouchRecord {
|
|
318
|
+
readonly touch: GestureTouch;
|
|
319
|
+
readonly participants: GestureRecognizer[];
|
|
320
|
+
readonly consumer: TouchConsumer | null;
|
|
321
|
+
view: ViewDelivery;
|
|
322
|
+
isLifted: boolean;
|
|
323
|
+
isClaimed: boolean;
|
|
324
|
+
suppressClick: boolean;
|
|
325
|
+
deferredClick: boolean;
|
|
326
|
+
}
|
|
327
|
+
interface Timer {
|
|
328
|
+
deadline: number;
|
|
329
|
+
callback: () => void;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/gestures/arenaScheduler.d.ts
|
|
333
|
+
/** The arena's state and clock; GestureArena is the class to use. */
|
|
334
|
+
declare abstract class ArenaScheduler {
|
|
335
|
+
/** Resolves what the latest input or timer decided. */
|
|
336
|
+
protected abstract settle(): void;
|
|
337
|
+
/** A recognizer's place in resolution order. */
|
|
338
|
+
protected abstract rank(recognizer: GestureRecognizer): number;
|
|
339
|
+
readonly environment: GestureEnvironment;
|
|
340
|
+
protected readonly clock: GestureClock;
|
|
341
|
+
protected readonly options: GestureArenaOptions;
|
|
342
|
+
/** The touches whose move the arena is delivering right now. */
|
|
343
|
+
protected movingIds: ReadonlySet<number>;
|
|
344
|
+
protected readonly records: Map<number, TouchRecord>;
|
|
345
|
+
/** Recognizers involved in the current interaction, in resolution order. */
|
|
346
|
+
protected active: GestureRecognizer[];
|
|
347
|
+
protected readonly timers: Map<GestureRecognizer, Timer>;
|
|
348
|
+
protected realTimer: unknown;
|
|
349
|
+
protected realTimerDeadline: number;
|
|
350
|
+
/** The time of the event or timer being processed; null between them. */
|
|
351
|
+
protected currentTime: number | null;
|
|
352
|
+
/** The latest time processed: input never moves the clock backwards. */
|
|
353
|
+
protected latestTime: number;
|
|
354
|
+
protected depth: number;
|
|
355
|
+
/** Open `deferResolution` calls: what their stops unblock waits. */
|
|
356
|
+
protected deferDepth: number;
|
|
357
|
+
/** A deferred stop left a resolution for the next pass. */
|
|
358
|
+
protected owesResolution: boolean;
|
|
359
|
+
constructor(options?: GestureArenaOptions);
|
|
360
|
+
/** The current time on the event clock. */
|
|
361
|
+
now(): number;
|
|
362
|
+
/** Run every timer due at or before `time` (the host's timer and tests). */
|
|
363
|
+
advanceTime(time: number): void;
|
|
364
|
+
/** Internal. Arm a recognizer's one timer at an absolute deadline. */
|
|
365
|
+
setTimer(recognizer: GestureRecognizer, deadline: number, callback: () => void): void;
|
|
366
|
+
/** Internal. */
|
|
367
|
+
clearTimer(recognizer: GestureRecognizer): void;
|
|
368
|
+
/**
|
|
369
|
+
* Runs `body`, code outside input that stops recognizers (an Effect that
|
|
370
|
+
* turns one off or detaches it), without resolving what those stops
|
|
371
|
+
* unblock: the recognitions waiting on them, the touches they held from
|
|
372
|
+
* a view, the resets. A pass a microtask later resolves all of it, at the
|
|
373
|
+
* last event's time, so the listeners and consumers it reaches hear it
|
|
374
|
+
* outside the caller's frame and read the recognized state
|
|
375
|
+
* (react-component-runtime INV2).
|
|
376
|
+
*/
|
|
377
|
+
deferResolution(body: () => void): void;
|
|
378
|
+
/** The last event's time, or now before any event. */
|
|
379
|
+
protected lastEventTime(): number;
|
|
380
|
+
protected clampTime(time: number): number;
|
|
381
|
+
/**
|
|
382
|
+
* One external entry: run the timers due by `time`, then `body`, then
|
|
383
|
+
* settle (release held deliveries, reset finished recognizers, forget
|
|
384
|
+
* finished touches). Re-entrant calls (a listener feeding input) run
|
|
385
|
+
* inline and settle with the outermost one.
|
|
386
|
+
*/
|
|
387
|
+
protected run(time: number, body: () => void): void;
|
|
388
|
+
protected flushTimers(upTo: number): void;
|
|
389
|
+
protected scheduleRealTimer(): void;
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/gestures/arenaDelivery.d.ts
|
|
393
|
+
/** Delivery to the view and click dispositions; GestureArena is the class to use. */
|
|
394
|
+
declare abstract class ArenaDelivery extends ArenaScheduler {
|
|
395
|
+
/** Internal. A recognizer takes its touches from the view, unclaimed. */
|
|
396
|
+
cancelTouchesInViewOf(recognizer: GestureRecognizer): void;
|
|
397
|
+
protected deliverViewBegan(record: TouchRecord): void;
|
|
398
|
+
/** What a lifted touch's view and click get, decided at the lift. */
|
|
399
|
+
protected resolveEnd(record: TouchRecord): ClickDisposition;
|
|
400
|
+
/** Release whatever no recognizer is holding any more. */
|
|
401
|
+
protected reviewHeld(): void;
|
|
402
|
+
protected beginDelayers(record: TouchRecord): boolean;
|
|
403
|
+
protected endDelayers(record: TouchRecord): boolean;
|
|
404
|
+
protected cancelViewTouchesOf(recognizer: GestureRecognizer): void;
|
|
405
|
+
protected cancelView(record: TouchRecord): void;
|
|
406
|
+
protected context(): GestureEventContext;
|
|
407
|
+
protected liveTouches(ids: ReadonlyArray<number>): GestureTouch[];
|
|
408
|
+
protected update(inputs: ReadonlyArray<TouchInput>, phase: 'moved' | 'ended'): GestureTouch[];
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/gestures/arenaResolution.d.ts
|
|
412
|
+
/** Conflict resolution and claims; GestureArena is the class to use. */
|
|
413
|
+
declare abstract class ArenaResolution extends ArenaDelivery {
|
|
414
|
+
/** Internal. A recognizer asked for a state change. */
|
|
415
|
+
requestTransition(recognizer: GestureRecognizer, next: GestureState): void;
|
|
416
|
+
/** Cancel an active recognizer, or fail a possible one. */
|
|
417
|
+
stop(recognizer: GestureRecognizer): void;
|
|
418
|
+
protected attemptRecognition(recognizer: GestureRecognizer, next: 'began' | 'ended'): void;
|
|
419
|
+
/** Whether `winner` being recognized prevents `other`. */
|
|
420
|
+
protected conflicts(winner: GestureRecognizer, other: GestureRecognizer): boolean;
|
|
421
|
+
/**
|
|
422
|
+
* Whether a recognizer that claims touches would take a contact the
|
|
423
|
+
* browser keeps while it is down (`refusesClaim`).
|
|
424
|
+
*/
|
|
425
|
+
protected isRefusedByBrowser(recognizer: GestureRecognizer): boolean;
|
|
426
|
+
/** UIControl's rule: a control may veto an overlapping ancestor recognizer. */
|
|
427
|
+
protected isVetoedByConsumer(recognizer: GestureRecognizer): boolean;
|
|
428
|
+
protected fail(recognizer: GestureRecognizer): void;
|
|
429
|
+
/**
|
|
430
|
+
* A recognition that claimed its touches and then fails or is cancelled (a
|
|
431
|
+
* waiting recognition that fails, a gesture a second finger or the app
|
|
432
|
+
* cancels) gives them back to the browser unless another recognition owns
|
|
433
|
+
* them, so a finger still resting there can pinch-zoom the page. A gesture
|
|
434
|
+
* that cancels itself on a finger's move (a long press past its tolerance)
|
|
435
|
+
* keeps that finger until it lifts: the drag goes on, and the page never
|
|
436
|
+
* takes it over midway (`spec:AST-094` FR14), as UIKit's scroll view never
|
|
437
|
+
* takes a touch another recognizer had.
|
|
438
|
+
*/
|
|
439
|
+
protected releaseClaim(recognizer: GestureRecognizer, keep?: ReadonlySet<number>): void;
|
|
440
|
+
protected apply(recognizer: GestureRecognizer, next: GestureState): void;
|
|
441
|
+
/**
|
|
442
|
+
* Re-run every waiting recognition whose requirements may have resolved.
|
|
443
|
+
* Repeats until nothing changes, so chains (A waits on B waits on C)
|
|
444
|
+
* settle in one pass.
|
|
445
|
+
*/
|
|
446
|
+
protected reviewPending(): void;
|
|
447
|
+
protected claim(recognizer: GestureRecognizer): void;
|
|
448
|
+
/** A recognizer's place in resolution order: innermost first, idle last. */
|
|
449
|
+
protected rank(recognizer: GestureRecognizer): number;
|
|
450
|
+
protected settle(): void;
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/gestures/GestureArena.d.ts
|
|
454
|
+
/**
|
|
455
|
+
* The arena that decides which recognizer gets a touch.
|
|
456
|
+
*/
|
|
457
|
+
declare class GestureArena extends ArenaResolution {
|
|
458
|
+
/** Whether a recognizer owns this touch, so the browser must not pan or zoom it. */
|
|
459
|
+
isClaimed(id: number): boolean;
|
|
460
|
+
/** Internal. The view-level consumer of this touch, if any. */
|
|
461
|
+
consumerOf(id: number): TouchConsumer | null;
|
|
462
|
+
/** The live touch with this id. */
|
|
463
|
+
getTouch(id: number): GestureTouch | undefined;
|
|
464
|
+
/**
|
|
465
|
+
* The recognizers that took touch `id` when it began: each was enabled,
|
|
466
|
+
* accepted its pointer, and its `shouldReceiveTouch` agreed. Empty for a
|
|
467
|
+
* touch the arena does not track.
|
|
468
|
+
*/
|
|
469
|
+
participantsOf(id: number): ReadonlyArray<GestureRecognizer>;
|
|
470
|
+
/** Every touch the arena tracks, lifted ones awaiting a decision included. */
|
|
471
|
+
get touches(): ReadonlyArray<GestureTouch>;
|
|
472
|
+
/** Recognizers taking part in the current interaction, in resolution order. */
|
|
473
|
+
get involvedRecognizers(): ReadonlyArray<GestureRecognizer>;
|
|
474
|
+
/** New contacts, each with the recognizers on its hit path. */
|
|
475
|
+
began(inputs: ReadonlyArray<ArenaBeganInput>): void;
|
|
476
|
+
/**
|
|
477
|
+
* A contact began where nothing takes part (plain page content). It is
|
|
478
|
+
* never tracked and stays the browser's; recognizers already tracking a
|
|
479
|
+
* gesture hear of it, as of any touch off their hit path.
|
|
480
|
+
*/
|
|
481
|
+
untrackedBegan(input: TouchBeganInput): void;
|
|
482
|
+
/** Contacts moved. */
|
|
483
|
+
moved(inputs: ReadonlyArray<TouchInput>): void;
|
|
484
|
+
/**
|
|
485
|
+
* Contacts lifted. Returns, per touch, what the browser's click for it
|
|
486
|
+
* should do.
|
|
487
|
+
*/
|
|
488
|
+
ended(inputs: ReadonlyArray<TouchInput>): Map<number, ClickDisposition>;
|
|
489
|
+
/** The system took these contacts (`touchcancel`, a mouse `pointercancel`). */
|
|
490
|
+
cancelled(ids: ReadonlyArray<number>, time: number): void;
|
|
491
|
+
/**
|
|
492
|
+
* The browser took these contacts for its own pan or zoom: their pointer
|
|
493
|
+
* stream is gone (`pointercancel`) and no click will follow. Possible
|
|
494
|
+
* recognizers sharing them fail and active ones are cancelled, as UIKit
|
|
495
|
+
* fails everything a scroll view's pan beats, except a recognizer that
|
|
496
|
+
* keeps observing the touch. Such a watcher never claims it: a drag the
|
|
497
|
+
* browser took stays the browser's (FR14).
|
|
498
|
+
*/
|
|
499
|
+
browserTookOver(ids: ReadonlyArray<number>, time: number): void;
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/gestures/recognizerOptions.d.ts
|
|
503
|
+
/**
|
|
504
|
+
* Turns text selection and the touch callout off on `elements` (and on a
|
|
505
|
+
* non-text input `target` inside one) for one held press; returns the undo.
|
|
506
|
+
* utils/selectionLock.ts's `lockSelection` is the one implementation.
|
|
507
|
+
*/
|
|
508
|
+
type SelectionLock = (elements: Iterable<Element>, target: EventTarget | null) => () => void;
|
|
509
|
+
interface GestureRecognizerOptions<R = GestureRecognizer> {
|
|
510
|
+
/** A name for debugging and test output. */
|
|
511
|
+
name?: string;
|
|
512
|
+
/** A disabled recognizer receives no touches; disabling one mid-gesture cancels it. @default true */
|
|
513
|
+
isEnabled?: boolean;
|
|
514
|
+
/**
|
|
515
|
+
* When the gesture is recognized, cancel the view's touches: a pressed
|
|
516
|
+
* control un-highlights without acting, and the browser's click for the
|
|
517
|
+
* touch is swallowed. @default true
|
|
518
|
+
*/
|
|
519
|
+
cancelsTouchesInView?: boolean;
|
|
520
|
+
/** Hold the view's touch-began until this recognizer fails. @default false */
|
|
521
|
+
delaysTouchesBegan?: boolean;
|
|
522
|
+
/**
|
|
523
|
+
* For a hold that does something (a slider's thumb, a switch's or a
|
|
524
|
+
* segmented control's drag): the lock that turns text selection and the
|
|
525
|
+
* touch callout off on this recognizer's element for each held press
|
|
526
|
+
* (`spec:AST-094` FR41). Pass `lockSelection` from utils/selectionLock.ts;
|
|
527
|
+
* the host calls it and never imports it, so a component without such a
|
|
528
|
+
* hold does not bundle it. Content under a sheet's or a pager's pan stays
|
|
529
|
+
* selectable, so there is none by default; a mouse keeps desktop selection
|
|
530
|
+
* either way. A long press brings its own when it has a hold (a
|
|
531
|
+
* `minimumPressDuration` above 0); `null` brings none.
|
|
532
|
+
*/
|
|
533
|
+
selectionLock?: SelectionLock | null;
|
|
534
|
+
/**
|
|
535
|
+
* Hold the view's touch-ended (and the browser's click) while this
|
|
536
|
+
* recognizer may still recognize. @default true
|
|
537
|
+
*/
|
|
538
|
+
delaysTouchesEnded?: boolean;
|
|
539
|
+
/** Pointer kinds this recognizer listens to (UIKit's `allowedTouchTypes`). @default all */
|
|
540
|
+
allowedPointerTypes?: ReadonlyArray<PointerKind>;
|
|
541
|
+
/**
|
|
542
|
+
* Scroll input this recognizer takes, as UIKit's `allowedScrollTypesMask`.
|
|
543
|
+
* A pan follows a trackpad's two-finger scroll (`continuous`), never a
|
|
544
|
+
* mouse wheel's notches. It moves as a contact with the content, along its
|
|
545
|
+
* own axis, after the scrollers under the pointer. Its own element is the
|
|
546
|
+
* pan's on the axis its `touch-action` keeps, as for a finger. A pinch takes
|
|
547
|
+
* a ctrl-wheel of either, as a trackpad pinches.
|
|
548
|
+
* @default none; a pinch takes both, the screen-edge pan none whatever a
|
|
549
|
+
* caller passes
|
|
550
|
+
*/
|
|
551
|
+
allowedScrollTypes?: ReadonlyArray<ScrollType>;
|
|
552
|
+
/** Ignore a touch of a different kind than the ones already tracked. @default true */
|
|
553
|
+
requiresExclusiveTouchType?: boolean;
|
|
554
|
+
/**
|
|
555
|
+
* Whether this recognizer takes its touches from the browser when it
|
|
556
|
+
* recognizes. `false` makes a watcher (a tab bar that minimizes while the
|
|
557
|
+
* page scrolls): it never claims, so it gets only passive listeners and
|
|
558
|
+
* never delays a scroll; it prevents no other recognizer and none prevents
|
|
559
|
+
* it (`spec:AST-094` FR15); it cancels no press or click under it; and it
|
|
560
|
+
* keeps tracking a touch the browser takes for a scroll,
|
|
561
|
+
* reporting through the native scroll and ending at the lift.
|
|
562
|
+
* @default true
|
|
563
|
+
*/
|
|
564
|
+
claimsTouches?: boolean;
|
|
565
|
+
/** gestureRecognizerShouldBegin: return false to fail instead of beginning. */
|
|
566
|
+
shouldBegin?: (recognizer: R) => boolean;
|
|
567
|
+
/** gestureRecognizer(_:shouldReceive:): return false to never see this touch. */
|
|
568
|
+
shouldReceiveTouch?: (recognizer: R, touch: GestureTouch) => boolean;
|
|
569
|
+
/** gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:). */
|
|
570
|
+
shouldRecognizeSimultaneously?: (recognizer: R, other: GestureRecognizer) => boolean;
|
|
571
|
+
/** gestureRecognizer(_:shouldRequireFailureOf:). */
|
|
572
|
+
shouldRequireFailureOf?: (recognizer: R, other: GestureRecognizer) => boolean;
|
|
573
|
+
/** gestureRecognizer(_:shouldBeRequiredToFailBy:). */
|
|
574
|
+
shouldBeRequiredToFailBy?: (recognizer: R, other: GestureRecognizer) => boolean;
|
|
575
|
+
}
|
|
576
|
+
type GestureListener<R> = (recognizer: R) => void;
|
|
577
|
+
type GestureTransitionListener<R> = (recognizer: R, from: GestureState, to: GestureState) => void;
|
|
578
|
+
/**
|
|
579
|
+
* The browser behaviors `touch-action` can keep or remove.
|
|
580
|
+
*/
|
|
581
|
+
interface NativeTouchBehavior {
|
|
582
|
+
readonly panX: boolean;
|
|
583
|
+
readonly panY: boolean;
|
|
584
|
+
readonly pinchZoom: boolean;
|
|
585
|
+
/** Double-tap to zoom, the reason for the old 300 ms click delay. */
|
|
586
|
+
readonly doubleTapZoom: boolean;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* What a recognizer is. The gesture code tells the family apart by it, never
|
|
590
|
+
* by `instanceof` (`architecture:react-component-runtime` INV13); a
|
|
591
|
+
* screen-edge pan is its own kind, though it is built on the pan.
|
|
592
|
+
*/
|
|
593
|
+
type RecognizerKind = 'tap' | 'longPress' | 'pan' | 'screenEdgePan' | 'swipe' | 'pinch';
|
|
594
|
+
//#endregion
|
|
595
|
+
//#region src/gestures/recognizerCore.d.ts
|
|
596
|
+
/** A recognizer's configuration and relationships; GestureRecognizer is the class to extend. */
|
|
597
|
+
declare abstract class RecognizerCore {
|
|
598
|
+
/** What this recognizer is (see RecognizerKind). */
|
|
599
|
+
abstract get kind(): RecognizerKind;
|
|
600
|
+
/** Stable id, for ordering and debugging. */
|
|
601
|
+
readonly id: number;
|
|
602
|
+
name: string;
|
|
603
|
+
isEnabled: boolean;
|
|
604
|
+
cancelsTouchesInView: boolean;
|
|
605
|
+
/** See GestureRecognizerOptions.selectionLock. */
|
|
606
|
+
readonly selectionLock: SelectionLock | null;
|
|
607
|
+
delaysTouchesBegan: boolean;
|
|
608
|
+
delaysTouchesEnded: boolean;
|
|
609
|
+
allowedPointerTypes: ReadonlySet<PointerKind> | null;
|
|
610
|
+
/** See GestureRecognizerOptions.allowedScrollTypes. */
|
|
611
|
+
readonly allowedScrollTypes: ReadonlySet<ScrollType>;
|
|
612
|
+
requiresExclusiveTouchType: boolean;
|
|
613
|
+
/**
|
|
614
|
+
* The element (or any object) the recognizer is attached to. The DOM host
|
|
615
|
+
* sets it; the arena treats it as opaque.
|
|
616
|
+
*/
|
|
617
|
+
view: unknown;
|
|
618
|
+
/** Internal. The arena delivering touches to this recognizer, if any. */
|
|
619
|
+
protected arena: GestureArena | null;
|
|
620
|
+
/** Internal. A recognition waiting for a failure requirement. */
|
|
621
|
+
protected pending: 'began' | 'ended' | null;
|
|
622
|
+
/**
|
|
623
|
+
* The delegate functions. Typed against the base so a subclass stays
|
|
624
|
+
* assignable to GestureRecognizer; each is only ever called with `this`.
|
|
625
|
+
*/
|
|
626
|
+
protected readonly options: GestureRecognizerOptions<GestureRecognizer>;
|
|
627
|
+
protected stateValue: GestureState;
|
|
628
|
+
protected readonly listeners: Set<GestureListener<GestureRecognizer>>;
|
|
629
|
+
protected readonly transitionListeners: Set<GestureTransitionListener<GestureRecognizer>>;
|
|
630
|
+
protected readonly failureRequirements: Set<GestureRecognizer>;
|
|
631
|
+
protected readonly simultaneousWith: Set<GestureRecognizer>;
|
|
632
|
+
/** Touches currently tracked, by id. */
|
|
633
|
+
protected readonly touches: Map<number, GestureTouch>;
|
|
634
|
+
/** Internal. Every touch id received since the last reset. */
|
|
635
|
+
protected readonly seenTouchIds: Set<number>;
|
|
636
|
+
protected lastLocation: Point;
|
|
637
|
+
constructor(options?: GestureRecognizerOptions<never>);
|
|
638
|
+
/** This recognizer, as the GestureRecognizer every recognizer is. */
|
|
639
|
+
protected get self(): GestureRecognizer;
|
|
640
|
+
/** Discrete recognizers go from `possible` straight to `ended`. */
|
|
641
|
+
get isDiscrete(): boolean;
|
|
642
|
+
/**
|
|
643
|
+
* Whether recognizing takes the touches from the browser: while a claiming
|
|
644
|
+
* recognizer owns a touch, the host cancels the browser's pan and zoom for
|
|
645
|
+
* it. Every touch recognizer claims; hover has no touches to claim.
|
|
646
|
+
*/
|
|
647
|
+
get claimsTouches(): boolean;
|
|
648
|
+
get state(): GestureState;
|
|
649
|
+
/**
|
|
650
|
+
* What the browser may still do natively on this recognizer's view: the
|
|
651
|
+
* host intersects these across a view's recognizers into its
|
|
652
|
+
* `touch-action`. A recognizer that takes no touches constrains nothing.
|
|
653
|
+
*/
|
|
654
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
655
|
+
/** Internal. Whether this recognizer listens to touch at all. */
|
|
656
|
+
protected get acceptsTouchInput(): boolean;
|
|
657
|
+
/** How many touches the recognizer is tracking right now. */
|
|
658
|
+
get numberOfTouches(): number;
|
|
659
|
+
/** The touches being tracked, in the order they began. */
|
|
660
|
+
get trackedTouches(): ReadonlyArray<GestureTouch>;
|
|
661
|
+
/**
|
|
662
|
+
* The centroid of the tracked touches in client coordinates; after they
|
|
663
|
+
* end, where they were last.
|
|
664
|
+
*/
|
|
665
|
+
location(): Point;
|
|
666
|
+
/** Facts about the page (viewport, writing direction). */
|
|
667
|
+
protected get environment(): GestureEnvironment;
|
|
668
|
+
/** UIKit's `require(toFail:)`: recognize only once `other` has failed. */
|
|
669
|
+
requireToFail(other: GestureRecognizer): this;
|
|
670
|
+
/** Let this and `others` be recognized at the same time (both directions). */
|
|
671
|
+
recognizeSimultaneouslyWith(...others: GestureRecognizer[]): this;
|
|
672
|
+
/** Internal. Whether this recognizer must wait for `other` to fail. */
|
|
673
|
+
protected requiresFailureOf(other: GestureRecognizer): boolean;
|
|
674
|
+
/**
|
|
675
|
+
* Internal. Whether this and `other` may be active together: both allow it
|
|
676
|
+
* (`recognizeSimultaneouslyWith` sets both sides; each delegate answers for
|
|
677
|
+
* its own recognizer), so one delegate alone keeps them exclusive (FR15).
|
|
678
|
+
*/
|
|
679
|
+
protected allowsSimultaneous(other: GestureRecognizer): boolean;
|
|
680
|
+
/** Internal. The delegate's should-begin answer. */
|
|
681
|
+
protected shouldBegin(): boolean;
|
|
682
|
+
/**
|
|
683
|
+
* Internal. Whether this recognizer holds `touchId` before it begins: the
|
|
684
|
+
* host then cancels that finger's moves as for a touch a recognizer owns.
|
|
685
|
+
* None does by default (`spec:AST-094` FR19); a scroll-edge pan holds a
|
|
686
|
+
* finger pulling away from an edge every scroller under it is at.
|
|
687
|
+
*/
|
|
688
|
+
protected keepsTouch(_touchId: number): boolean;
|
|
689
|
+
/** UIKit's `canPrevent(_:)`: whether recognizing fails `other`. */
|
|
690
|
+
canPrevent(_other: GestureRecognizer): boolean;
|
|
691
|
+
/** UIKit's `canBePrevented(by:)`. */
|
|
692
|
+
canBePrevented(_other: GestureRecognizer): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Whether this recognizer is still part of the current interaction: it
|
|
695
|
+
* tracks touches, is waiting on a requirement, or (a multi-tap between
|
|
696
|
+
* taps) expects more input. An idle `possible` recognizer cannot recognize
|
|
697
|
+
* and so does not hold up anything that requires it to fail.
|
|
698
|
+
*/
|
|
699
|
+
isInvolved(): boolean;
|
|
700
|
+
/** Called on began, changed, ended (recognized) and cancelled. */
|
|
701
|
+
addListener(listener: GestureListener<this>): () => void;
|
|
702
|
+
/** Called on every transition, including failed and the reset to possible. */
|
|
703
|
+
addTransitionListener(listener: GestureTransitionListener<this>): () => void;
|
|
704
|
+
/** The scroll types taken when the options name none (UIKit's: none). */
|
|
705
|
+
protected get defaultScrollTypes(): ReadonlyArray<ScrollType>;
|
|
706
|
+
}
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/gestures/GestureRecognizer.d.ts
|
|
709
|
+
declare abstract class GestureRecognizer extends RecognizerCore {
|
|
710
|
+
/** New touches for this recognizer. */
|
|
711
|
+
protected touchesBegan(_touches: ReadonlyArray<GestureTouch>, _event: GestureEventContext): void;
|
|
712
|
+
protected touchesMoved(_touches: ReadonlyArray<GestureTouch>, _event: GestureEventContext): void;
|
|
713
|
+
/** Touches lifted; they are removed from `touches` after this returns. */
|
|
714
|
+
protected touchesEnded(_touches: ReadonlyArray<GestureTouch>, _event: GestureEventContext): void;
|
|
715
|
+
/**
|
|
716
|
+
* The system or the browser took these touches. By default an active
|
|
717
|
+
* gesture is cancelled and a possible one fails.
|
|
718
|
+
*/
|
|
719
|
+
protected touchesCancelled(_touches: ReadonlyArray<GestureTouch>, _event: GestureEventContext): void;
|
|
720
|
+
/**
|
|
721
|
+
* The browser took these touches for its own pan or zoom (their pointer
|
|
722
|
+
* stream is gone). Return true to keep observing them; by default they are
|
|
723
|
+
* treated as cancelled. An observer never claims them: a drag the browser
|
|
724
|
+
* took stays the browser's (FR14).
|
|
725
|
+
*/
|
|
726
|
+
protected touchesTakenByBrowser(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): boolean;
|
|
727
|
+
/**
|
|
728
|
+
* A touch began elsewhere (off this recognizer's hit path) while this
|
|
729
|
+
* recognizer tracks touches of its own. It is not this recognizer's touch
|
|
730
|
+
* and is never delivered as one; a recognizer that a foreign finger should
|
|
731
|
+
* end (a menu's press slide) cancels itself here. By default nothing
|
|
732
|
+
* happens.
|
|
733
|
+
*/
|
|
734
|
+
protected touchBeganElsewhere(_touches: ReadonlyArray<GestureTouch>, _event: GestureEventContext): void;
|
|
735
|
+
/** Clear per-gesture state before the next attempt. */
|
|
736
|
+
protected reset(): void;
|
|
737
|
+
/**
|
|
738
|
+
* Whether a touch may join. The base checks enabled, pointer kind and
|
|
739
|
+
* exclusivity of kind; subclasses narrow it (a one-finger pan ignores a
|
|
740
|
+
* second finger once it is moving).
|
|
741
|
+
*/
|
|
742
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
743
|
+
/**
|
|
744
|
+
* Ask for a state change. The arena may refuse (the recognizer fails
|
|
745
|
+
* instead) or defer it until a failure requirement resolves.
|
|
746
|
+
*/
|
|
747
|
+
protected setState(next: GestureState): void;
|
|
748
|
+
/** Arm the recognizer's one timer at an absolute time on the event clock. */
|
|
749
|
+
protected setTimer(deadline: number, callback: () => void): void;
|
|
750
|
+
protected clearTimer(): void;
|
|
751
|
+
/** The event clock's current time. */
|
|
752
|
+
protected now(): number;
|
|
753
|
+
/**
|
|
754
|
+
* Takes this recognizer's touches from the view, as a claiming winner does
|
|
755
|
+
* under `cancelsTouchesInView`: the view's press ends and no click follows.
|
|
756
|
+
* The touches stay unclaimed, so the page still scrolls.
|
|
757
|
+
*/
|
|
758
|
+
protected cancelTouchesInView(): void;
|
|
759
|
+
/** Internal. Whether this recognizer takes `touch` right now. */
|
|
760
|
+
protected wantsTouch(touch: GestureTouch): boolean;
|
|
761
|
+
/** Internal. */
|
|
762
|
+
protected deliverBegan(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
763
|
+
/** Internal. */
|
|
764
|
+
protected deliverBeganElsewhere(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
765
|
+
/** Internal. */
|
|
766
|
+
protected deliverMoved(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
767
|
+
/** Internal. */
|
|
768
|
+
protected deliverEnded(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
769
|
+
/** Internal. */
|
|
770
|
+
protected deliverCancelled(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
771
|
+
/** Internal. */
|
|
772
|
+
protected deliverTakenByBrowser(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
773
|
+
/** Internal. The host's hook: listeners follow whether anything is enabled. */
|
|
774
|
+
onEnabledChange: (() => void) | null;
|
|
775
|
+
/**
|
|
776
|
+
* UIKit's `isEnabled` setter: turning a recognizer off mid-gesture cancels
|
|
777
|
+
* the gesture (an active one) or fails it (a possible one).
|
|
778
|
+
*/
|
|
779
|
+
setEnabled(value: boolean): void;
|
|
780
|
+
/** Cancel this recognizer if it is active, or fail it if it is possible. */
|
|
781
|
+
cancel(): void;
|
|
782
|
+
/** Internal. Apply a transition the arena has approved. */
|
|
783
|
+
protected applyState(next: GestureState): void;
|
|
784
|
+
/** Internal. Return to `possible` for the next attempt. */
|
|
785
|
+
protected resetToPossible(): void;
|
|
786
|
+
}
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/gestures/panOptions.d.ts
|
|
789
|
+
type PanDirection = 'any' | 'horizontal' | 'vertical' | 'left' | 'right' | 'up' | 'down';
|
|
790
|
+
interface PanGestureRecognizerOptions extends GestureRecognizerOptions<PanGestureRecognizer> {
|
|
791
|
+
/** @default 1 */
|
|
792
|
+
minimumNumberOfTouches?: number;
|
|
793
|
+
/** @default Infinity */
|
|
794
|
+
maximumNumberOfTouches?: number;
|
|
795
|
+
/**
|
|
796
|
+
* The travel that begins the pan, px. A function gives each press its own
|
|
797
|
+
* threshold: it reads the press's first touch when that touch lands.
|
|
798
|
+
* @default UIKit's 10
|
|
799
|
+
*/
|
|
800
|
+
hysteresis?: number | ((touch: GestureTouch) => number);
|
|
801
|
+
/** Movement that may begin the pan; anything else fails it. @default 'any' */
|
|
802
|
+
direction?: PanDirection;
|
|
803
|
+
/**
|
|
804
|
+
* For a pan limited to an axis: how much the movement along the axis must
|
|
805
|
+
* exceed the movement across it to begin. Above 1, movement that is still
|
|
806
|
+
* between the two lines when the pan reaches its hysteresis fails it: a pan
|
|
807
|
+
* that competes with native scrolling decides within 10 px
|
|
808
|
+
* (`spec:AST-094` FR19). Below 1, the pan claims drags up to
|
|
809
|
+
* atan(1 / axisRatio) off its axis.
|
|
810
|
+
* @default 1
|
|
811
|
+
*/
|
|
812
|
+
axisRatio?: number;
|
|
813
|
+
/**
|
|
814
|
+
* With `direction: 'any'`, report movement along the axis that dominated
|
|
815
|
+
* at the start only (UIScrollView's directional lock).
|
|
816
|
+
*/
|
|
817
|
+
lockAxis?: boolean;
|
|
818
|
+
/**
|
|
819
|
+
* A trackpad's two-finger scroll (`continuous`) drives the pan where its
|
|
820
|
+
* owner allows it. It moves as a contact with the content, along its own
|
|
821
|
+
* axis, after the scrollers under the pointer. Its own element is the pan's
|
|
822
|
+
* on the axis its `touch-action` keeps, as for a finger. A mouse wheel's
|
|
823
|
+
* notches never drive a pan; they scroll what is under the pointer.
|
|
824
|
+
* @default [] (none)
|
|
825
|
+
*/
|
|
826
|
+
allowedScrollTypes?: ReadonlyArray<'continuous'>;
|
|
827
|
+
/** Begin only when the native scrollers under the touch are at the edge. */
|
|
828
|
+
scrollEdge?: boolean;
|
|
829
|
+
/**
|
|
830
|
+
* A one-way pan decides on the touch's first move. A first move its own way
|
|
831
|
+
* holds the touch from that move. Any other first move fails the pan, so the
|
|
832
|
+
* page keeps the touch. A toast's swipe works this way.
|
|
833
|
+
*/
|
|
834
|
+
firstMoveDecides?: boolean;
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/gestures/PanGestureRecognizer.d.ts
|
|
838
|
+
export declare class PanGestureRecognizer extends GestureRecognizer {
|
|
839
|
+
get kind(): GestureRecognizer['kind'];
|
|
840
|
+
/** Internal. The host's brand: a pan follows the one-finger rule (recognizerInternals). */
|
|
841
|
+
protected get family(): 'pan';
|
|
842
|
+
minimumNumberOfTouches: number;
|
|
843
|
+
maximumNumberOfTouches: number;
|
|
844
|
+
hysteresis: number;
|
|
845
|
+
direction: PanDirection;
|
|
846
|
+
axisRatio: number;
|
|
847
|
+
lockAxis: boolean;
|
|
848
|
+
scrollEdge: boolean;
|
|
849
|
+
firstMoveDecides: boolean;
|
|
850
|
+
/** The axis a `lockAxis` pan locked to when it began. */
|
|
851
|
+
lockedAxis: 'x' | 'y' | null;
|
|
852
|
+
/** The movement the begin threshold took (excluded from `translation()`). */
|
|
853
|
+
travelAtBegan: Point;
|
|
854
|
+
private readonly tracker;
|
|
855
|
+
/**
|
|
856
|
+
* Read once per press. A finger that lands later keeps the press's
|
|
857
|
+
* threshold.
|
|
858
|
+
*/
|
|
859
|
+
private readonly hysteresisFor;
|
|
860
|
+
/** The lift's event time once the pan ended: its release (AST-100 FR2). */
|
|
861
|
+
private releaseTime;
|
|
862
|
+
/** The centroid where the gesture started, in client px. */
|
|
863
|
+
private origin;
|
|
864
|
+
/** Re-basing that keeps the translation continuous across finger changes. */
|
|
865
|
+
private adjust;
|
|
866
|
+
/** Translation since touch-down, before `setTranslation` offsets. */
|
|
867
|
+
private raw;
|
|
868
|
+
private offset;
|
|
869
|
+
/** How a `firstMoveDecides` pan read the touch's first move, once it moved. */
|
|
870
|
+
private firstMove;
|
|
871
|
+
constructor(options?: PanGestureRecognizerOptions);
|
|
872
|
+
/**
|
|
873
|
+
* Movement since the pan began (or since `setTranslation`), client px; the
|
|
874
|
+
* movement since touch-down while it is still possible.
|
|
875
|
+
*/
|
|
876
|
+
translation(): Point;
|
|
877
|
+
/**
|
|
878
|
+
* Change the allowed direction for the next gesture (a pan in progress
|
|
879
|
+
* keeps the one it began with). The element's touch-action is derived
|
|
880
|
+
* when the recognizer is attached: switching between directions that
|
|
881
|
+
* leave the browser the same touches (up and down) needs nothing more.
|
|
882
|
+
*/
|
|
883
|
+
setDirection(direction: PanDirection): void;
|
|
884
|
+
/** UIKit's `setTranslation(_:in:)`: make the current translation read `value`. */
|
|
885
|
+
setTranslation(value: Point): void;
|
|
886
|
+
/** Movement since the fingers landed, threshold included, client px. */
|
|
887
|
+
totalTranslation(): Point;
|
|
888
|
+
/**
|
|
889
|
+
* Velocity in px/s, UIKit's way, for a dragged surface. At the release it
|
|
890
|
+
* is 0 when the finger rested longer than the stillness interval before
|
|
891
|
+
* lifting, or moved fewer than twice (spec:AST-100 FR2).
|
|
892
|
+
*/
|
|
893
|
+
velocity(): Point;
|
|
894
|
+
/**
|
|
895
|
+
* A scrolling surface's release velocity in px/s (paging, a wheel): the
|
|
896
|
+
* scroll-view blend of the pan's last two values, with the same release
|
|
897
|
+
* rules (architecture:interaction-modality INV10).
|
|
898
|
+
*/
|
|
899
|
+
scrollVelocity(): Point;
|
|
900
|
+
/**
|
|
901
|
+
* The browser keeps the axis a two-way pan does not use. A one-way pan,
|
|
902
|
+
* and a pan that coordinates with native scrolling, leave the browser
|
|
903
|
+
* everything: the other direction still scrolls (a toast dragged away from
|
|
904
|
+
* its edge scrolls the page), and the pan claims its own direction by
|
|
905
|
+
* cancelling `touchmove` when it begins, below the distance at which the
|
|
906
|
+
* browser decides to scroll. Pinch-zoom stays the browser's.
|
|
907
|
+
*/
|
|
908
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
909
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
910
|
+
protected touchesBegan(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
911
|
+
protected touchesMoved(_touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
912
|
+
protected touchesEnded(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
913
|
+
protected reset(): void;
|
|
914
|
+
/**
|
|
915
|
+
* What this movement means for a pan limited to a direction: begin, fail,
|
|
916
|
+
* or undecided (between `axisRatio`'s lines), which fails it too once it
|
|
917
|
+
* reaches its hysteresis.
|
|
918
|
+
*/
|
|
919
|
+
protected classify(translation: Point): 'begin' | 'fail' | 'wait';
|
|
920
|
+
private tryBegin;
|
|
921
|
+
/**
|
|
922
|
+
* Leave the threshold's travel out of the translation, as UIKit does at
|
|
923
|
+
* .began: up to `hysteresis` px per axis, so a slow drag starts at zero and
|
|
924
|
+
* a step that overshoots keeps the overshoot (measured: a slow diagonal
|
|
925
|
+
* that crossed at (10.67, 10.67) reads (0.67, 0.67); a 3:1 drag crossing at
|
|
926
|
+
* (11, 3.67) reads (1, 0)). Some fast first moves read zero in UIKit; that
|
|
927
|
+
* case is not modelled.
|
|
928
|
+
*/
|
|
929
|
+
private startFromHere;
|
|
930
|
+
/**
|
|
931
|
+
* Inside a tap's wobble the moves stay the browser's, so WebKit keeps the
|
|
932
|
+
* tap's click. Past it, at an edge where the browser would only rubber-band,
|
|
933
|
+
* the pan holds the finger before it begins (`spec:AST-094` FR19, DEC-18).
|
|
934
|
+
* A move the content can still scroll stays the browser's, and so does every
|
|
935
|
+
* move while a second finger is down (a pinch).
|
|
936
|
+
*/
|
|
937
|
+
protected keepsTouch(touchId: number): boolean;
|
|
938
|
+
private travelAlongAxis;
|
|
939
|
+
private nativeCanScroll;
|
|
940
|
+
private track;
|
|
941
|
+
/** Keep the translation continuous when fingers join or leave. */
|
|
942
|
+
private rebase;
|
|
943
|
+
private locked;
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/motion/types.d.ts
|
|
947
|
+
/**
|
|
948
|
+
* A value the animator can drive.
|
|
949
|
+
*/
|
|
950
|
+
type MotionProperty = 'x' | 'y' | 'rotate' | 'scaleX' | 'scaleY' | 'opacity';
|
|
951
|
+
/**
|
|
952
|
+
* Values by property; `scale` sets `scaleX` and `scaleY` together.
|
|
953
|
+
*/
|
|
954
|
+
type MotionValues = Partial<Record<MotionProperty | 'scale', number>>;
|
|
955
|
+
/**
|
|
956
|
+
* A spring and the velocity it starts with.
|
|
957
|
+
*/
|
|
958
|
+
interface SpringTransition {
|
|
959
|
+
/** The spring, in any vocabulary of the constants table. */
|
|
960
|
+
spring: SpringDescription;
|
|
961
|
+
/**
|
|
962
|
+
* Initial velocities in units per second (px/s, deg/s, 1/s), for example a
|
|
963
|
+
* gesture's release velocity. A property without one keeps the velocity it
|
|
964
|
+
* has on screen.
|
|
965
|
+
*/
|
|
966
|
+
velocity?: MotionValues;
|
|
967
|
+
}
|
|
968
|
+
/** What `Animator.rebase` takes besides the amounts. */
|
|
969
|
+
interface RebaseOptions {
|
|
970
|
+
/** Time of the shift on the document timeline (ms). Defaults to now. */
|
|
971
|
+
at?: number;
|
|
972
|
+
/**
|
|
973
|
+
* Per property, the value its spring heads for after the shift. A spring
|
|
974
|
+
* whose target plus its amount lands there moves whole, before its first
|
|
975
|
+
* frame and once its start is known. Its curve and target move by the
|
|
976
|
+
* amount. It keeps its start time and velocity, as when the element's
|
|
977
|
+
* resting place moves under a curve that keeps going. If its first frame
|
|
978
|
+
* has run while its start is unread, only the model moves. The next call
|
|
979
|
+
* on the channel in the same task rebuilds its animation, or else the end
|
|
980
|
+
* of the task does.
|
|
981
|
+
*/
|
|
982
|
+
towards?: MotionValues;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Options of `animate` and `play`: the spring, a release velocity, the Reduced
|
|
986
|
+
* Motion handling.
|
|
987
|
+
*/
|
|
988
|
+
interface AnimateOptions {
|
|
989
|
+
/**
|
|
990
|
+
* Start time on the document timeline (ms, `performance.now()` clock).
|
|
991
|
+
* Defaults to now. Pass one value to several animators to put their
|
|
992
|
+
* animations on one clock.
|
|
993
|
+
*/
|
|
994
|
+
at?: number;
|
|
995
|
+
/**
|
|
996
|
+
* The call starts from the release of a touch drag (a sheet let go, a swipe
|
|
997
|
+
* back released). Under Reduced Motion it then cross-fades whatever the
|
|
998
|
+
* primary pointer (design:reduced-motion DR2), where another call on a
|
|
999
|
+
* fine primary pointer completes at once (DR3). The gesture host knows;
|
|
1000
|
+
* nothing is inferred from the last pointer.
|
|
1001
|
+
*/
|
|
1002
|
+
touchRelease?: boolean;
|
|
1003
|
+
/**
|
|
1004
|
+
* Which way the substituted cross-fade goes when the call's own opacity
|
|
1005
|
+
* does not say (a sheet slides in or out without fading): `'entrance'`
|
|
1006
|
+
* lands the travel at once and fades the opacity in from 0; `'exit'` fades
|
|
1007
|
+
* it out in place, then lands the travel and returns the opacity to its
|
|
1008
|
+
* value. The call's targets stay the end state; without Reduced Motion this
|
|
1009
|
+
* changes nothing.
|
|
1010
|
+
*/
|
|
1011
|
+
crossfadeAs?: 'entrance' | 'exit';
|
|
1012
|
+
/**
|
|
1013
|
+
* When the call's animations start. By default a call from rest starts
|
|
1014
|
+
* when the browser commits it. A call that continues motion on screen (a
|
|
1015
|
+
* retarget) starts now, from the value on screen. A curve whose tail
|
|
1016
|
+
* already shows as at rest counts as rest. Ignored with `at`.
|
|
1017
|
+
* - `'commit'`: a call that continues motion also starts when the browser
|
|
1018
|
+
* commits it. The browser dates it, as it dates a call from rest.
|
|
1019
|
+
* - `'presented'`: a call from rest leaves its element at rest. Its
|
|
1020
|
+
* animations are created two frames later, once the frame with the
|
|
1021
|
+
* element at rest has been presented. They then start at their commit,
|
|
1022
|
+
* so a busy UI process delays the motion instead of skipping into it.
|
|
1023
|
+
* Any other change to the animator before then creates the animations
|
|
1024
|
+
* first, in call order. A call that continues motion on screen starts
|
|
1025
|
+
* now, as by default.
|
|
1026
|
+
* - `'next-frame'`: the caller makes the call in an input event's own
|
|
1027
|
+
* task, never in a frame callback. The first frame whose callbacks run
|
|
1028
|
+
* after the call commits it. A call from rest starts at that frame,
|
|
1029
|
+
* however long the task ran, so a later listener's block delays the
|
|
1030
|
+
* motion. Without it, the browser dates the start inside that block, and
|
|
1031
|
+
* the motion skips ahead. A call that continues motion starts now, as by
|
|
1032
|
+
* default.
|
|
1033
|
+
*/
|
|
1034
|
+
start?: 'commit' | 'presented' | 'next-frame';
|
|
1035
|
+
/**
|
|
1036
|
+
* A call that retargets a curve on screen adds to it instead of replacing
|
|
1037
|
+
* it, as UIKit's animations do: the old curve keeps going (past its end, at
|
|
1038
|
+
* its target) and a spring of the difference between the two targets runs
|
|
1039
|
+
* from 0 on top, in the same animation. Its value and velocity at the call
|
|
1040
|
+
* are the old curve's, so whichever frame first shows it (WebKit can apply
|
|
1041
|
+
* a new curve tens of ms late), nothing steps back. Ignored for a property
|
|
1042
|
+
* at rest or still waiting for the browser's start, for a property given a
|
|
1043
|
+
* velocity, and under Reduced Motion. Use it for a played curve that starts
|
|
1044
|
+
* at rest (an eased reversal) while the property moves; a spring retarget
|
|
1045
|
+
* on the same spring moves the same either way, and a curve that already
|
|
1046
|
+
* continues the velocity on screen must not add to it.
|
|
1047
|
+
*/
|
|
1048
|
+
additive?: boolean;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Any closed-form curve to play on the compositor (`Animator.play`, and a
|
|
1052
|
+
* release's coast through `Animator.decay`): a spring chasing a moving
|
|
1053
|
+
* target, a piecewise curve, a fitted UIKit curve. Times are seconds from
|
|
1054
|
+
* the curve's start; the value at `duration` is the end state. Start it at
|
|
1055
|
+
* the property's presentation value (`get`) to continue without a jump.
|
|
1056
|
+
*/
|
|
1057
|
+
interface MotionCurve {
|
|
1058
|
+
/** Length, s. */
|
|
1059
|
+
readonly duration: number;
|
|
1060
|
+
/** Value `t` seconds after the start (0 ≤ t ≤ duration). */
|
|
1061
|
+
at: (t: number) => number;
|
|
1062
|
+
/** Velocity `t` seconds after the start, units/s. */
|
|
1063
|
+
velocity: (t: number) => number;
|
|
1064
|
+
/**
|
|
1065
|
+
* A transition started on release rather than a throw's momentum (a
|
|
1066
|
+
* spring back from past an edge): under Reduce Motion it is no coast and
|
|
1067
|
+
* cross-fades like `animate` (`design:reduced-motion` DR2).
|
|
1068
|
+
*/
|
|
1069
|
+
readonly isTransition?: boolean;
|
|
1070
|
+
}
|
|
1071
|
+
/** How `set` puts values in place. */
|
|
1072
|
+
interface SetOptions {
|
|
1073
|
+
/**
|
|
1074
|
+
* Whether the write promotes its channels to a compositing layer, as a
|
|
1075
|
+
* drag's per-frame writes need so each is a composite only (default
|
|
1076
|
+
* true). `false` writes the values and nothing else: a one-off switch that
|
|
1077
|
+
* must not give its element a layer, such as a veil under a sticky header
|
|
1078
|
+
* switched during a programmatic scroll (on iOS 26.2, a layer there blanks
|
|
1079
|
+
* the header's painted items for about two frames). A channel another
|
|
1080
|
+
* motion keeps promoted stays promoted, and a channel with other motion
|
|
1081
|
+
* still running gets its animation's layer as usual.
|
|
1082
|
+
*/
|
|
1083
|
+
promote?: boolean;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Options of `createMotionEngine`.
|
|
1087
|
+
*/
|
|
1088
|
+
interface AnimatorOptions {
|
|
1089
|
+
/**
|
|
1090
|
+
* Animates a pseudo-element of the element instead (`'::backdrop'` of a
|
|
1091
|
+
* native dialog). A pseudo-element has no inline style. So a static filling
|
|
1092
|
+
* animation holds its value after a curve ends and after `set`, unless the
|
|
1093
|
+
* value is its `base`.
|
|
1094
|
+
*/
|
|
1095
|
+
pseudoElement?: string;
|
|
1096
|
+
/** Starting values; identity by default. Never read from the DOM. */
|
|
1097
|
+
initial?: MotionValues;
|
|
1098
|
+
/**
|
|
1099
|
+
* For a pseudo-element: the values its own stylesheet shows at rest. A
|
|
1100
|
+
* value equal to its base needs no holding animation, so the
|
|
1101
|
+
* pseudo-element keeps no compositing layer there. Declare only what the
|
|
1102
|
+
* stylesheet shows: in development, the first hold dropped warns when the
|
|
1103
|
+
* computed style differs.
|
|
1104
|
+
*/
|
|
1105
|
+
base?: MotionValues;
|
|
1106
|
+
/** Clock in ms on the document timeline's time base. */
|
|
1107
|
+
now?: () => number;
|
|
1108
|
+
/**
|
|
1109
|
+
* Runs a callback in the next animation frame, with the frame's timestamp;
|
|
1110
|
+
* `requestAnimationFrame` by default. A call from rest reads the start the
|
|
1111
|
+
* browser gave it there.
|
|
1112
|
+
*/
|
|
1113
|
+
requestFrame?: (callback: (frame?: number) => void) => void;
|
|
1114
|
+
/**
|
|
1115
|
+
* Renders `x` into this custom property instead of `translate`, for an
|
|
1116
|
+
* element whose parts all read one value, such as a row's swipe travel.
|
|
1117
|
+
* `y` is not rendered. The value is a `<length>` in px or a plain
|
|
1118
|
+
* `<number>`. Registration lets it interpolate. It is inherited, so every
|
|
1119
|
+
* part of the element reads it. It animates on the main thread, not the
|
|
1120
|
+
* compositor, and every other channel renders as usual.
|
|
1121
|
+
* A `companion` is a second custom property that its `map` draws from x in
|
|
1122
|
+
* the same keyframes and writes. It shares x's animation and start, so it
|
|
1123
|
+
* follows x through every retarget and Reduce Motion plan.
|
|
1124
|
+
*/
|
|
1125
|
+
customProperty?: {
|
|
1126
|
+
name: string;
|
|
1127
|
+
syntax: '<length>' | '<number>';
|
|
1128
|
+
companion?: {
|
|
1129
|
+
name: string;
|
|
1130
|
+
syntax: '<length>' | '<number>';
|
|
1131
|
+
map: (x: number) => number;
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* One `animate` / `decay` call's animations.
|
|
1137
|
+
*/
|
|
1138
|
+
interface MotionHandle {
|
|
1139
|
+
/** The properties this call drives. */
|
|
1140
|
+
readonly properties: ReadonlyArray<MotionProperty>;
|
|
1141
|
+
/**
|
|
1142
|
+
* True when every property reached the end of this call's curve, false
|
|
1143
|
+
* as soon as any of them is retargeted, stopped or set before that.
|
|
1144
|
+
*/
|
|
1145
|
+
readonly finished: Promise<boolean>;
|
|
1146
|
+
/**
|
|
1147
|
+
* When the motion started on the document timeline (ms): for a call from
|
|
1148
|
+
* rest, the time the browser committed it (a block before the first frame
|
|
1149
|
+
* moves it later); otherwise the call time, or `at`. A retarget whose
|
|
1150
|
+
* frame comes late starts its springs at that frame, and this stays the
|
|
1151
|
+
* call time.
|
|
1152
|
+
*/
|
|
1153
|
+
readonly started: Promise<number>;
|
|
1154
|
+
/** Presentation value of a property at `time` (default now). */
|
|
1155
|
+
value: (property: MotionProperty, time?: number) => number;
|
|
1156
|
+
/** Presentation velocity of a property at `time`, units/s. */
|
|
1157
|
+
velocity: (property: MotionProperty, time?: number) => number;
|
|
1158
|
+
/**
|
|
1159
|
+
* The curve this call started on `property` (`scale` reads `scaleX`),
|
|
1160
|
+
* in seconds from the call's start: what the keyframes play. Null for a
|
|
1161
|
+
* property the call does not move, or moves without travel (Reduced
|
|
1162
|
+
* Motion). Map it onto a companion property with `mapProgress`, and play
|
|
1163
|
+
* that on the same clock. A retarget whose frame comes late starts its
|
|
1164
|
+
* spring again at that frame, and this stays the curve the call started.
|
|
1165
|
+
*/
|
|
1166
|
+
curve: (property: MotionProperty | 'scale') => MotionCurve | null;
|
|
1167
|
+
/** New targets for this call's properties, keeping their velocity. */
|
|
1168
|
+
retarget: (to: MotionValues, transition?: SpringTransition, options?: AnimateOptions) => MotionHandle;
|
|
1169
|
+
/** Freezes this call's properties at their presentation values. */
|
|
1170
|
+
stop: () => void;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* A compositor animator bound to one element (see the file header).
|
|
1174
|
+
*/
|
|
1175
|
+
interface Animator {
|
|
1176
|
+
/**
|
|
1177
|
+
* What Reduced Motion makes of a call on this element right now:
|
|
1178
|
+
* `'off'` (motion plays), `'crossfade'` (an opacity-only fade: a coarse
|
|
1179
|
+
* pointer, or `touchRelease`) or `'instant'` (any other pointer). For
|
|
1180
|
+
* feedback that has no fade of its own (a press lift, a lens chasing the
|
|
1181
|
+
* finger): skip it unless `'off'`.
|
|
1182
|
+
*/
|
|
1183
|
+
reducedMotion: (options?: {
|
|
1184
|
+
touchRelease?: boolean;
|
|
1185
|
+
}) => 'off' | 'crossfade' | 'instant';
|
|
1186
|
+
/** The element the animator writes to, if attached. */
|
|
1187
|
+
readonly element: HTMLElement | null;
|
|
1188
|
+
/**
|
|
1189
|
+
* Attaches (or detaches, with null) the element. Attaching writes the
|
|
1190
|
+
* current state and resumes running curves from now.
|
|
1191
|
+
*/
|
|
1192
|
+
attach: (element: HTMLElement | null) => void;
|
|
1193
|
+
/** Presentation value at `time` (default now), from the curve. */
|
|
1194
|
+
get: (property: MotionProperty | 'scale', time?: number) => number;
|
|
1195
|
+
/** Presentation velocity at `time` (default now), units/s. */
|
|
1196
|
+
getVelocity: (property: MotionProperty | 'scale', time?: number) => number;
|
|
1197
|
+
/**
|
|
1198
|
+
* Puts values in place now, ending their animations: the per-frame write
|
|
1199
|
+
* of a drag (one style write per channel, no animation when nothing else
|
|
1200
|
+
* on the channel is moving).
|
|
1201
|
+
*/
|
|
1202
|
+
set: (values: MotionValues, options?: SetOptions) => void;
|
|
1203
|
+
/** Springs to `to` from the presentation values. */
|
|
1204
|
+
animate: (to: MotionValues, transition: SpringTransition, options?: AnimateOptions) => MotionHandle;
|
|
1205
|
+
/**
|
|
1206
|
+
* Plays given curves (`scale` drives both axes), baked like a spring:
|
|
1207
|
+
* presentation values, velocities, `stop`, `finished` and the shared
|
|
1208
|
+
* clock work the same, and a later `animate` starts from the curve's
|
|
1209
|
+
* value and velocity. Reduced Motion treats a curve that moves x, y, rotate
|
|
1210
|
+
* or scale as travel, which the policy replaces (design:reduced-motion: a
|
|
1211
|
+
* cross-fade after a touch, an immediate change otherwise). Its handle has
|
|
1212
|
+
* no spring of its own: `retarget` needs one.
|
|
1213
|
+
*/
|
|
1214
|
+
play: (curves: Partial<Record<MotionProperty | 'scale', MotionCurve>>, options?: AnimateOptions) => MotionHandle;
|
|
1215
|
+
/**
|
|
1216
|
+
* Plays momentum curves as given, on the translate axes only: a released
|
|
1217
|
+
* scroll view's coast and edge bounce, which `coast()` (coast.ts) builds
|
|
1218
|
+
* from a finger's release velocity. Under Reduce Motion momentum keeps
|
|
1219
|
+
* its motion: it continues a throw, direct movement (design:reduced-motion
|
|
1220
|
+
* DR2, DEC-2). A curve marked `isTransition` (coast()'s spring back from
|
|
1221
|
+
* past an edge) is a transition and plays through the Reduce Motion
|
|
1222
|
+
* policy, as `animate` does. Anything else (a fade, a slide a tap starts)
|
|
1223
|
+
* is a transition too: play it with `play` or `animate`. Pass
|
|
1224
|
+
* `touchRelease` when a touch drag's release starts it, so a spring back
|
|
1225
|
+
* cross-fades on any pointer (DR2). Only a surface that coasts imports the
|
|
1226
|
+
* coast math and the scroll table.
|
|
1227
|
+
*/
|
|
1228
|
+
decay: (curves: Partial<Record<'x' | 'y', MotionCurve>>, options?: Pick<AnimateOptions, 'at' | 'touchRelease'>) => MotionHandle;
|
|
1229
|
+
/**
|
|
1230
|
+
* Moves properties by the given amounts at once, as when a layout shift
|
|
1231
|
+
* moves the element under them: a property moving on a spring keeps its
|
|
1232
|
+
* spring, velocity and target (the curve restarts from the shifted value);
|
|
1233
|
+
* any other moving curve shifts whole, its end included; a resting
|
|
1234
|
+
* property takes the offset and stays. `towards` moves some springs whole
|
|
1235
|
+
* instead (RebaseOptions).
|
|
1236
|
+
*/
|
|
1237
|
+
rebase: (deltas: MotionValues, options?: RebaseOptions) => void;
|
|
1238
|
+
/** Freezes properties (all by default) at their presentation values. */
|
|
1239
|
+
stop: (properties?: ReadonlyArray<MotionProperty | 'scale'>) => void;
|
|
1240
|
+
/**
|
|
1241
|
+
* Resolves once none of `properties` (every property by default) is moving:
|
|
1242
|
+
* after the last curve ends, whoever started it, retargets included.
|
|
1243
|
+
*/
|
|
1244
|
+
atRest: (properties?: ReadonlyArray<MotionProperty | 'scale'>) => Promise<void>;
|
|
1245
|
+
/** Cancels everything and detaches. */
|
|
1246
|
+
dispose: () => void;
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/motion/animator.d.ts
|
|
1250
|
+
/**
|
|
1251
|
+
* The one animator for `element` (and `options.pseudoElement`), created on
|
|
1252
|
+
* first use. Code that animates one element from several places (a swipe on
|
|
1253
|
+
* x, a removal on y) shares it, so their curves compose in one `translate`
|
|
1254
|
+
* track and retargeting one axis leaves the other on its curve; two
|
|
1255
|
+
* animators on one element would overwrite each other. `options` apply
|
|
1256
|
+
* when it is created; later calls get the same animator. Never `attach` it
|
|
1257
|
+
* elsewhere or `dispose` it: it lives as long as the element.
|
|
1258
|
+
*/
|
|
1259
|
+
export declare function animatorFor(element: HTMLElement, options?: AnimatorOptions): Animator;
|
|
1260
|
+
/**
|
|
1261
|
+
* Creates an animator for `element` (or for an element attached later).
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```
|
|
1265
|
+
* const animator = createMotionEngine(sheet);
|
|
1266
|
+
* // finger lifts at 1200 px/s heading for the detent at 0 (a component
|
|
1267
|
+
* // passes the spring of its motion role):
|
|
1268
|
+
* animator.animate({y: 0}, {spring: {response: 0.45, dampingRatio: 0.9}, velocity: {y: 1200}});
|
|
1269
|
+
* // the finger lands again: where is it right now?
|
|
1270
|
+
* const y = animator.get('y', event.timeStamp);
|
|
1271
|
+
* animator.stop(['y']);
|
|
1272
|
+
* ```
|
|
1273
|
+
*/
|
|
1274
|
+
export declare function createMotionEngine(element: HTMLElement | null, options?: AnimatorOptions): Animator;
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/composables/internal/focusLeaving.d.ts
|
|
1277
|
+
/**
|
|
1278
|
+
* 如果变化会让焦点丢掉就返回 true:现在哪儿都没有焦点,或者焦点还在即将被藏起的 `surface` 里。
|
|
1279
|
+
* 读 `surface` 自己所在的文档,所以 iframe 或画中画窗口里的元素也能判断。
|
|
1280
|
+
*/
|
|
1281
|
+
export declare function isFocusLost(surface: Element | null, doc?: Document): boolean;
|
|
1282
|
+
//#endregion
|
|
1283
|
+
//#region src/composables/internal/interactionModality.d.ts
|
|
1284
|
+
/**
|
|
1285
|
+
* 交互模态:用户上一次是用键盘还是用指针(鼠标、手指、笔)操作的。
|
|
1286
|
+
*
|
|
1287
|
+
* `:focus-visible` 仍然是画焦点环的条件,但它答不了「是不是键盘移过来的焦点」:
|
|
1288
|
+
* 鼠标点进文本框也会命中 `:focus-visible`,程序聚焦也会。只想在键盘操作后画环的组件,
|
|
1289
|
+
* 拿这里的答案和 `:focus-visible` 一起判断,不是替代它。
|
|
1290
|
+
*
|
|
1291
|
+
* 状态挂在 `document` 上(用全局 Symbol 作键),页面里就算打进了两份本库,
|
|
1292
|
+
* 也只有一份状态、一对监听。第一个用到的组件装上监听,之后一直留到页面结束,
|
|
1293
|
+
* 免得两个组件之间的空档里漏掉输入。模块加载时不碰 DOM,服务端答键盘(最安全的默认)。
|
|
1294
|
+
*/
|
|
1295
|
+
type InteractionModality = 'keyboard' | 'pointer';
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region src/composables/internal/focusReturn.d.ts
|
|
1298
|
+
/**
|
|
1299
|
+
* 程序移动焦点,焦点环跟着上一次的输入走:
|
|
1300
|
+
* 上一次是键盘就照常画环,上一次是鼠标或手指就不画。
|
|
1301
|
+
*
|
|
1302
|
+
* 用鼠标或手指关掉浮层后,焦点回到触发器上,但触发器不会突然亮起一圈焦点环。
|
|
1303
|
+
* 文本输入类元素例外:它们本来就要画出「打字会落在这里」,多一次 blur 还可能触发校验,
|
|
1304
|
+
* 所以一律直接聚焦。`options` 原样交给 `focus()`,例如 `preventScroll`。
|
|
1305
|
+
* `modality` 是调用方已经读到的上一次输入,不传就读页面当前的。
|
|
1306
|
+
*/
|
|
1307
|
+
export declare function focusForLastInput(element: HTMLElement, options?: FocusOptions, modality?: InteractionModality): void;
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/composables/internal/hitArea.d.ts
|
|
1310
|
+
/**
|
|
1311
|
+
* @file hitArea.ts
|
|
1312
|
+
* @input 目标的矩形和它周围可点元素的矩形
|
|
1313
|
+
* @output 触控热区的几何:目标每一边最多能往外长多少(朝 44px 长,碰到邻居就停在一半间距),
|
|
1314
|
+
* 组的整体长法,以及一次触摸该算给哪个目标
|
|
1315
|
+
* @position 内部工具,不对外导出。实时测量在 hitAreaWatch.ts,Vue 接入在 useTouchHitArea.ts。
|
|
1316
|
+
*
|
|
1317
|
+
* 手指需要 44 × 44px 的目标,但控件在手机上不一定能变大,热区也不能抢走邻居的点按。
|
|
1318
|
+
* 所以每一边朝 44px 长,长到离最近邻居一半间距的地方就停:落在间隙里的触摸总归离它更近的那个。
|
|
1319
|
+
*/
|
|
1320
|
+
/** 视口坐标里的矩形。 */
|
|
1321
|
+
interface HitRect {
|
|
1322
|
+
readonly left: number;
|
|
1323
|
+
readonly top: number;
|
|
1324
|
+
readonly right: number;
|
|
1325
|
+
readonly bottom: number;
|
|
1326
|
+
}
|
|
1327
|
+
/** 热区在目标每一边往外伸出多少,px。 */
|
|
1328
|
+
interface HitInsets {
|
|
1329
|
+
readonly top: number;
|
|
1330
|
+
readonly right: number;
|
|
1331
|
+
readonly bottom: number;
|
|
1332
|
+
readonly left: number;
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/composables/internal/hitAreaWatch.d.ts
|
|
1336
|
+
interface WatchHitAreaOptions {
|
|
1337
|
+
/**
|
|
1338
|
+
* 碰到邻居之前每一边长多少,在测量时读。组传成员的 `groupGrowth`。
|
|
1339
|
+
* @default 每条轴居中朝 44px 长
|
|
1340
|
+
*/
|
|
1341
|
+
readonly growth?: (target: HitRect, element: HTMLElement) => HitInsets;
|
|
1342
|
+
/**
|
|
1343
|
+
* 手指轻点时是否对照页面复查一次:邻居在上次测量后挪近了,这次点按就作废,不会点错。
|
|
1344
|
+
* 自己在按下时读成员位置的组关掉它。
|
|
1345
|
+
* @default true
|
|
1346
|
+
*/
|
|
1347
|
+
readonly checkAtPress?: boolean;
|
|
1348
|
+
}
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region src/composables/internal/useTouchHitArea.d.ts
|
|
1351
|
+
/**
|
|
1352
|
+
* 在 `enabled` 为真(元素接受点按)期间看着 `element` 的热区。元素换了、关掉或卸载时停下并清掉写过的值。
|
|
1353
|
+
* 细指针下共用的测量什么都不观察,热区保持 0。
|
|
1354
|
+
*/
|
|
1355
|
+
export declare function useTouchHitArea(element: MaybeRefOrGetter<HTMLElement | null | undefined>, enabled: MaybeRefOrGetter<boolean>, options?: WatchHitAreaOptions): void;
|
|
1356
|
+
//#endregion
|
|
1357
|
+
//#region src/utils/inputAge.d.ts
|
|
1358
|
+
/**
|
|
1359
|
+
* @file inputAge.ts
|
|
1360
|
+
* @input An input's time stamp, and its event or the node it landed on
|
|
1361
|
+
* @output clockOf, timeOn and msSinceInput: the clock of the window that
|
|
1362
|
+
* stamped an input, its time on that clock, and how long ago it happened
|
|
1363
|
+
* @position Internal utility. The content-touch delay (utils/pressFeedback.ts,
|
|
1364
|
+
* gestures/PressTracker.ts) and the long-press hold
|
|
1365
|
+
* (hooks/longPressDetector.ts) count from the touch with it.
|
|
1366
|
+
*/
|
|
1367
|
+
/**
|
|
1368
|
+
* The part of a window's performance timeline an input's age reads, with
|
|
1369
|
+
* the time origin that converts an epoch stamp.
|
|
1370
|
+
*/
|
|
1371
|
+
type EventClock = Pick<Performance, 'now' | 'timeOrigin'>;
|
|
1372
|
+
//#endregion
|
|
1373
|
+
//#region src/gestures/ScreenEdgePanGestureRecognizer.d.ts
|
|
1374
|
+
/**
|
|
1375
|
+
* An edge by writing direction: under RTL the leading edge is the right one.
|
|
1376
|
+
* Top and bottom edges land with their first user.
|
|
1377
|
+
*/
|
|
1378
|
+
type ScreenEdge = 'leading' | 'trailing';
|
|
1379
|
+
/** A physical horizontal edge of the viewport. */
|
|
1380
|
+
type PhysicalEdge = 'left' | 'right';
|
|
1381
|
+
/**
|
|
1382
|
+
* A screen-edge pan is a finger's: it takes no `allowedPointerTypes` and no
|
|
1383
|
+
* `allowedScrollTypes`, so neither a mouse, a trackpad nor a pen drives it.
|
|
1384
|
+
*/
|
|
1385
|
+
interface ScreenEdgePanGestureRecognizerOptions extends Omit<PanGestureRecognizerOptions, 'direction' | 'allowedPointerTypes' | 'allowedScrollTypes' | 'hysteresis'> {
|
|
1386
|
+
/** The edges a touch may start from. @default ['leading'] */
|
|
1387
|
+
edges?: ReadonlyArray<ScreenEdge>;
|
|
1388
|
+
/** Width of the band at each edge, px. */
|
|
1389
|
+
edgeRegion?: number;
|
|
1390
|
+
/**
|
|
1391
|
+
* The travel that begins the pan in its edge zone, px. It is one number for
|
|
1392
|
+
* every press, since the zone sets the threshold itself. @default UIKit's 15
|
|
1393
|
+
*/
|
|
1394
|
+
hysteresis?: number;
|
|
1395
|
+
}
|
|
1396
|
+
export declare class ScreenEdgePanGestureRecognizer extends PanGestureRecognizer {
|
|
1397
|
+
get kind(): PanGestureRecognizer['kind'];
|
|
1398
|
+
edges: ReadonlyArray<ScreenEdge>;
|
|
1399
|
+
edgeRegion: number;
|
|
1400
|
+
/** The physical edge the current gesture started from. */
|
|
1401
|
+
activeEdge: PhysicalEdge | null;
|
|
1402
|
+
/**
|
|
1403
|
+
* Internal. Set by the host while attached: called when the edge-zone
|
|
1404
|
+
* answer changes, so the element's `touch-action` follows it
|
|
1405
|
+
* (spec:AST-094 FR19, DEC-22).
|
|
1406
|
+
*/
|
|
1407
|
+
onTouchBehaviorChange: (() => void) | null;
|
|
1408
|
+
/** The hysteresis where the pan takes its axis (UIKit's 15 px). */
|
|
1409
|
+
private readonly edgeHysteresis;
|
|
1410
|
+
/** What the pan measured of its view (see EdgeLayout), until a layout change. */
|
|
1411
|
+
private layout;
|
|
1412
|
+
constructor(options?: ScreenEdgePanGestureRecognizerOptions);
|
|
1413
|
+
/**
|
|
1414
|
+
* The pan takes the horizontal axis only in its edge zone, a view within
|
|
1415
|
+
* the band of an edge it watches; elsewhere it leaves the browser every
|
|
1416
|
+
* touch behavior, so the author's scrolling is untouched (spec:AST-094
|
|
1417
|
+
* FR18), never claiming across a whole wider element.
|
|
1418
|
+
*/
|
|
1419
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
1420
|
+
/**
|
|
1421
|
+
* Internal. Whether the edge zone depends on the viewport's width: the pan
|
|
1422
|
+
* watches the right side, whose band moves with the viewport, so the host
|
|
1423
|
+
* reports a viewport resize to it as well as its own box's (FR19, FR24).
|
|
1424
|
+
*/
|
|
1425
|
+
get watchesViewport(): boolean;
|
|
1426
|
+
/**
|
|
1427
|
+
* Internal. The view's box may have changed (a resize): its edges' sides
|
|
1428
|
+
* and the edge zone are measured again, and a changed answer calls
|
|
1429
|
+
* onTouchBehaviorChange.
|
|
1430
|
+
*/
|
|
1431
|
+
layoutChanged(): void;
|
|
1432
|
+
protected touchesBegan(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
1433
|
+
/**
|
|
1434
|
+
* The physical sides the pan's edges resolve to under the view's writing
|
|
1435
|
+
* direction, and the sides whose band the view lies within, measured
|
|
1436
|
+
* together once until a layout change: the view starts at that side and
|
|
1437
|
+
* reaches no farther than `edgeRegion` from it, within layout's rounding
|
|
1438
|
+
* (a strip authored at the 40.2 px region lays out at 40.203 px, on
|
|
1439
|
+
* 1/64 px). A view that cannot be measured lies within none.
|
|
1440
|
+
*/
|
|
1441
|
+
private measured;
|
|
1442
|
+
protected reset(): void;
|
|
1443
|
+
private edgeAt;
|
|
1444
|
+
}
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region src/gestures/hostHelpers.d.ts
|
|
1447
|
+
interface PlacedContact {
|
|
1448
|
+
readonly x: number;
|
|
1449
|
+
readonly y: number;
|
|
1450
|
+
readonly target: unknown;
|
|
1451
|
+
}
|
|
1452
|
+
//#endregion
|
|
1453
|
+
//#region src/gestures/hostWheel.d.ts
|
|
1454
|
+
/** A wheel gesture: the contacts it drives in the arena, or none where the page keeps it. */
|
|
1455
|
+
interface WheelGesture {
|
|
1456
|
+
readonly kind: 'pan' | 'pinch';
|
|
1457
|
+
/** A mouse wheel's notches, or a trackpad's continuous scroll. */
|
|
1458
|
+
readonly scrollType: ScrollType;
|
|
1459
|
+
readonly ids: ReadonlyArray<number>;
|
|
1460
|
+
/** A pan's contact, or a pinch's center. */
|
|
1461
|
+
x: number;
|
|
1462
|
+
y: number;
|
|
1463
|
+
/** A pinch's span between its two contacts. */
|
|
1464
|
+
span: number;
|
|
1465
|
+
/** The latest wheel's time. */
|
|
1466
|
+
last: number;
|
|
1467
|
+
/**
|
|
1468
|
+
* How long after its last wheel it ends, ms. A trackpad pan stream waits
|
|
1469
|
+
* out its axis's pause bound, whoever keeps it. A pinch or a mouse wheel's
|
|
1470
|
+
* notches wait 100 ms.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly endMs: number;
|
|
1473
|
+
timer: unknown;
|
|
1474
|
+
/** The recognizers that took it; none where the page keeps it. */
|
|
1475
|
+
readonly takers: ReadonlyArray<GestureRecognizer>;
|
|
1476
|
+
/** A trackpad scroll a pan follows, until its fingers lift. */
|
|
1477
|
+
follow?: WheelFollow;
|
|
1478
|
+
}
|
|
1479
|
+
/** A trackpad scroll a pan follows: where its fingers lift, and what waits until then. */
|
|
1480
|
+
interface WheelFollow {
|
|
1481
|
+
/** The fingers lifted: the momentum after them never moves the pan. */
|
|
1482
|
+
lifted: boolean;
|
|
1483
|
+
/**
|
|
1484
|
+
* Shrinking deltas held until the splitter decides. They are the fingers'
|
|
1485
|
+
* when larger ones follow, and the start of momentum when it reads the
|
|
1486
|
+
* lift.
|
|
1487
|
+
*/
|
|
1488
|
+
heldX: number;
|
|
1489
|
+
heldY: number;
|
|
1490
|
+
/** The time of the fingers' last move the pan took. */
|
|
1491
|
+
lastMove: number;
|
|
1492
|
+
/** The fingers' travel as of that move: the contact without any held delta. */
|
|
1493
|
+
trueX: number;
|
|
1494
|
+
trueY: number;
|
|
1495
|
+
/** Where the pan was shown at that move, which the undecided stretch moves on from. */
|
|
1496
|
+
baseX: number;
|
|
1497
|
+
baseY: number;
|
|
1498
|
+
/** The fingers' speed at that move, content px per ms. */
|
|
1499
|
+
speedX: number;
|
|
1500
|
+
speedY: number;
|
|
1501
|
+
/**
|
|
1502
|
+
* The reading behind that speed: the fingers' travel where it began, and
|
|
1503
|
+
* its interval in ms.
|
|
1504
|
+
*/
|
|
1505
|
+
readFromX: number;
|
|
1506
|
+
readFromY: number;
|
|
1507
|
+
readSpan: number;
|
|
1508
|
+
/** The fingers' speed before that reading, content px per ms. */
|
|
1509
|
+
priorSpeedX: number;
|
|
1510
|
+
priorSpeedY: number;
|
|
1511
|
+
}
|
|
1512
|
+
//#endregion
|
|
1513
|
+
//#region src/gestures/PressTracker.d.ts
|
|
1514
|
+
interface PressBounds {
|
|
1515
|
+
readonly left: number;
|
|
1516
|
+
readonly top: number;
|
|
1517
|
+
readonly right: number;
|
|
1518
|
+
readonly bottom: number;
|
|
1519
|
+
}
|
|
1520
|
+
//#endregion
|
|
1521
|
+
//#region src/gestures/hostTypes.d.ts
|
|
1522
|
+
interface Registration {
|
|
1523
|
+
readonly recognizers: GestureRecognizer[];
|
|
1524
|
+
consumer: TouchConsumer | null;
|
|
1525
|
+
/**
|
|
1526
|
+
* Where fingers come from their pointer events, whether the element
|
|
1527
|
+
* carries the host's blocking `touchend` handler, which cancels a claimed
|
|
1528
|
+
* finger's lift (`spec:AST-094` FR21).
|
|
1529
|
+
*/
|
|
1530
|
+
hasTouchEndListener: boolean;
|
|
1531
|
+
/** Whether the element carries the host's shared blocking touchmove handler. */
|
|
1532
|
+
hasTouchMoveListener: boolean;
|
|
1533
|
+
/** Whether the element carries the host's wheel handler. */
|
|
1534
|
+
hasWheelListener: boolean;
|
|
1535
|
+
/** Inline values the host replaced, to restore on detach. */
|
|
1536
|
+
readonly savedStyle: Map<string, string>;
|
|
1537
|
+
/**
|
|
1538
|
+
* What the element's own stylesheet gives it, read in a frame for the
|
|
1539
|
+
* derived value the host marked then: `null` where the host's rule is in
|
|
1540
|
+
* force (the author sets nothing else); the host never allows more than
|
|
1541
|
+
* the author does. `null` before the read.
|
|
1542
|
+
*/
|
|
1543
|
+
authorTouchAction: {
|
|
1544
|
+
derived: string;
|
|
1545
|
+
author: string | null;
|
|
1546
|
+
} | null;
|
|
1547
|
+
manageStyle: boolean;
|
|
1548
|
+
/**
|
|
1549
|
+
* The recognizers attached with `manageStyle: false`. The host styles the
|
|
1550
|
+
* element for its other recognizers only.
|
|
1551
|
+
*/
|
|
1552
|
+
readonly unstyled: Set<GestureRecognizer>;
|
|
1553
|
+
/** An action group (`family:action-groups` FR5). */
|
|
1554
|
+
actionGroup: boolean;
|
|
1555
|
+
/** The attachments that asked for the action group; it lasts while one does. */
|
|
1556
|
+
actionGroupAsks: number;
|
|
1557
|
+
}
|
|
1558
|
+
interface GestureHostOptions {
|
|
1559
|
+
/** The arena's clock; tests pass a manual one. */
|
|
1560
|
+
clock?: GestureClock;
|
|
1561
|
+
/**
|
|
1562
|
+
* Where fingers come from: Touch Events where the browser has them
|
|
1563
|
+
* (`auto`), or Pointer Events only.
|
|
1564
|
+
*/
|
|
1565
|
+
inputMode?: 'auto' | 'pointer-events';
|
|
1566
|
+
/** Every recognizer transition, for debugging and tests. */
|
|
1567
|
+
onTransition?: GestureArenaOptions['onTransition'];
|
|
1568
|
+
/**
|
|
1569
|
+
* Send a contact to what is drawn while a compositor animation moves an
|
|
1570
|
+
* element (motion/presentation.ts): `auto` where the engine hit-tests such
|
|
1571
|
+
* an element where its animation started (iOS WebKit); `always` or
|
|
1572
|
+
* `never` for tests. @default 'auto'
|
|
1573
|
+
*/
|
|
1574
|
+
presentedHitTesting?: 'auto' | 'always' | 'never';
|
|
1575
|
+
/**
|
|
1576
|
+
* Whether the primary pointer is coarse (a phone, a tablet). Gestures
|
|
1577
|
+
* attach for every pointer (`spec:AST-094` FR43); where it is fine, an
|
|
1578
|
+
* element that uses a gesture keeps one passive `pointerdown` listener
|
|
1579
|
+
* (beside a claiming recognizer's blocking `touchmove`, FR19) and the
|
|
1580
|
+
* page's listeners last only a press (FR24).
|
|
1581
|
+
* @default `(pointer: coarse)` on the document's window
|
|
1582
|
+
*/
|
|
1583
|
+
isPrimaryPointerCoarse?: () => boolean;
|
|
1584
|
+
}
|
|
1585
|
+
interface AttachOptions {
|
|
1586
|
+
/**
|
|
1587
|
+
* Let the host set the element's styles: its `touch-action`, and the
|
|
1588
|
+
* selection and callout lock a hold that does something keeps while it is
|
|
1589
|
+
* held (`spec:AST-094` FR41). With false the caller keeps both for this
|
|
1590
|
+
* recognizer, and the host still styles the element for its others.
|
|
1591
|
+
* @default true
|
|
1592
|
+
*/
|
|
1593
|
+
manageStyle?: boolean;
|
|
1594
|
+
/**
|
|
1595
|
+
* Accepted and ignored: every attachment reads each event's pointer
|
|
1596
|
+
* (`spec:AST-094` FR43). Kept so callers written before FR43 compile.
|
|
1597
|
+
* @deprecated
|
|
1598
|
+
*/
|
|
1599
|
+
perEventPointer?: boolean;
|
|
1600
|
+
/**
|
|
1601
|
+
* The element is an action group, sibling actions a held pointer slides
|
|
1602
|
+
* across (`family:action-groups` FR5). It is served like every
|
|
1603
|
+
* attachment, for every pointer (`spec:AST-094` FR43). @default false
|
|
1604
|
+
*/
|
|
1605
|
+
actionGroup?: boolean;
|
|
1606
|
+
}
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region src/utils/dragSelection.d.ts
|
|
1609
|
+
/**
|
|
1610
|
+
* @file dragSelection.ts
|
|
1611
|
+
* @input The elements a claimed mouse or pen drag presses, their window,
|
|
1612
|
+
* and the page's selection when the press began
|
|
1613
|
+
* @output lockDragSelection (and its DragSelectionHold and
|
|
1614
|
+
* DragSelectionReleaseOptions): a claimed drag's hold, which refuses a new
|
|
1615
|
+
* selection and keeps the page's
|
|
1616
|
+
* @position The gesture host's drag hold; a held finger's lock is
|
|
1617
|
+
* lockSelection in selectionLock.ts, and the selection reads are
|
|
1618
|
+
* selectionRanges.ts
|
|
1619
|
+
*
|
|
1620
|
+
* SYNC: When modified, update gestures/hostSelection.ts.
|
|
1621
|
+
*/
|
|
1622
|
+
interface DragSelectionReleaseOptions {
|
|
1623
|
+
/**
|
|
1624
|
+
* The press was cancelled (a pointercancel, a blur, a detach), so no
|
|
1625
|
+
* mouseup or click follows: the hold ends at once. Called again after a
|
|
1626
|
+
* lift, it ends the hold's last task at once too.
|
|
1627
|
+
*/
|
|
1628
|
+
isCancel?: boolean;
|
|
1629
|
+
}
|
|
1630
|
+
/** A drag's selection hold: call it to release the hold. */
|
|
1631
|
+
interface DragSelectionHold {
|
|
1632
|
+
(options?: DragSelectionReleaseOptions): void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Called after the lift's own handlers ran. A selection they made since
|
|
1635
|
+
* the release stays: the hold then puts it back, not the press's.
|
|
1636
|
+
*/
|
|
1637
|
+
keepLiftSelection: () => void;
|
|
1638
|
+
}
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region src/gestures/wheelSegmenter.d.ts
|
|
1641
|
+
/**
|
|
1642
|
+
* @file wheelSegmenter.ts
|
|
1643
|
+
* @input A wheel stream's deltas along one axis, with their event times
|
|
1644
|
+
* @output Exports WheelSegmenter and isBunched. WheelSegmenter splits the
|
|
1645
|
+
* stream into gestures and reads a trackpad's lift (the onset of momentum).
|
|
1646
|
+
* It keeps a trackpad's late or merged glide wheels in their flick.
|
|
1647
|
+
* isBunched tells one stall's merge from a frame.
|
|
1648
|
+
* @position Read by GestureHost.ts's wheel input: the web reports no
|
|
1649
|
+
* trackpad contact or phase, so both are inferred.
|
|
1650
|
+
*/
|
|
1651
|
+
type WheelBoundary = 'first' | 'idle' | 'reversal' | 'jump' | 'gap';
|
|
1652
|
+
type WheelPhase = 'finger' | 'momentum';
|
|
1653
|
+
interface WheelSegment {
|
|
1654
|
+
/** Why this event starts a new gesture, or null when it continues one. */
|
|
1655
|
+
readonly boundary: WheelBoundary | null;
|
|
1656
|
+
readonly phase: WheelPhase;
|
|
1657
|
+
/** The gesture's number, counting from 1. */
|
|
1658
|
+
readonly gesture: number;
|
|
1659
|
+
/** This event is where the fingers lifted (momentum begins with it). */
|
|
1660
|
+
readonly liftNow: boolean;
|
|
1661
|
+
/** This event shrank, so it may be momentum: hold it until known. */
|
|
1662
|
+
readonly decaying: boolean;
|
|
1663
|
+
/** This event came so soon after the one before that it is a merge. */
|
|
1664
|
+
readonly bunched: boolean;
|
|
1665
|
+
/**
|
|
1666
|
+
* The signed travel of the late wheel before this one, with any wheel
|
|
1667
|
+
* merged with it. It is handed over when that wheel joined the glide and
|
|
1668
|
+
* this one grows into a new gesture; else 0.
|
|
1669
|
+
*/
|
|
1670
|
+
readonly carried: number;
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* A trackpad gesture has a finger phase and, after a fling, a momentum phase.
|
|
1674
|
+
* In the finger phase, deltas come while the fingers move, with pauses when
|
|
1675
|
+
* they move slowly. In the momentum phase, deltas come at frame rate and
|
|
1676
|
+
* shrink smoothly. The lift is the start of a run of shrinking deltas that
|
|
1677
|
+
* has lost a fifth of its size. In the finger phase, a pause of `idleMs`
|
|
1678
|
+
* ends the gesture. In the momentum phase, a reversal, a jump up against the
|
|
1679
|
+
* decay, or a pause of 50 ms starts a new gesture. A bunched wheel is never
|
|
1680
|
+
* a jump. The decay reads it by its last step. Momentum never pauses,
|
|
1681
|
+
* reverses or grows.
|
|
1682
|
+
*
|
|
1683
|
+
* A stalled page receives a trackpad's glide late, and the engine merges the
|
|
1684
|
+
* wheels it held. In momentum, a trackpad wheel that the glide's decay
|
|
1685
|
+
* explains stays in the flick. It may come after a pause, or rise after more
|
|
1686
|
+
* than a frame. It is at or below the next step, or near the sum of the next
|
|
1687
|
+
* steps its stall spans. After such a wheel, a trackpad wheel that grows
|
|
1688
|
+
* starts a new gesture and takes the late wheel's travel. The decay also
|
|
1689
|
+
* reads a trackpad merge in momentum, by its last step. It reads one in a
|
|
1690
|
+
* shrinking run too, where it explains the merge better than steady steps
|
|
1691
|
+
* do. Other wheels keep the rules above.
|
|
1692
|
+
*/
|
|
1693
|
+
declare class WheelSegmenter {
|
|
1694
|
+
gesture: number;
|
|
1695
|
+
phase: WheelPhase;
|
|
1696
|
+
private last;
|
|
1697
|
+
private previous;
|
|
1698
|
+
private sign;
|
|
1699
|
+
private count;
|
|
1700
|
+
private run;
|
|
1701
|
+
private runStart;
|
|
1702
|
+
/** The decay's step-to-step ratio, from the last two one-step wheels. */
|
|
1703
|
+
private ratio;
|
|
1704
|
+
/** The gesture's last on-pace intervals, ms: their median is its frame. */
|
|
1705
|
+
private paces;
|
|
1706
|
+
/** The intervals in a row that came slower than the frame allows, ms. */
|
|
1707
|
+
private slower;
|
|
1708
|
+
/** When the gesture's last wheel within two frames of the one before came. */
|
|
1709
|
+
private onPace;
|
|
1710
|
+
/** The gesture's last wheel that was not bunched, px. */
|
|
1711
|
+
private paced;
|
|
1712
|
+
/** A wheel joined the glide late: a later one that grows is the fingers'. */
|
|
1713
|
+
private resumed;
|
|
1714
|
+
/**
|
|
1715
|
+
* The signed travel of the last wheel that joined the glide late, with any
|
|
1716
|
+
* wheel merged with it.
|
|
1717
|
+
*/
|
|
1718
|
+
private joined;
|
|
1719
|
+
/**
|
|
1720
|
+
* Reads one wheel. `continuous` is whether it carries a trackpad's
|
|
1721
|
+
* signature (`scrollTypeOf`). Only those wheels can join a glide late.
|
|
1722
|
+
*/
|
|
1723
|
+
push(time: number, delta: number, idleMs: number, continuous?: boolean): WheelSegment;
|
|
1724
|
+
/**
|
|
1725
|
+
* Keep an interval for the frame. The gesture's first FIRST_PACES set it.
|
|
1726
|
+
* After them, only an interval within half a frame and one and a half
|
|
1727
|
+
* frames counts: a stall's squeezed wheels come faster. FIRST_PACES slower
|
|
1728
|
+
* intervals in a row set the frame again, so a squeezed start cannot hold
|
|
1729
|
+
* it down.
|
|
1730
|
+
*/
|
|
1731
|
+
private notePace;
|
|
1732
|
+
/**
|
|
1733
|
+
* The gesture's frame interval: the median of its last on-pace intervals,
|
|
1734
|
+
* or FRAME_MS before it shows one. A trackpad reports at 60 Hz or faster,
|
|
1735
|
+
* so a longer median is a stall's.
|
|
1736
|
+
*/
|
|
1737
|
+
private frameMs;
|
|
1738
|
+
/** The sum of the decay's next `count` steps from `previous`. */
|
|
1739
|
+
private glideSum;
|
|
1740
|
+
/**
|
|
1741
|
+
* How far a merge of `size` lies from whole steps of the run's steady
|
|
1742
|
+
* size, or of its last step, whichever lies nearer.
|
|
1743
|
+
*/
|
|
1744
|
+
private steadyOff;
|
|
1745
|
+
/**
|
|
1746
|
+
* How many of the decay's next steps a trackpad wheel of `size` carries,
|
|
1747
|
+
* at most `most`. A wheel at or below the next step carries one. A larger
|
|
1748
|
+
* one carries the fewest steps whose sum lies within FIT_PX or `share` of
|
|
1749
|
+
* it. The decay goes on from `previous` at `ratio` a step. Null when
|
|
1750
|
+
* no sum lies that near.
|
|
1751
|
+
*/
|
|
1752
|
+
private glideSteps;
|
|
1753
|
+
/** The gesture ended on its own (its timer): the next event starts one. */
|
|
1754
|
+
end(): void;
|
|
1755
|
+
}
|
|
1756
|
+
//#endregion
|
|
1757
|
+
//#region src/gestures/hostState.d.ts
|
|
1758
|
+
/** The host's state: its arena, clock, notes per contact and per element, and the reads every layer shares; GestureHost is the class to use. */
|
|
1759
|
+
declare abstract class HostState {
|
|
1760
|
+
protected abstract lockClaimedDrags(ids: ReadonlyArray<number>, claimer: GestureRecognizer): void;
|
|
1761
|
+
protected abstract refresh(element: Element, registration: Registration): void;
|
|
1762
|
+
protected abstract releaseArmedPress(): void;
|
|
1763
|
+
protected abstract releaseClaimedDrags(ids: ReadonlyArray<number>): void;
|
|
1764
|
+
protected abstract replayClick(touch: GestureTouch, allowed: boolean): void;
|
|
1765
|
+
protected abstract syncListeners(): void;
|
|
1766
|
+
readonly arena: GestureArena;
|
|
1767
|
+
protected readonly doc: Document;
|
|
1768
|
+
protected readonly registry: Map<Element, Registration>;
|
|
1769
|
+
/** Stops following the animator's moving elements (iOS WebKit only). */
|
|
1770
|
+
protected stopWatchingMovers: (() => void) | null;
|
|
1771
|
+
/** Whether the document carries the blocking touchmove for a mover. */
|
|
1772
|
+
protected stopBlockingForMovers: (() => void) | null;
|
|
1773
|
+
/** Elements whose caller touch-action waits for a read after paint. */
|
|
1774
|
+
protected readonly pendingCallerReads: Set<HTMLElement>;
|
|
1775
|
+
protected isCallerReadScheduled: boolean;
|
|
1776
|
+
/** Cancels the scheduled next-frame read (readCallerTouchActionInNextFrame). */
|
|
1777
|
+
protected cancelCallerRead: (() => void) | null;
|
|
1778
|
+
/** The selection lock each contact holds, by host contact id. */
|
|
1779
|
+
protected readonly lockedBy: Map<number, (options?: DragSelectionReleaseOptions) => void>;
|
|
1780
|
+
/**
|
|
1781
|
+
* The page's selection when each mouse or pen press began: a drag a
|
|
1782
|
+
* recognizer claims keeps it.
|
|
1783
|
+
*/
|
|
1784
|
+
protected readonly pressSelections: Map<number, readonly AbstractRange[]>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Mouse and pen contacts that began on selectable text. Once one moves, the
|
|
1787
|
+
* browser keeps the drag for a selection, and no recognizer claims it.
|
|
1788
|
+
*/
|
|
1789
|
+
protected readonly selectingContacts: Set<number>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Drag selection holds until their last task ends, a task after their lift
|
|
1792
|
+
* (lockDragSelection); the last detach ends them at once.
|
|
1793
|
+
*/
|
|
1794
|
+
protected readonly dragHolds: Set<(options?: DragSelectionReleaseOptions) => void>;
|
|
1795
|
+
/** Each claimed contact's drag hold, until its lift or a give-back. */
|
|
1796
|
+
protected readonly claimHolds: Map<number, DragSelectionHold>;
|
|
1797
|
+
protected readonly presentedHitTesting: 'auto' | 'always' | 'never';
|
|
1798
|
+
/**
|
|
1799
|
+
* Contacts sent to what is drawn instead of what the engine hit, by host
|
|
1800
|
+
* contact id, with where they landed (for their click).
|
|
1801
|
+
*/
|
|
1802
|
+
protected readonly retargeted: Map<number, {
|
|
1803
|
+
x: number;
|
|
1804
|
+
y: number;
|
|
1805
|
+
target: EventTarget;
|
|
1806
|
+
}>;
|
|
1807
|
+
/** Touch.identifier → arena id, for live fingers. */
|
|
1808
|
+
protected readonly touchIds: Map<number, number>;
|
|
1809
|
+
/**
|
|
1810
|
+
* Fingers cancelled because the app lost focus, kept until the browser
|
|
1811
|
+
* ends them: a browser that keeps such a touch alive must not let its
|
|
1812
|
+
* lift click (`spec:AST-094` FR28: nothing acts).
|
|
1813
|
+
*/
|
|
1814
|
+
protected readonly cancelledFingers: Set<number>;
|
|
1815
|
+
/**
|
|
1816
|
+
* The pens and pointer-read fingers that the app's lost focus cancelled,
|
|
1817
|
+
* by pointer id. Each is kept until its lift, which must not click either,
|
|
1818
|
+
* or until a new press.
|
|
1819
|
+
*/
|
|
1820
|
+
protected readonly cancelledPointers: Map<number, PointerKind>;
|
|
1821
|
+
/** Touch.identifier → the element the finger landed on. */
|
|
1822
|
+
protected readonly touchTargets: Map<number, EventTarget>;
|
|
1823
|
+
/**
|
|
1824
|
+
* Finger targets with listeners of their own: how many fingers each, and
|
|
1825
|
+
* how many of those a recognizer could claim while they move (only those
|
|
1826
|
+
* need the blocking `touchmove` listener).
|
|
1827
|
+
*/
|
|
1828
|
+
protected readonly watched: Map<EventTarget, {
|
|
1829
|
+
count: number;
|
|
1830
|
+
blocking: number;
|
|
1831
|
+
claiming: number;
|
|
1832
|
+
}>;
|
|
1833
|
+
/** Fingers whose target listener is the blocking one. */
|
|
1834
|
+
protected readonly blockingFingers: Set<number>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Fingers a participant could claim (a recognizer that claims touches, or
|
|
1837
|
+
* a press consumer): only their target's `touchend` may need cancelling,
|
|
1838
|
+
* so a touch only watchers follow gets a passive one (`spec:AST-094`
|
|
1839
|
+
* FR20).
|
|
1840
|
+
*/
|
|
1841
|
+
protected readonly claimingFingers: Set<number>;
|
|
1842
|
+
/** Touch events already handled (the document's and the target's listeners both see one). */
|
|
1843
|
+
protected readonly processed: WeakSet<Event>;
|
|
1844
|
+
/** pointerId → arena id, for live mouse and pen contacts. */
|
|
1845
|
+
protected readonly pointerIds: Map<number, number>;
|
|
1846
|
+
/** Each contact's kind: a blur refuses a pen's or a pointer-read finger's lift, never a mouse's. */
|
|
1847
|
+
protected readonly pointerKinds: Map<number, PointerKind>;
|
|
1848
|
+
/**
|
|
1849
|
+
* The boxes the host watches for screen-edge pans (syncLayoutWatch): each
|
|
1850
|
+
* element with an enabled one, and the root for one whose band moves with
|
|
1851
|
+
* the viewport (spec:AST-094 FR18, FR19, DEC-22), and the one observer
|
|
1852
|
+
* that watches them.
|
|
1853
|
+
*/
|
|
1854
|
+
protected readonly layoutWatched: Set<Element>;
|
|
1855
|
+
protected layoutObserver: ResizeObserver | null;
|
|
1856
|
+
/** Where and when the last pen hold the host tracked ended. */
|
|
1857
|
+
protected lastPenLift: {
|
|
1858
|
+
target: unknown;
|
|
1859
|
+
time: number;
|
|
1860
|
+
} | null;
|
|
1861
|
+
/**
|
|
1862
|
+
* Arena ids of the pen contacts that left the long press's tolerance
|
|
1863
|
+
* before its duration. No such contact is a hold.
|
|
1864
|
+
*/
|
|
1865
|
+
protected readonly driftedPens: Set<number>;
|
|
1866
|
+
/** Fingers whose first uncancelable `touchmove` was already judged. */
|
|
1867
|
+
protected readonly judgedUncancelable: Set<number>;
|
|
1868
|
+
/**
|
|
1869
|
+
* A finger's pointerId → its arena id, once its pointerdown and its
|
|
1870
|
+
* touchstart are paired. Chromium sends no `touchmove` until a finger has
|
|
1871
|
+
* travelled its slop (about 16 px), but sends every `pointermove`, so a
|
|
1872
|
+
* paired finger is sampled from its pointer events (`pointerFed`); and its
|
|
1873
|
+
* `pointercancel` is the browser's claim of exactly that finger.
|
|
1874
|
+
*/
|
|
1875
|
+
protected readonly fingerPointers: Map<number, number>;
|
|
1876
|
+
/** Finger pointerdowns still waiting for their touchstart. */
|
|
1877
|
+
protected readonly pendingPointers: Map<number, PlacedContact>;
|
|
1878
|
+
/**
|
|
1879
|
+
* A paired finger's lift, at its `pointerup`: the place and clock its moves
|
|
1880
|
+
* came on. Linux WebKit stamps the `touchend` that follows only after the
|
|
1881
|
+
* page's pointerup listeners finish. A busy listener would then make a flick
|
|
1882
|
+
* read as a resting finger. Read at the touchend, dropped with the finger.
|
|
1883
|
+
*/
|
|
1884
|
+
protected readonly liftStamps: Map<number, {
|
|
1885
|
+
x: number;
|
|
1886
|
+
y: number;
|
|
1887
|
+
time: number;
|
|
1888
|
+
}>;
|
|
1889
|
+
/**
|
|
1890
|
+
* Where fingers come from their pointer events, where claimed fingers
|
|
1891
|
+
* lifted and when: the `touchend` that follows each `pointerup` is
|
|
1892
|
+
* cancelled (FR21). A record no `touchend` consumed expires
|
|
1893
|
+
* (CLAIMED_LIFT_MS).
|
|
1894
|
+
*/
|
|
1895
|
+
protected readonly claimedLifts: (PlacedContact & {
|
|
1896
|
+
time: number;
|
|
1897
|
+
})[];
|
|
1898
|
+
/** The one timer that drops claimed lifts whose `touchend` never came. */
|
|
1899
|
+
protected claimedLiftTimer: unknown;
|
|
1900
|
+
/** The arena's clock, which the claimed lifts' timer runs on too. */
|
|
1901
|
+
protected readonly clock: GestureClock;
|
|
1902
|
+
/**
|
|
1903
|
+
* The clock of the document's own window, which stamps its events. A page
|
|
1904
|
+
* can replace it after the host exists, so each read looks it up.
|
|
1905
|
+
*/
|
|
1906
|
+
protected get timing(): EventClock | null;
|
|
1907
|
+
/** Fingers still waiting for their pointerdown, by arena id. */
|
|
1908
|
+
protected readonly unpairedTouches: Map<number, PlacedContact>;
|
|
1909
|
+
protected readonly isPrimaryPointerCoarse: () => boolean;
|
|
1910
|
+
/** Whether the host follows `(pointer: coarse)` (no read was passed). */
|
|
1911
|
+
protected readonly followsPointer: boolean;
|
|
1912
|
+
/** The last sample fed per contact: a contact's time never runs back. */
|
|
1913
|
+
protected readonly lastFed: Map<number, TouchSample>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Fingers whose samples come from their pointer events. A finger the
|
|
1916
|
+
* browser reports on both channels is sampled from ONE: the pointer
|
|
1917
|
+
* channel, where its pointerdown paired with its touchstart; touch events
|
|
1918
|
+
* sample only a finger no pointer event reported (no Pointer Events). The
|
|
1919
|
+
* other channel keeps its control duties (cancelling, claiming, the
|
|
1920
|
+
* browser's takeover) but never feeds a sample, so the two copies of one
|
|
1921
|
+
* move cannot both reach a velocity, however far apart they arrive.
|
|
1922
|
+
*/
|
|
1923
|
+
protected readonly pointerFed: Set<number>;
|
|
1924
|
+
/** When a finger was last down or lifted, and where it landed. */
|
|
1925
|
+
protected lastTouch: {
|
|
1926
|
+
readonly target: Node;
|
|
1927
|
+
readonly time: number;
|
|
1928
|
+
} | null;
|
|
1929
|
+
/** Scrollers a recognizer is scrolling itself this frame (ownScroll). */
|
|
1930
|
+
protected readonly ownedScrolls: Map<Node, number>;
|
|
1931
|
+
/** Numbers each ownScroll call: only the newest one's timer clears it. */
|
|
1932
|
+
protected ownScrollCalls: number;
|
|
1933
|
+
/** Cancels each scroller's pending ownScroll frames. */
|
|
1934
|
+
protected readonly ownScrollFrames: Map<Node, () => void>;
|
|
1935
|
+
/** The last scroll a finger drove, and when. */
|
|
1936
|
+
protected lastScroll: {
|
|
1937
|
+
readonly scroller: Node;
|
|
1938
|
+
readonly time: number;
|
|
1939
|
+
} | null;
|
|
1940
|
+
/** Predicates that hold a touch's target away from every participant. */
|
|
1941
|
+
protected readonly touchGates: Set<(target: Node) => boolean>;
|
|
1942
|
+
/** Who keeps the listeners installed without a registration (retain). */
|
|
1943
|
+
protected retainers: number;
|
|
1944
|
+
/** Told after every touch event that changed the fingers on the screen. */
|
|
1945
|
+
protected readonly fingerListeners: Set<() => void>;
|
|
1946
|
+
/**
|
|
1947
|
+
* Where each finger now on the screen landed, from the last touch event's
|
|
1948
|
+
* `touches` (every finger, whether or not a recognizer tracks it).
|
|
1949
|
+
*/
|
|
1950
|
+
protected fingerTargets: ReadonlyArray<Node>;
|
|
1951
|
+
protected nextId: number;
|
|
1952
|
+
/** The wheel gesture in progress. */
|
|
1953
|
+
protected wheel: WheelGesture | null;
|
|
1954
|
+
/** The wheel latch's input-stream subscription, while a gesture is latched. */
|
|
1955
|
+
protected stopWheelLatch: (() => void) | null;
|
|
1956
|
+
/** Splits the wheel stream into gestures and reads a trackpad's lift. */
|
|
1957
|
+
protected readonly segmenter: WheelSegmenter;
|
|
1958
|
+
/** The latest wheel's segment. */
|
|
1959
|
+
protected wheelSegment: WheelSegment | null;
|
|
1960
|
+
/** Wheels already taken: each element on the path with a listener hears one. */
|
|
1961
|
+
protected readonly wheelsSeen: WeakSet<Event>;
|
|
1962
|
+
protected isInstalled: boolean;
|
|
1963
|
+
/**
|
|
1964
|
+
* Whether the primary pointer is coarse (`spec:AST-094` FR19), read when
|
|
1965
|
+
* something first attaches and kept current while anything is attached.
|
|
1966
|
+
*/
|
|
1967
|
+
protected isCoarse: boolean;
|
|
1968
|
+
protected stopWatchingPointer: (() => void) | null;
|
|
1969
|
+
/** The input stream subscriptions while installed. */
|
|
1970
|
+
protected unsubscribers: (() => void)[];
|
|
1971
|
+
/**
|
|
1972
|
+
* Where the primary pointer is fine, each element that uses a gesture
|
|
1973
|
+
* listens for a press itself; the page's listeners last that press (FR24).
|
|
1974
|
+
*/
|
|
1975
|
+
protected readonly armedElements: Map<Element, () => void>;
|
|
1976
|
+
protected isArmedPress: boolean;
|
|
1977
|
+
/**
|
|
1978
|
+
* Whether the installed listeners include the cancelable ones (the
|
|
1979
|
+
* document's touchend, contextmenu and the window's click): only while a
|
|
1980
|
+
* participant that can claim is attached (`spec:AST-094` FR20).
|
|
1981
|
+
*/
|
|
1982
|
+
protected isClaimingInstalled: boolean;
|
|
1983
|
+
/** The input stream subscriptions syncClaimingListeners keeps. */
|
|
1984
|
+
protected claimingUnsubscribers: (() => void)[];
|
|
1985
|
+
protected readonly inputMode: 'auto' | 'pointer-events';
|
|
1986
|
+
protected usesTouchEvents: boolean;
|
|
1987
|
+
constructor(doc: Document, options?: GestureHostOptions);
|
|
1988
|
+
/**
|
|
1989
|
+
* Internal. The document this host serves.
|
|
1990
|
+
*/
|
|
1991
|
+
get document(): Document;
|
|
1992
|
+
/**
|
|
1993
|
+
* Internal. Whether a recognizer owns the touch with this Touch Events
|
|
1994
|
+
* `identifier`, so the browser must not pan it (pageHold.ts asks).
|
|
1995
|
+
*/
|
|
1996
|
+
isTouchClaimed(identifier: number): boolean;
|
|
1997
|
+
/**
|
|
1998
|
+
* Re-derive an element's styles and the host's listeners after its
|
|
1999
|
+
* recognizers' options or its consumer's enabled state changed.
|
|
2000
|
+
*/
|
|
2001
|
+
update(element: Element): void;
|
|
2002
|
+
/**
|
|
2003
|
+
* The Pointer Events `pointerId` of a contact the arena tracks: a mouse's
|
|
2004
|
+
* or a pen's own, and for a finger driven by touch events the pointer its
|
|
2005
|
+
* touch was paired with (null before the pairing, or without Pointer
|
|
2006
|
+
* Events). It hands a held finger to code that follows pointers, as a
|
|
2007
|
+
* menu does when a long press turns into a press-drag selection.
|
|
2008
|
+
*/
|
|
2009
|
+
pointerIdOf(touch: GestureTouch | number): number | null;
|
|
2010
|
+
}
|
|
2011
|
+
//#endregion
|
|
2012
|
+
//#region src/gestures/hostAttach.d.ts
|
|
2013
|
+
/** Attaching recognizers and consumers, layout watches, and the registrations' reads; GestureHost is the class to use. */
|
|
2014
|
+
declare abstract class HostAttach extends HostState {
|
|
2015
|
+
protected abstract applyStyle(element: HTMLElement, registration: Registration): void;
|
|
2016
|
+
protected abstract endWheel(endTime?: number): void;
|
|
2017
|
+
protected abstract readonly onBlockingTouchMove: (event: Event) => void;
|
|
2018
|
+
protected abstract readonly onClaimedTouchEnd: (event: Event) => void;
|
|
2019
|
+
protected abstract readonly onWheel: (event: Event) => void;
|
|
2020
|
+
protected abstract syncTouchMoveListener(element: Element, registration: Registration): void;
|
|
2021
|
+
protected abstract uninstallIfIdle(): void;
|
|
2022
|
+
protected abstract watchPointer(): void;
|
|
2023
|
+
protected abstract wheelHasTaker(gesture: WheelGesture): boolean;
|
|
2024
|
+
/** Attach a recognizer to an element. Returns the detach function. */
|
|
2025
|
+
attach(element: Element, recognizer: GestureRecognizer, options?: AttachOptions): () => void;
|
|
2026
|
+
/**
|
|
2027
|
+
* Watch the box of each element with an enabled screen-edge pan, and the
|
|
2028
|
+
* root's for a pan that watches the right side, whose band moves with the
|
|
2029
|
+
* viewport: a resize may move an element into or out of its edge band, and
|
|
2030
|
+
* the pan then measures again and re-derives the element's touch-action
|
|
2031
|
+
* (FR19). The host sets touch-action for every pointer (FR43), so it
|
|
2032
|
+
* watches under any primary pointer. One ResizeObserver serves every
|
|
2033
|
+
* element and goes with the last one, and no listener is added (FR24); an
|
|
2034
|
+
* engine without ResizeObserver keeps each pan's first measurement.
|
|
2035
|
+
*/
|
|
2036
|
+
protected syncLayoutWatch(): void;
|
|
2037
|
+
/** A watched box or the root resized: each enabled edge pan measures again. */
|
|
2038
|
+
protected readonly onLayoutChange: () => void;
|
|
2039
|
+
/** Attach the view-level touch consumer of an element (a pressable control). */
|
|
2040
|
+
attachConsumer(element: Element, consumer: TouchConsumer, _options?: Pick<AttachOptions, 'perEventPointer'>): () => void;
|
|
2041
|
+
/**
|
|
2042
|
+
* Internal. Keep the host's listeners installed until the returned
|
|
2043
|
+
* function runs, with no recognizer attached (fingerScroll.ts reads the
|
|
2044
|
+
* finger record meanwhile).
|
|
2045
|
+
*/
|
|
2046
|
+
retain(): () => void;
|
|
2047
|
+
/**
|
|
2048
|
+
* Internal. Call `listener` after each touch event the host hears, once
|
|
2049
|
+
* the finger record is up to date. Returns the unsubscribe.
|
|
2050
|
+
*/
|
|
2051
|
+
onFingersChange(listener: () => void): () => void;
|
|
2052
|
+
/** Internal. Whether a finger that landed inside `node` is down now. */
|
|
2053
|
+
isFingerDownIn(node: Node): boolean;
|
|
2054
|
+
/**
|
|
2055
|
+
* Internal. Whether a pen that went down inside `node` is down now,
|
|
2056
|
+
* whichever participant keeps it. A pen's own menu event is that hold's
|
|
2057
|
+
* (contextRequest.ts).
|
|
2058
|
+
*/
|
|
2059
|
+
isPenDownIn(node: Node): boolean;
|
|
2060
|
+
/**
|
|
2061
|
+
* Internal. When a pen hold that went down inside `node` last ended, at
|
|
2062
|
+
* its lift or a cancel. The time is on the host's clock: negative infinity
|
|
2063
|
+
* when none did.
|
|
2064
|
+
*/
|
|
2065
|
+
lastPenLiftIn(node: Node): number;
|
|
2066
|
+
protected registrationFor(element: Element): Registration;
|
|
2067
|
+
/** Whether anything attached could take input. */
|
|
2068
|
+
protected needsInput(): boolean;
|
|
2069
|
+
protected refresh(element: Element, registration: Registration): void;
|
|
2070
|
+
protected cleanup(element: Element, registration: Registration): void;
|
|
2071
|
+
}
|
|
2072
|
+
//#endregion
|
|
2073
|
+
//#region src/gestures/hostStyle.d.ts
|
|
2074
|
+
/** The derived touch-action and its writes, and which listeners an element keeps; GestureHost is the class to use. */
|
|
2075
|
+
declare abstract class HostStyle extends HostAttach {
|
|
2076
|
+
protected abstract hasClaimer(): boolean;
|
|
2077
|
+
protected abstract hitTestsLayout(): boolean;
|
|
2078
|
+
protected abstract install(): void;
|
|
2079
|
+
protected abstract readonly onContextMenu: (event: MouseEvent) => void;
|
|
2080
|
+
protected abstract readonly onTouchEnd: (event: TouchEvent) => void;
|
|
2081
|
+
protected abstract readsFingersFromPointerEvents(): boolean;
|
|
2082
|
+
protected abstract sendsTouchEvents(): boolean;
|
|
2083
|
+
protected abstract syncArmed(): void;
|
|
2084
|
+
protected abstract uninstall(): void;
|
|
2085
|
+
/**
|
|
2086
|
+
* The element's blocking `touchmove`. For every pointer a claiming
|
|
2087
|
+
* recognizer keeps it: a finger's claim cancels its moves here (FR19), a
|
|
2088
|
+
* listener FR24 counts outside the one-listener budget a fine pointer's
|
|
2089
|
+
* element keeps for its press (syncArmed). A kept press needs it only
|
|
2090
|
+
* while a press is held: a phone's before every touch (Safari honours a
|
|
2091
|
+
* blocking listener only when registered before the touch began), a fine
|
|
2092
|
+
* pointer's only during an armed press, whose `pointerdown` comes before
|
|
2093
|
+
* the touch it brings (FR24).
|
|
2094
|
+
*/
|
|
2095
|
+
protected syncTouchMoveListener(element: Element, registration: Registration): void;
|
|
2096
|
+
protected applyStyle(element: HTMLElement, registration: Registration): void;
|
|
2097
|
+
/**
|
|
2098
|
+
* The touch-action to write inline, if any. The author's value (a
|
|
2099
|
+
* trigger's own `touch-action: none`) stays in force and the host never
|
|
2100
|
+
* allows more (spec:AST-094 FR18, DEC-8):
|
|
2101
|
+
* - an inline value is the style's own, read with no recalc, and the host
|
|
2102
|
+
* writes what both allow, inline; a CSS-wide keyword (`initial`,
|
|
2103
|
+
* `inherit`, `unset`, `revert`, `revert-layer`) names no touch-action of
|
|
2104
|
+
* its own, so it is read as an author rule is, as what it resolves to;
|
|
2105
|
+
* - otherwise the element is marked with the derived value, under a rule
|
|
2106
|
+
* any author rule outranks, as the recognizer attaches: a subtree that
|
|
2107
|
+
* mounts with it is styled once, never restyled for it in a later frame.
|
|
2108
|
+
* The next frame reads what is in force, styles clean, and the host
|
|
2109
|
+
* writes inline only what both allow where that is narrower than an
|
|
2110
|
+
* author rule's value.
|
|
2111
|
+
*/
|
|
2112
|
+
protected touchActionToWrite(element: HTMLElement, registration: Registration, derived: string | undefined): string | undefined;
|
|
2113
|
+
/**
|
|
2114
|
+
* Read the touch-action in force on each marked element in the next frame,
|
|
2115
|
+
* then apply its style again. Batched: one style read serves every pending
|
|
2116
|
+
* element, and the writes follow the reads. The host has written no
|
|
2117
|
+
* touch-action inline on them, so a value other than the mark is an author
|
|
2118
|
+
* rule's.
|
|
2119
|
+
*/
|
|
2120
|
+
protected readCallerTouchActionInNextFrame(element: HTMLElement): void;
|
|
2121
|
+
/**
|
|
2122
|
+
* Listen only while something could take a touch now (`spec:AST-094`
|
|
2123
|
+
* FR24, FR43): where the primary pointer is coarse, an enabled recognizer
|
|
2124
|
+
* or consumer, or a finger-scroll watch; where it is fine, only during a
|
|
2125
|
+
* press an element armed (syncArmed). Otherwise no document listener is
|
|
2126
|
+
* registered, so an idle page and a disabled control pay nothing.
|
|
2127
|
+
*/
|
|
2128
|
+
protected syncListeners(): void;
|
|
2129
|
+
/**
|
|
2130
|
+
* Safari honours a blocking `touchmove` only where it was registered before
|
|
2131
|
+
* the touch began, on the engine's own target, and on iOS WebKit a finger
|
|
2132
|
+
* on an element a compositor animation moves lands, for the engine, on
|
|
2133
|
+
* whatever sits under the motion's start (see presentedTarget). So while an
|
|
2134
|
+
* element a recognizer that claims moving touches lives in (or around) is
|
|
2135
|
+
* moving, the blocking listener subscribes to the window's capturing
|
|
2136
|
+
* `touchmove` through the shared input stream with `{cancels: true}`,
|
|
2137
|
+
* which sees every touch on the page whatever the engine targets and makes
|
|
2138
|
+
* that one listener non-passive (`spec:AST-094` FR19;
|
|
2139
|
+
* architecture:react-component-runtime INV13). It leaves when the motion
|
|
2140
|
+
* ends: only while it is subscribed does a scroll starting anywhere wait on
|
|
2141
|
+
* the main thread.
|
|
2142
|
+
*/
|
|
2143
|
+
protected syncMoverBlocking(): void;
|
|
2144
|
+
/** Whether a recognizer that claims moving touches lives in or around `mover`. */
|
|
2145
|
+
protected hasClaimingRecognizerAround(mover: Element): boolean;
|
|
2146
|
+
/**
|
|
2147
|
+
* Keeps the touchend cancelable, and the contextmenu subscription on,
|
|
2148
|
+
* only while a claimer is attached; with only watchers the touchend is
|
|
2149
|
+
* passive and the contextmenu is off. Clicks are the click guard's
|
|
2150
|
+
* (utils/clickGuard.ts), whose one listener a window gets only once a
|
|
2151
|
+
* gesture first arms it.
|
|
2152
|
+
*/
|
|
2153
|
+
protected syncClaimingListeners(): void;
|
|
2154
|
+
protected shouldListen(): boolean;
|
|
2155
|
+
}
|
|
2156
|
+
//#endregion
|
|
2157
|
+
//#region src/gestures/hostInstall.d.ts
|
|
2158
|
+
/** Armed presses, the page listeners' install and uninstall, and the release when idle; GestureHost is the class to use. */
|
|
2159
|
+
declare abstract class HostInstall extends HostStyle {
|
|
2160
|
+
protected abstract cancelEverything(time: number): void;
|
|
2161
|
+
protected abstract clearClaimedLifts(): void;
|
|
2162
|
+
protected abstract readonly onBlur: () => void;
|
|
2163
|
+
protected abstract readonly onPointerCancel: (event: PointerEvent) => void;
|
|
2164
|
+
protected abstract readonly onPointerDown: (event: PointerEvent) => void;
|
|
2165
|
+
protected abstract readonly onPointerMove: (event: PointerEvent) => void;
|
|
2166
|
+
protected abstract readonly onPointerUp: (event: PointerEvent) => void;
|
|
2167
|
+
protected abstract readonly onScroll: (event: Event) => void;
|
|
2168
|
+
protected abstract readonly onTouchCancel: (event: TouchEvent) => void;
|
|
2169
|
+
protected abstract readonly onTouchMove: (event: TouchEvent) => void;
|
|
2170
|
+
protected abstract readonly onTouchStart: (event: TouchEvent) => void;
|
|
2171
|
+
protected abstract readonly onVisibilityChange: () => void;
|
|
2172
|
+
/**
|
|
2173
|
+
* Where the primary pointer is fine, each element with an enabled
|
|
2174
|
+
* recognizer or press consumer listens for a press itself: one passive
|
|
2175
|
+
* `pointerdown` listener on the element. The host's page listeners come at
|
|
2176
|
+
* that press and go once its contacts end and the arena drops their last
|
|
2177
|
+
* record (onIdle: a decision that waited on a timer), so an idle page has none
|
|
2178
|
+
* (`spec:AST-094` FR24, FR43). A finger on a touchscreen whose primary
|
|
2179
|
+
* pointer is fine sends its `pointerdown` before its `touchstart`, so the
|
|
2180
|
+
* host hears both.
|
|
2181
|
+
*/
|
|
2182
|
+
protected syncArmed(): void;
|
|
2183
|
+
/** A press on an armed element, a mouse's primary button, a pen or a finger: listen for this press. */
|
|
2184
|
+
protected readonly onArmedPress: (event: Event) => void;
|
|
2185
|
+
/** A kept press's blocking `touchmove` follows the armed press (syncTouchMoveListener). */
|
|
2186
|
+
protected syncKeptPresses(): void;
|
|
2187
|
+
/**
|
|
2188
|
+
* A new press is a new gesture, as the click guard reads one, so the lifts
|
|
2189
|
+
* the blur cancelled owe nothing after it. A second finger keeps the other
|
|
2190
|
+
* fingers' refusals, since those fingers may still be down.
|
|
2191
|
+
*/
|
|
2192
|
+
protected dropCancelledLifts(event: PointerEvent): void;
|
|
2193
|
+
/**
|
|
2194
|
+
* After a contact ends: an armed press that is over stops listening. A
|
|
2195
|
+
* contact the lost focus cancelled still owes its lift, so the press is
|
|
2196
|
+
* not over until that lift comes. A lift the page never hears ends it at
|
|
2197
|
+
* the next press, or at a cancel.
|
|
2198
|
+
*/
|
|
2199
|
+
protected releaseArmedPress(): void;
|
|
2200
|
+
/** With nothing attached, stop listening and stop following the pointer. */
|
|
2201
|
+
protected uninstallIfIdle(): void;
|
|
2202
|
+
/**
|
|
2203
|
+
* In the microtask after the last detach, unless something attached again
|
|
2204
|
+
* in the same task (a component that remounts mid-press keeps its notes):
|
|
2205
|
+
* nothing the host holds outlives it, no note and no pending frame or
|
|
2206
|
+
* timer (`spec:AST-094` FR24).
|
|
2207
|
+
*/
|
|
2208
|
+
protected releaseWhenIdle(): void;
|
|
2209
|
+
/** Read the primary pointer, and follow it while anything is attached. */
|
|
2210
|
+
protected watchPointer(): void;
|
|
2211
|
+
/**
|
|
2212
|
+
* The primary pointer turned coarse or fine (a tablet docking a mouse):
|
|
2213
|
+
* install or remove everything, as if each attach happened now.
|
|
2214
|
+
*/
|
|
2215
|
+
protected pointerChanged(isCoarse: boolean): void;
|
|
2216
|
+
/**
|
|
2217
|
+
* Whether an enabled participant could claim a touch or cancel a lift: a
|
|
2218
|
+
* consumer, or a recognizer that claims touches and takes a finger or a
|
|
2219
|
+
* pen. With only watchers, or only scroll-only recognizers
|
|
2220
|
+
* (`allowedPointerTypes: []`), the host's listeners are all passive.
|
|
2221
|
+
*/
|
|
2222
|
+
protected hasClaimer(): boolean;
|
|
2223
|
+
protected install(): void;
|
|
2224
|
+
protected uninstall(): void;
|
|
2225
|
+
}
|
|
2226
|
+
//#endregion
|
|
2227
|
+
//#region src/gestures/hostHitTest.d.ts
|
|
2228
|
+
/** Presented hit testing, click retargeting, and the participants a contact meets; GestureHost is the class to use. */
|
|
2229
|
+
declare abstract class HostHitTest extends HostInstall {
|
|
2230
|
+
/**
|
|
2231
|
+
* An element's box where it is drawn: the box the engine reports, moved
|
|
2232
|
+
* by the compositor animations of it and its ancestors on engines that
|
|
2233
|
+
* report and hit-test those where they started (iOS WebKit). Elsewhere
|
|
2234
|
+
* `getBoundingClientRect` already reports the drawn box. Press trackers
|
|
2235
|
+
* read their bounds through it.
|
|
2236
|
+
*/
|
|
2237
|
+
presentedRect(element: Element): PressBounds;
|
|
2238
|
+
/** Whether this engine hit-tests a compositor-moved element at layout. */
|
|
2239
|
+
protected hitTestsLayout(): boolean;
|
|
2240
|
+
/**
|
|
2241
|
+
* Where a contact lands among what is drawn. iOS WebKit hit-tests an
|
|
2242
|
+
* element that a compositor animation moves where the animation started:
|
|
2243
|
+
* a finger on a settling sheet lands on whatever sat under the sheet's
|
|
2244
|
+
* start (the scrim, which closes it), and a finger where the sheet was
|
|
2245
|
+
* lands on the sheet. UIKit keeps an interruptible animation hit-testable
|
|
2246
|
+
* where it is drawn (UIViewPropertyAnimator). The touch goes to what was
|
|
2247
|
+
* drawn under the finger when it landed (`time`, its event's timestamp),
|
|
2248
|
+
* even when a busy main thread hands it over later, and content that slid
|
|
2249
|
+
* under the finger since takes nothing (`spec:AST-094` FR11).
|
|
2250
|
+
*/
|
|
2251
|
+
protected presentedTarget(native: EventTarget | null, x: number, y: number, time: number): EventTarget | null;
|
|
2252
|
+
/** What is drawn at a point beneath every mover. */
|
|
2253
|
+
protected drawnBeneath(x: number, y: number, movers: ReadonlyArray<Element>): Element | null;
|
|
2254
|
+
/** What is drawn at a point, inside open shadow roots too. */
|
|
2255
|
+
protected drawnAt(x: number, y: number): Element | null;
|
|
2256
|
+
/** The browser took these touches (a scroll): no click of ours for them. */
|
|
2257
|
+
protected browserTook(ids: ReadonlyArray<number>, time: number): void;
|
|
2258
|
+
/**
|
|
2259
|
+
* The click a retargeted tap earned, on what was drawn under the finger.
|
|
2260
|
+
* The engine's own click would hit the start position, so the caller
|
|
2261
|
+
* cancels it (or the click guard drops it, a late one included) and this one
|
|
2262
|
+
* is the tap's single activation.
|
|
2263
|
+
*/
|
|
2264
|
+
protected clickRetargeted(target: EventTarget, x: number, y: number, pointerType: string): void;
|
|
2265
|
+
/**
|
|
2266
|
+
* Whether a finger set a scroller containing `node` moving within the last
|
|
2267
|
+
* `window` ms. A touch there now brakes the scroll rather than pressing
|
|
2268
|
+
* whatever is under it: a native list highlights nothing for one.
|
|
2269
|
+
*/
|
|
2270
|
+
isScrollBraking(node: Node, window?: number): boolean;
|
|
2271
|
+
/**
|
|
2272
|
+
* The recognizers on the path from `target` to the document, innermost
|
|
2273
|
+
* first, and (for a contact) its consumer: the innermost element with an
|
|
2274
|
+
* attached consumer.
|
|
2275
|
+
*/
|
|
2276
|
+
protected participantsAt(target: unknown, pointerType: PointerKind | null): {
|
|
2277
|
+
recognizers: GestureRecognizer[];
|
|
2278
|
+
consumer: TouchConsumer | null;
|
|
2279
|
+
consumerElement: Element | null;
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
//#endregion
|
|
2283
|
+
//#region src/gestures/hostSelection.d.ts
|
|
2284
|
+
/** The selection lock under a held finger, the drag hold under a claimed mouse or pen, and touch gates; GestureHost is the class to use. */
|
|
2285
|
+
declare abstract class HostSelection extends HostHitTest {
|
|
2286
|
+
/**
|
|
2287
|
+
* Turn text selection and the touch callout off, for as long as this
|
|
2288
|
+
* finger or pen is down, only on the elements whose hold does something:
|
|
2289
|
+
* a long press's (a menu, a hold-repeat), those of recognizers created
|
|
2290
|
+
* with a `selectionLock` (a slider's thumb, a switch's drag, a tab bar's
|
|
2291
|
+
* zero-delay lens) and that of a press tracker created with one (a
|
|
2292
|
+
* stepper's hold-repeat). Anything whose hold does nothing, a plain
|
|
2293
|
+
* press-tracked control or row included, keeps the browser's long-press
|
|
2294
|
+
* selection (`spec:AST-094` FR41). Restored when the contact ends. Callers
|
|
2295
|
+
* lock for a finger or a pen under any primary pointer, never for a mouse
|
|
2296
|
+
* (locksSelectionFor), and only once the arena has admitted the contact:
|
|
2297
|
+
* `recognizers` and `consumer` are the ones that took it.
|
|
2298
|
+
*/
|
|
2299
|
+
protected lockSelection(id: number, recognizers: ReadonlyArray<GestureRecognizer>, target: EventTarget | null, consumer: TouchConsumer | null, consumerElement: Element | null): void;
|
|
2300
|
+
/**
|
|
2301
|
+
* Hold the page's selection for a mouse or pen contact that a recognizer
|
|
2302
|
+
* claims. Examples are a pan's drag and a press a group claims at its own
|
|
2303
|
+
* pointerdown. While the contact is down, the claiming recognizers'
|
|
2304
|
+
* elements refuse a new selection. The selection the page had at the press
|
|
2305
|
+
* is put back over anything that replaced it. That includes the press's own
|
|
2306
|
+
* collapse and a selection the drag made before its claim. The claiming
|
|
2307
|
+
* recognizer's element holds from its claim, in any state: a waiting
|
|
2308
|
+
* recognizer claims while possible, and a swipe claims as ended. The
|
|
2309
|
+
* participants that already recognize hold too. A claim given back to the
|
|
2310
|
+
* browser lets its hold go (releaseClaimedDrags). A drag that starts on
|
|
2311
|
+
* selectable text never gets here, because no recognizer claims it
|
|
2312
|
+
* (`selectingContacts`). A tap claims only at its lift, so a click keeps
|
|
2313
|
+
* the selection it made. A finger keeps the touch-down lock alone.
|
|
2314
|
+
*/
|
|
2315
|
+
protected lockClaimedDrags(ids: ReadonlyArray<number>, claimer: GestureRecognizer): void;
|
|
2316
|
+
/**
|
|
2317
|
+
* Claimed contacts the arena gave back. Their drag holds end at once, so
|
|
2318
|
+
* the browser's drag selects again. A contact's press lock (lockSelection)
|
|
2319
|
+
* is not a drag hold and stays.
|
|
2320
|
+
*/
|
|
2321
|
+
protected releaseClaimedDrags(ids: ReadonlyArray<number>): void;
|
|
2322
|
+
/**
|
|
2323
|
+
* At a mouse or pen press, mark one that lands on selectable text: once it
|
|
2324
|
+
* moves, it is the browser's drag, and selects text.
|
|
2325
|
+
* Text whose hold does something is locked at this press already
|
|
2326
|
+
* (lockSelection), so it is not selectable text.
|
|
2327
|
+
*/
|
|
2328
|
+
protected noteSelectingPress(id: number, x: number, y: number, target: EventTarget | null): void;
|
|
2329
|
+
/**
|
|
2330
|
+
* Undo a contact's selection locks, its press lock and its drag hold, at
|
|
2331
|
+
* once for a cancel, and forget its press's selection; idempotent. A
|
|
2332
|
+
* drag's hold keeps its last task after a lift (lockDragSelection).
|
|
2333
|
+
*/
|
|
2334
|
+
protected unlockSelection(id: number, isCancel?: boolean): void;
|
|
2335
|
+
/**
|
|
2336
|
+
* Hold touches away from every participant while `gate(target)` answers
|
|
2337
|
+
* true. Returns the release. The input hold's held layers need no gate,
|
|
2338
|
+
* because the host asks `holdsTouch` for every touch.
|
|
2339
|
+
*/
|
|
2340
|
+
addTouchGate(gate: (target: Node) => boolean): () => void;
|
|
2341
|
+
/**
|
|
2342
|
+
* Internal. Whether a press consumer that keeps its press (a hold-repeat
|
|
2343
|
+
* control, `keepsTouch`) sits on the path from `target` up to `boundary`,
|
|
2344
|
+
* both included. Such a control keeps its long press its own. Its right
|
|
2345
|
+
* click and Shift+F10 still reach a context request around it
|
|
2346
|
+
* (contextRequest.ts).
|
|
2347
|
+
*/
|
|
2348
|
+
keepsPressBetween(target: unknown, boundary: Element): boolean;
|
|
2349
|
+
/**
|
|
2350
|
+
* How many fingers are on the screen: the length of `touches` in the last
|
|
2351
|
+
* touch event the host's listeners heard (`touchstart`, `touchmove`,
|
|
2352
|
+
* `touchend`, `touchcancel`), whatever its target, so a finger on an
|
|
2353
|
+
* element with no recognizer counts too. 0 before any, and while no
|
|
2354
|
+
* listener is installed. A recognizer that must not begin under a second
|
|
2355
|
+
* finger reads it in `shouldBegin`.
|
|
2356
|
+
*/
|
|
2357
|
+
fingersDown(): number;
|
|
2358
|
+
/** Whether this event is new to the host (and mark it handled). */
|
|
2359
|
+
protected takeEvent(event: Event): boolean;
|
|
2360
|
+
}
|
|
2361
|
+
//#endregion
|
|
2362
|
+
//#region src/gestures/hostWheelInput.d.ts
|
|
2363
|
+
/** The wheel's events: trackpad segments, provisional follows and who takes them; GestureHost is the class to use. */
|
|
2364
|
+
declare abstract class HostWheelInput extends HostSelection {
|
|
2365
|
+
protected abstract beginWheel(wheel: WheelEvent, kind: 'pan' | 'pinch', dx: number, dy: number, time: number): WheelGesture;
|
|
2366
|
+
protected abstract latchWheel(): void;
|
|
2367
|
+
/**
|
|
2368
|
+
* Wheel and trackpad input. A wheel gesture drives the recognizers that
|
|
2369
|
+
* allow its scroll type, as a contact that moves with the content. A pan
|
|
2370
|
+
* takes it along its own axis, once no scroller between the pointer and
|
|
2371
|
+
* the pan's element can scroll that way. The gesture's first wheel decides
|
|
2372
|
+
* this. A pinch takes a ctrl-wheel, as a trackpad pinches, as two contacts
|
|
2373
|
+
* whose span follows exp(-deltaY / 100). A wheel the page keeps is never
|
|
2374
|
+
* prevented, and a wheel a recognizer takes always is. A gesture ends its
|
|
2375
|
+
* end window after its last wheel (wheelEndMs), at that wheel's time, so
|
|
2376
|
+
* its release keeps its velocity. A gesture a recognizer took is latched
|
|
2377
|
+
* to it, as a browser latches a scroller. While the gesture lasts, the
|
|
2378
|
+
* shared input stream hands this every wheel first, wherever it lands. So
|
|
2379
|
+
* a pan whose element moves from under a still pointer keeps the gesture.
|
|
2380
|
+
* The page listener exists only during a gesture.
|
|
2381
|
+
*/
|
|
2382
|
+
protected readonly onWheel: (event: Event) => void;
|
|
2383
|
+
/**
|
|
2384
|
+
* Move a followed pan through the splitter's undecided stretch. It moves on
|
|
2385
|
+
* from where it was shown at the fingers' last move, at their last speed.
|
|
2386
|
+
* It never passes what that speed projects for the time since.
|
|
2387
|
+
*/
|
|
2388
|
+
protected followProvisionally(gesture: WheelGesture, f: WheelFollow, time: number): void;
|
|
2389
|
+
/**
|
|
2390
|
+
* Whether a scroller between `target` and `boundary` (both included)
|
|
2391
|
+
* scrolls this wheel now, along the wheel's major axis. It uses the edge
|
|
2392
|
+
* test a finger's probe uses (canElementScroll). With `keepsBoundary`, the
|
|
2393
|
+
* boundary's own scroll is its recognizers', as it is for a finger.
|
|
2394
|
+
*/
|
|
2395
|
+
protected scrollerTakes(target: unknown, boundary: Element, dx: number, dy: number, isHorizontal: boolean, keepsBoundary: boolean): boolean;
|
|
2396
|
+
/**
|
|
2397
|
+
* Whether the touch-action the host derives for `element` keeps the
|
|
2398
|
+
* wheel's axis from the browser. A finger's pan along that axis is then
|
|
2399
|
+
* the element's recognizers', and so is a trackpad's scroll of the element
|
|
2400
|
+
* itself.
|
|
2401
|
+
*/
|
|
2402
|
+
protected keepsAxis(element: Element, isHorizontal: boolean): boolean;
|
|
2403
|
+
/** A ctrl-wheel pinch's two contacts, `span` apart around its center. */
|
|
2404
|
+
protected pinchContacts(gesture: WheelGesture, time: number): {
|
|
2405
|
+
id: number;
|
|
2406
|
+
x: number;
|
|
2407
|
+
y: number;
|
|
2408
|
+
time: number;
|
|
2409
|
+
}[];
|
|
2410
|
+
/** Whether a recognizer that took this wheel gesture still takes part in it. */
|
|
2411
|
+
protected wheelHasTaker(gesture: WheelGesture): boolean;
|
|
2412
|
+
}
|
|
2413
|
+
//#endregion
|
|
2414
|
+
//#region src/gestures/hostWheelGesture.d.ts
|
|
2415
|
+
/** A wheel gesture's begin, latch and end; GestureHost is the class to use. */
|
|
2416
|
+
declare abstract class HostWheelGesture extends HostWheelInput {
|
|
2417
|
+
/** Start a wheel gesture: who takes it, decided once, or nobody. */
|
|
2418
|
+
protected beginWheel(wheel: WheelEvent, kind: 'pan' | 'pinch', dx: number, dy: number, time: number): WheelGesture;
|
|
2419
|
+
/**
|
|
2420
|
+
* Route every wheel on the page to the live wheel gesture, from its claim.
|
|
2421
|
+
* The route is the shared input stream's capture listener on the window,
|
|
2422
|
+
* which runs before any document listener. It is non-passive only while it
|
|
2423
|
+
* is subscribed.
|
|
2424
|
+
*/
|
|
2425
|
+
protected latchWheel(): void;
|
|
2426
|
+
/**
|
|
2427
|
+
* End the trackpad pan a recognizer still drives, when the page loses focus
|
|
2428
|
+
* or hides, and return its contacts to cancel. The rest of its stream is
|
|
2429
|
+
* the page's until the stream ends, as a touch the browser takes is. A
|
|
2430
|
+
* ctrl-wheel pinch keeps its stream, so the page never zooms for it. A
|
|
2431
|
+
* gesture the page keeps stays as it is. So does a pan its lift released:
|
|
2432
|
+
* its momentum stays latched and prevented until the stream ends.
|
|
2433
|
+
*/
|
|
2434
|
+
protected dropDrivenWheel(): ReadonlyArray<number>;
|
|
2435
|
+
/**
|
|
2436
|
+
* End the wheel gesture in progress. On its own timer, it ends its end
|
|
2437
|
+
* window after its last wheel. A taker that leaves (a detach, a disable)
|
|
2438
|
+
* passes that last wheel's time. An input that ends it sooner (a press,
|
|
2439
|
+
* the next gesture's first wheel) passes its own time. Both times are on
|
|
2440
|
+
* the wheels' time base (eventTime), never the host's clock, which need
|
|
2441
|
+
* not share it.
|
|
2442
|
+
*/
|
|
2443
|
+
protected endWheel(endTime?: number): void;
|
|
2444
|
+
}
|
|
2445
|
+
//#endregion
|
|
2446
|
+
//#region src/gestures/hostTouchStart.d.ts
|
|
2447
|
+
/** Touch events: a finger's start and move, and a claimed finger's end; GestureHost is the class to use. */
|
|
2448
|
+
declare abstract class HostTouchStart extends HostWheelGesture {
|
|
2449
|
+
protected abstract dropFingersNotDown(event: TouchEvent): void;
|
|
2450
|
+
protected abstract failUnclaimedLoneFingerPans(): void;
|
|
2451
|
+
protected abstract feedMoves(inputs: ReadonlyArray<TouchInput>): void;
|
|
2452
|
+
protected abstract forgetFinger(identifier: number): number | undefined;
|
|
2453
|
+
protected abstract isFingerClaimed(): boolean;
|
|
2454
|
+
protected abstract noteFingersDown(event: TouchEvent): void;
|
|
2455
|
+
protected abstract pairTouch(id: number, place: PlacedContact): void;
|
|
2456
|
+
protected abstract watchTarget(identifier: number, target: EventTarget | null, isBlocking: boolean, isClaiming: boolean): void;
|
|
2457
|
+
protected readonly onTouchStart: (event: TouchEvent) => void;
|
|
2458
|
+
protected readonly onTouchMove: (event: TouchEvent) => void;
|
|
2459
|
+
/** The one blocking `touchmove` handler every claiming element shares. */
|
|
2460
|
+
protected readonly onBlockingTouchMove: (event: Event) => void;
|
|
2461
|
+
/**
|
|
2462
|
+
* Cancel a `touchmove` while a recognizer owns one of its fingers. A touch
|
|
2463
|
+
* no recognizer owns keeps its moves (`spec:AST-094` FR19): nothing is
|
|
2464
|
+
* cancelled before a recognizer begins, or for a touch it does not track,
|
|
2465
|
+
* unless a recognizer holds that finger already (a scroll-edge pan pulling
|
|
2466
|
+
* away from an edge every scroller under it is at; FR19, DEC-18).
|
|
2467
|
+
*/
|
|
2468
|
+
/**
|
|
2469
|
+
* Under `inputMode: 'pointer-events'` a finger comes from its pointer
|
|
2470
|
+
* events, so its touches carry no id of ours: the live finger it is, the
|
|
2471
|
+
* nearest pointer-fed finger on the same target. Its touchmoves can then
|
|
2472
|
+
* be cancelled once a recognizer claims it (`spec:AST-094` FR19, FR21).
|
|
2473
|
+
*/
|
|
2474
|
+
protected pointerFingerAt(touch: Touch): number | undefined;
|
|
2475
|
+
/**
|
|
2476
|
+
* Cancel the `touchend` of a finger a recognizer owned when it lifted
|
|
2477
|
+
* (`inputMode: 'pointer-events'`): its `pointerup` came first, at the same
|
|
2478
|
+
* place on the same target (`spec:AST-094` FR21). Records older than
|
|
2479
|
+
* CLAIMED_LIFT_MS are dropped first: their touchend never came.
|
|
2480
|
+
*/
|
|
2481
|
+
protected readonly onClaimedTouchEnd: (event: Event) => void;
|
|
2482
|
+
protected cancelIfClaimed(event: TouchEvent): void;
|
|
2483
|
+
}
|
|
2484
|
+
//#endregion
|
|
2485
|
+
//#region src/gestures/hostTouchEnd.d.ts
|
|
2486
|
+
/** Touch events: a finger's end and cancel, the target's own listeners, and pairing touches with pointers; GestureHost is the class to use. */
|
|
2487
|
+
declare abstract class HostTouchEnd extends HostTouchStart {
|
|
2488
|
+
protected readonly onTouchEnd: (event: TouchEvent) => void;
|
|
2489
|
+
/**
|
|
2490
|
+
* Clicks what a retargeted contact touched if it ended as a tap the
|
|
2491
|
+
* engine would click: nothing claimed it, the browser did not take it
|
|
2492
|
+
* (a taken contact is no longer retargeted), and the finger stayed within
|
|
2493
|
+
* a tap's movement. Returns whether it clicked.
|
|
2494
|
+
*/
|
|
2495
|
+
protected clickRetargetedTap(landed: {
|
|
2496
|
+
x: number;
|
|
2497
|
+
y: number;
|
|
2498
|
+
target: EventTarget;
|
|
2499
|
+
} | undefined, end: {
|
|
2500
|
+
x: number;
|
|
2501
|
+
y: number;
|
|
2502
|
+
}, disposition: ClickDisposition | undefined, pointerType: string): boolean;
|
|
2503
|
+
protected readonly onTouchCancel: (event: TouchEvent) => void;
|
|
2504
|
+
/** The target's own listeners, for a target that left the document. */
|
|
2505
|
+
protected readonly onTargetTouchMove: (event: Event) => void;
|
|
2506
|
+
/** The same for a finger nothing could claim while it moves: never blocks. */
|
|
2507
|
+
protected readonly onTargetTouchMovePassive: (event: Event) => void;
|
|
2508
|
+
protected readonly onTargetTouchEnd: (event: Event) => void;
|
|
2509
|
+
/** The same, registered passively for a touch only watchers follow. */
|
|
2510
|
+
protected readonly onTargetTouchEndPassive: (event: Event) => void;
|
|
2511
|
+
protected readonly onTargetTouchCancel: (event: Event) => void;
|
|
2512
|
+
/**
|
|
2513
|
+
* Cancel tracked fingers the event says are no longer down. `touches`
|
|
2514
|
+
* lists every finger on the screen; one missing from it (and not lifting
|
|
2515
|
+
* in this very event) ended where we could not see it.
|
|
2516
|
+
*/
|
|
2517
|
+
protected dropFingersNotDown(event: TouchEvent): void;
|
|
2518
|
+
protected watchTarget(identifier: number, target: EventTarget | null, isBlocking: boolean, isClaiming: boolean): void;
|
|
2519
|
+
protected unwatchTarget(identifier: number): void;
|
|
2520
|
+
/**
|
|
2521
|
+
* Keeps one `touchmove` listener on a watched target: the blocking one
|
|
2522
|
+
* while a finger on it could be claimed as it moves, a passive one
|
|
2523
|
+
* otherwise, so a scroll starting there never waits on the main thread
|
|
2524
|
+
* (`spec:AST-094` FR19).
|
|
2525
|
+
*/
|
|
2526
|
+
protected swapTargetTouchMove(target: EventTarget, wasBlocking: boolean, isBlocking: boolean): void;
|
|
2527
|
+
/**
|
|
2528
|
+
* Keeps one `touchend` listener on a watched target: the cancelable one
|
|
2529
|
+
* while a finger on it has a participant that could claim (a lift whose
|
|
2530
|
+
* click must not happen cancels its `touchend`), a passive one while only
|
|
2531
|
+
* watchers follow its fingers (`spec:AST-094` FR20).
|
|
2532
|
+
*/
|
|
2533
|
+
protected swapTargetTouchEnd(target: EventTarget, wasClaiming: boolean, isClaiming: boolean): void;
|
|
2534
|
+
/** Stop tracking a finger by its Touch.identifier; returns its arena id. */
|
|
2535
|
+
protected forgetFinger(identifier: number): number | undefined;
|
|
2536
|
+
protected pairTouch(id: number, place: PlacedContact): void;
|
|
2537
|
+
protected pairPointer(pointerId: number, place: PlacedContact): void;
|
|
2538
|
+
/** Feed moves from a contact's sampling channel, in time order. */
|
|
2539
|
+
protected feedMoves(inputs: ReadonlyArray<TouchInput>): void;
|
|
2540
|
+
/** Forget a contact's pairing and echo state. */
|
|
2541
|
+
protected forgetContact(id: number): void;
|
|
2542
|
+
}
|
|
2543
|
+
//#endregion
|
|
2544
|
+
//#region src/gestures/hostPointer.d.ts
|
|
2545
|
+
/** Pointer events: a press's down, move and up, claimed lifts, and the host's own scrolls; GestureHost is the class to use. */
|
|
2546
|
+
declare abstract class HostPointer extends HostTouchEnd {
|
|
2547
|
+
protected abstract isPenHold(id: number, time: number): boolean;
|
|
2548
|
+
protected abstract notePenDrift(id: number, x: number, y: number, time: number): void;
|
|
2549
|
+
protected abstract refuseCancelledLift(event: PointerEvent): void;
|
|
2550
|
+
protected readonly onPointerDown: (event: PointerEvent) => void;
|
|
2551
|
+
protected readonly onPointerMove: (event: PointerEvent) => void;
|
|
2552
|
+
/**
|
|
2553
|
+
* In Chromium, a sandboxed frame can miss the `pointerup` of a button
|
|
2554
|
+
* released outside the window. The next mouse event shows the button up,
|
|
2555
|
+
* or a new press. The contact then ends at its last place. No click comes
|
|
2556
|
+
* to this document, so no click guard is armed.
|
|
2557
|
+
*/
|
|
2558
|
+
protected endMissedMouseLift(event: PointerEvent): boolean;
|
|
2559
|
+
protected readonly onPointerUp: (event: PointerEvent) => void;
|
|
2560
|
+
/**
|
|
2561
|
+
* Note a claimed finger's lift, so the `touchend` that follows its
|
|
2562
|
+
* `pointerup` is cancelled (FR21). Only where an element's listener can take
|
|
2563
|
+
* that touchend: elsewhere none comes, and the note would hold its node for
|
|
2564
|
+
* nothing. At most CLAIMED_LIFT_LIMIT wait, the oldest going first, and one
|
|
2565
|
+
* timer drops each once CLAIMED_LIFT_MS has passed (FR24); the host's
|
|
2566
|
+
* uninstall keeps them, as it can run in the microtask after the pointerup,
|
|
2567
|
+
* before the touchend that comes later in the same task.
|
|
2568
|
+
*/
|
|
2569
|
+
protected noteClaimedLift(event: PointerEvent): void;
|
|
2570
|
+
/** Arm the one timer for the oldest claimed lift still waiting. */
|
|
2571
|
+
protected armClaimedLiftTimer(): void;
|
|
2572
|
+
/** Drop every claimed lift and its timer, once the last one is taken. */
|
|
2573
|
+
protected clearClaimedLifts(): void;
|
|
2574
|
+
/**
|
|
2575
|
+
* A recognizer is about to scroll `scroller` itself (a menu's edge
|
|
2576
|
+
* autoscroll, spec:AST-094 FR30): the scroll that write fires is not a
|
|
2577
|
+
* finger's and not the browser taking one. It passes until the end of the
|
|
2578
|
+
* next frame, when that event has fired; a real pan in that window still
|
|
2579
|
+
* reports itself through pointercancel or touchcancel.
|
|
2580
|
+
*/
|
|
2581
|
+
ownScroll(scroller: Node): void;
|
|
2582
|
+
/**
|
|
2583
|
+
* Internal. Whether a recognizer is scrolling `scroller` itself now
|
|
2584
|
+
* (ownScroll): that scroll is not a finger's (fingerScroll.ts reads it).
|
|
2585
|
+
*/
|
|
2586
|
+
isOwnScroll(scroller: Node): boolean;
|
|
2587
|
+
protected readonly onScroll: (event: Event) => void;
|
|
2588
|
+
}
|
|
2589
|
+
//#endregion
|
|
2590
|
+
//#region src/gestures/GestureHost.d.ts
|
|
2591
|
+
declare class GestureHost extends HostPointer {
|
|
2592
|
+
protected readonly onPointerCancel: (event: PointerEvent) => void;
|
|
2593
|
+
/**
|
|
2594
|
+
* Whether a pen contact is a hold: it stays within the long press's
|
|
2595
|
+
* tolerance for its duration. Only such a hold fires the platform's own
|
|
2596
|
+
* menu event, so the host notes no other pen's lift.
|
|
2597
|
+
*/
|
|
2598
|
+
protected isPenHold(id: number, time: number): boolean;
|
|
2599
|
+
/**
|
|
2600
|
+
* A pen contact that leaves the long press's tolerance before its duration
|
|
2601
|
+
* is no hold, so its lift arms no menu refusal.
|
|
2602
|
+
*/
|
|
2603
|
+
protected notePenDrift(id: number, x: number, y: number, time: number): void;
|
|
2604
|
+
/**
|
|
2605
|
+
* Which live finger a touch `pointercancel` is about. The pointer keeps
|
|
2606
|
+
* the target the finger landed on (implicit capture), as the Touch does;
|
|
2607
|
+
* among fingers on that target, the nearest. WebKit also numbers the
|
|
2608
|
+
* pointer like the Touch, which settles what position cannot.
|
|
2609
|
+
*/
|
|
2610
|
+
protected touchForCancelledPointer(event: PointerEvent): number | null;
|
|
2611
|
+
protected replayClick(touch: GestureTouch, allowed: boolean): void;
|
|
2612
|
+
protected readonly onContextMenu: (event: MouseEvent) => void;
|
|
2613
|
+
protected noteFingersDown(event: TouchEvent): void;
|
|
2614
|
+
/**
|
|
2615
|
+
* A second finger landed somewhere (wherever: often on a plain row): a
|
|
2616
|
+
* pan that takes one finger only and has not claimed its touch fails, so
|
|
2617
|
+
* the two fingers stay the browser's pinch (WCAG 1.4.4) instead of the
|
|
2618
|
+
* pan claiming them midway. A drag a recognizer has claimed keeps its
|
|
2619
|
+
* finger: a second finger never cancels or redirects it (`spec:AST-094`
|
|
2620
|
+
* FR10), and no claim is released here.
|
|
2621
|
+
*/
|
|
2622
|
+
protected failUnclaimedLoneFingerPans(): void;
|
|
2623
|
+
/** Whether a finger's drag is claimed: then two fingers make no pinch. */
|
|
2624
|
+
protected isFingerClaimed(): boolean;
|
|
2625
|
+
protected readonly onVisibilityChange: () => void;
|
|
2626
|
+
protected readonly onBlur: () => void;
|
|
2627
|
+
/** Whether the browser sends Touch Events at all (`ontouchstart`). */
|
|
2628
|
+
protected sendsTouchEvents(): boolean;
|
|
2629
|
+
/**
|
|
2630
|
+
* Whether the host reads fingers from their pointer events: Pointer Events
|
|
2631
|
+
* input, or a window with no `ontouchstart` (touch emulation turned on
|
|
2632
|
+
* after load), as the move path does.
|
|
2633
|
+
*/
|
|
2634
|
+
protected readsFingersFromPointerEvents(): boolean;
|
|
2635
|
+
/**
|
|
2636
|
+
* The lift of a contact the lost focus cancelled: its click is refused,
|
|
2637
|
+
* and a finger's touchend after it is cancelled.
|
|
2638
|
+
*/
|
|
2639
|
+
protected refuseCancelledLift(event: PointerEvent): void;
|
|
2640
|
+
/** The app lost focus: UIKit cancels every touch in flight. */
|
|
2641
|
+
protected cancelEverything(time: number): void;
|
|
2642
|
+
}
|
|
2643
|
+
/** The gesture host of a document, created on first use. */
|
|
2644
|
+
export declare function getGestureHost(doc: Document): GestureHost;
|
|
2645
|
+
//#endregion
|
|
2646
|
+
//#region src/gestures/LongPressGestureRecognizer.d.ts
|
|
2647
|
+
interface LongPressGestureRecognizerOptions extends GestureRecognizerOptions<LongPressGestureRecognizer> {
|
|
2648
|
+
minimumPressDuration?: number;
|
|
2649
|
+
allowableMovement?: number;
|
|
2650
|
+
/** Quick taps before the press. @default 0 */
|
|
2651
|
+
numberOfTapsRequired?: number;
|
|
2652
|
+
/** @default 1 */
|
|
2653
|
+
numberOfTouchesRequired?: number;
|
|
2654
|
+
}
|
|
2655
|
+
export declare class LongPressGestureRecognizer extends GestureRecognizer {
|
|
2656
|
+
get kind(): GestureRecognizer['kind'];
|
|
2657
|
+
/** Internal. The host's brand: a long press keeps the callout and selection off (recognizerInternals). */
|
|
2658
|
+
protected get family(): 'longPress';
|
|
2659
|
+
minimumPressDuration: number;
|
|
2660
|
+
allowableMovement: number;
|
|
2661
|
+
numberOfTapsRequired: number;
|
|
2662
|
+
numberOfTouchesRequired: number;
|
|
2663
|
+
private tapsDone;
|
|
2664
|
+
/** The taps phase's current tap: when it landed and its most fingers. */
|
|
2665
|
+
private tapStartedAt;
|
|
2666
|
+
private tapMostTouches;
|
|
2667
|
+
private isPressTimerArmed;
|
|
2668
|
+
/** When the gesture began, on the event clock. */
|
|
2669
|
+
beganAt: number | null;
|
|
2670
|
+
constructor(options?: LongPressGestureRecognizerOptions);
|
|
2671
|
+
isInvolved(): boolean;
|
|
2672
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
2673
|
+
protected acceptsTouch(touch: GestureTouch): boolean;
|
|
2674
|
+
protected touchesBegan(_touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
2675
|
+
protected touchesMoved(touches: ReadonlyArray<GestureTouch>): void;
|
|
2676
|
+
protected touchesEnded(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
2677
|
+
protected reset(): void;
|
|
2678
|
+
}
|
|
2679
|
+
//#endregion
|
|
2680
|
+
//#region src/gestures/TapGestureRecognizer.d.ts
|
|
2681
|
+
interface TapGestureRecognizerOptions extends GestureRecognizerOptions<TapGestureRecognizer> {
|
|
2682
|
+
/** @default 1 */
|
|
2683
|
+
numberOfTapsRequired?: number;
|
|
2684
|
+
/** @default 1 */
|
|
2685
|
+
numberOfTouchesRequired?: number;
|
|
2686
|
+
allowableMovement?: number;
|
|
2687
|
+
maximumIntervalBetweenTaps?: number;
|
|
2688
|
+
allowableSeparation?: number;
|
|
2689
|
+
maximumTapDuration?: number;
|
|
2690
|
+
}
|
|
2691
|
+
export declare class TapGestureRecognizer extends GestureRecognizer {
|
|
2692
|
+
get kind(): GestureRecognizer['kind'];
|
|
2693
|
+
/** Internal. The host's brand: a tap decides at the lift, so it never claims mid-move (recognizerInternals). */
|
|
2694
|
+
protected get family(): 'tap';
|
|
2695
|
+
numberOfTapsRequired: number;
|
|
2696
|
+
numberOfTouchesRequired: number;
|
|
2697
|
+
allowableMovement: number;
|
|
2698
|
+
maximumIntervalBetweenTaps: number;
|
|
2699
|
+
allowableSeparation: number;
|
|
2700
|
+
maximumTapDuration: number;
|
|
2701
|
+
private tapCount;
|
|
2702
|
+
private isTapInProgress;
|
|
2703
|
+
private maxTouchesThisTap;
|
|
2704
|
+
/** Where the first tap's fingers lifted: their centroid. */
|
|
2705
|
+
private firstTapLocation;
|
|
2706
|
+
/** The current tap's fingers: where each landed and where each lifted. */
|
|
2707
|
+
private tapStarts;
|
|
2708
|
+
private tapLifts;
|
|
2709
|
+
constructor(options?: TapGestureRecognizerOptions);
|
|
2710
|
+
get isDiscrete(): boolean;
|
|
2711
|
+
get nativeTouchBehavior(): NativeTouchBehavior;
|
|
2712
|
+
/** Taps completed so far in the current sequence. */
|
|
2713
|
+
get completedTaps(): number;
|
|
2714
|
+
isInvolved(): boolean;
|
|
2715
|
+
protected touchesBegan(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
2716
|
+
protected touchesMoved(touches: ReadonlyArray<GestureTouch>): void;
|
|
2717
|
+
protected touchesEnded(touches: ReadonlyArray<GestureTouch>, event: GestureEventContext): void;
|
|
2718
|
+
protected reset(): void;
|
|
2719
|
+
}
|
|
2720
|
+
//#endregion
|
|
2721
|
+
//#region src/gestures/useGestureRecognizer.d.ts
|
|
2722
|
+
interface UseGestureRecognizerOptions {
|
|
2723
|
+
/**
|
|
2724
|
+
* Live toggle; turning it off mid-gesture cancels the gesture. That cancel
|
|
2725
|
+
* does not call `onGesture`: the code that turned it off already knows. A
|
|
2726
|
+
* recognizer that required this one to fail resolves just after and
|
|
2727
|
+
* reports as usual.
|
|
2728
|
+
* @default true
|
|
2729
|
+
*/
|
|
2730
|
+
isEnabled?: MaybeRefOrGetter<boolean>;
|
|
2731
|
+
/** Let the host set touch-action (and long-press callout) styles. @default true */
|
|
2732
|
+
manageStyle?: MaybeRefOrGetter<boolean>;
|
|
2733
|
+
/**
|
|
2734
|
+
* The element is an action group, sibling actions a held pointer slides
|
|
2735
|
+
* across (`family:action-groups` FR5): the host serves it where the
|
|
2736
|
+
* primary pointer is fine too (`AttachOptions.actionGroup`).
|
|
2737
|
+
* @default false
|
|
2738
|
+
*/
|
|
2739
|
+
actionGroup?: MaybeRefOrGetter<boolean>;
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Attach a recognizer to the element `target` names.
|
|
2743
|
+
*
|
|
2744
|
+
* @example
|
|
2745
|
+
* ```ts
|
|
2746
|
+
* const sheet = ref<HTMLElement | null>(null)
|
|
2747
|
+
* useGestureRecognizer(
|
|
2748
|
+
* sheet,
|
|
2749
|
+
* () => new PanGestureRecognizer({ direction: 'vertical' }),
|
|
2750
|
+
* (recognizer) => {
|
|
2751
|
+
* sheet.value!.style.transform = `translateY(${recognizer.translation().y}px)`
|
|
2752
|
+
* },
|
|
2753
|
+
* )
|
|
2754
|
+
* ```
|
|
2755
|
+
*/
|
|
2756
|
+
export declare function useGestureRecognizer<R extends GestureRecognizer>(target: MaybeRefOrGetter<Element | null | undefined>, create: () => R, onGesture?: (recognizer: R) => void, options?: UseGestureRecognizerOptions): R;
|
|
2757
|
+
//#endregion
|
|
2758
|
+
//#region src/motion/bezier.d.ts
|
|
2759
|
+
/**
|
|
2760
|
+
* @file bezier.ts
|
|
2761
|
+
* @input Cubic-bézier control points [x1, y1, x2, y2]
|
|
2762
|
+
* @output Exports `cubicBezier`, the timing function CSS and Core Animation
|
|
2763
|
+
* define by those points (progress → eased progress)
|
|
2764
|
+
* @position Pure math under the animator (the Reduced Motion cross-fade runs
|
|
2765
|
+
* on Core Animation's named curves); no DOM, no React
|
|
2766
|
+
*
|
|
2767
|
+
* The curve runs from (0, 0) to (1, 1) with the two given control points;
|
|
2768
|
+
* x is time, y is progress. Solved for x by Newton's method with a bisection
|
|
2769
|
+
* fallback, the approach browser engines use for CSS `cubic-bezier()`.
|
|
2770
|
+
*/
|
|
2771
|
+
type BezierPoints = readonly [number, number, number, number];
|
|
2772
|
+
/** The timing function for `points`: maps time progress to eased progress. */
|
|
2773
|
+
export declare function cubicBezier([x1, y1, x2, y2]: BezierPoints): (x: number) => number;
|
|
2774
|
+
//#endregion
|
|
2775
|
+
//#region src/motion/progress.d.ts
|
|
2776
|
+
/**
|
|
2777
|
+
* The curve of `f(driver(t))`, its velocity by the chain rule: a channel
|
|
2778
|
+
* following a path as its progress moves, or a companion following any
|
|
2779
|
+
* driving curve (a sheet's `y` mapped onto its scrim's opacity). The driver
|
|
2780
|
+
* is any MotionCurve, not only a progress from 0 to 1. A companion played on
|
|
2781
|
+
* another animator starts with its driver (`{at: start}`; see the file
|
|
2782
|
+
* header).
|
|
2783
|
+
*/
|
|
2784
|
+
export declare function mapProgress(driver: MotionCurve, f: (value: number) => number): MotionCurve;
|
|
2785
|
+
//#endregion
|
|
2786
|
+
//#region src/motion/reducedMotion.d.ts
|
|
2787
|
+
/**
|
|
2788
|
+
* The fade to play under Reduce Motion. `duration` 0 means the change
|
|
2789
|
+
* completes at once; `easing` is a CSS timing function.
|
|
2790
|
+
*/
|
|
2791
|
+
interface ReducedMotionFade {
|
|
2792
|
+
readonly duration: number;
|
|
2793
|
+
readonly easing: string;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* The Reduced Motion fade for a change to `element` now, for motion the
|
|
2797
|
+
* animator does not drive (two titles cross-fading with Web Animations):
|
|
2798
|
+
* null when motion is not reduced (play the normal motion), else an
|
|
2799
|
+
* opacity-only fade of 200 ms on a coarse pointer or for a touch release, or
|
|
2800
|
+
* duration 0 (at once) on any other pointer, on Core Animation's easeInOut;
|
|
2801
|
+
* the length is fixed.
|
|
2802
|
+
*/
|
|
2803
|
+
export declare function reducedMotionFade(element?: Element | null, options?: {
|
|
2804
|
+
/** The change starts from the release of a touch drag (DR2). */
|
|
2805
|
+
touchRelease?: boolean;
|
|
2806
|
+
}): ReducedMotionFade | null;
|
|
2807
|
+
//#endregion
|
|
2808
|
+
//#region src/motion/roleValue.d.ts
|
|
2809
|
+
/** The three kinds of value a role can hold. */
|
|
2810
|
+
type MotionRoleKind = 'spring' | 'duration' | 'curve';
|
|
2811
|
+
/** Cubic-bézier control points `[x1, y1, x2, y2]`. */
|
|
2812
|
+
type MotionCurvePoints = readonly [number, number, number, number];
|
|
2813
|
+
//#endregion
|
|
2814
|
+
//#region src/motion/roles.d.ts
|
|
2815
|
+
/**
|
|
2816
|
+
* Reads a role value back from its CSS custom property. Returns null for an
|
|
2817
|
+
* empty or malformed value: the caller then uses the table's value.
|
|
2818
|
+
*/
|
|
2819
|
+
export declare function parseMotionRoleValue(kind: 'spring', text: string): DurationBounce | null;
|
|
2820
|
+
export declare function parseMotionRoleValue(kind: 'duration', text: string): number | null;
|
|
2821
|
+
export declare function parseMotionRoleValue(kind: 'curve', text: string): MotionCurvePoints | null;
|
|
2822
|
+
export declare function parseMotionRoleValue(kind: MotionRoleKind, text: string): DurationBounce | number | MotionCurvePoints | null;
|
|
2823
|
+
/**
|
|
2824
|
+
* Reads a CSS easing, a keyword or a `cubic-bezier()`, as a curve role's value
|
|
2825
|
+
* is read. Returns null for any other easing, such as `steps()`.
|
|
2826
|
+
*/
|
|
2827
|
+
export declare function parseCssEasing(text: string): MotionCurvePoints | null;
|
|
2828
|
+
//#endregion
|
|
2829
|
+
//#region src/motion/resolveMotion.d.ts
|
|
2830
|
+
/**
|
|
2831
|
+
* A motion role's value at the tempo of the theme `element` is in. Hand it a
|
|
2832
|
+
* spring or curve of a motion table, or a table group and a key (the way to
|
|
2833
|
+
* name a duration, which is a bare number):
|
|
2834
|
+
*
|
|
2835
|
+
* @example
|
|
2836
|
+
* ```
|
|
2837
|
+
* const spring = resolveMotion(sheet, springs.settle);
|
|
2838
|
+
* const fadeMs = resolveMotion(row, timing, 'stateChangeMs');
|
|
2839
|
+
* ```
|
|
2840
|
+
*
|
|
2841
|
+
* The element names where the motion plays. Anything that is not a role
|
|
2842
|
+
* comes back unchanged. So a spring written inline at a call site keeps
|
|
2843
|
+
* working, and a resolved spring is not scaled again.
|
|
2844
|
+
*/
|
|
2845
|
+
export declare function resolveMotion<T extends SpringDescription>(element: Element | null | undefined, spring: T): T | SpringDescription;
|
|
2846
|
+
export declare function resolveMotion(element: Element | null | undefined, curve: MotionCurvePoints): MotionCurvePoints;
|
|
2847
|
+
export declare function resolveMotion<G extends object, K extends keyof G & string>(element: Element | null | undefined, group: G, key: K): G[K] extends number ? number : G[K] extends MotionCurvePoints ? MotionCurvePoints : G[K] | SpringDescription;
|
|
2848
|
+
//#endregion
|
|
2849
|
+
//#region src/motion/rubberBand.d.ts
|
|
2850
|
+
/**
|
|
2851
|
+
* @file rubberBand.ts
|
|
2852
|
+
* @input An overflow past an edge, the scroll view's dimension and UIKit's
|
|
2853
|
+
* rubber-band coefficient
|
|
2854
|
+
* @output Exports `rubberBand` (finger overflow → displayed overflow), its
|
|
2855
|
+
* inverse, its slope, and the clamp/unclamp pair over a [min, max] range
|
|
2856
|
+
* @position Pure math; no DOM, no React
|
|
2857
|
+
*
|
|
2858
|
+
* UIScrollView resists a drag past its content edge with
|
|
2859
|
+
* b = (1 − 1 ÷ (x·c ÷ d + 1))·d
|
|
2860
|
+
* where x is how far the finger has gone past the edge, d the scroll view's
|
|
2861
|
+
* size on that axis and c = 0.55 (uikit/scroll.ts records the sources). The
|
|
2862
|
+
* displayed overflow b approaches d but never reaches it, and its slope at
|
|
2863
|
+
* the edge is c: the first points of overflow move at 55 % of the finger.
|
|
2864
|
+
*
|
|
2865
|
+
* The inverse matters for spec:AST-094 FR6 (a finger catches any animation
|
|
2866
|
+
* mid-flight): a finger that lands on content still bouncing back has to
|
|
2867
|
+
* resume the drag from the finger position that would produce the overflow
|
|
2868
|
+
* on screen, or the content jumps.
|
|
2869
|
+
*/
|
|
2870
|
+
/**
|
|
2871
|
+
* Displayed overflow for a finger `overflow` past the edge (signed: the sign
|
|
2872
|
+
* is kept). `dimension` is the scroll view's size on the axis.
|
|
2873
|
+
*/
|
|
2874
|
+
export declare function rubberBand(overflow: number, dimension: number, coefficient?: number): number;
|
|
2875
|
+
/** The finger overflow that displays `displayed`; ±Infinity at ±dimension. */
|
|
2876
|
+
export declare function rubberBandInverse(displayed: number, dimension: number, coefficient?: number): number;
|
|
2877
|
+
/**
|
|
2878
|
+
* d(displayed) ÷ d(finger) at a finger overflow: what a finger velocity
|
|
2879
|
+
* becomes on screen while banding (c at the edge, falling toward 0).
|
|
2880
|
+
*/
|
|
2881
|
+
export declare function rubberBandSlope(overflow: number, dimension: number, coefficient?: number): number;
|
|
2882
|
+
//#endregion
|
|
2883
|
+
//#region src/motion/uikit/gestures.d.ts
|
|
2884
|
+
/**
|
|
2885
|
+
* Every group in one object, for a reader that needs several. A reader of
|
|
2886
|
+
* one group imports it by name instead (`UIKIT_PAN`): object properties do
|
|
2887
|
+
* not tree-shake, so this object bundles every group
|
|
2888
|
+
* (`architecture:component-style-authoring` INV6).
|
|
2889
|
+
*/
|
|
2890
|
+
export declare const UIKIT_GESTURES: {
|
|
2891
|
+
readonly tap: {
|
|
2892
|
+
/**
|
|
2893
|
+
* How far each finger may travel from where it landed before a tap
|
|
2894
|
+
* fails, as a distance.
|
|
2895
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2896
|
+
* with HID touches, Oct 23 2026: UITapGestureRecognizer
|
|
2897
|
+
* _allowableMovement 45; 44 pt taps, 46 pt fails, the same on the
|
|
2898
|
+
* diagonal
|
|
2899
|
+
*/
|
|
2900
|
+
readonly allowableMovement: {
|
|
2901
|
+
readonly value: 45;
|
|
2902
|
+
readonly unit: "px";
|
|
2903
|
+
};
|
|
2904
|
+
/**
|
|
2905
|
+
* Longest interval between one tap lifting and the next landing.
|
|
2906
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2907
|
+
* with HID touches, Oct 23 2026: _maximumIntervalBetweenSuccessiveTaps
|
|
2908
|
+
* 0.35 s; 330 ms double-taps, 370 ms does not
|
|
2909
|
+
*/
|
|
2910
|
+
readonly maximumIntervalBetweenTaps: {
|
|
2911
|
+
readonly value: 350;
|
|
2912
|
+
readonly unit: "ms";
|
|
2913
|
+
};
|
|
2914
|
+
/**
|
|
2915
|
+
* How far a later tap may land from the first one of the sequence.
|
|
2916
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2917
|
+
* with HID touches, Oct 23 2026: _allowableSeparation is unbounded and
|
|
2918
|
+
* the 45 pt movement rule applies between taps; 44 pt double-taps, 46
|
|
2919
|
+
* does not
|
|
2920
|
+
*/
|
|
2921
|
+
readonly allowableSeparation: {
|
|
2922
|
+
readonly value: 45;
|
|
2923
|
+
readonly unit: "px";
|
|
2924
|
+
};
|
|
2925
|
+
/**
|
|
2926
|
+
* Longest a finger may stay down and still tap.
|
|
2927
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2928
|
+
* with HID touches, Oct 23 2026: maximumTapDuration 1.5 s; a 1.4 s hold
|
|
2929
|
+
* taps, 1.6 s does not
|
|
2930
|
+
*/
|
|
2931
|
+
readonly maximumTapDuration: {
|
|
2932
|
+
readonly value: 1500;
|
|
2933
|
+
readonly unit: "ms";
|
|
2934
|
+
};
|
|
2935
|
+
};
|
|
2936
|
+
readonly longPress: {
|
|
2937
|
+
/**
|
|
2938
|
+
* UILongPressGestureRecognizer.minimumPressDuration default.
|
|
2939
|
+
* @source apple-docs
|
|
2940
|
+
* https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer/minimumpressduration
|
|
2941
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2942
|
+
* with HID touches, Oct 23 2026: _minimumPressDuration 0.5
|
|
2943
|
+
*/
|
|
2944
|
+
readonly minimumPressDuration: {
|
|
2945
|
+
readonly value: 500;
|
|
2946
|
+
readonly unit: "ms";
|
|
2947
|
+
};
|
|
2948
|
+
/**
|
|
2949
|
+
* UILongPressGestureRecognizer.allowableMovement default, a distance.
|
|
2950
|
+
* @source apple-docs
|
|
2951
|
+
* https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer/allowablemovement
|
|
2952
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2953
|
+
* with HID touches, Oct 23 2026: a (7, 7) drift begins, (7.2, 7.2) fails
|
|
2954
|
+
*/
|
|
2955
|
+
readonly allowableMovement: {
|
|
2956
|
+
readonly value: 10;
|
|
2957
|
+
readonly unit: "px";
|
|
2958
|
+
};
|
|
2959
|
+
};
|
|
2960
|
+
readonly pan: {
|
|
2961
|
+
/**
|
|
2962
|
+
* Travel before a pan begins, PER AXIS: |dx| or |dy| reaching it. The
|
|
2963
|
+
* translation is reset when the pan begins, so the hysteresis is not
|
|
2964
|
+
* part of it. Kept below the distance at which WebKit claims a drag for
|
|
2965
|
+
* scrolling, so a pan that must cancel the native scroll still sees
|
|
2966
|
+
* cancelable `touchmove`s.
|
|
2967
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2968
|
+
* with HID touches, Oct 23 2026: UIPanGestureRecognizer _hysteresis 10; x
|
|
2969
|
+
* and y began at 10.0, a diagonal at (10.67, 10.67); translation(in:) is
|
|
2970
|
+
* 0 at .began
|
|
2971
|
+
*/
|
|
2972
|
+
readonly hysteresis: {
|
|
2973
|
+
readonly value: 10;
|
|
2974
|
+
readonly unit: "px";
|
|
2975
|
+
};
|
|
2976
|
+
};
|
|
2977
|
+
readonly swipe: {
|
|
2978
|
+
/**
|
|
2979
|
+
* Travel along the swipe direction before a swipe is recognized.
|
|
2980
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2981
|
+
* with HID touches, Oct 23 2026: UISwipeGestureRecognizer minimum primary
|
|
2982
|
+
* movement 50; recognized during the motion; 40 pt does not
|
|
2983
|
+
*/
|
|
2984
|
+
readonly minimumDistance: {
|
|
2985
|
+
readonly value: 50;
|
|
2986
|
+
readonly unit: "px";
|
|
2987
|
+
};
|
|
2988
|
+
/**
|
|
2989
|
+
* Longest a swipe may take before it fails.
|
|
2990
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
2991
|
+
* with HID touches, Oct 23 2026: UISwipeGestureRecognizer maximum
|
|
2992
|
+
* duration 0.5 s
|
|
2993
|
+
*/
|
|
2994
|
+
readonly maximumDuration: {
|
|
2995
|
+
readonly value: 500;
|
|
2996
|
+
readonly unit: "ms";
|
|
2997
|
+
};
|
|
2998
|
+
/**
|
|
2999
|
+
* Travel across the swipe direction that fails it.
|
|
3000
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3001
|
+
* with HID touches, Oct 23 2026: UISwipeGestureRecognizer maximum
|
|
3002
|
+
* secondary movement 50
|
|
3003
|
+
*/
|
|
3004
|
+
readonly maximumSecondaryMovement: {
|
|
3005
|
+
readonly value: 50;
|
|
3006
|
+
readonly unit: "px";
|
|
3007
|
+
};
|
|
3008
|
+
/**
|
|
3009
|
+
* How the minimum movement relaxes over time. Read, not modelled: a
|
|
3010
|
+
* 120 pt swipe over 0.8 s was recognized at 303 ms, below 50 pt of travel.
|
|
3011
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3012
|
+
* with HID touches, Oct 23 2026: UISwipeGestureRecognizer
|
|
3013
|
+
* rateOfMinimumMovementDecay 0.06 (not modelled)
|
|
3014
|
+
*/
|
|
3015
|
+
readonly minimumMovementDecay: {
|
|
3016
|
+
readonly value: 0.06;
|
|
3017
|
+
readonly unit: "ratio";
|
|
3018
|
+
};
|
|
3019
|
+
};
|
|
3020
|
+
readonly pinch: {
|
|
3021
|
+
/**
|
|
3022
|
+
* Change of the distance between two fingers before a pinch begins. The
|
|
3023
|
+
* scale is then measured against the starting span moved by this much,
|
|
3024
|
+
* so it does not jump.
|
|
3025
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3026
|
+
* with HID touches, Oct 23 2026: UIPinchGestureRecognizer _hysteresis 8;
|
|
3027
|
+
* out from 120 began at 144 with scale 1.125 (= 144 / 128)
|
|
3028
|
+
*/
|
|
3029
|
+
readonly hysteresis: {
|
|
3030
|
+
readonly value: 8;
|
|
3031
|
+
readonly unit: "px";
|
|
3032
|
+
};
|
|
3033
|
+
};
|
|
3034
|
+
readonly rotation: {
|
|
3035
|
+
/**
|
|
3036
|
+
* Rotation of the two-finger vector before a rotation begins.
|
|
3037
|
+
* @source GUESS — UIRotationGestureRecognizer has no scalar threshold among
|
|
3038
|
+
* its ivars; 5 degrees. The simulator HID cannot rotate two fingers: a
|
|
3039
|
+
* device run (or an XCUITest rotate) logging the angle at .began.
|
|
3040
|
+
* @measure M-G10
|
|
3041
|
+
*/
|
|
3042
|
+
readonly hysteresis: {
|
|
3043
|
+
readonly value: 0.08726646259971647;
|
|
3044
|
+
readonly unit: "rad";
|
|
3045
|
+
};
|
|
3046
|
+
};
|
|
3047
|
+
readonly screenEdgePan: {
|
|
3048
|
+
/**
|
|
3049
|
+
* Width of the band at the screen edge a touch must land in.
|
|
3050
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3051
|
+
* with HID touches, Oct 23 2026: UIScreenEdgePanGestureRecognizer
|
|
3052
|
+
* _edgeRegionSize 40.2 on a 402 pt wide screen (10 % of it); edge pans
|
|
3053
|
+
* cannot begin from simulator HID
|
|
3054
|
+
*/
|
|
3055
|
+
readonly edgeRegion: {
|
|
3056
|
+
readonly value: 40.2;
|
|
3057
|
+
readonly unit: "px";
|
|
3058
|
+
};
|
|
3059
|
+
/**
|
|
3060
|
+
* Travel before an edge pan begins.
|
|
3061
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3062
|
+
* with HID touches, Oct 23 2026: the screen-edge pan hysteresis ivar 15
|
|
3063
|
+
*/
|
|
3064
|
+
readonly hysteresis: {
|
|
3065
|
+
readonly value: 15;
|
|
3066
|
+
readonly unit: "px";
|
|
3067
|
+
};
|
|
3068
|
+
};
|
|
3069
|
+
readonly control: {
|
|
3070
|
+
/**
|
|
3071
|
+
* How far outside its bounds a UIControl keeps a press inside: a finger
|
|
3072
|
+
* dragged out is still "inside" until it passes this margin.
|
|
3073
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3074
|
+
* with HID touches, Oct 23 2026: UIButton (.system) stays inside up to 70
|
|
3075
|
+
* pt out, touchDragExit at 71, touchDragEnter at 69 coming back;
|
|
3076
|
+
* touchUpInside up to 70, touchUpOutside from 71
|
|
3077
|
+
*/
|
|
3078
|
+
readonly trackingExpansion: {
|
|
3079
|
+
readonly value: 70;
|
|
3080
|
+
readonly unit: "px";
|
|
3081
|
+
};
|
|
3082
|
+
};
|
|
3083
|
+
readonly press: {
|
|
3084
|
+
/**
|
|
3085
|
+
* UIScrollView.delaysContentTouches: a touch in a scroller highlights after
|
|
3086
|
+
* this.
|
|
3087
|
+
* @source measured: Settings and Contacts, iOS 26.2 simulator, HID touches
|
|
3088
|
+
* filmed at 60 fps (utils/pressGesture.ts), Oct 6 2026
|
|
3089
|
+
*/
|
|
3090
|
+
readonly contentTouchDelay: {
|
|
3091
|
+
readonly value: 150;
|
|
3092
|
+
readonly unit: "ms";
|
|
3093
|
+
};
|
|
3094
|
+
/**
|
|
3095
|
+
* A tap shorter than the delay shows the highlight at the lift for this
|
|
3096
|
+
* long.
|
|
3097
|
+
* @source measured: Settings and Contacts, iOS 26.2 simulator, HID touches
|
|
3098
|
+
* filmed at 60 fps (utils/pressGesture.ts), Oct 6 2026
|
|
3099
|
+
*/
|
|
3100
|
+
readonly quickTapFlash: {
|
|
3101
|
+
readonly value: 100;
|
|
3102
|
+
readonly unit: "ms";
|
|
3103
|
+
};
|
|
3104
|
+
/**
|
|
3105
|
+
* Travel at which a press is a scroll, not a press.
|
|
3106
|
+
* @source measured: Mobile Safari 26.2, iOS 26.2 simulator, slow HID drag
|
|
3107
|
+
* on a scrollable page (1 pt steps): last cancelable touchmove at 10 px,
|
|
3108
|
+
* pointercancel and the first uncancelable touchmove at 11 px, Oct 23
|
|
3109
|
+
* 2026
|
|
3110
|
+
*/
|
|
3111
|
+
readonly slop: {
|
|
3112
|
+
readonly value: 10;
|
|
3113
|
+
readonly unit: "px";
|
|
3114
|
+
};
|
|
3115
|
+
/**
|
|
3116
|
+
* A touch this soon after a finger-driven scroll moved is a brake, not a
|
|
3117
|
+
* press.
|
|
3118
|
+
* @source measured: Settings and Contacts, iOS 26.2 simulator, HID touches
|
|
3119
|
+
* filmed at 60 fps (utils/pressGesture.ts), Oct 6 2026
|
|
3120
|
+
*/
|
|
3121
|
+
readonly scrollBrake: {
|
|
3122
|
+
readonly value: 150;
|
|
3123
|
+
readonly unit: "ms";
|
|
3124
|
+
};
|
|
3125
|
+
/**
|
|
3126
|
+
* How long after a finger was down a scroll can still be that finger's
|
|
3127
|
+
* momentum (the brake only counts scrolls a finger drove).
|
|
3128
|
+
* @source GUESS — The press model bound (utils/pressFeedback.ts): iOS
|
|
3129
|
+
* momentum runs for a second or two after the lift.
|
|
3130
|
+
* @measure M-G19
|
|
3131
|
+
*/
|
|
3132
|
+
readonly momentumMemory: {
|
|
3133
|
+
readonly value: 3000;
|
|
3134
|
+
readonly unit: "ms";
|
|
3135
|
+
};
|
|
3136
|
+
};
|
|
3137
|
+
readonly menuPress: {
|
|
3138
|
+
/**
|
|
3139
|
+
* How far the finger may move on a button inside a scroll view during the
|
|
3140
|
+
* content-touch delay and still open the menu. It is the trigger's drift
|
|
3141
|
+
* allowance.
|
|
3142
|
+
* @source GUESS — Between the 12 pt that opened and the 14 pt that did not.
|
|
3143
|
+
* UIKit lab, iOS 26.2 simulator, iPhone 17 Pro, gesture-state hook, Oct
|
|
3144
|
+
* 23 2026 (M-MN1). On a button outside any scroll view, a 12 pt move
|
|
3145
|
+
* within 80 ms still opened the menu at about 151 ms. Moves of 14, 17, 20
|
|
3146
|
+
* and 25 pt opened nothing. The recognizer reads an allowableMovement of
|
|
3147
|
+
* 10.
|
|
3148
|
+
* @measure M-G21
|
|
3149
|
+
*/
|
|
3150
|
+
readonly holdOpenSlop: {
|
|
3151
|
+
readonly value: 13;
|
|
3152
|
+
readonly unit: "px";
|
|
3153
|
+
};
|
|
3154
|
+
/**
|
|
3155
|
+
* After the menu opens under a still-held finger, the finger travels this
|
|
3156
|
+
* far before it starts picking. The distance is a straight line from the
|
|
3157
|
+
* first sample the menu receives after it opened. Until then nothing is
|
|
3158
|
+
* lit, and lifting acts on nothing.
|
|
3159
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3160
|
+
* iPhone 17 Pro, gesture-state hook, steps 150 ms apart, Oct 23 2026
|
|
3161
|
+
* (M-MN2): with the menu open under a held finger and a 1 pt first step,
|
|
3162
|
+
* moves of (0, 9) and (7, 7) picked nothing; (0, 10), (0, 11), (10, 0),
|
|
3163
|
+
* (9, 9) and (10, 10) picked; a 9 pt step followed by 3 pt more picked
|
|
3164
|
+
* nothing
|
|
3165
|
+
*/
|
|
3166
|
+
readonly handoff: {
|
|
3167
|
+
readonly value: 10;
|
|
3168
|
+
readonly unit: "px";
|
|
3169
|
+
};
|
|
3170
|
+
};
|
|
3171
|
+
readonly velocity: {
|
|
3172
|
+
/**
|
|
3173
|
+
* UIPanGestureRecognizer.velocity(in:) is this times the newest event's
|
|
3174
|
+
* instantaneous velocity plus the rest times the previous event's
|
|
3175
|
+
* (instantaneous velocity: position change over timestamp change between
|
|
3176
|
+
* consecutive events, the touch-down counting as the first). The lift
|
|
3177
|
+
* does not update it, and a finger at rest sends no events, so UIKit
|
|
3178
|
+
* reports the last moving value after a pause; Astryx's release reads 0
|
|
3179
|
+
* once the finger has rested (`spec:AST-100` FR2).
|
|
3180
|
+
* @source measured: UIKit lab, iOS 26.2 simulator, ivar reads confirmed
|
|
3181
|
+
* with HID touches, Oct 23 2026: fitted to all 69 velocity(in:) values of
|
|
3182
|
+
* six HID streams (constant, accelerating, pauses before the lift) to 0.0
|
|
3183
|
+
* pt/s
|
|
3184
|
+
*/
|
|
3185
|
+
readonly currentWeight: {
|
|
3186
|
+
readonly value: 0.2;
|
|
3187
|
+
readonly unit: "ratio";
|
|
3188
|
+
};
|
|
3189
|
+
/**
|
|
3190
|
+
* A scrolling surface's release (paging, a wheel) is this times the
|
|
3191
|
+
* newest pan value plus the rest times the previous one
|
|
3192
|
+
* (architecture:interaction-modality INV10).
|
|
3193
|
+
* @source GUESS — architecture:interaction-modality INV10 states
|
|
3194
|
+
* UIScrollView's release as 0.25 x the newest pan value + 0.75 x the
|
|
3195
|
+
* previous one.
|
|
3196
|
+
* @measure M-G14
|
|
3197
|
+
*/
|
|
3198
|
+
readonly scrollReleaseWeight: {
|
|
3199
|
+
readonly value: 0.25;
|
|
3200
|
+
readonly unit: "ratio";
|
|
3201
|
+
};
|
|
3202
|
+
/**
|
|
3203
|
+
* A contact that has not moved for longer than this before it lifts
|
|
3204
|
+
* releases at 0 (spec:AST-100 FR2). Not a UIKit value: UIKit's filter
|
|
3205
|
+
* never decays, so it flings after a rest.
|
|
3206
|
+
* @source GUESS — Android VelocityTracker and Flutter VelocityTracker
|
|
3207
|
+
* treat a pointer that has not moved for 40 ms as stopped.
|
|
3208
|
+
* @measure M-G16
|
|
3209
|
+
*/
|
|
3210
|
+
readonly stillness: {
|
|
3211
|
+
readonly value: 40;
|
|
3212
|
+
readonly unit: "ms";
|
|
3213
|
+
};
|
|
3214
|
+
};
|
|
3215
|
+
};
|
|
3216
|
+
//#endregion
|
|
3217
|
+
//#region src/motion/uikit/navigation.d.ts
|
|
3218
|
+
/**
|
|
3219
|
+
* @file navigation.ts
|
|
3220
|
+
* @input Nothing; data only
|
|
3221
|
+
* @output Exports `navigation`: UINavigationController's push / pop geometry,
|
|
3222
|
+
* starting velocity, dimming, transition clock and the interactive pop's
|
|
3223
|
+
* finish rule
|
|
3224
|
+
* @position The navigation domain of the UIKit constants table
|
|
3225
|
+
* (motion/uikit); its springs are `springs.navigationPush`,
|
|
3226
|
+
* `springs.navigationPop`, `springs.navigationInteractivePopFinish` and
|
|
3227
|
+
* `springs.navigationBarElements`
|
|
3228
|
+
*
|
|
3229
|
+
* On iOS 26.2 UIKit moves the cards by writing their positions into Core
|
|
3230
|
+
* Animation presentation modifiers every frame from the main thread; the
|
|
3231
|
+
* values below are fitted to those writes. The web version runs the same
|
|
3232
|
+
* curves on the compositor, which keeps them moving while the main thread is
|
|
3233
|
+
* busy.
|
|
3234
|
+
*
|
|
3235
|
+
* Every leaf carries one or more `@source`; webkit and GUESS values also carry
|
|
3236
|
+
* the `@measure` task that will confirm or replace them. uikit.test.ts
|
|
3237
|
+
* enforces both.
|
|
3238
|
+
*/
|
|
3239
|
+
export declare const navigation: {
|
|
3240
|
+
/**
|
|
3241
|
+
* The push and pop springs start moving at this many travels per second
|
|
3242
|
+
* (3527 pt/s on a 402 pt card), not from rest.
|
|
3243
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3244
|
+
* iPhone 17 Pro, CAPresentationModifier (value, velocity) fit, Oct 23 2026
|
|
3245
|
+
*/
|
|
3246
|
+
readonly pushVelocity: 8.773;
|
|
3247
|
+
/**
|
|
3248
|
+
* Where the card underneath ends, as a fraction of the container width:
|
|
3249
|
+
* it moves from 0 to −0.3 W while the incoming card moves from W to 0.
|
|
3250
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3251
|
+
* iPhone 17 Pro, CAPresentationModifier values, Oct 23 2026
|
|
3252
|
+
*/
|
|
3253
|
+
readonly parallax: -0.3;
|
|
3254
|
+
/**
|
|
3255
|
+
* The dimming over the card underneath: black at this alpha, its opacity
|
|
3256
|
+
* going 0 → 1 on the push spring.
|
|
3257
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3258
|
+
* iPhone 17 Pro, _UIParallaxDimmingView read, Oct 23 2026
|
|
3259
|
+
*/
|
|
3260
|
+
readonly dimmingAlpha: 0.1;
|
|
3261
|
+
/**
|
|
3262
|
+
* The transition context's duration, in ms; it paces completion callbacks
|
|
3263
|
+
* (a linear property animator), not the cards.
|
|
3264
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3265
|
+
* iPhone 17 Pro, transitionDuration read, Oct 23 2026
|
|
3266
|
+
*/
|
|
3267
|
+
readonly transitionMs: 350;
|
|
3268
|
+
/**
|
|
3269
|
+
* The interactive pop finishes when progress + this × velocity passes
|
|
3270
|
+
* `interactivePopFinishThreshold` (progress in widths, velocity in widths
|
|
3271
|
+
* per second): seconds of projection.
|
|
3272
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3273
|
+
* iPhone 17 Pro, the pop decision method hooked over 61 controlled
|
|
3274
|
+
* releases: the rule matches 58; the 3 misses all finished where it says
|
|
3275
|
+
* cancel, Oct 23 2026
|
|
3276
|
+
*/
|
|
3277
|
+
readonly interactivePopFinishProjection: 0.35;
|
|
3278
|
+
/**
|
|
3279
|
+
* The progress the projected release must pass to finish the pop (a still
|
|
3280
|
+
* finger at 0.475 cancels).
|
|
3281
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3282
|
+
* iPhone 17 Pro, the pop decision method over 61 releases, Oct 23 2026
|
|
3283
|
+
*/
|
|
3284
|
+
readonly interactivePopFinishThreshold: 0.5;
|
|
3285
|
+
};
|
|
3286
|
+
//#endregion
|
|
3287
|
+
//#region src/motion/uikit/scroll.d.ts
|
|
3288
|
+
export declare const scroll: {
|
|
3289
|
+
readonly decelerationRate: {
|
|
3290
|
+
/**
|
|
3291
|
+
* Normal deceleration: the release velocity is multiplied by this every
|
|
3292
|
+
* millisecond, as a continuous exponential (UIScrollView keeps ln r,
|
|
3293
|
+
* −0.002002, and velocities in pt/ms). The scroll view's own
|
|
3294
|
+
* target for a release (`scrollViewWillEndDragging`) is
|
|
3295
|
+
* v · r ÷ (1 − r), within 1 %: WWDC18 803's projection function.
|
|
3296
|
+
* @source apple-docs https://developer.apple.com/documentation/uikit/uiscrollview/decelerationrate-swift.struct/normal
|
|
3297
|
+
* (the constant, not its number)
|
|
3298
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3299
|
+
* iPhone 17 Pro, rawValue read, Oct 23 2026 (also a new scroll view's
|
|
3300
|
+
* decelerationRate)
|
|
3301
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3302
|
+
* iPhone 17 Pro, deceleration ivars read mid-coast
|
|
3303
|
+
* (`_decelerationFactor` 0.998, `_decelerationLnFactorV` −0.002002, the
|
|
3304
|
+
* velocity decaying 0.4343 over 400 ms) and willEndDragging targets,
|
|
3305
|
+
* Oct 23 2026
|
|
3306
|
+
*/
|
|
3307
|
+
readonly normal: 0.998;
|
|
3308
|
+
/**
|
|
3309
|
+
* Fast deceleration (`UIScrollView.DecelerationRate.fast`).
|
|
3310
|
+
* @source apple-docs https://developer.apple.com/documentation/uikit/uiscrollview/decelerationrate-swift.struct/fast
|
|
3311
|
+
* (the constant, not its number)
|
|
3312
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3313
|
+
* iPhone 17 Pro, rawValue read and `_decelerationFactor` 0.99 (ln
|
|
3314
|
+
* −0.01005) mid-coast, Oct 23 2026
|
|
3315
|
+
*/
|
|
3316
|
+
readonly fast: 0.99;
|
|
3317
|
+
};
|
|
3318
|
+
readonly rubberBand: {
|
|
3319
|
+
/**
|
|
3320
|
+
* c in b = (1 − 1 ÷ (x·c ÷ d + 1))·d, d = the scroll view's size on the
|
|
3321
|
+
* axis, x = the finger's travel past the edge after the
|
|
3322
|
+
* pan's 10 pt hysteresis.
|
|
3323
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3324
|
+
* iPhone 17 Pro, UIScrollView offsets released 100 / 300 / 600 pt past
|
|
3325
|
+
* the edge of an 874 pt view: 47 / 135 / 236.67 against the formula's
|
|
3326
|
+
* 46.85 / 134.9 / 236.6, Oct 23 2026
|
|
3327
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3328
|
+
* iPhone 17 Pro, sheet drags hooked: UISheetPresentationController
|
|
3329
|
+
* passes `withRubberBandCoefficient: 0.55` on every drag, Oct 23 2026
|
|
3330
|
+
*/
|
|
3331
|
+
readonly coefficient: 0.55;
|
|
3332
|
+
};
|
|
3333
|
+
/**
|
|
3334
|
+
* The spring that returns content released past an edge, and that catches
|
|
3335
|
+
* a coast hitting an edge (its velocity handed to the spring).
|
|
3336
|
+
* @source GUESS — critically damped as in I. Lobanov's UIScrollView
|
|
3337
|
+
* reimplementation (no oscillation at the bound); pace from SwiftUI's
|
|
3338
|
+
* `.smooth` default duration. Measured so far (iOS 26.2 simulator, Oct 23
|
|
3339
|
+
* 2026): back to the edge in about 0.5 s with no overshoot, but no single
|
|
3340
|
+
* spring from rest fits releases 47, 135 and 237 pt past the edge, so
|
|
3341
|
+
* UIKit's bounce is not a plain spring; the model is still to fit
|
|
3342
|
+
* @measure M-S3
|
|
3343
|
+
*/
|
|
3344
|
+
readonly bounce: {
|
|
3345
|
+
readonly duration: 0.5;
|
|
3346
|
+
readonly bounce: 0;
|
|
3347
|
+
};
|
|
3348
|
+
/**
|
|
3349
|
+
* `delaysContentTouches`: how long a scroll view holds a touch-down from
|
|
3350
|
+
* its content while it decides whether the touch is a scroll (no highlight
|
|
3351
|
+
* flash on a quick scroll), in ms.
|
|
3352
|
+
* @source wwdc 2014-235 "Advanced Scrollviews and Touch Handling
|
|
3353
|
+
* Techniques": the touch-delay recognizer UIScrollView uses runs "a
|
|
3354
|
+
* pretty short timer … Let's say .15 seconds" (presenter's example value)
|
|
3355
|
+
* @source measured: Settings and Contacts, iOS 26.2, simulator driven with
|
|
3356
|
+
* real HID touches at 60 fps, recorded with the touch press model
|
|
3357
|
+
* (PRESS_ONSET_MS in packages/core/src/utils/pressGesture.ts, 2026-10-06)
|
|
3358
|
+
*/
|
|
3359
|
+
readonly delaysContentTouchesMs: 150;
|
|
3360
|
+
/**
|
|
3361
|
+
* Scroll-to-top after a status-bar tap: not a spring. The offset
|
|
3362
|
+
* approaches the top as 1 − e^(−9.7 t) whatever the distance (done in about
|
|
3363
|
+
* 1.6 s for 500, 2000 or 8000 pt), which is a decay at this per-millisecond
|
|
3364
|
+
* rate (e^(−0.0097)) whose rest point is the top: a decay with a
|
|
3365
|
+
* starting velocity of 9.7 × the distance per second. A tap starts it, not
|
|
3366
|
+
* a throw, so under Reduce Motion it is a transition, not a coast: it
|
|
3367
|
+
* cross-fades to the top within 200 ms on a coarse pointer (DR2) and jumps
|
|
3368
|
+
* there on any other (DR3). Only momentum that continues a throw keeps
|
|
3369
|
+
* decaying under Reduce Motion (`design:reduced-motion` DR2, DEC-2), so a
|
|
3370
|
+
* component checks for Reduce Motion before it plays this decay.
|
|
3371
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3372
|
+
* iPhone 17 Pro, setContentOffset log after status-bar taps (starts 85–95
|
|
3373
|
+
* ms after the tap), Oct 23 2026
|
|
3374
|
+
*/
|
|
3375
|
+
readonly scrollToTopRate: 0.99035;
|
|
3376
|
+
};
|
|
3377
|
+
//#endregion
|
|
3378
|
+
//#region src/motion/uikit/springs.d.ts
|
|
3379
|
+
/**
|
|
3380
|
+
* Push (programmatic or a row tap): the incoming card slides in from the
|
|
3381
|
+
* trailing edge, the outgoing card shifts by `navigation.parallax`. The
|
|
3382
|
+
* spring does not start from rest: it starts at
|
|
3383
|
+
* `navigation.pushVelocity` × the travel per second.
|
|
3384
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3385
|
+
* iPhone 17 Pro, time-free fit of the (value, velocity) pairs UIKit
|
|
3386
|
+
* writes to the cards' CAPresentationModifiers every frame (rms 5e-4 of
|
|
3387
|
+
* the travel), Oct 23 2026
|
|
3388
|
+
*/
|
|
3389
|
+
export declare const NAVIGATION_PUSH_SPRING: {
|
|
3390
|
+
readonly response: 0.3;
|
|
3391
|
+
readonly dampingRatio: 1;
|
|
3392
|
+
};
|
|
3393
|
+
/**
|
|
3394
|
+
* Pop (back button or programmatic): identical to the push.
|
|
3395
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3396
|
+
* iPhone 17 Pro, CAPresentationModifier fit as for the push, Oct 23 2026
|
|
3397
|
+
*/
|
|
3398
|
+
export declare const NAVIGATION_POP_SPRING: {
|
|
3399
|
+
readonly response: 0.3;
|
|
3400
|
+
readonly dampingRatio: 1;
|
|
3401
|
+
};
|
|
3402
|
+
/**
|
|
3403
|
+
* Interactive pop finishing or cancelling after the finger lifts, starting
|
|
3404
|
+
* from the finger's velocity; which one is `navigation.interactivePop*`.
|
|
3405
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3406
|
+
* iPhone 17 Pro, CAPresentationModifier fit over released swipes,
|
|
3407
|
+
* Oct 23 2026
|
|
3408
|
+
*/
|
|
3409
|
+
export declare const NAVIGATION_INTERACTIVE_POP_FINISH_SPRING: {
|
|
3410
|
+
readonly response: 0.3;
|
|
3411
|
+
readonly dampingRatio: 0.85;
|
|
3412
|
+
};
|
|
3413
|
+
/**
|
|
3414
|
+
* Navigation bar elements (Liquid Glass) moving during a push or pop.
|
|
3415
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3416
|
+
* iPhone 17 Pro, UIView.animate(springDuration: 0.6, bounce: 0,
|
|
3417
|
+
* .beginFromCurrentState) calls hooked during transitions, Oct 23 2026
|
|
3418
|
+
*/
|
|
3419
|
+
export declare const NAVIGATION_BAR_ELEMENTS_SPRING: {
|
|
3420
|
+
readonly duration: 0.6;
|
|
3421
|
+
readonly bounce: 0;
|
|
3422
|
+
};
|
|
3423
|
+
//#endregion
|
|
3424
|
+
//#region src/motion/uikit/timing.d.ts
|
|
3425
|
+
export declare const timing: {
|
|
3426
|
+
readonly press: {
|
|
3427
|
+
/**
|
|
3428
|
+
* Highlight onset once a press is believed: none, the highlight is
|
|
3429
|
+
* painted in the frame the touch is accepted (after
|
|
3430
|
+
* `scroll.delaysContentTouchesMs` inside a scroller).
|
|
3431
|
+
* @source measured: Settings and Contacts, iOS 26.2, simulator driven
|
|
3432
|
+
* with real HID touches at 60 fps (touch press model,
|
|
3433
|
+
* packages/core/src/utils/pressGesture.ts, 2026-10-06)
|
|
3434
|
+
*/
|
|
3435
|
+
readonly highlightInMs: 0;
|
|
3436
|
+
/**
|
|
3437
|
+
* A tap released before the onset delay still flashes the highlight at
|
|
3438
|
+
* full strength for this long before fading.
|
|
3439
|
+
* @source measured: Settings and Contacts, iOS 26.2, simulator driven
|
|
3440
|
+
* with real HID touches at 60 fps (PRESS_FLASH_MS,
|
|
3441
|
+
* packages/core/src/utils/pressGesture.ts, 2026-10-06)
|
|
3442
|
+
*/
|
|
3443
|
+
readonly flashMs: 100;
|
|
3444
|
+
/**
|
|
3445
|
+
* Highlight fade after release: UIKit's deselect cross-fade. Reference
|
|
3446
|
+
* only, not played: a press release plays the theme's exit motion tokens
|
|
3447
|
+
* (`--duration-exit`, `--ease-exit`).
|
|
3448
|
+
* @source measured: Settings and Contacts, iOS 26.2, simulator driven
|
|
3449
|
+
* with real HID touches at 60 fps (touch press model,
|
|
3450
|
+
* packages/core/src/utils/pressGesture.ts, 2026-10-06)
|
|
3451
|
+
*/
|
|
3452
|
+
readonly highlightOutMs: 200;
|
|
3453
|
+
/**
|
|
3454
|
+
* The highlight fade's curve after release: an ease-out that spends the
|
|
3455
|
+
* whole clock fading (strength about 0.2 at the midpoint). Reference only,
|
|
3456
|
+
* not played: a press release plays the theme's `--ease-exit`.
|
|
3457
|
+
* @source GUESS — the release curve the touch press model shipped with,
|
|
3458
|
+
* chosen to read as UIKit's deselect cross-fade, not read from UIKit
|
|
3459
|
+
* @measure M-PR1
|
|
3460
|
+
*/
|
|
3461
|
+
readonly highlightOutCurve: readonly [0, 0, 0.2, 1];
|
|
3462
|
+
/**
|
|
3463
|
+
* A touch on a scroller that moved this recently brakes it instead of
|
|
3464
|
+
* pressing.
|
|
3465
|
+
* @source measured: Settings and Contacts, iOS 26.2, simulator driven
|
|
3466
|
+
* with real HID touches at 60 fps (PRESS_SCROLL_BRAKE_MS,
|
|
3467
|
+
* packages/core/src/utils/pressGesture.ts, 2026-10-06)
|
|
3468
|
+
*/
|
|
3469
|
+
readonly scrollBrakeMs: 150;
|
|
3470
|
+
/**
|
|
3471
|
+
* UIButton (filled configuration) release: the label cross-fade and the
|
|
3472
|
+
* background color both run 0.25 s on `curves.move`.
|
|
3473
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3474
|
+
* iPhone 17 Pro, CAAnimation read (CATransition fade and backgroundColor),
|
|
3475
|
+
* Oct 23 2026
|
|
3476
|
+
*/
|
|
3477
|
+
readonly buttonReleaseMs: 250;
|
|
3478
|
+
};
|
|
3479
|
+
readonly curves: {
|
|
3480
|
+
/**
|
|
3481
|
+
* `CAMediaTimingFunctionName.default`: "the timing of … most system
|
|
3482
|
+
* animations" that are not springs.
|
|
3483
|
+
* @source apple-docs https://developer.apple.com/documentation/quartzcore/camediatimingfunctionname/default
|
|
3484
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3485
|
+
* iPhone 17 Pro, CAMediaTimingFunction read from UIView.animate,
|
|
3486
|
+
* Oct 23 2026
|
|
3487
|
+
*/
|
|
3488
|
+
readonly viewChange: readonly [0.25, 0.1, 0.25, 1];
|
|
3489
|
+
readonly move: readonly [0.42, 0, 0.58, 1];
|
|
3490
|
+
/**
|
|
3491
|
+
* `easeIn`.
|
|
3492
|
+
* @source apple-docs https://developer.apple.com/documentation/quartzcore/camediatimingfunctionname/easein
|
|
3493
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3494
|
+
* iPhone 17 Pro, CAMediaTimingFunction read from UIView.animate,
|
|
3495
|
+
* Oct 23 2026
|
|
3496
|
+
*/
|
|
3497
|
+
readonly exit: readonly [0.42, 0, 1, 1];
|
|
3498
|
+
/**
|
|
3499
|
+
* `easeOut`.
|
|
3500
|
+
* @source apple-docs https://developer.apple.com/documentation/quartzcore/camediatimingfunctionname/easeout
|
|
3501
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3502
|
+
* iPhone 17 Pro, CAMediaTimingFunction read from UIView.animate,
|
|
3503
|
+
* Oct 23 2026
|
|
3504
|
+
*/
|
|
3505
|
+
readonly entrance: readonly [0, 0, 0.58, 1];
|
|
3506
|
+
};
|
|
3507
|
+
/**
|
|
3508
|
+
* `UINavigationController.hideShowBarDuration`, in ms.
|
|
3509
|
+
* @source apple-docs https://developer.apple.com/documentation/uikit/uinavigationcontroller/hideshowbarduration
|
|
3510
|
+
* (the constant, not its value)
|
|
3511
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3512
|
+
* iPhone 17 Pro, read, Oct 23 2026
|
|
3513
|
+
*/
|
|
3514
|
+
readonly navigationBarHideShowMs: 200;
|
|
3515
|
+
/**
|
|
3516
|
+
* The duration the keyboard notifications report
|
|
3517
|
+
* (UIKeyboardAnimationDurationUserInfoKey, with curve 7), show and hide
|
|
3518
|
+
* alike, in ms. The frame follows `springs.keyboard`, cut at this time.
|
|
3519
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3520
|
+
* iPhone 17 Pro, UIKeyboardWillShow / WillHide / WillChangeFrame read,
|
|
3521
|
+
* Oct 23 2026
|
|
3522
|
+
*/
|
|
3523
|
+
readonly keyboardNotificationMs: 383.3;
|
|
3524
|
+
/**
|
|
3525
|
+
* Core Animation's implicit animation duration
|
|
3526
|
+
* (`CATransaction.animationDuration()`), in ms.
|
|
3527
|
+
* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
|
|
3528
|
+
* iPhone 17 Pro, read, Oct 23 2026
|
|
3529
|
+
*/
|
|
3530
|
+
readonly stateChangeMs: 250;
|
|
3531
|
+
readonly reducedMotionCrossFadeMs: 200;
|
|
3532
|
+
};
|
|
3533
|
+
//#endregion
|
|
3534
|
+
//#region src/utils/coarsePointer.d.ts
|
|
3535
|
+
/**
|
|
3536
|
+
* @file coarsePointer.ts
|
|
3537
|
+
* @input A window
|
|
3538
|
+
* @output Exports isCoarsePointer, matchesMediaQuery, watchCoarsePointer and
|
|
3539
|
+
* watchMediaQuery: whether the primary pointer is coarse (TOUCH_QUERY) or
|
|
3540
|
+
* any media query matches, and when either changes
|
|
3541
|
+
* @position The coarse-pointer gate of packages/core/src/gestures and of
|
|
3542
|
+
* the press controller (pressFeedback.ts): touch-only work registers only
|
|
3543
|
+
* while it holds. useMediaQuery and the presentation resolvers read and
|
|
3544
|
+
* watch through matchesMediaQuery and watchMediaQuery
|
|
3545
|
+
*
|
|
3546
|
+
* Under a coarse primary pointer, a phone's touch work stays registered: the
|
|
3547
|
+
* gesture host's page listeners, the page hold and the finger scroll. Under a
|
|
3548
|
+
* fine one, recognizers still attach, and the host listens on the page only
|
|
3549
|
+
* during a press (AST-094). The answer can change while the page is open (a
|
|
3550
|
+
* tablet docking a mouse), so a holder watches it.
|
|
3551
|
+
*
|
|
3552
|
+
* SYNC: When modified, update coarsePointer.test.ts.
|
|
3553
|
+
*/
|
|
3554
|
+
/** Whether the primary pointer of `view` is coarse now. */
|
|
3555
|
+
export declare function isCoarsePointer(view: Window | null | undefined): boolean;
|
|
3556
|
+
//#endregion
|
|
3557
|
+
//#region src/utils/isRtlElement.d.ts
|
|
3558
|
+
/**
|
|
3559
|
+
* @file isRtlElement.ts
|
|
3560
|
+
* @input DOM element (nullable)
|
|
3561
|
+
* @output Exports isRtlElement helper resolving an element's computed text
|
|
3562
|
+
* direction
|
|
3563
|
+
* @position Internal hook utility; used by useListFocus and useGridFocus to
|
|
3564
|
+
* auto-detect RTL for arrow-key navigation (same getComputedStyle precedent
|
|
3565
|
+
* as Resizable's ResizeHandle drag deltas).
|
|
3566
|
+
*/
|
|
3567
|
+
/**
|
|
3568
|
+
* Whether `el` renders right-to-left, per its computed `direction`.
|
|
3569
|
+
*
|
|
3570
|
+
* SSR-safe: returns false when `el` is null or no DOM is available. Callers
|
|
3571
|
+
* should invoke this lazily (on keydown, not on render) so getComputedStyle
|
|
3572
|
+
* runs only when a horizontal arrow key is actually handled.
|
|
3573
|
+
*/
|
|
3574
|
+
export declare function isRtlElement(el: HTMLElement | null): boolean;
|
|
3575
|
+
//#endregion
|
|
3576
|
+
//#region src/utils/touchQueries.d.ts
|
|
3577
|
+
/**
|
|
3578
|
+
* @file touchQueries.ts
|
|
3579
|
+
* @input Nothing: plain strings
|
|
3580
|
+
* @output TOUCH_QUERY, the media query for a coarse primary pointer; and
|
|
3581
|
+
* IOS_SUPPORTS_QUERY with isIosWebKit, the iOS WebKit engine check
|
|
3582
|
+
* @position The dependency-free half of touchPresentation.ts, for code that
|
|
3583
|
+
* must load without React or the theme: the motion foundation, which
|
|
3584
|
+
* Node-side specs and browser proofs load without a StyleX compile.
|
|
3585
|
+
* touchPresentation.ts re-exports it beside the hook and the parts that
|
|
3586
|
+
* read the theme.
|
|
3587
|
+
*/
|
|
3588
|
+
/** The primary pointer is coarse: touch behaviours. */
|
|
3589
|
+
export declare const TOUCH_QUERY = "(pointer: coarse)";
|
|
3590
|
+
//#endregion
|
|
3591
|
+
export { type AnimateOptions, type GestureEventContext, type GestureTouch, type LogicalAxisMapping, type MotionCurve, type Animator as MotionEngine, type AnimatorOptions as MotionEngineOptions, type MotionHandle, type PanGestureRecognizerOptions, type PointerKind, type SpringDescription, type SpringTransition, type UseFingerScrollOptions, measureLogicalScrollAxis, observeResize, useFingerScroll };
|