diagrams-js 0.5.1 → 0.6.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 +225 -147
- package/dist/index.js +13 -13
- package/dist/providers/c4/index.js +1 -1
- package/package.json +1 -1
- package/skills/diagrams-js/browser-integration/SKILL.md +50 -0
- package/skills/diagrams-js/clusters-grouping/SKILL.md +20 -0
- package/skills/diagrams-js/diagrams-js-plugin-system/SKILL.md +29 -0
- package/skills/diagrams-js/node-connections/SKILL.md +27 -0
- package/skills/diagrams-js/rendering-export/SKILL.md +76 -0
- package/skills/diagrams-js/svg-serialization/SKILL.md +53 -0
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ interface Cluster {
|
|
|
46
46
|
* Changes here will be reflected in the rendered output.
|
|
47
47
|
*/
|
|
48
48
|
clusterAttrs: Record<string, string>;
|
|
49
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
50
|
+
className: string | undefined;
|
|
51
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
52
|
+
dataAttrs: Record<string, string>;
|
|
49
53
|
/** The diagram this cluster belongs to */
|
|
50
54
|
diagram: Diagram;
|
|
51
55
|
/**
|
|
@@ -71,9 +75,10 @@ interface Cluster {
|
|
|
71
75
|
/**
|
|
72
76
|
* Create a nested cluster within this one
|
|
73
77
|
* @param label - The label for the nested cluster
|
|
78
|
+
* @param options - Optional cluster configuration
|
|
74
79
|
* @returns The created nested cluster
|
|
75
80
|
*/
|
|
76
|
-
cluster(label: string): Cluster;
|
|
81
|
+
cluster(label: string, options?: ClusterOptions): Cluster;
|
|
77
82
|
/**
|
|
78
83
|
* Get all nodes in this cluster
|
|
79
84
|
* @returns Map of node IDs to node data
|
|
@@ -99,12 +104,19 @@ interface Cluster {
|
|
|
99
104
|
* @returns The diagram this cluster belongs to
|
|
100
105
|
*/
|
|
101
106
|
getDiagram(): Diagram;
|
|
107
|
+
/**
|
|
108
|
+
* Get the SVG element for this cluster.
|
|
109
|
+
* If no svg argument is provided, queries the current document.
|
|
110
|
+
* @param svg - Optional SVG string or Element to query within
|
|
111
|
+
* @returns The SVG element, or null if not found
|
|
112
|
+
*/
|
|
113
|
+
getElement(svg?: string | Element): Element | null;
|
|
102
114
|
}
|
|
103
115
|
/**
|
|
104
116
|
* Create a new cluster
|
|
105
117
|
* @param label - The display label for the cluster
|
|
106
118
|
* @param direction - Layout direction for the cluster
|
|
107
|
-
* @param
|
|
119
|
+
* @param options - Optional Graphviz attributes or ClusterOptions
|
|
108
120
|
* @param diagram - The diagram this cluster belongs to
|
|
109
121
|
* @param parent - Optional parent cluster for nesting
|
|
110
122
|
* @returns A new Cluster instance
|
|
@@ -114,148 +126,7 @@ interface Cluster {
|
|
|
114
126
|
* cluster.add(Server("Web"));
|
|
115
127
|
* ```
|
|
116
128
|
*/
|
|
117
|
-
declare function Cluster(label?: string, direction?: "TB" | "BT" | "LR" | "RL",
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/types.d.ts
|
|
120
|
-
/**
|
|
121
|
-
* Theme definitions for diagram styling.
|
|
122
|
-
* Each theme defines cluster background colors (by depth), border color, and edge color.
|
|
123
|
-
*/
|
|
124
|
-
declare const THEMES: {
|
|
125
|
-
/** Pastel colors - soft blues, greens, and purples */readonly pastel: {
|
|
126
|
-
readonly bgcolor: readonly ["#E5F5FD", "#EBF3E7", "#ECE8F6", "#FDF7E3"];
|
|
127
|
-
readonly pencolor: "#AEB6BE";
|
|
128
|
-
readonly edgecolor: "#7B8894";
|
|
129
|
-
}; /** Neutral grayscale theme */
|
|
130
|
-
readonly neutral: {
|
|
131
|
-
readonly bgcolor: readonly ["#F8F9FA", "#F1F3F5", "#E9ECEF", "#DEE2E6"];
|
|
132
|
-
readonly pencolor: "#ADB5BD";
|
|
133
|
-
readonly edgecolor: "#495057";
|
|
134
|
-
}; /** Blue color palette */
|
|
135
|
-
readonly blues: {
|
|
136
|
-
readonly bgcolor: readonly ["#E7F5FF", "#D0EBFF", "#A5D8FF", "#74C0FC"];
|
|
137
|
-
readonly pencolor: "#339AF0";
|
|
138
|
-
readonly edgecolor: "#1971C2";
|
|
139
|
-
}; /** Green color palette */
|
|
140
|
-
readonly greens: {
|
|
141
|
-
readonly bgcolor: readonly ["#EBFBEE", "#D3F9D8", "#B2F2BB", "#8CE99A"];
|
|
142
|
-
readonly pencolor: "#40C057";
|
|
143
|
-
readonly edgecolor: "#2F9E44";
|
|
144
|
-
}; /** Orange/warm color palette */
|
|
145
|
-
readonly orange: {
|
|
146
|
-
readonly bgcolor: readonly ["#FFF4E6", "#FFE8CC", "#FFD8A8", "#FFC078"];
|
|
147
|
-
readonly pencolor: "#FD7E14";
|
|
148
|
-
readonly edgecolor: "#E8590C";
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
/** Available theme names */
|
|
152
|
-
type ThemeName = keyof typeof THEMES;
|
|
153
|
-
/** Theme configuration type */
|
|
154
|
-
type ThemeConfig = (typeof THEMES)[ThemeName];
|
|
155
|
-
/**
|
|
156
|
-
* Options for creating a diagram
|
|
157
|
-
* @example
|
|
158
|
-
* ```typescript
|
|
159
|
-
* const options: DiagramOptions = {
|
|
160
|
-
* name: "My Architecture",
|
|
161
|
-
* direction: "TB",
|
|
162
|
-
* theme: "pastel",
|
|
163
|
-
* curvestyle: "ortho"
|
|
164
|
-
* };
|
|
165
|
-
* const diagram = Diagram("", options);
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
interface DiagramOptions {
|
|
169
|
-
/** The name/title of the diagram (overrides the name parameter) */
|
|
170
|
-
name?: string;
|
|
171
|
-
/** The filename used when saving (defaults to name converted to snake_case) */
|
|
172
|
-
filename?: string;
|
|
173
|
-
/** Layout direction: TB (top-bottom), BT (bottom-top), LR (left-right), RL (right-left) */
|
|
174
|
-
direction?: "TB" | "BT" | "LR" | "RL";
|
|
175
|
-
/** Edge curve style: ortho (orthogonal), curved, spline, or polyline */
|
|
176
|
-
curvestyle?: "ortho" | "curved" | "spline" | "polyline";
|
|
177
|
-
/** Whether to automatically prefix node labels with their type */
|
|
178
|
-
autolabel?: boolean;
|
|
179
|
-
/** Whether to create a strict graph (no duplicate edges) */
|
|
180
|
-
strict?: boolean;
|
|
181
|
-
/** Color theme for the diagram */
|
|
182
|
-
theme?: ThemeName;
|
|
183
|
-
/** Graph-level Graphviz attributes */
|
|
184
|
-
graphAttr?: Record<string, string>;
|
|
185
|
-
/** Default node Graphviz attributes */
|
|
186
|
-
nodeAttr?: Record<string, string>;
|
|
187
|
-
/** Default edge Graphviz attributes */
|
|
188
|
-
edgeAttr?: Record<string, string>;
|
|
189
|
-
/** Custom plugin registry (creates new one if not provided) */
|
|
190
|
-
pluginRegistry?: PluginRegistry;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Options for rendering a diagram
|
|
194
|
-
* @example
|
|
195
|
-
* ```typescript
|
|
196
|
-
* const svg = await diagram.render({ format: "svg" });
|
|
197
|
-
* const png = await diagram.render({ format: "png", scale: 2 });
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
interface RenderOptions {
|
|
201
|
-
/** Output format: svg, png, jpg, dot, or json */
|
|
202
|
-
format?: "svg" | "png" | "jpg" | "dot" | "json";
|
|
203
|
-
/** Output filename */
|
|
204
|
-
filename?: string;
|
|
205
|
-
/** Output width in pixels (for PNG/JPG) */
|
|
206
|
-
width?: number;
|
|
207
|
-
/** Output height in pixels (for PNG/JPG) */
|
|
208
|
-
height?: number;
|
|
209
|
-
/** Scale factor for output (for PNG/JPG, default: 2) */
|
|
210
|
-
scale?: number;
|
|
211
|
-
/** Whether to inject icons into SVG output */
|
|
212
|
-
injectIcons?: boolean;
|
|
213
|
-
/** Whether to embed diagram metadata into SVG output (default: true) */
|
|
214
|
-
embedData?: boolean;
|
|
215
|
-
/** Whether to return output as data URL */
|
|
216
|
-
dataUrl?: boolean;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Options for creating an edge
|
|
220
|
-
* @example
|
|
221
|
-
* ```typescript
|
|
222
|
-
* const edge = Edge({ label: "HTTP", color: "blue", style: "dashed" });
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
interface EdgeOptions {
|
|
226
|
-
/** The source node (internal use) */
|
|
227
|
-
node?: Node;
|
|
228
|
-
/** Whether this is a forward edge */
|
|
229
|
-
forward?: boolean;
|
|
230
|
-
/** Whether this is a reverse edge */
|
|
231
|
-
reverse?: boolean;
|
|
232
|
-
/** Edge label text */
|
|
233
|
-
label?: string;
|
|
234
|
-
/** Edge color */
|
|
235
|
-
color?: string;
|
|
236
|
-
/** Edge style (solid, dashed, dotted, etc.) */
|
|
237
|
-
style?: string;
|
|
238
|
-
/** Additional Graphviz edge attributes */
|
|
239
|
-
[key: string]: unknown;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Options for creating a node
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* const node = Node("My Service", { shape: "box", color: "blue" });
|
|
246
|
-
* ```
|
|
247
|
-
*/
|
|
248
|
-
interface NodeOptions {
|
|
249
|
-
/** Custom unique identifier for the node */
|
|
250
|
-
nodeId?: string;
|
|
251
|
-
/** @internal Node type for autolabel */
|
|
252
|
-
["~type"]?: string;
|
|
253
|
-
/** @internal Icon data URL */
|
|
254
|
-
["~iconDataUrl"]?: string;
|
|
255
|
-
/** Additional Graphviz node attributes */
|
|
256
|
-
[key: string]: unknown;
|
|
257
|
-
}
|
|
258
|
-
type Yaml = typeof yaml_d_exports;
|
|
129
|
+
declare function Cluster(label?: string, direction?: "TB" | "BT" | "LR" | "RL", options?: Record<string, string> | ClusterOptions, diagram?: Diagram, parent?: Cluster): Cluster;
|
|
259
130
|
//#endregion
|
|
260
131
|
//#region src/Edge.d.ts
|
|
261
132
|
/**
|
|
@@ -289,6 +160,14 @@ interface Edge {
|
|
|
289
160
|
* Changes here will be reflected in the attrs getter.
|
|
290
161
|
*/
|
|
291
162
|
edgeAttrs: Record<string, string>;
|
|
163
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
164
|
+
className: string | undefined;
|
|
165
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
166
|
+
dataAttrs: Record<string, string>;
|
|
167
|
+
/** @internal Source node ID (set during connection) */
|
|
168
|
+
["~fromNodeId"]: string;
|
|
169
|
+
/** @internal Target node ID (set during connection) */
|
|
170
|
+
["~toNodeId"]: string;
|
|
292
171
|
/**
|
|
293
172
|
* Connect this edge to a node or merge with another edge
|
|
294
173
|
* @param target - The target node or edge to merge
|
|
@@ -301,6 +180,13 @@ interface Edge {
|
|
|
301
180
|
* @returns The source node or this edge
|
|
302
181
|
*/
|
|
303
182
|
from(target: Node | Edge): Node | Edge;
|
|
183
|
+
/**
|
|
184
|
+
* Get the SVG element for this edge.
|
|
185
|
+
* If no svg argument is provided, queries the current document.
|
|
186
|
+
* @param svg - Optional SVG string or Element to query within
|
|
187
|
+
* @returns The SVG element, or null if not found
|
|
188
|
+
*/
|
|
189
|
+
getElement(svg?: string | Element): Element | null;
|
|
304
190
|
}
|
|
305
191
|
/**
|
|
306
192
|
* Create a new edge
|
|
@@ -392,6 +278,10 @@ interface Node {
|
|
|
392
278
|
type?: string;
|
|
393
279
|
/** The specific resource type (e.g., "EC2", "S3", "RDS") */
|
|
394
280
|
resource?: string;
|
|
281
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
282
|
+
className: string | undefined;
|
|
283
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
284
|
+
dataAttrs: Record<string, string>;
|
|
395
285
|
/** @internal */
|
|
396
286
|
["~id"]: string;
|
|
397
287
|
/** @internal */
|
|
@@ -462,6 +352,13 @@ interface Node {
|
|
|
462
352
|
*/
|
|
463
353
|
with(edge: Edge, target: Node): Node;
|
|
464
354
|
with(edge: Edge, targets: Node[]): Node[];
|
|
355
|
+
/**
|
|
356
|
+
* Get the SVG element for this node.
|
|
357
|
+
* If no svg argument is provided, queries the current document.
|
|
358
|
+
* @param svg - Optional SVG string or Element to query within
|
|
359
|
+
* @returns The SVG element, or null if not found
|
|
360
|
+
*/
|
|
361
|
+
getElement(svg?: string | Element): Element | null;
|
|
465
362
|
/**
|
|
466
363
|
* Internal method to connect this node to another with an edge
|
|
467
364
|
* @param target - The target node
|
|
@@ -682,6 +579,7 @@ declare enum HookEvent {
|
|
|
682
579
|
AFTER_EXPORT = "after:export",
|
|
683
580
|
BEFORE_RENDER = "before:render",
|
|
684
581
|
AFTER_RENDER = "after:render",
|
|
582
|
+
AFTER_LAYOUT = "after:layout",
|
|
685
583
|
BEFORE_SERIALIZE = "before:serialize",
|
|
686
584
|
AFTER_DESERIALIZE = "after:deserialize",
|
|
687
585
|
NODE_CREATE = "node:create",
|
|
@@ -784,6 +682,173 @@ declare class RuntimeError extends PluginError {
|
|
|
784
682
|
constructor(pluginName: string, requiredRuntimes: RuntimeSupport, currentRuntime: string);
|
|
785
683
|
}
|
|
786
684
|
//#endregion
|
|
685
|
+
//#region src/types.d.ts
|
|
686
|
+
/**
|
|
687
|
+
* Theme definitions for diagram styling.
|
|
688
|
+
* Each theme defines cluster background colors (by depth), border color, and edge color.
|
|
689
|
+
*/
|
|
690
|
+
declare const THEMES: {
|
|
691
|
+
/** Pastel colors - soft blues, greens, and purples */readonly pastel: {
|
|
692
|
+
readonly bgcolor: readonly ["#E5F5FD", "#EBF3E7", "#ECE8F6", "#FDF7E3"];
|
|
693
|
+
readonly pencolor: "#AEB6BE";
|
|
694
|
+
readonly edgecolor: "#7B8894";
|
|
695
|
+
}; /** Neutral grayscale theme */
|
|
696
|
+
readonly neutral: {
|
|
697
|
+
readonly bgcolor: readonly ["#F8F9FA", "#F1F3F5", "#E9ECEF", "#DEE2E6"];
|
|
698
|
+
readonly pencolor: "#ADB5BD";
|
|
699
|
+
readonly edgecolor: "#495057";
|
|
700
|
+
}; /** Blue color palette */
|
|
701
|
+
readonly blues: {
|
|
702
|
+
readonly bgcolor: readonly ["#E7F5FF", "#D0EBFF", "#A5D8FF", "#74C0FC"];
|
|
703
|
+
readonly pencolor: "#339AF0";
|
|
704
|
+
readonly edgecolor: "#1971C2";
|
|
705
|
+
}; /** Green color palette */
|
|
706
|
+
readonly greens: {
|
|
707
|
+
readonly bgcolor: readonly ["#EBFBEE", "#D3F9D8", "#B2F2BB", "#8CE99A"];
|
|
708
|
+
readonly pencolor: "#40C057";
|
|
709
|
+
readonly edgecolor: "#2F9E44";
|
|
710
|
+
}; /** Orange/warm color palette */
|
|
711
|
+
readonly orange: {
|
|
712
|
+
readonly bgcolor: readonly ["#FFF4E6", "#FFE8CC", "#FFD8A8", "#FFC078"];
|
|
713
|
+
readonly pencolor: "#FD7E14";
|
|
714
|
+
readonly edgecolor: "#E8590C";
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
/** Available theme names */
|
|
718
|
+
type ThemeName = keyof typeof THEMES;
|
|
719
|
+
/** Theme configuration type */
|
|
720
|
+
type ThemeConfig = (typeof THEMES)[ThemeName];
|
|
721
|
+
/**
|
|
722
|
+
* Options for creating a diagram
|
|
723
|
+
* @example
|
|
724
|
+
* ```typescript
|
|
725
|
+
* const options: DiagramOptions = {
|
|
726
|
+
* name: "My Architecture",
|
|
727
|
+
* direction: "TB",
|
|
728
|
+
* theme: "pastel",
|
|
729
|
+
* curvestyle: "ortho"
|
|
730
|
+
* };
|
|
731
|
+
* const diagram = Diagram("", options);
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
interface DiagramOptions {
|
|
735
|
+
/** The name/title of the diagram (overrides the name parameter) */
|
|
736
|
+
name?: string;
|
|
737
|
+
/** The filename used when saving (defaults to name converted to snake_case) */
|
|
738
|
+
filename?: string;
|
|
739
|
+
/** Layout direction: TB (top-bottom), BT (bottom-top), LR (left-right), RL (right-left) */
|
|
740
|
+
direction?: "TB" | "BT" | "LR" | "RL";
|
|
741
|
+
/** Edge curve style: ortho (orthogonal), curved, spline, or polyline */
|
|
742
|
+
curvestyle?: "ortho" | "curved" | "spline" | "polyline";
|
|
743
|
+
/** Whether to automatically prefix node labels with their type */
|
|
744
|
+
autolabel?: boolean;
|
|
745
|
+
/** Whether to create a strict graph (no duplicate edges) */
|
|
746
|
+
strict?: boolean;
|
|
747
|
+
/** Color theme for the diagram */
|
|
748
|
+
theme?: ThemeName;
|
|
749
|
+
/** Graph-level Graphviz attributes */
|
|
750
|
+
graphAttr?: Record<string, string>;
|
|
751
|
+
/** Default node Graphviz attributes */
|
|
752
|
+
nodeAttr?: Record<string, string>;
|
|
753
|
+
/** Default edge Graphviz attributes */
|
|
754
|
+
edgeAttr?: Record<string, string>;
|
|
755
|
+
/** Custom plugin registry (creates new one if not provided) */
|
|
756
|
+
pluginRegistry?: PluginRegistry;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Options for rendering a diagram
|
|
760
|
+
* @example
|
|
761
|
+
* ```typescript
|
|
762
|
+
* const svg = await diagram.render({ format: "svg" });
|
|
763
|
+
* const png = await diagram.render({ format: "png", scale: 2 });
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
interface RenderOptions {
|
|
767
|
+
/** Output format: svg, png, jpg, dot, or json */
|
|
768
|
+
format?: "svg" | "png" | "jpg" | "dot" | "json";
|
|
769
|
+
/** Output filename */
|
|
770
|
+
filename?: string;
|
|
771
|
+
/** Output width in pixels (for PNG/JPG) */
|
|
772
|
+
width?: number;
|
|
773
|
+
/** Output height in pixels (for PNG/JPG) */
|
|
774
|
+
height?: number;
|
|
775
|
+
/** Scale factor for output (for PNG/JPG, default: 2) */
|
|
776
|
+
scale?: number;
|
|
777
|
+
/** Whether to inject icons into SVG output */
|
|
778
|
+
injectIcons?: boolean;
|
|
779
|
+
/** Whether to embed diagram metadata into SVG output (default: true) */
|
|
780
|
+
embedData?: boolean;
|
|
781
|
+
/** Whether to return output as data URL */
|
|
782
|
+
dataUrl?: boolean;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Options for creating an edge
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* const edge = Edge({ label: "HTTP", color: "blue", style: "dashed" });
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
interface EdgeOptions {
|
|
792
|
+
/** The source node (internal use) */
|
|
793
|
+
node?: Node;
|
|
794
|
+
/** Whether this is a forward edge */
|
|
795
|
+
forward?: boolean;
|
|
796
|
+
/** Whether this is a reverse edge */
|
|
797
|
+
reverse?: boolean;
|
|
798
|
+
/** Edge label text */
|
|
799
|
+
label?: string;
|
|
800
|
+
/** Edge color */
|
|
801
|
+
color?: string;
|
|
802
|
+
/** Edge style (solid, dashed, dotted, etc.) */
|
|
803
|
+
style?: string;
|
|
804
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
805
|
+
className?: string;
|
|
806
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
807
|
+
dataAttrs?: Record<string, string>;
|
|
808
|
+
/** Additional Graphviz edge attributes */
|
|
809
|
+
[key: string]: unknown;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Options for creating a node
|
|
813
|
+
* @example
|
|
814
|
+
* ```typescript
|
|
815
|
+
* const node = Node("My Service", { shape: "box", color: "blue" });
|
|
816
|
+
* ```
|
|
817
|
+
*/
|
|
818
|
+
interface NodeOptions {
|
|
819
|
+
/** Custom unique identifier for the node */
|
|
820
|
+
nodeId?: string;
|
|
821
|
+
/** @internal Node type for autolabel */
|
|
822
|
+
["~type"]?: string;
|
|
823
|
+
/** @internal Icon data URL */
|
|
824
|
+
["~iconDataUrl"]?: string;
|
|
825
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
826
|
+
className?: string;
|
|
827
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
828
|
+
dataAttrs?: Record<string, string>;
|
|
829
|
+
/** Additional Graphviz node attributes */
|
|
830
|
+
[key: string]: unknown;
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Options for creating a cluster
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* const cluster = diagram.cluster("VPC", {
|
|
837
|
+
* className: "production",
|
|
838
|
+
* dataAttrs: { region: "us-east-1" }
|
|
839
|
+
* });
|
|
840
|
+
* ```
|
|
841
|
+
*/
|
|
842
|
+
interface ClusterOptions {
|
|
843
|
+
/** Graphviz attributes for the cluster */
|
|
844
|
+
graphAttr?: Record<string, string>;
|
|
845
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
846
|
+
className?: string;
|
|
847
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
848
|
+
dataAttrs?: Record<string, string>;
|
|
849
|
+
}
|
|
850
|
+
type Yaml = typeof yaml_d_exports;
|
|
851
|
+
//#endregion
|
|
787
852
|
//#region src/json.d.ts
|
|
788
853
|
/**
|
|
789
854
|
* JSON representation of a node in the diagram.
|
|
@@ -805,6 +870,10 @@ interface DiagramNodeJSON {
|
|
|
805
870
|
attrs?: Record<string, string | number>;
|
|
806
871
|
/** Metadata attached to this node (e.g., cloud provider specs, pricing) */
|
|
807
872
|
metadata?: Record<string, any>;
|
|
873
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
874
|
+
className?: string;
|
|
875
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
876
|
+
dataAttrs?: Record<string, string>;
|
|
808
877
|
}
|
|
809
878
|
/**
|
|
810
879
|
* JSON representation of an edge (connection) between nodes.
|
|
@@ -824,6 +893,10 @@ interface DiagramEdgeJSON {
|
|
|
824
893
|
style?: string;
|
|
825
894
|
/** Additional Graphviz attributes */
|
|
826
895
|
attrs?: Record<string, string>;
|
|
896
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
897
|
+
className?: string;
|
|
898
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
899
|
+
dataAttrs?: Record<string, string>;
|
|
827
900
|
}
|
|
828
901
|
/**
|
|
829
902
|
* JSON representation of a cluster (group) of nodes.
|
|
@@ -837,6 +910,10 @@ interface DiagramClusterJSON {
|
|
|
837
910
|
graphAttr?: Record<string, string>;
|
|
838
911
|
/** Nested clusters */
|
|
839
912
|
clusters?: DiagramClusterJSON[];
|
|
913
|
+
/** CSS class(es) to add to the rendered SVG element */
|
|
914
|
+
className?: string;
|
|
915
|
+
/** Custom data attributes to add to the rendered SVG element */
|
|
916
|
+
dataAttrs?: Record<string, string>;
|
|
840
917
|
}
|
|
841
918
|
/**
|
|
842
919
|
* A provider module mapping type names to factory functions.
|
|
@@ -1199,9 +1276,10 @@ interface Diagram {
|
|
|
1199
1276
|
/**
|
|
1200
1277
|
* Create a cluster (group) of nodes
|
|
1201
1278
|
* @param label - The label for the cluster
|
|
1279
|
+
* @param options - Optional cluster configuration
|
|
1202
1280
|
* @returns The cluster object
|
|
1203
1281
|
*/
|
|
1204
|
-
cluster(label: string): Cluster;
|
|
1282
|
+
cluster(label: string, options?: ClusterOptions): Cluster;
|
|
1205
1283
|
/**
|
|
1206
1284
|
* Render the diagram to SVG or other formats
|
|
1207
1285
|
* @param options - Rendering options
|
|
@@ -1512,7 +1590,7 @@ declare function createSVGPlugin(): DiagramsPlugin;
|
|
|
1512
1590
|
*/
|
|
1513
1591
|
declare const svgPlugin: DiagramsPlugin;
|
|
1514
1592
|
declare namespace index_d_exports {
|
|
1515
|
-
export { ChangeKind, Cluster, ClusterDiff, CreatePlugin, Custom, DependencyError, Diagram, DiagramClusterJSON, DiagramDiffResult, DiagramEdgeJSON, DiagramJSON, DiagramNodeJSON, DiagramOptions, DiagramsPlugin, DiffMeta, DiffOptions, DiffSummary, Edge, EdgeDiff, EdgeOptions, ExportContext, ExporterCapability, FromJSONOptions, HookCapability, HookContext, HookEvent, HookHandler, Iconify, ImportContext, ImporterCapability, MetadataCapability, MetadataContext, Node, NodeDiff, NodeMetadata, NodeOptions, PluginCapability, PluginContext, PluginError, PluginRegistry, ProviderModule, RenderContext, RenderDiffOptions, RendererCapability, RuntimeError, RuntimeSupport, ThemeConfig, ThemeName, Yaml, computeDiff, createJSONPlugin, createPluginRegistry, createSVGPlugin, jsonPlugin, renderDiff, svgPlugin };
|
|
1593
|
+
export { ChangeKind, Cluster, ClusterDiff, ClusterOptions, CreatePlugin, Custom, DependencyError, Diagram, DiagramClusterJSON, DiagramDiffResult, DiagramEdgeJSON, DiagramJSON, DiagramNodeJSON, DiagramOptions, DiagramsPlugin, DiffMeta, DiffOptions, DiffSummary, Edge, EdgeDiff, EdgeOptions, ExportContext, ExporterCapability, FromJSONOptions, HookCapability, HookContext, HookEvent, HookHandler, Iconify, ImportContext, ImporterCapability, MetadataCapability, MetadataContext, Node, NodeDiff, NodeMetadata, NodeOptions, PluginCapability, PluginContext, PluginError, PluginRegistry, ProviderModule, RenderContext, RenderDiffOptions, RendererCapability, RuntimeError, RuntimeSupport, ThemeConfig, ThemeName, Yaml, computeDiff, createJSONPlugin, createPluginRegistry, createSVGPlugin, jsonPlugin, renderDiff, svgPlugin };
|
|
1516
1594
|
}
|
|
1517
1595
|
//#endregion
|
|
1518
|
-
export { type ChangeKind, Cluster, type ClusterDiff, type CreatePlugin, Custom, DependencyError, Diagram, type DiagramClusterJSON, type DiagramDiffResult, type DiagramEdgeJSON, type DiagramJSON, type DiagramNodeJSON, type DiagramOptions, type DiagramsPlugin, type DiffMeta, type DiffOptions, type DiffSummary, Edge, type EdgeDiff, type EdgeOptions, type ExportContext, type ExporterCapability, type FromJSONOptions, type HookCapability, type HookContext, HookEvent, type HookHandler, Iconify, type ImportContext, type ImporterCapability, type MetadataCapability, type MetadataContext, type Node, type NodeDiff, type NodeMetadata, type NodeOptions, type PluginCapability, type PluginContext, PluginError, type PluginRegistry, type ProviderModule, type RenderContext, type RenderDiffOptions, type RendererCapability, RuntimeError, type RuntimeSupport, type ThemeConfig, type ThemeName, type Yaml, computeDiff, createJSONPlugin, createPluginRegistry, createSVGPlugin, jsonPlugin, renderDiff, svgPlugin };
|
|
1596
|
+
export { type ChangeKind, Cluster, type ClusterDiff, type ClusterOptions, type CreatePlugin, Custom, DependencyError, Diagram, type DiagramClusterJSON, type DiagramDiffResult, type DiagramEdgeJSON, type DiagramJSON, type DiagramNodeJSON, type DiagramOptions, type DiagramsPlugin, type DiffMeta, type DiffOptions, type DiffSummary, Edge, type EdgeDiff, type EdgeOptions, type ExportContext, type ExporterCapability, type FromJSONOptions, type HookCapability, type HookContext, HookEvent, type HookHandler, Iconify, type ImportContext, type ImporterCapability, type MetadataCapability, type MetadataContext, type Node, type NodeDiff, type NodeMetadata, type NodeOptions, type PluginCapability, type PluginContext, PluginError, type PluginRegistry, type ProviderModule, type RenderContext, type RenderDiffOptions, type RendererCapability, RuntimeError, type RuntimeSupport, type ThemeConfig, type ThemeName, type Yaml, computeDiff, createJSONPlugin, createPluginRegistry, createSVGPlugin, jsonPlugin, renderDiff, svgPlugin };
|