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,268 @@
|
|
|
1
|
+
import type { GestureResponderEvent } from "../responder/types";
|
|
2
|
+
import type { Orchestrator, Participant } from "./orchestrator";
|
|
3
|
+
import { type GestureHitSlop, type GestureKind, type RecognizerConfig } from "./types";
|
|
4
|
+
export type Rect = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* What the recognizer needs from the world it is mounted in: where its view
|
|
12
|
+
* is, and how to take the interaction when no touch event is in flight.
|
|
13
|
+
*/
|
|
14
|
+
export type RecognizerEnvironment = {
|
|
15
|
+
/**
|
|
16
|
+
* The gesture's own view in WINDOW coordinates, or null before it is laid
|
|
17
|
+
* out. Window coordinates because that is the space RN's `pageX`/`pageY`
|
|
18
|
+
* are in, so no conversion sits between a touch and a bounds test.
|
|
19
|
+
*/
|
|
20
|
+
boundsInWindow: () => Rect | null;
|
|
21
|
+
/**
|
|
22
|
+
* Ask for the responder outside a touch event. Returns whether it was
|
|
23
|
+
* granted. See `ResponderSystem.requestResponder`.
|
|
24
|
+
*/
|
|
25
|
+
requestResponder: () => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The JS-only arbitration registry this gesture takes part in. Injected
|
|
28
|
+
* rather than imported so a test can drive one loop in isolation, exactly
|
|
29
|
+
* as the responder system is injected rather than imported.
|
|
30
|
+
*/
|
|
31
|
+
orchestrator: Orchestrator;
|
|
32
|
+
};
|
|
33
|
+
/** The read-only view of the runtime the predicates are allowed to see. */
|
|
34
|
+
export type RecognizerView = {
|
|
35
|
+
/** Measured from the point of ACTIVATION once there is one; see `Runtime`. */
|
|
36
|
+
translationX: number;
|
|
37
|
+
translationY: number;
|
|
38
|
+
/**
|
|
39
|
+
* Straight-line travel from the PRESS, which outlives activation.
|
|
40
|
+
*
|
|
41
|
+
* `LongPress` needs this and translation will not do: it activates on a
|
|
42
|
+
* timer, translation is re-based to the activation point, and upstream's
|
|
43
|
+
* `maxDist` is measured from the press for the whole gesture — so a hold
|
|
44
|
+
* that drifted 8px before the timer and 8px after it has travelled 16, not
|
|
45
|
+
* twice-nearly-nothing.
|
|
46
|
+
*/
|
|
47
|
+
distanceFromPress: number;
|
|
48
|
+
velocityX: number;
|
|
49
|
+
velocityY: number;
|
|
50
|
+
/** Whether this press's own timer has already fired. */
|
|
51
|
+
timerElapsed: boolean;
|
|
52
|
+
/** Pointers down now, and the most this interaction has ever had at once. */
|
|
53
|
+
pointerCount: number;
|
|
54
|
+
maxPointerCount: number;
|
|
55
|
+
/** Completed press-release cycles, including the one being decided. */
|
|
56
|
+
taps: number;
|
|
57
|
+
/**
|
|
58
|
+
* `Pinch`: the scale since GTK recognized the gesture, 1 at the start.
|
|
59
|
+
* `Rotation`: radians since it did, 0 at the start and positive clockwise.
|
|
60
|
+
*
|
|
61
|
+
* Both are 1 and 0 for every pointer-driven kind, so a predicate that reads
|
|
62
|
+
* them on the wrong kind gets the identity rather than a lie.
|
|
63
|
+
*/
|
|
64
|
+
scale: number;
|
|
65
|
+
rotation: number;
|
|
66
|
+
/**
|
|
67
|
+
* `ForceTouch`: the pressure, normalised to `[0, 1]`.
|
|
68
|
+
*
|
|
69
|
+
* 0 for every other kind — an input with no pressure axis reports no
|
|
70
|
+
* pressure, and a predicate reading this on the wrong kind gets the number
|
|
71
|
+
* that is true rather than one that looks plausible.
|
|
72
|
+
*/
|
|
73
|
+
force: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The timer a recognizer arms on every press, and what its firing means.
|
|
77
|
+
*
|
|
78
|
+
* All three kinds want one and they disagree only about the outcome: `Pan`'s
|
|
79
|
+
* `activateAfterLongPress` and `LongPress`'s `minDuration` mature the gesture,
|
|
80
|
+
* `Tap`'s `maxDuration` is a deadline that kills it.
|
|
81
|
+
*/
|
|
82
|
+
export type RecognizerTimer = {
|
|
83
|
+
delay: number;
|
|
84
|
+
elapsed: "activate" | "fail";
|
|
85
|
+
};
|
|
86
|
+
/** What lifting the pointer means to a gesture that is still BEGAN. */
|
|
87
|
+
export type ReleaseOutcome = {
|
|
88
|
+
kind: "activate";
|
|
89
|
+
} | {
|
|
90
|
+
kind: "fail";
|
|
91
|
+
}
|
|
92
|
+
/** Not over — wait this long for another press, then fail. */
|
|
93
|
+
| {
|
|
94
|
+
kind: "await";
|
|
95
|
+
delay: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Nothing at all: stay BEGAN, with no timer and no decision.
|
|
99
|
+
*
|
|
100
|
+
* `Manual` alone, and it is upstream's documented rule for it — "it will not
|
|
101
|
+
* fail when all the pointers are lifted from the screen". A gesture the app
|
|
102
|
+
* drives has no business being failed by a lift the app did not ask about.
|
|
103
|
+
*/
|
|
104
|
+
| {
|
|
105
|
+
kind: "hold";
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* What a recognizer kind contributes: predicates over the current state of
|
|
109
|
+
* one press. Everything else — the state progression, the callbacks, the
|
|
110
|
+
* responder plumbing, the bounds tests, the timer — is shared, which is what
|
|
111
|
+
* makes `Tap` and `LongPress` an afternoon rather than a second machine.
|
|
112
|
+
*
|
|
113
|
+
* Only `shouldFail` and `shouldActivate` are required, and `Pan` implements
|
|
114
|
+
* exactly those two: the rest exist because `Tap` activates on a RELEASE and
|
|
115
|
+
* `LongPress` can be cancelled after it is already ACTIVE, and neither shape
|
|
116
|
+
* was reachable from a pair of movement predicates.
|
|
117
|
+
*/
|
|
118
|
+
export type RecognizerDecider = {
|
|
119
|
+
/**
|
|
120
|
+
* Which kind this is.
|
|
121
|
+
*
|
|
122
|
+
* Carried by the decider because the decider IS what tells the kinds apart,
|
|
123
|
+
* and because the arbitration loop needs exactly one fact about a gesture
|
|
124
|
+
* beyond its relations: whether it is `Gesture.Native()`, the one kind that
|
|
125
|
+
* can cancel an already-active gesture.
|
|
126
|
+
*/
|
|
127
|
+
kind: GestureKind;
|
|
128
|
+
shouldFail: (view: RecognizerView, config: RecognizerConfig) => boolean;
|
|
129
|
+
shouldActivate: (view: RecognizerView, config: RecognizerConfig) => boolean;
|
|
130
|
+
/** Absent means "no timer", which is `Pan` without `activateAfterLongPress`. */
|
|
131
|
+
timer?: (config: RecognizerConfig) => RecognizerTimer | null;
|
|
132
|
+
/** Absent means an ACTIVE gesture is only ever ended by the pointer. */
|
|
133
|
+
shouldCancelWhileActive?: (view: RecognizerView, config: RecognizerConfig) => boolean;
|
|
134
|
+
/** Absent means a lift while BEGAN is the end of it, which is `Pan`'s rule. */
|
|
135
|
+
onRelease?: (view: RecognizerView, config: RecognizerConfig) => ReleaseOutcome;
|
|
136
|
+
/**
|
|
137
|
+
* Whether activating means taking the responder. Absent means yes, which is
|
|
138
|
+
* every recognizer that decides the interaction is React Native's.
|
|
139
|
+
*
|
|
140
|
+
* `Native` is the one that says no, and it is not an optimisation: taking
|
|
141
|
+
* the responder is what makes the platform declare `CLAIMED` and suspend
|
|
142
|
+
* every enclosing `GtkScrolledWindow`'s kinetics
|
|
143
|
+
* (`responder/use-responder.ts`). A gesture whose entire meaning is "the
|
|
144
|
+
* native widget is handling this" cannot be the thing that stops the native
|
|
145
|
+
* widget from handling it.
|
|
146
|
+
*
|
|
147
|
+
* A recognizer that does not claim runs off the touch props alone — they
|
|
148
|
+
* fire regardless of responder status, which is the same seam the BEGAN
|
|
149
|
+
* phase already uses. It never receives `onResponderMove`, so its updates
|
|
150
|
+
* come from `onTouchMove` and its ending from `onTouchEnd`/`onTouchCancel`.
|
|
151
|
+
*/
|
|
152
|
+
claimsResponder?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Activating IS the whole gesture: end it, successfully, in the same breath.
|
|
155
|
+
*
|
|
156
|
+
* `Fling` alone, and it is upstream's own shape rather than a shortcut —
|
|
157
|
+
* `FlingGestureHandler.activate()` is overridden to call `this.end()`
|
|
158
|
+
* immediately after `super.activate()`. A fling is a verdict about a motion
|
|
159
|
+
* that has already happened, so there is nothing left to report once it is
|
|
160
|
+
* reached: BEGAN -> ACTIVE -> END, synchronously, with `onStart` and `onEnd`
|
|
161
|
+
* one after the other and no `onUpdate` between them.
|
|
162
|
+
*/
|
|
163
|
+
endsOnActivate?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Which entry surface drives this kind. Absent means `"pointer"`.
|
|
166
|
+
*
|
|
167
|
+
* The one structural concession this module makes, and it is about where
|
|
168
|
+
* events COME FROM rather than about what happens to them. Three kinds of
|
|
169
|
+
* input are simply not in the pointer stream:
|
|
170
|
+
*
|
|
171
|
+
* - `"touchpad"` — `Pinch`/`Rotation`, fed by
|
|
172
|
+
* `GtkGestureZoom`/`GtkGestureRotate`, because a touchpad pinch presses
|
|
173
|
+
* no button and so opens no GTK sequence and no responder session;
|
|
174
|
+
* - `"hover"` — `Hover`, fed by `GtkEventControllerMotion`, because a
|
|
175
|
+
* pointer that is merely OVER a view has pressed nothing either, and
|
|
176
|
+
* RN's touch props fire only from a press;
|
|
177
|
+
* - `"stylus"` — `ForceTouch`, fed by `GtkGestureStylus`, because pressure
|
|
178
|
+
* is a tablet axis and `wl_pointer` has none.
|
|
179
|
+
*
|
|
180
|
+
* Everything downstream of the entry point is this same machine: the same
|
|
181
|
+
* states, the same callbacks, the same payload, the same `tryActivate` and
|
|
182
|
+
* the same relation maps. There is no second arbitration path.
|
|
183
|
+
*
|
|
184
|
+
* Exactly one surface is live per recognizer. A non-pointer kind's
|
|
185
|
+
* touch/responder props are empty, so a mouse press cannot begin a pinch or
|
|
186
|
+
* a hover; a `"pointer"` kind's controller channel is inert, so a pinch
|
|
187
|
+
* cannot begin a pan.
|
|
188
|
+
*/
|
|
189
|
+
source?: "pointer" | "touchpad" | "hover" | "stylus";
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* RNGH's `checkHitSlop`, restated: build the acceptable box in the view's own
|
|
193
|
+
* coordinates, then test the pointer's offset into the view against it.
|
|
194
|
+
*
|
|
195
|
+
* Every side is "outward is positive", so a NEGATIVE value shrinks the box —
|
|
196
|
+
* the capability RN's own View `hitSlop` does not have. Explicit sides
|
|
197
|
+
* override `horizontal`/`vertical`, and `width`/`height` then anchor the
|
|
198
|
+
* opposite edge to whichever side was named.
|
|
199
|
+
*
|
|
200
|
+
* The plain-number spelling is normalised into the four sides up front.
|
|
201
|
+
* Upstream's web path does not do this and silently ignores a number, which
|
|
202
|
+
* is a bug rather than a semantic worth reproducing — its own native paths
|
|
203
|
+
* normalise exactly this way.
|
|
204
|
+
*/
|
|
205
|
+
export declare const hitSlopRect: (bounds: Rect, hitSlop: GestureHitSlop | undefined) => Rect;
|
|
206
|
+
/**
|
|
207
|
+
* One frame from whichever GTK controller feeds a non-pointer kind, in the
|
|
208
|
+
* terms the recognizer reads.
|
|
209
|
+
*
|
|
210
|
+
* ONE sample type for three sources rather than three, because what the
|
|
211
|
+
* machine needs from all of them is the same short list and only two fields
|
|
212
|
+
* differ per kind. `scale` and `rotation` are CUMULATIVE since GTK recognized
|
|
213
|
+
* the gesture, which is what `gtk_gesture_zoom_get_scale_delta` ("the zooming
|
|
214
|
+
* difference since the gesture was recognized, hence the starting point is
|
|
215
|
+
* considered 1:1") and `gtk_gesture_rotate_get_angle_delta` already are — the
|
|
216
|
+
* same shape as upstream's own accumulators, so nothing is re-derived on the
|
|
217
|
+
* way in.
|
|
218
|
+
*/
|
|
219
|
+
export type ControllerSample = {
|
|
220
|
+
/**
|
|
221
|
+
* Where the gesture is, in the gesture VIEW's own coordinates.
|
|
222
|
+
*
|
|
223
|
+
* A pinch's bounding-box centre, a hover's pointer, a stylus tip: three
|
|
224
|
+
* names for the position the payload's `x`/`y`, `focalX`/`focalY` and
|
|
225
|
+
* `anchorX`/`anchorY` are all filled from, which is why they are one pair
|
|
226
|
+
* of fields and not three.
|
|
227
|
+
*/
|
|
228
|
+
x: number;
|
|
229
|
+
y: number;
|
|
230
|
+
/** `Pinch`: 1 at the start of the gesture, above 1 for a spread. */
|
|
231
|
+
scale?: number;
|
|
232
|
+
/** `Rotation`: 0 at the start; radians, positive clockwise. */
|
|
233
|
+
rotation?: number;
|
|
234
|
+
/** `ForceTouch`: pressure normalised to `[0, 1]`. */
|
|
235
|
+
force?: number;
|
|
236
|
+
/** Pointers GTK reported. A touchpad pinch is always two; a hover is one. */
|
|
237
|
+
pointers: number;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* The non-pointer entry surface, for the kinds GTK feeds rather than the
|
|
241
|
+
* pointer stream. Null on every pointer kind — see `RecognizerDecider.source`.
|
|
242
|
+
*/
|
|
243
|
+
export type ControllerChannel = {
|
|
244
|
+
begin: (sample: ControllerSample) => void;
|
|
245
|
+
update: (sample: ControllerSample) => void;
|
|
246
|
+
end: () => void;
|
|
247
|
+
cancel: () => void;
|
|
248
|
+
};
|
|
249
|
+
export type Recognizer = {
|
|
250
|
+
/** The responder props to put on the gesture's view. Empty for a controller kind. */
|
|
251
|
+
handlers: Record<string, (event: GestureResponderEvent) => boolean | void>;
|
|
252
|
+
/**
|
|
253
|
+
* Where `GtkGestureZoom`/`GtkGestureRotate`/`GtkEventControllerMotion`/
|
|
254
|
+
* `GtkGestureStylus` deliver, or null for a pointer kind.
|
|
255
|
+
*/
|
|
256
|
+
controller: ControllerChannel | null;
|
|
257
|
+
/** This gesture's seat in the arbitration loop. */
|
|
258
|
+
participant: Participant;
|
|
259
|
+
/** Cancels any pending timer and leaves the loop; called on unmount. */
|
|
260
|
+
dispose: () => void;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Builds the machine. `readConfig` is called on every event rather than
|
|
264
|
+
* captured, so a re-render that hands the detector a fresh gesture object —
|
|
265
|
+
* which is what both spellings produce, every render — takes effect without
|
|
266
|
+
* swapping the handler set mid-drag.
|
|
267
|
+
*/
|
|
268
|
+
export declare const createRecognizer: (handlerTag: number, decider: RecognizerDecider, readConfig: () => RecognizerConfig, env: RecognizerEnvironment) => Recognizer;
|