/**
 * Surfaces Types
 *
 * Defines types for the managed surface system that renders UI into named slots.
 * Surfaces handles layout, stacking, animations, and priority-based arbitration.
 */
import type { Placement } from '@floating-ui/dom';
import type { AnchorId } from '../actions/types.js';
/** Static surface slots with fixed positioning */
export type StaticSurfaceSlot = 'drawer_right' | 'drawer_left' | 'drawer_bottom' | 'overlay_center' | 'overlay_corner_br' | 'overlay_corner_bl' | 'toast_top' | 'toast_bottom';
/** Dynamic inline slot (rendered inside anchor) */
export type InlineSurfaceSlot = `inline:${string}`;
/** Dynamic adjacent slot (positioned near anchor) */
export type AdjacentSurfaceSlot = `adjacent:${string}`;
/** All surface slot types */
export type SurfaceSlot = StaticSurfaceSlot | InlineSurfaceSlot | AdjacentSurfaceSlot;
/** React component content */
export interface ReactContent {
    type: 'react';
    component: unknown;
    props?: Record<string, unknown>;
}
/** HTML string content */
export interface HtmlContent {
    type: 'html';
    content: string;
}
/** Widget reference content */
export interface WidgetContent {
    type: 'widget';
    widgetId: string;
    config?: Record<string, unknown>;
}
/** Custom mount function content */
export interface CustomContent {
    type: 'custom';
    mount: (container: HTMLElement) => () => void;
}
/** Union of all renderable content types */
export type RenderableContent = ReactContent | HtmlContent | WidgetContent | CustomContent;
/** Position configuration for adjacent slots */
export interface PositionConfig {
    placement: Placement | 'auto';
    offset?: {
        x: number;
        y: number;
    };
    flip?: boolean;
    shift?: boolean;
}
/** Size constraints for mounted content */
export interface MountConstraints {
    maxWidth?: string;
    maxHeight?: string;
    minWidth?: string;
    minHeight?: string;
}
/** Animation types for enter/exit */
export type AnimationType = 'fade' | 'slide' | 'scale' | 'none';
/** Options when mounting content to a surface */
export interface MountOptions {
    /** Priority for conflict resolution (higher wins) */
    priority?: number;
    /** Whether to unmount other content in the same slot */
    exclusive?: boolean;
    /** Animation for enter/exit */
    animation?: AnimationType;
    /** Position configuration for adjacent slots */
    position?: PositionConfig;
    /** Size constraints */
    constraints?: MountConstraints;
    /** ID of the adaptive mounting this content */
    adaptiveId?: string;
    /** Whether to auto-unmount on route change */
    autoUnmountOnRouteChange?: boolean;
}
/** Handle returned when content is mounted */
export interface MountHandle {
    /** Unique ID for this mount */
    id: string;
    /** Update the content */
    update: (content: RenderableContent) => void;
    /** Update mount options */
    setOptions: (opts: Partial<MountOptions>) => void;
    /** Unmount the content */
    unmount: () => void;
    /** Check if still mounted */
    isMounted: () => boolean;
    /** Get the DOM container element */
    getContainer: () => HTMLElement | null;
}
/** State of a surface slot */
export interface SurfaceState {
    /** The slot identifier */
    slot: SurfaceSlot;
    /** Whether the slot is currently occupied */
    occupied: boolean;
    /** Priority of the current content (if occupied) */
    currentPriority?: number;
    /** Adaptive ID that owns current content */
    currentAdaptiveId?: string;
    /** Total number of mounts to this slot this session */
    mountCount: number;
    /** ID of the current mount (if occupied) */
    currentMountId?: string;
}
/** Callback for surface state changes */
export type SurfaceChangeCallback = (state: SurfaceState) => void;
/** Widget registry interface (subset needed by Surfaces) */
export interface SurfacesWidgetRegistry {
    has: (id: string) => boolean;
    mount: (id: string, container: HTMLElement, config?: Record<string, unknown>) => {
        unmount: () => void;
        update: (config?: Record<string, unknown>) => void;
    };
}
/** Options for creating a Surfaces instance */
export interface SurfacesOptions {
    /** Overlay root element for rendering */
    overlayRoot: HTMLElement;
    /** Event bus for publishing surface events */
    eventBus?: {
        publish: (name: string, props?: Record<string, unknown>) => void;
    };
    /** Function to resolve anchor IDs to elements (for inline/adjacent slots) */
    anchorResolver?: (anchorId: AnchorId) => HTMLElement | null;
    /** Default animation type */
    defaultAnimation?: AnimationType;
    /** Widget registry for resolving widget content */
    widgetRegistry?: SurfacesWidgetRegistry;
}
/** The Surfaces interface */
export interface Surfaces {
    /** Mount content to a surface slot */
    mount: (slot: SurfaceSlot, content: RenderableContent, opts?: MountOptions) => MountHandle;
    /** Get the current state of a slot */
    getState: (slot: SurfaceSlot) => SurfaceState;
    /** Subscribe to state changes for a slot */
    onStateChange: (slot: SurfaceSlot, fn: SurfaceChangeCallback) => () => void;
    /** Check if content can be mounted to a slot */
    canMount: (slot: SurfaceSlot, priority?: number) => boolean;
    /** Clean up all mounted surfaces */
    destroy: () => void;
}
/** Resolved internal options (with defaults applied) */
export interface InternalMountOptions {
    priority: number;
    exclusive: boolean;
    animation: AnimationType;
    position: PositionConfig;
    constraints: MountConstraints;
    adaptiveId?: string;
    autoUnmountOnRouteChange: boolean;
}
/** Internal mount entry */
export interface InternalMountEntry {
    id: string;
    slot: SurfaceSlot;
    content: RenderableContent;
    options: InternalMountOptions;
    container: HTMLElement;
    cleanup?: () => void;
    mountedAt: number;
}
/** Slot type classifier */
export declare function getSlotType(slot: SurfaceSlot): 'static' | 'inline' | 'adjacent';
/** Extract anchor ID from inline/adjacent slots */
export declare function getSlotAnchorId(slot: SurfaceSlot): string | null;
