import{type Placement}from'@floating-ui/dom';import{type VirtualAnchor}from'./positioner-geometry.js';export{virtualAnchorFromRect,type VirtualAnchor}from'./positioner-geometry.js'; /** What `place()` reports back after each recomputation, for a caller that renders an arrow or * reflects the resolved side (which `flip()` may have changed) into a part name or attribute. */ export interface PlacementResult{ /** The placement actually used, after `flip()`/`shift()` — not necessarily the requested one. */ placement:Placement; /** Arrow offsets within the popup, present only when an `arrow` element was supplied. */ arrow?:{x?:number;y?:number;};} /** * Which CSS positioning scheme the popup is laid out with. `fixed` (this library's default) * normally positions against the viewport, but transformed, filtered or containing ancestors can * establish its containing block and clipping still applies. It does not guarantee escape from * every ancestor. `absolute` positions against its containing block and can scroll with that * content; choose the strategy to match the surrounding layout. */ export type PlaceStrategy='absolute'|'fixed'; /** Which axes `autoSize` re-measures against its own boundary and padding. */ export type PlaceAutoSize='horizontal'|'vertical'|'both'; /** Which of the anchor's dimensions the popup copies. */ export type PlaceSync='width'|'height'|'both'; /** * What `flip()` settles on when no candidate placement fits. * `best-fit` takes the least-overflowing candidate; `initial-placement` keeps the requested one. */ export type PlaceFlipFallbackStrategy='best-fit'|'initial-placement'; /** The clipping context an overflow-aware middleware measures against, instead of the viewport. */ export type PlaceBoundary=Element|Element[];export interface PlaceOptions{placement?:Placement; /** CSS positioning scheme for the popup. Default `'fixed'`. */ strategy?:PlaceStrategy; /** Distance from the anchor along the placement axis. */ offset?:number; /** Distance along the perpendicular axis — Floating UI's cross-axis offset. */ skidding?:number; /** Shared clipping context for every overflow-aware middleware. A middleware-specific boundary * below takes precedence when supplied. An empty array intentionally means viewport-only * clipping because Floating UI still applies its viewport root boundary. */ boundary?:PlaceBoundary; /** Flip to the opposite side when the requested one does not fit. Default `true`. */ flip?:boolean; /** Placements `flip()` tries, in order, instead of just the opposite side. */ flipFallbackPlacements?:Placement[]; /** What `flip()` falls back to when none of the candidates fit. Default `'best-fit'`. */ flipFallbackStrategy?:PlaceFlipFallbackStrategy; /** Clipping context `flip()` measures overflow against. Default: the clipping ancestors. */ flipBoundary?:PlaceBoundary; /** Padding kept clear inside the flip boundary. Default `0`, matching Floating UI. */ flipPadding?:number; /** Shift along the anchor's edge to stay in view. Default `true`. */ shift?:boolean; /** Clipping context `shift()` measures overflow against. Default: the clipping ancestors. */ shiftBoundary?:PlaceBoundary; /** Padding kept clear inside the shift boundary. Defaults to `padding` when omitted. */ shiftPadding?:number; /** Viewport padding used by `shift()` and the available-size measurement. */ padding?:number; /** * Re-measures the available space on the named axes against `autoSizeBoundary`/`autoSizePadding` * instead of the shared `padding`, overwriting the matching * `--lr-positioner-available-inline-size`/`--lr-positioner-available-block-size` value. The * unnamed axis keeps the default measurement — `place()` has always published both, so this * narrows or widens an existing constraint rather than introducing one. */ autoSize?:PlaceAutoSize; /** Clipping context the `autoSize` measurement uses. Default: the clipping ancestors. */ autoSizeBoundary?:PlaceBoundary; /** Padding kept clear inside the auto-size boundary. Default `0`, matching Floating UI. */ autoSizePadding?:number; /** Copies the anchor's inline size, block size, or both onto the popup. */ sync?:PlaceSync; /** An arrow element inside the popup to position against the anchor's centre. */ arrow?:HTMLElement; /** Keeps the arrow this far from the popup's corners. */ arrowPadding?:number; /** * An element to clip into the quad spanning the anchor and the popup, so a pointer crossing the * `offset` gap between them never leaves both. `place()` writes the four corner coordinates as * `--lr-positioner-hover-bridge-*` custom properties on it; the caller's own stylesheet turns * those into a `clip-path`. */ hoverBridge?:HTMLElement; /** Called after every recomputation with the resolved placement. */ onPlaced?:(result:PlacementResult)=>void;} /** * Position `popup` relative to `anchor` with flip/shift, keeping it updated on scroll/resize. * Returns a cleanup function that stops updating. Re-calling `place()` on the same popup with * different options is the supported way to change them: each call re-establishes every write it * owns, so no run inherits the previous one's sizing. Throws `RangeError` before observers, * callbacks, or style writes when an input rect or numeric option is non-finite, or when a rect * dimension/padding is negative; signed finite `offset` and `skidding` remain supported. */ export declare function place(anchor:Element|VirtualAnchor,popup:HTMLElement,opts?:PlaceOptions):()=>void; /** * Calls `onUpdate` with `target`'s current viewport-relative rect whenever it changes (scroll, * resize, layout mutation, or visual-viewport change) — the same auto-update machinery `place()` * uses, minus the anchor/floating placement math, for a caller that needs to track a raw rect * (e.g. a spotlight cutout sized to match an arbitrary target) rather than position a second * element relative to one. `target` is passed as both the reference and floating element to * Floating UI's `autoUpdate()` since only change notifications are needed, not independent * positioning of a second element -- `autoUpdate()` does not require these to differ; any * resulting double-invocation of `onUpdate` per tick (from ancestor-scroll listeners being * attached once per role) is harmless, since `getBoundingClientRect()` reads are idempotent. * Returns a cleanup function, same contract as `place()`. Calls `onUpdate` once synchronously * before returning (through `autoUpdate()`'s own initial publication) so the first paint doesn't * wait for a scroll/resize tick. */ export declare function trackRect(target:HTMLElement,onUpdate:(rect:DOMRect)=>void):()=>void;