Files
upstream-tldraw/packages/mermaid/api-report.api.md
upstream-mirror a774ac673a
Some checks failed
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
i18n upload strings / Upload latest strings (push) Failing after 1s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 1s
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 1s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 1s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
snapshot of https://github.com/tldraw/tldraw.git (main, 2026-09-23; blobs > 131072B omitted)
2026-09-23 16:12:52 +05:00

5.8 KiB

API Report File for "@tldraw/mermaid"

Do not edit this file. It is a report generated by API Extractor.


import { Editor } from 'tldraw';
import type { TLArrowShapeArrowheadStyle } from 'tldraw';
import type { TLDefaultColorStyle } from 'tldraw';
import type { TLDefaultDashStyle } from 'tldraw';
import type { TLDefaultFillStyle } from 'tldraw';
import type { TLDefaultHorizontalAlignStyle } from 'tldraw';
import type { TLDefaultSizeStyle } from 'tldraw';
import type { TLDefaultVerticalAlignStyle } from 'tldraw';
import type { TLGeoShapeGeoStyle } from 'tldraw';
import type { TLShape } from 'tldraw';
import type { TLShapeId } from 'tldraw';

// @public (undocumented)
export interface BlueprintRenderingOptions {
    // (undocumented)
    centerOnPosition?: boolean;
    mapNodeToRenderSpec?: MermaidNodeRenderMapper;
    // (undocumented)
    position?: {
        x: number;
        y: number;
    };
}

// @public
export function createMermaidDiagram(editor: Editor, text: string, options?: MermaidDiagramOptions): Promise<void>;

// @public
export function defaultCreateMermaidNodeFromBlueprint(args: MermaidNodeCreateFunctionArgs): TLShape;

// @public
export function defaultMermaidNodeRenderSpec(diagramKind: MermaidDiagramKind, kind: string): MermaidBlueprintNodeRenderSpec;

// @public
export interface DiagramMermaidBlueprint {
    // (undocumented)
    diagramKind: MermaidDiagramKind;
    // (undocumented)
    edges: MermaidBlueprintEdge[];
    // (undocumented)
    groups?: string[][];
    // (undocumented)
    lines?: MermaidBlueprintLineNode[];
    // (undocumented)
    nodes: MermaidBlueprintNode[];
}

// @public
export const MERMAID_MINDMAP_NODE_TYPE: {
    readonly BANG: 5;
    readonly CIRCLE: 3;
    readonly CLOUD: 4;
    readonly DEFAULT: 0;
    readonly HEXAGON: 6;
    readonly RECT: 2;
    readonly ROUNDED_RECT: 1;
};

// @public (undocumented)
export interface MermaidBlueprintEdge {
    anchorEndX?: number;
    // (undocumented)
    anchorEndY?: number;
    anchorStartX?: number;
    // (undocumented)
    anchorStartY?: number;
    // (undocumented)
    arrowheadEnd?: TLArrowShapeArrowheadStyle;
    // (undocumented)
    arrowheadStart?: TLArrowShapeArrowheadStyle;
    // (undocumented)
    bend: number;
    // (undocumented)
    color?: TLDefaultColorStyle;
    // (undocumented)
    dash?: TLDefaultDashStyle;
    // (undocumented)
    decoration?: {
        type: 'autonumber';
        value: string;
    };
    // (undocumented)
    endNodeId: string;
    // (undocumented)
    isExact?: boolean;
    // (undocumented)
    isExactEnd?: boolean;
    // (undocumented)
    isPrecise?: boolean;
    // (undocumented)
    isPreciseEnd?: boolean;
    // (undocumented)
    label?: string;
    // (undocumented)
    size?: TLDefaultSizeStyle;
    // (undocumented)
    startNodeId: string;
}

// @public (undocumented)
export interface MermaidBlueprintLineNode {
    // (undocumented)
    color?: TLDefaultColorStyle;
    // (undocumented)
    dash?: TLDefaultDashStyle;
    // (undocumented)
    endX?: number;
    // (undocumented)
    endY: number;
    // (undocumented)
    id: string;
    // (undocumented)
    size?: TLDefaultSizeStyle;
    // (undocumented)
    x: number;
    // (undocumented)
    y: number;
}

// @public
export interface MermaidBlueprintNode {
    // (undocumented)
    align?: TLDefaultHorizontalAlignStyle;
    background?: boolean;
    // (undocumented)
    color?: TLDefaultColorStyle;
    // (undocumented)
    dash?: TLDefaultDashStyle;
    // (undocumented)
    fill?: TLDefaultFillStyle;
    // (undocumented)
    h: number;
    // (undocumented)
    id: string;
    kind: string;
    // (undocumented)
    label?: string;
    // (undocumented)
    parentId?: string;
    // (undocumented)
    size?: TLDefaultSizeStyle;
    // (undocumented)
    verticalAlign?: TLDefaultVerticalAlignStyle;
    // (undocumented)
    w: number;
    // (undocumented)
    x: number;
    // (undocumented)
    y: number;
}

// @public
export type MermaidBlueprintNodeRenderSpec = {
    type: string;
    props: Record<string, unknown>;
    variant: 'shape';
} | {
    variant: 'geo';
    geo: TLGeoShapeGeoStyle;
};

// @public (undocumented)
export class MermaidDiagramError extends Error {
    constructor(diagramType: string, type: 'parse' | 'unsupported');
    // (undocumented)
    diagramType: string;
    // (undocumented)
    type: 'parse' | 'unsupported';
}

// @public
export type MermaidDiagramKind = 'flowchart' | 'mindmap' | 'sequence' | 'state';

// @public (undocumented)
export interface MermaidDiagramOptions {
    // (undocumented)
    blueprintRender?: BlueprintRenderingOptions;
    // (undocumented)
    mermaidConfig?: Record<string, any>;
    // (undocumented)
    onUnsupportedDiagram?(svg: string): Promise<void>;
}

// @public
export interface MermaidNodeCreateFunctionArgs {
    // (undocumented)
    diagramKind: MermaidDiagramKind;
    // (undocumented)
    editor: Editor;
    // (undocumented)
    node: MermaidBlueprintNode;
    // (undocumented)
    parentShapeId?: TLShapeId;
    render: MermaidBlueprintNodeRenderSpec;
    // (undocumented)
    shapeId: TLShapeId;
    // (undocumented)
    x: number;
    // (undocumented)
    y: number;
}

// @public
export type MermaidNodeRenderMapper = (input: {
    nodeId: string;
    node: MermaidBlueprintNode;
    diagramKind: MermaidDiagramKind;
    kind: string;
}) => MermaidBlueprintNodeRenderSpec | undefined;

// @public (undocumented)
export function renderBlueprint(editor: Editor, blueprint: DiagramMermaidBlueprint, opts?: BlueprintRenderingOptions): void;

// @public
export function resolveMermaidNodeRender(diagramKind: MermaidDiagramKind, node: MermaidBlueprintNode, mapper?: MermaidNodeRenderMapper | undefined): MermaidBlueprintNodeRenderSpec;

// (No @packageDocumentation comment for this package)