import { type EditorAssetGarbageOptions, type EditorDocument, type EditorDocumentFile, type LoadReport } from "@pixerate/editor/persistence"; import { type CreateAutosaveOptions, type SvelteAutosave } from "./autosave.svelte.js"; export interface CreateEditorAutosaveOptions extends Omit, "key" | "getSnapshot" | "serialize" | "deserialize" | "history"> { /** Snapshot key (default the document's `kind`). */ key?: string; /** * For documents with `assets`: after `markClean` or `discard` retire a snapshot, delete the * stored assets nothing refers to any more (`collectEditorAssetGarbage`, best effort, keeping * the assets the document uses now; default `true`). Needs `storage.keys`; `false` turns it off. */ collectAssetGarbage?: boolean | Omit; } export interface SvelteEditorAutosave extends Omit, "restore"> { /** Loads the recovered snapshot into the document and starts autosaving. */ restore(): LoadReport | undefined; } /** * `createAutosave` for any editor's `EditorDocument` (e.g. * `createMermaidDiagram(...).editorDocument`): snapshots it as an * `EditorDocumentFile` after each change, and `restore` loads a recovered * snapshot straight into the editor. Status and recovery stay reactive. */ export declare function createEditorAutosave(doc: EditorDocument, { collectAssetGarbage, ...options }: CreateEditorAutosaveOptions): SvelteEditorAutosave;