/** * Floating window geometry — pure helpers for drag, resize, keyboard nudge, * and corner snap. Shared by every non-modal floating tool window. * * @see components/ui/floating-window.tsx */ interface FloatingWindowRect { x: number; y: number; width: number; height: number; } interface FloatingWindowViewport { width: number; height: number; } type FloatingWindowResizeHandle = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw"; type FloatingWindowCorner = "bottom-right" | "bottom-left" | "top-left" | "top-right"; /** Same inset every DS floating sheet uses (0.5rem). */ declare const FLOATING_WINDOW_INSET = 8; declare const FLOATING_WINDOW_MIN_WIDTH = 320; declare const FLOATING_WINDOW_MIN_HEIGHT = 360; declare const FLOATING_WINDOW_DEFAULT_WIDTH = 420; declare const FLOATING_WINDOW_DEFAULT_HEIGHT = 560; /** Arrow-key step, and the Shift-held step for crossing the screen faster. */ declare const FLOATING_WINDOW_NUDGE = 16; declare const FLOATING_WINDOW_NUDGE_COARSE = 48; declare const FLOATING_WINDOW_CORNERS: readonly ["bottom-right", "bottom-left", "top-left", "top-right"]; type FloatingWindowSizeOptions = { minWidth?: number; minHeight?: number; inset?: number; }; /** * Opens bottom-right by default — where a launcher FAB usually sits — so the * window reads as having grown out of the control that opened it. */ declare function defaultFloatingWindowRect(viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions & { width?: number; height?: number; /** Prefer `"bottom-right"` (default) or `"center-right"`. */ anchor?: "bottom-right" | "center-right"; }): FloatingWindowRect; /** * Keep the whole window inside the viewport inset. Stricter than most desktop * window managers — a half-off-screen window with unreachable handles is a trap. */ declare function clampFloatingWindowRect(rect: FloatingWindowRect, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; declare function moveFloatingWindowRect(rect: FloatingWindowRect, dx: number, dy: number, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; /** * Resize from one of eight handles. `start` is the rect when the gesture began; * deltas are measured from that instant so dragging past a clamp and back does * not accumulate discarded pixels. */ declare function resizeFloatingWindowRect(start: FloatingWindowRect, handle: FloatingWindowResizeHandle, dx: number, dy: number, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; declare function snapFloatingWindowRect(rect: FloatingWindowRect, corner: FloatingWindowCorner, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; /** Park in the next corner, keeping size. */ declare function snapFloatingWindowToNextCorner(rect: FloatingWindowRect, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; /** Keyboard resize from the bottom-right corner (top-left stays put). */ declare function nudgeFloatingWindowSize(rect: FloatingWindowRect, dx: number, dy: number, viewport: FloatingWindowViewport, options?: FloatingWindowSizeOptions): FloatingWindowRect; declare function readFloatingWindowViewport(): FloatingWindowViewport; export { FLOATING_WINDOW_CORNERS, FLOATING_WINDOW_DEFAULT_HEIGHT, FLOATING_WINDOW_DEFAULT_WIDTH, FLOATING_WINDOW_INSET, FLOATING_WINDOW_MIN_HEIGHT, FLOATING_WINDOW_MIN_WIDTH, FLOATING_WINDOW_NUDGE, FLOATING_WINDOW_NUDGE_COARSE, type FloatingWindowCorner, type FloatingWindowRect, type FloatingWindowResizeHandle, type FloatingWindowSizeOptions, type FloatingWindowViewport, clampFloatingWindowRect, defaultFloatingWindowRect, moveFloatingWindowRect, nudgeFloatingWindowSize, readFloatingWindowViewport, resizeFloatingWindowRect, snapFloatingWindowRect, snapFloatingWindowToNextCorner };