@hpcc-js/wasm-graphviz 1.25.0 → 1.27.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.js +2 -2
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
- package/src/graphviz.ts +56 -34
- package/src/index.ts +1 -0
- package/src/types.ts +10 -0
- package/types/graphviz.d.ts +19 -19
- package/types/graphvizlib.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/types.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/wasm-graphviz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"description": "hpcc-js - WASM Graphviz",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
},
|
|
57
57
|
"homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "489d0efe182d908652e5dea34891a6c26b760780"
|
|
60
60
|
}
|
package/src/graphviz.ts
CHANGED
|
@@ -5,7 +5,8 @@ import type {
|
|
|
5
5
|
NodeDotAttr, NodeAttrs,
|
|
6
6
|
EdgeDotAttr, EdgeAttrs,
|
|
7
7
|
ClusterDotAttr, ClusterAttrs,
|
|
8
|
-
GraphDotAttr, GraphAttrs
|
|
8
|
+
GraphDotAttr, GraphAttrs,
|
|
9
|
+
Format, Engine
|
|
9
10
|
} from "./types.ts";
|
|
10
11
|
|
|
11
12
|
type AttrValues<T> = Partial<{ [K in keyof T]: NonNullable<T[K]> }>;
|
|
@@ -24,11 +25,6 @@ function applyAttrs<T extends object>(
|
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
/**
|
|
28
|
-
* Various graphic and data formats for end user, web, documents and other applications. See [Output Formats](https://graphviz.org/docs/outputs/) for more information.
|
|
29
|
-
*/
|
|
30
|
-
export type Format = "svg" | "svg_inline" | "dot" | "json" | "dot_json" | "xdot_json" | "plain" | "plain-ext" | "canon";
|
|
31
|
-
|
|
32
28
|
/**
|
|
33
29
|
* An edge returned by graph-traversal methods.
|
|
34
30
|
*/
|
|
@@ -58,11 +54,6 @@ function parseEdges(json: string): EdgeInfo[] {
|
|
|
58
54
|
return result;
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
/**
|
|
62
|
-
* Various algorithms for projecting abstract graphs into a space for visualization. See [Layout Engines](https://graphviz.org/docs/layouts/) for more details.
|
|
63
|
-
*/
|
|
64
|
-
export type Engine = "circo" | "dot" | "fdp" | "sfdp" | "neato" | "osage" | "patchwork" | "twopi" | "nop" | "nop2";
|
|
65
|
-
|
|
66
57
|
/**
|
|
67
58
|
* Example: Passing a web hosted Image to GraphViz:
|
|
68
59
|
* ```ts
|
|
@@ -165,7 +156,7 @@ export type ClusterInit = SubgraphInit;
|
|
|
165
156
|
/**
|
|
166
157
|
* A subgraph (or cluster) inside a {@link Graph}.
|
|
167
158
|
*
|
|
168
|
-
* Obtain via {@link Graph.addSubgraph}. All mutation methods return `this`
|
|
159
|
+
* Obtain via {@link Graph.addSubgraph} or {@link Subgraph.addSubgraph}. All mutation methods return `this`
|
|
169
160
|
* for chaining. **Call {@link Subgraph.delete} (or use the `using` keyword)
|
|
170
161
|
* when finished** to free the underlying WASM wrapper — the actual subgraph
|
|
171
162
|
* data is owned by the parent {@link Graph} and is freed with it.
|
|
@@ -193,10 +184,10 @@ export class Subgraph {
|
|
|
193
184
|
/**
|
|
194
185
|
* Create (or find) a node and add it to this subgraph.
|
|
195
186
|
*/
|
|
196
|
-
addNode(name: string): this;
|
|
187
|
+
addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
|
|
197
188
|
addNode(init: NodeInit): this;
|
|
198
|
-
addNode(nameOrInit: string | NodeInit): this {
|
|
199
|
-
const init = typeof nameOrInit === "string" ? { name: nameOrInit } : nameOrInit;
|
|
189
|
+
addNode(nameOrInit: string | NodeInit, nodeAttrs?: AttrValues<NodeAttrs>, nodeHtmlAttrs?: AttrValues<NodeAttrs>): this {
|
|
190
|
+
const init = typeof nameOrInit === "string" ? { name: nameOrInit, attrs: nodeAttrs, htmlAttrs: nodeHtmlAttrs } : nameOrInit;
|
|
200
191
|
const { name, attrs, htmlAttrs } = init;
|
|
201
192
|
|
|
202
193
|
this._sg.addNode(name);
|
|
@@ -209,11 +200,14 @@ export class Subgraph {
|
|
|
209
200
|
* Create an edge inside this subgraph. Both endpoints are created
|
|
210
201
|
* automatically if they do not already exist.
|
|
211
202
|
*/
|
|
212
|
-
addEdge(tail: string, head: string,
|
|
203
|
+
addEdge(tail: string, head: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
204
|
+
addEdge(tail: string, head: string, key: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
213
205
|
addEdge(init: EdgeInit): this;
|
|
214
|
-
addEdge(tailOrInit: string | EdgeInit, head?: string,
|
|
206
|
+
addEdge(tailOrInit: string | EdgeInit, head?: string, keyOrAttrs: string | AttrValues<EdgeAttrs> = "", attrsOrHtmlAttrs?: AttrValues<EdgeAttrs>, maybeHtmlAttrs?: AttrValues<EdgeAttrs>): this {
|
|
215
207
|
const init = typeof tailOrInit === "string"
|
|
216
|
-
?
|
|
208
|
+
? typeof keyOrAttrs === "string"
|
|
209
|
+
? { tail: tailOrInit, head: head!, key: keyOrAttrs, attrs: attrsOrHtmlAttrs, htmlAttrs: maybeHtmlAttrs }
|
|
210
|
+
: { tail: tailOrInit, head: head!, attrs: keyOrAttrs, htmlAttrs: attrsOrHtmlAttrs }
|
|
217
211
|
: tailOrInit;
|
|
218
212
|
const { tail, head: resolvedHead, key: resolvedKey = "", attrs, htmlAttrs } = init;
|
|
219
213
|
|
|
@@ -223,6 +217,18 @@ export class Subgraph {
|
|
|
223
217
|
return this;
|
|
224
218
|
}
|
|
225
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Create (or return an existing) named subgraph under this subgraph.
|
|
222
|
+
*/
|
|
223
|
+
addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
|
|
224
|
+
addSubgraph(init: SubgraphInit): Subgraph;
|
|
225
|
+
addSubgraph(nameOrInit: string | SubgraphInit, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph {
|
|
226
|
+
const init = typeof nameOrInit === "string" ? { name: nameOrInit, attrs, htmlAttrs } : nameOrInit;
|
|
227
|
+
// addSubgraph only returns null when the internal subgraph pointer is null,
|
|
228
|
+
// which cannot happen while this Subgraph instance is alive.
|
|
229
|
+
return new Subgraph(this._sg.addSubgraph(init.name)!).applyInit(init);
|
|
230
|
+
}
|
|
231
|
+
|
|
226
232
|
applyInit(init: SubgraphInit): this {
|
|
227
233
|
applyAttrs<ClusterAttrs>(init.attrs, (attr, value) => this.setAttr(attr, value));
|
|
228
234
|
applyAttrs<ClusterAttrs>(init.htmlAttrs, (attr, value) => this.setHtmlAttr(attr, value));
|
|
@@ -560,14 +566,25 @@ export class Graph {
|
|
|
560
566
|
this._module = module;
|
|
561
567
|
}
|
|
562
568
|
|
|
569
|
+
private ensureDefaultFonts(includeNodeAndEdgeDefaults: boolean): void {
|
|
570
|
+
if (this.getGraphAttr("fontname") === "") {
|
|
571
|
+
this.setGraphAttr("fontname", "Arial");
|
|
572
|
+
}
|
|
573
|
+
this.setDefaultGraphAttr("fontname", "Arial");
|
|
574
|
+
if (includeNodeAndEdgeDefaults) {
|
|
575
|
+
this.setDefaultNodeAttr("fontname", "Arial");
|
|
576
|
+
this.setDefaultEdgeAttr("fontname", "Arial");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
563
580
|
/**
|
|
564
581
|
* Create a node. If a node with this name already exists it is returned
|
|
565
582
|
* unchanged.
|
|
566
583
|
*/
|
|
567
|
-
addNode(name: string): this;
|
|
584
|
+
addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
|
|
568
585
|
addNode(init: NodeInit): this;
|
|
569
|
-
addNode(nameOrInit: string | NodeInit): this {
|
|
570
|
-
const init = typeof nameOrInit === "string" ? { name: nameOrInit } : nameOrInit;
|
|
586
|
+
addNode(nameOrInit: string | NodeInit, nodeAttrs?: AttrValues<NodeAttrs>, nodeHtmlAttrs?: AttrValues<NodeAttrs>): this {
|
|
587
|
+
const init = typeof nameOrInit === "string" ? { name: nameOrInit, attrs: nodeAttrs, htmlAttrs: nodeHtmlAttrs } : nameOrInit;
|
|
571
588
|
const { name, attrs, htmlAttrs } = init;
|
|
572
589
|
|
|
573
590
|
this._graph.addNode(name);
|
|
@@ -582,11 +599,14 @@ export class Graph {
|
|
|
582
599
|
* parallel edges between the same pair of nodes; omit (or pass `""`) for
|
|
583
600
|
* an anonymous edge.
|
|
584
601
|
*/
|
|
585
|
-
addEdge(tail: string, head: string,
|
|
602
|
+
addEdge(tail: string, head: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
603
|
+
addEdge(tail: string, head: string, key: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
586
604
|
addEdge(init: EdgeInit): this;
|
|
587
|
-
addEdge(tailOrInit: string | EdgeInit, head?: string,
|
|
605
|
+
addEdge(tailOrInit: string | EdgeInit, head?: string, keyOrAttrs: string | AttrValues<EdgeAttrs> = "", attrsOrHtmlAttrs?: AttrValues<EdgeAttrs>, maybeHtmlAttrs?: AttrValues<EdgeAttrs>): this {
|
|
588
606
|
const init = typeof tailOrInit === "string"
|
|
589
|
-
?
|
|
607
|
+
? typeof keyOrAttrs === "string"
|
|
608
|
+
? { tail: tailOrInit, head: head!, key: keyOrAttrs, attrs: attrsOrHtmlAttrs, htmlAttrs: maybeHtmlAttrs }
|
|
609
|
+
: { tail: tailOrInit, head: head!, attrs: keyOrAttrs, htmlAttrs: attrsOrHtmlAttrs }
|
|
590
610
|
: tailOrInit;
|
|
591
611
|
const { tail, head: resolvedHead, key: resolvedKey = "", attrs, htmlAttrs } = init;
|
|
592
612
|
|
|
@@ -597,6 +617,7 @@ export class Graph {
|
|
|
597
617
|
}
|
|
598
618
|
|
|
599
619
|
applyInit(init: GraphInit): this {
|
|
620
|
+
this.ensureDefaultFonts(true);
|
|
600
621
|
applyAttrs<GraphAttrs>(init.attrs, (attr, value) => this.setGraphAttr(attr, value));
|
|
601
622
|
applyAttrs<GraphAttrs>(init.htmlAttrs, (attr, value) => this.setGraphHtmlAttr(attr, value));
|
|
602
623
|
return this;
|
|
@@ -610,6 +631,7 @@ export class Graph {
|
|
|
610
631
|
if (!this._graph.read(dotSource)) {
|
|
611
632
|
throw new Error("Invalid DOT source");
|
|
612
633
|
}
|
|
634
|
+
this.ensureDefaultFonts(false);
|
|
613
635
|
return this;
|
|
614
636
|
}
|
|
615
637
|
|
|
@@ -879,18 +901,18 @@ export class Graph {
|
|
|
879
901
|
// ---- Graph traversal ------------------------------------------------
|
|
880
902
|
|
|
881
903
|
/**
|
|
882
|
-
* Returns the names of all
|
|
883
|
-
* order).
|
|
904
|
+
* Returns the names of all direct subgraphs.
|
|
884
905
|
*/
|
|
885
|
-
|
|
886
|
-
return parseNames(this._graph.
|
|
906
|
+
subgraphNames(): string[] {
|
|
907
|
+
return parseNames(this._graph.subgraphNames());
|
|
887
908
|
}
|
|
888
909
|
|
|
889
910
|
/**
|
|
890
|
-
* Returns the names of all
|
|
911
|
+
* Returns the names of all nodes in the graph (in internal iteration
|
|
912
|
+
* order).
|
|
891
913
|
*/
|
|
892
|
-
|
|
893
|
-
return parseNames(this._graph.
|
|
914
|
+
nodeNames(): string[] {
|
|
915
|
+
return parseNames(this._graph.nodeNames());
|
|
894
916
|
}
|
|
895
917
|
|
|
896
918
|
/**
|
|
@@ -938,10 +960,10 @@ export class Graph {
|
|
|
938
960
|
* cluster.setAttr("label", "My Cluster").addEdge("a", "b");
|
|
939
961
|
* ```
|
|
940
962
|
*/
|
|
941
|
-
addSubgraph(name: string): Subgraph;
|
|
963
|
+
addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
|
|
942
964
|
addSubgraph(init: SubgraphInit): Subgraph;
|
|
943
|
-
addSubgraph(nameOrInit: string | SubgraphInit): Subgraph {
|
|
944
|
-
const init = typeof nameOrInit === "string" ? { name: nameOrInit } : nameOrInit;
|
|
965
|
+
addSubgraph(nameOrInit: string | SubgraphInit, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph {
|
|
966
|
+
const init = typeof nameOrInit === "string" ? { name: nameOrInit, attrs, htmlAttrs } : nameOrInit;
|
|
945
967
|
// addSubgraph only returns null when the internal graph pointer is null,
|
|
946
968
|
// which cannot happen while this Graph instance is alive.
|
|
947
969
|
return new Subgraph(this._graph.addSubgraph(init.name)!).applyInit(init);
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -611,3 +611,13 @@ export const GRAPH_DOT_ATTRS: readonly GraphDotAttr[] = attrsOf<GraphDotAttr>({
|
|
|
611
611
|
voro_margin: true,
|
|
612
612
|
xdotversion: true,
|
|
613
613
|
});
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Various graphic and data formats for end user, web, documents and other applications. See [Output Formats](https://graphviz.org/docs/outputs/) for more information.
|
|
617
|
+
*/
|
|
618
|
+
export type Format = "svg" | "svg_inline" | "dot" | "json" | "dot_json" | "xdot_json" | "plain" | "plain-ext" | "canon";
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Various algorithms for projecting abstract graphs into a space for visualization. See [Layout Engines](https://graphviz.org/docs/layouts/) for more details.
|
|
622
|
+
*/
|
|
623
|
+
export type Engine = "circo" | "dot" | "fdp" | "sfdp" | "neato" | "osage" | "patchwork" | "twopi" | "nop" | "nop2";
|
package/types/graphviz.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { MainModule, CGraph as CGraphWasm, CSubgraph as CSubgraphWasm } from "../types/graphvizlib.js";
|
|
2
|
-
import type { NodeDotAttr, NodeAttrs, EdgeDotAttr, EdgeAttrs, ClusterDotAttr, ClusterAttrs, GraphDotAttr, GraphAttrs
|
|
2
|
+
import type { NodeDotAttr, NodeAttrs, EdgeDotAttr, EdgeAttrs, ClusterDotAttr, ClusterAttrs, GraphDotAttr, GraphAttrs, Format, Engine } from "./types.ts";
|
|
3
3
|
type AttrValues<T> = Partial<{
|
|
4
4
|
[K in keyof T]: NonNullable<T[K]>;
|
|
5
5
|
}>;
|
|
6
|
-
/**
|
|
7
|
-
* Various graphic and data formats for end user, web, documents and other applications. See [Output Formats](https://graphviz.org/docs/outputs/) for more information.
|
|
8
|
-
*/
|
|
9
|
-
export type Format = "svg" | "svg_inline" | "dot" | "json" | "dot_json" | "xdot_json" | "plain" | "plain-ext" | "canon";
|
|
10
6
|
/**
|
|
11
7
|
* An edge returned by graph-traversal methods.
|
|
12
8
|
*/
|
|
@@ -21,10 +17,6 @@ export interface EdgeInfo {
|
|
|
21
17
|
*/
|
|
22
18
|
key: string;
|
|
23
19
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Various algorithms for projecting abstract graphs into a space for visualization. See [Layout Engines](https://graphviz.org/docs/layouts/) for more details.
|
|
26
|
-
*/
|
|
27
|
-
export type Engine = "circo" | "dot" | "fdp" | "sfdp" | "neato" | "osage" | "patchwork" | "twopi" | "nop" | "nop2";
|
|
28
20
|
/**
|
|
29
21
|
* Example: Passing a web hosted Image to GraphViz:
|
|
30
22
|
* ```ts
|
|
@@ -94,7 +86,7 @@ export type ClusterInit = SubgraphInit;
|
|
|
94
86
|
/**
|
|
95
87
|
* A subgraph (or cluster) inside a {@link Graph}.
|
|
96
88
|
*
|
|
97
|
-
* Obtain via {@link Graph.addSubgraph}. All mutation methods return `this`
|
|
89
|
+
* Obtain via {@link Graph.addSubgraph} or {@link Subgraph.addSubgraph}. All mutation methods return `this`
|
|
98
90
|
* for chaining. **Call {@link Subgraph.delete} (or use the `using` keyword)
|
|
99
91
|
* when finished** to free the underlying WASM wrapper — the actual subgraph
|
|
100
92
|
* data is owned by the parent {@link Graph} and is freed with it.
|
|
@@ -118,14 +110,20 @@ export declare class Subgraph {
|
|
|
118
110
|
/**
|
|
119
111
|
* Create (or find) a node and add it to this subgraph.
|
|
120
112
|
*/
|
|
121
|
-
addNode(name: string): this;
|
|
113
|
+
addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
|
|
122
114
|
addNode(init: NodeInit): this;
|
|
123
115
|
/**
|
|
124
116
|
* Create an edge inside this subgraph. Both endpoints are created
|
|
125
117
|
* automatically if they do not already exist.
|
|
126
118
|
*/
|
|
127
|
-
addEdge(tail: string, head: string,
|
|
119
|
+
addEdge(tail: string, head: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
120
|
+
addEdge(tail: string, head: string, key: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
128
121
|
addEdge(init: EdgeInit): this;
|
|
122
|
+
/**
|
|
123
|
+
* Create (or return an existing) named subgraph under this subgraph.
|
|
124
|
+
*/
|
|
125
|
+
addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
|
|
126
|
+
addSubgraph(init: SubgraphInit): Subgraph;
|
|
129
127
|
applyInit(init: SubgraphInit): this;
|
|
130
128
|
/**
|
|
131
129
|
* Remove a node from this subgraph only. The node (and any edges
|
|
@@ -303,11 +301,12 @@ export declare class Graph {
|
|
|
303
301
|
private _module;
|
|
304
302
|
/** @internal */
|
|
305
303
|
constructor(g: CGraphWasm, module: MainModule);
|
|
304
|
+
private ensureDefaultFonts;
|
|
306
305
|
/**
|
|
307
306
|
* Create a node. If a node with this name already exists it is returned
|
|
308
307
|
* unchanged.
|
|
309
308
|
*/
|
|
310
|
-
addNode(name: string): this;
|
|
309
|
+
addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
|
|
311
310
|
addNode(init: NodeInit): this;
|
|
312
311
|
/**
|
|
313
312
|
* Create an edge from `tail` to `head`. Both nodes are created
|
|
@@ -315,7 +314,8 @@ export declare class Graph {
|
|
|
315
314
|
* parallel edges between the same pair of nodes; omit (or pass `""`) for
|
|
316
315
|
* an anonymous edge.
|
|
317
316
|
*/
|
|
318
|
-
addEdge(tail: string, head: string,
|
|
317
|
+
addEdge(tail: string, head: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
318
|
+
addEdge(tail: string, head: string, key: string, attrs?: AttrValues<EdgeAttrs>, htmlAttrs?: AttrValues<EdgeAttrs>): this;
|
|
319
319
|
addEdge(init: EdgeInit): this;
|
|
320
320
|
applyInit(init: GraphInit): this;
|
|
321
321
|
/**
|
|
@@ -451,15 +451,15 @@ export declare class Graph {
|
|
|
451
451
|
* Pass `key = ""` for the first (or only) edge between `tail` and `head`.
|
|
452
452
|
*/
|
|
453
453
|
getEdgeAttr(tail: string, head: string, key: string, attr: string): string;
|
|
454
|
+
/**
|
|
455
|
+
* Returns the names of all direct subgraphs.
|
|
456
|
+
*/
|
|
457
|
+
subgraphNames(): string[];
|
|
454
458
|
/**
|
|
455
459
|
* Returns the names of all nodes in the graph (in internal iteration
|
|
456
460
|
* order).
|
|
457
461
|
*/
|
|
458
462
|
nodeNames(): string[];
|
|
459
|
-
/**
|
|
460
|
-
* Returns the names of all direct subgraphs.
|
|
461
|
-
*/
|
|
462
|
-
subgraphNames(): string[];
|
|
463
463
|
/**
|
|
464
464
|
* Returns all edges in the graph. Each unique edge is listed exactly
|
|
465
465
|
* once.
|
|
@@ -493,7 +493,7 @@ export declare class Graph {
|
|
|
493
493
|
* cluster.setAttr("label", "My Cluster").addEdge("a", "b");
|
|
494
494
|
* ```
|
|
495
495
|
*/
|
|
496
|
-
addSubgraph(name: string): Subgraph;
|
|
496
|
+
addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
|
|
497
497
|
addSubgraph(init: SubgraphInit): Subgraph;
|
|
498
498
|
/**
|
|
499
499
|
* Look up an existing subgraph by name without creating a new one.
|
package/types/graphvizlib.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface CSubgraph extends ClassHandle {
|
|
|
122
122
|
addNode(_0: EmbindString): void;
|
|
123
123
|
addEdge(_0: EmbindString, _1: EmbindString): void;
|
|
124
124
|
addEdge(_0: EmbindString, _1: EmbindString, _2: EmbindString): void;
|
|
125
|
+
addSubgraph(_0: EmbindString): CSubgraph | null;
|
|
125
126
|
setAttr(_0: EmbindString, _1: EmbindString): void;
|
|
126
127
|
setAttr(_0: EmbindString, _1: EmbindString, _2: EmbindString): void;
|
|
127
128
|
setHtmlAttr(_0: EmbindString, _1: EmbindString): void;
|
package/types/index.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -299,4 +299,12 @@ export declare const EDGE_DOT_ATTRS: readonly EdgeDotAttr[];
|
|
|
299
299
|
export declare const CLUSTER_DOT_ATTRS: readonly ClusterDotAttr[];
|
|
300
300
|
/** Graph DOT attributes (excludes write-only: bb, lheight, lp, lwidth; and non-DOT: type) */
|
|
301
301
|
export declare const GRAPH_DOT_ATTRS: readonly GraphDotAttr[];
|
|
302
|
+
/**
|
|
303
|
+
* Various graphic and data formats for end user, web, documents and other applications. See [Output Formats](https://graphviz.org/docs/outputs/) for more information.
|
|
304
|
+
*/
|
|
305
|
+
export type Format = "svg" | "svg_inline" | "dot" | "json" | "dot_json" | "xdot_json" | "plain" | "plain-ext" | "canon";
|
|
306
|
+
/**
|
|
307
|
+
* Various algorithms for projecting abstract graphs into a space for visualization. See [Layout Engines](https://graphviz.org/docs/layouts/) for more details.
|
|
308
|
+
*/
|
|
309
|
+
export type Engine = "circo" | "dot" | "fdp" | "sfdp" | "neato" | "osage" | "patchwork" | "twopi" | "nop" | "nop2";
|
|
302
310
|
export {};
|