@babsey/code-graph 0.0.9 → 0.0.10
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 +209 -204
- package/dist/code-graph.umd.cjs +1 -1
- package/dist/{lib/index.d.ts → index.d.ts} +1 -0
- package/dist/interfaceTypes/default.d.ts +8 -0
- package/dist/interfaceTypes/index.d.ts +1 -0
- package/package.json +2 -2
- /package/dist/{lib/code.d.ts → code.d.ts} +0 -0
- /package/dist/{lib/codeNode → codeNode}/codeNode.d.ts +0 -0
- /package/dist/{lib/codeNode → codeNode}/defineCodeNode.d.ts +0 -0
- /package/dist/{lib/codeNode → codeNode}/dynamicCodeNode.d.ts +0 -0
- /package/dist/{lib/codeNode → codeNode}/index.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/baseNumericInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/button/buttonInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/checkbox/checkboxInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/codeInput/codeInputInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/codeNode/CodeNodeInterface.vue.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/codeNode/codeNodeInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/codeOutput/codeOutputInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/index.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/integer/integerInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/number/numberInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/select/selectInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/slider/sliderInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/text/textInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/textInput/textInputInterface.d.ts +0 -0
- /package/dist/{lib/codeNodeInterfaces → codeNodeInterfaces}/textareaInput/textareaInputInterface.d.ts +0 -0
- /package/dist/{lib/components → components}/CodeGraphEditor.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/index.d.ts +0 -0
- /package/dist/{lib/components → components}/node/CodeGraphNode.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/nodeInterface/CodeGraphNodeInterface.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/nodePalette/CodeNodePalette.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/nodePalette/PaletteEntry.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/sidebar/Checkbox.vue.d.ts +0 -0
- /package/dist/{lib/components → components}/sidebar/CodeGraphSidebar.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/LayoutSidebarLeftCollapse.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/LayoutSidebarLeftExpand.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/LayoutSidebarRight.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/LayoutSidebarRightCollapse.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/LayoutSidebarRightExpand.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/Schema.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/SchemaOff.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/TrashOff.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/VerticalDots.vue.d.ts +0 -0
- /package/dist/{lib/icons → icons}/index.d.ts +0 -0
- /package/dist/{lib/settings.d.ts → settings.d.ts} +0 -0
- /package/dist/{lib/viewModel.d.ts → viewModel.d.ts} +0 -0
package/dist/code-graph.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AbstractNode as
|
|
2
|
-
import { ButtonInterfaceComponent as
|
|
1
|
+
import { AbstractNode as Le, NodeInterfaceType as P, BaklavaInterfaceTypes as Ge, NodeInterface as Ue, ButtonInterfaceComponent as je, CheckboxInterfaceComponent as Re, IntegerInterfaceComponent as Pe, NumberInterfaceComponent as De, SelectInterfaceComponent as Ae, SliderInterfaceComponent as He, TextInputInterfaceComponent as ge, TextareaInputInterfaceComponent as Fe, setType as j, allowMultipleConnections as Y, IntegerInterface as We, TextInputInterface as Xe, displayInSidebar as Ye, sortTopologically as Je, useViewModel as F, useTemporaryConnection as qe, Components as ve, useGraph as K, GRAPH_NODE_TYPE_PREFIX as J, useTransform as Qe, useNodeCategories as Ze, BaklavaEditor as Ke, DEFAULT_TOOLBAR_COMMANDS as et, useBaklava as tt, DependencyEngine as st, applyResult as nt } from "baklavajs";
|
|
2
|
+
import { ButtonInterfaceComponent as cn, CheckboxInterfaceComponent as pn, IntegerInterfaceComponent as hn, NumberInterfaceComponent as vn, SelectInterfaceComponent as mn, SliderInterfaceComponent as fn, TextInputInterfaceComponent as gn, TextareaInputInterfaceComponent as bn } from "baklavajs";
|
|
3
3
|
import be from "mustache";
|
|
4
|
-
import { reactive as R, defineComponent as G, createElementBlock as r, openBlock as i, toDisplayString as L, markRaw as $, ref as E, computed as f, onMounted as ee, onUpdated as _e, normalizeClass as U, createCommentVNode as N, createElementVNode as l, unref as _, renderSlot as q, createStaticVNode as te, onBeforeUnmount as
|
|
5
|
-
import
|
|
6
|
-
import { v4 as
|
|
7
|
-
import { usePointer as
|
|
8
|
-
class
|
|
4
|
+
import { reactive as R, defineComponent as G, createElementBlock as r, openBlock as i, toDisplayString as L, markRaw as $, ref as E, computed as f, onMounted as ee, onUpdated as _e, normalizeClass as U, createCommentVNode as N, createElementVNode as l, unref as _, renderSlot as q, createStaticVNode as te, onBeforeUnmount as ot, normalizeStyle as se, withModifiers as D, createBlock as V, withDirectives as ne, Fragment as T, createTextVNode as at, createVNode as S, withKeys as Q, vModelText as oe, renderList as A, nextTick as it, toRef as ye, resolveDynamicComponent as rt, inject as lt, Transition as dt, withCtx as X, onUnmounted as ut, normalizeProps as ct, guardReactiveProps as pt, mergeProps as ht } from "vue";
|
|
5
|
+
import vt from "toposort";
|
|
6
|
+
import { v4 as mt } from "uuid";
|
|
7
|
+
import { usePointer as ft } from "@vueuse/core";
|
|
8
|
+
class gt extends Le {
|
|
9
9
|
state;
|
|
10
10
|
code;
|
|
11
11
|
isCodeNode = !0;
|
|
@@ -80,7 +80,7 @@ class vt extends Be {
|
|
|
80
80
|
this.outputs.code && (this.outputs.code.name = this.variableName);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
class we extends
|
|
83
|
+
class we extends gt {
|
|
84
84
|
/**
|
|
85
85
|
* The default implementation does nothing.
|
|
86
86
|
* Overwrite this method to do calculation.
|
|
@@ -94,7 +94,7 @@ class we extends vt {
|
|
|
94
94
|
}
|
|
95
95
|
save() {
|
|
96
96
|
const e = super.save();
|
|
97
|
-
return
|
|
97
|
+
return bt(this.graph, e), e;
|
|
98
98
|
}
|
|
99
99
|
updateModules(e) {
|
|
100
100
|
if (e)
|
|
@@ -115,7 +115,7 @@ const xe = (o, e) => {
|
|
|
115
115
|
}), Object.entries(e.outputs).forEach(([n, a]) => {
|
|
116
116
|
n !== "_node" && s.outputs[n] && (s.outputs[n].hidden = a.hidden);
|
|
117
117
|
});
|
|
118
|
-
},
|
|
118
|
+
}, bt = (o, e) => {
|
|
119
119
|
if (!o) return;
|
|
120
120
|
const t = o.findNodeById(e.id);
|
|
121
121
|
if (!t || t.subgraph) return;
|
|
@@ -125,11 +125,9 @@ const xe = (o, e) => {
|
|
|
125
125
|
}), Object.entries(e.outputs).forEach(([n, a]) => {
|
|
126
126
|
n !== "_node" && s.outputs[n] && (a.hidden = s.outputs[n].hidden);
|
|
127
127
|
});
|
|
128
|
-
}
|
|
129
|
-
new
|
|
130
|
-
|
|
131
|
-
new P("list");
|
|
132
|
-
const Y = new P("node"), ft = new P("number"), gt = new P("string"), bt = ["title"], ae = /* @__PURE__ */ G({
|
|
128
|
+
}, _t = new P("boolean"), yt = new P("dict"), wt = new P("list"), H = new P("node"), ke = new P("number"), Ce = new P("string"), Fs = (o) => {
|
|
129
|
+
new Ge(o.editor, { viewPlugin: o }).addTypes(Ce, H, ke, _t, yt, wt);
|
|
130
|
+
}, xt = ["title"], ae = /* @__PURE__ */ G({
|
|
133
131
|
__name: "CodeNodeInterface",
|
|
134
132
|
props: {
|
|
135
133
|
intf: {}
|
|
@@ -137,10 +135,10 @@ const Y = new P("node"), ft = new P("number"), gt = new P("string"), bt = ["titl
|
|
|
137
135
|
setup(o) {
|
|
138
136
|
return (e, t) => (i(), r("div", {
|
|
139
137
|
title: e.intf.state?.script
|
|
140
|
-
}, L(e.intf.name), 9,
|
|
138
|
+
}, L(e.intf.name), 9, xt));
|
|
141
139
|
}
|
|
142
140
|
});
|
|
143
|
-
class M extends
|
|
141
|
+
class M extends Ue {
|
|
144
142
|
optional = !1;
|
|
145
143
|
code;
|
|
146
144
|
state;
|
|
@@ -160,15 +158,15 @@ class M extends Ve {
|
|
|
160
158
|
// if (this.name !== '_node') this.setHidden(false);
|
|
161
159
|
// }
|
|
162
160
|
}
|
|
163
|
-
class
|
|
164
|
-
component = $(
|
|
161
|
+
class Ws extends M {
|
|
162
|
+
component = $(je);
|
|
165
163
|
callback;
|
|
166
164
|
constructor(e, t) {
|
|
167
165
|
super(e, void 0), this.callback = t, this.setPort(!1);
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
|
-
class
|
|
171
|
-
component = $(
|
|
168
|
+
class Xs extends M {
|
|
169
|
+
component = $(Re);
|
|
172
170
|
}
|
|
173
171
|
class ie extends M {
|
|
174
172
|
min;
|
|
@@ -180,19 +178,19 @@ class ie extends M {
|
|
|
180
178
|
return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
|
-
class
|
|
184
|
-
component = $(
|
|
181
|
+
class Ys extends ie {
|
|
182
|
+
component = $(Pe);
|
|
185
183
|
validate(e) {
|
|
186
184
|
return Number.isInteger(e) && super.validate(e);
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
|
-
class
|
|
187
|
+
class Js extends M {
|
|
190
188
|
isCodeInput = !0;
|
|
191
189
|
constructor(e = "", t) {
|
|
192
190
|
super(e, t), this.setComponent($(ae));
|
|
193
191
|
}
|
|
194
192
|
}
|
|
195
|
-
class
|
|
193
|
+
class kt extends M {
|
|
196
194
|
isCodeOutput = !0;
|
|
197
195
|
constructor(e = "", t = "") {
|
|
198
196
|
super(e, t), this.setComponent($(ae));
|
|
@@ -207,38 +205,38 @@ class _t extends M {
|
|
|
207
205
|
super.value = e, this.state.script = this.name.length > 0 ? this.name : this.value;
|
|
208
206
|
}
|
|
209
207
|
}
|
|
210
|
-
class
|
|
211
|
-
component = $(
|
|
208
|
+
class qs extends ie {
|
|
209
|
+
component = $(De);
|
|
212
210
|
}
|
|
213
|
-
class
|
|
214
|
-
component = $(
|
|
211
|
+
class Qs extends M {
|
|
212
|
+
component = $(Ae);
|
|
215
213
|
items;
|
|
216
214
|
constructor(e, t, s) {
|
|
217
215
|
super(e, t), this.items = s;
|
|
218
216
|
}
|
|
219
217
|
}
|
|
220
|
-
class
|
|
221
|
-
component = $(
|
|
218
|
+
class Zs extends ie {
|
|
219
|
+
component = $(He);
|
|
222
220
|
min;
|
|
223
221
|
max;
|
|
224
222
|
constructor(e, t, s, n) {
|
|
225
223
|
super(e, t, s, n), this.min = s, this.max = n;
|
|
226
224
|
}
|
|
227
225
|
}
|
|
228
|
-
class
|
|
226
|
+
class Ks extends M {
|
|
229
227
|
component = $(ge);
|
|
230
228
|
constructor(e, t) {
|
|
231
229
|
super(e, t), this.setPort(!1);
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
|
-
class
|
|
232
|
+
class en extends M {
|
|
235
233
|
isString = !0;
|
|
236
234
|
component = $(ge);
|
|
237
235
|
}
|
|
238
|
-
class
|
|
239
|
-
component = $(
|
|
236
|
+
class tn extends M {
|
|
237
|
+
component = $(Fe);
|
|
240
238
|
}
|
|
241
|
-
function
|
|
239
|
+
function sn(o) {
|
|
242
240
|
return class extends we {
|
|
243
241
|
type = o.type;
|
|
244
242
|
inputs = {};
|
|
@@ -246,10 +244,10 @@ function Qs(o) {
|
|
|
246
244
|
constructor() {
|
|
247
245
|
super(), this._title = o.title ?? o.type, this.updateModules(o.modules), o.codeTemplate && (this.state.codeTemplate = o.codeTemplate(this)), o.variableName && (this.state.variableName = o.variableName), this.addInput(
|
|
248
246
|
"_node",
|
|
249
|
-
new M("", []).use(j,
|
|
247
|
+
new M("", []).use(j, H).use(Y).setHidden(!0)
|
|
250
248
|
), this.addOutput(
|
|
251
249
|
"_node",
|
|
252
|
-
new M("", []).use(j,
|
|
250
|
+
new M("", []).use(j, H).use(Y).setHidden(!0)
|
|
253
251
|
), this.executeFactory("input", o.inputs), this.executeFactory("output", o.outputs), o.onCreate?.call(this);
|
|
254
252
|
}
|
|
255
253
|
calculate = o.calculate ? (e, t) => ({
|
|
@@ -273,7 +271,7 @@ function Qs(o) {
|
|
|
273
271
|
}
|
|
274
272
|
};
|
|
275
273
|
}
|
|
276
|
-
class
|
|
274
|
+
class Ct extends we {
|
|
277
275
|
/**
|
|
278
276
|
* The default implementation does nothing.
|
|
279
277
|
* Overwrite this method to do calculation.
|
|
@@ -283,8 +281,8 @@ class yt extends we {
|
|
|
283
281
|
*/
|
|
284
282
|
calculate;
|
|
285
283
|
}
|
|
286
|
-
function
|
|
287
|
-
return class extends
|
|
284
|
+
function nn(o) {
|
|
285
|
+
return class extends Ct {
|
|
288
286
|
type = o.type;
|
|
289
287
|
inputs = {};
|
|
290
288
|
outputs = {};
|
|
@@ -295,10 +293,10 @@ function Zs(o) {
|
|
|
295
293
|
constructor() {
|
|
296
294
|
super(), this._title = o.title ?? o.type, this.updateModules(o.modules), o.codeTemplate && (this.state.codeTemplate = o.codeTemplate(this)), o.variableName && (this.state.variableName = o.variableName), this.addInput(
|
|
297
295
|
"_node",
|
|
298
|
-
new M("", []).use(j,
|
|
296
|
+
new M("", []).use(j, H).use(Y).setHidden(!0)
|
|
299
297
|
), this.addOutput(
|
|
300
298
|
"_node",
|
|
301
|
-
new M("", []).use(j,
|
|
299
|
+
new M("", []).use(j, H).use(Y).setHidden(!0)
|
|
302
300
|
), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input", o.inputs), this.executeFactory("output", o.outputs), o.calculate && (this.calculate = (e, t) => ({
|
|
303
301
|
...o.calculate?.call(this, e, t),
|
|
304
302
|
_node: null
|
|
@@ -327,14 +325,14 @@ function Zs(o) {
|
|
|
327
325
|
if (!this.inputs[t]) {
|
|
328
326
|
const s = e.inputs[t].value;
|
|
329
327
|
let n;
|
|
330
|
-
typeof s == "number" ? n = new
|
|
328
|
+
typeof s == "number" ? n = new We(t, s).use(j, ke) : n = new Xe(t, JSON.stringify(s)).use(j, Ce), n.use(Ye, !0), this.addInput(t, n);
|
|
331
329
|
}
|
|
332
330
|
this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
|
|
333
331
|
}
|
|
334
332
|
for (const t of Object.keys(e.outputs))
|
|
335
333
|
if (!this.staticOutputKeys.includes(t)) {
|
|
336
334
|
if (!this.outputs[t]) {
|
|
337
|
-
const s = new
|
|
335
|
+
const s = new kt(t);
|
|
338
336
|
this.addOutput(t, s);
|
|
339
337
|
}
|
|
340
338
|
this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
|
|
@@ -371,12 +369,12 @@ function Zs(o) {
|
|
|
371
369
|
}
|
|
372
370
|
};
|
|
373
371
|
}
|
|
374
|
-
class
|
|
372
|
+
class It {
|
|
375
373
|
_id;
|
|
376
374
|
_viewModel;
|
|
377
375
|
_state;
|
|
378
376
|
constructor(e) {
|
|
379
|
-
this._id =
|
|
377
|
+
this._id = mt(), this._viewModel = e, this._state = R({
|
|
380
378
|
autosort: !1,
|
|
381
379
|
modules: {},
|
|
382
380
|
script: "",
|
|
@@ -557,7 +555,7 @@ class wt {
|
|
|
557
555
|
a.from.nodeId
|
|
558
556
|
]);
|
|
559
557
|
let t = [...this.nodeIds];
|
|
560
|
-
t.reverse(), t =
|
|
558
|
+
t.reverse(), t = vt.array(t, e), t.reverse();
|
|
561
559
|
const s = this.graph.nodes.map((a) => a.id).filter((a) => !t.includes(a));
|
|
562
560
|
t = t.concat(s);
|
|
563
561
|
const n = t.map((a) => this.findNodeById(a));
|
|
@@ -575,14 +573,14 @@ const Z = (o) => {
|
|
|
575
573
|
return o.nodes.forEach((t) => {
|
|
576
574
|
t.subgraph ? e = e.concat(Z(t.subgraph)) : t.isCodeNode && e.push(t);
|
|
577
575
|
}), e;
|
|
578
|
-
},
|
|
576
|
+
}, on = (o = 0, e = 100) => ({
|
|
579
577
|
x: o * 420,
|
|
580
578
|
y: e
|
|
581
|
-
}),
|
|
579
|
+
}), an = (o) => {
|
|
582
580
|
const e = { ...o.position };
|
|
583
581
|
return e.x -= 400, e.y += 50, e;
|
|
584
|
-
},
|
|
585
|
-
const { calculationOrder: e, connectionsFromNode: t } =
|
|
582
|
+
}, Nt = (o) => {
|
|
583
|
+
const { calculationOrder: e, connectionsFromNode: t } = Je(o);
|
|
586
584
|
e.forEach((s) => {
|
|
587
585
|
if (!s.isCodeNode) return;
|
|
588
586
|
const n = s;
|
|
@@ -590,14 +588,14 @@ const Z = (o) => {
|
|
|
590
588
|
a.to.state && a.from.script && (a.to.state.script = a.from.script);
|
|
591
589
|
});
|
|
592
590
|
});
|
|
593
|
-
},
|
|
591
|
+
}, Mt = ["id"], Ot = { class: "align-middle" }, me = /* @__PURE__ */ G({
|
|
594
592
|
__name: "CodeGraphNodeInterface",
|
|
595
593
|
props: {
|
|
596
594
|
node: {},
|
|
597
595
|
intf: {}
|
|
598
596
|
},
|
|
599
597
|
setup(o) {
|
|
600
|
-
const e = o, { viewModel: t } =
|
|
598
|
+
const e = o, { viewModel: t } = F(), { hoveredOver: s, temporaryConnection: n } = qe(), a = E(null), u = f(() => e.intf.connectionCount > 0), d = f(() => ({
|
|
601
599
|
"--connected": u.value
|
|
602
600
|
})), h = () => {
|
|
603
601
|
s(e.intf);
|
|
@@ -618,17 +616,17 @@ const Z = (o) => {
|
|
|
618
616
|
onPointerover: h,
|
|
619
617
|
onPointerout: O
|
|
620
618
|
}, null, 34)) : N("", !0),
|
|
621
|
-
l("span",
|
|
619
|
+
l("span", Ot, [
|
|
622
620
|
q(k.$slots, "default")
|
|
623
621
|
])
|
|
624
|
-
], 10,
|
|
622
|
+
], 10, Mt));
|
|
625
623
|
}
|
|
626
624
|
}), z = (o, e) => {
|
|
627
625
|
const t = o.__vccOpts || o;
|
|
628
626
|
for (const [s, n] of e)
|
|
629
627
|
t[s] = n;
|
|
630
628
|
return t;
|
|
631
|
-
},
|
|
629
|
+
}, $t = {}, Et = {
|
|
632
630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
633
631
|
width: "24",
|
|
634
632
|
height: "24",
|
|
@@ -636,8 +634,8 @@ const Z = (o) => {
|
|
|
636
634
|
fill: "currentColor",
|
|
637
635
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
|
|
638
636
|
};
|
|
639
|
-
function
|
|
640
|
-
return i(), r("svg",
|
|
637
|
+
function Tt(o, e) {
|
|
638
|
+
return i(), r("svg", Et, [...e[0] || (e[0] = [
|
|
641
639
|
l("path", {
|
|
642
640
|
stroke: "none",
|
|
643
641
|
d: "M0 0h24v24H0z",
|
|
@@ -646,7 +644,7 @@ function Mt(o, e) {
|
|
|
646
644
|
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)
|
|
647
645
|
])]);
|
|
648
646
|
}
|
|
649
|
-
const
|
|
647
|
+
const St = /* @__PURE__ */ z($t, [["render", Tt]]), zt = {}, Bt = {
|
|
650
648
|
xmlns: "http://www.w3.org/2000/svg",
|
|
651
649
|
width: "24",
|
|
652
650
|
height: "24",
|
|
@@ -654,8 +652,8 @@ const Ot = /* @__PURE__ */ z(It, [["render", Mt]]), $t = {}, Et = {
|
|
|
654
652
|
fill: "currentColor",
|
|
655
653
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
|
|
656
654
|
};
|
|
657
|
-
function
|
|
658
|
-
return i(), r("svg",
|
|
655
|
+
function Vt(o, e) {
|
|
656
|
+
return i(), r("svg", Bt, [...e[0] || (e[0] = [
|
|
659
657
|
l("path", {
|
|
660
658
|
stroke: "none",
|
|
661
659
|
d: "M0 0h24v24H0z",
|
|
@@ -664,7 +662,7 @@ function Tt(o, e) {
|
|
|
664
662
|
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)
|
|
665
663
|
])]);
|
|
666
664
|
}
|
|
667
|
-
const
|
|
665
|
+
const Lt = /* @__PURE__ */ z(zt, [["render", Vt]]), Gt = {}, Ut = {
|
|
668
666
|
xmlns: "http://www.w3.org/2000/svg",
|
|
669
667
|
width: "24",
|
|
670
668
|
height: "24",
|
|
@@ -672,8 +670,8 @@ const St = /* @__PURE__ */ z($t, [["render", Tt]]), zt = {}, Bt = {
|
|
|
672
670
|
fill: "currentColor",
|
|
673
671
|
class: "balkava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
|
|
674
672
|
};
|
|
675
|
-
function
|
|
676
|
-
return i(), r("svg",
|
|
673
|
+
function jt(o, e) {
|
|
674
|
+
return i(), r("svg", Ut, [...e[0] || (e[0] = [
|
|
677
675
|
l("path", {
|
|
678
676
|
stroke: "none",
|
|
679
677
|
d: "M0 0h24v24H0z",
|
|
@@ -682,7 +680,7 @@ function Vt(o, e) {
|
|
|
682
680
|
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)
|
|
683
681
|
])]);
|
|
684
682
|
}
|
|
685
|
-
const
|
|
683
|
+
const Rt = /* @__PURE__ */ z(Gt, [["render", jt]]), Pt = {}, Dt = {
|
|
686
684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
687
685
|
width: "24",
|
|
688
686
|
height: "24",
|
|
@@ -690,8 +688,8 @@ const Lt = /* @__PURE__ */ z(zt, [["render", Vt]]), Gt = {}, Ut = {
|
|
|
690
688
|
fill: "currentColor",
|
|
691
689
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
|
|
692
690
|
};
|
|
693
|
-
function
|
|
694
|
-
return i(), r("svg",
|
|
691
|
+
function At(o, e) {
|
|
692
|
+
return i(), r("svg", Dt, [...e[0] || (e[0] = [
|
|
695
693
|
l("path", {
|
|
696
694
|
stroke: "none",
|
|
697
695
|
d: "M0 0h24v24H0z",
|
|
@@ -700,7 +698,7 @@ function jt(o, e) {
|
|
|
700
698
|
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)
|
|
701
699
|
])]);
|
|
702
700
|
}
|
|
703
|
-
const
|
|
701
|
+
const Ht = /* @__PURE__ */ z(Pt, [["render", At]]), Ft = {}, Wt = {
|
|
704
702
|
xmlns: "http://www.w3.org/2000/svg",
|
|
705
703
|
width: "24",
|
|
706
704
|
height: "24",
|
|
@@ -708,8 +706,8 @@ const Rt = /* @__PURE__ */ z(Gt, [["render", jt]]), Pt = {}, Dt = {
|
|
|
708
706
|
fill: "currentColor",
|
|
709
707
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
|
|
710
708
|
};
|
|
711
|
-
function
|
|
712
|
-
return i(), r("svg",
|
|
709
|
+
function Xt(o, e) {
|
|
710
|
+
return i(), r("svg", Wt, [...e[0] || (e[0] = [
|
|
713
711
|
l("path", {
|
|
714
712
|
stroke: "none",
|
|
715
713
|
d: "M0 0h24v24H0z",
|
|
@@ -718,7 +716,7 @@ function At(o, e) {
|
|
|
718
716
|
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)
|
|
719
717
|
])]);
|
|
720
718
|
}
|
|
721
|
-
const
|
|
719
|
+
const Yt = /* @__PURE__ */ z(Ft, [["render", Xt]]), Jt = {}, qt = {
|
|
722
720
|
xmlns: "http://www.w3.org/2000/svg",
|
|
723
721
|
class: "baklava-icon",
|
|
724
722
|
width: "24",
|
|
@@ -730,12 +728,12 @@ const Ht = /* @__PURE__ */ z(Pt, [["render", At]]), Ft = {}, Wt = {
|
|
|
730
728
|
"stroke-linecap": "round",
|
|
731
729
|
"stroke-linejoin": "round"
|
|
732
730
|
};
|
|
733
|
-
function
|
|
734
|
-
return i(), r("svg",
|
|
731
|
+
function Qt(o, e) {
|
|
732
|
+
return i(), r("svg", qt, [...e[0] || (e[0] = [
|
|
735
733
|
te('<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)
|
|
736
734
|
])]);
|
|
737
735
|
}
|
|
738
|
-
const
|
|
736
|
+
const Zt = /* @__PURE__ */ z(Jt, [["render", Qt]]), Kt = {}, es = {
|
|
739
737
|
xmlns: "http://www.w3.org/2000/svg",
|
|
740
738
|
class: "baklava-icon",
|
|
741
739
|
width: "24",
|
|
@@ -747,12 +745,12 @@ const Yt = /* @__PURE__ */ z(Ft, [["render", Xt]]), Jt = {}, qt = {
|
|
|
747
745
|
"stroke-linecap": "round",
|
|
748
746
|
"stroke-linejoin": "round"
|
|
749
747
|
};
|
|
750
|
-
function
|
|
751
|
-
return i(), r("svg",
|
|
748
|
+
function ts(o, e) {
|
|
749
|
+
return i(), r("svg", es, [...e[0] || (e[0] = [
|
|
752
750
|
te('<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)
|
|
753
751
|
])]);
|
|
754
752
|
}
|
|
755
|
-
const
|
|
753
|
+
const ss = /* @__PURE__ */ z(Kt, [["render", ts]]), ns = {}, os = {
|
|
756
754
|
xmlns: "http://www.w3.org/2000/svg",
|
|
757
755
|
class: "baklava-icon",
|
|
758
756
|
width: "24",
|
|
@@ -764,12 +762,12 @@ const Zt = /* @__PURE__ */ z(Jt, [["render", Qt]]), Kt = {}, es = {
|
|
|
764
762
|
"stroke-linecap": "round",
|
|
765
763
|
"stroke-linejoin": "round"
|
|
766
764
|
};
|
|
767
|
-
function
|
|
768
|
-
return i(), r("svg",
|
|
765
|
+
function as(o, e) {
|
|
766
|
+
return i(), r("svg", os, [...e[0] || (e[0] = [
|
|
769
767
|
te('<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)
|
|
770
768
|
])]);
|
|
771
769
|
}
|
|
772
|
-
const
|
|
770
|
+
const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = {}, ls = {
|
|
773
771
|
xmlns: "http://www.w3.org/2000/svg",
|
|
774
772
|
class: "baklava-icon",
|
|
775
773
|
width: "16",
|
|
@@ -781,8 +779,8 @@ const ss = /* @__PURE__ */ z(Kt, [["render", ts]]), ns = {}, os = {
|
|
|
781
779
|
"stroke-linecap": "round",
|
|
782
780
|
"stroke-linejoin": "round"
|
|
783
781
|
};
|
|
784
|
-
function
|
|
785
|
-
return i(), r("svg",
|
|
782
|
+
function ds(o, e) {
|
|
783
|
+
return i(), r("svg", ls, [...e[0] || (e[0] = [
|
|
786
784
|
l("path", {
|
|
787
785
|
stroke: "none",
|
|
788
786
|
d: "M0 0h24v24H0z",
|
|
@@ -805,13 +803,13 @@ function as(o, e) {
|
|
|
805
803
|
}, null, -1)
|
|
806
804
|
])]);
|
|
807
805
|
}
|
|
808
|
-
const
|
|
806
|
+
const us = /* @__PURE__ */ z(rs, [["render", ds]]), cs = ["id", "data-node-type"], ps = {
|
|
809
807
|
class: "__title-label",
|
|
810
808
|
style: { "flex-grow": "1" }
|
|
811
|
-
},
|
|
809
|
+
}, hs = { key: 0 }, vs = {
|
|
812
810
|
class: "__menu",
|
|
813
811
|
style: { display: "flex" }
|
|
814
|
-
},
|
|
812
|
+
}, ms = { class: "__outputs" }, fs = { key: 0 }, gs = ["id", "title"], bs = { class: "__inputs" }, _s = { key: 0 }, ys = ["id", "title"], ws = /* @__PURE__ */ G({
|
|
815
813
|
__name: "CodeGraphNode",
|
|
816
814
|
props: {
|
|
817
815
|
node: {},
|
|
@@ -820,7 +818,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
820
818
|
},
|
|
821
819
|
emits: ["select", "start-drag", "update"],
|
|
822
820
|
setup(o, { emit: e }) {
|
|
823
|
-
const t = ve.ContextMenu, s = ve.NodeInterface, n = o, a = f(() => n.node), u = e, { viewModel: d } =
|
|
821
|
+
const t = ve.ContextMenu, s = ve.NodeInterface, n = o, a = f(() => n.node), u = e, { viewModel: d } = F(), { graph: h, switchGraph: O } = K(), x = E(null), k = E(!1), B = E(""), y = E(null), m = E(!1);
|
|
824
822
|
let g = 0, b = 0;
|
|
825
823
|
const p = E(!1), w = f(() => {
|
|
826
824
|
const c = [
|
|
@@ -834,28 +832,28 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
834
832
|
"--dragging": n.dragging,
|
|
835
833
|
"--two-column": !!n.node.twoColumn,
|
|
836
834
|
"--hidden": a.value.state?.hidden
|
|
837
|
-
})),
|
|
835
|
+
})), Ie = f(() => ({
|
|
838
836
|
"--reverse-y": n.node.reverseY ?? d.value.settings.nodes.reverseY
|
|
839
|
-
})),
|
|
837
|
+
})), Ne = f(() => ({
|
|
840
838
|
top: `${n.node.position?.y ?? 0}px`,
|
|
841
839
|
left: `${n.node.position?.x ?? 0}px`,
|
|
842
840
|
"--width": `${n.node.width ?? d.value.settings.nodes.defaultWidth}px`
|
|
843
|
-
})),
|
|
841
|
+
})), Me = f(() => Object.values(n.node.inputs).filter((c) => !c.hidden)), Oe = f(() => Object.values(n.node.outputs).filter((c) => !c.hidden)), re = () => {
|
|
844
842
|
u("select");
|
|
845
|
-
},
|
|
843
|
+
}, $e = (c) => {
|
|
846
844
|
n.selected || re(), u("start-drag", c);
|
|
847
845
|
}, le = () => {
|
|
848
846
|
p.value = !0;
|
|
849
|
-
},
|
|
847
|
+
}, Ee = () => {
|
|
850
848
|
const c = d.value.displayedGraph.sidebar;
|
|
851
849
|
c.nodeId = "", c.visible = !1;
|
|
852
850
|
}, de = () => {
|
|
853
851
|
const c = d.value.displayedGraph.sidebar;
|
|
854
852
|
c.nodeId = n.node.id, c.visible = !0;
|
|
855
|
-
},
|
|
853
|
+
}, Te = () => {
|
|
856
854
|
const c = d.value.displayedGraph.sidebar;
|
|
857
855
|
c.nodeId = n.node.id;
|
|
858
|
-
},
|
|
856
|
+
}, Se = async (c) => {
|
|
859
857
|
switch (c) {
|
|
860
858
|
case "edit":
|
|
861
859
|
de();
|
|
@@ -864,7 +862,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
864
862
|
h.value.removeNode(n.node);
|
|
865
863
|
break;
|
|
866
864
|
case "rename":
|
|
867
|
-
B.value = n.node.title, k.value = !0, await
|
|
865
|
+
B.value = n.node.title, k.value = !0, await it(), y.value?.focus();
|
|
868
866
|
break;
|
|
869
867
|
case "editSubgraph":
|
|
870
868
|
O(n.node.template);
|
|
@@ -874,18 +872,18 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
874
872
|
n.node.title = B.value, k.value = !1;
|
|
875
873
|
}, ce = () => {
|
|
876
874
|
x.value && d.value.hooks.renderNode.execute({ node: n.node, el: x.value });
|
|
877
|
-
},
|
|
875
|
+
}, ze = (c) => {
|
|
878
876
|
m.value = !0, g = n.node.width, b = c.clientX, c.preventDefault();
|
|
879
877
|
}, pe = (c) => {
|
|
880
878
|
if (!m.value) return;
|
|
881
|
-
const C = c.clientX - b, v = g + C / h.value.scaling,
|
|
882
|
-
n.node.width = Math.max(
|
|
879
|
+
const C = c.clientX - b, v = g + C / h.value.scaling, Be = d.value.settings.nodes.minWidth, Ve = d.value.settings.nodes.maxWidth;
|
|
880
|
+
n.node.width = Math.max(Be, Math.min(Ve, v));
|
|
883
881
|
}, he = () => {
|
|
884
882
|
m.value = !1;
|
|
885
883
|
};
|
|
886
884
|
return ee(() => {
|
|
887
885
|
ce(), window.addEventListener("mousemove", pe), window.addEventListener("mouseup", he);
|
|
888
|
-
}), _e(ce),
|
|
886
|
+
}), _e(ce), ot(() => {
|
|
889
887
|
window.removeEventListener("mousemove", pe), window.removeEventListener("mouseup", he);
|
|
890
888
|
}), (c, C) => (i(), r("div", {
|
|
891
889
|
id: a.value.id,
|
|
@@ -893,17 +891,17 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
893
891
|
ref: x,
|
|
894
892
|
class: U([I.value, "baklava-node"]),
|
|
895
893
|
"data-node-type": a.value.type,
|
|
896
|
-
style: se(
|
|
894
|
+
style: se(Ne.value),
|
|
897
895
|
onPointerdown: re
|
|
898
896
|
}, [
|
|
899
897
|
_(d).settings.nodes.resizable ? (i(), r("div", {
|
|
900
898
|
key: 0,
|
|
901
899
|
class: "__resize-handle",
|
|
902
|
-
onMousedown:
|
|
900
|
+
onMousedown: ze
|
|
903
901
|
}, null, 32)) : N("", !0),
|
|
904
902
|
l("div", {
|
|
905
903
|
class: "__title",
|
|
906
|
-
onPointerdown: D(
|
|
904
|
+
onPointerdown: D($e, ["self", "stop"]),
|
|
907
905
|
onContextmenu: D(le, ["prevent"])
|
|
908
906
|
}, [
|
|
909
907
|
a.value.inputs._node ? (i(), V(me, {
|
|
@@ -928,27 +926,27 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
928
926
|
}, null, 544)), [
|
|
929
927
|
[oe, B.value]
|
|
930
928
|
]) : (i(), r(T, { key: 1 }, [
|
|
931
|
-
l("div",
|
|
932
|
-
a.value.idx > -1 ? (i(), r("span",
|
|
933
|
-
|
|
929
|
+
l("div", ps, [
|
|
930
|
+
a.value.idx > -1 ? (i(), r("span", hs, L(a.value.idx + 1) + " - ", 1)) : N("", !0),
|
|
931
|
+
at(L(a.value.title) + " (" + L(a.value.shortId) + ") ", 1)
|
|
934
932
|
]),
|
|
935
|
-
l("div",
|
|
933
|
+
l("div", vs, [
|
|
936
934
|
a.value.subgraph ? N("", !0) : (i(), r(T, { key: 0 }, [
|
|
937
|
-
!_(d).displayedGraph.sidebar.visible && _(d).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(_(
|
|
935
|
+
!_(d).displayedGraph.sidebar.visible && _(d).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(_(Yt), {
|
|
938
936
|
key: 0,
|
|
939
937
|
class: "--clickable mx-1",
|
|
940
938
|
onClick: de
|
|
941
|
-
})) : _(d).displayedGraph.sidebar.visible && _(d).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(_(
|
|
939
|
+
})) : _(d).displayedGraph.sidebar.visible && _(d).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(_(Rt), {
|
|
942
940
|
key: 1,
|
|
943
941
|
class: "--clickable mx-1",
|
|
944
|
-
onClick:
|
|
945
|
-
})) : (i(), V(_(
|
|
942
|
+
onClick: Te
|
|
943
|
+
})) : (i(), V(_(Ht), {
|
|
946
944
|
key: 2,
|
|
947
945
|
class: "--clickable mx-1",
|
|
948
|
-
onClick:
|
|
946
|
+
onClick: Ee
|
|
949
947
|
}))
|
|
950
948
|
], 64)),
|
|
951
|
-
S(_(
|
|
949
|
+
S(_(us), {
|
|
952
950
|
class: "--clickable mx-1",
|
|
953
951
|
onClick: le
|
|
954
952
|
}),
|
|
@@ -958,7 +956,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
958
956
|
x: 0,
|
|
959
957
|
y: 0,
|
|
960
958
|
items: w.value,
|
|
961
|
-
onClick:
|
|
959
|
+
onClick: Se
|
|
962
960
|
}, null, 8, ["modelValue", "items"])
|
|
963
961
|
])
|
|
964
962
|
], 64)),
|
|
@@ -971,17 +969,17 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
971
969
|
}, null, 8, ["node", "intf"])) : N("", !0)
|
|
972
970
|
], 32),
|
|
973
971
|
l("div", {
|
|
974
|
-
class: U(["__content",
|
|
972
|
+
class: U(["__content", Ie.value]),
|
|
975
973
|
onKeydown: C[2] || (C[2] = Q(D(() => {
|
|
976
974
|
}, ["stop"]), ["delete"])),
|
|
977
975
|
onContextmenu: C[3] || (C[3] = D(() => {
|
|
978
976
|
}, ["prevent"]))
|
|
979
977
|
}, [
|
|
980
|
-
l("div",
|
|
981
|
-
(i(!0), r(T, null, A(
|
|
978
|
+
l("div", ms, [
|
|
979
|
+
(i(!0), r(T, null, A(Oe.value, (v) => (i(), r(T, {
|
|
982
980
|
key: v.id
|
|
983
981
|
}, [
|
|
984
|
-
a.value.state?.hidden ? (i(), r("div",
|
|
982
|
+
a.value.state?.hidden ? (i(), r("div", fs, [
|
|
985
983
|
v.port ? (i(), r("div", {
|
|
986
984
|
key: 0,
|
|
987
985
|
id: v.id,
|
|
@@ -989,7 +987,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
989
987
|
class: "baklava-node-interface --output --connected"
|
|
990
988
|
}, [...C[4] || (C[4] = [
|
|
991
989
|
l("div", { class: "__port" }, null, -1)
|
|
992
|
-
])], 8,
|
|
990
|
+
])], 8, gs)) : N("", !0)
|
|
993
991
|
])) : q(c.$slots, "nodeInterface", {
|
|
994
992
|
key: 1,
|
|
995
993
|
type: "output",
|
|
@@ -1003,11 +1001,11 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1003
1001
|
])
|
|
1004
1002
|
], 64))), 128))
|
|
1005
1003
|
]),
|
|
1006
|
-
l("div",
|
|
1007
|
-
(i(!0), r(T, null, A(
|
|
1004
|
+
l("div", bs, [
|
|
1005
|
+
(i(!0), r(T, null, A(Me.value, (v) => (i(), r(T, {
|
|
1008
1006
|
key: v.id
|
|
1009
1007
|
}, [
|
|
1010
|
-
a.value.state?.hidden ? (i(), r("div",
|
|
1008
|
+
a.value.state?.hidden ? (i(), r("div", _s, [
|
|
1011
1009
|
v.port ? (i(), r("div", {
|
|
1012
1010
|
key: 0,
|
|
1013
1011
|
id: v.id,
|
|
@@ -1015,7 +1013,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1015
1013
|
class: "baklava-node-interface --input --connected"
|
|
1016
1014
|
}, [...C[5] || (C[5] = [
|
|
1017
1015
|
l("div", { class: "__port" }, null, -1)
|
|
1018
|
-
])], 8,
|
|
1016
|
+
])], 8, ys)) : N("", !0)
|
|
1019
1017
|
])) : q(c.$slots, "nodeInterface", {
|
|
1020
1018
|
key: 1,
|
|
1021
1019
|
node: a.value,
|
|
@@ -1031,12 +1029,12 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1031
1029
|
], 64))), 128))
|
|
1032
1030
|
])
|
|
1033
1031
|
], 34)
|
|
1034
|
-
], 46,
|
|
1032
|
+
], 46, cs));
|
|
1035
1033
|
}
|
|
1036
|
-
}),
|
|
1034
|
+
}), xs = ["title"], ks = {
|
|
1037
1035
|
key: 0,
|
|
1038
1036
|
class: "__label"
|
|
1039
|
-
},
|
|
1037
|
+
}, Cs = /* @__PURE__ */ G({
|
|
1040
1038
|
__name: "Checkbox",
|
|
1041
1039
|
props: {
|
|
1042
1040
|
modelValue: { type: Boolean },
|
|
@@ -1065,16 +1063,16 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1065
1063
|
})
|
|
1066
1064
|
])
|
|
1067
1065
|
], -1)),
|
|
1068
|
-
s.name ? (i(), r("div",
|
|
1069
|
-
], 10,
|
|
1066
|
+
s.name ? (i(), r("div", ks, L(s.name), 1)) : N("", !0)
|
|
1067
|
+
], 10, xs));
|
|
1070
1068
|
}
|
|
1071
|
-
}),
|
|
1069
|
+
}), Is = { class: "__header" }, Ns = { class: "__node-name" }, Ms = { style: { display: "flex" } }, Os = {
|
|
1072
1070
|
key: 1,
|
|
1073
1071
|
class: "__interface"
|
|
1074
|
-
},
|
|
1072
|
+
}, $s = /* @__PURE__ */ G({
|
|
1075
1073
|
__name: "CodeGraphSidebar",
|
|
1076
1074
|
setup(o) {
|
|
1077
|
-
const { viewModel: e } =
|
|
1075
|
+
const { viewModel: e } = F(), { graph: t } = K(), s = E(null), n = ye(e.value.settings.sidebar, "width"), a = f(() => e.value.settings.sidebar.resizable);
|
|
1078
1076
|
let u = 0, d = 0;
|
|
1079
1077
|
const h = f(() => {
|
|
1080
1078
|
const b = t.value.sidebar.nodeId;
|
|
@@ -1109,13 +1107,13 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1109
1107
|
class: "__resizer",
|
|
1110
1108
|
onMousedown: m
|
|
1111
1109
|
}, null, 32)) : N("", !0),
|
|
1112
|
-
l("div",
|
|
1110
|
+
l("div", Is, [
|
|
1113
1111
|
l("button", {
|
|
1114
1112
|
tabindex: "-1",
|
|
1115
1113
|
class: "__close",
|
|
1116
1114
|
onClick: B
|
|
1117
1115
|
}, "×"),
|
|
1118
|
-
l("div",
|
|
1116
|
+
l("div", Ns, [
|
|
1119
1117
|
l("b", null, L(h.value ? h.value.title : ""), 1)
|
|
1120
1118
|
])
|
|
1121
1119
|
]),
|
|
@@ -1123,8 +1121,8 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1123
1121
|
key: w.id,
|
|
1124
1122
|
class: "__interface"
|
|
1125
1123
|
}, [
|
|
1126
|
-
l("div",
|
|
1127
|
-
S(
|
|
1124
|
+
l("div", Ms, [
|
|
1125
|
+
S(Cs, {
|
|
1128
1126
|
modelValue: w.hidden,
|
|
1129
1127
|
"onUpdate:modelValue": [
|
|
1130
1128
|
(I) => w.hidden = I,
|
|
@@ -1133,7 +1131,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1133
1131
|
inversed: "",
|
|
1134
1132
|
style: { "margin-right": "8px" }
|
|
1135
1133
|
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1136
|
-
(i(), V(
|
|
1134
|
+
(i(), V(rt(w.component), {
|
|
1137
1135
|
modelValue: w.value,
|
|
1138
1136
|
"onUpdate:modelValue": (I) => w.value = I,
|
|
1139
1137
|
node: h.value,
|
|
@@ -1142,7 +1140,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1142
1140
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
|
|
1143
1141
|
])
|
|
1144
1142
|
]))), 128)),
|
|
1145
|
-
O.value && O.value.state ? (i(), r("div",
|
|
1143
|
+
O.value && O.value.state ? (i(), r("div", Os, [
|
|
1146
1144
|
p[2] || (p[2] = l("label", null, "Variable name", -1)),
|
|
1147
1145
|
ne(l("input", {
|
|
1148
1146
|
"onUpdate:modelValue": p[1] || (p[1] = (w) => O.value.state.variableName = w),
|
|
@@ -1157,7 +1155,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1157
1155
|
])) : N("", !0)
|
|
1158
1156
|
], 6));
|
|
1159
1157
|
}
|
|
1160
|
-
}),
|
|
1158
|
+
}), Es = G({
|
|
1161
1159
|
props: {
|
|
1162
1160
|
type: {
|
|
1163
1161
|
type: String,
|
|
@@ -1169,7 +1167,7 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1169
1167
|
}
|
|
1170
1168
|
},
|
|
1171
1169
|
setup(o) {
|
|
1172
|
-
const { viewModel: e } =
|
|
1170
|
+
const { viewModel: e } = F(), { switchGraph: t } = K(), s = E(!1), n = f(() => o.type.startsWith(J));
|
|
1173
1171
|
return { showContextMenu: s, hasContextMenu: n, contextMenuItems: [
|
|
1174
1172
|
{ label: "Edit Subgraph", value: "editSubgraph" },
|
|
1175
1173
|
{ label: "Delete Subgraph", value: "deleteSubgraph" }
|
|
@@ -1188,24 +1186,24 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), rs = ["id", "data-node-type"
|
|
|
1188
1186
|
}
|
|
1189
1187
|
} };
|
|
1190
1188
|
}
|
|
1191
|
-
}),
|
|
1192
|
-
function
|
|
1189
|
+
}), Ts = ["data-node-type"], Ss = { class: "__title" }, zs = { class: "__title-label" };
|
|
1190
|
+
function Bs(o, e, t, s, n, a) {
|
|
1193
1191
|
return i(), r("div", {
|
|
1194
1192
|
class: "baklava-node --palette",
|
|
1195
1193
|
"data-node-type": o.type
|
|
1196
1194
|
}, [
|
|
1197
|
-
l("div",
|
|
1198
|
-
l("div",
|
|
1195
|
+
l("div", Ss, [
|
|
1196
|
+
l("div", zs, L(o.title), 1)
|
|
1199
1197
|
])
|
|
1200
|
-
], 8,
|
|
1198
|
+
], 8, Ts);
|
|
1201
1199
|
}
|
|
1202
|
-
const fe = /* @__PURE__ */ z(
|
|
1200
|
+
const fe = /* @__PURE__ */ z(Es, [["render", Bs]]), Vs = {
|
|
1203
1201
|
class: "baklava-node --palette",
|
|
1204
1202
|
style: { "margin-top": "-20px", "margin-bottom": "30px" }
|
|
1205
|
-
},
|
|
1203
|
+
}, Ls = { key: 0 }, Gs = /* @__PURE__ */ G({
|
|
1206
1204
|
__name: "CodeNodePalette",
|
|
1207
1205
|
setup(o) {
|
|
1208
|
-
const { viewModel: e } =
|
|
1206
|
+
const { viewModel: e } = F(), { x: t, y: s } = ft(), { transform: n } = Qe(), a = Ze(e), u = lt("editorEl"), d = E(""), h = E(null), O = (y) => d.value ? y.filter(
|
|
1209
1207
|
(m) => Object.values(m.nodeTypes).some(
|
|
1210
1208
|
(g) => g.title.toLowerCase().includes(d.value?.toLowerCase())
|
|
1211
1209
|
)
|
|
@@ -1237,7 +1235,7 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1237
1235
|
onContextmenu: m[1] || (m[1] = D(() => {
|
|
1238
1236
|
}, ["stop", "prevent"]))
|
|
1239
1237
|
}, [
|
|
1240
|
-
l("div",
|
|
1238
|
+
l("div", Vs, [
|
|
1241
1239
|
ne(l("input", {
|
|
1242
1240
|
"onUpdate:modelValue": m[0] || (m[0] = (g) => d.value = g),
|
|
1243
1241
|
type: "text",
|
|
@@ -1250,7 +1248,7 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1250
1248
|
(i(!0), r(T, null, A(O(_(a)), (g) => (i(), r("section", {
|
|
1251
1249
|
key: g.name
|
|
1252
1250
|
}, [
|
|
1253
|
-
g.name !== "default" ? (i(), r("h3",
|
|
1251
|
+
g.name !== "default" ? (i(), r("h3", Ls, L(g.name), 1)) : N("", !0),
|
|
1254
1252
|
(i(!0), r(T, null, A(x(g.nodeTypes), (b, p) => (i(), V(fe, {
|
|
1255
1253
|
key: p,
|
|
1256
1254
|
type: p,
|
|
@@ -1259,8 +1257,8 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1259
1257
|
}, null, 8, ["type", "title", "onPointerdown"]))), 128))
|
|
1260
1258
|
]))), 128))
|
|
1261
1259
|
], 34),
|
|
1262
|
-
S(
|
|
1263
|
-
default:
|
|
1260
|
+
S(dt, { name: "fade" }, {
|
|
1261
|
+
default: X(() => [
|
|
1264
1262
|
h.value ? (i(), r("div", {
|
|
1265
1263
|
key: 0,
|
|
1266
1264
|
class: "baklava-dragged-node",
|
|
@@ -1276,7 +1274,7 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1276
1274
|
})
|
|
1277
1275
|
], 64));
|
|
1278
1276
|
}
|
|
1279
|
-
}),
|
|
1277
|
+
}), rn = /* @__PURE__ */ G({
|
|
1280
1278
|
__name: "CodeGraphEditor",
|
|
1281
1279
|
props: {
|
|
1282
1280
|
viewModel: {}
|
|
@@ -1285,24 +1283,24 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1285
1283
|
const t = ye(o, "viewModel"), s = (n) => n.events.update.emit(null);
|
|
1286
1284
|
return ee(() => {
|
|
1287
1285
|
t.value.subscribe(), t.value.engine.start();
|
|
1288
|
-
}),
|
|
1286
|
+
}), ut(() => {
|
|
1289
1287
|
t.value.unsubscribe(), t.value.engine.stop();
|
|
1290
|
-
}), (n, a) => (i(), V(_(
|
|
1291
|
-
palette:
|
|
1292
|
-
S(
|
|
1288
|
+
}), (n, a) => (i(), V(_(Ke), { "view-model": t.value }, {
|
|
1289
|
+
palette: X(() => [
|
|
1290
|
+
S(Gs)
|
|
1293
1291
|
]),
|
|
1294
|
-
node:
|
|
1295
|
-
S(
|
|
1292
|
+
node: X((u) => [
|
|
1293
|
+
S(ws, ht(u, {
|
|
1296
1294
|
onUpdate: (d) => s(u.node)
|
|
1297
1295
|
}), null, 16, ["onUpdate"])
|
|
1298
1296
|
]),
|
|
1299
|
-
sidebar:
|
|
1300
|
-
S(
|
|
1297
|
+
sidebar: X((u) => [
|
|
1298
|
+
S($s, ct(pt(u)), null, 16)
|
|
1301
1299
|
]),
|
|
1302
1300
|
_: 1
|
|
1303
1301
|
}, 8, ["view-model"]));
|
|
1304
1302
|
}
|
|
1305
|
-
}),
|
|
1303
|
+
}), Us = (o) => {
|
|
1306
1304
|
const e = "TOGGLE_PALETTE";
|
|
1307
1305
|
o.commandHandler.registerCommand(e, {
|
|
1308
1306
|
execute: () => o.settings.palette.enabled = !o.settings.palette.enabled,
|
|
@@ -1322,23 +1320,23 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1322
1320
|
command: e,
|
|
1323
1321
|
title: "Toggle palette",
|
|
1324
1322
|
// Tooltip text
|
|
1325
|
-
icon: f(() => o.settings.palette.enabled ?
|
|
1323
|
+
icon: f(() => o.settings.palette.enabled ? St : Lt)
|
|
1326
1324
|
},
|
|
1327
|
-
...
|
|
1325
|
+
...et,
|
|
1328
1326
|
{
|
|
1329
1327
|
command: t,
|
|
1330
1328
|
title: "Clear all",
|
|
1331
1329
|
// Tooltip text
|
|
1332
|
-
icon:
|
|
1330
|
+
icon: is
|
|
1333
1331
|
},
|
|
1334
1332
|
{
|
|
1335
1333
|
command: s,
|
|
1336
1334
|
title: "Toggle minimap",
|
|
1337
1335
|
// Tooltip text
|
|
1338
|
-
icon: f(() => o.settings.enableMinimap ?
|
|
1336
|
+
icon: f(() => o.settings.enableMinimap ? ss : Zt)
|
|
1339
1337
|
}
|
|
1340
1338
|
];
|
|
1341
|
-
},
|
|
1339
|
+
}, W = {
|
|
1342
1340
|
enableMinimap: !1,
|
|
1343
1341
|
toolbar: {
|
|
1344
1342
|
enabled: !0
|
|
@@ -1353,22 +1351,22 @@ const fe = /* @__PURE__ */ z(Ns, [["render", Es]]), Ts = {
|
|
|
1353
1351
|
},
|
|
1354
1352
|
displayValueOnHover: !1
|
|
1355
1353
|
};
|
|
1356
|
-
function
|
|
1357
|
-
const e =
|
|
1358
|
-
e.code = o?.code ? new o.code(e) : new
|
|
1354
|
+
function ln(o) {
|
|
1355
|
+
const e = tt(o?.existingEditor);
|
|
1356
|
+
e.code = o?.code ? new o.code(e) : new It(e), Us(e);
|
|
1359
1357
|
const t = {};
|
|
1360
|
-
return Object.keys(
|
|
1361
|
-
t[s] = typeof
|
|
1358
|
+
return Object.keys(W).forEach((s) => {
|
|
1359
|
+
t[s] = typeof W[s] == "object" ? { ...e.settings[s], ...W[s] } : W[s];
|
|
1362
1360
|
}), e.settings = R({ ...e.settings, ...t }), e.settings.nodes.defaultWidth = 350, e.state = R({
|
|
1363
1361
|
modules: {},
|
|
1364
1362
|
token: null
|
|
1365
|
-
}), e.engine = new
|
|
1363
|
+
}), e.engine = new st(e.editor), e.subscribe = () => {
|
|
1366
1364
|
e.state.token && e.unsubscribe();
|
|
1367
1365
|
const s = Symbol();
|
|
1368
1366
|
e.displayedGraph.events.addNode.subscribe(s, (n) => n.code = e.code), e.engine.events.beforeRun.subscribe(s, () => {
|
|
1369
1367
|
e.engine.pause(), e.code && (e.code.onCodeUpdate(), e.code.sortNodes(), e.code.updateOutputVariableNames()), e.engine.resume();
|
|
1370
1368
|
}), e.engine.events.afterRun.subscribe(s, (n) => {
|
|
1371
|
-
e.engine.pause(),
|
|
1369
|
+
e.engine.pause(), nt(n, e.editor), Nt(e.displayedGraph), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
|
|
1372
1370
|
}), e.state.token = s;
|
|
1373
1371
|
}, e.unsubscribe = () => {
|
|
1374
1372
|
if (!e.state.token) return;
|
|
@@ -1377,40 +1375,47 @@ function sn(o) {
|
|
|
1377
1375
|
}, e;
|
|
1378
1376
|
}
|
|
1379
1377
|
export {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1378
|
+
gt as AbstractCodeNode,
|
|
1379
|
+
Ws as ButtonInterface,
|
|
1380
|
+
cn as ButtonInterfaceComponent,
|
|
1381
|
+
Xs as CheckboxInterface,
|
|
1382
|
+
pn as CheckboxInterfaceComponent,
|
|
1383
|
+
It as Code,
|
|
1384
|
+
rn as CodeGraphEditor,
|
|
1385
|
+
Js as CodeInputInterface,
|
|
1388
1386
|
we as CodeNode,
|
|
1389
1387
|
M as CodeNodeInterface,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1388
|
+
kt as CodeOutputInterface,
|
|
1389
|
+
W as DEFAULT_SETTINGS,
|
|
1390
|
+
Ct as DynamicCodeNode,
|
|
1391
|
+
Ys as IntegerInterface,
|
|
1392
|
+
hn as IntegerInterfaceComponent,
|
|
1393
|
+
qs as NumberInterface,
|
|
1394
|
+
vn as NumberInterfaceComponent,
|
|
1395
|
+
Qs as SelectInterface,
|
|
1396
|
+
mn as SelectInterfaceComponent,
|
|
1397
|
+
Zs as SliderInterface,
|
|
1398
|
+
fn as SliderInterfaceComponent,
|
|
1399
|
+
en as TextInputInterface,
|
|
1400
|
+
gn as TextInputInterfaceComponent,
|
|
1401
|
+
Ks as TextInterface,
|
|
1402
|
+
tn as TextareaInputInterface,
|
|
1403
|
+
bn as TextareaInputInterfaceComponent,
|
|
1404
|
+
Fs as addDefaultTypes,
|
|
1405
|
+
Us as addToolbarCommands,
|
|
1406
|
+
_t as booleanType,
|
|
1407
|
+
sn as defineCodeNode,
|
|
1408
|
+
nn as defineDynamicCodeNode,
|
|
1409
|
+
yt as dictType,
|
|
1409
1410
|
Z as getCodeNodes,
|
|
1410
|
-
|
|
1411
|
-
|
|
1411
|
+
on as getPositionAtColumn,
|
|
1412
|
+
an as getPositionBeforeNode,
|
|
1413
|
+
wt as listType,
|
|
1412
1414
|
xe as loadNodeState,
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1415
|
+
H as nodeType,
|
|
1416
|
+
ke as numberType,
|
|
1417
|
+
bt as saveNodeState,
|
|
1418
|
+
Ce as stringType,
|
|
1419
|
+
Nt as transferCodeScript,
|
|
1420
|
+
ln as useCodeGraph
|
|
1416
1421
|
};
|