import { StoryLocator } from '@superdoc/document-api'; import { Editor } from '../../core/Editor.js'; import { StoryRuntime } from './story-types.js'; import { StoryRuntimeCache } from './runtime-cache.js'; /** * Runtime resolution options. * * Read operations use the default `'read'` intent. Write operations opt into * `'write'` so story-specific resolvers may prepare temporary write-only * runtimes for stories that do not exist yet. */ export interface ResolveStoryRuntimeOptions { intent?: 'read' | 'write'; } /** * Resolves a {@link StoryLocator} to a {@link StoryRuntime}. * * When the locator is `undefined` or targets the body, the host editor * itself is returned as a zero-cost passthrough runtime. * * For non-body stories (headers, footers, footnotes, endnotes), the * function delegates to story-specific resolution logic: * - **headerFooterSlot** — resolves via section variant lookup * - **headerFooterPart** — resolves directly by relationship ID * - **footnote / endnote** — resolves from the converter's note cache * * Resolved runtimes are cached by story key so that repeated calls with * the same locator return the same editor instance. * * @param hostEditor - The body (host) editor — always the document's primary editor. * @param locator - The story to resolve. `undefined` defaults to body. * @returns A resolved story runtime ready for operation execution. * * @throws {DocumentApiAdapterError} `STORY_NOT_FOUND` if the targeted * story cannot be located in the converter's data structures. * @throws {DocumentApiAdapterError} `INVALID_INPUT` if the locator has * an unrecognized story type. */ export declare function resolveStoryRuntime(hostEditor: Editor, locator?: StoryLocator, options?: ResolveStoryRuntimeOptions): StoryRuntime; /** * Invalidates a specific cached story runtime, disposing it and removing * it from the cache. * * The next call to {@link resolveStoryRuntime} for the same story key * will create a fresh runtime from the current converter data. * * @param hostEditor - The body (host) editor. * @param storyKey - The canonical story key to invalidate. * @returns `true` if the entry existed and was invalidated. */ export declare function invalidateStoryRuntime(hostEditor: Editor, storyKey: string): boolean; /** * Returns the {@link StoryRuntimeCache} attached to a host editor. * * Returns `undefined` if no cache has been created yet (i.e., no runtime * has been resolved for this editor). * * @param hostEditor - The body (host) editor. */ export declare function getStoryRuntimeCache(hostEditor: Editor): StoryRuntimeCache | undefined; //# sourceMappingURL=resolve-story-runtime.d.ts.map