@elicdavis/node-flow 0.1.4 → 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/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/graph.ts +4 -0
- package/src/nodes/publisher.ts +1 -1
- package/src/nodes/subsystem.ts +9 -1
package/package.json
CHANGED
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
|
}
|
package/src/nodes/publisher.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class Publisher {
|
|
|
54
54
|
const slashIndex = key.indexOf("/")
|
|
55
55
|
const bracketIndex = key.indexOf("[")
|
|
56
56
|
|
|
57
|
-
if (slashIndex === -1 || bracketIndex < slashIndex) {
|
|
57
|
+
if (slashIndex === -1 || (bracketIndex !== -1 && bracketIndex < slashIndex)) {
|
|
58
58
|
items.push({
|
|
59
59
|
name: key,
|
|
60
60
|
callback: () => {
|
package/src/nodes/subsystem.ts
CHANGED
|
@@ -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];
|