@statelyai/graph 0.3.0 → 0.3.1
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/{adjacency-list-A4_Eiwj3.mjs → adjacency-list-ITO40kmn.mjs} +33 -0
- package/dist/{algorithms-DBU7nmIV.mjs → algorithms-NWSB2RWj.mjs} +672 -19
- package/dist/algorithms.d.mts +479 -10
- package/dist/algorithms.mjs +1 -1
- package/dist/converter-CchokMDg.mjs +67 -0
- package/dist/{edge-list-DuHMz8hf.mjs → edge-list-CgX6bBIF.mjs} +32 -0
- package/dist/formats/adjacency-list/index.d.mts +35 -1
- package/dist/formats/adjacency-list/index.mjs +1 -1
- package/dist/formats/converter/index.d.mts +37 -3
- package/dist/formats/converter/index.mjs +1 -1
- package/dist/formats/cytoscape/index.d.mts +50 -2
- package/dist/formats/cytoscape/index.mjs +50 -2
- package/dist/formats/d3/index.d.mts +48 -2
- package/dist/formats/d3/index.mjs +48 -2
- package/dist/formats/dot/index.d.mts +56 -2
- package/dist/formats/dot/index.mjs +55 -2
- package/dist/formats/edge-list/index.d.mts +34 -1
- package/dist/formats/edge-list/index.mjs +1 -1
- package/dist/formats/gexf/index.d.mts +1 -1
- package/dist/formats/gexf/index.mjs +1 -1
- package/dist/formats/gml/index.d.mts +58 -2
- package/dist/formats/gml/index.mjs +57 -2
- package/dist/formats/graphml/index.d.mts +1 -1
- package/dist/formats/graphml/index.mjs +1 -1
- package/dist/formats/jgf/index.d.mts +51 -2
- package/dist/formats/jgf/index.mjs +51 -2
- package/dist/formats/mermaid/index.d.mts +201 -8
- package/dist/formats/mermaid/index.mjs +361 -22
- package/dist/formats/tgf/index.d.mts +47 -2
- package/dist/formats/tgf/index.mjs +46 -2
- package/dist/index.d.mts +320 -14
- package/dist/index.mjs +115 -7
- package/dist/{indexing-BFFVMnjF.mjs → indexing-eNDrXdDA.mjs} +31 -2
- package/dist/queries.d.mts +353 -8
- package/dist/queries.mjs +352 -8
- package/dist/{types-B6Tpeerk.d.mts → types-BDXC1O5b.d.mts} +1 -1
- package/package.json +1 -1
- package/dist/converter-DnbeyE_p.mjs +0 -33
|
@@ -1,6 +1,28 @@
|
|
|
1
|
-
import { n as createFormatConverter } from "../../converter-
|
|
1
|
+
import { n as createFormatConverter } from "../../converter-CchokMDg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formats/gml/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a graph to GML (Graph Modelling Language) string.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createGraph } from '@statelyai/graph';
|
|
10
|
+
* import { toGML } from '@statelyai/graph/formats/gml';
|
|
11
|
+
*
|
|
12
|
+
* const graph = createGraph({
|
|
13
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
14
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const gml = toGML(graph);
|
|
18
|
+
* // graph [
|
|
19
|
+
* // directed 1
|
|
20
|
+
* // node [ id "a" ]
|
|
21
|
+
* // node [ id "b" ]
|
|
22
|
+
* // edge [ id "e0" source "a" target "b" ]
|
|
23
|
+
* // ]
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
4
26
|
function toGML(graph) {
|
|
5
27
|
const lines = [];
|
|
6
28
|
lines.push("graph [");
|
|
@@ -50,6 +72,23 @@ function toGML(graph) {
|
|
|
50
72
|
function gmlString(s) {
|
|
51
73
|
return `"${s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
52
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Parses a GML (Graph Modelling Language) string into a graph.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { fromGML } from '@statelyai/graph/formats/gml';
|
|
81
|
+
*
|
|
82
|
+
* const graph = fromGML(`
|
|
83
|
+
* graph [
|
|
84
|
+
* directed 1
|
|
85
|
+
* node [ id "a" ]
|
|
86
|
+
* node [ id "b" ]
|
|
87
|
+
* edge [ source "a" target "b" ]
|
|
88
|
+
* ]
|
|
89
|
+
* `);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
53
92
|
function fromGML(gml) {
|
|
54
93
|
if (typeof gml !== "string") throw new Error("GML: expected a string");
|
|
55
94
|
if (!gml.trim()) throw new Error("GML: input is empty");
|
|
@@ -229,7 +268,23 @@ function tryParseJSON(str) {
|
|
|
229
268
|
return str;
|
|
230
269
|
}
|
|
231
270
|
}
|
|
232
|
-
/**
|
|
271
|
+
/**
|
|
272
|
+
* Bidirectional converter for GML (Graph Modelling Language) format.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* import { createGraph } from '@statelyai/graph';
|
|
277
|
+
* import { gmlConverter } from '@statelyai/graph/formats/gml';
|
|
278
|
+
*
|
|
279
|
+
* const graph = createGraph({
|
|
280
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
281
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
282
|
+
* });
|
|
283
|
+
*
|
|
284
|
+
* const gml = gmlConverter.to(graph);
|
|
285
|
+
* const roundTripped = gmlConverter.from(gml);
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
233
288
|
const gmlConverter = createFormatConverter(toGML, fromGML);
|
|
234
289
|
|
|
235
290
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Graph, f as GraphFormatConverter } from "../../types-
|
|
1
|
+
import { c as Graph, f as GraphFormatConverter } from "../../types-BDXC1O5b.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formats/jgf/index.d.ts
|
|
4
4
|
interface JGFNode {
|
|
@@ -22,9 +22,58 @@ interface JGFGraph {
|
|
|
22
22
|
edges: JGFEdge[];
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Converts a graph to JSON Graph Format (JGF).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { createGraph } from '@statelyai/graph';
|
|
31
|
+
* import { toJGF } from '@statelyai/graph/formats/jgf';
|
|
32
|
+
*
|
|
33
|
+
* const graph = createGraph({
|
|
34
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
35
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* const jgf = toJGF(graph);
|
|
39
|
+
* // { graph: { directed: true, nodes: [...], edges: [...] } }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
25
42
|
declare function toJGF(graph: Graph): JGFGraph;
|
|
43
|
+
/**
|
|
44
|
+
* Parses a JSON Graph Format (JGF) object into a graph.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { fromJGF } from '@statelyai/graph/formats/jgf';
|
|
49
|
+
*
|
|
50
|
+
* const graph = fromJGF({
|
|
51
|
+
* graph: {
|
|
52
|
+
* directed: true,
|
|
53
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
54
|
+
* edges: [{ source: 'a', target: 'b' }],
|
|
55
|
+
* },
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
26
59
|
declare function fromJGF(jgf: JGFGraph): Graph;
|
|
27
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Bidirectional converter for JSON Graph Format.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { createGraph } from '@statelyai/graph';
|
|
66
|
+
* import { jgfConverter } from '@statelyai/graph/formats/jgf';
|
|
67
|
+
*
|
|
68
|
+
* const graph = createGraph({
|
|
69
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
70
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* const jgf = jgfConverter.to(graph);
|
|
74
|
+
* const roundTripped = jgfConverter.from(jgf);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
28
77
|
declare const jgfConverter: GraphFormatConverter<JGFGraph>;
|
|
29
78
|
//#endregion
|
|
30
79
|
export { JGFEdge, JGFGraph, JGFNode, fromJGF, jgfConverter, toJGF };
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { n as createFormatConverter } from "../../converter-
|
|
1
|
+
import { n as createFormatConverter } from "../../converter-CchokMDg.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formats/jgf/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Converts a graph to JSON Graph Format (JGF).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createGraph } from '@statelyai/graph';
|
|
10
|
+
* import { toJGF } from '@statelyai/graph/formats/jgf';
|
|
11
|
+
*
|
|
12
|
+
* const graph = createGraph({
|
|
13
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
14
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const jgf = toJGF(graph);
|
|
18
|
+
* // { graph: { directed: true, nodes: [...], edges: [...] } }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
4
21
|
function toJGF(graph) {
|
|
5
22
|
const metadata = {};
|
|
6
23
|
if (graph.initialNodeId !== null) metadata.initialNodeId = graph.initialNodeId;
|
|
@@ -41,6 +58,22 @@ function toJGF(graph) {
|
|
|
41
58
|
})
|
|
42
59
|
} };
|
|
43
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Parses a JSON Graph Format (JGF) object into a graph.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { fromJGF } from '@statelyai/graph/formats/jgf';
|
|
67
|
+
*
|
|
68
|
+
* const graph = fromJGF({
|
|
69
|
+
* graph: {
|
|
70
|
+
* directed: true,
|
|
71
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
72
|
+
* edges: [{ source: 'a', target: 'b' }],
|
|
73
|
+
* },
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
44
77
|
function fromJGF(jgf) {
|
|
45
78
|
if (!jgf || typeof jgf !== "object") throw new Error("JGF: expected an object");
|
|
46
79
|
if (!jgf.graph || typeof jgf.graph !== "object") throw new Error("JGF: missing \"graph\" property");
|
|
@@ -78,7 +111,23 @@ function fromJGF(jgf) {
|
|
|
78
111
|
}))
|
|
79
112
|
};
|
|
80
113
|
}
|
|
81
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Bidirectional converter for JSON Graph Format.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { createGraph } from '@statelyai/graph';
|
|
120
|
+
* import { jgfConverter } from '@statelyai/graph/formats/jgf';
|
|
121
|
+
*
|
|
122
|
+
* const graph = createGraph({
|
|
123
|
+
* nodes: [{ id: 'a' }, { id: 'b' }],
|
|
124
|
+
* edges: [{ id: 'e0', sourceId: 'a', targetId: 'b' }],
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* const jgf = jgfConverter.to(graph);
|
|
128
|
+
* const roundTripped = jgfConverter.from(jgf);
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
82
131
|
const jgfConverter = createFormatConverter(toJGF, fromJGF);
|
|
83
132
|
|
|
84
133
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Graph, f as GraphFormatConverter } from "../../types-
|
|
1
|
+
import { c as Graph, f as GraphFormatConverter } from "../../types-BDXC1O5b.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/formats/mermaid/sequence.d.ts
|
|
4
4
|
interface SequenceNodeData {
|
|
@@ -58,9 +58,37 @@ interface SequenceGraphData {
|
|
|
58
58
|
blocks?: SequenceBlock[];
|
|
59
59
|
}
|
|
60
60
|
type SequenceGraph = Graph<SequenceNodeData, SequenceEdgeData, SequenceGraphData>;
|
|
61
|
+
/**
|
|
62
|
+
* Parses a Mermaid sequence diagram string into a Graph.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* const graph = fromMermaidSequence(`
|
|
66
|
+
* sequenceDiagram
|
|
67
|
+
* participant Alice
|
|
68
|
+
* participant Bob
|
|
69
|
+
* Alice->>Bob: Hello
|
|
70
|
+
* Bob-->>Alice: Hi back
|
|
71
|
+
* `);
|
|
72
|
+
*/
|
|
61
73
|
declare function fromMermaidSequence(input: string): SequenceGraph;
|
|
74
|
+
/**
|
|
75
|
+
* Converts a sequence diagram Graph to a Mermaid sequence diagram string.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* const mermaid = toMermaidSequence(graph);
|
|
79
|
+
* // "sequenceDiagram\n participant Alice\n ..."
|
|
80
|
+
*/
|
|
62
81
|
declare function toMermaidSequence(graph: SequenceGraph): string;
|
|
63
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Bidirectional converter for Mermaid sequence diagram format.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* const graph = mermaidSequenceConverter.from(`
|
|
87
|
+
* sequenceDiagram
|
|
88
|
+
* Alice->>Bob: Hello
|
|
89
|
+
* `);
|
|
90
|
+
* const str = mermaidSequenceConverter.to(graph);
|
|
91
|
+
*/
|
|
64
92
|
declare const mermaidSequenceConverter: GraphFormatConverter<string>;
|
|
65
93
|
//#endregion
|
|
66
94
|
//#region src/formats/mermaid/flowchart.d.ts
|
|
@@ -82,9 +110,35 @@ interface FlowchartGraphData {
|
|
|
82
110
|
classDefs?: Record<string, Record<string, string>>;
|
|
83
111
|
}
|
|
84
112
|
type FlowchartGraph = Graph<FlowchartNodeData, FlowchartEdgeData, FlowchartGraphData>;
|
|
113
|
+
/**
|
|
114
|
+
* Parses a Mermaid flowchart string into a Graph.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* const graph = fromMermaidFlowchart(`
|
|
118
|
+
* flowchart TD
|
|
119
|
+
* A[Start] --> B{Decision}
|
|
120
|
+
* B -->|Yes| C[End]
|
|
121
|
+
* `);
|
|
122
|
+
*/
|
|
85
123
|
declare function fromMermaidFlowchart(input: string): FlowchartGraph;
|
|
124
|
+
/**
|
|
125
|
+
* Converts a flowchart Graph to a Mermaid flowchart string.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* const mermaid = toMermaidFlowchart(graph);
|
|
129
|
+
* // "flowchart TD\n A[Start] --> B{Decision}\n ..."
|
|
130
|
+
*/
|
|
86
131
|
declare function toMermaidFlowchart(graph: FlowchartGraph): string;
|
|
87
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Bidirectional converter for Mermaid flowchart format.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* const graph = mermaidFlowchartConverter.from(`
|
|
137
|
+
* flowchart TD
|
|
138
|
+
* A --> B
|
|
139
|
+
* `);
|
|
140
|
+
* const str = mermaidFlowchartConverter.to(graph);
|
|
141
|
+
*/
|
|
88
142
|
declare const mermaidFlowchartConverter: GraphFormatConverter<string>;
|
|
89
143
|
//#endregion
|
|
90
144
|
//#region src/formats/mermaid/state.d.ts
|
|
@@ -103,9 +157,36 @@ interface StateGraphData {
|
|
|
103
157
|
diagramType: 'stateDiagram';
|
|
104
158
|
}
|
|
105
159
|
type StateGraph = Graph<StateNodeData, StateEdgeData, StateGraphData>;
|
|
160
|
+
/**
|
|
161
|
+
* Parses a Mermaid state diagram string into a Graph.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* const graph = fromMermaidState(`
|
|
165
|
+
* stateDiagram-v2
|
|
166
|
+
* [*] --> Idle
|
|
167
|
+
* Idle --> Running : start
|
|
168
|
+
* Running --> [*]
|
|
169
|
+
* `);
|
|
170
|
+
*/
|
|
106
171
|
declare function fromMermaidState(input: string): StateGraph;
|
|
172
|
+
/**
|
|
173
|
+
* Converts a state diagram Graph to a Mermaid state diagram string.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* const mermaid = toMermaidState(graph);
|
|
177
|
+
* // "stateDiagram-v2\n [*] --> Idle\n ..."
|
|
178
|
+
*/
|
|
107
179
|
declare function toMermaidState(graph: StateGraph): string;
|
|
108
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Bidirectional converter for Mermaid state diagram format.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* const graph = mermaidStateConverter.from(`
|
|
185
|
+
* stateDiagram-v2
|
|
186
|
+
* [*] --> Active
|
|
187
|
+
* `);
|
|
188
|
+
* const str = mermaidStateConverter.to(graph);
|
|
189
|
+
*/
|
|
109
190
|
declare const mermaidStateConverter: GraphFormatConverter<string>;
|
|
110
191
|
//#endregion
|
|
111
192
|
//#region src/formats/mermaid/class-diagram.d.ts
|
|
@@ -128,9 +209,38 @@ interface ClassGraphData {
|
|
|
128
209
|
diagramType: 'classDiagram';
|
|
129
210
|
}
|
|
130
211
|
type ClassGraph = Graph<ClassNodeData, ClassEdgeData, ClassGraphData>;
|
|
212
|
+
/**
|
|
213
|
+
* Parses a Mermaid class diagram string into a Graph.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* const graph = fromMermaidClass(`
|
|
217
|
+
* classDiagram
|
|
218
|
+
* class Animal {
|
|
219
|
+
* +String name
|
|
220
|
+
* +eat() void
|
|
221
|
+
* }
|
|
222
|
+
* Animal <|-- Dog
|
|
223
|
+
* `);
|
|
224
|
+
*/
|
|
131
225
|
declare function fromMermaidClass(input: string): ClassGraph;
|
|
226
|
+
/**
|
|
227
|
+
* Converts a class diagram Graph to a Mermaid class diagram string.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* const mermaid = toMermaidClass(graph);
|
|
231
|
+
* // "classDiagram\n class Animal {\n ..."
|
|
232
|
+
*/
|
|
132
233
|
declare function toMermaidClass(graph: ClassGraph): string;
|
|
133
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* Bidirectional converter for Mermaid class diagram format.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const graph = mermaidClassConverter.from(`
|
|
239
|
+
* classDiagram
|
|
240
|
+
* Animal <|-- Dog
|
|
241
|
+
* `);
|
|
242
|
+
* const str = mermaidClassConverter.to(graph);
|
|
243
|
+
*/
|
|
134
244
|
declare const mermaidClassConverter: GraphFormatConverter<string>;
|
|
135
245
|
//#endregion
|
|
136
246
|
//#region src/formats/mermaid/er-diagram.d.ts
|
|
@@ -151,9 +261,35 @@ interface ERGraphData {
|
|
|
151
261
|
diagramType: 'erDiagram';
|
|
152
262
|
}
|
|
153
263
|
type ERGraph = Graph<ERNodeData, EREdgeData, ERGraphData>;
|
|
264
|
+
/**
|
|
265
|
+
* Parses a Mermaid ER diagram string into a Graph.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* const graph = fromMermaidER(`
|
|
269
|
+
* erDiagram
|
|
270
|
+
* CUSTOMER ||--o{ ORDER : places
|
|
271
|
+
* ORDER ||--|{ LINE_ITEM : contains
|
|
272
|
+
* `);
|
|
273
|
+
*/
|
|
154
274
|
declare function fromMermaidER(input: string): ERGraph;
|
|
275
|
+
/**
|
|
276
|
+
* Converts an ER diagram Graph to a Mermaid ER diagram string.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* const mermaid = toMermaidER(graph);
|
|
280
|
+
* // "erDiagram\n CUSTOMER ||--o{ ORDER : \"places\"\n ..."
|
|
281
|
+
*/
|
|
155
282
|
declare function toMermaidER(graph: ERGraph): string;
|
|
156
|
-
/**
|
|
283
|
+
/**
|
|
284
|
+
* Bidirectional converter for Mermaid ER diagram format.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* const graph = mermaidERConverter.from(`
|
|
288
|
+
* erDiagram
|
|
289
|
+
* CUSTOMER ||--o{ ORDER : places
|
|
290
|
+
* `);
|
|
291
|
+
* const str = mermaidERConverter.to(graph);
|
|
292
|
+
*/
|
|
157
293
|
declare const mermaidERConverter: GraphFormatConverter<string>;
|
|
158
294
|
//#endregion
|
|
159
295
|
//#region src/formats/mermaid/mindmap.d.ts
|
|
@@ -165,9 +301,38 @@ interface MindmapGraphData {
|
|
|
165
301
|
diagramType: 'mindmap';
|
|
166
302
|
}
|
|
167
303
|
type MindmapGraph = Graph<MindmapNodeData, MindmapEdgeData, MindmapGraphData>;
|
|
304
|
+
/**
|
|
305
|
+
* Parses a Mermaid mindmap string into a Graph.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* const graph = fromMermaidMindmap(`
|
|
309
|
+
* mindmap
|
|
310
|
+
* Root
|
|
311
|
+
* Child A
|
|
312
|
+
* Grandchild
|
|
313
|
+
* Child B
|
|
314
|
+
* `);
|
|
315
|
+
*/
|
|
168
316
|
declare function fromMermaidMindmap(input: string): MindmapGraph;
|
|
317
|
+
/**
|
|
318
|
+
* Converts a mindmap Graph to a Mermaid mindmap string.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* const mermaid = toMermaidMindmap(graph);
|
|
322
|
+
* // "mindmap\n Root\n Child A\n ..."
|
|
323
|
+
*/
|
|
169
324
|
declare function toMermaidMindmap(graph: MindmapGraph): string;
|
|
170
|
-
/**
|
|
325
|
+
/**
|
|
326
|
+
* Bidirectional converter for Mermaid mindmap format.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* const graph = mermaidMindmapConverter.from(`
|
|
330
|
+
* mindmap
|
|
331
|
+
* Root
|
|
332
|
+
* Branch
|
|
333
|
+
* `);
|
|
334
|
+
* const str = mermaidMindmapConverter.to(graph);
|
|
335
|
+
*/
|
|
171
336
|
declare const mermaidMindmapConverter: GraphFormatConverter<string>;
|
|
172
337
|
//#endregion
|
|
173
338
|
//#region src/formats/mermaid/block.d.ts
|
|
@@ -180,9 +345,37 @@ interface BlockGraphData {
|
|
|
180
345
|
columns?: number;
|
|
181
346
|
}
|
|
182
347
|
type BlockGraph = Graph<BlockNodeData, BlockEdgeData, BlockGraphData>;
|
|
348
|
+
/**
|
|
349
|
+
* Parses a Mermaid block diagram string into a Graph.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* const graph = fromMermaidBlock(`
|
|
353
|
+
* block-beta
|
|
354
|
+
* columns 2
|
|
355
|
+
* a["Task A"] b["Task B"]
|
|
356
|
+
* a --> b
|
|
357
|
+
* `);
|
|
358
|
+
*/
|
|
183
359
|
declare function fromMermaidBlock(input: string): BlockGraph;
|
|
360
|
+
/**
|
|
361
|
+
* Converts a block diagram Graph to a Mermaid block diagram string.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* const mermaid = toMermaidBlock(graph);
|
|
365
|
+
* // "block-beta\n columns 2\n a[\"Task A\"]\n ..."
|
|
366
|
+
*/
|
|
184
367
|
declare function toMermaidBlock(graph: BlockGraph): string;
|
|
185
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* Bidirectional converter for Mermaid block diagram format.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* const graph = mermaidBlockConverter.from(`
|
|
373
|
+
* block-beta
|
|
374
|
+
* columns 2
|
|
375
|
+
* a b
|
|
376
|
+
* `);
|
|
377
|
+
* const str = mermaidBlockConverter.to(graph);
|
|
378
|
+
*/
|
|
186
379
|
declare const mermaidBlockConverter: GraphFormatConverter<string>;
|
|
187
380
|
//#endregion
|
|
188
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 };
|