import { RefObject } from 'react'; export interface GesturePoint { x: number; y: number; } export interface GestureHandlers { /** Every press that starts a gesture, before anything else: where a running settle is finished. */ onPress?: () => void; /** Whether a horizontal swipe may page right now. */ canSwipe?: () => boolean; onSwipeMove?: (dx: number) => void; /** Also called with `(0, 0)` when the browser takes the gesture over. */ onSwipeEnd?: (dx: number, velocity: number) => void; /** What a press on `target` would pick up, or `null` where nothing can be dragged. */ dragFrom?: (target: Element, point: GesturePoint) => D | null; onDragStart?: (drag: D, point: GesturePoint) => void; onDragMove?: (point: GesturePoint) => void; onDragEnd?: (point: GesturePoint) => void; onDragCancel?: () => void; onPinchStart?: (center: GesturePoint, distance: number) => void; onPinchMove?: (center: GesturePoint, distance: number) => void; onPinchEnd?: () => void; /** The element a drag scrolls near its edges, and the band of the viewport that counts as its inside. */ autoScroll?: () => { element: HTMLElement; top: number; bottom: number; } | null; } /** * One owner for every pointer gesture inside `ref`, so a swipe, a long-press drag, a pinch and * the browser's own scrolling can never both act on the same touch. * * Mouse or touch rules are chosen per event from `pointerType`, not once from a media query, * which answers wrongly on a laptop with a touch screen. */ export declare function useGestures(ref: RefObject, handlers: GestureHandlers): void;