@zombie-mermaid/mermaid-parser 3.1.0 → 4.0.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.cts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Direction } from '@zombie-mermaid/core';
2
+ import { MermaidGraph } from '@zombie-mermaid/core';
2
3
  import { NodeInteraction } from '@zombie-mermaid/core';
3
4
  import { NodeShape } from '@zombie-mermaid/core';
5
+ import { Point } from '@zombie-mermaid/core';
4
6
  import { Statement } from '@zombie-mermaid/core';
5
7
  import { StyleDirectives } from '@zombie-mermaid/core';
6
8
 
@@ -11,6 +13,8 @@ export declare interface Activation {
11
13
  topY: number;
12
14
  bottomY: number;
13
15
  width: number;
16
+ /** Nesting level on this actor's lifeline: 0 for the outermost bar, 1 for a bar opened while one is already active, and so on */
17
+ depth: number;
14
18
  }
15
19
 
16
20
  export declare interface ActivationCheckResult {
@@ -88,6 +92,54 @@ export declare interface Actor {
88
92
  destroyedAt?: number;
89
93
  }
90
94
 
95
+ export declare interface ArchitectureDiagram {
96
+ groups: ArchitectureGroup[];
97
+ services: ArchitectureService[];
98
+ junctions: ArchitectureJunction[];
99
+ edges: ArchitectureEdge[];
100
+ }
101
+
102
+ export declare interface ArchitectureEdge {
103
+ source: string;
104
+ sourcePort: ArchitecturePort;
105
+ /** `{group}` modifier: the edge attaches to the enclosing group's border. */
106
+ sourceGroup: boolean;
107
+ target: string;
108
+ targetPort: ArchitecturePort;
109
+ targetGroup: boolean;
110
+ /** `<--` / `<-->`: arrowhead at the source end. */
111
+ arrowStart: boolean;
112
+ /** `-->` / `<-->`: arrowhead at the target end. */
113
+ arrowEnd: boolean;
114
+ }
115
+
116
+ export declare interface ArchitectureGroup {
117
+ id: string;
118
+ /** Icon name from `(icon)`; kept for consumers, not drawn (see to-graph). */
119
+ icon?: string;
120
+ /** `[Title]`; falls back to the id. */
121
+ title: string;
122
+ /** Enclosing group id, from `in <parent>`. */
123
+ parent?: string;
124
+ }
125
+
126
+ export declare interface ArchitectureJunction {
127
+ id: string;
128
+ parent?: string;
129
+ }
130
+
131
+ /** A port on a service/junction: left, right, top, bottom. */
132
+ export declare type ArchitecturePort = 'L' | 'R' | 'T' | 'B';
133
+
134
+ export declare interface ArchitectureService {
135
+ id: string;
136
+ icon?: string;
137
+ title: string;
138
+ parent?: string;
139
+ }
140
+
141
+ export declare function architectureToGraph(diagram: ArchitectureDiagram): MermaidGraph;
142
+
91
143
  export declare interface AxisTick {
92
144
  /** Label text for this tick */
93
145
  label: string;
@@ -120,6 +172,111 @@ export declare interface Block {
120
172
  }>;
121
173
  }
122
174
 
175
+ export declare interface C4Boundary {
176
+ alias: string;
177
+ label: string;
178
+ /** Boundary type (`Boundary(a, "x", "type")`) or deployment node type. */
179
+ type?: string;
180
+ description?: string;
181
+ /** Aliases of elements declared directly inside this boundary. */
182
+ elementAliases: string[];
183
+ children: C4Boundary[];
184
+ }
185
+
186
+ /** A boundary's type line (`[ENTERPRISE]`, `[Ubuntu]`), when it has a type. */
187
+ export declare function c4BoundaryTypeLine(b: C4Boundary): string | undefined;
188
+
189
+ export declare interface C4Diagram {
190
+ variant: C4Variant;
191
+ /**
192
+ * Top-level layout direction. Never set by the parser (C4 sources have no
193
+ * direction statement); only `RenderOptions.direction` sets it, via
194
+ * `withDirectionOverride`. Unset lays out top-to-bottom.
195
+ */
196
+ direction?: Direction;
197
+ title?: string;
198
+ /** Every element in declaration order, wherever it is nested. */
199
+ elements: C4Element[];
200
+ /** Top-level boundaries; elements outside any boundary are not listed. */
201
+ boundaries: C4Boundary[];
202
+ relationships: C4Relationship[];
203
+ }
204
+
205
+ export declare interface C4Element {
206
+ alias: string;
207
+ kind: C4ElementKind;
208
+ shape: C4ElementShape;
209
+ /** `*_Ext` variants: outside the system being described. */
210
+ external: boolean;
211
+ label: string;
212
+ technology?: string;
213
+ description?: string;
214
+ }
215
+
216
+ export declare type C4ElementKind = 'person' | 'system' | 'container' | 'component';
217
+
218
+ /** Visual variant of an element: plain box, database cylinder, or queue. */
219
+ export declare type C4ElementShape = 'default' | 'db' | 'queue';
220
+
221
+ /**
222
+ * Layout placement hint carried by `Rel_U`/`Rel_D`/`Rel_L`/`Rel_R` (and their
223
+ * long-form aliases): where `to` should sit relative to `from`. Plain `Rel`,
224
+ * `BiRel`, `RelIndex` and `Rel_Back` carry none.
225
+ */
226
+ export declare type C4LayoutHint = 'up' | 'down' | 'left' | 'right';
227
+
228
+ /**
229
+ * How a relationship constrains placement. `source` is meant to sit before
230
+ * `target` along `axis`: above it for `'vertical'`, left of it for
231
+ * `'horizontal'`. `Rel_U`/`Rel_L` reverse the pair (the target sits above /
232
+ * left of the source); plain `Rel` is a vertical hint, since C4 diagrams flow
233
+ * top to bottom by default.
234
+ */
235
+ export declare interface C4Placement {
236
+ source: string;
237
+ target: string;
238
+ axis: 'vertical' | 'horizontal';
239
+ /** True when the hint came from an explicit `Rel_U/D/L/R`. */
240
+ explicit: boolean;
241
+ }
242
+
243
+ export declare function c4Placement(rel: C4Relationship): C4Placement;
244
+
245
+ export declare interface C4Relationship {
246
+ from: string;
247
+ to: string;
248
+ label: string;
249
+ technology?: string;
250
+ /** `BiRel`: arrowheads at both ends. */
251
+ bidirectional: boolean;
252
+ /**
253
+ * `Rel_Back`: the arrowhead points at `from` instead of `to`. `from`/`to`
254
+ * stay as declared, so layout and placement hints still follow them.
255
+ */
256
+ reversed?: boolean;
257
+ /** `RelIndex(n, ...)` in C4Dynamic diagrams. */
258
+ index?: string;
259
+ /** Placement hint from a directional `Rel_*` macro; see `C4LayoutHint`. */
260
+ layout?: C4LayoutHint;
261
+ }
262
+
263
+ /**
264
+ * The text lines of a relationship label: the label itself (prefixed with its
265
+ * sequence number in a C4Dynamic diagram), then the technology in brackets on its
266
+ * own line. Empty when the relationship has neither.
267
+ */
268
+ export declare function c4RelLabelLines(rel: C4Relationship): string[];
269
+
270
+ /**
271
+ * The bracketed type line under an element's name, as Mermaid draws it:
272
+ * `[Person]`, `[Software System]`, `[Container: PostgreSQL]`. External,
273
+ * database and queue variants share their base kind's line; the fill and the
274
+ * shape tell them apart.
275
+ */
276
+ export declare function c4TypeLine(el: C4Element): string;
277
+
278
+ export declare type C4Variant = 'context' | 'container' | 'component' | 'dynamic' | 'deployment';
279
+
123
280
  /**
124
281
  * Cardinality notation (crow's foot):
125
282
  * 'one' || || exactly one
@@ -316,7 +473,7 @@ export declare function formatClassMember(m: ClassMember): string;
316
473
  * Get the hex color for a series index.
317
474
  * Index 0 returns the accent color as-is.
318
475
  * Index 1+ alternate between darker and lighter shades of the same hue
319
- * with subtle hue drift (±8-12° per tier) to stay in the same family.
476
+ * with subtle hue drift (-8° per tier for darker, -12° for lighter) to stay in the same family.
320
477
  *
321
478
  * When `bgColor` is provided, shade direction adapts to the background:
322
479
  * - Light bg: odd = darker, even = lighter (default)
@@ -435,6 +592,12 @@ export declare interface Note {
435
592
  afterIndex: number;
436
593
  }
437
594
 
595
+ /**
596
+ * Parse a Mermaid architecture diagram.
597
+ * Expects the first statement to be the `architecture-beta` header.
598
+ */
599
+ export declare function parseArchitecture(lines: Statement[]): ArchitectureDiagram;
600
+
438
601
  /**
439
602
  * Split the text after the `box` keyword into a colour and a label, per
440
603
  * Mermaid's `parseBoxData`: the leading word (or function call) is the
@@ -447,6 +610,13 @@ export declare function parseBoxHeader(header: string): {
447
610
  label: string;
448
611
  };
449
612
 
613
+ /**
614
+ * Parse a Mermaid C4 diagram. Expects the first statement to be a
615
+ * `C4Context` / `C4Container` / `C4Component` / `C4Dynamic` /
616
+ * `C4Deployment` header.
617
+ */
618
+ export declare function parseC4Diagram(lines: Statement[]): C4Diagram;
619
+
450
620
  /**
451
621
  * Parse a Mermaid class diagram.
452
622
  * Expects the first line to be "classDiagram".
@@ -580,12 +750,79 @@ export declare interface PositionedBlock {
580
750
  }>;
581
751
  }
582
752
 
753
+ export declare interface PositionedC4Boundary {
754
+ alias: string;
755
+ label: string;
756
+ type?: string;
757
+ description?: string;
758
+ x: number;
759
+ y: number;
760
+ width: number;
761
+ height: number;
762
+ /** Nesting depth, 0 for a top-level boundary. */
763
+ depth: number;
764
+ /** Centre line of the title, below the frame's top edge (Mermaid's layout). */
765
+ labelY?: number;
766
+ /** Centre line of the `[type]` text, below the frame's top edge. */
767
+ typeY?: number;
768
+ /** Centre line of the description (deployment nodes), below the top edge. */
769
+ descrY?: number;
770
+ }
771
+
772
+ export declare interface PositionedC4Diagram {
773
+ variant: C4Variant;
774
+ title?: string;
775
+ width: number;
776
+ height: number;
777
+ /** Where the title baseline sits (centre x, y), when there is a title. */
778
+ titlePosition?: Point;
779
+ elements: PositionedC4Element[];
780
+ /** Outer boundaries first, so inner ones paint on top. */
781
+ boundaries: PositionedC4Boundary[];
782
+ relationships: PositionedC4Relationship[];
783
+ }
784
+
785
+ export declare interface PositionedC4Element extends C4Element {
786
+ x: number;
787
+ y: number;
788
+ width: number;
789
+ height: number;
790
+ /** Name wrapped to the box width, one entry per line. */
791
+ nameLines: string[];
792
+ /** Description wrapped to the box width, one entry per line. */
793
+ descriptionLines: string[];
794
+ }
795
+
796
+ export declare interface PositionedC4Relationship extends C4Relationship {
797
+ /** The start and end of the line (a straight chord when `curve` is unset). */
798
+ points: Point[];
799
+ /** Control point of a quadratic curve from the first to the last point. */
800
+ curve?: Point;
801
+ /** Centre of the label block, when the relationship has label text. */
802
+ labelPosition?: Point;
803
+ /** Centre x of the `[technology]` line, which Mermaid lays out on its own. */
804
+ technologyX?: number;
805
+ }
806
+
583
807
  export declare interface PositionedClassDiagram {
584
808
  width: number;
585
809
  height: number;
586
810
  classes: PositionedClassNode[];
587
811
  relationships: PositionedClassRelationship[];
588
812
  notes: PositionedClassNote[];
813
+ /** Namespace frames, drawn behind their member classes */
814
+ namespaces: PositionedClassNamespace[];
815
+ }
816
+
817
+ /** A `namespace Name { ... }` block's frame, in diagram coordinates */
818
+ export declare interface PositionedClassNamespace {
819
+ name: string;
820
+ /** Ids of the member classes the frame encloses */
821
+ classIds: string[];
822
+ x: number;
823
+ y: number;
824
+ width: number;
825
+ height: number;
589
826
  }
