@elicdavis/node-flow 0.1.9 → 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 +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/index.html +7 -2
- package/package.json +1 -1
- package/src/index.ts +3 -1
- package/src/node.ts +19 -4
package/dist/index.d.mts
CHANGED
|
@@ -224,6 +224,8 @@ declare enum MessageType {
|
|
|
224
224
|
interface NodeMessageConfig {
|
|
225
225
|
message: string;
|
|
226
226
|
type?: MessageType;
|
|
227
|
+
alwaysShow?: boolean;
|
|
228
|
+
color?: string;
|
|
227
229
|
}
|
|
228
230
|
interface FlowNodeConfig {
|
|
229
231
|
position?: Vector2;
|
|
@@ -293,6 +295,7 @@ declare class FlowNode {
|
|
|
293
295
|
addInput(config: PortConfig): Port;
|
|
294
296
|
addOutput(config: PortConfig): Port;
|
|
295
297
|
addWidget(widget: Widget): void;
|
|
298
|
+
removeWidget(widget: Widget): void;
|
|
296
299
|
getWidget(index: number): Widget;
|
|
297
300
|
widgetCount(): number;
|
|
298
301
|
translate(delta: Vector2): void;
|
|
@@ -632,6 +635,22 @@ declare class StringWidget {
|
|
|
632
635
|
Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
|
|
633
636
|
}
|
|
634
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
|
+
|
|
635
654
|
interface ButtonWidgetConfig {
|
|
636
655
|
text?: string;
|
|
637
656
|
callback?: () => void;
|
|
@@ -779,4 +798,4 @@ declare class WidgetFactory {
|
|
|
779
798
|
}
|
|
780
799
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
781
800
|
|
|
782
|
-
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
|
@@ -224,6 +224,8 @@ declare enum MessageType {
|
|
|
224
224
|
interface NodeMessageConfig {
|
|
225
225
|
message: string;
|
|
226
226
|
type?: MessageType;
|
|
227
|
+
alwaysShow?: boolean;
|
|
228
|
+
color?: string;
|
|
227
229
|
}
|
|
228
230
|
interface FlowNodeConfig {
|
|
229
231
|
position?: Vector2;
|
|
@@ -293,6 +295,7 @@ declare class FlowNode {
|
|
|
293
295
|
addInput(config: PortConfig): Port;
|
|
294
296
|
addOutput(config: PortConfig): Port;
|
|
295
297
|
addWidget(widget: Widget): void;
|
|
298
|
+
removeWidget(widget: Widget): void;
|
|
296
299
|
getWidget(index: number): Widget;
|
|
297
300
|
widgetCount(): number;
|
|
298
301
|
translate(delta: Vector2): void;
|
|
@@ -632,6 +635,22 @@ declare class StringWidget {
|
|
|
632
635
|
Draw(ctx: CanvasRenderingContext2D, position: Vector2, scale: number, mousePosition: Vector2 | undefined): Box;
|
|
633
636
|
}
|
|
634
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
|
+
|
|
635
654
|
interface ButtonWidgetConfig {
|
|
636
655
|
text?: string;
|
|
637
656
|
callback?: () => void;
|
|
@@ -779,4 +798,4 @@ declare class WidgetFactory {
|
|
|
779
798
|
}
|
|
780
799
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
781
800
|
|
|
782
|
-
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
|
});
|
|
@@ -3942,14 +3943,16 @@ var NodeState = /* @__PURE__ */ ((NodeState2) => {
|
|
|
3942
3943
|
NodeState2[NodeState2["Grabbed"] = 2] = "Grabbed";
|
|
3943
3944
|
return NodeState2;
|
|
3944
3945
|
})(NodeState || {});
|
|
3945
|
-
var _text7;
|
|
3946
|
+
var _text7, _alwaysShow;
|
|
3946
3947
|
var MessageRenderer = class {
|
|
3947
3948
|
constructor(config) {
|
|
3948
3949
|
__privateAdd(this, _text7);
|
|
3950
|
+
__privateAdd(this, _alwaysShow);
|
|
3951
|
+
__privateSet(this, _alwaysShow, config.alwaysShow ? config.alwaysShow : false);
|
|
3949
3952
|
__privateSet(this, _text7, new Text(
|
|
3950
3953
|
config.message,
|
|
3951
3954
|
{
|
|
3952
|
-
color: MessageTypeColor(config.type ? config.type : "info" /* Info */)
|
|
3955
|
+
color: config.color ? config.color : MessageTypeColor(config.type ? config.type : "info" /* Info */)
|
|
3953
3956
|
},
|
|
3954
3957
|
{
|
|
3955
3958
|
LineSpacing: 2.5,
|
|
@@ -3957,13 +3960,17 @@ var MessageRenderer = class {
|
|
|
3957
3960
|
}
|
|
3958
3961
|
));
|
|
3959
3962
|
}
|
|
3960
|
-
render(ctx, scale, position) {
|
|
3963
|
+
render(ctx, scale, position, hovering) {
|
|
3964
|
+
if (!__privateGet(this, _alwaysShow) && !hovering) {
|
|
3965
|
+
return 0;
|
|
3966
|
+
}
|
|
3961
3967
|
ctx.textAlign = "center" /* Center */;
|
|
3962
3968
|
__privateGet(this, _text7).render(ctx, scale, position);
|
|
3963
3969
|
return __privateGet(this, _text7).height(ctx) * scale;
|
|
3964
3970
|
}
|
|
3965
3971
|
};
|
|
3966
3972
|
_text7 = new WeakMap();
|
|
3973
|
+
_alwaysShow = new WeakMap();
|
|
3967
3974
|
var _position, _title2, _subTitle, _infoSymbol, _infoText, _messages, _input, _output, _widgets, _locked, _canEditTitle, _canEditInfo, _canEditPorts, _contextMenu2, _metadata, _onSelect, _onUnselect, _onFiledrop, _onDragStop, _titleChangeCallback, _infoChangeCallback, _titleColor, _selectedStyle, _stateStyles, _padding2, _portTextStyle, _elementSpacing, _selected, _inputPortPositions, _outputPortPositions, _widgetPositions, _data, _registeredAnyPropertyChangeCallbacks, _registeredPropertyChangeCallbacks, _FlowNode_instances, popupNodeTitleSelection_fn, popupNodeInfoSelection_fn, popupNewButtonWidget_fn, widgetSubmenu_fn, calculateStyle_fn;
|
|
3968
3975
|
var FlowNode = class {
|
|
3969
3976
|
constructor(config) {
|
|
@@ -4416,6 +4423,13 @@ var FlowNode = class {
|
|
|
4416
4423
|
addWidget(widget) {
|
|
4417
4424
|
__privateGet(this, _widgets).push(widget);
|
|
4418
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
|
+
}
|
|
4419
4433
|
getWidget(index) {
|
|
4420
4434
|
return __privateGet(this, _widgets)[index];
|
|
4421
4435
|
}
|
|
@@ -4659,7 +4673,7 @@ var FlowNode = class {
|
|
|
4659
4673
|
messageStart.y = nodeBounds.Position.y + nodeBounds.Size.y + 15 * camera.zoom;
|
|
4660
4674
|
for (let i = 0; i < __privateGet(this, _messages).length; i++) {
|
|
4661
4675
|
const message = __privateGet(this, _messages)[i];
|
|
4662
|
-
messageStart.y += message.render(ctx, camera.zoom, messageStart) + 10 * camera.zoom;
|
|
4676
|
+
messageStart.y += message.render(ctx, camera.zoom, messageStart, !(state === 0 /* Idle */)) + 10 * camera.zoom;
|
|
4663
4677
|
}
|
|
4664
4678
|
});
|
|
4665
4679
|
}
|
|
@@ -6633,6 +6647,7 @@ renderQuickMenu_fn = function() {
|
|
|
6633
6647
|
Publisher,
|
|
6634
6648
|
SliderWidget,
|
|
6635
6649
|
StringWidget,
|
|
6650
|
+
TextWidget,
|
|
6636
6651
|
Theme,
|
|
6637
6652
|
ToggleWidget
|
|
6638
6653
|
});
|