import type { DomicileHost } from "../domicile-host"; import type { On } from "./subscribe"; export type GestureKind = "edge" | "hold" | "pinch" | "swipe"; /** The side of the display an edge swipe came in from. */ export type GestureEdge = "bottom" | "left" | "right" | "top"; export type GesturePhase = "begin" | "end" | "update"; /** A phase of a grabbed gesture. */ export type Gesture = { kind: GestureKind; phase: GesturePhase; fingers: number; /** * This update's motion, in the touchpad's accelerated pointer units, or an * edge swipe's in the display's pixels. */ dx: number; dy: number; /** A pinch's scale relative to its begin. */ scale: number; /** This update's rotation, in degrees clockwise. */ rotation: number; /** On an end: the gesture was abandoned rather than finished. */ canceled: boolean; /** An edge swipe's side; `undefined` for every other kind. */ edge: GestureEdge | undefined; }; export type GesturesListeners = { /** A phase of a grabbed gesture, wherever the pointer is. */ gesture: (gesture: Gesture) => void; }; export type Gestures = { /** * Route `gesture`, written `swipe`, `pinch` or `hold` with an optional * finger count such as `swipe:3`, to the page rather than to the window * under the pointer. A count left out is any of three or more. Or a * touchscreen finger in from a display's edge: `edge:left`, `right`, `top` * or `bottom`, or `edge` for any. Throws a SyntaxError for a gesture * written wrong or of fewer than three fingers. */ grab: (gesture: string) => void; /** Answer one {@link Gestures.grab}; the last gives the gesture back. */ ungrab: (gesture: string) => void; on: On; }; export type GesturesHost = Pick; export declare const gestures: (host: GesturesHost) => Gestures;