590
827
 
591
828
  export declare interface PositionedClassNode {
@@ -834,6 +1071,9 @@ export declare interface SequenceDiagram {
834
1071
  */
835
1072
  export declare function toBlockType(value: string): Block['type'];
836
1073
 
1074
+ /** Greedy word wrap; a word longer than `width` stays on its own line. */
1075
+ export declare function wrapC4Text(text: string, width: number): string[];
1076
+
837
1077
  /** Axis configuration — categorical (labels) or numeric (range) */
838
1078
  export declare interface XYAxis {
839
1079
  /** Optional axis title/label */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Direction } from '@zombie-mermaid/core';
2
+ import { MermaidGraph } from '@zombie-mermaid/core';
2
3
  import { NodeInteraction } from '@zombie-mermaid/core';
3
4
  import { NodeShape } from '@zombie-mermaid/core';
5
+ import { Point } from '@zombie-mermaid/core';
4
6
  import { Statement } from '@zombie-mermaid/core';
5
7
  import { StyleDirectives } from '@zombie-mermaid/core';
6
8
 
@@ -11,6 +13,8 @@ export declare interface Activation {
11
13
  topY: number;
12
14
  bottomY: number;
13
15
  width: number;
16
+ /** Nesting level on this actor's lifeline: 0 for the outermost bar, 1 for a bar opened while one is already active, and so on */
17
+ depth: number;
14
18
  }
15
19
 
16
20
  export declare interface ActivationCheckResult {
@@ -88,6 +92,54 @@ export declare interface Actor {
88
92
  destroyedAt?: number;
89
93
  }
90
94
 
95
+ export declare interface ArchitectureDiagram {
96
+ groups: ArchitectureGroup[];
97
+ services: ArchitectureService[];
98
+ junctions: ArchitectureJunction[];
99
+ edges: ArchitectureEdge[];
100
+ }
101
+
102
+ export declare interface ArchitectureEdge {
103
+ source: string;
104
+ sourcePort: ArchitecturePort;
105
+ /** `{group}` modifier: the edge attaches to the enclosing group's border. */
106
+ sourceGroup: boolean;
107
+ target: string;
108
+ targetPort: ArchitecturePort;
109
+ targetGroup: boolean;
110
+ /** `<--` / `<-->`: arrowhead at the source end. */
111
+ arrowStart: boolean;
112
+ /** `-->` / `<-->`: arrowhead at the target end. */
113
+ arrowEnd: boolean;
114
+ }
115
+
116
+ export declare interface ArchitectureGroup {
117
+ id: string;
118
+ /** Icon name from `(icon)`; kept for consumers, not drawn (see to-graph). */
119
+ icon?: string;
120
+ /** `[Title]`; falls back to the id. */
121
+ title: string;
122
+ /** Enclosing group id, from `in <parent>`. */
123
+ parent?: string;
124
+ }
125
+
126
+ export declare interface ArchitectureJunction {
127
+ id: string;
128
+ parent?: string;
129
+ }
130
+
131
+ /** A port on a service/junction: left, right, top, bottom. */
132
+ export declare type ArchitecturePort = 'L' | 'R' | 'T' | 'B';
133
+
134
+ export declare interface ArchitectureService {
135
+ id: string;
136
+ icon?: string;
137
+ title: string;
138
+ parent?: string;
139
+ }
140
+
141
+ export declare function architectureToGraph(diagram: ArchitectureDiagram): MermaidGraph;
142
+
91
143
  export declare interface AxisTick {
92
144
  /** Label text for this tick */
93
145
  label: string;
@@ -120,6 +172,111 @@ export declare interface Block {
120
172
  }>;
121
173
  }
122
174
 
175
+ export declare interface C4Boundary {
176
+ alias: string;
177
+ label: string;
178
+ /** Boundary type (`Boundary(a, "x", "type")`) or deployment node type. */
179
+ type?: string;
180
+ description?: string;
181
+ /** Aliases of elements declared directly inside this boundary. */
182
+ elementAliases: string[];
183
+ children: C4Boundary[];
184
+ }
185
+
186
+ /** A boundary's type line (`[ENTERPRISE]`, `[Ubuntu]`), when it has a type. */
187
+ export declare function c4BoundaryTypeLine(b: C4Boundary): string | undefined;
188
+
189
+ export declare interface C4Diagram {
190
+ variant: C4Variant;
191
+ /**
192
+ * Top-level layout direction. Never set by the parser (C4 sources have no
193
+ * direction statement); only `RenderOptions.direction` sets it, via
194
+ * `withDirectionOverride`. Unset lays out top-to-bottom.
195
+ */
196
+ direction?: Direction;
197
+ title?: string;
198
+ /** Every element in declaration order, wherever it is nested. */
199
+ elements: C4Element[];
200
+ /** Top-level boundaries; elements outside any boundary are not listed. */
201
+ boundaries: C4Boundary[];
202
+ relationships: C4Relationship[];
203
+ }
204
+
205
+ export declare interface C4Element {
206
+ alias: string;
207
+ kind: C4ElementKind;
208
+ shape: C4ElementShape;
209
+ /** `*_Ext` variants: outside the system being described. */
210
+ external: boolean;
211
+ label: string;
212
+ technology?: string;
213
+ description?: string;
214
+ }
215
+
216
+ export declare type C4ElementKind = 'person' | 'system' | 'container' | 'component';
217
+
218
+ /** Visual variant of an element: plain box, database cylinder, or queue. */
219
+ export declare type C4ElementShape = 'default' | 'db' | 'queue';
220
+
221
+ /**
222
+ * Layout placement hint carried by `Rel_U`/`Rel_D`/`Rel_L`/`Rel_R` (and their
223
+ * long-form aliases): where `to` should sit relative to `from`. Plain `Rel`,
224
+ * `BiRel`, `RelIndex` and `Rel_Back` carry none.
225
+ */
226
+ export declare type C4LayoutHint = 'up' | 'down' | 'left' | 'right';
227
+
228
+ /**
229
+ * How a relationship constrains placement. `source` is meant to sit before
230
+ * `target` along `axis`: above it for `'vertical'`, left of it for
231
+ * `'horizontal'`. `Rel_U`/`Rel_L` reverse the pair (the target sits above /
232
+ * left of the source); plain `Rel` is a vertical hint, since C4 diagrams flow
233
+ * top to bottom by default.
234
+ */
235
+ export declare interface C4Placement {
236
+ source: string;
237
+ target: string;
238
+ axis: 'vertical' | 'horizontal';
239
+ /** True when the hint came from an explicit `Rel_U/D/L/R`. */
240
+ explicit: boolean;
241
+ }
242
+
243
+ export declare function c4Placement(rel: C4Relationship): C4Placement;
244
+
245
+ export declare interface C4Relationship {
246
+ from: string;
247
+ to: string;
248
+ label: string;
249
+ technology?: string;
250
+ /** `BiRel`: arrowheads at both ends. */
251
+ bidirectional: boolean;
252
+ /**
253
+ * `Rel_Back`: the arrowhead points at `from` instead of `to`. `from`/`to`
254
+ * stay as declared, so layout and placement hints still follow them.
255
+ */
256
+ reversed?: boolean;
257
+ /** `RelIndex(n, ...)` in C4Dynamic diagrams. */
258
+ index?: string;
259
+ /** Placement hint from a directional `Rel_*` macro; see `C4LayoutHint`. */
260
+ layout?: C4LayoutHint;
261
+ }
262
+
263
+ /**
264
+ * The text lines of a relationship label: the label itself (prefixed with its
265
+ * sequence number in a C4Dynamic diagram), then the technology in brackets on its
266
+ * own line. Empty when the relationship has neither.
267
+ */
268
+ export declare function c4RelLabelLines(rel: C4Relationship): string[];
269
+
270
+ /**
271
+ * The bracketed type line under an element's name, as Mermaid draws it:
272
+ * `[Person]`, `[Software System]`, `[Container: PostgreSQL]`. External,
273
+ * database and queue variants share their base kind's line; the fill and the
274
+ * shape tell them apart.
275
+ */
276
+ export declare function c4TypeLine(el: C4Element): string;
277
+
278
+ export declare type C4Variant = 'context' | 'container' | 'component' | 'dynamic' | 'deployment';
279
+
123
280
  /**
124
281
  * Cardinality notation (crow's foot):
125
282
  * 'one' || || exactly one
@@ -316,7 +473,7 @@ export declare function formatClassMember(m: ClassMember): string;
316
473
  * Get the hex color for a series index.
317
474
  * Index 0 returns the accent color as-is.
318
475
  * Index 1+ alternate between darker and lighter shades of the same hue
319
- * with subtle hue drift (±8-12° per tier) to stay in the same family.
476
+ * with subtle hue drift (-8° per tier for darker, -12° for lighter) to stay in the same family.
320
477
  *
321
478
  * When `bgColor` is provided, shade direction adapts to the background:
322
479
  * - Light bg: odd = darker, even = lighter (default)
@@ -435,6 +592,12 @@ export declare interface Note {
435
592
  afterIndex: number;
436
593
  }
437
594
 
595
+ /**
596
+ * Parse a Mermaid architecture diagram.
597
+ * Expects the first statement to be the `architecture-beta` header.
598
+ */
599
+ export declare function parseArchitecture(lines: Statement[]): ArchitectureDiagram;
600
+
438
601
  /**
439
602
  * Split the text after the `box` keyword into a colour and a label, per
440
603
  * Mermaid's `parseBoxData`: the leading word (or function call) is the
@@ -447,6 +610,13 @@ export declare function parseBoxHeader(header: string): {
447
610
  label: string;
448
611
  };
449
612
 
613
+ /**
614
+ * Parse a Mermaid C4 diagram. Expects the first statement to be a
615
+ * `C4Context` / `C4Container` / `C4Component` / `C4Dynamic` /
616
+ * `C4Deployment` header.
617
+ */
618
+ export declare function parseC4Diagram(lines: Statement[]): C4Diagram;
619
+
450
620
  /**
451
621
  * Parse a Mermaid class diagram.
452
622
  * Expects the first line to be "classDiagram".
@@ -580,12 +750,79 @@ export declare interface PositionedBlock {
580
750
  }>;
581
751
  }
582
752
 
753
+ export declare interface PositionedC4Boundary {
754
+ alias: string;
755
+ label: string;
756
+ type?: string;
757
+ description?: string;
758
+ x: number;
759
+ y: number;
760
+ width: number;
761
+ height: number;
762
+ /** Nesting depth, 0 for a top-level boundary. */
763
+ depth: number;
764
+ /** Centre line of the title, below the frame's top edge (Mermaid's layout). */
765
+ labelY?: number;
766
+ /** Centre line of the `[type]` text, below the frame's top edge. */
767
+ typeY?: number;
768
+ /** Centre line of the description (deployment nodes), below the top edge. */
769
+ descrY?: number;
770
+ }
771
+
772
+ export declare interface PositionedC4Diagram {
773
+ variant: C4Variant;
774
+ title?: string;
775
+ width: number;
776
+ height: number;
777
+ /** Where the title baseline sits (centre x, y), when there is a title. */
778
+ titlePosition?: Point;
779
+ elements: PositionedC4Element[];
780
+ /** Outer boundaries first, so inner ones paint on top. */
781
+ boundaries: PositionedC4Boundary[];
782
+ relationships: PositionedC4Relationship[];
783
+ }
784
+
785
+ export declare interface PositionedC4Element extends C4Element {
786
+ x: number;
787
+ y: number;
788
+ width: number;
789
+ height: number;
790
+ /** Name wrapped to the box width, one entry per line. */
791
+ nameLines: string[];
792
+ /** Description wrapped to the box width, one entry per line. */
793
+ descriptionLines: string[];
794
+ }
795
+
796
+ export declare interface PositionedC4Relationship extends C4Relationship {
797
+ /** The start and end of the line (a straight chord when `curve` is unset). */
798
+ points: Point[];
799
+ /** Control point of a quadratic curve from the first to the last point. */
800
+ curve?: Point;
801
+ /** Centre of the label block, when the relationship has label text. */
802
+ labelPosition?: Point;
803
+ /** Centre x of the `[technology]` line, which Mermaid lays out on its own. */
804
+ technologyX?: number;
805
+ }
806
+
583
807
  export declare interface PositionedClassDiagram {
584
808
  width: number;
585
809
  height: number;
586
810
  classes: PositionedClassNode[];
587
811
  relationships: PositionedClassRelationship[];
588
812
  notes: PositionedClassNote[];
813
+ /** Namespace frames, drawn behind their member classes */
814
+ namespaces: PositionedClassNamespace[];
815
+ }
816
+
817
+ /** A `namespace Name { ... }` block's frame, in diagram coordinates */
818
+ export declare interface PositionedClassNamespace {
819
+ name: string;
820
+ /** Ids of the member classes the frame encloses */
821
+ classIds: string[];
822
+ x: number;
823
+ y: number;
824
+ width: number;
825
+ height: number;
589
826
  }
590
827
 
591
828
  export declare interface PositionedClassNode {
@@ -834,6 +1071,9 @@ export declare interface SequenceDiagram {
834
1071
  */
835
1072
  export declare function toBlockType(value: string): Block['type'];
836
1073
 
1074
+ /** Greedy word wrap; a word longer than `width` stays on its own line. */
1075
+ export declare function wrapC4Text(text: string, width: number): string[];
1076
+
837
1077
  /** Axis configuration — categorical (labels) or numeric (range) */
838
1078
  export declare interface XYAxis {
839
1079
  /** Optional axis title/label */