Skip to content
D
Documentation

Dsl — interfaces a–s

reference
11 min readUpdated

Interfaces A–S

Import these from @grafloria/engine.

Interfaces

ASTNode

Base AST Node

ts
interface ASTNode

Properties

NameTypeDefaultDescription
typestring
location?SourceLocation

ASTPosition

ts
interface Position

Properties

NameTypeDefaultDescription
linenumber
columnnumber
indexnumber

BlockGridSpec

The grid a container carries for the architecture layout (metadata.grid).

ts
interface BlockGridSpec

Properties

NameTypeDefaultDescription
columns?number
cellsArray<{ id?: string; span: number }>

ClassDefNode

Also has every member of ASTNode, listed on its own entry.

Class definition: classDef className fill:#f9f

ts
interface ClassDefNode extends ASTNode

Properties

NameTypeDefaultDescription
type'ClassDef'
classNamestring
propertiesStyleProperties

ConflictInfo

ts
interface ConflictInfo

Properties

NameTypeDefaultDescription
timestampDateTimestamp of conflict
sources[SyncDirection, SyncDirection]Conflicting edit sources
resolution'last-write-wins' | 'user-choice' | 'merge'Resolution strategy used
resolvedbooleanWas conflict resolved

DiagramAnalysis

ts
interface DiagramAnalysis

Properties

NameTypeDefaultDescription
diagramTypeDiagramTypeSuggested diagram type
directionDirectionSuggested direction
nodeOrderstring[]Node ID to order mapping (for sequential output)
nodeGroupsMap<string, string[]>Grouped nodes (for subgraphs)
nodeMetadataMap<string, { shape: string; hasCustomStyle: boolean; }>Node metadata
linkMetadataMap<string, { hasLabel: boolean; hasCustomStyle: boolean; }>Link metadata
stats{ nodeCount: number; linkCount: number; maxDepth: number; hasCycles: boolean; }Overall statistics

DiagramCharacteristics

ts
interface DiagramCharacteristics

Properties

NameTypeDefaultDescription
nodeCountnumber
linkCountnumber
hasCyclesboolean
maxDepthnumber
averageDegreenumber
maxDegreenumber
isTreeboolean
isDAGboolean
direction?Direction
diagramType?string

DiagramNode

Also has every member of ASTNode, listed on its own entry.

Root diagram node

ts
interface DiagramNode extends ASTNode

Properties

NameTypeDefaultDescription
type'Diagram'
diagramTypeDiagramType
direction?Direction
statementsStatementNode[]

DSLOptions

ts
interface DSLOptions

Properties

NameTypeDefaultDescription
autoLayout?booleanAuto-apply layout after parsing
transformOptions?TransformOptionsTransformation options
debug?booleanEnable debug logging

EdgeDefinitionNode

Also has every member of ASTNode, listed on its own entry.

Edge/Link definition: A --> B

ts
interface EdgeDefinitionNode extends ASTNode

Properties

NameTypeDefaultDescription
type'EdgeDefinition'
sourcestring
targetstring
linkTypeLinkType
label?string
style?StyleProperties
sourceShape?NodeShapeSource node shape if specified inline (e.g., A[Label] --> B)
sourceLabel?stringSource node label if specified inline (e.g., A[Label] --> B)
targetShape?NodeShapeTarget node shape if specified inline (e.g., A --> B[Label])
targetLabel?stringTarget node label if specified inline (e.g., A --> B[Label])

ErSpec

ts
interface ErSpec

Properties

NameTypeDefaultDescription
entitiesErSpecEntity[]
relationshipsErSpecRelationship[]

FormatterOptions

DSL Formatter - Formats DSL text for readability

Provides clean, consistent formatting for generated DSL text:

  • Proper indentation
  • Line wrapping
  • Comment alignment
  • Whitespace normalization
ts
interface FormatterOptions

Properties

NameTypeDefaultDescription
indent?stringIndentation string (default: 2 spaces)
maxLineLength?numberMaximum line length before wrapping
preserveBlankLines?booleanPreserve blank lines
blankLineBeforeComments?booleanAdd blank line before comments
alignComments?booleanAlign comments to column

GeneratorOptions

