/** * High-level API: `render`, `renderAll`, `parse` and the 0.x-compatible * `renderPlantUml`. * @module api */ import { DiagramRegistry } from "./core/registry.mjs"; export type RenderOptions = import("./core/pipeline.mjs").RenderOptions; export type ApiOptions = RenderOptions & { block?: number | string; registry?: DiagramRegistry; }; /** @typedef {import("./core/pipeline.mjs").RenderOptions} RenderOptions */ /** * @typedef {RenderOptions & { block?: number | string, registry?: DiagramRegistry }} ApiOptions */ /** Registry with every bundled diagram type. */ export declare const defaultRegistry: DiagramRegistry; /** * The result of rendering one diagram. * @public */ export declare class RenderResult { /** Diagram kind, e.g. `sequence`. */ kind: string; /** Block name from `@startuml name`, if any. */ name: string; /** The Excalidraw document. */ excalidraw: import("./render/excalidraw.mjs").ExcalidrawDocument; /** Warnings collected while parsing. */ diagnostics: import("./core/diagnostics.mjs").Diagnostic[]; /** Number of `newpage` pages in the block. */ pages: number; /** Parsed (and laid out) diagram model. */ model: any; /** * @param {import("./core/pipeline.mjs").BlockOutput & { name: string | null }} output */ constructor(output: import("./core/pipeline.mjs").BlockOutput & { name: string | null; }); /** @returns {import("./render/excalidraw.mjs").ExcalidrawDocument} */ toJSON(): import("./render/excalidraw.mjs").ExcalidrawDocument; /** * Render as standalone SVG (Excalifont embedded). * @param {import("./render/svg.mjs").SvgOptions} [options] * @returns {Promise} */ toSvg(options?: import("./render/svg.mjs").SvgOptions): Promise; /** * Render as PNG. * @param {import("./render/png.mjs").PngOptions & Omit} [options] * @returns {Promise} */ toPng(options?: import("./render/png.mjs").PngOptions & Omit): Promise; } /** * Render a PlantUML document (the first `@start…@end` block by default). * @param {string} source PlantUML text. * @param {ApiOptions} [options] * @returns {Promise} * @public */ export declare function render(source: string, options?: ApiOptions): Promise; /** * Render every block of a document. * @param {string} source * @param {ApiOptions} [options] * @returns {Promise} * @public */ export declare function renderAll(source: string, options?: ApiOptions): Promise; /** * Parse without layout or rendering. Useful for tooling and tests. * @param {string} source * @param {ApiOptions} [options] * @returns {{ kind: string, model: any, diagnostics: import("./core/diagnostics.mjs").Diagnostic[] }} * @public */ export declare function parse(source: string, options?: ApiOptions): { kind: string; model: any; diagnostics: import("./core/diagnostics.mjs").Diagnostic[]; }; /** * Detect the diagram kind of a source without rendering it. * @param {string} source * @param {ApiOptions} [options] * @returns {string} * @public */ export declare function detectKind(source: string, options?: ApiOptions): string; /** * List bundled (or registered) diagram types. * @param {DiagramRegistry} [registry] * @returns {{ kind: string, title: string, starts: readonly string[] }[]} * @public */ export declare function listDiagramTypes(registry?: DiagramRegistry): { kind: string; title: string; starts: readonly string[]; }[]; /** * 0.x-compatible entry point: awaitable Excalidraw document with chained * `.toSvg()` / `.toPng()` helpers. * @param {string} source * @param {ApiOptions} [options] * @returns {Promise & { toSvg: (o?: import("./render/svg.mjs").SvgOptions) => Promise, toPng: (o?: import("./render/png.mjs").PngOptions) => Promise }} * @public */ export declare function renderPlantUml(source: string, options?: ApiOptions): Promise & { toSvg: (o?: import("./render/svg.mjs").SvgOptions) => Promise; toPng: (o?: import("./render/png.mjs").PngOptions) => Promise; }; /** * Pre-load and pre-heat the layout engine so the first real graph render does * not pay for it (loading ELK takes ~0.9 s, running it cold another ~0.6 s). * Hosts such as the MCP server, the VS Code extension or the Obsidian plugin * call this once at start-up, without awaiting it. * * Idempotent: concurrent and repeated calls share one promise. It has no * observable side effects — the layout cache is bypassed and the rendered * result is discarded — and never rejects: a failure is swallowed (and a later * call tries again), because warming up must never break rendering. * @returns {Promise} * @public */ export declare function warmup(): Promise;