euv-ui 0.49.1

Cross-platform UI component library and 17-scheme design system for the euv framework with pixel-consistent rendering across Web, Android, iOS, iPadOS, macOS, Windows, and Linux.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
use super::*;

/// Custom Mermaid `classDef` style palette entry applied to flowchart nodes.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidClassDef {
    /// Declared class name.
    pub(crate) name: String,
    /// Optional fill color expression (`#hex` or named CSS color).
    pub(crate) fill: Option<String>,
    /// Optional stroke border color expression.
    pub(crate) stroke: Option<String>,
    /// Optional label text color expression.
    pub(crate) text_color: Option<String>,
}

/// Single node inside a Mermaid flowchart or state diagram.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidFlowNode {
    /// Unique identifier referenced by edges.
    pub(crate) id: String,
    /// Visible human-readable label.
    pub(crate) label: String,
    /// Rendered geometric node shape.
    #[get(type(copy))]
    pub(crate) shape: MermaidNodeShape,
    /// Optional enclosing subgraph index.
    #[get(type(copy))]
    pub(crate) subgraph: Option<usize>,
    /// Attached Mermaid CSS class names from `:::` or `class` directives.
    #[new(skip)]
    pub(crate) classes: Vec<String>,
    /// Optional custom fill color resolved from `style` or `classDef`.
    #[new(skip)]
    pub(crate) fill: Option<String>,
    /// Optional custom border stroke color resolved from `style` or `classDef`.
    #[new(skip)]
    pub(crate) stroke: Option<String>,
    /// Optional custom text foreground color resolved from `style` or `classDef`.
    #[new(skip)]
    pub(crate) text_color: Option<String>,
    /// Optional click directive target URL or callback name.
    #[new(skip)]
    pub(crate) click_url: Option<String>,
}

/// Directed or undirected edge connecting two flowchart/state nodes.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidFlowEdge {
    /// Source node identifier.
    pub(crate) from: String,
    /// Destination node identifier.
    pub(crate) to: String,
    /// Optional edge label rendered along the connector.
    pub(crate) label: String,
    /// Line stroke and arrowhead style.
    #[get(type(copy))]
    pub(crate) style: MermaidEdgeStyle,
}

/// Named subgraph group box enclosing a subset of flowchart or composite state nodes.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidSubgraph {
    /// Visible subgraph title.
    pub(crate) title: String,
    /// Optional subgraph identifier used for references.
    #[new(skip)]
    pub(crate) id: String,
    /// Optional enclosing parent subgraph index for nested subgraphs.
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) parent: Option<usize>,
    /// Optional inner layout direction override (`direction LR`, `direction TD`, etc.).
    #[new(skip)]
    pub(crate) direction: Option<MermaidFlowDirection>,
}

/// Parsed Mermaid flowchart or state graph.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidFlowchart {
    /// Layout flow direction (`TD`, `BT`, `LR`, `RL`).
    #[get(type(copy))]
    pub(crate) direction: MermaidFlowDirection,
    /// Ordered unique nodes.
    pub(crate) nodes: Vec<MermaidFlowNode>,
    /// Ordered connectors.
    pub(crate) edges: Vec<MermaidFlowEdge>,
    /// Named subgraph frames (including nested subgraphs).
    pub(crate) subgraphs: Vec<MermaidSubgraph>,
    /// Declared `classDef` style definitions.
    pub(crate) class_defs: Vec<MermaidClassDef>,
}

/// Active execution bar along a participant lifeline in a `sequenceDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidSeqActivation {
    /// Participant column index.
    #[get(type(copy))]
    pub(crate) participant_idx: usize,
    /// Starting message row index.
    #[get(type(copy))]
    pub(crate) start_row: usize,
    /// Ending message row index (inclusive).
    #[get(type(copy))]
    pub(crate) end_row: usize,
}

/// Branch separator row (`else`, `and`, `option`) inside a `MermaidSeqBlock`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidSeqBlockDivider {
    /// Message row index where the divider splits the block.
    #[get(type(copy))]
    pub(crate) row_idx: usize,
    /// Optional branch condition label.
    pub(crate) label: String,
}

/// Framed control-flow block (`loop`, `alt`, `opt`, `par`, `critical`, `break`, `rect`) in a `sequenceDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidSeqBlock {
    /// Fragment block kind.
    #[get(type(copy))]
    pub(crate) kind: MermaidSeqBlockKind,
    /// Fragment header caption.
    pub(crate) label: String,
    /// First message row index inside this block.
    #[get(type(copy))]
    pub(crate) start_row: usize,
    /// Last message row index inside this block (inclusive).
    #[get(type(copy))]
    pub(crate) end_row: usize,
    /// Nesting depth (`0` = outermost).
    #[get(type(copy))]
    pub(crate) depth: usize,
    /// Internal `else` / `and` / `option` divider rows.
    pub(crate) dividers: Vec<MermaidSeqBlockDivider>,
}

