1 | import type { DetailedError } from './utils.js';
|
2 | import type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';
|
3 | export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export declare class Diagram {
|
9 | text: string;
|
10 | metadata: Pick<DiagramMetadata, 'title'>;
|
11 | type: string;
|
12 | parser: DiagramDefinition['parser'];
|
13 | renderer: DiagramDefinition['renderer'];
|
14 | db: DiagramDefinition['db'];
|
15 | private init?;
|
16 | private detectError?;
|
17 | constructor(text: string, metadata?: Pick<DiagramMetadata, 'title'>);
|
18 | parse(): void;
|
19 | render(id: string, version: string): Promise<void>;
|
20 | getParser(): import("./diagram-api/types.js").ParserDefinition;
|
21 | getType(): string;
|
22 | }
|
23 | /**
|
24 | * Parse the text asynchronously and generate a Diagram object asynchronously.
|
25 | * **Warning:** This function may be changed in the future.
|
26 | * @alpha
|
27 | * @param text - The mermaid diagram definition.
|
28 | * @param metadata - Diagram metadata, defined in YAML.
|
29 | * @returns A the Promise of a Diagram object.
|
30 | * @throws {@link UnknownDiagramError} if the diagram type can not be found.
|
31 | * @privateRemarks This is exported as part of the public mermaidAPI.
|
32 | */
|
33 | export declare const getDiagramFromText: (text: string, metadata?: Pick<DiagramMetadata, 'title'>) => Promise<Diagram>;
|