@babsey/code-graph 0.4.1 → 0.4.3
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 +804 -764
- package/dist/code-graph.umd.cjs +6 -6
- package/package.json +1 -1
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
|
|
2
|
+
import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as P, markRaw as Y, computed as A, createElementVNode as m, withDirectives as ke, vModelText as xe, createStaticVNode as fe, toRef as $e, ref as H, createVNode as G, unref as O, mergeModels as Be, useModel as Nt, resolveComponent as qe, createCommentVNode as L, 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 Ae, 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 At } from "vue";
|
|
3
3
|
import { v4 as re } from "uuid";
|
|
4
|
-
import { AbstractNode as
|
|
5
|
-
import { NodeInterfaceType as
|
|
6
|
-
import { allowMultipleConnections as
|
|
7
|
-
import { displayInSidebar as
|
|
8
|
-
import
|
|
9
|
-
import { SequentialHook as
|
|
10
|
-
import { usePointer as
|
|
4
|
+
import { AbstractNode as Gt, NodeInterface as J, Graph as Rt, getGraphNodeTypeString as tt, GraphTemplate as jt, GRAPH_NODE_TYPE_PREFIX as Lt, GRAPH_INPUT_NODE_TYPE as Pt, GRAPH_OUTPUT_NODE_TYPE as Vt, Editor as Bt } from "@baklavajs/core";
|
|
5
|
+
import { NodeInterfaceType as ie, BaklavaInterfaceTypes as Ht, setType as V } from "@baklavajs/interface-types";
|
|
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 Ge, IntegerInterfaceComponent as Ft, TextInputInterfaceComponent as st, NumberInterfaceComponent as Yt, SelectInterfaceComponent as Wt, SliderInterfaceComponent as Kt, TextareaInputInterfaceComponent as Xt, 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
|
+
import pn from "toposort";
|
|
9
|
+
import { SequentialHook as ze } from "@baklavajs/events";
|
|
10
|
+
import { usePointer as hn } from "@vueuse/core";
|
|
11
11
|
ce.escape = (n) => n;
|
|
12
|
-
class
|
|
12
|
+
class rt extends Gt {
|
|
13
13
|
codeTemplate;
|
|
14
14
|
isCodeNode = !0;
|
|
15
15
|
mask = null;
|
|
@@ -26,9 +26,9 @@ class lt extends St {
|
|
|
26
26
|
modules: [],
|
|
27
27
|
props: null,
|
|
28
28
|
script: "",
|
|
29
|
-
variableName: "
|
|
29
|
+
variableName: ""
|
|
30
30
|
}), this.codeTemplate = function() {
|
|
31
|
-
return `${this.name}(${
|
|
31
|
+
return `${this.name}(${fn(this.codeNodeInputs).join(", ")})`;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
get code() {
|
|
@@ -122,14 +122,14 @@ class lt extends St {
|
|
|
122
122
|
let s = [];
|
|
123
123
|
if (t !== "outputs" && this.inputs[e]) {
|
|
124
124
|
const o = this.graph.connections.filter(
|
|
125
|
-
(
|
|
126
|
-
).map((
|
|
125
|
+
(a) => a.to.id === this.inputs[e]?.id || a.from.id === this.inputs[e]?.id
|
|
126
|
+
).map((a) => a.from.nodeId);
|
|
127
127
|
o && (s = s.concat(o));
|
|
128
128
|
}
|
|
129
129
|
if (t !== "inputs" && this.outputs[e]) {
|
|
130
130
|
const o = this.graph.connections.filter(
|
|
131
|
-
(
|
|
132
|
-
).map((
|
|
131
|
+
(a) => a.from.id === this.outputs[e]?.id || a.from.id === this.outputs[e]?.id
|
|
132
|
+
).map((a) => a.to.nodeId);
|
|
133
133
|
o && (s = s.concat(o));
|
|
134
134
|
}
|
|
135
135
|
return !s || s.length == 0 ? [] : s.map((o) => this.graph.findNodeById(o));
|
|
@@ -182,8 +182,18 @@ class lt extends St {
|
|
|
182
182
|
updateProps(e) {
|
|
183
183
|
this.state.props = e;
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Update input values
|
|
187
|
+
* @param props values for inputs
|
|
188
|
+
*/
|
|
189
|
+
updateInputValues(e) {
|
|
190
|
+
const t = Object.keys(this.inputs);
|
|
191
|
+
Object.keys(e).forEach((s) => {
|
|
192
|
+
!t.includes(s) || !this.inputs[s] || (this.inputs[s].value = e[s], this.inputs[s].setHidden(!1));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
185
195
|
}
|
|
186
|
-
class Re extends
|
|
196
|
+
class Re extends rt {
|
|
187
197
|
/**
|
|
188
198
|
* The default implementation does nothing.
|
|
189
199
|
* Overwrite this method to do calculation.
|
|
@@ -196,41 +206,67 @@ class Re extends lt {
|
|
|
196
206
|
return this.lockCode || (s._code = this.renderCode({ inputs: e, ...t })), this.updateOutputValues(s), s;
|
|
197
207
|
};
|
|
198
208
|
load(e) {
|
|
199
|
-
super.load(e),
|
|
209
|
+
super.load(e), it(this.graph, e);
|
|
200
210
|
}
|
|
201
211
|
save() {
|
|
202
212
|
const e = super.save();
|
|
203
|
-
return
|
|
213
|
+
return mn(this.graph, e), e;
|
|
204
214
|
}
|
|
205
215
|
}
|
|
206
|
-
const
|
|
216
|
+
const fn = (n, e = !0) => {
|
|
207
217
|
const t = [], s = Object.keys(n);
|
|
208
218
|
return s.forEach((o) => {
|
|
209
219
|
if (n[o]?.hidden) return;
|
|
210
220
|
const i = e && t.length < s.indexOf(o) ? `${o}=` : "";
|
|
211
221
|
t.push(`${i}{{ inputs.${o} }}`);
|
|
212
222
|
}), t;
|
|
213
|
-
},
|
|
223
|
+
}, it = (n, e) => {
|
|
214
224
|
if (!n) return;
|
|
215
225
|
const t = n.findNodeById(e.id);
|
|
216
226
|
if (!t || t.subgraph) return;
|
|
217
227
|
const s = t;
|
|
218
|
-
s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o,
|
|
219
|
-
o !== "_code" && s.inputs[o] && (s.inputs[o].hidden =
|
|
220
|
-
}), Object.entries(e.outputs).forEach(([o,
|
|
221
|
-
o !== "_code" && s.outputs[o] && (s.outputs[o].hidden =
|
|
228
|
+
s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
229
|
+
o !== "_code" && s.inputs[o] && (s.inputs[o].hidden = a.hidden);
|
|
230
|
+
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
231
|
+
o !== "_code" && s.outputs[o] && (s.outputs[o].hidden = a.hidden);
|
|
222
232
|
});
|
|
223
|
-
},
|
|
233
|
+
}, mn = (n, e) => {
|
|
224
234
|
if (!n) return;
|
|
225
235
|
const t = n.findNodeById(e.id);
|
|
226
236
|
if (!t || t.subgraph) return;
|
|
227
237
|
const s = t;
|
|
228
|
-
s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o,
|
|
229
|
-
o !== "_code" && s.inputs[o]
|
|
230
|
-
|
|
231
|
-
|
|
238
|
+
s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
239
|
+
if (o !== "_code" && s.inputs[o]) {
|
|
240
|
+
const i = s.inputs[o];
|
|
241
|
+
a.hidden = i.hidden, i.component?.__name && (a.component = i.component.__name);
|
|
242
|
+
}
|
|
243
|
+
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
244
|
+
o !== "_code" && s.outputs[o] && (a.hidden = s.outputs[o].hidden);
|
|
232
245
|
});
|
|
233
|
-
},
|
|
246
|
+
}, vn = (n, e) => {
|
|
247
|
+
switch (n) {
|
|
248
|
+
case "CheckBoxInterface":
|
|
249
|
+
return new yn(e.id, e.value);
|
|
250
|
+
case "IntegerInterface":
|
|
251
|
+
return new ht(
|
|
252
|
+
e.id,
|
|
253
|
+
e.value,
|
|
254
|
+
e.min,
|
|
255
|
+
e.max
|
|
256
|
+
);
|
|
257
|
+
case "NumberInterface":
|
|
258
|
+
return new Cn(
|
|
259
|
+
e.id,
|
|
260
|
+
e.value,
|
|
261
|
+
e.min,
|
|
262
|
+
e.max
|
|
263
|
+
);
|
|
264
|
+
case "SelectInterface":
|
|
265
|
+
return new wn(e.id, e.value, e.items);
|
|
266
|
+
default:
|
|
267
|
+
return new ft(e.id, e.value);
|
|
268
|
+
}
|
|
269
|
+
}, gn = ["title"], je = /* @__PURE__ */ F({
|
|
234
270
|
__name: "CodeNodeInterface",
|
|
235
271
|
props: {
|
|
236
272
|
intf: {}
|
|
@@ -238,7 +274,7 @@ const hn = (n, e = !0) => {
|
|
|
238
274
|
setup(n) {
|
|
239
275
|
return (e, t) => (p(), b("div", {
|
|
240
276
|
title: n.intf.value
|
|
241
|
-
},
|
|
277
|
+
}, P(n.intf.name), 9, gn));
|
|
242
278
|
}
|
|
243
279
|
});
|
|
244
280
|
class D extends J {
|
|
@@ -247,7 +283,7 @@ class D extends J {
|
|
|
247
283
|
state;
|
|
248
284
|
type = null;
|
|
249
285
|
constructor(e, t) {
|
|
250
|
-
super(e, t), this.setComponent(
|
|
286
|
+
super(e, t), this.setComponent(Y(je)), this.state = te({
|
|
251
287
|
optional: !1
|
|
252
288
|
});
|
|
253
289
|
}
|
|
@@ -264,7 +300,7 @@ class D extends J {
|
|
|
264
300
|
}
|
|
265
301
|
class ve extends D {
|
|
266
302
|
constructor(e = "", t) {
|
|
267
|
-
super(e, t), this.setComponent(
|
|
303
|
+
super(e, t), this.setComponent(Y(je)), this.use(ot, !0);
|
|
268
304
|
}
|
|
269
305
|
get value() {
|
|
270
306
|
return super.value;
|
|
@@ -273,20 +309,20 @@ class ve extends D {
|
|
|
273
309
|
super.value = e, this.name !== "_code" && this.setHidden(!1);
|
|
274
310
|
}
|
|
275
311
|
}
|
|
276
|
-
const
|
|
277
|
-
new
|
|
312
|
+
const lt = new ie("boolean"), bn = new ie("dict"), dt = new ie("list"), K = new ie("node"), ut = new ie("number"), ct = new ie("string"), pt = new ie("tuple"), la = (n) => {
|
|
313
|
+
new Ht(n.editor, { viewPlugin: n }).addTypes(lt, bn, dt, K, ut, ct, pt);
|
|
278
314
|
};
|
|
279
|
-
class
|
|
315
|
+
class yn extends ve {
|
|
280
316
|
constructor(e, t) {
|
|
281
|
-
super(e, t), this.setComponent(
|
|
317
|
+
super(e, t), this.setComponent(Y(Dt)), this.use(V, lt);
|
|
282
318
|
}
|
|
283
319
|
getValue = () => this.value ? "True" : "False";
|
|
284
320
|
}
|
|
285
|
-
class
|
|
321
|
+
class _n extends D {
|
|
286
322
|
isCodeNodeOutput = !0;
|
|
287
323
|
suffix = "";
|
|
288
324
|
constructor(e = "", t = "") {
|
|
289
|
-
super(e, ""), this.suffix = t, this.setComponent(
|
|
325
|
+
super(e, ""), this.suffix = t, this.setComponent(Y(je));
|
|
290
326
|
}
|
|
291
327
|
get codeValue() {
|
|
292
328
|
return this.node?.outputs._code.value ?? "";
|
|
@@ -296,46 +332,46 @@ class gn extends D {
|
|
|
296
332
|
return e.value.findNodeById(this.nodeId);
|
|
297
333
|
}
|
|
298
334
|
}
|
|
299
|
-
class
|
|
335
|
+
class Le extends ve {
|
|
300
336
|
min;
|
|
301
337
|
max;
|
|
302
338
|
constructor(e, t, s, o) {
|
|
303
|
-
super(e, t), this.min = s, this.max = o, this.use(V,
|
|
339
|
+
super(e, t), this.min = s, this.max = o, this.use(V, ut);
|
|
304
340
|
}
|
|
305
341
|
validate(e) {
|
|
306
342
|
return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
|
|
307
343
|
}
|
|
308
344
|
}
|
|
309
|
-
class
|
|
310
|
-
component =
|
|
345
|
+
class ht extends Le {
|
|
346
|
+
component = Y(Ft);
|
|
311
347
|
validate(e) {
|
|
312
348
|
return Number.isInteger(e) && super.validate(e);
|
|
313
349
|
}
|
|
314
350
|
}
|
|
315
|
-
class
|
|
351
|
+
class da extends ve {
|
|
316
352
|
constructor(e = "", t = "") {
|
|
317
|
-
super(e, t), this.setComponent(
|
|
353
|
+
super(e, t), this.setComponent(Y(st)), this.use(V, dt);
|
|
318
354
|
}
|
|
319
355
|
getValue = () => `[${this.value}]`;
|
|
320
356
|
}
|
|
321
|
-
class
|
|
322
|
-
component =
|
|
357
|
+
class Cn extends Le {
|
|
358
|
+
component = Y(Yt);
|
|
323
359
|
}
|
|
324
|
-
class
|
|
360
|
+
class Pe extends ve {
|
|
325
361
|
constructor(e, t) {
|
|
326
|
-
super(e, t), this.use(V,
|
|
362
|
+
super(e, t), this.use(V, ct);
|
|
327
363
|
}
|
|
328
364
|
getValue = () => `"${this.value}"`;
|
|
329
365
|
}
|
|
330
|
-
class
|
|
331
|
-
component =
|
|
366
|
+
class wn extends Pe {
|
|
367
|
+
component = Y(Wt);
|
|
332
368
|
items;
|
|
333
369
|
constructor(e, t, s) {
|
|
334
370
|
super(e, t), this.items = s;
|
|
335
371
|
}
|
|
336
372
|
}
|
|
337
|
-
class
|
|
338
|
-
component =
|
|
373
|
+
class ua extends Le {
|
|
374
|
+
component = Y(Kt);
|
|
339
375
|
min;
|
|
340
376
|
max;
|
|
341
377
|
constructor(e, t, s, o) {
|
|
@@ -343,7 +379,7 @@ class ur extends Be {
|
|
|
343
379
|
}
|
|
344
380
|
getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
|
|
345
381
|
}
|
|
346
|
-
const
|
|
382
|
+
const kn = F({
|
|
347
383
|
props: {
|
|
348
384
|
intf: {
|
|
349
385
|
type: Object,
|
|
@@ -356,47 +392,47 @@ const bn = F({
|
|
|
356
392
|
},
|
|
357
393
|
emits: ["update:modelValue"],
|
|
358
394
|
setup(n, { emit: e }) {
|
|
359
|
-
return { v:
|
|
395
|
+
return { v: A({
|
|
360
396
|
get: () => n.modelValue,
|
|
361
397
|
set: (s) => {
|
|
362
398
|
e("update:modelValue", s);
|
|
363
399
|
}
|
|
364
400
|
}) };
|
|
365
401
|
}
|
|
366
|
-
}),
|
|
402
|
+
}), R = (n, e) => {
|
|
367
403
|
const t = n.__vccOpts || n;
|
|
368
404
|
for (const [s, o] of e)
|
|
369
405
|
t[s] = o;
|
|
370
406
|
return t;
|
|
371
|
-
},
|
|
372
|
-
function
|
|
373
|
-
return p(), b("div",
|
|
374
|
-
m("label",
|
|
407
|
+
}, 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, s, o, a) {
|
|
409
|
+
return p(), b("div", xn, [
|
|
410
|
+
m("label", In, P(n.intf.name), 1),
|
|
375
411
|
ke(m("input", {
|
|
376
412
|
"onUpdate:modelValue": e[0] || (e[0] = (i) => n.v = i),
|
|
377
413
|
type: "text",
|
|
378
414
|
class: "baklava-input",
|
|
379
415
|
placeholder: n.intf.name,
|
|
380
416
|
title: n.intf.name
|
|
381
|
-
}, null, 8,
|
|
417
|
+
}, null, 8, Nn), [
|
|
382
418
|
[xe, n.v]
|
|
383
419
|
])
|
|
384
420
|
]);
|
|
385
421
|
}
|
|
386
|
-
const
|
|
387
|
-
class
|
|
388
|
-
component =
|
|
422
|
+
const Tn = /* @__PURE__ */ R(kn, [["render", En]]);
|
|
423
|
+
class ft extends Pe {
|
|
424
|
+
component = Y(Tn);
|
|
389
425
|
}
|
|
390
|
-
class
|
|
391
|
-
component =
|
|
426
|
+
class ca extends Pe {
|
|
427
|
+
component = Y(Xt);
|
|
392
428
|
}
|
|
393
|
-
class
|
|
429
|
+
class pa extends ve {
|
|
394
430
|
constructor(e = "", t = "") {
|
|
395
|
-
super(e, t), this.setComponent(
|
|
431
|
+
super(e, t), this.setComponent(Y(st)), this.use(V, pt);
|
|
396
432
|
}
|
|
397
433
|
getValue = () => `(${this.value})`;
|
|
398
434
|
}
|
|
399
|
-
function
|
|
435
|
+
function ha(n) {
|
|
400
436
|
return class extends Re {
|
|
401
437
|
type = n.type;
|
|
402
438
|
inputs = {};
|
|
@@ -404,10 +440,10 @@ function hr(n) {
|
|
|
404
440
|
constructor() {
|
|
405
441
|
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(
|
|
406
442
|
"_code",
|
|
407
|
-
new D("", []).use(V,
|
|
443
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
408
444
|
), this.addOutput(
|
|
409
445
|
"_code",
|
|
410
|
-
new D("", []).use(V,
|
|
446
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
411
447
|
);
|
|
412
448
|
}
|
|
413
449
|
onPlaced() {
|
|
@@ -433,10 +469,10 @@ function hr(n) {
|
|
|
433
469
|
}
|
|
434
470
|
};
|
|
435
471
|
}
|
|
436
|
-
class
|
|
472
|
+
class On extends Re {
|
|
437
473
|
}
|
|
438
|
-
function
|
|
439
|
-
return class extends
|
|
474
|
+
function fa(n) {
|
|
475
|
+
return class extends On {
|
|
440
476
|
type = n.type;
|
|
441
477
|
inputs = {};
|
|
442
478
|
outputs = {};
|
|
@@ -446,10 +482,10 @@ function fr(n) {
|
|
|
446
482
|
constructor() {
|
|
447
483
|
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(
|
|
448
484
|
"_code",
|
|
449
|
-
new D("", []).use(V,
|
|
485
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
450
486
|
), this.addOutput(
|
|
451
487
|
"_code",
|
|
452
|
-
new D("", []).use(V,
|
|
488
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
453
489
|
), this.staticInputKeys.push("_code"), this.staticOutputKeys.push("_code");
|
|
454
490
|
}
|
|
455
491
|
onPlaced() {
|
|
@@ -477,23 +513,23 @@ function fr(n) {
|
|
|
477
513
|
this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id, t !== "_code" && (this.outputs[t].hidden = e.outputs[t].hidden);
|
|
478
514
|
this.preventUpdate = !1, this.onUpdate(), this.preventUpdate = !0;
|
|
479
515
|
for (const t of Object.keys(e.inputs))
|
|
480
|
-
if (!this.staticInputKeys.includes(t)) {
|
|
516
|
+
if (!(this.staticInputKeys.includes(t) || !e.inputs[t])) {
|
|
481
517
|
if (!this.inputs[t]) {
|
|
482
|
-
const s = e.inputs[t].value;
|
|
483
|
-
let
|
|
484
|
-
|
|
518
|
+
const s = e.inputs[t], o = s.value;
|
|
519
|
+
let a;
|
|
520
|
+
s.component ? a = vn(s.component, { ...s, id: t }) : typeof o == "number" ? a = new ht(t, o) : a = new ft(t, JSON.stringify(o)), a.use(ot, !0), a.setOptional(s.optional ?? !1), a.setHidden(s.hidden ?? !1), this.addInput(t, a);
|
|
485
521
|
}
|
|
486
522
|
this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
|
|
487
523
|
}
|
|
488
524
|
for (const t of Object.keys(e.outputs))
|
|
489
|
-
if (!this.staticOutputKeys.includes(t)) {
|
|
525
|
+
if (!(this.staticOutputKeys.includes(t) || !e.outputs[t])) {
|
|
490
526
|
if (!this.outputs[t]) {
|
|
491
|
-
const s = new
|
|
527
|
+
const s = new _n(t);
|
|
492
528
|
this.addOutput(t, s);
|
|
493
529
|
}
|
|
494
530
|
this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
|
|
495
531
|
}
|
|
496
|
-
|
|
532
|
+
it(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
|
|
497
533
|
}
|
|
498
534
|
onUpdate() {
|
|
499
535
|
if (this.preventUpdate) return;
|
|
@@ -508,13 +544,13 @@ function fr(n) {
|
|
|
508
544
|
return s;
|
|
509
545
|
}
|
|
510
546
|
updateInterfaces(e, t, s) {
|
|
511
|
-
const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys,
|
|
512
|
-
for (const i of Object.keys(
|
|
547
|
+
const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
|
|
548
|
+
for (const i of Object.keys(a))
|
|
513
549
|
o.includes(i) || t[i] && !s.includes(i) || (e === "input" ? this.removeInput(i) : this.removeOutput(i));
|
|
514
550
|
for (const i of Object.keys(t)) {
|
|
515
|
-
if (
|
|
516
|
-
const
|
|
517
|
-
e === "input" ? this.addInput(i,
|
|
551
|
+
if (a[i]) continue;
|
|
552
|
+
const r = t[i]();
|
|
553
|
+
e === "input" ? this.addInput(i, r) : this.addOutput(i, r);
|
|
518
554
|
}
|
|
519
555
|
}
|
|
520
556
|
updateProps(e) {
|
|
@@ -529,7 +565,7 @@ function fr(n) {
|
|
|
529
565
|
};
|
|
530
566
|
}
|
|
531
567
|
ce.escape = (n) => n;
|
|
532
|
-
class
|
|
568
|
+
class Ve {
|
|
533
569
|
_id;
|
|
534
570
|
_state;
|
|
535
571
|
viewModel;
|
|
@@ -596,25 +632,26 @@ class ze {
|
|
|
596
632
|
}
|
|
597
633
|
/**
|
|
598
634
|
* Render code script.
|
|
635
|
+
* @param data data for render template.
|
|
599
636
|
*/
|
|
600
637
|
renderCode(e) {
|
|
601
|
-
this.state.script = ce.render(this.state.template || "", e);
|
|
638
|
+
this.state.script = ce.render(this.state.template || "", e ?? {});
|
|
602
639
|
}
|
|
603
640
|
}
|
|
604
|
-
class
|
|
641
|
+
class ma extends Ve {
|
|
605
642
|
constructor() {
|
|
606
643
|
super(), this.loadTemplate(import("./python-CKuCd7tg.js"));
|
|
607
644
|
}
|
|
608
645
|
}
|
|
609
|
-
class
|
|
646
|
+
class va extends Ve {
|
|
610
647
|
constructor() {
|
|
611
648
|
super(), this.loadTemplate(import("./javascript-DK1c6Ap1.js"));
|
|
612
649
|
}
|
|
613
650
|
}
|
|
614
|
-
const
|
|
651
|
+
const ga = (n) => {
|
|
615
652
|
n.allowMultipleConnections = !0;
|
|
616
653
|
};
|
|
617
|
-
class
|
|
654
|
+
class Mn extends zt {
|
|
618
655
|
order = /* @__PURE__ */ new Map();
|
|
619
656
|
constructor(e) {
|
|
620
657
|
super(e);
|
|
@@ -623,32 +660,32 @@ class In extends Bt {
|
|
|
623
660
|
super.start(), this.recalculateOrder = !0, this.calculateWithoutData();
|
|
624
661
|
}
|
|
625
662
|
async runGraph(e, t, s) {
|
|
626
|
-
this.order.has(e.id) || this.order.set(e.id,
|
|
627
|
-
const { calculationOrder: o, connectionsFromNode:
|
|
628
|
-
for (const
|
|
663
|
+
this.order.has(e.id) || this.order.set(e.id, Ut(e));
|
|
664
|
+
const { calculationOrder: o, connectionsFromNode: a } = this.order.get(e.id), i = /* @__PURE__ */ new Map();
|
|
665
|
+
for (const r of o) {
|
|
629
666
|
const l = {};
|
|
630
|
-
Object.entries(
|
|
667
|
+
Object.entries(r.inputs).forEach(([f, C]) => {
|
|
631
668
|
l[f] = this.getInterfaceValue(t, C.id);
|
|
632
|
-
}),
|
|
633
|
-
let
|
|
634
|
-
if (
|
|
635
|
-
if (
|
|
636
|
-
for (const [f, C] of Object.entries(
|
|
637
|
-
this.hooks.transferData.execute(
|
|
669
|
+
}), r.isCodeNode && (r.updateCodeTemplate(), r.updateOutputNames()), this.events.beforeNodeCalculation.emit({ inputValues: l, node: r });
|
|
670
|
+
let u;
|
|
671
|
+
if (r.calculate) {
|
|
672
|
+
if (u = await r.calculate(l, { globalValues: s, engine: this }), a.has(r))
|
|
673
|
+
for (const [f, C] of Object.entries(u))
|
|
674
|
+
this.hooks.transferData.execute(u[f], C), a.get(r).forEach((h) => t.set(h.to.id, C));
|
|
638
675
|
} else {
|
|
639
|
-
|
|
640
|
-
for (const [f, C] of Object.entries(
|
|
641
|
-
|
|
676
|
+
u = {};
|
|
677
|
+
for (const [f, C] of Object.entries(r.outputs))
|
|
678
|
+
u[f] = this.getInterfaceValue(t, C.id);
|
|
642
679
|
}
|
|
643
|
-
this.events.afterNodeCalculation.emit({ outputValues:
|
|
644
|
-
const C = Object.entries(
|
|
680
|
+
this.events.afterNodeCalculation.emit({ outputValues: u, node: r }), i.set(r.id, new Map(Object.entries(u))), a.has(r) && a.get(r).forEach((f) => {
|
|
681
|
+
const C = Object.entries(r.outputs).find(([, N]) => N.id === f.from.id)?.[0];
|
|
645
682
|
if (!C)
|
|
646
683
|
throw new Error(
|
|
647
684
|
`Could not find key for interface ${f.from.id}
|
|
648
685
|
This is likely an internal issue. Please report it on GitHub.`
|
|
649
686
|
);
|
|
650
|
-
const h = this.hooks.transferData.execute(
|
|
651
|
-
f.to.allowMultipleConnections ? t.has(f.to.id) ? t.get(f.to.id).push(h) : t.set(f.to.id, [h]) : t.set(f.to.id, h);
|
|
687
|
+
const h = this.hooks.transferData.execute(u[C], f);
|
|
688
|
+
C !== "_code" && (f.to.allowMultipleConnections ? t.has(f.to.id) ? t.get(f.to.id).push(h) : t.set(f.to.id, [h]) : t.set(f.to.id, h));
|
|
652
689
|
});
|
|
653
690
|
}
|
|
654
691
|
return i;
|
|
@@ -680,7 +717,7 @@ This is likely an internal issue. Please report it on GitHub.`
|
|
|
680
717
|
return e.get(t);
|
|
681
718
|
}
|
|
682
719
|
}
|
|
683
|
-
const
|
|
720
|
+
const $n = {}, Sn = {
|
|
684
721
|
xmlns: "http://www.w3.org/2000/svg",
|
|
685
722
|
width: "24",
|
|
686
723
|
height: "24",
|
|
@@ -692,8 +729,8 @@ const Nn = {}, En = {
|
|
|
692
729
|
"stroke-linejoin": "round",
|
|
693
730
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-check"
|
|
694
731
|
};
|
|
695
|
-
function
|
|
696
|
-
return p(), b("svg",
|
|
732
|
+
function An(n, e) {
|
|
733
|
+
return p(), b("svg", Sn, [...e[0] || (e[0] = [
|
|
697
734
|
m("path", {
|
|
698
735
|
stroke: "none",
|
|
699
736
|
d: "M0 0h24v24H0z",
|
|
@@ -702,7 +739,7 @@ function Tn(n, e) {
|
|
|
702
739
|
m("path", { d: "M5 12l5 5l10 -10" }, null, -1)
|
|
703
740
|
])]);
|
|
704
741
|
}
|
|
705
|
-
const
|
|
742
|
+
const Gn = /* @__PURE__ */ R($n, [["render", An]]), Rn = {}, jn = {
|
|
706
743
|
xmlns: "http://www.w3.org/2000/svg",
|
|
707
744
|
width: "24",
|
|
708
745
|
height: "24",
|
|
@@ -714,8 +751,8 @@ const On = /* @__PURE__ */ A(Nn, [["render", Tn]]), $n = {}, Mn = {
|
|
|
714
751
|
"stroke-linejoin": "round",
|
|
715
752
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"
|
|
716
753
|
};
|
|
717
|
-
function
|
|
718
|
-
return p(), b("svg",
|
|
754
|
+
function Ln(n, e) {
|
|
755
|
+
return p(), b("svg", jn, [...e[0] || (e[0] = [
|
|
719
756
|
m("path", {
|
|
720
757
|
stroke: "none",
|
|
721
758
|
d: "M0 0h24v24H0z",
|
|
@@ -724,7 +761,7 @@ function Sn(n, e) {
|
|
|
724
761
|
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)
|
|
725
762
|
])]);
|
|
726
763
|
}
|
|
727
|
-
const Pn = /* @__PURE__ */
|
|
764
|
+
const Pn = /* @__PURE__ */ R(Rn, [["render", Ln]]), Vn = {}, Bn = {
|
|
728
765
|
xmlns: "http://www.w3.org/2000/svg",
|
|
729
766
|
width: "24",
|
|
730
767
|
height: "24",
|
|
@@ -736,8 +773,8 @@ const Pn = /* @__PURE__ */ A($n, [["render", Sn]]), Gn = {}, An = {
|
|
|
736
773
|
"stroke-linejoin": "round",
|
|
737
774
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"
|
|
738
775
|
};
|
|
739
|
-
function
|
|
740
|
-
return p(), b("svg",
|
|
776
|
+
function Hn(n, e) {
|
|
777
|
+
return p(), b("svg", Bn, [...e[0] || (e[0] = [
|
|
741
778
|
m("path", {
|
|
742
779
|
stroke: "none",
|
|
743
780
|
d: "M0 0h24v24H0z",
|
|
@@ -747,7 +784,7 @@ function Rn(n, e) {
|
|
|
747
784
|
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)
|
|
748
785
|
])]);
|
|
749
786
|
}
|
|
750
|
-
const
|
|
787
|
+
const zn = /* @__PURE__ */ R(Vn, [["render", Hn]]), Un = {}, Dn = {
|
|
751
788
|
xmlns: "http://www.w3.org/2000/svg",
|
|
752
789
|
width: "24",
|
|
753
790
|
height: "24",
|
|
@@ -759,8 +796,8 @@ const jn = /* @__PURE__ */ A(Gn, [["render", Rn]]), Ln = {}, Vn = {
|
|
|
759
796
|
"stroke-linejoin": "round",
|
|
760
797
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"
|
|
761
798
|
};
|
|
762
|
-
function
|
|
763
|
-
return p(), b("svg",
|
|
799
|
+
function Fn(n, e) {
|
|
800
|
+
return p(), b("svg", Dn, [...e[0] || (e[0] = [
|
|
764
801
|
m("path", {
|
|
765
802
|
stroke: "none",
|
|
766
803
|
d: "M0 0h24v24H0z",
|
|
@@ -771,7 +808,7 @@ function Bn(n, e) {
|
|
|
771
808
|
m("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
|
|
772
809
|
])]);
|
|
773
810
|
}
|
|
774
|
-
const
|
|
811
|
+
const Yn = /* @__PURE__ */ R(Un, [["render", Fn]]), Wn = {}, Kn = {
|
|
775
812
|
xmlns: "http://www.w3.org/2000/svg",
|
|
776
813
|
width: "24",
|
|
777
814
|
height: "24",
|
|
@@ -779,8 +816,8 @@ const Hn = /* @__PURE__ */ A(Ln, [["render", Bn]]), zn = {}, Un = {
|
|
|
779
816
|
fill: "currentColor",
|
|
780
817
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
|
|
781
818
|
};
|
|
782
|
-
function
|
|
783
|
-
return p(), b("svg",
|
|
819
|
+
function Xn(n, e) {
|
|
820
|
+
return p(), b("svg", Kn, [...e[0] || (e[0] = [
|
|
784
821
|
m("path", {
|
|
785
822
|
stroke: "none",
|
|
786
823
|
d: "M0 0h24v24H0z",
|
|
@@ -789,7 +826,7 @@ function Dn(n, e) {
|
|
|
789
826
|
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)
|
|
790
827
|
])]);
|
|
791
828
|
}
|
|
792
|
-
const
|
|
829
|
+
const qn = /* @__PURE__ */ R(Wn, [["render", Xn]]), Jn = {}, Qn = {
|
|
793
830
|
xmlns: "http://www.w3.org/2000/svg",
|
|
794
831
|
width: "24",
|
|
795
832
|
height: "24",
|
|
@@ -797,8 +834,8 @@ const Fn = /* @__PURE__ */ A(zn, [["render", Dn]]), Wn = {}, Yn = {
|
|
|
797
834
|
fill: "currentColor",
|
|
798
835
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
|
|
799
836
|
};
|
|
800
|
-
function
|
|
801
|
-
return p(), b("svg",
|
|
837
|
+
function Zn(n, e) {
|
|
838
|
+
return p(), b("svg", Qn, [...e[0] || (e[0] = [
|
|
802
839
|
m("path", {
|
|
803
840
|
stroke: "none",
|
|
804
841
|
d: "M0 0h24v24H0z",
|
|
@@ -807,7 +844,7 @@ function Xn(n, e) {
|
|
|
807
844
|
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)
|
|
808
845
|
])]);
|
|
809
846
|
}
|
|
810
|
-
const
|
|
847
|
+
const eo = /* @__PURE__ */ R(Jn, [["render", Zn]]), to = {}, no = {
|
|
811
848
|
xmlns: "http://www.w3.org/2000/svg",
|
|
812
849
|
width: "24",
|
|
813
850
|
height: "24",
|
|
@@ -815,8 +852,8 @@ const Kn = /* @__PURE__ */ A(Wn, [["render", Xn]]), qn = {}, Jn = {
|
|
|
815
852
|
fill: "currentColor",
|
|
816
853
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
|
|
817
854
|
};
|
|
818
|
-
function
|
|
819
|
-
return p(), b("svg",
|
|
855
|
+
function oo(n, e) {
|
|
856
|
+
return p(), b("svg", no, [...e[0] || (e[0] = [
|
|
820
857
|
m("path", {
|
|
821
858
|
stroke: "none",
|
|
822
859
|
d: "M0 0h24v24H0z",
|
|
@@ -825,7 +862,7 @@ function Qn(n, e) {
|
|
|
825
862
|
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)
|
|
826
863
|
])]);
|
|
827
864
|
}
|
|
828
|
-
const
|
|
865
|
+
const so = /* @__PURE__ */ R(to, [["render", oo]]), ao = {}, ro = {
|
|
829
866
|
xmlns: "http://www.w3.org/2000/svg",
|
|
830
867
|
width: "24",
|
|
831
868
|
height: "24",
|
|
@@ -833,8 +870,8 @@ const Zn = /* @__PURE__ */ A(qn, [["render", Qn]]), eo = {}, to = {
|
|
|
833
870
|
fill: "currentColor",
|
|
834
871
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
|
|
835
872
|
};
|
|
836
|
-
function
|
|
837
|
-
return p(), b("svg",
|
|
873
|
+
function io(n, e) {
|
|
874
|
+
return p(), b("svg", ro, [...e[0] || (e[0] = [
|
|
838
875
|
m("path", {
|
|
839
876
|
stroke: "none",
|
|
840
877
|
d: "M0 0h24v24H0z",
|
|
@@ -843,7 +880,7 @@ function no(n, e) {
|
|
|
843
880
|
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)
|
|
844
881
|
])]);
|
|
845
882
|
}
|
|
846
|
-
const
|
|
883
|
+
const lo = /* @__PURE__ */ R(ao, [["render", io]]), uo = {}, co = {
|
|
847
884
|
xmlns: "http://www.w3.org/2000/svg",
|
|
848
885
|
width: "24",
|
|
849
886
|
height: "24",
|
|
@@ -851,8 +888,8 @@ const oo = /* @__PURE__ */ A(eo, [["render", no]]), so = {}, ro = {
|
|
|
851
888
|
fill: "currentColor",
|
|
852
889
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
|
|
853
890
|
};
|
|
854
|
-
function
|
|
855
|
-
return p(), b("svg",
|
|
891
|
+
function po(n, e) {
|
|
892
|
+
return p(), b("svg", co, [...e[0] || (e[0] = [
|
|
856
893
|
m("path", {
|
|
857
894
|
stroke: "none",
|
|
858
895
|
d: "M0 0h24v24H0z",
|
|
@@ -861,7 +898,7 @@ function ao(n, e) {
|
|
|
861
898
|
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)
|
|
862
899
|
])]);
|
|
863
900
|
}
|
|
864
|
-
const
|
|
901
|
+
const ho = /* @__PURE__ */ R(uo, [["render", po]]), fo = {}, mo = {
|
|
865
902
|
xmlns: "http://www.w3.org/2000/svg",
|
|
866
903
|
width: "24",
|
|
867
904
|
height: "24",
|
|
@@ -873,12 +910,12 @@ const io = /* @__PURE__ */ A(so, [["render", ao]]), lo = {}, uo = {
|
|
|
873
910
|
"stroke-linejoin": "round",
|
|
874
911
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"
|
|
875
912
|
};
|
|
876
|
-
function
|
|
877
|
-
return p(), b("svg",
|
|
913
|
+
function vo(n, e) {
|
|
914
|
+
return p(), b("svg", mo, [...e[0] || (e[0] = [
|
|
878
915
|
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)
|
|
879
916
|
])]);
|
|
880
917
|
}
|
|
881
|
-
const
|
|
918
|
+
const mt = /* @__PURE__ */ R(fo, [["render", vo]]), go = {}, bo = {
|
|
882
919
|
xmlns: "http://www.w3.org/2000/svg",
|
|
883
920
|
width: "24",
|
|
884
921
|
height: "24",
|
|
@@ -890,8 +927,8 @@ const ht = /* @__PURE__ */ A(lo, [["render", co]]), po = {}, ho = {
|
|
|
890
927
|
"stroke-linejoin": "round",
|
|
891
928
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-player-play"
|
|
892
929
|
};
|
|
893
|
-
function
|
|
894
|
-
return p(), b("svg",
|
|
930
|
+
function yo(n, e) {
|
|
931
|
+
return p(), b("svg", bo, [...e[0] || (e[0] = [
|
|
895
932
|
m("path", {
|
|
896
933
|
stroke: "none",
|
|
897
934
|
d: "M0 0h24v24H0z",
|
|
@@ -900,7 +937,7 @@ function fo(n, e) {
|
|
|
900
937
|
m("path", { d: "M7 4v16l13 -8z" }, null, -1)
|
|
901
938
|
])]);
|
|
902
939
|
}
|
|
903
|
-
const
|
|
940
|
+
const _o = /* @__PURE__ */ R(go, [["render", yo]]), Co = {}, wo = {
|
|
904
941
|
xmlns: "http://www.w3.org/2000/svg",
|
|
905
942
|
width: "24",
|
|
906
943
|
height: "24",
|
|
@@ -912,8 +949,8 @@ const mo = /* @__PURE__ */ A(po, [["render", fo]]), vo = {}, go = {
|
|
|
912
949
|
"stroke-linejoin": "round",
|
|
913
950
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-plus"
|
|
914
951
|
};
|
|
915
|
-
function
|
|
916
|
-
return p(), b("svg",
|
|
952
|
+
function ko(n, e) {
|
|
953
|
+
return p(), b("svg", wo, [...e[0] || (e[0] = [
|
|
917
954
|
m("path", {
|
|
918
955
|
stroke: "none",
|
|
919
956
|
d: "M0 0h24v24H0z",
|
|
@@ -923,7 +960,7 @@ function bo(n, e) {
|
|
|
923
960
|
m("path", { d: "M5 12l14 0" }, null, -1)
|
|
924
961
|
])]);
|
|
925
962
|
}
|
|
926
|
-
const
|
|
963
|
+
const xo = /* @__PURE__ */ R(Co, [["render", ko]]), Io = {}, No = {
|
|
927
964
|
xmlns: "http://www.w3.org/2000/svg",
|
|
928
965
|
width: "24",
|
|
929
966
|
height: "24",
|
|
@@ -935,12 +972,12 @@ const yo = /* @__PURE__ */ A(vo, [["render", bo]]), _o = {}, Co = {
|
|
|
935
972
|
"stroke-linejoin": "round",
|
|
936
973
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"
|
|
937
974
|
};
|
|
938
|
-
function
|
|
939
|
-
return p(), b("svg",
|
|
975
|
+
function Eo(n, e) {
|
|
976
|
+
return p(), b("svg", No, [...e[0] || (e[0] = [
|
|
940
977
|
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)
|
|
941
978
|
])]);
|
|
942
979
|
}
|
|
943
|
-
const
|
|
980
|
+
const To = /* @__PURE__ */ R(Io, [["render", Eo]]), Oo = {}, Mo = {
|
|
944
981
|
xmlns: "http://www.w3.org/2000/svg",
|
|
945
982
|
width: "24",
|
|
946
983
|
height: "24",
|
|
@@ -952,12 +989,12 @@ const ko = /* @__PURE__ */ A(_o, [["render", wo]]), xo = {}, Io = {
|
|
|
952
989
|
"stroke-linejoin": "round",
|
|
953
990
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"
|
|
954
991
|
};
|
|
955
|
-
function
|
|
956
|
-
return p(), b("svg",
|
|
992
|
+
function $o(n, e) {
|
|
993
|
+
return p(), b("svg", Mo, [...e[0] || (e[0] = [
|
|
957
994
|
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)
|
|
958
995
|
])]);
|
|
959
996
|
}
|
|
960
|
-
const
|
|
997
|
+
const So = /* @__PURE__ */ R(Oo, [["render", $o]]), Ao = {}, Go = {
|
|
961
998
|
xmlns: "http://www.w3.org/2000/svg",
|
|
962
999
|
width: "24",
|
|
963
1000
|
height: "24",
|
|
@@ -969,12 +1006,12 @@ const Eo = /* @__PURE__ */ A(xo, [["render", No]]), To = {}, Oo = {
|
|
|
969
1006
|
"stroke-linejoin": "round",
|
|
970
1007
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"
|
|
971
1008
|
};
|
|
972
|
-
function
|
|
973
|
-
return p(), b("svg",
|
|
1009
|
+
function Ro(n, e) {
|
|
1010
|
+
return p(), b("svg", Go, [...e[0] || (e[0] = [
|
|
974
1011
|
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)
|
|
975
1012
|
])]);
|
|
976
1013
|
}
|
|
977
|
-
const
|
|
1014
|
+
const jo = /* @__PURE__ */ R(Ao, [["render", Ro]]), Lo = {}, Po = {
|
|
978
1015
|
xmlns: "http://www.w3.org/2000/svg",
|
|
979
1016
|
width: "24",
|
|
980
1017
|
height: "24",
|
|
@@ -986,12 +1023,12 @@ const Mo = /* @__PURE__ */ A(To, [["render", $o]]), So = {}, Po = {
|
|
|
986
1023
|
"stroke-linejoin": "round",
|
|
987
1024
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-trash-off"
|
|
988
1025
|
};
|
|
989
|
-
function
|
|
1026
|
+
function Vo(n, e) {
|
|
990
1027
|
return p(), b("svg", Po, [...e[0] || (e[0] = [
|
|
991
1028
|
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)
|
|
992
1029
|
])]);
|
|
993
1030
|
}
|
|
994
|
-
const
|
|
1031
|
+
const Bo = /* @__PURE__ */ R(Lo, [["render", Vo]]), Ho = {}, zo = {
|
|
995
1032
|
xmlns: "http://www.w3.org/2000/svg",
|
|
996
1033
|
width: "24",
|
|
997
1034
|
height: "24",
|
|
@@ -1003,8 +1040,8 @@ const Ao = /* @__PURE__ */ A(So, [["render", Go]]), Ro = {}, jo = {
|
|
|
1003
1040
|
"stroke-linejoin": "round",
|
|
1004
1041
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-x"
|
|
1005
1042
|
};
|
|
1006
|
-
function
|
|
1007
|
-
return p(), b("svg",
|
|
1043
|
+
function Uo(n, e) {
|
|
1044
|
+
return p(), b("svg", zo, [...e[0] || (e[0] = [
|
|
1008
1045
|
m("path", {
|
|
1009
1046
|
stroke: "none",
|
|
1010
1047
|
d: "M0 0h24v24H0z",
|
|
@@ -1014,55 +1051,57 @@ function Lo(n, e) {
|
|
|
1014
1051
|
m("path", { d: "M6 6l12 12" }, null, -1)
|
|
1015
1052
|
])]);
|
|
1016
1053
|
}
|
|
1017
|
-
const
|
|
1054
|
+
const Do = /* @__PURE__ */ R(Ho, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_ENGINE", bt = "TOGGLE_MINIMAP", yt = "TOGGLE_PALETTE", Fo = (n, e, t) => {
|
|
1018
1055
|
const s = t.zoomToFit.paddingLeft;
|
|
1019
|
-
e.registerCommand(
|
|
1056
|
+
e.registerCommand(yt, {
|
|
1020
1057
|
execute: () => {
|
|
1021
1058
|
t.palette.enabled = !t.palette.enabled, t.zoomToFit.paddingLeft = t.palette.enabled ? s : 50;
|
|
1022
1059
|
},
|
|
1023
1060
|
canExecute: () => !0
|
|
1024
|
-
}), e.registerCommand(ft, {
|
|
1025
|
-
execute: () => n.value.clear(),
|
|
1026
|
-
canExecute: () => n.value.nodes.length > 0
|
|
1027
1061
|
}), e.registerCommand(vt, {
|
|
1062
|
+
execute: () => {
|
|
1063
|
+
e.executeCommand(ne.CLEAR_CLIPBOARD_COMMAND), e.executeCommand(ne.CLEAR_HISTORY_COMMAND), n.value.clear(), n.value.editor.code.clear();
|
|
1064
|
+
},
|
|
1065
|
+
canExecute: () => n.value.nodes.length > 0
|
|
1066
|
+
}), e.registerCommand(bt, {
|
|
1028
1067
|
execute: () => t.enableMinimap = !t.enableMinimap,
|
|
1029
1068
|
canExecute: () => n.value.nodes.length > 1
|
|
1030
1069
|
});
|
|
1031
|
-
},
|
|
1070
|
+
}, Yo = (n) => {
|
|
1032
1071
|
const e = {
|
|
1033
|
-
command:
|
|
1072
|
+
command: gt,
|
|
1034
1073
|
title: "Run",
|
|
1035
1074
|
// Tooltip text
|
|
1036
|
-
icon:
|
|
1075
|
+
icon: A(() => _o)
|
|
1037
1076
|
}, t = {
|
|
1038
|
-
command:
|
|
1077
|
+
command: yt,
|
|
1039
1078
|
title: "Toggle palette",
|
|
1040
1079
|
// Tooltip text
|
|
1041
|
-
icon:
|
|
1080
|
+
icon: A(() => n.palette.enabled ? qn : eo)
|
|
1042
1081
|
}, s = {
|
|
1043
|
-
command:
|
|
1082
|
+
command: vt,
|
|
1044
1083
|
title: "Clear all",
|
|
1045
1084
|
// Tooltip text
|
|
1046
|
-
icon:
|
|
1085
|
+
icon: A(() => Bo)
|
|
1047
1086
|
}, o = {
|
|
1048
|
-
command:
|
|
1087
|
+
command: bt,
|
|
1049
1088
|
title: "Toggle minimap",
|
|
1050
1089
|
// Tooltip text
|
|
1051
|
-
icon:
|
|
1090
|
+
icon: A(() => n.enableMinimap ? So : To)
|
|
1052
1091
|
};
|
|
1053
|
-
n.toolbar.commands = [t, e, ...
|
|
1054
|
-
},
|
|
1055
|
-
|
|
1056
|
-
execute: () =>
|
|
1057
|
-
canExecute: () =>
|
|
1092
|
+
n.toolbar.commands = [t, e, ...qt, s, o];
|
|
1093
|
+
}, Wo = (n, e, t) => {
|
|
1094
|
+
t.registerCommand(gt, {
|
|
1095
|
+
execute: () => e.runOnce(null),
|
|
1096
|
+
canExecute: () => n.nodes.length > 0
|
|
1058
1097
|
});
|
|
1059
1098
|
};
|
|
1060
|
-
function
|
|
1099
|
+
function Ko(n) {
|
|
1061
1100
|
const e = Symbol("CodeEngineToken");
|
|
1062
|
-
n.engine = new
|
|
1063
|
-
n.engine?.pause(), n.displayedGraph.clear(), n.editor.load(t), n.commandHandler.executeCommand(
|
|
1101
|
+
n.engine = new Mn(n.editor), Wo(n.editor.graph, n.engine, n.commandHandler), n.loadEditor = (t) => {
|
|
1102
|
+
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);
|
|
1064
1103
|
}, n.newGraph = () => {
|
|
1065
|
-
n.engine?.pause(), n.displayedGraph.clear(), n.commandHandler.executeCommand(
|
|
1104
|
+
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);
|
|
1066
1105
|
}, n.subscribe = () => {
|
|
1067
1106
|
n.displayedGraph.events.addConnection.subscribe(e, (t) => {
|
|
1068
1107
|
const s = n.displayedGraph.findNodeById(t.to.nodeId);
|
|
@@ -1077,7 +1116,7 @@ function Uo(n) {
|
|
|
1077
1116
|
}), n.engine?.events.beforeRun.subscribe(e, () => {
|
|
1078
1117
|
n.engine?.pause(), n.displayedGraph.sortNodes(), n.engine?.resume();
|
|
1079
1118
|
}), n.engine?.events.afterRun.subscribe(e, (t) => {
|
|
1080
|
-
n.engine?.pause(),
|
|
1119
|
+
n.engine?.pause(), nt(t, n.editor), n.code.state.lockCode || n.code.renderCode({
|
|
1081
1120
|
nodes: n.editor.graph.scriptedCodeNodes,
|
|
1082
1121
|
modules: n.editor.code.modules
|
|
1083
1122
|
}), n.engine?.resume();
|
|
@@ -1086,7 +1125,7 @@ function Uo(n) {
|
|
|
1086
1125
|
n.displayedGraph.events.addConnection.unsubscribe(e), n.displayedGraph.events.removeConnection.unsubscribe(e), n.engine?.events.beforeRun.unsubscribe(e), n.engine?.events.afterRun.unsubscribe(e);
|
|
1087
1126
|
};
|
|
1088
1127
|
}
|
|
1089
|
-
class Ie extends
|
|
1128
|
+
class Ie extends Rt {
|
|
1090
1129
|
code = null;
|
|
1091
1130
|
editor;
|
|
1092
1131
|
_state = te({
|
|
@@ -1097,7 +1136,7 @@ class Ie extends Pt {
|
|
|
1097
1136
|
super(e, t), this.editor = e, this.template = t, e.code && (this.code = e.code);
|
|
1098
1137
|
}
|
|
1099
1138
|
get codeNodes() {
|
|
1100
|
-
return
|
|
1139
|
+
return _t(this);
|
|
1101
1140
|
}
|
|
1102
1141
|
get connections() {
|
|
1103
1142
|
return super.connections;
|
|
@@ -1207,31 +1246,31 @@ class Ie extends Pt {
|
|
|
1207
1246
|
try {
|
|
1208
1247
|
let e = this.nodeIds;
|
|
1209
1248
|
const t = this.connections.filter(
|
|
1210
|
-
(
|
|
1211
|
-
).map((
|
|
1212
|
-
e.reverse(), e =
|
|
1213
|
-
const s = this.nodes.map((
|
|
1249
|
+
(a) => e.includes(a.to.nodeId) && e.includes(a.from.nodeId)
|
|
1250
|
+
).map((a) => [a.to.nodeId, a.from.nodeId]);
|
|
1251
|
+
e.reverse(), e = pn.array(e, t), e.reverse();
|
|
1252
|
+
const s = this.nodes.map((a) => a.id).filter((a) => !e.includes(a));
|
|
1214
1253
|
e = [...e, ...s];
|
|
1215
|
-
const o = e.map((
|
|
1254
|
+
const o = e.map((a) => this.findNodeById(a));
|
|
1216
1255
|
o && (this.nodes = o);
|
|
1217
1256
|
} catch {
|
|
1218
1257
|
console.warn("Failed to sort nodes.");
|
|
1219
1258
|
}
|
|
1220
1259
|
}
|
|
1221
1260
|
}
|
|
1222
|
-
const
|
|
1261
|
+
const _t = (n) => {
|
|
1223
1262
|
const e = [];
|
|
1224
1263
|
return n.nodes.length === 0 || n.nodes.forEach((t) => {
|
|
1225
|
-
t && (t.hasOwnProperty("subgraph") ? e.push(...
|
|
1264
|
+
t && (t.hasOwnProperty("subgraph") ? e.push(..._t(t.subgraph)) : t.hasOwnProperty("isCodeNode") && e.push(t));
|
|
1226
1265
|
}), e;
|
|
1227
|
-
},
|
|
1266
|
+
}, ba = (n = 0, e = 100) => ({
|
|
1228
1267
|
x: n * 420,
|
|
1229
1268
|
y: e
|
|
1230
|
-
}),
|
|
1269
|
+
}), ya = (n) => {
|
|
1231
1270
|
const e = { ...n.position };
|
|
1232
1271
|
return e.x -= 440, e.y += 50, e;
|
|
1233
|
-
},
|
|
1234
|
-
class
|
|
1272
|
+
}, Ue = "__baklava_SubgraphInputNode", De = "__baklava_SubgraphOutputNode";
|
|
1273
|
+
class Ct extends Re {
|
|
1235
1274
|
graphInterfaceId;
|
|
1236
1275
|
constructor() {
|
|
1237
1276
|
super(), this.graphInterfaceId = re();
|
|
@@ -1251,11 +1290,11 @@ class yt extends Re {
|
|
|
1251
1290
|
update() {
|
|
1252
1291
|
}
|
|
1253
1292
|
}
|
|
1254
|
-
class
|
|
1293
|
+
class wt extends Ct {
|
|
1255
1294
|
static isGraphInputNode(e) {
|
|
1256
|
-
return e.type ===
|
|
1295
|
+
return e.type === Ue;
|
|
1257
1296
|
}
|
|
1258
|
-
type =
|
|
1297
|
+
type = Ue;
|
|
1259
1298
|
inputs = {
|
|
1260
1299
|
name: new J("Name", "Input")
|
|
1261
1300
|
};
|
|
@@ -1263,11 +1302,11 @@ class _t extends yt {
|
|
|
1263
1302
|
placeholder: new J("Value", void 0)
|
|
1264
1303
|
};
|
|
1265
1304
|
}
|
|
1266
|
-
class
|
|
1305
|
+
class kt extends Ct {
|
|
1267
1306
|
static isGraphOutputNode(e) {
|
|
1268
|
-
return e.type ===
|
|
1307
|
+
return e.type === De;
|
|
1269
1308
|
}
|
|
1270
|
-
type =
|
|
1309
|
+
type = De;
|
|
1271
1310
|
inputs = {
|
|
1272
1311
|
name: new J("Name", "Output"),
|
|
1273
1312
|
placeholder: new J("Value", void 0)
|
|
@@ -1279,7 +1318,7 @@ class Ct extends yt {
|
|
|
1279
1318
|
output: e
|
|
1280
1319
|
});
|
|
1281
1320
|
}
|
|
1282
|
-
const
|
|
1321
|
+
const Xo = [
|
|
1283
1322
|
"component",
|
|
1284
1323
|
"connectionCount",
|
|
1285
1324
|
"events",
|
|
@@ -1294,9 +1333,9 @@ const Do = [
|
|
|
1294
1333
|
"templateId",
|
|
1295
1334
|
"value"
|
|
1296
1335
|
];
|
|
1297
|
-
function
|
|
1298
|
-
return class extends
|
|
1299
|
-
type =
|
|
1336
|
+
function qo(n) {
|
|
1337
|
+
return class extends rt {
|
|
1338
|
+
type = tt(n);
|
|
1300
1339
|
get title() {
|
|
1301
1340
|
return this._title;
|
|
1302
1341
|
}
|
|
@@ -1318,18 +1357,18 @@ function Fo(n) {
|
|
|
1318
1357
|
if (!s.engine || typeof s.engine != "object")
|
|
1319
1358
|
throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`);
|
|
1320
1359
|
const o = s.engine.getInputValues(this.subgraph);
|
|
1321
|
-
for (const
|
|
1322
|
-
o.set(
|
|
1323
|
-
const
|
|
1360
|
+
for (const r of this.subgraph.inputs)
|
|
1361
|
+
o.set(r.nodeInterfaceId, t[r.id]);
|
|
1362
|
+
const a = await s.engine.runGraph(
|
|
1324
1363
|
this.subgraph,
|
|
1325
1364
|
o,
|
|
1326
1365
|
s.globalValues
|
|
1327
1366
|
);
|
|
1328
|
-
s.engine.pause(),
|
|
1367
|
+
s.engine.pause(), nt(a, s.engine.editor), s.engine.resume();
|
|
1329
1368
|
const i = {};
|
|
1330
|
-
for (const
|
|
1331
|
-
i[
|
|
1332
|
-
return i._calculationResults =
|
|
1369
|
+
for (const r of this.subgraph.outputs)
|
|
1370
|
+
i[r.id] = a.get(r.nodeId)?.get("output");
|
|
1371
|
+
return i._calculationResults = a, this.lockCode || (i._code = this.renderCode({ inputs: t, ...s.globalValues })), this.updateOutputValues(i), i;
|
|
1333
1372
|
};
|
|
1334
1373
|
load(t) {
|
|
1335
1374
|
if (!this.subgraph) throw new Error("Cannot load a graph node without a graph");
|
|
@@ -1373,10 +1412,10 @@ function Fo(n) {
|
|
|
1373
1412
|
this.subgraph.outputs.some((s) => s.id === t) || this.removeOutput(t);
|
|
1374
1413
|
this.addInput(
|
|
1375
1414
|
"_code",
|
|
1376
|
-
new D("", []).use(V,
|
|
1415
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
1377
1416
|
), this.addOutput(
|
|
1378
1417
|
"_code",
|
|
1379
|
-
new D("", []).use(V,
|
|
1418
|
+
new D("_code", []).use(V, K).use(ue).setHidden(!0)
|
|
1380
1419
|
), this.addOutput("_calculationResults", new J("_calculationResults", void 0).setHidden(!0));
|
|
1381
1420
|
}
|
|
1382
1421
|
/**
|
|
@@ -1387,29 +1426,29 @@ function Fo(n) {
|
|
|
1387
1426
|
createProxyInterface(t, s) {
|
|
1388
1427
|
const o = new D(t.name, void 0);
|
|
1389
1428
|
return new Proxy(o, {
|
|
1390
|
-
get: (
|
|
1391
|
-
if (
|
|
1392
|
-
return Reflect.get(
|
|
1393
|
-
let
|
|
1394
|
-
s ?
|
|
1395
|
-
(C) =>
|
|
1396
|
-
)?.outputs.placeholder.id :
|
|
1397
|
-
(C) =>
|
|
1429
|
+
get: (a, i) => {
|
|
1430
|
+
if (Xo.includes(i) || i in a || typeof i == "string" && i.startsWith("__v_"))
|
|
1431
|
+
return Reflect.get(a, i);
|
|
1432
|
+
let r;
|
|
1433
|
+
s ? r = this.subgraph?.nodes.find(
|
|
1434
|
+
(C) => wt.isGraphInputNode(C) && C.graphInterfaceId === t.id
|
|
1435
|
+
)?.outputs.placeholder.id : r = this.subgraph?.nodes.find(
|
|
1436
|
+
(C) => kt.isGraphOutputNode(C) && C.graphInterfaceId === t.id
|
|
1398
1437
|
)?.inputs.placeholder.id;
|
|
1399
|
-
const l = this.subgraph?.connections.find((f) =>
|
|
1400
|
-
if (
|
|
1438
|
+
const l = this.subgraph?.connections.find((f) => r === (s ? f.from : f.to)?.id), u = s ? l?.to : l?.from;
|
|
1439
|
+
if (u) return Reflect.get(u, i);
|
|
1401
1440
|
}
|
|
1402
1441
|
});
|
|
1403
1442
|
}
|
|
1404
1443
|
};
|
|
1405
1444
|
}
|
|
1406
|
-
function
|
|
1445
|
+
function Jo(n, e) {
|
|
1407
1446
|
return Object.fromEntries(Object.entries(n).filter(e));
|
|
1408
1447
|
}
|
|
1409
|
-
function
|
|
1448
|
+
function Qo(n, e) {
|
|
1410
1449
|
return Object.fromEntries(Object.entries(n).map(([t, s]) => [t, e(s)]));
|
|
1411
1450
|
}
|
|
1412
|
-
class Ne extends
|
|
1451
|
+
class Ne extends jt {
|
|
1413
1452
|
/** Create a new GraphTemplate from the nodes and connections inside the graph instance */
|
|
1414
1453
|
static fromGraph(e, t) {
|
|
1415
1454
|
return new Ne(e.save(), t);
|
|
@@ -1432,16 +1471,16 @@ class Ne extends Gt {
|
|
|
1432
1471
|
const N = t.get(h);
|
|
1433
1472
|
if (!N) throw new Error(`Unable to create graph from template: Could not map old id ${h} to new id`);
|
|
1434
1473
|
return N;
|
|
1435
|
-
},
|
|
1474
|
+
}, a = (h) => Qo(h, (N) => ({
|
|
1436
1475
|
id: s(N.id),
|
|
1437
1476
|
templateId: N.id,
|
|
1438
1477
|
value: N.value
|
|
1439
1478
|
})), i = this.nodes.map((h) => ({
|
|
1440
1479
|
...h,
|
|
1441
1480
|
id: s(h.id),
|
|
1442
|
-
inputs:
|
|
1443
|
-
outputs:
|
|
1444
|
-
})),
|
|
1481
|
+
inputs: a(h.inputs),
|
|
1482
|
+
outputs: a(h.outputs)
|
|
1483
|
+
})), r = this.connections.map((h) => ({
|
|
1445
1484
|
id: s(h.id),
|
|
1446
1485
|
from: o(h.from),
|
|
1447
1486
|
to: o(h.to)
|
|
@@ -1450,7 +1489,7 @@ class Ne extends Gt {
|
|
|
1450
1489
|
name: h.name,
|
|
1451
1490
|
nodeId: o(h.nodeId),
|
|
1452
1491
|
nodeInterfaceId: o(h.nodeInterfaceId)
|
|
1453
|
-
})),
|
|
1492
|
+
})), u = this.outputs.map((h) => ({
|
|
1454
1493
|
id: h.id,
|
|
1455
1494
|
name: h.name,
|
|
1456
1495
|
nodeId: o(h.nodeId),
|
|
@@ -1458,18 +1497,18 @@ class Ne extends Gt {
|
|
|
1458
1497
|
})), f = {
|
|
1459
1498
|
id: re(),
|
|
1460
1499
|
nodes: i,
|
|
1461
|
-
connections:
|
|
1500
|
+
connections: r,
|
|
1462
1501
|
inputs: l,
|
|
1463
|
-
outputs:
|
|
1502
|
+
outputs: u
|
|
1464
1503
|
};
|
|
1465
1504
|
return e || (e = new Ie(this.editor)), e.load(f).forEach((h) => console.warn(h)), e.template = this, e;
|
|
1466
1505
|
}
|
|
1467
1506
|
}
|
|
1468
|
-
const
|
|
1469
|
-
function
|
|
1507
|
+
const Zo = (n) => !(n instanceof Ie);
|
|
1508
|
+
function es(n, e) {
|
|
1470
1509
|
return { switchGraph: (s) => {
|
|
1471
1510
|
let o;
|
|
1472
|
-
if (
|
|
1511
|
+
if (Zo(s))
|
|
1473
1512
|
o = new Ie(n.value), s.createGraph(o);
|
|
1474
1513
|
else {
|
|
1475
1514
|
if (s !== n.value.graph)
|
|
@@ -1481,16 +1520,16 @@ function Ko(n, e) {
|
|
|
1481
1520
|
e.value && e.value !== n.value.graph && e.value.destroy(), o.panning = o.panning ?? s.panning ?? { x: 0, y: 0 }, o.scaling = o.scaling ?? s.scaling ?? 1, o.selectedNodes = o.selectedNodes ?? [], o.sidebar = o.sidebar ?? { visible: !1, nodeId: "", optionName: "" }, e.value = o, o.code?.engine?.runOnce(null);
|
|
1482
1521
|
} };
|
|
1483
1522
|
}
|
|
1484
|
-
function
|
|
1523
|
+
function ts(n) {
|
|
1485
1524
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
1486
1525
|
}
|
|
1487
1526
|
var we = { exports: {} };
|
|
1488
|
-
var
|
|
1489
|
-
function
|
|
1490
|
-
return
|
|
1527
|
+
var ns = we.exports, Fe;
|
|
1528
|
+
function os() {
|
|
1529
|
+
return Fe || (Fe = 1, (function(n, e) {
|
|
1491
1530
|
(function(s, o) {
|
|
1492
1531
|
n.exports = o();
|
|
1493
|
-
})(
|
|
1532
|
+
})(ns, function() {
|
|
1494
1533
|
return (
|
|
1495
1534
|
/******/
|
|
1496
1535
|
(function() {
|
|
@@ -1498,16 +1537,16 @@ function Qo() {
|
|
|
1498
1537
|
/***/
|
|
1499
1538
|
686: (
|
|
1500
1539
|
/***/
|
|
1501
|
-
(function(
|
|
1502
|
-
|
|
1540
|
+
(function(a, i, r) {
|
|
1541
|
+
r.d(i, {
|
|
1503
1542
|
default: function() {
|
|
1504
1543
|
return (
|
|
1505
1544
|
/* binding */
|
|
1506
|
-
|
|
1545
|
+
M
|
|
1507
1546
|
);
|
|
1508
1547
|
}
|
|
1509
1548
|
});
|
|
1510
|
-
var l =
|
|
1549
|
+
var l = r(279), u = /* @__PURE__ */ r.n(l), f = r(370), C = /* @__PURE__ */ r.n(f), h = r(817), N = /* @__PURE__ */ r.n(h);
|
|
1511
1550
|
function v(g) {
|
|
1512
1551
|
try {
|
|
1513
1552
|
return document.execCommand(g);
|
|
@@ -1518,14 +1557,14 @@ function Qo() {
|
|
|
1518
1557
|
var w = function(c) {
|
|
1519
1558
|
var _ = N()(c);
|
|
1520
1559
|
return v("cut"), _;
|
|
1521
|
-
},
|
|
1560
|
+
}, d = w;
|
|
1522
1561
|
function y(g) {
|
|
1523
1562
|
var c = document.documentElement.getAttribute("dir") === "rtl", _ = document.createElement("textarea");
|
|
1524
1563
|
_.style.fontSize = "12pt", _.style.border = "0", _.style.padding = "0", _.style.margin = "0", _.style.position = "absolute", _.style[c ? "right" : "left"] = "-9999px";
|
|
1525
1564
|
var x = window.pageYOffset || document.documentElement.scrollTop;
|
|
1526
1565
|
return _.style.top = "".concat(x, "px"), _.setAttribute("readonly", ""), _.value = g, _;
|
|
1527
1566
|
}
|
|
1528
|
-
var
|
|
1567
|
+
var $ = function(c, _) {
|
|
1529
1568
|
var x = y(c);
|
|
1530
1569
|
_.container.appendChild(x);
|
|
1531
1570
|
var I = N()(x);
|
|
@@ -1534,7 +1573,7 @@ function Qo() {
|
|
|
1534
1573
|
var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
1535
1574
|
container: document.body
|
|
1536
1575
|
}, x = "";
|
|
1537
|
-
return typeof c == "string" ? x =
|
|
1576
|
+
return typeof c == "string" ? x = $(c, _) : c instanceof HTMLInputElement && !["text", "search", "url", "tel", "password"].includes(c?.type) ? x = $(c.value, _) : (x = N()(c), v("copy")), x;
|
|
1538
1577
|
}, S = T;
|
|
1539
1578
|
function Q(g) {
|
|
1540
1579
|
"@babel/helpers - typeof";
|
|
@@ -1545,7 +1584,7 @@ function Qo() {
|
|
|
1545
1584
|
}, Q(g);
|
|
1546
1585
|
}
|
|
1547
1586
|
var Z = function() {
|
|
1548
|
-
var c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ = c.action, x = _ === void 0 ? "copy" : _, I = c.container, E = c.target,
|
|
1587
|
+
var c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ = c.action, x = _ === void 0 ? "copy" : _, I = c.container, E = c.target, W = c.text;
|
|
1549
1588
|
if (x !== "copy" && x !== "cut")
|
|
1550
1589
|
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
|
1551
1590
|
if (E !== void 0)
|
|
@@ -1556,35 +1595,35 @@ function Qo() {
|
|
|
1556
1595
|
throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`);
|
|
1557
1596
|
} else
|
|
1558
1597
|
throw new Error('Invalid "target" value, use a valid Element');
|
|
1559
|
-
if (
|
|
1560
|
-
return S(
|
|
1598
|
+
if (W)
|
|
1599
|
+
return S(W, {
|
|
1561
1600
|
container: I
|
|
1562
1601
|
});
|
|
1563
1602
|
if (E)
|
|
1564
|
-
return x === "cut" ?
|
|
1603
|
+
return x === "cut" ? d(E) : S(E, {
|
|
1565
1604
|
container: I
|
|
1566
1605
|
});
|
|
1567
1606
|
}, pe = Z;
|
|
1568
|
-
function
|
|
1607
|
+
function X(g) {
|
|
1569
1608
|
"@babel/helpers - typeof";
|
|
1570
|
-
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ?
|
|
1609
|
+
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? X = function(_) {
|
|
1571
1610
|
return typeof _;
|
|
1572
|
-
} :
|
|
1611
|
+
} : X = function(_) {
|
|
1573
1612
|
return _ && typeof Symbol == "function" && _.constructor === Symbol && _ !== Symbol.prototype ? "symbol" : typeof _;
|
|
1574
|
-
},
|
|
1613
|
+
}, X(g);
|
|
1575
1614
|
}
|
|
1576
1615
|
function k(g, c) {
|
|
1577
1616
|
if (!(g instanceof c))
|
|
1578
1617
|
throw new TypeError("Cannot call a class as a function");
|
|
1579
1618
|
}
|
|
1580
|
-
function
|
|
1619
|
+
function j(g, c) {
|
|
1581
1620
|
for (var _ = 0; _ < c.length; _++) {
|
|
1582
1621
|
var x = c[_];
|
|
1583
1622
|
x.enumerable = x.enumerable || !1, x.configurable = !0, "value" in x && (x.writable = !0), Object.defineProperty(g, x.key, x);
|
|
1584
1623
|
}
|
|
1585
1624
|
}
|
|
1586
1625
|
function z(g, c, _) {
|
|
1587
|
-
return c &&
|
|
1626
|
+
return c && j(g.prototype, c), _ && j(g, _), g;
|
|
1588
1627
|
}
|
|
1589
1628
|
function ge(g, c) {
|
|
1590
1629
|
if (typeof c != "function" && c !== null)
|
|
@@ -1599,9 +1638,9 @@ function Qo() {
|
|
|
1599
1638
|
function Ee(g) {
|
|
1600
1639
|
var c = Te();
|
|
1601
1640
|
return function() {
|
|
1602
|
-
var x =
|
|
1641
|
+
var x = se(g), I;
|
|
1603
1642
|
if (c) {
|
|
1604
|
-
var E =
|
|
1643
|
+
var E = se(this).constructor;
|
|
1605
1644
|
I = Reflect.construct(x, arguments, E);
|
|
1606
1645
|
} else
|
|
1607
1646
|
I = x.apply(this, arguments);
|
|
@@ -1609,7 +1648,7 @@ function Qo() {
|
|
|
1609
1648
|
};
|
|
1610
1649
|
}
|
|
1611
1650
|
function be(g, c) {
|
|
1612
|
-
return c && (
|
|
1651
|
+
return c && (X(c) === "object" || typeof c == "function") ? c : ye(g);
|
|
1613
1652
|
}
|
|
1614
1653
|
function ye(g) {
|
|
1615
1654
|
if (g === void 0)
|
|
@@ -1626,12 +1665,12 @@ function Qo() {
|
|
|
1626
1665
|
return !1;
|
|
1627
1666
|
}
|
|
1628
1667
|
}
|
|
1629
|
-
function
|
|
1630
|
-
return
|
|
1668
|
+
function se(g) {
|
|
1669
|
+
return se = Object.setPrototypeOf ? Object.getPrototypeOf : function(_) {
|
|
1631
1670
|
return _.__proto__ || Object.getPrototypeOf(_);
|
|
1632
|
-
},
|
|
1671
|
+
}, se(g);
|
|
1633
1672
|
}
|
|
1634
|
-
function
|
|
1673
|
+
function le(g, c) {
|
|
1635
1674
|
var _ = "data-clipboard-".concat(g);
|
|
1636
1675
|
if (c.hasAttribute(_))
|
|
1637
1676
|
return c.getAttribute(_);
|
|
@@ -1647,7 +1686,7 @@ function Qo() {
|
|
|
1647
1686
|
key: "resolveOptions",
|
|
1648
1687
|
value: function() {
|
|
1649
1688
|
var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1650
|
-
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 =
|
|
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 = X(I.container) === "object" ? I.container : document.body;
|
|
1651
1690
|
}
|
|
1652
1691
|
/**
|
|
1653
1692
|
* Adds a click event listener to the passed trigger.
|
|
@@ -1657,8 +1696,8 @@ function Qo() {
|
|
|
1657
1696
|
key: "listenClick",
|
|
1658
1697
|
value: function(I) {
|
|
1659
1698
|
var E = this;
|
|
1660
|
-
this.listener = C()(I, "click", function(
|
|
1661
|
-
return E.onClick(
|
|
1699
|
+
this.listener = C()(I, "click", function(W) {
|
|
1700
|
+
return E.onClick(W);
|
|
1662
1701
|
});
|
|
1663
1702
|
}
|
|
1664
1703
|
/**
|
|
@@ -1668,14 +1707,14 @@ function Qo() {
|
|
|
1668
1707
|
}, {
|
|
1669
1708
|
key: "onClick",
|
|
1670
1709
|
value: function(I) {
|
|
1671
|
-
var E = I.delegateTarget || I.currentTarget,
|
|
1672
|
-
action:
|
|
1710
|
+
var E = I.delegateTarget || I.currentTarget, W = this.action(E) || "copy", Ce = pe({
|
|
1711
|
+
action: W,
|
|
1673
1712
|
container: this.container,
|
|
1674
1713
|
target: this.target(E),
|
|
1675
1714
|
text: this.text(E)
|
|
1676
1715
|
});
|
|
1677
1716
|
this.emit(Ce ? "success" : "error", {
|
|
1678
|
-
action:
|
|
1717
|
+
action: W,
|
|
1679
1718
|
text: Ce,
|
|
1680
1719
|
trigger: E,
|
|
1681
1720
|
clearSelection: function() {
|
|
@@ -1690,7 +1729,7 @@ function Qo() {
|
|
|
1690
1729
|
}, {
|
|
1691
1730
|
key: "defaultAction",
|
|
1692
1731
|
value: function(I) {
|
|
1693
|
-
return
|
|
1732
|
+
return le("action", I);
|
|
1694
1733
|
}
|
|
1695
1734
|
/**
|
|
1696
1735
|
* Default `target` lookup function.
|
|
@@ -1699,7 +1738,7 @@ function Qo() {
|
|
|
1699
1738
|
}, {
|
|
1700
1739
|
key: "defaultTarget",
|
|
1701
1740
|
value: function(I) {
|
|
1702
|
-
var E =
|
|
1741
|
+
var E = le("target", I);
|
|
1703
1742
|
if (E)
|
|
1704
1743
|
return document.querySelector(E);
|
|
1705
1744
|
}
|
|
@@ -1716,7 +1755,7 @@ function Qo() {
|
|
|
1716
1755
|
* @param {Element} trigger
|
|
1717
1756
|
*/
|
|
1718
1757
|
value: function(I) {
|
|
1719
|
-
return
|
|
1758
|
+
return le("text", I);
|
|
1720
1759
|
}
|
|
1721
1760
|
/**
|
|
1722
1761
|
* Destroy lifecycle.
|
|
@@ -1742,7 +1781,7 @@ function Qo() {
|
|
|
1742
1781
|
}, {
|
|
1743
1782
|
key: "cut",
|
|
1744
1783
|
value: function(I) {
|
|
1745
|
-
return
|
|
1784
|
+
return d(I);
|
|
1746
1785
|
}
|
|
1747
1786
|
/**
|
|
1748
1787
|
* Returns the support of the given action, or all actions if no action is
|
|
@@ -1752,73 +1791,73 @@ function Qo() {
|
|
|
1752
1791
|
}, {
|
|
1753
1792
|
key: "isSupported",
|
|
1754
1793
|
value: function() {
|
|
1755
|
-
var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"], E = typeof I == "string" ? [I] : I,
|
|
1794
|
+
var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ["copy", "cut"], E = typeof I == "string" ? [I] : I, W = !!document.queryCommandSupported;
|
|
1756
1795
|
return E.forEach(function(Ce) {
|
|
1757
|
-
|
|
1758
|
-
}),
|
|
1796
|
+
W = W && !!document.queryCommandSupported(Ce);
|
|
1797
|
+
}), W;
|
|
1759
1798
|
}
|
|
1760
1799
|
}]), _;
|
|
1761
|
-
})(
|
|
1800
|
+
})(u()), M = _e;
|
|
1762
1801
|
})
|
|
1763
1802
|
),
|
|
1764
1803
|
/***/
|
|
1765
1804
|
828: (
|
|
1766
1805
|
/***/
|
|
1767
|
-
(function(
|
|
1806
|
+
(function(a) {
|
|
1768
1807
|
var i = 9;
|
|
1769
1808
|
if (typeof Element < "u" && !Element.prototype.matches) {
|
|
1770
|
-
var
|
|
1771
|
-
|
|
1809
|
+
var r = Element.prototype;
|
|
1810
|
+
r.matches = r.matchesSelector || r.mozMatchesSelector || r.msMatchesSelector || r.oMatchesSelector || r.webkitMatchesSelector;
|
|
1772
1811
|
}
|
|
1773
|
-
function l(
|
|
1774
|
-
for (;
|
|
1775
|
-
if (typeof
|
|
1776
|
-
return
|
|
1777
|
-
|
|
1812
|
+
function l(u, f) {
|
|
1813
|
+
for (; u && u.nodeType !== i; ) {
|
|
1814
|
+
if (typeof u.matches == "function" && u.matches(f))
|
|
1815
|
+
return u;
|
|
1816
|
+
u = u.parentNode;
|
|
1778
1817
|
}
|
|
1779
1818
|
}
|
|
1780
|
-
|
|
1819
|
+
a.exports = l;
|
|
1781
1820
|
})
|
|
1782
1821
|
),
|
|
1783
1822
|
/***/
|
|
1784
1823
|
438: (
|
|
1785
1824
|
/***/
|
|
1786
|
-
(function(
|
|
1787
|
-
var l =
|
|
1788
|
-
function
|
|
1825
|
+
(function(a, i, r) {
|
|
1826
|
+
var l = r(828);
|
|
1827
|
+
function u(h, N, v, w, d) {
|
|
1789
1828
|
var y = C.apply(this, arguments);
|
|
1790
|
-
return h.addEventListener(v, y,
|
|
1829
|
+
return h.addEventListener(v, y, d), {
|
|
1791
1830
|
destroy: function() {
|
|
1792
|
-
h.removeEventListener(v, y,
|
|
1831
|
+
h.removeEventListener(v, y, d);
|
|
1793
1832
|
}
|
|
1794
1833
|
};
|
|
1795
1834
|
}
|
|
1796
|
-
function f(h, N, v, w,
|
|
1797
|
-
return typeof h.addEventListener == "function" ?
|
|
1798
|
-
return
|
|
1835
|
+
function f(h, N, v, w, d) {
|
|
1836
|
+
return typeof h.addEventListener == "function" ? u.apply(null, arguments) : typeof v == "function" ? u.bind(null, document).apply(null, arguments) : (typeof h == "string" && (h = document.querySelectorAll(h)), Array.prototype.map.call(h, function(y) {
|
|
1837
|
+
return u(y, N, v, w, d);
|
|
1799
1838
|
}));
|
|
1800
1839
|
}
|
|
1801
1840
|
function C(h, N, v, w) {
|
|
1802
|
-
return function(
|
|
1803
|
-
|
|
1841
|
+
return function(d) {
|
|
1842
|
+
d.delegateTarget = l(d.target, N), d.delegateTarget && w.call(h, d);
|
|
1804
1843
|
};
|
|
1805
1844
|
}
|
|
1806
|
-
|
|
1845
|
+
a.exports = f;
|
|
1807
1846
|
})
|
|
1808
1847
|
),
|
|
1809
1848
|
/***/
|
|
1810
1849
|
879: (
|
|
1811
1850
|
/***/
|
|
1812
|
-
(function(
|
|
1813
|
-
i.node = function(
|
|
1814
|
-
return
|
|
1815
|
-
}, i.nodeList = function(
|
|
1816
|
-
var l = Object.prototype.toString.call(
|
|
1817
|
-
return
|
|
1818
|
-
}, i.string = function(
|
|
1819
|
-
return typeof
|
|
1820
|
-
}, i.fn = function(
|
|
1821
|
-
var l = Object.prototype.toString.call(
|
|
1851
|
+
(function(a, i) {
|
|
1852
|
+
i.node = function(r) {
|
|
1853
|
+
return r !== void 0 && r instanceof HTMLElement && r.nodeType === 1;
|
|
1854
|
+
}, i.nodeList = function(r) {
|
|
1855
|
+
var l = Object.prototype.toString.call(r);
|
|
1856
|
+
return r !== void 0 && (l === "[object NodeList]" || l === "[object HTMLCollection]") && "length" in r && (r.length === 0 || i.node(r[0]));
|
|
1857
|
+
}, i.string = function(r) {
|
|
1858
|
+
return typeof r == "string" || r instanceof String;
|
|
1859
|
+
}, i.fn = function(r) {
|
|
1860
|
+
var l = Object.prototype.toString.call(r);
|
|
1822
1861
|
return l === "[object Function]";
|
|
1823
1862
|
};
|
|
1824
1863
|
})
|
|
@@ -1826,111 +1865,111 @@ function Qo() {
|
|
|
1826
1865
|
/***/
|
|
1827
1866
|
370: (
|
|
1828
1867
|
/***/
|
|
1829
|
-
(function(
|
|
1830
|
-
var l =
|
|
1831
|
-
function f(v, w,
|
|
1832
|
-
if (!v && !w && !
|
|
1868
|
+
(function(a, i, r) {
|
|
1869
|
+
var l = r(879), u = r(438);
|
|
1870
|
+
function f(v, w, d) {
|
|
1871
|
+
if (!v && !w && !d)
|
|
1833
1872
|
throw new Error("Missing required arguments");
|
|
1834
1873
|
if (!l.string(w))
|
|
1835
1874
|
throw new TypeError("Second argument must be a String");
|
|
1836
|
-
if (!l.fn(
|
|
1875
|
+
if (!l.fn(d))
|
|
1837
1876
|
throw new TypeError("Third argument must be a Function");
|
|
1838
1877
|
if (l.node(v))
|
|
1839
|
-
return C(v, w,
|
|
1878
|
+
return C(v, w, d);
|
|
1840
1879
|
if (l.nodeList(v))
|
|
1841
|
-
return h(v, w,
|
|
1880
|
+
return h(v, w, d);
|
|
1842
1881
|
if (l.string(v))
|
|
1843
|
-
return N(v, w,
|
|
1882
|
+
return N(v, w, d);
|
|
1844
1883
|
throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
|
|
1845
1884
|
}
|
|
1846
|
-
function C(v, w,
|
|
1847
|
-
return v.addEventListener(w,
|
|
1885
|
+
function C(v, w, d) {
|
|
1886
|
+
return v.addEventListener(w, d), {
|
|
1848
1887
|
destroy: function() {
|
|
1849
|
-
v.removeEventListener(w,
|
|
1888
|
+
v.removeEventListener(w, d);
|
|
1850
1889
|
}
|
|
1851
1890
|
};
|
|
1852
1891
|
}
|
|
1853
|
-
function h(v, w,
|
|
1892
|
+
function h(v, w, d) {
|
|
1854
1893
|
return Array.prototype.forEach.call(v, function(y) {
|
|
1855
|
-
y.addEventListener(w,
|
|
1894
|
+
y.addEventListener(w, d);
|
|
1856
1895
|
}), {
|
|
1857
1896
|
destroy: function() {
|
|
1858
1897
|
Array.prototype.forEach.call(v, function(y) {
|
|
1859
|
-
y.removeEventListener(w,
|
|
1898
|
+
y.removeEventListener(w, d);
|
|
1860
1899
|
});
|
|
1861
1900
|
}
|
|
1862
1901
|
};
|
|
1863
1902
|
}
|
|
1864
|
-
function N(v, w,
|
|
1865
|
-
return
|
|
1903
|
+
function N(v, w, d) {
|
|
1904
|
+
return u(document.body, v, w, d);
|
|
1866
1905
|
}
|
|
1867
|
-
|
|
1906
|
+
a.exports = f;
|
|
1868
1907
|
})
|
|
1869
1908
|
),
|
|
1870
1909
|
/***/
|
|
1871
1910
|
817: (
|
|
1872
1911
|
/***/
|
|
1873
|
-
(function(
|
|
1874
|
-
function i(
|
|
1912
|
+
(function(a) {
|
|
1913
|
+
function i(r) {
|
|
1875
1914
|
var l;
|
|
1876
|
-
if (
|
|
1877
|
-
|
|
1878
|
-
else if (
|
|
1879
|
-
var
|
|
1880
|
-
|
|
1915
|
+
if (r.nodeName === "SELECT")
|
|
1916
|
+
r.focus(), l = r.value;
|
|
1917
|
+
else if (r.nodeName === "INPUT" || r.nodeName === "TEXTAREA") {
|
|
1918
|
+
var u = r.hasAttribute("readonly");
|
|
1919
|
+
u || r.setAttribute("readonly", ""), r.select(), r.setSelectionRange(0, r.value.length), u || r.removeAttribute("readonly"), l = r.value;
|
|
1881
1920
|
} else {
|
|
1882
|
-
|
|
1921
|
+
r.hasAttribute("contenteditable") && r.focus();
|
|
1883
1922
|
var f = window.getSelection(), C = document.createRange();
|
|
1884
|
-
C.selectNodeContents(
|
|
1923
|
+
C.selectNodeContents(r), f.removeAllRanges(), f.addRange(C), l = f.toString();
|
|
1885
1924
|
}
|
|
1886
1925
|
return l;
|
|
1887
1926
|
}
|
|
1888
|
-
|
|
1927
|
+
a.exports = i;
|
|
1889
1928
|
})
|
|
1890
1929
|
),
|
|
1891
1930
|
/***/
|
|
1892
1931
|
279: (
|
|
1893
1932
|
/***/
|
|
1894
|
-
(function(
|
|
1933
|
+
(function(a) {
|
|
1895
1934
|
function i() {
|
|
1896
1935
|
}
|
|
1897
1936
|
i.prototype = {
|
|
1898
|
-
on: function(
|
|
1937
|
+
on: function(r, l, u) {
|
|
1899
1938
|
var f = this.e || (this.e = {});
|
|
1900
|
-
return (f[
|
|
1939
|
+
return (f[r] || (f[r] = [])).push({
|
|
1901
1940
|
fn: l,
|
|
1902
|
-
ctx:
|
|
1941
|
+
ctx: u
|
|
1903
1942
|
}), this;
|
|
1904
1943
|
},
|
|
1905
|
-
once: function(
|
|
1944
|
+
once: function(r, l, u) {
|
|
1906
1945
|
var f = this;
|
|
1907
1946
|
function C() {
|
|
1908
|
-
f.off(
|
|
1947
|
+
f.off(r, C), l.apply(u, arguments);
|
|
1909
1948
|
}
|
|
1910
|
-
return C._ = l, this.on(
|
|
1949
|
+
return C._ = l, this.on(r, C, u);
|
|
1911
1950
|
},
|
|
1912
|
-
emit: function(
|
|
1913
|
-
var l = [].slice.call(arguments, 1),
|
|
1951
|
+
emit: function(r) {
|
|
1952
|
+
var l = [].slice.call(arguments, 1), u = ((this.e || (this.e = {}))[r] || []).slice(), f = 0, C = u.length;
|
|
1914
1953
|
for (f; f < C; f++)
|
|
1915
|
-
|
|
1954
|
+
u[f].fn.apply(u[f].ctx, l);
|
|
1916
1955
|
return this;
|
|
1917
1956
|
},
|
|
1918
|
-
off: function(
|
|
1919
|
-
var
|
|
1957
|
+
off: function(r, l) {
|
|
1958
|
+
var u = this.e || (this.e = {}), f = u[r], C = [];
|
|
1920
1959
|
if (f && l)
|
|
1921
1960
|
for (var h = 0, N = f.length; h < N; h++)
|
|
1922
1961
|
f[h].fn !== l && f[h].fn._ !== l && C.push(f[h]);
|
|
1923
|
-
return C.length ?
|
|
1962
|
+
return C.length ? u[r] = C : delete u[r], this;
|
|
1924
1963
|
}
|
|
1925
|
-
},
|
|
1964
|
+
}, a.exports = i, a.exports.TinyEmitter = i;
|
|
1926
1965
|
})
|
|
1927
1966
|
)
|
|
1928
1967
|
/******/
|
|
1929
1968
|
}, s = {};
|
|
1930
|
-
function o(
|
|
1931
|
-
if (s[
|
|
1932
|
-
return s[
|
|
1933
|
-
var i = s[
|
|
1969
|
+
function o(a) {
|
|
1970
|
+
if (s[a])
|
|
1971
|
+
return s[a].exports;
|
|
1972
|
+
var i = s[a] = {
|
|
1934
1973
|
/******/
|
|
1935
1974
|
// no module.id needed
|
|
1936
1975
|
/******/
|
|
@@ -1939,31 +1978,31 @@ function Qo() {
|
|
|
1939
1978
|
exports: {}
|
|
1940
1979
|
/******/
|
|
1941
1980
|
};
|
|
1942
|
-
return t[
|
|
1981
|
+
return t[a](i, i.exports, o), i.exports;
|
|
1943
1982
|
}
|
|
1944
1983
|
return (function() {
|
|
1945
|
-
o.n = function(
|
|
1946
|
-
var i =
|
|
1984
|
+
o.n = function(a) {
|
|
1985
|
+
var i = a && a.__esModule ? (
|
|
1947
1986
|
/******/
|
|
1948
1987
|
function() {
|
|
1949
|
-
return
|
|
1988
|
+
return a.default;
|
|
1950
1989
|
}
|
|
1951
1990
|
) : (
|
|
1952
1991
|
/******/
|
|
1953
1992
|
function() {
|
|
1954
|
-
return
|
|
1993
|
+
return a;
|
|
1955
1994
|
}
|
|
1956
1995
|
);
|
|
1957
1996
|
return o.d(i, { a: i }), i;
|
|
1958
1997
|
};
|
|
1959
1998
|
})(), (function() {
|
|
1960
|
-
o.d = function(
|
|
1961
|
-
for (var
|
|
1962
|
-
o.o(i,
|
|
1999
|
+
o.d = function(a, i) {
|
|
2000
|
+
for (var r in i)
|
|
2001
|
+
o.o(i, r) && !o.o(a, r) && Object.defineProperty(a, r, { enumerable: !0, get: i[r] });
|
|
1963
2002
|
};
|
|
1964
2003
|
})(), (function() {
|
|
1965
|
-
o.o = function(
|
|
1966
|
-
return Object.prototype.hasOwnProperty.call(
|
|
2004
|
+
o.o = function(a, i) {
|
|
2005
|
+
return Object.prototype.hasOwnProperty.call(a, i);
|
|
1967
2006
|
};
|
|
1968
2007
|
})(), o(686);
|
|
1969
2008
|
})().default
|
|
@@ -1971,75 +2010,75 @@ function Qo() {
|
|
|
1971
2010
|
});
|
|
1972
2011
|
})(we)), we.exports;
|
|
1973
2012
|
}
|
|
1974
|
-
var
|
|
1975
|
-
const
|
|
2013
|
+
var ss = os();
|
|
2014
|
+
const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
|
|
1976
2015
|
toClipboard(e, t) {
|
|
1977
2016
|
return new Promise((s, o) => {
|
|
1978
|
-
const
|
|
2017
|
+
const a = document.createElement("button"), i = new as(a, {
|
|
1979
2018
|
text: () => e,
|
|
1980
2019
|
action: () => "copy",
|
|
1981
2020
|
container: t !== void 0 ? t : document.body
|
|
1982
2021
|
});
|
|
1983
|
-
i.on("success", (
|
|
1984
|
-
i.destroy(), s(
|
|
1985
|
-
}), i.on("error", (
|
|
1986
|
-
i.destroy(), o(
|
|
1987
|
-
}), document.body.appendChild(
|
|
2022
|
+
i.on("success", (r) => {
|
|
2023
|
+
i.destroy(), s(r);
|
|
2024
|
+
}), i.on("error", (r) => {
|
|
2025
|
+
i.destroy(), o(r);
|
|
2026
|
+
}), document.body.appendChild(a), a.click(), document.body.removeChild(a);
|
|
1988
2027
|
});
|
|
1989
2028
|
}
|
|
1990
|
-
}),
|
|
2029
|
+
}), is = {
|
|
1991
2030
|
key: 0,
|
|
1992
2031
|
class: "baklava-button"
|
|
1993
|
-
},
|
|
2032
|
+
}, ls = /* @__PURE__ */ F({
|
|
1994
2033
|
__name: "CopyToClipboard",
|
|
1995
2034
|
props: { text: String },
|
|
1996
2035
|
setup(n) {
|
|
1997
|
-
const { toClipboard: e } =
|
|
2036
|
+
const { toClipboard: e } = rs(), s = $e(n, "text"), o = H(!1), a = async () => {
|
|
1998
2037
|
try {
|
|
1999
2038
|
await e(s.value), o.value = !0, setTimeout(() => o.value = !1, 1500), console.log("Copied to clipboard");
|
|
2000
2039
|
} catch (i) {
|
|
2001
2040
|
console.error(i);
|
|
2002
2041
|
}
|
|
2003
2042
|
};
|
|
2004
|
-
return (i,
|
|
2005
|
-
o.value ? (p(), b("button",
|
|
2006
|
-
G(O(
|
|
2043
|
+
return (i, r) => (p(), b("div", null, [
|
|
2044
|
+
o.value ? (p(), b("button", is, [
|
|
2045
|
+
G(O(Gn))
|
|
2007
2046
|
])) : (p(), b("button", {
|
|
2008
2047
|
key: 1,
|
|
2009
|
-
onClick:
|
|
2048
|
+
onClick: a,
|
|
2010
2049
|
class: "baklava-button"
|
|
2011
2050
|
}, [
|
|
2012
|
-
G(O(
|
|
2051
|
+
G(O(zn))
|
|
2013
2052
|
]))
|
|
2014
2053
|
]));
|
|
2015
2054
|
}
|
|
2016
|
-
}),
|
|
2055
|
+
}), ds = { class: "code-editor" }, us = { class: "code-buttons" }, Ca = /* @__PURE__ */ F({
|
|
2017
2056
|
__name: "CodeEditor",
|
|
2018
|
-
props: /* @__PURE__ */
|
|
2057
|
+
props: /* @__PURE__ */ Be({
|
|
2019
2058
|
locked: { type: Boolean },
|
|
2020
2059
|
extensions: {}
|
|
2021
2060
|
}, {
|
|
2022
2061
|
modelValue: { required: !0, type: String },
|
|
2023
2062
|
modelModifiers: {}
|
|
2024
2063
|
}),
|
|
2025
|
-
emits: /* @__PURE__ */
|
|
2064
|
+
emits: /* @__PURE__ */ Be(["update:locked"], ["update:modelValue"]),
|
|
2026
2065
|
setup(n, { emit: e }) {
|
|
2027
|
-
const t =
|
|
2028
|
-
return (
|
|
2029
|
-
const
|
|
2030
|
-
return p(), b("div",
|
|
2031
|
-
m("div",
|
|
2066
|
+
const t = Nt(n, "modelValue"), s = e, o = (a) => s("update:locked", a);
|
|
2067
|
+
return (a, i) => {
|
|
2068
|
+
const r = qe("codemirror");
|
|
2069
|
+
return p(), b("div", ds, [
|
|
2070
|
+
m("div", us, [
|
|
2032
2071
|
n.locked ? (p(), b("button", {
|
|
2033
2072
|
key: 0,
|
|
2034
2073
|
class: "baklava-button",
|
|
2035
2074
|
title: "The code is locked.",
|
|
2036
2075
|
onClick: i[0] || (i[0] = (l) => o(!1))
|
|
2037
2076
|
}, [
|
|
2038
|
-
G(O(
|
|
2039
|
-
])) :
|
|
2040
|
-
G(
|
|
2077
|
+
G(O(mt))
|
|
2078
|
+
])) : L("", !0),
|
|
2079
|
+
G(ls, { text: n.modelValue }, null, 8, ["text"])
|
|
2041
2080
|
]),
|
|
2042
|
-
G(
|
|
2081
|
+
G(r, {
|
|
2043
2082
|
modelValue: t.value,
|
|
2044
2083
|
"onUpdate:modelValue": i[1] || (i[1] = (l) => t.value = l),
|
|
2045
2084
|
extensions: n.extensions,
|
|
@@ -2050,60 +2089,56 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2050
2089
|
]);
|
|
2051
2090
|
};
|
|
2052
2091
|
}
|
|
2053
|
-
}),
|
|
2092
|
+
}), wa = /* @__PURE__ */ F({
|
|
2054
2093
|
__name: "CodeGraphEditor",
|
|
2055
2094
|
props: {
|
|
2056
2095
|
viewModel: {}
|
|
2057
2096
|
},
|
|
2058
2097
|
setup(n) {
|
|
2059
|
-
const t =
|
|
2060
|
-
return Se(() => {
|
|
2061
|
-
|
|
2062
|
-
}),
|
|
2063
|
-
t.value.unsubscribe && t.value.unsubscribe(), t.value.engine?.stop();
|
|
2064
|
-
}), tt(t, (o, r) => {
|
|
2065
|
-
r && r.unsubscribe(), o && o.subscribe();
|
|
2066
|
-
}), (o, r) => (p(), B(O(qt), { viewModel: t.value }, {
|
|
2098
|
+
const t = $e(n, "viewModel"), s = (o) => o.events.update.emit(null);
|
|
2099
|
+
return Se(t.value.onMounted), Je(t.value.onBeforeUnmount), Qe(t, (o, a) => {
|
|
2100
|
+
a && a.onBeforeUnmount(), o && o.onMounted();
|
|
2101
|
+
}), (o, a) => (p(), B(O(Jt), { "view-model": t.value }, {
|
|
2067
2102
|
palette: ee(() => [
|
|
2068
|
-
G(O(
|
|
2103
|
+
G(O(Bs))
|
|
2069
2104
|
]),
|
|
2070
2105
|
node: ee((i) => [
|
|
2071
|
-
G(O(
|
|
2072
|
-
onUpdate: (
|
|
2106
|
+
G(O(ws), Ot(i, {
|
|
2107
|
+
onUpdate: (r) => s(i.node)
|
|
2073
2108
|
}), null, 16, ["onUpdate"])
|
|
2074
2109
|
]),
|
|
2075
2110
|
sidebar: ee((i) => [
|
|
2076
|
-
G(O(
|
|
2077
|
-
codeEditor: ee(({ node:
|
|
2078
|
-
q(o.$slots, "sidebarCodeEditor", { node:
|
|
2111
|
+
G(O(Rs), Et(Tt(i)), {
|
|
2112
|
+
codeEditor: ee(({ node: r }) => [
|
|
2113
|
+
q(o.$slots, "sidebarCodeEditor", { node: r })
|
|
2079
2114
|
]),
|
|
2080
2115
|
_: 3
|
|
2081
2116
|
}, 16)
|
|
2082
2117
|
]),
|
|
2083
2118
|
_: 3
|
|
2084
|
-
}, 8, ["
|
|
2119
|
+
}, 8, ["view-model"]));
|
|
2085
2120
|
}
|
|
2086
|
-
}),
|
|
2121
|
+
}), cs = { class: "code-graph-info" }, ka = /* @__PURE__ */ F({
|
|
2087
2122
|
__name: "CodeGraphInfo",
|
|
2088
2123
|
props: {
|
|
2089
2124
|
viewModel: {}
|
|
2090
2125
|
},
|
|
2091
2126
|
setup(n) {
|
|
2092
|
-
return (e, t) => (p(), b("div",
|
|
2093
|
-
m("div", null, "Editor graph: " +
|
|
2094
|
-
m("div", null, "Displayed graph: " +
|
|
2095
|
-
m("div", null, "Graphs: " +
|
|
2096
|
-
m("div", null, "Graph templates: " +
|
|
2097
|
-
m("div", null, "Engine status: " +
|
|
2127
|
+
return (e, t) => (p(), b("div", cs, [
|
|
2128
|
+
m("div", null, "Editor graph: " + P(n.viewModel.editor.graph.shortId), 1),
|
|
2129
|
+
m("div", null, "Displayed graph: " + P(n.viewModel.displayedGraph.shortId), 1),
|
|
2130
|
+
m("div", null, "Graphs: " + P(n.viewModel.editor.graphIds), 1),
|
|
2131
|
+
m("div", null, "Graph templates: " + P(n.viewModel.editor.graphTemplateIds), 1),
|
|
2132
|
+
m("div", null, "Engine status: " + P(n.viewModel.engine?.status), 1)
|
|
2098
2133
|
]));
|
|
2099
2134
|
}
|
|
2100
|
-
}),
|
|
2135
|
+
}), ps = ["data-node-type", "id"], hs = {
|
|
2101
2136
|
class: "__title-label",
|
|
2102
2137
|
style: { "flex-grow": "1" }
|
|
2103
|
-
},
|
|
2138
|
+
}, fs = { key: 0 }, ms = {
|
|
2104
2139
|
class: "__menu",
|
|
2105
2140
|
style: { display: "flex" }
|
|
2106
|
-
},
|
|
2141
|
+
}, vs = { class: "__outputs" }, gs = { key: 0 }, bs = ["id", "title"], ys = { class: "__inputs" }, _s = { key: 0 }, Cs = ["id", "title"], ws = /* @__PURE__ */ F({
|
|
2107
2142
|
__name: "CodeGraphNode",
|
|
2108
2143
|
props: {
|
|
2109
2144
|
node: {},
|
|
@@ -2112,43 +2147,43 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2112
2147
|
},
|
|
2113
2148
|
emits: ["select", "start-drag", "update"],
|
|
2114
2149
|
setup(n, { emit: e }) {
|
|
2115
|
-
const t =
|
|
2116
|
-
let w = 0,
|
|
2117
|
-
const y = H(!1),
|
|
2118
|
-
const
|
|
2150
|
+
const t = Me.ContextMenu, s = Me.NodeInterface, o = n, a = A(() => o.node), i = e, { viewModel: r } = me(), { graph: l, switchGraph: u } = Ge(), f = H(null), C = H(!1), h = H(""), N = H(null), v = H(!1);
|
|
2151
|
+
let w = 0, d = 0;
|
|
2152
|
+
const y = H(!1), $ = A(() => {
|
|
2153
|
+
const M = [
|
|
2119
2154
|
{ value: "edit", label: "Edit" },
|
|
2120
2155
|
{ value: "rename", label: "Rename" },
|
|
2121
2156
|
{ value: "delete", label: "Delete" }
|
|
2122
2157
|
];
|
|
2123
|
-
return o.node.type.startsWith(
|
|
2124
|
-
}), T =
|
|
2158
|
+
return o.node.type.startsWith(Lt) && M.push({ value: "editSubgraph", label: "Edit Subgraph" }), M;
|
|
2159
|
+
}), T = A(() => ({
|
|
2125
2160
|
"--selected": o.selected,
|
|
2126
2161
|
"--dragging": o.dragging,
|
|
2127
2162
|
"--two-column": !!o.node.twoColumn,
|
|
2128
|
-
"--hidden":
|
|
2129
|
-
})), S =
|
|
2130
|
-
"--reverse-y": o.node.reverseY ??
|
|
2131
|
-
})), Q =
|
|
2163
|
+
"--hidden": a.value.state?.hidden
|
|
2164
|
+
})), S = A(() => ({
|
|
2165
|
+
"--reverse-y": o.node.reverseY ?? r.value.settings.nodes.reverseY
|
|
2166
|
+
})), Q = A(() => ({
|
|
2132
2167
|
top: `${o.node.position?.y ?? 0}px`,
|
|
2133
2168
|
left: `${o.node.position?.x ?? 0}px`,
|
|
2134
|
-
"--width": `${o.node.width ??
|
|
2135
|
-
})), Z =
|
|
2169
|
+
"--width": `${o.node.width ?? r.value.settings.nodes.defaultWidth}px`
|
|
2170
|
+
})), Z = A(() => Object.values(o.node.inputs).filter((M) => !M.hidden)), pe = A(() => Object.values(o.node.outputs).filter((M) => !M.hidden)), X = () => {
|
|
2136
2171
|
i("select");
|
|
2137
|
-
}, k = (
|
|
2138
|
-
o.selected ||
|
|
2139
|
-
},
|
|
2172
|
+
}, k = (M) => {
|
|
2173
|
+
o.selected || X(), i("start-drag", M);
|
|
2174
|
+
}, j = () => {
|
|
2140
2175
|
y.value = !0;
|
|
2141
2176
|
}, z = () => {
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2177
|
+
const M = r.value.displayedGraph.sidebar;
|
|
2178
|
+
M.nodeId = "", M.visible = !1;
|
|
2144
2179
|
}, ge = () => {
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2180
|
+
const M = r.value.displayedGraph.sidebar;
|
|
2181
|
+
M.nodeId = o.node.id, M.visible = !0;
|
|
2147
2182
|
}, he = () => {
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2150
|
-
}, Ee = async (
|
|
2151
|
-
switch (
|
|
2183
|
+
const M = r.value.displayedGraph.sidebar;
|
|
2184
|
+
M.nodeId = o.node.id;
|
|
2185
|
+
}, Ee = async (M) => {
|
|
2186
|
+
switch (M) {
|
|
2152
2187
|
case "edit":
|
|
2153
2188
|
ge();
|
|
2154
2189
|
break;
|
|
@@ -2156,59 +2191,59 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2156
2191
|
l.value.removeNode(o.node);
|
|
2157
2192
|
break;
|
|
2158
2193
|
case "rename":
|
|
2159
|
-
h.value = o.node.title, C.value = !0, await
|
|
2194
|
+
h.value = o.node.title, C.value = !0, await Mt(), N.value?.focus();
|
|
2160
2195
|
break;
|
|
2161
2196
|
case "editSubgraph":
|
|
2162
|
-
|
|
2197
|
+
u(o.node.template);
|
|
2163
2198
|
break;
|
|
2164
2199
|
}
|
|
2165
2200
|
}, be = () => {
|
|
2166
|
-
|
|
2201
|
+
a.value.title = h.value, C.value = !1;
|
|
2167
2202
|
}, ye = () => {
|
|
2168
|
-
f.value &&
|
|
2169
|
-
}, Te = (
|
|
2170
|
-
v.value = !0, w = o.node.width,
|
|
2171
|
-
},
|
|
2172
|
-
|
|
2173
|
-
},
|
|
2203
|
+
f.value && r.value.hooks.renderNode.execute({ node: o.node, el: f.value });
|
|
2204
|
+
}, Te = (M) => {
|
|
2205
|
+
v.value = !0, w = o.node.width, d = M.clientX, M.preventDefault();
|
|
2206
|
+
}, se = (M) => {
|
|
2207
|
+
a.value.state && (a.value.state.integrated = M, i("update"));
|
|
2208
|
+
}, le = (M) => {
|
|
2174
2209
|
if (!v.value) return;
|
|
2175
|
-
const g =
|
|
2176
|
-
|
|
2210
|
+
const g = M.clientX - d, c = w + g / l.value.scaling, _ = r.value.settings.nodes.minWidth, x = r.value.settings.nodes.maxWidth;
|
|
2211
|
+
a.value.width = Math.max(_, Math.min(x, c));
|
|
2177
2212
|
}, _e = () => {
|
|
2178
2213
|
v.value = !1;
|
|
2179
2214
|
};
|
|
2180
2215
|
return Se(() => {
|
|
2181
|
-
ye(), window.addEventListener("mousemove",
|
|
2182
|
-
}),
|
|
2183
|
-
window.removeEventListener("mousemove",
|
|
2184
|
-
}), (
|
|
2185
|
-
|
|
2216
|
+
ye(), window.addEventListener("mousemove", le), window.addEventListener("mouseup", _e);
|
|
2217
|
+
}), Ze(ye), Je(() => {
|
|
2218
|
+
window.removeEventListener("mousemove", le), window.removeEventListener("mouseup", _e);
|
|
2219
|
+
}), (M, g) => (p(), b("div", {
|
|
2220
|
+
class: oe([T.value, "baklava-node"]),
|
|
2221
|
+
"data-node-type": a.value.type,
|
|
2222
|
+
id: a.value.id,
|
|
2223
|
+
style: Ae(Q.value),
|
|
2186
2224
|
ref_key: "el",
|
|
2187
2225
|
ref: f,
|
|
2188
|
-
|
|
2189
|
-
"data-node-type": r.value.type,
|
|
2190
|
-
style: Pe(Q.value),
|
|
2191
|
-
onPointerdown: K
|
|
2226
|
+
onPointerdown: X
|
|
2192
2227
|
}, [
|
|
2193
|
-
O(
|
|
2228
|
+
O(r).settings.nodes.resizable ? (p(), b("div", {
|
|
2194
2229
|
key: 0,
|
|
2195
2230
|
class: "__resize-handle",
|
|
2196
2231
|
onMousedown: Te
|
|
2197
|
-
}, null, 32)) :
|
|
2232
|
+
}, null, 32)) : L("", !0),
|
|
2198
2233
|
m("div", {
|
|
2199
2234
|
class: "__title",
|
|
2200
|
-
onPointerdown:
|
|
2201
|
-
onContextmenu:
|
|
2235
|
+
onPointerdown: de(k, ["self", "stop"]),
|
|
2236
|
+
onContextmenu: de(j, ["prevent"])
|
|
2202
2237
|
}, [
|
|
2203
|
-
|
|
2238
|
+
a.value.inputs._code ? (p(), B(O(Ye), {
|
|
2204
2239
|
key: 0,
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
title:
|
|
2240
|
+
intf: a.value.inputs._code,
|
|
2241
|
+
node: a.value,
|
|
2242
|
+
title: a.value.inputs._code.value,
|
|
2208
2243
|
class: "--input",
|
|
2209
2244
|
"data-interface-type": "node",
|
|
2210
2245
|
style: { "flex-grow": "0" }
|
|
2211
|
-
}, null, 8, ["
|
|
2246
|
+
}, null, 8, ["intf", "node", "title"])) : L("", !0),
|
|
2212
2247
|
C.value ? ke((p(), b("input", {
|
|
2213
2248
|
key: 2,
|
|
2214
2249
|
ref_key: "renameInputEl",
|
|
@@ -2223,75 +2258,75 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2223
2258
|
}, null, 544)), [
|
|
2224
2259
|
[xe, h.value]
|
|
2225
2260
|
]) : (p(), b(U, { key: 1 }, [
|
|
2226
|
-
m("div",
|
|
2227
|
-
|
|
2228
|
-
|
|
2261
|
+
m("div", hs, [
|
|
2262
|
+
a.value.idx > -1 ? (p(), b("span", fs, P(a.value.idx + 1) + " > ", 1)) : L("", !0),
|
|
2263
|
+
et(P(a.value.title), 1)
|
|
2229
2264
|
]),
|
|
2230
|
-
m("div",
|
|
2231
|
-
|
|
2232
|
-
|
|
2265
|
+
m("div", ms, [
|
|
2266
|
+
a.value.isCodeNode ? (p(), b(U, { key: 0 }, [
|
|
2267
|
+
a.value.state.lockCode ? (p(), B(O(mt), {
|
|
2233
2268
|
key: 0,
|
|
2234
2269
|
class: "--clickable mx-1",
|
|
2235
|
-
onClick: g[0] || (g[0] = (c) =>
|
|
2236
|
-
})) :
|
|
2237
|
-
|
|
2270
|
+
onClick: g[0] || (g[0] = (c) => a.value.lockCode = !1)
|
|
2271
|
+
})) : L("", !0),
|
|
2272
|
+
a.value.state.integrated ? (p(), B(O(Pn), {
|
|
2238
2273
|
key: 1,
|
|
2239
2274
|
class: "--clickable mx-1",
|
|
2240
|
-
onClick: g[1] || (g[1] = (c) =>
|
|
2241
|
-
})) : (p(), B(O(
|
|
2275
|
+
onClick: g[1] || (g[1] = (c) => se(!1))
|
|
2276
|
+
})) : (p(), B(O(jo), {
|
|
2242
2277
|
key: 2,
|
|
2243
2278
|
class: "--clickable mx-1",
|
|
2244
|
-
onClick: g[2] || (g[2] = (c) =>
|
|
2279
|
+
onClick: g[2] || (g[2] = (c) => se(!0))
|
|
2245
2280
|
})),
|
|
2246
|
-
!O(
|
|
2281
|
+
!O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), B(O(ho), {
|
|
2247
2282
|
key: 3,
|
|
2248
2283
|
class: "--clickable mx-1",
|
|
2249
2284
|
onClick: ge
|
|
2250
|
-
})) : O(
|
|
2285
|
+
})) : O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), B(O(so), {
|
|
2251
2286
|
key: 4,
|
|
2252
2287
|
class: "--clickable mx-1",
|
|
2253
2288
|
onClick: he
|
|
2254
|
-
})) : (p(), B(O(
|
|
2289
|
+
})) : (p(), B(O(lo), {
|
|
2255
2290
|
key: 5,
|
|
2256
2291
|
class: "--clickable mx-1",
|
|
2257
2292
|
onClick: z
|
|
2258
2293
|
}))
|
|
2259
|
-
], 64)) :
|
|
2260
|
-
G(O(
|
|
2294
|
+
], 64)) : L("", !0),
|
|
2295
|
+
G(O(Yn), {
|
|
2261
2296
|
class: "--clickable mx-1",
|
|
2262
|
-
onClick:
|
|
2297
|
+
onClick: j
|
|
2263
2298
|
}),
|
|
2264
2299
|
G(O(t), {
|
|
2265
2300
|
modelValue: y.value,
|
|
2266
2301
|
"onUpdate:modelValue": g[3] || (g[3] = (c) => y.value = c),
|
|
2267
2302
|
x: 0,
|
|
2268
2303
|
y: 0,
|
|
2269
|
-
items:
|
|
2304
|
+
items: $.value,
|
|
2270
2305
|
onClick: Ee
|
|
2271
2306
|
}, null, 8, ["modelValue", "items"])
|
|
2272
2307
|
])
|
|
2273
2308
|
], 64)),
|
|
2274
|
-
|
|
2309
|
+
a.value.outputs._code ? (p(), B(O(Ye), {
|
|
2275
2310
|
key: 3,
|
|
2276
|
-
node:
|
|
2277
|
-
intf:
|
|
2311
|
+
node: a.value,
|
|
2312
|
+
intf: a.value.outputs._code,
|
|
2278
2313
|
class: "--output",
|
|
2279
|
-
title:
|
|
2314
|
+
title: a.value.outputs._code.value,
|
|
2280
2315
|
"data-interface-type": "node"
|
|
2281
|
-
}, null, 8, ["node", "intf", "title"])) :
|
|
2316
|
+
}, null, 8, ["node", "intf", "title"])) : L("", !0)
|
|
2282
2317
|
], 32),
|
|
2283
2318
|
m("div", {
|
|
2284
|
-
class:
|
|
2285
|
-
onKeydown: g[5] || (g[5] = Oe(
|
|
2319
|
+
class: oe(["__content", S.value]),
|
|
2320
|
+
onKeydown: g[5] || (g[5] = Oe(de(() => {
|
|
2286
2321
|
}, ["stop"]), ["delete"])),
|
|
2287
|
-
onContextmenu: g[6] || (g[6] =
|
|
2322
|
+
onContextmenu: g[6] || (g[6] = de(() => {
|
|
2288
2323
|
}, ["prevent"]))
|
|
2289
2324
|
}, [
|
|
2290
|
-
m("div",
|
|
2291
|
-
(p(!0), b(U, null,
|
|
2325
|
+
m("div", vs, [
|
|
2326
|
+
(p(!0), b(U, null, ae(pe.value, (c) => (p(), b(U, {
|
|
2292
2327
|
key: c.id
|
|
2293
2328
|
}, [
|
|
2294
|
-
|
|
2329
|
+
a.value.state?.hidden ? (p(), b("div", gs, [
|
|
2295
2330
|
c.port ? (p(), b("div", {
|
|
2296
2331
|
key: 0,
|
|
2297
2332
|
id: c.id,
|
|
@@ -2299,26 +2334,26 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2299
2334
|
class: "baklava-node-interface --output --connected"
|
|
2300
2335
|
}, [...g[7] || (g[7] = [
|
|
2301
2336
|
m("div", { class: "__port" }, null, -1)
|
|
2302
|
-
])], 8,
|
|
2303
|
-
])) : q(
|
|
2337
|
+
])], 8, bs)) : L("", !0)
|
|
2338
|
+
])) : q(M.$slots, "nodeInterface", {
|
|
2304
2339
|
key: 1,
|
|
2305
2340
|
type: "output",
|
|
2306
|
-
node:
|
|
2341
|
+
node: a.value,
|
|
2307
2342
|
intf: c
|
|
2308
2343
|
}, () => [
|
|
2309
2344
|
G(O(s), {
|
|
2310
|
-
node:
|
|
2345
|
+
node: a.value,
|
|
2311
2346
|
intf: c,
|
|
2312
2347
|
title: c.value
|
|
2313
2348
|
}, null, 8, ["node", "intf", "title"])
|
|
2314
2349
|
])
|
|
2315
2350
|
], 64))), 128))
|
|
2316
2351
|
]),
|
|
2317
|
-
m("div",
|
|
2318
|
-
(p(!0), b(U, null,
|
|
2352
|
+
m("div", ys, [
|
|
2353
|
+
(p(!0), b(U, null, ae(Z.value, (c) => (p(), b(U, {
|
|
2319
2354
|
key: c.id
|
|
2320
2355
|
}, [
|
|
2321
|
-
|
|
2356
|
+
a.value.state?.hidden ? (p(), b("div", _s, [
|
|
2322
2357
|
c.port ? (p(), b("div", {
|
|
2323
2358
|
key: 0,
|
|
2324
2359
|
id: c.id,
|
|
@@ -2326,15 +2361,15 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2326
2361
|
class: "baklava-node-interface --input --connected"
|
|
2327
2362
|
}, [...g[8] || (g[8] = [
|
|
2328
2363
|
m("div", { class: "__port" }, null, -1)
|
|
2329
|
-
])], 8,
|
|
2330
|
-
])) : q(
|
|
2364
|
+
])], 8, Cs)) : L("", !0)
|
|
2365
|
+
])) : q(M.$slots, "nodeInterface", {
|
|
2331
2366
|
key: 1,
|
|
2332
|
-
node:
|
|
2367
|
+
node: a.value,
|
|
2333
2368
|
intf: c,
|
|
2334
2369
|
type: "input"
|
|
2335
2370
|
}, () => [
|
|
2336
2371
|
G(O(s), {
|
|
2337
|
-
node:
|
|
2372
|
+
node: a.value,
|
|
2338
2373
|
intf: c,
|
|
2339
2374
|
title: c.value
|
|
2340
2375
|
}, null, 8, ["node", "intf", "title"])
|
|
@@ -2342,45 +2377,45 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2342
2377
|
], 64))), 128))
|
|
2343
2378
|
])
|
|
2344
2379
|
], 34)
|
|
2345
|
-
], 46,
|
|
2380
|
+
], 46, ps));
|
|
2346
2381
|
}
|
|
2347
|
-
}),
|
|
2382
|
+
}), ks = ["id"], xs = { class: "align-middle" }, Ye = /* @__PURE__ */ F({
|
|
2348
2383
|
__name: "CodeGraphNodeInterface",
|
|
2349
2384
|
props: {
|
|
2350
2385
|
node: {},
|
|
2351
2386
|
intf: {}
|
|
2352
2387
|
},
|
|
2353
2388
|
setup(n) {
|
|
2354
|
-
const e = n, { viewModel: t } = me(), { hoveredOver: s, temporaryConnection: o } =
|
|
2389
|
+
const e = n, { viewModel: t } = me(), { hoveredOver: s, temporaryConnection: o } = Qt(), a = H(null), i = A(() => e.intf.connectionCount > 0), r = A(() => ({
|
|
2355
2390
|
"--connected": i.value
|
|
2356
2391
|
})), l = () => {
|
|
2357
2392
|
s(e.intf);
|
|
2358
|
-
},
|
|
2393
|
+
}, u = () => {
|
|
2359
2394
|
s(void 0);
|
|
2360
2395
|
}, f = () => {
|
|
2361
|
-
|
|
2396
|
+
a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
|
|
2362
2397
|
};
|
|
2363
|
-
return Se(f),
|
|
2398
|
+
return Se(f), Ze(f), (C, h) => (p(), b("div", {
|
|
2364
2399
|
id: n.intf.id,
|
|
2365
2400
|
ref_key: "el",
|
|
2366
|
-
ref:
|
|
2367
|
-
class:
|
|
2401
|
+
ref: a,
|
|
2402
|
+
class: oe(["baklava-node-interface", r.value])
|
|
2368
2403
|
}, [
|
|
2369
2404
|
n.intf.port ? (p(), b("div", {
|
|
2370
2405
|
key: 0,
|
|
2371
|
-
class:
|
|
2406
|
+
class: oe([{ "--selected": O(o)?.from === n.intf }, "__port"]),
|
|
2372
2407
|
onPointerover: l,
|
|
2373
|
-
onPointerout:
|
|
2374
|
-
}, null, 34)) :
|
|
2375
|
-
m("span",
|
|
2408
|
+
onPointerout: u
|
|
2409
|
+
}, null, 34)) : L("", !0),
|
|
2410
|
+
m("span", xs, [
|
|
2376
2411
|
q(C.$slots, "default")
|
|
2377
2412
|
])
|
|
2378
|
-
], 10,
|
|
2413
|
+
], 10, ks));
|
|
2379
2414
|
}
|
|
2380
|
-
}),
|
|
2415
|
+
}), Is = ["title"], Ns = {
|
|
2381
2416
|
key: 0,
|
|
2382
2417
|
class: "__label"
|
|
2383
|
-
},
|
|
2418
|
+
}, We = /* @__PURE__ */ F({
|
|
2384
2419
|
__name: "SidebarCheckbox",
|
|
2385
2420
|
props: {
|
|
2386
2421
|
disabled: { type: Boolean },
|
|
@@ -2392,9 +2427,9 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2392
2427
|
setup(n, { emit: e }) {
|
|
2393
2428
|
const t = e;
|
|
2394
2429
|
return (s, o) => (p(), b("div", {
|
|
2395
|
-
class:
|
|
2430
|
+
class: oe(["baklava-checkbox", { "--checked": n.inversed ? !n.modelValue : n.modelValue, "--disabled": n.disabled }]),
|
|
2396
2431
|
title: n.name,
|
|
2397
|
-
onClick: o[0] || (o[0] = (
|
|
2432
|
+
onClick: o[0] || (o[0] = (a) => t("update:modelValue", !n.modelValue))
|
|
2398
2433
|
}, [
|
|
2399
2434
|
o[1] || (o[1] = m("div", { class: "__checkmark-container" }, [
|
|
2400
2435
|
m("svg", {
|
|
@@ -2410,79 +2445,79 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2410
2445
|
})
|
|
2411
2446
|
])
|
|
2412
2447
|
], -1)),
|
|
2413
|
-
n.name ? (p(), b("div",
|
|
2414
|
-
], 10,
|
|
2448
|
+
n.name ? (p(), b("div", Ns, P(n.name), 1)) : L("", !0)
|
|
2449
|
+
], 10, Is));
|
|
2415
2450
|
}
|
|
2416
|
-
}),
|
|
2451
|
+
}), Es = { class: "__header" }, Ts = { class: "__node-name" }, Os = { class: "__interfaces" }, Ms = { class: "__inputs" }, $s = { style: { display: "flex" } }, Ss = { class: "__outputs" }, As = {
|
|
2417
2452
|
key: 0,
|
|
2418
2453
|
class: "__interface"
|
|
2419
|
-
},
|
|
2454
|
+
}, Gs = { style: { display: "flex" } }, Rs = /* @__PURE__ */ F({
|
|
2420
2455
|
__name: "CodeGraphSidebar",
|
|
2421
2456
|
setup(n) {
|
|
2422
|
-
const { viewModel: e } = me(), { graph: t } = Ge(), s = H(null), o =
|
|
2423
|
-
let i = 0,
|
|
2424
|
-
const l =
|
|
2457
|
+
const { viewModel: e } = me(), { graph: t } = Ge(), s = H(null), o = $e(e.value.settings.sidebar, "width"), a = A(() => e.value.settings.sidebar.resizable);
|
|
2458
|
+
let i = 0, r = 0;
|
|
2459
|
+
const l = A(() => {
|
|
2425
2460
|
const y = t.value.sidebar.nodeId;
|
|
2426
|
-
return t.value.nodes.find((
|
|
2427
|
-
}),
|
|
2461
|
+
return t.value.nodes.find(($) => $.id === y);
|
|
2462
|
+
}), u = A(() => l.value), f = A(() => ({
|
|
2428
2463
|
width: `${o.value}px`
|
|
2429
|
-
})), C =
|
|
2464
|
+
})), C = A(() => u.value ? Object.values(u.value.inputs).filter((y) => y.displayInSidebar && y.component) : []), h = A(() => u.value ? Object.values(u.value.outputs).filter((y) => y.displayInSidebar && y.component) : []), N = () => {
|
|
2430
2465
|
t.value.sidebar.visible = !1;
|
|
2431
2466
|
}, v = () => {
|
|
2432
2467
|
l.value?.events.update.emit(null);
|
|
2433
2468
|
}, w = (y) => {
|
|
2434
|
-
i = o.value,
|
|
2469
|
+
i = o.value, r = y.clientX, window.addEventListener("mousemove", d), window.addEventListener(
|
|
2435
2470
|
"mouseup",
|
|
2436
2471
|
() => {
|
|
2437
|
-
window.removeEventListener("mousemove",
|
|
2472
|
+
window.removeEventListener("mousemove", d);
|
|
2438
2473
|
},
|
|
2439
2474
|
{ once: !0 }
|
|
2440
2475
|
);
|
|
2441
|
-
},
|
|
2442
|
-
const
|
|
2476
|
+
}, d = (y) => {
|
|
2477
|
+
const $ = s.value?.parentElement?.getBoundingClientRect().width ?? 500, T = y.clientX - r;
|
|
2443
2478
|
let S = i - T;
|
|
2444
|
-
S < 300 ? S = 300 : S > 0.9 *
|
|
2479
|
+
S < 300 ? S = 300 : S > 0.9 * $ && (S = 0.9 * $), o.value = S;
|
|
2445
2480
|
};
|
|
2446
|
-
return (y,
|
|
2447
|
-
class:
|
|
2448
|
-
style:
|
|
2481
|
+
return (y, $) => (p(), b("div", {
|
|
2482
|
+
class: oe([{ "--open": O(t).sidebar.visible }, "baklava-sidebar"]),
|
|
2483
|
+
style: Ae(f.value),
|
|
2449
2484
|
ref_key: "el",
|
|
2450
2485
|
ref: s
|
|
2451
2486
|
}, [
|
|
2452
|
-
|
|
2487
|
+
a.value ? (p(), b("div", {
|
|
2453
2488
|
key: 0,
|
|
2454
2489
|
class: "__resizer",
|
|
2455
2490
|
onMousedown: w
|
|
2456
|
-
}, null, 32)) :
|
|
2491
|
+
}, null, 32)) : L("", !0),
|
|
2457
2492
|
l.value ? (p(), b(U, { key: 1 }, [
|
|
2458
|
-
m("div",
|
|
2493
|
+
m("div", Es, [
|
|
2459
2494
|
m("button", {
|
|
2460
2495
|
tabindex: "-1",
|
|
2461
2496
|
class: "__close",
|
|
2462
2497
|
onClick: N
|
|
2463
2498
|
}, "×"),
|
|
2464
|
-
m("div",
|
|
2465
|
-
m("b", null,
|
|
2499
|
+
m("div", Ts, [
|
|
2500
|
+
m("b", null, P(l.value.title), 1)
|
|
2466
2501
|
])
|
|
2467
2502
|
]),
|
|
2468
|
-
m("div",
|
|
2469
|
-
m("div",
|
|
2470
|
-
(p(!0), b(U, null,
|
|
2503
|
+
m("div", Os, [
|
|
2504
|
+
m("div", Ms, [
|
|
2505
|
+
(p(!0), b(U, null, ae(C.value, (T) => (p(), b("div", {
|
|
2471
2506
|
key: T.id,
|
|
2472
2507
|
class: "__interface"
|
|
2473
2508
|
}, [
|
|
2474
|
-
m("div",
|
|
2475
|
-
G(
|
|
2509
|
+
m("div", $s, [
|
|
2510
|
+
G(We, {
|
|
2476
2511
|
modelValue: T.hidden,
|
|
2477
2512
|
"onUpdate:modelValue": [
|
|
2478
2513
|
(S) => T.hidden = S,
|
|
2479
|
-
|
|
2514
|
+
$[0] || ($[0] = () => l.value?.events.update.emit(null))
|
|
2480
2515
|
],
|
|
2481
2516
|
disabled: !T.optional,
|
|
2482
2517
|
inversed: "",
|
|
2483
2518
|
style: { "padding-right": "8px" }
|
|
2484
2519
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
|
|
2485
|
-
(p(), B(
|
|
2520
|
+
(p(), B(He(T.component), {
|
|
2486
2521
|
modelValue: T.value,
|
|
2487
2522
|
"onUpdate:modelValue": (S) => T.value = S,
|
|
2488
2523
|
node: l.value,
|
|
@@ -2492,36 +2527,36 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2492
2527
|
])
|
|
2493
2528
|
]))), 128))
|
|
2494
2529
|
]),
|
|
2495
|
-
m("div",
|
|
2496
|
-
|
|
2497
|
-
|
|
2530
|
+
m("div", Ss, [
|
|
2531
|
+
u.value && u.value.state ? (p(), b("div", As, [
|
|
2532
|
+
$[3] || ($[3] = m("label", null, "Variable name", -1)),
|
|
2498
2533
|
ke(m("input", {
|
|
2499
|
-
"onUpdate:modelValue":
|
|
2534
|
+
"onUpdate:modelValue": $[1] || ($[1] = (T) => u.value.state.variableName = T),
|
|
2500
2535
|
type: "text",
|
|
2501
2536
|
class: "baklava-input",
|
|
2502
2537
|
title: "Variable name",
|
|
2503
2538
|
onBlur: v,
|
|
2504
2539
|
onKeydown: Oe(v, ["enter"])
|
|
2505
2540
|
}, null, 544), [
|
|
2506
|
-
[xe,
|
|
2541
|
+
[xe, u.value.state.variableName]
|
|
2507
2542
|
])
|
|
2508
|
-
])) :
|
|
2509
|
-
(p(!0), b(U, null,
|
|
2543
|
+
])) : L("", !0),
|
|
2544
|
+
(p(!0), b(U, null, ae(h.value, (T) => (p(), b("div", {
|
|
2510
2545
|
key: T.id,
|
|
2511
2546
|
class: "__interface"
|
|
2512
2547
|
}, [
|
|
2513
|
-
m("div",
|
|
2514
|
-
G(
|
|
2548
|
+
m("div", Gs, [
|
|
2549
|
+
G(We, {
|
|
2515
2550
|
modelValue: T.hidden,
|
|
2516
2551
|
"onUpdate:modelValue": [
|
|
2517
2552
|
(S) => T.hidden = S,
|
|
2518
|
-
|
|
2553
|
+
$[2] || ($[2] = () => l.value?.events.update.emit(null))
|
|
2519
2554
|
],
|
|
2520
2555
|
disabled: !T.optional,
|
|
2521
2556
|
inversed: "",
|
|
2522
2557
|
style: { "padding-right": "8px" }
|
|
2523
2558
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
|
|
2524
|
-
(p(), B(
|
|
2559
|
+
(p(), B(He(T.component), {
|
|
2525
2560
|
modelValue: T.value,
|
|
2526
2561
|
"onUpdate:modelValue": (S) => T.value = S,
|
|
2527
2562
|
node: l.value,
|
|
@@ -2533,57 +2568,57 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2533
2568
|
])
|
|
2534
2569
|
]),
|
|
2535
2570
|
q(y.$slots, "codeEditor", { node: l.value })
|
|
2536
|
-
], 64)) :
|
|
2571
|
+
], 64)) : L("", !0)
|
|
2537
2572
|
], 6));
|
|
2538
2573
|
}
|
|
2539
|
-
}),
|
|
2574
|
+
}), js = {
|
|
2540
2575
|
class: "baklava-node --palette",
|
|
2541
2576
|
style: { "margin-top": "-20px", "margin-bottom": "20px" }
|
|
2542
|
-
},
|
|
2577
|
+
}, Ls = {
|
|
2543
2578
|
key: 0,
|
|
2544
2579
|
style: { display: "flex", "justify-content": "space-between" }
|
|
2545
|
-
}, Ps = ["onClick"],
|
|
2580
|
+
}, Ps = ["onClick"], Vs = {
|
|
2546
2581
|
key: 0,
|
|
2547
2582
|
style: { margin: "auto 0", "font-size": "12px" }
|
|
2548
|
-
},
|
|
2583
|
+
}, Bs = /* @__PURE__ */ F({
|
|
2549
2584
|
__name: "CodeNodePalette",
|
|
2550
2585
|
setup(n) {
|
|
2551
|
-
const e =
|
|
2586
|
+
const e = Me.PaletteEntry, { viewModel: t } = me(), { x: s, y: o } = hn(), { transform: a } = Zt(), i = en(t), r = $t("editorEl"), l = H(""), u = H(null), f = () => l.value ? i.value.filter(
|
|
2552
2587
|
(v) => v.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(v.nodeTypes).some(
|
|
2553
2588
|
(w) => w.title.toLowerCase().includes(l.value.toLowerCase())
|
|
2554
2589
|
)
|
|
2555
|
-
) : i.value, C = (v) => l.value ?
|
|
2556
|
-
const
|
|
2557
|
-
return
|
|
2558
|
-
}) : v, h =
|
|
2559
|
-
if (!
|
|
2560
|
-
const { left: v, top: w } =
|
|
2590
|
+
) : i.value, C = (v) => l.value ? Jo(v, (w) => {
|
|
2591
|
+
const d = w[1];
|
|
2592
|
+
return d.category.includes(l.value.toLowerCase()) || d.title?.toLowerCase().includes(l.value.toLowerCase());
|
|
2593
|
+
}) : v, h = A(() => {
|
|
2594
|
+
if (!u.value || !r?.value) return {};
|
|
2595
|
+
const { left: v, top: w } = r.value.getBoundingClientRect();
|
|
2561
2596
|
return {
|
|
2562
2597
|
top: `${o.value - w}px`,
|
|
2563
2598
|
left: `${s.value - v}px`
|
|
2564
2599
|
};
|
|
2565
2600
|
}), N = (v, w) => {
|
|
2566
|
-
|
|
2601
|
+
u.value = {
|
|
2567
2602
|
type: v,
|
|
2568
2603
|
nodeInformation: w
|
|
2569
2604
|
};
|
|
2570
|
-
const
|
|
2605
|
+
const d = () => {
|
|
2571
2606
|
const y = te(new w.type());
|
|
2572
2607
|
t.value.displayedGraph.addNode(y);
|
|
2573
|
-
const
|
|
2574
|
-
y.position.x = T, y.position.y = S,
|
|
2608
|
+
const $ = r.value.getBoundingClientRect(), [T, S] = a(s.value - $.left, o.value - $.top);
|
|
2609
|
+
y.position.x = T, y.position.y = S, u.value = null, document.removeEventListener("pointerup", d);
|
|
2575
2610
|
};
|
|
2576
|
-
document.addEventListener("pointerup",
|
|
2611
|
+
document.addEventListener("pointerup", d);
|
|
2577
2612
|
};
|
|
2578
2613
|
return (v, w) => (p(), b(U, null, [
|
|
2579
2614
|
m("div", {
|
|
2580
|
-
class:
|
|
2581
|
-
onContextmenu: w[1] || (w[1] =
|
|
2615
|
+
class: oe([{ "--open": O(t).settings.palette.enabled }, "baklava-node-palette"]),
|
|
2616
|
+
onContextmenu: w[1] || (w[1] = de(() => {
|
|
2582
2617
|
}, ["stop", "prevent"]))
|
|
2583
2618
|
}, [
|
|
2584
|
-
m("div",
|
|
2619
|
+
m("div", js, [
|
|
2585
2620
|
ke(m("input", {
|
|
2586
|
-
"onUpdate:modelValue": w[0] || (w[0] = (
|
|
2621
|
+
"onUpdate:modelValue": w[0] || (w[0] = (d) => l.value = d),
|
|
2587
2622
|
type: "text",
|
|
2588
2623
|
class: "baklava-input",
|
|
2589
2624
|
title: "Filter nodes",
|
|
@@ -2592,58 +2627,58 @@ const es = /* @__PURE__ */ qo(Zo), ts = (n) => ({
|
|
|
2592
2627
|
[xe, l.value]
|
|
2593
2628
|
])
|
|
2594
2629
|
]),
|
|
2595
|
-
(p(!0), b(U, null,
|
|
2596
|
-
key:
|
|
2630
|
+
(p(!0), b(U, null, ae(f(), (d) => (p(), b("section", {
|
|
2631
|
+
key: d.name
|
|
2597
2632
|
}, [
|
|
2598
|
-
|
|
2633
|
+
d.name !== "default" ? (p(), b("h3", Ls, [
|
|
2599
2634
|
m("div", {
|
|
2600
|
-
onClick: (y) => l.value =
|
|
2635
|
+
onClick: (y) => l.value = d.name,
|
|
2601
2636
|
style: { cursor: "pointer" }
|
|
2602
|
-
},
|
|
2603
|
-
Object.keys(C(
|
|
2604
|
-
])) :
|
|
2605
|
-
(p(!0), b(U, null,
|
|
2606
|
-
key:
|
|
2607
|
-
type: M,
|
|
2637
|
+
}, 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)) : L("", !0)
|
|
2639
|
+
])) : L("", !0),
|
|
2640
|
+
(p(!0), b(U, null, ae(C(d.nodeTypes), (y, $) => (p(), B(O(e), {
|
|
2641
|
+
key: $,
|
|
2608
2642
|
title: y.title,
|
|
2609
|
-
|
|
2610
|
-
|
|
2643
|
+
type: $,
|
|
2644
|
+
onPointerdown: (T) => N($, y)
|
|
2645
|
+
}, null, 8, ["title", "type", "onPointerdown"]))), 128))
|
|
2611
2646
|
]))), 128))
|
|
2612
2647
|
], 34),
|
|
2613
|
-
G(
|
|
2648
|
+
G(St, { name: "fade" }, {
|
|
2614
2649
|
default: ee(() => [
|
|
2615
|
-
|
|
2650
|
+
u.value ? (p(), b("div", {
|
|
2616
2651
|
key: 0,
|
|
2617
2652
|
class: "baklava-dragged-node",
|
|
2618
|
-
style:
|
|
2653
|
+
style: Ae(h.value)
|
|
2619
2654
|
}, [
|
|
2620
2655
|
G(O(e), {
|
|
2621
|
-
type:
|
|
2622
|
-
title:
|
|
2656
|
+
type: u.value.type,
|
|
2657
|
+
title: u.value.nodeInformation.title
|
|
2623
2658
|
}, null, 8, ["type", "title"])
|
|
2624
|
-
], 4)) :
|
|
2659
|
+
], 4)) : L("", !0)
|
|
2625
2660
|
]),
|
|
2626
2661
|
_: 1
|
|
2627
2662
|
})
|
|
2628
2663
|
], 64));
|
|
2629
2664
|
}
|
|
2630
|
-
}),
|
|
2631
|
-
function
|
|
2632
|
-
const t =
|
|
2665
|
+
}), Hs = {}, zs = { class: "prependIcon" }, Us = { class: "appendIcon" };
|
|
2666
|
+
function Ds(n, e) {
|
|
2667
|
+
const t = qe("router-link");
|
|
2633
2668
|
return p(), B(t, { class: "navItem" }, {
|
|
2634
2669
|
default: ee(() => [
|
|
2635
|
-
m("span",
|
|
2670
|
+
m("span", zs, [
|
|
2636
2671
|
q(n.$slots, "prependIcon")
|
|
2637
2672
|
]),
|
|
2638
2673
|
q(n.$slots, "default"),
|
|
2639
|
-
m("span",
|
|
2674
|
+
m("span", Us, [
|
|
2640
2675
|
q(n.$slots, "appendIcon")
|
|
2641
2676
|
])
|
|
2642
2677
|
]),
|
|
2643
2678
|
_: 3
|
|
2644
2679
|
});
|
|
2645
2680
|
}
|
|
2646
|
-
const
|
|
2681
|
+
const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys = ["onClick"], xa = /* @__PURE__ */ F({
|
|
2647
2682
|
__name: "NavBar",
|
|
2648
2683
|
props: {
|
|
2649
2684
|
viewModel: {},
|
|
@@ -2655,33 +2690,33 @@ const Je = /* @__PURE__ */ A(Rs, [["render", Vs]]), Bs = { class: "navbar" }, Hs
|
|
|
2655
2690
|
const t = e, s = (o) => {
|
|
2656
2691
|
t("click:remove", o);
|
|
2657
2692
|
};
|
|
2658
|
-
return (o,
|
|
2693
|
+
return (o, a) => (p(), b("nav", Fs, [
|
|
2659
2694
|
q(o.$slots, "prepend"),
|
|
2660
|
-
(p(!0), b(U, null,
|
|
2695
|
+
(p(!0), b(U, null, ae(n.editorStates, (i) => (p(), B(Ke, {
|
|
2661
2696
|
key: i.graph.id,
|
|
2662
|
-
class:
|
|
2697
|
+
class: oe({ active: i.graph.id === n.viewModel.displayedGraph.id }),
|
|
2663
2698
|
to: { name: n.routes?.edit ?? "edit", params: { editorId: i.graph.id } }
|
|
2664
2699
|
}, {
|
|
2665
2700
|
appendIcon: ee(() => [
|
|
2666
2701
|
m("button", {
|
|
2667
2702
|
class: "remove",
|
|
2668
|
-
onClick:
|
|
2703
|
+
onClick: de((r) => s(i.graph.id), ["prevent"])
|
|
2669
2704
|
}, [
|
|
2670
|
-
G(O(
|
|
2671
|
-
], 8,
|
|
2705
|
+
G(O(Do))
|
|
2706
|
+
], 8, Ys)
|
|
2672
2707
|
]),
|
|
2673
2708
|
default: ee(() => [
|
|
2674
|
-
|
|
2709
|
+
et(P(i.graph.id.slice(0, 6)) + " ", 1)
|
|
2675
2710
|
]),
|
|
2676
2711
|
_: 2
|
|
2677
2712
|
}, 1032, ["class", "to"]))), 128)),
|
|
2678
2713
|
q(o.$slots, "append", {}, () => [
|
|
2679
|
-
G(
|
|
2714
|
+
G(Ke, {
|
|
2680
2715
|
to: { name: n.routes?.new ?? "new" },
|
|
2681
2716
|
class: "navItem"
|
|
2682
2717
|
}, {
|
|
2683
2718
|
default: ee(() => [
|
|
2684
|
-
G(O(
|
|
2719
|
+
G(O(xo), { class: "plus" })
|
|
2685
2720
|
]),
|
|
2686
2721
|
_: 1
|
|
2687
2722
|
}, 8, ["to"])
|
|
@@ -2689,58 +2724,58 @@ const Je = /* @__PURE__ */ A(Rs, [["render", Vs]]), Bs = { class: "navbar" }, Hs
|
|
|
2689
2724
|
]));
|
|
2690
2725
|
}
|
|
2691
2726
|
});
|
|
2692
|
-
class
|
|
2727
|
+
class xt extends wt {
|
|
2693
2728
|
_title = "Subgraph Input";
|
|
2694
2729
|
inputs = {
|
|
2695
|
-
_code: new D("", "").use(V,
|
|
2696
|
-
name: new
|
|
2730
|
+
_code: new D("_code", "").use(V, K).setHidden(!0),
|
|
2731
|
+
name: new at("Name", "Input").setPort(!1)
|
|
2697
2732
|
};
|
|
2698
2733
|
outputs = {
|
|
2699
|
-
_code: new D("", "").use(V,
|
|
2734
|
+
_code: new D("_code", "").use(V, K).setHidden(!0),
|
|
2700
2735
|
placeholder: new J("Connection", void 0)
|
|
2701
2736
|
};
|
|
2702
2737
|
}
|
|
2703
|
-
class
|
|
2738
|
+
class It extends kt {
|
|
2704
2739
|
_title = "Subgraph Output";
|
|
2705
2740
|
inputs = {
|
|
2706
|
-
_code: new D("", "").use(V,
|
|
2707
|
-
name: new
|
|
2741
|
+
_code: new D("_code", "").use(V, K).setHidden(!0),
|
|
2742
|
+
name: new at("Name", "Output").setPort(!1),
|
|
2708
2743
|
placeholder: new J("Connection", void 0)
|
|
2709
2744
|
};
|
|
2710
2745
|
outputs = {
|
|
2711
|
-
_code: new D("", "").use(V,
|
|
2746
|
+
_code: new D("_code", "").use(V, K).setHidden(!0),
|
|
2712
2747
|
output: new J("Output", void 0).setHidden(!0)
|
|
2713
2748
|
};
|
|
2714
2749
|
}
|
|
2715
|
-
const
|
|
2716
|
-
function
|
|
2717
|
-
const s = () => n.value.selectedNodes.filter((
|
|
2718
|
-
const { viewModel:
|
|
2750
|
+
const Ws = "CREATE_SUBGRAPH", Xe = [Pt, Vt];
|
|
2751
|
+
function Ks(n, e, t) {
|
|
2752
|
+
const s = () => n.value.selectedNodes.filter((a) => !Xe.includes(a.type)).length > 0, o = () => {
|
|
2753
|
+
const { viewModel: a } = me(), i = n.value, r = n.value.editor;
|
|
2719
2754
|
if (i.selectedNodes.length === 0) return;
|
|
2720
|
-
const l = i.selectedNodes.filter((k) => !
|
|
2721
|
-
(k) => !f.includes(k.from) &&
|
|
2755
|
+
const l = i.selectedNodes.filter((k) => !Xe.includes(k.type)), u = l.flatMap((k) => Object.values(k.inputs)), f = l.flatMap((k) => Object.values(k.outputs)), C = i.connections.filter(
|
|
2756
|
+
(k) => !f.includes(k.from) && u.includes(k.to)
|
|
2722
2757
|
), h = i.connections.filter(
|
|
2723
|
-
(k) => f.includes(k.from) && !
|
|
2758
|
+
(k) => f.includes(k.from) && !u.includes(k.to)
|
|
2724
2759
|
), N = i.connections.filter(
|
|
2725
|
-
(k) => f.includes(k.from) &&
|
|
2760
|
+
(k) => f.includes(k.from) && u.includes(k.to)
|
|
2726
2761
|
), v = l.map((k) => k.save()), w = N.map((k) => ({
|
|
2727
2762
|
id: k.id,
|
|
2728
2763
|
from: k.from.id,
|
|
2729
2764
|
to: k.to.id
|
|
2730
|
-
})),
|
|
2731
|
-
for (const [k,
|
|
2732
|
-
const z = new
|
|
2733
|
-
z.inputs.name.value =
|
|
2765
|
+
})), d = /* @__PURE__ */ new Map(), { xLeft: y, xRight: $, yTop: T } = Xs(l);
|
|
2766
|
+
for (const [k, j] of C.entries()) {
|
|
2767
|
+
const z = new xt();
|
|
2768
|
+
z.inputs.name.value = j.to.name, v.push({
|
|
2734
2769
|
...z.save(),
|
|
2735
|
-
position: { x:
|
|
2736
|
-
}), w.push({ id: re(), from: z.outputs.placeholder.id, to:
|
|
2770
|
+
position: { x: $ - a.value.settings.nodes.defaultWidth - 100, y: T + k * 200 }
|
|
2771
|
+
}), w.push({ id: re(), from: z.outputs.placeholder.id, to: j.to.id }), d.set(j.to.id, z.graphInterfaceId);
|
|
2737
2772
|
}
|
|
2738
|
-
for (const [k,
|
|
2739
|
-
const z = new
|
|
2740
|
-
z.inputs.name.value =
|
|
2773
|
+
for (const [k, j] of h.entries()) {
|
|
2774
|
+
const z = new It();
|
|
2775
|
+
z.inputs.name.value = j.from.name, v.push({
|
|
2741
2776
|
...z.save(),
|
|
2742
2777
|
position: { x: y + 100, y: T + k * 200 }
|
|
2743
|
-
}), w.push({ id: re(), from:
|
|
2778
|
+
}), w.push({ id: re(), from: j.from.id, to: z.inputs.placeholder.id }), d.set(j.from.id, z.graphInterfaceId);
|
|
2744
2779
|
}
|
|
2745
2780
|
const S = te(
|
|
2746
2781
|
new Ne(
|
|
@@ -2751,45 +2786,45 @@ function Us(n, e, t) {
|
|
|
2751
2786
|
inputs: [],
|
|
2752
2787
|
outputs: []
|
|
2753
2788
|
},
|
|
2754
|
-
|
|
2789
|
+
r
|
|
2755
2790
|
)
|
|
2756
2791
|
);
|
|
2757
|
-
|
|
2758
|
-
const Q =
|
|
2792
|
+
r.addGraphTemplate(S);
|
|
2793
|
+
const Q = r.nodeTypes.get(tt(S));
|
|
2759
2794
|
if (!Q) throw new Error("Unable to create subgraph: Could not find corresponding graph node type");
|
|
2760
2795
|
i.activeTransactions++;
|
|
2761
2796
|
const Z = te(new Q.type());
|
|
2762
2797
|
i.addNode(Z);
|
|
2763
2798
|
const pe = Math.round(
|
|
2764
|
-
l.map((k) => k.position.x).reduce((k,
|
|
2765
|
-
),
|
|
2766
|
-
l.map((k) => k.position.y).reduce((k,
|
|
2799
|
+
l.map((k) => k.position.x).reduce((k, j) => k + j, 0) / l.length
|
|
2800
|
+
), X = Math.round(
|
|
2801
|
+
l.map((k) => k.position.y).reduce((k, j) => k + j, 0) / l.length
|
|
2767
2802
|
);
|
|
2768
|
-
Z.position.x = pe, Z.position.y =
|
|
2769
|
-
i.removeConnection(k), i.addConnection(k.from, Z.inputs[
|
|
2803
|
+
Z.position.x = pe, Z.position.y = X, C.forEach((k) => {
|
|
2804
|
+
i.removeConnection(k), i.addConnection(k.from, Z.inputs[d.get(k.to.id)]);
|
|
2770
2805
|
}), h.forEach((k) => {
|
|
2771
|
-
i.removeConnection(k), i.addConnection(Z.outputs[
|
|
2772
|
-
}), l.forEach((k) => i.removeNode(k)), i.activeTransactions--, e.canExecuteCommand(
|
|
2806
|
+
i.removeConnection(k), i.addConnection(Z.outputs[d.get(k.from.id)], k.to);
|
|
2807
|
+
}), 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;
|
|
2773
2808
|
};
|
|
2774
|
-
e.registerCommand(
|
|
2809
|
+
e.registerCommand(Ws, {
|
|
2775
2810
|
canExecute: s,
|
|
2776
2811
|
execute: o
|
|
2777
2812
|
});
|
|
2778
2813
|
}
|
|
2779
|
-
function
|
|
2780
|
-
const e = n.reduce((o,
|
|
2781
|
-
const i =
|
|
2814
|
+
function Xs(n) {
|
|
2815
|
+
const e = n.reduce((o, a) => {
|
|
2816
|
+
const i = a.position.x;
|
|
2782
2817
|
return i < o ? i : o;
|
|
2783
|
-
}, 1 / 0), t = n.reduce((o,
|
|
2784
|
-
const i =
|
|
2818
|
+
}, 1 / 0), t = n.reduce((o, a) => {
|
|
2819
|
+
const i = a.position.y;
|
|
2785
2820
|
return i < o ? i : o;
|
|
2786
2821
|
}, 1 / 0);
|
|
2787
|
-
return { xLeft: n.reduce((o,
|
|
2788
|
-
const i =
|
|
2822
|
+
return { xLeft: n.reduce((o, a) => {
|
|
2823
|
+
const i = a.position.x + a.width;
|
|
2789
2824
|
return i > o ? i : o;
|
|
2790
2825
|
}, -1 / 0), xRight: e, yTop: t };
|
|
2791
2826
|
}
|
|
2792
|
-
class
|
|
2827
|
+
class qs extends Bt {
|
|
2793
2828
|
code;
|
|
2794
2829
|
graph;
|
|
2795
2830
|
constructor(e) {
|
|
@@ -2810,7 +2845,7 @@ class Fs extends Lt {
|
|
|
2810
2845
|
addGraphTemplate(e) {
|
|
2811
2846
|
if (this.events.beforeAddGraphTemplate.emit(e).prevented) return;
|
|
2812
2847
|
this._graphTemplates.push(e), this.graphTemplateEvents.addTarget(e.events), this.graphTemplateHooks.addTarget(e.hooks);
|
|
2813
|
-
const t =
|
|
2848
|
+
const t = qo(e);
|
|
2814
2849
|
this.registerNodeType(t, { category: "Subgraphs", title: e.name }), this.events.addGraphTemplate.emit(e);
|
|
2815
2850
|
}
|
|
2816
2851
|
/**
|
|
@@ -2841,123 +2876,128 @@ class Fs extends Lt {
|
|
|
2841
2876
|
this.code.state.modules[e] = t;
|
|
2842
2877
|
}
|
|
2843
2878
|
}
|
|
2844
|
-
function
|
|
2845
|
-
const e = H(n?.code ?? new
|
|
2879
|
+
function Ia(n) {
|
|
2880
|
+
const e = H(n?.code ?? new Ve()), t = H(n?.existingEditor ?? new qs(e.value)), s = Symbol("ViewModelToken"), o = H(null), a = At(o), { switchGraph: i } = es(t, o), r = A(() => a.value && a.value !== t.value.graph), l = te(tn());
|
|
2846
2881
|
l.nodes.defaultWidth = 400;
|
|
2847
|
-
const
|
|
2882
|
+
const u = nn(), f = on(a, u), C = sn(a, t, u), h = {
|
|
2848
2883
|
/** Called whenever a node is rendered */
|
|
2849
|
-
renderNode: new
|
|
2884
|
+
renderNode: new ze(null),
|
|
2850
2885
|
/** Called whenever an interface is rendered */
|
|
2851
|
-
renderInterface: new
|
|
2886
|
+
renderInterface: new ze(null)
|
|
2852
2887
|
}, N = te({
|
|
2853
2888
|
clipboard: C,
|
|
2854
2889
|
code: e,
|
|
2855
|
-
commandHandler:
|
|
2856
|
-
displayedGraph:
|
|
2890
|
+
commandHandler: u,
|
|
2891
|
+
displayedGraph: a,
|
|
2857
2892
|
editor: t,
|
|
2858
2893
|
history: f,
|
|
2859
2894
|
hooks: h,
|
|
2860
|
-
isSubgraph:
|
|
2895
|
+
isSubgraph: r,
|
|
2896
|
+
onBeforeUnmount: () => {
|
|
2897
|
+
},
|
|
2898
|
+
onMounted: () => {
|
|
2899
|
+
},
|
|
2861
2900
|
settings: l,
|
|
2862
2901
|
switchGraph: i
|
|
2863
2902
|
});
|
|
2864
|
-
return e.value.registerViewModel(N),
|
|
2903
|
+
return e.value.registerViewModel(N), Ko(N), an(a, u), Ks(a, u, i), rn(a, u), ln(a, u, i), dn(a, u), un(a, u, l), Fo(a, u, l), Yo(l), Qe(
|
|
2865
2904
|
t,
|
|
2866
2905
|
(v, w) => {
|
|
2867
|
-
w && (w.events.registerGraph.unsubscribe(s), w.graphEvents.beforeAddNode.unsubscribe(s), v.nodeHooks.beforeLoad.unsubscribe(s), v.nodeHooks.afterSave.unsubscribe(s), v.graphTemplateHooks.beforeLoad.unsubscribe(s), v.graphTemplateHooks.afterSave.unsubscribe(s), v.graph.hooks.load.unsubscribe(s), v.graph.hooks.save.unsubscribe(s)), v && (v.nodeHooks.beforeLoad.subscribe(s, (
|
|
2906
|
+
w && (w.events.registerGraph.unsubscribe(s), w.graphEvents.beforeAddNode.unsubscribe(s), v.nodeHooks.beforeLoad.unsubscribe(s), v.nodeHooks.afterSave.unsubscribe(s), v.graphTemplateHooks.beforeLoad.unsubscribe(s), v.graphTemplateHooks.afterSave.unsubscribe(s), v.graph.hooks.load.unsubscribe(s), v.graph.hooks.save.unsubscribe(s)), v && (v.nodeHooks.beforeLoad.subscribe(s, (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(s, (d, y) => (d.position = y.position, d.width = y.width, d.twoColumn = y.twoColumn, d)), v.graphTemplateHooks.beforeLoad.subscribe(s, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graphTemplateHooks.afterSave.subscribe(s, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graph.hooks.load.subscribe(s, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graph.hooks.save.subscribe(s, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graphEvents.beforeAddNode.subscribe(
|
|
2868
2907
|
s,
|
|
2869
|
-
(
|
|
2870
|
-
), t.value.registerNodeType(
|
|
2908
|
+
(d) => cn(d, { defaultWidth: l.nodes.defaultWidth })
|
|
2909
|
+
), t.value.registerNodeType(xt, { category: "Subgraphs" }), t.value.registerNodeType(It, { category: "Subgraphs" }), i(v.graph));
|
|
2871
2910
|
},
|
|
2872
2911
|
{ immediate: !0 }
|
|
2873
2912
|
), N;
|
|
2874
2913
|
}
|
|
2875
2914
|
export {
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2915
|
+
rt as AbstractCodeNode,
|
|
2916
|
+
vt as CLEAR_ALL_COMMAND,
|
|
2917
|
+
Ws as CREATE_SUBGRAPH_COMMAND,
|
|
2918
|
+
Gn as Check,
|
|
2919
|
+
yn as CheckboxInterface,
|
|
2920
|
+
Ve as Code,
|
|
2921
|
+
Ca as CodeEditor,
|
|
2922
|
+
Mn as CodeEngine,
|
|
2884
2923
|
Ie as CodeGraph,
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2924
|
+
wa as CodeGraphEditor,
|
|
2925
|
+
ka as CodeGraphInfo,
|
|
2926
|
+
wt as CodeGraphInputNode,
|
|
2927
|
+
ws as CodeGraphNode,
|
|
2928
|
+
Ye as CodeGraphNodeInterface,
|
|
2929
|
+
kt as CodeGraphOutputNode,
|
|
2930
|
+
Rs as CodeGraphSidebar,
|
|
2892
2931
|
Ne as CodeGraphTemplate,
|
|
2893
2932
|
Re as CodeNode,
|
|
2894
2933
|
ve as CodeNodeInputInterface,
|
|
2895
2934
|
D as CodeNodeInterface,
|
|
2896
2935
|
je as CodeNodeInterfaceComponent,
|
|
2897
|
-
|
|
2898
|
-
|
|
2936
|
+
_n as CodeNodeOutputInterface,
|
|
2937
|
+
Bs as CodeNodePalette,
|
|
2899
2938
|
Pn as CodeVariable,
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2939
|
+
zn as Copy,
|
|
2940
|
+
ls as CopyToClipboard,
|
|
2941
|
+
Yn as DotsVertical,
|
|
2942
|
+
On as DynamicCodeNode,
|
|
2943
|
+
Ue as GRAPH_INPUT_NODE_TYPE,
|
|
2944
|
+
De as GRAPH_OUTPUT_NODE_TYPE,
|
|
2945
|
+
ht as IntegerInterface,
|
|
2946
|
+
va as JavascriptCode,
|
|
2947
|
+
qn as LayoutSidebarLeftCollapse,
|
|
2948
|
+
eo as LayoutSidebarLeftExpand,
|
|
2949
|
+
so as LayoutSidebarRight,
|
|
2950
|
+
lo as LayoutSidebarRightCollapse,
|
|
2951
|
+
ho as LayoutSidebarRightExpand,
|
|
2952
|
+
da as ListInputInterface,
|
|
2953
|
+
mt as LockCode,
|
|
2954
|
+
xa as NavBar,
|
|
2955
|
+
Ke as NavItem,
|
|
2956
|
+
Cn as NumberInterface,
|
|
2957
|
+
_o as PlayerPlay,
|
|
2958
|
+
xo as Plus,
|
|
2959
|
+
ma as PythonCode,
|
|
2960
|
+
gt as RUN_ENGINE_COMMAND,
|
|
2961
|
+
To as Schema,
|
|
2962
|
+
So as SchemaOff,
|
|
2963
|
+
wn as SelectInterface,
|
|
2964
|
+
We as SidebarCheckbox,
|
|
2965
|
+
ua as SliderInterface,
|
|
2966
|
+
xt as SubgraphInputNode,
|
|
2967
|
+
It as SubgraphOutputNode,
|
|
2968
|
+
bt as TOGGLE_MINIMAP_COMMAND,
|
|
2969
|
+
yt as TOGGLE_PALETTE_COMMAND,
|
|
2970
|
+
ft as TextInputInterface,
|
|
2971
|
+
Tn as TextInputInterfaceComponent,
|
|
2972
|
+
ca as TextareaInputInterface,
|
|
2973
|
+
jo as TransitionBottom,
|
|
2974
|
+
Bo as TrashOff,
|
|
2975
|
+
pa as TupleInputInterface,
|
|
2976
|
+
Do as X,
|
|
2977
|
+
la as addDefaultInterfaceTypes,
|
|
2978
|
+
ga as allowMultipleConnections,
|
|
2979
|
+
lt as booleanType,
|
|
2980
|
+
qo as createCodeGraphNodeType,
|
|
2981
|
+
vn as createInterface,
|
|
2982
|
+
ha as defineCodeNode,
|
|
2983
|
+
fa as defineDynamicCodeNode,
|
|
2984
|
+
bn as dictType,
|
|
2985
|
+
fn as formatInputs,
|
|
2986
|
+
_t as getCodeNodes,
|
|
2987
|
+
ba as getPositionAtColumn,
|
|
2988
|
+
ya as getPositionBeforeNode,
|
|
2989
|
+
dt as listType,
|
|
2990
|
+
it as loadNodeState,
|
|
2991
|
+
K as nodeType,
|
|
2992
|
+
ut as numberType,
|
|
2993
|
+
Ko as registerCodeEngine,
|
|
2994
|
+
Ks as registerCreateSubgraphCommand,
|
|
2995
|
+
Fo as registerCustomCommands,
|
|
2996
|
+
Wo as registerRunEngineCommands,
|
|
2997
|
+
mn as saveNodeState,
|
|
2998
|
+
ct as stringType,
|
|
2959
2999
|
pt as tupleType,
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3000
|
+
Yo as updateToolbarItems,
|
|
3001
|
+
Ia as useCodeGraph,
|
|
3002
|
+
es as useSwitchCodeGraph
|
|
2963
3003
|
};
|