/** * Movement data for a single animation-frame-batched drag update */ export interface DragMoveFrame { /** Adjusted absolute translateY position after rubber band resistance (px) */ adjustedY: number; /** Y delta from the point where the drag began (px) */ deltaY: number; /** Openness ratio: 1 fully open, 0 fully closed (not clamped) */ ratio: number; /** Current gesture velocity (px/ms, positive = downward) */ velocity: number; } /** * Outcome of a released gesture. * * The controller reports where the sheet would coast to; choosing a resting * position from that is the caller's business, since only it knows the * configured detents. */ export interface DragRelease { /** Position the sheet would come to rest at if left to decelerate (px) */ projectedY: number; /** Release velocity (px/s, positive = downward) */ velocity: number; } /** * Configuration for the drag controller */ export interface DragControllerConfig { /** Sheet root element: the whole sheet is draggable */ element: HTMLElement; /** Returns the current sheet translateY (px), read when the drag begins */ getPosition: () => number; /** Returns the total sheet height (px) for resistance and projection */ getSheetHeight: () => number; /** Returns the translateY of the most open detent, past which the sheet resists */ getTopBound: () => number; /** Whether the sheet is resting at its most open detent */ isAtLargestDetent: () => boolean; /** Whether drag processing is currently allowed */ isEnabled: () => boolean; /** Called when a drag gesture starts (slop threshold crossed) */ onDragStart: () => void; /** Called synchronously on each move so a drag takes over a running animation */ onTakeover: () => void; /** Called on each animation-frame-batched move */ onMove: (frame: DragMoveFrame) => void; /** Called when the gesture ends (release, cancel or abort) */ onDragEnd: () => void; /** Called with the snap/dismiss decision after release */ onRelease: (release: DragRelease) => void; /** Called when the browser takes the gesture away, to restore the resting position */ onAbort: () => void; } /** * Drag controller for BootstrapSheet. * * Owns pointer input and gesture physics: gesture arbitration against * scrollable content, drag slop, animation-frame batching of moves, windowed * velocity tracking, rubber band resistance and the snap/dismiss decision on * release. DOM side effects (transform, backdrop opacity, class names, events, * animations) are delegated to the caller via callbacks. * * The whole sheet is draggable. A gesture that starts inside a scrolled * container, inside an opt-out subtree, or too soon after a content scroll * belongs to the content instead; see `#resolveOwner` and `#decideOwner`. */ export default class DragController { #private; constructor(config: DragControllerConfig); /** * Whether a drag gesture is currently in progress */ get isDragging(): boolean; /** * Attach event listeners */ attach(): void; /** * Detach event listeners and cancel any pending frame */ detach(): void; /** * Abort the current drag without a release decision or an abort callback. * Used when the sheet is going away on its own (hide, dispose). */ abort(): void; } //# sourceMappingURL=drag-controller.d.ts.map