export type FrameInteractionPhase = 'idle' | 'starting' | 'preview' | 'interacting'; export interface FrameInteractionScrollState { x: number; y: number; maxX: number; maxY: number; viewportWidth: number; viewportHeight: number; contentWidth: number; contentHeight: number; } export interface FrameInteractionSnapshot { frameId: string | null; phase: FrameInteractionPhase; scroll: FrameInteractionScrollState | null; } export interface FrameInteractionViewportAdapter { readScroll(): FrameInteractionScrollState; scrollTo(position: { x: number; y: number; }): void; focus?(): void; subscribe?(listener: () => void): () => void; } export interface FrameInteractionEntryContext { editMode: boolean; tool: string; hasRoute: boolean; liveOriginReady: boolean; backgroundOnly?: boolean; } /** Only a readable, code-backed screen with a runnable origin enters live input. */ export declare function canBeginFrameInteraction({ editMode, tool, hasRoute, liveOriginReady, backgroundOnly, }: FrameInteractionEntryContext): boolean; /** Keeps canvas tools authoritative except during selection or live input. */ export declare function canvasFramePointerEventsEnabled(editMode: boolean, tool: string, interactionActive: boolean): boolean; /** Hash and query changes stay in the same screen; another path leaves it. */ export declare function frameInteractionNavigationStaysInFrame(baselineHref: string, nextHref: string): boolean; /** Blocks document navigation while leaving ordinary in-screen events intact. */ export declare function installFrameInteractionNavigationGuard(view: Window, document: Document): () => void; /** * The per-runtime live-input session: the frame in live input, its phase and * scroll reading, the connected viewport bridge, and the listeners the shell * and panels subscribe through. The bodies below are the former module-level * functions, closed over instance state instead of module state. */ export declare function createFrameInteraction(): { beginFrameInteraction: (frameId: string) => void; exitFrameInteraction: (frameId?: string) => boolean; reconcileFrameInteractionScope: (activeFrameId: string | null, enabled: boolean) => boolean; getFrameInteractionSnapshot: () => FrameInteractionSnapshot; subscribeFrameInteraction: (listener: () => void) => () => void; connectFrameInteractionViewport: (frameId: string, adapter: FrameInteractionViewportAdapter) => () => void; connectFrameInteractionPreview: (frameId: string, root: ShadowRoot, contentElement: HTMLElement) => () => void; setFrameInteractionScroll: (position: { x?: number; y?: number; }) => boolean; connectFrameInteractionIframe: (frameId: string, iframe: HTMLIFrameElement) => () => void; resetFrameInteraction: () => void; }; export type FrameInteraction = ReturnType;