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