react-native-gtkx 0.2.0-alpha.2 → 0.3.0-alpha.1
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/README.md +5 -2
- package/dist/aliases/index.d.ts +84 -0
- package/dist/aliases/index.js +208 -0
- package/dist/aliases/index.js.map +1 -0
- package/dist/animated/index.d.ts +2 -0
- package/dist/animated/index.js +5 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/types.d.ts +1 -0
- package/dist/animated/types.js.map +1 -1
- package/dist/animated/value-animation.js +17 -4
- package/dist/animated/value-animation.js.map +1 -1
- package/dist/apis/host.gtkx.js +9 -12
- package/dist/apis/host.gtkx.js.map +1 -1
- package/dist/apis/index.d.ts +4 -2
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/keyboard.d.ts +60 -0
- package/dist/apis/keyboard.js +63 -0
- package/dist/apis/keyboard.js.map +1 -0
- package/dist/apis/log-box.d.ts +15 -0
- package/dist/apis/log-box.js +46 -0
- package/dist/apis/log-box.js.map +1 -0
- package/dist/apis/platform.d.ts +18 -1
- package/dist/apis/platform.js.map +1 -1
- package/dist/common/index.d.ts +0 -1
- package/dist/common/index.js +24 -1
- package/dist/common/index.js.map +1 -1
- package/dist/components/animated.d.ts +70 -6
- package/dist/components/animated.js +559 -46
- package/dist/components/animated.js.map +1 -1
- package/dist/components/driven-size.d.ts +27 -0
- package/dist/components/driven-size.js +85 -0
- package/dist/components/driven-size.js.map +1 -0
- package/dist/components/find-node-handle.d.ts +11 -0
- package/dist/components/find-node-handle.js +53 -0
- package/dist/components/find-node-handle.js.map +1 -0
- package/dist/components/flat-list.d.ts +3 -2
- package/dist/components/flat-list.js.map +1 -1
- package/dist/components/frame-scheduler.d.ts +16 -0
- package/dist/components/frame-scheduler.js +37 -0
- package/dist/components/frame-scheduler.js.map +1 -0
- package/dist/components/image.d.ts +6 -1
- package/dist/components/image.js +15 -4
- package/dist/components/image.js.map +1 -1
- package/dist/components/index.d.ts +7 -5
- package/dist/components/index.js +5 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +51 -1
- package/dist/components/measure.js +101 -2
- package/dist/components/measure.js.map +1 -1
- package/dist/components/pressable.d.ts +61 -1
- package/dist/components/pressable.js +151 -4
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +58 -0
- package/dist/components/rect-store.js +124 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/root.js +6 -1
- package/dist/components/root.js.map +1 -1
- package/dist/components/scroll-phase.d.ts +35 -0
- package/dist/components/scroll-phase.js +26 -0
- package/dist/components/scroll-phase.js.map +1 -0
- package/dist/components/scroll-view.d.ts +39 -3
- package/dist/components/scroll-view.js +378 -43
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/text-input.js +9 -25
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.d.ts +6 -2
- package/dist/components/text.js +43 -8
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-focus.d.ts +27 -0
- package/dist/components/use-focus.js +116 -0
- package/dist/components/use-focus.js.map +1 -0
- package/dist/components/use-layout-child.d.ts +13 -1
- package/dist/components/use-layout-child.js +188 -5
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +5 -2
- package/dist/components/view.js +18 -13
- package/dist/components/view.js.map +1 -1
- package/dist/components/virtualized-list.d.ts +45 -5
- package/dist/components/virtualized-list.js +90 -24
- package/dist/components/virtualized-list.js.map +1 -1
- package/dist/components/wheel-scroll-session.d.ts +7 -0
- package/dist/components/wheel-scroll-session.js +53 -0
- package/dist/components/wheel-scroll-session.js.map +1 -0
- package/dist/components/widget-retention.d.ts +35 -0
- package/dist/components/widget-retention.js +169 -0
- package/dist/components/widget-retention.js.map +1 -0
- package/dist/contracts.d.ts +4 -0
- package/dist/contracts.js.map +1 -1
- package/dist/dnd/context.d.ts +69 -0
- package/dist/dnd/context.js +149 -0
- package/dist/dnd/context.js.map +1 -0
- package/dist/dnd/draggable.d.ts +59 -0
- package/dist/dnd/draggable.js +149 -0
- package/dist/dnd/draggable.js.map +1 -0
- package/dist/dnd/droppable.d.ts +24 -0
- package/dist/dnd/droppable.js +74 -0
- package/dist/dnd/droppable.js.map +1 -0
- package/dist/dnd/gtk-controllers.d.ts +39 -0
- package/dist/dnd/gtk-controllers.js +110 -0
- package/dist/dnd/gtk-controllers.js.map +1 -0
- package/dist/dnd/index.d.ts +6 -0
- package/dist/dnd/index.js +31 -0
- package/dist/dnd/index.js.map +1 -0
- package/dist/dnd/order.d.ts +7 -0
- package/dist/dnd/order.js +20 -0
- package/dist/dnd/order.js.map +1 -0
- package/dist/dnd/payload.d.ts +14 -0
- package/dist/dnd/payload.js +41 -0
- package/dist/dnd/payload.js.map +1 -0
- package/dist/dnd/sortable.d.ts +49 -0
- package/dist/dnd/sortable.js +307 -0
- package/dist/dnd/sortable.js.map +1 -0
- package/dist/dnd/types.d.ts +290 -0
- package/dist/dnd/types.js +25 -0
- package/dist/dnd/types.js.map +1 -0
- package/dist/gesture-handler-compat/builder.d.ts +251 -0
- package/dist/gesture-handler-compat/builder.js +513 -0
- package/dist/gesture-handler-compat/builder.js.map +1 -0
- package/dist/gesture-handler-compat/composition.d.ts +23 -0
- package/dist/gesture-handler-compat/composition.js +111 -0
- package/dist/gesture-handler-compat/composition.js.map +1 -0
- package/dist/gesture-handler-compat/deciders.d.ts +3 -0
- package/dist/gesture-handler-compat/deciders.js +47 -0
- package/dist/gesture-handler-compat/deciders.js.map +1 -0
- package/dist/gesture-handler-compat/detector-runtime.d.ts +44 -0
- package/dist/gesture-handler-compat/detector-runtime.js +374 -0
- package/dist/gesture-handler-compat/detector-runtime.js.map +1 -0
- package/dist/gesture-handler-compat/detector.d.ts +22 -0
- package/dist/gesture-handler-compat/detector.js +104 -0
- package/dist/gesture-handler-compat/detector.js.map +1 -0
- package/dist/gesture-handler-compat/fling.d.ts +24 -0
- package/dist/gesture-handler-compat/fling.js +123 -0
- package/dist/gesture-handler-compat/fling.js.map +1 -0
- package/dist/gesture-handler-compat/force-touch.d.ts +13 -0
- package/dist/gesture-handler-compat/force-touch.js +40 -0
- package/dist/gesture-handler-compat/force-touch.js.map +1 -0
- package/dist/gesture-handler-compat/hooks.d.ts +157 -0
- package/dist/gesture-handler-compat/hooks.js +268 -0
- package/dist/gesture-handler-compat/hooks.js.map +1 -0
- package/dist/gesture-handler-compat/hover.d.ts +2 -0
- package/dist/gesture-handler-compat/hover.js +22 -0
- package/dist/gesture-handler-compat/hover.js.map +1 -0
- package/dist/gesture-handler-compat/index.d.ts +98 -0
- package/dist/gesture-handler-compat/index.js +255 -0
- package/dist/gesture-handler-compat/index.js.map +1 -0
- package/dist/gesture-handler-compat/long-press.d.ts +6 -0
- package/dist/gesture-handler-compat/long-press.js +21 -0
- package/dist/gesture-handler-compat/long-press.js.map +1 -0
- package/dist/gesture-handler-compat/manual.d.ts +2 -0
- package/dist/gesture-handler-compat/manual.js +18 -0
- package/dist/gesture-handler-compat/manual.js.map +1 -0
- package/dist/gesture-handler-compat/native.d.ts +7 -0
- package/dist/gesture-handler-compat/native.js +34 -0
- package/dist/gesture-handler-compat/native.js.map +1 -0
- package/dist/gesture-handler-compat/orchestrator.d.ts +77 -0
- package/dist/gesture-handler-compat/orchestrator.js +284 -0
- package/dist/gesture-handler-compat/orchestrator.js.map +1 -0
- package/dist/gesture-handler-compat/pan.d.ts +23 -0
- package/dist/gesture-handler-compat/pan.js +116 -0
- package/dist/gesture-handler-compat/pan.js.map +1 -0
- package/dist/gesture-handler-compat/recognizer.d.ts +268 -0
- package/dist/gesture-handler-compat/recognizer.js +1056 -0
- package/dist/gesture-handler-compat/recognizer.js.map +1 -0
- package/dist/gesture-handler-compat/relations.d.ts +43 -0
- package/dist/gesture-handler-compat/relations.js +128 -0
- package/dist/gesture-handler-compat/relations.js.map +1 -0
- package/dist/gesture-handler-compat/tap.d.ts +6 -0
- package/dist/gesture-handler-compat/tap.js +29 -0
- package/dist/gesture-handler-compat/tap.js.map +1 -0
- package/dist/gesture-handler-compat/touchpad.d.ts +41 -0
- package/dist/gesture-handler-compat/touchpad.js +64 -0
- package/dist/gesture-handler-compat/touchpad.js.map +1 -0
- package/dist/gesture-handler-compat/types.d.ts +441 -0
- package/dist/gesture-handler-compat/types.js +167 -0
- package/dist/gesture-handler-compat/types.js.map +1 -0
- package/dist/gtk/controllers.d.ts +39 -0
- package/dist/gtk/controllers.js +92 -0
- package/dist/gtk/controllers.js.map +1 -0
- package/dist/gtk/index.d.ts +2 -1
- package/dist/gtk/index.js +7 -1
- package/dist/gtk/index.js.map +1 -1
- package/dist/gtkx/bridge/geometry.js +6 -4
- package/dist/gtkx/bridge/geometry.js.map +1 -1
- package/dist/gtkx/bridge/index.d.ts +5 -3
- package/dist/gtkx/bridge/index.js +6 -3
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.js.map +1 -1
- package/dist/gtkx/bridge/use-signal.js +1 -1
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/view-box.d.ts +56 -0
- package/dist/gtkx/bridge/view-box.js +394 -9
- package/dist/gtkx/bridge/view-box.js.map +1 -1
- package/dist/gtkx/bridge/widget-css.d.ts +17 -0
- package/dist/gtkx/bridge/widget-css.js +72 -0
- package/dist/gtkx/bridge/widget-css.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/driven-size.d.ts +12 -0
- package/dist/layout/driven-size.js +70 -0
- package/dist/layout/driven-size.js.map +1 -0
- package/dist/layout/engine.d.ts +17 -1
- package/dist/layout/engine.js +3 -20
- package/dist/layout/engine.js.map +1 -1
- package/dist/layout/node.d.ts +13 -0
- package/dist/layout/node.js +14 -0
- package/dist/layout/node.js.map +1 -1
- package/dist/layout/yoga.d.ts +3 -2
- package/dist/layout/yoga.js +5 -2
- package/dist/layout/yoga.js.map +1 -1
- package/dist/mcp/data/generated.d.ts +257 -60
- package/dist/mcp/data/generated.js +306 -62
- package/dist/mcp/data/generated.js.map +1 -1
- package/dist/metro/index.d.ts +10 -0
- package/dist/metro/index.js +21 -12
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +16 -0
- package/dist/navigation/sidebar.js +65 -1
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/reanimated-compat/animated-ref.d.ts +32 -0
- package/dist/reanimated-compat/animated-ref.js +57 -0
- package/dist/reanimated-compat/animated-ref.js.map +1 -0
- package/dist/reanimated-compat/animation.d.ts +177 -0
- package/dist/reanimated-compat/animation.js +540 -0
- package/dist/reanimated-compat/animation.js.map +1 -0
- package/dist/reanimated-compat/color.d.ts +28 -0
- package/dist/reanimated-compat/color.js +249 -0
- package/dist/reanimated-compat/color.js.map +1 -0
- package/dist/reanimated-compat/decay.d.ts +39 -0
- package/dist/reanimated-compat/decay.js +96 -0
- package/dist/reanimated-compat/decay.js.map +1 -0
- package/dist/reanimated-compat/easing.d.ts +30 -0
- package/dist/reanimated-compat/easing.js +76 -0
- package/dist/reanimated-compat/easing.js.map +1 -0
- package/dist/reanimated-compat/hooks.d.ts +14 -0
- package/dist/reanimated-compat/hooks.js +217 -0
- package/dist/reanimated-compat/hooks.js.map +1 -0
- package/dist/reanimated-compat/index.d.ts +258 -0
- package/dist/reanimated-compat/index.js +464 -0
- package/dist/reanimated-compat/index.js.map +1 -0
- package/dist/reanimated-compat/interpolation.d.ts +18 -0
- package/dist/reanimated-compat/interpolation.js +122 -0
- package/dist/reanimated-compat/interpolation.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-config.d.ts +43 -0
- package/dist/reanimated-compat/layout-animation-config.js +78 -0
- package/dist/reanimated-compat/layout-animation-config.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-presets.d.ts +117 -0
- package/dist/reanimated-compat/layout-animation-presets.js +498 -0
- package/dist/reanimated-compat/layout-animation-presets.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-runtime.d.ts +21 -0
- package/dist/reanimated-compat/layout-animation-runtime.js +311 -0
- package/dist/reanimated-compat/layout-animation-runtime.js.map +1 -0
- package/dist/reanimated-compat/layout-animation-view.d.ts +27 -0
- package/dist/reanimated-compat/layout-animation-view.js +266 -0
- package/dist/reanimated-compat/layout-animation-view.js.map +1 -0
- package/dist/reanimated-compat/layout-animation.d.ts +171 -0
- package/dist/reanimated-compat/layout-animation.js +469 -0
- package/dist/reanimated-compat/layout-animation.js.map +1 -0
- package/dist/reanimated-compat/layout-transitions.d.ts +83 -0
- package/dist/reanimated-compat/layout-transitions.js +350 -0
- package/dist/reanimated-compat/layout-transitions.js.map +1 -0
- package/dist/reanimated-compat/mutable.d.ts +29 -0
- package/dist/reanimated-compat/mutable.js +139 -0
- package/dist/reanimated-compat/mutable.js.map +1 -0
- package/dist/reanimated-compat/props.d.ts +18 -0
- package/dist/reanimated-compat/props.js +111 -0
- package/dist/reanimated-compat/props.js.map +1 -0
- package/dist/reanimated-compat/scroll-handler.d.ts +119 -0
- package/dist/reanimated-compat/scroll-handler.js +274 -0
- package/dist/reanimated-compat/scroll-handler.js.map +1 -0
- package/dist/reanimated-compat/scroll-offset.d.ts +12 -0
- package/dist/reanimated-compat/scroll-offset.js +104 -0
- package/dist/reanimated-compat/scroll-offset.js.map +1 -0
- package/dist/reanimated-compat/style.d.ts +90 -0
- package/dist/reanimated-compat/style.js +452 -0
- package/dist/reanimated-compat/style.js.map +1 -0
- package/dist/reanimated-compat/test-timers.d.ts +28 -0
- package/dist/reanimated-compat/test-timers.js +136 -0
- package/dist/reanimated-compat/test-timers.js.map +1 -0
- package/dist/reanimated-compat/threads.d.ts +13 -0
- package/dist/reanimated-compat/threads.js +41 -0
- package/dist/reanimated-compat/threads.js.map +1 -0
- package/dist/reanimated-compat/tracking.d.ts +41 -0
- package/dist/reanimated-compat/tracking.js +106 -0
- package/dist/reanimated-compat/tracking.js.map +1 -0
- package/dist/reanimated-compat/updater-animations.d.ts +36 -0
- package/dist/reanimated-compat/updater-animations.js +273 -0
- package/dist/reanimated-compat/updater-animations.js.map +1 -0
- package/dist/responder/system.d.ts +80 -7
- package/dist/responder/system.js +143 -23
- package/dist/responder/system.js.map +1 -1
- package/dist/responder/use-responder.d.ts +11 -0
- package/dist/responder/use-responder.js +225 -6
- package/dist/responder/use-responder.js.map +1 -1
- package/dist/runner/host-dev.js +1 -1
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +1 -1
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.js +3 -3
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/gtkx-config-module.js +1 -1
- package/dist/sea/gtkx-config-module.js.map +1 -1
- package/dist/style/absolute-insets.d.ts +26 -0
- package/dist/style/absolute-insets.js +113 -0
- package/dist/style/absolute-insets.js.map +1 -0
- package/dist/style/animated-size.d.ts +25 -0
- package/dist/style/animated-size.js +225 -0
- package/dist/style/animated-size.js.map +1 -0
- package/dist/style/colors.d.ts +17 -0
- package/dist/style/colors.js +25 -6
- package/dist/style/colors.js.map +1 -1
- package/dist/style/imperative-css.d.ts +21 -0
- package/dist/style/imperative-css.js +63 -0
- package/dist/style/imperative-css.js.map +1 -0
- package/dist/style/index.d.ts +2 -1
- package/dist/style/index.js +2 -1
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.js +5 -0
- package/dist/style/split-style.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unsupported-export.d.ts +8 -0
- package/dist/unsupported-export.js +66 -0
- package/dist/unsupported-export.js.map +1 -0
- package/dist/vite/index.d.ts +21 -8
- package/dist/vite/index.js +127 -82
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/dist/worklets-compat/index.d.ts +4 -0
- package/dist/worklets-compat/index.js +28 -0
- package/dist/worklets-compat/index.js.map +1 -0
- package/dist/worklets-compat/surface.d.ts +110 -0
- package/dist/worklets-compat/surface.js +153 -0
- package/dist/worklets-compat/surface.js.map +1 -0
- package/package.json +25 -9
- package/types.d.ts +9 -0
- package/dist/common/list.d.ts +0 -82
- package/dist/common/list.js +0 -166
- package/dist/common/list.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recognizer.js","sourceRoot":"","sources":["../../src/gesture-handler-compat/recognizer.ts"],"names":[],"mappings":"AAkCA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,GASjB,MAAM,SAAS,CAAA;AAkRhB,MAAM,UAAU,GAAG,GAAY,EAAE,CAAC,CAAC;IACjC,KAAK,EAAE,aAAa,CAAC,YAAY;IACjC,QAAQ,EAAE,aAAa,CAAC,YAAY;IACpC,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,gBAAgB,EAAE,KAAK;IACvB,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,IAAI;IACrB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC;IAClB,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE,KAAK;IACpB,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,aAAa,EAAE,CAAC;IAChB,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,CAAC;IAClB,kBAAkB,EAAE,CAAC;IACrB,KAAK,EAAE,CAAC;IACR,eAAe,EAAE,CAAC;IAClB,cAAc,EAAE,CAAC;CAClB,CAAC,CAAA;AAEF;;;;;;;;;;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,EAAE;YACZ,oBAAoB,EAAE,CAAA;YACtB,eAAe,EAAE,CAAA;YACjB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QACtC,CAAC;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// The recognizer: a state machine over RN's touch and responder props, which\n// is what a `GestureDetector` actually is once both spellings of the builder\n// are stripped away.\n//\n// THE SEAM THAT MAKES IT WORK, and it reads like a footnote: **View touch\n// props fire independently of responder status**. So the machine runs off\n// `onTouchStart`/`onTouchMove`, keeps its own\n// UNDETERMINED -> BEGAN -> ACTIVE/FAILED progression, holds no lock while it\n// is deciding, and returns `true` from `onMoveShouldSetResponder` at exactly\n// the instant it activates. `onStartShouldSetResponder` returns false always\n// — a pan that grabbed the interaction on press is a pan with no\n// `activeOffset` at all, and deciding late is what every offset knob is for.\n//\n// `responder/system.ts` dispatches the touch props BEFORE it negotiates, in\n// both `touchStart` and `touchMove`, so the machine's state is always current\n// by the time the negotiation asks it anything. That ordering is load-bearing\n// and predates this module.\n//\n// TWO LOCKS, AT TWO LEVELS, and this file is where they meet. The responder\n// lock keeps its one job — one interaction, one holder, one irrevocable GTK\n// `CLAIMED` on the source. Gesture arbitration is a second, JS-only registry\n// (./orchestrator) that never talks to GTK, and `decide()` below is the one\n// place a recognizer asks it for a turn. A gesture that is first to activate\n// takes the responder as it always did; a gesture activating alongside one\n// that already holds it does not ask, becomes ACTIVE in the registry, and is\n// driven from the touch props.\n//\n// There are therefore two reasons a gesture can be ACTIVE without the lock —\n// a kind that never takes it (`Native`, `claimsResponder: false`) and one that\n// simply lost the race to a simultaneous partner — and exactly one test for\n// both: `runtime.hasResponder`. A static per-kind flag cannot answer it,\n// because whether a `Pan` holds the lock is a fact about this interaction.\nimport type { GestureResponderEvent } from \"../responder/types\"\nimport type { Orchestrator, Participant } from \"./orchestrator\"\nimport {\n GESTURE_STATE,\n POINTER_TYPE,\n TOUCH_EVENT_TYPE,\n type GestureEventPayload,\n type GestureHitSlop,\n type GestureKind,\n type GestureStateManagerApi,\n type GestureStateValue,\n type GestureTouchEvent,\n type RecognizerConfig,\n type TouchEventTypeValue,\n} from \"./types\"\n\nexport type Rect = { x: number; y: number; width: number; height: number }\n\n/**\n * What the recognizer needs from the world it is mounted in: where its view\n * is, and how to take the interaction when no touch event is in flight.\n */\nexport type RecognizerEnvironment = {\n /**\n * The gesture's own view in WINDOW coordinates, or null before it is laid\n * out. Window coordinates because that is the space RN's `pageX`/`pageY`\n * are in, so no conversion sits between a touch and a bounds test.\n */\n boundsInWindow: () => Rect | null\n /**\n * Ask for the responder outside a touch event. Returns whether it was\n * granted. See `ResponderSystem.requestResponder`.\n */\n requestResponder: () => boolean\n /**\n * The JS-only arbitration registry this gesture takes part in. Injected\n * rather than imported so a test can drive one loop in isolation, exactly\n * as the responder system is injected rather than imported.\n */\n orchestrator: Orchestrator\n}\n\n/** The read-only view of the runtime the predicates are allowed to see. */\nexport type RecognizerView = {\n /** Measured from the point of ACTIVATION once there is one; see `Runtime`. */\n translationX: number\n translationY: number\n /**\n * Straight-line travel from the PRESS, which outlives activation.\n *\n * `LongPress` needs this and translation will not do: it activates on a\n * timer, translation is re-based to the activation point, and upstream's\n * `maxDist` is measured from the press for the whole gesture — so a hold\n * that drifted 8px before the timer and 8px after it has travelled 16, not\n * twice-nearly-nothing.\n */\n distanceFromPress: number\n velocityX: number\n velocityY: number\n /** Whether this press's own timer has already fired. */\n timerElapsed: boolean\n /** Pointers down now, and the most this interaction has ever had at once. */\n pointerCount: number\n maxPointerCount: number\n /** Completed press-release cycles, including the one being decided. */\n taps: number\n /**\n * `Pinch`: the scale since GTK recognized the gesture, 1 at the start.\n * `Rotation`: radians since it did, 0 at the start and positive clockwise.\n *\n * Both are 1 and 0 for every pointer-driven kind, so a predicate that reads\n * them on the wrong kind gets the identity rather than a lie.\n */\n scale: number\n rotation: number\n /**\n * `ForceTouch`: the pressure, normalised to `[0, 1]`.\n *\n * 0 for every other kind — an input with no pressure axis reports no\n * pressure, and a predicate reading this on the wrong kind gets the number\n * that is true rather than one that looks plausible.\n */\n force: number\n}\n\n/**\n * The timer a recognizer arms on every press, and what its firing means.\n *\n * All three kinds want one and they disagree only about the outcome: `Pan`'s\n * `activateAfterLongPress` and `LongPress`'s `minDuration` mature the gesture,\n * `Tap`'s `maxDuration` is a deadline that kills it.\n */\nexport type RecognizerTimer = {\n delay: number\n elapsed: \"activate\" | \"fail\"\n}\n\n/** What lifting the pointer means to a gesture that is still BEGAN. */\nexport type ReleaseOutcome =\n | { kind: \"activate\" }\n | { kind: \"fail\" }\n /** Not over — wait this long for another press, then fail. */\n | { kind: \"await\"; delay: number }\n /**\n * Nothing at all: stay BEGAN, with no timer and no decision.\n *\n * `Manual` alone, and it is upstream's documented rule for it — \"it will not\n * fail when all the pointers are lifted from the screen\". A gesture the app\n * drives has no business being failed by a lift the app did not ask about.\n */\n | { kind: \"hold\" }\n\n/**\n * What a recognizer kind contributes: predicates over the current state of\n * one press. Everything else — the state progression, the callbacks, the\n * responder plumbing, the bounds tests, the timer — is shared, which is what\n * makes `Tap` and `LongPress` an afternoon rather than a second machine.\n *\n * Only `shouldFail` and `shouldActivate` are required, and `Pan` implements\n * exactly those two: the rest exist because `Tap` activates on a RELEASE and\n * `LongPress` can be cancelled after it is already ACTIVE, and neither shape\n * was reachable from a pair of movement predicates.\n */\nexport type RecognizerDecider = {\n /**\n * Which kind this is.\n *\n * Carried by the decider because the decider IS what tells the kinds apart,\n * and because the arbitration loop needs exactly one fact about a gesture\n * beyond its relations: whether it is `Gesture.Native()`, the one kind that\n * can cancel an already-active gesture.\n */\n kind: GestureKind\n shouldFail: (view: RecognizerView, config: RecognizerConfig) => boolean\n shouldActivate: (view: RecognizerView, config: RecognizerConfig) => boolean\n /** Absent means \"no timer\", which is `Pan` without `activateAfterLongPress`. */\n timer?: (config: RecognizerConfig) => RecognizerTimer | null\n /** Absent means an ACTIVE gesture is only ever ended by the pointer. */\n shouldCancelWhileActive?: (\n view: RecognizerView,\n config: RecognizerConfig,\n ) => boolean\n /** Absent means a lift while BEGAN is the end of it, which is `Pan`'s rule. */\n onRelease?: (view: RecognizerView, config: RecognizerConfig) => ReleaseOutcome\n /**\n * Whether activating means taking the responder. Absent means yes, which is\n * every recognizer that decides the interaction is React Native's.\n *\n * `Native` is the one that says no, and it is not an optimisation: taking\n * the responder is what makes the platform declare `CLAIMED` and suspend\n * every enclosing `GtkScrolledWindow`'s kinetics\n * (`responder/use-responder.ts`). A gesture whose entire meaning is \"the\n * native widget is handling this\" cannot be the thing that stops the native\n * widget from handling it.\n *\n * A recognizer that does not claim runs off the touch props alone — they\n * fire regardless of responder status, which is the same seam the BEGAN\n * phase already uses. It never receives `onResponderMove`, so its updates\n * come from `onTouchMove` and its ending from `onTouchEnd`/`onTouchCancel`.\n */\n claimsResponder?: boolean\n /**\n * Activating IS the whole gesture: end it, successfully, in the same breath.\n *\n * `Fling` alone, and it is upstream's own shape rather than a shortcut —\n * `FlingGestureHandler.activate()` is overridden to call `this.end()`\n * immediately after `super.activate()`. A fling is a verdict about a motion\n * that has already happened, so there is nothing left to report once it is\n * reached: BEGAN -> ACTIVE -> END, synchronously, with `onStart` and `onEnd`\n * one after the other and no `onUpdate` between them.\n */\n endsOnActivate?: boolean\n /**\n * Which entry surface drives this kind. Absent means `\"pointer\"`.\n *\n * The one structural concession this module makes, and it is about where\n * events COME FROM rather than about what happens to them. Three kinds of\n * input are simply not in the pointer stream:\n *\n * - `\"touchpad\"` — `Pinch`/`Rotation`, fed by\n * `GtkGestureZoom`/`GtkGestureRotate`, because a touchpad pinch presses\n * no button and so opens no GTK sequence and no responder session;\n * - `\"hover\"` — `Hover`, fed by `GtkEventControllerMotion`, because a\n * pointer that is merely OVER a view has pressed nothing either, and\n * RN's touch props fire only from a press;\n * - `\"stylus\"` — `ForceTouch`, fed by `GtkGestureStylus`, because pressure\n * is a tablet axis and `wl_pointer` has none.\n *\n * Everything downstream of the entry point is this same machine: the same\n * states, the same callbacks, the same payload, the same `tryActivate` and\n * the same relation maps. There is no second arbitration path.\n *\n * Exactly one surface is live per recognizer. A non-pointer kind's\n * touch/responder props are empty, so a mouse press cannot begin a pinch or\n * a hover; a `\"pointer\"` kind's controller channel is inert, so a pinch\n * cannot begin a pan.\n */\n source?: \"pointer\" | \"touchpad\" | \"hover\" | \"stylus\"\n}\n\ntype Timer = ReturnType<typeof setTimeout> | null\n\ntype Runtime = {\n state: GestureStateValue\n oldState: GestureStateValue\n /**\n * WALL CLOCK at the press, which is what `duration` is measured against.\n * Not the event's own `timestamp`: that is GTK's event time, with no fixed\n * epoch, and a timer firing has no event to read one off anyway. Upstream\n * computes it the same way.\n */\n pressTime: number\n /** Where translation is measured FROM; reset to the activation point. */\n originX: number\n originY: number\n /** Where the press landed, which activation does NOT move. */\n pressX: number\n pressY: number\n lastX: number\n lastY: number\n lastTime: number\n velocityX: number\n velocityY: number\n /** The previous update's translation, for the change delta. */\n changeFromX: number\n changeFromY: number\n /** Whether any update has been emitted yet, for the first change delta. */\n hasEmittedUpdate: boolean\n /** Whether the gesture ever reached ACTIVE, which outlives the state itself. */\n hasActivated: boolean\n activationTimer: Timer\n timerElapsed: boolean\n pointerCount: number\n maxPointerCount: number\n /**\n * Completed press-release cycles, and the timer waiting for the next one.\n *\n * These two are the only state that survives a press, and the timer IS the\n * sequence: while it is armed the gesture is a multi-tap in progress, and\n * the next `onTouchStart` continues it instead of starting over.\n */\n taps: number\n delayTimer: Timer\n /**\n * The orchestrator cleared this gesture to become ACTIVE and it is waiting\n * for the responder lock to catch up.\n *\n * This is the ONLY thing `onMoveShouldSetResponder` answers from. It used to\n * mean \"a timer or a callback asked to activate\", which was the same thing\n * while there was nothing to arbitrate; now the difference is load-bearing,\n * because a gesture parked behind `requireExternalGestureToFail` wants to\n * activate and must not be allowed to take the lock.\n */\n authorized: boolean\n /**\n * Whether THIS gesture holds the responder, in THIS interaction.\n *\n * Which of two update pumps drives it: the holder reads `onResponderMove`,\n * anything else ACTIVE reads `onTouchMove`. Two different gestures end up on\n * the second pump and only this flag covers both — a kind that never takes\n * the lock (`claimsResponder: false`), and a kind that does but lost the\n * race to a simultaneous partner. Exactly one pump fires per gesture.\n */\n hasResponder: boolean\n forcedFailure: boolean\n /**\n * The touchpad gesture's own accumulators, and the values the previous\n * update reported — which is what `scaleChange`/`rotationChange` and\n * `velocity` are computed from.\n *\n * Held here rather than read back off the GTK controller so that a\n * recognizer measures what it was TOLD. `gtk_gesture_zoom_get_scale_delta`\n * returns 1 the moment the gesture is no longer active, so an `end` handler\n * that asked GTK would report the gesture undoing itself.\n */\n scale: number\n rotation: number\n scaleVelocity: number\n rotationVelocity: number\n changeFromScale: number\n changeFromRotation: number\n /** `ForceTouch`'s pressure, and the value the previous update reported. */\n force: number\n changeFromForce: number\n /** Wall clock of the last controller sample, for the per-second velocities. */\n lastSampleTime: number\n}\n\nconst newRuntime = (): Runtime => ({\n state: GESTURE_STATE.UNDETERMINED,\n oldState: GESTURE_STATE.UNDETERMINED,\n pressTime: 0,\n originX: 0,\n originY: 0,\n pressX: 0,\n pressY: 0,\n lastX: 0,\n lastY: 0,\n lastTime: 0,\n velocityX: 0,\n velocityY: 0,\n changeFromX: 0,\n changeFromY: 0,\n hasEmittedUpdate: false,\n hasActivated: false,\n activationTimer: null,\n timerElapsed: false,\n pointerCount: 0,\n maxPointerCount: 0,\n taps: 0,\n delayTimer: null,\n authorized: false,\n hasResponder: false,\n forcedFailure: false,\n scale: 1,\n rotation: 0,\n scaleVelocity: 0,\n rotationVelocity: 0,\n changeFromScale: 1,\n changeFromRotation: 0,\n force: 0,\n changeFromForce: 0,\n lastSampleTime: 0,\n})\n\n/**\n * RNGH's `checkHitSlop`, restated: build the acceptable box in the view's own\n * coordinates, then test the pointer's offset into the view against it.\n *\n * Every side is \"outward is positive\", so a NEGATIVE value shrinks the box —\n * the capability RN's own View `hitSlop` does not have. Explicit sides\n * override `horizontal`/`vertical`, and `width`/`height` then anchor the\n * opposite edge to whichever side was named.\n *\n * The plain-number spelling is normalised into the four sides up front.\n * Upstream's web path does not do this and silently ignores a number, which\n * is a bug rather than a semantic worth reproducing — its own native paths\n * normalise exactly this way.\n */\nexport const hitSlopRect = (\n bounds: Rect,\n hitSlop: GestureHitSlop | undefined,\n): Rect => {\n if (hitSlop === undefined || hitSlop === null) {\n return bounds\n }\n const slop =\n typeof hitSlop === \"number\"\n ? { left: hitSlop, right: hitSlop, top: hitSlop, bottom: hitSlop }\n : hitSlop\n\n let left = 0\n let top = 0\n let right = bounds.width\n let bottom = bounds.height\n\n if (slop.horizontal !== undefined) {\n left -= slop.horizontal\n right += slop.horizontal\n }\n if (slop.vertical !== undefined) {\n top -= slop.vertical\n bottom += slop.vertical\n }\n if (slop.left !== undefined) {\n left = -slop.left\n }\n if (slop.right !== undefined) {\n right = bounds.width + slop.right\n }\n if (slop.top !== undefined) {\n top = -slop.top\n }\n if (slop.bottom !== undefined) {\n bottom = bounds.height + slop.bottom\n }\n if (slop.width !== undefined) {\n if (slop.left !== undefined) {\n right = left + slop.width\n } else if (slop.right !== undefined) {\n left = right - slop.width\n }\n }\n if (slop.height !== undefined) {\n if (slop.top !== undefined) {\n bottom = top + slop.height\n } else if (slop.bottom !== undefined) {\n top = bottom - slop.height\n }\n }\n\n return {\n x: bounds.x + left,\n y: bounds.y + top,\n width: right - left,\n height: bottom - top,\n }\n}\n\nconst contains = (rect: Rect, x: number, y: number): boolean =>\n x >= rect.x &&\n x <= rect.x + rect.width &&\n y >= rect.y &&\n y <= rect.y + rect.height\n\n/**\n * One frame from whichever GTK controller feeds a non-pointer kind, in the\n * terms the recognizer reads.\n *\n * ONE sample type for three sources rather than three, because what the\n * machine needs from all of them is the same short list and only two fields\n * differ per kind. `scale` and `rotation` are CUMULATIVE since GTK recognized\n * the gesture, which is what `gtk_gesture_zoom_get_scale_delta` (\"the zooming\n * difference since the gesture was recognized, hence the starting point is\n * considered 1:1\") and `gtk_gesture_rotate_get_angle_delta` already are — the\n * same shape as upstream's own accumulators, so nothing is re-derived on the\n * way in.\n */\nexport type ControllerSample = {\n /**\n * Where the gesture is, in the gesture VIEW's own coordinates.\n *\n * A pinch's bounding-box centre, a hover's pointer, a stylus tip: three\n * names for the position the payload's `x`/`y`, `focalX`/`focalY` and\n * `anchorX`/`anchorY` are all filled from, which is why they are one pair\n * of fields and not three.\n */\n x: number\n y: number\n /** `Pinch`: 1 at the start of the gesture, above 1 for a spread. */\n scale?: number\n /** `Rotation`: 0 at the start; radians, positive clockwise. */\n rotation?: number\n /** `ForceTouch`: pressure normalised to `[0, 1]`. */\n force?: number\n /** Pointers GTK reported. A touchpad pinch is always two; a hover is one. */\n pointers: number\n}\n\n/**\n * The non-pointer entry surface, for the kinds GTK feeds rather than the\n * pointer stream. Null on every pointer kind — see `RecognizerDecider.source`.\n */\nexport type ControllerChannel = {\n begin: (sample: ControllerSample) => void\n update: (sample: ControllerSample) => void\n end: () => void\n cancel: () => void\n}\n\nexport type Recognizer = {\n /** The responder props to put on the gesture's view. Empty for a controller kind. */\n handlers: Record<string, (event: GestureResponderEvent) => boolean | void>\n /**\n * Where `GtkGestureZoom`/`GtkGestureRotate`/`GtkEventControllerMotion`/\n * `GtkGestureStylus` deliver, or null for a pointer kind.\n */\n controller: ControllerChannel | null\n /** This gesture's seat in the arbitration loop. */\n participant: Participant\n /** Cancels any pending timer and leaves the loop; called on unmount. */\n dispose: () => void\n}\n\n/**\n * Builds the machine. `readConfig` is called on every event rather than\n * captured, so a re-render that hands the detector a fresh gesture object —\n * which is what both spellings produce, every render — takes effect without\n * swapping the handler set mid-drag.\n */\nexport const createRecognizer = (\n handlerTag: number,\n decider: RecognizerDecider,\n readConfig: () => RecognizerConfig,\n env: RecognizerEnvironment,\n): Recognizer => {\n let runtime = newRuntime()\n\n const isEnabled = (): boolean => readConfig().enabled !== false\n\n /**\n * What kind of device this gesture's events come from.\n *\n * `MOUSE` for everything except `ForceTouch`, and that is not a default with\n * a hole in it: this platform has one pointer and no touch injection, so\n * every other kind really is a mouse. A pressure reading can only have come\n * from a tablet tool, so the one kind that reads pressure reports `STYLUS`.\n */\n const pointerType =\n decider.source === \"stylus\" ? POINTER_TYPE.STYLUS : POINTER_TYPE.MOUSE\n\n const setState = (next: GestureStateValue): void => {\n runtime.oldState = runtime.state\n runtime.state = next\n }\n\n const viewOf = (): RecognizerView => ({\n translationX: runtime.lastX - runtime.originX,\n translationY: runtime.lastY - runtime.originY,\n distanceFromPress: Math.hypot(\n runtime.lastX - runtime.pressX,\n runtime.lastY - runtime.pressY,\n ),\n velocityX: runtime.velocityX,\n velocityY: runtime.velocityY,\n timerElapsed: runtime.timerElapsed,\n pointerCount: runtime.pointerCount,\n maxPointerCount: runtime.maxPointerCount,\n taps: runtime.taps,\n scale: runtime.scale,\n rotation: runtime.rotation,\n force: runtime.force,\n })\n\n /**\n * One payload, from a point rather than from an event.\n *\n * A timer has no event to build one from and every one of the three kinds\n * has a timer that can end the gesture — `Tap`'s `maxDuration` and\n * `maxDelay` both finalize with no pointer in flight. Fabricating a\n * `GestureResponderEvent` to feed an event-shaped builder would have put an\n * invented event into the responder system's own vocabulary; taking the\n * three numbers the payload actually needs does not.\n */\n const payloadAt = (\n pageX: number,\n pageY: number,\n pointerCount: number,\n fallback?: { locationX: number; locationY: number },\n ): GestureEventPayload => {\n const bounds = env.boundsInWindow()\n const translationX = pageX - runtime.originX\n const translationY = pageY - runtime.originY\n return {\n handlerTag,\n numberOfPointers: pointerCount,\n pointerType,\n state: runtime.state,\n oldState: runtime.oldState,\n // RNGH's `x`/`y` are relative to the GESTURE's view. The responder\n // event's own `locationX` is relative to whichever widget carried the\n // event, which is the deepest one with a controller and not always this\n // one — so it is recomputed rather than passed through.\n x: bounds ? pageX - bounds.x : (fallback?.locationX ?? pageX),\n y: bounds ? pageY - bounds.y : (fallback?.locationY ?? pageY),\n absoluteX: pageX,\n absoluteY: pageY,\n translationX,\n translationY,\n velocityX: runtime.velocityX,\n velocityY: runtime.velocityY,\n // On the first update the change IS the translation, which is\n // upstream's rule rather than an approximation of it.\n changeX: runtime.hasEmittedUpdate\n ? translationX - runtime.changeFromX\n : translationX,\n changeY: runtime.hasEmittedUpdate\n ? translationY - runtime.changeFromY\n : translationY,\n duration: Date.now() - runtime.pressTime,\n scale: runtime.scale,\n // A RATIO, not a difference — scale composes by multiplication, and\n // upstream's `changeEventCalculator` for `Pinch` divides where the one\n // for `Rotation` subtracts. On the first update it is the scale itself,\n // which is upstream's rule for both and the same rule `changeX` follows.\n scaleChange: runtime.hasEmittedUpdate\n ? runtime.scale / runtime.changeFromScale\n : runtime.scale,\n // The focal point IS the position for these two kinds: the touchpad\n // channel writes the gesture's bounding-box centre into the same\n // last-position fields the pointer kinds write a touch into, so `x`/`y`\n // and `focalX`/`focalY` are the same number arrived at the same way.\n focalX: bounds ? pageX - bounds.x : (fallback?.locationX ?? pageX),\n focalY: bounds ? pageY - bounds.y : (fallback?.locationY ?? pageY),\n rotation: runtime.rotation,\n rotationChange: runtime.hasEmittedUpdate\n ? runtime.rotation - runtime.changeFromRotation\n : runtime.rotation,\n anchorX: bounds ? pageX - bounds.x : (fallback?.locationX ?? pageX),\n anchorY: bounds ? pageY - bounds.y : (fallback?.locationY ?? pageY),\n force: runtime.force,\n // A DIFFERENCE, like `rotationChange` and unlike `scaleChange`, because\n // upstream's `changeEventCalculator` for `ForceTouch` subtracts. On the\n // first update it is the force itself, which is upstream's rule there\n // and the same rule `changeX` follows.\n forceChange: runtime.hasEmittedUpdate\n ? runtime.force - runtime.changeFromForce\n : runtime.force,\n velocity:\n decider.kind === \"rotation\"\n ? runtime.rotationVelocity\n : runtime.scaleVelocity,\n }\n }\n\n const payloadOf = (event: GestureResponderEvent): GestureEventPayload => {\n const { pageX, pageY, locationX, locationY } = event.nativeEvent\n return payloadAt(pageX, pageY, event.nativeEvent.touches.length, {\n locationX,\n locationY,\n })\n }\n\n /** The payload for a decision a timer made, from the last known position. */\n const payloadNow = (): GestureEventPayload =>\n payloadAt(runtime.lastX, runtime.lastY, runtime.pointerCount)\n\n const touchEventOf = (\n event: GestureResponderEvent,\n eventType: TouchEventTypeValue,\n ): GestureTouchEvent => {\n const bounds = env.boundsInWindow()\n const toData = (touch: {\n identifier: number\n pageX: number\n pageY: number\n }) => ({\n id: touch.identifier,\n x: bounds ? touch.pageX - bounds.x : touch.pageX,\n y: bounds ? touch.pageY - bounds.y : touch.pageY,\n absoluteX: touch.pageX,\n absoluteY: touch.pageY,\n })\n return {\n handlerTag,\n numberOfTouches: event.nativeEvent.touches.length,\n eventType,\n allTouches: event.nativeEvent.touches.map(toData),\n changedTouches: event.nativeEvent.changedTouches.map(toData),\n state: runtime.state,\n pointerType,\n }\n }\n\n const clearActivationTimer = (): void => {\n if (runtime.activationTimer !== null) {\n clearTimeout(runtime.activationTimer)\n runtime.activationTimer = null\n }\n }\n\n const clearDelayTimer = (): void => {\n if (runtime.delayTimer !== null) {\n clearTimeout(runtime.delayTimer)\n runtime.delayTimer = null\n }\n }\n\n const track = (event: GestureResponderEvent): void => {\n const { pageX, pageY, timestamp } = event.nativeEvent\n const elapsed = timestamp - runtime.lastTime\n if (elapsed > 0) {\n runtime.velocityX = ((pageX - runtime.lastX) / elapsed) * 1000\n runtime.velocityY = ((pageY - runtime.lastY) / elapsed) * 1000\n }\n runtime.lastX = pageX\n runtime.lastY = pageY\n runtime.lastTime = timestamp\n countPointers(event)\n }\n\n const countPointers = (event: GestureResponderEvent): void => {\n runtime.pointerCount = event.nativeEvent.touches.length\n runtime.maxPointerCount = Math.max(\n runtime.maxPointerCount,\n runtime.pointerCount,\n )\n }\n\n /**\n * Every exit from a live gesture goes through here exactly once, and this is\n * where the tap sequence dies: `newRuntime()` drops `taps` along with\n * everything else, so a finalized multi-tap starts counting from zero.\n */\n const finalize = (\n payloadFor: () => GestureEventPayload,\n success: boolean,\n ): void => {\n if (runtime.state === GESTURE_STATE.UNDETERMINED) {\n // Already over. The responder system dispatches `onResponderRelease` to\n // whoever holds the lock at the end of the interaction, and a gesture\n // can have cancelled itself while still holding it — a `LongPress` that\n // wandered past `maxDistance`, or one the orchestrator cancelled. One\n // exit per gesture, and this is where the second one stops.\n return\n }\n const config = readConfig()\n clearActivationTimer()\n clearDelayTimer()\n // Read the flag, not the state: a cancellation sets the state to\n // CANCELLED on its way in, and an ACTIVE gesture that gets cancelled must\n // still be told it deactivated.\n const wasActive = runtime.hasActivated\n if (success) {\n setState(GESTURE_STATE.END)\n }\n // Built AFTER the transition, so `event.state` is the state the gesture\n // ended in — which is what a consumer comparing it against `State` reads.\n const payload = payloadFor()\n // The deactivation callback is the ACTIVE gesture's ending. A gesture\n // that never activated gets `onFinalize` and nothing else, which is what\n // lets a consumer distinguish a drag that finished from one that never\n // happened — `react-native-reanimated-dnd` relies on exactly that.\n if (wasActive) {\n config.onDeactivate?.(payload, success)\n }\n config.onFinalize?.(payload, success)\n // Told AFTER the callbacks and BEFORE the reset. After, so a gesture this\n // failure releases from `awaiting` starts where the previous one left off\n // rather than in the middle of it; before, so the loop is handed the state\n // the gesture actually ended in — END releases nobody and cancels the\n // waiters, FAILED and CANCELLED release them.\n env.orchestrator.finished(participant, runtime.state)\n runtime = newRuntime()\n }\n\n const finalizeAt = (event: GestureResponderEvent, success: boolean): void => {\n finalize(() => payloadOf(event), success)\n }\n\n const fail = (event: GestureResponderEvent): void => {\n clearActivationTimer()\n setState(GESTURE_STATE.FAILED)\n finalize(() => payloadOf(event), false)\n }\n\n /** A timer decided this, so there is no event and the position is the last one. */\n const failNow = (): void => {\n clearActivationTimer()\n setState(GESTURE_STATE.FAILED)\n finalize(payloadNow, false)\n }\n\n /** Whether this kind takes the interaction when it activates. */\n const claimsResponder = decider.claimsResponder !== false\n\n /**\n * Everything becoming ACTIVE means, from a position rather than an event.\n *\n * Three ways in now, and the third is the whole of slice 3: `onResponderGrant`\n * for a recognizer that took the lock, `authorize()` for one that never will\n * (`claimsResponder: false`), and `authorize()` again for one that WOULD have\n * but was told the interaction is already held by a gesture it is\n * simultaneous with. Everything after the transition is identical, because\n * being ACTIVE is a fact about the gesture and not about the lock.\n */\n const enterActive = (pageX: number, pageY: number): void => {\n setState(GESTURE_STATE.ACTIVE)\n runtime.authorized = false\n clearActivationTimer()\n clearDelayTimer()\n // Translation is measured from where the gesture BECAME ACTIVE, not\n // from the press: a pan with `activeOffsetY([-10, 10])` that reported\n // 10px of travel the moment it started would jump the content by the\n // threshold on every drag. With `activateAfterLongPress` the pointer\n // has not moved when the timer grants, so the two origins coincide —\n // which is only true because the grant no longer waits for a move.\n runtime.originX = pageX\n runtime.originY = pageY\n runtime.lastX = pageX\n runtime.lastY = pageY\n runtime.changeFromX = 0\n runtime.changeFromY = 0\n runtime.hasEmittedUpdate = false\n runtime.hasActivated = true\n }\n\n /**\n * `Fling`'s ending, which is the same instant as its activation.\n *\n * Called at the tail of every path into ACTIVE, so the one-shot kind behaves\n * identically however it got there — a grant, an authorization without one,\n * or a controller channel. Upstream reaches this by overriding `activate()`\n * to call `end()`; a flag on the decider is the same statement without a\n * subclass to put it on.\n */\n const endIfOneShot = (): void => {\n if (decider.endsOnActivate === true) {\n finalize(payloadNow, true)\n }\n }\n\n /** Becoming ACTIVE without a grant to carry the position or the payload. */\n const activateHere = (): void => {\n enterActive(runtime.lastX, runtime.lastY)\n const payload = payloadNow()\n // Mutual exclusion is enforced here rather than at the moment permission\n // was given, because permission is not always the same instant: a gesture\n // that has to take the responder becomes ACTIVE only if the negotiation\n // grants it, and an ancestor can still win.\n env.orchestrator.activated(participant)\n readConfig().onActivate?.(payload)\n endIfOneShot()\n }\n\n /**\n * The orchestrator's answer, and the only place the two locks touch.\n *\n * `needsResponder` false means another gesture already holds the interaction\n * and this one was cleared to run alongside it. It does NOT ask for the\n * responder: the lock is single-holder by design, GTK has already been told\n * everything it can be told, and winning the lock would take the interaction\n * away from the gesture this one was written to accompany.\n *\n * A recognizer that never claims takes the same path for its own reason —\n * it is not asking for the interaction, it is reporting that the widget\n * underneath it has taken one.\n */\n const authorize = (needsResponder: boolean): void => {\n if (runtime.state !== GESTURE_STATE.BEGAN) {\n return\n }\n runtime.authorized = true\n if (!claimsResponder || !needsResponder) {\n activateHere()\n return\n }\n // The out-of-event channel, asked from inside a touch event as well as\n // from a timer, and that uniformity is not laziness. Slice 1 could leave\n // an in-event activation to the negotiation the responder system runs\n // after the touch props, because there was only ever one gesture asking.\n // With two, both would defer into the same negotiation, exactly one would\n // win it, and the loser would sit authorized and never activate — so\n // `Simultaneous` would silently be a race. Asking here settles the lock\n // before the second gesture is even consulted, which is what lets it be\n // told the interaction is already taken.\n //\n // It is the same negotiation either way: `requestResponder` reuses\n // `negotiateAndTransfer` unchanged, so capture still beats bubble and an\n // ancestor can still win.\n env.requestResponder()\n }\n\n /**\n * The one place a recognizer asks to become active, and therefore the seam\n * the orchestrator sits in.\n *\n * Every path that used to take the responder now goes through here first:\n * the gesture's own criteria being met is a request, not a decision. What\n * comes back is `authorize()` (with or without the lock), a parking in\n * `awaiting` that leaves the gesture BEGAN holding nothing, or a\n * cancellation. `Native` goes through it too — a gesture that never takes\n * the lock still takes part in arbitration, and it is the one kind that can\n * cancel an already-active gesture.\n */\n const decide = (): void => {\n if (runtime.authorized || runtime.state !== GESTURE_STATE.BEGAN) {\n return\n }\n env.orchestrator.tryActivate(participant)\n }\n\n /** Cancelled by the loop: another gesture won, or the one it waited for ended. */\n const cancelFromOrchestrator = (): void => {\n if (\n runtime.state !== GESTURE_STATE.BEGAN &&\n runtime.state !== GESTURE_STATE.ACTIVE\n ) {\n return\n }\n setState(GESTURE_STATE.CANCELLED)\n finalize(payloadNow, false)\n }\n\n const participant: Participant = {\n tag: handlerTag,\n kind: decider.kind,\n authorize,\n holdsResponder: () => runtime.hasResponder,\n cancel: cancelFromOrchestrator,\n }\n\n /**\n * The state, read through a call.\n *\n * Not decoration: `decide()` can change the state before it returns — the\n * orchestrator may activate the gesture, or cancel it, synchronously — and a\n * narrowed `runtime.state` read straight afterwards is a fact the compiler\n * believes and the runtime does not.\n */\n const stateNow = (): GestureStateValue => runtime.state\n\n /**\n * The four transitions an app may drive by hand — upstream's\n * `GestureStateManager`, and the whole of what `Gesture.Manual()` is.\n *\n * These used to be two real transitions and two deferrals: `fail()` and\n * `end()` both set a flag that the next `onTouchMove` noticed, which was\n * enough while the only caller was a `Pan` narrowing its own criteria, and\n * is not enough for a gesture that has NO criteria. `Manual` is driven\n * entirely from here, so each of the four has to mean what upstream's means,\n * at the moment it is called:\n *\n * begin UNDETERMINED -> BEGAN\n * activate BEGAN -> ACTIVE, through the orchestrator like every other\n * activation — a manual gesture takes part in arbitration\n * rather than bypassing it, which is the point of having it\n * end BEGAN or ACTIVE -> END, successfully\n * fail BEGAN or ACTIVE -> FAILED\n *\n * `activate()` is FORCED past `manualActivation`, exactly as upstream's web\n * state manager calls `handler.activate(true)`: that flag exists to stop the\n * gesture's own predicates activating it, and this is not them.\n */\n const stateManager: GestureStateManagerApi = {\n begin: () => {\n if (runtime.state === GESTURE_STATE.UNDETERMINED) {\n setState(GESTURE_STATE.BEGAN)\n readConfig().onBegin?.(payloadNow())\n }\n },\n activate: () => {\n // Upstream forces the BEGAN step first when asked to activate a gesture\n // that never began, \"to preserve the correct state transition flow\" —\n // and here it also matters that the orchestrator has been told about the\n // gesture, which `record()` on the press is what does.\n if (runtime.state === GESTURE_STATE.UNDETERMINED) {\n setState(GESTURE_STATE.BEGAN)\n env.orchestrator.record(participant)\n readConfig().onBegin?.(payloadNow())\n }\n if (runtime.state === GESTURE_STATE.BEGAN) {\n decide()\n }\n },\n fail: () => {\n if (\n runtime.state === GESTURE_STATE.BEGAN ||\n runtime.state === GESTURE_STATE.ACTIVE\n ) {\n // Kept as well as acted on: a gesture failed from inside\n // `onTouchesDown` has not reached the move that would have consulted\n // its predicates, and the flag is what stops a later move reviving it.\n runtime.forcedFailure = true\n failNow()\n }\n },\n end: () => {\n if (\n runtime.state === GESTURE_STATE.BEGAN ||\n runtime.state === GESTURE_STATE.ACTIVE\n ) {\n runtime.forcedFailure = true\n finalize(payloadNow, true)\n }\n },\n }\n\n const outsideBounds = (event: GestureResponderEvent): boolean => {\n const bounds = env.boundsInWindow()\n if (bounds === null) {\n // Before the first layout there is no truth to test against, and\n // refusing every press would be worse than accepting them.\n return false\n }\n const { pageX, pageY } = event.nativeEvent\n return !contains(hitSlopRect(bounds, readConfig().hitSlop), pageX, pageY)\n }\n\n const pointerCountAllowed = (event: GestureResponderEvent): boolean => {\n const config = readConfig()\n const count = event.nativeEvent.touches.length\n return (\n count >= (config.minPointers ?? 1) && count <= (config.maxPointers ?? 10)\n )\n }\n\n /**\n * One ACTIVE gesture's reaction to the pointer moving, from whichever\n * channel reached it: `onResponderMove` for the lock's holder,\n * `onTouchMove` for a recognizer that never takes it.\n *\n * Returns nothing; the gesture may have finalized itself on the way out.\n */\n const advance = (event: GestureResponderEvent): void => {\n track(event)\n const config = readConfig()\n if (\n (config.shouldCancelWhenOutside === true && outsideBounds(event)) ||\n // `LongPress` is the one kind that can be cancelled by movement it has\n // already accepted: `maxDistance` keeps applying once the press has\n // matured, and travelling past it while ACTIVE is a cancellation\n // rather than a failure.\n decider.shouldCancelWhileActive?.(viewOf(), config) === true\n ) {\n setState(GESTURE_STATE.CANCELLED)\n finalizeAt(event, false)\n return\n }\n const payload = payloadOf(event)\n // The event that GRANTED the responder reaches here too — the system\n // dispatches the move to whoever holds the lock after the handoff, in\n // the same event. Emitting it would be an update of zero travel that\n // `onActivate` has just reported the position of, and it would make\n // upstream's rule that the FIRST change equals the translation vacuous:\n // that first delta would always be zero. So the activation event is not\n // an update, and the first real move is.\n if (\n !runtime.hasEmittedUpdate &&\n payload.translationX === 0 &&\n payload.translationY === 0\n ) {\n return\n }\n config.onUpdate?.(payload)\n config.onChange?.(payload)\n runtime.changeFromX = payload.translationX\n runtime.changeFromY = payload.translationY\n runtime.hasEmittedUpdate = true\n }\n\n const handlers = {\n // Always false. A pan that takes the interaction on press cannot honour\n // an `activeOffset`, and letting a sibling or an ancestor win instead is\n // the behaviour every offset knob exists to produce.\n onStartShouldSetResponder: () => false,\n\n onTouchStart: (event: GestureResponderEvent) => {\n const config = readConfig()\n if (!isEnabled() || outsideBounds(event)) {\n return\n }\n // A tap sequence in progress carries its count across the press. The\n // delay timer's existence IS the sequence — while it is armed the\n // gesture is between taps, still BEGAN, and this press is the next one\n // rather than a fresh gesture.\n const continuing =\n runtime.delayTimer !== null && runtime.state === GESTURE_STATE.BEGAN\n const carriedTaps = continuing ? runtime.taps : 0\n clearDelayTimer()\n runtime = newRuntime()\n runtime.taps = carriedTaps\n\n const { pageX, pageY, timestamp } = event.nativeEvent\n runtime.pressTime = Date.now()\n runtime.originX = pageX\n runtime.originY = pageY\n runtime.pressX = pageX\n runtime.pressY = pageY\n runtime.lastX = pageX\n runtime.lastY = pageY\n runtime.lastTime = timestamp\n countPointers(event)\n setState(GESTURE_STATE.BEGAN)\n // Recorded on the press, not on mount. That is the whole islands answer\n // in one line: a gesture takes part in an interaction only when the\n // interaction's pointer reaches it, so a relation naming a gesture in\n // another `Root` — or one the pointer never went near — never has an\n // occasion to apply and can never park anything for ever. Recording on\n // mount would have made `requireExternalGestureToFail` across two\n // islands a permanent deadlock. See docs/api.md.\n env.orchestrator.record(participant)\n // Upstream begins once per SEQUENCE, not once per tap: its `begin()` is\n // reached only from the UNDETERMINED branch, so the second press of a\n // double tap gets no second `onBegin`.\n if (!continuing) {\n config.onBegin?.(payloadOf(event))\n }\n config.onTouchesDown?.(\n touchEventOf(event, TOUCH_EVENT_TYPE.TOUCHES_DOWN),\n stateManager,\n )\n\n const timer = decider.timer?.(config) ?? null\n if (timer !== null) {\n runtime.activationTimer = setTimeout(() => {\n runtime.activationTimer = null\n if (runtime.state !== GESTURE_STATE.BEGAN) {\n return\n }\n runtime.timerElapsed = true\n if (timer.elapsed === \"fail\") {\n // `Tap`'s `maxDuration`: the pointer is still down and the tap is\n // already too slow. There is no event to fail with.\n failNow()\n return\n }\n if (readConfig().manualActivation === true) {\n return\n }\n // Asked rather than assumed: the timer maturing is one criterion\n // among the kind's own, and `LongPress` also wants the right number\n // of pointers down before it will take the gesture.\n if (!decider.shouldActivate(viewOf(), readConfig())) {\n return\n }\n // THE OUT-OF-EVENT GRANT. Without it the gesture could not take the\n // interaction until the pointer next moved — one frame late for a\n // drag, and never for a press-and-hold that stays still. This is\n // the single extension slice 1 makes to the responder model;\n // docs/research/gestures.md records it with its reason.\n decide()\n }, timer.delay)\n }\n\n // A recognizer that never claims may activate on the press itself, and\n // `Gesture.Native().shouldActivateOnStart(true)` is the shape that\n // wants to: a native BUTTON takes the press at once rather than waiting\n // to see whether the pointer travels.\n //\n // Deliberately not asked for the claiming kinds, and that is the same\n // rule `onStartShouldSetResponder` states by always answering false — a\n // gesture that grabbed the interaction on press cannot honour an\n // `activeOffset`, and deciding late is what every offset knob is for.\n // Nothing is being decided late here, because nothing is being taken.\n if (\n !claimsResponder &&\n config.manualActivation !== true &&\n decider.shouldActivate(viewOf(), config)\n ) {\n decide()\n }\n },\n\n onTouchMove: (event: GestureResponderEvent) => {\n if (runtime.state === GESTURE_STATE.ACTIVE) {\n // A gesture that does not hold the lock has no `onResponderMove`\n // coming, so this is where its updates live. One that does is driven\n // from there instead, and emitting here as well would double every\n // update it reports.\n //\n // Two kinds of gesture end up here and the flag covers both: one that\n // never takes the lock (`claimsResponder: false`), and one that would\n // have but is ACTIVE alongside a gesture it is `Simultaneous` with.\n // Without the second, `Simultaneous` would be a state with no events\n // attached to it.\n if (!runtime.hasResponder) {\n advance(event)\n }\n return\n }\n if (runtime.state !== GESTURE_STATE.BEGAN) {\n // A finished gesture is not tracked at all.\n return\n }\n track(event)\n const config = readConfig()\n config.onTouchesMove?.(\n touchEventOf(event, TOUCH_EVENT_TYPE.TOUCHES_MOVE),\n stateManager,\n )\n const view = viewOf()\n // Failure is tested before activation, and the comparisons differ —\n // failure is strict, activation is not — so a translation sitting\n // exactly on a bound activates rather than fails. That asymmetry is\n // upstream's and is reproduced rather than tidied.\n if (\n runtime.forcedFailure ||\n !pointerCountAllowed(event) ||\n // Upstream fails a BEGAN handler that leaves the view, not just an\n // ACTIVE one — `onPointerLeave` splits exactly that way. It is the\n // default for `Tap` and `LongPress`, which is why it surfaces here;\n // `Pan` leaves the flag off unless an app sets it.\n (config.shouldCancelWhenOutside === true && outsideBounds(event)) ||\n decider.shouldFail(view, config)\n ) {\n fail(event)\n return\n }\n if (config.manualActivation === true) {\n return\n }\n if (decider.shouldActivate(view, config)) {\n decide()\n }\n },\n\n // The instant of decision. Everything above ran holding nothing.\n onMoveShouldSetResponder: () => {\n // `Native` never answers yes: winning here is what makes the platform\n // claim the GTK sequence and suspend the scroller it is reporting on.\n if (!claimsResponder) {\n return false\n }\n if (runtime.state !== GESTURE_STATE.BEGAN || !isEnabled()) {\n return false\n }\n // The orchestrator's answer and nothing else. Slice 1 asked the decider\n // a second time from here, on the reasoning that a move arriving while\n // another view held the responder had not reached the decision above —\n // which was never true (system.ts dispatches the touch props BEFORE it\n // negotiates, in both entry points) and is now actively wrong: a gesture\n // parked behind `requireExternalGestureToFail` still meets its own\n // criteria, and answering them here would let it take the lock it was\n // told to wait for.\n return runtime.authorized\n },\n\n onResponderGrant: (event: GestureResponderEvent) => {\n // The host holds the responder whoever asked for it — the recognizer's\n // props are merged into the child's, so a child with responder props of\n // its own can be the reason this fired.\n runtime.hasResponder = true\n if (!runtime.authorized) {\n // Not this gesture's grant. Becoming ACTIVE is the orchestrator's to\n // authorize, and it has not.\n return\n }\n enterActive(event.nativeEvent.pageX, event.nativeEvent.pageY)\n const payload = payloadOf(event)\n env.orchestrator.activated(participant)\n readConfig().onActivate?.(payload)\n endIfOneShot()\n },\n\n onResponderMove: (event: GestureResponderEvent) => {\n if (runtime.state !== GESTURE_STATE.ACTIVE) {\n return\n }\n advance(event)\n },\n\n onResponderRelease: (event: GestureResponderEvent) => {\n runtime.hasResponder = false\n finalizeAt(event, true)\n },\n\n onResponderTerminate: (event: GestureResponderEvent) => {\n runtime.hasResponder = false\n // The interaction went somewhere this registry cannot follow — an\n // ancestor took the responder, the window lost focus, a scroller moved\n // under it. Anything running alongside this gesture was riding on a lock\n // that is gone, and there is no callback of its own coming to tell it.\n env.orchestrator.interactionLost(participant)\n if (runtime.state === GESTURE_STATE.UNDETERMINED) {\n // Already over: this gesture cancelled itself while still holding the\n // lock, and the system is telling the HOST the interaction ended.\n return\n }\n setState(GESTURE_STATE.CANCELLED)\n finalizeAt(event, false)\n },\n\n onTouchEnd: (event: GestureResponderEvent) => {\n readConfig().onTouchesUp?.(\n touchEventOf(event, TOUCH_EVENT_TYPE.TOUCHES_UP),\n stateManager,\n )\n // The responder holder is finalized by `onResponderRelease`, which the\n // system dispatches AFTER the touch props. A gesture that is ACTIVE\n // without holding the lock — a `Native`, or a `Simultaneous` partner\n // that lost the race for it — has no responder callback coming, and\n // this is where its successful ending is.\n if (runtime.state === GESTURE_STATE.ACTIVE) {\n if (!runtime.hasResponder) {\n finalizeAt(event, true)\n }\n return\n }\n if (runtime.state !== GESTURE_STATE.BEGAN) {\n return\n }\n const config = readConfig()\n runtime.taps += 1\n const outcome = decider.onRelease?.(viewOf(), config) ?? { kind: \"fail\" }\n\n if (outcome.kind === \"hold\") {\n // `Manual`: the pointer lifting decides nothing, because nothing about\n // this gesture is decided by the pointer. It stays BEGAN, holding no\n // lock and running no timer, until the app says otherwise — and the\n // `onTouchesUp` above has just given it the state manager to say it\n // with. The next press resets it, as it resets any BEGAN gesture.\n return\n }\n\n if (outcome.kind === \"await\") {\n // Not over. The gesture stays BEGAN with its count intact, holding no\n // lock, and the next press continues it — or this timer fails it.\n clearActivationTimer()\n runtime.delayTimer = setTimeout(() => {\n runtime.delayTimer = null\n if (runtime.state === GESTURE_STATE.BEGAN) {\n failNow()\n }\n }, outcome.delay)\n return\n }\n\n if (outcome.kind === \"fail\") {\n // `fail()` rather than a bare `finalizeAt(..., false)`, because the\n // payload has to carry the state the gesture ENDED in and this path\n // was reporting BEGAN. Upstream's `fail()` moves to FAILED first, and\n // a consumer comparing `event.state` against `State.FAILED` — which is\n // exactly what two of the four target libraries do with `State` — was\n // being told the gesture was still deciding. `Fling` made it visible\n // because failing on the lift is its ordinary ending rather than an\n // edge case, but `Tap` and `Pan` were reporting it too.\n fail(event)\n return\n }\n\n // `Tap` activating: this is the one kind whose activation criterion is\n // the pointer coming back UP, so the grant is asked for here rather than\n // from a move. The responder system dispatches the touch props before it\n // clears the session, so the out-of-event channel still has an\n // interaction to negotiate over — and the `onResponderRelease` that\n // follows in the same event is what ends the gesture with success.\n clearActivationTimer()\n decide()\n if (stateNow() === GESTURE_STATE.ACTIVE) {\n if (!runtime.hasResponder) {\n // It activated alongside a gesture that holds the lock, so no\n // `onResponderRelease` is coming for it either.\n finalizeAt(event, true)\n }\n return\n }\n // Nobody granted it — an ancestor holds the interaction, the gesture is\n // not on its path, or the orchestrator parked it behind another. There\n // is no release callback coming, and a discrete gesture whose pointer\n // has lifted cannot be woken later: the interaction it would have taken\n // is over.\n finalizeAt(event, false)\n },\n\n onTouchCancel: (event: GestureResponderEvent) => {\n readConfig().onTouchesCancel?.(\n touchEventOf(event, TOUCH_EVENT_TYPE.TOUCHES_CANCEL),\n stateManager,\n )\n // THIS is where a stolen sequence lands, and why the responder system\n // learned to tell `->DENIED` from an ordinary `drag-end`\n // (`responder/use-responder.ts`). A native ancestor claiming mid-drag\n // used to arrive here as `onTouchEnd`, which for an ACTIVE `Native`\n // gesture would have reported a clean, successful ending of a drag that\n // was actually taken away.\n //\n // An ACTIVE gesture that DID hold the lock is cancelled by\n // `onResponderTerminate`, which the system dispatches after these touch\n // props — finalizing here too would end it twice.\n if (\n runtime.state === GESTURE_STATE.BEGAN ||\n (!runtime.hasResponder && runtime.state === GESTURE_STATE.ACTIVE)\n ) {\n setState(GESTURE_STATE.CANCELLED)\n finalizeAt(event, false)\n }\n },\n }\n\n /**\n * The second entry surface: a GTK controller, for the kinds the pointer\n * stream cannot carry.\n *\n * THREE sources arrive here and the machine cannot tell them apart, which is\n * the point — `GtkGestureZoom`/`GtkGestureRotate` for `Pinch`/`Rotation`,\n * `GtkEventControllerMotion` for `Hover`, `GtkGestureStylus` for\n * `ForceTouch`. What they have in common is everything that matters: no\n * button goes down, so there is no GTK sequence, no responder session and\n * nothing to claim; and the numbers they carry are already in the shape the\n * payload wants.\n *\n * Everything below the entry point is the machine above, unchanged. `begin`\n * does what `onTouchStart` does (record with the orchestrator, BEGAN,\n * `onBegin`), `update` does what `onTouchMove` and `advance` do between them\n * (test the kind's predicate, `decide()`, emit), and `end` does what\n * `onTouchEnd` does. `decide()` is the same call into the same\n * `tryActivate`, and `finalize` is the same one exit.\n *\n * ONE DIFFERENCE FROM `Pan`, and it is upstream's: `scale`, `rotation` and\n * `force` are NOT re-based when the gesture activates. Translation is,\n * because a pan that reported its `activeOffset` as travel would jump the\n * content by the threshold on every drag. Upstream's `scale` is not —\n * `resetProgress()` resets it only while the handler is not yet ACTIVE, so\n * the value that crossed the activation threshold is the value the first\n * `onUpdate` reports. GTK measures from its own recognition point for the\n * same reason, so the two origins already agree and nothing is re-derived.\n */\n const controller: ControllerChannel = {\n begin: (sample: ControllerSample): void => {\n if (!isEnabled() || runtime.state !== GESTURE_STATE.UNDETERMINED) {\n return\n }\n const bounds = env.boundsInWindow()\n const pageX = (bounds?.x ?? 0) + sample.x\n const pageY = (bounds?.y ?? 0) + sample.y\n if (\n bounds !== null &&\n !contains(hitSlopRect(bounds, readConfig().hitSlop), pageX, pageY)\n ) {\n return\n }\n runtime = newRuntime()\n runtime.pressTime = Date.now()\n runtime.lastSampleTime = runtime.pressTime\n runtime.originX = pageX\n runtime.originY = pageY\n runtime.pressX = pageX\n runtime.pressY = pageY\n runtime.lastX = pageX\n runtime.lastY = pageY\n runtime.scale = sample.scale ?? 1\n runtime.rotation = sample.rotation ?? 0\n runtime.force = sample.force ?? 0\n runtime.pointerCount = sample.pointers\n runtime.maxPointerCount = sample.pointers\n setState(GESTURE_STATE.BEGAN)\n // On the gesture, not on mount — the same rule and the same line as\n // `onTouchStart`, and the same islands answer follows from it.\n env.orchestrator.record(participant)\n readConfig().onBegin?.(payloadNow())\n // `Hover` activates on the crossing itself: upstream's\n // `onPointerMoveOver` calls `begin()` and `activate()` one after the\n // other, because a pointer that is over the view IS the gesture and\n // there is nothing further to wait for. Asked through the decider rather\n // than flagged, so it is the same question `onTouchStart` asks of a\n // `Native` that activates on the press.\n if (\n readConfig().manualActivation !== true &&\n decider.shouldActivate(viewOf(), readConfig())\n ) {\n decide()\n }\n },\n\n update: (sample: ControllerSample): void => {\n if (\n runtime.state !== GESTURE_STATE.BEGAN &&\n runtime.state !== GESTURE_STATE.ACTIVE\n ) {\n return\n }\n const scale = sample.scale ?? 1\n const rotation = sample.rotation ?? 0\n const now = Date.now()\n const elapsed = now - runtime.lastSampleTime\n if (elapsed > 0) {\n // Per SECOND, which upstream documents and neither of its web paths\n // computes. See `GestureEventPayload.velocity`.\n runtime.scaleVelocity = ((scale - runtime.scale) / elapsed) * 1000\n runtime.rotationVelocity =\n ((rotation - runtime.rotation) / elapsed) * 1000\n runtime.lastSampleTime = now\n }\n runtime.scale = scale\n runtime.rotation = rotation\n runtime.force = sample.force ?? 0\n runtime.pointerCount = sample.pointers\n runtime.maxPointerCount = Math.max(\n runtime.maxPointerCount,\n sample.pointers,\n )\n const bounds = env.boundsInWindow()\n runtime.lastX = (bounds?.x ?? 0) + sample.x\n runtime.lastY = (bounds?.y ?? 0) + sample.y\n\n const config = readConfig()\n // A kind that can be cancelled by its own numbers while ACTIVE gets the\n // same treatment `advance` gives `LongPress` — `ForceTouch` is the one\n // that wants it, because `maxForce` keeps applying after activation.\n if (\n runtime.state === GESTURE_STATE.ACTIVE &&\n decider.shouldCancelWhileActive?.(viewOf(), config) === true\n ) {\n setState(GESTURE_STATE.CANCELLED)\n finalize(payloadNow, false)\n return\n }\n if (runtime.state === GESTURE_STATE.BEGAN) {\n if (decider.shouldFail(viewOf(), config)) {\n failNow()\n return\n }\n if (config.manualActivation === true) {\n return\n }\n if (!decider.shouldActivate(viewOf(), config)) {\n return\n }\n // The same request into the same loop every other kind makes. It can\n // come back as an activation, as a parking behind\n // `requireExternalGestureToFail`, or as a cancellation.\n decide()\n if (stateNow() !== GESTURE_STATE.ACTIVE) {\n return\n }\n // `onActivate` has just reported this sample; emitting it again as an\n // update would double it, exactly as `advance` refuses the event that\n // granted the responder.\n runtime.changeFromScale = runtime.scale\n runtime.changeFromRotation = runtime.rotation\n runtime.changeFromForce = runtime.force\n return\n }\n const payload = payloadNow()\n config.onUpdate?.(payload)\n config.onChange?.(payload)\n runtime.changeFromX = payload.translationX\n runtime.changeFromY = payload.translationY\n runtime.changeFromScale = runtime.scale\n runtime.changeFromRotation = runtime.rotation\n runtime.changeFromForce = runtime.force\n runtime.hasEmittedUpdate = true\n },\n\n /** GTK's `end`: a success if it activated, a failure if it never did. */\n end: (): void => {\n if (runtime.state === GESTURE_STATE.ACTIVE) {\n finalize(payloadNow, true)\n return\n }\n if (runtime.state === GESTURE_STATE.BEGAN) {\n setState(GESTURE_STATE.FAILED)\n finalize(payloadNow, false)\n }\n },\n\n /** GTK's `cancel`: the sequence was taken away. */\n cancel: (): void => {\n if (\n runtime.state === GESTURE_STATE.BEGAN ||\n runtime.state === GESTURE_STATE.ACTIVE\n ) {\n setState(GESTURE_STATE.CANCELLED)\n finalize(payloadNow, false)\n }\n },\n }\n\n const drivenByController =\n decider.source !== undefined && decider.source !== \"pointer\"\n\n return {\n // Exactly one surface is live. A controller kind that also answered the\n // touch props would begin on a mouse press — `onBegin` on every click, on\n // a gesture that cannot happen — and a pointer kind with a live controller\n // channel would pan on a pinch.\n handlers: drivenByController ? {} : handlers,\n controller: drivenByController ? controller : null,\n participant,\n dispose: () => {\n clearActivationTimer()\n clearDelayTimer()\n env.orchestrator.forget(participant)\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type GestureRef, type GestureRelations } from "./types";
|
|
2
|
+
/** Called by a mounted detector for each gesture it drives, on every render. */
|
|
3
|
+
export declare const bindGestureTag: (spec: object, tag: number) => void;
|
|
4
|
+
/** Called when a detector unmounts. Hygiene: a stale tag is never recorded. */
|
|
5
|
+
export declare const unbindGestureTag: (spec: object) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Every handler tag one relation reference stands for.
|
|
8
|
+
*
|
|
9
|
+
* Three spellings, all upstream's: the gesture itself, a ref built with
|
|
10
|
+
* `withRef()` holding it, or a raw handler tag. A COMPOSED gesture stands for
|
|
11
|
+
* every gesture in it, which is what makes
|
|
12
|
+
* `requireExternalGestureToFail(Gesture.Simultaneous(a, b))` mean what it
|
|
13
|
+
* reads like.
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolveGestureTags: (reference: GestureRef) => number[];
|
|
16
|
+
export type RelationRegistry = {
|
|
17
|
+
/**
|
|
18
|
+
* Replaces every relation recorded for one gesture. Replaces rather than
|
|
19
|
+
* merges, because the config is rebuilt from scratch on every render and a
|
|
20
|
+
* merge would accumulate references to gestures nobody holds any more —
|
|
21
|
+
* upstream shipped exactly that leak (#3763).
|
|
22
|
+
*/
|
|
23
|
+
configure: (tag: number, relations: Partial<GestureRelations>) => void;
|
|
24
|
+
drop: (tag: number) => void;
|
|
25
|
+
/** `tag` must wait for `otherTag` to fail before it may activate. */
|
|
26
|
+
shouldWaitForFailure: (tag: number, otherTag: number) => boolean;
|
|
27
|
+
/** `tag` and `otherTag` may both be ACTIVE at once. */
|
|
28
|
+
shouldRecognizeSimultaneously: (tag: number, otherTag: number) => boolean;
|
|
29
|
+
/** `otherTag` must wait for `tag` — the same relation, declared from the other end. */
|
|
30
|
+
blocks: (tag: number, otherTag: number) => boolean;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* References are stored raw and resolved on every question, rather than
|
|
35
|
+
* resolved to tags once at configure time.
|
|
36
|
+
*
|
|
37
|
+
* That is deliberate and it is what makes cross-component relations work at
|
|
38
|
+
* all: React mounts children before parents and siblings in tree order, so a
|
|
39
|
+
* gesture routinely names one whose detector has not minted its tag yet.
|
|
40
|
+
* Resolving lazily means the answer is correct as soon as both ends are
|
|
41
|
+
* mounted, in whatever order that happened, with no second pass.
|
|
42
|
+
*/
|
|
43
|
+
export declare const createRelationRegistry: () => RelationRegistry;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// The three relation maps, and the identity that makes them mean something.
|
|
2
|
+
//
|
|
3
|
+
// This is upstream's `InteractionManager` under a different name. The rename
|
|
4
|
+
// is not cosmetic: RN's OWN `InteractionManager` ships on this platform too
|
|
5
|
+
// (src/apis), and two unrelated things called the same thing inside one
|
|
6
|
+
// package is a trap somebody eventually falls into. What upstream calls
|
|
7
|
+
// `InteractionManager` is a relation registry and nothing else, so that is
|
|
8
|
+
// what it is called here.
|
|
9
|
+
//
|
|
10
|
+
// IT NEVER TALKS TO GTK, and that is the whole point of the slice. The
|
|
11
|
+
// responder lock is a single global interaction lock with one irrevocable
|
|
12
|
+
// `CLAIMED` on the source; it cannot express `Simultaneous` and must not try,
|
|
13
|
+
// because making it multi-holder would break `PanResponder` and every
|
|
14
|
+
// RN-portable app on this platform. So there are two locks at two levels: the
|
|
15
|
+
// responder lock decides that an interaction belongs to React Native, and
|
|
16
|
+
// this registry — plus the loop in ./orchestrator — decides which gestures
|
|
17
|
+
// are active inside it. Every relation resolves in JS before anything is
|
|
18
|
+
// claimed. See docs/research/gesture-detector.md, "Can the responder lock
|
|
19
|
+
// express this? No — and it should not try".
|
|
20
|
+
//
|
|
21
|
+
// There are exactly three relations and composition is sugar over them:
|
|
22
|
+
//
|
|
23
|
+
// waitFor this gesture must wait for those to fail
|
|
24
|
+
// simultaneousHandlers these two may both be active
|
|
25
|
+
// blocksHandlers those must wait for THIS one
|
|
26
|
+
//
|
|
27
|
+
// Nothing is vendored, adapted or transcribed from `src/web/`; what is
|
|
28
|
+
// reproduced is the behaviour, which docs/research/gesture-detector.md
|
|
29
|
+
// restated as a specification.
|
|
30
|
+
import { isComposedGestureSpec, } from "./types";
|
|
31
|
+
/**
|
|
32
|
+
* Which MOUNTED gesture a spec object stands for.
|
|
33
|
+
*
|
|
34
|
+
* A relation names another gesture by handing over its spec object — that is
|
|
35
|
+
* upstream's `GestureRef` and it is the only identity an app ever holds. The
|
|
36
|
+
* spec is rebuilt on every render by both spellings, so the object cannot BE
|
|
37
|
+
* the identity; what it can do is point at one. A mounted detector binds each
|
|
38
|
+
* of its specs to the handler tag it minted, and the binding is never
|
|
39
|
+
* removed on re-render, so a memoized gesture holding a reference to last
|
|
40
|
+
* render's spec object still resolves to the right live gesture.
|
|
41
|
+
*
|
|
42
|
+
* Weak on purpose: a spec object from a render nobody remembers must not keep
|
|
43
|
+
* anything alive.
|
|
44
|
+
*/
|
|
45
|
+
const tagOfSpec = new WeakMap();
|
|
46
|
+
/** Called by a mounted detector for each gesture it drives, on every render. */
|
|
47
|
+
export const bindGestureTag = (spec, tag) => {
|
|
48
|
+
tagOfSpec.set(spec, tag);
|
|
49
|
+
};
|
|
50
|
+
/** Called when a detector unmounts. Hygiene: a stale tag is never recorded. */
|
|
51
|
+
export const unbindGestureTag = (spec) => {
|
|
52
|
+
tagOfSpec.delete(spec);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Every handler tag one relation reference stands for.
|
|
56
|
+
*
|
|
57
|
+
* Three spellings, all upstream's: the gesture itself, a ref built with
|
|
58
|
+
* `withRef()` holding it, or a raw handler tag. A COMPOSED gesture stands for
|
|
59
|
+
* every gesture in it, which is what makes
|
|
60
|
+
* `requireExternalGestureToFail(Gesture.Simultaneous(a, b))` mean what it
|
|
61
|
+
* reads like.
|
|
62
|
+
*/
|
|
63
|
+
export const resolveGestureTags = (reference) => {
|
|
64
|
+
if (typeof reference === "number") {
|
|
65
|
+
return [reference];
|
|
66
|
+
}
|
|
67
|
+
if (reference === null || typeof reference !== "object") {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
if (isComposedGestureSpec(reference)) {
|
|
71
|
+
return reference.toGestureArray().flatMap(resolveGestureTags);
|
|
72
|
+
}
|
|
73
|
+
const direct = tagOfSpec.get(reference);
|
|
74
|
+
if (direct !== undefined) {
|
|
75
|
+
return [direct];
|
|
76
|
+
}
|
|
77
|
+
// `withRef(ref)` puts the gesture into an ordinary React ref, and upstream's
|
|
78
|
+
// relation methods accept that ref in place of the gesture.
|
|
79
|
+
const current = reference.current;
|
|
80
|
+
return current !== null && typeof current === "object"
|
|
81
|
+
? resolveGestureTags(current)
|
|
82
|
+
: [];
|
|
83
|
+
};
|
|
84
|
+
const containsTag = (references, tag) => references !== undefined &&
|
|
85
|
+
references.some((reference) => resolveGestureTags(reference).includes(tag));
|
|
86
|
+
/**
|
|
87
|
+
* References are stored raw and resolved on every question, rather than
|
|
88
|
+
* resolved to tags once at configure time.
|
|
89
|
+
*
|
|
90
|
+
* That is deliberate and it is what makes cross-component relations work at
|
|
91
|
+
* all: React mounts children before parents and siblings in tree order, so a
|
|
92
|
+
* gesture routinely names one whose detector has not minted its tag yet.
|
|
93
|
+
* Resolving lazily means the answer is correct as soon as both ends are
|
|
94
|
+
* mounted, in whatever order that happened, with no second pass.
|
|
95
|
+
*/
|
|
96
|
+
export const createRelationRegistry = () => {
|
|
97
|
+
const waitForRelations = new Map();
|
|
98
|
+
const simultaneousRelations = new Map();
|
|
99
|
+
const blocksHandlersRelations = new Map();
|
|
100
|
+
const set = (map, tag, references) => {
|
|
101
|
+
if (references === undefined || references.length === 0) {
|
|
102
|
+
map.delete(tag);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
map.set(tag, references);
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
configure: (tag, relations) => {
|
|
109
|
+
set(waitForRelations, tag, relations.waitFor);
|
|
110
|
+
set(simultaneousRelations, tag, relations.simultaneousHandlers);
|
|
111
|
+
set(blocksHandlersRelations, tag, relations.blocksHandlers);
|
|
112
|
+
},
|
|
113
|
+
drop: (tag) => {
|
|
114
|
+
waitForRelations.delete(tag);
|
|
115
|
+
simultaneousRelations.delete(tag);
|
|
116
|
+
blocksHandlersRelations.delete(tag);
|
|
117
|
+
},
|
|
118
|
+
shouldWaitForFailure: (tag, otherTag) => containsTag(waitForRelations.get(tag), otherTag),
|
|
119
|
+
shouldRecognizeSimultaneously: (tag, otherTag) => containsTag(simultaneousRelations.get(tag), otherTag),
|
|
120
|
+
blocks: (tag, otherTag) => containsTag(blocksHandlersRelations.get(tag), otherTag),
|
|
121
|
+
reset: () => {
|
|
122
|
+
waitForRelations.clear();
|
|
123
|
+
simultaneousRelations.clear();
|
|
124
|
+
blocksHandlersRelations.clear();
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=relations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations.js","sourceRoot":"","sources":["../../src/gesture-handler-compat/relations.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,wEAAwE;AACxE,wEAAwE;AACxE,2EAA2E;AAC3E,0BAA0B;AAC1B,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,EAAE;AACF,iEAAiE;AACjE,uDAAuD;AACvD,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,+BAA+B;AAC/B,OAAO,EACL,qBAAqB,GAGtB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;GAaG;AACH,MAAM,SAAS,GAAG,IAAI,OAAO,EAAkB,CAAA;AAE/C,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,GAAW,EAAQ,EAAE;IAChE,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA;AAED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AQ,CAAC;QAEvD,MAAM,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CACxB,WAAW,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;QAEzD,KAAK,EAAE,GAAG,EAAE;YACV,gBAAgB,CAAC,KAAK,EAAE,CAAA;YACxB,qBAAqB,CAAC,KAAK,EAAE,CAAA;YAC7B,uBAAuB,CAAC,KAAK,EAAE,CAAA;QACjC,CAAC;KACF,CAAA;AACH,CAAC,CAAA","sourcesContent":["// The three relation maps, and the identity that makes them mean something.\n//\n// This is upstream's `InteractionManager` under a different name. The rename\n// is not cosmetic: RN's OWN `InteractionManager` ships on this platform too\n// (src/apis), and two unrelated things called the same thing inside one\n// package is a trap somebody eventually falls into. What upstream calls\n// `InteractionManager` is a relation registry and nothing else, so that is\n// what it is called here.\n//\n// IT NEVER TALKS TO GTK, and that is the whole point of the slice. The\n// responder lock is a single global interaction lock with one irrevocable\n// `CLAIMED` on the source; it cannot express `Simultaneous` and must not try,\n// because making it multi-holder would break `PanResponder` and every\n// RN-portable app on this platform. So there are two locks at two levels: the\n// responder lock decides that an interaction belongs to React Native, and\n// this registry — plus the loop in ./orchestrator — decides which gestures\n// are active inside it. Every relation resolves in JS before anything is\n// claimed. See docs/research/gesture-detector.md, \"Can the responder lock\n// express this? No — and it should not try\".\n//\n// There are exactly three relations and composition is sugar over them:\n//\n// waitFor this gesture must wait for those to fail\n// simultaneousHandlers these two may both be active\n// blocksHandlers those must wait for THIS one\n//\n// Nothing is vendored, adapted or transcribed from `src/web/`; what is\n// reproduced is the behaviour, which docs/research/gesture-detector.md\n// restated as a specification.\nimport {\n isComposedGestureSpec,\n type GestureRef,\n type GestureRelations,\n} from \"./types\"\n\n/**\n * Which MOUNTED gesture a spec object stands for.\n *\n * A relation names another gesture by handing over its spec object — that is\n * upstream's `GestureRef` and it is the only identity an app ever holds. The\n * spec is rebuilt on every render by both spellings, so the object cannot BE\n * the identity; what it can do is point at one. A mounted detector binds each\n * of its specs to the handler tag it minted, and the binding is never\n * removed on re-render, so a memoized gesture holding a reference to last\n * render's spec object still resolves to the right live gesture.\n *\n * Weak on purpose: a spec object from a render nobody remembers must not keep\n * anything alive.\n */\nconst tagOfSpec = new WeakMap<object, number>()\n\n/** Called by a mounted detector for each gesture it drives, on every render. */\nexport const bindGestureTag = (spec: object, tag: number): void => {\n tagOfSpec.set(spec, tag)\n}\n\n/** Called when a detector unmounts. Hygiene: a stale tag is never recorded. */\nexport const unbindGestureTag = (spec: object): void => {\n tagOfSpec.delete(spec)\n}\n\n/**\n * Every handler tag one relation reference stands for.\n *\n * Three spellings, all upstream's: the gesture itself, a ref built with\n * `withRef()` holding it, or a raw handler tag. A COMPOSED gesture stands for\n * every gesture in it, which is what makes\n * `requireExternalGestureToFail(Gesture.Simultaneous(a, b))` mean what it\n * reads like.\n */\nexport const resolveGestureTags = (reference: GestureRef): number[] => {\n if (typeof reference === \"number\") {\n return [reference]\n }\n if (reference === null || typeof reference !== \"object\") {\n return []\n }\n if (isComposedGestureSpec(reference)) {\n return reference.toGestureArray().flatMap(resolveGestureTags)\n }\n const direct = tagOfSpec.get(reference)\n if (direct !== undefined) {\n return [direct]\n }\n // `withRef(ref)` puts the gesture into an ordinary React ref, and upstream's\n // relation methods accept that ref in place of the gesture.\n const current = (reference as { current?: unknown }).current\n return current !== null && typeof current === \"object\"\n ? resolveGestureTags(current as GestureRef)\n : []\n}\n\nconst containsTag = (\n references: readonly GestureRef[] | undefined,\n tag: number,\n): boolean =>\n references !== undefined &&\n references.some((reference) => resolveGestureTags(reference).includes(tag))\n\nexport type RelationRegistry = {\n /**\n * Replaces every relation recorded for one gesture. Replaces rather than\n * merges, because the config is rebuilt from scratch on every render and a\n * merge would accumulate references to gestures nobody holds any more —\n * upstream shipped exactly that leak (#3763).\n */\n configure: (tag: number, relations: Partial<GestureRelations>) => void\n drop: (tag: number) => void\n /** `tag` must wait for `otherTag` to fail before it may activate. */\n shouldWaitForFailure: (tag: number, otherTag: number) => boolean\n /** `tag` and `otherTag` may both be ACTIVE at once. */\n shouldRecognizeSimultaneously: (tag: number, otherTag: number) => boolean\n /** `otherTag` must wait for `tag` — the same relation, declared from the other end. */\n blocks: (tag: number, otherTag: number) => boolean\n reset: () => void\n}\n\n/**\n * References are stored raw and resolved on every question, rather than\n * resolved to tags once at configure time.\n *\n * That is deliberate and it is what makes cross-component relations work at\n * all: React mounts children before parents and siblings in tree order, so a\n * gesture routinely names one whose detector has not minted its tag yet.\n * Resolving lazily means the answer is correct as soon as both ends are\n * mounted, in whatever order that happened, with no second pass.\n */\nexport const createRelationRegistry = (): RelationRegistry => {\n const waitForRelations = new Map<number, readonly GestureRef[]>()\n const simultaneousRelations = new Map<number, readonly GestureRef[]>()\n const blocksHandlersRelations = new Map<number, readonly GestureRef[]>()\n\n const set = (\n map: Map<number, readonly GestureRef[]>,\n tag: number,\n references: readonly GestureRef[] | undefined,\n ): void => {\n if (references === undefined || references.length === 0) {\n map.delete(tag)\n return\n }\n map.set(tag, references)\n }\n\n return {\n configure: (tag, relations) => {\n set(waitForRelations, tag, relations.waitFor)\n set(simultaneousRelations, tag, relations.simultaneousHandlers)\n set(blocksHandlersRelations, tag, relations.blocksHandlers)\n },\n\n drop: (tag) => {\n waitForRelations.delete(tag)\n simultaneousRelations.delete(tag)\n blocksHandlersRelations.delete(tag)\n },\n\n shouldWaitForFailure: (tag, otherTag) =>\n containsTag(waitForRelations.get(tag), otherTag),\n\n shouldRecognizeSimultaneously: (tag, otherTag) =>\n containsTag(simultaneousRelations.get(tag), otherTag),\n\n blocks: (tag, otherTag) =>\n containsTag(blocksHandlersRelations.get(tag), otherTag),\n\n reset: () => {\n waitForRelations.clear()\n simultaneousRelations.clear()\n blocksHandlersRelations.clear()\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RecognizerDecider } from "./recognizer";
|
|
2
|
+
/** Upstream's `DEFAULT_MAX_DURATION_MS`. */
|
|
3
|
+
export declare const DEFAULT_MAX_DURATION = 500;
|
|
4
|
+
/** Upstream's `DEFAULT_MAX_DELAY_MS`. */
|
|
5
|
+
export declare const DEFAULT_MAX_DELAY = 500;
|
|
6
|
+
export declare const tapDecider: RecognizerDecider;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Upstream's `DEFAULT_MAX_DURATION_MS`. */
|
|
2
|
+
export const DEFAULT_MAX_DURATION = 500;
|
|
3
|
+
/** Upstream's `DEFAULT_MAX_DELAY_MS`. */
|
|
4
|
+
export const DEFAULT_MAX_DELAY = 500;
|
|
5
|
+
const exceeds = (value, limit) => limit !== undefined && Math.abs(value) > limit;
|
|
6
|
+
export const tapDecider = {
|
|
7
|
+
kind: "tap",
|
|
8
|
+
/** The deadline, re-armed on every press of the sequence. */
|
|
9
|
+
timer: (config) => ({
|
|
10
|
+
delay: config.maxDuration ?? DEFAULT_MAX_DURATION,
|
|
11
|
+
elapsed: "fail",
|
|
12
|
+
}),
|
|
13
|
+
shouldFail: (view, config) => exceeds(view.translationX, config.maxDeltaX) ||
|
|
14
|
+
exceeds(view.translationY, config.maxDeltaY) ||
|
|
15
|
+
exceeds(view.distanceFromPress, config.maxDistance),
|
|
16
|
+
// Never from movement: a tap that activated while the pointer was still
|
|
17
|
+
// down would be a press, and would take the interaction away from whatever
|
|
18
|
+
// pan is watching the same view.
|
|
19
|
+
shouldActivate: () => false,
|
|
20
|
+
onRelease: (view, config) => {
|
|
21
|
+
const wanted = config.numberOfTaps ?? 1;
|
|
22
|
+
if (view.taps >= wanted &&
|
|
23
|
+
view.maxPointerCount >= (config.minPointers ?? 1)) {
|
|
24
|
+
return { kind: "activate" };
|
|
25
|
+
}
|
|
26
|
+
return { kind: "await", delay: config.maxDelay ?? DEFAULT_MAX_DELAY };
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=tap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.js","s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AAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,IAAI,iBAAiB,EAAE,CAAA;IACvE,CAAC;CACF,CAAA","sourcesContent":["// Tap's predicates, over the same machine `Pan` runs on.\n//\n// A tap is the one kind whose activation criterion is the pointer coming back\n// UP, and the whole of it is three numbers and a counter:\n//\n// - `maxDuration` is a deadline armed on every press. It fires while the\n// pointer is still down, and firing kills the tap — a press held too long\n// is not a tap, it is a press.\n// - `maxDelay` is the gap between taps. On a release that has not completed\n// the sequence the gesture stays BEGAN, holding nothing, and this timer is\n// what eventually gives up.\n// - `maxDistance` / `maxDeltaX` / `maxDeltaY` fail a press that travelled.\n// This is the tap-vs-drag disambiguation and it is the reason a tap and a\n// pan can share a view at all.\n//\n// Restated from `src/web/handlers/TapGestureHandler.ts` at 3.1.0, not\n// transcribed. Two of its details are worth naming because they look like\n// bugs and are not:\n//\n// - there is **no default `maxDistance`**. Upstream initialises all three\n// distance limits to `Number.MIN_SAFE_INTEGER` and treats that as \"unset\",\n// so an unconfigured tap accepts any travel that stays inside the view and\n// lifts in time. `shouldCancelWhenOutside` (which `Gesture.Tap()` turns on\n// in its constructor) is what actually bounds it. Inventing a default here\n// would refuse taps upstream accepts;\n// - `minPointers` is checked against the MOST pointers the interaction ever\n// had at once, not the count at release, which by then is zero.\nimport type {\n RecognizerDecider,\n RecognizerTimer,\n RecognizerView,\n ReleaseOutcome,\n} from \"./recognizer\"\nimport type { RecognizerConfig } from \"./types\"\n\n/** Upstream's `DEFAULT_MAX_DURATION_MS`. */\nexport const DEFAULT_MAX_DURATION = 500\n/** Upstream's `DEFAULT_MAX_DELAY_MS`. */\nexport const DEFAULT_MAX_DELAY = 500\n\nconst exceeds = (value: number, limit: number | undefined): boolean =>\n limit !== undefined && Math.abs(value) > limit\n\nexport const tapDecider: RecognizerDecider = {\n kind: \"tap\",\n\n /** The deadline, re-armed on every press of the sequence. */\n timer: (config: RecognizerConfig): RecognizerTimer => ({\n delay: config.maxDuration ?? DEFAULT_MAX_DURATION,\n elapsed: \"fail\",\n }),\n\n shouldFail: (view: RecognizerView, config: RecognizerConfig): boolean =>\n exceeds(view.translationX, config.maxDeltaX) ||\n exceeds(view.translationY, config.maxDeltaY) ||\n exceeds(view.distanceFromPress, config.maxDistance),\n\n // Never from movement: a tap that activated while the pointer was still\n // down would be a press, and would take the interaction away from whatever\n // pan is watching the same view.\n shouldActivate: (): boolean => false,\n\n onRelease: (\n view: RecognizerView,\n config: RecognizerConfig,\n ): ReleaseOutcome => {\n const wanted = config.numberOfTaps ?? 1\n if (\n view.taps >= wanted &&\n view.maxPointerCount >= (config.minPointers ?? 1)\n ) {\n return { kind: \"activate\" }\n }\n return { kind: \"await\", delay: config.maxDelay ?? DEFAULT_MAX_DELAY }\n },\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RecognizerDecider } from "./recognizer";
|
|
2
|
+
import type { RecognizerConfig } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Upstream's `ROTATION_RECOGNITION_THRESHOLD`
|
|
5
|
+
* (`src/web/handlers/RotationGestureHandler.ts` at 3.1.0), reproduced exactly:
|
|
6
|
+
* five degrees of accumulated rotation activates the gesture.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ROTATION_RECOGNITION_THRESHOLD: number;
|
|
9
|
+
/**
|
|
10
|
+
* Five percent of scale change activates a pinch — and this number is OURS,
|
|
11
|
+
* which is the one place these two recognizers do not restate upstream.
|
|
12
|
+
*
|
|
13
|
+
* Upstream's gate is two stages of pixels: `ScaleGestureDetector` reports
|
|
14
|
+
* nothing until the span between the two touches has changed by more than
|
|
15
|
+
* `spanSlop` (`DEFAULT_TOUCH_SLOP * 2`, 30px), and `PinchGestureHandler` then
|
|
16
|
+
* activates after a further `DEFAULT_TOUCH_SLOP` (15px) from wherever that
|
|
17
|
+
* opened. Both are arithmetic over two touch POSITIONS, and a touchpad pinch
|
|
18
|
+
* has none: libinput hands the compositor a ratio and GDK hands GTK a ratio,
|
|
19
|
+
* so there is no span in pixels anywhere in this chain to measure 45 of.
|
|
20
|
+
*
|
|
21
|
+
* What makes a small threshold the right restatement rather than a weaker one
|
|
22
|
+
* is where upstream's slop sits in the pipeline. Upstream's is the FIRST
|
|
23
|
+
* decision that a pinch is happening at all — nothing below it filters. Here
|
|
24
|
+
* libinput has already made that decision: it will not emit
|
|
25
|
+
* `GESTURE_PINCH_BEGIN` until it has classified the two fingers' motion as a
|
|
26
|
+
* pinch rather than a two-finger scroll, which is a threshold of its own and a
|
|
27
|
+
* stricter one. Measured with the virtual touchpad, the first `scale-changed`
|
|
28
|
+
* after `begin` already reports about 1.09. So this gate is a second, smaller
|
|
29
|
+
* one, and setting it at upstream's effective magnitude would refuse pinches
|
|
30
|
+
* the platform has already accepted.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PINCH_RECOGNITION_THRESHOLD = 0.05;
|
|
33
|
+
export declare const pinchDecider: RecognizerDecider;
|
|
34
|
+
export declare const rotationDecider: RecognizerDecider;
|
|
35
|
+
/**
|
|
36
|
+
* Upstream sets `shouldCancelWhenOutside = false` from both handlers' `init`,
|
|
37
|
+
* against a base class that defaults it on for several other kinds. Applied
|
|
38
|
+
* from the builders' constructors here, which is where this module puts every
|
|
39
|
+
* other constructor-set default.
|
|
40
|
+
*/
|
|
41
|
+
export declare const TOUCHPAD_DEFAULTS: Partial<RecognizerConfig>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upstream's `ROTATION_RECOGNITION_THRESHOLD`
|
|
3
|
+
* (`src/web/handlers/RotationGestureHandler.ts` at 3.1.0), reproduced exactly:
|
|
4
|
+
* five degrees of accumulated rotation activates the gesture.
|
|
5
|
+
*/
|
|
6
|
+
export const ROTATION_RECOGNITION_THRESHOLD = Math.PI / 36;
|
|
7
|
+
/**
|
|
8
|
+
* Five percent of scale change activates a pinch — and this number is OURS,
|
|
9
|
+
* which is the one place these two recognizers do not restate upstream.
|
|
10
|
+
*
|
|
11
|
+
* Upstream's gate is two stages of pixels: `ScaleGestureDetector` reports
|
|
12
|
+
* nothing until the span between the two touches has changed by more than
|
|
13
|
+
* `spanSlop` (`DEFAULT_TOUCH_SLOP * 2`, 30px), and `PinchGestureHandler` then
|
|
14
|
+
* activates after a further `DEFAULT_TOUCH_SLOP` (15px) from wherever that
|
|
15
|
+
* opened. Both are arithmetic over two touch POSITIONS, and a touchpad pinch
|
|
16
|
+
* has none: libinput hands the compositor a ratio and GDK hands GTK a ratio,
|
|
17
|
+
* so there is no span in pixels anywhere in this chain to measure 45 of.
|
|
18
|
+
*
|
|
19
|
+
* What makes a small threshold the right restatement rather than a weaker one
|
|
20
|
+
* is where upstream's slop sits in the pipeline. Upstream's is the FIRST
|
|
21
|
+
* decision that a pinch is happening at all — nothing below it filters. Here
|
|
22
|
+
* libinput has already made that decision: it will not emit
|
|
23
|
+
* `GESTURE_PINCH_BEGIN` until it has classified the two fingers' motion as a
|
|
24
|
+
* pinch rather than a two-finger scroll, which is a threshold of its own and a
|
|
25
|
+
* stricter one. Measured with the virtual touchpad, the first `scale-changed`
|
|
26
|
+
* after `begin` already reports about 1.09. So this gate is a second, smaller
|
|
27
|
+
* one, and setting it at upstream's effective magnitude would refuse pinches
|
|
28
|
+
* the platform has already accepted.
|
|
29
|
+
*/
|
|
30
|
+
export const PINCH_RECOGNITION_THRESHOLD = 0.05;
|
|
31
|
+
const magnitude = (view) => Math.abs(view.scale - 1);
|
|
32
|
+
export const pinchDecider = {
|
|
33
|
+
kind: "pinch",
|
|
34
|
+
// See the file header: there is no press, so there is no interaction lock
|
|
35
|
+
// to take. Every update arrives through `Recognizer.touchpad` instead.
|
|
36
|
+
claimsResponder: false,
|
|
37
|
+
source: "touchpad",
|
|
38
|
+
/**
|
|
39
|
+
* Never from the gesture itself. Upstream's pinch has no failure predicate
|
|
40
|
+
* over movement at all, and it goes further: `PinchGestureHandler.init` sets
|
|
41
|
+
* `shouldCancelWhenOutside = false` explicitly, so a pinch whose focal point
|
|
42
|
+
* wanders off the view keeps running. It fails when GTK ends the gesture
|
|
43
|
+
* before it ever activated, which is the shared machine's own rule.
|
|
44
|
+
*/
|
|
45
|
+
shouldFail: () => false,
|
|
46
|
+
shouldActivate: (view) => magnitude(view) >= PINCH_RECOGNITION_THRESHOLD,
|
|
47
|
+
};
|
|
48
|
+
export const rotationDecider = {
|
|
49
|
+
kind: "rotation",
|
|
50
|
+
claimsResponder: false,
|
|
51
|
+
source: "touchpad",
|
|
52
|
+
shouldFail: () => false,
|
|
53
|
+
shouldActivate: (view) => Math.abs(view.rotation) >= ROTATION_RECOGNITION_THRESHOLD,
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Upstream sets `shouldCancelWhenOutside = false` from both handlers' `init`,
|
|
57
|
+
* against a base class that defaults it on for several other kinds. Applied
|
|
58
|
+
* from the builders' constructors here, which is where this module puts every
|
|
59
|
+
* other constructor-set default.
|
|
60
|
+
*/
|
|
61
|
+
export const TOUCHPAD_DEFAULTS = {
|
|
62
|
+
shouldCancelWhenOutside: false,
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=touchpad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchpad.js","sourceRoot":"","sources":["../../src/gesture-handler-compat/touchpad.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAA;AAE/C,MAAM,SAAS,GAAG,CAAC,IAAoB,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;AAE5E,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,IAAI,EAAE,OAAO;IACb,0EAA0E;IAC1E,uEAAuE;IACvE,eAAe,EAAE,KAAK;IACtB,MAAM,EAAE,UAAU;IAElB;;;;;;OAMG;IACH,UAAU,EAAE,GAAY,EAAE,CAAC,KAAK;IAEhC,cAAc,EAAE,CAAC,IAAoB,EAAW,EAAE,CAChD,SAAS,CAAC,IAAI,CAAC,IAAI,2BAA2B;CACjD,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,IAAI,EAAE,UAAU;IAChB,eAAe,EAAE,KAAK;IACtB,MAAM,EAAE,UAAU;IAElB,UAAU,EAAE,GAAY,EAAE,CAAC,KAAK;IAEhC,cAAc,EAAE,CAAC,IAAoB,EAAW,EAAE,CAChD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,8BAA8B;CAC5D,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,uBAAuB,EAAE,KAAK;CAC/B,CAAA","sourcesContent":["// `Gesture.Pinch()` and `Gesture.Rotation()` — the two recognizers whose raw\n// numbers come from GTK rather than from the pointer stream.\n//\n// WHY THEY ARE DIFFERENT AT ALL, and it is one sentence: this platform has one\n// pointer. Upstream's `PinchGestureHandler` runs a `ScaleGestureDetector` over\n// two tracked pointers and needs two real touches; there are none here and no\n// protocol to synthesize one. What there IS instead is better —\n// `gtk_gesture_zoom_filter_event` lets `GDK_TOUCHPAD_PINCH` through when\n// `gdk_touchpad_event_get_n_fingers() == 2` and `_gtk_gesture_zoom_get_distance`\n// reads `gdk_touchpad_event_get_pinch_scale()` straight off the event rather\n// than computing it from two points. So a TOUCHPAD pinch drives\n// `GtkGestureZoom` with no touchscreen involved, which is a path RNGH's own\n// single-runtime implementation does not have.\n//\n// WHAT IS SHARED, which is everything that matters: the state machine, the\n// callbacks, the payload, `tryActivate`, the relation maps, `makeActive`'s\n// broadcast cancel and `finished`. ./recognizer runs one machine with two\n// entry surfaces — the touch/responder props for the pointer kinds, and\n// `Recognizer.controller` for the kinds a GTK controller feeds — and only the\n// entry surface differs. There is no second arbitration path and no second\n// registry. `Hover` and `ForceTouch` arrive on that same channel from\n// `GtkEventControllerMotion` and `GtkGestureStylus`, which is why it is named\n// for the controller rather than for the touchpad.\n//\n// THEY NEVER TAKE THE RESPONDER (`claimsResponder: false`), for a reason that\n// is structural rather than a policy: the responder lock is a lock over an\n// INTERACTION, and an interaction here starts with a press. A touchpad pinch\n// has no button down, so there is no session to take, nothing to transfer and\n// no GTK sequence to claim. `Native` reaches the same flag from the opposite\n// direction — it has a sequence and must not claim it — and both end up on the\n// touch-prop update pump, which is why one flag covers both.\nimport type { RecognizerDecider, RecognizerView } from \"./recognizer\"\nimport type { RecognizerConfig } from \"./types\"\n\n/**\n * Upstream's `ROTATION_RECOGNITION_THRESHOLD`\n * (`src/web/handlers/RotationGestureHandler.ts` at 3.1.0), reproduced exactly:\n * five degrees of accumulated rotation activates the gesture.\n */\nexport const ROTATION_RECOGNITION_THRESHOLD = Math.PI / 36\n\n/**\n * Five percent of scale change activates a pinch — and this number is OURS,\n * which is the one place these two recognizers do not restate upstream.\n *\n * Upstream's gate is two stages of pixels: `ScaleGestureDetector` reports\n * nothing until the span between the two touches has changed by more than\n * `spanSlop` (`DEFAULT_TOUCH_SLOP * 2`, 30px), and `PinchGestureHandler` then\n * activates after a further `DEFAULT_TOUCH_SLOP` (15px) from wherever that\n * opened. Both are arithmetic over two touch POSITIONS, and a touchpad pinch\n * has none: libinput hands the compositor a ratio and GDK hands GTK a ratio,\n * so there is no span in pixels anywhere in this chain to measure 45 of.\n *\n * What makes a small threshold the right restatement rather than a weaker one\n * is where upstream's slop sits in the pipeline. Upstream's is the FIRST\n * decision that a pinch is happening at all — nothing below it filters. Here\n * libinput has already made that decision: it will not emit\n * `GESTURE_PINCH_BEGIN` until it has classified the two fingers' motion as a\n * pinch rather than a two-finger scroll, which is a threshold of its own and a\n * stricter one. Measured with the virtual touchpad, the first `scale-changed`\n * after `begin` already reports about 1.09. So this gate is a second, smaller\n * one, and setting it at upstream's effective magnitude would refuse pinches\n * the platform has already accepted.\n */\nexport const PINCH_RECOGNITION_THRESHOLD = 0.05\n\nconst magnitude = (view: RecognizerView): number => Math.abs(view.scale - 1)\n\nexport const pinchDecider: RecognizerDecider = {\n kind: \"pinch\",\n // See the file header: there is no press, so there is no interaction lock\n // to take. Every update arrives through `Recognizer.touchpad` instead.\n claimsResponder: false,\n source: \"touchpad\",\n\n /**\n * Never from the gesture itself. Upstream's pinch has no failure predicate\n * over movement at all, and it goes further: `PinchGestureHandler.init` sets\n * `shouldCancelWhenOutside = false` explicitly, so a pinch whose focal point\n * wanders off the view keeps running. It fails when GTK ends the gesture\n * before it ever activated, which is the shared machine's own rule.\n */\n shouldFail: (): boolean => false,\n\n shouldActivate: (view: RecognizerView): boolean =>\n magnitude(view) >= PINCH_RECOGNITION_THRESHOLD,\n}\n\nexport const rotationDecider: RecognizerDecider = {\n kind: \"rotation\",\n claimsResponder: false,\n source: \"touchpad\",\n\n shouldFail: (): boolean => false,\n\n shouldActivate: (view: RecognizerView): boolean =>\n Math.abs(view.rotation) >= ROTATION_RECOGNITION_THRESHOLD,\n}\n\n/**\n * Upstream sets `shouldCancelWhenOutside = false` from both handlers' `init`,\n * against a base class that defaults it on for several other kinds. Applied\n * from the builders' constructors here, which is where this module puts every\n * other constructor-set default.\n */\nexport const TOUCHPAD_DEFAULTS: Partial<RecognizerConfig> = {\n shouldCancelWhenOutside: false,\n}\n"]}
|