import { EditorRuntime, EditorRuntimeDocumentMode, EditorRuntimeId } from '../index.js'; /** Event on/off surface shared by the v1 `Editor` and `PresentationEditor`. */ export interface V1EventTargetLike { on?(event: string, handler: (...args: unknown[]) => void): void; off?(event: string, handler: (...args: unknown[]) => void): void; } /** The subset of the PM document the adapter reads (selected-text only). */ export interface V1DocLike { textBetween(from: number, to: number, blockSeparator?: string, leafText?: string): string; } /** The subset of the PM editor state the adapter reads. */ export interface V1EditorStateLike { doc: V1DocLike; selection: { from: number; to: number; empty?: boolean; }; } /** The subset of the v1 `Editor` the adapter delegates to. */ export interface V1EditorLike extends V1EventTargetLike { options?: { documentId?: string; documentMode?: string; }; state?: V1EditorStateLike; view?: { focus(): void; }; commands?: Record unknown>; focus?(): void; exportDocx?(params?: unknown): Promise; setDocumentMode?(mode: EditorRuntimeDocumentMode): void; } /** The subset of the v1 `PresentationEditor` the adapter delegates to. */ export interface V1PresentationEditorLike extends V1EventTargetLike { focus?(): void; setZoom?(zoom: number): void; scrollToPosition?(pos: number, options?: Record): boolean; setDocumentMode?(mode: EditorRuntimeDocumentMode): void; } export interface V1EditorRuntimeAdapterOptions { /** Registry-unique runtime id (minted by the shell). */ readonly id: EditorRuntimeId; /** Document id this runtime backs. */ readonly documentId: string; /** Shell-owned host wrapper element (NOT painter DOM). */ readonly root: HTMLElement; /** The live v1 editor, available from `onEditorCreate`. */ readonly editor: V1EditorLike; /** * Called exactly once when the runtime tears down (the wrapped editor emits * `destroy`, or `dispose()` is called). The shell wires this to * `superdoc.unregisterEditorRuntime(id)` so active-state policy stays with the * registry - the adapter never nulls or promotes active editor state itself *. */ readonly onUnregister?: (id: EditorRuntimeId) => void; /** * Global v1 zoom forwarder. v1 zoom is GLOBAL in current implementation (the shell calls the * static `PresentationEditor.setGlobalZoom`), so the per-runtime `setZoom` * forwards here rather than claiming isolated per-root zoom. When * omitted, `setZoom` falls back to the attached presentation editor instance. */ readonly setGlobalZoom?: (factor: number) => void; } /** * Wrap the live v1 editor (and, once ready, its presentation editor) in the * shell-owned {@link EditorRuntime} contract. * * Returns the runtime plus an `attachPresentationEditor` hook the shell calls at * `onEditorReady`. The adapter is "pending" (state `opening`) until then. */ export declare function createV1EditorRuntimeAdapter(options: V1EditorRuntimeAdapterOptions): { runtime: EditorRuntime; attachPresentationEditor(presentationEditor: V1PresentationEditorLike): void; }; //# sourceMappingURL=v1-editor-runtime-adapter.d.ts.map