Skip to main content

euv_ui/component/mermaid/
enum.rs

1use super::*;
2
3/// Layout flow axis for Mermaid `flowchart` / `graph` diagrams.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
5pub enum MermaidFlowDirection {
6    /// Top-to-bottom hierarchical layout (`TD` / `TB`).
7    #[default]
8    TopDown,
9    /// Bottom-to-top hierarchical layout (`BT`).
10    BottomTop,
11    /// Left-to-right pipeline layout (`LR`).
12    LeftRight,
13    /// Right-to-left pipeline layout (`RL`).
14    RightLeft,
15}
16
17/// Vector shape rendered for a Mermaid flowchart, state, or mindmap node.
18#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
19pub enum MermaidNodeShape {
20    /// Standard rectangle box (`[Label]`).
21    #[default]
22    Box,
23    /// Soft rounded box (`(Label)`).
24    Rounded,
25    /// Decision diamond (`{Label}`).
26    Diamond,
27    /// Pill / stadium terminal (`([Label])`).
28    Stadium,
29    /// Subroutine double-bordered box (`[[Label]]`).
30    Subroutine,
31    /// Cylindrical database node (`[(Label)]`).
32    Cylinder,
33    /// Circular node (`((Label))`).
34    Circle,
35    /// Concentric double circle (`(((Label)))`).
36    DoubleCircle,
37    /// Six-sided hexagon (`{{Label}}`).
38    Hexagon,
39    /// Right-leaning parallelogram (`[/Label/]`).
40    Parallelogram,
41    /// Left-leaning parallelogram (`[\Label\]`).
42    ParallelogramAlt,
43    /// Bottom-wide trapezoid (`[/Label\]`).
44    Trapezoid,
45    /// Top-wide inverted trapezoid (`[\Label/]`).
46    TrapezoidAlt,
47    /// Asymmetric flag / ribbon node (`>Label]`).
48    Asymmetric,
49    /// State diagram start filled dot (`[*]`).
50    StateStart,
51    /// State diagram end bullseye (`[*]`).
52    StateEnd,
53    /// State diagram fork or join synchronization bar (`<<fork>>` / `<<join>>`).
54    ForkJoin,
55    /// Attached annotation note card.
56    Note,
57}
58
59/// Connector stroke and endpoint style for Mermaid edges and sequence arrows.
60#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
61pub enum MermaidEdgeStyle {
62    /// Standard solid directed arrow (`-->` / `->>`).
63    #[default]
64    Solid,
65    /// Dashed directed arrow (`-.->` / `-->>`).
66    Dashed,
67    /// Emphasized thick solid arrow (`==>`).
68    Thick,
69    /// Undirected solid line (`---`).
70    Plain,
71    /// Undirected dashed line (`-.-`).
72    DashedPlain,
73    /// Undirected thick line (`===`).
74    ThickPlain,
75    /// Bidirectional solid arrow (`<-->`).
76    Bidir,
77    /// Bidirectional dashed arrow (`<-.->`).
78    DashedBidir,
79    /// Bidirectional thick arrow (`<==>`).
80    ThickBidir,
81    /// Solid line terminating in a circle marker (`--o`).
82    CircleEnd,
83    /// Solid line terminating in a cross marker (`--x`).
84    CrossEnd,
85    /// Solid line with circle markers at both ends (`o--o`).
86    CircleBoth,
87    /// Solid line with cross markers at both ends (`x--x`).
88    CrossBoth,
89    /// Solid sequence line without filled arrowhead (`->`).
90    OpenArrow,
91    /// Dashed sequence line without filled arrowhead (`-->`).
92    DashedOpenArrow,
93    /// Solid async half-arrow (`-)`).
94    AsyncArrow,
95    /// Dashed async half-arrow (`--)`).
96    DashedAsyncArrow,
97    /// Solid sequence cross termination (`-x`).
98    CrossArrow,
99    /// Dashed sequence cross termination (`--x`).
100    DashedCrossArrow,
101}
102
103/// Placement anchor for a `sequenceDiagram` note callout.
104#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
105pub enum MermaidSeqNotePlacement {
106    /// Centered over one or more participants (`Note over A,B`).
107    #[default]
108    Over,
109    /// Placed to the left of a participant lifeline (`Note left of A`).
110    LeftOf,
111    /// Placed to the right of a participant lifeline (`Note right of A`).
112    RightOf,
113}
114
115/// Control-flow fragment block kind inside a Mermaid `sequenceDiagram`.
116#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
117pub enum MermaidSeqBlockKind {
118    /// Repeating `loop ... end` block.
119    #[default]
120    Loop,
121    /// Conditional `alt ... else ... end` block.
122    Alt,
123    /// Optional `opt ... end` block.
124    Opt,
125    /// Parallel `par ... and ... end` block.
126    Par,
127    /// Critical `critical ... option ... end` block.
128    Critical,
129    /// Early-exit `break ... end` block.
130    Break,
131    /// Highlighted `rect ... end` region.
132    Rect,
133}
134
135/// UML relationship connector marker kind inside a Mermaid `classDiagram`.
136#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
137pub enum MermaidClassRelKind {
138    /// Standard directed association (`-->` / `<--`).
139    #[default]
140    Association,
141    /// Inheritance / generalization (`<|--` / `--|>`).
142    Inheritance,
143    /// Interface realization (`<|..` / `..|>`).
144    Realization,
145    /// Composition filled diamond (`*--` / `--*`).
146    Composition,
147    /// Aggregation hollow diamond (`o--` / `--o`).
148    Aggregation,
149    /// Dashed dependency (`..>` / `<..`).
150    Dependency,
151    /// Plain undirected link (`--` / `..`).
152    Link,
153}
154
155/// Task bar visual status inside a Mermaid Gantt chart.
156#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
157pub enum MermaidGanttStatus {
158    /// Default scheduled task bar.
159    #[default]
160    Normal,
161    /// Completed task bar (`done`).
162    Done,
163    /// Active in-progress task bar (`active`).
164    Active,
165    /// Critical path task bar (`crit`).
166    Critical,
167    /// Diamond milestone marker (`milestone`).
168    Milestone,
169}
170
171/// High-level parsed Mermaid diagram AST rendered natively onto `euv` vector `DisplayList` primitives and inline SVGs.
172#[derive(Clone, Debug, PartialEq)]
173pub enum MermaidDiagram {
174    /// Directed flowchart (`flowchart` / `graph`).
175    Flowchart(MermaidFlowchart),
176    /// Interaction sequence diagram (`sequenceDiagram`).
177    Sequence(MermaidSequence),
178    /// Finite state machine diagram (`stateDiagram` / `stateDiagram-v2`).
179    State(MermaidFlowchart),
180    /// UML class diagram (`classDiagram`).
181    Class(MermaidClassDiagram),
182    /// Entity-relationship diagram (`erDiagram`).
183    Er(MermaidErDiagram),
184    /// Proportional pie chart (`pie`).
185    Pie(MermaidPieChart),
186    /// Timeline Gantt chart (`gantt`).
187    Gantt(MermaidGanttChart),
188    /// Chronological milestone timeline (`timeline`).
189    Timeline(MermaidTimeline),
190    /// Hierarchical radial/horizontal mindmap (`mindmap`).
191    Mindmap(MermaidMindmap),
192    /// Cartesian bar and line XY chart (`xychart-beta` / `xychart`).
193    XyChart(MermaidXyChart),
194    /// Branch and merge commit history graph (`gitGraph`).
195    GitGraph(MermaidGitGraph),
196}