@dskripchenko/diagrams 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,18 +1,217 @@
1
+ declare interface Accessibility {
2
+ title?: string;
3
+ description?: string;
4
+ }
5
+
6
+ declare interface ActivationEvent {
7
+ kind: 'activate' | 'deactivate';
8
+ actor: string;
9
+ sourceLine: number;
10
+ }
11
+
1
12
  /**
2
13
  * Measures with a table of glyph widths. Deterministic, which also makes it
3
14
  * the measurer for tests and snapshots.
4
15
  */
5
16
  export declare const approximateMeasurer: TextMeasurer;
6
17
 
18
+ declare type ArrowHead = 'none' | 'arrow' | 'open' | 'cross';
19
+
20
+ declare type AttributeKey = 'PK' | 'FK' | 'UK';
21
+
22
+ declare interface BlockEndEvent {
23
+ kind: 'block-end';
24
+ sourceLine: number;
25
+ }
26
+
27
+ /** `group` is PlantUML's labelled block: its text is the tab. */
28
+ declare type BlockKind = 'loop' | 'alt' | 'opt' | 'par' | 'critical' | 'break' | 'rect' | 'group';
29
+
30
+ declare interface BlockSectionEvent {
31
+ kind: 'block-section';
32
+ /** `else`, `and` or `option`. */
33
+ keyword: 'else' | 'and' | 'option';
34
+ text: string;
35
+ sourceLine: number;
36
+ }
37
+
38
+ declare interface BlockStartEvent {
39
+ kind: 'block-start';
40
+ block: BlockKind;
41
+ /** Guard text; for `rect`, empty. */
42
+ text: string;
43
+ /** `rect` only: the validated background colour. */
44
+ color?: string;
45
+ sourceLine: number;
46
+ }
47
+
48
+ declare type BoundaryKind = 'boundary' | 'enterprise' | 'system' | 'container' | 'node';
49
+
50
+ declare interface C4Boundary {
51
+ id: string;
52
+ kind: BoundaryKind;
53
+ label: string;
54
+ /** The type line: `$type` of `Boundary` and deployment nodes. */
55
+ type?: string;
56
+ description?: string;
57
+ parent?: string;
58
+ style?: ElementStyle;
59
+ }
60
+
61
+ declare interface C4Diagram {
62
+ type: 'c4';
63
+ kind: C4Kind;
64
+ title?: string;
65
+ direction: 'TB' | 'LR';
66
+ /** Elements in declaration order. */
67
+ elements: Map<string, C4Element>;
68
+ /** Boundaries and deployment nodes in declaration order. */
69
+ boundaries: Map<string, C4Boundary>;
70
+ /** Everything a scope contains, in declaration order (scope id `''` is the root). */
71
+ children: Map<string, string[]>;
72
+ relations: C4Relation[];
73
+ /** `UpdateLayoutConfig`. */
74
+ shapeInRow: number;
75
+ boundaryInRow: number;
76
+ accessibility: Accessibility;
77
+ }
78
+
79
+ declare interface C4Element {
80
+ id: string;
81
+ level: ElementLevel;
82
+ shape: ElementShape;
83
+ external: boolean;
84
+ label: string;
85
+ /** `$techn` of containers and components. */
86
+ techn?: string;
87
+ /** `$type` of persons and systems: replaces the default type line. */
88
+ type?: string;
89
+ description?: string;
90
+ /** The boundary or deployment node it is declared in. */
91
+ parent?: string;
92
+ style?: ElementStyle;
93
+ }
94
+
95
+ declare type C4Kind = 'C4Context' | 'C4Container' | 'C4Component' | 'C4Dynamic' | 'C4Deployment';
96
+
97
+ declare interface C4Relation {
98
+ from: string;
99
+ to: string;
100
+ label: string;
101
+ techn?: string;
102
+ description?: string;
103
+ direction?: RelDirection;
104
+ /** Which ends carry an arrowhead. */
105
+ arrows: 'end' | 'start' | 'both';
106
+ /** `Lay_*`: a layout hint only, not drawn. */
107
+ hidden: boolean;
108
+ /** The number shown in front of the label (C4Dynamic and `RelIndex`). */
109
+ index?: string;
110
+ style?: {
111
+ line?: string;
112
+ text?: string;
113
+ };
114
+ line: number;
115
+ column: number;
116
+ }
117
+
118
+ /** How many rows of one entity relate to one row of the other. */
119
+ declare type Cardinality = 'one' | 'zero-one' | 'one-many' | 'zero-many';
120
+
121
+ declare interface ClassDiagram {
122
+ type: 'class';
123
+ direction: Direction;
124
+ classes: Map<string, ClassNode>;
125
+ relations: ClassRelation[];
126
+ notes: ClassNote[];
127
+ namespaces: Map<string, ClassNamespace>;
128
+ classDefs: Map<string, UserStyle>;
129
+ accessibility: Accessibility;
130
+ }
131
+
132
+ /** `$` after a member: static (underlined); `*`: abstract (italic). */
133
+ declare type Classifier = 'static' | 'abstract';
134
+
135
+ declare interface ClassMember {
136
+ kind: 'attribute' | 'method';
137
+ /** What the box shows: generics as `<…>`, a method's return type after a colon. */
138
+ text: string;
139
+ visibility?: Visibility;
140
+ classifier?: Classifier;
141
+ }
142
+
143
+ declare interface ClassNamespace {
144
+ id: string;
145
+ }
146
+
147
+ declare interface ClassNode {
148
+ id: string;
149
+ /** The name the box shows: a `["label"]`, or the id with its generic parameter. */
150
+ label: string;
151
+ /** `T` of `class Square~T~`. */
152
+ generic?: string;
153
+ /** `interface`, `abstract`, … as written between `<<` and `>>`. */
154
+ annotations: string[];
155
+ attributes: ClassMember[];
156
+ methods: ClassMember[];
157
+ namespace?: string;
158
+ classes: string[];
159
+ style?: UserStyle;
160
+ link?: {
161
+ href: string;
162
+ tooltip?: string;
163
+ target?: string;
164
+ };
165
+ }
166
+
167
+ declare interface ClassNote {
168
+ /** The class the note is attached to; none for a free-standing note. */
169
+ target?: string;
170
+ text: string;
171
+ }
172
+
173
+ declare interface ClassRelation {
174
+ from: string;
175
+ to: string;
176
+ fromEnd: RelationEnd;
177
+ toEnd: RelationEnd;
178
+ /** `..` rather than `--`: dependency, realization, dashed link. */
179
+ dashed: boolean;
180
+ fromCardinality?: string;
181
+ toCardinality?: string;
182
+ label?: string;
183
+ }
184
+
7
185
  /**
8
186
  * The best measurer the environment offers: a canvas when there is one,
9
187
  * otherwise the glyph table.
10
188
  */
