@elicdavis/node-flow 0.1.10 → 0.1.11

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 CHANGED
@@ -295,6 +295,7 @@ declare class FlowNode {
295
295
  addInput(config: PortConfig): Port;
296
296
  addOutput(config: PortConfig): Port;
297
297
  addWidget(widget: Widget): void;
298
+ removeWidget(widget: Widget): void;
298
299
  getWidget(index: number): Widget;
299
300
  widgetCount(): number;
300
301
  translate(delta: Vector2): void;
@@ -634,6 +635,22 @@ declare class StringWidget {
634
635
  Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
635
636
  }
636
637
 
638
+ interface TextWidgetConfig {
639
+ property?: string;
640
+ value?: string;
641
+ textBoxStyle?: TextStyleConfig;
642
+ callback?: (newString: string) => void;
643
+ }
644
+ declare class TextWidget {
645
+ #private;
646
+ constructor(node: FlowNode, config?: TextWidgetConfig);
647
+ Size(): Vector2;
648
+ Set(value: string): void;
649
+ ClickStart(): void;
650
+ ClickEnd(): void;
651
+ Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
652
+ }
653
+
637
654
  interface ButtonWidgetConfig {
638
655
  text?: string;
639
656
  callback?: () => void;
@@ -781,4 +798,4 @@ declare class WidgetFactory {
781
798
  }
782
799
  declare const GlobalWidgetFactory: WidgetFactory;
783
800
 
784
- 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, Theme, ToggleWidget, type WidgetConfig };
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 };
package/dist/index.d.ts CHANGED
@@ -295,6 +295,7 @@ declare class FlowNode {
295
295
  addInput(config: PortConfig): Port;
296
296
  addOutput(config: PortConfig): Port;
297
297
  addWidget(widget: Widget): void;
298
+ removeWidget(widget: Widget): void;
298
299
  getWidget(index: number): Widget;
299
300
  widgetCount(): number;
300
301
  translate(delta: Vector2): void;
@@ -634,6 +635,22 @@ declare class StringWidget {
634
635
  Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
635
636
  }
636
637
 
638
+ interface TextWidgetConfig {
639
+ property?: string;
640
+ value?: string;
641
+ textBoxStyle?: TextStyleConfig;
642
+ callback?: (newString: string) => void;
643
+ }
644
+ declare class TextWidget {
645
+ #private;
646
+ constructor(node: FlowNode, config?: TextWidgetConfig);
647
+ Size(): Vector2;
648
+ Set(value: string): void;
649
+ ClickStart(): void;
650
+ ClickEnd(): void;
651
+ Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
652
+ }
653
+
637
654
  interface ButtonWidgetConfig {
638
655
  text?: string;
639
656
  callback?: () => void;
@@ -781,4 +798,4 @@ declare class WidgetFactory {
781
798
  }
782
799
  declare const GlobalWidgetFactory: WidgetFactory;
783
800
 
784
- 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, Theme, ToggleWidget, type WidgetConfig };
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 };
package/dist/index.js CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  Publisher: () => Publisher,
50
50
  SliderWidget: () => SliderWidget,
51
51
  StringWidget: () => StringWidget,
52
+ TextWidget: () => TextWidget,
52
53
  Theme: () => Theme,
53
54
  ToggleWidget: () => ToggleWidget
54
55
  });
@@ -4422,6 +4423,13 @@ var FlowNode = class {
4422
4423
  addWidget(widget) {
4423
4424
  __privateGet(this, _widgets).push(widget);
4424
4425
  }
4426
+ removeWidget(widget) {
4427
+ const index = __privateGet(this, _widgets).indexOf(widget, 0);
4428
+ if (index === -1) {
4429
+ throw new Error("node does not contain widget");
4430
+ }
4431
+ __privateGet(this, _widgets).splice(index, 1);
4432
+ }
4425
4433
  getWidget(index) {
4426
4434
  return __privateGet(this, _widgets)[index];
4427
4435
  }
@@ -6639,6 +6647,7 @@ renderQuickMenu_fn = function() {
6639
6647
  Publisher,
6640
6648
  SliderWidget,
6641
6649
  StringWidget,
6650
+ TextWidget,
6642
6651
  Theme,
6643
6652
  ToggleWidget
6644
6653
  });