@elicdavis/node-flow 0.1.5 → 0.1.6

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
@@ -2,7 +2,7 @@
2
2
  "name": "@elicdavis/node-flow",
3
3
  "description": "build node graphs",
4
4
  "author": "Eli C Davis",
5
- "version": "0.1.5",
5
+ "version": "0.1.6",
6
6
  "license": "MIT",
7
7
  "keywords": [
8
8
  "nodes",
package/src/graph.ts CHANGED
@@ -396,6 +396,10 @@ export class NodeFlowGraph {
396
396
  this.#mainNodeSubsystem.addNode(node);
397
397
  }
398
398
 
399
+ removeNode(node: FlowNode): void {
400
+ this.#mainNodeSubsystem.removeNode(node);
401
+ }
402
+
399
403
  addNote(note: FlowNote): void {
400
404
  this.#mainNoteSubsystem.addNote(note);
401
405
  }
@@ -139,7 +139,7 @@ export class NodeSubsystem {
139
139
  public addOnNodeCreatedListener(callback: NodeCreatedCallback): void {
140
140
  this.#nodeFactory.addOnNodeCreatedListener(callback);
141
141
  }
142
-
142
+
143
143
  public nodeFactory(): NodeFactory {
144
144
  return this.#nodeFactory;
145
145
  }
@@ -477,6 +477,14 @@ export class NodeSubsystem {
477
477
  return this.#widgetCurrentlyClicking !== null;
478
478
  }
479
479
 
480
+ removeNode(node: FlowNode): void {
481
+ for (let i = 0; i < this.#nodes.length; i++) {
482
+ if (this.#nodes[i] === node) {
483
+ this.#removeNodeByIndex(i);
484
+ }
485
+ }
486
+ }
487
+
480
488
  #removeNodeByIndex(nodeIndex: number): void {
481
489
  this.#removeNodeConnections(nodeIndex);
482
490
  const node = this.#nodes[nodeIndex];