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