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,513 @@
|
|
|
1
|
+
// Spelling one: `Gesture.Pan()` / `.Tap()` / `.LongPress()`, the chainable
|
|
2
|
+
// builders.
|
|
3
|
+
//
|
|
4
|
+
// Deprecated upstream since 3.1.0 — every one of the twelve `Gesture.*`
|
|
5
|
+
// statics carries an `@deprecated` tag pointing at a hook — and it is still
|
|
6
|
+
// what every shipped consumer calls, which is why it is the spelling that had
|
|
7
|
+
// to work first. It is a facade: each method writes one value into a
|
|
8
|
+
// `RecognizerConfig` and returns `this`, and the object it builds is a
|
|
9
|
+
// `GestureSpec` and nothing more.
|
|
10
|
+
//
|
|
11
|
+
// The class split mirrors upstream's. `BaseGestureBuilder` is its
|
|
12
|
+
// `BaseGesture` — everything the three kinds share — and `onUpdate`/`onChange`
|
|
13
|
+
// live on `PanGestureBuilder` alone because upstream puts them on
|
|
14
|
+
// `ContinousBaseGesture`, which `TapGesture` and `LongPressGesture` do not
|
|
15
|
+
// extend. A discrete gesture has no travel to report.
|
|
16
|
+
//
|
|
17
|
+
// The callback renames are where the two spellings genuinely differ.
|
|
18
|
+
// `onStart` and `onEnd` here are `onActivate` and `onDeactivate` internally,
|
|
19
|
+
// `onTouchesCancelled` is `onTouchesCancel`, and `onChange` — which the hook
|
|
20
|
+
// spelling dropped — is an ordinary callback over the same payload, because
|
|
21
|
+
// the payload already carries `changeX`/`changeY`.
|
|
22
|
+
import { exclusiveGestures, raceGestures, simultaneousGestures, } from "./composition";
|
|
23
|
+
/**
|
|
24
|
+
* Everything upstream's `BaseGesture` has, which is everything the three
|
|
25
|
+
* implemented kinds share. Not a port of it: it holds no handler tag and no
|
|
26
|
+
* worklet machinery, because on this platform there is one runtime and a
|
|
27
|
+
* handler tag identifies a MOUNTED gesture rather than a built one. The
|
|
28
|
+
* relations it does hold are lists of references and nothing else — the maps
|
|
29
|
+
* that read them live in ./relations, and the loop that acts on them in
|
|
30
|
+
* ./orchestrator.
|
|
31
|
+
*
|
|
32
|
+
* `onUpdate` and `onChange` are deliberately NOT here. Upstream puts them on
|
|
33
|
+
* `ContinousBaseGesture`, which `Tap` and `LongPress` do not extend — they are
|
|
34
|
+
* discrete, they have no travel to report, and offering the methods would
|
|
35
|
+
* invite a callback that never fires.
|
|
36
|
+
*/
|
|
37
|
+
class BaseGestureBuilder {
|
|
38
|
+
config = {};
|
|
39
|
+
// --- common configuration ---
|
|
40
|
+
enabled(value) {
|
|
41
|
+
this.config.enabled = value;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
shouldCancelWhenOutside(value) {
|
|
45
|
+
this.config.shouldCancelWhenOutside = value;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
hitSlop(value) {
|
|
49
|
+
this.config.hitSlop = value;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
manualActivation(value) {
|
|
53
|
+
this.config.manualActivation = value;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
// --- callbacks ---
|
|
57
|
+
onBegin(callback) {
|
|
58
|
+
this.config.onBegin = callback;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
onStart(callback) {
|
|
62
|
+
this.config.onActivate = callback;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
onEnd(callback) {
|
|
66
|
+
this.config.onDeactivate = callback;
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
onFinalize(callback) {
|
|
70
|
+
this.config.onFinalize = callback;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
onTouchesDown(callback) {
|
|
74
|
+
this.config.onTouchesDown = callback;
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
onTouchesMove(callback) {
|
|
78
|
+
this.config.onTouchesMove = callback;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
onTouchesUp(callback) {
|
|
82
|
+
this.config.onTouchesUp = callback;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
onTouchesCancelled(callback) {
|
|
86
|
+
this.config.onTouchesCancel = callback;
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Recorded and not acted on, exactly as upstream does not act on it off its
|
|
91
|
+
* worklet platforms: gesture callbacks are worklets by default there and
|
|
92
|
+
* this asks for the JS runtime instead. There is one runtime here, so every
|
|
93
|
+
* callback already runs where this is asking it to. `@gorhom/bottom-sheet`
|
|
94
|
+
* sets it twice; making it throw would refuse code that is already correct.
|
|
95
|
+
*
|
|
96
|
+
* Recorded rather than discarded so the config still describes what the app
|
|
97
|
+
* asked for — the orchestrator and any devtools read this object.
|
|
98
|
+
*/
|
|
99
|
+
runOnJS(value) {
|
|
100
|
+
this.config.runOnJS = value;
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Platform-specific upstream and inert here, which is upstream's own
|
|
105
|
+
* treatment of them off their platforms: `averageTouches` is Android-only,
|
|
106
|
+
* `enableTrackpadTwoFingerGesture` and `cancelsTouchesInView` are iOS-only,
|
|
107
|
+
* `activeCursor` and `mouseButton` are Web-only. Accepting them keeps
|
|
108
|
+
* portable source portable; docs/api.md records that they do nothing.
|
|
109
|
+
*/
|
|
110
|
+
averageTouches(value) {
|
|
111
|
+
this.config.averageTouches = value;
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
enableTrackpadTwoFingerGesture(value) {
|
|
115
|
+
this.config.enableTrackpadTwoFingerGesture = value;
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
cancelsTouchesInView(value) {
|
|
119
|
+
this.config.cancelsTouchesInView = value;
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
activeCursor(value) {
|
|
123
|
+
this.config.activeCursor = value;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
mouseButton(value) {
|
|
127
|
+
this.config.mouseButton = value;
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
/** Upstream stores a ref for the relation APIs; harmless to honour early. */
|
|
131
|
+
withRef(ref) {
|
|
132
|
+
ref.current = this;
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
withTestId(id) {
|
|
136
|
+
this.config.testId = id;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
/** Upstream's flattening hook for composed gestures; a lone gesture is a list of one. */
|
|
140
|
+
toGestureArray() {
|
|
141
|
+
return [this];
|
|
142
|
+
}
|
|
143
|
+
// --- the relations ---
|
|
144
|
+
//
|
|
145
|
+
// Three methods, three lists, one place they are read: the maps in
|
|
146
|
+
// ./relations. Each of them writes a list of REFERENCES rather than tags —
|
|
147
|
+
// an app names another gesture with the gesture object it built, and the
|
|
148
|
+
// tag that identifies a mounted one does not exist until a detector mounts
|
|
149
|
+
// it. `withRef()` and a raw tag are accepted in the same position, as
|
|
150
|
+
// upstream's `GestureRef` is.
|
|
151
|
+
//
|
|
152
|
+
// Appending rather than replacing: `.simultaneousWithExternalGesture(a)`
|
|
153
|
+
// followed by `.simultaneousWithExternalGesture(b)` means both, which is
|
|
154
|
+
// what chaining reads like. The builder is rebuilt every render by every
|
|
155
|
+
// app that follows upstream's own advice, so nothing accumulates across
|
|
156
|
+
// renders — and composition computes rather than writes back here, so it
|
|
157
|
+
// cannot accumulate either.
|
|
158
|
+
simultaneousWithExternalGesture(...gestures) {
|
|
159
|
+
this.config.simultaneousHandlers = [
|
|
160
|
+
...(this.config.simultaneousHandlers ?? []),
|
|
161
|
+
...gestures,
|
|
162
|
+
];
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
requireExternalGestureToFail(...gestures) {
|
|
166
|
+
this.config.waitFor = [...(this.config.waitFor ?? []), ...gestures];
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
blocksExternalGesture(...gestures) {
|
|
170
|
+
this.config.blocksHandlers = [
|
|
171
|
+
...(this.config.blocksHandlers ?? []),
|
|
172
|
+
...gestures,
|
|
173
|
+
];
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** `Gesture.Pan()`, and the only one of the three that reports travel. */
|
|
178
|
+
export class PanGestureBuilder extends BaseGestureBuilder {
|
|
179
|
+
kind = "pan";
|
|
180
|
+
// --- activation and failure bounds ---
|
|
181
|
+
activeOffsetX(offset) {
|
|
182
|
+
this.config.activeOffsetX = offset;
|
|
183
|
+
return this;
|
|
184
|
+
}
|
|
185
|
+
activeOffsetY(offset) {
|
|
186
|
+
this.config.activeOffsetY = offset;
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
failOffsetX(offset) {
|
|
190
|
+
this.config.failOffsetX = offset;
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
failOffsetY(offset) {
|
|
194
|
+
this.config.failOffsetY = offset;
|
|
195
|
+
return this;
|
|
196
|
+
}
|
|
197
|
+
minDistance(distance) {
|
|
198
|
+
this.config.minDistance = distance;
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
minVelocity(velocity) {
|
|
202
|
+
this.config.minVelocity = velocity;
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
minVelocityX(velocity) {
|
|
206
|
+
this.config.minVelocityX = velocity;
|
|
207
|
+
return this;
|
|
208
|
+
}
|
|
209
|
+
minVelocityY(velocity) {
|
|
210
|
+
this.config.minVelocityY = velocity;
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
minPointers(count) {
|
|
214
|
+
this.config.minPointers = count;
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
maxPointers(count) {
|
|
218
|
+
this.config.maxPointers = count;
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
activateAfterLongPress(duration) {
|
|
222
|
+
this.config.activateAfterLongPress = duration;
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
// --- the continuous callbacks, which only a continuous gesture has ---
|
|
226
|
+
onUpdate(callback) {
|
|
227
|
+
this.config.onUpdate = callback;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
onChange(callback) {
|
|
231
|
+
this.config.onChange = callback;
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* `Gesture.Tap()`.
|
|
237
|
+
*
|
|
238
|
+
* `shouldCancelWhenOutside` is on by default, set from the constructor exactly
|
|
239
|
+
* as upstream's `TapGesture` does — a press that wanders off the view is not a
|
|
240
|
+
* tap on it, and the native `TapGestureHandler` config says the same.
|
|
241
|
+
*/
|
|
242
|
+
export class TapGestureBuilder extends BaseGestureBuilder {
|
|
243
|
+
kind = "tap";
|
|
244
|
+
constructor() {
|
|
245
|
+
super();
|
|
246
|
+
this.shouldCancelWhenOutside(true);
|
|
247
|
+
}
|
|
248
|
+
numberOfTaps(count) {
|
|
249
|
+
this.config.numberOfTaps = count;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
maxDuration(duration) {
|
|
253
|
+
this.config.maxDuration = duration;
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
maxDelay(delay) {
|
|
257
|
+
this.config.maxDelay = delay;
|
|
258
|
+
return this;
|
|
259
|
+
}
|
|
260
|
+
maxDistance(distance) {
|
|
261
|
+
this.config.maxDistance = distance;
|
|
262
|
+
return this;
|
|
263
|
+
}
|
|
264
|
+
maxDeltaX(delta) {
|
|
265
|
+
this.config.maxDeltaX = delta;
|
|
266
|
+
return this;
|
|
267
|
+
}
|
|
268
|
+
maxDeltaY(delta) {
|
|
269
|
+
this.config.maxDeltaY = delta;
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
minPointers(count) {
|
|
273
|
+
this.config.minPointers = count;
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** `Gesture.LongPress()`, with upstream's default of `shouldCancelWhenOutside`. */
|
|
278
|
+
export class LongPressGestureBuilder extends BaseGestureBuilder {
|
|
279
|
+
kind = "longPress";
|
|
280
|
+
constructor() {
|
|
281
|
+
super();
|
|
282
|
+
this.shouldCancelWhenOutside(true);
|
|
283
|
+
}
|
|
284
|
+
minDuration(duration) {
|
|
285
|
+
this.config.minDuration = duration;
|
|
286
|
+
return this;
|
|
287
|
+
}
|
|
288
|
+
maxDistance(distance) {
|
|
289
|
+
this.config.maxDistance = distance;
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
numberOfPointers(count) {
|
|
293
|
+
this.config.numberOfPointers = count;
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* `Gesture.Native()` — the widget underneath, put into the arbitration.
|
|
299
|
+
*
|
|
300
|
+
* `shouldCancelWhenOutside` defaults to true from the constructor, which is
|
|
301
|
+
* where upstream's `NativeViewGestureHandler.init` sets it rather than its
|
|
302
|
+
* builder. See ./native for what the recognizer does and, more to the point,
|
|
303
|
+
* what it deliberately does not do: it never takes the responder, because
|
|
304
|
+
* taking it is what switches the native scroller off.
|
|
305
|
+
*/
|
|
306
|
+
export class NativeGestureBuilder extends BaseGestureBuilder {
|
|
307
|
+
kind = "native";
|
|
308
|
+
constructor() {
|
|
309
|
+
super();
|
|
310
|
+
this.shouldCancelWhenOutside(true);
|
|
311
|
+
}
|
|
312
|
+
shouldActivateOnStart(value) {
|
|
313
|
+
this.config.shouldActivateOnStart = value;
|
|
314
|
+
return this;
|
|
315
|
+
}
|
|
316
|
+
disallowInterruption(value) {
|
|
317
|
+
this.config.disallowInterruption = value;
|
|
318
|
+
return this;
|
|
319
|
+
}
|
|
320
|
+
yieldsToContinuousGestures(value) {
|
|
321
|
+
this.config.yieldsToContinuousGestures = value;
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A native view is CONTINUOUS upstream (`isContinuous = true`), so it
|
|
326
|
+
* reports travel like `Pan` does and unlike `Tap`. These are here rather
|
|
327
|
+
* than on the base class for the same reason they are on
|
|
328
|
+
* `PanGestureBuilder`: upstream puts them on `ContinousBaseGesture`.
|
|
329
|
+
*/
|
|
330
|
+
onUpdate(callback) {
|
|
331
|
+
this.config.onUpdate = callback;
|
|
332
|
+
return this;
|
|
333
|
+
}
|
|
334
|
+
onChange(callback) {
|
|
335
|
+
this.config.onChange = callback;
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* `Gesture.Pinch()` and `Gesture.Rotation()`, which have no configuration of
|
|
341
|
+
* their own at all — verified against 3.1.0, where `PinchGesture` and
|
|
342
|
+
* `RotationGesture` add zero builder methods over `ContinousBaseGesture`, and
|
|
343
|
+
* where v3's `PinchGestureNativeProperties` is literally
|
|
344
|
+
* `Record<string, never>`. Both are CONTINUOUS, so `onUpdate`/`onChange` are
|
|
345
|
+
* here for the same reason they are on `PanGestureBuilder`.
|
|
346
|
+
*
|
|
347
|
+
* `shouldCancelWhenOutside` is off, set from the constructor because upstream
|
|
348
|
+
* sets it from `PinchGestureHandler.init`/`RotationGestureHandler.init` — a
|
|
349
|
+
* pinch whose focal point wanders off the view keeps running, unlike a tap.
|
|
350
|
+
*
|
|
351
|
+
* What they do NOT have is a pointer: see ./touchpad. Their numbers come from
|
|
352
|
+
* `GtkGestureZoom`/`GtkGestureRotate`, and everything else about them — the
|
|
353
|
+
* states, the callbacks, the arbitration — is the machine every other kind
|
|
354
|
+
* runs on.
|
|
355
|
+
*/
|
|
356
|
+
export class PinchGestureBuilder extends BaseGestureBuilder {
|
|
357
|
+
kind = "pinch";
|
|
358
|
+
constructor() {
|
|
359
|
+
super();
|
|
360
|
+
this.shouldCancelWhenOutside(false);
|
|
361
|
+
}
|
|
362
|
+
onUpdate(callback) {
|
|
363
|
+
this.config.onUpdate = callback;
|
|
364
|
+
return this;
|
|
365
|
+
}
|
|
366
|
+
onChange(callback) {
|
|
367
|
+
this.config.onChange = callback;
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/** `Gesture.Rotation()`. Same shape as `Pinch`, same reasons. */
|
|
372
|
+
export class RotationGestureBuilder extends BaseGestureBuilder {
|
|
373
|
+
kind = "rotation";
|
|
374
|
+
constructor() {
|
|
375
|
+
super();
|
|
376
|
+
this.shouldCancelWhenOutside(false);
|
|
377
|
+
}
|
|
378
|
+
onUpdate(callback) {
|
|
379
|
+
this.config.onUpdate = callback;
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
onChange(callback) {
|
|
383
|
+
this.config.onChange = callback;
|
|
384
|
+
return this;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* `Gesture.Fling()` — a directional swipe, and the one DISCRETE gesture with a
|
|
389
|
+
* velocity criterion.
|
|
390
|
+
*
|
|
391
|
+
* No `onUpdate`/`onChange`, and that is upstream's shape rather than an
|
|
392
|
+
* omission: `FlingGesture` extends `BaseGesture` and not
|
|
393
|
+
* `ContinousBaseGesture`, because a fling activates and ends in the same
|
|
394
|
+
* breath (see ./fling) and there is never an update to report between them.
|
|
395
|
+
* Offering the methods would invite a callback that cannot fire.
|
|
396
|
+
*/
|
|
397
|
+
export class FlingGestureBuilder extends BaseGestureBuilder {
|
|
398
|
+
kind = "fling";
|
|
399
|
+
/** A BITMASK of `Directions`; several are one value, OR'd together. */
|
|
400
|
+
direction(direction) {
|
|
401
|
+
this.config.direction = direction;
|
|
402
|
+
return this;
|
|
403
|
+
}
|
|
404
|
+
numberOfPointers(count) {
|
|
405
|
+
this.config.numberOfPointers = count;
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* `Gesture.Manual()` — no configuration at all, because there is nothing to
|
|
411
|
+
* configure: the app drives the state machine through the manager handed to
|
|
412
|
+
* the `onTouches*` callbacks.
|
|
413
|
+
*
|
|
414
|
+
* Verified against 3.1.0, where `ManualGesture` adds zero builder methods over
|
|
415
|
+
* `ContinousBaseGesture` and v3's `ManualGestureProperties` is
|
|
416
|
+
* `Record<string, never>`. Continuous, so `onUpdate`/`onChange` are here.
|
|
417
|
+
*/
|
|
418
|
+
export class ManualGestureBuilder extends BaseGestureBuilder {
|
|
419
|
+
kind = "manual";
|
|
420
|
+
onUpdate(callback) {
|
|
421
|
+
this.config.onUpdate = callback;
|
|
422
|
+
return this;
|
|
423
|
+
}
|
|
424
|
+
onChange(callback) {
|
|
425
|
+
this.config.onChange = callback;
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* `Gesture.Hover()` — the pointer being over the view, with no button down.
|
|
431
|
+
*
|
|
432
|
+
* `effect()` is upstream's one knob and it is iOS-only there; it is recorded
|
|
433
|
+
* and inert here, exactly as it is inert in upstream's own web handler, which
|
|
434
|
+
* never branches on it either. Continuous, so it reports travel.
|
|
435
|
+
*/
|
|
436
|
+
export class HoverGestureBuilder extends BaseGestureBuilder {
|
|
437
|
+
kind = "hover";
|
|
438
|
+
effect(effect) {
|
|
439
|
+
this.config.hoverEffect = effect;
|
|
440
|
+
return this;
|
|
441
|
+
}
|
|
442
|
+
onUpdate(callback) {
|
|
443
|
+
this.config.onUpdate = callback;
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
onChange(callback) {
|
|
447
|
+
this.config.onChange = callback;
|
|
448
|
+
return this;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* `Gesture.ForceTouch()` — pressure, and the one recognizer in this module
|
|
453
|
+
* whose input the test rig cannot fully produce. See ./force-touch, which
|
|
454
|
+
* says so at length, and docs/api.md, which says it where an app will read it.
|
|
455
|
+
*
|
|
456
|
+
* Continuous, matching upstream's `ContinousBaseGesture`.
|
|
457
|
+
*/
|
|
458
|
+
export class ForceTouchGestureBuilder extends BaseGestureBuilder {
|
|
459
|
+
kind = "forceTouch";
|
|
460
|
+
minForce(force) {
|
|
461
|
+
this.config.minForce = force;
|
|
462
|
+
return this;
|
|
463
|
+
}
|
|
464
|
+
maxForce(force) {
|
|
465
|
+
this.config.maxForce = force;
|
|
466
|
+
return this;
|
|
467
|
+
}
|
|
468
|
+
/** Haptics. Recorded and inert: there is no haptic device on this platform. */
|
|
469
|
+
feedbackOnActivation(value) {
|
|
470
|
+
this.config.feedbackOnActivation = value;
|
|
471
|
+
return this;
|
|
472
|
+
}
|
|
473
|
+
onUpdate(callback) {
|
|
474
|
+
this.config.onUpdate = callback;
|
|
475
|
+
return this;
|
|
476
|
+
}
|
|
477
|
+
onChange(callback) {
|
|
478
|
+
this.config.onChange = callback;
|
|
479
|
+
return this;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* `Gesture`, the namespace of statics — all ten of them, and the three
|
|
484
|
+
* composers.
|
|
485
|
+
*
|
|
486
|
+
* Nothing here throws any more. The four that used to (`Fling`, `Hover`,
|
|
487
|
+
* `Manual`, `ForceTouch`) are the last of upstream's surface and the reasons
|
|
488
|
+
* they were refused have been re-examined one at a time rather than inherited:
|
|
489
|
+
* `Fling` and `Manual` were always reachable and merely unwritten, `Hover` was
|
|
490
|
+
* refused on a judgement about the rig that was simply wrong (a mouse hovers,
|
|
491
|
+
* and the virtual pointer moves a mouse), and `ForceTouch` is the one that
|
|
492
|
+
* needs hardware — it ships with upstream's documented semantics and an
|
|
493
|
+
* explicit note about what is unverified, rather than a refusal that says
|
|
494
|
+
* nothing.
|
|
495
|
+
*/
|
|
496
|
+
export const Gesture = {
|
|
497
|
+
Pan: () => new PanGestureBuilder(),
|
|
498
|
+
Tap: () => new TapGestureBuilder(),
|
|
499
|
+
LongPress: () => new LongPressGestureBuilder(),
|
|
500
|
+
Native: () => new NativeGestureBuilder(),
|
|
501
|
+
// List-builders over the same three maps the relation methods write, with
|
|
502
|
+
// no mechanism of their own — see ./composition.
|
|
503
|
+
Race: (...gestures) => raceGestures(...gestures),
|
|
504
|
+
Simultaneous: (...gestures) => simultaneousGestures(...gestures),
|
|
505
|
+
Exclusive: (...gestures) => exclusiveGestures(...gestures),
|
|
506
|
+
Pinch: () => new PinchGestureBuilder(),
|
|
507
|
+
Rotation: () => new RotationGestureBuilder(),
|
|
508
|
+
Fling: () => new FlingGestureBuilder(),
|
|
509
|
+
Hover: () => new HoverGestureBuilder(),
|
|
510
|
+
Manual: () => new ManualGestureBuilder(),
|
|
511
|
+
ForceTouch: () => new ForceTouchGestureBuilder(),
|
|
512
|
+
};
|
|
513
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/gesture-handler-compat/builder.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,YAAY;AACZ,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,8EAA8E;AAC9E,qEAAqE;AACrE,uEAAuE;AACvE,kCAAkC;AAClC,EAAE;AACF,kEAAkE;AAClE,+EAA+E;AAC/E,kEAAkE;AAClE,2EAA2E;AAC3E,sDAAsD;AACtD,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,mDAAmD;AACnD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,GACrB,MAAM,eAAe,CAAA;AAoBtB;;;;;;;;;;;;;GAaG;AACH,MAAe,kBAAkB;IAEtB,MAAM,GAAqB,EAAE,CAAA;IAEtC,+BAA+B;IAC/B,OAAO,CAAC,KAAc;QACpB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,uBAAuB,CAAC,KAAc;QACpC,IAAI,CAAC,MAAM,CAAC,uBAAuB,GAAG,KAAK,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,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AAI,uBAAuB,EAAE;IACvE,MAAM,EAAE,GAAyB,EAAE,CAAC,IAAI,oBAAoB,EAAE;IAC9D,0EAA0E;IAC1E,iDAAiD;IACjD,IAAI,EAAE,CAAC,GAAG,QAA0B,EAAuB,EAAE,CAC3D,YAAY,CAAC,GAAG,QAAQ,CAAC;IAC3B,YAAY,EAAE,CAAC,GAAG,QAA0B,EAAuB,EAAE,CACnE,oBAAoB,CAAC,GAAG,QAAQ,CAAC;IACnC,SAAS,EAAE,CAAC,GAAG,QAA0B,EAAuB,EAAE,CAChE,iBAAiB,CAAC,GAAG,QAAQ,CAAC;IAChC,KAAK,EAAE,GAAwB,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC3D,QAAQ,EAAE,GAA2B,EAAE,CAAC,IAAI,sBAAsB,EAAE;IACpE,KAAK,EAAE,GAAwB,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC3D,KAAK,EAAE,GAAwB,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC3D,MAAM,EAAE,GAAyB,EAAE,CAAC,IAAI,oBAAoB,EAAE;IAC9D,UAAU,EAAE,GAA6B,EAAE,CAAC,IAAI,wBAAwB,EAAE;CAC3E,CAAA","sourcesContent":["// Spelling one: `Gesture.Pan()` / `.Tap()` / `.LongPress()`, the chainable\n// builders.\n//\n// Deprecated upstream since 3.1.0 — every one of the twelve `Gesture.*`\n// statics carries an `@deprecated` tag pointing at a hook — and it is still\n// what every shipped consumer calls, which is why it is the spelling that had\n// to work first. It is a facade: each method writes one value into a\n// `RecognizerConfig` and returns `this`, and the object it builds is a\n// `GestureSpec` and nothing more.\n//\n// The class split mirrors upstream's. `BaseGestureBuilder` is its\n// `BaseGesture` — everything the three kinds share — and `onUpdate`/`onChange`\n// live on `PanGestureBuilder` alone because upstream puts them on\n// `ContinousBaseGesture`, which `TapGesture` and `LongPressGesture` do not\n// extend. A discrete gesture has no travel to report.\n//\n// The callback renames are where the two spellings genuinely differ.\n// `onStart` and `onEnd` here are `onActivate` and `onDeactivate` internally,\n// `onTouchesCancelled` is `onTouchesCancel`, and `onChange` — which the hook\n// spelling dropped — is an ordinary callback over the same payload, because\n// the payload already carries `changeX`/`changeY`.\nimport {\n exclusiveGestures,\n raceGestures,\n simultaneousGestures,\n} from \"./composition\"\nimport type {\n AnyGestureSpec,\n ComposedGestureSpec,\n GestureEventPayload,\n GestureHitSlop,\n GestureKind,\n GestureRef,\n GestureSpec,\n GestureStateManagerApi,\n GestureTouchEvent,\n OffsetBound,\n RecognizerConfig,\n} from \"./types\"\n\ntype TouchHandler = (\n event: GestureTouchEvent,\n manager: GestureStateManagerApi,\n) => void\n\n/**\n * Everything upstream's `BaseGesture` has, which is everything the three\n * implemented kinds share. Not a port of it: it holds no handler tag and no\n * worklet machinery, because on this platform there is one runtime and a\n * handler tag identifies a MOUNTED gesture rather than a built one. The\n * relations it does hold are lists of references and nothing else — the maps\n * that read them live in ./relations, and the loop that acts on them in\n * ./orchestrator.\n *\n * `onUpdate` and `onChange` are deliberately NOT here. Upstream puts them on\n * `ContinousBaseGesture`, which `Tap` and `LongPress` do not extend — they are\n * discrete, they have no travel to report, and offering the methods would\n * invite a callback that never fires.\n */\nabstract class BaseGestureBuilder implements GestureSpec {\n abstract readonly kind: GestureKind\n readonly config: RecognizerConfig = {}\n\n // --- common configuration ---\n enabled(value: boolean): this {\n this.config.enabled = value\n return this\n }\n shouldCancelWhenOutside(value: boolean): this {\n this.config.shouldCancelWhenOutside = value\n return this\n }\n hitSlop(value: GestureHitSlop): this {\n this.config.hitSlop = value\n return this\n }\n manualActivation(value: boolean): this {\n this.config.manualActivation = value\n return this\n }\n\n // --- callbacks ---\n onBegin(callback: (event: GestureEventPayload) => void): this {\n this.config.onBegin = callback\n return this\n }\n onStart(callback: (event: GestureEventPayload) => void): this {\n this.config.onActivate = callback\n return this\n }\n onEnd(\n callback: (event: GestureEventPayload, success: boolean) => void,\n ): this {\n this.config.onDeactivate = callback\n return this\n }\n onFinalize(\n callback: (event: GestureEventPayload, success: boolean) => void,\n ): this {\n this.config.onFinalize = callback\n return this\n }\n onTouchesDown(callback: TouchHandler): this {\n this.config.onTouchesDown = callback\n return this\n }\n onTouchesMove(callback: TouchHandler): this {\n this.config.onTouchesMove = callback\n return this\n }\n onTouchesUp(callback: TouchHandler): this {\n this.config.onTouchesUp = callback\n return this\n }\n onTouchesCancelled(callback: TouchHandler): this {\n this.config.onTouchesCancel = callback\n return this\n }\n\n /**\n * Recorded and not acted on, exactly as upstream does not act on it off its\n * worklet platforms: gesture callbacks are worklets by default there and\n * this asks for the JS runtime instead. There is one runtime here, so every\n * callback already runs where this is asking it to. `@gorhom/bottom-sheet`\n * sets it twice; making it throw would refuse code that is already correct.\n *\n * Recorded rather than discarded so the config still describes what the app\n * asked for — the orchestrator and any devtools read this object.\n */\n runOnJS(value: boolean): this {\n this.config.runOnJS = value\n return this\n }\n\n /**\n * Platform-specific upstream and inert here, which is upstream's own\n * treatment of them off their platforms: `averageTouches` is Android-only,\n * `enableTrackpadTwoFingerGesture` and `cancelsTouchesInView` are iOS-only,\n * `activeCursor` and `mouseButton` are Web-only. Accepting them keeps\n * portable source portable; docs/api.md records that they do nothing.\n */\n averageTouches(value: boolean): this {\n this.config.averageTouches = value\n return this\n }\n enableTrackpadTwoFingerGesture(value: boolean): this {\n this.config.enableTrackpadTwoFingerGesture = value\n return this\n }\n cancelsTouchesInView(value: boolean): this {\n this.config.cancelsTouchesInView = value\n return this\n }\n activeCursor(value: string): this {\n this.config.activeCursor = value\n return this\n }\n mouseButton(value: number): this {\n this.config.mouseButton = value\n return this\n }\n\n /** Upstream stores a ref for the relation APIs; harmless to honour early. */\n withRef(ref: { current: unknown }): this {\n ref.current = this\n return this\n }\n withTestId(id: string): this {\n this.config.testId = id\n return this\n }\n\n /** Upstream's flattening hook for composed gestures; a lone gesture is a list of one. */\n toGestureArray(): BaseGestureBuilder[] {\n return [this]\n }\n\n // --- the relations ---\n //\n // Three methods, three lists, one place they are read: the maps in\n // ./relations. Each of them writes a list of REFERENCES rather than tags —\n // an app names another gesture with the gesture object it built, and the\n // tag that identifies a mounted one does not exist until a detector mounts\n // it. `withRef()` and a raw tag are accepted in the same position, as\n // upstream's `GestureRef` is.\n //\n // Appending rather than replacing: `.simultaneousWithExternalGesture(a)`\n // followed by `.simultaneousWithExternalGesture(b)` means both, which is\n // what chaining reads like. The builder is rebuilt every render by every\n // app that follows upstream's own advice, so nothing accumulates across\n // renders — and composition computes rather than writes back here, so it\n // cannot accumulate either.\n simultaneousWithExternalGesture(...gestures: GestureRef[]): this {\n this.config.simultaneousHandlers = [\n ...(this.config.simultaneousHandlers ?? []),\n ...gestures,\n ]\n return this\n }\n requireExternalGestureToFail(...gestures: GestureRef[]): this {\n this.config.waitFor = [...(this.config.waitFor ?? []), ...gestures]\n return this\n }\n blocksExternalGesture(...gestures: GestureRef[]): this {\n this.config.blocksHandlers = [\n ...(this.config.blocksHandlers ?? []),\n ...gestures,\n ]\n return this\n }\n}\n\n/** `Gesture.Pan()`, and the only one of the three that reports travel. */\nexport class PanGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"pan\" as const\n\n // --- activation and failure bounds ---\n activeOffsetX(offset: OffsetBound): this {\n this.config.activeOffsetX = offset\n return this\n }\n activeOffsetY(offset: OffsetBound): this {\n this.config.activeOffsetY = offset\n return this\n }\n failOffsetX(offset: OffsetBound): this {\n this.config.failOffsetX = offset\n return this\n }\n failOffsetY(offset: OffsetBound): this {\n this.config.failOffsetY = offset\n return this\n }\n minDistance(distance: number): this {\n this.config.minDistance = distance\n return this\n }\n minVelocity(velocity: number): this {\n this.config.minVelocity = velocity\n return this\n }\n minVelocityX(velocity: number): this {\n this.config.minVelocityX = velocity\n return this\n }\n minVelocityY(velocity: number): this {\n this.config.minVelocityY = velocity\n return this\n }\n minPointers(count: number): this {\n this.config.minPointers = count\n return this\n }\n maxPointers(count: number): this {\n this.config.maxPointers = count\n return this\n }\n activateAfterLongPress(duration: number): this {\n this.config.activateAfterLongPress = duration\n return this\n }\n\n // --- the continuous callbacks, which only a continuous gesture has ---\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture.Tap()`.\n *\n * `shouldCancelWhenOutside` is on by default, set from the constructor exactly\n * as upstream's `TapGesture` does — a press that wanders off the view is not a\n * tap on it, and the native `TapGestureHandler` config says the same.\n */\nexport class TapGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"tap\" as const\n\n constructor() {\n super()\n this.shouldCancelWhenOutside(true)\n }\n\n numberOfTaps(count: number): this {\n this.config.numberOfTaps = count\n return this\n }\n maxDuration(duration: number): this {\n this.config.maxDuration = duration\n return this\n }\n maxDelay(delay: number): this {\n this.config.maxDelay = delay\n return this\n }\n maxDistance(distance: number): this {\n this.config.maxDistance = distance\n return this\n }\n maxDeltaX(delta: number): this {\n this.config.maxDeltaX = delta\n return this\n }\n maxDeltaY(delta: number): this {\n this.config.maxDeltaY = delta\n return this\n }\n minPointers(count: number): this {\n this.config.minPointers = count\n return this\n }\n}\n\n/** `Gesture.LongPress()`, with upstream's default of `shouldCancelWhenOutside`. */\nexport class LongPressGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"longPress\" as const\n\n constructor() {\n super()\n this.shouldCancelWhenOutside(true)\n }\n\n minDuration(duration: number): this {\n this.config.minDuration = duration\n return this\n }\n maxDistance(distance: number): this {\n this.config.maxDistance = distance\n return this\n }\n numberOfPointers(count: number): this {\n this.config.numberOfPointers = count\n return this\n }\n}\n\n/**\n * `Gesture.Native()` — the widget underneath, put into the arbitration.\n *\n * `shouldCancelWhenOutside` defaults to true from the constructor, which is\n * where upstream's `NativeViewGestureHandler.init` sets it rather than its\n * builder. See ./native for what the recognizer does and, more to the point,\n * what it deliberately does not do: it never takes the responder, because\n * taking it is what switches the native scroller off.\n */\nexport class NativeGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"native\" as const\n\n constructor() {\n super()\n this.shouldCancelWhenOutside(true)\n }\n\n shouldActivateOnStart(value: boolean): this {\n this.config.shouldActivateOnStart = value\n return this\n }\n disallowInterruption(value: boolean): this {\n this.config.disallowInterruption = value\n return this\n }\n yieldsToContinuousGestures(value: boolean): this {\n this.config.yieldsToContinuousGestures = value\n return this\n }\n\n /**\n * A native view is CONTINUOUS upstream (`isContinuous = true`), so it\n * reports travel like `Pan` does and unlike `Tap`. These are here rather\n * than on the base class for the same reason they are on\n * `PanGestureBuilder`: upstream puts them on `ContinousBaseGesture`.\n */\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture.Pinch()` and `Gesture.Rotation()`, which have no configuration of\n * their own at all — verified against 3.1.0, where `PinchGesture` and\n * `RotationGesture` add zero builder methods over `ContinousBaseGesture`, and\n * where v3's `PinchGestureNativeProperties` is literally\n * `Record<string, never>`. Both are CONTINUOUS, so `onUpdate`/`onChange` are\n * here for the same reason they are on `PanGestureBuilder`.\n *\n * `shouldCancelWhenOutside` is off, set from the constructor because upstream\n * sets it from `PinchGestureHandler.init`/`RotationGestureHandler.init` — a\n * pinch whose focal point wanders off the view keeps running, unlike a tap.\n *\n * What they do NOT have is a pointer: see ./touchpad. Their numbers come from\n * `GtkGestureZoom`/`GtkGestureRotate`, and everything else about them — the\n * states, the callbacks, the arbitration — is the machine every other kind\n * runs on.\n */\nexport class PinchGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"pinch\" as const\n\n constructor() {\n super()\n this.shouldCancelWhenOutside(false)\n }\n\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/** `Gesture.Rotation()`. Same shape as `Pinch`, same reasons. */\nexport class RotationGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"rotation\" as const\n\n constructor() {\n super()\n this.shouldCancelWhenOutside(false)\n }\n\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture.Fling()` — a directional swipe, and the one DISCRETE gesture with a\n * velocity criterion.\n *\n * No `onUpdate`/`onChange`, and that is upstream's shape rather than an\n * omission: `FlingGesture` extends `BaseGesture` and not\n * `ContinousBaseGesture`, because a fling activates and ends in the same\n * breath (see ./fling) and there is never an update to report between them.\n * Offering the methods would invite a callback that cannot fire.\n */\nexport class FlingGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"fling\" as const\n\n /** A BITMASK of `Directions`; several are one value, OR'd together. */\n direction(direction: number): this {\n this.config.direction = direction\n return this\n }\n numberOfPointers(count: number): this {\n this.config.numberOfPointers = count\n return this\n }\n}\n\n/**\n * `Gesture.Manual()` — no configuration at all, because there is nothing to\n * configure: the app drives the state machine through the manager handed to\n * the `onTouches*` callbacks.\n *\n * Verified against 3.1.0, where `ManualGesture` adds zero builder methods over\n * `ContinousBaseGesture` and v3's `ManualGestureProperties` is\n * `Record<string, never>`. Continuous, so `onUpdate`/`onChange` are here.\n */\nexport class ManualGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"manual\" as const\n\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture.Hover()` — the pointer being over the view, with no button down.\n *\n * `effect()` is upstream's one knob and it is iOS-only there; it is recorded\n * and inert here, exactly as it is inert in upstream's own web handler, which\n * never branches on it either. Continuous, so it reports travel.\n */\nexport class HoverGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"hover\" as const\n\n effect(effect: number): this {\n this.config.hoverEffect = effect\n return this\n }\n\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture.ForceTouch()` — pressure, and the one recognizer in this module\n * whose input the test rig cannot fully produce. See ./force-touch, which\n * says so at length, and docs/api.md, which says it where an app will read it.\n *\n * Continuous, matching upstream's `ContinousBaseGesture`.\n */\nexport class ForceTouchGestureBuilder extends BaseGestureBuilder {\n readonly kind = \"forceTouch\" as const\n\n minForce(force: number): this {\n this.config.minForce = force\n return this\n }\n maxForce(force: number): this {\n this.config.maxForce = force\n return this\n }\n /** Haptics. Recorded and inert: there is no haptic device on this platform. */\n feedbackOnActivation(value: boolean): this {\n this.config.feedbackOnActivation = value\n return this\n }\n\n onUpdate(callback: (event: GestureEventPayload) => void): this {\n this.config.onUpdate = callback\n return this\n }\n onChange(callback: (event: GestureEventPayload) => void): this {\n this.config.onChange = callback\n return this\n }\n}\n\n/**\n * `Gesture`, the namespace of statics — all ten of them, and the three\n * composers.\n *\n * Nothing here throws any more. The four that used to (`Fling`, `Hover`,\n * `Manual`, `ForceTouch`) are the last of upstream's surface and the reasons\n * they were refused have been re-examined one at a time rather than inherited:\n * `Fling` and `Manual` were always reachable and merely unwritten, `Hover` was\n * refused on a judgement about the rig that was simply wrong (a mouse hovers,\n * and the virtual pointer moves a mouse), and `ForceTouch` is the one that\n * needs hardware — it ships with upstream's documented semantics and an\n * explicit note about what is unverified, rather than a refusal that says\n * nothing.\n */\nexport const Gesture = {\n Pan: (): PanGestureBuilder => new PanGestureBuilder(),\n Tap: (): TapGestureBuilder => new TapGestureBuilder(),\n LongPress: (): LongPressGestureBuilder => new LongPressGestureBuilder(),\n Native: (): NativeGestureBuilder => new NativeGestureBuilder(),\n // List-builders over the same three maps the relation methods write, with\n // no mechanism of their own — see ./composition.\n Race: (...gestures: AnyGestureSpec[]): ComposedGestureSpec =>\n raceGestures(...gestures),\n Simultaneous: (...gestures: AnyGestureSpec[]): ComposedGestureSpec =>\n simultaneousGestures(...gestures),\n Exclusive: (...gestures: AnyGestureSpec[]): ComposedGestureSpec =>\n exclusiveGestures(...gestures),\n Pinch: (): PinchGestureBuilder => new PinchGestureBuilder(),\n Rotation: (): RotationGestureBuilder => new RotationGestureBuilder(),\n Fling: (): FlingGestureBuilder => new FlingGestureBuilder(),\n Hover: (): HoverGestureBuilder => new HoverGestureBuilder(),\n Manual: (): ManualGestureBuilder => new ManualGestureBuilder(),\n ForceTouch: (): ForceTouchGestureBuilder => new ForceTouchGestureBuilder(),\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AnyGestureSpec, type ComposedGestureSpec, type GestureRelations, type GestureSpec } from "./types";
|
|
2
|
+
/** One recognizer, with the relations it ends up with once composed. */
|
|
3
|
+
export type PreparedGesture = {
|
|
4
|
+
spec: GestureSpec;
|
|
5
|
+
relations: GestureRelations;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Flattens a gesture or a composition into the recognizers a detector has to
|
|
9
|
+
* mount, each with the relations composition gave it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const prepareGestures: (gesture: AnyGestureSpec) => PreparedGesture[];
|
|
12
|
+
/**
|
|
13
|
+
* `Gesture.Race()` — the default, spelled out.
|
|
14
|
+
*
|
|
15
|
+
* Upstream's hook spelling calls this `useCompetingGestures`, which is the
|
|
16
|
+
* better name for it: the gestures compete, the first to activate cancels the
|
|
17
|
+
* rest, and that would have happened anyway.
|
|
18
|
+
*/
|
|
19
|
+
export declare const raceGestures: (...gestures: AnyGestureSpec[]) => ComposedGestureSpec;
|
|
20
|
+
/** `Gesture.Simultaneous()` — a pairwise fill of `simultaneousHandlers`. */
|
|
21
|
+
export declare const simultaneousGestures: (...gestures: AnyGestureSpec[]) => ComposedGestureSpec;
|
|
22
|
+
/** `Gesture.Exclusive()` — a chain fill of `waitFor`. */
|
|
23
|
+
export declare const exclusiveGestures: (...gestures: AnyGestureSpec[]) => ComposedGestureSpec;
|