/** * popover - shared helpers for panels that must escape the grid's * `overflow:hidden` scroll container by portalling to : the theme-var * snapshot + portal action, and the fixed-position anchor/flip math. Rune-free * and DOM-only so it is reused verbatim by SvGridDropdown, SvDateTimePicker and * any future popover. The per-component `$effect` wiring (scroll/resize * reposition, outside-click close) stays in the component since it needs the * component's own open state. */ /** * Theme tokens a portalled panel must carry with it. `--sg-*` custom properties * are scoped to whatever wrapper the grid sits inside (e.g. a per-preset theme * class); moving the panel to leaves that scope, so we snapshot the * resolved values and pin them inline. Keep this list in sync with the tokens * any popover panel actually consumes. */ export declare const PANEL_THEME_VARS: readonly ["--sg-accent", "--sg-on-accent", "--sg-bg", "--sg-fg", "--sg-muted", "--sg-border", "--sg-header-bg", "--sg-header-fg", "--sg-row-hover-bg", "--sg-row-alt-bg", "--sg-selection-bg", "--sg-selection-fg", "--sg-input-bg", "--sg-input-border", "--sg-danger", "--sg-focus-ring", "--sg-radius", "--sg-font", "--sg-invalid-bg", "--sg-invalid-border", "--sg-invalid-fg", "--sg-rating-on", "--sg-rating-empty", "--sg-rating-hover"]; /** * Svelte action: snapshot the resolved theme tokens from the node's current * (in-scope) position, then detach it and append to so it can never be * clipped by an ancestor's overflow. Removes itself on destroy. */ export declare function portalToBody(node: HTMLElement, vars?: ReadonlyArray): { destroy(): void; }; /** * Svelte action: play a short enter animation when a portalled panel mounts * (dropdowns, popovers, dialogs). Slides from the trigger side + fades/scales in. * A no-op under `prefers-reduced-motion` and in environments without the Web * Animations API (jsdom), so tests and reduced-motion users are unaffected. * * `use:popIn={{ up: rect.openUpward }}` - pass `up` for panels that flipped above * their trigger so the slide direction matches. */ export declare function popIn(node: HTMLElement, param?: { up?: boolean; duration?: number; scale?: number; }): {} | undefined; export type AnchoredRect = { top: number; left: number; width: number; openUpward: boolean; /** * Comfortable panel height: the estimate, capped to the room on the chosen * side so the panel never leaves the viewport. Apply as the panel's * `max-height` and long content scrolls inside instead of overflowing. */ maxHeight: number; /** * Absolute height the panel may occupy on the chosen side (room minus the * viewport margin). The hard ceiling a user resize must clamp to. */ availHeight: number; /** * For an upward-flipped panel: distance from the viewport bottom to where the * panel's bottom edge sits (just above the trigger). Bottom-anchoring an * upward panel with `style:bottom` lets it grow to its natural content height * instead of being positioned from a (possibly wrong) height estimate. * Undefined until `anchoredRect` computes it. */ bottom?: number; }; export type AnchorOptions = { /** Estimated panel height, used to decide whether to flip upward. */ estimatedHeight: number; /** Gap between trigger and panel. Default 2px. */ gap?: number; /** Force the panel at least this wide (else it matches the trigger). */ minWidth?: number; /** Keep the panel within the viewport horizontally. Default true. */ clampHorizontal?: boolean; /** Viewport edge kept clear top/bottom so a panel never touches it. Default 8. */ viewportMargin?: number; /** Floor for `maxHeight`/`availHeight` so a cramped panel stays usable. Default 96. */ minHeight?: number; }; /** * Compute a `position: fixed` rect anchored to `triggerRect`, flipping above the * trigger when there isn't room below and there's more room above. Generalized * with min-width + horizontal clamping for wider panels (date/time popovers), * and with vertical bounds detection: `maxHeight` caps the panel to the room on * the chosen side (minus a viewport margin) so a long list near a screen edge * scrolls internally rather than overflowing, and an upward flip is clamped so * its top never leaves the viewport. */ export declare function anchoredRect(triggerRect: DOMRect, opts: AnchorOptions): AnchoredRect;