@babsey/code-graph 0.4.5 → 0.5.1
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/code-graph.js +407 -377
- package/dist/code-graph.umd.cjs +4 -4
- package/package.json +3 -3
package/dist/code-graph.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import ce from "mustache";
|
|
2
|
-
import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as P, markRaw as Y, computed as
|
|
2
|
+
import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as P, markRaw as Y, computed as G, createElementVNode as m, withDirectives as ke, vModelText as xe, createStaticVNode as fe, toRef as $e, ref as H, createVNode as L, unref as O, mergeModels as Be, useModel as Nt, resolveComponent as qe, createCommentVNode as j, onMounted as Se, onBeforeUnmount as Je, watch as Qe, createBlock as B, withCtx as ee, normalizeProps as Et, guardReactiveProps as Tt, renderSlot as q, mergeProps as Ot, onUpdated as Ze, normalizeStyle as Ge, normalizeClass as oe, withModifiers as de, Fragment as U, createTextVNode as et, withKeys as Oe, renderList as ae, nextTick as Mt, resolveDynamicComponent as He, inject as $t, Transition as St, shallowReadonly as Gt } from "vue";
|
|
3
3
|
import { v4 as re } from "uuid";
|
|
4
|
-
import { AbstractNode as
|
|
4
|
+
import { AbstractNode as Lt, NodeInterface as J, Graph as At, getGraphNodeTypeString as tt, GraphTemplate as Rt, GRAPH_NODE_TYPE_PREFIX as jt, GRAPH_INPUT_NODE_TYPE as Pt, GRAPH_OUTPUT_NODE_TYPE as Vt, Editor as Bt } from "@baklavajs/core";
|
|
5
5
|
import { NodeInterfaceType as ie, BaklavaInterfaceTypes as Ht, setType as V } from "@baklavajs/interface-types";
|
|
6
6
|
import { allowMultipleConnections as ue, BaseEngine as zt, sortTopologically as Ut, applyResult as nt } from "@baklavajs/engine";
|
|
7
|
-
import { displayInSidebar as ot, CheckboxInterfaceComponent as Dt, useGraph as
|
|
7
|
+
import { displayInSidebar as ot, CheckboxInterfaceComponent as Dt, useGraph as Le, IntegerInterfaceComponent as Ft, TextInputInterfaceComponent as st, NumberInterfaceComponent as Yt, SelectInterfaceComponent as Wt, SliderInterfaceComponent as Xt, TextareaInputInterfaceComponent as Kt, Commands as ne, DEFAULT_TOOLBAR_COMMANDS as qt, BaklavaEditor as Jt, Components as Me, useViewModel as me, useTemporaryConnection as Qt, useTransform as Zt, useNodeCategories as en, TextInputInterface as at, DEFAULT_SETTINGS as tn, useCommandHandler as nn, useHistory as on, useClipboard as sn, registerDeleteNodesCommand as an, registerSaveSubgraphCommand as rn, registerSwitchToMainGraphCommand as ln, registerSidebarCommands as dn, registerZoomToFitCommands as un, setViewNodeProperties as cn } from "@baklavajs/renderer-vue";
|
|
8
8
|
import pn from "toposort";
|
|
9
9
|
import { SequentialHook as ze } from "@baklavajs/events";
|
|
10
10
|
import { usePointer as hn } from "@vueuse/core";
|
|
11
11
|
ce.escape = (n) => n;
|
|
12
|
-
class rt extends
|
|
12
|
+
class rt extends Lt {
|
|
13
13
|
codeTemplate;
|
|
14
14
|
isCodeNode = !0;
|
|
15
15
|
mask = null;
|
|
@@ -93,8 +93,8 @@ class rt extends Gt {
|
|
|
93
93
|
* @returns code node instance or null
|
|
94
94
|
*/
|
|
95
95
|
getConnectedNodeByInterface(e, t) {
|
|
96
|
-
const
|
|
97
|
-
return
|
|
96
|
+
const o = this.getConnectedNodesByInterface(e, t);
|
|
97
|
+
return o.length > 0 ? o[0] : null;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Get connected nodes to the node.
|
|
@@ -104,14 +104,14 @@ class rt extends Gt {
|
|
|
104
104
|
getConnectedNodes(e) {
|
|
105
105
|
let t = [];
|
|
106
106
|
if (e !== "inputs") {
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const o = this.graph.connections.filter((s) => s.from.name !== "_code").filter((s) => s.from.nodeId === this.id).map((s) => s.to.nodeId);
|
|
108
|
+
o && (t = t.concat(o));
|
|
109
109
|
}
|
|
110
110
|
if (e !== "outputs") {
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
const o = this.graph.connections.filter((s) => s.from.name !== "_code").filter((s) => s.to.nodeId === this.id).map((s) => s.from.nodeId);
|
|
112
|
+
o && (t = t.concat(o));
|
|
113
113
|
}
|
|
114
|
-
return !t || t.length == 0 ? [] : t.map((
|
|
114
|
+
return !t || t.length == 0 ? [] : t.map((o) => this.graph.findNodeById(o));
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Get connected nodes to the node interface.
|
|
@@ -119,20 +119,26 @@ class rt extends Gt {
|
|
|
119
119
|
* @returns code node instances
|
|
120
120
|
*/
|
|
121
121
|
getConnectedNodesByInterface(e, t) {
|
|
122
|
-
let
|
|
122
|
+
let o = [];
|
|
123
123
|
if (t !== "outputs" && this.inputs[e]) {
|
|
124
|
-
const
|
|
124
|
+
const s = this.graph.connections.filter(
|
|
125
125
|
(a) => a.to.id === this.inputs[e]?.id || a.from.id === this.inputs[e]?.id
|
|
126
126
|
).map((a) => a.from.nodeId);
|
|
127
|
-
|
|
127
|
+
s && (o = o.concat(s));
|
|
128
128
|
}
|
|
129
129
|
if (t !== "inputs" && this.outputs[e]) {
|
|
130
|
-
const
|
|
130
|
+
const s = this.graph.connections.filter(
|
|
131
131
|
(a) => a.from.id === this.outputs[e]?.id || a.from.id === this.outputs[e]?.id
|
|
132
132
|
).map((a) => a.to.nodeId);
|
|
133
|
-
|
|
133
|
+
s && (o = o.concat(s));
|
|
134
134
|
}
|
|
135
|
-
return !
|
|
135
|
+
return !o || o.length == 0 ? [] : o.map((s) => this.graph.findNodeById(s));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Remove this node from the graph.
|
|
139
|
+
*/
|
|
140
|
+
remove() {
|
|
141
|
+
this.graph?.removeNode(this);
|
|
136
142
|
}
|
|
137
143
|
/**
|
|
138
144
|
* Render code of this node.
|
|
@@ -184,16 +190,16 @@ class rt extends Gt {
|
|
|
184
190
|
}
|
|
185
191
|
/**
|
|
186
192
|
* Update input values
|
|
187
|
-
* @param
|
|
193
|
+
* @param inputs input values
|
|
188
194
|
*/
|
|
189
195
|
updateInputValues(e) {
|
|
190
196
|
const t = Object.keys(this.inputs);
|
|
191
|
-
Object.keys(e).forEach((
|
|
192
|
-
!t.includes(
|
|
197
|
+
Object.keys(e).forEach((o) => {
|
|
198
|
+
!t.includes(o) || !this.inputs[o] || (this.inputs[o].value = e[o], this.inputs[o].setHidden(!1));
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
201
|
}
|
|
196
|
-
class
|
|
202
|
+
class Ae extends rt {
|
|
197
203
|
/**
|
|
198
204
|
* The default implementation does nothing.
|
|
199
205
|
* Overwrite this method to do calculation.
|
|
@@ -202,11 +208,11 @@ class Re extends rt {
|
|
|
202
208
|
* @return Values for output interfaces
|
|
203
209
|
*/
|
|
204
210
|
calculate = (e, t) => {
|
|
205
|
-
const
|
|
206
|
-
return this.lockCode || (
|
|
211
|
+
const o = {};
|
|
212
|
+
return this.lockCode || (o._code = this.renderCode({ inputs: e, ...t })), this.updateOutputValues(o), o;
|
|
207
213
|
};
|
|
208
214
|
load(e) {
|
|
209
|
-
super.load(e), it(this.graph, e);
|
|
215
|
+
super.load(e), it(this.graph, e), this.afterLoaded();
|
|
210
216
|
}
|
|
211
217
|
save() {
|
|
212
218
|
const e = super.save();
|
|
@@ -214,34 +220,34 @@ class Re extends rt {
|
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
222
|
const fn = (n, e = !0) => {
|
|
217
|
-
const t = [],
|
|
218
|
-
return
|
|
219
|
-
if (n[
|
|
220
|
-
const i = e && t.length <
|
|
221
|
-
t.push(`${i}{{ inputs.${
|
|
223
|
+
const t = [], o = Object.keys(n);
|
|
224
|
+
return o.forEach((s) => {
|
|
225
|
+
if (n[s]?.hidden) return;
|
|
226
|
+
const i = e && t.length < o.indexOf(s) ? `${s}=` : "";
|
|
227
|
+
t.push(`${i}{{ inputs.${s} }}`);
|
|
222
228
|
}), t;
|
|
223
229
|
}, it = (n, e) => {
|
|
224
230
|
if (!n) return;
|
|
225
231
|
const t = n.findNodeById(e.id);
|
|
226
232
|
if (!t || t.subgraph) return;
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}), Object.entries(e.outputs).forEach(([
|
|
231
|
-
|
|
233
|
+
const o = t;
|
|
234
|
+
o.state && (o.state.integrated = e.integrated, o.state.props = e.props), Object.entries(e.inputs).forEach(([s, a]) => {
|
|
235
|
+
s !== "_code" && o.inputs[s] && (o.inputs[s].hidden = a.hidden, o.inputs[s].state.optional = a.optional);
|
|
236
|
+
}), Object.entries(e.outputs).forEach(([s, a]) => {
|
|
237
|
+
s !== "_code" && o.outputs[s] && (o.outputs[s].hidden = a.hidden, o.outputs[s].state.optional = a.optional);
|
|
232
238
|
});
|
|
233
239
|
}, mn = (n, e) => {
|
|
234
240
|
if (!n) return;
|
|
235
241
|
const t = n.findNodeById(e.id);
|
|
236
242
|
if (!t || t.subgraph) return;
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
if (
|
|
240
|
-
const i =
|
|
241
|
-
a.hidden = i.hidden, i.component?.__name && (a.component = i.component.__name);
|
|
243
|
+
const o = t;
|
|
244
|
+
o.state && (e.integrated = o.state.integrated, o.state.props && (e.props = o.state.props)), Object.entries(e.inputs).forEach(([s, a]) => {
|
|
245
|
+
if (s !== "_code" && o.inputs[s]) {
|
|
246
|
+
const i = o.inputs[s];
|
|
247
|
+
a.hidden = i.hidden, a.optional = i.state.optional, i.component?.__name && (a.component = i.component.__name);
|
|
242
248
|
}
|
|
243
|
-
}), Object.entries(e.outputs).forEach(([
|
|
244
|
-
|
|
249
|
+
}), Object.entries(e.outputs).forEach(([s, a]) => {
|
|
250
|
+
s !== "_code" && o.outputs[s] && (a.hidden = o.outputs[s].hidden);
|
|
245
251
|
});
|
|
246
252
|
}, vn = (n, e) => {
|
|
247
253
|
switch (n) {
|
|
@@ -266,7 +272,7 @@ const fn = (n, e = !0) => {
|
|
|
266
272
|
default:
|
|
267
273
|
return new ft(e.id, e.value);
|
|
268
274
|
}
|
|
269
|
-
}, gn = ["title"],
|
|
275
|
+
}, gn = ["title"], Re = /* @__PURE__ */ F({
|
|
270
276
|
__name: "CodeNodeInterface",
|
|
271
277
|
props: {
|
|
272
278
|
intf: {}
|
|
@@ -283,7 +289,7 @@ class D extends J {
|
|
|
283
289
|
state;
|
|
284
290
|
type = null;
|
|
285
291
|
constructor(e, t) {
|
|
286
|
-
super(e, t), this.setComponent(Y(
|
|
292
|
+
super(e, t), this.setComponent(Y(Re)), this.state = te({
|
|
287
293
|
optional: !1
|
|
288
294
|
});
|
|
289
295
|
}
|
|
@@ -300,7 +306,7 @@ class D extends J {
|
|
|
300
306
|
}
|
|
301
307
|
class ve extends D {
|
|
302
308
|
constructor(e = "", t) {
|
|
303
|
-
super(e, t), this.setComponent(Y(
|
|
309
|
+
super(e, t), this.setComponent(Y(Re)), this.use(ot, !0);
|
|
304
310
|
}
|
|
305
311
|
get value() {
|
|
306
312
|
return super.value;
|
|
@@ -309,8 +315,8 @@ class ve extends D {
|
|
|
309
315
|
super.value = e, this.name !== "_code" && this.setHidden(!1);
|
|
310
316
|
}
|
|
311
317
|
}
|
|
312
|
-
const lt = new ie("boolean"), bn = new ie("dict"), dt = new ie("list"),
|
|
313
|
-
new Ht(n.editor, { viewPlugin: n }).addTypes(lt, bn, dt,
|
|
318
|
+
const lt = new ie("boolean"), bn = new ie("dict"), dt = new ie("list"), X = new ie("node"), ut = new ie("number"), ct = new ie("string"), pt = new ie("tuple"), la = (n) => {
|
|
319
|
+
new Ht(n.editor, { viewPlugin: n }).addTypes(lt, bn, dt, X, ut, ct, pt);
|
|
314
320
|
};
|
|
315
321
|
class yn extends ve {
|
|
316
322
|
constructor(e, t) {
|
|
@@ -322,27 +328,27 @@ class _n extends D {
|
|
|
322
328
|
isCodeNodeOutput = !0;
|
|
323
329
|
suffix = "";
|
|
324
330
|
constructor(e = "", t = "") {
|
|
325
|
-
super(e, ""), this.suffix = t, this.setComponent(Y(
|
|
331
|
+
super(e, ""), this.suffix = t, this.setComponent(Y(Re));
|
|
326
332
|
}
|
|
327
333
|
get codeValue() {
|
|
328
334
|
return this.node?.outputs._code.value ?? "";
|
|
329
335
|
}
|
|
330
336
|
get node() {
|
|
331
|
-
const { graph: e } =
|
|
337
|
+
const { graph: e } = Le();
|
|
332
338
|
return e.value.findNodeById(this.nodeId);
|
|
333
339
|
}
|
|
334
340
|
}
|
|
335
|
-
class
|
|
341
|
+
class je extends ve {
|
|
336
342
|
min;
|
|
337
343
|
max;
|
|
338
|
-
constructor(e, t,
|
|
339
|
-
super(e, t), this.min =
|
|
344
|
+
constructor(e, t, o, s) {
|
|
345
|
+
super(e, t), this.min = o, this.max = s, this.use(V, ut);
|
|
340
346
|
}
|
|
341
347
|
validate(e) {
|
|
342
348
|
return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
|
|
343
349
|
}
|
|
344
350
|
}
|
|
345
|
-
class ht extends
|
|
351
|
+
class ht extends je {
|
|
346
352
|
component = Y(Ft);
|
|
347
353
|
validate(e) {
|
|
348
354
|
return Number.isInteger(e) && super.validate(e);
|
|
@@ -354,7 +360,7 @@ class da extends ve {
|
|
|
354
360
|
}
|
|
355
361
|
getValue = () => `[${this.value}]`;
|
|
356
362
|
}
|
|
357
|
-
class Cn extends
|
|
363
|
+
class Cn extends je {
|
|
358
364
|
component = Y(Yt);
|
|
359
365
|
}
|
|
360
366
|
class Pe extends ve {
|
|
@@ -366,16 +372,16 @@ class Pe extends ve {
|
|
|
366
372
|
class wn extends Pe {
|
|
367
373
|
component = Y(Wt);
|
|
368
374
|
items;
|
|
369
|
-
constructor(e, t,
|
|
370
|
-
super(e, t), this.items =
|
|
375
|
+
constructor(e, t, o) {
|
|
376
|
+
super(e, t), this.items = o;
|
|
371
377
|
}
|
|
372
378
|
}
|
|
373
|
-
class ua extends
|
|
374
|
-
component = Y(
|
|
379
|
+
class ua extends je {
|
|
380
|
+
component = Y(Xt);
|
|
375
381
|
min;
|
|
376
382
|
max;
|
|
377
|
-
constructor(e, t,
|
|
378
|
-
super(e, t,
|
|
383
|
+
constructor(e, t, o, s) {
|
|
384
|
+
super(e, t, o, s), this.min = o, this.max = s;
|
|
379
385
|
}
|
|
380
386
|
getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
|
|
381
387
|
}
|
|
@@ -392,20 +398,20 @@ const kn = F({
|
|
|
392
398
|
},
|
|
393
399
|
emits: ["update:modelValue"],
|
|
394
400
|
setup(n, { emit: e }) {
|
|
395
|
-
return { v:
|
|
401
|
+
return { v: G({
|
|
396
402
|
get: () => n.modelValue,
|
|
397
|
-
set: (
|
|
398
|
-
e("update:modelValue",
|
|
403
|
+
set: (o) => {
|
|
404
|
+
e("update:modelValue", o);
|
|
399
405
|
}
|
|
400
406
|
}) };
|
|
401
407
|
}
|
|
402
|
-
}),
|
|
408
|
+
}), A = (n, e) => {
|
|
403
409
|
const t = n.__vccOpts || n;
|
|
404
|
-
for (const [
|
|
405
|
-
t[
|
|
410
|
+
for (const [o, s] of e)
|
|
411
|
+
t[o] = s;
|
|
406
412
|
return t;
|
|
407
413
|
}, xn = { style: { position: "relative" } }, In = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, Nn = ["placeholder", "title"];
|
|
408
|
-
function En(n, e, t,
|
|
414
|
+
function En(n, e, t, o, s, a) {
|
|
409
415
|
return p(), b("div", xn, [
|
|
410
416
|
m("label", In, P(n.intf.name), 1),
|
|
411
417
|
ke(m("input", {
|
|
@@ -419,12 +425,12 @@ function En(n, e, t, s, o, a) {
|
|
|
419
425
|
])
|
|
420
426
|
]);
|
|
421
427
|
}
|
|
422
|
-
const Tn = /* @__PURE__ */
|
|
428
|
+
const Tn = /* @__PURE__ */ A(kn, [["render", En]]);
|
|
423
429
|
class ft extends Pe {
|
|
424
430
|
component = Y(Tn);
|
|
425
431
|
}
|
|
426
432
|
class ca extends Pe {
|
|
427
|
-
component = Y(
|
|
433
|
+
component = Y(Kt);
|
|
428
434
|
}
|
|
429
435
|
class pa extends ve {
|
|
430
436
|
constructor(e = "", t = "") {
|
|
@@ -433,19 +439,25 @@ class pa extends ve {
|
|
|
433
439
|
getValue = () => `(${this.value})`;
|
|
434
440
|
}
|
|
435
441
|
function ha(n) {
|
|
436
|
-
return class extends
|
|
442
|
+
return class extends Ae {
|
|
437
443
|
type = n.type;
|
|
438
444
|
inputs = {};
|
|
439
445
|
outputs = {};
|
|
440
446
|
constructor() {
|
|
441
447
|
super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate.call(this, { inputs: e, ...t })), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.variableName != null && (this.state.variableName = n.variableName), n.codeTemplate && (this.codeTemplate = n.codeTemplate), this.addInput(
|
|
442
448
|
"_code",
|
|
443
|
-
new D("_code", []).use(V,
|
|
449
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
444
450
|
), this.addOutput(
|
|
445
451
|
"_code",
|
|
446
|
-
new D("_code", []).use(V,
|
|
452
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
447
453
|
);
|
|
448
454
|
}
|
|
455
|
+
afterGraphLoaded() {
|
|
456
|
+
n.afterGraphLoaded?.call(this);
|
|
457
|
+
}
|
|
458
|
+
afterLoaded() {
|
|
459
|
+
n.afterLoaded?.call(this);
|
|
460
|
+
}
|
|
449
461
|
onPlaced() {
|
|
450
462
|
n.onPlaced?.call(this);
|
|
451
463
|
}
|
|
@@ -462,14 +474,14 @@ function ha(n) {
|
|
|
462
474
|
n.update?.call(this);
|
|
463
475
|
}
|
|
464
476
|
executeFactory(e, t) {
|
|
465
|
-
Object.keys(t || {}).forEach((
|
|
466
|
-
const
|
|
467
|
-
e === "input" ? this.addInput(
|
|
477
|
+
Object.keys(t || {}).forEach((o) => {
|
|
478
|
+
const s = t[o]();
|
|
479
|
+
e === "input" ? this.addInput(o, s) : this.addOutput(o, s);
|
|
468
480
|
});
|
|
469
481
|
}
|
|
470
482
|
};
|
|
471
483
|
}
|
|
472
|
-
class On extends
|
|
484
|
+
class On extends Ae {
|
|
473
485
|
}
|
|
474
486
|
function fa(n) {
|
|
475
487
|
return class extends On {
|
|
@@ -482,12 +494,18 @@ function fa(n) {
|
|
|
482
494
|
constructor() {
|
|
483
495
|
super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate?.call(this, e, t)), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.codeTemplate && (this.codeTemplate = n.codeTemplate), n.variableName && (this.state.variableName = n.variableName), this.addInput(
|
|
484
496
|
"_code",
|
|
485
|
-
new D("_code", []).use(V,
|
|
497
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
486
498
|
), this.addOutput(
|
|
487
499
|
"_code",
|
|
488
|
-
new D("_code", []).use(V,
|
|
500
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
489
501
|
), this.staticInputKeys.push("_code"), this.staticOutputKeys.push("_code");
|
|
490
502
|
}
|
|
503
|
+
afterGraphLoaded() {
|
|
504
|
+
n.afterGraphLoaded?.call(this);
|
|
505
|
+
}
|
|
506
|
+
afterLoaded() {
|
|
507
|
+
n.afterLoaded?.call(this);
|
|
508
|
+
}
|
|
491
509
|
onPlaced() {
|
|
492
510
|
this.events.update.subscribe(this, (e) => {
|
|
493
511
|
e && (e.type === "input" && this.staticInputKeys.includes(e.name) || e.type === "output" && this.staticOutputKeys.includes(e.name)) && this.onUpdate();
|
|
@@ -515,38 +533,41 @@ function fa(n) {
|
|
|
515
533
|
for (const t of Object.keys(e.inputs))
|
|
516
534
|
if (!(this.staticInputKeys.includes(t) || !e.inputs[t])) {
|
|
517
535
|
if (!this.inputs[t]) {
|
|
518
|
-
const
|
|
536
|
+
const o = e.inputs[t], s = o.value;
|
|
519
537
|
let a;
|
|
520
|
-
|
|
538
|
+
o.component ? a = vn(o.component, { ...o, id: t }) : typeof s == "number" ? a = new ht(t, s) : a = new ft(t, JSON.stringify(s)), a.use(ot, !0), a.setOptional(o.optional ?? !1), a.setHidden(o.hidden ?? !1), this.addInput(t, a);
|
|
521
539
|
}
|
|
522
540
|
this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
|
|
523
541
|
}
|
|
524
542
|
for (const t of Object.keys(e.outputs))
|
|
525
543
|
if (!(this.staticOutputKeys.includes(t) || !e.outputs[t])) {
|
|
526
544
|
if (!this.outputs[t]) {
|
|
527
|
-
const
|
|
528
|
-
this.addOutput(t,
|
|
545
|
+
const o = new _n(t);
|
|
546
|
+
this.addOutput(t, o);
|
|
529
547
|
}
|
|
530
548
|
this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
|
|
531
549
|
}
|
|
532
550
|
it(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
|
|
533
551
|
}
|
|
534
552
|
onUpdate() {
|
|
535
|
-
if (this.preventUpdate) return;
|
|
553
|
+
if (!n.onUpdate || this.preventUpdate) return;
|
|
536
554
|
this.graph && this.graph.activeTransactions++;
|
|
537
|
-
const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs),
|
|
538
|
-
this.updateInterfaces("input",
|
|
555
|
+
const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs), o = n.onUpdate.call(this, e, t);
|
|
556
|
+
this.updateInterfaces("input", o.inputs ?? {}, o.forceUpdateInputs ?? []), this.updateInterfaces("output", o.outputs ?? {}, o.forceUpdateOutputs ?? []), this.graph && this.graph.activeTransactions--;
|
|
539
557
|
}
|
|
540
558
|
getStaticValues(e, t) {
|
|
541
|
-
const
|
|
542
|
-
for (const
|
|
543
|
-
s
|
|
544
|
-
return
|
|
559
|
+
const o = {};
|
|
560
|
+
for (const s of e)
|
|
561
|
+
o[s] = t[s].value;
|
|
562
|
+
return o;
|
|
563
|
+
}
|
|
564
|
+
updateInputInterfaces(e = {}, t = []) {
|
|
565
|
+
this.updateInterfaces("input", e, t);
|
|
545
566
|
}
|
|
546
|
-
updateInterfaces(e, t,
|
|
547
|
-
const
|
|
567
|
+
updateInterfaces(e, t = {}, o = []) {
|
|
568
|
+
const s = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
|
|
548
569
|
for (const i of Object.keys(a))
|
|
549
|
-
|
|
570
|
+
s.includes(i) || t[i] && !o.includes(i) || (e === "input" ? this.removeInput(i) : this.removeOutput(i));
|
|
550
571
|
for (const i of Object.keys(t)) {
|
|
551
572
|
if (a[i]) continue;
|
|
552
573
|
const r = t[i]();
|
|
@@ -557,9 +578,9 @@ function fa(n) {
|
|
|
557
578
|
this.state.props = e, this.onUpdate();
|
|
558
579
|
}
|
|
559
580
|
executeFactory(e, t) {
|
|
560
|
-
Object.keys(t || {}).forEach((
|
|
561
|
-
const
|
|
562
|
-
e === "input" ? this.addInput(
|
|
581
|
+
Object.keys(t || {}).forEach((o) => {
|
|
582
|
+
const s = t[o]();
|
|
583
|
+
e === "input" ? this.addInput(o, s) : this.addOutput(o, s);
|
|
563
584
|
});
|
|
564
585
|
}
|
|
565
586
|
};
|
|
@@ -659,17 +680,17 @@ class Mn extends zt {
|
|
|
659
680
|
start() {
|
|
660
681
|
super.start(), this.recalculateOrder = !0, this.calculateWithoutData();
|
|
661
682
|
}
|
|
662
|
-
async runGraph(e, t,
|
|
683
|
+
async runGraph(e, t, o) {
|
|
663
684
|
this.order.has(e.id) || this.order.set(e.id, Ut(e));
|
|
664
|
-
const { calculationOrder:
|
|
665
|
-
for (const r of
|
|
685
|
+
const { calculationOrder: s, connectionsFromNode: a } = this.order.get(e.id), i = /* @__PURE__ */ new Map();
|
|
686
|
+
for (const r of s) {
|
|
666
687
|
const l = {};
|
|
667
688
|
Object.entries(r.inputs).forEach(([f, C]) => {
|
|
668
689
|
l[f] = this.getInterfaceValue(t, C.id);
|
|
669
690
|
}), r.isCodeNode && (r.updateCodeTemplate(), r.updateOutputNames()), this.events.beforeNodeCalculation.emit({ inputValues: l, node: r });
|
|
670
691
|
let u;
|
|
671
692
|
if (r.calculate) {
|
|
672
|
-
if (u = await r.calculate(l, { globalValues:
|
|
693
|
+
if (u = await r.calculate(l, { globalValues: o, engine: this }), a.has(r))
|
|
673
694
|
for (const [f, C] of Object.entries(u))
|
|
674
695
|
this.hooks.transferData.execute(u[f], C), a.get(r).forEach((h) => t.set(h.to.id, C));
|
|
675
696
|
} else {
|
|
@@ -697,11 +718,11 @@ This is likely an internal issue. Please report it on GitHub.`
|
|
|
697
718
|
}
|
|
698
719
|
getInputValues(e) {
|
|
699
720
|
const t = /* @__PURE__ */ new Map();
|
|
700
|
-
for (const
|
|
701
|
-
Object.values(
|
|
702
|
-
|
|
703
|
-
}),
|
|
704
|
-
t.set(
|
|
721
|
+
for (const o of e.nodes)
|
|
722
|
+
Object.values(o.inputs).forEach((s) => {
|
|
723
|
+
s.connectionCount === 0 && t.set(s.id, s.getValue ? s.getValue() : s.value);
|
|
724
|
+
}), o.calculate || Object.values(o.outputs).forEach((s) => {
|
|
725
|
+
t.set(s.id, s.getValue ? s.getValue() : s.value);
|
|
705
726
|
});
|
|
706
727
|
return t;
|
|
707
728
|
}
|
|
@@ -729,7 +750,7 @@ const $n = {}, Sn = {
|
|
|
729
750
|
"stroke-linejoin": "round",
|
|
730
751
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"
|
|
731
752
|
};
|
|
732
|
-
function
|
|
753
|
+
function Gn(n, e) {
|
|
733
754
|
return p(), b("svg", Sn, [...e[0] || (e[0] = [
|
|
734
755
|
m("path", {
|
|
735
756
|
stroke: "none",
|
|
@@ -739,7 +760,7 @@ function An(n, e) {
|
|
|
739
760
|
m("path", { d: "M5 12l5 5l10 -10" }, null, -1)
|
|
740
761
|
])]);
|
|
741
762
|
}
|
|
742
|
-
const
|
|
763
|
+
const Ln = /* @__PURE__ */ A($n, [["render", Gn]]), An = {}, Rn = {
|
|
743
764
|
xmlns: "http://www.w3.org/2000/svg",
|
|
744
765
|
width: "24",
|
|
745
766
|
height: "24",
|
|
@@ -751,8 +772,8 @@ const Gn = /* @__PURE__ */ R($n, [["render", An]]), Rn = {}, jn = {
|
|
|
751
772
|
"stroke-linejoin": "round",
|
|
752
773
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"
|
|
753
774
|
};
|
|
754
|
-
function
|
|
755
|
-
return p(), b("svg",
|
|
775
|
+
function jn(n, e) {
|
|
776
|
+
return p(), b("svg", Rn, [...e[0] || (e[0] = [
|
|
756
777
|
m("path", {
|
|
757
778
|
stroke: "none",
|
|
758
779
|
d: "M0 0h24v24H0z",
|
|
@@ -761,7 +782,7 @@ function Ln(n, e) {
|
|
|
761
782
|
m("path", { d: "M4 8m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z" }, null, -1)
|
|
762
783
|
])]);
|
|
763
784
|
}
|
|
764
|
-
const Pn = /* @__PURE__ */
|
|
785
|
+
const Pn = /* @__PURE__ */ A(An, [["render", jn]]), Vn = {}, Bn = {
|
|
765
786
|
xmlns: "http://www.w3.org/2000/svg",
|
|
766
787
|
width: "24",
|
|
767
788
|
height: "24",
|
|
@@ -784,7 +805,7 @@ function Hn(n, e) {
|
|
|
784
805
|
m("path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" }, null, -1)
|
|
785
806
|
])]);
|
|
786
807
|
}
|
|
787
|
-
const zn = /* @__PURE__ */
|
|
808
|
+
const zn = /* @__PURE__ */ A(Vn, [["render", Hn]]), Un = {}, Dn = {
|
|
788
809
|
xmlns: "http://www.w3.org/2000/svg",
|
|
789
810
|
width: "24",
|
|
790
811
|
height: "24",
|
|
@@ -808,7 +829,7 @@ function Fn(n, e) {
|
|
|
808
829
|
m("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
|
|
809
830
|
])]);
|
|
810
831
|
}
|
|
811
|
-
const Yn = /* @__PURE__ */
|
|
832
|
+
const Yn = /* @__PURE__ */ A(Un, [["render", Fn]]), Wn = {}, Xn = {
|
|
812
833
|
xmlns: "http://www.w3.org/2000/svg",
|
|
813
834
|
width: "24",
|
|
814
835
|
height: "24",
|
|
@@ -816,8 +837,8 @@ const Yn = /* @__PURE__ */ R(Un, [["render", Fn]]), Wn = {}, Kn = {
|
|
|
816
837
|
fill: "currentColor",
|
|
817
838
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
|
|
818
839
|
};
|
|
819
|
-
function
|
|
820
|
-
return p(), b("svg",
|
|
840
|
+
function Kn(n, e) {
|
|
841
|
+
return p(), b("svg", Xn, [...e[0] || (e[0] = [
|
|
821
842
|
m("path", {
|
|
822
843
|
stroke: "none",
|
|
823
844
|
d: "M0 0h24v24H0z",
|
|
@@ -826,7 +847,7 @@ function Xn(n, e) {
|
|
|
826
847
|
m("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-2.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z" }, null, -1)
|
|
827
848
|
])]);
|
|
828
849
|
}
|
|
829
|
-
const qn = /* @__PURE__ */
|
|
850
|
+
const qn = /* @__PURE__ */ A(Wn, [["render", Kn]]), Jn = {}, Qn = {
|
|
830
851
|
xmlns: "http://www.w3.org/2000/svg",
|
|
831
852
|
width: "24",
|
|
832
853
|
height: "24",
|
|
@@ -844,7 +865,7 @@ function Zn(n, e) {
|
|
|
844
865
|
m("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm0 2h-9v14h9a1 1 0 0 0 .993 -.883l.007 -.117v-12a1 1 0 0 0 -.883 -.993l-.117 -.007zm-4.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z" }, null, -1)
|
|
845
866
|
])]);
|
|
846
867
|
}
|
|
847
|
-
const eo = /* @__PURE__ */
|
|
868
|
+
const eo = /* @__PURE__ */ A(Jn, [["render", Zn]]), to = {}, no = {
|
|
848
869
|
xmlns: "http://www.w3.org/2000/svg",
|
|
849
870
|
width: "24",
|
|
850
871
|
height: "24",
|
|
@@ -862,7 +883,7 @@ function oo(n, e) {
|
|
|
862
883
|
m("path", { d: "M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm8 -16h-8a1 1 0 0 0 -1 1v12a1 1 0 0 0 1 1h8z" }, null, -1)
|
|
863
884
|
])]);
|
|
864
885
|
}
|
|
865
|
-
const so = /* @__PURE__ */
|
|
886
|
+
const so = /* @__PURE__ */ A(to, [["render", oo]]), ao = {}, ro = {
|
|
866
887
|
xmlns: "http://www.w3.org/2000/svg",
|
|
867
888
|
width: "24",
|
|
868
889
|
height: "24",
|
|
@@ -880,7 +901,7 @@ function io(n, e) {
|
|
|
880
901
|
m("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-5.387 4.21l.094 .083l2 2a1 1 0 0 1 .083 1.32l-.083 .094l-2 2a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.292 -1.293l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083z" }, null, -1)
|
|
881
902
|
])]);
|
|
882
903
|
}
|
|
883
|
-
const lo = /* @__PURE__ */
|
|
904
|
+
const lo = /* @__PURE__ */ A(ao, [["render", io]]), uo = {}, co = {
|
|
884
905
|
xmlns: "http://www.w3.org/2000/svg",
|
|
885
906
|
width: "24",
|
|
886
907
|
height: "24",
|
|
@@ -898,7 +919,7 @@ function po(n, e) {
|
|
|
898
919
|
m("path", { d: "M18 3a3 3 0 0 1 2.995 2.824l.005 .176v12a3 3 0 0 1 -2.824 2.995l-.176 .005h-12a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-12a3 3 0 0 1 2.824 -2.995l.176 -.005h12zm-3 2h-9a1 1 0 0 0 -.993 .883l-.007 .117v12a1 1 0 0 0 .883 .993l.117 .007h9v-14zm-3.293 4.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.292 1.293l1.292 1.293a1 1 0 0 1 .083 1.32l-.083 .094a1 1 0 0 1 -1.32 .083l-.094 -.083l-2 -2a1 1 0 0 1 -.083 -1.32l.083 -.094l2 -2a1 1 0 0 1 1.414 0z" }, null, -1)
|
|
899
920
|
])]);
|
|
900
921
|
}
|
|
901
|
-
const ho = /* @__PURE__ */
|
|
922
|
+
const ho = /* @__PURE__ */ A(uo, [["render", po]]), fo = {}, mo = {
|
|
902
923
|
xmlns: "http://www.w3.org/2000/svg",
|
|
903
924
|
width: "24",
|
|
904
925
|
height: "24",
|
|
@@ -915,7 +936,7 @@ function vo(n, e) {
|
|
|
915
936
|
fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>', 6)
|
|
916
937
|
])]);
|
|
917
938
|
}
|
|
918
|
-
const mt = /* @__PURE__ */
|
|
939
|
+
const mt = /* @__PURE__ */ A(fo, [["render", vo]]), go = {}, bo = {
|
|
919
940
|
xmlns: "http://www.w3.org/2000/svg",
|
|
920
941
|
width: "24",
|
|
921
942
|
height: "24",
|
|
@@ -937,7 +958,7 @@ function yo(n, e) {
|
|
|
937
958
|
m("path", { d: "M7 4v16l13 -8z" }, null, -1)
|
|
938
959
|
])]);
|
|
939
960
|
}
|
|
940
|
-
const _o = /* @__PURE__ */
|
|
961
|
+
const _o = /* @__PURE__ */ A(go, [["render", yo]]), Co = {}, wo = {
|
|
941
962
|
xmlns: "http://www.w3.org/2000/svg",
|
|
942
963
|
width: "24",
|
|
943
964
|
height: "24",
|
|
@@ -960,7 +981,7 @@ function ko(n, e) {
|
|
|
960
981
|
m("path", { d: "M5 12l14 0" }, null, -1)
|
|
961
982
|
])]);
|
|
962
983
|
}
|
|
963
|
-
const xo = /* @__PURE__ */
|
|
984
|
+
const xo = /* @__PURE__ */ A(Co, [["render", ko]]), Io = {}, No = {
|
|
964
985
|
xmlns: "http://www.w3.org/2000/svg",
|
|
965
986
|
width: "24",
|
|
966
987
|
height: "24",
|
|
@@ -977,7 +998,7 @@ function Eo(n, e) {
|
|
|
977
998
|
fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M5 2h5v4h-5z"></path><path d="M15 10h5v4h-5z"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h5"></path><path d="M7.5 6v4"></path><path d="M7.5 14v4"></path>', 8)
|
|
978
999
|
])]);
|
|
979
1000
|
}
|
|
980
|
-
const To = /* @__PURE__ */
|
|
1001
|
+
const To = /* @__PURE__ */ A(Io, [["render", Eo]]), Oo = {}, Mo = {
|
|
981
1002
|
xmlns: "http://www.w3.org/2000/svg",
|
|
982
1003
|
width: "24",
|
|
983
1004
|
height: "24",
|
|
@@ -994,7 +1015,7 @@ function $o(n, e) {
|
|
|
994
1015
|
fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 2h4v4m-4 0h-1v-1"></path><path d="M15 11v-1h5v4h-2"></path><path d="M5 18h5v4h-5z"></path><path d="M5 10h5v4h-5z"></path><path d="M10 12h2"></path><path d="M7.5 7.5v2.5"></path><path d="M7.5 14v4"></path><path d="M3 3l18 18"></path>', 9)
|
|
995
1016
|
])]);
|
|
996
1017
|
}
|
|
997
|
-
const So = /* @__PURE__ */
|
|
1018
|
+
const So = /* @__PURE__ */ A(Oo, [["render", $o]]), Go = {}, Lo = {
|
|
998
1019
|
xmlns: "http://www.w3.org/2000/svg",
|
|
999
1020
|
width: "24",
|
|
1000
1021
|
height: "24",
|
|
@@ -1006,12 +1027,12 @@ const So = /* @__PURE__ */ R(Oo, [["render", $o]]), Ao = {}, Go = {
|
|
|
1006
1027
|
"stroke-linejoin": "round",
|
|
1007
1028
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"
|
|
1008
1029
|
};
|
|
1009
|
-
function
|
|
1010
|
-
return p(), b("svg",
|
|
1030
|
+
function Ao(n, e) {
|
|
1031
|
+
return p(), b("svg", Lo, [...e[0] || (e[0] = [
|
|
1011
1032
|
fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M21 18a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3"></path><path d="M3 3m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z"></path><path d="M12 9v8"></path><path d="M9 14l3 3l3 -3"></path>', 5)
|
|
1012
1033
|
])]);
|
|
1013
1034
|
}
|
|
1014
|
-
const
|
|
1035
|
+
const Ro = /* @__PURE__ */ A(Go, [["render", Ao]]), jo = {}, Po = {
|
|
1015
1036
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1016
1037
|
width: "24",
|
|
1017
1038
|
height: "24",
|
|
@@ -1028,7 +1049,7 @@ function Vo(n, e) {
|
|
|
1028
1049
|
fe('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 3l18 18"></path><path d="M4 7h3m4 0h9"></path><path d="M10 11l0 6"></path><path d="M14 14l0 3"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l.077 -.923"></path><path d="M18.384 14.373l.616 -7.373"></path><path d="M9 5v-1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>', 8)
|
|
1029
1050
|
])]);
|
|
1030
1051
|
}
|
|
1031
|
-
const Bo = /* @__PURE__ */
|
|
1052
|
+
const Bo = /* @__PURE__ */ A(jo, [["render", Vo]]), Ho = {}, zo = {
|
|
1032
1053
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1033
1054
|
width: "24",
|
|
1034
1055
|
height: "24",
|
|
@@ -1051,11 +1072,11 @@ function Uo(n, e) {
|
|
|
1051
1072
|
m("path", { d: "M6 6l12 12" }, null, -1)
|
|
1052
1073
|
])]);
|
|
1053
1074
|
}
|
|
1054
|
-
const Do = /* @__PURE__ */
|
|
1055
|
-
const
|
|
1075
|
+
const Do = /* @__PURE__ */ A(Ho, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_ENGINE", bt = "TOGGLE_MINIMAP", yt = "TOGGLE_PALETTE", Fo = (n, e, t) => {
|
|
1076
|
+
const o = t.zoomToFit.paddingLeft;
|
|
1056
1077
|
e.registerCommand(yt, {
|
|
1057
1078
|
execute: () => {
|
|
1058
|
-
t.palette.enabled = !t.palette.enabled, t.zoomToFit.paddingLeft = t.palette.enabled ?
|
|
1079
|
+
t.palette.enabled = !t.palette.enabled, t.zoomToFit.paddingLeft = t.palette.enabled ? o : 50;
|
|
1059
1080
|
},
|
|
1060
1081
|
canExecute: () => !0
|
|
1061
1082
|
}), e.registerCommand(vt, {
|
|
@@ -1072,31 +1093,31 @@ const Do = /* @__PURE__ */ R(Ho, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_
|
|
|
1072
1093
|
command: gt,
|
|
1073
1094
|
title: "Run",
|
|
1074
1095
|
// Tooltip text
|
|
1075
|
-
icon:
|
|
1096
|
+
icon: G(() => _o)
|
|
1076
1097
|
}, t = {
|
|
1077
1098
|
command: yt,
|
|
1078
1099
|
title: "Toggle palette",
|
|
1079
1100
|
// Tooltip text
|
|
1080
|
-
icon:
|
|
1081
|
-
},
|
|
1101
|
+
icon: G(() => n.palette.enabled ? qn : eo)
|
|
1102
|
+
}, o = {
|
|
1082
1103
|
command: vt,
|
|
1083
1104
|
title: "Clear all",
|
|
1084
1105
|
// Tooltip text
|
|
1085
|
-
icon:
|
|
1086
|
-
},
|
|
1106
|
+
icon: G(() => Bo)
|
|
1107
|
+
}, s = {
|
|
1087
1108
|
command: bt,
|
|
1088
1109
|
title: "Toggle minimap",
|
|
1089
1110
|
// Tooltip text
|
|
1090
|
-
icon:
|
|
1111
|
+
icon: G(() => n.enableMinimap ? So : To)
|
|
1091
1112
|
};
|
|
1092
|
-
n.toolbar.commands = [t, e, ...qt,
|
|
1113
|
+
n.toolbar.commands = [t, e, ...qt, o, s];
|
|
1093
1114
|
}, Wo = (n, e, t) => {
|
|
1094
1115
|
t.registerCommand(gt, {
|
|
1095
1116
|
execute: () => e.runOnce(null),
|
|
1096
1117
|
canExecute: () => n.nodes.length > 0
|
|
1097
1118
|
});
|
|
1098
1119
|
};
|
|
1099
|
-
function
|
|
1120
|
+
function Xo(n) {
|
|
1100
1121
|
const e = Symbol("CodeEngineToken");
|
|
1101
1122
|
n.engine = new Mn(n.editor), Wo(n.editor.graph, n.engine, n.commandHandler), n.loadEditor = (t) => {
|
|
1102
1123
|
n.engine?.pause(), n.displayedGraph.clear(), n.editor.load(t), n.commandHandler.executeCommand(ne.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(ne.CLEAR_HISTORY_COMMAND), n.engine?.resume(), n.engine?.runOnce(null);
|
|
@@ -1104,15 +1125,15 @@ function Ko(n) {
|
|
|
1104
1125
|
n.engine?.pause(), n.displayedGraph.clear(), n.commandHandler.executeCommand(ne.CLEAR_CLIPBOARD_COMMAND), n.commandHandler.executeCommand(ne.CLEAR_HISTORY_COMMAND), n.displayedGraph.id = re(), n.engine?.resume(), n.engine?.runOnce(null);
|
|
1105
1126
|
}, n.subscribe = () => {
|
|
1106
1127
|
n.displayedGraph.events.addConnection.subscribe(e, (t) => {
|
|
1107
|
-
const
|
|
1108
|
-
s && s.isCodeNode && s.onConnected();
|
|
1109
|
-
const o = n.displayedGraph.findNodeById(t.from.nodeId);
|
|
1128
|
+
const o = n.displayedGraph.findNodeById(t.to.nodeId);
|
|
1110
1129
|
o && o.isCodeNode && o.onConnected();
|
|
1130
|
+
const s = n.displayedGraph.findNodeById(t.from.nodeId);
|
|
1131
|
+
s && s.isCodeNode && s.onConnected();
|
|
1111
1132
|
}), n.displayedGraph.events.removeConnection.subscribe(e, (t) => {
|
|
1112
|
-
const
|
|
1113
|
-
s && s.isCodeNode && s.onUnconnected();
|
|
1114
|
-
const o = n.displayedGraph.findNodeById(t.from.nodeId);
|
|
1133
|
+
const o = n.displayedGraph.findNodeById(t.to.nodeId);
|
|
1115
1134
|
o && o.isCodeNode && o.onUnconnected();
|
|
1135
|
+
const s = n.displayedGraph.findNodeById(t.from.nodeId);
|
|
1136
|
+
s && s.isCodeNode && s.onUnconnected();
|
|
1116
1137
|
}), n.engine?.events.beforeRun.subscribe(e, () => {
|
|
1117
1138
|
n.engine?.pause(), n.displayedGraph.sortNodes(), n.engine?.resume();
|
|
1118
1139
|
}), n.engine?.events.afterRun.subscribe(e, (t) => {
|
|
@@ -1125,7 +1146,7 @@ function Ko(n) {
|
|
|
1125
1146
|
n.displayedGraph.events.addConnection.unsubscribe(e), n.displayedGraph.events.removeConnection.unsubscribe(e), n.engine?.events.beforeRun.unsubscribe(e), n.engine?.events.afterRun.unsubscribe(e);
|
|
1126
1147
|
};
|
|
1127
1148
|
}
|
|
1128
|
-
class Ie extends
|
|
1149
|
+
class Ie extends At {
|
|
1129
1150
|
code = null;
|
|
1130
1151
|
editor;
|
|
1131
1152
|
_state = te({
|
|
@@ -1180,7 +1201,7 @@ class Ie extends Rt {
|
|
|
1180
1201
|
* @param props optional
|
|
1181
1202
|
* @returns code node
|
|
1182
1203
|
*/
|
|
1183
|
-
addNodeAtCoordinates = (e, t = { x: 0, y: 0 },
|
|
1204
|
+
addNodeAtCoordinates = (e, t = { x: 0, y: 0 }, o) => (this.addNode(e, o), e.position && (e.position = t), e);
|
|
1184
1205
|
/**
|
|
1185
1206
|
* Add connection of code nodes
|
|
1186
1207
|
* @param from code node interface
|
|
@@ -1229,9 +1250,18 @@ class Ie extends Rt {
|
|
|
1229
1250
|
*/
|
|
1230
1251
|
hasConnection(e, t) {
|
|
1231
1252
|
return this.connections.some(
|
|
1232
|
-
(
|
|
1253
|
+
(o) => o.from.id === e.id && o.to.id === t.id
|
|
1233
1254
|
);
|
|
1234
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Load a state
|
|
1258
|
+
* @param state State to load
|
|
1259
|
+
* @returns An array of warnings that occured during loading. If the array is empty, the state was successfully loaded.
|
|
1260
|
+
*/
|
|
1261
|
+
load(e) {
|
|
1262
|
+
const t = super.load(e);
|
|
1263
|
+
return this.nodes.forEach((o) => o.afterGraphLoaded()), t;
|
|
1264
|
+
}
|
|
1235
1265
|
/**
|
|
1236
1266
|
* Render code script.
|
|
1237
1267
|
*/
|
|
@@ -1249,10 +1279,10 @@ class Ie extends Rt {
|
|
|
1249
1279
|
(a) => e.includes(a.to.nodeId) && e.includes(a.from.nodeId)
|
|
1250
1280
|
).map((a) => [a.to.nodeId, a.from.nodeId]);
|
|
1251
1281
|
e.reverse(), e = pn.array(e, t), e.reverse();
|
|
1252
|
-
const
|
|
1253
|
-
e = [...e, ...
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1282
|
+
const o = this.nodes.map((a) => a.id).filter((a) => !e.includes(a));
|
|
1283
|
+
e = [...e, ...o];
|
|
1284
|
+
const s = e.map((a) => this.findNodeById(a));
|
|
1285
|
+
s && (this.nodes = s);
|
|
1256
1286
|
} catch {
|
|
1257
1287
|
console.warn("Failed to sort nodes.");
|
|
1258
1288
|
}
|
|
@@ -1270,7 +1300,7 @@ const _t = (n) => {
|
|
|
1270
1300
|
const e = { ...n.position };
|
|
1271
1301
|
return e.x -= 440, e.y += 50, e;
|
|
1272
1302
|
}, Ue = "__baklava_SubgraphInputNode", De = "__baklava_SubgraphOutputNode";
|
|
1273
|
-
class Ct extends
|
|
1303
|
+
class Ct extends Ae {
|
|
1274
1304
|
graphInterfaceId;
|
|
1275
1305
|
constructor() {
|
|
1276
1306
|
super(), this.graphInterfaceId = re();
|
|
@@ -1318,7 +1348,7 @@ class kt extends Ct {
|
|
|
1318
1348
|
output: e
|
|
1319
1349
|
});
|
|
1320
1350
|
}
|
|
1321
|
-
const
|
|
1351
|
+
const Ko = [
|
|
1322
1352
|
"component",
|
|
1323
1353
|
"connectionCount",
|
|
1324
1354
|
"events",
|
|
@@ -1352,23 +1382,23 @@ function qo(n) {
|
|
|
1352
1382
|
}
|
|
1353
1383
|
onUnconnected() {
|
|
1354
1384
|
}
|
|
1355
|
-
calculate = async (t,
|
|
1385
|
+
calculate = async (t, o) => {
|
|
1356
1386
|
if (!this.subgraph) throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`);
|
|
1357
|
-
if (!
|
|
1387
|
+
if (!o.engine || typeof o.engine != "object")
|
|
1358
1388
|
throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);
|
|
1359
|
-
const
|
|
1389
|
+
const s = o.engine.getInputValues(this.subgraph);
|
|
1360
1390
|
for (const r of this.subgraph.inputs)
|
|
1361
|
-
|
|
1362
|
-
const a = await
|
|
1391
|
+
s.set(r.nodeInterfaceId, t[r.id]);
|
|
1392
|
+
const a = await o.engine.runGraph(
|
|
1363
1393
|
this.subgraph,
|
|
1364
|
-
|
|
1365
|
-
|
|
1394
|
+
s,
|
|
1395
|
+
o.globalValues
|
|
1366
1396
|
);
|
|
1367
|
-
|
|
1397
|
+
o.engine.pause(), nt(a, o.engine.editor), o.engine.resume();
|
|
1368
1398
|
const i = {};
|
|
1369
1399
|
for (const r of this.subgraph.outputs)
|
|
1370
1400
|
i[r.id] = a.get(r.nodeId)?.get("output");
|
|
1371
|
-
return i._calculationResults = a, this.lockCode || (i._code = this.renderCode({ inputs: t, ...
|
|
1401
|
+
return i._calculationResults = a, this.lockCode || (i._code = this.renderCode({ inputs: t, ...o.globalValues })), this.updateOutputValues(i), i;
|
|
1372
1402
|
};
|
|
1373
1403
|
load(t) {
|
|
1374
1404
|
if (!this.subgraph) throw new Error("Cannot load a graph node without a graph");
|
|
@@ -1405,17 +1435,17 @@ function qo(n) {
|
|
|
1405
1435
|
for (const t of this.subgraph.inputs)
|
|
1406
1436
|
t.id in this.inputs ? this.inputs[t.id].name = t.name : this.addInput(t.id, this.createProxyInterface(t, !0));
|
|
1407
1437
|
for (const t of Object.keys(this.inputs))
|
|
1408
|
-
this.subgraph.inputs.some((
|
|
1438
|
+
this.subgraph.inputs.some((o) => o.id === t) || this.removeInput(t);
|
|
1409
1439
|
for (const t of this.subgraph.outputs)
|
|
1410
1440
|
t.id in this.outputs ? this.outputs[t.id].name = t.name : this.addOutput(t.id, this.createProxyInterface(t, !1));
|
|
1411
1441
|
for (const t of Object.keys(this.outputs))
|
|
1412
|
-
this.subgraph.outputs.some((
|
|
1442
|
+
this.subgraph.outputs.some((o) => o.id === t) || this.removeOutput(t);
|
|
1413
1443
|
this.addInput(
|
|
1414
1444
|
"_code",
|
|
1415
|
-
new D("_code", []).use(V,
|
|
1445
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
1416
1446
|
), this.addOutput(
|
|
1417
1447
|
"_code",
|
|
1418
|
-
new D("_code", []).use(V,
|
|
1448
|
+
new D("_code", []).use(V, X).use(ue).setHidden(!0)
|
|
1419
1449
|
), this.addOutput("_calculationResults", new J("_calculationResults", void 0).setHidden(!0));
|
|
1420
1450
|
}
|
|
1421
1451
|
/**
|
|
@@ -1423,19 +1453,19 @@ function qo(n) {
|
|
|
1423
1453
|
* For example, the `type` property or the `allowMultipleConnections` property.
|
|
1424
1454
|
* These properties should be proxied to the subgraph interface, so they behave the same as the original interface.
|
|
1425
1455
|
*/
|
|
1426
|
-
createProxyInterface(t,
|
|
1427
|
-
const
|
|
1428
|
-
return new Proxy(
|
|
1456
|
+
createProxyInterface(t, o) {
|
|
1457
|
+
const s = new D(t.name, void 0);
|
|
1458
|
+
return new Proxy(s, {
|
|
1429
1459
|
get: (a, i) => {
|
|
1430
|
-
if (
|
|
1460
|
+
if (Ko.includes(i) || i in a || typeof i == "string" && i.startsWith("__v_"))
|
|
1431
1461
|
return Reflect.get(a, i);
|
|
1432
1462
|
let r;
|
|
1433
|
-
|
|
1463
|
+
o ? r = this.subgraph?.nodes.find(
|
|
1434
1464
|
(C) => wt.isGraphInputNode(C) && C.graphInterfaceId === t.id
|
|
1435
1465
|
)?.outputs.placeholder.id : r = this.subgraph?.nodes.find(
|
|
1436
1466
|
(C) => kt.isGraphOutputNode(C) && C.graphInterfaceId === t.id
|
|
1437
1467
|
)?.inputs.placeholder.id;
|
|
1438
|
-
const l = this.subgraph?.connections.find((f) => r === (
|
|
1468
|
+
const l = this.subgraph?.connections.find((f) => r === (o ? f.from : f.to)?.id), u = o ? l?.to : l?.from;
|
|
1439
1469
|
if (u) return Reflect.get(u, i);
|
|
1440
1470
|
}
|
|
1441
1471
|
});
|
|
@@ -1446,9 +1476,9 @@ function Jo(n, e) {
|
|
|
1446
1476
|
return Object.fromEntries(Object.entries(n).filter(e));
|
|
1447
1477
|
}
|
|
1448
1478
|
function Qo(n, e) {
|
|
1449
|
-
return Object.fromEntries(Object.entries(n).map(([t,
|
|
1479
|
+
return Object.fromEntries(Object.entries(n).map(([t, o]) => [t, e(o)]));
|
|
1450
1480
|
}
|
|
1451
|
-
class Ne extends
|
|
1481
|
+
class Ne extends Rt {
|
|
1452
1482
|
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
|
|
1453
1483
|
static fromGraph(e, t) {
|
|
1454
1484
|
return new Ne(e.save(), t);
|
|
@@ -1464,36 +1494,36 @@ class Ne extends jt {
|
|
|
1464
1494
|
* or load the state into the provided graph instance.
|
|
1465
1495
|
*/
|
|
1466
1496
|
createGraph(e) {
|
|
1467
|
-
const t = /* @__PURE__ */ new Map(),
|
|
1497
|
+
const t = /* @__PURE__ */ new Map(), o = (h) => {
|
|
1468
1498
|
const N = re();
|
|
1469
1499
|
return t.set(h, N), N;
|
|
1470
|
-
},
|
|
1500
|
+
}, s = (h) => {
|
|
1471
1501
|
const N = t.get(h);
|
|
1472
1502
|
if (!N) throw new Error(`Unable to create graph from template: Could not map old id ${h} to new id`);
|
|
1473
1503
|
return N;
|
|
1474
1504
|
}, a = (h) => Qo(h, (N) => ({
|
|
1475
|
-
id:
|
|
1505
|
+
id: o(N.id),
|
|
1476
1506
|
templateId: N.id,
|
|
1477
1507
|
value: N.value
|
|
1478
1508
|
})), i = this.nodes.map((h) => ({
|
|
1479
1509
|
...h,
|
|
1480
|
-
id:
|
|
1510
|
+
id: o(h.id),
|
|
1481
1511
|
inputs: a(h.inputs),
|
|
1482
1512
|
outputs: a(h.outputs)
|
|
1483
1513
|
})), r = this.connections.map((h) => ({
|
|
1484
|
-
id:
|
|
1485
|
-
from:
|
|
1486
|
-
to:
|
|
1514
|
+
id: o(h.id),
|
|
1515
|
+
from: s(h.from),
|
|
1516
|
+
to: s(h.to)
|
|
1487
1517
|
})), l = this.inputs.map((h) => ({
|
|
1488
1518
|
id: h.id,
|
|
1489
1519
|
name: h.name,
|
|
1490
|
-
nodeId:
|
|
1491
|
-
nodeInterfaceId:
|
|
1520
|
+
nodeId: s(h.nodeId),
|
|
1521
|
+
nodeInterfaceId: s(h.nodeInterfaceId)
|
|
1492
1522
|
})), u = this.outputs.map((h) => ({
|
|
1493
1523
|
id: h.id,
|
|
1494
1524
|
name: h.name,
|
|
1495
|
-
nodeId:
|
|
1496
|
-
nodeInterfaceId:
|
|
1525
|
+
nodeId: s(h.nodeId),
|
|
1526
|
+
nodeInterfaceId: s(h.nodeInterfaceId)
|
|
1497
1527
|
})), f = {
|
|
1498
1528
|
id: re(),
|
|
1499
1529
|
nodes: i,
|
|
@@ -1506,18 +1536,18 @@ class Ne extends jt {
|
|
|
1506
1536
|
}
|
|
1507
1537
|
const Zo = (n) => !(n instanceof Ie);
|
|
1508
1538
|
function es(n, e) {
|
|
1509
|
-
return { switchGraph: (
|
|
1510
|
-
let
|
|
1511
|
-
if (Zo(
|
|
1512
|
-
|
|
1539
|
+
return { switchGraph: (o) => {
|
|
1540
|
+
let s;
|
|
1541
|
+
if (Zo(o))
|
|
1542
|
+
s = new Ie(n.value), o.createGraph(s);
|
|
1513
1543
|
else {
|
|
1514
|
-
if (
|
|
1544
|
+
if (o !== n.value.graph)
|
|
1515
1545
|
throw new Error(
|
|
1516
1546
|
"Can only switch using 'Graph' instance when it is the root graph. Otherwise a 'GraphTemplate' must be used."
|
|
1517
1547
|
);
|
|
1518
|
-
|
|
1548
|
+
s = o;
|
|
1519
1549
|
}
|
|
1520
|
-
e.value && e.value !== n.value.graph && e.value.destroy(),
|
|
1550
|
+
e.value && e.value !== n.value.graph && e.value.destroy(), s.panning = s.panning ?? o.panning ?? { x: 0, y: 0 }, s.scaling = s.scaling ?? o.scaling ?? 1, s.selectedNodes = s.selectedNodes ?? [], s.sidebar = s.sidebar ?? { visible: !1, nodeId: "", optionName: "" }, e.value = s, s.code?.engine?.runOnce(null);
|
|
1521
1551
|
} };
|
|
1522
1552
|
}
|
|
1523
1553
|
function ts(n) {
|
|
@@ -1527,8 +1557,8 @@ var we = { exports: {} };
|
|
|
1527
1557
|
var ns = we.exports, Fe;
|
|
1528
1558
|
function os() {
|
|
1529
1559
|
return Fe || (Fe = 1, (function(n, e) {
|
|
1530
|
-
(function(
|
|
1531
|
-
n.exports =
|
|
1560
|
+
(function(o, s) {
|
|
1561
|
+
n.exports = s();
|
|
1532
1562
|
})(ns, function() {
|
|
1533
1563
|
return (
|
|
1534
1564
|
/******/
|
|
@@ -1604,26 +1634,26 @@ function os() {
|
|
|
1604
1634
|
container: I
|
|
1605
1635
|
});
|
|
1606
1636
|
}, pe = Z;
|
|
1607
|
-
function
|
|
1637
|
+
function K(g) {
|
|
1608
1638
|
"@babel/helpers - typeof";
|
|
1609
|
-
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ?
|
|
1639
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? K = function(_) {
|
|
1610
1640
|
return typeof _;
|
|
1611
|
-
} :
|
|
1641
|
+
} : K = function(_) {
|
|
1612
1642
|
return _ && typeof Symbol == "function" && _.constructor === Symbol && _ !== Symbol.prototype ? "symbol" : typeof _;
|
|
1613
|
-
},
|
|
1643
|
+
}, K(g);
|
|
1614
1644
|
}
|
|
1615
1645
|
function k(g, c) {
|
|
1616
1646
|
if (!(g instanceof c))
|
|
1617
1647
|
throw new TypeError("Cannot call a class as a function");
|
|
1618
1648
|
}
|
|
1619
|
-
function
|
|
1649
|
+
function R(g, c) {
|
|
1620
1650
|
for (var _ = 0; _ < c.length; _++) {
|
|
1621
1651
|
var x = c[_];
|
|
1622
1652
|
x.enumerable = x.enumerable || !1, x.configurable = !0, "value" in x && (x.writable = !0), Object.defineProperty(g, x.key, x);
|
|
1623
1653
|
}
|
|
1624
1654
|
}
|
|
1625
1655
|
function z(g, c, _) {
|
|
1626
|
-
return c &&
|
|
1656
|
+
return c && R(g.prototype, c), _ && R(g, _), g;
|
|
1627
1657
|
}
|
|
1628
1658
|
function ge(g, c) {
|
|
1629
1659
|
if (typeof c != "function" && c !== null)
|
|
@@ -1648,7 +1678,7 @@ function os() {
|
|
|
1648
1678
|
};
|
|
1649
1679
|
}
|
|
1650
1680
|
function be(g, c) {
|
|
1651
|
-
return c && (
|
|
1681
|
+
return c && (K(c) === "object" || typeof c == "function") ? c : ye(g);
|
|
1652
1682
|
}
|
|
1653
1683
|
function ye(g) {
|
|
1654
1684
|
if (g === void 0)
|
|
@@ -1686,7 +1716,7 @@ function os() {
|
|
|
1686
1716
|
key: "resolveOptions",
|
|
1687
1717
|
value: function() {
|
|
1688
1718
|
var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1689
|
-
this.action = typeof I.action == "function" ? I.action : this.defaultAction, this.target = typeof I.target == "function" ? I.target : this.defaultTarget, this.text = typeof I.text == "function" ? I.text : this.defaultText, this.container =
|
|
1719
|
+
this.action = typeof I.action == "function" ? I.action : this.defaultAction, this.target = typeof I.target == "function" ? I.target : this.defaultTarget, this.text = typeof I.text == "function" ? I.text : this.defaultText, this.container = K(I.container) === "object" ? I.container : document.body;
|
|
1690
1720
|
}
|
|
1691
1721
|
/**
|
|
1692
1722
|
* Adds a click event listener to the passed trigger.
|
|
@@ -1965,11 +1995,11 @@ function os() {
|
|
|
1965
1995
|
})
|
|
1966
1996
|
)
|
|
1967
1997
|
/******/
|
|
1968
|
-
},
|
|
1969
|
-
function
|
|
1970
|
-
if (
|
|
1971
|
-
return
|
|
1972
|
-
var i =
|
|
1998
|
+
}, o = {};
|
|
1999
|
+
function s(a) {
|
|
2000
|
+
if (o[a])
|
|
2001
|
+
return o[a].exports;
|
|
2002
|
+
var i = o[a] = {
|
|
1973
2003
|
/******/
|
|
1974
2004
|
// no module.id needed
|
|
1975
2005
|
/******/
|
|
@@ -1978,10 +2008,10 @@ function os() {
|
|
|
1978
2008
|
exports: {}
|
|
1979
2009
|
/******/
|
|
1980
2010
|
};
|
|
1981
|
-
return t[a](i, i.exports,
|
|
2011
|
+
return t[a](i, i.exports, s), i.exports;
|
|
1982
2012
|
}
|
|
1983
2013
|
return (function() {
|
|
1984
|
-
|
|
2014
|
+
s.n = function(a) {
|
|
1985
2015
|
var i = a && a.__esModule ? (
|
|
1986
2016
|
/******/
|
|
1987
2017
|
function() {
|
|
@@ -1993,18 +2023,18 @@ function os() {
|
|
|
1993
2023
|
return a;
|
|
1994
2024
|
}
|
|
1995
2025
|
);
|
|
1996
|
-
return
|
|
2026
|
+
return s.d(i, { a: i }), i;
|
|
1997
2027
|
};
|
|
1998
2028
|
})(), (function() {
|
|
1999
|
-
|
|
2029
|
+
s.d = function(a, i) {
|
|
2000
2030
|
for (var r in i)
|
|
2001
|
-
|
|
2031
|
+
s.o(i, r) && !s.o(a, r) && Object.defineProperty(a, r, { enumerable: !0, get: i[r] });
|
|
2002
2032
|
};
|
|
2003
2033
|
})(), (function() {
|
|
2004
|
-
|
|
2034
|
+
s.o = function(a, i) {
|
|
2005
2035
|
return Object.prototype.hasOwnProperty.call(a, i);
|
|
2006
2036
|
};
|
|
2007
|
-
})(),
|
|
2037
|
+
})(), s(686);
|
|
2008
2038
|
})().default
|
|
2009
2039
|
);
|
|
2010
2040
|
});
|
|
@@ -2013,16 +2043,16 @@ function os() {
|
|
|
2013
2043
|
var ss = os();
|
|
2014
2044
|
const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
2015
2045
|
toClipboard(e, t) {
|
|
2016
|
-
return new Promise((
|
|
2046
|
+
return new Promise((o, s) => {
|
|
2017
2047
|
const a = document.createElement("button"), i = new as(a, {
|
|
2018
2048
|
text: () => e,
|
|
2019
2049
|
action: () => "copy",
|
|
2020
2050
|
container: t !== void 0 ? t : document.body
|
|
2021
2051
|
});
|
|
2022
2052
|
i.on("success", (r) => {
|
|
2023
|
-
i.destroy(), s(r);
|
|
2024
|
-
}), i.on("error", (r) => {
|
|
2025
2053
|
i.destroy(), o(r);
|
|
2054
|
+
}), i.on("error", (r) => {
|
|
2055
|
+
i.destroy(), s(r);
|
|
2026
2056
|
}), document.body.appendChild(a), a.click(), document.body.removeChild(a);
|
|
2027
2057
|
});
|
|
2028
2058
|
}
|
|
@@ -2033,22 +2063,22 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2033
2063
|
__name: "CopyToClipboard",
|
|
2034
2064
|
props: { text: String },
|
|
2035
2065
|
setup(n) {
|
|
2036
|
-
const { toClipboard: e } = rs(),
|
|
2066
|
+
const { toClipboard: e } = rs(), o = $e(n, "text"), s = H(!1), a = async () => {
|
|
2037
2067
|
try {
|
|
2038
|
-
await e(
|
|
2068
|
+
await e(o.value), s.value = !0, setTimeout(() => s.value = !1, 1500), console.log("Copied to clipboard");
|
|
2039
2069
|
} catch (i) {
|
|
2040
2070
|
console.error(i);
|
|
2041
2071
|
}
|
|
2042
2072
|
};
|
|
2043
2073
|
return (i, r) => (p(), b("div", null, [
|
|
2044
|
-
|
|
2045
|
-
|
|
2074
|
+
s.value ? (p(), b("button", is, [
|
|
2075
|
+
L(O(Ln))
|
|
2046
2076
|
])) : (p(), b("button", {
|
|
2047
2077
|
key: 1,
|
|
2048
2078
|
onClick: a,
|
|
2049
2079
|
class: "baklava-button"
|
|
2050
2080
|
}, [
|
|
2051
|
-
|
|
2081
|
+
L(O(zn))
|
|
2052
2082
|
]))
|
|
2053
2083
|
]));
|
|
2054
2084
|
}
|
|
@@ -2058,12 +2088,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2058
2088
|
locked: { type: Boolean },
|
|
2059
2089
|
extensions: {}
|
|
2060
2090
|
}, {
|
|
2061
|
-
modelValue: { required: !0
|
|
2091
|
+
modelValue: { required: !0 },
|
|
2062
2092
|
modelModifiers: {}
|
|
2063
2093
|
}),
|
|
2064
2094
|
emits: /* @__PURE__ */ Be(["update:locked"], ["update:modelValue"]),
|
|
2065
2095
|
setup(n, { emit: e }) {
|
|
2066
|
-
const t = Nt(n, "modelValue"),
|
|
2096
|
+
const t = Nt(n, "modelValue"), o = e, s = (a) => o("update:locked", a);
|
|
2067
2097
|
return (a, i) => {
|
|
2068
2098
|
const r = qe("codemirror");
|
|
2069
2099
|
return p(), b("div", ds, [
|
|
@@ -2072,19 +2102,19 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2072
2102
|
key: 0,
|
|
2073
2103
|
class: "baklava-button",
|
|
2074
2104
|
title: "The code is locked.",
|
|
2075
|
-
onClick: i[0] || (i[0] = (l) =>
|
|
2105
|
+
onClick: i[0] || (i[0] = (l) => s(!1))
|
|
2076
2106
|
}, [
|
|
2077
|
-
|
|
2078
|
-
])) :
|
|
2079
|
-
|
|
2107
|
+
L(O(mt))
|
|
2108
|
+
])) : j("", !0),
|
|
2109
|
+
L(ls, { text: n.modelValue }, null, 8, ["text"])
|
|
2080
2110
|
]),
|
|
2081
|
-
|
|
2111
|
+
L(r, {
|
|
2082
2112
|
modelValue: t.value,
|
|
2083
2113
|
"onUpdate:modelValue": i[1] || (i[1] = (l) => t.value = l),
|
|
2084
2114
|
extensions: n.extensions,
|
|
2085
2115
|
class: "codemirror",
|
|
2086
2116
|
style: { height: "100%" },
|
|
2087
|
-
onKeydown: i[2] || (i[2] = (l) =>
|
|
2117
|
+
onKeydown: i[2] || (i[2] = (l) => s(!0))
|
|
2088
2118
|
}, null, 8, ["modelValue", "extensions"])
|
|
2089
2119
|
]);
|
|
2090
2120
|
};
|
|
@@ -2095,22 +2125,22 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2095
2125
|
viewModel: {}
|
|
2096
2126
|
},
|
|
2097
2127
|
setup(n) {
|
|
2098
|
-
const t = $e(n, "viewModel"),
|
|
2099
|
-
return Se(t.value.onMounted), Je(t.value.onBeforeUnmount), Qe(t, (
|
|
2100
|
-
a && a.onBeforeUnmount(),
|
|
2101
|
-
}), (
|
|
2128
|
+
const t = $e(n, "viewModel"), o = (s) => s.events.update.emit(null);
|
|
2129
|
+
return Se(t.value.onMounted), Je(t.value.onBeforeUnmount), Qe(t, (s, a) => {
|
|
2130
|
+
a && a.onBeforeUnmount(), s && s.onMounted();
|
|
2131
|
+
}), (s, a) => (p(), B(O(Jt), { "view-model": t.value }, {
|
|
2102
2132
|
palette: ee(() => [
|
|
2103
|
-
|
|
2133
|
+
L(O(Bs))
|
|
2104
2134
|
]),
|
|
2105
2135
|
node: ee((i) => [
|
|
2106
|
-
|
|
2107
|
-
onUpdate: (r) =>
|
|
2136
|
+
L(O(ws), Ot(i, {
|
|
2137
|
+
onUpdate: (r) => o(i.node)
|
|
2108
2138
|
}), null, 16, ["onUpdate"])
|
|
2109
2139
|
]),
|
|
2110
2140
|
sidebar: ee((i) => [
|
|
2111
|
-
|
|
2141
|
+
L(O(As), Et(Tt(i)), {
|
|
2112
2142
|
codeEditor: ee(({ node: r }) => [
|
|
2113
|
-
q(
|
|
2143
|
+
q(s.$slots, "sidebarCodeEditor", { node: r })
|
|
2114
2144
|
]),
|
|
2115
2145
|
_: 3
|
|
2116
2146
|
}, 16)
|
|
@@ -2147,62 +2177,62 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2147
2177
|
},
|
|
2148
2178
|
emits: ["select", "start-drag", "update"],
|
|
2149
2179
|
setup(n, { emit: e }) {
|
|
2150
|
-
const t = Me.ContextMenu,
|
|
2180
|
+
const t = Me.ContextMenu, o = Me.NodeInterface, s = n, a = G(() => s.node), i = e, { viewModel: r } = me(), { graph: l, switchGraph: u } = Le(), f = H(null), C = H(!1), h = H(""), N = H(null), v = H(!1);
|
|
2151
2181
|
let w = 0, d = 0;
|
|
2152
|
-
const y = H(!1), $ =
|
|
2182
|
+
const y = H(!1), $ = G(() => {
|
|
2153
2183
|
const M = [
|
|
2154
2184
|
{ value: "edit", label: "Edit" },
|
|
2155
2185
|
{ value: "rename", label: "Rename" },
|
|
2156
2186
|
{ value: "delete", label: "Delete" }
|
|
2157
2187
|
];
|
|
2158
|
-
return
|
|
2159
|
-
}), T =
|
|
2160
|
-
"--selected":
|
|
2161
|
-
"--dragging":
|
|
2162
|
-
"--two-column": !!
|
|
2188
|
+
return s.node.type.startsWith(jt) && M.push({ value: "editSubgraph", label: "Edit Subgraph" }), M;
|
|
2189
|
+
}), T = G(() => ({
|
|
2190
|
+
"--selected": s.selected,
|
|
2191
|
+
"--dragging": s.dragging,
|
|
2192
|
+
"--two-column": !!s.node.twoColumn,
|
|
2163
2193
|
"--hidden": a.value.state?.hidden
|
|
2164
|
-
})), S =
|
|
2165
|
-
"--reverse-y":
|
|
2166
|
-
})), Q =
|
|
2167
|
-
top: `${
|
|
2168
|
-
left: `${
|
|
2169
|
-
"--width": `${
|
|
2170
|
-
})), Z =
|
|
2194
|
+
})), S = G(() => ({
|
|
2195
|
+
"--reverse-y": s.node.reverseY ?? r.value.settings.nodes.reverseY
|
|
2196
|
+
})), Q = G(() => ({
|
|
2197
|
+
top: `${s.node.position?.y ?? 0}px`,
|
|
2198
|
+
left: `${s.node.position?.x ?? 0}px`,
|
|
2199
|
+
"--width": `${s.node.width ?? r.value.settings.nodes.defaultWidth}px`
|
|
2200
|
+
})), Z = G(() => Object.values(s.node.inputs).filter((M) => !M.hidden)), pe = G(() => Object.values(s.node.outputs).filter((M) => !M.hidden)), K = () => {
|
|
2171
2201
|
i("select");
|
|
2172
2202
|
}, k = (M) => {
|
|
2173
|
-
|
|
2174
|
-
},
|
|
2203
|
+
s.selected || K(), i("start-drag", M);
|
|
2204
|
+
}, R = () => {
|
|
2175
2205
|
y.value = !0;
|
|
2176
2206
|
}, z = () => {
|
|
2177
2207
|
const M = r.value.displayedGraph.sidebar;
|
|
2178
2208
|
M.nodeId = "", M.visible = !1;
|
|
2179
2209
|
}, ge = () => {
|
|
2180
2210
|
const M = r.value.displayedGraph.sidebar;
|
|
2181
|
-
M.nodeId =
|
|
2211
|
+
M.nodeId = s.node.id, M.visible = !0;
|
|
2182
2212
|
}, he = () => {
|
|
2183
2213
|
const M = r.value.displayedGraph.sidebar;
|
|
2184
|
-
M.nodeId =
|
|
2214
|
+
M.nodeId = s.node.id;
|
|
2185
2215
|
}, Ee = async (M) => {
|
|
2186
2216
|
switch (M) {
|
|
2187
2217
|
case "edit":
|
|
2188
2218
|
ge();
|
|
2189
2219
|
break;
|
|
2190
2220
|
case "delete":
|
|
2191
|
-
l.value.removeNode(
|
|
2221
|
+
l.value.removeNode(s.node);
|
|
2192
2222
|
break;
|
|
2193
2223
|
case "rename":
|
|
2194
|
-
h.value =
|
|
2224
|
+
h.value = s.node.title, C.value = !0, await Mt(), N.value?.focus();
|
|
2195
2225
|
break;
|
|
2196
2226
|
case "editSubgraph":
|
|
2197
|
-
u(
|
|
2227
|
+
u(s.node.template);
|
|
2198
2228
|
break;
|
|
2199
2229
|
}
|
|
2200
2230
|
}, be = () => {
|
|
2201
2231
|
a.value.title = h.value, C.value = !1;
|
|
2202
2232
|
}, ye = () => {
|
|
2203
|
-
f.value && r.value.hooks.renderNode.execute({ node:
|
|
2233
|
+
f.value && r.value.hooks.renderNode.execute({ node: s.node, el: f.value });
|
|
2204
2234
|
}, Te = (M) => {
|
|
2205
|
-
v.value = !0, w =
|
|
2235
|
+
v.value = !0, w = s.node.width, d = M.clientX, M.preventDefault();
|
|
2206
2236
|
}, se = (M) => {
|
|
2207
2237
|
a.value.state && (a.value.state.integrated = M, i("update"));
|
|
2208
2238
|
}, le = (M) => {
|
|
@@ -2220,20 +2250,20 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2220
2250
|
class: oe([T.value, "baklava-node"]),
|
|
2221
2251
|
"data-node-type": a.value.type,
|
|
2222
2252
|
id: a.value.id,
|
|
2223
|
-
style:
|
|
2253
|
+
style: Ge(Q.value),
|
|
2224
2254
|
ref_key: "el",
|
|
2225
2255
|
ref: f,
|
|
2226
|
-
onPointerdown:
|
|
2256
|
+
onPointerdown: K
|
|
2227
2257
|
}, [
|
|
2228
2258
|
O(r).settings.nodes.resizable ? (p(), b("div", {
|
|
2229
2259
|
key: 0,
|
|
2230
2260
|
class: "__resize-handle",
|
|
2231
2261
|
onMousedown: Te
|
|
2232
|
-
}, null, 32)) :
|
|
2262
|
+
}, null, 32)) : j("", !0),
|
|
2233
2263
|
m("div", {
|
|
2234
2264
|
class: "__title",
|
|
2235
2265
|
onPointerdown: de(k, ["self", "stop"]),
|
|
2236
|
-
onContextmenu: de(
|
|
2266
|
+
onContextmenu: de(R, ["prevent"])
|
|
2237
2267
|
}, [
|
|
2238
2268
|
a.value.inputs._code ? (p(), B(O(Ye), {
|
|
2239
2269
|
key: 0,
|
|
@@ -2243,7 +2273,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2243
2273
|
class: "--input",
|
|
2244
2274
|
"data-interface-type": "node",
|
|
2245
2275
|
style: { "flex-grow": "0" }
|
|
2246
|
-
}, null, 8, ["intf", "node", "title"])) :
|
|
2276
|
+
}, null, 8, ["intf", "node", "title"])) : j("", !0),
|
|
2247
2277
|
C.value ? ke((p(), b("input", {
|
|
2248
2278
|
key: 2,
|
|
2249
2279
|
ref_key: "renameInputEl",
|
|
@@ -2259,7 +2289,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2259
2289
|
[xe, h.value]
|
|
2260
2290
|
]) : (p(), b(U, { key: 1 }, [
|
|
2261
2291
|
m("div", hs, [
|
|
2262
|
-
a.value.idx > -1 ? (p(), b("span", fs, P(a.value.idx + 1) + " > ", 1)) :
|
|
2292
|
+
a.value.idx > -1 ? (p(), b("span", fs, P(a.value.idx + 1) + " > ", 1)) : j("", !0),
|
|
2263
2293
|
et(P(a.value.title), 1)
|
|
2264
2294
|
]),
|
|
2265
2295
|
m("div", ms, [
|
|
@@ -2268,12 +2298,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2268
2298
|
key: 0,
|
|
2269
2299
|
class: "--clickable mx-1",
|
|
2270
2300
|
onClick: g[0] || (g[0] = (c) => a.value.lockCode = !1)
|
|
2271
|
-
})) :
|
|
2301
|
+
})) : j("", !0),
|
|
2272
2302
|
a.value.state.integrated ? (p(), B(O(Pn), {
|
|
2273
2303
|
key: 1,
|
|
2274
2304
|
class: "--clickable mx-1",
|
|
2275
2305
|
onClick: g[1] || (g[1] = (c) => se(!1))
|
|
2276
|
-
})) : (p(), B(O(
|
|
2306
|
+
})) : (p(), B(O(Ro), {
|
|
2277
2307
|
key: 2,
|
|
2278
2308
|
class: "--clickable mx-1",
|
|
2279
2309
|
onClick: g[2] || (g[2] = (c) => se(!0))
|
|
@@ -2291,12 +2321,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2291
2321
|
class: "--clickable mx-1",
|
|
2292
2322
|
onClick: z
|
|
2293
2323
|
}))
|
|
2294
|
-
], 64)) :
|
|
2295
|
-
|
|
2324
|
+
], 64)) : j("", !0),
|
|
2325
|
+
L(O(Yn), {
|
|
2296
2326
|
class: "--clickable mx-1",
|
|
2297
|
-
onClick:
|
|
2327
|
+
onClick: R
|
|
2298
2328
|
}),
|
|
2299
|
-
|
|
2329
|
+
L(O(t), {
|
|
2300
2330
|
modelValue: y.value,
|
|
2301
2331
|
"onUpdate:modelValue": g[3] || (g[3] = (c) => y.value = c),
|
|
2302
2332
|
x: 0,
|
|
@@ -2313,7 +2343,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2313
2343
|
class: "--output",
|
|
2314
2344
|
title: a.value.outputs._code.value,
|
|
2315
2345
|
"data-interface-type": "node"
|
|
2316
|
-
}, null, 8, ["node", "intf", "title"])) :
|
|
2346
|
+
}, null, 8, ["node", "intf", "title"])) : j("", !0)
|
|
2317
2347
|
], 32),
|
|
2318
2348
|
m("div", {
|
|
2319
2349
|
class: oe(["__content", S.value]),
|
|
@@ -2334,14 +2364,14 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2334
2364
|
class: "baklava-node-interface --output --connected"
|
|
2335
2365
|
}, [...g[7] || (g[7] = [
|
|
2336
2366
|
m("div", { class: "__port" }, null, -1)
|
|
2337
|
-
])], 8, bs)) :
|
|
2367
|
+
])], 8, bs)) : j("", !0)
|
|
2338
2368
|
])) : q(M.$slots, "nodeInterface", {
|
|
2339
2369
|
key: 1,
|
|
2340
2370
|
type: "output",
|
|
2341
2371
|
node: a.value,
|
|
2342
2372
|
intf: c
|
|
2343
2373
|
}, () => [
|
|
2344
|
-
|
|
2374
|
+
L(O(o), {
|
|
2345
2375
|
node: a.value,
|
|
2346
2376
|
intf: c,
|
|
2347
2377
|
title: c.value
|
|
@@ -2361,14 +2391,14 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2361
2391
|
class: "baklava-node-interface --input --connected"
|
|
2362
2392
|
}, [...g[8] || (g[8] = [
|
|
2363
2393
|
m("div", { class: "__port" }, null, -1)
|
|
2364
|
-
])], 8, Cs)) :
|
|
2394
|
+
])], 8, Cs)) : j("", !0)
|
|
2365
2395
|
])) : q(M.$slots, "nodeInterface", {
|
|
2366
2396
|
key: 1,
|
|
2367
2397
|
node: a.value,
|
|
2368
2398
|
intf: c,
|
|
2369
2399
|
type: "input"
|
|
2370
2400
|
}, () => [
|
|
2371
|
-
|
|
2401
|
+
L(O(o), {
|
|
2372
2402
|
node: a.value,
|
|
2373
2403
|
intf: c,
|
|
2374
2404
|
title: c.value
|
|
@@ -2386,12 +2416,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2386
2416
|
intf: {}
|
|
2387
2417
|
},
|
|
2388
2418
|
setup(n) {
|
|
2389
|
-
const e = n, { viewModel: t } = me(), { hoveredOver:
|
|
2419
|
+
const e = n, { viewModel: t } = me(), { hoveredOver: o, temporaryConnection: s } = Qt(), a = H(null), i = G(() => e.intf.connectionCount > 0), r = G(() => ({
|
|
2390
2420
|
"--connected": i.value
|
|
2391
2421
|
})), l = () => {
|
|
2392
|
-
|
|
2422
|
+
o(e.intf);
|
|
2393
2423
|
}, u = () => {
|
|
2394
|
-
|
|
2424
|
+
o(void 0);
|
|
2395
2425
|
}, f = () => {
|
|
2396
2426
|
a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
|
|
2397
2427
|
};
|
|
@@ -2403,10 +2433,10 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2403
2433
|
}, [
|
|
2404
2434
|
n.intf.port ? (p(), b("div", {
|
|
2405
2435
|
key: 0,
|
|
2406
|
-
class: oe([{ "--selected": O(
|
|
2436
|
+
class: oe([{ "--selected": O(s)?.from === n.intf }, "__port"]),
|
|
2407
2437
|
onPointerover: l,
|
|
2408
2438
|
onPointerout: u
|
|
2409
|
-
}, null, 34)) :
|
|
2439
|
+
}, null, 34)) : j("", !0),
|
|
2410
2440
|
m("span", xs, [
|
|
2411
2441
|
q(C.$slots, "default")
|
|
2412
2442
|
])
|
|
@@ -2426,12 +2456,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2426
2456
|
emits: ["update:modelValue"],
|
|
2427
2457
|
setup(n, { emit: e }) {
|
|
2428
2458
|
const t = e;
|
|
2429
|
-
return (
|
|
2459
|
+
return (o, s) => (p(), b("div", {
|
|
2430
2460
|
class: oe(["baklava-checkbox", { "--checked": n.inversed ? !n.modelValue : n.modelValue, "--disabled": n.disabled }]),
|
|
2431
2461
|
title: n.name,
|
|
2432
|
-
onClick:
|
|
2462
|
+
onClick: s[0] || (s[0] = (a) => t("update:modelValue", !n.modelValue))
|
|
2433
2463
|
}, [
|
|
2434
|
-
|
|
2464
|
+
s[1] || (s[1] = m("div", { class: "__checkmark-container" }, [
|
|
2435
2465
|
m("svg", {
|
|
2436
2466
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2437
2467
|
width: "18",
|
|
@@ -2445,28 +2475,28 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2445
2475
|
})
|
|
2446
2476
|
])
|
|
2447
2477
|
], -1)),
|
|
2448
|
-
n.name ? (p(), b("div", Ns, P(n.name), 1)) :
|
|
2478
|
+
n.name ? (p(), b("div", Ns, P(n.name), 1)) : j("", !0)
|
|
2449
2479
|
], 10, Is));
|
|
2450
2480
|
}
|
|
2451
|
-
}), Es = { class: "__header" }, Ts = { class: "__node-name" }, Os = { class: "__interfaces" }, Ms = { class: "__inputs" }, $s = { style: { display: "flex" } }, Ss = { class: "__outputs" },
|
|
2481
|
+
}), Es = { class: "__header" }, Ts = { class: "__node-name" }, Os = { class: "__interfaces" }, Ms = { class: "__inputs" }, $s = { style: { display: "flex" } }, Ss = { class: "__outputs" }, Gs = {
|
|
2452
2482
|
key: 0,
|
|
2453
2483
|
class: "__interface"
|
|
2454
|
-
},
|
|
2484
|
+
}, Ls = { style: { display: "flex" } }, As = /* @__PURE__ */ F({
|
|
2455
2485
|
__name: "CodeGraphSidebar",
|
|
2456
2486
|
setup(n) {
|
|
2457
|
-
const { viewModel: e } = me(), { graph: t } =
|
|
2487
|
+
const { viewModel: e } = me(), { graph: t } = Le(), o = H(null), s = $e(e.value.settings.sidebar, "width"), a = G(() => e.value.settings.sidebar.resizable);
|
|
2458
2488
|
let i = 0, r = 0;
|
|
2459
|
-
const l =
|
|
2489
|
+
const l = G(() => {
|
|
2460
2490
|
const y = t.value.sidebar.nodeId;
|
|
2461
2491
|
return t.value.nodes.find(($) => $.id === y);
|
|
2462
|
-
}), u =
|
|
2463
|
-
width: `${
|
|
2464
|
-
})), C =
|
|
2492
|
+
}), u = G(() => l.value), f = G(() => ({
|
|
2493
|
+
width: `${s.value}px`
|
|
2494
|
+
})), C = G(() => u.value ? Object.values(u.value.inputs).filter((y) => y.displayInSidebar && y.component) : []), h = G(() => u.value ? Object.values(u.value.outputs).filter((y) => y.displayInSidebar && y.component) : []), N = () => {
|
|
2465
2495
|
t.value.sidebar.visible = !1;
|
|
2466
2496
|
}, v = () => {
|
|
2467
2497
|
l.value?.events.update.emit(null);
|
|
2468
2498
|
}, w = (y) => {
|
|
2469
|
-
i =
|
|
2499
|
+
i = s.value, r = y.clientX, window.addEventListener("mousemove", d), window.addEventListener(
|
|
2470
2500
|
"mouseup",
|
|
2471
2501
|
() => {
|
|
2472
2502
|
window.removeEventListener("mousemove", d);
|
|
@@ -2474,21 +2504,21 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2474
2504
|
{ once: !0 }
|
|
2475
2505
|
);
|
|
2476
2506
|
}, d = (y) => {
|
|
2477
|
-
const $ =
|
|
2507
|
+
const $ = o.value?.parentElement?.getBoundingClientRect().width ?? 500, T = y.clientX - r;
|
|
2478
2508
|
let S = i - T;
|
|
2479
|
-
S < 300 ? S = 300 : S > 0.9 * $ && (S = 0.9 * $),
|
|
2509
|
+
S < 300 ? S = 300 : S > 0.9 * $ && (S = 0.9 * $), s.value = S;
|
|
2480
2510
|
};
|
|
2481
2511
|
return (y, $) => (p(), b("div", {
|
|
2482
2512
|
class: oe([{ "--open": O(t).sidebar.visible }, "baklava-sidebar"]),
|
|
2483
|
-
style:
|
|
2513
|
+
style: Ge(f.value),
|
|
2484
2514
|
ref_key: "el",
|
|
2485
|
-
ref:
|
|
2515
|
+
ref: o
|
|
2486
2516
|
}, [
|
|
2487
2517
|
a.value ? (p(), b("div", {
|
|
2488
2518
|
key: 0,
|
|
2489
2519
|
class: "__resizer",
|
|
2490
2520
|
onMousedown: w
|
|
2491
|
-
}, null, 32)) :
|
|
2521
|
+
}, null, 32)) : j("", !0),
|
|
2492
2522
|
l.value ? (p(), b(U, { key: 1 }, [
|
|
2493
2523
|
m("div", Es, [
|
|
2494
2524
|
m("button", {
|
|
@@ -2507,7 +2537,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2507
2537
|
class: "__interface"
|
|
2508
2538
|
}, [
|
|
2509
2539
|
m("div", $s, [
|
|
2510
|
-
|
|
2540
|
+
L(We, {
|
|
2511
2541
|
modelValue: T.hidden,
|
|
2512
2542
|
"onUpdate:modelValue": [
|
|
2513
2543
|
(S) => T.hidden = S,
|
|
@@ -2528,7 +2558,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2528
2558
|
]))), 128))
|
|
2529
2559
|
]),
|
|
2530
2560
|
m("div", Ss, [
|
|
2531
|
-
u.value && u.value.state ? (p(), b("div",
|
|
2561
|
+
u.value && u.value.state ? (p(), b("div", Gs, [
|
|
2532
2562
|
$[3] || ($[3] = m("label", null, "Variable name", -1)),
|
|
2533
2563
|
ke(m("input", {
|
|
2534
2564
|
"onUpdate:modelValue": $[1] || ($[1] = (T) => u.value.state.variableName = T),
|
|
@@ -2540,13 +2570,13 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2540
2570
|
}, null, 544), [
|
|
2541
2571
|
[xe, u.value.state.variableName]
|
|
2542
2572
|
])
|
|
2543
|
-
])) :
|
|
2573
|
+
])) : j("", !0),
|
|
2544
2574
|
(p(!0), b(U, null, ae(h.value, (T) => (p(), b("div", {
|
|
2545
2575
|
key: T.id,
|
|
2546
2576
|
class: "__interface"
|
|
2547
2577
|
}, [
|
|
2548
|
-
m("div",
|
|
2549
|
-
|
|
2578
|
+
m("div", Ls, [
|
|
2579
|
+
L(We, {
|
|
2550
2580
|
modelValue: T.hidden,
|
|
2551
2581
|
"onUpdate:modelValue": [
|
|
2552
2582
|
(S) => T.hidden = S,
|
|
@@ -2568,13 +2598,13 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2568
2598
|
])
|
|
2569
2599
|
]),
|
|
2570
2600
|
q(y.$slots, "codeEditor", { node: l.value })
|
|
2571
|
-
], 64)) :
|
|
2601
|
+
], 64)) : j("", !0)
|
|
2572
2602
|
], 6));
|
|
2573
2603
|
}
|
|
2574
|
-
}),
|
|
2604
|
+
}), Rs = {
|
|
2575
2605
|
class: "baklava-node --palette",
|
|
2576
2606
|
style: { "margin-top": "-20px", "margin-bottom": "20px" }
|
|
2577
|
-
},
|
|
2607
|
+
}, js = {
|
|
2578
2608
|
key: 0,
|
|
2579
2609
|
style: { display: "flex", "justify-content": "space-between" }
|
|
2580
2610
|
}, Ps = ["onClick"], Vs = {
|
|
@@ -2583,19 +2613,19 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2583
2613
|
}, Bs = /* @__PURE__ */ F({
|
|
2584
2614
|
__name: "CodeNodePalette",
|
|
2585
2615
|
setup(n) {
|
|
2586
|
-
const e = Me.PaletteEntry, { viewModel: t } = me(), { x:
|
|
2616
|
+
const e = Me.PaletteEntry, { viewModel: t } = me(), { x: o, y: s } = hn(), { transform: a } = Zt(), i = en(t), r = $t("editorEl"), l = H(""), u = H(null), f = () => l.value ? i.value.filter(
|
|
2587
2617
|
(v) => v.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(v.nodeTypes).some(
|
|
2588
2618
|
(w) => w.title.toLowerCase().includes(l.value.toLowerCase())
|
|
2589
2619
|
)
|
|
2590
2620
|
) : i.value, C = (v) => l.value ? Jo(v, (w) => {
|
|
2591
2621
|
const d = w[1];
|
|
2592
2622
|
return d.category.includes(l.value.toLowerCase()) || d.title?.toLowerCase().includes(l.value.toLowerCase());
|
|
2593
|
-
}) : v, h =
|
|
2623
|
+
}) : v, h = G(() => {
|
|
2594
2624
|
if (!u.value || !r?.value) return {};
|
|
2595
2625
|
const { left: v, top: w } = r.value.getBoundingClientRect();
|
|
2596
2626
|
return {
|
|
2597
|
-
top: `${
|
|
2598
|
-
left: `${
|
|
2627
|
+
top: `${s.value - w}px`,
|
|
2628
|
+
left: `${o.value - v}px`
|
|
2599
2629
|
};
|
|
2600
2630
|
}), N = (v, w) => {
|
|
2601
2631
|
u.value = {
|
|
@@ -2605,7 +2635,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2605
2635
|
const d = () => {
|
|
2606
2636
|
const y = te(new w.type());
|
|
2607
2637
|
t.value.displayedGraph.addNode(y);
|
|
2608
|
-
const $ = r.value.getBoundingClientRect(), [T, S] = a(
|
|
2638
|
+
const $ = r.value.getBoundingClientRect(), [T, S] = a(o.value - $.left, s.value - $.top);
|
|
2609
2639
|
y.position.x = T, y.position.y = S, u.value = null, document.removeEventListener("pointerup", d);
|
|
2610
2640
|
};
|
|
2611
2641
|
document.addEventListener("pointerup", d);
|
|
@@ -2616,7 +2646,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2616
2646
|
onContextmenu: w[1] || (w[1] = de(() => {
|
|
2617
2647
|
}, ["stop", "prevent"]))
|
|
2618
2648
|
}, [
|
|
2619
|
-
m("div",
|
|
2649
|
+
m("div", Rs, [
|
|
2620
2650
|
ke(m("input", {
|
|
2621
2651
|
"onUpdate:modelValue": w[0] || (w[0] = (d) => l.value = d),
|
|
2622
2652
|
type: "text",
|
|
@@ -2630,13 +2660,13 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2630
2660
|
(p(!0), b(U, null, ae(f(), (d) => (p(), b("section", {
|
|
2631
2661
|
key: d.name
|
|
2632
2662
|
}, [
|
|
2633
|
-
d.name !== "default" ? (p(), b("h3",
|
|
2663
|
+
d.name !== "default" ? (p(), b("h3", js, [
|
|
2634
2664
|
m("div", {
|
|
2635
2665
|
onClick: (y) => l.value = d.name,
|
|
2636
2666
|
style: { cursor: "pointer" }
|
|
2637
2667
|
}, P(d.name), 9, Ps),
|
|
2638
|
-
Object.keys(C(d.nodeTypes)).length < Object.values(d.nodeTypes).length ? (p(), b("div", Vs, " ( " + P(Object.keys(C(d.nodeTypes)).length) + " / " + P(Object.values(d.nodeTypes).length) + " ) ", 1)) :
|
|
2639
|
-
])) :
|
|
2668
|
+
Object.keys(C(d.nodeTypes)).length < Object.values(d.nodeTypes).length ? (p(), b("div", Vs, " ( " + P(Object.keys(C(d.nodeTypes)).length) + " / " + P(Object.values(d.nodeTypes).length) + " ) ", 1)) : j("", !0)
|
|
2669
|
+
])) : j("", !0),
|
|
2640
2670
|
(p(!0), b(U, null, ae(C(d.nodeTypes), (y, $) => (p(), B(O(e), {
|
|
2641
2671
|
key: $,
|
|
2642
2672
|
title: y.title,
|
|
@@ -2645,18 +2675,18 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
|
2645
2675
|
}, null, 8, ["title", "type", "onPointerdown"]))), 128))
|
|
2646
2676
|
]))), 128))
|
|
2647
2677
|
], 34),
|
|
2648
|
-
|
|
2678
|
+
L(St, { name: "fade" }, {
|
|
2649
2679
|
default: ee(() => [
|
|
2650
2680
|
u.value ? (p(), b("div", {
|
|
2651
2681
|
key: 0,
|
|
2652
2682
|
class: "baklava-dragged-node",
|
|
2653
|
-
style:
|
|
2683
|
+
style: Ge(h.value)
|
|
2654
2684
|
}, [
|
|
2655
|
-
|
|
2685
|
+
L(O(e), {
|
|
2656
2686
|
type: u.value.type,
|
|
2657
2687
|
title: u.value.nodeInformation.title
|
|
2658
2688
|
}, null, 8, ["type", "title"])
|
|
2659
|
-
], 4)) :
|
|
2689
|
+
], 4)) : j("", !0)
|
|
2660
2690
|
]),
|
|
2661
2691
|
_: 1
|
|
2662
2692
|
})
|
|
@@ -2678,7 +2708,7 @@ function Ds(n, e) {
|
|
|
2678
2708
|
_: 3
|
|
2679
2709
|
});
|
|
2680
2710
|
}
|
|
2681
|
-
const
|
|
2711
|
+
const Xe = /* @__PURE__ */ A(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys = ["onClick"], xa = /* @__PURE__ */ F({
|
|
2682
2712
|
__name: "NavBar",
|
|
2683
2713
|
props: {
|
|
2684
2714
|
viewModel: {},
|
|
@@ -2687,12 +2717,12 @@ const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
|
|
|
2687
2717
|
},
|
|
2688
2718
|
emits: ["click:remove"],
|
|
2689
2719
|
setup(n, { emit: e }) {
|
|
2690
|
-
const t = e,
|
|
2691
|
-
t("click:remove",
|
|
2720
|
+
const t = e, o = (s) => {
|
|
2721
|
+
t("click:remove", s);
|
|
2692
2722
|
};
|
|
2693
|
-
return (
|
|
2694
|
-
q(
|
|
2695
|
-
(p(!0), b(U, null, ae(n.editorStates, (i) => (p(), B(
|
|
2723
|
+
return (s, a) => (p(), b("nav", Fs, [
|
|
2724
|
+
q(s.$slots, "prepend"),
|
|
2725
|
+
(p(!0), b(U, null, ae(n.editorStates, (i) => (p(), B(Xe, {
|
|
2696
2726
|
key: i.graph.id,
|
|
2697
2727
|
class: oe({ active: i.graph.id === n.viewModel.displayedGraph.id }),
|
|
2698
2728
|
to: { name: n.routes?.edit ?? "edit", params: { editorId: i.graph.id } }
|
|
@@ -2700,9 +2730,9 @@ const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
|
|
|
2700
2730
|
appendIcon: ee(() => [
|
|
2701
2731
|
m("button", {
|
|
2702
2732
|
class: "remove",
|
|
2703
|
-
onClick: de((r) =>
|
|
2733
|
+
onClick: de((r) => o(i.graph.id), ["prevent"])
|
|
2704
2734
|
}, [
|
|
2705
|
-
|
|
2735
|
+
L(O(Do))
|
|
2706
2736
|
], 8, Ys)
|
|
2707
2737
|
]),
|
|
2708
2738
|
default: ee(() => [
|
|
@@ -2710,13 +2740,13 @@ const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
|
|
|
2710
2740
|
]),
|
|
2711
2741
|
_: 2
|
|
2712
2742
|
}, 1032, ["class", "to"]))), 128)),
|
|
2713
|
-
q(
|
|
2714
|
-
|
|
2743
|
+
q(s.$slots, "append", {}, () => [
|
|
2744
|
+
L(Xe, {
|
|
2715
2745
|
to: { name: n.routes?.new ?? "new" },
|
|
2716
2746
|
class: "navItem"
|
|
2717
2747
|
}, {
|
|
2718
2748
|
default: ee(() => [
|
|
2719
|
-
|
|
2749
|
+
L(O(xo), { class: "plus" })
|
|
2720
2750
|
]),
|
|
2721
2751
|
_: 1
|
|
2722
2752
|
}, 8, ["to"])
|
|
@@ -2727,32 +2757,32 @@ const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
|
|
|
2727
2757
|
class xt extends wt {
|
|
2728
2758
|
_title = "Subgraph Input";
|
|
2729
2759
|
inputs = {
|
|
2730
|
-
_code: new D("_code", "").use(V,
|
|
2760
|
+
_code: new D("_code", "").use(V, X).setHidden(!0),
|
|
2731
2761
|
name: new at("Name", "Input").setPort(!1)
|
|
2732
2762
|
};
|
|
2733
2763
|
outputs = {
|
|
2734
|
-
_code: new D("_code", "").use(V,
|
|
2764
|
+
_code: new D("_code", "").use(V, X).setHidden(!0),
|
|
2735
2765
|
placeholder: new J("Connection", void 0)
|
|
2736
2766
|
};
|
|
2737
2767
|
}
|
|
2738
2768
|
class It extends kt {
|
|
2739
2769
|
_title = "Subgraph Output";
|
|
2740
2770
|
inputs = {
|
|
2741
|
-
_code: new D("_code", "").use(V,
|
|
2771
|
+
_code: new D("_code", "").use(V, X).setHidden(!0),
|
|
2742
2772
|
name: new at("Name", "Output").setPort(!1),
|
|
2743
2773
|
placeholder: new J("Connection", void 0)
|
|
2744
2774
|
};
|
|
2745
2775
|
outputs = {
|
|
2746
|
-
_code: new D("_code", "").use(V,
|
|
2776
|
+
_code: new D("_code", "").use(V, X).setHidden(!0),
|
|
2747
2777
|
output: new J("Output", void 0).setHidden(!0)
|
|
2748
2778
|
};
|
|
2749
2779
|
}
|
|
2750
|
-
const Ws = "CREATE_SUBGRAPH",
|
|
2751
|
-
function
|
|
2752
|
-
const
|
|
2780
|
+
const Ws = "CREATE_SUBGRAPH", Ke = [Pt, Vt];
|
|
2781
|
+
function Xs(n, e, t) {
|
|
2782
|
+
const o = () => n.value.selectedNodes.filter((a) => !Ke.includes(a.type)).length > 0, s = () => {
|
|
2753
2783
|
const { viewModel: a } = me(), i = n.value, r = n.value.editor;
|
|
2754
2784
|
if (i.selectedNodes.length === 0) return;
|
|
2755
|
-
const l = i.selectedNodes.filter((k) => !
|
|
2785
|
+
const l = i.selectedNodes.filter((k) => !Ke.includes(k.type)), u = l.flatMap((k) => Object.values(k.inputs)), f = l.flatMap((k) => Object.values(k.outputs)), C = i.connections.filter(
|
|
2756
2786
|
(k) => !f.includes(k.from) && u.includes(k.to)
|
|
2757
2787
|
), h = i.connections.filter(
|
|
2758
2788
|
(k) => f.includes(k.from) && !u.includes(k.to)
|
|
@@ -2762,20 +2792,20 @@ function Ks(n, e, t) {
|
|
|
2762
2792
|
id: k.id,
|
|
2763
2793
|
from: k.from.id,
|
|
2764
2794
|
to: k.to.id
|
|
2765
|
-
})), d = /* @__PURE__ */ new Map(), { xLeft: y, xRight: $, yTop: T } =
|
|
2766
|
-
for (const [k,
|
|
2795
|
+
})), d = /* @__PURE__ */ new Map(), { xLeft: y, xRight: $, yTop: T } = Ks(l);
|
|
2796
|
+
for (const [k, R] of C.entries()) {
|
|
2767
2797
|
const z = new xt();
|
|
2768
|
-
z.inputs.name.value =
|
|
2798
|
+
z.inputs.name.value = R.to.name, v.push({
|
|
2769
2799
|
...z.save(),
|
|
2770
2800
|
position: { x: $ - a.value.settings.nodes.defaultWidth - 100, y: T + k * 200 }
|
|
2771
|
-
}), w.push({ id: re(), from: z.outputs.placeholder.id, to:
|
|
2801
|
+
}), w.push({ id: re(), from: z.outputs.placeholder.id, to: R.to.id }), d.set(R.to.id, z.graphInterfaceId);
|
|
2772
2802
|
}
|
|
2773
|
-
for (const [k,
|
|
2803
|
+
for (const [k, R] of h.entries()) {
|
|
2774
2804
|
const z = new It();
|
|
2775
|
-
z.inputs.name.value =
|
|
2805
|
+
z.inputs.name.value = R.from.name, v.push({
|
|
2776
2806
|
...z.save(),
|
|
2777
2807
|
position: { x: y + 100, y: T + k * 200 }
|
|
2778
|
-
}), w.push({ id: re(), from:
|
|
2808
|
+
}), w.push({ id: re(), from: R.from.id, to: z.inputs.placeholder.id }), d.set(R.from.id, z.graphInterfaceId);
|
|
2779
2809
|
}
|
|
2780
2810
|
const S = te(
|
|
2781
2811
|
new Ne(
|
|
@@ -2796,32 +2826,32 @@ function Ks(n, e, t) {
|
|
|
2796
2826
|
const Z = te(new Q.type());
|
|
2797
2827
|
i.addNode(Z);
|
|
2798
2828
|
const pe = Math.round(
|
|
2799
|
-
l.map((k) => k.position.x).reduce((k,
|
|
2800
|
-
),
|
|
2801
|
-
l.map((k) => k.position.y).reduce((k,
|
|
2829
|
+
l.map((k) => k.position.x).reduce((k, R) => k + R, 0) / l.length
|
|
2830
|
+
), K = Math.round(
|
|
2831
|
+
l.map((k) => k.position.y).reduce((k, R) => k + R, 0) / l.length
|
|
2802
2832
|
);
|
|
2803
|
-
Z.position.x = pe, Z.position.y =
|
|
2833
|
+
Z.position.x = pe, Z.position.y = K, C.forEach((k) => {
|
|
2804
2834
|
i.removeConnection(k), i.addConnection(k.from, Z.inputs[d.get(k.to.id)]);
|
|
2805
2835
|
}), h.forEach((k) => {
|
|
2806
2836
|
i.removeConnection(k), i.addConnection(Z.outputs[d.get(k.from.id)], k.to);
|
|
2807
2837
|
}), l.forEach((k) => i.removeNode(k)), i.activeTransactions--, e.canExecuteCommand(ne.SAVE_SUBGRAPH_COMMAND) && e.executeCommand(ne.SAVE_SUBGRAPH_COMMAND), t(S), n.value.panning = { ...i.panning }, n.value.scaling = i.scaling;
|
|
2808
2838
|
};
|
|
2809
2839
|
e.registerCommand(Ws, {
|
|
2810
|
-
canExecute:
|
|
2811
|
-
execute:
|
|
2840
|
+
canExecute: o,
|
|
2841
|
+
execute: s
|
|
2812
2842
|
});
|
|
2813
2843
|
}
|
|
2814
|
-
function
|
|
2815
|
-
const e = n.reduce((
|
|
2844
|
+
function Ks(n) {
|
|
2845
|
+
const e = n.reduce((s, a) => {
|
|
2816
2846
|
const i = a.position.x;
|
|
2817
|
-
return i <
|
|
2818
|
-
}, 1 / 0), t = n.reduce((
|
|
2847
|
+
return i < s ? i : s;
|
|
2848
|
+
}, 1 / 0), t = n.reduce((s, a) => {
|
|
2819
2849
|
const i = a.position.y;
|
|
2820
|
-
return i <
|
|
2850
|
+
return i < s ? i : s;
|
|
2821
2851
|
}, 1 / 0);
|
|
2822
|
-
return { xLeft: n.reduce((
|
|
2852
|
+
return { xLeft: n.reduce((s, a) => {
|
|
2823
2853
|
const i = a.position.x + a.width;
|
|
2824
|
-
return i >
|
|
2854
|
+
return i > s ? i : s;
|
|
2825
2855
|
}, -1 / 0), xRight: e, yTop: t };
|
|
2826
2856
|
}
|
|
2827
2857
|
class qs extends Bt {
|
|
@@ -2857,12 +2887,12 @@ class qs extends Bt {
|
|
|
2857
2887
|
try {
|
|
2858
2888
|
for (super._loading = !0, e = this.hooks.load.execute(e); this.graphTemplates.length > 0; )
|
|
2859
2889
|
this.removeGraphTemplate(this.graphTemplates[0]);
|
|
2860
|
-
e.graphTemplates.forEach((
|
|
2861
|
-
const
|
|
2862
|
-
this.addGraphTemplate(
|
|
2890
|
+
e.graphTemplates.forEach((o) => {
|
|
2891
|
+
const s = new Ne(o, this);
|
|
2892
|
+
this.addGraphTemplate(s);
|
|
2863
2893
|
});
|
|
2864
2894
|
const t = this.graph.load(e.graph);
|
|
2865
|
-
return this.events.loaded.emit(), t.forEach((
|
|
2895
|
+
return this.events.loaded.emit(), t.forEach((o) => console.warn(o)), t;
|
|
2866
2896
|
} finally {
|
|
2867
2897
|
super._loading = !1;
|
|
2868
2898
|
}
|
|
@@ -2877,7 +2907,7 @@ class qs extends Bt {
|
|
|
2877
2907
|
}
|
|
2878
2908
|
}
|
|
2879
2909
|
function Ia(n) {
|
|
2880
|
-
const e = H(n?.code ?? new Ve()), t = H(n?.existingEditor ?? new qs(e.value)),
|
|
2910
|
+
const e = H(n?.code ?? new Ve()), t = H(n?.existingEditor ?? new qs(e.value)), o = Symbol("ViewModelToken"), s = H(null), a = Gt(s), { switchGraph: i } = es(t, s), r = G(() => a.value && a.value !== t.value.graph), l = te(tn());
|
|
2881
2911
|
l.nodes.defaultWidth = 400;
|
|
2882
2912
|
const u = nn(), f = on(a, u), C = sn(a, t, u), h = {
|
|
2883
2913
|
/** Called whenever a node is rendered */
|
|
@@ -2900,11 +2930,11 @@ function Ia(n) {
|
|
|
2900
2930
|
settings: l,
|
|
2901
2931
|
switchGraph: i
|
|
2902
2932
|
});
|
|
2903
|
-
return e.value.registerViewModel(N),
|
|
2933
|
+
return e.value.registerViewModel(N), Xo(N), an(a, u), Xs(a, u, i), rn(a, u), ln(a, u, i), dn(a, u), un(a, u, l), Fo(a, u, l), Yo(l), Qe(
|
|
2904
2934
|
t,
|
|
2905
2935
|
(v, w) => {
|
|
2906
|
-
w && (w.events.registerGraph.unsubscribe(
|
|
2907
|
-
|
|
2936
|
+
w && (w.events.registerGraph.unsubscribe(o), w.graphEvents.beforeAddNode.unsubscribe(o), v.nodeHooks.beforeLoad.unsubscribe(o), v.nodeHooks.afterSave.unsubscribe(o), v.graphTemplateHooks.beforeLoad.unsubscribe(o), v.graphTemplateHooks.afterSave.unsubscribe(o), v.graph.hooks.load.unsubscribe(o), v.graph.hooks.save.unsubscribe(o)), v && (v.nodeHooks.beforeLoad.subscribe(o, (d, y) => (y.position = d.position ?? { x: 0, y: 0 }, y.width = d.width ?? l.nodes.defaultWidth, y.twoColumn = d.twoColumn ?? !1, d)), v.nodeHooks.afterSave.subscribe(o, (d, y) => (d.position = y.position, d.width = y.width, d.twoColumn = y.twoColumn, d)), v.graphTemplateHooks.beforeLoad.subscribe(o, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graphTemplateHooks.afterSave.subscribe(o, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graph.hooks.load.subscribe(o, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graph.hooks.save.subscribe(o, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graphEvents.beforeAddNode.subscribe(
|
|
2937
|
+
o,
|
|
2908
2938
|
(d) => cn(d, { defaultWidth: l.nodes.defaultWidth })
|
|
2909
2939
|
), t.value.registerNodeType(xt, { category: "Subgraphs" }), t.value.registerNodeType(It, { category: "Subgraphs" }), i(v.graph));
|
|
2910
2940
|
},
|
|
@@ -2915,7 +2945,7 @@ export {
|
|
|
2915
2945
|
rt as AbstractCodeNode,
|
|
2916
2946
|
vt as CLEAR_ALL_COMMAND,
|
|
2917
2947
|
Ws as CREATE_SUBGRAPH_COMMAND,
|
|
2918
|
-
|
|
2948
|
+
Ln as Check,
|
|
2919
2949
|
yn as CheckboxInterface,
|
|
2920
2950
|
Ve as Code,
|
|
2921
2951
|
Ca as CodeEditor,
|
|
@@ -2927,12 +2957,12 @@ export {
|
|
|
2927
2957
|
ws as CodeGraphNode,
|
|
2928
2958
|
Ye as CodeGraphNodeInterface,
|
|
2929
2959
|
kt as CodeGraphOutputNode,
|
|
2930
|
-
|
|
2960
|
+
As as CodeGraphSidebar,
|
|
2931
2961
|
Ne as CodeGraphTemplate,
|
|
2932
|
-
|
|
2962
|
+
Ae as CodeNode,
|
|
2933
2963
|
ve as CodeNodeInputInterface,
|
|
2934
2964
|
D as CodeNodeInterface,
|
|
2935
|
-
|
|
2965
|
+
Re as CodeNodeInterfaceComponent,
|
|
2936
2966
|
_n as CodeNodeOutputInterface,
|
|
2937
2967
|
Bs as CodeNodePalette,
|
|
2938
2968
|
Pn as CodeVariable,
|
|
@@ -2952,7 +2982,7 @@ export {
|
|
|
2952
2982
|
da as ListInputInterface,
|
|
2953
2983
|
mt as LockCode,
|
|
2954
2984
|
xa as NavBar,
|
|
2955
|
-
|
|
2985
|
+
Xe as NavItem,
|
|
2956
2986
|
Cn as NumberInterface,
|
|
2957
2987
|
_o as PlayerPlay,
|
|
2958
2988
|
xo as Plus,
|
|
@@ -2970,7 +3000,7 @@ export {
|
|
|
2970
3000
|
ft as TextInputInterface,
|
|
2971
3001
|
Tn as TextInputInterfaceComponent,
|
|
2972
3002
|
ca as TextareaInputInterface,
|
|
2973
|
-
|
|
3003
|
+
Ro as TransitionBottom,
|
|
2974
3004
|
Bo as TrashOff,
|
|
2975
3005
|
pa as TupleInputInterface,
|
|
2976
3006
|
Do as X,
|
|
@@ -2988,10 +3018,10 @@ export {
|
|
|
2988
3018
|
ya as getPositionBeforeNode,
|
|
2989
3019
|
dt as listType,
|
|
2990
3020
|
it as loadNodeState,
|
|
2991
|
-
|
|
3021
|
+
X as nodeType,
|
|
2992
3022
|
ut as numberType,
|
|
2993
|
-
|
|
2994
|
-
|
|
3023
|
+
Xo as registerCodeEngine,
|
|
3024
|
+
Xs as registerCreateSubgraphCommand,
|
|
2995
3025
|
Fo as registerCustomCommands,
|
|
2996
3026
|
Wo as registerRunEngineCommands,
|
|
2997
3027
|
mn as saveNodeState,
|