@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.mjs CHANGED
@@ -2026,7 +2026,7 @@ var NumberWidget = class {
2026
2026
  return { "x": width, "y": height };
2027
2027
  }
2028
2028
  Set(newNumber) {
2029
- if (this.#value === newNumber) {
2029
+ if (Object.is(this.#value, newNumber)) {
2030
2030
  return;
2031
2031
  }
2032
2032
  this.#value = newNumber;
@@ -2314,7 +2314,7 @@ var SliderWidget = class {
2314
2314
  }
2315
2315
  SetValue(newValue) {
2316
2316
  const cleanedValue = Clamp(newValue, this.#min, this.#max);
2317
- if (this.#value === cleanedValue) {
2317
+ if (Object.is(this.#value, cleanedValue)) {
2318
2318
  return;
2319
2319
  }
2320
2320
  this.#value = cleanedValue;
@@ -3913,6 +3913,14 @@ var NodeSubsystem2 = class {
3913
3913
  this.#removeNodeConnections(nodeIndex);
3914
3914
  const node = this.#nodes[nodeIndex];
3915
3915
  this.#nodes.splice(nodeIndex, 1);
3916
+ if (this.#nodeHovering === nodeIndex) {
3917
+ this.#nodeHovering = -1;
3918
+ } else if (this.#nodeHovering > nodeIndex) {
3919
+ this.#nodeHovering--;
3920
+ }
3921
+ if (this.#portHovering?.Node === node) {
3922
+ this.#portHovering = null;
3923
+ }
3916
3924
  requestRender();
3917
3925
  for (let i = 0; i < this.#nodeRemovedCallbacks.length; i++) {
3918
3926
  this.#nodeRemovedCallbacks[i](node);
@@ -4498,7 +4506,7 @@ var FlowNode = class {
4498
4506
  }
4499
4507
  setProperty(name, value) {
4500
4508
  const oldValue = this.#data[name];
4501
- if (oldValue === value) {
4509
+ if (Object.is(oldValue, value)) {
4502
4510
  return;
4503
4511
  }
4504
4512
  this.#data[name] = value;
@@ -4951,10 +4959,6 @@ var FlowNode = class {
4951
4959
  return this.#title.get();
4952
4960
  }
4953
4961
  setTitle(newTitle) {
4954
- if (!this.#canEditTitle) {
4955
- console.warn("setTitle instruction ignored, as node has been marked un-editable");
4956
- return;
4957
- }
4958
4962
  let cleaned = newTitle;
4959
4963
  if (cleaned === null || cleaned === void 0) {
4960
4964
  cleaned = "";
@@ -4971,9 +4975,6 @@ var FlowNode = class {
4971
4975
  }
4972
4976
  }
4973
4977
  setInfo(newInfo) {
4974
- if (!this.#canEditInfo) {
4975
- console.warn("setInfo instruction ignored, as node has been marked un-editable");
4976
- }
4977
4978
  let cleaned = newInfo;
4978
4979
  if (cleaned === null || cleaned === void 0) {
4979
4980
  cleaned = "";
@@ -6874,12 +6875,25 @@ var NodeFlowGraph = class {
6874
6875
  this.#pasteCallbacks.forEach((callback) => callback(position));
6875
6876
  }
6876
6877
  #deleteKey(e) {
6877
- return e.code === "Delete" || e.code === "Backspace" || e.key === "Delete" || e.key === "Backspace";
6878
+ return e.code === "Delete" || e.key === "Delete";
6878
6879
  }
6879
6880
  #keyDown(e) {
6880
6881
  if (document.activeElement) {
6881
6882
  if (["INPUT", "TEXTAREA"].includes(document.activeElement.tagName)) return;
6882
6883
  }
6884
+ if (this.#openQuickMenu) {
6885
+ if (e.code === "Escape") {
6886
+ this.#openQuickMenu = null;
6887
+ return;
6888
+ }
6889
+ if (e.code === "Enter") {
6890
+ this.#openQuickMenu.Menu.execute();
6891
+ this.#openQuickMenu = null;
6892
+ return;
6893
+ }
6894
+ this.#openQuickMenu.Menu.keyboardEvent(e);
6895
+ return;
6896
+ }
6883
6897
  if (this.#deleteKey(e)) {
6884
6898
  if (this.#mainNodeSubsystem.getSelectedNodes().length > 0) {
6885
6899
  e.preventDefault();
@@ -6904,19 +6918,6 @@ var NodeFlowGraph = class {
6904
6918
  return;
6905
6919
  }
6906
6920
  }
6907
- if (this.#openQuickMenu) {
6908
- if (e.code === "Escape") {
6909
- this.#openQuickMenu = null;
6910
- return;
6911
- }
6912
- if (e.code === "Enter") {
6913
- this.#openQuickMenu.Menu.execute();
6914
- this.#openQuickMenu = null;
6915
- return;
6916
- }
6917
- this.#openQuickMenu.Menu.keyboardEvent(e);
6918
- return;
6919
- }
6920
6921
  const spacePressed = e.key == " " || e.code == "Space";
6921
6922
  if (!spacePressed) {
6922
6923
  return;
@@ -7115,6 +7116,9 @@ var NodeFlowGraph = class {
7115
7116
  connectNodes(nodeOut, outPort, nodeIn, inPort) {
7116
7117
  return this.#mainNodeSubsystem.connectNodes(nodeOut, outPort, nodeIn, inPort);
7117
7118
  }
7119
+ clearNodeInputConnection(node, index) {
7120
+ this.#mainNodeSubsystem.clearNodeInputConnection(node, index);
7121
+ }
7118
7122
  addNode(node) {
7119
7123
  this.#mainNodeSubsystem.addNode(node);
7120
7124
  }