@babsey/code-graph 0.1.7 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code-graph.js +756 -630
- package/dist/code-graph.umd.cjs +1 -1
- package/dist/code.d.ts +26 -19
- package/dist/codeNode/codeGraphNode.d.ts +11 -0
- package/dist/codeNode/index.d.ts +1 -0
- package/dist/codeNodeInterfaces/codeNode/codeNodeInterface.d.ts +1 -1
- package/dist/components/node/CodeGraphNode.vue.d.ts +2 -2
- package/dist/settings.d.ts +9 -8
- package/dist/utils.d.ts +5 -0
- package/dist/viewModel.d.ts +5 -5
- package/package.json +2 -2
package/dist/code-graph.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Y from "mustache";
|
|
2
2
|
import Ye from "toposort";
|
|
3
|
-
import { AbstractNode as
|
|
4
|
-
import { reactive as
|
|
5
|
-
import { v4 as
|
|
6
|
-
import { usePointer as
|
|
7
|
-
|
|
8
|
-
class
|
|
3
|
+
import { AbstractNode as Ke, sortTopologically as qe, NodeInterface as Je, displayInSidebar as Ne, NodeInterfaceType as H, BaklavaInterfaceTypes as Qe, CheckboxInterfaceComponent as Ze, setType as T, IntegerInterfaceComponent as et, TextInputInterfaceComponent as Me, NumberInterfaceComponent as tt, SelectInterfaceComponent as st, SliderInterfaceComponent as nt, TextareaInputInterfaceComponent as ot, allowMultipleConnections as A, IntegerInterface as at, TextInputInterface as it, getGraphNodeTypeString as rt, GraphInputNode as dt, GraphOutputNode as lt, Commands as Z, useViewModel as K, useTemporaryConnection as ut, Components as Ce, useGraph as ae, GRAPH_NODE_TYPE_PREFIX as se, useTransform as ct, useNodeCategories as pt, BaklavaEditor as ht, useBaklava as mt, DependencyEngine as vt } from "baklavajs";
|
|
4
|
+
import { reactive as q, defineComponent as R, createElementBlock as d, openBlock as i, toDisplayString as j, markRaw as B, computed as b, createElementVNode as l, withDirectives as ee, vModelText as te, ref as V, onMounted as ie, onUpdated as $e, normalizeClass as P, createCommentVNode as x, unref as k, renderSlot as X, createStaticVNode as J, onBeforeUnmount as ft, normalizeStyle as re, withModifiers as F, createBlock as E, Fragment as S, createTextVNode as gt, createVNode as z, withKeys as ne, renderList as D, nextTick as bt, toRef as Oe, resolveDynamicComponent as ke, inject as _t, Transition as yt, withCtx as W, onUnmounted as Ct, normalizeProps as kt, guardReactiveProps as wt, mergeProps as It } from "vue";
|
|
5
|
+
import { v4 as Te } from "uuid";
|
|
6
|
+
import { usePointer as xt } from "@vueuse/core";
|
|
7
|
+
Y.escape = (s) => s;
|
|
8
|
+
class Ee extends Ke {
|
|
9
9
|
state;
|
|
10
10
|
code;
|
|
11
11
|
isCodeNode = !0;
|
|
@@ -14,7 +14,7 @@ class xt extends qe {
|
|
|
14
14
|
inputs = {};
|
|
15
15
|
outputs = {};
|
|
16
16
|
constructor() {
|
|
17
|
-
super(), this.initializeIo(), this.
|
|
17
|
+
super(), this.initializeIo(), this.twoColumn = !0, this.state = q({
|
|
18
18
|
codeTemplate: "",
|
|
19
19
|
hidden: !1,
|
|
20
20
|
integrated: !1,
|
|
@@ -22,9 +22,9 @@ class xt extends qe {
|
|
|
22
22
|
modules: [],
|
|
23
23
|
props: null,
|
|
24
24
|
script: "",
|
|
25
|
-
variableName: ""
|
|
25
|
+
variableName: "x"
|
|
26
26
|
}), this.codeTemplate = function() {
|
|
27
|
-
return `${this.name}(${
|
|
27
|
+
return `${this.name}(${Nt(this.codeNodeInputs).join(", ")})`;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
get codeNodeInputs() {
|
|
@@ -90,11 +90,11 @@ class xt extends qe {
|
|
|
90
90
|
getConnectedNodes(e) {
|
|
91
91
|
let t = [];
|
|
92
92
|
if (e !== "inputs") {
|
|
93
|
-
const n = this.graph?.connections.filter((o) => o.from.name !== "
|
|
93
|
+
const n = this.graph?.connections.filter((o) => o.from.name !== "_code").filter((o) => o.from.nodeId === this.id).map((o) => o.to.nodeId);
|
|
94
94
|
n && (t = t.concat(n));
|
|
95
95
|
}
|
|
96
96
|
if (e !== "outputs") {
|
|
97
|
-
const n = this.graph?.connections.filter((o) => o.from.name !== "
|
|
97
|
+
const n = this.graph?.connections.filter((o) => o.from.name !== "_code").filter((o) => o.to.nodeId === this.id).map((o) => o.from.nodeId);
|
|
98
98
|
n && (t = t.concat(n));
|
|
99
99
|
}
|
|
100
100
|
return !t || t.length == 0 ? [] : t.map((n) => this.graph?.findNodeById(n));
|
|
@@ -134,16 +134,16 @@ class xt extends qe {
|
|
|
134
134
|
if (!this.lockCode) {
|
|
135
135
|
const e = {};
|
|
136
136
|
Object.keys(this.inputs).forEach((n) => {
|
|
137
|
-
if (n === "
|
|
137
|
+
if (n === "_code") return;
|
|
138
138
|
const o = this.inputs[n];
|
|
139
139
|
o && o.state && (e[n] = o.state.script.length > 0 ? o.state.script : o.getValue());
|
|
140
140
|
});
|
|
141
141
|
const t = {};
|
|
142
142
|
Object.keys(this.outputs).forEach((n) => {
|
|
143
|
-
if (n === "
|
|
143
|
+
if (n === "_code") return;
|
|
144
144
|
const o = this.outputs[n];
|
|
145
145
|
o && o.state && (t[n] = o.getValue());
|
|
146
|
-
}), this.state.script =
|
|
146
|
+
}), this.state.script = Y.render(this.state.codeTemplate, { inputs: e, outputs: t });
|
|
147
147
|
}
|
|
148
148
|
this.outputs.out && (this.outputs.out.state.script = this.script);
|
|
149
149
|
}
|
|
@@ -158,7 +158,7 @@ class xt extends qe {
|
|
|
158
158
|
}
|
|
159
159
|
updateConnectedInputInterfaces() {
|
|
160
160
|
if (!this.graph) return;
|
|
161
|
-
const { connectionsFromNode: e } =
|
|
161
|
+
const { connectionsFromNode: e } = qe(this.graph);
|
|
162
162
|
if (!e.has(this)) return;
|
|
163
163
|
const t = e.get(this);
|
|
164
164
|
t && t.forEach((n) => {
|
|
@@ -176,7 +176,7 @@ class xt extends qe {
|
|
|
176
176
|
this.state.props = e;
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
class
|
|
179
|
+
class Se extends Ee {
|
|
180
180
|
/**
|
|
181
181
|
* The default implementation does nothing.
|
|
182
182
|
* Overwrite this method to do calculation.
|
|
@@ -186,11 +186,11 @@ class Be extends xt {
|
|
|
186
186
|
*/
|
|
187
187
|
calculate;
|
|
188
188
|
load(e) {
|
|
189
|
-
super.load(e),
|
|
189
|
+
super.load(e), Be(this.graph, e);
|
|
190
190
|
}
|
|
191
191
|
save() {
|
|
192
192
|
const e = super.save();
|
|
193
|
-
return
|
|
193
|
+
return Mt(this.graph, e), e;
|
|
194
194
|
}
|
|
195
195
|
updateModules(e) {
|
|
196
196
|
if (e)
|
|
@@ -201,51 +201,51 @@ class Be extends xt {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
const
|
|
204
|
+
const Nt = (s, e = !0) => {
|
|
205
205
|
const t = [], n = Object.keys(s);
|
|
206
206
|
return n.forEach((o) => {
|
|
207
207
|
if (s[o]?.hidden) return;
|
|
208
|
-
const
|
|
209
|
-
t.push(`${
|
|
208
|
+
const r = e && t.length < n.indexOf(o) ? `${o}=` : "";
|
|
209
|
+
t.push(`${r}{{ inputs.${o} }}`);
|
|
210
210
|
}), t;
|
|
211
|
-
},
|
|
211
|
+
}, Be = (s, e) => {
|
|
212
212
|
if (!s) return;
|
|
213
213
|
const t = s.findNodeById(e.id);
|
|
214
214
|
if (!t || t.subgraph) return;
|
|
215
215
|
const n = t;
|
|
216
216
|
n.state && (n.state.integrated = e.integrated, n.state.modules = e.modules, n.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
217
|
-
o !== "
|
|
217
|
+
o !== "_code" && n.inputs[o] && (n.inputs[o].hidden = a.hidden);
|
|
218
218
|
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
219
|
-
o !== "
|
|
219
|
+
o !== "_code" && n.outputs[o] && (n.outputs[o].hidden = a.hidden);
|
|
220
220
|
});
|
|
221
|
-
},
|
|
221
|
+
}, Mt = (s, e) => {
|
|
222
222
|
if (!s) return;
|
|
223
223
|
const t = s.findNodeById(e.id);
|
|
224
224
|
if (!t || t.subgraph) return;
|
|
225
225
|
const n = t;
|
|
226
226
|
n.state && (e.integrated = n.state.integrated, e.modules = n.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
227
|
-
o !== "
|
|
227
|
+
o !== "_code" && n.inputs[o] && (a.hidden = n.inputs[o].hidden);
|
|
228
228
|
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
229
|
-
o !== "
|
|
229
|
+
o !== "_code" && n.outputs[o] && (a.hidden = n.outputs[o].hidden);
|
|
230
230
|
});
|
|
231
|
-
},
|
|
231
|
+
}, $t = ["title"], de = /* @__PURE__ */ R({
|
|
232
232
|
__name: "CodeNodeInterface",
|
|
233
233
|
props: {
|
|
234
234
|
intf: {}
|
|
235
235
|
},
|
|
236
236
|
setup(s) {
|
|
237
|
-
return (e, t) => (i(),
|
|
237
|
+
return (e, t) => (i(), d("div", {
|
|
238
238
|
title: s.intf.state?.script
|
|
239
|
-
}, j(s.intf.name), 9,
|
|
239
|
+
}, j(s.intf.name), 9, $t));
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
|
-
class
|
|
242
|
+
class L extends Je {
|
|
243
243
|
isCodeNode = !0;
|
|
244
244
|
code;
|
|
245
245
|
state;
|
|
246
246
|
type = null;
|
|
247
247
|
constructor(e, t) {
|
|
248
|
-
super(e, t), this.setComponent(
|
|
248
|
+
super(e, t), this.setComponent(B(de)), this.state = q({
|
|
249
249
|
optional: !1,
|
|
250
250
|
script: ""
|
|
251
251
|
});
|
|
@@ -264,13 +264,13 @@ class H extends Je {
|
|
|
264
264
|
}
|
|
265
265
|
getValue = () => `${this.value ?? "None"}`;
|
|
266
266
|
resetScript = () => this.state.script = "";
|
|
267
|
+
setOptional(e) {
|
|
268
|
+
return this.state.optional = e, this.setHidden(e), this;
|
|
269
|
+
}
|
|
267
270
|
}
|
|
268
|
-
|
|
269
|
-
s.state.optional = e, s.setHidden(e);
|
|
270
|
-
};
|
|
271
|
-
class J extends H {
|
|
271
|
+
class Q extends L {
|
|
272
272
|
constructor(e = "", t) {
|
|
273
|
-
super(e, t), this.setComponent(
|
|
273
|
+
super(e, t), this.setComponent(B(de)), this.use(Ne, !0);
|
|
274
274
|
}
|
|
275
275
|
set script(e) {
|
|
276
276
|
if (this.state.script && this.allowMultipleConnections) {
|
|
@@ -283,67 +283,67 @@ class J extends H {
|
|
|
283
283
|
return super.value;
|
|
284
284
|
}
|
|
285
285
|
set value(e) {
|
|
286
|
-
super.value = e, this.name !== "
|
|
286
|
+
super.value = e, this.name !== "_code" && this.setHidden(!1);
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
const
|
|
290
|
-
new Qe(s.editor, { viewPlugin: s }).addTypes(
|
|
289
|
+
const Ve = new H("boolean"), Ot = new H("dict"), ze = new H("list"), U = new H("node"), le = new H("number"), ue = new H("string"), je = new H("tuple"), In = (s) => {
|
|
290
|
+
new Qe(s.editor, { viewPlugin: s }).addTypes(Ve, Ot, ze, U, le, ue, je);
|
|
291
291
|
};
|
|
292
|
-
class
|
|
292
|
+
class xn extends Q {
|
|
293
293
|
constructor(e, t) {
|
|
294
|
-
super(e, t), this.setComponent(
|
|
294
|
+
super(e, t), this.setComponent(B(Ze)), this.use(T, Ve);
|
|
295
295
|
}
|
|
296
296
|
getValue = () => this.value ? "True" : "False";
|
|
297
297
|
}
|
|
298
|
-
class
|
|
298
|
+
class Ge extends L {
|
|
299
299
|
isCodeNodeOutput = !0;
|
|
300
300
|
constructor(e = "", t = "") {
|
|
301
|
-
super(e, t), this.setComponent(
|
|
301
|
+
super(e, t), this.setComponent(B(de));
|
|
302
302
|
}
|
|
303
303
|
get script() {
|
|
304
304
|
return this.name ? this.name : this.state.script;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
class
|
|
307
|
+
class ce extends Q {
|
|
308
308
|
min;
|
|
309
309
|
max;
|
|
310
310
|
constructor(e, t, n, o) {
|
|
311
|
-
super(e, t), this.min = n, this.max = o, this.use(
|
|
311
|
+
super(e, t), this.min = n, this.max = o, this.use(T, le);
|
|
312
312
|
}
|
|
313
313
|
validate(e) {
|
|
314
314
|
return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
class
|
|
318
|
-
component =
|
|
317
|
+
class Nn extends ce {
|
|
318
|
+
component = B(et);
|
|
319
319
|
validate(e) {
|
|
320
320
|
return Number.isInteger(e) && super.validate(e);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class Mn extends Q {
|
|
324
324
|
constructor(e = "", t = "") {
|
|
325
|
-
super(e, t), this.setComponent(
|
|
325
|
+
super(e, t), this.setComponent(B(Me)), this.use(T, ze);
|
|
326
326
|
}
|
|
327
327
|
getValue = () => `[${this.value}]`;
|
|
328
328
|
}
|
|
329
|
-
class
|
|
330
|
-
component =
|
|
329
|
+
class $n extends ce {
|
|
330
|
+
component = B(tt);
|
|
331
331
|
}
|
|
332
|
-
class
|
|
332
|
+
class pe extends Q {
|
|
333
333
|
constructor(e, t) {
|
|
334
|
-
super(e, t), this.use(
|
|
334
|
+
super(e, t), this.use(T, ue);
|
|
335
335
|
}
|
|
336
336
|
getValue = () => `"${this.value}"`;
|
|
337
337
|
}
|
|
338
|
-
class
|
|
339
|
-
component =
|
|
338
|
+
class On extends pe {
|
|
339
|
+
component = B(st);
|
|
340
340
|
items;
|
|
341
341
|
constructor(e, t, n) {
|
|
342
342
|
super(e, t), this.items = n;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
class
|
|
346
|
-
component =
|
|
345
|
+
class Tn extends ce {
|
|
346
|
+
component = B(nt);
|
|
347
347
|
min;
|
|
348
348
|
max;
|
|
349
349
|
constructor(e, t, n, o) {
|
|
@@ -351,7 +351,7 @@ class Mn extends pe {
|
|
|
351
351
|
}
|
|
352
352
|
getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
|
|
353
353
|
}
|
|
354
|
-
const
|
|
354
|
+
const Tt = R({
|
|
355
355
|
props: {
|
|
356
356
|
intf: {
|
|
357
357
|
type: Object,
|
|
@@ -376,54 +376,48 @@ const Et = U({
|
|
|
376
376
|
for (const [n, o] of e)
|
|
377
377
|
t[n] = o;
|
|
378
378
|
return t;
|
|
379
|
-
},
|
|
379
|
+
}, Et = { style: { position: "relative" } }, St = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, Bt = ["placeholder", "title"];
|
|
380
380
|
function Vt(s, e, t, n, o, a) {
|
|
381
|
-
return i(),
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
381
|
+
return i(), d("div", Et, [
|
|
382
|
+
l("label", St, j(s.intf.name), 1),
|
|
383
|
+
ee(l("input", {
|
|
384
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => s.v = r),
|
|
385
385
|
type: "text",
|
|
386
386
|
class: "baklava-input",
|
|
387
387
|
placeholder: s.intf.name,
|
|
388
388
|
title: s.intf.name
|
|
389
389
|
}, null, 8, Bt), [
|
|
390
|
-
[
|
|
390
|
+
[te, s.v]
|
|
391
391
|
])
|
|
392
392
|
]);
|
|
393
393
|
}
|
|
394
|
-
const zt = /* @__PURE__ */ $(
|
|
395
|
-
class
|
|
396
|
-
component =
|
|
394
|
+
const zt = /* @__PURE__ */ $(Tt, [["render", Vt]]);
|
|
395
|
+
class En extends pe {
|
|
396
|
+
component = B(zt);
|
|
397
397
|
}
|
|
398
|
-
class
|
|
399
|
-
component =
|
|
398
|
+
class Sn extends pe {
|
|
399
|
+
component = B(ot);
|
|
400
400
|
}
|
|
401
|
-
class
|
|
401
|
+
class Bn extends Q {
|
|
402
402
|
constructor(e = "", t = "") {
|
|
403
|
-
super(e, t), this.setComponent(
|
|
403
|
+
super(e, t), this.setComponent(B(Me)), this.use(T, je);
|
|
404
404
|
}
|
|
405
405
|
getValue = () => `(${this.value})`;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
return class extends
|
|
407
|
+
function Vn(s) {
|
|
408
|
+
return class extends Se {
|
|
409
409
|
type = s.type;
|
|
410
410
|
inputs = {};
|
|
411
411
|
outputs = {};
|
|
412
412
|
constructor() {
|
|
413
|
-
super(), this._title = s.title ?? s.type, this.name = s.name ?? s.type, this.updateModules(s.modules), s.variableName && (this.state.variableName = s.variableName), s.codeTemplate && (this.codeTemplate = s.codeTemplate), this.addInput(
|
|
414
|
-
"
|
|
415
|
-
new
|
|
413
|
+
super(), this._title = s.title ?? s.type, this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this), this.name = s.name ?? s.type, this.updateModules(s.modules), s.variableName != null && (this.state.variableName = s.variableName), s.codeTemplate && (this.codeTemplate = s.codeTemplate), this.addInput(
|
|
414
|
+
"_code",
|
|
415
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
416
416
|
), this.addOutput(
|
|
417
|
-
"
|
|
418
|
-
new
|
|
419
|
-
)
|
|
417
|
+
"_code",
|
|
418
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
419
|
+
);
|
|
420
420
|
}
|
|
421
|
-
// public calculate = definition.calculate
|
|
422
|
-
// ? (inputs: I, globalValues: CalculationContext) => ({
|
|
423
|
-
// ...definition.calculate!.call(this, inputs, globalValues),
|
|
424
|
-
// _node: null,
|
|
425
|
-
// })
|
|
426
|
-
// : undefined
|
|
427
421
|
onPlaced() {
|
|
428
422
|
s.onPlaced?.call(this);
|
|
429
423
|
}
|
|
@@ -447,7 +441,7 @@ function Tn(s) {
|
|
|
447
441
|
}
|
|
448
442
|
};
|
|
449
443
|
}
|
|
450
|
-
class jt extends
|
|
444
|
+
class jt extends Se {
|
|
451
445
|
/**
|
|
452
446
|
* The default implementation does nothing.
|
|
453
447
|
* Overwrite this method to do calculation.
|
|
@@ -457,23 +451,22 @@ class jt extends Be {
|
|
|
457
451
|
*/
|
|
458
452
|
calculate;
|
|
459
453
|
}
|
|
460
|
-
function
|
|
454
|
+
function zn(s) {
|
|
461
455
|
return class extends jt {
|
|
462
456
|
type = s.type;
|
|
463
457
|
inputs = {};
|
|
464
458
|
outputs = {};
|
|
465
|
-
calculate;
|
|
466
459
|
preventUpdate = !1;
|
|
467
460
|
staticInputKeys = Object.keys(s.inputs ?? {});
|
|
468
461
|
staticOutputKeys = Object.keys(s.outputs ?? {});
|
|
469
462
|
constructor() {
|
|
470
|
-
super(), this._title = s.title ?? s.type, this.name = s.name ?? s.type, this.updateModules(s.modules), s.codeTemplate && (this.codeTemplate = s.codeTemplate), s.variableName && (this.state.variableName = s.variableName), this.addInput(
|
|
471
|
-
"
|
|
472
|
-
new
|
|
463
|
+
super(), this._title = s.title ?? s.type, this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this), this.name = s.name ?? s.type, this.updateModules(s.modules), s.codeTemplate && (this.codeTemplate = s.codeTemplate), s.variableName && (this.state.variableName = s.variableName), this.addInput(
|
|
464
|
+
"_code",
|
|
465
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
473
466
|
), this.addOutput(
|
|
474
|
-
"
|
|
475
|
-
new
|
|
476
|
-
), this.staticInputKeys.push("
|
|
467
|
+
"_code",
|
|
468
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
469
|
+
), this.staticInputKeys.push("_code"), this.staticOutputKeys.push("_code");
|
|
477
470
|
}
|
|
478
471
|
onPlaced() {
|
|
479
472
|
this.events.update.subscribe(this, (e) => {
|
|
@@ -495,28 +488,28 @@ function Sn(s) {
|
|
|
495
488
|
load(e) {
|
|
496
489
|
this.preventUpdate = !0, this.hooks.beforeLoad.execute(e), this.id = e.id, this.title = e.title;
|
|
497
490
|
for (const t of this.staticInputKeys)
|
|
498
|
-
this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id, t !== "
|
|
491
|
+
this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id, t !== "_code" && (this.inputs[t].hidden = e.inputs[t].hidden);
|
|
499
492
|
for (const t of this.staticOutputKeys)
|
|
500
|
-
this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id, t !== "
|
|
493
|
+
this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id, t !== "_code" && (this.outputs[t].hidden = e.outputs[t].hidden);
|
|
501
494
|
this.preventUpdate = !1, this.onUpdate(), this.preventUpdate = !0;
|
|
502
495
|
for (const t of Object.keys(e.inputs))
|
|
503
496
|
if (!this.staticInputKeys.includes(t)) {
|
|
504
497
|
if (!this.inputs[t]) {
|
|
505
498
|
const n = e.inputs[t].value;
|
|
506
499
|
let o;
|
|
507
|
-
typeof n == "number" ? o = new
|
|
500
|
+
typeof n == "number" ? o = new at(t, n).use(T, le) : o = new it(t, JSON.stringify(n)).use(T, ue), o.use(Ne, !0), this.addInput(t, o);
|
|
508
501
|
}
|
|
509
502
|
this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
|
|
510
503
|
}
|
|
511
504
|
for (const t of Object.keys(e.outputs))
|
|
512
505
|
if (!this.staticOutputKeys.includes(t)) {
|
|
513
506
|
if (!this.outputs[t]) {
|
|
514
|
-
const n = new
|
|
507
|
+
const n = new Ge(t);
|
|
515
508
|
this.addOutput(t, n);
|
|
516
509
|
}
|
|
517
510
|
this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
|
|
518
511
|
}
|
|
519
|
-
|
|
512
|
+
Be(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
|
|
520
513
|
}
|
|
521
514
|
onUpdate() {
|
|
522
515
|
if (this.preventUpdate) return;
|
|
@@ -532,12 +525,12 @@ function Sn(s) {
|
|
|
532
525
|
}
|
|
533
526
|
updateInterfaces(e, t, n) {
|
|
534
527
|
const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
|
|
535
|
-
for (const
|
|
536
|
-
o.includes(
|
|
537
|
-
for (const
|
|
538
|
-
if (a[
|
|
539
|
-
const u = t[
|
|
540
|
-
e === "input" ? this.addInput(
|
|
528
|
+
for (const r of Object.keys(a))
|
|
529
|
+
o.includes(r) || t[r] && !n.includes(r) || (e === "input" ? this.removeInput(r) : this.removeOutput(r));
|
|
530
|
+
for (const r of Object.keys(t)) {
|
|
531
|
+
if (a[r]) continue;
|
|
532
|
+
const u = t[r]();
|
|
533
|
+
e === "input" ? this.addInput(r, u) : this.addOutput(r, u);
|
|
541
534
|
}
|
|
542
535
|
}
|
|
543
536
|
updateProps(e) {
|
|
@@ -551,13 +544,155 @@ function Sn(s) {
|
|
|
551
544
|
}
|
|
552
545
|
};
|
|
553
546
|
}
|
|
554
|
-
|
|
555
|
-
|
|
547
|
+
const jn = "__baklava_GraphNode-", Gt = [
|
|
548
|
+
"component",
|
|
549
|
+
"connectionCount",
|
|
550
|
+
"events",
|
|
551
|
+
"hidden",
|
|
552
|
+
"hooks",
|
|
553
|
+
"id",
|
|
554
|
+
"isCodeNode",
|
|
555
|
+
"isInput",
|
|
556
|
+
"name",
|
|
557
|
+
"nodeId",
|
|
558
|
+
"port",
|
|
559
|
+
"templateId",
|
|
560
|
+
"value"
|
|
561
|
+
];
|
|
562
|
+
function Lt(s) {
|
|
563
|
+
return class extends Ee {
|
|
564
|
+
type = rt(s);
|
|
565
|
+
get title() {
|
|
566
|
+
return this._title;
|
|
567
|
+
}
|
|
568
|
+
set title(t) {
|
|
569
|
+
this.template.name = t;
|
|
570
|
+
}
|
|
571
|
+
inputs = {};
|
|
572
|
+
outputs = {};
|
|
573
|
+
template = s;
|
|
574
|
+
subgraph;
|
|
575
|
+
// public override calculate: CalculateFunction<Record<string, unknown>, Record<string, unknown>> = async (
|
|
576
|
+
// inputs,
|
|
577
|
+
// context,
|
|
578
|
+
// ) => {
|
|
579
|
+
// if (!this.subgraph) {
|
|
580
|
+
// throw new Error(`GraphNode ${this.id}: calculate called without subgraph being initialized`)
|
|
581
|
+
// }
|
|
582
|
+
// if (!context.engine || typeof context.engine !== 'object') {
|
|
583
|
+
// throw new Error(`GraphNode ${this.id}: calculate called but no engine provided in context`)
|
|
584
|
+
// }
|
|
585
|
+
// const graphInputs = context.engine.getInputValues(this.subgraph)
|
|
586
|
+
// // fill subgraph input placeholders
|
|
587
|
+
// for (const input of this.subgraph.inputs) {
|
|
588
|
+
// graphInputs.set(input.nodeInterfaceId, inputs[input.id])
|
|
589
|
+
// }
|
|
590
|
+
// const result: Map<string, Map<string, unknown>> = await context.engine.runGraph(
|
|
591
|
+
// this.subgraph,
|
|
592
|
+
// graphInputs,
|
|
593
|
+
// context.globalValues,
|
|
594
|
+
// )
|
|
595
|
+
// const outputs: Record<string, unknown> = {}
|
|
596
|
+
// for (const output of this.subgraph.outputs) {
|
|
597
|
+
// outputs[output.id] = result.get(output.nodeId)?.get('output')
|
|
598
|
+
// }
|
|
599
|
+
// outputs._calculationResults = result
|
|
600
|
+
// outputs['_code'] = inputs['_code']
|
|
601
|
+
// return outputs
|
|
602
|
+
// }
|
|
603
|
+
/**
|
|
604
|
+
* Render code script of code nodes.
|
|
605
|
+
*/
|
|
606
|
+
renderCodes() {
|
|
607
|
+
if (!this.subgraph) return;
|
|
608
|
+
this.subgraph.nodes.filter((n) => n.isCodeNode).forEach((n) => n.renderCode());
|
|
609
|
+
const t = this.subgraph.nodes;
|
|
610
|
+
this.state.script = Y.render(this.code.state.template || "", { nodes: t });
|
|
611
|
+
}
|
|
612
|
+
load(t) {
|
|
613
|
+
if (!this.subgraph)
|
|
614
|
+
throw new Error("Cannot load a graph node without a graph");
|
|
615
|
+
if (!this.template)
|
|
616
|
+
throw new Error("Unable to load graph node without graph template");
|
|
617
|
+
this.subgraph.load(t.graphState), super.load(t);
|
|
618
|
+
}
|
|
619
|
+
save() {
|
|
620
|
+
if (!this.subgraph)
|
|
621
|
+
throw new Error("Cannot save a graph node without a graph");
|
|
622
|
+
return {
|
|
623
|
+
...super.save(),
|
|
624
|
+
graphState: this.subgraph.save()
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
onPlaced() {
|
|
628
|
+
this.template.events.updated.subscribe(this, () => this.initialize()), this.template.events.nameChanged.subscribe(this, (t) => {
|
|
629
|
+
this._title = t;
|
|
630
|
+
}), this.initialize();
|
|
631
|
+
}
|
|
632
|
+
onConnected() {
|
|
633
|
+
}
|
|
634
|
+
onDestroy() {
|
|
635
|
+
this.template.events.updated.unsubscribe(this), this.template.events.nameChanged.unsubscribe(this), this.subgraph?.destroy();
|
|
636
|
+
}
|
|
637
|
+
onUnconnected() {
|
|
638
|
+
}
|
|
639
|
+
initialize() {
|
|
640
|
+
this.subgraph && this.subgraph.destroy(), this.subgraph = this.template.createGraph(), this._title = this.template.name, this.updateInterfaces(), this.events.update.emit(null);
|
|
641
|
+
}
|
|
642
|
+
updateInterfaces() {
|
|
643
|
+
if (!this.subgraph)
|
|
644
|
+
throw new Error("Trying to update interfaces without graph instance");
|
|
645
|
+
for (const t of this.subgraph.inputs)
|
|
646
|
+
t.id in this.inputs ? this.inputs[t.id].name = t.name : this.addInput(t.id, this.createProxyInterface(t, !0));
|
|
647
|
+
for (const t of Object.keys(this.inputs))
|
|
648
|
+
this.subgraph.inputs.some((n) => n.id === t) || this.removeInput(t);
|
|
649
|
+
for (const t of this.subgraph.outputs)
|
|
650
|
+
t.id in this.outputs ? this.outputs[t.id].name = t.name : this.addOutput(t.id, this.createProxyInterface(t, !1));
|
|
651
|
+
for (const t of Object.keys(this.outputs))
|
|
652
|
+
this.subgraph.outputs.some((n) => n.id === t) || this.removeOutput(t);
|
|
653
|
+
this.addInput(
|
|
654
|
+
"_code",
|
|
655
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
656
|
+
), this.addOutput(
|
|
657
|
+
"_code",
|
|
658
|
+
new L("", []).use(T, U).use(A).setHidden(!0)
|
|
659
|
+
), this.addOutput(
|
|
660
|
+
"_calculationResults",
|
|
661
|
+
new Ge("_calculationResults", void 0).setHidden(!0)
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* When we create a interface in the graph node, we hide certain properties of the interface in the subgraph.
|
|
666
|
+
* For example, the `type` property or the `allowMultipleConnections` property.
|
|
667
|
+
* These properties should be proxied to the subgraph interface, so they behave the same as the original interface.
|
|
668
|
+
*/
|
|
669
|
+
createProxyInterface(t, n) {
|
|
670
|
+
const o = new L(t.name, void 0);
|
|
671
|
+
return new Proxy(o, {
|
|
672
|
+
get: (a, r) => {
|
|
673
|
+
if (Gt.includes(r) || r in a || typeof r == "string" && r.startsWith("__v_"))
|
|
674
|
+
return Reflect.get(a, r);
|
|
675
|
+
let u;
|
|
676
|
+
n ? u = this.subgraph?.nodes.find(
|
|
677
|
+
(I) => dt.isGraphInputNode(I) && I.graphInterfaceId === t.id
|
|
678
|
+
)?.outputs.placeholder.id : u = this.subgraph?.nodes.find(
|
|
679
|
+
(I) => lt.isGraphOutputNode(I) && I.graphInterfaceId === t.id
|
|
680
|
+
)?.inputs.placeholder.id;
|
|
681
|
+
const p = this.subgraph?.connections.find((g) => u === (n ? g.from : g.to)?.id), _ = n ? p?.to : p?.from;
|
|
682
|
+
if (_)
|
|
683
|
+
return Reflect.get(_, r);
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
Y.escape = (s) => s;
|
|
690
|
+
class Rt {
|
|
556
691
|
_id;
|
|
557
692
|
_viewModel;
|
|
558
693
|
_state;
|
|
559
694
|
constructor(e) {
|
|
560
|
-
this._id =
|
|
695
|
+
this._id = Te(), this._viewModel = e, this._state = q({
|
|
561
696
|
autosort: !1,
|
|
562
697
|
lockCode: !1,
|
|
563
698
|
modules: {},
|
|
@@ -567,7 +702,10 @@ class Lt {
|
|
|
567
702
|
});
|
|
568
703
|
}
|
|
569
704
|
get codeNodes() {
|
|
570
|
-
return
|
|
705
|
+
return oe(this.graph);
|
|
706
|
+
}
|
|
707
|
+
get codeNodeIds() {
|
|
708
|
+
return this.codeNodes.map((e) => e.id);
|
|
571
709
|
}
|
|
572
710
|
get connections() {
|
|
573
711
|
return this.graph.connections;
|
|
@@ -588,13 +726,13 @@ class Lt {
|
|
|
588
726
|
this.state.lockCode = e, this.viewModel.engine.runOnce(null);
|
|
589
727
|
}
|
|
590
728
|
get modules() {
|
|
591
|
-
|
|
592
|
-
return this.codeNodes.filter((t) => t.state.modules?.length > 0).forEach((t) =>
|
|
593
|
-
|
|
594
|
-
|
|
729
|
+
const e = [];
|
|
730
|
+
return this.codeNodes.filter((t) => t.state.modules?.length > 0).forEach((t) => e.push(...t.state.modules)), e ? (e.sort(), Array.from(
|
|
731
|
+
new Set(e.map((t) => this.viewModel.state.modules[t]))
|
|
732
|
+
)) : [];
|
|
595
733
|
}
|
|
596
734
|
get nodeIds() {
|
|
597
|
-
return this.
|
|
735
|
+
return this.nodes.map((e) => e.id);
|
|
598
736
|
}
|
|
599
737
|
get nodes() {
|
|
600
738
|
return this.graph.nodes;
|
|
@@ -606,10 +744,10 @@ class Lt {
|
|
|
606
744
|
return this.state.script;
|
|
607
745
|
}
|
|
608
746
|
set script(e) {
|
|
609
|
-
this.state.script = e
|
|
747
|
+
this.state.script = e;
|
|
610
748
|
}
|
|
611
749
|
get scriptedCodeNodes() {
|
|
612
|
-
return
|
|
750
|
+
return oe(this.graph).filter(
|
|
613
751
|
(e) => !e.state?.integrated
|
|
614
752
|
);
|
|
615
753
|
}
|
|
@@ -647,23 +785,43 @@ class Lt {
|
|
|
647
785
|
* @param to code node interface
|
|
648
786
|
*/
|
|
649
787
|
addConnection(e, t) {
|
|
650
|
-
e.name !== "
|
|
788
|
+
e.name !== "_code" && (e.hidden = !1), t.name !== "_code" && (t.hidden = !1), this.graph.addConnection(e, t);
|
|
651
789
|
}
|
|
652
790
|
/**
|
|
653
791
|
* Clear code graph.
|
|
654
792
|
*/
|
|
655
793
|
clear() {
|
|
656
|
-
this.state.modules = {}, this.nodes = [], this.connections = [], this.state.script = ""
|
|
794
|
+
this.viewModel.commandHandler.executeCommand(Z.CLEAR_CLIPBOARD_COMMAND), this.viewModel.commandHandler.executeCommand(Z.CLEAR_HISTORY_COMMAND), this.state.modules = {}, this.nodes = [], this.connections = [], this.state.script = "";
|
|
657
795
|
}
|
|
796
|
+
/**
|
|
797
|
+
* Find node by ID.
|
|
798
|
+
* @param id node ID
|
|
799
|
+
* @returns node instance
|
|
800
|
+
*/
|
|
658
801
|
findNodeById(e) {
|
|
659
802
|
return this.graph.findNodeById(e);
|
|
660
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* Find node by type.
|
|
806
|
+
* @param nodeType node type
|
|
807
|
+
* @returns node instance
|
|
808
|
+
*/
|
|
661
809
|
findNodeByType(e) {
|
|
662
810
|
return this.codeNodes.find((t) => t.type === e);
|
|
663
811
|
}
|
|
812
|
+
/**
|
|
813
|
+
* Get nodes of the same type.
|
|
814
|
+
* @param type node type
|
|
815
|
+
* @returns a list of node instances
|
|
816
|
+
*/
|
|
664
817
|
getNodesBySameType(e) {
|
|
665
818
|
return this.codeNodes.filter((t) => t.type === e);
|
|
666
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* Get nodes of the same variable name.
|
|
822
|
+
* @param variableName variable name
|
|
823
|
+
* @returns a list of node instances
|
|
824
|
+
*/
|
|
667
825
|
getNodesBySameVariableNames(e) {
|
|
668
826
|
return this.codeNodes.filter(
|
|
669
827
|
(t) => t.state.variableName === e
|
|
@@ -682,8 +840,9 @@ class Lt {
|
|
|
682
840
|
}
|
|
683
841
|
/**
|
|
684
842
|
* Load template from the file.
|
|
843
|
+
* @param resolve: default string in promise resolve (from import)
|
|
685
844
|
*/
|
|
686
|
-
loadTemplate(e) {
|
|
845
|
+
async loadTemplate(e) {
|
|
687
846
|
e.then((t) => {
|
|
688
847
|
this._state.template = t.default ?? "";
|
|
689
848
|
});
|
|
@@ -703,16 +862,18 @@ class Lt {
|
|
|
703
862
|
this.graph.removeNode(e);
|
|
704
863
|
}
|
|
705
864
|
/**
|
|
706
|
-
* Render
|
|
865
|
+
* Render code script of code nodes.
|
|
707
866
|
*/
|
|
708
867
|
renderNodeCodes() {
|
|
709
|
-
this.state.lockCode || this.codeNodes.length
|
|
868
|
+
this.state.lockCode || this.codeNodes.length === 0 || this.codeNodes.forEach((e) => e.renderCode());
|
|
710
869
|
}
|
|
711
870
|
/**
|
|
712
|
-
* Render code.
|
|
871
|
+
* Render code script.
|
|
713
872
|
*/
|
|
714
873
|
renderCode() {
|
|
715
|
-
|
|
874
|
+
if (this.state.lockCode) return;
|
|
875
|
+
const e = this.scriptedCodeNodes, t = this.modules;
|
|
876
|
+
this.state.script = Y.render(this.state.template || "", { nodes: e, modules: t });
|
|
716
877
|
}
|
|
717
878
|
/**
|
|
718
879
|
* Reset scripts of intput interfaces.
|
|
@@ -720,44 +881,20 @@ class Lt {
|
|
|
720
881
|
resetInputInterfaceScript() {
|
|
721
882
|
this.codeNodes.forEach((e) => e.resetInputInterfaceScript());
|
|
722
883
|
}
|
|
723
|
-
/**
|
|
724
|
-
* Save code graph.
|
|
725
|
-
* @returns graph state
|
|
726
|
-
*/
|
|
727
|
-
save() {
|
|
728
|
-
this.state.autosort && this.sortNodes();
|
|
729
|
-
const e = this.viewModel.editor.save();
|
|
730
|
-
return e.graph.id = this.id, this.saveNodeStates(e.graph.nodes), JSON.parse(JSON.stringify(e));
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Save node states.
|
|
734
|
-
* @param nodeStates a list of node state.
|
|
735
|
-
*/
|
|
736
|
-
saveNodeStates(e) {
|
|
737
|
-
e.forEach((t, n) => {
|
|
738
|
-
const o = this.nodes[n];
|
|
739
|
-
Object.entries(t.inputs).forEach(([a, l]) => {
|
|
740
|
-
t.inputs && o.inputs[a] && (l.hidden = o.inputs[a].hidden);
|
|
741
|
-
}), Object.entries(t.outputs).forEach(([a, l]) => {
|
|
742
|
-
t.outputs && o.outputs[a] && (l.hidden = o.outputs[a].hidden);
|
|
743
|
-
});
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
884
|
/**
|
|
747
885
|
* Sort code nodes.
|
|
748
886
|
*/
|
|
749
887
|
sortNodes() {
|
|
750
888
|
if (!(this.nodes.length === 0 || this.connections.length === 0))
|
|
751
889
|
try {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
a.from.nodeId
|
|
755
|
-
]);
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
const o = t.map((a) => this.findNodeById(a));
|
|
890
|
+
let e = this.nodeIds;
|
|
891
|
+
const t = this.connections.filter(
|
|
892
|
+
(a) => e.includes(a.to.nodeId) && e.includes(a.from.nodeId)
|
|
893
|
+
).map((a) => [a.to.nodeId, a.from.nodeId]);
|
|
894
|
+
e.reverse(), e = Ye.array(e, t), e.reverse();
|
|
895
|
+
const n = this.graph.nodes.map((a) => a.id).filter((a) => !e.includes(a));
|
|
896
|
+
e = [...e, ...n];
|
|
897
|
+
const o = e.map((a) => this.findNodeById(a));
|
|
761
898
|
o && (this.nodes = o);
|
|
762
899
|
} catch {
|
|
763
900
|
console.warn("Failed to sort nodes.");
|
|
@@ -776,60 +913,51 @@ class Lt {
|
|
|
776
913
|
this.codeNodes.forEach((e) => e.updateCodeTemplate());
|
|
777
914
|
}
|
|
778
915
|
}
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
return s.nodes.forEach((t) => {
|
|
782
|
-
t.subgraph ? e
|
|
916
|
+
const oe = (s) => {
|
|
917
|
+
const e = [];
|
|
918
|
+
return s.nodes.length === 0 || s.nodes.forEach((t) => {
|
|
919
|
+
t && (t.hasOwnProperty("subgraph") ? e.push(...oe(t.subgraph)) : t.hasOwnProperty("isCodeNode") && e.push(t));
|
|
783
920
|
}), e;
|
|
784
|
-
},
|
|
921
|
+
}, Ln = (s = 0, e = 100) => ({
|
|
785
922
|
x: s * 420,
|
|
786
923
|
y: e
|
|
787
|
-
}),
|
|
924
|
+
}), Rn = (s) => {
|
|
788
925
|
const e = { ...s.position };
|
|
789
926
|
return e.x -= 440, e.y += 50, e;
|
|
790
|
-
},
|
|
791
|
-
const { calculationOrder: e, connectionsFromNode: t } = Me(s);
|
|
792
|
-
e.forEach((n) => {
|
|
793
|
-
if (!n.isCodeNode) return;
|
|
794
|
-
const o = n;
|
|
795
|
-
t.has(o) && t.get(o).forEach((a) => {
|
|
796
|
-
a.to.state && a.from.script && (a.to.state.script = a.from.script);
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
}, Ut = ["id"], Rt = { class: "align-middle" }, xe = /* @__PURE__ */ U({
|
|
927
|
+
}, Pt = ["id"], Ut = { class: "align-middle" }, we = /* @__PURE__ */ R({
|
|
800
928
|
__name: "CodeGraphNodeInterface",
|
|
801
929
|
props: {
|
|
802
930
|
node: {},
|
|
803
931
|
intf: {}
|
|
804
932
|
},
|
|
805
933
|
setup(s) {
|
|
806
|
-
const e = s, { viewModel: t } =
|
|
807
|
-
"--connected":
|
|
808
|
-
})),
|
|
934
|
+
const e = s, { viewModel: t } = K(), { hoveredOver: n, temporaryConnection: o } = ut(), a = V(null), r = b(() => e.intf.connectionCount > 0), u = b(() => ({
|
|
935
|
+
"--connected": r.value
|
|
936
|
+
})), p = () => {
|
|
809
937
|
n(e.intf);
|
|
810
|
-
},
|
|
938
|
+
}, _ = () => {
|
|
811
939
|
n(void 0);
|
|
812
|
-
},
|
|
940
|
+
}, g = () => {
|
|
813
941
|
a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
|
|
814
942
|
};
|
|
815
|
-
return
|
|
943
|
+
return ie(g), $e(g), (I, G) => (i(), d("div", {
|
|
816
944
|
id: s.intf.id,
|
|
817
945
|
ref_key: "el",
|
|
818
946
|
ref: a,
|
|
819
|
-
class:
|
|
947
|
+
class: P(["baklava-node-interface", u.value])
|
|
820
948
|
}, [
|
|
821
|
-
s.intf.port ? (i(),
|
|
949
|
+
s.intf.port ? (i(), d("div", {
|
|
822
950
|
key: 0,
|
|
823
|
-
class:
|
|
824
|
-
onPointerover:
|
|
825
|
-
onPointerout:
|
|
826
|
-
}, null, 34)) :
|
|
827
|
-
|
|
828
|
-
|
|
951
|
+
class: P(["__port", { "--selected": k(o)?.from === s.intf }]),
|
|
952
|
+
onPointerover: p,
|
|
953
|
+
onPointerout: _
|
|
954
|
+
}, null, 34)) : x("", !0),
|
|
955
|
+
l("span", Ut, [
|
|
956
|
+
X(I.$slots, "default")
|
|
829
957
|
])
|
|
830
|
-
], 10,
|
|
958
|
+
], 10, Pt));
|
|
831
959
|
}
|
|
832
|
-
}),
|
|
960
|
+
}), Ht = {}, At = {
|
|
833
961
|
xmlns: "http://www.w3.org/2000/svg",
|
|
834
962
|
width: "24",
|
|
835
963
|
height: "24",
|
|
@@ -842,16 +970,16 @@ const ae = (s) => {
|
|
|
842
970
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"
|
|
843
971
|
};
|
|
844
972
|
function Dt(s, e) {
|
|
845
|
-
return i(),
|
|
846
|
-
|
|
973
|
+
return i(), d("svg", At, [...e[0] || (e[0] = [
|
|
974
|
+
l("path", {
|
|
847
975
|
stroke: "none",
|
|
848
976
|
d: "M0 0h24v24H0z",
|
|
849
977
|
fill: "none"
|
|
850
978
|
}, null, -1),
|
|
851
|
-
|
|
979
|
+
l("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)
|
|
852
980
|
])]);
|
|
853
981
|
}
|
|
854
|
-
const
|
|
982
|
+
const Ft = /* @__PURE__ */ $(Ht, [["render", Dt]]), Wt = {}, Xt = {
|
|
855
983
|
xmlns: "http://www.w3.org/2000/svg",
|
|
856
984
|
width: "24",
|
|
857
985
|
height: "24",
|
|
@@ -863,19 +991,19 @@ const Ht = /* @__PURE__ */ $(Gt, [["render", Dt]]), Pt = {}, Ft = {
|
|
|
863
991
|
"stroke-linejoin": "round",
|
|
864
992
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"
|
|
865
993
|
};
|
|
866
|
-
function
|
|
867
|
-
return i(),
|
|
868
|
-
|
|
994
|
+
function Yt(s, e) {
|
|
995
|
+
return i(), d("svg", Xt, [...e[0] || (e[0] = [
|
|
996
|
+
l("path", {
|
|
869
997
|
stroke: "none",
|
|
870
998
|
d: "M0 0h24v24H0z",
|
|
871
999
|
fill: "none"
|
|
872
1000
|
}, null, -1),
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1001
|
+
l("path", { d: "M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
|
|
1002
|
+
l("path", { d: "M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1),
|
|
1003
|
+
l("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
|
|
876
1004
|
])]);
|
|
877
1005
|
}
|
|
878
|
-
const
|
|
1006
|
+
const Kt = /* @__PURE__ */ $(Wt, [["render", Yt]]), qt = {}, Jt = {
|
|
879
1007
|
xmlns: "http://www.w3.org/2000/svg",
|
|
880
1008
|
width: "24",
|
|
881
1009
|
height: "24",
|
|
@@ -883,17 +1011,17 @@ const Xt = /* @__PURE__ */ $(Pt, [["render", Wt]]), Yt = {}, qt = {
|
|
|
883
1011
|
fill: "currentColor",
|
|
884
1012
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
|
|
885
1013
|
};
|
|
886
|
-
function
|
|
887
|
-
return i(),
|
|
888
|
-
|
|
1014
|
+
function Qt(s, e) {
|
|
1015
|
+
return i(), d("svg", Jt, [...e[0] || (e[0] = [
|
|
1016
|
+
l("path", {
|
|
889
1017
|
stroke: "none",
|
|
890
1018
|
d: "M0 0h24v24H0z",
|
|
891
1019
|
fill: "none"
|
|
892
1020
|
}, null, -1),
|
|
893
|
-
|
|
1021
|
+
l("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)
|
|
894
1022
|
])]);
|
|
895
1023
|
}
|
|
896
|
-
const
|
|
1024
|
+
const Zt = /* @__PURE__ */ $(qt, [["render", Qt]]), es = {}, ts = {
|
|
897
1025
|
xmlns: "http://www.w3.org/2000/svg",
|
|
898
1026
|
width: "24",
|
|
899
1027
|
height: "24",
|
|
@@ -901,17 +1029,17 @@ const Qt = /* @__PURE__ */ $(Yt, [["render", Jt]]), Kt = {}, Zt = {
|
|
|
901
1029
|
fill: "currentColor",
|
|
902
1030
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
|
|
903
1031
|
};
|
|
904
|
-
function
|
|
905
|
-
return i(),
|
|
906
|
-
|
|
1032
|
+
function ss(s, e) {
|
|
1033
|
+
return i(), d("svg", ts, [...e[0] || (e[0] = [
|
|
1034
|
+
l("path", {
|
|
907
1035
|
stroke: "none",
|
|
908
1036
|
d: "M0 0h24v24H0z",
|
|
909
1037
|
fill: "none"
|
|
910
1038
|
}, null, -1),
|
|
911
|
-
|
|
1039
|
+
l("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)
|
|
912
1040
|
])]);
|
|
913
1041
|
}
|
|
914
|
-
const
|
|
1042
|
+
const ns = /* @__PURE__ */ $(es, [["render", ss]]), os = {}, as = {
|
|
915
1043
|
xmlns: "http://www.w3.org/2000/svg",
|
|
916
1044
|
width: "24",
|
|
917
1045
|
height: "24",
|
|
@@ -919,17 +1047,17 @@ const ts = /* @__PURE__ */ $(Kt, [["render", es]]), ss = {}, ns = {
|
|
|
919
1047
|
fill: "currentColor",
|
|
920
1048
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
|
|
921
1049
|
};
|
|
922
|
-
function
|
|
923
|
-
return i(),
|
|
924
|
-
|
|
1050
|
+
function is(s, e) {
|
|
1051
|
+
return i(), d("svg", as, [...e[0] || (e[0] = [
|
|
1052
|
+
l("path", {
|
|
925
1053
|
stroke: "none",
|
|
926
1054
|
d: "M0 0h24v24H0z",
|
|
927
1055
|
fill: "none"
|
|
928
1056
|
}, null, -1),
|
|
929
|
-
|
|
1057
|
+
l("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)
|
|
930
1058
|
])]);
|
|
931
1059
|
}
|
|
932
|
-
const
|
|
1060
|
+
const rs = /* @__PURE__ */ $(os, [["render", is]]), ds = {}, ls = {
|
|
933
1061
|
xmlns: "http://www.w3.org/2000/svg",
|
|
934
1062
|
width: "24",
|
|
935
1063
|
height: "24",
|
|
@@ -937,17 +1065,17 @@ const as = /* @__PURE__ */ $(ss, [["render", os]]), is = {}, rs = {
|
|
|
937
1065
|
fill: "currentColor",
|
|
938
1066
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
|
|
939
1067
|
};
|
|
940
|
-
function
|
|
941
|
-
return i(),
|
|
942
|
-
|
|
1068
|
+
function us(s, e) {
|
|
1069
|
+
return i(), d("svg", ls, [...e[0] || (e[0] = [
|
|
1070
|
+
l("path", {
|
|
943
1071
|
stroke: "none",
|
|
944
1072
|
d: "M0 0h24v24H0z",
|
|
945
1073
|
fill: "none"
|
|
946
1074
|
}, null, -1),
|
|
947
|
-
|
|
1075
|
+
l("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)
|
|
948
1076
|
])]);
|
|
949
1077
|
}
|
|
950
|
-
const
|
|
1078
|
+
const cs = /* @__PURE__ */ $(ds, [["render", us]]), ps = {}, hs = {
|
|
951
1079
|
xmlns: "http://www.w3.org/2000/svg",
|
|
952
1080
|
width: "24",
|
|
953
1081
|
height: "24",
|
|
@@ -955,17 +1083,17 @@ const ls = /* @__PURE__ */ $(is, [["render", ds]]), us = {}, cs = {
|
|
|
955
1083
|
fill: "currentColor",
|
|
956
1084
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
|
|
957
1085
|
};
|
|
958
|
-
function
|
|
959
|
-
return i(),
|
|
960
|
-
|
|
1086
|
+
function ms(s, e) {
|
|
1087
|
+
return i(), d("svg", hs, [...e[0] || (e[0] = [
|
|
1088
|
+
l("path", {
|
|
961
1089
|
stroke: "none",
|
|
962
1090
|
d: "M0 0h24v24H0z",
|
|
963
1091
|
fill: "none"
|
|
964
1092
|
}, null, -1),
|
|
965
|
-
|
|
1093
|
+
l("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)
|
|
966
1094
|
])]);
|
|
967
1095
|
}
|
|
968
|
-
const
|
|
1096
|
+
const vs = /* @__PURE__ */ $(ps, [["render", ms]]), fs = {}, gs = {
|
|
969
1097
|
xmlns: "http://www.w3.org/2000/svg",
|
|
970
1098
|
width: "24",
|
|
971
1099
|
height: "24",
|
|
@@ -977,12 +1105,12 @@ const hs = /* @__PURE__ */ $(us, [["render", ps]]), vs = {}, ms = {
|
|
|
977
1105
|
"stroke-linejoin": "round",
|
|
978
1106
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-lock-code"
|
|
979
1107
|
};
|
|
980
|
-
function
|
|
981
|
-
return i(),
|
|
982
|
-
|
|
1108
|
+
function bs(s, e) {
|
|
1109
|
+
return i(), d("svg", gs, [...e[0] || (e[0] = [
|
|
1110
|
+
J('<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)
|
|
983
1111
|
])]);
|
|
984
1112
|
}
|
|
985
|
-
const
|
|
1113
|
+
const _s = /* @__PURE__ */ $(fs, [["render", bs]]), ys = {}, Cs = {
|
|
986
1114
|
xmlns: "http://www.w3.org/2000/svg",
|
|
987
1115
|
width: "24",
|
|
988
1116
|
height: "24",
|
|
@@ -994,12 +1122,12 @@ const gs = /* @__PURE__ */ $(vs, [["render", fs]]), bs = {}, ys = {
|
|
|
994
1122
|
"stroke-linejoin": "round",
|
|
995
1123
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema"
|
|
996
1124
|
};
|
|
997
|
-
function
|
|
998
|
-
return i(),
|
|
999
|
-
|
|
1125
|
+
function ks(s, e) {
|
|
1126
|
+
return i(), d("svg", Cs, [...e[0] || (e[0] = [
|
|
1127
|
+
J('<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)
|
|
1000
1128
|
])]);
|
|
1001
1129
|
}
|
|
1002
|
-
const
|
|
1130
|
+
const ws = /* @__PURE__ */ $(ys, [["render", ks]]), Is = {}, xs = {
|
|
1003
1131
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1004
1132
|
width: "24",
|
|
1005
1133
|
height: "24",
|
|
@@ -1011,12 +1139,12 @@ const Cs = /* @__PURE__ */ $(bs, [["render", _s]]), ks = {}, ws = {
|
|
|
1011
1139
|
"stroke-linejoin": "round",
|
|
1012
1140
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-schema-off"
|
|
1013
1141
|
};
|
|
1014
|
-
function
|
|
1015
|
-
return i(),
|
|
1016
|
-
|
|
1142
|
+
function Ns(s, e) {
|
|
1143
|
+
return i(), d("svg", xs, [...e[0] || (e[0] = [
|
|
1144
|
+
J('<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)
|
|
1017
1145
|
])]);
|
|
1018
1146
|
}
|
|
1019
|
-
const
|
|
1147
|
+
const Ms = /* @__PURE__ */ $(Is, [["render", Ns]]), $s = {}, Os = {
|
|
1020
1148
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1021
1149
|
width: "24",
|
|
1022
1150
|
height: "24",
|
|
@@ -1028,12 +1156,12 @@ const Is = /* @__PURE__ */ $(ks, [["render", xs]]), Ns = {}, Ms = {
|
|
|
1028
1156
|
"stroke-linejoin": "round",
|
|
1029
1157
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-transition-bottom"
|
|
1030
1158
|
};
|
|
1031
|
-
function
|
|
1032
|
-
return i(),
|
|
1033
|
-
|
|
1159
|
+
function Ts(s, e) {
|
|
1160
|
+
return i(), d("svg", Os, [...e[0] || (e[0] = [
|
|
1161
|
+
J('<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)
|
|
1034
1162
|
])]);
|
|
1035
1163
|
}
|
|
1036
|
-
const
|
|
1164
|
+
const Es = /* @__PURE__ */ $($s, [["render", Ts]]), Ss = {}, Bs = {
|
|
1037
1165
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1038
1166
|
width: "24",
|
|
1039
1167
|
height: "24",
|
|
@@ -1045,18 +1173,18 @@ const Os = /* @__PURE__ */ $(Ns, [["render", $s]]), Es = {}, Ts = {
|
|
|
1045
1173
|
"stroke-linejoin": "round",
|
|
1046
1174
|
class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-trash-off"
|
|
1047
1175
|
};
|
|
1048
|
-
function
|
|
1049
|
-
return i(),
|
|
1050
|
-
|
|
1176
|
+
function Vs(s, e) {
|
|
1177
|
+
return i(), d("svg", Bs, [...e[0] || (e[0] = [
|
|
1178
|
+
J('<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)
|
|
1051
1179
|
])]);
|
|
1052
1180
|
}
|
|
1053
|
-
const
|
|
1181
|
+
const zs = /* @__PURE__ */ $(Ss, [["render", Vs]]), js = ["id", "data-node-type"], Gs = {
|
|
1054
1182
|
class: "__title-label",
|
|
1055
1183
|
style: { "flex-grow": "1" }
|
|
1056
|
-
},
|
|
1184
|
+
}, Ls = { key: 0 }, Rs = {
|
|
1057
1185
|
class: "__menu",
|
|
1058
1186
|
style: { display: "flex" }
|
|
1059
|
-
},
|
|
1187
|
+
}, Ps = { class: "__outputs" }, Us = { key: 0 }, Hs = ["id", "title"], As = { class: "__inputs" }, Ds = { key: 0 }, Fs = ["id", "title"], Ws = /* @__PURE__ */ R({
|
|
1060
1188
|
__name: "CodeGraphNode",
|
|
1061
1189
|
props: {
|
|
1062
1190
|
node: {},
|
|
@@ -1065,240 +1193,242 @@ const Bs = /* @__PURE__ */ $(Es, [["render", Ss]]), Vs = ["id", "data-node-type"
|
|
|
1065
1193
|
},
|
|
1066
1194
|
emits: ["select", "start-drag", "update"],
|
|
1067
1195
|
setup(s, { emit: e }) {
|
|
1068
|
-
const t =
|
|
1069
|
-
let
|
|
1070
|
-
const
|
|
1196
|
+
const t = Ce.ContextMenu, n = Ce.NodeInterface, o = s, a = b(() => o.node), r = e, { viewModel: u } = K(), { graph: p, switchGraph: _ } = ae(), g = V(null), I = V(!1), G = V(""), N = V(null), y = V(!1);
|
|
1197
|
+
let f = 0, O = 0;
|
|
1198
|
+
const m = V(!1), w = b(() => {
|
|
1071
1199
|
const c = [
|
|
1072
1200
|
{ value: "edit", label: "Edit" },
|
|
1073
1201
|
{ value: "rename", label: "Rename" },
|
|
1074
1202
|
{ value: "delete", label: "Delete" }
|
|
1075
1203
|
];
|
|
1076
|
-
return o.node.type.startsWith(
|
|
1077
|
-
}),
|
|
1204
|
+
return o.node.type.startsWith(se) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
|
|
1205
|
+
}), h = b(() => ({
|
|
1078
1206
|
"--selected": o.selected,
|
|
1079
1207
|
"--dragging": o.dragging,
|
|
1080
1208
|
"--two-column": !!o.node.twoColumn,
|
|
1081
1209
|
"--hidden": a.value.state?.hidden
|
|
1082
1210
|
})), M = b(() => ({
|
|
1083
1211
|
"--reverse-y": o.node.reverseY ?? u.value.settings.nodes.reverseY
|
|
1084
|
-
})),
|
|
1212
|
+
})), Le = b(() => ({
|
|
1085
1213
|
top: `${o.node.position?.y ?? 0}px`,
|
|
1086
1214
|
left: `${o.node.position?.x ?? 0}px`,
|
|
1087
1215
|
"--width": `${o.node.width ?? u.value.settings.nodes.defaultWidth}px`
|
|
1088
|
-
})), Re = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)),
|
|
1089
|
-
|
|
1090
|
-
},
|
|
1091
|
-
o.selected ||
|
|
1216
|
+
})), Re = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), Pe = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), he = () => {
|
|
1217
|
+
r("select");
|
|
1218
|
+
}, Ue = (c) => {
|
|
1219
|
+
o.selected || he(), r("start-drag", c);
|
|
1092
1220
|
}, me = () => {
|
|
1093
|
-
|
|
1094
|
-
},
|
|
1221
|
+
m.value = !0;
|
|
1222
|
+
}, He = () => {
|
|
1095
1223
|
const c = u.value.displayedGraph.sidebar;
|
|
1096
1224
|
c.nodeId = "", c.visible = !1;
|
|
1097
|
-
},
|
|
1225
|
+
}, ve = () => {
|
|
1098
1226
|
const c = u.value.displayedGraph.sidebar;
|
|
1099
1227
|
c.nodeId = o.node.id, c.visible = !0;
|
|
1100
|
-
},
|
|
1228
|
+
}, Ae = () => {
|
|
1101
1229
|
const c = u.value.displayedGraph.sidebar;
|
|
1102
1230
|
c.nodeId = o.node.id;
|
|
1103
|
-
},
|
|
1231
|
+
}, De = async (c) => {
|
|
1104
1232
|
switch (c) {
|
|
1105
1233
|
case "edit":
|
|
1106
|
-
|
|
1234
|
+
ve();
|
|
1107
1235
|
break;
|
|
1108
1236
|
case "delete":
|
|
1109
|
-
|
|
1237
|
+
p.value.removeNode(o.node);
|
|
1110
1238
|
break;
|
|
1111
1239
|
case "rename":
|
|
1112
|
-
|
|
1240
|
+
G.value = o.node.title, I.value = !0, await bt(), N.value?.focus();
|
|
1113
1241
|
break;
|
|
1114
1242
|
case "editSubgraph":
|
|
1115
|
-
|
|
1243
|
+
_(o.node.template);
|
|
1116
1244
|
break;
|
|
1117
1245
|
}
|
|
1246
|
+
}, fe = () => {
|
|
1247
|
+
a.value.title = G.value, I.value = !1;
|
|
1118
1248
|
}, ge = () => {
|
|
1119
|
-
|
|
1120
|
-
}, be = () => {
|
|
1121
|
-
w.value && u.value.hooks.renderNode.execute({ node: o.node, el: w.value });
|
|
1249
|
+
g.value && u.value.hooks.renderNode.execute({ node: o.node, el: g.value });
|
|
1122
1250
|
}, Fe = (c) => {
|
|
1123
|
-
|
|
1124
|
-
},
|
|
1125
|
-
a.value.state && (a.value.state.integrated = c,
|
|
1251
|
+
y.value = !0, f = o.node.width, O = c.clientX, c.preventDefault();
|
|
1252
|
+
}, be = (c) => {
|
|
1253
|
+
a.value.state && (a.value.state.integrated = c, r("update"));
|
|
1126
1254
|
}, _e = (c) => {
|
|
1127
|
-
if (!
|
|
1128
|
-
const
|
|
1129
|
-
a.value.width = Math.max(We, Math.min(Xe,
|
|
1130
|
-
},
|
|
1131
|
-
|
|
1255
|
+
if (!y.value) return;
|
|
1256
|
+
const C = c.clientX - O, v = f + C / p.value.scaling, We = u.value.settings.nodes.minWidth, Xe = u.value.settings.nodes.maxWidth;
|
|
1257
|
+
a.value.width = Math.max(We, Math.min(Xe, v));
|
|
1258
|
+
}, ye = () => {
|
|
1259
|
+
y.value = !1;
|
|
1132
1260
|
};
|
|
1133
|
-
return
|
|
1134
|
-
|
|
1135
|
-
}),
|
|
1136
|
-
window.removeEventListener("mousemove", _e), window.removeEventListener("mouseup",
|
|
1137
|
-
}), (c,
|
|
1261
|
+
return ie(() => {
|
|
1262
|
+
ge(), window.addEventListener("mousemove", _e), window.addEventListener("mouseup", ye);
|
|
1263
|
+
}), $e(ge), ft(() => {
|
|
1264
|
+
window.removeEventListener("mousemove", _e), window.removeEventListener("mouseup", ye);
|
|
1265
|
+
}), (c, C) => (i(), d("div", {
|
|
1138
1266
|
id: a.value.id,
|
|
1139
1267
|
ref_key: "el",
|
|
1140
|
-
ref:
|
|
1141
|
-
class:
|
|
1268
|
+
ref: g,
|
|
1269
|
+
class: P([h.value, "baklava-node"]),
|
|
1142
1270
|
"data-node-type": a.value.type,
|
|
1143
|
-
style:
|
|
1144
|
-
onPointerdown:
|
|
1271
|
+
style: re(Le.value),
|
|
1272
|
+
onPointerdown: he
|
|
1145
1273
|
}, [
|
|
1146
|
-
|
|
1274
|
+
k(u).settings.nodes.resizable ? (i(), d("div", {
|
|
1147
1275
|
key: 0,
|
|
1148
1276
|
class: "__resize-handle",
|
|
1149
1277
|
onMousedown: Fe
|
|
1150
|
-
}, null, 32)) :
|
|
1151
|
-
|
|
1278
|
+
}, null, 32)) : x("", !0),
|
|
1279
|
+
l("div", {
|
|
1152
1280
|
class: "__title",
|
|
1153
|
-
onPointerdown:
|
|
1154
|
-
onContextmenu:
|
|
1281
|
+
onPointerdown: F(Ue, ["self", "stop"]),
|
|
1282
|
+
onContextmenu: F(me, ["prevent"])
|
|
1155
1283
|
}, [
|
|
1156
|
-
a.value.inputs.
|
|
1284
|
+
a.value.inputs._code ? (i(), E(we, {
|
|
1157
1285
|
key: 0,
|
|
1158
1286
|
node: a.value,
|
|
1159
|
-
intf: a.value.inputs.
|
|
1287
|
+
intf: a.value.inputs._code,
|
|
1288
|
+
title: a.value.inputs._code.value,
|
|
1160
1289
|
class: "--input",
|
|
1161
1290
|
"data-interface-type": "node",
|
|
1162
1291
|
style: { "flex-grow": "0" }
|
|
1163
|
-
}, null, 8, ["node", "intf"])) :
|
|
1164
|
-
|
|
1292
|
+
}, null, 8, ["node", "intf", "title"])) : x("", !0),
|
|
1293
|
+
I.value ? ee((i(), d("input", {
|
|
1165
1294
|
key: 2,
|
|
1166
1295
|
ref_key: "renameInputEl",
|
|
1167
1296
|
ref: N,
|
|
1168
|
-
"onUpdate:modelValue":
|
|
1297
|
+
"onUpdate:modelValue": C[4] || (C[4] = (v) => G.value = v),
|
|
1169
1298
|
class: "baklava-input",
|
|
1170
1299
|
placeholder: "Node Name",
|
|
1171
1300
|
style: { "flex-grow": "1" },
|
|
1172
1301
|
type: "text",
|
|
1173
|
-
onBlur:
|
|
1174
|
-
onKeydown:
|
|
1302
|
+
onBlur: fe,
|
|
1303
|
+
onKeydown: ne(fe, ["enter"])
|
|
1175
1304
|
}, null, 544)), [
|
|
1176
|
-
[
|
|
1177
|
-
]) : (i(),
|
|
1178
|
-
|
|
1179
|
-
a.value.idx > -1 ? (i(),
|
|
1180
|
-
|
|
1305
|
+
[te, G.value]
|
|
1306
|
+
]) : (i(), d(S, { key: 1 }, [
|
|
1307
|
+
l("div", Gs, [
|
|
1308
|
+
a.value.idx > -1 ? (i(), d("span", Ls, j(a.value.idx + 1) + " - ", 1)) : x("", !0),
|
|
1309
|
+
gt(j(a.value.title), 1)
|
|
1181
1310
|
]),
|
|
1182
|
-
|
|
1183
|
-
a.value.
|
|
1184
|
-
a.value.state.lockCode ? (i(),
|
|
1311
|
+
l("div", Rs, [
|
|
1312
|
+
a.value.isCodeNode ? (i(), d(S, { key: 0 }, [
|
|
1313
|
+
a.value.state.lockCode ? (i(), E(k(_s), {
|
|
1185
1314
|
key: 0,
|
|
1186
1315
|
class: "--clickable mx-1",
|
|
1187
|
-
onClick:
|
|
1188
|
-
})) :
|
|
1189
|
-
a.value.state.integrated ? (i(),
|
|
1316
|
+
onClick: C[0] || (C[0] = (v) => a.value.lockCode = !1)
|
|
1317
|
+
})) : x("", !0),
|
|
1318
|
+
a.value.state.integrated ? (i(), E(k(Ft), {
|
|
1190
1319
|
key: 1,
|
|
1191
1320
|
class: "--clickable mx-1",
|
|
1192
|
-
onClick:
|
|
1193
|
-
})) : (i(),
|
|
1321
|
+
onClick: C[1] || (C[1] = (v) => be(!1))
|
|
1322
|
+
})) : (i(), E(k(Es), {
|
|
1194
1323
|
key: 2,
|
|
1195
1324
|
class: "--clickable mx-1",
|
|
1196
|
-
onClick:
|
|
1325
|
+
onClick: C[2] || (C[2] = (v) => be(!0))
|
|
1197
1326
|
})),
|
|
1198
|
-
!
|
|
1327
|
+
!k(u).displayedGraph.sidebar.visible && k(u).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), E(k(vs), {
|
|
1199
1328
|
key: 3,
|
|
1200
1329
|
class: "--clickable mx-1",
|
|
1201
|
-
onClick:
|
|
1202
|
-
})) :
|
|
1330
|
+
onClick: ve
|
|
1331
|
+
})) : k(u).displayedGraph.sidebar.visible && k(u).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), E(k(rs), {
|
|
1203
1332
|
key: 4,
|
|
1204
1333
|
class: "--clickable mx-1",
|
|
1205
|
-
onClick:
|
|
1206
|
-
})) : (i(),
|
|
1334
|
+
onClick: Ae
|
|
1335
|
+
})) : (i(), E(k(cs), {
|
|
1207
1336
|
key: 5,
|
|
1208
1337
|
class: "--clickable mx-1",
|
|
1209
|
-
onClick:
|
|
1338
|
+
onClick: He
|
|
1210
1339
|
}))
|
|
1211
|
-
], 64)),
|
|
1212
|
-
z(
|
|
1340
|
+
], 64)) : x("", !0),
|
|
1341
|
+
z(k(Kt), {
|
|
1213
1342
|
class: "--clickable mx-1",
|
|
1214
1343
|
onClick: me
|
|
1215
1344
|
}),
|
|
1216
|
-
z(
|
|
1217
|
-
modelValue:
|
|
1218
|
-
"onUpdate:modelValue":
|
|
1345
|
+
z(k(t), {
|
|
1346
|
+
modelValue: m.value,
|
|
1347
|
+
"onUpdate:modelValue": C[3] || (C[3] = (v) => m.value = v),
|
|
1219
1348
|
x: 0,
|
|
1220
1349
|
y: 0,
|
|
1221
|
-
items:
|
|
1222
|
-
onClick:
|
|
1350
|
+
items: w.value,
|
|
1351
|
+
onClick: De
|
|
1223
1352
|
}, null, 8, ["modelValue", "items"])
|
|
1224
1353
|
])
|
|
1225
1354
|
], 64)),
|
|
1226
|
-
a.value.outputs.
|
|
1355
|
+
a.value.outputs._code ? (i(), E(we, {
|
|
1227
1356
|
key: 3,
|
|
1228
1357
|
node: a.value,
|
|
1229
|
-
intf: a.value.outputs.
|
|
1358
|
+
intf: a.value.outputs._code,
|
|
1230
1359
|
class: "--output",
|
|
1360
|
+
title: a.value.outputs._code.value,
|
|
1231
1361
|
"data-interface-type": "node"
|
|
1232
|
-
}, null, 8, ["node", "intf"])) :
|
|
1362
|
+
}, null, 8, ["node", "intf", "title"])) : x("", !0)
|
|
1233
1363
|
], 32),
|
|
1234
|
-
|
|
1235
|
-
class:
|
|
1236
|
-
onKeydown:
|
|
1364
|
+
l("div", {
|
|
1365
|
+
class: P(["__content", M.value]),
|
|
1366
|
+
onKeydown: C[5] || (C[5] = ne(F(() => {
|
|
1237
1367
|
}, ["stop"]), ["delete"])),
|
|
1238
|
-
onContextmenu:
|
|
1368
|
+
onContextmenu: C[6] || (C[6] = F(() => {
|
|
1239
1369
|
}, ["prevent"]))
|
|
1240
1370
|
}, [
|
|
1241
|
-
|
|
1242
|
-
(i(!0),
|
|
1243
|
-
key:
|
|
1371
|
+
l("div", Ps, [
|
|
1372
|
+
(i(!0), d(S, null, D(Pe.value, (v) => (i(), d(S, {
|
|
1373
|
+
key: v.id
|
|
1244
1374
|
}, [
|
|
1245
|
-
a.value.state?.hidden ? (i(),
|
|
1246
|
-
|
|
1375
|
+
a.value.state?.hidden ? (i(), d("div", Us, [
|
|
1376
|
+
v.port ? (i(), d("div", {
|
|
1247
1377
|
key: 0,
|
|
1248
|
-
id:
|
|
1249
|
-
title:
|
|
1378
|
+
id: v.id,
|
|
1379
|
+
title: v.name,
|
|
1250
1380
|
class: "baklava-node-interface --output --connected"
|
|
1251
|
-
}, [...
|
|
1252
|
-
|
|
1253
|
-
])], 8,
|
|
1254
|
-
])) :
|
|
1381
|
+
}, [...C[7] || (C[7] = [
|
|
1382
|
+
l("div", { class: "__port" }, null, -1)
|
|
1383
|
+
])], 8, Hs)) : x("", !0)
|
|
1384
|
+
])) : X(c.$slots, "nodeInterface", {
|
|
1255
1385
|
key: 1,
|
|
1256
1386
|
type: "output",
|
|
1257
1387
|
node: a.value,
|
|
1258
|
-
intf:
|
|
1388
|
+
intf: v
|
|
1259
1389
|
}, () => [
|
|
1260
|
-
z(
|
|
1390
|
+
z(k(n), {
|
|
1261
1391
|
node: a.value,
|
|
1262
|
-
intf:
|
|
1263
|
-
title:
|
|
1392
|
+
intf: v,
|
|
1393
|
+
title: v.type
|
|
1264
1394
|
}, null, 8, ["node", "intf", "title"])
|
|
1265
1395
|
])
|
|
1266
1396
|
], 64))), 128))
|
|
1267
1397
|
]),
|
|
1268
|
-
|
|
1269
|
-
(i(!0),
|
|
1270
|
-
key:
|
|
1398
|
+
l("div", As, [
|
|
1399
|
+
(i(!0), d(S, null, D(Re.value, (v) => (i(), d(S, {
|
|
1400
|
+
key: v.id
|
|
1271
1401
|
}, [
|
|
1272
|
-
a.value.state?.hidden ? (i(),
|
|
1273
|
-
|
|
1402
|
+
a.value.state?.hidden ? (i(), d("div", Ds, [
|
|
1403
|
+
v.port ? (i(), d("div", {
|
|
1274
1404
|
key: 0,
|
|
1275
|
-
id:
|
|
1276
|
-
title:
|
|
1405
|
+
id: v.id,
|
|
1406
|
+
title: v.name,
|
|
1277
1407
|
class: "baklava-node-interface --input --connected"
|
|
1278
|
-
}, [...
|
|
1279
|
-
|
|
1280
|
-
])], 8,
|
|
1281
|
-
])) :
|
|
1408
|
+
}, [...C[8] || (C[8] = [
|
|
1409
|
+
l("div", { class: "__port" }, null, -1)
|
|
1410
|
+
])], 8, Fs)) : x("", !0)
|
|
1411
|
+
])) : X(c.$slots, "nodeInterface", {
|
|
1282
1412
|
key: 1,
|
|
1283
1413
|
node: a.value,
|
|
1284
|
-
intf:
|
|
1414
|
+
intf: v,
|
|
1285
1415
|
type: "input"
|
|
1286
1416
|
}, () => [
|
|
1287
|
-
z(
|
|
1417
|
+
z(k(n), {
|
|
1288
1418
|
node: a.value,
|
|
1289
|
-
intf:
|
|
1290
|
-
title:
|
|
1419
|
+
intf: v,
|
|
1420
|
+
title: v.type
|
|
1291
1421
|
}, null, 8, ["node", "intf", "title"])
|
|
1292
1422
|
])
|
|
1293
1423
|
], 64))), 128))
|
|
1294
1424
|
])
|
|
1295
1425
|
], 34)
|
|
1296
|
-
], 46,
|
|
1426
|
+
], 46, js));
|
|
1297
1427
|
}
|
|
1298
|
-
}),
|
|
1428
|
+
}), Xs = ["title"], Ys = {
|
|
1299
1429
|
key: 0,
|
|
1300
1430
|
class: "__label"
|
|
1301
|
-
}, Ie = /* @__PURE__ */
|
|
1431
|
+
}, Ie = /* @__PURE__ */ R({
|
|
1302
1432
|
__name: "Checkbox",
|
|
1303
1433
|
props: {
|
|
1304
1434
|
disabled: { type: Boolean },
|
|
@@ -1309,152 +1439,156 @@ const Bs = /* @__PURE__ */ $(Es, [["render", Ss]]), Vs = ["id", "data-node-type"
|
|
|
1309
1439
|
emits: ["update:modelValue"],
|
|
1310
1440
|
setup(s, { emit: e }) {
|
|
1311
1441
|
const t = e;
|
|
1312
|
-
return (n, o) => (i(),
|
|
1313
|
-
class:
|
|
1442
|
+
return (n, o) => (i(), d("div", {
|
|
1443
|
+
class: P(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue, "--disabled": s.disabled }]),
|
|
1314
1444
|
title: s.name,
|
|
1315
1445
|
onClick: o[0] || (o[0] = (a) => t("update:modelValue", !s.modelValue))
|
|
1316
1446
|
}, [
|
|
1317
|
-
o[1] || (o[1] =
|
|
1318
|
-
|
|
1447
|
+
o[1] || (o[1] = l("div", { class: "__checkmark-container" }, [
|
|
1448
|
+
l("svg", {
|
|
1319
1449
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1320
1450
|
width: "18",
|
|
1321
1451
|
height: "18",
|
|
1322
1452
|
viewBox: "0 0 18 18"
|
|
1323
1453
|
}, [
|
|
1324
|
-
|
|
1454
|
+
l("path", {
|
|
1325
1455
|
class: "__checkmark",
|
|
1326
1456
|
d: "M 6 5 L 6 10 L 16 10",
|
|
1327
1457
|
transform: "rotate(-45 10 10)"
|
|
1328
1458
|
})
|
|
1329
1459
|
])
|
|
1330
1460
|
], -1)),
|
|
1331
|
-
s.name ? (i(),
|
|
1332
|
-
], 10,
|
|
1461
|
+
s.name ? (i(), d("div", Ys, j(s.name), 1)) : x("", !0)
|
|
1462
|
+
], 10, Xs));
|
|
1333
1463
|
}
|
|
1334
|
-
}),
|
|
1464
|
+
}), Ks = { class: "__header" }, qs = { class: "__node-name" }, Js = { class: "__interfaces" }, Qs = { class: "__inputs" }, Zs = { style: { display: "flex" } }, en = { class: "__outputs" }, tn = {
|
|
1335
1465
|
key: 0,
|
|
1336
1466
|
class: "__interface"
|
|
1337
|
-
},
|
|
1467
|
+
}, sn = { style: { display: "flex" } }, nn = /* @__PURE__ */ R({
|
|
1338
1468
|
__name: "CodeGraphSidebar",
|
|
1339
1469
|
setup(s) {
|
|
1340
|
-
const { viewModel: e } =
|
|
1341
|
-
let
|
|
1342
|
-
const
|
|
1343
|
-
const
|
|
1344
|
-
return t.value.nodes.find((
|
|
1345
|
-
}),
|
|
1470
|
+
const { viewModel: e } = K(), { graph: t } = ae(), n = V(null), o = Oe(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
|
|
1471
|
+
let r = 0, u = 0;
|
|
1472
|
+
const p = b(() => {
|
|
1473
|
+
const m = t.value.sidebar.nodeId;
|
|
1474
|
+
return t.value.nodes.find((w) => w.id === m);
|
|
1475
|
+
}), _ = b(() => p.value), g = b(() => ({
|
|
1346
1476
|
width: `${o.value}px`
|
|
1347
|
-
})),
|
|
1477
|
+
})), I = b(() => _.value ? Object.values(_.value.inputs).filter((m) => m.displayInSidebar && m.component) : []), G = b(() => _.value ? Object.values(_.value.outputs).filter((m) => m.displayInSidebar && m.component) : []), N = () => {
|
|
1348
1478
|
t.value.sidebar.visible = !1;
|
|
1349
|
-
},
|
|
1350
|
-
|
|
1351
|
-
},
|
|
1352
|
-
|
|
1479
|
+
}, y = () => {
|
|
1480
|
+
p.value?.events.update.emit(null);
|
|
1481
|
+
}, f = (m) => {
|
|
1482
|
+
r = o.value, u = m.clientX, window.addEventListener("mousemove", O), window.addEventListener(
|
|
1353
1483
|
"mouseup",
|
|
1354
1484
|
() => {
|
|
1355
|
-
window.removeEventListener("mousemove",
|
|
1485
|
+
window.removeEventListener("mousemove", O);
|
|
1356
1486
|
},
|
|
1357
1487
|
{ once: !0 }
|
|
1358
1488
|
);
|
|
1359
|
-
},
|
|
1360
|
-
const
|
|
1361
|
-
let M =
|
|
1362
|
-
M < 300 ? M = 300 : M > 0.9 *
|
|
1489
|
+
}, O = (m) => {
|
|
1490
|
+
const w = n.value?.parentElement?.getBoundingClientRect().width ?? 500, h = m.clientX - u;
|
|
1491
|
+
let M = r - h;
|
|
1492
|
+
M < 300 ? M = 300 : M > 0.9 * w && (M = 0.9 * w), o.value = M;
|
|
1363
1493
|
};
|
|
1364
|
-
return (
|
|
1365
|
-
class:
|
|
1366
|
-
style:
|
|
1494
|
+
return (m, w) => (i(), d("div", {
|
|
1495
|
+
class: P([{ "--open": k(t).sidebar.visible }, "baklava-sidebar"]),
|
|
1496
|
+
style: re(g.value),
|
|
1367
1497
|
ref_key: "el",
|
|
1368
1498
|
ref: n
|
|
1369
1499
|
}, [
|
|
1370
|
-
a.value ? (i(),
|
|
1500
|
+
a.value ? (i(), d("div", {
|
|
1371
1501
|
key: 0,
|
|
1372
1502
|
class: "__resizer",
|
|
1373
|
-
onMousedown:
|
|
1374
|
-
}, null, 32)) :
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1503
|
+
onMousedown: f
|
|
1504
|
+
}, null, 32)) : x("", !0),
|
|
1505
|
+
p.value ? (i(), d(S, { key: 1 }, [
|
|
1506
|
+
l("div", Ks, [
|
|
1507
|
+
l("button", {
|
|
1378
1508
|
tabindex: "-1",
|
|
1379
1509
|
class: "__close",
|
|
1380
1510
|
onClick: N
|
|
1381
1511
|
}, "×"),
|
|
1382
|
-
|
|
1383
|
-
|
|
1512
|
+
l("div", qs, [
|
|
1513
|
+
l("b", null, j(p.value.title), 1)
|
|
1384
1514
|
])
|
|
1385
1515
|
]),
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
(i(!0),
|
|
1389
|
-
key:
|
|
1516
|
+
l("div", Js, [
|
|
1517
|
+
l("div", Qs, [
|
|
1518
|
+
(i(!0), d(S, null, D(I.value, (h) => (i(), d("div", {
|
|
1519
|
+
key: h.id,
|
|
1390
1520
|
class: "__interface"
|
|
1391
1521
|
}, [
|
|
1392
|
-
|
|
1522
|
+
l("div", Zs, [
|
|
1393
1523
|
z(Ie, {
|
|
1394
|
-
modelValue:
|
|
1524
|
+
modelValue: h.hidden,
|
|
1395
1525
|
"onUpdate:modelValue": [
|
|
1396
|
-
(M) =>
|
|
1397
|
-
|
|
1526
|
+
(M) => h.hidden = M,
|
|
1527
|
+
w[0] || (w[0] = () => p.value?.events.update.emit(null))
|
|
1398
1528
|
],
|
|
1399
|
-
disabled: !
|
|
1529
|
+
disabled: !h.optional,
|
|
1400
1530
|
inversed: "",
|
|
1401
1531
|
style: { "padding-right": "8px" }
|
|
1402
1532
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
|
|
1403
|
-
(i(),
|
|
1404
|
-
modelValue:
|
|
1405
|
-
"onUpdate:modelValue": (M) =>
|
|
1406
|
-
node:
|
|
1407
|
-
intf:
|
|
1533
|
+
(i(), E(ke(h.component), {
|
|
1534
|
+
modelValue: h.value,
|
|
1535
|
+
"onUpdate:modelValue": (M) => h.value = M,
|
|
1536
|
+
node: p.value,
|
|
1537
|
+
intf: h,
|
|
1408
1538
|
style: { width: "100%" }
|
|
1409
1539
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
|
|
1410
1540
|
])
|
|
1411
1541
|
]))), 128))
|
|
1412
1542
|
]),
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
"onUpdate:modelValue":
|
|
1543
|
+
l("div", en, [
|
|
1544
|
+
_.value && _.value.state ? (i(), d("div", tn, [
|
|
1545
|
+
w[3] || (w[3] = l("label", null, "Variable name", -1)),
|
|
1546
|
+
ee(l("input", {
|
|
1547
|
+
"onUpdate:modelValue": w[1] || (w[1] = (h) => _.value.state.variableName = h),
|
|
1418
1548
|
type: "text",
|
|
1419
1549
|
class: "baklava-input",
|
|
1420
1550
|
title: "Variable name",
|
|
1421
|
-
onBlur:
|
|
1422
|
-
onKeydown:
|
|
1551
|
+
onBlur: y,
|
|
1552
|
+
onKeydown: ne(y, ["enter"])
|
|
1423
1553
|
}, null, 544), [
|
|
1424
|
-
[
|
|
1554
|
+
[te, _.value.state.variableName]
|
|
1425
1555
|
])
|
|
1426
|
-
])) :
|
|
1427
|
-
(i(!0),
|
|
1428
|
-
key:
|
|
1556
|
+
])) : x("", !0),
|
|
1557
|
+
(i(!0), d(S, null, D(G.value, (h) => (i(), d("div", {
|
|
1558
|
+
key: h.id,
|
|
1429
1559
|
class: "__interface"
|
|
1430
1560
|
}, [
|
|
1431
|
-
|
|
1561
|
+
l("div", sn, [
|
|
1432
1562
|
z(Ie, {
|
|
1433
|
-
modelValue:
|
|
1563
|
+
modelValue: h.hidden,
|
|
1434
1564
|
"onUpdate:modelValue": [
|
|
1435
|
-
(M) =>
|
|
1436
|
-
|
|
1565
|
+
(M) => h.hidden = M,
|
|
1566
|
+
w[2] || (w[2] = () => p.value?.events.update.emit(null))
|
|
1437
1567
|
],
|
|
1438
|
-
disabled: !
|
|
1568
|
+
disabled: !h.optional,
|
|
1439
1569
|
inversed: "",
|
|
1440
1570
|
style: { "padding-right": "8px" }
|
|
1441
1571
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
|
|
1442
|
-
(i(),
|
|
1443
|
-
modelValue:
|
|
1444
|
-
"onUpdate:modelValue": (M) =>
|
|
1445
|
-
node:
|
|
1446
|
-
intf:
|
|
1572
|
+
(i(), E(ke(h.component), {
|
|
1573
|
+
modelValue: h.value,
|
|
1574
|
+
"onUpdate:modelValue": (M) => h.value = M,
|
|
1575
|
+
node: p.value,
|
|
1576
|
+
intf: h,
|
|
1447
1577
|
style: { width: "100%" }
|
|
1448
1578
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
|
|
1449
1579
|
])
|
|
1450
1580
|
]))), 128))
|
|
1451
1581
|
])
|
|
1452
1582
|
]),
|
|
1453
|
-
|
|
1454
|
-
], 64)) :
|
|
1583
|
+
X(m.$slots, "codeEditor", { node: p.value })
|
|
1584
|
+
], 64)) : x("", !0)
|
|
1455
1585
|
], 6));
|
|
1456
1586
|
}
|
|
1457
|
-
})
|
|
1587
|
+
});
|
|
1588
|
+
function on(s, e) {
|
|
1589
|
+
return Object.fromEntries(Object.entries(s).filter(e));
|
|
1590
|
+
}
|
|
1591
|
+
const an = R({
|
|
1458
1592
|
props: {
|
|
1459
1593
|
type: {
|
|
1460
1594
|
type: String,
|
|
@@ -1466,150 +1600,151 @@ const Bs = /* @__PURE__ */ $(Es, [["render", Ss]]), Vs = ["id", "data-node-type"
|
|
|
1466
1600
|
}
|
|
1467
1601
|
},
|
|
1468
1602
|
setup(s) {
|
|
1469
|
-
const { viewModel: e } =
|
|
1603
|
+
const { viewModel: e } = K(), { switchGraph: t } = ae(), n = V(!1), o = b(() => s.type.startsWith(se));
|
|
1470
1604
|
return { showContextMenu: n, hasContextMenu: o, contextMenuItems: [
|
|
1471
1605
|
{ label: "Edit Subgraph", value: "editSubgraph" },
|
|
1472
1606
|
{ label: "Delete Subgraph", value: "deleteSubgraph" }
|
|
1473
1607
|
], openContextMenu: () => {
|
|
1474
1608
|
n.value = !0;
|
|
1475
|
-
}, onContextMenuClick: (
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1478
|
-
switch (
|
|
1609
|
+
}, onContextMenuClick: (p) => {
|
|
1610
|
+
const _ = s.type.substring(se.length), g = e.value.editor.graphTemplates.find((I) => I.id === _);
|
|
1611
|
+
if (g)
|
|
1612
|
+
switch (p) {
|
|
1479
1613
|
case "editSubgraph":
|
|
1480
|
-
t(
|
|
1614
|
+
t(g);
|
|
1481
1615
|
break;
|
|
1482
1616
|
case "deleteSubgraph":
|
|
1483
|
-
e.value.editor.removeGraphTemplate(
|
|
1617
|
+
e.value.editor.removeGraphTemplate(g);
|
|
1484
1618
|
break;
|
|
1485
1619
|
}
|
|
1486
1620
|
} };
|
|
1487
1621
|
}
|
|
1488
|
-
}),
|
|
1489
|
-
function
|
|
1490
|
-
return i(),
|
|
1622
|
+
}), rn = ["data-node-type"], dn = { class: "__title" }, ln = { class: "__title-label" };
|
|
1623
|
+
function un(s, e, t, n, o, a) {
|
|
1624
|
+
return i(), d("div", {
|
|
1491
1625
|
class: "baklava-node --palette",
|
|
1492
1626
|
"data-node-type": s.type
|
|
1493
1627
|
}, [
|
|
1494
|
-
|
|
1495
|
-
|
|
1628
|
+
l("div", dn, [
|
|
1629
|
+
l("div", ln, j(s.title), 1)
|
|
1496
1630
|
])
|
|
1497
|
-
], 8,
|
|
1631
|
+
], 8, rn);
|
|
1498
1632
|
}
|
|
1499
|
-
const
|
|
1633
|
+
const xe = /* @__PURE__ */ $(an, [["render", un]]), cn = {
|
|
1500
1634
|
class: "baklava-node --palette",
|
|
1501
1635
|
style: { "margin-top": "-20px", "margin-bottom": "20px" }
|
|
1502
|
-
},
|
|
1636
|
+
}, pn = {
|
|
1503
1637
|
key: 0,
|
|
1504
1638
|
style: { display: "flex", "justify-content": "space-between" }
|
|
1505
|
-
},
|
|
1639
|
+
}, hn = ["onClick"], mn = {
|
|
1506
1640
|
key: 0,
|
|
1507
1641
|
style: { margin: "auto 0", "font-size": "12px" }
|
|
1508
|
-
},
|
|
1642
|
+
}, vn = /* @__PURE__ */ R({
|
|
1509
1643
|
__name: "CodeNodePalette",
|
|
1510
1644
|
setup(s) {
|
|
1511
|
-
const { viewModel: e } =
|
|
1645
|
+
const { viewModel: e } = K(), { x: t, y: n } = xt(), { transform: o } = ct(), a = pt(e), r = _t("editorEl"), u = V(""), p = V(null), _ = () => u.value ? a.value.filter(
|
|
1512
1646
|
(N) => N.name.toLowerCase().includes(u.value.toLowerCase()) || Object.values(N.nodeTypes).some(
|
|
1513
|
-
(
|
|
1647
|
+
(y) => y.title.toLowerCase().includes(u.value.toLowerCase())
|
|
1514
1648
|
)
|
|
1515
|
-
) : a.value,
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1649
|
+
) : a.value, g = (N) => u.value ? on(N, (y) => {
|
|
1650
|
+
const f = y[1];
|
|
1651
|
+
return f.category.includes(u.value.toLowerCase()) || f.title?.toLowerCase().includes(u.value.toLowerCase());
|
|
1652
|
+
}) : N, I = b(() => {
|
|
1653
|
+
if (!p.value || !r?.value) return {};
|
|
1654
|
+
const { left: N, top: y } = r.value.getBoundingClientRect();
|
|
1520
1655
|
return {
|
|
1521
|
-
top: `${n.value -
|
|
1656
|
+
top: `${n.value - y}px`,
|
|
1522
1657
|
left: `${t.value - N}px`
|
|
1523
1658
|
};
|
|
1524
|
-
}),
|
|
1525
|
-
|
|
1659
|
+
}), G = (N, y) => {
|
|
1660
|
+
p.value = {
|
|
1526
1661
|
type: N,
|
|
1527
|
-
nodeInformation:
|
|
1662
|
+
nodeInformation: y
|
|
1528
1663
|
};
|
|
1529
|
-
const
|
|
1530
|
-
const
|
|
1531
|
-
e.value.displayedGraph.addNode(
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1664
|
+
const f = () => {
|
|
1665
|
+
const O = q(new y.type());
|
|
1666
|
+
e.value.displayedGraph.addNode(O);
|
|
1667
|
+
const m = r.value.getBoundingClientRect(), [w, h] = o(t.value - m.left, n.value - m.top);
|
|
1668
|
+
O.position.x = w, O.position.y = h, p.value = null, document.removeEventListener("pointerup", f);
|
|
1534
1669
|
};
|
|
1535
|
-
document.addEventListener("pointerup",
|
|
1670
|
+
document.addEventListener("pointerup", f);
|
|
1536
1671
|
};
|
|
1537
|
-
return (N,
|
|
1538
|
-
|
|
1539
|
-
class:
|
|
1540
|
-
onContextmenu:
|
|
1672
|
+
return (N, y) => (i(), d(S, null, [
|
|
1673
|
+
l("div", {
|
|
1674
|
+
class: P([{ "--open": k(e).settings.palette.enabled }, "baklava-node-palette"]),
|
|
1675
|
+
onContextmenu: y[1] || (y[1] = F(() => {
|
|
1541
1676
|
}, ["stop", "prevent"]))
|
|
1542
1677
|
}, [
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
"onUpdate:modelValue":
|
|
1678
|
+
l("div", cn, [
|
|
1679
|
+
ee(l("input", {
|
|
1680
|
+
"onUpdate:modelValue": y[0] || (y[0] = (f) => u.value = f),
|
|
1546
1681
|
type: "text",
|
|
1547
1682
|
class: "baklava-input",
|
|
1548
1683
|
title: "Filter nodes",
|
|
1549
|
-
onKeyup:
|
|
1684
|
+
onKeyup: _
|
|
1550
1685
|
}, null, 544), [
|
|
1551
|
-
[
|
|
1686
|
+
[te, u.value]
|
|
1552
1687
|
])
|
|
1553
1688
|
]),
|
|
1554
|
-
(i(!0),
|
|
1555
|
-
key:
|
|
1689
|
+
(i(!0), d(S, null, D(_(), (f) => (i(), d("section", {
|
|
1690
|
+
key: f.name
|
|
1556
1691
|
}, [
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
onClick: (
|
|
1692
|
+
f.name !== "default" ? (i(), d("h3", pn, [
|
|
1693
|
+
l("div", {
|
|
1694
|
+
onClick: (O) => u.value = f.name,
|
|
1560
1695
|
style: { cursor: "pointer" }
|
|
1561
|
-
}, j(
|
|
1562
|
-
|
|
1563
|
-
])) :
|
|
1564
|
-
(i(!0),
|
|
1565
|
-
key:
|
|
1566
|
-
type:
|
|
1567
|
-
title:
|
|
1568
|
-
onPointerdown: (
|
|
1696
|
+
}, j(f.name), 9, hn),
|
|
1697
|
+
Object.keys(g(f.nodeTypes)).length < Object.values(f.nodeTypes).length ? (i(), d("div", mn, " ( " + j(Object.keys(g(f.nodeTypes)).length) + " / " + j(Object.values(f.nodeTypes).length) + " ) ", 1)) : x("", !0)
|
|
1698
|
+
])) : x("", !0),
|
|
1699
|
+
(i(!0), d(S, null, D(g(f.nodeTypes), (O, m) => (i(), E(xe, {
|
|
1700
|
+
key: m,
|
|
1701
|
+
type: m,
|
|
1702
|
+
title: O.title,
|
|
1703
|
+
onPointerdown: (w) => G(m, O)
|
|
1569
1704
|
}, null, 8, ["type", "title", "onPointerdown"]))), 128))
|
|
1570
1705
|
]))), 128))
|
|
1571
1706
|
], 34),
|
|
1572
|
-
z(
|
|
1573
|
-
default:
|
|
1574
|
-
|
|
1707
|
+
z(yt, { name: "fade" }, {
|
|
1708
|
+
default: W(() => [
|
|
1709
|
+
p.value ? (i(), d("div", {
|
|
1575
1710
|
key: 0,
|
|
1576
1711
|
class: "baklava-dragged-node",
|
|
1577
|
-
style:
|
|
1712
|
+
style: re(I.value)
|
|
1578
1713
|
}, [
|
|
1579
|
-
z(
|
|
1580
|
-
type:
|
|
1581
|
-
title:
|
|
1714
|
+
z(xe, {
|
|
1715
|
+
type: p.value.type,
|
|
1716
|
+
title: p.value.nodeInformation.title
|
|
1582
1717
|
}, null, 8, ["type", "title"])
|
|
1583
|
-
], 4)) :
|
|
1718
|
+
], 4)) : x("", !0)
|
|
1584
1719
|
]),
|
|
1585
1720
|
_: 1
|
|
1586
1721
|
})
|
|
1587
1722
|
], 64));
|
|
1588
1723
|
}
|
|
1589
|
-
}),
|
|
1724
|
+
}), Pn = /* @__PURE__ */ R({
|
|
1590
1725
|
__name: "CodeGraphEditor",
|
|
1591
1726
|
props: {
|
|
1592
1727
|
viewModel: {}
|
|
1593
1728
|
},
|
|
1594
1729
|
setup(s) {
|
|
1595
|
-
const t =
|
|
1596
|
-
return
|
|
1730
|
+
const t = Oe(s, "viewModel"), n = (o) => o.events.update.emit(null);
|
|
1731
|
+
return ie(() => {
|
|
1597
1732
|
t.value.subscribe(), t.value.engine.start();
|
|
1598
|
-
}),
|
|
1733
|
+
}), Ct(() => {
|
|
1599
1734
|
t.value.unsubscribe(), t.value.engine.stop();
|
|
1600
|
-
}), (o, a) => (i(),
|
|
1601
|
-
palette:
|
|
1602
|
-
z(
|
|
1735
|
+
}), (o, a) => (i(), E(k(ht), { "view-model": t.value }, {
|
|
1736
|
+
palette: W(() => [
|
|
1737
|
+
z(vn)
|
|
1603
1738
|
]),
|
|
1604
|
-
node:
|
|
1605
|
-
z(
|
|
1606
|
-
onUpdate: (u) => n(
|
|
1739
|
+
node: W((r) => [
|
|
1740
|
+
z(Ws, It(r, {
|
|
1741
|
+
onUpdate: (u) => n(r.node)
|
|
1607
1742
|
}), null, 16, ["onUpdate"])
|
|
1608
1743
|
]),
|
|
1609
|
-
sidebar:
|
|
1610
|
-
z(
|
|
1611
|
-
codeEditor:
|
|
1612
|
-
|
|
1744
|
+
sidebar: W((r) => [
|
|
1745
|
+
z(nn, kt(wt(r)), {
|
|
1746
|
+
codeEditor: W(({ node: u }) => [
|
|
1747
|
+
X(o.$slots, "sidebarCodeEditor", { node: u })
|
|
1613
1748
|
]),
|
|
1614
1749
|
_: 3
|
|
1615
1750
|
}, 16)
|
|
@@ -1618,147 +1753,138 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
|
|
|
1618
1753
|
}, 8, ["view-model"]));
|
|
1619
1754
|
}
|
|
1620
1755
|
});
|
|
1621
|
-
function
|
|
1622
|
-
const e =
|
|
1623
|
-
e.code = s?.code ? new s.code(e) : new
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
t
|
|
1627
|
-
|
|
1756
|
+
function Un(s) {
|
|
1757
|
+
const e = mt(s?.existingEditor);
|
|
1758
|
+
return e.code = s?.code ? new s.code(e) : new Rt(e), e.editor.addGraphTemplate = function(t) {
|
|
1759
|
+
if (this.events.beforeAddGraphTemplate.emit(t).prevented)
|
|
1760
|
+
return;
|
|
1761
|
+
this._graphTemplates.push(t), this.graphTemplateEvents.addTarget(t.events), this.graphTemplateHooks.addTarget(t.hooks);
|
|
1762
|
+
const n = Lt(t);
|
|
1763
|
+
this.registerNodeType(n, { category: "Subgraphs", title: t.name }), this.events.addGraphTemplate.emit(t);
|
|
1764
|
+
}, fn(e), gn(e), e.state = q({
|
|
1628
1765
|
modules: {},
|
|
1629
1766
|
token: null
|
|
1630
1767
|
}), e.init = () => {
|
|
1631
|
-
e.unsubscribe(), e.engine = new
|
|
1632
|
-
}, e.loadEditor = (
|
|
1633
|
-
e.engine?.pause(), e.code.clear(), e.editor.load(
|
|
1768
|
+
e.unsubscribe(), e.engine = new vt(e.editor);
|
|
1769
|
+
}, e.loadEditor = (t) => {
|
|
1770
|
+
e.engine?.pause(), e.code.clear(), e.editor.load(t), e.commandHandler.executeCommand(Z.CLEAR_CLIPBOARD_COMMAND), e.commandHandler.executeCommand(Z.CLEAR_HISTORY_COMMAND), e.engine?.resume(), e.engine?.runOnce(void 0);
|
|
1634
1771
|
}, e.newGraph = () => {
|
|
1635
|
-
e.engine?.pause(), e.code.clear(), e.editor.graph.id =
|
|
1772
|
+
e.engine?.pause(), e.code.clear(), e.editor.graph.id = Te(), e.engine?.resume(), e.engine?.runOnce(void 0);
|
|
1636
1773
|
}, e.subscribe = () => {
|
|
1637
1774
|
e.state.token && e.unsubscribe();
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
}),
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1775
|
+
const t = Symbol(), n = e.displayedGraph;
|
|
1776
|
+
n.events.addNode.subscribe(t, (o) => {
|
|
1777
|
+
!o.subgraph && o.isCodeNode && (o.code = e.code);
|
|
1778
|
+
}), n.events.addConnection.subscribe(t, (o) => {
|
|
1779
|
+
const a = e.code.findNodeById(o.to.nodeId);
|
|
1780
|
+
a && a.isCodeNode && a.onConnected();
|
|
1781
|
+
const r = e.code.findNodeById(o.from.nodeId);
|
|
1782
|
+
r && r.isCodeNode && r.onConnected();
|
|
1783
|
+
}), n.events.removeConnection.subscribe(t, (o) => {
|
|
1784
|
+
const a = e.code.findNodeById(o.to.nodeId);
|
|
1785
|
+
a && a.isCodeNode && a.onUnconnected();
|
|
1786
|
+
const r = e.code.findNodeById(o.from.nodeId);
|
|
1787
|
+
r && r.isCodeNode && r.onUnconnected();
|
|
1788
|
+
}), e.engine.events.beforeRun.subscribe(t, () => {
|
|
1646
1789
|
e.engine.pause(), e.code && (e.code.updateCodeNodes(), e.code.sortNodes(), e.code.updateCodeTemplates(), e.code.resetInputInterfaceScript()), e.engine.resume();
|
|
1647
|
-
}), e.engine.events.beforeNodeCalculation.subscribe(
|
|
1790
|
+
}), e.engine.events.beforeNodeCalculation.subscribe(t, (o) => {
|
|
1648
1791
|
e.engine.pause();
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1651
|
-
}), e.engine.events.afterRun.subscribe(
|
|
1652
|
-
e.engine.pause(),
|
|
1653
|
-
}), e.state.token =
|
|
1792
|
+
const a = o.node;
|
|
1793
|
+
a.isCodeNode && (a.updateOutputNames(), a.updateConnectedInputInterfaces()), e.engine.resume();
|
|
1794
|
+
}), e.engine.events.afterRun.subscribe(t, () => {
|
|
1795
|
+
e.engine.pause(), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
|
|
1796
|
+
}), e.state.token = t;
|
|
1654
1797
|
}, e.unsubscribe = () => {
|
|
1655
1798
|
if (!e.state.token) return;
|
|
1656
|
-
const
|
|
1657
|
-
e.displayedGraph.events.addNode.unsubscribe(
|
|
1799
|
+
const t = e.state.token;
|
|
1800
|
+
e.displayedGraph.events.addNode.unsubscribe(t), e.displayedGraph.events.addConnection.unsubscribe(t), e.engine.events.beforeRun.unsubscribe(t), e.engine.events.beforeNodeCalculation.unsubscribe(t), e.engine.events.afterRun.unsubscribe(t), e.state.token = null;
|
|
1658
1801
|
}, e;
|
|
1659
1802
|
}
|
|
1660
|
-
const
|
|
1803
|
+
const fn = (s) => {
|
|
1661
1804
|
const e = "TOGGLE_PALETTE";
|
|
1662
1805
|
s.commandHandler.registerCommand(e, {
|
|
1663
1806
|
execute: () => s.settings.palette.enabled = !s.settings.palette.enabled,
|
|
1664
1807
|
canExecute: () => !0
|
|
1808
|
+
}), s.settings.toolbar.commands.unshift({
|
|
1809
|
+
command: e,
|
|
1810
|
+
title: "Toggle palette",
|
|
1811
|
+
// Tooltip text
|
|
1812
|
+
icon: b(() => s.settings.palette.enabled ? Zt : ns)
|
|
1665
1813
|
});
|
|
1666
1814
|
const t = "CLEAR_ALL";
|
|
1667
1815
|
s.commandHandler.registerCommand(t, {
|
|
1668
1816
|
execute: () => s.code.clear(),
|
|
1669
1817
|
canExecute: () => s.displayedGraph.nodes.length > 0
|
|
1818
|
+
}), s.settings.toolbar.commands.push({
|
|
1819
|
+
command: t,
|
|
1820
|
+
title: "Clear all",
|
|
1821
|
+
// Tooltip text
|
|
1822
|
+
icon: b(() => zs)
|
|
1670
1823
|
});
|
|
1671
1824
|
const n = "TOGGLE_MINIMAP";
|
|
1672
1825
|
s.commandHandler.registerCommand(n, {
|
|
1673
1826
|
execute: () => s.settings.enableMinimap = !s.settings.enableMinimap,
|
|
1674
1827
|
canExecute: () => s.displayedGraph.nodes.length > 1
|
|
1675
|
-
}), s.settings.toolbar.commands
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
{
|
|
1684
|
-
command: t,
|
|
1685
|
-
title: "Clear all",
|
|
1686
|
-
// Tooltip text
|
|
1687
|
-
icon: Bs
|
|
1688
|
-
},
|
|
1689
|
-
{
|
|
1690
|
-
command: n,
|
|
1691
|
-
title: "Toggle minimap",
|
|
1692
|
-
// Tooltip text
|
|
1693
|
-
icon: b(() => s.settings.enableMinimap ? Is : Cs)
|
|
1694
|
-
}
|
|
1695
|
-
];
|
|
1696
|
-
}, Q = {
|
|
1697
|
-
enableMinimap: !1,
|
|
1698
|
-
toolbar: {
|
|
1699
|
-
enabled: !0
|
|
1700
|
-
},
|
|
1701
|
-
palette: {
|
|
1702
|
-
enabled: !0
|
|
1703
|
-
},
|
|
1704
|
-
sidebar: {
|
|
1705
|
-
enabled: !0,
|
|
1706
|
-
resizable: !0,
|
|
1707
|
-
width: 350
|
|
1708
|
-
},
|
|
1709
|
-
displayValueOnHover: !1
|
|
1828
|
+
}), s.settings.toolbar.commands.push({
|
|
1829
|
+
command: n,
|
|
1830
|
+
title: "Toggle minimap",
|
|
1831
|
+
// Tooltip text
|
|
1832
|
+
icon: b(() => s.settings.enableMinimap ? Ms : ws)
|
|
1833
|
+
});
|
|
1834
|
+
}, gn = (s) => {
|
|
1835
|
+
s.settings.nodes.defaultWidth = 400;
|
|
1710
1836
|
};
|
|
1711
1837
|
export {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
Xt as DotsVertical,
|
|
1838
|
+
Ee as AbstractCodeNode,
|
|
1839
|
+
xn as CheckboxInterface,
|
|
1840
|
+
Rt as Code,
|
|
1841
|
+
Pn as CodeGraphEditor,
|
|
1842
|
+
Se as CodeNode,
|
|
1843
|
+
Q as CodeNodeInputInterface,
|
|
1844
|
+
L as CodeNodeInterface,
|
|
1845
|
+
de as CodeNodeInterfaceComponent,
|
|
1846
|
+
Ge as CodeNodeOutputInterface,
|
|
1847
|
+
Ft as CodeVariable,
|
|
1848
|
+
Kt as DotsVertical,
|
|
1724
1849
|
jt as DynamicCodeNode,
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1850
|
+
jn as GRAPH_NODE_TYPE_PREFIX,
|
|
1851
|
+
Nn as IntegerInterface,
|
|
1852
|
+
Zt as LayoutSidebarLeftCollapse,
|
|
1853
|
+
ns as LayoutSidebarLeftExpand,
|
|
1854
|
+
rs as LayoutSidebarRight,
|
|
1855
|
+
cs as LayoutSidebarRightCollapse,
|
|
1856
|
+
vs as LayoutSidebarRightExpand,
|
|
1857
|
+
Mn as ListInputInterface,
|
|
1858
|
+
_s as LockCode,
|
|
1859
|
+
$n as NumberInterface,
|
|
1860
|
+
ws as Schema,
|
|
1861
|
+
Ms as SchemaOff,
|
|
1862
|
+
On as SelectInterface,
|
|
1863
|
+
Tn as SliderInterface,
|
|
1864
|
+
En as TextInputInterface,
|
|
1739
1865
|
zt as TextInputInterfaceComponent,
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1866
|
+
Sn as TextareaInputInterface,
|
|
1867
|
+
Es as TransitionBottom,
|
|
1868
|
+
zs as TrashOff,
|
|
1869
|
+
Bn as TupleInputInterface,
|
|
1870
|
+
In as addDefaultInterfaceTypes,
|
|
1871
|
+
fn as addToolbarCommands,
|
|
1872
|
+
Ve as booleanType,
|
|
1873
|
+
Lt as createCodeGraphNodeType,
|
|
1874
|
+
Vn as defineCodeNode,
|
|
1875
|
+
zn as defineDynamicCodeNode,
|
|
1876
|
+
Ot as dictType,
|
|
1877
|
+
Nt as formatInputs,
|
|
1878
|
+
oe as getCodeNodes,
|
|
1879
|
+
Ln as getPositionAtColumn,
|
|
1880
|
+
Rn as getPositionBeforeNode,
|
|
1881
|
+
ze as listType,
|
|
1882
|
+
Be as loadNodeState,
|
|
1883
|
+
U as nodeType,
|
|
1884
|
+
le as numberType,
|
|
1885
|
+
Mt as saveNodeState,
|
|
1886
|
+
ue as stringType,
|
|
1887
|
+
je as tupleType,
|
|
1888
|
+
gn as updateSettings,
|
|
1889
|
+
Un as useCodeGraph
|
|
1764
1890
|
};
|