ts
interface GeneratorOptions

Properties

NameTypeDefaultDescription
includeComments?booleanInclude comments in output
includeStyles?booleanInclude style definitions
format?booleanFormat output (uses DSLFormatter)
preserveIds?booleanPreserve node IDs from diagram
includeSubgraphs?booleanGenerate subgraphs
positions?booleanWrite %%grafloria:at id x,y WxH for every node and zone (see ExportTextOptions.positions).

IntegratedSyncOptions

ts
interface IntegratedSyncOptions

Properties

NameTypeDefaultDescription
syncOptions?SyncOptionsBidirectional sync options
layoutOptions?LayoutApplicatorOptionsLayout applicator options
autoLayoutOnTextChange?booleanEnable auto-layout on text changes
debug?booleanEnable debug logging

LayoutApplicationResult

ts
interface LayoutApplicationResult

Properties

NameTypeDefaultDescription
successbooleanWas layout applied successfully
presetId?stringLayout preset that was applied
confidence?numberConfidence of the layout selection
reasoning?stringReasoning for layout choice
applyTime?numberTime taken to apply layout (ms)
error?stringError if layout failed

LayoutApplicatorOptions

ts
interface LayoutApplicatorOptions

Properties

NameTypeDefaultDescription
minConfidence?numberMinimum confidence threshold to auto-apply (0-1)
debug?booleanEnable debug logging
customLayouts?Map<string, LayoutConfiguration>Custom layout configurations

LayoutSuggestion

ts
interface LayoutSuggestion

Properties

NameTypeDefaultDescription
presetIdstringRecommended layout preset ID
confidencenumberConfidence score (0-1)
reasoningstringReasoning for this suggestion
alternatives?string[]Alternative suggestions

MermaidArchEdge

ts
interface MermaidArchEdge

Properties

NameTypeDefaultDescription
fromstring
fromSideArchSide
tostring
toSideArchSide
arrowFromboolean
arrowToboolean
label?string
fromGroup?boolean{group}: the line joins the GROUP the service is in, at its edge.
toGroup?boolean

MermaidArchGroup

ts
interface MermaidArchGroup

Properties

NameTypeDefaultDescription
idstring
icon?string
title?string
parent?string

MermaidArchitectureModel

ts
interface MermaidArchitectureModel

Properties

NameTypeDefaultDescription
groupsMermaidArchGroup[]
servicesMermaidArchService[]
junctionsMermaidArchJunction[]
edgesMermaidArchEdge[]

MermaidArchJunction

ts
interface MermaidArchJunction

Properties

NameTypeDefaultDescription
idstring
parent?string

MermaidBlockModel

ts
interface MermaidBlockModel

Properties

NameTypeDefaultDescription
columns?numberBlocks to a row; undefined = auto (one row).
cellsBlockCell[]
passthroughstring[]Lines the flowchart grammar reads as they are: edges, style, classDef, class, linkStyle, %%grafloria.

MermaidClassDef

ts
interface MermaidClassDef

Properties

NameTypeDefaultDescription
idstring
namestringDisplay name — class Foo["Bar"] label, else the id (generics included).
stereotype?string<<interface>> / <<abstract>> / <<enum>> / …
generic?stringclass Square~Shape~ generic parameter.
attributesMermaidClassMember[]
methodsMermaidClassMember[]
cssClassesstring[]:::css style classes applied to the node.

MermaidClassMember

ts
interface MermaidClassMember

Properties

