export type PortalDirection = 'up' | 'down'; export type PortalAlign = 'left' | 'right'; export type AnchorRect = Readonly>; export declare const PORTAL_PANEL_Z_INDEX = 1500; export type ComputePortalPositionParams = Readonly<{ anchorRect: AnchorRect; panelHeight: number; panelWidth: number; direction: PortalDirection; align?: PortalAlign; offset?: number; }>; export type PortalPosition = Readonly<{ top: number; left: number; }>; export declare const computePortalPosition: ({ anchorRect, panelHeight, panelWidth, direction, align, offset, }: ComputePortalPositionParams) => PortalPosition; export type ResolveDropdownDirectionParams = Readonly<{ anchorRect: Pick; panelHeight: number; viewportHeight: number; gap?: number; }>; export declare const resolveDropdownDirection: ({ anchorRect, panelHeight, viewportHeight, gap, }: ResolveDropdownDirectionParams) => PortalDirection; export type BuildPortalPanelStyleParams = Readonly<{ anchorRect: AnchorRect; panelHeight: number; panelWidth: number | null; direction: PortalDirection; align?: PortalAlign; offset?: number; /** * true 이면 panelWidth 를 무시하고 anchorRect.width 로 minWidth 를 설정한다. * align: 'right' 와 조합 시 콘텐츠가 앵커보다 넓으면 우측 정렬이 보장되지 않는다. */ matchAnchorWidth?: boolean; }>; export type PortalPanelStyle = Readonly<{ position: 'fixed'; top: number; left: number; zIndex: number; minWidth?: number; }>; export declare const buildPortalPanelStyle: ({ anchorRect, panelHeight, panelWidth, direction, align, offset, matchAnchorWidth, }: BuildPortalPanelStyleParams) => PortalPanelStyle; export type ObserveAnchorGeometryParams = Readonly<{ getAnchor: () => HTMLElement | null; /** ResizeObserver 는 구독 시점의 패널에만 부착된다 — 이후 교체·마운트되어도 옵저버는 갱신되지 않는다. */ getPanel: () => HTMLElement | null; onChange: () => void; }>; export declare const observeAnchorGeometry: ({ getAnchor, getPanel, onChange }: ObserveAnchorGeometryParams) => (() => void); export type TrackPortalPositionParams = Readonly<{ getAnchor: () => HTMLElement | null; getPanel: () => HTMLElement | null; /** 함수를 넘기면 갱신마다 다시 읽는다 — 열린 뒤 패널 높이가 변하는 소비자가 방향을 재판정할 수 있다 */ direction: PortalDirection | (() => PortalDirection); align?: PortalAlign; offset?: number; matchAnchorWidth?: boolean; onUpdate: (style: PortalPanelStyle) => void; }>; export declare const trackPortalPosition: ({ onUpdate, ...measureOptions }: TrackPortalPositionParams) => (() => void); export declare const applyPortalPanelStyle: (element: HTMLElement, style: PortalPanelStyle) => void;