@statelyai/graph 0.4.0 → 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.
Files changed (46) hide show
  1. package/README.md +63 -144
  2. package/dist/{algorithms-CnTmuX9t.mjs → algorithms-oVD9PYil.mjs} +219 -31
  3. package/dist/algorithms.d.mts +91 -3
  4. package/dist/algorithms.mjs +2 -2
  5. package/dist/{converter-C5DlzzHs.mjs → converter-B5CUD0r9.mjs} +2 -2
  6. package/dist/formats/adjacency-list/index.d.mts +1 -1
  7. package/dist/formats/adjacency-list/index.mjs +1 -1
  8. package/dist/formats/converter/index.d.mts +2 -2
  9. package/dist/formats/converter/index.mjs +1 -1
  10. package/dist/formats/cytoscape/index.d.mts +1 -1
  11. package/dist/formats/cytoscape/index.mjs +1 -1
  12. package/dist/formats/d3/index.d.mts +1 -1
  13. package/dist/formats/d3/index.mjs +1 -1
  14. package/dist/formats/dot/index.d.mts +1 -1
  15. package/dist/formats/dot/index.mjs +1 -1
  16. package/dist/formats/edge-list/index.d.mts +1 -1
  17. package/dist/formats/edge-list/index.mjs +1 -1
  18. package/dist/formats/elk/index.d.mts +61 -0
  19. package/dist/formats/elk/index.mjs +176 -0
  20. package/dist/formats/gexf/index.d.mts +1 -1
  21. package/dist/formats/gexf/index.mjs +1 -1
  22. package/dist/formats/gml/index.d.mts +1 -1
  23. package/dist/formats/gml/index.mjs +1 -1
  24. package/dist/formats/graphml/index.d.mts +1 -1
  25. package/dist/formats/graphml/index.mjs +148 -56
  26. package/dist/formats/jgf/index.d.mts +1 -1
  27. package/dist/formats/jgf/index.mjs +1 -1
  28. package/dist/formats/mermaid/index.d.mts +51 -33
  29. package/dist/formats/mermaid/index.mjs +315 -31
  30. package/dist/formats/tgf/index.d.mts +1 -1
  31. package/dist/formats/tgf/index.mjs +1 -1
  32. package/dist/formats/xyflow/index.d.mts +1 -1
  33. package/dist/index.d.mts +100 -3
  34. package/dist/index.mjs +366 -10
  35. package/dist/queries.d.mts +1 -1
  36. package/dist/queries.mjs +1 -1
  37. package/dist/schemas.d.mts +39 -4
  38. package/dist/schemas.mjs +27 -5
  39. package/dist/{types-Bq_fmLwW.d.mts → types-DF-HNw50.d.mts} +65 -13
  40. package/package.json +7 -1
  41. package/schemas/edge.schema.json +32 -1
  42. package/schemas/graph.schema.json +114 -4
  43. package/schemas/node.schema.json +45 -2
  44. /package/dist/{adjacency-list-Bv4tfiM3.mjs → adjacency-list-fldj-QAL.mjs} +0 -0
  45. /package/dist/{edge-list-R1SUbHwe.mjs → edge-list-Br05wXMg.mjs} +0 -0
  46. /package/dist/{indexing-DitHphT7.mjs → indexing-DyfgLuzw.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { n as createFormatConverter } from "../../converter-C5DlzzHs.mjs";
1
+ import { n as createFormatConverter } from "../../converter-B5CUD0r9.mjs";
2
2
  import { XMLBuilder, XMLParser } from "fast-xml-parser";
3
3
 
4
4
  //#region src/formats/graphml/index.ts
@@ -17,6 +17,12 @@ function toGraphML(graph) {
17
17
  "@_attr.name": "parentId",
18
18
  "@_attr.type": "string"
19
19
  },
20
+ {
21
+ "@_id": "initialNodeId",
22
+ "@_for": "node",
23
+ "@_attr.name": "initialNodeId",
24
+ "@_attr.type": "string"
25
+ },
20
26
  {
21
27
  "@_id": "data",
22
28
  "@_for": "all",
@@ -29,6 +35,30 @@ function toGraphML(graph) {
29
35
  "@_attr.name": "data",
30
36
  "@_attr.type": "string"
31
37
  },
38
+ {
39
+ "@_id": "graphInitialNodeId",
40
+ "@_for": "graph",
41
+ "@_attr.name": "initialNodeId",
42
+ "@_attr.type": "string"
43
+ },
44
+ {
45
+ "@_id": "direction",
46
+ "@_for": "graph",
47
+ "@_attr.name": "direction",
48
+ "@_attr.type": "string"
49
+ },
50
+ {
51
+ "@_id": "style",
52
+ "@_for": "all",
53
+ "@_attr.name": "style",
54
+ "@_attr.type": "string"
55
+ },
56
+ {
57
+ "@_id": "graphStyle",
58
+ "@_for": "graph",
59
+ "@_attr.name": "style",
60
+ "@_attr.type": "string"
61
+ },
32
62
  {
33
63
  "@_id": "x",
34
64
  "@_for": "all",
@@ -64,85 +94,107 @@ function toGraphML(graph) {
64
94
  "@_for": "all",
65
95
  "@_attr.name": "color",
66
96
  "@_attr.type": "string"
97
+ },
98
+ {
99
+ "@_id": "weight",
100
+ "@_for": "edge",
101
+ "@_attr.name": "weight",
102
+ "@_attr.type": "double"
67
103
  }
68
104
  ];
69
- const nodes = graph.nodes.map((n) => {
105
+ const nodes = graph.nodes.map((node) => {
70
106
  const data = [];
71
- if (n.label) data.push({
107
+ if (node.label) data.push({
72
108
  "@_key": "label",
73
- "#text": n.label
109
+ "#text": node.label
74
110
  });
75
- if (n.parentId) data.push({
111
+ if (node.parentId) data.push({
76
112
  "@_key": "parentId",
77
- "#text": n.parentId
113
+ "#text": node.parentId
78
114
  });
79
- if (n.data !== void 0) data.push({
115
+ if (node.initialNodeId) data.push({
116
+ "@_key": "initialNodeId",
117
+ "#text": node.initialNodeId
118
+ });
119
+ if (node.data !== void 0) data.push({
80
120
  "@_key": "data",
81
- "#text": JSON.stringify(n.data)
121
+ "#text": JSON.stringify(node.data)
122
+ });
123
+ if (node.style !== void 0) data.push({
124
+ "@_key": "style",
125
+ "#text": JSON.stringify(node.style)
82
126
  });
83
- if (n.x !== void 0) data.push({
127
+ if (node.x !== void 0) data.push({
84
128
  "@_key": "x",
85
- "#text": n.x
129
+ "#text": node.x
86
130
  });
87
- if (n.y !== void 0) data.push({
131
+ if (node.y !== void 0) data.push({
88
132
  "@_key": "y",
89
- "#text": n.y
133
+ "#text": node.y
90
134
  });
91
- if (n.width !== void 0) data.push({
135
+ if (node.width !== void 0) data.push({
92
136
  "@_key": "width",
93
- "#text": n.width
137
+ "#text": node.width
94
138
  });
95
- if (n.height !== void 0) data.push({
139
+ if (node.height !== void 0) data.push({
96
140
  "@_key": "height",
97
- "#text": n.height
141
+ "#text": node.height
98
142
  });
99
- if (n.shape) data.push({
143
+ if (node.shape) data.push({
100
144
  "@_key": "shape",
101
- "#text": n.shape
145
+ "#text": node.shape
102
146
  });
103
- if (n.color) data.push({
147
+ if (node.color) data.push({
104
148
  "@_key": "color",
105
- "#text": n.color
149
+ "#text": node.color
106
150
  });
107
151
  return {
108
- "@_id": n.id,
152
+ "@_id": node.id,
109
153
  ...data.length > 0 && { data }
110
154
  };
111
155
  });
112
- const edges = graph.edges.map((e) => {
156
+ const edges = graph.edges.map((edge) => {
113
157
  const data = [];
114
- if (e.label) data.push({
158
+ if (edge.label) data.push({
115
159
  "@_key": "label",
116
- "#text": e.label
160
+ "#text": edge.label
117
161
  });
118
- if (e.data !== void 0) data.push({
162
+ if (edge.data !== void 0) data.push({
119
163
  "@_key": "data",
120
- "#text": JSON.stringify(e.data)
164
+ "#text": JSON.stringify(edge.data)
121
165
  });
122
- if (e.x !== void 0) data.push({
166
+ if (edge.style !== void 0) data.push({
167
+ "@_key": "style",
168
+ "#text": JSON.stringify(edge.style)
169
+ });
170
+ if (edge.x !== void 0) data.push({
123
171
  "@_key": "x",
124
- "#text": e.x
172
+ "#text": edge.x
125
173
  });
126
- if (e.y !== void 0) data.push({
174
+ if (edge.y !== void 0) data.push({
127
175
  "@_key": "y",
128
- "#text": e.y
176
+ "#text": edge.y
129
177
  });
130
- if (e.width !== void 0) data.push({
178
+ if (edge.width !== void 0) data.push({
131
179
  "@_key": "width",
132
- "#text": e.width
180
+ "#text": edge.width
133
181
  });
134
- if (e.height !== void 0) data.push({
182
+ if (edge.height !== void 0) data.push({
135
183
  "@_key": "height",
136
- "#text": e.height
184
+ "#text": edge.height
137
185
  });
138
- if (e.color) data.push({
186
+ if (edge.color) data.push({
139
187
  "@_key": "color",
140
- "#text": e.color
188
+ "#text": edge.color
189
+ });
190
+ if (edge.weight !== void 0) data.push({
191
+ "@_key": "weight",
192
+ "#text": edge.weight
141
193
  });
142
194
  return {
143
- "@_id": e.id,
144
- "@_source": e.sourceId,
145
- "@_target": e.targetId,
195
+ "@_id": edge.id,
196
+ "@_source": edge.sourceId,
197
+ "@_target": edge.targetId,
146
198
  ...data.length > 0 && { data }
147
199
  };
148
200
  });
@@ -151,6 +203,18 @@ function toGraphML(graph) {
151
203
  "@_key": "graphData",
152
204
  "#text": JSON.stringify(graph.data)
153
205
  });
206
+ if (graph.initialNodeId) graphData.push({
207
+ "@_key": "graphInitialNodeId",
208
+ "#text": graph.initialNodeId
209
+ });
210
+ if (graph.direction !== void 0) graphData.push({
211
+ "@_key": "direction",
212
+ "#text": graph.direction
213
+ });
214
+ if (graph.style !== void 0) graphData.push({
215
+ "@_key": "graphStyle",
216
+ "#text": JSON.stringify(graph.style)
217
+ });
154
218
  const obj = {
155
219
  "?xml": {
156
220
  "@_version": "1.0",
@@ -196,40 +260,57 @@ function fromGraphML(xml) {
196
260
  const graphEl = graphml.graph;
197
261
  if (!graphEl) throw new Error("GraphML: missing <graph> element");
198
262
  const graphType = graphEl["@_edgedefault"] === "undirected" ? "undirected" : "directed";
199
- let graphData = void 0;
200
- if (graphEl.data) {
201
- for (const d of asArray(graphEl.data)) if (d["@_key"] === "graphData") graphData = tryParseJSON(String(d["#text"]));
202
- }
203
- const nodes = asArray(graphEl.node).map((n) => {
204
- const dataMap = parseDataElements(n.data);
205
- return {
263
+ const graphDataMap = parseDataElements(graphEl.data);
264
+ const graphData = graphDataMap.graphData !== void 0 ? tryParseJSON(graphDataMap.graphData) : void 0;
265
+ const nodes = asArray(graphEl.node).map((nodeEl) => {
266
+ const dataMap = parseDataElements(nodeEl.data);
267
+ const node = {
206
268
  type: "node",
207
- id: String(n["@_id"]),
269
+ id: String(nodeEl["@_id"]),
208
270
  parentId: dataMap.parentId ?? null,
209
271
  initialNodeId: dataMap.initialNodeId ?? null,
210
272
  label: dataMap.label ?? "",
211
273
  data: dataMap.data !== void 0 ? tryParseJSON(dataMap.data) : void 0
212
274
  };
275
+ if (dataMap.x !== void 0) node.x = parseNumber(dataMap.x);
276
+ if (dataMap.y !== void 0) node.y = parseNumber(dataMap.y);
277
+ if (dataMap.width !== void 0) node.width = parseNumber(dataMap.width);
278
+ if (dataMap.height !== void 0) node.height = parseNumber(dataMap.height);
279
+ if (dataMap.shape !== void 0) node.shape = dataMap.shape;
280
+ if (dataMap.color !== void 0) node.color = dataMap.color;
281
+ if (dataMap.style !== void 0) node.style = tryParseJSON(dataMap.style);
282
+ return node;
213
283
  });
214
- const edges = asArray(graphEl.edge).map((e) => {
215
- const dataMap = parseDataElements(e.data);
216
- return {
284
+ const edges = asArray(graphEl.edge).map((edgeEl) => {
285
+ const dataMap = parseDataElements(edgeEl.data);
286
+ const edge = {
217
287
  type: "edge",
218
- id: String(e["@_id"]),
219
- sourceId: String(e["@_source"]),
220
- targetId: String(e["@_target"]),
288
+ id: String(edgeEl["@_id"]),
289
+ sourceId: String(edgeEl["@_source"]),
290
+ targetId: String(edgeEl["@_target"]),
221
291
  label: dataMap.label ?? "",
222
292
  data: dataMap.data !== void 0 ? tryParseJSON(dataMap.data) : void 0
223
293
  };
294
+ if (dataMap.weight !== void 0) edge.weight = parseNumber(dataMap.weight);
295
+ if (dataMap.x !== void 0) edge.x = parseNumber(dataMap.x);
296
+ if (dataMap.y !== void 0) edge.y = parseNumber(dataMap.y);
297
+ if (dataMap.width !== void 0) edge.width = parseNumber(dataMap.width);
298
+ if (dataMap.height !== void 0) edge.height = parseNumber(dataMap.height);
299
+ if (dataMap.color !== void 0) edge.color = dataMap.color;
300
+ if (dataMap.style !== void 0) edge.style = tryParseJSON(dataMap.style);
301
+ return edge;
224
302
  });
225
- return {
303
+ const graph = {
226
304
  id: String(graphEl["@_id"] ?? ""),
227
305
  type: graphType,
228
- initialNodeId: null,
306
+ initialNodeId: graphDataMap.graphInitialNodeId ?? null,
229
307
  nodes,
230
308
  edges,
231
309
  data: graphData
232
310
  };
311
+ if (graphDataMap.direction !== void 0) graph.direction = parseDirection(graphDataMap.direction);
312
+ if (graphDataMap.graphStyle !== void 0) graph.style = tryParseJSON(graphDataMap.graphStyle);
313
+ return graph;
233
314
  }
234
315
  function asArray(val) {
235
316
  if (val === void 0) return [];
@@ -237,7 +318,7 @@ function asArray(val) {
237
318
  }
238
319
  function parseDataElements(dataEls) {
239
320
  const map = {};
240
- for (const d of asArray(dataEls)) if (d && d["@_key"]) map[d["@_key"]] = String(d["#text"] ?? "");
321
+ for (const dataEl of asArray(dataEls)) if (dataEl && dataEl["@_key"]) map[dataEl["@_key"]] = String(dataEl["#text"] ?? "");
241
322
  return map;
242
323
  }
243
324
  function tryParseJSON(str) {
@@ -247,6 +328,17 @@ function tryParseJSON(str) {
247
328
  return str;
248
329
  }
249
330
  }
331
+ function parseNumber(value) {
332
+ return Number(value);
333
+ }
334
+ function parseDirection(value) {
335
+ return [
336
+ "up",
337
+ "down",
338
+ "left",
339
+ "right"
340
+ ].includes(value) ? value : void 0;
341
+ }
250
342
  /** Bidirectional converter for GraphML XML format. */
251
343
  const graphmlConverter = createFormatConverter(toGraphML, fromGraphML);
252
344
 
@@ -1,4 +1,4 @@
1
- import { c as Graph, f as GraphFormatConverter } from "../../types-Bq_fmLwW.mjs";
1
+ import { m as GraphFormatConverter, u as Graph } from "../../types-DF-HNw50.mjs";
2
2
 
3
3
  //#region src/formats/jgf/index.d.ts
4
4
  interface JGFNode {
@@ -1,4 +1,4 @@
1
- import { n as createFormatConverter } from "../../converter-C5DlzzHs.mjs";
1
+ import { n as createFormatConverter } from "../../converter-B5CUD0r9.mjs";
2
2
 
3
3
  //#region src/formats/jgf/index.ts
4
4
  /**
@@ -1,11 +1,20 @@
1
- import { c as Graph, f as GraphFormatConverter } from "../../types-Bq_fmLwW.mjs";
1
+ import { m as GraphFormatConverter, u as Graph } from "../../types-DF-HNw50.mjs";
2
2
 
3
3
  //#region src/formats/mermaid/sequence.d.ts
4
4
  interface SequenceNodeData {
5
- actorType: 'participant' | 'actor';
5
+ actorType: 'participant' | 'actor' | 'boundary' | 'control' | 'entity' | 'database' | 'collections' | 'queue';
6
6
  alias?: string;
7
7
  created?: boolean;
8
8
  destroyed?: boolean;
9
+ notes?: Array<{
10
+ position: 'left' | 'right' | 'over';
11
+ text: string;
12
+ over?: string[];
13
+ }>;
14
+ box?: {
15
+ title?: string;
16
+ color?: string;
17
+ };
9
18
  }
10
19
  interface SequenceEdgeData {
11
20
  kind: 'message' | 'activation' | 'deactivation';
@@ -14,6 +23,11 @@ interface SequenceEdgeData {
14
23
  bidirectional?: boolean;
15
24
  sequenceNumber?: number;
16
25
  }
26
+ /**
27
+ * Control-flow blocks (loop/alt/par/opt/critical/break/rect).
28
+ * Not graph topology — they describe ordering constraints.
29
+ * Stored in `graphData.blocks` for round-trip fidelity.
30
+ */
17
31
  type SequenceBlock = {
18
32
  type: 'loop';
19
33
  label: string;
@@ -57,7 +71,7 @@ interface SequenceGraphData {
57
71
  autonumber?: boolean;
58
72
  blocks?: SequenceBlock[];
59
73
  }
60
- type SequenceGraph = Graph<SequenceNodeData, SequenceEdgeData, SequenceGraphData>;
74
+ type MermaidSequenceGraph = Graph<SequenceNodeData, SequenceEdgeData, SequenceGraphData>;
61
75
  /**
62
76
  * Parses a Mermaid sequence diagram string into a Graph.
63
77
  *
@@ -70,7 +84,7 @@ type SequenceGraph = Graph<SequenceNodeData, SequenceEdgeData, SequenceGraphData
70
84
  * Bob-->>Alice: Hi back
71
85
  * `);
72
86
  */
73
- declare function fromMermaidSequence(input: string): SequenceGraph;
87
+ declare function fromMermaidSequence(input: string): MermaidSequenceGraph;
74
88
  /**
75
89
  * Converts a sequence diagram Graph to a Mermaid sequence diagram string.
76
90
  *
@@ -78,7 +92,7 @@ declare function fromMermaidSequence(input: string): SequenceGraph;
78
92
  * const mermaid = toMermaidSequence(graph);
79
93
  * // "sequenceDiagram\n participant Alice\n ..."
80
94
  */
81
- declare function toMermaidSequence(graph: SequenceGraph): string;
95
+ declare function toMermaidSequence(graph: MermaidSequenceGraph): string;
82
96
  /**
83
97
  * Bidirectional converter for Mermaid sequence diagram format.
84
98
  *
@@ -89,16 +103,17 @@ declare function toMermaidSequence(graph: SequenceGraph): string;
89
103
  * `);
90
104
  * const str = mermaidSequenceConverter.to(graph);
91
105
  */
92
- declare const mermaidSequenceConverter: GraphFormatConverter<string>;
106
+ declare const mermaidSequenceConverter: GraphFormatConverter<string, SequenceNodeData, SequenceEdgeData, SequenceGraphData>;
93
107
  //#endregion
94
108
  //#region src/formats/mermaid/flowchart.d.ts
95
109
  interface FlowchartNodeData {
96
110
  classes?: string[];
97
111
  link?: string;
98
112
  tooltip?: string;
113
+ direction?: 'up' | 'down' | 'left' | 'right';
99
114
  }
100
115
  interface FlowchartEdgeData {
101
- stroke: 'normal' | 'dotted' | 'thick';
116
+ stroke: 'normal' | 'dotted' | 'thick' | 'invisible';
102
117
  arrowType: 'arrow' | 'none';
103
118
  endMarker?: 'arrow' | 'circle' | 'cross';
104
119
  startMarker?: 'arrow' | 'circle' | 'cross';
@@ -109,7 +124,7 @@ interface FlowchartGraphData {
109
124
  diagramType: 'flowchart';
110
125
  classDefs?: Record<string, Record<string, string>>;
111
126
  }
112
- type FlowchartGraph = Graph<FlowchartNodeData, FlowchartEdgeData, FlowchartGraphData>;
127
+ type MermaidFlowchartGraph = Graph<FlowchartNodeData, FlowchartEdgeData, FlowchartGraphData>;
113
128
  /**
114
129
  * Parses a Mermaid flowchart string into a Graph.
115
130
  *
@@ -120,7 +135,7 @@ type FlowchartGraph = Graph<FlowchartNodeData, FlowchartEdgeData, FlowchartGraph
120
135
  * B -->|Yes| C[End]
121
136
  * `);
122
137
  */
123
- declare function fromMermaidFlowchart(input: string): FlowchartGraph;
138
+ declare function fromMermaidFlowchart(input: string): MermaidFlowchartGraph;
124
139
  /**
125
140
  * Converts a flowchart Graph to a Mermaid flowchart string.
126
141
  *
@@ -128,7 +143,7 @@ declare function fromMermaidFlowchart(input: string): FlowchartGraph;
128
143
  * const mermaid = toMermaidFlowchart(graph);
129
144
  * // "flowchart TD\n A[Start] --> B{Decision}\n ..."
130
145
  */
131
- declare function toMermaidFlowchart(graph: FlowchartGraph): string;
146
+ declare function toMermaidFlowchart(graph: MermaidFlowchartGraph): string;
132
147
  /**
133
148
  * Bidirectional converter for Mermaid flowchart format.
134
149
  *
@@ -139,24 +154,27 @@ declare function toMermaidFlowchart(graph: FlowchartGraph): string;
139
154
  * `);
140
155
  * const str = mermaidFlowchartConverter.to(graph);
141
156
  */
142
- declare const mermaidFlowchartConverter: GraphFormatConverter<string>;
157
+ declare const mermaidFlowchartConverter: GraphFormatConverter<string, FlowchartNodeData, FlowchartEdgeData, FlowchartGraphData>;
143
158
  //#endregion
144
159
  //#region src/formats/mermaid/state.d.ts
145
160
  interface StateNodeData {
146
161
  description?: string;
147
- stateType?: 'choice' | 'fork' | 'join';
162
+ stateType?: 'choice' | 'fork' | 'join' | 'parallel';
148
163
  notes?: Array<{
149
164
  position: 'left' | 'right';
150
165
  text: string;
151
166
  }>;
152
167
  isStart?: boolean;
153
168
  isEnd?: boolean;
169
+ classes?: string[];
170
+ direction?: 'up' | 'down' | 'left' | 'right';
154
171
  }
155
172
  interface StateEdgeData {}
156
173
  interface StateGraphData {
157
174
  diagramType: 'stateDiagram';
175
+ classDefs?: Record<string, Record<string, string>>;
158
176
  }
159
- type StateGraph = Graph<StateNodeData, StateEdgeData, StateGraphData>;
177
+ type MermaidStateGraph = Graph<StateNodeData, StateEdgeData, StateGraphData>;
160
178
  /**
161
179
  * Parses a Mermaid state diagram string into a Graph.
162
180
  *
@@ -168,7 +186,7 @@ type StateGraph = Graph<StateNodeData, StateEdgeData, StateGraphData>;
168
186
  * Running --> [*]
169
187
  * `);
170
188
  */
171
- declare function fromMermaidState(input: string): StateGraph;
189
+ declare function fromMermaidState(input: string): MermaidStateGraph;
172
190
  /**
173
191
  * Converts a state diagram Graph to a Mermaid state diagram string.
174
192
  *
@@ -176,7 +194,7 @@ declare function fromMermaidState(input: string): StateGraph;
176
194
  * const mermaid = toMermaidState(graph);
177
195
  * // "stateDiagram-v2\n [*] --> Idle\n ..."
178
196
  */
179
- declare function toMermaidState(graph: StateGraph): string;
197
+ declare function toMermaidState(graph: MermaidStateGraph): string;
180
198
  /**
181
199
  * Bidirectional converter for Mermaid state diagram format.
182
200
  *
@@ -187,7 +205,7 @@ declare function toMermaidState(graph: StateGraph): string;
187
205
  * `);
188
206
  * const str = mermaidStateConverter.to(graph);
189
207
  */
190
- declare const mermaidStateConverter: GraphFormatConverter<string>;
208
+ declare const mermaidStateConverter: GraphFormatConverter<string, StateNodeData, StateEdgeData, StateGraphData>;
191
209
  //#endregion
192
210
  //#region src/formats/mermaid/class-diagram.d.ts
193
211
  interface ClassNodeData {
@@ -208,7 +226,7 @@ interface ClassEdgeData {
208
226
  interface ClassGraphData {
209
227
  diagramType: 'classDiagram';
210
228
  }
211
- type ClassGraph = Graph<ClassNodeData, ClassEdgeData, ClassGraphData>;
229
+ type MermaidClassGraph = Graph<ClassNodeData, ClassEdgeData, ClassGraphData>;
212
230
  /**
213
231
  * Parses a Mermaid class diagram string into a Graph.
214
232
  *
@@ -222,7 +240,7 @@ type ClassGraph = Graph<ClassNodeData, ClassEdgeData, ClassGraphData>;
222
240
  * Animal <|-- Dog
223
241
  * `);
224
242
  */
225
- declare function fromMermaidClass(input: string): ClassGraph;
243
+ declare function fromMermaidClass(input: string): MermaidClassGraph;
226
244
  /**
227
245
  * Converts a class diagram Graph to a Mermaid class diagram string.
228
246
  *
@@ -230,7 +248,7 @@ declare function fromMermaidClass(input: string): ClassGraph;
230
248
  * const mermaid = toMermaidClass(graph);
231
249
  * // "classDiagram\n class Animal {\n ..."
232
250
  */
233
- declare function toMermaidClass(graph: ClassGraph): string;
251
+ declare function toMermaidClass(graph: MermaidClassGraph): string;
234
252
  /**
235
253
  * Bidirectional converter for Mermaid class diagram format.
236
254
  *
@@ -241,7 +259,7 @@ declare function toMermaidClass(graph: ClassGraph): string;
241
259
  * `);
242
260
  * const str = mermaidClassConverter.to(graph);
243
261
  */
244
- declare const mermaidClassConverter: GraphFormatConverter<string>;
262
+ declare const mermaidClassConverter: GraphFormatConverter<string, ClassNodeData, ClassEdgeData, ClassGraphData>;
245
263
  //#endregion
246
264
  //#region src/formats/mermaid/er-diagram.d.ts
247
265
  interface ERNodeData {
@@ -260,7 +278,7 @@ interface EREdgeData {
260
278
  interface ERGraphData {
261
279
  diagramType: 'erDiagram';
262
280
  }
263
- type ERGraph = Graph<ERNodeData, EREdgeData, ERGraphData>;
281
+ type MermaidERGraph = Graph<ERNodeData, EREdgeData, ERGraphData>;
264
282
  /**
265
283
  * Parses a Mermaid ER diagram string into a Graph.
266
284
  *
@@ -271,7 +289,7 @@ type ERGraph = Graph<ERNodeData, EREdgeData, ERGraphData>;
271
289
  * ORDER ||--|{ LINE_ITEM : contains
272
290
  * `);
273
291
  */
274
- declare function fromMermaidER(input: string): ERGraph;
292
+ declare function fromMermaidER(input: string): MermaidERGraph;
275
293
  /**
276
294
  * Converts an ER diagram Graph to a Mermaid ER diagram string.
277
295
  *
@@ -279,7 +297,7 @@ declare function fromMermaidER(input: string): ERGraph;
279
297
  * const mermaid = toMermaidER(graph);
280
298
  * // "erDiagram\n CUSTOMER ||--o{ ORDER : \"places\"\n ..."
281
299
  */
282
- declare function toMermaidER(graph: ERGraph): string;
300
+ declare function toMermaidER(graph: MermaidERGraph): string;
283
301
  /**
284
302
  * Bidirectional converter for Mermaid ER diagram format.
285
303
  *
@@ -290,7 +308,7 @@ declare function toMermaidER(graph: ERGraph): string;
290
308
  * `);
291
309
  * const str = mermaidERConverter.to(graph);
292
310
  */
293
- declare const mermaidERConverter: GraphFormatConverter<string>;
311
+ declare const mermaidERConverter: GraphFormatConverter<string, ERNodeData, EREdgeData, ERGraphData>;
294
312
  //#endregion
295
313
  //#region src/formats/mermaid/mindmap.d.ts
296
314
  interface MindmapNodeData {
@@ -300,7 +318,7 @@ interface MindmapEdgeData {}
300
318
  interface MindmapGraphData {
301
319
  diagramType: 'mindmap';
302
320
  }
303
- type MindmapGraph = Graph<MindmapNodeData, MindmapEdgeData, MindmapGraphData>;
321
+ type MermaidMindmapGraph = Graph<MindmapNodeData, MindmapEdgeData, MindmapGraphData>;
304
322
  /**
305
323
  * Parses a Mermaid mindmap string into a Graph.
306
324
  *
@@ -313,7 +331,7 @@ type MindmapGraph = Graph<MindmapNodeData, MindmapEdgeData, MindmapGraphData>;
313
331
  * Child B
314
332
  * `);
315
333
  */
316
- declare function fromMermaidMindmap(input: string): MindmapGraph;
334
+ declare function fromMermaidMindmap(input: string): MermaidMindmapGraph;
317
335
  /**
318
336
  * Converts a mindmap Graph to a Mermaid mindmap string.
319
337
  *
@@ -321,7 +339,7 @@ declare function fromMermaidMindmap(input: string): MindmapGraph;
321
339
  * const mermaid = toMermaidMindmap(graph);
322
340
  * // "mindmap\n Root\n Child A\n ..."
323
341
  */
324
- declare function toMermaidMindmap(graph: MindmapGraph): string;
342
+ declare function toMermaidMindmap(graph: MermaidMindmapGraph): string;
325
343
  /**
326
344
  * Bidirectional converter for Mermaid mindmap format.
327
345
  *
@@ -333,7 +351,7 @@ declare function toMermaidMindmap(graph: MindmapGraph): string;
333
351
  * `);
334
352
  * const str = mermaidMindmapConverter.to(graph);
335
353
  */
336
- declare const mermaidMindmapConverter: GraphFormatConverter<string>;
354
+ declare const mermaidMindmapConverter: GraphFormatConverter<string, MindmapNodeData, MindmapEdgeData, MindmapGraphData>;
337
355
  //#endregion
338
356
  //#region src/formats/mermaid/block.d.ts
339
357
  interface BlockNodeData {
@@ -344,7 +362,7 @@ interface BlockGraphData {
344
362
  diagramType: 'block';
345
363
  columns?: number;
346
364
  }
347
- type BlockGraph = Graph<BlockNodeData, BlockEdgeData, BlockGraphData>;
365
+ type MermaidBlockGraph = Graph<BlockNodeData, BlockEdgeData, BlockGraphData>;
348
366
  /**
349
367
  * Parses a Mermaid block diagram string into a Graph.
350
368
  *
@@ -356,7 +374,7 @@ type BlockGraph = Graph<BlockNodeData, BlockEdgeData, BlockGraphData>;
356
374
  * a --> b
357
375
  * `);
358
376
  */
359
- declare function fromMermaidBlock(input: string): BlockGraph;
377
+ declare function fromMermaidBlock(input: string): MermaidBlockGraph;
360
378
  /**
361
379
  * Converts a block diagram Graph to a Mermaid block diagram string.
362
380
  *
@@ -364,7 +382,7 @@ declare function fromMermaidBlock(input: string): BlockGraph;
364
382
  * const mermaid = toMermaidBlock(graph);
365
383
  * // "block-beta\n columns 2\n a[\"Task A\"]\n ..."
366
384
  */
367
- declare function toMermaidBlock(graph: BlockGraph): string;
385
+ declare function toMermaidBlock(graph: MermaidBlockGraph): string;
368
386
  /**
369
387
  * Bidirectional converter for Mermaid block diagram format.
370
388
  *
@@ -376,6 +394,6 @@ declare function toMermaidBlock(graph: BlockGraph): string;
376
394
  * `);
377
395
  * const str = mermaidBlockConverter.to(graph);
378
396
  */
379
- declare const mermaidBlockConverter: GraphFormatConverter<string>;
397
+ declare const mermaidBlockConverter: GraphFormatConverter<string, BlockNodeData, BlockEdgeData, BlockGraphData>;
380
398
  //#endregion
381
- export { type BlockEdgeData, type BlockGraphData, type BlockNodeData, type ClassEdgeData, type ClassGraphData, type ClassNodeData, type EREdgeData, type ERGraphData, type ERNodeData, type FlowchartEdgeData, type FlowchartGraphData, type FlowchartNodeData, type MindmapEdgeData, type MindmapGraphData, type MindmapNodeData, type SequenceBlock, type SequenceEdgeData, type SequenceGraphData, type SequenceNodeData, type StateEdgeData, type StateGraphData, type StateNodeData, fromMermaidBlock, fromMermaidClass, fromMermaidER, fromMermaidFlowchart, fromMermaidMindmap, fromMermaidSequence, fromMermaidState, mermaidBlockConverter, mermaidClassConverter, mermaidERConverter, mermaidFlowchartConverter, mermaidMindmapConverter, mermaidSequenceConverter, mermaidStateConverter, toMermaidBlock, toMermaidClass, toMermaidER, toMermaidFlowchart, toMermaidMindmap, toMermaidSequence, toMermaidState };
399
+ export { type BlockEdgeData, type BlockGraphData, type BlockNodeData, type ClassEdgeData, type ClassGraphData, type ClassNodeData, type EREdgeData, type ERGraphData, type ERNodeData, type FlowchartEdgeData, type FlowchartGraphData, type FlowchartNodeData, type MermaidBlockGraph, type MermaidClassGraph, type MermaidERGraph, type MermaidFlowchartGraph, type MermaidMindmapGraph, type MermaidSequenceGraph, type MermaidStateGraph, type MindmapEdgeData, type MindmapGraphData, type MindmapNodeData, type SequenceBlock, type SequenceEdgeData, type SequenceGraphData, type SequenceNodeData, type StateEdgeData, type StateGraphData, type StateNodeData, fromMermaidBlock, fromMermaidClass, fromMermaidER, fromMermaidFlowchart, fromMermaidMindmap, fromMermaidSequence, fromMermaidState, mermaidBlockConverter, mermaidClassConverter, mermaidERConverter, mermaidFlowchartConverter, mermaidMindmapConverter, mermaidSequenceConverter, mermaidStateConverter, toMermaidBlock, toMermaidClass, toMermaidER, toMermaidFlowchart, toMermaidMindmap, toMermaidSequence, toMermaidState };