//#region src/parts.d.ts /** * Query a single part/slot within a component root */ declare const getPart: (root: Element, slot: string) => T | null; /** * Query all parts/slots within a component root */ declare const getParts: (root: Element, slot: string) => T[]; /** * Find all component roots within a scope by data-slot value */ declare const getRoots: (scope: ParentNode, slot: string) => T[]; declare function getRootBinding(root: Element, key: string): T | undefined; declare function hasRootBinding(root: Element, key: string): boolean; declare function setRootBinding(root: Element, key: string, value: T): T; declare function clearRootBinding(root: Element, key: string, value?: T): boolean; declare function warnRootBindingOnce(root: Element, key: string, message: string): void; declare function reuseRootBinding(root: Element, key: string, message: string): T | undefined; /** * Parse a boolean data attribute. * - Present with no value, "true", "1", "yes" → true * - "false", "0", "no" → false * - Absent or invalid → undefined */ declare function getDataBool(el: Element, key: string): boolean | undefined; /** * Parse a number data attribute. * - Valid finite number → number * - Absent, invalid, NaN, Infinity, empty → undefined */ declare function getDataNumber(el: Element, key: string): number | undefined; /** * Parse a string data attribute. * - Present (including empty string) → string * - Absent → undefined */ declare function getDataString(el: Element, key: string): string | undefined; /** * Parse an enum data attribute. * - Valid value in allowed array → T * - Absent or invalid → undefined */ declare function getDataEnum(el: Element, key: string, allowed: readonly T[]): T | undefined; /** Check if target is inside root, including portaled descendants. * Follows chained portal ownership for nested portals. */ declare function containsWithPortals(root: Element, target: Node | null): boolean; interface PortalState { originalParent: ParentNode | null; originalNextSibling: ChildNode | null; portaled: boolean; } declare function portalToBody(el: Element, originRoot: Element, state: PortalState): void; declare function restorePortal(el: Element, state: PortalState): void; //#endregion //#region src/aria.d.ts /** * Ensure an element has an id, generating one if needed */ declare const ensureId: (el: Element, prefix: string) => string; /** * Set or remove an ARIA attribute * Note: boolean values are converted to strings, use null to remove */ declare const setAria: (el: Element, name: string, value: string | boolean | null) => void; /** * Link content element to its label and description via ARIA */ declare const linkLabelledBy: (content: Element, title?: Element | null, description?: Element | null) => void; //#endregion //#region src/events.d.ts /** * Add an event listener and return a cleanup function */ declare function on(el: EventTarget, type: K, fn: (e: HTMLElementEventMap[K]) => void, opts?: AddEventListenerOptions): () => void; declare function on(el: EventTarget, type: string, fn: (e: Event) => void, opts?: AddEventListenerOptions): () => void; /** * Dispatch a custom event with optional detail */ declare const emit: (el: Element, name: string, detail?: T) => boolean; /** * Compose multiple event handlers into one * Handlers are called in order, stops if event.defaultPrevented */ declare const composeHandlers: (...handlers: Array<((e: E) => void) | undefined>) => ((e: E) => void); //#endregion //#region src/scroll.d.ts /** * Scroll lock utilities with reference counting. * Prevents body scroll when overlays (dialogs, selects, dropdowns) are open. * Uses scrollbar-gutter: stable to prevent layout shift. */ /** * Lock document scroll. Call when opening an overlay. * Uses reference counting - multiple overlays can be open simultaneously. */ declare function lockScroll(): void; /** * Unlock document scroll. Call when closing an overlay. * Only restores scroll when all overlays are closed (ref count reaches 0). */ declare function unlockScroll(): void; /** * Get current scroll lock count (for testing). */ //#endregion //#region src/popup.d.ts type PopupDirection = "ltr" | "rtl"; type PopupSide = "top" | "right" | "bottom" | "left" | "inline-start" | "inline-end"; type PopupAlign = "start" | "center" | "end"; interface PopupPlacementOptions { side: PopupSide; align: PopupAlign; sideOffset: number; alignOffset: number; avoidCollisions: boolean; collisionPadding: number; direction?: PopupDirection; allowedSides?: readonly PopupSide[]; } interface RectLike { top: number; right: number; bottom: number; left: number; width: number; height: number; } interface ComputeFloatingPositionInput extends PopupPlacementOptions { anchorRect: RectLike; contentRect: RectLike; viewportWidth?: number; viewportHeight?: number; } interface FloatingPosition { x: number; y: number; side: PopupSide; align: PopupAlign; } interface FloatingTransformOriginAnchor { x: number; y: number; } interface ComputeFloatingTransformOriginInput { side: PopupSide; align: PopupAlign; anchorRect: RectLike; popupX: number; popupY: number; direction?: PopupDirection; } declare const getFloatingTransformOriginAnchor: (side: PopupSide, align: PopupAlign, anchorRect: RectLike, direction?: PopupDirection) => FloatingTransformOriginAnchor; declare const computeFloatingTransformOrigin: (input: ComputeFloatingTransformOriginInput) => string; /** * Measure popup content size in a transform-stable way. * * `getBoundingClientRect()` reflects active CSS transforms (for example scale/zoom), * which can shift placement during open/close animations. `offsetWidth/offsetHeight` * stay in layout coordinates, so we prefer them when available. */ declare function measurePopupContentRect(element: HTMLElement): Pick; declare const focusElement: (el: HTMLElement | null | undefined) => void; interface ModalStackItemOptions { content: HTMLElement; overlay?: HTMLElement | null; onTabKeydown?: (event: KeyboardEvent) => void; cssVarPrefix: string; } interface ModalStackItemController { open(): void; close(): void; destroy(): void; } declare function createModalStackItem(options: ModalStackItemOptions): ModalStackItemController; declare function computeFloatingPosition(input: ComputeFloatingPositionInput): FloatingPosition; declare function ensureItemVisibleInContainer(item: HTMLElement, container: HTMLElement, padding?: number): void; interface PositionSyncOptions { onUpdate: () => void; isActive?: () => boolean; observedElements?: readonly Element[]; ignoreScrollTarget?: (target: EventTarget | null) => boolean; ancestorScroll?: boolean; syncOnScroll?: boolean; ancestorResize?: boolean; elementResize?: boolean; layoutShift?: boolean; animationFrame?: boolean; win?: Window; } interface PositionSyncController { start(): void; stop(): void; update(): void; } declare function createPositionSync(options: PositionSyncOptions): PositionSyncController; interface DismissLayerOptions { root: Element; isOpen: () => boolean; onDismiss: () => void; closeOnClickOutside?: boolean; closeOnEscape?: boolean; preventEscapeDefault?: boolean; isInside?: (target: Node | null) => boolean; } declare function createDismissLayer(options: DismissLayerOptions): () => void; interface PortalLifecycleOptions { content: Element; root: Element; enabled?: boolean; state?: PortalState; wrapperSlot?: string; /** * Optional authored element used for positioning/state attributes. * When provided, `container` is always this element. */ container?: Element; /** * Optional authored element to portal to `document.body`. * Defaults to `container` (if provided), otherwise `content`. */ mountTarget?: Element; } interface PortalLifecycleController { readonly state: PortalState; readonly container: Element; mount(): void; restore(): void; cleanup(): void; } declare function createPortalLifecycle(options: PortalLifecycleOptions): PortalLifecycleController; interface PresenceLifecycleOptions { element: HTMLElement; onExitComplete: () => void; win?: Window; } interface PresenceLifecycleController { readonly isExiting: boolean; enter(): void; exit(): void; cleanup(): void; } declare function createPresenceLifecycle(options: PresenceLifecycleOptions): PresenceLifecycleController; //#endregion export { type ComputeFloatingPositionInput, type ComputeFloatingTransformOriginInput, type DismissLayerOptions, type FloatingPosition, type FloatingTransformOriginAnchor, type ModalStackItemController, type ModalStackItemOptions, type PopupAlign, type PopupDirection, type PopupPlacementOptions, type PopupSide, type PortalLifecycleController, type PortalLifecycleOptions, type PortalState, type PositionSyncController, type PositionSyncOptions, type PresenceLifecycleController, type PresenceLifecycleOptions, clearRootBinding, composeHandlers, computeFloatingPosition, computeFloatingTransformOrigin, containsWithPortals, createDismissLayer, createModalStackItem, createPortalLifecycle, createPositionSync, createPresenceLifecycle, emit, ensureId, ensureItemVisibleInContainer, focusElement, getDataBool, getDataEnum, getDataNumber, getDataString, getFloatingTransformOriginAnchor, getPart, getParts, getRootBinding, getRoots, hasRootBinding, linkLabelledBy, lockScroll, measurePopupContentRect, on, portalToBody, restorePortal, reuseRootBinding, setAria, setRootBinding, unlockScroll, warnRootBindingOnce };