Types
Import these from @grafloria/engine.
Types
ArchSide
Also has every member of String, listed on its own entry.
tstype ArchSide = 'T' | 'B' | 'L' | 'R';
ASTDirection
Also has every member of String, listed on its own entry.
Abstract Syntax Tree (AST) Node Definitions
Represents the parsed structure of diagram DSL code
tstype Direction = 'TD' | 'TB' | 'BT' | 'RL' | 'LR';
BlockCell
tstype BlockCell =
| { kind: 'block'; id: string; token: string; span: number; raw?: string }
| { kind: 'space'; span: number }
| { kind: 'group'; id: string; span: number; columns?: number; cells: BlockCell[]; label?: string; labelToken?: string };
Properties
| Name | Type | Default | Description |
|---|---|---|---|
kind | 'block' | ||
span | number |
DiagramChangeCallback
tstype DiagramChangeCallback = (diagram: DiagramModel) => void;
DiagramType
Also has every member of String, listed on its own entry.
tstype DiagramType = 'flowchart' | 'bpmn' | 'erd' | 'classDiagram';
EditSource
Also has every member of String, listed on its own entry.
tstype EditSource = 'text' | 'visual' | 'none';
ErCardinalityMarker
Also has every member of String, listed on its own entry.
The renderer/kit marker vocabulary these tokens denote.
tstype ErCardinalityMarker = 'one' | 'zero-or-one' | 'zero-or-many' | 'one-or-many';
LinkType
Also has every member of String, listed on its own entry.
Link/Edge type mapping
tstype LinkType =
| 'arrow'
| 'line'
| 'dotted-arrow'
| 'dotted-line'
| 'thick-arrow'
| 'thick-line'
| 'bidirectional'
| 'circle-edge'
| 'cross-edge';
MermaidArchService
Also has every member of MermaidArchGroup, listed on its own entry.
tstype MermaidArchService = MermaidArchGroup;
NodeShape
Also has every member of String, listed on its own entry.
Node shape type mapping to Mermaid syntax
tstype NodeShape =
| 'text'
| 'rectangle'
| 'rounded-rectangle'
| 'stadium'
| 'subroutine'
| 'cylindrical'
| 'circle'
| 'asymmetric'
| 'rhombus'
| 'hexagon'
| 'trapezoid'
| 'trapezoid-alt'
| 'parallelogram'
| 'parallelogram-alt';
StateKind
Also has every member of String, listed on its own entry.
tstype StateKind =
| 'state' | 'start' | 'end' | 'choice' | 'fork' | 'join' | 'history' | 'deep-history';
StatementNode
Also has every member of NodeDefinitionNode, ASTNode, listed on their own entries.
Statement types
tstype StatementNode =
| NodeDefinitionNode
| EdgeDefinitionNode
| SubgraphNode
| StyleNode
| ClassDefNode
| ClassApplicationNode
| LinkStyleNode
| ClickNode
| GrafloriaDirectiveNode;
StatusCallback
tstype StatusCallback = (status: SyncStatus) => void;
StatusChangeCallback
tstype StatusChangeCallback = (status: SyncStatus) => void;
SyncCallback
tstype SyncCallback = (direction: SyncDirection, success: boolean) => void;
SyncDirection
Also has every member of String, listed on its own entry.
tstype SyncDirection = 'text-to-visual' | 'visual-to-text' | 'none';
TextChangeCallback
tstype TextChangeCallback = (text: string) => void;
UmlKind
Also has every member of String, listed on its own entry.
The diagram kit's relationship vocabulary.
tstype UmlKind =
| 'inheritance' | 'realization' | 'association' | 'directed-association'
| 'aggregation' | 'composition' | 'dependency';
UmlLeftMarker
Also has every member of String, listed on its own entry.
Mermaid's class relationship grammar is COMPOSITIONAL, not a fixed list:
relation := relationType? lineType relationType?
with relationType ∈ {<|/|> extension, * composition, o aggregation,
</> dependency, () lollipop} and lineType ∈ {-- solid, .. dotted}. That is 72 legal spellings, every one of which mermaid 11.16 accepts
(verified operator-by-operator against the real parser). The previous
hand-written table listed 17 of them, and a line using any of the other 55 —
A <|--* B, A o--|> B, the whole lollipop family — matched no rule at all,
so the line was skipped and BOTH classes vanished: an empty diagram, silently.
tstype UmlLeftMarker = '' | '<|' | '*' | 'o' | '<' | '()';
UmlLineType
Also has every member of String, listed on its own entry.
tstype UmlLineType = '--' | '..';
UmlOperator
Also has every member of String, listed on its own entry.
The literal Mermaid operator, kept so generation is not a guess.
tstype UmlOperator = `${UmlLeftMarker}${UmlLineType}${UmlRightMarker}`;
UmlRightMarker
Also has every member of String, listed on its own entry.
tstype UmlRightMarker = '' | '|>' | '*' | 'o' | '>' | '()';
Was this page helpful?