NameTypeDefaultDescription
rawstringThe member exactly as written (minus the visibility marker's whitespace).
visibility?UmlVisibility
namestring
isMethodboolean
classifier?'$' | '*'$ (static) / * (abstract) classifier suffixes Mermaid supports.

MermaidClassModel

ts
interface MermaidClassModel

Properties

NameTypeDefaultDescription
classesMermaidClassDef[]
relationshipsMermaidClassRelationship[]
direction?string
notesArray<{ for?: string; text: string }>note "text" / note for X "text" — kept so export does not drop them.

MermaidClassRelationship

ts
interface MermaidClassRelationship

Properties

NameTypeDefaultDescription
fromstringLeft operand, exactly as written.
tostringRight operand, exactly as written.
operatorUmlOperator
label?string
multiplicity?[string, string]Multiplicity as written: [left-of-operator, right-of-operator].

MermaidErAttribute

ts
interface MermaidErAttribute

Properties

NameTypeDefaultDescription
typestring
namestring
keysstring[]PK / FK / UK, in source order.
comment?string

MermaidErEntity

ts
interface MermaidErEntity

Properties

NameTypeDefaultDescription
idstringThe identifier used in relationships.
namestringDisplay name — the ENTITY["alias"] alias when given, else the id.
attributesMermaidErAttribute[]

MermaidErModel

ts
interface MermaidErModel

Properties

NameTypeDefaultDescription
entitiesMermaidErEntity[]
relationshipsMermaidErRelationship[]
direction?string

MermaidErRelationship

ts
interface MermaidErRelationship

Properties

NameTypeDefaultDescription
fromstringLeft-hand entity id, exactly as written.
tostringRight-hand entity id, exactly as written.
leftErLeftToken
rightErRightToken
identifyingboolean-- (identifying: the child cannot exist without the parent) vs .. (non-identifying). Mermaid renders the latter dashed.
labelstring

MermaidStateModel

ts
interface MermaidStateModel

Properties

NameTypeDefaultDescription
statesMermaidStateNode[]
transitionsMermaidStateTransition[]
direction?string
notesArray<{ position: string; target: string; text: string }>

MermaidStateNode

ts
interface MermaidStateNode

Properties

NameTypeDefaultDescription
idstring
labelstring
kindStateKind
parent?stringComposite parent id, when nested. For a region's children, the REGION id.
composite?booleanTrue when this state has its own { … } body.
concurrent?booleanComposite whose body is split by -- into concurrent regions.
region?booleanA synthetic orthogonal region of a concurrent composite. Not a state the author wrote — it exists so each region owns its own children and [*], and it is re-emitted as a -- separator, never as a nested state.
direction?stringdirection declared INSIDE this composite. Mermaid scopes it to the composite; hoisting it onto the diagram re-exported it at top level and silently re-oriented the WHOLE diagram.
cssClass?stringThe :::cssClass style hook, captured by NAME. Not applied and not re-emitted (state-level styling is an open gap), but it has to be parsed: [*] --> A:::hot used to read as a state A LABELLED ::hot, and export then wrote [*] --> A : ::hot — a transition label the author never typed.

MermaidStateTransition

ts
interface MermaidStateTransition

Properties

NameTypeDefaultDescription
fromstring
tostring
label?string

NodeDefinitionNode

Also has every member of ASTNode, listed on its own entry.

Node definition: A[Label]

ts
interface NodeDefinitionNode extends ASTNode

Properties

NameTypeDefaultDescription
type'NodeDefinition'
idstring
label?string
shapeNodeShape
style?StyleProperties

ParseResult

ts
interface ParseResult

Properties

NameTypeDefaultDescription
diagramDiagramModelGenerated diagram model
astDiagramNodeAbstract syntax tree
tokensToken[]Tokens from lexical analysis
layoutSuggestion?LayoutSuggestionLayout suggestion
stats{ nodeCount: number; linkCount: number; parseTime: number; }Parse statistics

SourceLocation

Source location in the original text

ts
interface SourceLocation

Properties

NameTypeDefaultDescription
startPosition
endPosition

StyleNode

Also has every member of ASTNode, listed on its own entry.

Style definition: style A fill:#f9f,stroke:#333

ts
interface StyleNode extends ASTNode

Properties

NameTypeDefaultDescription
type'Style'
targetIdstring
propertiesStyleProperties

StyleProperties

Style properties

ts
interface StyleProperties

Properties

NameTypeDefaultDescription
fill?string
stroke?string
strokeWidth?number
strokeDasharray?string
color?string

SubgraphNode

Also has every member of ASTNode, listed on its own entry.

Subgraph definition

ts
interface SubgraphNode extends ASTNode

Properties

NameTypeDefaultDescription
type'Subgraph'
id?string
label?string
direction?Direction
statementsStatementNode[]

Was this page helpful?

Dsl — interfaces a–s — Grafloria