@elicdavis/node-flow 0.1.11 → 0.1.12

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/README.md CHANGED
@@ -164,6 +164,16 @@ node.addInput({ name: "c", type: "float32" })
164
164
  node.addOutput({ name: "sum", type: "float32" })
165
165
  ```
166
166
 
167
+ ### Note API
168
+
169
+ ```javascript
170
+ note.setText("...");
171
+ note.setPosition({ x, y });
172
+ graph.removeNote(note);
173
+ graph.removeAllNotes();
174
+ graph.getNotes();
175
+ ```
176
+
167
177
  ## Library Development
168
178
 
169
179
  Just run
package/dist/index.d.mts CHANGED
@@ -490,6 +490,9 @@ declare class NodeFlowGraph {
490
490
  addNode(node: FlowNode): void;
491
491
  removeNode(node: FlowNode): void;
492
492
  addNote(note: FlowNote): void;
493
+ removeNote(note: FlowNote): void;
494
+ removeAllNotes(): void;
495
+ getNotes(): Array<FlowNote>;
493
496
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
494
497
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
495
498
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
@@ -798,4 +801,4 @@ declare class WidgetFactory {
798
801
  }
799
802
  declare const GlobalWidgetFactory: WidgetFactory;
800
803
 
801
- export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
804
+ export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
package/dist/index.d.ts CHANGED
@@ -490,6 +490,9 @@ declare class NodeFlowGraph {
490
490
  addNode(node: FlowNode): void;
491
491
  removeNode(node: FlowNode): void;
492
492
  addNote(note: FlowNote): void;
493
+ removeNote(note: FlowNote): void;
494
+ removeAllNotes(): void;
495
+ getNotes(): Array<FlowNote>;
493
496
  addOnNodeCreatedListener(callback: NodeCreatedCallback): void;
494
497
  addOnNodeAddedListener(callback: NodeAddedCallback): void;
495
498
  addOnNodeRemovedListener(callback: NodeRemovedCallback): void;
@@ -798,4 +801,4 @@ declare class WidgetFactory {
798
801
  }
799
802
  declare const GlobalWidgetFactory: WidgetFactory;
800
803
 
801
- export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
804
+ export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, type FlowNoteConfig, GlobalWidgetFactory, type GraphRenderer, ImageWidget, MessageType, NodeFlowGraph, type NodeIntersection, type NodeMessageConfig, NodeState, type NoteAddedCallback, type NoteContentChangeCallback, type NoteDragStartCallback, type NoteDragStopCallback, type NoteRemovedCallback, type NoteSubsystemConfig, type NoteWidthChangeCallback, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, TextWidget, Theme, ToggleWidget, type WidgetConfig };
package/dist/index.js CHANGED
@@ -5764,6 +5764,9 @@ var NoteSubsystem = class {
5764
5764
  __privateGet(this, _onNoteAddedCallbacks)[i](note);
5765
5765
  }
5766
5766
  }
5767
+ getNotes() {
5768
+ return __privateGet(this, _notes);
5769
+ }
5767
5770
  addNoteAddedListener(callback) {
5768
5771
  if (callback === null || callback === void 0) {
5769
5772
  return;
@@ -5887,6 +5890,17 @@ var NoteSubsystem = class {
5887
5890
  console.error("no note found to remove");
5888
5891
  }
5889
5892
  }
5893
+ removeAllNotes() {
5894
+ const notes = __privateGet(this, _notes);
5895
+ __privateSet(this, _notes, []);
5896
+ __privateSet(this, _noteHovering, null);
5897
+ __privateSet(this, _noteSelected, null);
5898
+ for (let i = 0; i < notes.length; i++) {
5899
+ for (let j = 0; j < __privateGet(this, _onNoteRemovedCallbacks).length; j++) {
5900
+ __privateGet(this, _onNoteRemovedCallbacks)[j](notes[i]);
5901
+ }
5902
+ }
5903
+ }
5890
5904
  render(ctx, camera, mousePosition) {
5891
5905
  __privateSet(this, _noteHovering, null);
5892
5906
  __privateSet(this, _hoveringHandle, 0 /* None */);
@@ -6481,6 +6495,15 @@ var NodeFlowGraph = class {
6481
6495
  addNote(note) {
6482
6496
  __privateGet(this, _mainNoteSubsystem).addNote(note);
6483
6497
  }
6498
+ removeNote(note) {
6499
+ __privateGet(this, _mainNoteSubsystem).removeNote(note);
6500
+ }
6501
+ removeAllNotes() {
6502
+ __privateGet(this, _mainNoteSubsystem).removeAllNotes();
6503
+ }
6504
+ getNotes() {
6505
+ return __privateGet(this, _mainNoteSubsystem).getNotes();
6506
+ }
6484
6507
  addOnNodeCreatedListener(callback) {
6485
6508
  __privateGet(this, _mainNodeSubsystem).addOnNodeCreatedListener(callback);
6486
6509
  }