/** * Touch event construction utilities. * Provides stateful touch tracking and gesture support. */ import type { Modifier } from './keyboard.js'; /** * Represents a single touch point on the screen. */ export interface TouchPoint { x: number; y: number; id?: number; radiusX?: number; radiusY?: number; rotationAngle?: number; force?: number; } /** * Touch event data returned by touch state methods. */ export interface TouchEventData { type: 'touchstart' | 'touchend' | 'touchmove' | 'touchcancel'; touches: TouchPoint[]; targetTouches: TouchPoint[]; changedTouches: TouchPoint[]; modifiers?: number; } /** * Stateful touch tracker that manages multiple simultaneous touches. * Ports Playwright's touchscreen state management pattern. */ export declare class TouchState { private activeTouches; private nextTouchId; private modifiers; /** * Get all currently active touches. * Returns cloned touch points to prevent mutation issues. */ getActiveTouches(): TouchPoint[]; /** * Get the number of active touches. */ getActiveTouchCount(): number; /** * Set the current modifiers (for keyboard integration). */ setModifiers(modifiers: Set): void; /** * Get the current modifier mask. */ private getModifierMask; /** * Start a touch at the given coordinates. * Returns touch ID for multi-touch tracking. */ touchStart(x: number, y: number): { id: number; event: TouchEventData; }; /** * Move an existing touch to new coordinates. */ touchMove(id: number, x: number, y: number): TouchEventData; /** * End a touch. */ touchEnd(id: number): TouchEventData; /** * Cancel all active touches. */ touchCancel(): TouchEventData; /** * Perform a tap (touchStart + touchEnd) at coordinates. */ tap(x: number, y: number): TouchEventData[]; /** * Perform a double tap. */ doubleTap(x: number, y: number): TouchEventData[]; /** * Perform a long press (touchStart, hold, touchEnd). * Returns all events; the caller is responsible for timing. */ longPress(x: number, y: number, _duration?: number): TouchEventData[]; /** * Perform a swipe from start to end. * Returns all events including intermediate move events. */ swipe(startX: number, startY: number, endX: number, endY: number, steps?: number): TouchEventData[]; /** * Perform a pinch gesture (two-finger zoom). * startDistance and endDistance are the distances between the two fingers. */ pinch(centerX: number, centerY: number, startDistance: number, endDistance: number, steps?: number): TouchEventData[]; /** * Reset all touch state. */ reset(): void; } /** * Create a TouchEvent from TouchEventData. */ export declare function createTouchEvent(target: EventTarget, data: TouchEventData): TouchEvent; /** * Dispatch a touch event on an element. */ export declare function dispatchTouchEvent(element: Element, data: TouchEventData): boolean; /** * Dispatch a tap sequence on an element at coordinates. */ export declare function dispatchTap(element: Element, x: number, y: number): boolean; /** * Dispatch a tap at coordinates (finds element automatically). */ export declare function dispatchTapAt(x: number, y: number, modifiers?: number): boolean; /** * Dispatch a swipe gesture at coordinates. */ export declare function dispatchSwipeAt(startX: number, startY: number, endX: number, endY: number, steps?: number): boolean; /** * Dispatch a pinch gesture at coordinates. */ export declare function dispatchPinchAt(centerX: number, centerY: number, startDistance: number, endDistance: number, steps?: number): boolean; //# sourceMappingURL=touch.d.ts.map