@babsey/code-graph 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code-graph.css +1 -1
- package/dist/code-graph.js +601 -549
- package/dist/code-graph.umd.cjs +1 -1
- package/dist/codeNode/codeNode.d.ts +11 -0
- package/dist/codeNodeInterfaces/baseNumericInterface.d.ts +2 -2
- package/dist/codeNodeInterfaces/baseStringInterface.d.ts +4 -0
- package/dist/codeNodeInterfaces/checkbox/checkboxInterface.d.ts +3 -4
- package/dist/codeNodeInterfaces/codeNode/codeNodeInterface.d.ts +5 -1
- package/dist/codeNodeInterfaces/{codeInput/codeInputInterface.d.ts → codeNodeInput/codeNodeInputInterface.d.ts} +1 -2
- package/dist/codeNodeInterfaces/codeNodeOutput/codeNodeOutputInterface.d.ts +6 -0
- package/dist/codeNodeInterfaces/index.d.ts +2 -4
- package/dist/codeNodeInterfaces/select/selectInterface.d.ts +2 -2
- package/dist/codeNodeInterfaces/textInput/textInputInterface.d.ts +2 -3
- package/dist/codeNodeInterfaces/textareaInput/textareaInputInterface.d.ts +2 -2
- package/dist/components/sidebar/Checkbox.vue.d.ts +2 -1
- package/dist/interfaceTypes/default.d.ts +1 -1
- package/package.json +1 -1
- package/dist/codeNodeInterfaces/button/buttonInterface.d.ts +0 -9
- package/dist/codeNodeInterfaces/codeOutput/codeOutputInterface.d.ts +0 -8
- package/dist/codeNodeInterfaces/text/textInterface.d.ts +0 -6
package/dist/code-graph.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { AbstractNode as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { reactive as
|
|
5
|
-
import
|
|
6
|
-
import { v4 as
|
|
7
|
-
import { usePointer as
|
|
8
|
-
class
|
|
1
|
+
import { AbstractNode as De, sortTopologically as ke, NodeInterface as Pe, NodeInterfaceType as D, BaklavaInterfaceTypes as Ae, CheckboxInterfaceComponent as He, setType as L, displayInSidebar as q, IntegerInterfaceComponent as Fe, NumberInterfaceComponent as We, SelectInterfaceComponent as Xe, SliderInterfaceComponent as Ye, TextInputInterfaceComponent as qe, TextareaInputInterfaceComponent as Je, allowMultipleConnections as Y, IntegerInterface as Qe, TextInputInterface as Ze, useViewModel as F, useTemporaryConnection as Ke, Components as _e, useGraph as ee, GRAPH_NODE_TYPE_PREFIX as J, useTransform as et, useNodeCategories as tt, BaklavaEditor as st, DEFAULT_TOOLBAR_COMMANDS as nt, useBaklava as ot, DependencyEngine as at, applyResult as it } from "baklavajs";
|
|
2
|
+
import { CheckboxInterfaceComponent as vn, IntegerInterfaceComponent as mn, NumberInterfaceComponent as fn, SelectInterfaceComponent as gn, SliderInterfaceComponent as bn, TextInputInterfaceComponent as _n, TextareaInputInterfaceComponent as yn } from "baklavajs";
|
|
3
|
+
import xe from "mustache";
|
|
4
|
+
import { reactive as G, defineComponent as j, createElementBlock as r, openBlock as i, toDisplayString as E, markRaw as z, ref as O, computed as b, onMounted as te, onUpdated as Ne, normalizeClass as U, createCommentVNode as I, createElementVNode as d, unref as k, renderSlot as Q, createStaticVNode as se, onBeforeUnmount as rt, normalizeStyle as ne, withModifiers as P, createBlock as V, withDirectives as oe, Fragment as $, createTextVNode as dt, createVNode as T, withKeys as Z, vModelText as ae, renderList as A, nextTick as lt, toRef as Ie, resolveDynamicComponent as ut, inject as ct, Transition as pt, withCtx as X, onUnmounted as ht, normalizeProps as vt, guardReactiveProps as mt, mergeProps as ft } from "vue";
|
|
5
|
+
import gt from "toposort";
|
|
6
|
+
import { v4 as bt } from "uuid";
|
|
7
|
+
import { usePointer as _t } from "@vueuse/core";
|
|
8
|
+
class yt extends De {
|
|
9
9
|
state;
|
|
10
10
|
code;
|
|
11
11
|
isCodeNode = !0;
|
|
12
|
-
codeTemplate = () => "";
|
|
12
|
+
codeTemplate = () => "{{ &outputs.code }}";
|
|
13
13
|
inputs = {};
|
|
14
14
|
outputs = {};
|
|
15
15
|
constructor() {
|
|
16
|
-
super(), this.initializeIo(), this.width = 400, this.twoColumn = !0, this.state =
|
|
17
|
-
codeTemplate: "
|
|
16
|
+
super(), this.initializeIo(), this.width = 400, this.twoColumn = !0, this.state = G({
|
|
17
|
+
codeTemplate: "",
|
|
18
18
|
hidden: !1,
|
|
19
19
|
integrated: !1,
|
|
20
20
|
modules: [],
|
|
@@ -22,12 +22,21 @@ class gt extends Le {
|
|
|
22
22
|
variableName: ""
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
get codeNodeInputs() {
|
|
26
|
+
return Object.fromEntries(Object.entries(this.inputs).filter(([e, t]) => t.type != "node"));
|
|
27
|
+
}
|
|
25
28
|
get idx() {
|
|
26
29
|
return this.code?.codeNodes.filter((e) => !e.state.integrated).indexOf(this) ?? -1;
|
|
27
30
|
}
|
|
28
31
|
get idxByVariableNames() {
|
|
29
32
|
return this.code?.getNodesBySameVariableNames(this.state.variableName).indexOf(this) ?? -1;
|
|
30
33
|
}
|
|
34
|
+
get optionalInputs() {
|
|
35
|
+
return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(([e, t]) => t.optional));
|
|
36
|
+
}
|
|
37
|
+
get requiredInputs() {
|
|
38
|
+
return Object.fromEntries(Object.entries(this.codeNodeInputs).filter(([e, t]) => !t.optional));
|
|
39
|
+
}
|
|
31
40
|
get script() {
|
|
32
41
|
return this.state.script;
|
|
33
42
|
}
|
|
@@ -45,11 +54,11 @@ class gt extends Le {
|
|
|
45
54
|
getConnectedNodes(e) {
|
|
46
55
|
let t = [];
|
|
47
56
|
if (e !== "inputs") {
|
|
48
|
-
const s = this.graph?.connections.filter((
|
|
57
|
+
const s = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.from.nodeId === this.id).map((o) => o.to.nodeId);
|
|
49
58
|
s && (t = t.concat(s));
|
|
50
59
|
}
|
|
51
60
|
if (e !== "outputs") {
|
|
52
|
-
const s = this.graph?.connections.filter((
|
|
61
|
+
const s = this.graph?.connections.filter((o) => o.from.name !== "_node").filter((o) => o.to.nodeId === this.id).map((o) => o.from.nodeId);
|
|
53
62
|
s && (t = t.concat(s));
|
|
54
63
|
}
|
|
55
64
|
return !t || t.length == 0 ? [] : t.map((s) => this.graph?.findNodeById(s));
|
|
@@ -65,21 +74,29 @@ class gt extends Le {
|
|
|
65
74
|
const e = {};
|
|
66
75
|
Object.keys(this.inputs).forEach((s) => {
|
|
67
76
|
if (s === "_node") return;
|
|
68
|
-
const
|
|
69
|
-
|
|
77
|
+
const o = this.inputs[s], a = ye(o);
|
|
78
|
+
o && o.state && (e[s] = o.state.script.length > 0 ? o.state.script : a);
|
|
70
79
|
});
|
|
71
80
|
const t = {};
|
|
72
81
|
Object.keys(this.outputs).forEach((s) => {
|
|
73
82
|
if (s === "_node") return;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}), this.state.script =
|
|
83
|
+
const o = this.outputs[s], a = ye(o);
|
|
84
|
+
o && o.state && (t[s] = a);
|
|
85
|
+
}), this.state.script = xe.render(this.state.codeTemplate, { inputs: e, outputs: t }), this.outputs.code && (this.outputs.code.state.script = this.state.script);
|
|
86
|
+
}
|
|
87
|
+
updateCodeNodeInputInterfaces() {
|
|
88
|
+
if (!this.graph) return;
|
|
89
|
+
const { connectionsFromNode: e } = ke(this.graph);
|
|
90
|
+
e.has(this) && e.get(this).forEach((t) => {
|
|
91
|
+
const s = this.graph?.findNodeById(t.from.nodeId);
|
|
92
|
+
s && (s.renderCode(), t.from.isCodeNode && t.to.isCodeNode && (t.to.state.script = t.from.script));
|
|
93
|
+
});
|
|
77
94
|
}
|
|
78
95
|
updateOutputVariableName() {
|
|
79
96
|
this.outputs.code && (this.outputs.code.name = this.variableName);
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
|
-
class
|
|
99
|
+
class Me extends yt {
|
|
83
100
|
/**
|
|
84
101
|
* The default implementation does nothing.
|
|
85
102
|
* Overwrite this method to do calculation.
|
|
@@ -89,11 +106,11 @@ class we extends gt {
|
|
|
89
106
|
*/
|
|
90
107
|
calculate;
|
|
91
108
|
load(e) {
|
|
92
|
-
super.load(e),
|
|
109
|
+
super.load(e), Oe(this.graph, e);
|
|
93
110
|
}
|
|
94
111
|
save() {
|
|
95
112
|
const e = super.save();
|
|
96
|
-
return
|
|
113
|
+
return wt(this.graph, e), e;
|
|
97
114
|
}
|
|
98
115
|
updateModules(e) {
|
|
99
116
|
if (e)
|
|
@@ -104,46 +121,75 @@ class we extends gt {
|
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
const Ys = (n) => {
|
|
125
|
+
const e = [], t = Object.keys(n);
|
|
126
|
+
return t.forEach((s) => {
|
|
127
|
+
if (n[s]?.hidden) return;
|
|
128
|
+
const a = e.length < t.indexOf(s) ? `${s}=` : "";
|
|
129
|
+
e.push(`${a}{{& inputs.${s} }}`);
|
|
130
|
+
}), e;
|
|
131
|
+
}, Oe = (n, e) => {
|
|
132
|
+
if (!n) return;
|
|
133
|
+
const t = n.findNodeById(e.id);
|
|
110
134
|
if (!t || t.subgraph) return;
|
|
111
135
|
const s = t;
|
|
112
|
-
s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([
|
|
113
|
-
|
|
114
|
-
}), Object.entries(e.outputs).forEach(([
|
|
115
|
-
|
|
136
|
+
s.state && (s.state.integrated = e.integrated, s.state.modules = e.modules, s.state.props = e.props), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
137
|
+
o !== "_node" && s.inputs[o] && (s.inputs[o].hidden = a.hidden);
|
|
138
|
+
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
139
|
+
o !== "_node" && s.outputs[o] && (s.outputs[o].hidden = a.hidden);
|
|
116
140
|
});
|
|
117
|
-
},
|
|
118
|
-
if (!
|
|
119
|
-
const t =
|
|
141
|
+
}, wt = (n, e) => {
|
|
142
|
+
if (!n) return;
|
|
143
|
+
const t = n.findNodeById(e.id);
|
|
120
144
|
if (!t || t.subgraph) return;
|
|
121
145
|
const s = t;
|
|
122
|
-
s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([
|
|
123
|
-
|
|
124
|
-
}), Object.entries(e.outputs).forEach(([
|
|
125
|
-
|
|
146
|
+
s.state && (e.integrated = s.state.integrated, e.modules = s.state.modules), Object.entries(e.inputs).forEach(([o, a]) => {
|
|
147
|
+
o !== "_node" && s.inputs[o] && (a.hidden = s.inputs[o].hidden);
|
|
148
|
+
}), Object.entries(e.outputs).forEach(([o, a]) => {
|
|
149
|
+
o !== "_node" && s.outputs[o] && (a.hidden = s.outputs[o].hidden);
|
|
126
150
|
});
|
|
127
|
-
},
|
|
151
|
+
}, ye = (n) => {
|
|
152
|
+
let e;
|
|
153
|
+
if (n.value == null) return "None";
|
|
154
|
+
switch (n.type) {
|
|
155
|
+
case "boolean":
|
|
156
|
+
e = n.value ? "True" : "False";
|
|
157
|
+
break;
|
|
158
|
+
case "string":
|
|
159
|
+
e = `'${n.value}'`;
|
|
160
|
+
break;
|
|
161
|
+
case void 0:
|
|
162
|
+
e = "None";
|
|
163
|
+
break;
|
|
164
|
+
default:
|
|
165
|
+
e = `${n.value}`;
|
|
166
|
+
}
|
|
167
|
+
return e;
|
|
168
|
+
}, Ct = ["title"], ie = /* @__PURE__ */ j({
|
|
128
169
|
__name: "CodeNodeInterface",
|
|
129
170
|
props: {
|
|
130
171
|
intf: {}
|
|
131
172
|
},
|
|
132
|
-
setup(
|
|
133
|
-
return (e, t) => (i(),
|
|
173
|
+
setup(n) {
|
|
174
|
+
return (e, t) => (i(), r("div", {
|
|
134
175
|
title: e.intf.state?.script
|
|
135
|
-
},
|
|
176
|
+
}, E(e.intf.name), 9, Ct));
|
|
136
177
|
}
|
|
137
178
|
});
|
|
138
|
-
class
|
|
139
|
-
|
|
179
|
+
class R extends Pe {
|
|
180
|
+
isCodeNode = !0;
|
|
140
181
|
code;
|
|
141
182
|
state;
|
|
183
|
+
type = null;
|
|
142
184
|
constructor(e, t) {
|
|
143
|
-
super(e, t), this.setComponent(
|
|
185
|
+
super(e, t), this.setComponent(z(ie)), this.state = G({
|
|
186
|
+
optional: !1,
|
|
144
187
|
script: ""
|
|
145
188
|
});
|
|
146
189
|
}
|
|
190
|
+
get optional() {
|
|
191
|
+
return this.state.optional;
|
|
192
|
+
}
|
|
147
193
|
get shortId() {
|
|
148
194
|
return this.id.slice(0, 6);
|
|
149
195
|
}
|
|
@@ -155,123 +201,114 @@ class M extends Ge {
|
|
|
155
201
|
// if (this.name !== '_node') this.setHidden(false);
|
|
156
202
|
// }
|
|
157
203
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
204
|
+
const qs = (n, e) => {
|
|
205
|
+
n.state.optional = e;
|
|
206
|
+
};
|
|
207
|
+
class re extends R {
|
|
208
|
+
constructor(e = "", t) {
|
|
209
|
+
super(e, t), this.setComponent(z(ie));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const $e = new D("boolean"), kt = new D("dict"), xt = new D("list"), H = new D("node"), de = new D("number"), le = new D("string"), Js = (n) => {
|
|
213
|
+
new Ae(n.editor, { viewPlugin: n }).addTypes($e, kt, xt, H, de, le);
|
|
214
|
+
};
|
|
215
|
+
class Qs extends re {
|
|
161
216
|
constructor(e, t) {
|
|
162
|
-
super(e,
|
|
217
|
+
super(e, t), this.setComponent(z(He)), this.use(L, $e).use(q, !0);
|
|
163
218
|
}
|
|
164
219
|
}
|
|
165
|
-
class
|
|
166
|
-
|
|
220
|
+
class Nt extends R {
|
|
221
|
+
isCodeNodeOutput = !0;
|
|
222
|
+
constructor(e = "", t = "") {
|
|
223
|
+
super(e, t), this.setComponent(z(ie));
|
|
224
|
+
}
|
|
225
|
+
get script() {
|
|
226
|
+
return this.name.length > 0 ? this.name : this.state.script;
|
|
227
|
+
}
|
|
167
228
|
}
|
|
168
|
-
class
|
|
229
|
+
class ue extends re {
|
|
169
230
|
min;
|
|
170
231
|
max;
|
|
171
|
-
constructor(e, t, s,
|
|
172
|
-
super(e, t), this.min = s, this.max =
|
|
232
|
+
constructor(e, t, s, o) {
|
|
233
|
+
super(e, t), this.min = s, this.max = o, this.use(L, de).use(q, !0);
|
|
173
234
|
}
|
|
174
235
|
validate(e) {
|
|
175
236
|
return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
|
|
176
237
|
}
|
|
177
238
|
}
|
|
178
|
-
class
|
|
179
|
-
component =
|
|
239
|
+
class Zs extends ue {
|
|
240
|
+
component = z(Fe);
|
|
180
241
|
validate(e) {
|
|
181
242
|
return Number.isInteger(e) && super.validate(e);
|
|
182
243
|
}
|
|
183
244
|
}
|
|
184
|
-
class
|
|
185
|
-
|
|
186
|
-
constructor(e = "", t) {
|
|
187
|
-
super(e, t), this.setComponent(T(ae));
|
|
188
|
-
}
|
|
245
|
+
class Ks extends ue {
|
|
246
|
+
component = z(We);
|
|
189
247
|
}
|
|
190
|
-
class
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
super(e, t), this.setComponent(T(ae));
|
|
194
|
-
}
|
|
195
|
-
get script() {
|
|
196
|
-
return this.state.script;
|
|
197
|
-
}
|
|
198
|
-
get value() {
|
|
199
|
-
return super.value;
|
|
200
|
-
}
|
|
201
|
-
set value(e) {
|
|
202
|
-
super.value = e, this.state.script = this.name.length > 0 ? this.name : this.value;
|
|
248
|
+
class ce extends re {
|
|
249
|
+
constructor(e, t) {
|
|
250
|
+
super(e, t), this.use(L, le).use(q, !0);
|
|
203
251
|
}
|
|
204
252
|
}
|
|
205
|
-
class
|
|
206
|
-
component =
|
|
207
|
-
}
|
|
208
|
-
class qs extends M {
|
|
209
|
-
component = T(De);
|
|
253
|
+
class en extends ce {
|
|
254
|
+
component = z(Xe);
|
|
210
255
|
items;
|
|
211
256
|
constructor(e, t, s) {
|
|
212
257
|
super(e, t), this.items = s;
|
|
213
258
|
}
|
|
214
259
|
}
|
|
215
|
-
class
|
|
216
|
-
component =
|
|
260
|
+
class tn extends ue {
|
|
261
|
+
component = z(Ye);
|
|
217
262
|
min;
|
|
218
263
|
max;
|
|
219
|
-
constructor(e, t, s,
|
|
220
|
-
super(e, t, s,
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
class Zs extends M {
|
|
224
|
-
component = T(ge);
|
|
225
|
-
constructor(e, t) {
|
|
226
|
-
super(e, t), this.setPort(!1);
|
|
264
|
+
constructor(e, t, s, o) {
|
|
265
|
+
super(e, t, s, o), this.min = s, this.max = o;
|
|
227
266
|
}
|
|
228
267
|
}
|
|
229
|
-
class
|
|
230
|
-
|
|
231
|
-
component = T(ge);
|
|
268
|
+
class sn extends ce {
|
|
269
|
+
component = z(qe);
|
|
232
270
|
}
|
|
233
|
-
class
|
|
234
|
-
component =
|
|
271
|
+
class nn extends ce {
|
|
272
|
+
component = z(Je);
|
|
235
273
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
function sn(o) {
|
|
240
|
-
return class extends we {
|
|
241
|
-
type = o.type;
|
|
274
|
+
function on(n) {
|
|
275
|
+
return class extends Me {
|
|
276
|
+
type = n.type;
|
|
242
277
|
inputs = {};
|
|
243
278
|
outputs = {};
|
|
244
279
|
constructor() {
|
|
245
|
-
super(), this._title =
|
|
280
|
+
super(), this._title = n.title ?? n.type, this.updateModules(n.modules), n.variableName && (this.state.variableName = n.variableName), n.codeTemplate && (this.codeTemplate = n.codeTemplate), this.addInput(
|
|
246
281
|
"_node",
|
|
247
|
-
new
|
|
282
|
+
new R("", []).use(L, H).use(Y).setHidden(!0)
|
|
248
283
|
), this.addOutput(
|
|
249
284
|
"_node",
|
|
250
|
-
new
|
|
251
|
-
), this.executeFactory("input",
|
|
285
|
+
new R("", []).use(L, H).use(Y).setHidden(!0)
|
|
286
|
+
), this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.onCreate?.call(this);
|
|
252
287
|
}
|
|
253
|
-
calculate =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
288
|
+
// public calculate = definition.calculate
|
|
289
|
+
// ? (inputs: I, globalValues: CalculationContext) => ({
|
|
290
|
+
// ...definition.calculate!.call(this, inputs, globalValues),
|
|
291
|
+
// _node: null,
|
|
292
|
+
// })
|
|
293
|
+
// : undefined
|
|
257
294
|
onPlaced() {
|
|
258
|
-
|
|
295
|
+
n.onPlaced?.call(this);
|
|
259
296
|
}
|
|
260
297
|
onDestroy() {
|
|
261
|
-
|
|
298
|
+
n.onDestroy?.call(this);
|
|
262
299
|
}
|
|
263
300
|
onCodeUpdate() {
|
|
264
|
-
|
|
301
|
+
n.onCodeUpdate?.call(this);
|
|
265
302
|
}
|
|
266
303
|
executeFactory(e, t) {
|
|
267
304
|
Object.keys(t || {}).forEach((s) => {
|
|
268
|
-
const
|
|
269
|
-
e === "input" ? this.addInput(s,
|
|
305
|
+
const o = t[s]();
|
|
306
|
+
e === "input" ? this.addInput(s, o) : this.addOutput(s, o);
|
|
270
307
|
});
|
|
271
308
|
}
|
|
272
309
|
};
|
|
273
310
|
}
|
|
274
|
-
class
|
|
311
|
+
class It extends Me {
|
|
275
312
|
/**
|
|
276
313
|
* The default implementation does nothing.
|
|
277
314
|
* Overwrite this method to do calculation.
|
|
@@ -281,37 +318,34 @@ class Ct extends we {
|
|
|
281
318
|
*/
|
|
282
319
|
calculate;
|
|
283
320
|
}
|
|
284
|
-
function
|
|
285
|
-
return class extends
|
|
286
|
-
type =
|
|
321
|
+
function an(n) {
|
|
322
|
+
return class extends It {
|
|
323
|
+
type = n.type;
|
|
287
324
|
inputs = {};
|
|
288
325
|
outputs = {};
|
|
289
326
|
calculate;
|
|
290
327
|
preventUpdate = !1;
|
|
291
|
-
staticInputKeys = Object.keys(
|
|
292
|
-
staticOutputKeys = Object.keys(
|
|
328
|
+
staticInputKeys = Object.keys(n.inputs ?? {});
|
|
329
|
+
staticOutputKeys = Object.keys(n.outputs ?? {});
|
|
293
330
|
constructor() {
|
|
294
|
-
super(), this._title =
|
|
331
|
+
super(), this._title = n.title ?? n.type, this.updateModules(n.modules), n.codeTemplate && (this.codeTemplate = n.codeTemplate), n.variableName && (this.state.variableName = n.variableName), this.addInput(
|
|
295
332
|
"_node",
|
|
296
|
-
new
|
|
333
|
+
new R("", []).use(L, H).use(Y).setHidden(!0)
|
|
297
334
|
), this.addOutput(
|
|
298
335
|
"_node",
|
|
299
|
-
new
|
|
300
|
-
), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input",
|
|
301
|
-
...o.calculate?.call(this, e, t),
|
|
302
|
-
_node: null
|
|
303
|
-
})), o.onCreate?.call(this);
|
|
336
|
+
new R("", []).use(L, H).use(Y).setHidden(!0)
|
|
337
|
+
), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.onCreate?.call(this);
|
|
304
338
|
}
|
|
305
339
|
onPlaced() {
|
|
306
340
|
this.events.update.subscribe(this, (e) => {
|
|
307
341
|
e && (e.type === "input" && this.staticInputKeys.includes(e.name) || e.type === "output" && this.staticOutputKeys.includes(e.name)) && this.onUpdate();
|
|
308
|
-
}), this.onUpdate(),
|
|
342
|
+
}), this.onUpdate(), n.onPlaced?.call(this);
|
|
309
343
|
}
|
|
310
344
|
onDestroy() {
|
|
311
|
-
|
|
345
|
+
n.onDestroy?.call(this);
|
|
312
346
|
}
|
|
313
347
|
onCodeUpdate() {
|
|
314
|
-
|
|
348
|
+
n.onCodeUpdate?.call(this);
|
|
315
349
|
}
|
|
316
350
|
load(e) {
|
|
317
351
|
this.preventUpdate = !0, this.hooks.beforeLoad.execute(e), this.id = e.id, this.title = e.title;
|
|
@@ -324,57 +358,57 @@ function nn(o) {
|
|
|
324
358
|
if (!this.staticInputKeys.includes(t)) {
|
|
325
359
|
if (!this.inputs[t]) {
|
|
326
360
|
const s = e.inputs[t].value;
|
|
327
|
-
let
|
|
328
|
-
typeof s == "number" ?
|
|
361
|
+
let o;
|
|
362
|
+
typeof s == "number" ? o = new Qe(t, s).use(L, de) : o = new Ze(t, JSON.stringify(s)).use(L, le), o.use(q, !0), this.addInput(t, o);
|
|
329
363
|
}
|
|
330
364
|
this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
|
|
331
365
|
}
|
|
332
366
|
for (const t of Object.keys(e.outputs))
|
|
333
367
|
if (!this.staticOutputKeys.includes(t)) {
|
|
334
368
|
if (!this.outputs[t]) {
|
|
335
|
-
const s = new
|
|
369
|
+
const s = new Nt(t);
|
|
336
370
|
this.addOutput(t, s);
|
|
337
371
|
}
|
|
338
372
|
this.outputs[t] && (this.outputs[t].load(e.outputs[t]), this.outputs[t].nodeId = this.id);
|
|
339
373
|
}
|
|
340
|
-
|
|
374
|
+
Oe(this.graph, e), this.preventUpdate = !1, this.events.loaded.emit(this);
|
|
341
375
|
}
|
|
342
376
|
onUpdate() {
|
|
343
377
|
if (this.preventUpdate) return;
|
|
344
378
|
this.graph && this.graph.activeTransactions++;
|
|
345
|
-
const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs), s =
|
|
379
|
+
const e = this.getStaticValues(this.staticInputKeys, this.inputs), t = this.getStaticValues(this.staticOutputKeys, this.outputs), s = n.onUpdate.call(this, e, t);
|
|
346
380
|
this.updateInterfaces("input", s.inputs ?? {}, s.forceUpdateInputs ?? []), this.updateInterfaces("output", s.outputs ?? {}, s.forceUpdateOutputs ?? []), this.graph && this.graph.activeTransactions--;
|
|
347
381
|
}
|
|
348
382
|
getStaticValues(e, t) {
|
|
349
383
|
const s = {};
|
|
350
|
-
for (const
|
|
351
|
-
s[
|
|
384
|
+
for (const o of e)
|
|
385
|
+
s[o] = t[o].value;
|
|
352
386
|
return s;
|
|
353
387
|
}
|
|
354
388
|
updateInterfaces(e, t, s) {
|
|
355
|
-
const
|
|
389
|
+
const o = e === "input" ? this.staticInputKeys : this.staticOutputKeys, a = e === "input" ? this.inputs : this.outputs;
|
|
356
390
|
for (const u of Object.keys(a))
|
|
357
|
-
|
|
391
|
+
o.includes(u) || t[u] && !s.includes(u) || (e === "input" ? this.removeInput(u) : this.removeOutput(u));
|
|
358
392
|
for (const u of Object.keys(t)) {
|
|
359
393
|
if (a[u]) continue;
|
|
360
|
-
const
|
|
361
|
-
e === "input" ? this.addInput(u,
|
|
394
|
+
const l = t[u]();
|
|
395
|
+
e === "input" ? this.addInput(u, l) : this.addOutput(u, l);
|
|
362
396
|
}
|
|
363
397
|
}
|
|
364
398
|
executeFactory(e, t) {
|
|
365
399
|
Object.keys(t || {}).forEach((s) => {
|
|
366
|
-
const
|
|
367
|
-
e === "input" ? this.addInput(s,
|
|
400
|
+
const o = t[s]();
|
|
401
|
+
e === "input" ? this.addInput(s, o) : this.addOutput(s, o);
|
|
368
402
|
});
|
|
369
403
|
}
|
|
370
404
|
};
|
|
371
405
|
}
|
|
372
|
-
class
|
|
406
|
+
class Mt {
|
|
373
407
|
_id;
|
|
374
408
|
_viewModel;
|
|
375
409
|
_state;
|
|
376
410
|
constructor(e) {
|
|
377
|
-
this._id =
|
|
411
|
+
this._id = bt(), this._viewModel = e, this._state = G({
|
|
378
412
|
autosort: !1,
|
|
379
413
|
modules: {},
|
|
380
414
|
script: "",
|
|
@@ -383,7 +417,7 @@ class It {
|
|
|
383
417
|
});
|
|
384
418
|
}
|
|
385
419
|
get codeNodes() {
|
|
386
|
-
return
|
|
420
|
+
return K(this.graph);
|
|
387
421
|
}
|
|
388
422
|
get connections() {
|
|
389
423
|
return this.graph.connections;
|
|
@@ -413,7 +447,7 @@ class It {
|
|
|
413
447
|
this.graph._nodes = e;
|
|
414
448
|
}
|
|
415
449
|
get scriptedCodeNodes() {
|
|
416
|
-
return
|
|
450
|
+
return K(this.graph).filter(
|
|
417
451
|
(e) => e.state?.script.length > 0
|
|
418
452
|
);
|
|
419
453
|
}
|
|
@@ -457,7 +491,7 @@ class It {
|
|
|
457
491
|
* Clear code graph.
|
|
458
492
|
*/
|
|
459
493
|
clear() {
|
|
460
|
-
this.nodes = [], this.connections = [];
|
|
494
|
+
this.state.modules = {}, this.nodes = [], this.connections = [], this.state.script = "";
|
|
461
495
|
}
|
|
462
496
|
findNodeById(e) {
|
|
463
497
|
return this.graph.findNodeById(e);
|
|
@@ -519,7 +553,7 @@ class It {
|
|
|
519
553
|
* Render code.
|
|
520
554
|
*/
|
|
521
555
|
renderCode() {
|
|
522
|
-
this.state.script =
|
|
556
|
+
this.state.script = xe.render(this.state.template || "", this);
|
|
523
557
|
}
|
|
524
558
|
/**
|
|
525
559
|
* Save code graph.
|
|
@@ -536,11 +570,11 @@ class It {
|
|
|
536
570
|
*/
|
|
537
571
|
saveNodeStates(e) {
|
|
538
572
|
e.forEach((t, s) => {
|
|
539
|
-
const
|
|
573
|
+
const o = this.nodes[s];
|
|
540
574
|
Object.entries(t.inputs).forEach(([a]) => {
|
|
541
|
-
t.inputs &&
|
|
575
|
+
t.inputs && o.inputs[a] && (t.inputs[a].hidden = o.inputs[a].hidden);
|
|
542
576
|
}), Object.entries(t.outputs).forEach(([a]) => {
|
|
543
|
-
t.outputs &&
|
|
577
|
+
t.outputs && o.outputs[a] && (t.outputs[a].hidden = o.outputs[a].hidden);
|
|
544
578
|
});
|
|
545
579
|
});
|
|
546
580
|
}
|
|
@@ -555,11 +589,11 @@ class It {
|
|
|
555
589
|
a.from.nodeId
|
|
556
590
|
]);
|
|
557
591
|
let t = [...this.nodeIds];
|
|
558
|
-
t.reverse(), t =
|
|
592
|
+
t.reverse(), t = gt.array(t, e), t.reverse();
|
|
559
593
|
const s = this.graph.nodes.map((a) => a.id).filter((a) => !t.includes(a));
|
|
560
594
|
t = t.concat(s);
|
|
561
|
-
const
|
|
562
|
-
|
|
595
|
+
const o = t.map((a) => this.findNodeById(a));
|
|
596
|
+
o && (this.nodes = o);
|
|
563
597
|
} catch {
|
|
564
598
|
console.warn("Failed to sort nodes.");
|
|
565
599
|
}
|
|
@@ -568,65 +602,65 @@ class It {
|
|
|
568
602
|
this.codeNodes.forEach((e) => e.updateOutputVariableName());
|
|
569
603
|
}
|
|
570
604
|
}
|
|
571
|
-
const
|
|
605
|
+
const K = (n) => {
|
|
572
606
|
let e = [];
|
|
573
|
-
return
|
|
574
|
-
t.subgraph ? e = e.concat(
|
|
607
|
+
return n.nodes.forEach((t) => {
|
|
608
|
+
t.subgraph ? e = e.concat(K(t.subgraph)) : t.isCodeNode && e.push(t);
|
|
575
609
|
}), e;
|
|
576
|
-
},
|
|
577
|
-
x:
|
|
610
|
+
}, rn = (n = 0, e = 100) => ({
|
|
611
|
+
x: n * 420,
|
|
578
612
|
y: e
|
|
579
|
-
}),
|
|
580
|
-
const e = { ...
|
|
613
|
+
}), dn = (n) => {
|
|
614
|
+
const e = { ...n.position };
|
|
581
615
|
return e.x -= 400, e.y += 50, e;
|
|
582
|
-
},
|
|
583
|
-
const { calculationOrder: e, connectionsFromNode: t } =
|
|
616
|
+
}, ln = (n) => {
|
|
617
|
+
const { calculationOrder: e, connectionsFromNode: t } = ke(n);
|
|
584
618
|
e.forEach((s) => {
|
|
585
619
|
if (!s.isCodeNode) return;
|
|
586
|
-
const
|
|
587
|
-
t.has(
|
|
620
|
+
const o = s;
|
|
621
|
+
t.has(o) && t.get(o).forEach((a) => {
|
|
588
622
|
a.to.state && a.from.script && (a.to.state.script = a.from.script);
|
|
589
623
|
});
|
|
590
624
|
});
|
|
591
|
-
},
|
|
625
|
+
}, Ot = ["id"], $t = { class: "align-middle" }, we = /* @__PURE__ */ j({
|
|
592
626
|
__name: "CodeGraphNodeInterface",
|
|
593
627
|
props: {
|
|
594
628
|
node: {},
|
|
595
629
|
intf: {}
|
|
596
630
|
},
|
|
597
|
-
setup(
|
|
598
|
-
const e =
|
|
631
|
+
setup(n) {
|
|
632
|
+
const e = n, { viewModel: t } = F(), { hoveredOver: s, temporaryConnection: o } = Ke(), a = O(null), u = b(() => e.intf.connectionCount > 0), l = b(() => ({
|
|
599
633
|
"--connected": u.value
|
|
600
|
-
})),
|
|
634
|
+
})), v = () => {
|
|
601
635
|
s(e.intf);
|
|
602
|
-
},
|
|
636
|
+
}, _ = () => {
|
|
603
637
|
s(void 0);
|
|
604
|
-
},
|
|
638
|
+
}, y = () => {
|
|
605
639
|
a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
|
|
606
640
|
};
|
|
607
|
-
return
|
|
608
|
-
id:
|
|
641
|
+
return te(y), Ne(y), (x, B) => (i(), r("div", {
|
|
642
|
+
id: x.intf.id,
|
|
609
643
|
ref_key: "el",
|
|
610
644
|
ref: a,
|
|
611
|
-
class: U(["baklava-node-interface",
|
|
645
|
+
class: U(["baklava-node-interface", l.value])
|
|
612
646
|
}, [
|
|
613
|
-
|
|
647
|
+
x.intf.port ? (i(), r("div", {
|
|
614
648
|
key: 0,
|
|
615
|
-
class: U(["__port", { "--selected":
|
|
616
|
-
onPointerover:
|
|
617
|
-
onPointerout:
|
|
618
|
-
}, null, 34)) :
|
|
619
|
-
|
|
620
|
-
|
|
649
|
+
class: U(["__port", { "--selected": k(o)?.from === x.intf }]),
|
|
650
|
+
onPointerover: v,
|
|
651
|
+
onPointerout: _
|
|
652
|
+
}, null, 34)) : I("", !0),
|
|
653
|
+
d("span", $t, [
|
|
654
|
+
Q(x.$slots, "default")
|
|
621
655
|
])
|
|
622
|
-
], 10,
|
|
656
|
+
], 10, Ot));
|
|
623
657
|
}
|
|
624
|
-
}),
|
|
625
|
-
const t =
|
|
626
|
-
for (const [s,
|
|
627
|
-
t[s] =
|
|
658
|
+
}), S = (n, e) => {
|
|
659
|
+
const t = n.__vccOpts || n;
|
|
660
|
+
for (const [s, o] of e)
|
|
661
|
+
t[s] = o;
|
|
628
662
|
return t;
|
|
629
|
-
}, Tt = {},
|
|
663
|
+
}, Tt = {}, Et = {
|
|
630
664
|
xmlns: "http://www.w3.org/2000/svg",
|
|
631
665
|
width: "24",
|
|
632
666
|
height: "24",
|
|
@@ -634,17 +668,17 @@ const Z = (o) => {
|
|
|
634
668
|
fill: "currentColor",
|
|
635
669
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
|
|
636
670
|
};
|
|
637
|
-
function
|
|
638
|
-
return i(),
|
|
639
|
-
|
|
671
|
+
function zt(n, e) {
|
|
672
|
+
return i(), r("svg", Et, [...e[0] || (e[0] = [
|
|
673
|
+
d("path", {
|
|
640
674
|
stroke: "none",
|
|
641
675
|
d: "M0 0h24v24H0z",
|
|
642
676
|
fill: "none"
|
|
643
677
|
}, null, -1),
|
|
644
|
-
|
|
678
|
+
d("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)
|
|
645
679
|
])]);
|
|
646
680
|
}
|
|
647
|
-
const St = /* @__PURE__ */
|
|
681
|
+
const St = /* @__PURE__ */ S(Tt, [["render", zt]]), Bt = {}, Lt = {
|
|
648
682
|
xmlns: "http://www.w3.org/2000/svg",
|
|
649
683
|
width: "24",
|
|
650
684
|
height: "24",
|
|
@@ -652,17 +686,17 @@ const St = /* @__PURE__ */ z(Tt, [["render", Et]]), zt = {}, Bt = {
|
|
|
652
686
|
fill: "currentColor",
|
|
653
687
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-expand"
|
|
654
688
|
};
|
|
655
|
-
function Vt(
|
|
656
|
-
return i(),
|
|
657
|
-
|
|
689
|
+
function Vt(n, e) {
|
|
690
|
+
return i(), r("svg", Lt, [...e[0] || (e[0] = [
|
|
691
|
+
d("path", {
|
|
658
692
|
stroke: "none",
|
|
659
693
|
d: "M0 0h24v24H0z",
|
|
660
694
|
fill: "none"
|
|
661
695
|
}, null, -1),
|
|
662
|
-
|
|
696
|
+
d("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)
|
|
663
697
|
])]);
|
|
664
698
|
}
|
|
665
|
-
const
|
|
699
|
+
const jt = /* @__PURE__ */ S(Bt, [["render", Vt]]), Ut = {}, Gt = {
|
|
666
700
|
xmlns: "http://www.w3.org/2000/svg",
|
|
667
701
|
width: "24",
|
|
668
702
|
height: "24",
|
|
@@ -670,17 +704,17 @@ const Lt = /* @__PURE__ */ z(zt, [["render", Vt]]), Gt = {}, Ut = {
|
|
|
670
704
|
fill: "currentColor",
|
|
671
705
|
class: "balkava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right"
|
|
672
706
|
};
|
|
673
|
-
function
|
|
674
|
-
return i(),
|
|
675
|
-
|
|
707
|
+
function Rt(n, e) {
|
|
708
|
+
return i(), r("svg", Gt, [...e[0] || (e[0] = [
|
|
709
|
+
d("path", {
|
|
676
710
|
stroke: "none",
|
|
677
711
|
d: "M0 0h24v24H0z",
|
|
678
712
|
fill: "none"
|
|
679
713
|
}, null, -1),
|
|
680
|
-
|
|
714
|
+
d("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)
|
|
681
715
|
])]);
|
|
682
716
|
}
|
|
683
|
-
const
|
|
717
|
+
const Dt = /* @__PURE__ */ S(Ut, [["render", Rt]]), Pt = {}, At = {
|
|
684
718
|
xmlns: "http://www.w3.org/2000/svg",
|
|
685
719
|
width: "24",
|
|
686
720
|
height: "24",
|
|
@@ -688,17 +722,17 @@ const Rt = /* @__PURE__ */ z(Gt, [["render", jt]]), Pt = {}, Dt = {
|
|
|
688
722
|
fill: "currentColor",
|
|
689
723
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-collapse"
|
|
690
724
|
};
|
|
691
|
-
function
|
|
692
|
-
return i(),
|
|
693
|
-
|
|
725
|
+
function Ht(n, e) {
|
|
726
|
+
return i(), r("svg", At, [...e[0] || (e[0] = [
|
|
727
|
+
d("path", {
|
|
694
728
|
stroke: "none",
|
|
695
729
|
d: "M0 0h24v24H0z",
|
|
696
730
|
fill: "none"
|
|
697
731
|
}, null, -1),
|
|
698
|
-
|
|
732
|
+
d("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)
|
|
699
733
|
])]);
|
|
700
734
|
}
|
|
701
|
-
const
|
|
735
|
+
const Ft = /* @__PURE__ */ S(Pt, [["render", Ht]]), Wt = {}, Xt = {
|
|
702
736
|
xmlns: "http://www.w3.org/2000/svg",
|
|
703
737
|
width: "24",
|
|
704
738
|
height: "24",
|
|
@@ -706,17 +740,17 @@ const Ht = /* @__PURE__ */ z(Pt, [["render", At]]), Ft = {}, Wt = {
|
|
|
706
740
|
fill: "currentColor",
|
|
707
741
|
class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-right-expand"
|
|
708
742
|
};
|
|
709
|
-
function
|
|
710
|
-
return i(),
|
|
711
|
-
|
|
743
|
+
function Yt(n, e) {
|
|
744
|
+
return i(), r("svg", Xt, [...e[0] || (e[0] = [
|
|
745
|
+
d("path", {
|
|
712
746
|
stroke: "none",
|
|
713
747
|
d: "M0 0h24v24H0z",
|
|
714
748
|
fill: "none"
|
|
715
749
|
}, null, -1),
|
|
716
|
-
|
|
750
|
+
d("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)
|
|
717
751
|
])]);
|
|
718
752
|
}
|
|
719
|
-
const
|
|
753
|
+
const qt = /* @__PURE__ */ S(Wt, [["render", Yt]]), Jt = {}, Qt = {
|
|
720
754
|
xmlns: "http://www.w3.org/2000/svg",
|
|
721
755
|
class: "baklava-icon",
|
|
722
756
|
width: "24",
|
|
@@ -728,12 +762,12 @@ const Yt = /* @__PURE__ */ z(Ft, [["render", Xt]]), Jt = {}, qt = {
|
|
|
728
762
|
"stroke-linecap": "round",
|
|
729
763
|
"stroke-linejoin": "round"
|
|
730
764
|
};
|
|
731
|
-
function
|
|
732
|
-
return i(),
|
|
733
|
-
|
|
765
|
+
function Zt(n, e) {
|
|
766
|
+
return i(), r("svg", Qt, [...e[0] || (e[0] = [
|
|
767
|
+
se('<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)
|
|
734
768
|
])]);
|
|
735
769
|
}
|
|
736
|
-
const
|
|
770
|
+
const Kt = /* @__PURE__ */ S(Jt, [["render", Zt]]), es = {}, ts = {
|
|
737
771
|
xmlns: "http://www.w3.org/2000/svg",
|
|
738
772
|
class: "baklava-icon",
|
|
739
773
|
width: "24",
|
|
@@ -745,12 +779,12 @@ const Zt = /* @__PURE__ */ z(Jt, [["render", Qt]]), Kt = {}, es = {
|
|
|
745
779
|
"stroke-linecap": "round",
|
|
746
780
|
"stroke-linejoin": "round"
|
|
747
781
|
};
|
|
748
|
-
function
|
|
749
|
-
return i(),
|
|
750
|
-
|
|
782
|
+
function ss(n, e) {
|
|
783
|
+
return i(), r("svg", ts, [...e[0] || (e[0] = [
|
|
784
|
+
se('<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)
|
|
751
785
|
])]);
|
|
752
786
|
}
|
|
753
|
-
const
|
|
787
|
+
const ns = /* @__PURE__ */ S(es, [["render", ss]]), os = {}, as = {
|
|
754
788
|
xmlns: "http://www.w3.org/2000/svg",
|
|
755
789
|
class: "baklava-icon",
|
|
756
790
|
width: "24",
|
|
@@ -762,12 +796,12 @@ const ss = /* @__PURE__ */ z(Kt, [["render", ts]]), ns = {}, os = {
|
|
|
762
796
|
"stroke-linecap": "round",
|
|
763
797
|
"stroke-linejoin": "round"
|
|
764
798
|
};
|
|
765
|
-
function
|
|
766
|
-
return i(),
|
|
767
|
-
|
|
799
|
+
function is(n, e) {
|
|
800
|
+
return i(), r("svg", as, [...e[0] || (e[0] = [
|
|
801
|
+
se('<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)
|
|
768
802
|
])]);
|
|
769
803
|
}
|
|
770
|
-
const
|
|
804
|
+
const rs = /* @__PURE__ */ S(os, [["render", is]]), ds = {}, ls = {
|
|
771
805
|
xmlns: "http://www.w3.org/2000/svg",
|
|
772
806
|
class: "baklava-icon",
|
|
773
807
|
width: "16",
|
|
@@ -779,37 +813,37 @@ const is = /* @__PURE__ */ z(ns, [["render", as]]), ls = {}, rs = {
|
|
|
779
813
|
"stroke-linecap": "round",
|
|
780
814
|
"stroke-linejoin": "round"
|
|
781
815
|
};
|
|
782
|
-
function
|
|
783
|
-
return i(),
|
|
784
|
-
|
|
816
|
+
function us(n, e) {
|
|
817
|
+
return i(), r("svg", ls, [...e[0] || (e[0] = [
|
|
818
|
+
d("path", {
|
|
785
819
|
stroke: "none",
|
|
786
820
|
d: "M0 0h24v24H0z",
|
|
787
821
|
fill: "none"
|
|
788
822
|
}, null, -1),
|
|
789
|
-
|
|
823
|
+
d("circle", {
|
|
790
824
|
cx: "12",
|
|
791
825
|
cy: "12",
|
|
792
826
|
r: "1"
|
|
793
827
|
}, null, -1),
|
|
794
|
-
|
|
828
|
+
d("circle", {
|
|
795
829
|
cx: "12",
|
|
796
830
|
cy: "19",
|
|
797
831
|
r: "1"
|
|
798
832
|
}, null, -1),
|
|
799
|
-
|
|
833
|
+
d("circle", {
|
|
800
834
|
cx: "12",
|
|
801
835
|
cy: "5",
|
|
802
836
|
r: "1"
|
|
803
837
|
}, null, -1)
|
|
804
838
|
])]);
|
|
805
839
|
}
|
|
806
|
-
const
|
|
840
|
+
const cs = /* @__PURE__ */ S(ds, [["render", us]]), ps = ["id", "data-node-type"], hs = {
|
|
807
841
|
class: "__title-label",
|
|
808
842
|
style: { "flex-grow": "1" }
|
|
809
|
-
},
|
|
843
|
+
}, vs = { key: 0 }, ms = {
|
|
810
844
|
class: "__menu",
|
|
811
845
|
style: { display: "flex" }
|
|
812
|
-
},
|
|
846
|
+
}, fs = { class: "__outputs" }, gs = { key: 0 }, bs = ["id", "title"], _s = { class: "__inputs" }, ys = { key: 0 }, ws = ["id", "title"], Cs = /* @__PURE__ */ j({
|
|
813
847
|
__name: "CodeGraphNode",
|
|
814
848
|
props: {
|
|
815
849
|
node: {},
|
|
@@ -817,345 +851,347 @@ const us = /* @__PURE__ */ z(ls, [["render", ds]]), cs = ["id", "data-node-type"
|
|
|
817
851
|
dragging: { type: Boolean }
|
|
818
852
|
},
|
|
819
853
|
emits: ["select", "start-drag", "update"],
|
|
820
|
-
setup(
|
|
821
|
-
const t =
|
|
822
|
-
let
|
|
823
|
-
const p =
|
|
854
|
+
setup(n, { emit: e }) {
|
|
855
|
+
const t = _e.ContextMenu, s = _e.NodeInterface, o = n, a = b(() => o.node), u = e, { viewModel: l } = F(), { graph: v, switchGraph: _ } = ee(), y = O(null), x = O(!1), B = O(""), w = O(null), m = O(!1);
|
|
856
|
+
let f = 0, h = 0;
|
|
857
|
+
const p = O(!1), C = b(() => {
|
|
824
858
|
const c = [
|
|
825
859
|
{ value: "edit", label: "Edit" },
|
|
826
860
|
{ value: "rename", label: "Rename" },
|
|
827
861
|
{ value: "delete", label: "Delete" }
|
|
828
862
|
];
|
|
829
|
-
return
|
|
830
|
-
}),
|
|
831
|
-
"--selected":
|
|
832
|
-
"--dragging":
|
|
833
|
-
"--two-column": !!
|
|
863
|
+
return o.node.type.startsWith(J) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
|
|
864
|
+
}), M = b(() => ({
|
|
865
|
+
"--selected": o.selected,
|
|
866
|
+
"--dragging": o.dragging,
|
|
867
|
+
"--two-column": !!o.node.twoColumn,
|
|
834
868
|
"--hidden": a.value.state?.hidden
|
|
835
|
-
})),
|
|
836
|
-
"--reverse-y":
|
|
837
|
-
})),
|
|
838
|
-
top: `${
|
|
839
|
-
left: `${
|
|
840
|
-
"--width": `${
|
|
841
|
-
})),
|
|
869
|
+
})), Te = b(() => ({
|
|
870
|
+
"--reverse-y": o.node.reverseY ?? l.value.settings.nodes.reverseY
|
|
871
|
+
})), Ee = b(() => ({
|
|
872
|
+
top: `${o.node.position?.y ?? 0}px`,
|
|
873
|
+
left: `${o.node.position?.x ?? 0}px`,
|
|
874
|
+
"--width": `${o.node.width ?? l.value.settings.nodes.defaultWidth}px`
|
|
875
|
+
})), ze = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), Se = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), pe = () => {
|
|
842
876
|
u("select");
|
|
843
|
-
},
|
|
844
|
-
|
|
845
|
-
},
|
|
877
|
+
}, Be = (c) => {
|
|
878
|
+
o.selected || pe(), u("start-drag", c);
|
|
879
|
+
}, he = () => {
|
|
846
880
|
p.value = !0;
|
|
847
|
-
},
|
|
848
|
-
const c =
|
|
881
|
+
}, Le = () => {
|
|
882
|
+
const c = l.value.displayedGraph.sidebar;
|
|
849
883
|
c.nodeId = "", c.visible = !1;
|
|
850
|
-
},
|
|
851
|
-
const c =
|
|
852
|
-
c.nodeId =
|
|
853
|
-
},
|
|
854
|
-
const c =
|
|
855
|
-
c.nodeId =
|
|
856
|
-
},
|
|
884
|
+
}, ve = () => {
|
|
885
|
+
const c = l.value.displayedGraph.sidebar;
|
|
886
|
+
c.nodeId = o.node.id, c.visible = !0;
|
|
887
|
+
}, Ve = () => {
|
|
888
|
+
const c = l.value.displayedGraph.sidebar;
|
|
889
|
+
c.nodeId = o.node.id;
|
|
890
|
+
}, je = async (c) => {
|
|
857
891
|
switch (c) {
|
|
858
892
|
case "edit":
|
|
859
|
-
|
|
893
|
+
ve();
|
|
860
894
|
break;
|
|
861
895
|
case "delete":
|
|
862
|
-
|
|
896
|
+
v.value.removeNode(o.node);
|
|
863
897
|
break;
|
|
864
898
|
case "rename":
|
|
865
|
-
B.value =
|
|
899
|
+
B.value = o.node.title, x.value = !0, await lt(), w.value?.focus();
|
|
866
900
|
break;
|
|
867
901
|
case "editSubgraph":
|
|
868
|
-
|
|
902
|
+
_(o.node.template);
|
|
869
903
|
break;
|
|
870
904
|
}
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
},
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
m.value = !0,
|
|
877
|
-
},
|
|
905
|
+
}, me = () => {
|
|
906
|
+
o.node.title = B.value, x.value = !1;
|
|
907
|
+
}, fe = () => {
|
|
908
|
+
y.value && l.value.hooks.renderNode.execute({ node: o.node, el: y.value });
|
|
909
|
+
}, Ue = (c) => {
|
|
910
|
+
m.value = !0, f = o.node.width, h = c.clientX, c.preventDefault();
|
|
911
|
+
}, ge = (c) => {
|
|
878
912
|
if (!m.value) return;
|
|
879
|
-
const
|
|
880
|
-
|
|
881
|
-
},
|
|
913
|
+
const N = c.clientX - h, g = f + N / v.value.scaling, Ge = l.value.settings.nodes.minWidth, Re = l.value.settings.nodes.maxWidth;
|
|
914
|
+
o.node.width = Math.max(Ge, Math.min(Re, g));
|
|
915
|
+
}, be = () => {
|
|
882
916
|
m.value = !1;
|
|
883
917
|
};
|
|
884
|
-
return
|
|
885
|
-
|
|
886
|
-
}),
|
|
887
|
-
window.removeEventListener("mousemove",
|
|
888
|
-
}), (c,
|
|
918
|
+
return te(() => {
|
|
919
|
+
fe(), window.addEventListener("mousemove", ge), window.addEventListener("mouseup", be);
|
|
920
|
+
}), Ne(fe), rt(() => {
|
|
921
|
+
window.removeEventListener("mousemove", ge), window.removeEventListener("mouseup", be);
|
|
922
|
+
}), (c, N) => (i(), r("div", {
|
|
889
923
|
id: a.value.id,
|
|
890
924
|
ref_key: "el",
|
|
891
|
-
ref:
|
|
892
|
-
class: U([
|
|
925
|
+
ref: y,
|
|
926
|
+
class: U([M.value, "baklava-node"]),
|
|
893
927
|
"data-node-type": a.value.type,
|
|
894
|
-
style:
|
|
895
|
-
onPointerdown:
|
|
928
|
+
style: ne(Ee.value),
|
|
929
|
+
onPointerdown: pe
|
|
896
930
|
}, [
|
|
897
|
-
|
|
931
|
+
k(l).settings.nodes.resizable ? (i(), r("div", {
|
|
898
932
|
key: 0,
|
|
899
933
|
class: "__resize-handle",
|
|
900
|
-
onMousedown:
|
|
901
|
-
}, null, 32)) :
|
|
902
|
-
|
|
934
|
+
onMousedown: Ue
|
|
935
|
+
}, null, 32)) : I("", !0),
|
|
936
|
+
d("div", {
|
|
903
937
|
class: "__title",
|
|
904
|
-
onPointerdown:
|
|
905
|
-
onContextmenu:
|
|
938
|
+
onPointerdown: P(Be, ["self", "stop"]),
|
|
939
|
+
onContextmenu: P(he, ["prevent"])
|
|
906
940
|
}, [
|
|
907
|
-
a.value.inputs._node ? (i(), V(
|
|
941
|
+
a.value.inputs._node ? (i(), V(we, {
|
|
908
942
|
key: 0,
|
|
909
943
|
node: a.value,
|
|
910
944
|
intf: a.value.inputs._node,
|
|
911
945
|
class: "--input",
|
|
912
946
|
"data-interface-type": "node",
|
|
913
947
|
style: { "flex-grow": "0" }
|
|
914
|
-
}, null, 8, ["node", "intf"])) :
|
|
915
|
-
|
|
948
|
+
}, null, 8, ["node", "intf"])) : I("", !0),
|
|
949
|
+
x.value ? oe((i(), r("input", {
|
|
916
950
|
key: 2,
|
|
917
951
|
ref_key: "renameInputEl",
|
|
918
|
-
ref:
|
|
919
|
-
"onUpdate:modelValue":
|
|
952
|
+
ref: w,
|
|
953
|
+
"onUpdate:modelValue": N[1] || (N[1] = (g) => B.value = g),
|
|
920
954
|
class: "baklava-input",
|
|
921
955
|
placeholder: "Node Name",
|
|
922
956
|
style: { "flex-grow": "1" },
|
|
923
957
|
type: "text",
|
|
924
|
-
onBlur:
|
|
925
|
-
onKeydown:
|
|
958
|
+
onBlur: me,
|
|
959
|
+
onKeydown: Z(me, ["enter"])
|
|
926
960
|
}, null, 544)), [
|
|
927
|
-
[
|
|
928
|
-
]) : (i(),
|
|
929
|
-
|
|
930
|
-
a.value.idx > -1 ? (i(),
|
|
931
|
-
|
|
961
|
+
[ae, B.value]
|
|
962
|
+
]) : (i(), r($, { key: 1 }, [
|
|
963
|
+
d("div", hs, [
|
|
964
|
+
a.value.idx > -1 ? (i(), r("span", vs, E(a.value.idx + 1) + " - ", 1)) : I("", !0),
|
|
965
|
+
dt(E(a.value.title) + " (" + E(a.value.shortId) + ") ", 1)
|
|
932
966
|
]),
|
|
933
|
-
|
|
934
|
-
a.value.subgraph ?
|
|
935
|
-
!
|
|
967
|
+
d("div", ms, [
|
|
968
|
+
a.value.subgraph ? I("", !0) : (i(), r($, { key: 0 }, [
|
|
969
|
+
!k(l).displayedGraph.sidebar.visible && k(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(k(qt), {
|
|
936
970
|
key: 0,
|
|
937
971
|
class: "--clickable mx-1",
|
|
938
|
-
onClick:
|
|
939
|
-
})) :
|
|
972
|
+
onClick: ve
|
|
973
|
+
})) : k(l).displayedGraph.sidebar.visible && k(l).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), V(k(Dt), {
|
|
940
974
|
key: 1,
|
|
941
975
|
class: "--clickable mx-1",
|
|
942
|
-
onClick:
|
|
943
|
-
})) : (i(), V(
|
|
976
|
+
onClick: Ve
|
|
977
|
+
})) : (i(), V(k(Ft), {
|
|
944
978
|
key: 2,
|
|
945
979
|
class: "--clickable mx-1",
|
|
946
|
-
onClick:
|
|
980
|
+
onClick: Le
|
|
947
981
|
}))
|
|
948
982
|
], 64)),
|
|
949
|
-
|
|
983
|
+
T(k(cs), {
|
|
950
984
|
class: "--clickable mx-1",
|
|
951
|
-
onClick:
|
|
985
|
+
onClick: he
|
|
952
986
|
}),
|
|
953
|
-
|
|
987
|
+
T(k(t), {
|
|
954
988
|
modelValue: p.value,
|
|
955
|
-
"onUpdate:modelValue":
|
|
989
|
+
"onUpdate:modelValue": N[0] || (N[0] = (g) => p.value = g),
|
|
956
990
|
x: 0,
|
|
957
991
|
y: 0,
|
|
958
|
-
items:
|
|
959
|
-
onClick:
|
|
992
|
+
items: C.value,
|
|
993
|
+
onClick: je
|
|
960
994
|
}, null, 8, ["modelValue", "items"])
|
|
961
995
|
])
|
|
962
996
|
], 64)),
|
|
963
|
-
a.value.outputs._node ? (i(), V(
|
|
997
|
+
a.value.outputs._node ? (i(), V(we, {
|
|
964
998
|
key: 3,
|
|
965
999
|
node: a.value,
|
|
966
1000
|
intf: a.value.outputs._node,
|
|
967
1001
|
class: "--output",
|
|
968
1002
|
"data-interface-type": "node"
|
|
969
|
-
}, null, 8, ["node", "intf"])) :
|
|
1003
|
+
}, null, 8, ["node", "intf"])) : I("", !0)
|
|
970
1004
|
], 32),
|
|
971
|
-
|
|
972
|
-
class: U(["__content",
|
|
973
|
-
onKeydown:
|
|
1005
|
+
d("div", {
|
|
1006
|
+
class: U(["__content", Te.value]),
|
|
1007
|
+
onKeydown: N[2] || (N[2] = Z(P(() => {
|
|
974
1008
|
}, ["stop"]), ["delete"])),
|
|
975
|
-
onContextmenu:
|
|
1009
|
+
onContextmenu: N[3] || (N[3] = P(() => {
|
|
976
1010
|
}, ["prevent"]))
|
|
977
1011
|
}, [
|
|
978
|
-
|
|
979
|
-
(i(!0),
|
|
980
|
-
key:
|
|
1012
|
+
d("div", fs, [
|
|
1013
|
+
(i(!0), r($, null, A(Se.value, (g) => (i(), r($, {
|
|
1014
|
+
key: g.id
|
|
981
1015
|
}, [
|
|
982
|
-
a.value.state?.hidden ? (i(),
|
|
983
|
-
|
|
1016
|
+
a.value.state?.hidden ? (i(), r("div", gs, [
|
|
1017
|
+
g.port ? (i(), r("div", {
|
|
984
1018
|
key: 0,
|
|
985
|
-
id:
|
|
986
|
-
title:
|
|
1019
|
+
id: g.id,
|
|
1020
|
+
title: g.name,
|
|
987
1021
|
class: "baklava-node-interface --output --connected"
|
|
988
|
-
}, [...
|
|
989
|
-
|
|
990
|
-
])], 8,
|
|
991
|
-
])) :
|
|
1022
|
+
}, [...N[4] || (N[4] = [
|
|
1023
|
+
d("div", { class: "__port" }, null, -1)
|
|
1024
|
+
])], 8, bs)) : I("", !0)
|
|
1025
|
+
])) : Q(c.$slots, "nodeInterface", {
|
|
992
1026
|
key: 1,
|
|
993
1027
|
type: "output",
|
|
994
1028
|
node: a.value,
|
|
995
|
-
intf:
|
|
1029
|
+
intf: g
|
|
996
1030
|
}, () => [
|
|
997
|
-
|
|
1031
|
+
T(k(s), {
|
|
998
1032
|
node: a.value,
|
|
999
|
-
intf:
|
|
1033
|
+
intf: g
|
|
1000
1034
|
}, null, 8, ["node", "intf"])
|
|
1001
1035
|
])
|
|
1002
1036
|
], 64))), 128))
|
|
1003
1037
|
]),
|
|
1004
|
-
|
|
1005
|
-
(i(!0),
|
|
1006
|
-
key:
|
|
1038
|
+
d("div", _s, [
|
|
1039
|
+
(i(!0), r($, null, A(ze.value, (g) => (i(), r($, {
|
|
1040
|
+
key: g.id
|
|
1007
1041
|
}, [
|
|
1008
|
-
a.value.state?.hidden ? (i(),
|
|
1009
|
-
|
|
1042
|
+
a.value.state?.hidden ? (i(), r("div", ys, [
|
|
1043
|
+
g.port ? (i(), r("div", {
|
|
1010
1044
|
key: 0,
|
|
1011
|
-
id:
|
|
1012
|
-
title:
|
|
1045
|
+
id: g.id,
|
|
1046
|
+
title: g.name,
|
|
1013
1047
|
class: "baklava-node-interface --input --connected"
|
|
1014
|
-
}, [...
|
|
1015
|
-
|
|
1016
|
-
])], 8,
|
|
1017
|
-
])) :
|
|
1048
|
+
}, [...N[5] || (N[5] = [
|
|
1049
|
+
d("div", { class: "__port" }, null, -1)
|
|
1050
|
+
])], 8, ws)) : I("", !0)
|
|
1051
|
+
])) : Q(c.$slots, "nodeInterface", {
|
|
1018
1052
|
key: 1,
|
|
1019
1053
|
node: a.value,
|
|
1020
|
-
intf:
|
|
1054
|
+
intf: g,
|
|
1021
1055
|
type: "input"
|
|
1022
1056
|
}, () => [
|
|
1023
|
-
|
|
1057
|
+
T(k(s), {
|
|
1024
1058
|
node: a.value,
|
|
1025
|
-
intf:
|
|
1026
|
-
title:
|
|
1059
|
+
intf: g,
|
|
1060
|
+
title: g.name
|
|
1027
1061
|
}, null, 8, ["node", "intf", "title"])
|
|
1028
1062
|
])
|
|
1029
1063
|
], 64))), 128))
|
|
1030
1064
|
])
|
|
1031
1065
|
], 34)
|
|
1032
|
-
], 46,
|
|
1066
|
+
], 46, ps));
|
|
1033
1067
|
}
|
|
1034
|
-
}),
|
|
1068
|
+
}), ks = ["title"], xs = {
|
|
1035
1069
|
key: 0,
|
|
1036
1070
|
class: "__label"
|
|
1037
|
-
},
|
|
1071
|
+
}, Ns = /* @__PURE__ */ j({
|
|
1038
1072
|
__name: "Checkbox",
|
|
1039
1073
|
props: {
|
|
1040
|
-
|
|
1074
|
+
disabled: { type: Boolean },
|
|
1041
1075
|
inversed: { type: Boolean },
|
|
1076
|
+
modelValue: { type: Boolean },
|
|
1042
1077
|
name: {}
|
|
1043
1078
|
},
|
|
1044
1079
|
emits: ["update:modelValue"],
|
|
1045
|
-
setup(
|
|
1080
|
+
setup(n, { emit: e }) {
|
|
1046
1081
|
const t = e;
|
|
1047
|
-
return (s,
|
|
1048
|
-
class: U(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue }]),
|
|
1082
|
+
return (s, o) => (i(), r("div", {
|
|
1083
|
+
class: U(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue, "--disabled": s.disabled }]),
|
|
1049
1084
|
title: s.name,
|
|
1050
|
-
onClick:
|
|
1085
|
+
onClick: o[0] || (o[0] = (a) => t("update:modelValue", !s.modelValue))
|
|
1051
1086
|
}, [
|
|
1052
|
-
|
|
1053
|
-
|
|
1087
|
+
o[1] || (o[1] = d("div", { class: "__checkmark-container" }, [
|
|
1088
|
+
d("svg", {
|
|
1054
1089
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1055
1090
|
width: "18",
|
|
1056
1091
|
height: "18",
|
|
1057
1092
|
viewBox: "0 0 18 18"
|
|
1058
1093
|
}, [
|
|
1059
|
-
|
|
1094
|
+
d("path", {
|
|
1060
1095
|
class: "__checkmark",
|
|
1061
1096
|
d: "M 6 5 L 6 10 L 16 10",
|
|
1062
1097
|
transform: "rotate(-45 10 10)"
|
|
1063
1098
|
})
|
|
1064
1099
|
])
|
|
1065
1100
|
], -1)),
|
|
1066
|
-
s.name ? (i(),
|
|
1067
|
-
], 10,
|
|
1101
|
+
s.name ? (i(), r("div", xs, E(s.name), 1)) : I("", !0)
|
|
1102
|
+
], 10, ks));
|
|
1068
1103
|
}
|
|
1069
|
-
}), Is = { class: "__header" },
|
|
1104
|
+
}), Is = { class: "__header" }, Ms = { class: "__node-name" }, Os = { style: { display: "flex" } }, $s = {
|
|
1070
1105
|
key: 1,
|
|
1071
1106
|
class: "__interface"
|
|
1072
|
-
}, Ts = /* @__PURE__ */
|
|
1107
|
+
}, Ts = /* @__PURE__ */ j({
|
|
1073
1108
|
__name: "CodeGraphSidebar",
|
|
1074
|
-
setup(
|
|
1075
|
-
const { viewModel: e } = F(), { graph: t } =
|
|
1076
|
-
let u = 0,
|
|
1077
|
-
const
|
|
1078
|
-
const
|
|
1079
|
-
return t.value.nodes.find((p) => p.id ===
|
|
1080
|
-
}),
|
|
1081
|
-
width: `${
|
|
1082
|
-
})),
|
|
1109
|
+
setup(n) {
|
|
1110
|
+
const { viewModel: e } = F(), { graph: t } = ee(), s = O(null), o = Ie(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
|
|
1111
|
+
let u = 0, l = 0;
|
|
1112
|
+
const v = b(() => {
|
|
1113
|
+
const h = t.value.sidebar.nodeId;
|
|
1114
|
+
return t.value.nodes.find((p) => p.id === h);
|
|
1115
|
+
}), _ = b(() => v.value), y = b(() => ({
|
|
1116
|
+
width: `${o.value}px`
|
|
1117
|
+
})), x = b(() => _.value ? [...Object.values(_.value.inputs), ...Object.values(_.value.outputs)].filter((p) => p.displayInSidebar && p.component) : []), B = () => {
|
|
1083
1118
|
t.value.sidebar.visible = !1;
|
|
1084
|
-
},
|
|
1085
|
-
|
|
1086
|
-
}, m = (
|
|
1087
|
-
u =
|
|
1119
|
+
}, w = () => {
|
|
1120
|
+
v.value?.events.update.emit(null);
|
|
1121
|
+
}, m = (h) => {
|
|
1122
|
+
u = o.value, l = h.clientX, window.addEventListener("mousemove", f), window.addEventListener(
|
|
1088
1123
|
"mouseup",
|
|
1089
1124
|
() => {
|
|
1090
|
-
window.removeEventListener("mousemove",
|
|
1125
|
+
window.removeEventListener("mousemove", f);
|
|
1091
1126
|
},
|
|
1092
1127
|
{ once: !0 }
|
|
1093
1128
|
);
|
|
1094
|
-
},
|
|
1095
|
-
const p = s.value?.parentElement?.getBoundingClientRect().width ?? 500,
|
|
1096
|
-
let
|
|
1097
|
-
|
|
1129
|
+
}, f = (h) => {
|
|
1130
|
+
const p = s.value?.parentElement?.getBoundingClientRect().width ?? 500, C = h.clientX - l;
|
|
1131
|
+
let M = u - C;
|
|
1132
|
+
M < 300 ? M = 300 : M > 0.9 * p && (M = 0.9 * p), o.value = M;
|
|
1098
1133
|
};
|
|
1099
|
-
return (
|
|
1134
|
+
return (h, p) => (i(), r("div", {
|
|
1100
1135
|
ref_key: "el",
|
|
1101
1136
|
ref: s,
|
|
1102
|
-
class: U(["baklava-sidebar", { "--open":
|
|
1103
|
-
style:
|
|
1137
|
+
class: U(["baklava-sidebar", { "--open": k(t).sidebar.visible }]),
|
|
1138
|
+
style: ne(y.value)
|
|
1104
1139
|
}, [
|
|
1105
|
-
a.value ? (i(),
|
|
1140
|
+
a.value ? (i(), r("div", {
|
|
1106
1141
|
key: 0,
|
|
1107
1142
|
class: "__resizer",
|
|
1108
1143
|
onMousedown: m
|
|
1109
|
-
}, null, 32)) :
|
|
1110
|
-
|
|
1111
|
-
|
|
1144
|
+
}, null, 32)) : I("", !0),
|
|
1145
|
+
d("div", Is, [
|
|
1146
|
+
d("button", {
|
|
1112
1147
|
tabindex: "-1",
|
|
1113
1148
|
class: "__close",
|
|
1114
1149
|
onClick: B
|
|
1115
1150
|
}, "×"),
|
|
1116
|
-
|
|
1117
|
-
|
|
1151
|
+
d("div", Ms, [
|
|
1152
|
+
d("b", null, E(v.value ? v.value.title : ""), 1)
|
|
1118
1153
|
])
|
|
1119
1154
|
]),
|
|
1120
|
-
(i(!0),
|
|
1121
|
-
key:
|
|
1155
|
+
(i(!0), r($, null, A(x.value, (C) => (i(), r("div", {
|
|
1156
|
+
key: C.id,
|
|
1122
1157
|
class: "__interface"
|
|
1123
1158
|
}, [
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
modelValue:
|
|
1159
|
+
d("div", Os, [
|
|
1160
|
+
T(Ns, {
|
|
1161
|
+
modelValue: C.hidden,
|
|
1127
1162
|
"onUpdate:modelValue": [
|
|
1128
|
-
(
|
|
1129
|
-
p[0] || (p[0] = () =>
|
|
1163
|
+
(M) => C.hidden = M,
|
|
1164
|
+
p[0] || (p[0] = () => v.value?.events.update.emit(null))
|
|
1130
1165
|
],
|
|
1166
|
+
disabled: !C.optional,
|
|
1131
1167
|
inversed: "",
|
|
1132
1168
|
style: { "margin-right": "8px" }
|
|
1133
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
1134
|
-
(i(), V(
|
|
1135
|
-
modelValue:
|
|
1136
|
-
"onUpdate:modelValue": (
|
|
1137
|
-
node:
|
|
1138
|
-
intf:
|
|
1169
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
|
|
1170
|
+
(i(), V(ut(C.component), {
|
|
1171
|
+
modelValue: C.value,
|
|
1172
|
+
"onUpdate:modelValue": (M) => C.value = M,
|
|
1173
|
+
node: v.value,
|
|
1174
|
+
intf: C,
|
|
1139
1175
|
style: { width: "100%" }
|
|
1140
1176
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "node", "intf"]))
|
|
1141
1177
|
])
|
|
1142
1178
|
]))), 128)),
|
|
1143
|
-
|
|
1144
|
-
p[2] || (p[2] =
|
|
1145
|
-
|
|
1146
|
-
"onUpdate:modelValue": p[1] || (p[1] = (
|
|
1179
|
+
_.value && _.value.state ? (i(), r("div", $s, [
|
|
1180
|
+
p[2] || (p[2] = d("label", null, "Variable name", -1)),
|
|
1181
|
+
oe(d("input", {
|
|
1182
|
+
"onUpdate:modelValue": p[1] || (p[1] = (C) => _.value.state.variableName = C),
|
|
1147
1183
|
type: "text",
|
|
1148
1184
|
class: "baklava-input",
|
|
1149
1185
|
title: "Variable name",
|
|
1150
|
-
onBlur:
|
|
1151
|
-
onKeydown:
|
|
1186
|
+
onBlur: w,
|
|
1187
|
+
onKeydown: Z(w, ["enter"])
|
|
1152
1188
|
}, null, 544), [
|
|
1153
|
-
[
|
|
1189
|
+
[ae, _.value.state.variableName]
|
|
1154
1190
|
])
|
|
1155
|
-
])) :
|
|
1191
|
+
])) : I("", !0)
|
|
1156
1192
|
], 6));
|
|
1157
1193
|
}
|
|
1158
|
-
}),
|
|
1194
|
+
}), Es = j({
|
|
1159
1195
|
props: {
|
|
1160
1196
|
type: {
|
|
1161
1197
|
type: String,
|
|
@@ -1166,174 +1202,187 @@ const us = /* @__PURE__ */ z(ls, [["render", ds]]), cs = ["id", "data-node-type"
|
|
|
1166
1202
|
required: !0
|
|
1167
1203
|
}
|
|
1168
1204
|
},
|
|
1169
|
-
setup(
|
|
1170
|
-
const { viewModel: e } = F(), { switchGraph: t } =
|
|
1171
|
-
return { showContextMenu: s, hasContextMenu:
|
|
1205
|
+
setup(n) {
|
|
1206
|
+
const { viewModel: e } = F(), { switchGraph: t } = ee(), s = O(!1), o = b(() => n.type.startsWith(J));
|
|
1207
|
+
return { showContextMenu: s, hasContextMenu: o, contextMenuItems: [
|
|
1172
1208
|
{ label: "Edit Subgraph", value: "editSubgraph" },
|
|
1173
1209
|
{ label: "Delete Subgraph", value: "deleteSubgraph" }
|
|
1174
1210
|
], openContextMenu: () => {
|
|
1175
1211
|
s.value = !0;
|
|
1176
|
-
}, onContextMenuClick: (
|
|
1177
|
-
const
|
|
1178
|
-
if (
|
|
1179
|
-
switch (
|
|
1212
|
+
}, onContextMenuClick: (v) => {
|
|
1213
|
+
const _ = n.type.substring(J.length), y = e.value.editor.graphTemplates.find((x) => x.id === _);
|
|
1214
|
+
if (y)
|
|
1215
|
+
switch (v) {
|
|
1180
1216
|
case "editSubgraph":
|
|
1181
|
-
t(
|
|
1217
|
+
t(y);
|
|
1182
1218
|
break;
|
|
1183
1219
|
case "deleteSubgraph":
|
|
1184
|
-
e.value.editor.removeGraphTemplate(
|
|
1220
|
+
e.value.editor.removeGraphTemplate(y);
|
|
1185
1221
|
break;
|
|
1186
1222
|
}
|
|
1187
1223
|
} };
|
|
1188
1224
|
}
|
|
1189
|
-
}),
|
|
1190
|
-
function
|
|
1191
|
-
return i(),
|
|
1225
|
+
}), zs = ["data-node-type"], Ss = { class: "__title" }, Bs = { class: "__title-label" };
|
|
1226
|
+
function Ls(n, e, t, s, o, a) {
|
|
1227
|
+
return i(), r("div", {
|
|
1192
1228
|
class: "baklava-node --palette",
|
|
1193
|
-
"data-node-type":
|
|
1229
|
+
"data-node-type": n.type
|
|
1194
1230
|
}, [
|
|
1195
|
-
|
|
1196
|
-
|
|
1231
|
+
d("div", Ss, [
|
|
1232
|
+
d("div", Bs, E(n.title), 1)
|
|
1197
1233
|
])
|
|
1198
|
-
], 8,
|
|
1234
|
+
], 8, zs);
|
|
1199
1235
|
}
|
|
1200
|
-
const
|
|
1236
|
+
const Ce = /* @__PURE__ */ S(Es, [["render", Ls]]), Vs = {
|
|
1201
1237
|
class: "baklava-node --palette",
|
|
1202
|
-
style: { "margin-top": "-20px", "margin-bottom": "
|
|
1203
|
-
},
|
|
1238
|
+
style: { "margin-top": "-20px", "margin-bottom": "20px" }
|
|
1239
|
+
}, js = {
|
|
1240
|
+
key: 0,
|
|
1241
|
+
style: { display: "flex", "justify-content": "space-between" }
|
|
1242
|
+
}, Us = ["onClick"], Gs = {
|
|
1243
|
+
key: 0,
|
|
1244
|
+
style: { margin: "auto 0", "font-size": "12px" }
|
|
1245
|
+
}, Rs = /* @__PURE__ */ j({
|
|
1204
1246
|
__name: "CodeNodePalette",
|
|
1205
|
-
setup(
|
|
1206
|
-
const { viewModel: e } = F(), { x: t, y: s } =
|
|
1207
|
-
(
|
|
1208
|
-
(
|
|
1247
|
+
setup(n) {
|
|
1248
|
+
const { viewModel: e } = F(), { x: t, y: s } = _t(), { transform: o } = et(), a = tt(e), u = ct("editorEl"), l = O(""), v = O(null), _ = () => l.value ? a.value.filter(
|
|
1249
|
+
(w) => w.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(w.nodeTypes).some(
|
|
1250
|
+
(m) => m.title.toLowerCase().includes(l.value.toLowerCase())
|
|
1209
1251
|
)
|
|
1210
|
-
) :
|
|
1211
|
-
(m) => m.title.toLowerCase().includes(
|
|
1212
|
-
) : Object.values(
|
|
1213
|
-
if (!
|
|
1214
|
-
const { left:
|
|
1252
|
+
) : a.value, y = (w) => l.value ? Object.values(w).filter(
|
|
1253
|
+
(m) => m.category.toLowerCase().includes(l.value.toLowerCase()) || m.title.toLowerCase().includes(l.value.toLowerCase())
|
|
1254
|
+
) : Object.values(w), x = b(() => {
|
|
1255
|
+
if (!v.value || !u?.value) return {};
|
|
1256
|
+
const { left: w, top: m } = u.value.getBoundingClientRect();
|
|
1215
1257
|
return {
|
|
1216
1258
|
top: `${s.value - m}px`,
|
|
1217
|
-
left: `${t.value -
|
|
1259
|
+
left: `${t.value - w}px`
|
|
1218
1260
|
};
|
|
1219
|
-
}), B = (
|
|
1220
|
-
|
|
1221
|
-
type:
|
|
1261
|
+
}), B = (w, m) => {
|
|
1262
|
+
v.value = {
|
|
1263
|
+
type: w,
|
|
1222
1264
|
nodeInformation: m
|
|
1223
1265
|
};
|
|
1224
|
-
const
|
|
1225
|
-
const
|
|
1226
|
-
e.value.displayedGraph.addNode(
|
|
1227
|
-
const p = u.value.getBoundingClientRect(), [
|
|
1228
|
-
|
|
1266
|
+
const f = () => {
|
|
1267
|
+
const h = G(new m.type());
|
|
1268
|
+
e.value.displayedGraph.addNode(h);
|
|
1269
|
+
const p = u.value.getBoundingClientRect(), [C, M] = o(t.value - p.left, s.value - p.top);
|
|
1270
|
+
h.position.x = C, h.position.y = M, v.value = null, document.removeEventListener("pointerup", f);
|
|
1229
1271
|
};
|
|
1230
|
-
document.addEventListener("pointerup",
|
|
1272
|
+
document.addEventListener("pointerup", f);
|
|
1231
1273
|
};
|
|
1232
|
-
return (
|
|
1233
|
-
|
|
1234
|
-
class: U(["baklava-node-palette", { "--open":
|
|
1235
|
-
onContextmenu: m[1] || (m[1] =
|
|
1274
|
+
return (w, m) => (i(), r($, null, [
|
|
1275
|
+
d("div", {
|
|
1276
|
+
class: U(["baklava-node-palette", { "--open": k(e).settings.palette.enabled }]),
|
|
1277
|
+
onContextmenu: m[1] || (m[1] = P(() => {
|
|
1236
1278
|
}, ["stop", "prevent"]))
|
|
1237
1279
|
}, [
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
"onUpdate:modelValue": m[0] || (m[0] = (
|
|
1280
|
+
d("div", Vs, [
|
|
1281
|
+
oe(d("input", {
|
|
1282
|
+
"onUpdate:modelValue": m[0] || (m[0] = (f) => l.value = f),
|
|
1241
1283
|
type: "text",
|
|
1242
1284
|
class: "baklava-input",
|
|
1243
|
-
title: "Filter
|
|
1244
|
-
|
|
1245
|
-
|
|
1285
|
+
title: "Filter nodes",
|
|
1286
|
+
onKeyup: _
|
|
1287
|
+
}, null, 544), [
|
|
1288
|
+
[ae, l.value]
|
|
1246
1289
|
])
|
|
1247
1290
|
]),
|
|
1248
|
-
(i(!0),
|
|
1249
|
-
key:
|
|
1291
|
+
(i(!0), r($, null, A(_(), (f) => (i(), r("section", {
|
|
1292
|
+
key: f.name
|
|
1250
1293
|
}, [
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1294
|
+
f.name !== "default" ? (i(), r("h3", js, [
|
|
1295
|
+
d("div", {
|
|
1296
|
+
onClick: (h) => l.value = f.name,
|
|
1297
|
+
style: { cursor: "pointer" }
|
|
1298
|
+
}, E(f.name), 9, Us),
|
|
1299
|
+
y(f.nodeTypes).length < Object.values(f.nodeTypes).length ? (i(), r("div", Gs, " ( " + E(y(f.nodeTypes).length) + " / " + E(Object.values(f.nodeTypes).length) + " ) ", 1)) : I("", !0)
|
|
1300
|
+
])) : I("", !0),
|
|
1301
|
+
(i(!0), r($, null, A(y(f.nodeTypes), (h) => (i(), V(Ce, {
|
|
1302
|
+
key: h.type,
|
|
1303
|
+
type: h.type,
|
|
1304
|
+
title: h.title,
|
|
1305
|
+
onPointerdown: (p) => B(h.type, h)
|
|
1257
1306
|
}, null, 8, ["type", "title", "onPointerdown"]))), 128))
|
|
1258
1307
|
]))), 128))
|
|
1259
1308
|
], 34),
|
|
1260
|
-
|
|
1309
|
+
T(pt, { name: "fade" }, {
|
|
1261
1310
|
default: X(() => [
|
|
1262
|
-
|
|
1311
|
+
v.value ? (i(), r("div", {
|
|
1263
1312
|
key: 0,
|
|
1264
1313
|
class: "baklava-dragged-node",
|
|
1265
|
-
style:
|
|
1314
|
+
style: ne(x.value)
|
|
1266
1315
|
}, [
|
|
1267
|
-
|
|
1268
|
-
type:
|
|
1269
|
-
title:
|
|
1316
|
+
T(Ce, {
|
|
1317
|
+
type: v.value.type,
|
|
1318
|
+
title: v.value.nodeInformation.title
|
|
1270
1319
|
}, null, 8, ["type", "title"])
|
|
1271
|
-
], 4)) :
|
|
1320
|
+
], 4)) : I("", !0)
|
|
1272
1321
|
]),
|
|
1273
1322
|
_: 1
|
|
1274
1323
|
})
|
|
1275
1324
|
], 64));
|
|
1276
1325
|
}
|
|
1277
|
-
}),
|
|
1326
|
+
}), un = /* @__PURE__ */ j({
|
|
1278
1327
|
__name: "CodeGraphEditor",
|
|
1279
1328
|
props: {
|
|
1280
1329
|
viewModel: {}
|
|
1281
1330
|
},
|
|
1282
|
-
setup(
|
|
1283
|
-
const t =
|
|
1284
|
-
return
|
|
1331
|
+
setup(n) {
|
|
1332
|
+
const t = Ie(n, "viewModel"), s = (o) => o.events.update.emit(null);
|
|
1333
|
+
return te(() => {
|
|
1285
1334
|
t.value.subscribe(), t.value.engine.start();
|
|
1286
|
-
}),
|
|
1335
|
+
}), ht(() => {
|
|
1287
1336
|
t.value.unsubscribe(), t.value.engine.stop();
|
|
1288
|
-
}), (
|
|
1337
|
+
}), (o, a) => (i(), V(k(st), { "view-model": t.value }, {
|
|
1289
1338
|
palette: X(() => [
|
|
1290
|
-
|
|
1339
|
+
T(Rs)
|
|
1291
1340
|
]),
|
|
1292
1341
|
node: X((u) => [
|
|
1293
|
-
|
|
1294
|
-
onUpdate: (
|
|
1342
|
+
T(Cs, ft(u, {
|
|
1343
|
+
onUpdate: (l) => s(u.node)
|
|
1295
1344
|
}), null, 16, ["onUpdate"])
|
|
1296
1345
|
]),
|
|
1297
1346
|
sidebar: X((u) => [
|
|
1298
|
-
|
|
1347
|
+
T(Ts, vt(mt(u)), null, 16)
|
|
1299
1348
|
]),
|
|
1300
1349
|
_: 1
|
|
1301
1350
|
}, 8, ["view-model"]));
|
|
1302
1351
|
}
|
|
1303
|
-
}),
|
|
1352
|
+
}), Ds = (n) => {
|
|
1304
1353
|
const e = "TOGGLE_PALETTE";
|
|
1305
|
-
|
|
1306
|
-
execute: () =>
|
|
1354
|
+
n.commandHandler.registerCommand(e, {
|
|
1355
|
+
execute: () => n.settings.palette.enabled = !n.settings.palette.enabled,
|
|
1307
1356
|
canExecute: () => !0
|
|
1308
1357
|
});
|
|
1309
1358
|
const t = "CLEAR_ALL";
|
|
1310
|
-
|
|
1311
|
-
execute: () =>
|
|
1312
|
-
canExecute: () =>
|
|
1359
|
+
n.commandHandler.registerCommand(t, {
|
|
1360
|
+
execute: () => n.code.clear(),
|
|
1361
|
+
canExecute: () => n.displayedGraph.nodes.length > 0
|
|
1313
1362
|
});
|
|
1314
1363
|
const s = "TOGGLE_MINIMAP";
|
|
1315
|
-
|
|
1316
|
-
execute: () =>
|
|
1317
|
-
canExecute: () =>
|
|
1318
|
-
}),
|
|
1364
|
+
n.commandHandler.registerCommand(s, {
|
|
1365
|
+
execute: () => n.settings.enableMinimap = !n.settings.enableMinimap,
|
|
1366
|
+
canExecute: () => n.displayedGraph.nodes.length > 1
|
|
1367
|
+
}), n.settings.toolbar.commands = [
|
|
1319
1368
|
{
|
|
1320
1369
|
command: e,
|
|
1321
1370
|
title: "Toggle palette",
|
|
1322
1371
|
// Tooltip text
|
|
1323
|
-
icon:
|
|
1372
|
+
icon: b(() => n.settings.palette.enabled ? St : jt)
|
|
1324
1373
|
},
|
|
1325
|
-
...
|
|
1374
|
+
...nt,
|
|
1326
1375
|
{
|
|
1327
1376
|
command: t,
|
|
1328
1377
|
title: "Clear all",
|
|
1329
1378
|
// Tooltip text
|
|
1330
|
-
icon:
|
|
1379
|
+
icon: rs
|
|
1331
1380
|
},
|
|
1332
1381
|
{
|
|
1333
1382
|
command: s,
|
|
1334
1383
|
title: "Toggle minimap",
|
|
1335
1384
|
// Tooltip text
|
|
1336
|
-
icon:
|
|
1385
|
+
icon: b(() => n.settings.enableMinimap ? ns : Kt)
|
|
1337
1386
|
}
|
|
1338
1387
|
];
|
|
1339
1388
|
}, W = {
|
|
@@ -1351,22 +1400,26 @@ const fe = /* @__PURE__ */ z($s, [["render", Bs]]), Vs = {
|
|
|
1351
1400
|
},
|
|
1352
1401
|
displayValueOnHover: !1
|
|
1353
1402
|
};
|
|
1354
|
-
function
|
|
1355
|
-
const e =
|
|
1356
|
-
e.code =
|
|
1403
|
+
function cn(n) {
|
|
1404
|
+
const e = ot(n?.existingEditor);
|
|
1405
|
+
e.code = n?.code ? new n.code(e) : new Mt(e), Ds(e);
|
|
1357
1406
|
const t = {};
|
|
1358
1407
|
return Object.keys(W).forEach((s) => {
|
|
1359
1408
|
t[s] = typeof W[s] == "object" ? { ...e.settings[s], ...W[s] } : W[s];
|
|
1360
|
-
}), e.settings =
|
|
1409
|
+
}), e.settings = G({ ...e.settings, ...t }), e.settings.nodes.defaultWidth = 350, e.state = G({
|
|
1361
1410
|
modules: {},
|
|
1362
1411
|
token: null
|
|
1363
|
-
}), e.engine = new
|
|
1412
|
+
}), e.engine = new at(e.editor), e.subscribe = () => {
|
|
1364
1413
|
e.state.token && e.unsubscribe();
|
|
1365
1414
|
const s = Symbol();
|
|
1366
|
-
e.displayedGraph.events.addNode.subscribe(s, (
|
|
1367
|
-
e.engine.pause(), e.code && (e.code.onCodeUpdate(), e.code.sortNodes()
|
|
1368
|
-
}), e.engine.events.
|
|
1369
|
-
e.engine.pause()
|
|
1415
|
+
e.displayedGraph.events.addNode.subscribe(s, (o) => o.code = e.code), e.engine.events.beforeRun.subscribe(s, () => {
|
|
1416
|
+
e.engine.pause(), e.code && (e.code.onCodeUpdate(), e.code.sortNodes()), e.engine.resume();
|
|
1417
|
+
}), e.engine.events.beforeNodeCalculation.subscribe(s, (o) => {
|
|
1418
|
+
e.engine.pause();
|
|
1419
|
+
const a = o.node;
|
|
1420
|
+
a.isCodeNode && (a.updateOutputVariableName(), a.updateCodeNodeInputInterfaces()), e.engine.resume();
|
|
1421
|
+
}), e.engine.events.afterRun.subscribe(s, (o) => {
|
|
1422
|
+
e.engine.pause(), it(o, e.editor), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
|
|
1370
1423
|
}), e.state.token = s;
|
|
1371
1424
|
}, e.unsubscribe = () => {
|
|
1372
1425
|
if (!e.state.token) return;
|
|
@@ -1375,47 +1428,46 @@ function rn(o) {
|
|
|
1375
1428
|
}, e;
|
|
1376
1429
|
}
|
|
1377
1430
|
export {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
M as CodeNodeInterface,
|
|
1388
|
-
yt as CodeOutputInterface,
|
|
1431
|
+
yt as AbstractCodeNode,
|
|
1432
|
+
Qs as CheckboxInterface,
|
|
1433
|
+
vn as CheckboxInterfaceComponent,
|
|
1434
|
+
Mt as Code,
|
|
1435
|
+
un as CodeGraphEditor,
|
|
1436
|
+
Me as CodeNode,
|
|
1437
|
+
re as CodeNodeInputInterface,
|
|
1438
|
+
R as CodeNodeInterface,
|
|
1439
|
+
Nt as CodeNodeOutputInterface,
|
|
1389
1440
|
W as DEFAULT_SETTINGS,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1441
|
+
It as DynamicCodeNode,
|
|
1442
|
+
Zs as IntegerInterface,
|
|
1443
|
+
mn as IntegerInterfaceComponent,
|
|
1444
|
+
Ks as NumberInterface,
|
|
1445
|
+
fn as NumberInterfaceComponent,
|
|
1446
|
+
en as SelectInterface,
|
|
1447
|
+
gn as SelectInterfaceComponent,
|
|
1448
|
+
tn as SliderInterface,
|
|
1449
|
+
bn as SliderInterfaceComponent,
|
|
1450
|
+
sn as TextInputInterface,
|
|
1451
|
+
_n as TextInputInterfaceComponent,
|
|
1452
|
+
nn as TextareaInputInterface,
|
|
1453
|
+
yn as TextareaInputInterfaceComponent,
|
|
1454
|
+
Js as addDefaultInterfaceTypes,
|
|
1455
|
+
Ds as addToolbarCommands,
|
|
1456
|
+
$e as booleanType,
|
|
1457
|
+
on as defineCodeNode,
|
|
1458
|
+
an as defineDynamicCodeNode,
|
|
1459
|
+
kt as dictType,
|
|
1460
|
+
Ys as formatInputs,
|
|
1461
|
+
K as getCodeNodes,
|
|
1462
|
+
rn as getPositionAtColumn,
|
|
1463
|
+
dn as getPositionBeforeNode,
|
|
1464
|
+
xt as listType,
|
|
1465
|
+
Oe as loadNodeState,
|
|
1415
1466
|
H as nodeType,
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1467
|
+
de as numberType,
|
|
1468
|
+
wt as saveNodeState,
|
|
1469
|
+
qs as setOptional,
|
|
1470
|
+
le as stringType,
|
|
1471
|
+
ln as transferCodeScript,
|
|
1472
|
+
cn as useCodeGraph
|
|
1421
1473
|
};
|