import type { RuiPlacement } from './placement'; export type FloatingSize = { width: number; height: number; }; export type FloatingCoords = { x: number; y: number; }; export type FloatingViewport = { width: number; height: number; padding: number; }; export type FloatingPositionResult = { coords: FloatingCoords; placement: RuiPlacement; }; /** * Computes fixed-position coords for a floating surface. * * @remarks * Prefers `placement`, then flips on the primary axis when the opposite side * has more free space. Clamps only the cross-axis so the floating surface * never slides onto its anchor. */ export declare function computeFloatingCoords(anchor: DOMRect, size: FloatingSize, placement: RuiPlacement, gap: number, viewport?: FloatingViewport): FloatingCoords; /** * Computes fixed-position coords and the resolved placement (after flip). */ export declare function computeFloatingPosition(anchor: DOMRect, size: FloatingSize, placement: RuiPlacement, gap: number, viewport?: FloatingViewport): FloatingPositionResult; /** Applies fixed coords to a floating element. */ export declare function applyFloatingPosition(anchor: HTMLElement, floating: HTMLElement, placement: RuiPlacement, gap: number, options?: { matchAnchorWidth?: boolean; }): RuiPlacement; export type AttachFloatingOptions = { anchor: HTMLElement; floating: HTMLElement; getPlacement: () => RuiPlacement; gap: number; matchAnchorWidth?: boolean; }; /** * Positions on attach and keeps the floating element updated on scroll/resize. * * @returns Cleanup that removes listeners and observers. */ export declare function attachFloating({ anchor, floating, getPlacement, gap, matchAnchorWidth, }: AttachFloatingOptions): () => void;