@elicdavis/node-flow 0.1.7 → 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 +143 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +141 -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/index.ts +2 -4
- 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, FlowNote, GlobalWidgetFactory, ImageWidget, NodeFlowGraph, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, Theme, ToggleWidget };
|
|
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, FlowNote, GlobalWidgetFactory, ImageWidget, NodeFlowGraph, NumberWidget, Publisher, type PublisherConfig, SliderWidget, StringWidget, Theme, ToggleWidget };
|
|
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,7 +42,9 @@ __export(index_exports, {
|
|
|
42
42
|
FlowNote: () => FlowNote,
|
|
43
43
|
GlobalWidgetFactory: () => GlobalWidgetFactory,
|
|
44
44
|
ImageWidget: () => ImageWidget,
|
|
45
|
+
MessageType: () => MessageType,
|
|
45
46
|
NodeFlowGraph: () => NodeFlowGraph,
|
|
47
|
+
NodeState: () => NodeState,
|
|
46
48
|
NumberWidget: () => NumberWidget,
|
|
47
49
|
Publisher: () => Publisher,
|
|
48
50
|
SliderWidget: () => SliderWidget,
|
|
@@ -75,6 +77,11 @@ var Theme = {
|
|
|
75
77
|
},
|
|
76
78
|
Port: {
|
|
77
79
|
FontColor: "#afb9bb"
|
|
80
|
+
},
|
|
81
|
+
Message: {
|
|
82
|
+
InfoColor: "#afb9bb",
|
|
83
|
+
WarnColor: "#f1f663ff",
|
|
84
|
+
ErrorColor: "#FF0000"
|
|
78
85
|
}
|
|
79
86
|
},
|
|
80
87
|
BoxSelect: {
|
|
@@ -1174,18 +1181,24 @@ function splitStringIntoLines(ctx, str, maxWidth) {
|
|
|
1174
1181
|
}
|
|
1175
1182
|
|
|
1176
1183
|
// src/types/text.ts
|
|
1177
|
-
var _measured, _size2, _style, _value, _Text_instances, measure_fn;
|
|
1184
|
+
var _measured, _size2, _style, _value, _maxWidth2, _lineSpacing, _textToRender, _Text_instances, measure_fn;
|
|
1178
1185
|
var _Text = class _Text {
|
|
1179
|
-
constructor(value, style) {
|
|
1186
|
+
constructor(value, style, config) {
|
|
1180
1187
|
__privateAdd(this, _Text_instances);
|
|
1181
1188
|
__privateAdd(this, _measured);
|
|
1182
1189
|
__privateAdd(this, _size2);
|
|
1183
1190
|
__privateAdd(this, _style);
|
|
1184
1191
|
__privateAdd(this, _value);
|
|
1192
|
+
__privateAdd(this, _maxWidth2);
|
|
1193
|
+
__privateAdd(this, _lineSpacing);
|
|
1194
|
+
__privateAdd(this, _textToRender);
|
|
1185
1195
|
__privateSet(this, _value, value);
|
|
1186
1196
|
__privateSet(this, _measured, false);
|
|
1187
1197
|
__privateSet(this, _size2, Zero());
|
|
1188
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]);
|
|
1189
1202
|
if (!document.fonts.check(`16px "${__privateGet(this, _style).getFont()}"`)) {
|
|
1190
1203
|
document.fonts.addEventListener("loadingdone", (event) => {
|
|
1191
1204
|
__privateSet(this, _measured, false);
|
|
@@ -1252,6 +1265,10 @@ var _Text = class _Text {
|
|
|
1252
1265
|
CopyVector2(out, __privateGet(this, _size2));
|
|
1253
1266
|
ScaleVector(out, scale);
|
|
1254
1267
|
}
|
|
1268
|
+
height(ctx) {
|
|
1269
|
+
__privateMethod(this, _Text_instances, measure_fn).call(this, ctx);
|
|
1270
|
+
return __privateGet(this, _size2).y;
|
|
1271
|
+
}
|
|
1255
1272
|
setColor(color) {
|
|
1256
1273
|
__privateGet(this, _style).setColor(color);
|
|
1257
1274
|
}
|
|
@@ -1265,8 +1282,17 @@ var _Text = class _Text {
|
|
|
1265
1282
|
__privateGet(this, _style).setWeight(weight);
|
|
1266
1283
|
}
|
|
1267
1284
|
render(ctx, scale, position) {
|
|
1285
|
+
__privateMethod(this, _Text_instances, measure_fn).call(this, ctx);
|
|
1268
1286
|
__privateGet(this, _style).setupStyle(ctx, scale);
|
|
1269
|
-
|
|
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
|
+
}
|
|
1270
1296
|
}
|
|
1271
1297
|
style() {
|
|
1272
1298
|
return __privateGet(this, _style);
|
|
@@ -1276,15 +1302,31 @@ _measured = new WeakMap();
|
|
|
1276
1302
|
_size2 = new WeakMap();
|
|
1277
1303
|
_style = new WeakMap();
|
|
1278
1304
|
_value = new WeakMap();
|
|
1305
|
+
_maxWidth2 = new WeakMap();
|
|
1306
|
+
_lineSpacing = new WeakMap();
|
|
1307
|
+
_textToRender = new WeakMap();
|
|
1279
1308
|
_Text_instances = new WeakSet();
|
|
1280
1309
|
measure_fn = function(ctx) {
|
|
1281
1310
|
if (__privateGet(this, _measured)) {
|
|
1282
1311
|
return;
|
|
1283
1312
|
}
|
|
1284
1313
|
__privateGet(this, _style).setupStyle(ctx, 1);
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
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;
|
|
1288
1330
|
__privateSet(this, _measured, true);
|
|
1289
1331
|
};
|
|
1290
1332
|
var Text = _Text;
|
|
@@ -2552,14 +2594,14 @@ _disabledStyle = new WeakMap();
|
|
|
2552
2594
|
_callback6 = new WeakMap();
|
|
2553
2595
|
|
|
2554
2596
|
// src/widgets/image.ts
|
|
2555
|
-
var _url, _image,
|
|
2597
|
+
var _url, _image, _maxWidth3, _maxHeight2;
|
|
2556
2598
|
var ImageWidget = class {
|
|
2557
2599
|
constructor(config) {
|
|
2558
2600
|
__privateAdd(this, _url);
|
|
2559
2601
|
__privateAdd(this, _image);
|
|
2560
|
-
__privateAdd(this,
|
|
2602
|
+
__privateAdd(this, _maxWidth3);
|
|
2561
2603
|
__privateAdd(this, _maxHeight2);
|
|
2562
|
-
__privateSet(this,
|
|
2604
|
+
__privateSet(this, _maxWidth3, (config == null ? void 0 : config.maxWidth) === void 0 ? 150 : config == null ? void 0 : config.maxWidth);
|
|
2563
2605
|
__privateSet(this, _maxHeight2, (config == null ? void 0 : config.maxHeight) === void 0 ? 150 : config == null ? void 0 : config.maxHeight);
|
|
2564
2606
|
if (config == null ? void 0 : config.image) {
|
|
2565
2607
|
this.SetUrl(config == null ? void 0 : config.image);
|
|
@@ -2589,8 +2631,8 @@ var ImageWidget = class {
|
|
|
2589
2631
|
return { "x": 0, "y": 0 };
|
|
2590
2632
|
}
|
|
2591
2633
|
let adjust = 1;
|
|
2592
|
-
if (__privateGet(this, _image).width > __privateGet(this,
|
|
2593
|
-
adjust = __privateGet(this,
|
|
2634
|
+
if (__privateGet(this, _image).width > __privateGet(this, _maxWidth3)) {
|
|
2635
|
+
adjust = __privateGet(this, _maxWidth3) / __privateGet(this, _image).width;
|
|
2594
2636
|
}
|
|
2595
2637
|
if (__privateGet(this, _image).height > __privateGet(this, _maxHeight2)) {
|
|
2596
2638
|
let heightAdjust = __privateGet(this, _maxHeight2) / __privateGet(this, _image).height;
|
|
@@ -2632,7 +2674,7 @@ var ImageWidget = class {
|
|
|
2632
2674
|
};
|
|
2633
2675
|
_url = new WeakMap();
|
|
2634
2676
|
_image = new WeakMap();
|
|
2635
|
-
|
|
2677
|
+
_maxWidth3 = new WeakMap();
|
|
2636
2678
|
_maxHeight2 = new WeakMap();
|
|
2637
2679
|
|
|
2638
2680
|
// src/widgets/text.ts
|
|
@@ -3876,7 +3918,53 @@ function FormPopup(config) {
|
|
|
3876
3918
|
|
|
3877
3919
|
// src/node.ts
|
|
3878
3920
|
var MINIMUM_NODE_WIDTH = 150;
|
|
3879
|
-
var
|
|
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
|
+
}
|
|
3939
|
+
var NodeState = /* @__PURE__ */ ((NodeState2) => {
|
|
3940
|
+
NodeState2[NodeState2["Idle"] = 0] = "Idle";
|
|
3941
|
+
NodeState2[NodeState2["MouseOver"] = 1] = "MouseOver";
|
|
3942
|
+
NodeState2[NodeState2["Grabbed"] = 2] = "Grabbed";
|
|
3943
|
+
return NodeState2;
|
|
3944
|
+
})(NodeState || {});
|
|
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;
|
|
3880
3968
|
var FlowNode = class {
|
|
3881
3969
|
constructor(config) {
|
|
3882
3970
|
__privateAdd(this, _FlowNode_instances);
|
|
@@ -3885,6 +3973,7 @@ var FlowNode = class {
|
|
|
3885
3973
|
__privateAdd(this, _subTitle);
|
|
3886
3974
|
__privateAdd(this, _infoSymbol);
|
|
3887
3975
|
__privateAdd(this, _infoText);
|
|
3976
|
+
__privateAdd(this, _messages);
|
|
3888
3977
|
__privateAdd(this, _input);
|
|
3889
3978
|
__privateAdd(this, _output);
|
|
3890
3979
|
__privateAdd(this, _widgets);
|
|
@@ -3933,6 +4022,13 @@ var FlowNode = class {
|
|
|
3933
4022
|
__privateSet(this, _canEditInfo, (config == null ? void 0 : config.canEditInfo) === void 0 ? false : config.canEditInfo);
|
|
3934
4023
|
__privateSet(this, _contextMenu2, (config == null ? void 0 : config.contextMenu) === void 0 ? null : config.contextMenu);
|
|
3935
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
|
+
}
|
|
3936
4032
|
__privateSet(this, _selected, false);
|
|
3937
4033
|
__privateSet(this, _onSelect, new Array());
|
|
3938
4034
|
__privateSet(this, _onUnselect, new Array());
|
|
@@ -4425,6 +4521,12 @@ var FlowNode = class {
|
|
|
4425
4521
|
outputs() {
|
|
4426
4522
|
return __privateGet(this, _output).length;
|
|
4427
4523
|
}
|
|
4524
|
+
addMessage(message) {
|
|
4525
|
+
__privateGet(this, _messages).push(new MessageRenderer(message));
|
|
4526
|
+
}
|
|
4527
|
+
clearMessages() {
|
|
4528
|
+
__privateSet(this, _messages, []);
|
|
4529
|
+
}
|
|
4428
4530
|
render(ctx, camera, state, mousePosition, postProcess) {
|
|
4429
4531
|
VectorPool.run(() => {
|
|
4430
4532
|
const tempMeasurement = VectorPool.get();
|
|
@@ -4552,6 +4654,13 @@ var FlowNode = class {
|
|
|
4552
4654
|
__privateGet(this, _widgetPositions).Push(widget.Draw(ctx, position, camera.zoom, mousePosition));
|
|
4553
4655
|
startY += widgetSize.y * camera.zoom + scaledElementSpacing;
|
|
4554
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
|
+
}
|
|
4555
4664
|
});
|
|
4556
4665
|
}
|
|
4557
4666
|
};
|
|
@@ -4560,6 +4669,7 @@ _title2 = new WeakMap();
|
|
|
4560
4669
|
_subTitle = new WeakMap();
|
|
4561
4670
|
_infoSymbol = new WeakMap();
|
|
4562
4671
|
_infoText = new WeakMap();
|
|
4672
|
+
_messages = new WeakMap();
|
|
4563
4673
|
_input = new WeakMap();
|
|
4564
4674
|
_output = new WeakMap();
|
|
4565
4675
|
_widgets = new WeakMap();
|
|
@@ -4878,15 +4988,15 @@ text_fn = function() {
|
|
|
4878
4988
|
};
|
|
4879
4989
|
|
|
4880
4990
|
// src/markdown/entry.ts
|
|
4881
|
-
var
|
|
4991
|
+
var _text8, _calculatedPositions, _calculatedEntries, _calculatedForWidth, _CodeBlockEntry_instances, calculateLayout_fn;
|
|
4882
4992
|
var CodeBlockEntry = class {
|
|
4883
4993
|
constructor(text) {
|
|
4884
4994
|
__privateAdd(this, _CodeBlockEntry_instances);
|
|
4885
|
-
__privateAdd(this,
|
|
4995
|
+
__privateAdd(this, _text8);
|
|
4886
4996
|
__privateAdd(this, _calculatedPositions);
|
|
4887
4997
|
__privateAdd(this, _calculatedEntries);
|
|
4888
4998
|
__privateAdd(this, _calculatedForWidth);
|
|
4889
|
-
__privateSet(this,
|
|
4999
|
+
__privateSet(this, _text8, text);
|
|
4890
5000
|
__privateSet(this, _calculatedForWidth, -1);
|
|
4891
5001
|
__privateSet(this, _calculatedEntries, new List());
|
|
4892
5002
|
__privateSet(this, _calculatedPositions, new List());
|
|
@@ -4925,7 +5035,7 @@ var CodeBlockEntry = class {
|
|
|
4925
5035
|
return max + padding * 2;
|
|
4926
5036
|
}
|
|
4927
5037
|
};
|
|
4928
|
-
|
|
5038
|
+
_text8 = new WeakMap();
|
|
4929
5039
|
_calculatedPositions = new WeakMap();
|
|
4930
5040
|
_calculatedEntries = new WeakMap();
|
|
4931
5041
|
_calculatedForWidth = new WeakMap();
|
|
@@ -4939,8 +5049,8 @@ calculateLayout_fn = function(ctx, maxWidth) {
|
|
|
4939
5049
|
__privateGet(this, _calculatedEntries).Clear();
|
|
4940
5050
|
__privateGet(this, _calculatedPositions).Clear();
|
|
4941
5051
|
let curHeight = 0;
|
|
4942
|
-
const lineInc = __privateGet(this,
|
|
4943
|
-
let entries = __privateGet(this,
|
|
5052
|
+
const lineInc = __privateGet(this, _text8).style().getSize() + Theme.Note.LineSpacing;
|
|
5053
|
+
let entries = __privateGet(this, _text8).split("\n");
|
|
4944
5054
|
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
4945
5055
|
const entry = entries[entryIndex];
|
|
4946
5056
|
let lines = entry.breakIntoLines(ctx, adjustedWith);
|
|
@@ -5837,11 +5947,11 @@ var PassSubsystem = class {
|
|
|
5837
5947
|
_queue = new WeakMap();
|
|
5838
5948
|
|
|
5839
5949
|
// src/quickMenu.ts
|
|
5840
|
-
var
|
|
5950
|
+
var _text9;
|
|
5841
5951
|
var QuickMenuGroup = class {
|
|
5842
5952
|
constructor(text, items) {
|
|
5843
|
-
__privateAdd(this,
|
|
5844
|
-
__privateSet(this,
|
|
5953
|
+
__privateAdd(this, _text9);
|
|
5954
|
+
__privateSet(this, _text9, text);
|
|
5845
5955
|
this.items = items;
|
|
5846
5956
|
}
|
|
5847
5957
|
updateRendering(terms) {
|
|
@@ -5853,18 +5963,18 @@ var QuickMenuGroup = class {
|
|
|
5853
5963
|
shouldRender = true;
|
|
5854
5964
|
}
|
|
5855
5965
|
}
|
|
5856
|
-
__privateGet(this,
|
|
5966
|
+
__privateGet(this, _text9).setDisplay(shouldRender ? "flex" /* Flex */ : "none" /* None */);
|
|
5857
5967
|
}
|
|
5858
5968
|
};
|
|
5859
|
-
|
|
5860
|
-
var _searchText,
|
|
5969
|
+
_text9 = new WeakMap();
|
|
5970
|
+
var _searchText, _text10, _context;
|
|
5861
5971
|
var QuickMenuItem = class {
|
|
5862
5972
|
constructor(searchText, text, context) {
|
|
5863
5973
|
__privateAdd(this, _searchText);
|
|
5864
|
-
__privateAdd(this,
|
|
5974
|
+
__privateAdd(this, _text10);
|
|
5865
5975
|
__privateAdd(this, _context);
|
|
5866
5976
|
__privateSet(this, _searchText, searchText.toLowerCase());
|
|
5867
|
-
__privateSet(this,
|
|
5977
|
+
__privateSet(this, _text10, text);
|
|
5868
5978
|
__privateSet(this, _context, context);
|
|
5869
5979
|
}
|
|
5870
5980
|
filter(terms) {
|
|
@@ -5882,13 +5992,13 @@ var QuickMenuItem = class {
|
|
|
5882
5992
|
return true;
|
|
5883
5993
|
}
|
|
5884
5994
|
render(render) {
|
|
5885
|
-
__privateGet(this,
|
|
5995
|
+
__privateGet(this, _text10).setDisplay(render ? "flex" /* Flex */ : "none" /* None */);
|
|
5886
5996
|
}
|
|
5887
5997
|
rendering() {
|
|
5888
|
-
return __privateGet(this,
|
|
5998
|
+
return __privateGet(this, _text10).getDisplay() === "flex" /* Flex */;
|
|
5889
5999
|
}
|
|
5890
6000
|
highlight(highlight) {
|
|
5891
|
-
__privateGet(this,
|
|
6001
|
+
__privateGet(this, _text10).setBackgroundColor(highlight ? Theme.ContextMenu.HighlightColor : "");
|
|
5892
6002
|
}
|
|
5893
6003
|
select() {
|
|
5894
6004
|
if (__privateGet(this, _context).callback) {
|
|
@@ -5897,7 +6007,7 @@ var QuickMenuItem = class {
|
|
|
5897
6007
|
}
|
|
5898
6008
|
};
|
|
5899
6009
|
_searchText = new WeakMap();
|
|
5900
|
-
|
|
6010
|
+
_text10 = new WeakMap();
|
|
5901
6011
|
_context = new WeakMap();
|
|
5902
6012
|
function RecurseBuildContainers(path, config, renderElements, groups) {
|
|
5903
6013
|
var _a, _b, _c;
|
|
@@ -6516,7 +6626,9 @@ renderQuickMenu_fn = function() {
|
|
|
6516
6626
|
FlowNote,
|
|
6517
6627
|
GlobalWidgetFactory,
|
|
6518
6628
|
ImageWidget,
|
|
6629
|
+
MessageType,
|
|
6519
6630
|
NodeFlowGraph,
|
|
6631
|
+
NodeState,
|
|
6520
6632
|
NumberWidget,
|
|
6521
6633
|
Publisher,
|
|
6522
6634
|
SliderWidget,
|