@babsey/code-graph 0.4.2 → 0.4.4

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,10 +1,10 @@
1
1
  import ce from "mustache";
2
- import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as P, markRaw as Y, computed as A, createElementVNode as m, withDirectives as ke, vModelText as xe, createStaticVNode as fe, toRef as $e, ref as B, createVNode as G, unref as O, mergeModels as He, useModel as Nt, resolveComponent as qe, createCommentVNode as L, onMounted as Se, onBeforeUnmount as Je, watch as Qe, createBlock as H, withCtx as ee, normalizeProps as Et, guardReactiveProps as Tt, renderSlot as q, mergeProps as Ot, onUpdated as Ze, normalizeStyle as Ae, normalizeClass as oe, withModifiers as ue, Fragment as U, createTextVNode as et, withKeys as Oe, renderList as ae, nextTick as Mt, resolveDynamicComponent as Be, inject as $t, Transition as St, shallowReadonly as At } from "vue";
2
+ import { reactive as te, defineComponent as F, createElementBlock as b, openBlock as p, toDisplayString as P, markRaw as Y, computed as A, createElementVNode as m, withDirectives as ke, vModelText as xe, createStaticVNode as fe, toRef as $e, ref as H, createVNode as G, unref as O, mergeModels as Be, useModel as Nt, resolveComponent as qe, createCommentVNode as L, onMounted as Se, onBeforeUnmount as Je, watch as Qe, createBlock as B, withCtx as ee, normalizeProps as Et, guardReactiveProps as Tt, renderSlot as q, mergeProps as Ot, onUpdated as Ze, normalizeStyle as Ae, normalizeClass as oe, withModifiers as de, Fragment as U, createTextVNode as et, withKeys as Oe, renderList as ae, nextTick as Mt, resolveDynamicComponent as He, inject as $t, Transition as St, shallowReadonly as At } from "vue";
3
3
  import { v4 as re } from "uuid";
4
- import { AbstractNode as Gt, NodeInterface as J, Graph as Rt, getGraphNodeTypeString as tt, GraphTemplate as jt, GRAPH_NODE_TYPE_PREFIX as Lt, GRAPH_INPUT_NODE_TYPE as Pt, GRAPH_OUTPUT_NODE_TYPE as Vt, Editor as Ht } from "@baklavajs/core";
5
- import { NodeInterfaceType as ie, BaklavaInterfaceTypes as Bt, setType as V } from "@baklavajs/interface-types";
6
- import { allowMultipleConnections as de, BaseEngine as zt, sortTopologically as Ut, applyResult as nt } from "@baklavajs/engine";
7
- import { displayInSidebar as ot, CheckboxInterfaceComponent as Dt, useGraph as Ge, IntegerInterfaceComponent as Ft, TextInputInterfaceComponent as st, NumberInterfaceComponent as Yt, SelectInterfaceComponent as Wt, SliderInterfaceComponent as Kt, TextareaInputInterfaceComponent as Xt, Commands as ne, DEFAULT_TOOLBAR_COMMANDS as qt, BaklavaEditor as Jt, Components as Me, useViewModel as me, useTemporaryConnection as Qt, useTransform as Zt, useNodeCategories as en, TextInputInterface as at, DEFAULT_SETTINGS as tn, useCommandHandler as nn, useHistory as on, useClipboard as sn, registerDeleteNodesCommand as an, registerSaveSubgraphCommand as rn, registerSwitchToMainGraphCommand as ln, registerSidebarCommands as un, registerZoomToFitCommands as dn, setViewNodeProperties as cn } from "@baklavajs/renderer-vue";
4
+ import { AbstractNode as Gt, NodeInterface as J, Graph as Rt, getGraphNodeTypeString as tt, GraphTemplate as jt, GRAPH_NODE_TYPE_PREFIX as Lt, GRAPH_INPUT_NODE_TYPE as Pt, GRAPH_OUTPUT_NODE_TYPE as Vt, Editor as Bt } from "@baklavajs/core";
5
+ import { NodeInterfaceType as ie, BaklavaInterfaceTypes as Ht, setType as V } from "@baklavajs/interface-types";
6
+ import { allowMultipleConnections as ue, BaseEngine as zt, sortTopologically as Ut, applyResult as nt } from "@baklavajs/engine";
7
+ import { displayInSidebar as ot, CheckboxInterfaceComponent as Dt, useGraph as Ge, IntegerInterfaceComponent as Ft, TextInputInterfaceComponent as st, NumberInterfaceComponent as Yt, SelectInterfaceComponent as Wt, SliderInterfaceComponent as Kt, TextareaInputInterfaceComponent as Xt, Commands as ne, DEFAULT_TOOLBAR_COMMANDS as qt, BaklavaEditor as Jt, Components as Me, useViewModel as me, useTemporaryConnection as Qt, useTransform as Zt, useNodeCategories as en, TextInputInterface as at, DEFAULT_SETTINGS as tn, useCommandHandler as nn, useHistory as on, useClipboard as sn, registerDeleteNodesCommand as an, registerSaveSubgraphCommand as rn, registerSwitchToMainGraphCommand as ln, registerSidebarCommands as dn, registerZoomToFitCommands as un, setViewNodeProperties as cn } from "@baklavajs/renderer-vue";
8
8
  import pn from "toposort";
9
9
  import { SequentialHook as ze } from "@baklavajs/events";
10
10
  import { usePointer as hn } from "@vueuse/core";
@@ -309,8 +309,8 @@ class ve extends D {
309
309
  super.value = e, this.name !== "_code" && this.setHidden(!1);
310
310
  }
311
311
  }
