Back to Tldraw

Api Report.Api

packages/mermaid/api-report.api.md

5.0.05.7 KB
Original Source

API Report File for "@tldraw/mermaid"

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

ts

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 {
    // (undocumented)
    anchorEndY?: 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;
    // (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)