11
189
  export declare function defaultMeasurer(): TextMeasurer;
12
190
 
13
- /** The diagram type a source declares on its first line, or null. */
191
+ /** Time passes: a gap, with an optional text (PlantUML `...` / `...text...`). */
192
+ declare interface DelayEvent {
193
+ kind: 'delay';
194
+ text: string;
195
+ sourceLine: number;
196
+ }
197
+
198
+ declare interface DestroyEvent {
199
+ kind: 'destroy';
200
+ actor: string;
201
+ sourceLine: number;
202
+ }
203
+
204
+ /**
205
+ * The diagram type of a source, or null: a Mermaid source declares it on its
206
+ * first line; a PlantUML one is recognised from its statements and reported
207
+ * as the type it is drawn as (`sequence`, or `flowchart` for use case,
208
+ * component, deployment and activity diagrams).
209
+ */
14
210
  export declare function detect(source: string): DiagramType | null;
15
211
 
212
+ /** The syntax of a source: PlantUML when it starts with `@start…`, else Mermaid. */
213
+ export declare function detectSyntax(source: string): Syntax;
214
+
16
215
  /**
17
216
  * The one error every parser and layout throws.
18
217
  *
@@ -34,7 +233,119 @@ export declare class DiagramError extends Error {
34
233
  constructor(message: string, line?: number, column?: number, hint?: string | undefined);
35
234
  }
36
235
 
37
- export declare type DiagramType = 'pie' | 'gantt' | 'flowchart' | 'sequence' | 'state';
236
+ export declare type DiagramType = 'pie' | 'gantt' | 'flowchart' | 'sequence' | 'state' | 'timeline' | 'xychart' | 'mindmap' | 'er' | 'class' | 'c4' | 'journey' | 'quadrant' | 'kanban' | 'requirement' | 'architecture' | 'sankey' | 'gitgraph' | 'block' | 'timing' | 'salt';
237
+
238
+ declare type Direction = 'TB' | 'BT' | 'LR' | 'RL';
239
+
240
+ /** A rule across the whole diagram with a title in the middle (PlantUML `== text ==`). */
241
+ declare interface DividerEvent {
242
+ kind: 'divider';
243
+ text: string;
244
+ sourceLine: number;
245
+ }
246
+
247
+ /** Line ends; the UML ones (triangle, diamonds, open arrow) come from PlantUML. */
248
+ declare type EdgeEnd = 'none' | 'arrow' | 'circle' | 'cross' | 'triangle' | 'diamond' | 'diamond-open' | 'open-arrow';
249
+
250
+ declare type ElementLevel = 'person' | 'system' | 'container' | 'component';
251
+
252
+ declare type ElementShape = 'box' | 'person' | 'db' | 'queue';
253
+
254
+ /** Validated colours from `UpdateElementStyle` / `UpdateBoundaryStyle`. */
255
+ declare interface ElementStyle {
256
+ fill?: string;
257
+ stroke?: string;
258
+ text?: string;
259
+ }
260
+
261
+ declare interface ErAttribute {
262
+ type: string;
263
+ name: string;
264
+ keys: AttributeKey[];
265
+ comment?: string;
266
+ }
267
+
268
+ declare interface ErDiagram {
269
+ type: 'er';
270
+ direction: Direction;
271
+ entities: Map<string, ErEntity>;
272
+ relationships: ErRelationship[];
273
+ classDefs: Map<string, UserStyle>;
274
+ accessibility: Accessibility;
275
+ }
276
+
277
+ declare interface ErEntity {
278
+ id: string;
279
+ /** What the box shows: the alias from `ID["Alias"]`, or the id. */
280
+ label: string;
281
+ attributes: ErAttribute[];
282
+ classes: string[];
283
+ style?: UserStyle;
284
+ }
285
+
286
+ declare interface ErRelationship {
287
+ from: string;
288
+ to: string;
289
+ /** Cardinality at the `from` entity, written on the left of the line. */
290
+ fromCardinality: Cardinality;
291
+ toCardinality: Cardinality;
292
+ /** `--` (identifying, solid) or `..` (non-identifying, dashed). */
293
+ identifying: boolean;
294
+ label: string;
295
+ }
296
+
297
+ declare interface Flowchart {
298
+ type: 'flowchart';
299
+ direction: Direction;
300
+ nodes: Map<string, FlowNode>;
301
+ edges: FlowEdge[];
302
+ subgraphs: Map<string, FlowSubgraph>;
303
+ classDefs: Map<string, UserStyle>;
304
+ accessibility: Accessibility;
305
+ }
306
+
307
+ declare interface FlowEdge {
308
+ from: string;
309
+ to: string;
310
+ stroke: Stroke;
311
+ start: EdgeEnd;
312
+ end: EdgeEnd;
313
+ /** Ranks the edge spans at least: `-->` 1, `--->` 2. */
314
+ length: number;
315
+ text?: string;
316
+ markdown: boolean;
317
+ style?: UserStyle;
318
+ }
319
+
320
+ declare interface FlowNode {
321
+ id: string;
322
+ /** Label source; the id when the node never got text. */
323
+ text: string;
324
+ markdown: boolean;
325
+ shape: ShapeKind;
326
+ classes: string[];
327
+ style?: UserStyle;
328
+ link?: {
329
+ href: string;
330
+ tooltip?: string;
331
+ target?: string;
332
+ };
333
+ tooltip?: string;
334
+ /** The subgraph the node belongs to. */
335
+ subgraph?: string;
336
+ }
337
+
338
+ declare interface FlowSubgraph {
339
+ id: string;
340
+ title: string;
341
+ markdown: boolean;
342
+ parent?: string;
343
+ direction?: Direction;
344
+ classes: string[];
345
+ style?: UserStyle;
346
+ /** The frame's shape: a package, a node, a cloud… (PlantUML containers); a rectangle by default. */
347
+ kind?: ShapeKind;
348
+ }
38
349
 
