@elicdavis/node-flow 0.1.18 → 0.1.20
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/graph.ts +22 -17
- package/src/node.ts +2 -10
- package/src/nodes/subsystem.ts +10 -0
- package/src/widgets/number.ts +1 -1
- package/src/widgets/slider.ts +1 -1
- package/test/hover_after_removal.test.ts +72 -0
- package/test/property_binding.test.ts +49 -0
package/dist/index.d.mts
CHANGED
|
@@ -653,6 +653,7 @@ declare class NodeFlowGraph {
|
|
|
653
653
|
connectedInputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
654
654
|
connectedOutputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
655
655
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
656
|
+
clearNodeInputConnection(node: FlowNode, index: number): void;
|
|
656
657
|
addNode(node: FlowNode): void;
|
|
657
658
|
removeNode(node: FlowNode): void;
|
|
658
659
|
addNote(note: FlowNote): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -653,6 +653,7 @@ declare class NodeFlowGraph {
|
|
|
653
653
|
connectedInputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
654
654
|
connectedOutputsNodeReferences(nodeIndex: number): Array<FlowNode>;
|
|
655
655
|
connectNodes(nodeOut: FlowNode, outPort: number, nodeIn: FlowNode, inPort: number): Connection | undefined;
|
|
656
|
+
clearNodeInputConnection(node: FlowNode, index: number): void;
|
|
656
657
|
addNode(node: FlowNode): void;
|
|
657
658
|
removeNode(node: FlowNode): void;
|
|
658
659
|
addNote(note: FlowNote): void;
|
package/dist/index.js
CHANGED
|
@@ -2080,7 +2080,7 @@ var NumberWidget = class {
|
|
|
2080
2080
|
return { "x": width, "y": height };
|
|
2081
2081
|
}
|
|
2082
2082
|
Set(newNumber) {
|
|
2083
|
-
if (this.#value
|
|
2083
|
+
if (Object.is(this.#value, newNumber)) {
|
|
2084
2084
|
return;
|
|
2085
2085
|
}
|
|
2086
2086
|
this.#value = newNumber;
|
|
@@ -2368,7 +2368,7 @@ var SliderWidget = class {
|
|
|
2368
2368
|
}
|
|
2369
2369
|
SetValue(newValue) {
|
|
2370
2370
|
const cleanedValue = Clamp(newValue, this.#min, this.#max);
|
|
2371
|
-
if (this.#value
|
|
2371
|
+
if (Object.is(this.#value, cleanedValue)) {
|
|
2372
2372
|
return;
|
|
2373
2373
|
}
|
|
2374
2374
|
this.#value = cleanedValue;
|
|
@@ -3967,6 +3967,14 @@ var NodeSubsystem2 = class {
|
|
|
3967
3967
|
this.#removeNodeConnections(nodeIndex);
|
|
3968
3968
|
const node = this.#nodes[nodeIndex];
|
|
3969
3969
|
this.#nodes.splice(nodeIndex, 1);
|
|
3970
|
+
if (this.#nodeHovering === nodeIndex) {
|
|
3971
|
+
this.#nodeHovering = -1;
|
|
3972
|
+
} else if (this.#nodeHovering > nodeIndex) {
|
|
3973
|
+
this.#nodeHovering--;
|
|
3974
|
+
}
|
|
3975
|
+
if (this.#portHovering?.Node === node) {
|
|
3976
|
+
this.#portHovering = null;
|
|
3977
|
+
}
|
|
3970
3978
|
requestRender();
|
|
3971
3979
|
for (let i = 0; i < this.#nodeRemovedCallbacks.length; i++) {
|
|
3972
3980
|
this.#nodeRemovedCallbacks[i](node);
|
|
@@ -4552,7 +4560,7 @@ var FlowNode = class {
|
|
|
4552
4560
|
}
|
|
4553
4561
|
setProperty(name, value) {
|
|
4554
4562
|
const oldValue = this.#data[name];
|
|
4555
|
-
if (oldValue
|
|
4563
|
+
if (Object.is(oldValue, value)) {
|
|
4556
4564
|
return;
|
|
4557
4565
|
}
|
|
4558
4566
|
this.#data[name] = value;
|
|
@@ -5005,10 +5013,6 @@ var FlowNode = class {
|
|
|
5005
5013
|
return this.#title.get();
|
|
5006
5014
|
}
|
|
5007
5015
|
setTitle(newTitle) {
|
|
5008
|
-
if (!this.#canEditTitle) {
|
|
5009
|
-
console.warn("setTitle instruction ignored, as node has been marked un-editable");
|
|
5010
|
-
return;
|
|
5011
|
-
}
|
|
5012
5016
|
let cleaned = newTitle;
|
|
5013
5017
|
if (cleaned === null || cleaned === void 0) {
|
|
5014
5018
|
cleaned = "";
|
|
@@ -5025,9 +5029,6 @@ var FlowNode = class {
|
|
|
5025
5029
|
}
|
|
5026
5030
|
}
|
|
5027
5031
|
setInfo(newInfo) {
|
|
5028
|
-
if (!this.#canEditInfo) {
|
|
5029
|
-
console.warn("setInfo instruction ignored, as node has been marked un-editable");
|
|
5030
|
-
}
|
|
5031
5032
|
let cleaned = newInfo;
|
|
5032
5033
|
if (cleaned === null || cleaned === void 0) {
|
|
5033
5034
|
cleaned = "";
|
|
@@ -6928,12 +6929,25 @@ var NodeFlowGraph = class {
|
|
|
6928
6929
|
this.#pasteCallbacks.forEach((callback) => callback(position));
|
|
6929
6930
|
}
|
|
6930
6931
|
#deleteKey(e) {
|
|
6931
|
-
return e.code === "Delete" || e.
|
|
6932
|
+
return e.code === "Delete" || e.key === "Delete";
|
|
6932
6933
|
}
|
|
6933
6934
|
#keyDown(e) {
|
|
6934
6935
|
if (document.activeElement) {
|
|
6935
6936
|
if (["INPUT", "TEXTAREA"].includes(document.activeElement.tagName)) return;
|
|
6936
6937
|
}
|
|
6938
|
+
if (this.#openQuickMenu) {
|
|
6939
|
+
if (e.code === "Escape") {
|
|
6940
|
+
this.#openQuickMenu = null;
|
|
6941
|
+
return;
|
|
6942
|
+
}
|
|
6943
|
+
if (e.code === "Enter") {
|
|
6944
|
+
this.#openQuickMenu.Menu.execute();
|
|
6945
|
+
this.#openQuickMenu = null;
|
|
6946
|
+
return;
|
|
6947
|
+
}
|
|
6948
|
+
this.#openQuickMenu.Menu.keyboardEvent(e);
|
|
6949
|
+
return;
|
|
6950
|
+
}
|
|
6937
6951
|
if (this.#deleteKey(e)) {
|
|
6938
6952
|
if (this.#mainNodeSubsystem.getSelectedNodes().length > 0) {
|
|
6939
6953
|
e.preventDefault();
|
|
@@ -6958,19 +6972,6 @@ var NodeFlowGraph = class {
|
|
|
6958
6972
|
return;
|
|
6959
6973
|
}
|
|
6960
6974
|
}
|
|
6961
|
-
if (this.#openQuickMenu) {
|
|
6962
|
-
if (e.code === "Escape") {
|
|
6963
|
-
this.#openQuickMenu = null;
|
|
6964
|
-
return;
|
|
6965
|
-
}
|
|
6966
|
-
if (e.code === "Enter") {
|
|
6967
|
-
this.#openQuickMenu.Menu.execute();
|
|
6968
|
-
this.#openQuickMenu = null;
|
|
6969
|
-
return;
|
|
6970
|
-
}
|
|
6971
|
-
this.#openQuickMenu.Menu.keyboardEvent(e);
|
|
6972
|
-
return;
|
|
6973
|
-
}
|
|
6974
6975
|
const spacePressed = e.key == " " || e.code == "Space";
|
|
6975
6976
|
if (!spacePressed) {
|
|
6976
6977
|
return;
|
|
@@ -7169,6 +7170,9 @@ var NodeFlowGraph = class {
|
|
|
7169
7170
|
connectNodes(nodeOut, outPort, nodeIn, inPort) {
|
|
7170
7171
|
return this.#mainNodeSubsystem.connectNodes(nodeOut, outPort, nodeIn, inPort);
|
|
7171
7172
|
}
|
|
7173
|
+
clearNodeInputConnection(node, index) {
|
|
7174
|
+
this.#mainNodeSubsystem.clearNodeInputConnection(node, index);
|
|
7175
|
+
}
|
|
7172
7176
|
addNode(node) {
|
|
7173
7177
|
this.#mainNodeSubsystem.addNode(node);
|
|
7174
7178
|
}
|