/// Single message or note step inside a Mermaid `sequenceDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidSequenceMessage {
    /// Source participant index.
    #[get(type(copy))]
    pub(crate) from_idx: usize,
    /// Target participant index.
    #[get(type(copy))]
    pub(crate) to_idx: usize,
    /// Message label or note copy.
    pub(crate) text: String,
    /// Connector style (`Solid`, `Dashed`, `OpenArrow`, `CrossArrow`, `AsyncArrow`, etc.).
    #[get(type(copy))]
    pub(crate) style: MermaidEdgeStyle,
    /// When `true`, renders as a callout note anchored to `from_idx..=to_idx`.
    #[get(type(copy))]
    pub(crate) is_note: bool,
    /// Placement rule for sequence notes (`Over`, `LeftOf`, `RightOf`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) note_placement: MermaidSeqNotePlacement,
}

/// Parsed Mermaid `sequenceDiagram` with ordered participants, actor markers, autonumbering, activations, and nested control blocks.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidSequence {
    /// Ordered participant `(id, display_label)` entries.
    pub(crate) participants: Vec<(String, String)>,
    /// Ordered chronological message/note steps.
    pub(crate) messages: Vec<MermaidSequenceMessage>,
    /// Parallel flags indicating whether each participant is an `actor` (`true`) or box (`false`).
    pub(crate) actor_flags: Vec<bool>,
    /// Whether `autonumber` prefixes message labels sequentially.
    #[get(type(copy))]
    pub(crate) autonumber: bool,
    /// Recorded lifeline activation spans.
    pub(crate) activations: Vec<MermaidSeqActivation>,
    /// Recorded nested control-flow fragment boxes.
    pub(crate) blocks: Vec<MermaidSeqBlock>,
}

/// Single class entity inside a Mermaid `classDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidClassBox {
    /// Class identifier and header name.
    pub(crate) name: String,
    /// Declared field and method member lines.
    pub(crate) members: Vec<String>,
    /// Optional UML stereotype annotation (for example `<<interface>>`, `<<abstract>>`, `<<service>>`).
    #[new(skip)]
    pub(crate) stereotype: String,
}

/// Relationship connector between two classes inside a `classDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidClassRelation {
    /// Source class name.
    pub(crate) from: String,
    /// Target class name.
    pub(crate) to: String,
    /// Relationship label.
    pub(crate) label: String,
    /// Dashed or solid connector style.
    #[get(type(copy))]
    pub(crate) style: MermaidEdgeStyle,
    /// UML marker semantics (`Inheritance`, `Composition`, `Aggregation`, `Dependency`, etc.).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) rel_kind: MermaidClassRelKind,
}

/// Parsed Mermaid `classDiagram`.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidClassDiagram {
    /// Ordered class boxes.
    pub(crate) classes: Vec<MermaidClassBox>,
    /// Ordered relationships.
    pub(crate) relations: Vec<MermaidClassRelation>,
}

/// Single entity table inside a Mermaid `erDiagram`.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidErEntity {
    /// Entity name.
    pub(crate) name: String,
    /// Declared attribute rows (e.g. `"int id PK"`).
    pub(crate) attributes: Vec<String>,
}

/// Cardinality relationship between two ER entities.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidErRelation {
    /// Left entity name.
    pub(crate) left: String,
    /// Right entity name.
    pub(crate) right: String,
    /// Left cardinality token (e.g. `"||"`).
    pub(crate) left_card: String,
    /// Right cardinality token (e.g. `"o{"`).
    pub(crate) right_card: String,
    /// Relationship verb label.
    pub(crate) label: String,
    /// When `true`, renders a non-identifying dashed relationship line (`..`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) dashed: bool,
}

/// Parsed Mermaid `erDiagram`.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidErDiagram {
    /// Ordered entities.
    pub(crate) entities: Vec<MermaidErEntity>,
    /// Ordered cardinality relationships.
    pub(crate) relations: Vec<MermaidErRelation>,
}

/// Single proportional slice inside a Mermaid `pie` chart.
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct MermaidPieSlice {
    /// Slice display label.
    pub(crate) label: String,
    /// Positive numeric weight.
    #[get(type(copy))]
    pub(crate) value: f32,
}

/// Parsed Mermaid `pie` chart.
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct MermaidPieChart {
    /// Optional chart title.
    pub(crate) title: String,
    /// Ordered pie slices.
    pub(crate) slices: Vec<MermaidPieSlice>,
}

/// Single timeline task bar inside a Mermaid `gantt` chart.
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct MermaidGanttTask {
    /// Enclosing section label.
    pub(crate) section: String,
    /// Task display title.
    pub(crate) label: String,
    /// Visual bar status.
    #[get(type(copy))]
    pub(crate) status: MermaidGanttStatus,
    /// Relative start offset in timeline units.
    #[get(type(copy))]
    pub(crate) start_unit: f32,
    /// Duration span in timeline units.
    #[get(type(copy))]
    pub(crate) duration_unit: f32,
}

/// Parsed Mermaid `gantt` chart.
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct MermaidGanttChart {
    /// Optional chart title.
    pub(crate) title: String,
    /// Ordered timeline tasks.
    pub(crate) tasks: Vec<MermaidGanttTask>,
}