39
350
  export declare interface FontSpec {
40
351
  /** Pixels. */
@@ -44,8 +355,152 @@ export declare interface FontSpec {
44
355
  style?: 'normal' | 'italic';
45
356
  }
46
357
 
358
+ declare interface GanttDiagram {
359
+ type: 'gantt';
360
+ title?: string;
361
+ dateFormat: string;
362
+ axisFormat: string;
363
+ /** True when `axisFormat` was written; otherwise the renderer may pick a shorter one. */
364
+ axisFormatSet: boolean;
365
+ tickInterval?: TickInterval;
366
+ excludes: string[];
367
+ includes: string[];
368
+ /** 'on' (default), 'off', or a style for the marker line. */
369
+ todayMarker: string;
370
+ topAxis: boolean;
371
+ inclusiveEndDates: boolean;
372
+ sections: string[];
373
+ tasks: GanttTask[];
374
+ /** Excluded days within the chart's span, merged into ranges, for shading. */
375
+ excludedRanges: {
376
+ start: number;
377
+ end: number;
378
+ }[];
379
+ accessibility: Accessibility;
380
+ }
381
+
382
+ declare interface GanttTags {
383
+ done: boolean;
384
+ active: boolean;
385
+ crit: boolean;
386
+ milestone: boolean;
387
+ }
388
+
389
+ declare interface GanttTask {
390
+ id: string;
391
+ name: string;
392
+ /** Section name; '' for tasks before the first `section`. */
393
+ section: string;
394
+ tags: GanttTags;
395
+ /** Milliseconds since the epoch, UTC. */
396
+ start: number;
397
+ end: number;
398
+ /**
399
+ * Where the bar is drawn to. Differs from `end` only when excluded days
400
+ * stretched the task: the bar stops at the last working day rather than
401
+ * running across the weekend that follows it.
402
+ */
403
+ renderEnd: number;
404
+ href?: string;
405
+ line: number;
406
+ }
407
+
408
+ declare type LineStyle = 'solid' | 'dotted';
409
+
410
+ declare interface MessageEvent_2 {
411
+ kind: 'message';
412
+ from: string;
413
+ to: string;
414
+ line: LineStyle;
415
+ head: ArrowHead;
416
+ /** `<<->>`: an arrowhead at both ends. */
417
+ bidirectional: boolean;
418
+ text: string;
419
+ /** `+` before the target: the target is activated by this message. */
420
+ activateTarget: boolean;
421
+ /** `-` before the target: the sender's activation ends with this message. */
422
+ deactivateSource: boolean;
423
+ /** The autonumber shown next to the message, if numbering is on. */
424
+ number?: number;
425
+ sourceLine: number;
426
+ }
427
+
428
+ declare interface MindmapDiagram {
429
+ type: 'mindmap';
430
+ root: MindmapNode;
431
+ accessibility: Accessibility;
432
+ }
433
+
434
+ declare interface MindmapNode {
435
+ id: string;
436
+ /** The text as written; `markdown` says whether `**` and `*` style it. */
437
+ label: string;
438
+ markdown: boolean;
439
+ shape: MindmapShape;
440
+ /** `::icon(…)` is read and kept, but not drawn: there is no icon font to draw it with. */
441
+ icon?: string;
442
+ /** `:::name` classes, kept for tools; Mermaid's mind maps have no classDef to apply them. */
443
+ classes: string[];
444
+ children: MindmapNode[];
445
+ line: number;
446
+ column: number;
447
+ }
448
+
449
+ declare type MindmapShape = 'default' | 'square' | 'rounded' | 'circle' | 'bang' | 'cloud' | 'hexagon';
450
+
451
+ declare interface NoteEvent {
452
+ kind: 'note';
453
+ placement: 'left' | 'right' | 'over';
454
+ /** One participant, or two for `over A,B`. */
455
+ actors: string[];
456
+ text: string;
457
+ sourceLine: number;
458
+ }
459
+
47
460
  /** Parses without laying out: the diagram's structure, for tools and tests. */
48
- export declare function parse(source: string): unknown;
461
+ export declare function parse(source: string, options?: {
462
+ syntax?: Syntax;
463
+ }): unknown;
464
+
465
+ export declare interface ParsedPlantUml {
466
+ kind: PlantUmlKind;
467
+ model: PlantUmlModel;
468
+ }
469
+
470
+ export declare function parsePlantUml(source: string): ParsedPlantUml;
471
+
472
+ declare interface Participant {
473
+ id: string;
474
+ /** Label source; `<br>` breaks lines. */
475
+ label: string;
476
+ kind: ParticipantKind;
477
+ /** Index into `boxes`, when declared inside a `box`. */
478
+ box?: number;
479
+ /** Declared with `create`: drawn where it is first used rather than at the top. */
480
+ created: boolean;
481
+ }
482
+
483
+ declare interface ParticipantBox {
484
+ label?: string;
485
+ /** Validated CSS colour, or undefined for no fill. */
486
+ color?: string;
487
+ }
488
+
489
+ declare type ParticipantKind = 'participant' | 'actor' | 'boundary' | 'control' | 'entity' | 'database' | 'collections' | 'queue';
490
+
491
+ /** The PlantUML diagram kinds this package reads. */
492
+ export declare type PlantUmlKind = 'sequence' | 'activity' | 'description' | 'class' | 'state' | 'er' | 'c4' | 'mindmap' | 'wbs' | 'gantt' | 'timing' | 'salt';
493
+
494
+ /** The kind of a `@startuml` diagram, recognised from its statements. */
495
+ export declare function plantUmlKind(list: readonly Statement[]): PlantUmlKind;
496
+
497
+ declare type PlantUmlModel = SequenceDiagram | Flowchart | ClassDiagram | StateDiagram | ErDiagram | C4Diagram | MindmapDiagram | GanttDiagram | TimingDiagram | SaltDiagram;
498
+
499
+ /** The symbol at one end of a relationship. */
500
+ declare type RelationEnd = 'none' | 'inheritance' | 'composition' | 'aggregation' | 'arrow';
501
+
502
+ /** A layout hint: where `to` should be relative to `from`. */
503
+ declare type RelDirection = 'up' | 'down' | 'left' | 'right';
49
504
 
50
505
  /**
51
506
  * Renders a diagram to an SVG string.
@@ -55,6 +510,8 @@ export declare function parse(source: string): unknown;
55
510
  export declare function render(source: string, options?: RenderOptions): RenderResult;
56
511
 
57
512
  export declare interface RenderOptions {
513
+ /** The source's syntax; recognised from its first line when omitted (`@startuml` → PlantUML). */
514
+ syntax?: Syntax;
58
515
  /** How text is measured; defaults to a canvas in the browser and a glyph table elsewhere. */
59
516
  measureText?: TextMeasurer;
60
517
  /**
@@ -78,6 +535,170 @@ export declare interface RenderResult {
78
535
  type: string;
79
536
  }
80
537
 
538
+ /** Grid lines: none, outer border (`+`), all (`#`), columns (`!`), rows (`-`). */
539
+ declare type SaltBorder = 'none' | 'outer' | 'all' | 'columns' | 'rows';
540
+
541
+ declare interface SaltDiagram {
542
+ type: 'salt';
543
+ root: SaltWidget;
544
+ title?: string;
545
+ accessibility: Accessibility;
546
+ }
547
+
548
+ declare type SaltWidget = {
549
+ kind: 'text';
550
+ text: string;
551
+ bold: boolean;
552
+ } | {
553
+ kind: 'button';
554
+ text: string;
555
+ } | {
556
+ kind: 'input';
557
+ text: string;
558
+ } | {
559
+ kind: 'checkbox';
560
+ text: string;
561
+ checked: boolean;
562
+ } | {
563
+ kind: 'radio';
564
+ text: string;
565
+ checked: boolean;
566
+ } | {
567
+ kind: 'droplist';
568
+ text: string;
569
+ } | {
570
+ kind: 'empty';
571
+ } | {
572
+ kind: 'separator';
573
+ style: 'dotted' | 'double' | 'dashed' | 'solid';
574
+ } | {
575
+ kind: 'grid';
576
+ border: SaltBorder;
577
+ rows: SaltWidget[][];
578
+ title?: string;
579
+ scroll: boolean;
580
+ } | {
581
+ kind: 'tabs';
582
+ tabs: string[];
583
+ selected: number;
584
+ vertical: boolean;
585
+ } | {
586
+ kind: 'menu';
587
+ items: string[];
588
+ } | {
589
+ kind: 'tree';
590
+ items: {
591
+ depth: number;
592
+ text: string;
593
+ }[];
594
+ };
595
+
596
+ declare interface SequenceDiagram {
597
+ type: 'sequence';
598
+ title?: string;
599
+ participants: Participant[];
600
+ boxes: ParticipantBox[];
601
+ events: SequenceEvent[];
602
+ accessibility: Accessibility;
603
+ /** No participants repeated at the bottom (PlantUML `hide footbox`). */
604
+ hideFootbox?: boolean;
605
+ }
606
+
607
+ declare type SequenceEvent = MessageEvent_2 | NoteEvent | ActivationEvent | BlockStartEvent | BlockSectionEvent | BlockEndEvent | DestroyEvent | DividerEvent | DelayEvent | SpaceEvent;
608
+
609
+ declare type ShapeKind = 'rect' | 'round' | 'stadium' | 'subroutine' | 'cylinder' | 'circle' | 'doublecircle' | 'asymmetric' | 'rhombus' | 'hexagon' | 'parallelogram' | 'parallelogram-alt' | 'trapezoid' | 'trapezoid-alt' | 'start' | 'end' | 'fork' | 'choice' | 'actor' | 'usecase' | 'component' | 'interface' | 'node' | 'cloud' | 'folder' | 'frame' | 'artifact' | 'note' | 'file' | 'queue' | 'storage' | 'stack' | 'person' | 'collections' | 'boundary' | 'control' | 'entity' | 'text';
610
+
611
+ declare interface Signal {
612
+ id: string;
613
+ label: string;
614
+ kind: SignalKind;
615
+ /** Robust signals: the levels, bottom to top. */
616
+ states: string[];
617
+ changes: SignalChange[];
618
+ /** Clocks: the period, the high part of it, the first rising edge. */
619
+ clock?: {
620
+ period: number;
621
+ pulse: number;
622
+ offset: number;
623
+ };
624
+ }
625
+
626
+ declare interface SignalChange {
627
+ at: number;
628
+ state: string;
629
+ }
630
+
631
+ declare type SignalKind = 'robust' | 'concise' | 'binary' | 'clock';
632
+
633
+ /** Extra vertical space (PlantUML `|||` / `||45||`). */
634
+ declare interface SpaceEvent {
635
+ kind: 'space';
636
+ height: number;
637
+ sourceLine: number;
638
+ }
639
+
640
+ declare interface StateComposite {
641
+ id: string;
642
+ name: string;
643
+ parent?: string;
644
+ /** A concurrent region: no title, drawn dashed inside its composite. */
645
+ region: boolean;
646
+ direction?: Direction;
647
+ classes: string[];
648
+ style?: UserStyle;
649
+ }
650
+
651
+ declare interface StateDiagram {
652
+ type: 'state';
653
+ direction: Direction;
654
+ states: Map<string, StateNode>;
655
+ composites: Map<string, StateComposite>;
656
+ transitions: StateTransition[];
657
+ notes: StateNote[];
658
+ classDefs: Map<string, UserStyle>;
659
+ accessibility: Accessibility;
660
+ }
661
+
662
+ declare type StateKind = 'state' | 'start' | 'end' | 'choice' | 'fork' | 'join';
663
+
664
+ declare interface Statement {
665
+ /** The statement text, trimmed. */
666
+ text: string;
667
+ /** 1-based line. */
668
+ line: number;
669
+ /** 1-based column of the first character of `text`. */
670
+ column: number;
671
+ }
672
+
673
+ declare interface StateNode {
674
+ id: string;
675
+ kind: StateKind;
676
+ /** Display name; the id unless `state "…" as id` gave one. */
677
+ name: string;
678
+ descriptions: string[];
679
+ /** The composite or region it sits in. */
680
+ parent?: string;
681
+ classes: string[];
682
+ style?: UserStyle;
683
+ }
684
+
685
+ declare interface StateNote {
686
+ target: string;
687
+ side: 'left' | 'right';
688
+ text: string;
689
+ }
690
+
691
+ declare interface StateTransition {
692
+ from: string;
693
+ to: string;
694
+ label?: string;
695
+ }
696
+
697
+ declare type Stroke = 'normal' | 'thick' | 'dotted' | 'invisible';
698
+
699
+ /** The text syntaxes this package reads. */
700
+ export declare type Syntax = 'mermaid' | 'plantuml';
701
+
81
702
  export declare type TextMeasurer = (text: string, font: FontSpec) => TextSize;
82
703
 
83
704
  export declare interface TextSize {
@@ -88,4 +709,43 @@ export declare interface TextSize {
88
709
  /** Variable name → light-theme default. The documented theming surface. */
89
710
  export declare const THEME_VARIABLES: Readonly<Record<string, string>>;
90
711
 
712
+ declare interface TickInterval {
713
+ unit: 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M';
714
+ step: number;
715
+ }
716
+
717
+ declare interface TimingDiagram {
718
+ type: 'timing';
719
+ title?: string;
720
+ signals: Signal[];
721
+ messages: TimingMessage[];
722
+ highlights: TimingHighlight[];
723
+ accessibility: Accessibility;
724
+ }
725
+
726
+ declare interface TimingHighlight {
727
+ from: number;
728
+ to: number;
729
+ text: string;
730
+ color?: string;
731
+ }
732
+
733
+ declare interface TimingMessage {
734
+ from: string;
735
+ to: string;
736
+ at: number;
737
+ /** The arrival time; equal to `at` unless the message took time. */
738
+ until: number;
739
+ text: string;
740
+ }
741
+
742
+ declare interface UserStyle {
743
+ /** For the shape or line. */
744
+ shape: Record<string, string>;
745
+ /** For the text. */
746
+ text: Record<string, string>;
747
+ }
748
+
749
+ declare type Visibility = '+' | '-' | '#' | '~';
750
+
91
751
  export { }