/** * A drag, tracked on the document until the pointer lets go. * * The dial of a clock is turned by dragging, and that gesture cannot be tracked on the element it * started on: the pointer leaves it immediately and the rest of the drag happens somewhere else. So * every renderer binds `mousemove`/`touchmove` and `mouseup`/`touchend` on the document and unbinds * them at the end — and each one wrote that itself, with two of them byte-identical. * * The sibling of `createLightDismiss` and `createFocusCustodian`: the plumbing of a gesture, not what * the gesture means. What the angle *becomes* is the widget's business and stays there. * * `touchmove` is bound non-passive on purpose. A dial that does not call `preventDefault` scrolls the * page under the finger instead of turning, and a passive listener is not allowed to prevent it. */ /** Where the pointer is, from either kind of event. */ export interface MdyDragPoint { readonly clientX: number; readonly clientY: number; } export interface MdyPointerDragOptions { /** Called for every move while the drag is live. */ onMove(point: MdyDragPoint, event: MouseEvent | TouchEvent): void; /** Called once when the pointer lets go, before the listeners come off. */ onEnd?(): void; /** Defaults to the global document; supplied by a host that lives in another one. */ readonly document?: Document; } export interface MdyPointerDrag { /** Begin tracking. Idempotent: a second start while live does not double-bind. */ start(): void; /** Stop tracking. Idempotent, and safe to call from a teardown that does not know the state. */ stop(): void; readonly dragging: boolean; } /** The point a mouse or touch event is at, or `null` for a touch event with no touches left. */ export declare function dragPointOf(event: MouseEvent | TouchEvent): MdyDragPoint | null; export declare function createPointerDrag(options: MdyPointerDragOptions): MdyPointerDrag;