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