@hpcc-js/wasm-graphviz 1.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/wasm-graphviz",
3
- "version": "1.26.0",
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": "b173ceec45fa54ec60a1642655d4f785ade8165c"
59
+ "gitHead": "489d0efe182d908652e5dea34891a6c26b760780"
60
60
  }
package/src/graphviz.ts CHANGED
@@ -184,10 +184,10 @@ export class Subgraph {
184
184
  /**
185
185
  * Create (or find) a node and add it to this subgraph.
186
186
  */
187
- addNode(name: string): this;
187
+ addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
188
188
  addNode(init: NodeInit): this;
189
- addNode(nameOrInit: string | NodeInit): this {
190
- 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;
191
191
  const { name, attrs, htmlAttrs } = init;
192
192
 
193
193
  this._sg.addNode(name);
@@ -200,11 +200,14 @@ export class Subgraph {
200
200
  * Create an edge inside this subgraph. Both endpoints are created
201
201
  * automatically if they do not already exist.
202
202
  */
203
- addEdge(tail: string, head: string, key?: string): this;
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;
204
205
  addEdge(init: EdgeInit): this;
205
- addEdge(tailOrInit: string | EdgeInit, head?: string, key: string = ""): this {
206
+ addEdge(tailOrInit: string | EdgeInit, head?: string, keyOrAttrs: string | AttrValues<EdgeAttrs> = "", attrsOrHtmlAttrs?: AttrValues<EdgeAttrs>, maybeHtmlAttrs?: AttrValues<EdgeAttrs>): this {
206
207
  const init = typeof tailOrInit === "string"
207
- ? { tail: tailOrInit, head: head!, key }
208
+ ? typeof keyOrAttrs === "string"
209
+ ? { tail: tailOrInit, head: head!, key: keyOrAttrs, attrs: attrsOrHtmlAttrs, htmlAttrs: maybeHtmlAttrs }
210
+ : { tail: tailOrInit, head: head!, attrs: keyOrAttrs, htmlAttrs: attrsOrHtmlAttrs }
208
211
  : tailOrInit;
209
212
  const { tail, head: resolvedHead, key: resolvedKey = "", attrs, htmlAttrs } = init;
210
213
 
@@ -217,10 +220,10 @@ export class Subgraph {
217
220
  /**
218
221
  * Create (or return an existing) named subgraph under this subgraph.
219
222
  */
220
- addSubgraph(name: string): Subgraph;
223
+ addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
221
224
  addSubgraph(init: SubgraphInit): Subgraph;
222
- addSubgraph(nameOrInit: string | SubgraphInit): Subgraph {
223
- const init = typeof nameOrInit === "string" ? { name: nameOrInit } : nameOrInit;
225
+ addSubgraph(nameOrInit: string | SubgraphInit, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph {
226
+ const init = typeof nameOrInit === "string" ? { name: nameOrInit, attrs, htmlAttrs } : nameOrInit;
224
227
  // addSubgraph only returns null when the internal subgraph pointer is null,
225
228
  // which cannot happen while this Subgraph instance is alive.
226
229
  return new Subgraph(this._sg.addSubgraph(init.name)!).applyInit(init);
@@ -578,10 +581,10 @@ export class Graph {
578
581
  * Create a node. If a node with this name already exists it is returned
579
582
  * unchanged.
580
583
  */
581
- addNode(name: string): this;
584
+ addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
582
585
  addNode(init: NodeInit): this;
583
- addNode(nameOrInit: string | NodeInit): this {
584
- 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;
585
588
  const { name, attrs, htmlAttrs } = init;
586
589
 
587
590
  this._graph.addNode(name);
@@ -596,11 +599,14 @@ export class Graph {
596
599
  * parallel edges between the same pair of nodes; omit (or pass `""`) for
597
600
  * an anonymous edge.
598
601
  */
599
- addEdge(tail: string, head: string, key?: string): this;
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;
600
604
  addEdge(init: EdgeInit): this;
601
- addEdge(tailOrInit: string | EdgeInit, head?: string, key: string = ""): this {
605
+ addEdge(tailOrInit: string | EdgeInit, head?: string, keyOrAttrs: string | AttrValues<EdgeAttrs> = "", attrsOrHtmlAttrs?: AttrValues<EdgeAttrs>, maybeHtmlAttrs?: AttrValues<EdgeAttrs>): this {
602
606
  const init = typeof tailOrInit === "string"
603
- ? { tail: tailOrInit, head: head!, key }
607
+ ? typeof keyOrAttrs === "string"
608
+ ? { tail: tailOrInit, head: head!, key: keyOrAttrs, attrs: attrsOrHtmlAttrs, htmlAttrs: maybeHtmlAttrs }
609
+ : { tail: tailOrInit, head: head!, attrs: keyOrAttrs, htmlAttrs: attrsOrHtmlAttrs }
604
610
  : tailOrInit;
605
611
  const { tail, head: resolvedHead, key: resolvedKey = "", attrs, htmlAttrs } = init;
606
612
 
@@ -954,10 +960,10 @@ export class Graph {
954
960
  * cluster.setAttr("label", "My Cluster").addEdge("a", "b");
955
961
  * ```
956
962
  */
957
- addSubgraph(name: string): Subgraph;
963
+ addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
958
964
  addSubgraph(init: SubgraphInit): Subgraph;
959
- addSubgraph(nameOrInit: string | SubgraphInit): Subgraph {
960
- 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;
961
967
  // addSubgraph only returns null when the internal graph pointer is null,
962
968
  // which cannot happen while this Graph instance is alive.
963
969
  return new Subgraph(this._graph.addSubgraph(init.name)!).applyInit(init);
@@ -110,18 +110,19 @@ export declare class Subgraph {
110
110
  /**
111
111
  * Create (or find) a node and add it to this subgraph.
112
112
  */
113
- addNode(name: string): this;
113
+ addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
114
114
  addNode(init: NodeInit): this;
115
115
  /**
116
116
  * Create an edge inside this subgraph. Both endpoints are created
117
117
  * automatically if they do not already exist.
118
118
  */
119
- addEdge(tail: string, head: string, key?: string): this;
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;
120
121
  addEdge(init: EdgeInit): this;
121
122
  /**
122
123
  * Create (or return an existing) named subgraph under this subgraph.
123
124
  */
124
- addSubgraph(name: string): Subgraph;
125
+ addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
125
126
  addSubgraph(init: SubgraphInit): Subgraph;
126
127
  applyInit(init: SubgraphInit): this;
127
128
  /**
@@ -305,7 +306,7 @@ export declare class Graph {
305
306
  * Create a node. If a node with this name already exists it is returned
306
307
  * unchanged.
307
308
  */
308
- addNode(name: string): this;
309
+ addNode(name: string, attrs?: AttrValues<NodeAttrs>, htmlAttrs?: AttrValues<NodeAttrs>): this;
309
310
  addNode(init: NodeInit): this;
310
311
  /**
311
312
  * Create an edge from `tail` to `head`. Both nodes are created
@@ -313,7 +314,8 @@ export declare class Graph {
313
314
  * parallel edges between the same pair of nodes; omit (or pass `""`) for
314
315
  * an anonymous edge.
315
316
  */
316
- addEdge(tail: string, head: string, key?: string): this;
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;
317
319
  addEdge(init: EdgeInit): this;
318
320
  applyInit(init: GraphInit): this;
319
321
  /**
@@ -491,7 +493,7 @@ export declare class Graph {
491
493
  * cluster.setAttr("label", "My Cluster").addEdge("a", "b");
492
494
  * ```
493
495
  */
494
- addSubgraph(name: string): Subgraph;
496
+ addSubgraph(name: string, attrs?: AttrValues<ClusterAttrs>, htmlAttrs?: AttrValues<ClusterAttrs>): Subgraph;
495
497
  addSubgraph(init: SubgraphInit): Subgraph;
496
498
  /**
497
499
  * Look up an existing subgraph by name without creating a new one.