@elicdavis/node-flow 0.1.8 → 0.1.9
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/LICENSE +21 -0
- package/dist/index.d.mts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +135 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +134 -31
- package/dist/index.mjs.map +1 -1
- package/index.html +9 -0
- package/package.json +1 -1
- package/src/graph.ts +1 -1
- package/src/node.ts +79 -1
- package/src/theme.ts +5 -0
- package/src/types/text.ts +53 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Eli C Davis.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/index.d.mts
CHANGED
|
@@ -216,11 +216,21 @@ interface FlowNodeStyle {
|
|
|
216
216
|
selected?: BoxStyleConfig;
|
|
217
217
|
portText?: TextStyleConfig;
|
|
218
218
|
}
|
|
219
|
+
declare enum MessageType {
|
|
220
|
+
Info = "info",
|
|
221
|
+
Warning = "warning",
|
|
222
|
+
Error = "error"
|
|
223
|
+
}
|
|
224
|
+
interface NodeMessageConfig {
|
|
225
|
+
message: string;
|
|
226
|
+
type?: MessageType;
|
|
227
|
+
}
|
|
219
228
|
interface FlowNodeConfig {
|
|
220
229
|
position?: Vector2;
|
|
221
230
|
title?: string;
|
|
222
231
|
subTitle?: string;
|
|
223
232
|
info?: string;
|
|
233
|
+
messages?: Array<NodeMessageConfig>;
|
|
224
234
|
locked?: boolean;
|
|
225
235
|
data?: Metadata;
|
|
226
236
|
contextMenu?: ContextMenuConfig;
|
|
@@ -298,6 +308,8 @@ declare class FlowNode {
|
|
|
298
308
|
outputPortPosition(index: number): Box;
|
|
299
309
|
outputPort(index: number): Port;
|
|
300
310
|
outputs(): number;
|
|
311
|
+
addMessage(message: NodeMessageConfig): void;
|
|
312
|
+
clearMessages(): void;
|
|
301
313
|
render(ctx: CanvasRenderingContext2D, camera: Camera, state: NodeState, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): void;
|
|
302
314
|
}
|
|
303
315
|
|
|
@@ -503,6 +515,11 @@ declare const Theme: {
|
|
|
503
515
|
Port: {
|
|
504
516
|
FontColor: string;
|
|
505
517
|
};
|
|
518
|
+
Message: {
|
|
519
|
+
InfoColor: string;
|
|
520
|
+
WarnColor: string;
|
|
521
|
+
ErrorColor: string;
|
|
522
|
+
};
|
|
506
523
|
};
|
|
507
524
|
BoxSelect: {
|
|
508
525
|
Color: string;
|
|
@@ -762,4 +779,4 @@ declare class WidgetFactory {
|
|
|
762
779
|
}
|
|
763
780
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
764
781
|
|
|
765
|
-
export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, GlobalWidgetFactory, type GraphRenderer, ImageWidget, NodeFlowGraph, type NodeIntersection, NodeState, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, Theme, ToggleWidget, type WidgetConfig };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,11 +216,21 @@ interface FlowNodeStyle {
|
|
|
216
216
|
selected?: BoxStyleConfig;
|
|
217
217
|
portText?: TextStyleConfig;
|
|
218
218
|
}
|
|
219
|
+
declare enum MessageType {
|
|
220
|
+
Info = "info",
|
|
221
|
+
Warning = "warning",
|
|
222
|
+
Error = "error"
|
|
223
|
+
}
|
|
224
|
+
interface NodeMessageConfig {
|
|
225
|
+
message: string;
|
|
226
|
+
type?: MessageType;
|
|
227
|
+
}
|
|
219
228
|
interface FlowNodeConfig {
|
|
220
229
|
position?: Vector2;
|
|
221
230
|
title?: string;
|
|
222
231
|
subTitle?: string;
|
|
223
232
|
info?: string;
|
|
233
|
+
messages?: Array<NodeMessageConfig>;
|
|
224
234
|
locked?: boolean;
|
|
225
235
|
data?: Metadata;
|
|
226
236
|
contextMenu?: ContextMenuConfig;
|
|
@@ -298,6 +308,8 @@ declare class FlowNode {
|
|
|
298
308
|
outputPortPosition(index: number): Box;
|
|
299
309
|
outputPort(index: number): Port;
|
|
300
310
|
outputs(): number;
|
|
311
|
+
addMessage(message: NodeMessageConfig): void;
|
|
312
|
+
clearMessages(): void;
|
|
301
313
|
render(ctx: CanvasRenderingContext2D, camera: Camera, state: NodeState, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): void;
|
|
302
314
|
}
|
|
303
315
|
|
|
@@ -503,6 +515,11 @@ declare const Theme: {
|
|
|
503
515
|
Port: {
|
|
504
516
|
FontColor: string;
|
|
505
517
|
};
|
|
518
|
+
Message: {
|
|
519
|
+
InfoColor: string;
|
|
520
|
+
WarnColor: string;
|
|
521
|
+
ErrorColor: string;
|
|
522
|
+
};
|
|
506
523
|
};
|
|
507
524
|
BoxSelect: {
|
|
508
525
|
Color: string;
|
|
@@ -762,4 +779,4 @@ declare class WidgetFactory {
|
|
|
762
779
|
}
|
|
763
780
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
764
781
|
|
|
765
|
-
export { ButtonWidget, ColorWidget, FlowNode, type FlowNodeConfig, type FlowNodeGraphConfiguration, type FlowNodeStyle, type FlowNodeTitleConfig, FlowNote, GlobalWidgetFactory, type GraphRenderer, ImageWidget, NodeFlowGraph, type NodeIntersection, NodeState, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, Theme, ToggleWidget, type WidgetConfig };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
FlowNote: () => FlowNote,
|
|
43
43
|
GlobalWidgetFactory: () => GlobalWidgetFactory,
|
|
44
44
|
ImageWidget: () => ImageWidget,
|
|
45
|
+
MessageType: () => MessageType,
|
|
45
46
|
NodeFlowGraph: () => NodeFlowGraph,
|
|
46
47
|
NodeState: () => NodeState,
|
|
47
48
|
NumberWidget: () => NumberWidget,
|
|
@@ -76,6 +77,11 @@ var Theme = {
|
|
|
76
77
|
},
|
|
77
78
|
Port: {
|
|
78
79
|
FontColor: "#afb9bb"
|
|
80
|
+
},
|
|
81
|
+
Message: {
|
|
82
|
+
InfoColor: "#afb9bb",
|
|
83
|
+
WarnColor: "#f1f663ff",
|
|
84
|
+
ErrorColor: "#FF0000"
|
|
79
85
|
}
|
|
80
86
|
},
|
|
81
87
|
BoxSelect: {
|
|
@@ -1175,18 +1181,24 @@ function splitStringIntoLines(ctx, str, maxWidth) {
|
|
|
1175
1181
|
}
|
|
1176
1182
|
|
|
1177
1183
|
// src/types/text.ts
|
|
1178
|
-
var _measured, _size2, _style, _value, _Text_instances, measure_fn;
|
|
1184
|
+
var _measured, _size2, _style, _value, _maxWidth2, _lineSpacing, _textToRender, _Text_instances, measure_fn;
|
|
1179
1185
|
var _Text = class _Text {
|
|
1180
|
-
constructor(value, style) {
|
|
1186
|
+
constructor(value, style, config) {
|
|
1181
1187
|
__privateAdd(this, _Text_instances);
|
|
1182
1188
|
__privateAdd(this, _measured);
|
|
1183
1189
|
__privateAdd(this, _size2);
|
|
1184
1190
|
__privateAdd(this, _style);
|
|
1185
1191
|
__privateAdd(this, _value);
|
|
1192
|
+
__privateAdd(this, _maxWidth2);
|
|
1193
|
+
__privateAdd(this, _lineSpacing);
|
|
1194
|
+
__privateAdd(this, _textToRender);
|
|
1186
1195
|
__privateSet(this, _value, value);
|
|
1187
1196
|
__privateSet(this, _measured, false);
|
|
1188
1197
|
__privateSet(this, _size2, Zero());
|
|
1189
1198
|
__privateSet(this, _style, new TextStyle(style));
|
|
1199
|
+
__privateSet(this, _maxWidth2, (config == null ? void 0 : config.MaxWidth) ? config == null ? void 0 : config.MaxWidth : -1);
|
|
1200
|
+
__privateSet(this, _lineSpacing, (config == null ? void 0 : config.LineSpacing) ? config == null ? void 0 : config.LineSpacing : 5);
|
|
1201
|
+
__privateSet(this, _textToRender, [value]);
|
|
1190
1202
|
if (!document.fonts.check(`16px "${__privateGet(this, _style).getFont()}"`)) {
|
|
1191
1203
|
document.fonts.addEventListener("loadingdone", (event) => {
|
|
1192
1204
|
__privateSet(this, _measured, false);
|
|
@@ -1253,6 +1265,10 @@ var _Text = class _Text {
|
|
|
1253
1265
|
CopyVector2(out, __privateGet(this, _size2));
|
|
1254
1266
|
ScaleVector(out, scale);
|
|
1255
1267
|
}
|
|
1268
|
+
height(ctx) {
|
|
1269
|
+
__privateMethod(this, _Text_instances, measure_fn).call(this, ctx);
|
|
1270
|
+
return __privateGet(this, _size2).y;
|
|
1271
|
+
}
|
|
1256
1272
|
setColor(color) {
|
|
1257
1273
|
__privateGet(this, _style).setColor(color);
|
|
1258
1274
|
}
|
|
@@ -1266,8 +1282,17 @@ var _Text = class _Text {
|
|
|
1266
1282
|
__privateGet(this, _style).setWeight(weight);
|
|
1267
1283
|
}
|
|
1268
1284
|
render(ctx, scale, position) {
|
|
1285
|
+
__privateMethod(this, _Text_instances, measure_fn).call(this, ctx);
|
|
1269
1286
|
__privateGet(this, _style).setupStyle(ctx, scale);
|
|
1270
|
-
|
|
1287
|
+
let yOffset = 0;
|
|
1288
|
+
for (let i = 0; i < __privateGet(this, _textToRender).length; i++) {
|
|
1289
|
+
ctx.fillText(
|
|
1290
|
+
__privateGet(this, _textToRender)[i],
|
|
1291
|
+
position.x,
|
|
1292
|
+
position.y + yOffset
|
|
1293
|
+
);
|
|
1294
|
+
yOffset += (__privateGet(this, _style).getSize() + __privateGet(this, _lineSpacing)) * scale;
|
|
1295
|
+
}
|
|
1271
1296
|
}
|
|
1272
1297
|
style() {
|
|
1273
1298
|
return __privateGet(this, _style);
|
|
@@ -1277,15 +1302,31 @@ _measured = new WeakMap();
|
|
|
1277
1302
|
_size2 = new WeakMap();
|
|
1278
1303
|
_style = new WeakMap();
|
|
1279
1304
|
_value = new WeakMap();
|
|
1305
|
+
_maxWidth2 = new WeakMap();
|
|
1306
|
+
_lineSpacing = new WeakMap();
|
|
1307
|
+
_textToRender = new WeakMap();
|
|
1280
1308
|
_Text_instances = new WeakSet();
|
|
1281
1309
|
measure_fn = function(ctx) {
|
|
1282
1310
|
if (__privateGet(this, _measured)) {
|
|
1283
1311
|
return;
|
|
1284
1312
|
}
|
|
1285
1313
|
__privateGet(this, _style).setupStyle(ctx, 1);
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1314
|
+
if (__privateGet(this, _maxWidth2) == -1) {
|
|
1315
|
+
const measurements = ctx.measureText(__privateGet(this, _value));
|
|
1316
|
+
__privateGet(this, _size2).x = measurements.width;
|
|
1317
|
+
__privateGet(this, _size2).y = measurements.actualBoundingBoxAscent + measurements.actualBoundingBoxDescent;
|
|
1318
|
+
__privateSet(this, _textToRender, [__privateGet(this, _value)]);
|
|
1319
|
+
__privateSet(this, _measured, true);
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
__privateSet(this, _textToRender, splitStringIntoLines(ctx, __privateGet(this, _value), __privateGet(this, _maxWidth2)));
|
|
1323
|
+
__privateGet(this, _size2).x = 0;
|
|
1324
|
+
__privateGet(this, _size2).y = 0;
|
|
1325
|
+
for (let i = 0; i < __privateGet(this, _textToRender).length; i++) {
|
|
1326
|
+
const measurements = ctx.measureText(__privateGet(this, _textToRender)[i]);
|
|
1327
|
+
__privateGet(this, _size2).x = Math.max(__privateGet(this, _size2).x, measurements.width);
|
|
1328
|
+
}
|
|
1329
|
+
__privateGet(this, _size2).y += (__privateGet(this, _textToRender).length - 1) * __privateGet(this, _lineSpacing) + __privateGet(this, _style).getSize() * __privateGet(this, _textToRender).length;
|
|
1289
1330
|
__privateSet(this, _measured, true);
|
|
1290
1331
|
};
|
|
1291
1332
|
var Text = _Text;
|
|
@@ -2553,14 +2594,14 @@ _disabledStyle = new WeakMap();
|
|
|
2553
2594
|
_callback6 = new WeakMap();
|
|
2554
2595
|
|
|
2555
2596
|
// src/widgets/image.ts
|
|
2556
|
-
var _url, _image,
|
|
2597
|
+
var _url, _image, _maxWidth3, _maxHeight2;
|
|
2557
2598
|
var ImageWidget = class {
|
|
2558
2599
|
constructor(config) {
|
|
2559
2600
|
__privateAdd(this, _url);
|
|
2560
2601
|
__privateAdd(this, _image);
|
|
2561
|
-
__privateAdd(this,
|
|
2602
|
+
__privateAdd(this, _maxWidth3);
|
|
2562
2603
|
__privateAdd(this, _maxHeight2);
|
|
2563
|
-
__privateSet(this,
|
|
2604
|
+
__privateSet(this, _maxWidth3, (config == null ? void 0 : config.maxWidth) === void 0 ? 150 : config == null ? void 0 : config.maxWidth);
|
|
2564
2605
|
__privateSet(this, _maxHeight2, (config == null ? void 0 : config.maxHeight) === void 0 ? 150 : config == null ? void 0 : config.maxHeight);
|
|
2565
2606
|
if (config == null ? void 0 : config.image) {
|
|
2566
2607
|
this.SetUrl(config == null ? void 0 : config.image);
|
|
@@ -2590,8 +2631,8 @@ var ImageWidget = class {
|
|
|
2590
2631
|
return { "x": 0, "y": 0 };
|
|
2591
2632
|
}
|
|
2592
2633
|
let adjust = 1;
|
|
2593
|
-
if (__privateGet(this, _image).width > __privateGet(this,
|
|
2594
|
-
adjust = __privateGet(this,
|
|
2634
|
+
if (__privateGet(this, _image).width > __privateGet(this, _maxWidth3)) {
|
|
2635
|
+
adjust = __privateGet(this, _maxWidth3) / __privateGet(this, _image).width;
|
|
2595
2636
|
}
|
|
2596
2637
|
if (__privateGet(this, _image).height > __privateGet(this, _maxHeight2)) {
|
|
2597
2638
|
let heightAdjust = __privateGet(this, _maxHeight2) / __privateGet(this, _image).height;
|
|
@@ -2633,7 +2674,7 @@ var ImageWidget = class {
|
|
|
2633
2674
|
};
|
|
2634
2675
|
_url = new WeakMap();
|
|
2635
2676
|
_image = new WeakMap();
|
|
2636
|
-
|
|
2677
|
+
_maxWidth3 = new WeakMap();
|
|
2637
2678
|
_maxHeight2 = new WeakMap();
|
|
2638
2679
|
|
|
2639
2680
|
// src/widgets/text.ts
|
|
@@ -3877,13 +3918,53 @@ function FormPopup(config) {
|
|
|
3877
3918
|
|
|
3878
3919
|
// src/node.ts
|
|
3879
3920
|
var MINIMUM_NODE_WIDTH = 150;
|
|
3921
|
+
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
3922
|
+
MessageType2["Info"] = "info";
|
|
3923
|
+
MessageType2["Warning"] = "warning";
|
|
3924
|
+
MessageType2["Error"] = "error";
|
|
3925
|
+
return MessageType2;
|
|
3926
|
+
})(MessageType || {});
|
|
3927
|
+
function MessageTypeColor(messageType) {
|
|
3928
|
+
switch (messageType) {
|
|
3929
|
+
case "info" /* Info */:
|
|
3930
|
+
return Theme.Node.Message.InfoColor;
|
|
3931
|
+
case "warning" /* Warning */:
|
|
3932
|
+
return Theme.Node.Message.WarnColor;
|
|
3933
|
+
case "error" /* Error */:
|
|
3934
|
+
return Theme.Node.Message.ErrorColor;
|
|
3935
|
+
default:
|
|
3936
|
+
throw new Error(`unrecognized message type ${messageType}`);
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3880
3939
|
var NodeState = /* @__PURE__ */ ((NodeState2) => {
|
|
3881
3940
|
NodeState2[NodeState2["Idle"] = 0] = "Idle";
|
|
3882
3941
|
NodeState2[NodeState2["MouseOver"] = 1] = "MouseOver";
|
|
3883
3942
|
NodeState2[NodeState2["Grabbed"] = 2] = "Grabbed";
|
|
3884
3943
|
return NodeState2;
|
|
3885
3944
|
})(NodeState || {});
|
|
3886
|
-
var
|
|
3945
|
+
var _text7;
|
|
3946
|
+
var MessageRenderer = class {
|
|
3947
|
+
constructor(config) {
|
|
3948
|
+
__privateAdd(this, _text7);
|
|
3949
|
+
__privateSet(this, _text7, new Text(
|
|
3950
|
+
config.message,
|
|
3951
|
+
{
|
|
3952
|
+
color: MessageTypeColor(config.type ? config.type : "info" /* Info */)
|
|
3953
|
+
},
|
|
3954
|
+
{
|
|
3955
|
+
LineSpacing: 2.5,
|
|
3956
|
+
MaxWidth: 200
|
|
3957
|
+
}
|
|
3958
|
+
));
|
|
3959
|
+
}
|
|
3960
|
+
render(ctx, scale, position) {
|
|
3961
|
+
ctx.textAlign = "center" /* Center */;
|
|
3962
|
+
__privateGet(this, _text7).render(ctx, scale, position);
|
|
3963
|
+
return __privateGet(this, _text7).height(ctx) * scale;
|
|
3964
|
+
}
|
|
3965
|
+
};
|
|
3966
|
+
_text7 = new WeakMap();
|
|
3967
|
+
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;
|
|
3887
3968
|
var FlowNode = class {
|
|
3888
3969
|
constructor(config) {
|
|
3889
3970
|
__privateAdd(this, _FlowNode_instances);
|
|
@@ -3892,6 +3973,7 @@ var FlowNode = class {
|
|
|
3892
3973
|
__privateAdd(this, _subTitle);
|
|
3893
3974
|
__privateAdd(this, _infoSymbol);
|
|
3894
3975
|
__privateAdd(this, _infoText);
|
|
3976
|
+
__privateAdd(this, _messages);
|
|
3895
3977
|
__privateAdd(this, _input);
|
|
3896
3978
|
__privateAdd(this, _output);
|
|
3897
3979
|
__privateAdd(this, _widgets);
|
|
@@ -3940,6 +4022,13 @@ var FlowNode = class {
|
|
|
3940
4022
|
__privateSet(this, _canEditInfo, (config == null ? void 0 : config.canEditInfo) === void 0 ? false : config.canEditInfo);
|
|
3941
4023
|
__privateSet(this, _contextMenu2, (config == null ? void 0 : config.contextMenu) === void 0 ? null : config.contextMenu);
|
|
3942
4024
|
__privateSet(this, _metadata, config == null ? void 0 : config.metadata);
|
|
4025
|
+
__privateSet(this, _messages, []);
|
|
4026
|
+
if (config == null ? void 0 : config.messages) {
|
|
4027
|
+
for (let i = 0; i < config.messages.length; i++) {
|
|
4028
|
+
const message = config.messages[i];
|
|
4029
|
+
__privateGet(this, _messages).push(new MessageRenderer(message));
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
3943
4032
|
__privateSet(this, _selected, false);
|
|
3944
4033
|
__privateSet(this, _onSelect, new Array());
|
|
3945
4034
|
__privateSet(this, _onUnselect, new Array());
|
|
@@ -4432,6 +4521,12 @@ var FlowNode = class {
|
|
|
4432
4521
|
outputs() {
|
|
4433
4522
|
return __privateGet(this, _output).length;
|
|
4434
4523
|
}
|
|
4524
|
+
addMessage(message) {
|
|
4525
|
+
__privateGet(this, _messages).push(new MessageRenderer(message));
|
|
4526
|
+
}
|
|
4527
|
+
clearMessages() {
|
|
4528
|
+
__privateSet(this, _messages, []);
|
|
4529
|
+
}
|
|
4435
4530
|
render(ctx, camera, state, mousePosition, postProcess) {
|
|
4436
4531
|
VectorPool.run(() => {
|
|
4437
4532
|
const tempMeasurement = VectorPool.get();
|
|
@@ -4559,6 +4654,13 @@ var FlowNode = class {
|
|
|
4559
4654
|
__privateGet(this, _widgetPositions).Push(widget.Draw(ctx, position, camera.zoom, mousePosition));
|
|
4560
4655
|
startY += widgetSize.y * camera.zoom + scaledElementSpacing;
|
|
4561
4656
|
}
|
|
4657
|
+
const messageStart = VectorPool.get();
|
|
4658
|
+
messageStart.x = nodeBounds.Position.x + nodeBounds.Size.x / 2;
|
|
4659
|
+
messageStart.y = nodeBounds.Position.y + nodeBounds.Size.y + 15 * camera.zoom;
|
|
4660
|
+
for (let i = 0; i < __privateGet(this, _messages).length; i++) {
|
|
4661
|
+
const message = __privateGet(this, _messages)[i];
|
|
4662
|
+
messageStart.y += message.render(ctx, camera.zoom, messageStart) + 10 * camera.zoom;
|
|
4663
|
+
}
|
|
4562
4664
|
});
|
|
4563
4665
|
}
|
|
4564
4666
|
};
|
|
@@ -4567,6 +4669,7 @@ _title2 = new WeakMap();
|
|
|
4567
4669
|
_subTitle = new WeakMap();
|
|
4568
4670
|
_infoSymbol = new WeakMap();
|
|
4569
4671
|
_infoText = new WeakMap();
|
|
4672
|
+
_messages = new WeakMap();
|
|
4570
4673
|
_input = new WeakMap();
|
|
4571
4674
|
_output = new WeakMap();
|
|
4572
4675
|
_widgets = new WeakMap();
|
|
@@ -4885,15 +4988,15 @@ text_fn = function() {
|
|
|
4885
4988
|
};
|
|
4886
4989
|
|
|
4887
4990
|
// src/markdown/entry.ts
|
|
4888
|
-
var
|
|
4991
|
+
var _text8, _calculatedPositions, _calculatedEntries, _calculatedForWidth, _CodeBlockEntry_instances, calculateLayout_fn;
|
|
4889
4992
|
var CodeBlockEntry = class {
|
|
4890
4993
|
constructor(text) {
|
|
4891
4994
|
__privateAdd(this, _CodeBlockEntry_instances);
|
|
4892
|
-
__privateAdd(this,
|
|
4995
|
+
__privateAdd(this, _text8);
|
|
4893
4996
|
__privateAdd(this, _calculatedPositions);
|
|
4894
4997
|
__privateAdd(this, _calculatedEntries);
|
|
4895
4998
|
__privateAdd(this, _calculatedForWidth);
|
|
4896
|
-
__privateSet(this,
|
|
4999
|
+
__privateSet(this, _text8, text);
|
|
4897
5000
|
__privateSet(this, _calculatedForWidth, -1);
|
|
4898
5001
|
__privateSet(this, _calculatedEntries, new List());
|
|
4899
5002
|
__privateSet(this, _calculatedPositions, new List());
|
|
@@ -4932,7 +5035,7 @@ var CodeBlockEntry = class {
|
|
|
4932
5035
|
return max + padding * 2;
|
|
4933
5036
|
}
|
|
4934
5037
|
};
|
|
4935
|
-
|
|
5038
|
+
_text8 = new WeakMap();
|
|
4936
5039
|
_calculatedPositions = new WeakMap();
|
|
4937
5040
|
_calculatedEntries = new WeakMap();
|
|
4938
5041
|
_calculatedForWidth = new WeakMap();
|
|
@@ -4946,8 +5049,8 @@ calculateLayout_fn = function(ctx, maxWidth) {
|
|
|
4946
5049
|
__privateGet(this, _calculatedEntries).Clear();
|
|
4947
5050
|
__privateGet(this, _calculatedPositions).Clear();
|
|
4948
5051
|
let curHeight = 0;
|
|
4949
|
-
const lineInc = __privateGet(this,
|
|
4950
|
-
let entries = __privateGet(this,
|
|
5052
|
+
const lineInc = __privateGet(this, _text8).style().getSize() + Theme.Note.LineSpacing;
|
|
5053
|
+
let entries = __privateGet(this, _text8).split("\n");
|
|
4951
5054
|
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
4952
5055
|
const entry = entries[entryIndex];
|
|
4953
5056
|
let lines = entry.breakIntoLines(ctx, adjustedWith);
|
|
@@ -5844,11 +5947,11 @@ var PassSubsystem = class {
|
|
|
5844
5947
|
_queue = new WeakMap();
|
|
5845
5948
|
|
|
5846
5949
|
// src/quickMenu.ts
|
|
5847
|
-
var
|
|
5950
|
+
var _text9;
|
|
5848
5951
|
var QuickMenuGroup = class {
|
|
5849
5952
|
constructor(text, items) {
|
|
5850
|
-
__privateAdd(this,
|
|
5851
|
-
__privateSet(this,
|
|
5953
|
+
__privateAdd(this, _text9);
|
|
5954
|
+
__privateSet(this, _text9, text);
|
|
5852
5955
|
this.items = items;
|
|
5853
5956
|
}
|
|
5854
5957
|
updateRendering(terms) {
|
|
@@ -5860,18 +5963,18 @@ var QuickMenuGroup = class {
|
|
|
5860
5963
|
shouldRender = true;
|
|
5861
5964
|
}
|
|
5862
5965
|
}
|
|
5863
|
-
__privateGet(this,
|
|
5966
|
+
__privateGet(this, _text9).setDisplay(shouldRender ? "flex" /* Flex */ : "none" /* None */);
|
|
5864
5967
|
}
|
|
5865
5968
|
};
|
|
5866
|
-
|
|
5867
|
-
var _searchText,
|
|
5969
|
+
_text9 = new WeakMap();
|
|
5970
|
+
var _searchText, _text10, _context;
|
|
5868
5971
|
var QuickMenuItem = class {
|
|
5869
5972
|
constructor(searchText, text, context) {
|
|
5870
5973
|
__privateAdd(this, _searchText);
|
|
5871
|
-
__privateAdd(this,
|
|
5974
|
+
__privateAdd(this, _text10);
|
|
5872
5975
|
__privateAdd(this, _context);
|
|
5873
5976
|
__privateSet(this, _searchText, searchText.toLowerCase());
|
|
5874
|
-
__privateSet(this,
|
|
5977
|
+
__privateSet(this, _text10, text);
|
|
5875
5978
|
__privateSet(this, _context, context);
|
|
5876
5979
|
}
|
|
5877
5980
|
filter(terms) {
|
|
@@ -5889,13 +5992,13 @@ var QuickMenuItem = class {
|
|
|
5889
5992
|
return true;
|
|
5890
5993
|
}
|
|
5891
5994
|
render(render) {
|
|
5892
|
-
__privateGet(this,
|
|
5995
|
+
__privateGet(this, _text10).setDisplay(render ? "flex" /* Flex */ : "none" /* None */);
|
|
5893
5996
|
}
|
|
5894
5997
|
rendering() {
|
|
5895
|
-
return __privateGet(this,
|
|
5998
|
+
return __privateGet(this, _text10).getDisplay() === "flex" /* Flex */;
|
|
5896
5999
|
}
|
|
5897
6000
|
highlight(highlight) {
|
|
5898
|
-
__privateGet(this,
|
|
6001
|
+
__privateGet(this, _text10).setBackgroundColor(highlight ? Theme.ContextMenu.HighlightColor : "");
|
|
5899
6002
|
}
|
|
5900
6003
|
select() {
|
|
5901
6004
|
if (__privateGet(this, _context).callback) {
|
|
@@ -5904,7 +6007,7 @@ var QuickMenuItem = class {
|
|
|
5904
6007
|
}
|
|
5905
6008
|
};
|
|
5906
6009
|
_searchText = new WeakMap();
|
|
5907
|
-
|
|
6010
|
+
_text10 = new WeakMap();
|
|
5908
6011
|
_context = new WeakMap();
|
|
5909
6012
|
function RecurseBuildContainers(path, config, renderElements, groups) {
|
|
5910
6013
|
var _a, _b, _c;
|
|
@@ -6523,6 +6626,7 @@ renderQuickMenu_fn = function() {
|
|
|
6523
6626
|
FlowNote,
|
|
6524
6627
|
GlobalWidgetFactory,
|
|
6525
6628
|
ImageWidget,
|
|
6629
|
+
MessageType,
|
|
6526
6630
|
NodeFlowGraph,
|
|
6527
6631
|
NodeState,
|
|
6528
6632
|
NumberWidget,
|