/** * FIX-498 — Pure tooltip positioning with viewport flip + clamp. * * The Tooltip component used to split positioning between JS (top/left set on the * portaled node) and CSS translate classes (`-translate-x-1/2 -translate-y-full`). * With no JS-side number to test, a near-viewport-edge tooltip overflowed and was * clipped (e.g. header status bar under the 42px --header-height). * * This helper places the tooltip FULLY in JS — including the half-size centering * the CSS translate used to perform — so overflow is testable. `side` becomes a * PREFERENCE: if the primary axis overflows and the opposite side has room, it * flips; the cross-axis is clamped into the viewport (`max` applied last so an * oversized tooltip sticks to the margin edge instead of going negative). * * Extracted as a pure function because jsdom computes no layout, so the component * itself can't be positioned in vitest — the math is asserted here instead. */ export type TooltipSide = "top" | "right" | "bottom" | "left"; export interface Rect { top: number; left: number; right: number; bottom: number; width: number; height: number; } export interface Size { width: number; height: number; } export interface Viewport { width: number; height: number; } export interface TooltipPlacement { top: number; left: number; side: TooltipSide; } /** * Compute the final on-screen position for a tooltip. * * @param trigger Bounding rect of the trigger element. * @param tooltip Measured natural size of the tooltip. * @param side Preferred side (may flip to its opposite on overflow). * @param viewport Viewport dimensions. * @param gap Trigger↔tooltip offset (the legacy ±8). * @param margin Minimum padding from the viewport edge. */ export declare function computeTooltipPosition(trigger: Rect, tooltip: Size, side: TooltipSide, viewport: Viewport, gap?: number, margin?: number): TooltipPlacement; //# sourceMappingURL=tooltipPosition.d.ts.map