/** * Draggable bubble utility. * * Attaches pointer-based drag behavior to a fixed-position bubble element. * Persists the drag offset in localStorage so the position survives page * navigations and transfers between the lightweight and full bubbles. */ interface DraggableOptions { /** Element that initiates the drag (defaults to the target element itself) */ handle?: HTMLElement; /** * Fired after the element settles at a new position: initial restore * from localStorage, drag end, and viewport resize re-clamp. The chat * widget uses this to recompute the panel's opening direction so the * panel always extends into whichever side of the viewport has more * room (see `usePanelAnchor` in `ui/ChatRoot.tsx`). */ onPositionChange?: () => void; } interface DragHandle { destroy: () => void; } /** * Make a fixed-position element draggable. * * @param el The element to reposition via translate3d. * @param opts.handle Optional drag handle element (e.g. bubble * inside a container). Pointer events listen * on the handle; transform applies to `el`. * Defaults to `el` itself. * @param opts.onPositionChange Called after the element settles — * initial restore, drag end, and viewport * resize re-clamp. Used by the chat widget * to recompute the panel's opening * direction. * * - Restores persisted position from localStorage on attach. * - Persists position on drag end (and on resize when the clamp had to * correct an out-of-bounds value, so the next page load is consistent). * - Distinguishes click from drag via a 5px movement threshold. * When dragged, the subsequent `click` event on the handle is suppressed once. * - Re-clamps on viewport resize. */ export declare function makeDraggable(el: HTMLElement, opts?: DraggableOptions): DragHandle; export {};