import type { PointerPhaseEvent, PointerType } from './input-snapshot'; export declare const LONG_PRESS_DURATION_MS = 500; export declare const LONG_PRESS_SLOP = 10; export declare const DOUBLE_TAP_INTERVAL_MS = 350; export declare const DOUBLE_TAP_DISTANCE = 10; export declare const SWIPE_VELOCITY_THRESHOLD = 0.5; export declare const SWIPE_WINDOW_MS = 100; /** Swipe direction taken from the dominant displacement axis (D-10). */ declare const SWIPE_DIRECTIONS: readonly ["left", "right", "up", "down"]; export type SwipeDirection = (typeof SWIPE_DIRECTIONS)[number]; /** * Continuous gesture values read each frame via `snap.gesture` (D-4). * Identity when no gesture is active or after a cancel/reset (AC-12): * pinchScale = 1.0, rotationAngle = 0. */ export interface GestureState { readonly pinchScale: number; readonly rotationAngle: number; } /** * Closed discriminant union of gesture lifecycle + instantaneous events * (AC-13). One-frame lifecycle: an event appears in exactly one frame's * `gestureEvents`. Every member carries `pointerType` (narrowed union, * AC-19) so consumers can exhaustively switch on gesture kind AND device * type without a default branch. */ export type GestureEvent = { readonly kind: 'pinch-begin'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'pinch-end'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'pinch-cancel'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'rotate-begin'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'rotate-end'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'rotate-cancel'; readonly pointerIds: readonly [number, number]; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'swipe'; readonly pointerId: number; readonly direction: SwipeDirection; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'long-press'; readonly pointerId: number; readonly x: number; readonly y: number; readonly pointerType: PointerType; readonly timestamp: number; } | { readonly kind: 'double-tap'; readonly pointerId: number; readonly x: number; readonly y: number; readonly pointerType: PointerType; readonly timestamp: number; }; /** Live position + device type for a pointer (subset of the backend pointerMap entry). */ export interface RecognizerPointer { readonly x: number; readonly y: number; readonly pointerType: PointerType; } /** Locked dual-finger tracker for pinch + rotate (D-11). */ export interface PinchRotateTracker { readonly pointerA: number; readonly pointerB: number; readonly initialDistance: number; /** Previous frame's raw atan2 angle; rotation accumulates frame deltas (D-11). */ readonly lastAngle: number; readonly pointerType: PointerType; } /** Per-pointer long-press arming state (D-10). */ export interface LongPressTracker { readonly downTime: number; readonly x: number; readonly y: number; readonly pointerType: PointerType; readonly armed: boolean; readonly fired: boolean; } /** Timestamped position sample for swipe velocity (D-10, 100ms window). */ export interface SwipeSample { readonly t: number; readonly x: number; readonly y: number; } /** Last recorded tap for double-tap window matching (D-10). */ export interface TapRecord { readonly time: number; readonly x: number; readonly y: number; } /** * The single legal cross-frame gesture state (C-3). Immutable: each * `processGestureFrame` returns a fresh copy; the producer stores it for * the next frame. `gesture` is the current continuous value read by * `snap.gesture` -- live during pinch, frozen after a 2->1 end, identity * after cancel/reset or when no gesture ever activated. */ export interface RecognizerState { readonly pinch: PinchRotateTracker | null; readonly gesture: GestureState; readonly longPresses: ReadonlyMap; readonly lastTap: TapRecord | null; readonly swipeHistory: ReadonlyMap; } /** Result of processing one frame of phase events (D-4 dual channel). */ export interface GestureFrameResult { readonly newState: RecognizerState; readonly gestureState: GestureState; readonly gestureEvents: readonly GestureEvent[]; } /** Identity continuous value (AC-12): no scale, no rotation. */ export declare const IDENTITY_GESTURE: GestureState; /** Fresh recognizer state with no active gestures. */ export declare function createRecognizerState(): RecognizerState; /** * Process one frame of pointer phase events, advancing all timers off * `now`, and return the new state + continuous values + one-frame event * list (D-4). Never mutates its inputs. */ export declare function processGestureFrame(phaseQueue: readonly PointerPhaseEvent[], pointerMap: ReadonlyMap, prevState: RecognizerState, now: number): GestureFrameResult; export {}; //# sourceMappingURL=gesture-recognizer.d.ts.map