312
- const lt = new ie("boolean"), bn = new ie("dict"), ut = new ie("list"), K = new ie("node"), dt = new ie("number"), ct = new ie("string"), pt = new ie("tuple"), la = (n) => {
313
- new Bt(n.editor, { viewPlugin: n }).addTypes(lt, bn, ut, K, dt, ct, pt);
312
+ const lt = new ie("boolean"), bn = new ie("dict"), dt = new ie("list"), K = new ie("node"), ut = new ie("number"), ct = new ie("string"), pt = new ie("tuple"), la = (n) => {
313
+ new Ht(n.editor, { viewPlugin: n }).addTypes(lt, bn, dt, K, ut, ct, pt);
314
314
  };
315
315
  class yn extends ve {
316
316
  constructor(e, t) {
@@ -336,7 +336,7 @@ class Le extends ve {
336
336
  min;
337
337
  max;
338
338
  constructor(e, t, s, o) {
339
- super(e, t), this.min = s, this.max = o, this.use(V, dt);
339
+ super(e, t), this.min = s, this.max = o, this.use(V, ut);
340
340
  }
341
341
  validate(e) {
342
342
  return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
@@ -348,9 +348,9 @@ class ht extends Le {
348
348
  return Number.isInteger(e) && super.validate(e);
349
349
  }
350
350
  }
351
- class ua extends ve {
351
+ class da extends ve {
352
352
  constructor(e = "", t = "") {
353
- super(e, t), this.setComponent(Y(st)), this.use(V, ut);
353
+ super(e, t), this.setComponent(Y(st)), this.use(V, dt);
354
354
  }
355
355
  getValue = () => `[${this.value}]`;
356
356
  }
@@ -370,7 +370,7 @@ class wn extends Pe {
370
370
  super(e, t), this.items = s;
371
371
  }
372
372
  }
373
- class da extends Le {
373
+ class ua extends Le {
374
374
  component = Y(Kt);
375
375
  min;
376
376
  max;
@@ -440,10 +440,10 @@ function ha(n) {
440
440
  constructor() {
441
441
  super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate.call(this, { inputs: e, ...t })), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.variableName != null && (this.state.variableName = n.variableName), n.codeTemplate && (this.codeTemplate = n.codeTemplate), this.addInput(
442
442
  "_code",
443
- new D("_code", []).use(V, K).use(de).setHidden(!0)
443
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
444
444
  ), this.addOutput(
445
445
  "_code",
446
- new D("_code", []).use(V, K).use(de).setHidden(!0)
446
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
447
447
  );
448
448
  }
449
449
  onPlaced() {
@@ -482,10 +482,10 @@ function fa(n) {
482
482
  constructor() {
483
483
  super(), this._title = n.title ?? n.type, this.executeFactory("input", n.inputs), this.executeFactory("output", n.outputs), n.calculate && (this.calculate = (e, t) => n.calculate?.call(this, e, t)), n.onCreate?.call(this), this.name = n.name ?? n.type, this.updateModules(n.modules), n.codeTemplate && (this.codeTemplate = n.codeTemplate), n.variableName && (this.state.variableName = n.variableName), this.addInput(
484
484
  "_code",
485
- new D("_code", []).use(V, K).use(de).setHidden(!0)
485
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
486
486
  ), this.addOutput(
487
487
  "_code",
488
- new D("_code", []).use(V, K).use(de).setHidden(!0)
488
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
489
489
  ), this.staticInputKeys.push("_code"), this.staticOutputKeys.push("_code");
490
490
  }
491
491
  onPlaced() {
@@ -667,24 +667,24 @@ class Mn extends zt {
667
667
  Object.entries(r.inputs).forEach(([f, C]) => {
668
668
  l[f] = this.getInterfaceValue(t, C.id);
669
669
  }), r.isCodeNode && (r.updateCodeTemplate(), r.updateOutputNames()), this.events.beforeNodeCalculation.emit({ inputValues: l, node: r });
670
- let d;
670
+ let u;
671
671
  if (r.calculate) {
672
- if (d = await r.calculate(l, { globalValues: s, engine: this }), a.has(r))
673
- for (const [f, C] of Object.entries(d))
674
- this.hooks.transferData.execute(d[f], C), a.get(r).forEach((h) => t.set(h.to.id, C));
672
+ if (u = await r.calculate(l, { globalValues: s, engine: this }), a.has(r))
673
+ for (const [f, C] of Object.entries(u))
674
+ this.hooks.transferData.execute(u[f], C), a.get(r).forEach((h) => t.set(h.to.id, C));
675
675
  } else {
676
- d = {};
676
+ u = {};
677
677
  for (const [f, C] of Object.entries(r.outputs))
678
- d[f] = this.getInterfaceValue(t, C.id);
678
+ u[f] = this.getInterfaceValue(t, C.id);
679
679
  }
680
- this.events.afterNodeCalculation.emit({ outputValues: d, node: r }), i.set(r.id, new Map(Object.entries(d))), a.has(r) && a.get(r).forEach((f) => {
680
+ this.events.afterNodeCalculation.emit({ outputValues: u, node: r }), i.set(r.id, new Map(Object.entries(u))), a.has(r) && a.get(r).forEach((f) => {
681
681
  const C = Object.entries(r.outputs).find(([, N]) => N.id === f.from.id)?.[0];
682
682
  if (!C)
683
683
  throw new Error(
684
684
  `Could not find key for interface ${f.from.id}
685
685
  This is likely an internal issue. Please report it on GitHub.`
686
686
  );
687
- const h = this.hooks.transferData.execute(d[C], f);
687
+ const h = this.hooks.transferData.execute(u[C], f);
688
688
  C !== "_code" && (f.to.allowMultipleConnections ? t.has(f.to.id) ? t.get(f.to.id).push(h) : t.set(f.to.id, [h]) : t.set(f.to.id, h));
689
689
  });
690
690
  }
@@ -761,7 +761,7 @@ function Ln(n, e) {
761
761
  m("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)
762
762
  ])]);
763
763
  }
764
- const Pn = /* @__PURE__ */ R(Rn, [["render", Ln]]), Vn = {}, Hn = {
764
+ const Pn = /* @__PURE__ */ R(Rn, [["render", Ln]]), Vn = {}, Bn = {
765
765
  xmlns: "http://www.w3.org/2000/svg",
766
766
  width: "24",
767
767
  height: "24",
@@ -773,8 +773,8 @@ const Pn = /* @__PURE__ */ R(Rn, [["render", Ln]]), Vn = {}, Hn = {
773
773
  "stroke-linejoin": "round",
774
774
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-copy"
775
775
  };
776
- function Bn(n, e) {
777
- return p(), b("svg", Hn, [...e[0] || (e[0] = [
776
+ function Hn(n, e) {
777
+ return p(), b("svg", Bn, [...e[0] || (e[0] = [
778
778
  m("path", {
779
779
  stroke: "none",
780
780
  d: "M0 0h24v24H0z",
@@ -784,7 +784,7 @@ function Bn(n, e) {
784
784
  m("path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" }, null, -1)
785
785
  ])]);
786
786
  }
787
- const zn = /* @__PURE__ */ R(Vn, [["render", Bn]]), Un = {}, Dn = {
787
+ const zn = /* @__PURE__ */ R(Vn, [["render", Hn]]), Un = {}, Dn = {
788
788
  xmlns: "http://www.w3.org/2000/svg",
789
789
  width: "24",
790
790
  height: "24",
@@ -1028,7 +1028,7 @@ function Vo(n, e) {
1028
1028
  fe('<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)
1029
1029
  ])]);
1030
1030
  }
1031
- const Ho = /* @__PURE__ */ R(Lo, [["render", Vo]]), Bo = {}, zo = {
1031
+ const Bo = /* @__PURE__ */ R(Lo, [["render", Vo]]), Ho = {}, zo = {
1032
1032
  xmlns: "http://www.w3.org/2000/svg",
1033
1033
  width: "24",
1034
1034
  height: "24",
@@ -1051,7 +1051,7 @@ function Uo(n, e) {
1051
1051
  m("path", { d: "M6 6l12 12" }, null, -1)
1052
1052
  ])]);
1053
1053
  }
1054
- const Do = /* @__PURE__ */ R(Bo, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_ENGINE", bt = "TOGGLE_MINIMAP", yt = "TOGGLE_PALETTE", Fo = (n, e, t) => {
1054
+ const Do = /* @__PURE__ */ R(Ho, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_ENGINE", bt = "TOGGLE_MINIMAP", yt = "TOGGLE_PALETTE", Fo = (n, e, t) => {
1055
1055
  const s = t.zoomToFit.paddingLeft;
1056
1056
  e.registerCommand(yt, {
1057
1057
  execute: () => {
@@ -1082,7 +1082,7 @@ const Do = /* @__PURE__ */ R(Bo, [["render", Uo]]), vt = "CLEAR_ALL", gt = "RUN_
1082
1082
  command: vt,
1083
1083
  title: "Clear all",
1084
1084
  // Tooltip text
1085
- icon: A(() => Ho)
1085
+ icon: A(() => Bo)
1086
1086
  }, o = {
1087
1087
  command: bt,
1088
1088
  title: "Toggle minimap",
@@ -1187,7 +1187,7 @@ class Ie extends Rt {
1187
1187
  * @param to code node interface
1188
1188
  */
1189
1189
  addConnection(e, t) {
1190
- e?.name !== "_code" && (e.hidden = !1), t?.name !== "_code" && (t.hidden = !1), super.addConnection(e, t);
1190
+ e && e?.name !== "_code" && (e.hidden = !1), t && t?.name !== "_code" && (t.hidden = !1), super.addConnection(e, t);
1191
1191
  }
1192
1192
  /**
1193
1193
  * Clear code graph.
@@ -1412,10 +1412,10 @@ function qo(n) {
1412
1412
  this.subgraph.outputs.some((s) => s.id === t) || this.removeOutput(t);
1413
1413
  this.addInput(
1414
1414
  "_code",
1415
- new D("_code", []).use(V, K).use(de).setHidden(!0)
1415
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
1416
1416
  ), this.addOutput(
1417
1417
  "_code",
1418
- new D("_code", []).use(V, K).use(de).setHidden(!0)
1418
+ new D("_code", []).use(V, K).use(ue).setHidden(!0)
1419
1419
  ), this.addOutput("_calculationResults", new J("_calculationResults", void 0).setHidden(!0));
1420
1420
  }
1421
1421
  /**
@@ -1435,8 +1435,8 @@ function qo(n) {
1435
1435
  )?.outputs.placeholder.id : r = this.subgraph?.nodes.find(
1436
1436
  (C) => kt.isGraphOutputNode(C) && C.graphInterfaceId === t.id
1437
1437
  )?.inputs.placeholder.id;
1438
- const l = this.subgraph?.connections.find((f) => r === (s ? f.from : f.to)?.id), d = s ? l?.to : l?.from;
1439
- if (d) return Reflect.get(d, i);
1438
+ const l = this.subgraph?.connections.find((f) => r === (s ? f.from : f.to)?.id), u = s ? l?.to : l?.from;
1439
+ if (u) return Reflect.get(u, i);
1440
1440
  }
1441
1441
  });
1442
1442
  }
@@ -1489,7 +1489,7 @@ class Ne extends jt {
1489
1489
  name: h.name,
1490
1490
  nodeId: o(h.nodeId),
1491
1491
  nodeInterfaceId: o(h.nodeInterfaceId)
1492
- })), d = this.outputs.map((h) => ({
1492
+ })), u = this.outputs.map((h) => ({
1493
1493
  id: h.id,
1494
1494
  name: h.name,
1495
1495
  nodeId: o(h.nodeId),
@@ -1499,7 +1499,7 @@ class Ne extends jt {
1499
1499
  nodes: i,
1500
1500
  connections: r,
1501
1501
  inputs: l,
1502
- outputs: d
1502
+ outputs: u
1503
1503
  };
1504
1504
  return e || (e = new Ie(this.editor)), e.load(f).forEach((h) => console.warn(h)), e.template = this, e;
1505
1505
  }
@@ -1546,7 +1546,7 @@ function os() {
1546
1546
  );
1547
1547
  }
1548
1548
  });
1549
- var l = r(279), d = /* @__PURE__ */ r.n(l), f = r(370), C = /* @__PURE__ */ r.n(f), h = r(817), N = /* @__PURE__ */ r.n(h);
1549
+ var l = r(279), u = /* @__PURE__ */ r.n(l), f = r(370), C = /* @__PURE__ */ r.n(f), h = r(817), N = /* @__PURE__ */ r.n(h);
1550
1550
  function v(g) {
1551
1551
  try {
1552
1552
  return document.execCommand(g);
@@ -1557,7 +1557,7 @@ function os() {
1557
1557
  var w = function(c) {
1558
1558
  var _ = N()(c);
1559
1559
  return v("cut"), _;
1560
- }, u = w;
1560
+ }, d = w;
1561
1561
  function y(g) {
1562
1562
  var c = document.documentElement.getAttribute("dir") === "rtl", _ = document.createElement("textarea");
1563
1563
  _.style.fontSize = "12pt", _.style.border = "0", _.style.padding = "0", _.style.margin = "0", _.style.position = "absolute", _.style[c ? "right" : "left"] = "-9999px";
@@ -1600,7 +1600,7 @@ function os() {
1600
1600
  container: I
1601
1601
  });
1602
1602
  if (E)
1603
- return x === "cut" ? u(E) : S(E, {
1603
+ return x === "cut" ? d(E) : S(E, {
1604
1604
  container: I
1605
1605
  });
1606
1606
  }, pe = Z;
@@ -1781,7 +1781,7 @@ function os() {
1781
1781
  }, {
1782
1782
  key: "cut",
1783
1783
  value: function(I) {
1784
- return u(I);
1784
+ return d(I);
1785
1785
  }
1786
1786
  /**
1787
1787
  * Returns the support of the given action, or all actions if no action is
@@ -1797,7 +1797,7 @@ function os() {
1797
1797
  }), W;
1798
1798
  }
1799
1799
  }]), _;
1800
- })(d()), M = _e;
1800
+ })(u()), M = _e;
1801
1801
  })
1802
1802
  ),
1803
1803
  /***/
@@ -1809,11 +1809,11 @@ function os() {
1809
1809
  var r = Element.prototype;
1810
1810
  r.matches = r.matchesSelector || r.mozMatchesSelector || r.msMatchesSelector || r.oMatchesSelector || r.webkitMatchesSelector;
1811
1811
  }
1812
- function l(d, f) {
1813
- for (; d && d.nodeType !== i; ) {
1814
- if (typeof d.matches == "function" && d.matches(f))
1815
- return d;
1816
- d = d.parentNode;
1812
+ function l(u, f) {
1813
+ for (; u && u.nodeType !== i; ) {
1814
+ if (typeof u.matches == "function" && u.matches(f))
1815
+ return u;
1816
+ u = u.parentNode;
1817
1817
  }
1818
1818
  }
1819
1819
  a.exports = l;
@@ -1824,22 +1824,22 @@ function os() {
1824
1824
  /***/
1825
1825
  (function(a, i, r) {
1826
1826
  var l = r(828);
1827
- function d(h, N, v, w, u) {
1827
+ function u(h, N, v, w, d) {
1828
1828
  var y = C.apply(this, arguments);
1829
- return h.addEventListener(v, y, u), {
1829
+ return h.addEventListener(v, y, d), {
1830
1830
  destroy: function() {
1831
- h.removeEventListener(v, y, u);
1831
+ h.removeEventListener(v, y, d);
1832
1832
  }
1833
1833
  };
1834
1834
  }
1835
- function f(h, N, v, w, u) {
1836
- return typeof h.addEventListener == "function" ? d.apply(null, arguments) : typeof v == "function" ? d.bind(null, document).apply(null, arguments) : (typeof h == "string" && (h = document.querySelectorAll(h)), Array.prototype.map.call(h, function(y) {
1837
- return d(y, N, v, w, u);
1835
+ function f(h, N, v, w, d) {
1836
+ return typeof h.addEventListener == "function" ? u.apply(null, arguments) : typeof v == "function" ? u.bind(null, document).apply(null, arguments) : (typeof h == "string" && (h = document.querySelectorAll(h)), Array.prototype.map.call(h, function(y) {
1837
+ return u(y, N, v, w, d);
1838
1838
  }));
1839
1839
  }
1840
1840
  function C(h, N, v, w) {
1841
- return function(u) {
1842
- u.delegateTarget = l(u.target, N), u.delegateTarget && w.call(h, u);
1841
+ return function(d) {
1842
+ d.delegateTarget = l(d.target, N), d.delegateTarget && w.call(h, d);
1843
1843
  };
1844
1844
  }
1845
1845
  a.exports = f;
@@ -1866,42 +1866,42 @@ function os() {
1866
1866
  370: (
1867
1867
  /***/
1868
1868
  (function(a, i, r) {
1869
- var l = r(879), d = r(438);
1870
- function f(v, w, u) {
1871
- if (!v && !w && !u)
1869
+ var l = r(879), u = r(438);
1870
+ function f(v, w, d) {
1871
+ if (!v && !w && !d)
1872
1872
  throw new Error("Missing required arguments");
1873
1873
  if (!l.string(w))
1874
1874
  throw new TypeError("Second argument must be a String");
1875
- if (!l.fn(u))
1875
+ if (!l.fn(d))
1876
1876
  throw new TypeError("Third argument must be a Function");
1877
1877
  if (l.node(v))
1878
- return C(v, w, u);
1878
+ return C(v, w, d);
1879
1879
  if (l.nodeList(v))
1880
- return h(v, w, u);
1880
+ return h(v, w, d);
1881
1881
  if (l.string(v))
1882
- return N(v, w, u);
1882
+ return N(v, w, d);
1883
1883
  throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList");
1884
1884
  }
1885
- function C(v, w, u) {
1886
- return v.addEventListener(w, u), {
1885
+ function C(v, w, d) {
1886
+ return v.addEventListener(w, d), {
1887
1887
  destroy: function() {
1888
- v.removeEventListener(w, u);
1888
+ v.removeEventListener(w, d);
1889
1889
  }
1890
1890
  };
1891
1891
  }
1892
- function h(v, w, u) {
1892
+ function h(v, w, d) {
1893
1893
  return Array.prototype.forEach.call(v, function(y) {
1894
- y.addEventListener(w, u);
1894
+ y.addEventListener(w, d);
1895
1895
  }), {
1896
1896
  destroy: function() {
1897
1897
  Array.prototype.forEach.call(v, function(y) {
1898
- y.removeEventListener(w, u);
1898
+ y.removeEventListener(w, d);
1899
1899
  });
1900
1900
  }
1901
1901
  };
1902
1902
  }
1903
- function N(v, w, u) {
1904
- return d(document.body, v, w, u);
1903
+ function N(v, w, d) {
1904
+ return u(document.body, v, w, d);
1905
1905
  }
1906
1906
  a.exports = f;
1907
1907
  })
@@ -1915,8 +1915,8 @@ function os() {
1915
1915
  if (r.nodeName === "SELECT")
1916
1916
  r.focus(), l = r.value;
1917
1917
  else if (r.nodeName === "INPUT" || r.nodeName === "TEXTAREA") {
1918
- var d = r.hasAttribute("readonly");
1919
- d || r.setAttribute("readonly", ""), r.select(), r.setSelectionRange(0, r.value.length), d || r.removeAttribute("readonly"), l = r.value;
1918
+ var u = r.hasAttribute("readonly");
1919
+ u || r.setAttribute("readonly", ""), r.select(), r.setSelectionRange(0, r.value.length), u || r.removeAttribute("readonly"), l = r.value;
1920
1920
  } else {
1921
1921
  r.hasAttribute("contenteditable") && r.focus();
1922
1922
  var f = window.getSelection(), C = document.createRange();
@@ -1934,32 +1934,32 @@ function os() {
1934
1934
  function i() {
1935
1935
  }
1936
1936
  i.prototype = {
1937
- on: function(r, l, d) {
1937
+ on: function(r, l, u) {
1938
1938
  var f = this.e || (this.e = {});
1939
1939
  return (f[r] || (f[r] = [])).push({
1940
1940
  fn: l,
1941
- ctx: d
1941
+ ctx: u
1942
1942
  }), this;
1943
1943
  },
1944
- once: function(r, l, d) {
1944
+ once: function(r, l, u) {
1945
1945
  var f = this;
1946
1946
  function C() {
1947
- f.off(r, C), l.apply(d, arguments);
1947
+ f.off(r, C), l.apply(u, arguments);
1948
1948
  }
1949
- return C._ = l, this.on(r, C, d);
1949
+ return C._ = l, this.on(r, C, u);
1950
1950
  },
1951
1951
  emit: function(r) {
1952
- var l = [].slice.call(arguments, 1), d = ((this.e || (this.e = {}))[r] || []).slice(), f = 0, C = d.length;
1952
+ var l = [].slice.call(arguments, 1), u = ((this.e || (this.e = {}))[r] || []).slice(), f = 0, C = u.length;
1953
1953
  for (f; f < C; f++)
1954
- d[f].fn.apply(d[f].ctx, l);
1954
+ u[f].fn.apply(u[f].ctx, l);
1955
1955
  return this;
1956
1956
  },
1957
1957
  off: function(r, l) {
1958
- var d = this.e || (this.e = {}), f = d[r], C = [];
1958
+ var u = this.e || (this.e = {}), f = u[r], C = [];
1959
1959
  if (f && l)
1960
1960
  for (var h = 0, N = f.length; h < N; h++)
1961
1961
  f[h].fn !== l && f[h].fn._ !== l && C.push(f[h]);
1962
- return C.length ? d[r] = C : delete d[r], this;
1962
+ return C.length ? u[r] = C : delete u[r], this;
1963
1963
  }
1964
1964
  }, a.exports = i, a.exports.TinyEmitter = i;
1965
1965
  })
@@ -2033,7 +2033,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2033
2033
  __name: "CopyToClipboard",
2034
2034
  props: { text: String },
2035
2035
  setup(n) {
2036
- const { toClipboard: e } = rs(), s = $e(n, "text"), o = B(!1), a = async () => {
2036
+ const { toClipboard: e } = rs(), s = $e(n, "text"), o = H(!1), a = async () => {
2037
2037
  try {
2038
2038
  await e(s.value), o.value = !0, setTimeout(() => o.value = !1, 1500), console.log("Copied to clipboard");
2039
2039
  } catch (i) {
@@ -2052,22 +2052,22 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2052
2052
  ]))
2053
2053
  ]));
2054
2054
  }
2055
- }), us = { class: "code-editor" }, ds = { class: "code-buttons" }, Ca = /* @__PURE__ */ F({
2055
+ }), ds = { class: "code-editor" }, us = { class: "code-buttons" }, Ca = /* @__PURE__ */ F({
2056
2056
  __name: "CodeEditor",
2057
- props: /* @__PURE__ */ He({
2057
+ props: /* @__PURE__ */ Be({
2058
2058
  locked: { type: Boolean },
2059
2059
  extensions: {}
2060
2060
  }, {
2061
2061
  modelValue: { required: !0, type: String },
2062
2062
  modelModifiers: {}
2063
2063
  }),
2064
- emits: /* @__PURE__ */ He(["update:locked"], ["update:modelValue"]),
2064
+ emits: /* @__PURE__ */ Be(["update:locked"], ["update:modelValue"]),
2065
2065
  setup(n, { emit: e }) {
2066
2066
  const t = Nt(n, "modelValue"), s = e, o = (a) => s("update:locked", a);
2067
2067
  return (a, i) => {
2068
2068
  const r = qe("codemirror");
2069
- return p(), b("div", us, [
2070
- m("div", ds, [
2069
+ return p(), b("div", ds, [
2070
+ m("div", us, [
2071
2071
  n.locked ? (p(), b("button", {
2072
2072
  key: 0,
2073
2073
  class: "baklava-button",
@@ -2096,15 +2096,11 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2096
2096
  },
2097
2097
  setup(n) {
2098
2098
  const t = $e(n, "viewModel"), s = (o) => o.events.update.emit(null);
2099
- return Se(() => {
2100
- t.value.subscribe && t.value.subscribe(), t.value.engine?.start();
2101
- }), Je(() => {
2102
- t.value.unsubscribe && t.value.unsubscribe(), t.value.engine?.stop();
2103
- }), Qe(t, (o, a) => {
2104
- a && a.unsubscribe(), o && o.subscribe();
2105
- }), (o, a) => (p(), H(O(Jt), { viewModel: t.value }, {
2099
+ return Se(t.value.onMounted), Je(t.value.onBeforeUnmount), Qe(t, (o, a) => {
2100
+ a && a.onBeforeUnmount(), o && o.onMounted();
2101
+ }), (o, a) => (p(), B(O(Jt), { "view-model": t.value }, {
2106
2102
  palette: ee(() => [
2107
- G(O(Hs))
2103
+ G(O(Bs))
2108
2104
  ]),
2109
2105
  node: ee((i) => [
2110
2106
  G(O(ws), Ot(i, {
@@ -2120,7 +2116,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2120
2116
  }, 16)
2121
2117
  ]),
2122
2118
  _: 3
2123
- }, 8, ["viewModel"]));
2119
+ }, 8, ["view-model"]));
2124
2120
  }
2125
2121
  }), cs = { class: "code-graph-info" }, ka = /* @__PURE__ */ F({
2126
2122
  __name: "CodeGraphInfo",
@@ -2136,7 +2132,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2136
2132
  m("div", null, "Engine status: " + P(n.viewModel.engine?.status), 1)
2137
2133
  ]));
2138
2134
  }
2139
- }), ps = ["id", "data-node-type"], hs = {
2135
+ }), ps = ["data-node-type", "id"], hs = {
2140
2136
  class: "__title-label",
2141
2137
  style: { "flex-grow": "1" }
2142
2138
  }, fs = { key: 0 }, ms = {
@@ -2151,9 +2147,9 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2151
2147
  },
2152
2148
  emits: ["select", "start-drag", "update"],
2153
2149
  setup(n, { emit: e }) {
2154
- const t = Me.ContextMenu, s = Me.NodeInterface, o = n, a = A(() => o.node), i = e, { viewModel: r } = me(), { graph: l, switchGraph: d } = Ge(), f = B(null), C = B(!1), h = B(""), N = B(null), v = B(!1);
2155
- let w = 0, u = 0;
2156
- const y = B(!1), $ = A(() => {
2150
+ const t = Me.ContextMenu, s = Me.NodeInterface, o = n, a = A(() => o.node), i = e, { viewModel: r } = me(), { graph: l, switchGraph: u } = Ge(), f = H(null), C = H(!1), h = H(""), N = H(null), v = H(!1);
2151
+ let w = 0, d = 0;
2152
+ const y = H(!1), $ = A(() => {
2157
2153
  const M = [
2158
2154
  { value: "edit", label: "Edit" },
2159
2155
  { value: "rename", label: "Rename" },
@@ -2198,7 +2194,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2198
2194
  h.value = o.node.title, C.value = !0, await Mt(), N.value?.focus();
2199
2195
  break;
2200
2196
  case "editSubgraph":
2201
- d(o.node.template);
2197
+ u(o.node.template);
2202
2198
  break;
2203
2199
  }
2204
2200
  }, be = () => {
@@ -2206,12 +2202,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2206
2202
  }, ye = () => {
2207
2203
  f.value && r.value.hooks.renderNode.execute({ node: o.node, el: f.value });
2208
2204
  }, Te = (M) => {
2209
- v.value = !0, w = o.node.width, u = M.clientX, M.preventDefault();
2205
+ v.value = !0, w = o.node.width, d = M.clientX, M.preventDefault();
2210
2206
  }, se = (M) => {
2211
2207
  a.value.state && (a.value.state.integrated = M, i("update"));
2212
2208
  }, le = (M) => {
2213
2209
  if (!v.value) return;
2214
- const g = M.clientX - u, c = w + g / l.value.scaling, _ = r.value.settings.nodes.minWidth, x = r.value.settings.nodes.maxWidth;
2210
+ const g = M.clientX - d, c = w + g / l.value.scaling, _ = r.value.settings.nodes.minWidth, x = r.value.settings.nodes.maxWidth;
2215
2211
  a.value.width = Math.max(_, Math.min(x, c));
2216
2212
  }, _e = () => {
2217
2213
  v.value = !1;
@@ -2221,12 +2217,12 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2221
2217
  }), Ze(ye), Je(() => {
2222
2218
  window.removeEventListener("mousemove", le), window.removeEventListener("mouseup", _e);
2223
2219
  }), (M, g) => (p(), b("div", {
2224
- id: a.value.id,
2225
- ref_key: "el",
2226
- ref: f,
2227
2220
  class: oe([T.value, "baklava-node"]),
2228
2221
  "data-node-type": a.value.type,
2222
+ id: a.value.id,
2229
2223
  style: Ae(Q.value),
2224
+ ref_key: "el",
2225
+ ref: f,
2230
2226
  onPointerdown: X
2231
2227
  }, [
2232
2228
  O(r).settings.nodes.resizable ? (p(), b("div", {
@@ -2236,18 +2232,18 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2236
2232
  }, null, 32)) : L("", !0),
2237
2233
  m("div", {
2238
2234
  class: "__title",
2239
- onPointerdown: ue(k, ["self", "stop"]),
2240
- onContextmenu: ue(j, ["prevent"])
2235
+ onPointerdown: de(k, ["self", "stop"]),
2236
+ onContextmenu: de(j, ["prevent"])
2241
2237
  }, [
2242
- a.value.inputs._code ? (p(), H(O(Ye), {
2238
+ a.value.inputs._code ? (p(), B(O(Ye), {
2243
2239
  key: 0,
2244
- node: a.value,
2245
2240
  intf: a.value.inputs._code,
2241
+ node: a.value,
2246
2242
  title: a.value.inputs._code.value,
2247
2243
  class: "--input",
2248
2244
  "data-interface-type": "node",
2249
2245
  style: { "flex-grow": "0" }
2250
- }, null, 8, ["node", "intf", "title"])) : L("", !0),
2246
+ }, null, 8, ["intf", "node", "title"])) : L("", !0),
2251
2247
  C.value ? ke((p(), b("input", {
2252
2248
  key: 2,
2253
2249
  ref_key: "renameInputEl",
@@ -2268,29 +2264,29 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2268
2264
  ]),
2269
2265
  m("div", ms, [
2270
2266
  a.value.isCodeNode ? (p(), b(U, { key: 0 }, [
2271
- a.value.state.lockCode ? (p(), H(O(mt), {
2267
+ a.value.state.lockCode ? (p(), B(O(mt), {
2272
2268
  key: 0,
2273
2269
  class: "--clickable mx-1",
2274
2270
  onClick: g[0] || (g[0] = (c) => a.value.lockCode = !1)
2275
2271
  })) : L("", !0),
2276
- a.value.state.integrated ? (p(), H(O(Pn), {
2272
+ a.value.state.integrated ? (p(), B(O(Pn), {
2277
2273
  key: 1,
2278
2274
  class: "--clickable mx-1",
2279
2275
  onClick: g[1] || (g[1] = (c) => se(!1))
2280
- })) : (p(), H(O(jo), {
2276
+ })) : (p(), B(O(jo), {
2281
2277
  key: 2,
2282
2278
  class: "--clickable mx-1",
2283
2279
  onClick: g[2] || (g[2] = (c) => se(!0))
2284
2280
  })),
2285
- !O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), H(O(ho), {
2281
+ !O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), B(O(ho), {
2286
2282
  key: 3,
2287
2283
  class: "--clickable mx-1",
2288
2284
  onClick: ge
2289
- })) : O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), H(O(so), {
2285
+ })) : O(r).displayedGraph.sidebar.visible && O(r).displayedGraph.sidebar.nodeId !== a.value.id ? (p(), B(O(so), {
2290
2286
  key: 4,
2291
2287
  class: "--clickable mx-1",
2292
2288
  onClick: he
2293
- })) : (p(), H(O(lo), {
2289
+ })) : (p(), B(O(lo), {
2294
2290
  key: 5,
2295
2291
  class: "--clickable mx-1",
2296
2292
  onClick: z
@@ -2310,7 +2306,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2310
2306
  }, null, 8, ["modelValue", "items"])
2311
2307
  ])
2312
2308
  ], 64)),
2313
- a.value.outputs._code ? (p(), H(O(Ye), {
2309
+ a.value.outputs._code ? (p(), B(O(Ye), {
2314
2310
  key: 3,
2315
2311
  node: a.value,
2316
2312
  intf: a.value.outputs._code,
@@ -2321,9 +2317,9 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2321
2317
  ], 32),
2322
2318
  m("div", {
2323
2319
  class: oe(["__content", S.value]),
2324
- onKeydown: g[5] || (g[5] = Oe(ue(() => {
2320
+ onKeydown: g[5] || (g[5] = Oe(de(() => {
2325
2321
  }, ["stop"]), ["delete"])),
2326
- onContextmenu: g[6] || (g[6] = ue(() => {
2322
+ onContextmenu: g[6] || (g[6] = de(() => {
2327
2323
  }, ["prevent"]))
2328
2324
  }, [
2329
2325
  m("div", vs, [
@@ -2390,11 +2386,11 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2390
2386
  intf: {}
2391
2387
  },
2392
2388
  setup(n) {
2393
- const e = n, { viewModel: t } = me(), { hoveredOver: s, temporaryConnection: o } = Qt(), a = B(null), i = A(() => e.intf.connectionCount > 0), r = A(() => ({
2389
+ const e = n, { viewModel: t } = me(), { hoveredOver: s, temporaryConnection: o } = Qt(), a = H(null), i = A(() => e.intf.connectionCount > 0), r = A(() => ({
2394
2390
  "--connected": i.value
2395
2391
  })), l = () => {
2396
2392
  s(e.intf);
2397
- }, d = () => {
2393
+ }, u = () => {
2398
2394
  s(void 0);
2399
2395
  }, f = () => {
2400
2396
  a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
@@ -2407,9 +2403,9 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2407
2403
  }, [
2408
2404
  n.intf.port ? (p(), b("div", {
2409
2405
  key: 0,
2410
- class: oe(["__port", { "--selected": O(o)?.from === n.intf }]),
2406
+ class: oe([{ "--selected": O(o)?.from === n.intf }, "__port"]),
2411
2407
  onPointerover: l,
2412
- onPointerout: d
2408
+ onPointerout: u
2413
2409
  }, null, 34)) : L("", !0),
2414
2410
  m("span", xs, [
2415
2411
  q(C.$slots, "default")
@@ -2458,26 +2454,26 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2458
2454
  }, Gs = { style: { display: "flex" } }, Rs = /* @__PURE__ */ F({
2459
2455
  __name: "CodeGraphSidebar",
2460
2456
  setup(n) {
2461
- const { viewModel: e } = me(), { graph: t } = Ge(), s = B(null), o = $e(e.value.settings.sidebar, "width"), a = A(() => e.value.settings.sidebar.resizable);
2457
+ const { viewModel: e } = me(), { graph: t } = Ge(), s = H(null), o = $e(e.value.settings.sidebar, "width"), a = A(() => e.value.settings.sidebar.resizable);
2462
2458
  let i = 0, r = 0;
2463
2459
  const l = A(() => {
2464
2460
  const y = t.value.sidebar.nodeId;
2465
2461
  return t.value.nodes.find(($) => $.id === y);
2466
- }), d = A(() => l.value), f = A(() => ({
2462
+ }), u = A(() => l.value), f = A(() => ({
2467
2463
  width: `${o.value}px`
2468
- })), C = A(() => d.value ? Object.values(d.value.inputs).filter((y) => y.displayInSidebar && y.component) : []), h = A(() => d.value ? Object.values(d.value.outputs).filter((y) => y.displayInSidebar && y.component) : []), N = () => {
2464
+ })), C = A(() => u.value ? Object.values(u.value.inputs).filter((y) => y.displayInSidebar && y.component) : []), h = A(() => u.value ? Object.values(u.value.outputs).filter((y) => y.displayInSidebar && y.component) : []), N = () => {
2469
2465
  t.value.sidebar.visible = !1;
2470
2466
  }, v = () => {
2471
2467
  l.value?.events.update.emit(null);
2472
2468
  }, w = (y) => {
2473
- i = o.value, r = y.clientX, window.addEventListener("mousemove", u), window.addEventListener(
2469
+ i = o.value, r = y.clientX, window.addEventListener("mousemove", d), window.addEventListener(
2474
2470
  "mouseup",
2475
2471
  () => {
2476
- window.removeEventListener("mousemove", u);
2472
+ window.removeEventListener("mousemove", d);
2477
2473
  },
2478
2474
  { once: !0 }
2479
2475
  );
2480
- }, u = (y) => {
2476
+ }, d = (y) => {
2481
2477
  const $ = s.value?.parentElement?.getBoundingClientRect().width ?? 500, T = y.clientX - r;
2482
2478
  let S = i - T;
2483
2479
  S < 300 ? S = 300 : S > 0.9 * $ && (S = 0.9 * $), o.value = S;
@@ -2521,7 +2517,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2521
2517
  inversed: "",
2522
2518
  style: { "padding-right": "8px" }
2523
2519
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
2524
- (p(), H(Be(T.component), {
2520
+ (p(), B(He(T.component), {
2525
2521
  modelValue: T.value,
2526
2522
  "onUpdate:modelValue": (S) => T.value = S,
2527
2523
  node: l.value,
@@ -2532,17 +2528,17 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2532
2528
  ]))), 128))
2533
2529
  ]),
2534
2530
  m("div", Ss, [
2535
- d.value && d.value.state ? (p(), b("div", As, [
2531
+ u.value && u.value.state ? (p(), b("div", As, [
2536
2532
  $[3] || ($[3] = m("label", null, "Variable name", -1)),
2537
2533
  ke(m("input", {
2538
- "onUpdate:modelValue": $[1] || ($[1] = (T) => d.value.state.variableName = T),
2534
+ "onUpdate:modelValue": $[1] || ($[1] = (T) => u.value.state.variableName = T),
2539
2535
  type: "text",
2540
2536
  class: "baklava-input",
2541
2537
  title: "Variable name",
2542
2538
  onBlur: v,
2543
2539
  onKeydown: Oe(v, ["enter"])
2544
2540
  }, null, 544), [
2545
- [xe, d.value.state.variableName]
2541
+ [xe, u.value.state.variableName]
2546
2542
  ])
2547
2543
  ])) : L("", !0),
2548
2544
  (p(!0), b(U, null, ae(h.value, (T) => (p(), b("div", {
@@ -2560,7 +2556,7 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2560
2556
  inversed: "",
2561
2557
  style: { "padding-right": "8px" }
2562
2558
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
2563
- (p(), H(Be(T.component), {
2559
+ (p(), B(He(T.component), {
2564
2560
  modelValue: T.value,
2565
2561
  "onUpdate:modelValue": (S) => T.value = S,
2566
2562
  node: l.value,
@@ -2584,45 +2580,45 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2584
2580
  }, Ps = ["onClick"], Vs = {
2585
2581
  key: 0,
2586
2582
  style: { margin: "auto 0", "font-size": "12px" }
2587
- }, Hs = /* @__PURE__ */ F({
2583
+ }, Bs = /* @__PURE__ */ F({
2588
2584
  __name: "CodeNodePalette",
2589
2585
  setup(n) {
2590
- const e = Me.PaletteEntry, { viewModel: t } = me(), { x: s, y: o } = hn(), { transform: a } = Zt(), i = en(t), r = $t("editorEl"), l = B(""), d = B(null), f = () => l.value ? i.value.filter(
2586
+ const e = Me.PaletteEntry, { viewModel: t } = me(), { x: s, y: o } = hn(), { transform: a } = Zt(), i = en(t), r = $t("editorEl"), l = H(""), u = H(null), f = () => l.value ? i.value.filter(
2591
2587
  (v) => v.name.toLowerCase().includes(l.value.toLowerCase()) || Object.values(v.nodeTypes).some(
2592
2588
  (w) => w.title.toLowerCase().includes(l.value.toLowerCase())
2593
2589
  )
2594
2590
  ) : i.value, C = (v) => l.value ? Jo(v, (w) => {
2595
- const u = w[1];
2596
- return u.category.includes(l.value.toLowerCase()) || u.title?.toLowerCase().includes(l.value.toLowerCase());
2591
+ const d = w[1];
2592
+ return d.category.includes(l.value.toLowerCase()) || d.title?.toLowerCase().includes(l.value.toLowerCase());
2597
2593
  }) : v, h = A(() => {
2598
- if (!d.value || !r?.value) return {};
2594
+ if (!u.value || !r?.value) return {};
2599
2595
  const { left: v, top: w } = r.value.getBoundingClientRect();
2600
2596
  return {
2601
2597
  top: `${o.value - w}px`,
2602
2598
  left: `${s.value - v}px`
2603
2599
  };
2604
2600
  }), N = (v, w) => {
2605
- d.value = {
2601
+ u.value = {
2606
2602
  type: v,
2607
2603
  nodeInformation: w
2608
2604
  };
2609
- const u = () => {
2605
+ const d = () => {
2610
2606
  const y = te(new w.type());
2611
2607
  t.value.displayedGraph.addNode(y);
2612
2608
  const $ = r.value.getBoundingClientRect(), [T, S] = a(s.value - $.left, o.value - $.top);
2613
- y.position.x = T, y.position.y = S, d.value = null, document.removeEventListener("pointerup", u);
2609
+ y.position.x = T, y.position.y = S, u.value = null, document.removeEventListener("pointerup", d);
2614
2610
  };
2615
- document.addEventListener("pointerup", u);
2611
+ document.addEventListener("pointerup", d);
2616
2612
  };
2617
2613
  return (v, w) => (p(), b(U, null, [
2618
2614
  m("div", {
2619
2615
  class: oe([{ "--open": O(t).settings.palette.enabled }, "baklava-node-palette"]),
2620
- onContextmenu: w[1] || (w[1] = ue(() => {
2616
+ onContextmenu: w[1] || (w[1] = de(() => {
2621
2617
  }, ["stop", "prevent"]))
2622
2618
  }, [
2623
2619
  m("div", js, [
2624
2620
  ke(m("input", {
2625
- "onUpdate:modelValue": w[0] || (w[0] = (u) => l.value = u),
2621
+ "onUpdate:modelValue": w[0] || (w[0] = (d) => l.value = d),
2626
2622
  type: "text",
2627
2623
  class: "baklava-input",
2628
2624
  title: "Filter nodes",
@@ -2631,34 +2627,34 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2631
2627
  [xe, l.value]
2632
2628
  ])
2633
2629
  ]),
2634
- (p(!0), b(U, null, ae(f(), (u) => (p(), b("section", {
2635
- key: u.name
2630
+ (p(!0), b(U, null, ae(f(), (d) => (p(), b("section", {
2631
+ key: d.name
2636
2632
  }, [
2637
- u.name !== "default" ? (p(), b("h3", Ls, [
2633
+ d.name !== "default" ? (p(), b("h3", Ls, [
2638
2634
  m("div", {
2639
- onClick: (y) => l.value = u.name,
2635
+ onClick: (y) => l.value = d.name,
2640
2636
  style: { cursor: "pointer" }
2641
- }, P(u.name), 9, Ps),
2642
- Object.keys(C(u.nodeTypes)).length < Object.values(u.nodeTypes).length ? (p(), b("div", Vs, " ( " + P(Object.keys(C(u.nodeTypes)).length) + " / " + P(Object.values(u.nodeTypes).length) + " ) ", 1)) : L("", !0)
2637
+ }, P(d.name), 9, Ps),
2638
+ Object.keys(C(d.nodeTypes)).length < Object.values(d.nodeTypes).length ? (p(), b("div", Vs, " ( " + P(Object.keys(C(d.nodeTypes)).length) + " / " + P(Object.values(d.nodeTypes).length) + " ) ", 1)) : L("", !0)
2643
2639
  ])) : L("", !0),
2644
- (p(!0), b(U, null, ae(C(u.nodeTypes), (y, $) => (p(), H(O(e), {
2640
+ (p(!0), b(U, null, ae(C(d.nodeTypes), (y, $) => (p(), B(O(e), {
2645
2641
  key: $,
2646
- type: $,
2647
2642
  title: y.title,
2643
+ type: $,
2648
2644
  onPointerdown: (T) => N($, y)
2649
- }, null, 8, ["type", "title", "onPointerdown"]))), 128))
2645
+ }, null, 8, ["title", "type", "onPointerdown"]))), 128))
2650
2646
  ]))), 128))
2651
2647
  ], 34),
2652
2648
  G(St, { name: "fade" }, {
2653
2649
  default: ee(() => [
2654
- d.value ? (p(), b("div", {
2650
+ u.value ? (p(), b("div", {
2655
2651
  key: 0,
2656
2652
  class: "baklava-dragged-node",
2657
2653
  style: Ae(h.value)
2658
2654
  }, [
2659
2655
  G(O(e), {
2660
- type: d.value.type,
2661
- title: d.value.nodeInformation.title
2656
+ type: u.value.type,
2657
+ title: u.value.nodeInformation.title
2662
2658
  }, null, 8, ["type", "title"])
2663
2659
  ], 4)) : L("", !0)
2664
2660
  ]),
@@ -2666,10 +2662,10 @@ const as = /* @__PURE__ */ ts(ss), rs = (n) => ({
2666
2662
  })
2667
2663
  ], 64));
2668
2664
  }
2669
- }), Bs = {}, zs = { class: "prependIcon" }, Us = { class: "appendIcon" };
2665
+ }), Hs = {}, zs = { class: "prependIcon" }, Us = { class: "appendIcon" };
2670
2666
  function Ds(n, e) {
2671
2667
  const t = qe("router-link");
2672
- return p(), H(t, { class: "navItem" }, {
2668
+ return p(), B(t, { class: "navItem" }, {
2673
2669
  default: ee(() => [
2674
2670
  m("span", zs, [
2675
2671
  q(n.$slots, "prependIcon")
@@ -2682,7 +2678,7 @@ function Ds(n, e) {
2682
2678
  _: 3
2683
2679
  });
2684
2680
  }
2685
- const Ke = /* @__PURE__ */ R(Bs, [["render", Ds]]), Fs = { class: "navbar" }, Ys = ["onClick"], xa = /* @__PURE__ */ F({
2681
+ const Ke = /* @__PURE__ */ R(Hs, [["render", Ds]]), Fs = { class: "navbar" }, Ys = ["onClick"], xa = /* @__PURE__ */ F({
2686
2682
  __name: "NavBar",
2687
2683
  props: {
2688
2684
  viewModel: {},
@@ -2696,7 +2692,7 @@ const Ke = /* @__PURE__ */ R(Bs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
2696
2692
  };
2697
2693
  return (o, a) => (p(), b("nav", Fs, [
2698
2694
  q(o.$slots, "prepend"),
2699
- (p(!0), b(U, null, ae(n.editorStates, (i) => (p(), H(Ke, {
2695
+ (p(!0), b(U, null, ae(n.editorStates, (i) => (p(), B(Ke, {
2700
2696
  key: i.graph.id,
2701
2697
  class: oe({ active: i.graph.id === n.viewModel.displayedGraph.id }),
2702
2698
  to: { name: n.routes?.edit ?? "edit", params: { editorId: i.graph.id } }
@@ -2704,7 +2700,7 @@ const Ke = /* @__PURE__ */ R(Bs, [["render", Ds]]), Fs = { class: "navbar" }, Ys
2704
2700
  appendIcon: ee(() => [
2705
2701
  m("button", {
2706
2702
  class: "remove",
2707
- onClick: ue((r) => s(i.graph.id), ["prevent"])
2703
+ onClick: de((r) => s(i.graph.id), ["prevent"])
2708
2704
  }, [
2709
2705
  G(O(Do))
2710
2706
  ], 8, Ys)
@@ -2756,30 +2752,30 @@ function Ks(n, e, t) {
2756
2752
  const s = () => n.value.selectedNodes.filter((a) => !Xe.includes(a.type)).length > 0, o = () => {
2757
2753
  const { viewModel: a } = me(), i = n.value, r = n.value.editor;
2758
2754
  if (i.selectedNodes.length === 0) return;
2759
- const l = i.selectedNodes.filter((k) => !Xe.includes(k.type)), d = l.flatMap((k) => Object.values(k.inputs)), f = l.flatMap((k) => Object.values(k.outputs)), C = i.connections.filter(
2760
- (k) => !f.includes(k.from) && d.includes(k.to)
2755
+ const l = i.selectedNodes.filter((k) => !Xe.includes(k.type)), u = l.flatMap((k) => Object.values(k.inputs)), f = l.flatMap((k) => Object.values(k.outputs)), C = i.connections.filter(
2756
+ (k) => !f.includes(k.from) && u.includes(k.to)
2761
2757
  ), h = i.connections.filter(
2762
- (k) => f.includes(k.from) && !d.includes(k.to)
2758
+ (k) => f.includes(k.from) && !u.includes(k.to)
2763
2759
  ), N = i.connections.filter(
2764
- (k) => f.includes(k.from) && d.includes(k.to)
2760
+ (k) => f.includes(k.from) && u.includes(k.to)
2765
2761
  ), v = l.map((k) => k.save()), w = N.map((k) => ({
2766
2762
  id: k.id,
2767
2763
  from: k.from.id,
2768
2764
  to: k.to.id
2769
- })), u = /* @__PURE__ */ new Map(), { xLeft: y, xRight: $, yTop: T } = Xs(l);
2765
+ })), d = /* @__PURE__ */ new Map(), { xLeft: y, xRight: $, yTop: T } = Xs(l);
2770
2766
  for (const [k, j] of C.entries()) {
2771
2767
  const z = new xt();
2772
2768
  z.inputs.name.value = j.to.name, v.push({
2773
2769
  ...z.save(),
2774
2770
  position: { x: $ - a.value.settings.nodes.defaultWidth - 100, y: T + k * 200 }
2775
- }), w.push({ id: re(), from: z.outputs.placeholder.id, to: j.to.id }), u.set(j.to.id, z.graphInterfaceId);
2771
+ }), w.push({ id: re(), from: z.outputs.placeholder.id, to: j.to.id }), d.set(j.to.id, z.graphInterfaceId);
2776
2772
  }
2777
2773
  for (const [k, j] of h.entries()) {
2778
2774
  const z = new It();
2779
2775
  z.inputs.name.value = j.from.name, v.push({
2780
2776
  ...z.save(),
2781
2777
  position: { x: y + 100, y: T + k * 200 }
2782
- }), w.push({ id: re(), from: j.from.id, to: z.inputs.placeholder.id }), u.set(j.from.id, z.graphInterfaceId);
2778
+ }), w.push({ id: re(), from: j.from.id, to: z.inputs.placeholder.id }), d.set(j.from.id, z.graphInterfaceId);
2783
2779
  }
2784
2780
  const S = te(
2785
2781
  new Ne(
@@ -2805,9 +2801,9 @@ function Ks(n, e, t) {
2805
2801
  l.map((k) => k.position.y).reduce((k, j) => k + j, 0) / l.length
2806
2802
  );
2807
2803
  Z.position.x = pe, Z.position.y = X, C.forEach((k) => {
2808
- i.removeConnection(k), i.addConnection(k.from, Z.inputs[u.get(k.to.id)]);
2804
+ i.removeConnection(k), i.addConnection(k.from, Z.inputs[d.get(k.to.id)]);
2809
2805
  }), h.forEach((k) => {
2810
- i.removeConnection(k), i.addConnection(Z.outputs[u.get(k.from.id)], k.to);
2806
+ i.removeConnection(k), i.addConnection(Z.outputs[d.get(k.from.id)], k.to);
2811
2807
  }), l.forEach((k) => i.removeNode(k)), i.activeTransactions--, e.canExecuteCommand(ne.SAVE_SUBGRAPH_COMMAND) && e.executeCommand(ne.SAVE_SUBGRAPH_COMMAND), t(S), n.value.panning = { ...i.panning }, n.value.scaling = i.scaling;
2812
2808
  };
2813
2809
  e.registerCommand(Ws, {
@@ -2828,7 +2824,7 @@ function Xs(n) {
2828
2824
  return i > o ? i : o;
2829
2825
  }, -1 / 0), xRight: e, yTop: t };
2830
2826
  }
2831
- class qs extends Ht {
2827
+ class qs extends Bt {
2832
2828
  code;
2833
2829
  graph;
2834
2830
  constructor(e) {
@@ -2881,9 +2877,9 @@ class qs extends Ht {
2881
2877
  }
2882
2878
  }
2883
2879
  function Ia(n) {
2884
- const e = B(n?.code ?? new Ve()), t = B(n?.existingEditor ?? new qs(e.value)), s = Symbol("ViewModelToken"), o = B(null), a = At(o), { switchGraph: i } = es(t, o), r = A(() => a.value && a.value !== t.value.graph), l = te(tn());
2880
+ const e = H(n?.code ?? new Ve()), t = H(n?.existingEditor ?? new qs(e.value)), s = Symbol("ViewModelToken"), o = H(null), a = At(o), { switchGraph: i } = es(t, o), r = A(() => a.value && a.value !== t.value.graph), l = te(tn());
2885
2881
  l.nodes.defaultWidth = 400;
2886
- const d = nn(), f = on(a, d), C = sn(a, t, d), h = {
2882
+ const u = nn(), f = on(a, u), C = sn(a, t, u), h = {
2887
2883
  /** Called whenever a node is rendered */
2888
2884
  renderNode: new ze(null),
2889
2885
  /** Called whenever an interface is rendered */
@@ -2891,21 +2887,25 @@ function Ia(n) {
2891
2887
  }, N = te({
2892
2888
  clipboard: C,
2893
2889
  code: e,
2894
- commandHandler: d,
2890
+ commandHandler: u,
2895
2891
  displayedGraph: a,
2896
2892
  editor: t,
2897
2893
  history: f,
2898
2894
  hooks: h,
2899
2895
  isSubgraph: r,
2896
+ onBeforeUnmount: () => {
2897
+ },
2898
+ onMounted: () => {
2899
+ },
2900
2900
  settings: l,
2901
2901
  switchGraph: i
2902
2902
  });
2903
- return e.value.registerViewModel(N), Ko(N), an(a, d), Ks(a, d, i), rn(a, d), ln(a, d, i), un(a, d), dn(a, d, l), Fo(a, d, l), Yo(l), Qe(
2903
+ return e.value.registerViewModel(N), Ko(N), an(a, u), Ks(a, u, i), rn(a, u), ln(a, u, i), dn(a, u), un(a, u, l), Fo(a, u, l), Yo(l), Qe(
2904
2904
  t,
2905
2905
  (v, w) => {
2906
- w && (w.events.registerGraph.unsubscribe(s), w.graphEvents.beforeAddNode.unsubscribe(s), v.nodeHooks.beforeLoad.unsubscribe(s), v.nodeHooks.afterSave.unsubscribe(s), v.graphTemplateHooks.beforeLoad.unsubscribe(s), v.graphTemplateHooks.afterSave.unsubscribe(s), v.graph.hooks.load.unsubscribe(s), v.graph.hooks.save.unsubscribe(s)), v && (v.nodeHooks.beforeLoad.subscribe(s, (u, y) => (y.position = u.position ?? { x: 0, y: 0 }, y.width = u.width ?? l.nodes.defaultWidth, y.twoColumn = u.twoColumn ?? !1, u)), v.nodeHooks.afterSave.subscribe(s, (u, y) => (u.position = y.position, u.width = y.width, u.twoColumn = y.twoColumn, u)), v.graphTemplateHooks.beforeLoad.subscribe(s, (u, y) => (y.panning = u.panning, y.scaling = u.scaling, u)), v.graphTemplateHooks.afterSave.subscribe(s, (u, y) => (u.panning = y.panning, u.scaling = y.scaling, u)), v.graph.hooks.load.subscribe(s, (u, y) => (y.panning = u.panning, y.scaling = u.scaling, u)), v.graph.hooks.save.subscribe(s, (u, y) => (u.panning = y.panning, u.scaling = y.scaling, u)), v.graphEvents.beforeAddNode.subscribe(
2906
+ w && (w.events.registerGraph.unsubscribe(s), w.graphEvents.beforeAddNode.unsubscribe(s), v.nodeHooks.beforeLoad.unsubscribe(s), v.nodeHooks.afterSave.unsubscribe(s), v.graphTemplateHooks.beforeLoad.unsubscribe(s), v.graphTemplateHooks.afterSave.unsubscribe(s), v.graph.hooks.load.unsubscribe(s), v.graph.hooks.save.unsubscribe(s)), v && (v.nodeHooks.beforeLoad.subscribe(s, (d, y) => (y.position = d.position ?? { x: 0, y: 0 }, y.width = d.width ?? l.nodes.defaultWidth, y.twoColumn = d.twoColumn ?? !1, d)), v.nodeHooks.afterSave.subscribe(s, (d, y) => (d.position = y.position, d.width = y.width, d.twoColumn = y.twoColumn, d)), v.graphTemplateHooks.beforeLoad.subscribe(s, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graphTemplateHooks.afterSave.subscribe(s, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graph.hooks.load.subscribe(s, (d, y) => (y.panning = d.panning, y.scaling = d.scaling, d)), v.graph.hooks.save.subscribe(s, (d, y) => (d.panning = y.panning, d.scaling = y.scaling, d)), v.graphEvents.beforeAddNode.subscribe(
2907
2907
  s,
2908
- (u) => cn(u, { defaultWidth: l.nodes.defaultWidth })
2908
+ (d) => cn(d, { defaultWidth: l.nodes.defaultWidth })
2909
2909
  ), t.value.registerNodeType(xt, { category: "Subgraphs" }), t.value.registerNodeType(It, { category: "Subgraphs" }), i(v.graph));
2910
2910
  },
2911
2911
  { immediate: !0 }
@@ -2934,7 +2934,7 @@ export {
2934
2934
  D as CodeNodeInterface,
2935
2935
  je as CodeNodeInterfaceComponent,
2936
2936
  _n as CodeNodeOutputInterface,
2937
- Hs as CodeNodePalette,
2937
+ Bs as CodeNodePalette,
2938
2938
  Pn as CodeVariable,
2939
2939
  zn as Copy,
2940
2940
  ls as CopyToClipboard,
@@ -2949,7 +2949,7 @@ export {
2949
2949
  so as LayoutSidebarRight,
2950
2950
  lo as LayoutSidebarRightCollapse,
2951
2951
  ho as LayoutSidebarRightExpand,
2952
- ua as ListInputInterface,
2952
+ da as ListInputInterface,
2953
2953
  mt as LockCode,
2954
2954
  xa as NavBar,
2955
2955
  Ke as NavItem,
@@ -2962,7 +2962,7 @@ export {
2962
2962
  So as SchemaOff,
2963
2963
  wn as SelectInterface,
2964
2964
  We as SidebarCheckbox,
2965
- da as SliderInterface,
2965
+ ua as SliderInterface,
2966
2966
  xt as SubgraphInputNode,
2967
2967
  It as SubgraphOutputNode,
2968
2968
  bt as TOGGLE_MINIMAP_COMMAND,
@@ -2971,7 +2971,7 @@ export {
2971
2971
  Tn as TextInputInterfaceComponent,
2972
2972
  ca as TextareaInputInterface,
2973
2973
  jo as TransitionBottom,
2974
- Ho as TrashOff,
2974
+ Bo as TrashOff,
2975
2975
  pa as TupleInputInterface,
2976
2976
  Do as X,
2977
2977
  la as addDefaultInterfaceTypes,
@@ -2986,10 +2986,10 @@ export {
2986
2986
  _t as getCodeNodes,
2987
2987
  ba as getPositionAtColumn,
2988
2988
  ya as getPositionBeforeNode,
2989
- ut as listType,
2989
+ dt as listType,
2990
2990
  it as loadNodeState,
2991
2991
  K as nodeType,
2992
- dt as numberType,
2992
+ ut as numberType,
2993
2993
  Ko as registerCodeEngine,
2994
2994
  Ks as registerCreateSubgraphCommand,
2995
2995
  Fo as registerCustomCommands,