@elicdavis/node-flow 0.1.8 → 0.1.10
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 +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +141 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -31
- package/dist/index.mjs.map +1 -1
- package/index.html +14 -0
- package/package.json +1 -1
- package/src/graph.ts +1 -1
- package/src/node.ts +87 -2
- 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,23 @@ 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
|
+
alwaysShow?: boolean;
|
|
228
|
+
color?: string;
|
|
229
|
+
}
|
|
219
230
|
interface FlowNodeConfig {
|
|
220
231
|
position?: Vector2;
|
|
221
232
|
title?: string;
|
|
222
233
|
subTitle?: string;
|
|
223
234
|
info?: string;
|
|
235
|
+
messages?: Array<NodeMessageConfig>;
|
|
224
236
|
locked?: boolean;
|
|
225
237
|
data?: Metadata;
|
|
226
238
|
contextMenu?: ContextMenuConfig;
|
|
@@ -298,6 +310,8 @@ declare class FlowNode {
|
|
|
298
310
|
outputPortPosition(index: number): Box;
|
|
299
311
|
outputPort(index: number): Port;
|
|
300
312
|
outputs(): number;
|
|
313
|
+
addMessage(message: NodeMessageConfig): void;
|
|
314
|
+
clearMessages(): void;
|
|
301
315
|
render(ctx: CanvasRenderingContext2D, camera: Camera, state: NodeState, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): void;
|
|
302
316
|
}
|
|
303
317
|
|
|
@@ -503,6 +517,11 @@ declare const Theme: {
|
|
|
503
517
|
Port: {
|
|
504
518
|
FontColor: string;
|
|
505
519
|
};
|
|
520
|
+
Message: {
|
|
521
|
+
InfoColor: string;
|
|
522
|
+
WarnColor: string;
|
|
523
|
+
ErrorColor: string;
|
|
524
|
+
};
|
|
506
525
|
};
|
|
507
526
|
BoxSelect: {
|
|
508
527
|
Color: string;
|
|
@@ -762,4 +781,4 @@ declare class WidgetFactory {
|
|
|
762
781
|
}
|
|
763
782
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
764
783
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,11 +216,23 @@ 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
|
+
alwaysShow?: boolean;
|
|
228
|
+
color?: string;
|
|
229
|
+
}
|
|
219
230
|
interface FlowNodeConfig {
|
|
220
231
|
position?: Vector2;
|
|
221
232
|
title?: string;
|
|
222
233
|
subTitle?: string;
|
|
223
234
|
info?: string;
|
|
235
|
+
messages?: Array<NodeMessageConfig>;
|
|
224
236
|
locked?: boolean;
|
|
225
237
|
data?: Metadata;
|
|
226
238
|
contextMenu?: ContextMenuConfig;
|
|
@@ -298,6 +310,8 @@ declare class FlowNode {
|
|
|
298
310
|
outputPortPosition(index: number): Box;
|
|
299
311
|
outputPort(index: number): Port;
|
|
300
312
|
outputs(): number;
|
|
313
|
+
addMessage(message: NodeMessageConfig): void;
|
|
314
|
+
clearMessages(): void;
|
|
301
315
|
render(ctx: CanvasRenderingContext2D, camera: Camera, state: NodeState, mousePosition: Vector2 | undefined, postProcess: PassSubsystem): void;
|
|
302
316
|
}
|
|
303
317
|
|
|
@@ -503,6 +517,11 @@ declare const Theme: {
|
|
|
503
517
|
Port: {
|
|
504
518
|
FontColor: string;
|
|
505
519
|
};
|
|
520
|
+
Message: {
|
|
521
|
+
InfoColor: string;
|
|
522
|
+
WarnColor: string;
|
|
523
|
+
ErrorColor: string;
|
|
524
|
+
};
|
|
506
525
|
};
|
|
507
526
|
BoxSelect: {
|
|
508
527
|
Color: string;
|
|
@@ -762,4 +781,4 @@ declare class WidgetFactory {
|
|
|
762
781
|
}
|
|
763
782
|
declare const GlobalWidgetFactory: WidgetFactory;
|
|
764
783
|
|
|
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 };
|
|
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 };
|
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,59 @@ 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, _alwaysShow;
|
|
3946
|
+
var MessageRenderer = class {
|
|
3947
|
+
constructor(config) {
|
|
3948
|
+
__privateAdd(this, _text7);
|
|
3949
|
+
__privateAdd(this, _alwaysShow);
|
|
3950
|
+
__privateSet(this, _alwaysShow, config.alwaysShow ? config.alwaysShow : false);
|
|
3951
|
+
__privateSet(this, _text7, new Text(
|
|
3952
|
+
config.message,
|
|
3953
|
+
{
|
|
3954
|
+
color: config.color ? config.color : MessageTypeColor(config.type ? config.type : "info" /* Info */)
|
|
3955
|
+
},
|
|
3956
|
+
{
|
|
3957
|
+
LineSpacing: 2.5,
|
|
3958
|
+
MaxWidth: 200
|
|
3959
|
+
}
|
|
3960
|
+
));
|
|
3961
|
+
}
|
|
3962
|
+
render(ctx, scale, position, hovering) {
|
|
3963
|
+
if (!__privateGet(this, _alwaysShow) && !hovering) {
|
|
3964
|
+
return 0;
|
|
3965
|
+
}
|
|
3966
|
+
ctx.textAlign = "center" /* Center */;
|
|
3967
|
+
__privateGet(this, _text7).render(ctx, scale, position);
|
|
3968
|
+
return __privateGet(this, _text7).height(ctx) * scale;
|
|
3969
|
+
}
|
|
3970
|
+
};
|
|
3971
|
+
_text7 = new WeakMap();
|
|
3972
|
+
_alwaysShow = new WeakMap();
|
|
3973
|
+
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
3974
|
var FlowNode = class {
|
|
3888
3975
|
constructor(config) {
|
|
3889
3976
|
__privateAdd(this, _FlowNode_instances);
|
|
@@ -3892,6 +3979,7 @@ var FlowNode = class {
|
|
|
3892
3979
|
__privateAdd(this, _subTitle);
|
|
3893
3980
|
__privateAdd(this, _infoSymbol);
|
|
3894
3981
|
__privateAdd(this, _infoText);
|
|
3982
|
+
__privateAdd(this, _messages);
|
|
3895
3983
|
__privateAdd(this, _input);
|
|
3896
3984
|
__privateAdd(this, _output);
|
|
3897
3985
|
__privateAdd(this, _widgets);
|
|
@@ -3940,6 +4028,13 @@ var FlowNode = class {
|
|
|
3940
4028
|
__privateSet(this, _canEditInfo, (config == null ? void 0 : config.canEditInfo) === void 0 ? false : config.canEditInfo);
|
|
3941
4029
|
__privateSet(this, _contextMenu2, (config == null ? void 0 : config.contextMenu) === void 0 ? null : config.contextMenu);
|
|
3942
4030
|
__privateSet(this, _metadata, config == null ? void 0 : config.metadata);
|
|
4031
|
+
__privateSet(this, _messages, []);
|
|
4032
|
+
if (config == null ? void 0 : config.messages) {
|
|
4033
|
+
for (let i = 0; i < config.messages.length; i++) {
|
|
4034
|
+
const message = config.messages[i];
|
|
4035
|
+
__privateGet(this, _messages).push(new MessageRenderer(message));
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
3943
4038
|
__privateSet(this, _selected, false);
|
|
3944
4039
|
__privateSet(this, _onSelect, new Array());
|
|
3945
4040
|
__privateSet(this, _onUnselect, new Array());
|
|
@@ -4432,6 +4527,12 @@ var FlowNode = class {
|
|
|
4432
4527
|
outputs() {
|
|
4433
4528
|
return __privateGet(this, _output).length;
|
|
4434
4529
|
}
|
|
4530
|
+
addMessage(message) {
|
|
4531
|
+
__privateGet(this, _messages).push(new MessageRenderer(message));
|
|
4532
|
+
}
|
|
4533
|
+
clearMessages() {
|
|
4534
|
+
__privateSet(this, _messages, []);
|
|
4535
|
+
}
|
|
4435
4536
|
render(ctx, camera, state, mousePosition, postProcess) {
|
|
4436
4537
|
VectorPool.run(() => {
|
|
4437
4538
|
const tempMeasurement = VectorPool.get();
|
|
@@ -4559,6 +4660,13 @@ var FlowNode = class {
|
|
|
4559
4660
|
__privateGet(this, _widgetPositions).Push(widget.Draw(ctx, position, camera.zoom, mousePosition));
|
|
4560
4661
|
startY += widgetSize.y * camera.zoom + scaledElementSpacing;
|
|
4561
4662
|
}
|
|
4663
|
+
const messageStart = VectorPool.get();
|
|
4664
|
+
messageStart.x = nodeBounds.Position.x + nodeBounds.Size.x / 2;
|
|
4665
|
+
messageStart.y = nodeBounds.Position.y + nodeBounds.Size.y + 15 * camera.zoom;
|
|
4666
|
+
for (let i = 0; i < __privateGet(this, _messages).length; i++) {
|
|
4667
|
+
const message = __privateGet(this, _messages)[i];
|
|
4668
|
+
messageStart.y += message.render(ctx, camera.zoom, messageStart, !(state === 0 /* Idle */)) + 10 * camera.zoom;
|
|
4669
|
+
}
|
|
4562
4670
|
});
|
|
4563
4671
|
}
|
|
4564
4672
|
};
|
|
@@ -4567,6 +4675,7 @@ _title2 = new WeakMap();
|
|
|
4567
4675
|
_subTitle = new WeakMap();
|
|
4568
4676
|
_infoSymbol = new WeakMap();
|
|
4569
4677
|
_infoText = new WeakMap();
|
|
4678
|
+
_messages = new WeakMap();
|
|
4570
4679
|
_input = new WeakMap();
|
|
4571
4680
|
_output = new WeakMap();
|
|
4572
4681
|
_widgets = new WeakMap();
|
|
@@ -4885,15 +4994,15 @@ text_fn = function() {
|
|
|
4885
4994
|
};
|
|
4886
4995
|
|
|
4887
4996
|
// src/markdown/entry.ts
|
|
4888
|
-
var
|
|
4997
|
+
var _text8, _calculatedPositions, _calculatedEntries, _calculatedForWidth, _CodeBlockEntry_instances, calculateLayout_fn;
|
|
4889
4998
|
var CodeBlockEntry = class {
|
|
4890
4999
|
constructor(text) {
|
|
4891
5000
|
__privateAdd(this, _CodeBlockEntry_instances);
|
|
4892
|
-
__privateAdd(this,
|
|
5001
|
+
__privateAdd(this, _text8);
|
|
4893
5002
|
__privateAdd(this, _calculatedPositions);
|
|
4894
5003
|
__privateAdd(this, _calculatedEntries);
|
|
4895
5004
|
__privateAdd(this, _calculatedForWidth);
|
|
4896
|
-
__privateSet(this,
|
|
5005
|
+
__privateSet(this, _text8, text);
|
|
4897
5006
|
__privateSet(this, _calculatedForWidth, -1);
|
|
4898
5007
|
__privateSet(this, _calculatedEntries, new List());
|
|
4899
5008
|
__privateSet(this, _calculatedPositions, new List());
|
|
@@ -4932,7 +5041,7 @@ var CodeBlockEntry = class {
|
|
|
4932
5041
|
return max + padding * 2;
|
|
4933
5042
|
}
|
|
4934
5043
|
};
|
|
4935
|
-
|
|
5044
|
+
_text8 = new WeakMap();
|
|
4936
5045
|
_calculatedPositions = new WeakMap();
|
|
4937
5046
|
_calculatedEntries = new WeakMap();
|
|
4938
5047
|
_calculatedForWidth = new WeakMap();
|
|
@@ -4946,8 +5055,8 @@ calculateLayout_fn = function(ctx, maxWidth) {
|
|
|
4946
5055
|
__privateGet(this, _calculatedEntries).Clear();
|
|
4947
5056
|
__privateGet(this, _calculatedPositions).Clear();
|
|
4948
5057
|
let curHeight = 0;
|
|
4949
|
-
const lineInc = __privateGet(this,
|
|
4950
|
-
let entries = __privateGet(this,
|
|
5058
|
+
const lineInc = __privateGet(this, _text8).style().getSize() + Theme.Note.LineSpacing;
|
|
5059
|
+
let entries = __privateGet(this, _text8).split("\n");
|
|
4951
5060
|
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
4952
5061
|
const entry = entries[entryIndex];
|
|
4953
5062
|
let lines = entry.breakIntoLines(ctx, adjustedWith);
|
|
@@ -5844,11 +5953,11 @@ var PassSubsystem = class {
|
|
|
5844
5953
|
_queue = new WeakMap();
|
|
5845
5954
|
|
|
5846
5955
|
// src/quickMenu.ts
|
|
5847
|
-
var
|
|
5956
|
+
var _text9;
|
|
5848
5957
|
var QuickMenuGroup = class {
|
|
5849
5958
|
constructor(text, items) {
|
|
5850
|
-
__privateAdd(this,
|
|
5851
|
-
__privateSet(this,
|
|
5959
|
+
__privateAdd(this, _text9);
|
|
5960
|
+
__privateSet(this, _text9, text);
|
|
5852
5961
|
this.items = items;
|
|
5853
5962
|
}
|
|
5854
5963
|
updateRendering(terms) {
|
|
@@ -5860,18 +5969,18 @@ var QuickMenuGroup = class {
|
|
|
5860
5969
|
shouldRender = true;
|
|
5861
5970
|
}
|
|
5862
5971
|
}
|
|
5863
|
-
__privateGet(this,
|
|
5972
|
+
__privateGet(this, _text9).setDisplay(shouldRender ? "flex" /* Flex */ : "none" /* None */);
|
|
5864
5973
|
}
|
|
5865
5974
|
};
|
|
5866
|
-
|
|
5867
|
-
var _searchText,
|
|
5975
|
+
_text9 = new WeakMap();
|
|
5976
|
+
var _searchText, _text10, _context;
|
|
5868
5977
|
var QuickMenuItem = class {
|
|
5869
5978
|
constructor(searchText, text, context) {
|
|
5870
5979
|
__privateAdd(this, _searchText);
|
|
5871
|
-
__privateAdd(this,
|
|
5980
|
+
__privateAdd(this, _text10);
|
|
5872
5981
|
__privateAdd(this, _context);
|
|
5873
5982
|
__privateSet(this, _searchText, searchText.toLowerCase());
|
|
5874
|
-
__privateSet(this,
|
|
5983
|
+
__privateSet(this, _text10, text);
|
|
5875
5984
|
__privateSet(this, _context, context);
|
|
5876
5985
|
}
|
|
5877
5986
|
filter(terms) {
|
|
@@ -5889,13 +5998,13 @@ var QuickMenuItem = class {
|
|
|
5889
5998
|
return true;
|
|
5890
5999
|
}
|
|
5891
6000
|
render(render) {
|
|
5892
|
-
__privateGet(this,
|
|
6001
|
+
__privateGet(this, _text10).setDisplay(render ? "flex" /* Flex */ : "none" /* None */);
|
|
5893
6002
|
}
|
|
5894
6003
|
rendering() {
|
|
5895
|
-
return __privateGet(this,
|
|
6004
|
+
return __privateGet(this, _text10).getDisplay() === "flex" /* Flex */;
|
|
5896
6005
|
}
|
|
5897
6006
|
highlight(highlight) {
|
|
5898
|
-
__privateGet(this,
|
|
6007
|
+
__privateGet(this, _text10).setBackgroundColor(highlight ? Theme.ContextMenu.HighlightColor : "");
|
|
5899
6008
|
}
|
|
5900
6009
|
select() {
|
|
5901
6010
|
if (__privateGet(this, _context).callback) {
|
|
@@ -5904,7 +6013,7 @@ var QuickMenuItem = class {
|
|
|
5904
6013
|
}
|
|
5905
6014
|
};
|
|
5906
6015
|
_searchText = new WeakMap();
|
|
5907
|
-
|
|
6016
|
+
_text10 = new WeakMap();
|
|
5908
6017
|
_context = new WeakMap();
|
|
5909
6018
|
function RecurseBuildContainers(path, config, renderElements, groups) {
|
|
5910
6019
|
var _a, _b, _c;
|
|
@@ -6523,6 +6632,7 @@ renderQuickMenu_fn = function() {
|
|
|
6523
6632
|
FlowNote,
|
|
6524
6633
|
GlobalWidgetFactory,
|
|
6525
6634
|
ImageWidget,
|
|
6635
|
+
MessageType,
|
|
6526
6636
|
NodeFlowGraph,
|
|
6527
6637
|
NodeState,
|
|
6528
6638
|
NumberWidget,
|