/// Single chronological milestone period inside a Mermaid `timeline` diagram.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidTimelineEvent {
    /// Optional enclosing section name.
    pub(crate) section: String,
    /// Period heading label (e.g. `"2026 Q1"`).
    pub(crate) period: String,
    /// Ordered event descriptions within this period.
    pub(crate) items: Vec<String>,
}

/// Parsed Mermaid `timeline` diagram.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidTimeline {
    /// Optional timeline heading title.
    pub(crate) title: String,
    /// Ordered milestone period columns.
    pub(crate) events: Vec<MermaidTimelineEvent>,
}

/// Single hierarchical node inside a Mermaid `mindmap` diagram.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidMindmapNode {
    /// Visible node caption.
    pub(crate) label: String,
    /// Tree indentation depth (`0` = root).
    #[get(type(copy))]
    pub(crate) depth: usize,
    /// Node geometric outline shape.
    #[get(type(copy))]
    pub(crate) shape: MermaidNodeShape,
}

/// Parsed Mermaid `mindmap` hierarchy.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidMindmap {
    /// Ordered pre-order mindmap nodes.
    pub(crate) nodes: Vec<MermaidMindmapNode>,
}

/// Single bar or line series inside a Mermaid `xychart-beta` diagram.
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct MermaidXySeries {
    /// `true` for bar series, `false` for line series.
    #[get(type(copy))]
    pub(crate) is_bar: bool,
    /// Ordered numeric data points matching `x_labels`.
    pub(crate) values: Vec<f32>,
}

/// Parsed Mermaid `xychart-beta` / `xychart` diagram.
#[derive(Clone, Data, Debug, Default, PartialEq)]
pub struct MermaidXyChart {
    /// Optional chart title.
    pub(crate) title: String,
    /// Categorical X-axis tick labels.
    pub(crate) x_labels: Vec<String>,
    /// Optional Y-axis caption.
    pub(crate) y_label: String,
    /// Resolved minimum Y-axis scale bound.
    #[get(type(copy))]
    pub(crate) y_min: f32,
    /// Resolved maximum Y-axis scale bound.
    #[get(type(copy))]
    pub(crate) y_max: f32,
    /// Ordered bar and line series.
    pub(crate) series: Vec<MermaidXySeries>,
}

/// Single commit node inside a Mermaid `gitGraph` diagram.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct MermaidGitCommit {
    /// Commit display identifier or short hash.
    pub(crate) id: String,
    /// Active branch name where this commit lives.
    pub(crate) branch: String,
    /// Zero-based horizontal branch lane index.
    #[get(type(copy))]
    pub(crate) lane: usize,
    /// Optional tag badge attached to this commit.
    pub(crate) tag: String,
    /// Optional commit highlight style (`""`, `"HIGHLIGHT"`, `"REVERSE"`).
    pub(crate) commit_type: String,
    /// Optional source branch lane index when this commit represents a `merge`.
    #[get(type(copy))]
    pub(crate) merge_from_lane: Option<usize>,
    /// Optional previous commit index on the same branch or branch point.
    #[get(type(copy))]
    pub(crate) parent_idx: Option<usize>,
}

/// Parsed Mermaid `gitGraph` commit and branch topology.
#[derive(Clone, Data, Debug, Default, Eq, PartialEq)]
pub struct MermaidGitGraph {
    /// Ordered branch names (index = lane).
    pub(crate) branches: Vec<String>,
    /// Ordered commit history steps.
    pub(crate) commits: Vec<MermaidGitCommit>,
}

/// Native vector Mermaid diagram component rendering flowcharts, sequence, state, class, ER, pie, Gantt, timeline, mindmap, XY chart, and gitGraph diagrams onto `euv` `canvas` with H+V scrolling and fullscreen inspection.
#[derive(Clone, CustomDebug, Data, New, Props)]
pub struct EuvMermaid {
    /// Raw Mermaid diagram source text.
    pub(crate) source: String,
    /// Active theme tokens.
    #[get(type(copy))]
    pub(crate) tokens: ThemeTokens,
    /// Optional style overrides controlling maximum inline viewport height and container styling (defaults to `max_height: Length::Px(420.0)`).
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) style: Option<Style>,
    /// Optional copy callback invoked with the raw Mermaid source when Copy is clicked.
    #[new(skip)]
    #[debug(skip)]
    #[get(skip)]
    #[prop(custom)]
    pub(crate) on_copy: Option<MarkdownStrCallback>,
}

/// Cached scaled fullscreen display-list entry keyed by `(bounds, tokens, zoom_bits)`.
pub(crate) struct MermaidModalPaintEntry {
    /// Logical canvas bounds when cached.
    pub(crate) bounds: Rect,
    /// Active theme tokens when cached.
    pub(crate) tokens: ThemeTokens,
    /// Zoom factor raw `f32` bits when cached.
    pub(crate) zoom_bits: u32,
    /// Cached scaled draw commands.
    pub(crate) commands: Vec<DrawCommand>,
}