@babsey/code-graph 0.0.15 → 0.0.17

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