@babsey/code-graph 0.1.5 → 0.1.6

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
- import Z from "mustache";
2
- import Xe from "toposort";
3
- import { AbstractNode as qe, sortTopologically as Me, NodeInterface as Je, displayInSidebar as $e, NodeInterfaceType as R, BaklavaInterfaceTypes as Ye, CheckboxInterfaceComponent as Qe, setType as B, IntegerInterfaceComponent as Ke, TextInputInterfaceComponent as Oe, NumberInterfaceComponent as Ze, SelectInterfaceComponent as et, SliderInterfaceComponent as tt, TextareaInputInterfaceComponent as st, allowMultipleConnections as K, IntegerInterface as nt, TextInputInterface as ot, Commands as ke, useViewModel as q, useTemporaryConnection as at, Components as Ce, useGraph as ae, GRAPH_NODE_TYPE_PREFIX as se, useTransform as it, useNodeCategories as rt, BaklavaEditor as dt, useBaklava as lt, DependencyEngine as ut, applyResult as ct, DEFAULT_TOOLBAR_COMMANDS as pt } from "baklavajs";
4
- import { reactive as D, defineComponent as U, createElementBlock as r, openBlock as i, toDisplayString as j, markRaw as E, computed as b, createElementVNode as d, withDirectives as ee, vModelText as te, ref as V, onMounted as ie, onUpdated as Te, normalizeClass as G, createCommentVNode as I, unref as _, renderSlot as W, createStaticVNode as J, onBeforeUnmount as ht, normalizeStyle as re, withModifiers as A, createBlock as O, Fragment as T, createTextVNode as vt, createVNode as z, withKeys as ne, renderList as H, nextTick as mt, toRef as Ee, resolveDynamicComponent as we, inject as ft, Transition as gt, withCtx as F, onUnmounted as bt, normalizeProps as yt, guardReactiveProps as _t, mergeProps as kt } from "vue";
5
- import { v4 as Ct } from "uuid";
1
+ import ee from "mustache";
2
+ import Ye from "toposort";
3
+ import { AbstractNode as qe, sortTopologically as Me, NodeInterface as Je, displayInSidebar as $e, NodeInterfaceType as G, BaklavaInterfaceTypes as Qe, CheckboxInterfaceComponent as Ke, setType as V, IntegerInterfaceComponent as Ze, TextInputInterfaceComponent as Oe, NumberInterfaceComponent as et, SelectInterfaceComponent as tt, SliderInterfaceComponent as st, TextareaInputInterfaceComponent as nt, allowMultipleConnections as K, IntegerInterface as ot, TextInputInterface as at, Commands as Z, useViewModel as Y, useTemporaryConnection as it, Components as ke, useGraph as ie, GRAPH_NODE_TYPE_PREFIX as ne, useTransform as rt, useNodeCategories as dt, BaklavaEditor as lt, useBaklava as ut, DependencyEngine as ct, applyResult as pt, DEFAULT_TOOLBAR_COMMANDS as ht } from "baklavajs";
4
+ import { reactive as A, defineComponent as U, createElementBlock as r, openBlock as i, toDisplayString as j, markRaw as T, computed as b, createElementVNode as d, withDirectives as te, vModelText as se, ref as B, onMounted as re, onUpdated as Ee, normalizeClass as R, createCommentVNode as I, unref as _, renderSlot as W, createStaticVNode as q, onBeforeUnmount as vt, normalizeStyle as de, withModifiers as P, createBlock as O, Fragment as E, createTextVNode as mt, createVNode as z, withKeys as oe, renderList as D, nextTick as ft, toRef as Te, resolveDynamicComponent as we, inject as gt, Transition as bt, withCtx as F, onUnmounted as yt, normalizeProps as _t, guardReactiveProps as Ct, mergeProps as kt } from "vue";
5
+ import { v4 as Se } from "uuid";
6
6
  import { usePointer as wt } from "@vueuse/core";
7
- Z.escape = (s) => s;
7
+ ee.escape = (s) => s;
8
8
  class xt extends qe {
9
9
  state;
10
10
  code;
@@ -14,7 +14,7 @@ class xt extends qe {
14
14
  inputs = {};
15
15
  outputs = {};
16
16
  constructor() {
17
- super(), this.initializeIo(), this.width = 400, this.twoColumn = !0, this.state = D({
17
+ super(), this.initializeIo(), this.width = 400, this.twoColumn = !0, this.state = A({
18
18
  codeTemplate: "",
19
19
  hidden: !1,
20
20
  integrated: !1,
@@ -143,7 +143,7 @@ class xt extends qe {
143
143
  if (n === "_node") return;
144
144
  const o = this.outputs[n];
145
145
  o && o.state && (t[n] = o.getValue());
146
- }), this.state.script = Z.render(this.state.codeTemplate, { inputs: e, outputs: t });
146
+ }), this.state.script = ee.render(this.state.codeTemplate, { inputs: e, outputs: t });
147
147
  }
148
148
  this.outputs.out && (this.outputs.out.state.script = this.script);
149
149
  }
@@ -176,7 +176,7 @@ class xt extends qe {
176
176
  this.state.props = e;
177
177
  }
178
178
  }
179
- class Se extends xt {
179
+ class Be extends xt {
180
180
  /**
181
181
  * The default implementation does nothing.
182
182
  * Overwrite this method to do calculation.
@@ -228,7 +228,7 @@ const It = (s, e = !0) => {
228
228
  }), Object.entries(e.outputs).forEach(([o, a]) => {
229
229
  o !== "_node" && n.outputs[o] && (a.hidden = n.outputs[o].hidden);
230
230
  });
231
- }, Mt = ["title"], de = /* @__PURE__ */ U({
231
+ }, Mt = ["title"], le = /* @__PURE__ */ U({
232
232
  __name: "CodeNodeInterface",
233
233
  props: {
234
234
  intf: {}
@@ -239,13 +239,13 @@ const It = (s, e = !0) => {
239
239
  }, j(s.intf.name), 9, Mt));
240
240
  }
241
241
  });
242
- class P extends Je {
242
+ class H extends Je {
243
243
  isCodeNode = !0;
244
244
  code;
245
245
  state;
246
246
  type = null;
247
247
  constructor(e, t) {
248
- super(e, t), this.setComponent(E(de)), this.state = D({
248
+ super(e, t), this.setComponent(T(le)), this.state = A({
249
249
  optional: !1,
250
250
  script: ""
251
251
  });
@@ -268,9 +268,9 @@ class P extends Je {
268
268
  const _n = (s, e) => {
269
269
  s.state.optional = e, s.setHidden(e);
270
270
  };
271
- class Y extends P {
271
+ class J extends H {
272
272
  constructor(e = "", t) {
273
- super(e, t), this.setComponent(E(de)), this.use($e, !0);
273
+ super(e, t), this.setComponent(T(le)), this.use($e, !0);
274
274
  }
275
275
  set script(e) {
276
276
  if (this.state.script && this.allowMultipleConnections) {
@@ -286,64 +286,64 @@ class Y extends P {
286
286
  super.value = e, this.name !== "_node" && this.setHidden(!1);
287
287
  }
288
288
  }
289
- const Be = new R("boolean"), $t = new R("dict"), ze = new R("list"), X = new R("node"), le = new R("number"), ue = new R("string"), je = new R("tuple"), kn = (s) => {
290
- new Ye(s.editor, { viewPlugin: s }).addTypes(Be, $t, ze, X, le, ue, je);
289
+ const ze = new G("boolean"), $t = new G("dict"), je = new G("list"), X = new G("node"), ue = new G("number"), ce = new G("string"), Le = new G("tuple"), Cn = (s) => {
290
+ new Qe(s.editor, { viewPlugin: s }).addTypes(ze, $t, je, X, ue, ce, Le);
291
291
  };
292
- class Cn extends Y {
292
+ class kn extends J {
293
293
  constructor(e, t) {
294
- super(e, t), this.setComponent(E(Qe)), this.use(B, Be);
294
+ super(e, t), this.setComponent(T(Ke)), this.use(V, ze);
295
295
  }
296
296
  getValue = () => this.value ? "True" : "False";
297
297
  }
298
- class Ot extends P {
298
+ class Ot extends H {
299
299
  isCodeNodeOutput = !0;
300
300
  constructor(e = "", t = "") {
301
- super(e, t), this.setComponent(E(de));
301
+ super(e, t), this.setComponent(T(le));
302
302
  }
303
303
  get script() {
304
304
  return this.name ? this.name : this.state.script;
305
305
  }
306
306
  }
307
- class ce extends Y {
307
+ class pe extends J {
308
308
  min;
309
309
  max;
310
310
  constructor(e, t, n, o) {
311
- super(e, t), this.min = n, this.max = o, this.use(B, le);
311
+ super(e, t), this.min = n, this.max = o, this.use(V, ue);
312
312
  }
313
313
  validate(e) {
314
314
  return (this.min === void 0 || e >= this.min) && (this.max === void 0 || e <= this.max);
315
315
  }
316
316
  }
317
- class wn extends ce {
318
- component = E(Ke);
317
+ class wn extends pe {
318
+ component = T(Ze);
319
319
  validate(e) {
320
320
  return Number.isInteger(e) && super.validate(e);
321
321
  }
322
322
  }
323
- class xn extends Y {
323
+ class xn extends J {
324
324
  constructor(e = "", t = "") {
325
- super(e, t), this.setComponent(E(Oe)), this.use(B, ze);
325
+ super(e, t), this.setComponent(T(Oe)), this.use(V, je);
326
326
  }
327
327
  getValue = () => `[${this.value}]`;
328
328
  }
329
- class In extends ce {
330
- component = E(Ze);
329
+ class In extends pe {
330
+ component = T(et);
331
331
  }
332
- class pe extends Y {
332
+ class he extends J {
333
333
  constructor(e, t) {
334
- super(e, t), this.use(B, ue);
334
+ super(e, t), this.use(V, ce);
335
335
  }
336
336
  getValue = () => `"${this.value}"`;
337
337
  }
338
- class Nn extends pe {
339
- component = E(et);
338
+ class Nn extends he {
339
+ component = T(tt);
340
340
  items;
341
341
  constructor(e, t, n) {
342
342
  super(e, t), this.items = n;
343
343
  }
344
344
  }
345
- class Mn extends ce {
346
- component = E(tt);
345
+ class Mn extends pe {
346
+ component = T(st);
347
347
  min;
348
348
  max;
349
349
  constructor(e, t, n, o) {
@@ -351,7 +351,7 @@ class Mn extends ce {
351
351
  }
352
352
  getValue = () => `${Math.round(this.value * 1e3) / 1e3}`;
353
353
  }
354
- const Tt = U({
354
+ const Et = U({
355
355
  props: {
356
356
  intf: {
357
357
  type: Object,
@@ -376,46 +376,46 @@ const Tt = U({
376
376
  for (const [n, o] of e)
377
377
  t[n] = o;
378
378
  return t;
379
- }, Et = { style: { position: "relative" } }, St = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, Vt = ["placeholder", "title"];
380
- function Bt(s, e, t, n, o, a) {
381
- return i(), r("div", Et, [
379
+ }, Tt = { style: { position: "relative" } }, St = { style: { "font-size": "12px", padding: "0 6px", position: "absolute", top: "-8px", "background-color": "var(--baklava-node-color-background)" } }, Bt = ["placeholder", "title"];
380
+ function Vt(s, e, t, n, o, a) {
381
+ return i(), r("div", Tt, [
382
382
  d("label", St, j(s.intf.name), 1),
383
- ee(d("input", {
383
+ te(d("input", {
384
384
  "onUpdate:modelValue": e[0] || (e[0] = (l) => s.v = l),
385
385
  type: "text",
386
386
  class: "baklava-input",
387
387
  placeholder: s.intf.name,
388
388
  title: s.intf.name
389
- }, null, 8, Vt), [
390
- [te, s.v]
389
+ }, null, 8, Bt), [
390
+ [se, s.v]
391
391
  ])
392
392
  ]);
393
393
  }
394
- const zt = /* @__PURE__ */ $(Tt, [["render", Bt]]);
395
- class $n extends pe {
396
- component = E(zt);
394
+ const zt = /* @__PURE__ */ $(Et, [["render", Vt]]);
395
+ class $n extends he {
396
+ component = T(zt);
397
397
  }
398
- class On extends pe {
399
- component = E(st);
398
+ class On extends he {
399
+ component = T(nt);
400
400
  }
401
- class Tn extends Y {
401
+ class En extends J {
402
402
  constructor(e = "", t = "") {
403
- super(e, t), this.setComponent(E(Oe)), this.use(B, je);
403
+ super(e, t), this.setComponent(T(Oe)), this.use(V, Le);
404
404
  }
405
405
  getValue = () => `(${this.value})`;
406
406
  }
407
- function En(s) {
408
- return class extends Se {
407
+ function Tn(s) {
408
+ return class extends Be {
409
409
  type = s.type;
410
410
  inputs = {};
411
411
  outputs = {};
412
412
  constructor() {
413
413
  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(
414
414
  "_node",
415
- new P("", []).use(B, X).use(K).setHidden(!0)
415
+ new H("", []).use(V, X).use(K).setHidden(!0)
416
416
  ), this.addOutput(
417
417
  "_node",
418
- new P("", []).use(B, X).use(K).setHidden(!0)
418
+ new H("", []).use(V, X).use(K).setHidden(!0)
419
419
  ), this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this);
420
420
  }
421
421
  // public calculate = definition.calculate
@@ -447,7 +447,7 @@ function En(s) {
447
447
  }
448
448
  };
449
449
  }
450
- class jt extends Se {
450
+ class jt extends Be {
451
451
  /**
452
452
  * The default implementation does nothing.
453
453
  * Overwrite this method to do calculation.
@@ -469,10 +469,10 @@ function Sn(s) {
469
469
  constructor() {
470
470
  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(
471
471
  "_node",
472
- new P("", []).use(B, X).use(K).setHidden(!0)
472
+ new H("", []).use(V, X).use(K).setHidden(!0)
473
473
  ), this.addOutput(
474
474
  "_node",
475
- new P("", []).use(B, X).use(K).setHidden(!0)
475
+ new H("", []).use(V, X).use(K).setHidden(!0)
476
476
  ), this.staticInputKeys.push("_node"), this.staticOutputKeys.push("_node"), this.executeFactory("input", s.inputs), this.executeFactory("output", s.outputs), s.onCreate?.call(this);
477
477
  }
478
478
  onPlaced() {
@@ -504,7 +504,7 @@ function Sn(s) {
504
504
  if (!this.inputs[t]) {
505
505
  const n = e.inputs[t].value;
506
506
  let o;
507
- typeof n == "number" ? o = new nt(t, n).use(B, le) : o = new ot(t, JSON.stringify(n)).use(B, ue), o.use($e, !0), this.addInput(t, o);
507
+ typeof n == "number" ? o = new ot(t, n).use(V, ue) : o = new at(t, JSON.stringify(n)).use(V, ce), o.use($e, !0), this.addInput(t, o);
508
508
  }
509
509
  this.inputs[t] && (this.inputs[t].load(e.inputs[t]), this.inputs[t].nodeId = this.id);
510
510
  }
@@ -551,13 +551,13 @@ function Sn(s) {
551
551
  }
552
552
  };
553
553
  }
554
- Z.escape = (s) => s;
554
+ ee.escape = (s) => s;
555
555
  class Lt {
556
556
  _id;
557
557
  _viewModel;
558
558
  _state;
559
559
  constructor(e) {
560
- this._id = Ct(), this._viewModel = e, this._state = D({
560
+ this._id = Se(), this._viewModel = e, this._state = A({
561
561
  autosort: !1,
562
562
  lockCode: !1,
563
563
  modules: {},
@@ -567,7 +567,7 @@ class Lt {
567
567
  });
568
568
  }
569
569
  get codeNodes() {
570
- return oe(this.graph);
570
+ return ae(this.graph);
571
571
  }
572
572
  get connections() {
573
573
  return this.graph.connections;
@@ -609,7 +609,7 @@ class Lt {
609
609
  this.state.script = e, this.viewModel.engine.runOnce(null);
610
610
  }
611
611
  get scriptedCodeNodes() {
612
- return oe(this.graph).filter(
612
+ return ae(this.graph).filter(
613
613
  (e) => !e.state?.integrated
614
614
  );
615
615
  }
@@ -653,7 +653,7 @@ class Lt {
653
653
  * Clear code graph.
654
654
  */
655
655
  clear() {
656
- this.state.modules = {}, this.nodes = [], this.connections = [], this.state.script = "", this.viewModel.commandHandler.executeCommand(ke.CLEAR_CLIPBOARD_COMMAND), this.viewModel.commandHandler.executeCommand(ke.CLEAR_HISTORY_COMMAND), this.viewModel.engine && this.viewModel.engine.runOnce(null);
656
+ this.state.modules = {}, this.nodes = [], this.connections = [], this.state.script = "", this.viewModel.commandHandler.executeCommand(Z.CLEAR_CLIPBOARD_COMMAND), this.viewModel.commandHandler.executeCommand(Z.CLEAR_HISTORY_COMMAND), this.viewModel.engine && this.viewModel.engine.runOnce(null);
657
657
  }
658
658
  findNodeById(e) {
659
659
  return this.graph.findNodeById(e);
@@ -712,7 +712,7 @@ class Lt {
712
712
  * Render code.
713
713
  */
714
714
  renderCode() {
715
- this.state.lockCode || (this.state.script = Z.render(this.state.template || "", this));
715
+ this.state.lockCode || (this.state.script = ee.render(this.state.template || "", this));
716
716
  }
717
717
  /**
718
718
  * Reset scripts of intput interfaces.
@@ -754,7 +754,7 @@ class Lt {
754
754
  a.from.nodeId
755
755
  ]);
756
756
  let t = [...this.nodeIds];
757
- t.reverse(), t = Xe.array(t, e), t.reverse();
757
+ t.reverse(), t = Ye.array(t, e), t.reverse();
758
758
  const n = this.graph.nodes.map((a) => a.id).filter((a) => !t.includes(a));
759
759
  t = t.concat(n);
760
760
  const o = t.map((a) => this.findNodeById(a));
@@ -776,15 +776,15 @@ class Lt {
776
776
  this.codeNodes.forEach((e) => e.updateCodeTemplate());
777
777
  }
778
778
  }
779
- const oe = (s) => {
779
+ const ae = (s) => {
780
780
  let e = [];
781
781
  return s.nodes.forEach((t) => {
782
- t.subgraph ? e = e.concat(oe(t.subgraph)) : t.isCodeNode && e.push(t);
782
+ t.subgraph ? e = e.concat(ae(t.subgraph)) : t.isCodeNode && e.push(t);
783
783
  }), e;
784
- }, Vn = (s = 0, e = 100) => ({
784
+ }, Bn = (s = 0, e = 100) => ({
785
785
  x: s * 420,
786
786
  y: e
787
- }), Bn = (s) => {
787
+ }), Vn = (s) => {
788
788
  const e = { ...s.position };
789
789
  return e.x -= 440, e.y += 50, e;
790
790
  }, zn = (s) => {
@@ -796,40 +796,40 @@ const oe = (s) => {
796
796
  a.to.state && a.from.script && (a.to.state.script = a.from.script);
797
797
  });
798
798
  });
799
- }, Ut = ["id"], Gt = { class: "align-middle" }, xe = /* @__PURE__ */ U({
799
+ }, Ut = ["id"], Rt = { class: "align-middle" }, xe = /* @__PURE__ */ U({
800
800
  __name: "CodeGraphNodeInterface",
801
801
  props: {
802
802
  node: {},
803
803
  intf: {}
804
804
  },
805
805
  setup(s) {
806
- const e = s, { viewModel: t } = q(), { hoveredOver: n, temporaryConnection: o } = at(), a = V(null), l = b(() => e.intf.connectionCount > 0), u = b(() => ({
806
+ const e = s, { viewModel: t } = Y(), { hoveredOver: n, temporaryConnection: o } = it(), a = B(null), l = b(() => e.intf.connectionCount > 0), u = b(() => ({
807
807
  "--connected": l.value
808
808
  })), v = () => {
809
809
  n(e.intf);
810
- }, k = () => {
810
+ }, C = () => {
811
811
  n(void 0);
812
812
  }, w = () => {
813
813
  a.value && t.value.hooks.renderInterface.execute({ intf: e.intf, el: a.value });
814
814
  };
815
- return ie(w), Te(w), (S, L) => (i(), r("div", {
815
+ return re(w), Ee(w), (S, L) => (i(), r("div", {
816
816
  id: s.intf.id,
817
817
  ref_key: "el",
818
818
  ref: a,
819
- class: G(["baklava-node-interface", u.value])
819
+ class: R(["baklava-node-interface", u.value])
820
820
  }, [
821
821
  s.intf.port ? (i(), r("div", {
822
822
  key: 0,
823
- class: G(["__port", { "--selected": _(o)?.from === s.intf }]),
823
+ class: R(["__port", { "--selected": _(o)?.from === s.intf }]),
824
824
  onPointerover: v,
825
- onPointerout: k
825
+ onPointerout: C
826
826
  }, null, 34)) : I("", !0),
827
- d("span", Gt, [
827
+ d("span", Rt, [
828
828
  W(S.$slots, "default")
829
829
  ])
830
830
  ], 10, Ut));
831
831
  }
832
- }), Rt = {}, Dt = {
832
+ }), Gt = {}, At = {
833
833
  xmlns: "http://www.w3.org/2000/svg",
834
834
  width: "24",
835
835
  height: "24",
@@ -841,8 +841,8 @@ const oe = (s) => {
841
841
  "stroke-linejoin": "round",
842
842
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-code-variable"
843
843
  };
844
- function Ht(s, e) {
845
- return i(), r("svg", Dt, [...e[0] || (e[0] = [
844
+ function Dt(s, e) {
845
+ return i(), r("svg", At, [...e[0] || (e[0] = [
846
846
  d("path", {
847
847
  stroke: "none",
848
848
  d: "M0 0h24v24H0z",
@@ -851,7 +851,7 @@ function Ht(s, e) {
851
851
  d("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)
852
852
  ])]);
853
853
  }
854
- const Pt = /* @__PURE__ */ $(Rt, [["render", Ht]]), At = {}, Ft = {
854
+ const Ht = /* @__PURE__ */ $(Gt, [["render", Dt]]), Pt = {}, Ft = {
855
855
  xmlns: "http://www.w3.org/2000/svg",
856
856
  width: "24",
857
857
  height: "24",
@@ -875,7 +875,7 @@ function Wt(s, e) {
875
875
  d("path", { d: "M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1)
876
876
  ])]);
877
877
  }
878
- const Xt = /* @__PURE__ */ $(At, [["render", Wt]]), qt = {}, Jt = {
878
+ const Xt = /* @__PURE__ */ $(Pt, [["render", Wt]]), Yt = {}, qt = {
879
879
  xmlns: "http://www.w3.org/2000/svg",
880
880
  width: "24",
881
881
  height: "24",
@@ -883,8 +883,8 @@ const Xt = /* @__PURE__ */ $(At, [["render", Wt]]), qt = {}, Jt = {
883
883
  fill: "currentColor",
884
884
  class: "baklava-icon icon icon-tabler icons-tabler-filled icon-tabler-layout-sidebar-left-collapse"
885
885
  };
886
- function Yt(s, e) {
887
- return i(), r("svg", Jt, [...e[0] || (e[0] = [
886
+ function Jt(s, e) {
887
+ return i(), r("svg", qt, [...e[0] || (e[0] = [
888
888
  d("path", {
889
889
  stroke: "none",
890
890
  d: "M0 0h24v24H0z",
@@ -893,7 +893,7 @@ function Yt(s, e) {
893
893
  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)
894
894
  ])]);
895
895
  }
896
- const Qt = /* @__PURE__ */ $(qt, [["render", Yt]]), Kt = {}, Zt = {
896
+ const Qt = /* @__PURE__ */ $(Yt, [["render", Jt]]), Kt = {}, Zt = {
897
897
  xmlns: "http://www.w3.org/2000/svg",
898
898
  width: "24",
899
899
  height: "24",
@@ -979,7 +979,7 @@ const hs = /* @__PURE__ */ $(us, [["render", ps]]), vs = {}, ms = {
979
979
  };
980
980
  function fs(s, e) {
981
981
  return i(), r("svg", ms, [...e[0] || (e[0] = [
982
- J('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>', 6)
982
+ q('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M11.5 21h-4.5a2 2 0 0 1 -2 -2v-6a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2"></path><path d="M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"></path><path d="M8 11v-4a4 4 0 1 1 8 0v4"></path><path d="M20 21l2 -2l-2 -2"></path><path d="M17 17l-2 2l2 2"></path>', 6)
983
983
  ])]);
984
984
  }
985
985
  const gs = /* @__PURE__ */ $(vs, [["render", fs]]), bs = {}, ys = {
@@ -996,10 +996,10 @@ const gs = /* @__PURE__ */ $(vs, [["render", fs]]), bs = {}, ys = {
996
996
  };
997
997
  function _s(s, e) {
998
998
  return i(), r("svg", ys, [...e[0] || (e[0] = [
999
- J('<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)
999
+ 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)
1000
1000
  ])]);
1001
1001
  }
1002
- const ks = /* @__PURE__ */ $(bs, [["render", _s]]), Cs = {}, ws = {
1002
+ const Cs = /* @__PURE__ */ $(bs, [["render", _s]]), ks = {}, ws = {
1003
1003
  xmlns: "http://www.w3.org/2000/svg",
1004
1004
  width: "24",
1005
1005
  height: "24",
@@ -1013,10 +1013,10 @@ const ks = /* @__PURE__ */ $(bs, [["render", _s]]), Cs = {}, ws = {
1013
1013
  };
1014
1014
  function xs(s, e) {
1015
1015
  return i(), r("svg", ws, [...e[0] || (e[0] = [
1016
- J('<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)
1016
+ 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)
1017
1017
  ])]);
1018
1018
  }
1019
- const Is = /* @__PURE__ */ $(Cs, [["render", xs]]), Ns = {}, Ms = {
1019
+ const Is = /* @__PURE__ */ $(ks, [["render", xs]]), Ns = {}, Ms = {
1020
1020
  xmlns: "http://www.w3.org/2000/svg",
1021
1021
  width: "24",
1022
1022
  height: "24",
@@ -1030,10 +1030,10 @@ const Is = /* @__PURE__ */ $(Cs, [["render", xs]]), Ns = {}, Ms = {
1030
1030
  };
1031
1031
  function $s(s, e) {
1032
1032
  return i(), r("svg", Ms, [...e[0] || (e[0] = [
1033
- J('<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)
1033
+ 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)
1034
1034
  ])]);
1035
1035
  }
1036
- const Os = /* @__PURE__ */ $(Ns, [["render", $s]]), Ts = {}, Es = {
1036
+ const Os = /* @__PURE__ */ $(Ns, [["render", $s]]), Es = {}, Ts = {
1037
1037
  xmlns: "http://www.w3.org/2000/svg",
1038
1038
  width: "24",
1039
1039
  height: "24",
@@ -1046,17 +1046,17 @@ const Os = /* @__PURE__ */ $(Ns, [["render", $s]]), Ts = {}, Es = {
1046
1046
  class: "baklava-icon icon icon-tabler icons-tabler-outline icon-tabler-trash-off"
1047
1047
  };
1048
1048
  function Ss(s, e) {
1049
- return i(), r("svg", Es, [...e[0] || (e[0] = [
1050
- J('<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)
1049
+ return i(), r("svg", Ts, [...e[0] || (e[0] = [
1050
+ 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)
1051
1051
  ])]);
1052
1052
  }
1053
- const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"], zs = {
1053
+ const Bs = /* @__PURE__ */ $(Es, [["render", Ss]]), Vs = ["id", "data-node-type"], zs = {
1054
1054
  class: "__title-label",
1055
1055
  style: { "flex-grow": "1" }
1056
1056
  }, js = { key: 0 }, Ls = {
1057
1057
  class: "__menu",
1058
1058
  style: { display: "flex" }
1059
- }, Us = { class: "__outputs" }, Gs = { key: 0 }, Rs = ["id", "title"], Ds = { class: "__inputs" }, Hs = { key: 0 }, Ps = ["id", "title"], As = /* @__PURE__ */ U({
1059
+ }, Us = { class: "__outputs" }, Rs = { key: 0 }, Gs = ["id", "title"], As = { class: "__inputs" }, Ds = { key: 0 }, Hs = ["id", "title"], Ps = /* @__PURE__ */ U({
1060
1060
  __name: "CodeGraphNode",
1061
1061
  props: {
1062
1062
  node: {},
@@ -1065,15 +1065,15 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1065
1065
  },
1066
1066
  emits: ["select", "start-drag", "update"],
1067
1067
  setup(s, { emit: e }) {
1068
- const t = Ce.ContextMenu, n = Ce.NodeInterface, o = s, a = b(() => o.node), l = e, { viewModel: u } = q(), { graph: v, switchGraph: k } = ae(), w = V(null), S = V(!1), L = V(""), N = V(null), m = V(!1);
1068
+ const t = ke.ContextMenu, n = ke.NodeInterface, o = s, a = b(() => o.node), l = e, { viewModel: u } = Y(), { graph: v, switchGraph: C } = ie(), w = B(null), S = B(!1), L = B(""), N = B(null), m = B(!1);
1069
1069
  let y = 0, x = 0;
1070
- const f = V(!1), C = b(() => {
1070
+ const f = B(!1), k = b(() => {
1071
1071
  const c = [
1072
1072
  { value: "edit", label: "Edit" },
1073
1073
  { value: "rename", label: "Rename" },
1074
1074
  { value: "delete", label: "Delete" }
1075
1075
  ];
1076
- return o.node.type.startsWith(se) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
1076
+ return o.node.type.startsWith(ne) && c.push({ value: "editSubgraph", label: "Edit Subgraph" }), c;
1077
1077
  }), p = b(() => ({
1078
1078
  "--selected": o.selected,
1079
1079
  "--dragging": o.dragging,
@@ -1081,20 +1081,20 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1081
1081
  "--hidden": a.value.state?.hidden
1082
1082
  })), M = b(() => ({
1083
1083
  "--reverse-y": o.node.reverseY ?? u.value.settings.nodes.reverseY
1084
- })), Le = b(() => ({
1084
+ })), Ue = b(() => ({
1085
1085
  top: `${o.node.position?.y ?? 0}px`,
1086
1086
  left: `${o.node.position?.x ?? 0}px`,
1087
1087
  "--width": `${o.node.width ?? u.value.settings.nodes.defaultWidth}px`
1088
- })), Ue = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), Ge = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), he = () => {
1088
+ })), Re = b(() => Object.values(o.node.inputs).filter((c) => !c.hidden)), Ge = b(() => Object.values(o.node.outputs).filter((c) => !c.hidden)), ve = () => {
1089
1089
  l("select");
1090
- }, Re = (c) => {
1091
- o.selected || he(), l("start-drag", c);
1092
- }, ve = () => {
1090
+ }, Ae = (c) => {
1091
+ o.selected || ve(), l("start-drag", c);
1092
+ }, me = () => {
1093
1093
  f.value = !0;
1094
1094
  }, De = () => {
1095
1095
  const c = u.value.displayedGraph.sidebar;
1096
1096
  c.nodeId = "", c.visible = !1;
1097
- }, me = () => {
1097
+ }, fe = () => {
1098
1098
  const c = u.value.displayedGraph.sidebar;
1099
1099
  c.nodeId = o.node.id, c.visible = !0;
1100
1100
  }, He = () => {
@@ -1103,55 +1103,55 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1103
1103
  }, Pe = async (c) => {
1104
1104
  switch (c) {
1105
1105
  case "edit":
1106
- me();
1106
+ fe();
1107
1107
  break;
1108
1108
  case "delete":
1109
1109
  v.value.removeNode(o.node);
1110
1110
  break;
1111
1111
  case "rename":
1112
- L.value = o.node.title, S.value = !0, await mt(), N.value?.focus();
1112
+ L.value = o.node.title, S.value = !0, await ft(), N.value?.focus();
1113
1113
  break;
1114
1114
  case "editSubgraph":
1115
- k(o.node.template);
1115
+ C(o.node.template);
1116
1116
  break;
1117
1117
  }
1118
- }, fe = () => {
1119
- a.value.title = L.value, S.value = !1;
1120
1118
  }, ge = () => {
1119
+ a.value.title = L.value, S.value = !1;
1120
+ }, be = () => {
1121
1121
  w.value && u.value.hooks.renderNode.execute({ node: o.node, el: w.value });
1122
- }, Ae = (c) => {
1122
+ }, Fe = (c) => {
1123
1123
  m.value = !0, y = o.node.width, x = c.clientX, c.preventDefault();
1124
- }, be = (c) => {
1125
- a.value.state && (a.value.state.integrated = c, l("update"));
1126
1124
  }, ye = (c) => {
1125
+ a.value.state && (a.value.state.integrated = c, l("update"));
1126
+ }, _e = (c) => {
1127
1127
  if (!m.value) return;
1128
- const g = c.clientX - x, h = y + g / v.value.scaling, Fe = u.value.settings.nodes.minWidth, We = u.value.settings.nodes.maxWidth;
1129
- a.value.width = Math.max(Fe, Math.min(We, h));
1130
- }, _e = () => {
1128
+ const g = c.clientX - x, h = y + g / v.value.scaling, We = u.value.settings.nodes.minWidth, Xe = u.value.settings.nodes.maxWidth;
1129
+ a.value.width = Math.max(We, Math.min(Xe, h));
1130
+ }, Ce = () => {
1131
1131
  m.value = !1;
1132
1132
  };
1133
- return ie(() => {
1134
- ge(), window.addEventListener("mousemove", ye), window.addEventListener("mouseup", _e);
1135
- }), Te(ge), ht(() => {
1136
- window.removeEventListener("mousemove", ye), window.removeEventListener("mouseup", _e);
1133
+ return re(() => {
1134
+ be(), window.addEventListener("mousemove", _e), window.addEventListener("mouseup", Ce);
1135
+ }), Ee(be), vt(() => {
1136
+ window.removeEventListener("mousemove", _e), window.removeEventListener("mouseup", Ce);
1137
1137
  }), (c, g) => (i(), r("div", {
1138
1138
  id: a.value.id,
1139
1139
  ref_key: "el",
1140
1140
  ref: w,
1141
- class: G([p.value, "baklava-node"]),
1141
+ class: R([p.value, "baklava-node"]),
1142
1142
  "data-node-type": a.value.type,
1143
- style: re(Le.value),
1144
- onPointerdown: he
1143
+ style: de(Ue.value),
1144
+ onPointerdown: ve
1145
1145
  }, [
1146
1146
  _(u).settings.nodes.resizable ? (i(), r("div", {
1147
1147
  key: 0,
1148
1148
  class: "__resize-handle",
1149
- onMousedown: Ae
1149
+ onMousedown: Fe
1150
1150
  }, null, 32)) : I("", !0),
1151
1151
  d("div", {
1152
1152
  class: "__title",
1153
- onPointerdown: A(Re, ["self", "stop"]),
1154
- onContextmenu: A(ve, ["prevent"])
1153
+ onPointerdown: P(Ae, ["self", "stop"]),
1154
+ onContextmenu: P(me, ["prevent"])
1155
1155
  }, [
1156
1156
  a.value.inputs._node ? (i(), O(xe, {
1157
1157
  key: 0,
@@ -1161,7 +1161,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1161
1161
  "data-interface-type": "node",
1162
1162
  style: { "flex-grow": "0" }
1163
1163
  }, null, 8, ["node", "intf"])) : I("", !0),
1164
- S.value ? ee((i(), r("input", {
1164
+ S.value ? te((i(), r("input", {
1165
1165
  key: 2,
1166
1166
  ref_key: "renameInputEl",
1167
1167
  ref: N,
@@ -1170,35 +1170,35 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1170
1170
  placeholder: "Node Name",
1171
1171
  style: { "flex-grow": "1" },
1172
1172
  type: "text",
1173
- onBlur: fe,
1174
- onKeydown: ne(fe, ["enter"])
1173
+ onBlur: ge,
1174
+ onKeydown: oe(ge, ["enter"])
1175
1175
  }, null, 544)), [
1176
- [te, L.value]
1177
- ]) : (i(), r(T, { key: 1 }, [
1176
+ [se, L.value]
1177
+ ]) : (i(), r(E, { key: 1 }, [
1178
1178
  d("div", zs, [
1179
1179
  a.value.idx > -1 ? (i(), r("span", js, j(a.value.idx + 1) + " - ", 1)) : I("", !0),
1180
- vt(j(a.value.title), 1)
1180
+ mt(j(a.value.title), 1)
1181
1181
  ]),
1182
1182
  d("div", Ls, [
1183
- a.value.subgraph ? I("", !0) : (i(), r(T, { key: 0 }, [
1183
+ a.value.subgraph ? I("", !0) : (i(), r(E, { key: 0 }, [
1184
1184
  a.value.state.lockCode ? (i(), O(_(gs), {
1185
1185
  key: 0,
1186
1186
  class: "--clickable mx-1",
1187
1187
  onClick: g[0] || (g[0] = (h) => a.value.lockCode = !1)
1188
1188
  })) : I("", !0),
1189
- a.value.state.integrated ? (i(), O(_(Pt), {
1189
+ a.value.state.integrated ? (i(), O(_(Ht), {
1190
1190
  key: 1,
1191
1191
  class: "--clickable mx-1",
1192
- onClick: g[1] || (g[1] = (h) => be(!1))
1192
+ onClick: g[1] || (g[1] = (h) => ye(!1))
1193
1193
  })) : (i(), O(_(Os), {
1194
1194
  key: 2,
1195
1195
  class: "--clickable mx-1",
1196
- onClick: g[2] || (g[2] = (h) => be(!0))
1196
+ onClick: g[2] || (g[2] = (h) => ye(!0))
1197
1197
  })),
1198
1198
  !_(u).displayedGraph.sidebar.visible && _(u).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), O(_(hs), {
1199
1199
  key: 3,
1200
1200
  class: "--clickable mx-1",
1201
- onClick: me
1201
+ onClick: fe
1202
1202
  })) : _(u).displayedGraph.sidebar.visible && _(u).displayedGraph.sidebar.nodeId !== a.value.id ? (i(), O(_(as), {
1203
1203
  key: 4,
1204
1204
  class: "--clickable mx-1",
@@ -1211,14 +1211,14 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1211
1211
  ], 64)),
1212
1212
  z(_(Xt), {
1213
1213
  class: "--clickable mx-1",
1214
- onClick: ve
1214
+ onClick: me
1215
1215
  }),
1216
1216
  z(_(t), {
1217
1217
  modelValue: f.value,
1218
1218
  "onUpdate:modelValue": g[3] || (g[3] = (h) => f.value = h),
1219
1219
  x: 0,
1220
1220
  y: 0,
1221
- items: C.value,
1221
+ items: k.value,
1222
1222
  onClick: Pe
1223
1223
  }, null, 8, ["modelValue", "items"])
1224
1224
  ])
@@ -1232,17 +1232,17 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1232
1232
  }, null, 8, ["node", "intf"])) : I("", !0)
1233
1233
  ], 32),
1234
1234
  d("div", {
1235
- class: G(["__content", M.value]),
1236
- onKeydown: g[5] || (g[5] = ne(A(() => {
1235
+ class: R(["__content", M.value]),
1236
+ onKeydown: g[5] || (g[5] = oe(P(() => {
1237
1237
  }, ["stop"]), ["delete"])),
1238
- onContextmenu: g[6] || (g[6] = A(() => {
1238
+ onContextmenu: g[6] || (g[6] = P(() => {
1239
1239
  }, ["prevent"]))
1240
1240
  }, [
1241
1241
  d("div", Us, [
1242
- (i(!0), r(T, null, H(Ge.value, (h) => (i(), r(T, {
1242
+ (i(!0), r(E, null, D(Ge.value, (h) => (i(), r(E, {
1243
1243
  key: h.id
1244
1244
  }, [
1245
- a.value.state?.hidden ? (i(), r("div", Gs, [
1245
+ a.value.state?.hidden ? (i(), r("div", Rs, [
1246
1246
  h.port ? (i(), r("div", {
1247
1247
  key: 0,
1248
1248
  id: h.id,
@@ -1250,7 +1250,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1250
1250
  class: "baklava-node-interface --output --connected"
1251
1251
  }, [...g[7] || (g[7] = [
1252
1252
  d("div", { class: "__port" }, null, -1)
1253
- ])], 8, Rs)) : I("", !0)
1253
+ ])], 8, Gs)) : I("", !0)
1254
1254
  ])) : W(c.$slots, "nodeInterface", {
1255
1255
  key: 1,
1256
1256
  type: "output",
@@ -1265,11 +1265,11 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1265
1265
  ])
1266
1266
  ], 64))), 128))
1267
1267
  ]),
1268
- d("div", Ds, [
1269
- (i(!0), r(T, null, H(Ue.value, (h) => (i(), r(T, {
1268
+ d("div", As, [
1269
+ (i(!0), r(E, null, D(Re.value, (h) => (i(), r(E, {
1270
1270
  key: h.id
1271
1271
  }, [
1272
- a.value.state?.hidden ? (i(), r("div", Hs, [
1272
+ a.value.state?.hidden ? (i(), r("div", Ds, [
1273
1273
  h.port ? (i(), r("div", {
1274
1274
  key: 0,
1275
1275
  id: h.id,
@@ -1277,7 +1277,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1277
1277
  class: "baklava-node-interface --input --connected"
1278
1278
  }, [...g[8] || (g[8] = [
1279
1279
  d("div", { class: "__port" }, null, -1)
1280
- ])], 8, Ps)) : I("", !0)
1280
+ ])], 8, Hs)) : I("", !0)
1281
1281
  ])) : W(c.$slots, "nodeInterface", {
1282
1282
  key: 1,
1283
1283
  node: a.value,
@@ -1293,7 +1293,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1293
1293
  ], 64))), 128))
1294
1294
  ])
1295
1295
  ], 34)
1296
- ], 46, Bs));
1296
+ ], 46, Vs));
1297
1297
  }
1298
1298
  }), Fs = ["title"], Ws = {
1299
1299
  key: 0,
@@ -1310,7 +1310,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1310
1310
  setup(s, { emit: e }) {
1311
1311
  const t = e;
1312
1312
  return (n, o) => (i(), r("div", {
1313
- class: G(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue, "--disabled": s.disabled }]),
1313
+ class: R(["baklava-checkbox", { "--checked": s.inversed ? !s.modelValue : s.modelValue, "--disabled": s.disabled }]),
1314
1314
  title: s.name,
1315
1315
  onClick: o[0] || (o[0] = (a) => t("update:modelValue", !s.modelValue))
1316
1316
  }, [
@@ -1331,20 +1331,20 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1331
1331
  s.name ? (i(), r("div", Ws, j(s.name), 1)) : I("", !0)
1332
1332
  ], 10, Fs));
1333
1333
  }
1334
- }), Xs = { class: "__header" }, qs = { class: "__node-name" }, Js = { class: "__interfaces" }, Ys = { class: "__inputs" }, Qs = { style: { display: "flex" } }, Ks = { class: "__outputs" }, Zs = {
1334
+ }), Xs = { class: "__header" }, Ys = { class: "__node-name" }, qs = { class: "__interfaces" }, Js = { class: "__inputs" }, Qs = { style: { display: "flex" } }, Ks = { class: "__outputs" }, Zs = {
1335
1335
  key: 0,
1336
1336
  class: "__interface"
1337
1337
  }, en = { style: { display: "flex" } }, tn = /* @__PURE__ */ U({
1338
1338
  __name: "CodeGraphSidebar",
1339
1339
  setup(s) {
1340
- const { viewModel: e } = q(), { graph: t } = ae(), n = V(null), o = Ee(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
1340
+ const { viewModel: e } = Y(), { graph: t } = ie(), n = B(null), o = Te(e.value.settings.sidebar, "width"), a = b(() => e.value.settings.sidebar.resizable);
1341
1341
  let l = 0, u = 0;
1342
1342
  const v = b(() => {
1343
1343
  const f = t.value.sidebar.nodeId;
1344
- return t.value.nodes.find((C) => C.id === f);
1345
- }), k = b(() => v.value), w = b(() => ({
1344
+ return t.value.nodes.find((k) => k.id === f);
1345
+ }), C = b(() => v.value), w = b(() => ({
1346
1346
  width: `${o.value}px`
1347
- })), S = b(() => k.value ? Object.values(k.value.inputs).filter((f) => f.displayInSidebar && f.component) : []), L = b(() => k.value ? Object.values(k.value.outputs).filter((f) => f.displayInSidebar && f.component) : []), N = () => {
1347
+ })), S = b(() => C.value ? Object.values(C.value.inputs).filter((f) => f.displayInSidebar && f.component) : []), L = b(() => C.value ? Object.values(C.value.outputs).filter((f) => f.displayInSidebar && f.component) : []), N = () => {
1348
1348
  t.value.sidebar.visible = !1;
1349
1349
  }, m = () => {
1350
1350
  v.value?.events.update.emit(null);
@@ -1357,13 +1357,13 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1357
1357
  { once: !0 }
1358
1358
  );
1359
1359
  }, x = (f) => {
1360
- const C = n.value?.parentElement?.getBoundingClientRect().width ?? 500, p = f.clientX - u;
1360
+ const k = n.value?.parentElement?.getBoundingClientRect().width ?? 500, p = f.clientX - u;
1361
1361
  let M = l - p;
1362
- M < 300 ? M = 300 : M > 0.9 * C && (M = 0.9 * C), o.value = M;
1362
+ M < 300 ? M = 300 : M > 0.9 * k && (M = 0.9 * k), o.value = M;
1363
1363
  };
1364
- return (f, C) => (i(), r("div", {
1365
- class: G([{ "--open": _(t).sidebar.visible }, "baklava-sidebar"]),
1366
- style: re(w.value),
1364
+ return (f, k) => (i(), r("div", {
1365
+ class: R([{ "--open": _(t).sidebar.visible }, "baklava-sidebar"]),
1366
+ style: de(w.value),
1367
1367
  ref_key: "el",
1368
1368
  ref: n
1369
1369
  }, [
@@ -1372,20 +1372,20 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1372
1372
  class: "__resizer",
1373
1373
  onMousedown: y
1374
1374
  }, null, 32)) : I("", !0),
1375
- v.value ? (i(), r(T, { key: 1 }, [
1375
+ v.value ? (i(), r(E, { key: 1 }, [
1376
1376
  d("div", Xs, [
1377
1377
  d("button", {
1378
1378
  tabindex: "-1",
1379
1379
  class: "__close",
1380
1380
  onClick: N
1381
1381
  }, "×"),
1382
- d("div", qs, [
1382
+ d("div", Ys, [
1383
1383
  d("b", null, j(v.value.title), 1)
1384
1384
  ])
1385
1385
  ]),
1386
- d("div", Js, [
1387
- d("div", Ys, [
1388
- (i(!0), r(T, null, H(S.value, (p) => (i(), r("div", {
1386
+ d("div", qs, [
1387
+ d("div", Js, [
1388
+ (i(!0), r(E, null, D(S.value, (p) => (i(), r("div", {
1389
1389
  key: p.id,
1390
1390
  class: "__interface"
1391
1391
  }, [
@@ -1394,7 +1394,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1394
1394
  modelValue: p.hidden,
1395
1395
  "onUpdate:modelValue": [
1396
1396
  (M) => p.hidden = M,
1397
- C[0] || (C[0] = () => v.value?.events.update.emit(null))
1397
+ k[0] || (k[0] = () => v.value?.events.update.emit(null))
1398
1398
  ],
1399
1399
  disabled: !p.optional,
1400
1400
  inversed: "",
@@ -1411,20 +1411,20 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1411
1411
  ]))), 128))
1412
1412
  ]),
1413
1413
  d("div", Ks, [
1414
- k.value && k.value.state ? (i(), r("div", Zs, [
1415
- C[3] || (C[3] = d("label", null, "Variable name", -1)),
1416
- ee(d("input", {
1417
- "onUpdate:modelValue": C[1] || (C[1] = (p) => k.value.state.variableName = p),
1414
+ C.value && C.value.state ? (i(), r("div", Zs, [
1415
+ k[3] || (k[3] = d("label", null, "Variable name", -1)),
1416
+ te(d("input", {
1417
+ "onUpdate:modelValue": k[1] || (k[1] = (p) => C.value.state.variableName = p),
1418
1418
  type: "text",
1419
1419
  class: "baklava-input",
1420
1420
  title: "Variable name",
1421
1421
  onBlur: m,
1422
- onKeydown: ne(m, ["enter"])
1422
+ onKeydown: oe(m, ["enter"])
1423
1423
  }, null, 544), [
1424
- [te, k.value.state.variableName]
1424
+ [se, C.value.state.variableName]
1425
1425
  ])
1426
1426
  ])) : I("", !0),
1427
- (i(!0), r(T, null, H(L.value, (p) => (i(), r("div", {
1427
+ (i(!0), r(E, null, D(L.value, (p) => (i(), r("div", {
1428
1428
  key: p.id,
1429
1429
  class: "__interface"
1430
1430
  }, [
@@ -1433,7 +1433,7 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1433
1433
  modelValue: p.hidden,
1434
1434
  "onUpdate:modelValue": [
1435
1435
  (M) => p.hidden = M,
1436
- C[2] || (C[2] = () => v.value?.events.update.emit(null))
1436
+ k[2] || (k[2] = () => v.value?.events.update.emit(null))
1437
1437
  ],
1438
1438
  disabled: !p.optional,
1439
1439
  inversed: "",
@@ -1466,14 +1466,14 @@ const Vs = /* @__PURE__ */ $(Ts, [["render", Ss]]), Bs = ["id", "data-node-type"
1466
1466
  }
1467
1467
  },
1468
1468
  setup(s) {
1469
- const { viewModel: e } = q(), { switchGraph: t } = ae(), n = V(!1), o = b(() => s.type.startsWith(se));
1469
+ const { viewModel: e } = Y(), { switchGraph: t } = ie(), n = B(!1), o = b(() => s.type.startsWith(ne));
1470
1470
  return { showContextMenu: n, hasContextMenu: o, contextMenuItems: [
1471
1471
  { label: "Edit Subgraph", value: "editSubgraph" },
1472
1472
  { label: "Delete Subgraph", value: "deleteSubgraph" }
1473
1473
  ], openContextMenu: () => {
1474
1474
  n.value = !0;
1475
1475
  }, onContextMenuClick: (v) => {
1476
- const k = s.type.substring(se.length), w = e.value.editor.graphTemplates.find((S) => S.id === k);
1476
+ const C = s.type.substring(ne.length), w = e.value.editor.graphTemplates.find((S) => S.id === C);
1477
1477
  if (w)
1478
1478
  switch (v) {
1479
1479
  case "editSubgraph":
@@ -1508,7 +1508,7 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1508
1508
  }, pn = /* @__PURE__ */ U({
1509
1509
  __name: "CodeNodePalette",
1510
1510
  setup(s) {
1511
- const { viewModel: e } = q(), { x: t, y: n } = wt(), { transform: o } = it(), a = rt(e), l = ft("editorEl"), u = V(""), v = V(null), k = () => u.value ? a.value.filter(
1511
+ const { viewModel: e } = Y(), { x: t, y: n } = wt(), { transform: o } = rt(), a = dt(e), l = gt("editorEl"), u = B(""), v = B(null), C = () => u.value ? a.value.filter(
1512
1512
  (N) => N.name.toLowerCase().includes(u.value.toLowerCase()) || Object.values(N.nodeTypes).some(
1513
1513
  (m) => m.title.toLowerCase().includes(u.value.toLowerCase())
1514
1514
  )
@@ -1527,31 +1527,31 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1527
1527
  nodeInformation: m
1528
1528
  };
1529
1529
  const y = () => {
1530
- const x = D(new m.type());
1530
+ const x = A(new m.type());
1531
1531
  e.value.displayedGraph.addNode(x);
1532
- const f = l.value.getBoundingClientRect(), [C, p] = o(t.value - f.left, n.value - f.top);
1533
- x.position.x = C, x.position.y = p, v.value = null, document.removeEventListener("pointerup", y);
1532
+ const f = l.value.getBoundingClientRect(), [k, p] = o(t.value - f.left, n.value - f.top);
1533
+ x.position.x = k, x.position.y = p, v.value = null, document.removeEventListener("pointerup", y);
1534
1534
  };
1535
1535
  document.addEventListener("pointerup", y);
1536
1536
  };
1537
- return (N, m) => (i(), r(T, null, [
1537
+ return (N, m) => (i(), r(E, null, [
1538
1538
  d("div", {
1539
- class: G([{ "--open": _(e).settings.palette.enabled }, "baklava-node-palette"]),
1540
- onContextmenu: m[1] || (m[1] = A(() => {
1539
+ class: R([{ "--open": _(e).settings.palette.enabled }, "baklava-node-palette"]),
1540
+ onContextmenu: m[1] || (m[1] = P(() => {
1541
1541
  }, ["stop", "prevent"]))
1542
1542
  }, [
1543
1543
  d("div", dn, [
1544
- ee(d("input", {
1544
+ te(d("input", {
1545
1545
  "onUpdate:modelValue": m[0] || (m[0] = (y) => u.value = y),
1546
1546
  type: "text",
1547
1547
  class: "baklava-input",
1548
1548
  title: "Filter nodes",
1549
- onKeyup: k
1549
+ onKeyup: C
1550
1550
  }, null, 544), [
1551
- [te, u.value]
1551
+ [se, u.value]
1552
1552
  ])
1553
1553
  ]),
1554
- (i(!0), r(T, null, H(k(), (y) => (i(), r("section", {
1554
+ (i(!0), r(E, null, D(C(), (y) => (i(), r("section", {
1555
1555
  key: y.name
1556
1556
  }, [
1557
1557
  y.name !== "default" ? (i(), r("h3", ln, [
@@ -1561,7 +1561,7 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1561
1561
  }, j(y.name), 9, un),
1562
1562
  w(y.nodeTypes).length < Object.values(y.nodeTypes).length ? (i(), r("div", cn, " ( " + j(w(y.nodeTypes).length) + " / " + j(Object.values(y.nodeTypes).length) + " ) ", 1)) : I("", !0)
1563
1563
  ])) : I("", !0),
1564
- (i(!0), r(T, null, H(w(y.nodeTypes), (x) => (i(), O(Ne, {
1564
+ (i(!0), r(E, null, D(w(y.nodeTypes), (x) => (i(), O(Ne, {
1565
1565
  key: x.type,
1566
1566
  type: x.type,
1567
1567
  title: x.title,
@@ -1569,12 +1569,12 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1569
1569
  }, null, 8, ["type", "title", "onPointerdown"]))), 128))
1570
1570
  ]))), 128))
1571
1571
  ], 34),
1572
- z(gt, { name: "fade" }, {
1572
+ z(bt, { name: "fade" }, {
1573
1573
  default: F(() => [
1574
1574
  v.value ? (i(), r("div", {
1575
1575
  key: 0,
1576
1576
  class: "baklava-dragged-node",
1577
- style: re(S.value)
1577
+ style: de(S.value)
1578
1578
  }, [
1579
1579
  z(Ne, {
1580
1580
  type: v.value.type,
@@ -1592,22 +1592,22 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1592
1592
  viewModel: {}
1593
1593
  },
1594
1594
  setup(s) {
1595
- const t = Ee(s, "viewModel"), n = (o) => o.events.update.emit(null);
1596
- return ie(() => {
1595
+ const t = Te(s, "viewModel"), n = (o) => o.events.update.emit(null);
1596
+ return re(() => {
1597
1597
  t.value.subscribe(), t.value.engine.start();
1598
- }), bt(() => {
1598
+ }), yt(() => {
1599
1599
  t.value.unsubscribe(), t.value.engine.stop();
1600
- }), (o, a) => (i(), O(_(dt), { "view-model": t.value }, {
1600
+ }), (o, a) => (i(), O(_(lt), { "view-model": t.value }, {
1601
1601
  palette: F(() => [
1602
1602
  z(pn)
1603
1603
  ]),
1604
1604
  node: F((l) => [
1605
- z(As, kt(l, {
1605
+ z(Ps, kt(l, {
1606
1606
  onUpdate: (u) => n(l.node)
1607
1607
  }), null, 16, ["onUpdate"])
1608
1608
  ]),
1609
1609
  sidebar: F((l) => [
1610
- z(tn, yt(_t(l)), {
1610
+ z(tn, _t(Ct(l)), {
1611
1611
  codeEditor: F(({ node: u }) => [
1612
1612
  W(o.$slots, "sidebarCodeEditor", { node: u })
1613
1613
  ]),
@@ -1619,16 +1619,20 @@ const Ne = /* @__PURE__ */ $(sn, [["render", rn]]), dn = {
1619
1619
  }
1620
1620
  });
1621
1621
  function Ln(s) {
1622
- const e = lt(s?.existingEditor);
1622
+ const e = ut(s?.existingEditor);
1623
1623
  e.code = s?.code ? new s.code(e) : new Lt(e), hn(e);
1624
1624
  const t = {};
1625
1625
  return Object.keys(Q).forEach((n) => {
1626
1626
  t[n] = typeof Q[n] == "object" ? { ...e.settings[n], ...Q[n] } : Q[n];
1627
- }), e.settings = D({ ...e.settings, ...t }), e.settings.nodes.defaultWidth = 350, e.state = D({
1627
+ }), e.settings = A({ ...e.settings, ...t }), e.settings.nodes.defaultWidth = 350, e.state = A({
1628
1628
  modules: {},
1629
1629
  token: null
1630
1630
  }), e.init = () => {
1631
- e.unsubscribe(), e.engine = new ut(e.editor);
1631
+ e.unsubscribe(), e.engine = new ct(e.editor);
1632
+ }, e.loadEditor = (n) => {
1633
+ e.engine?.pause(), e.code.clear(), e.editor.load(n), e.commandHandler.executeCommand(Z.CLEAR_CLIPBOARD_COMMAND), e.commandHandler.executeCommand(Z.CLEAR_HISTORY_COMMAND), e.engine?.resume(), e.engine?.runOnce(null);
1634
+ }, e.newGraph = () => {
1635
+ e.engine?.pause(), e.code.clear(), e.editor.graph.id = Se(), e.engine?.resume(), e.engine?.runOnce(null);
1632
1636
  }, e.subscribe = () => {
1633
1637
  e.state.token && e.unsubscribe();
1634
1638
  const n = Symbol(), o = e.displayedGraph;
@@ -1645,7 +1649,7 @@ function Ln(s) {
1645
1649
  const l = a.node;
1646
1650
  l.isCodeNode && (l.updateOutputNames(), l.updateConnectedInputInterfaces()), e.engine.resume();
1647
1651
  }), e.engine.events.afterRun.subscribe(n, (a) => {
1648
- e.engine.pause(), ct(a, e.editor), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
1652
+ e.engine.pause(), pt(a, e.editor), e.code && (e.code.renderNodeCodes(), e.code.renderCode()), e.engine.resume();
1649
1653
  }), e.state.token = n;
1650
1654
  }, e.unsubscribe = () => {
1651
1655
  if (!e.state.token) return;
@@ -1675,18 +1679,18 @@ const hn = (s) => {
1675
1679
  // Tooltip text
1676
1680
  icon: b(() => s.settings.palette.enabled ? Qt : ts)
1677
1681
  },
1678
- ...pt,
1682
+ ...ht,
1679
1683
  {
1680
1684
  command: t,
1681
1685
  title: "Clear all",
1682
1686
  // Tooltip text
1683
- icon: Vs
1687
+ icon: Bs
1684
1688
  },
1685
1689
  {
1686
1690
  command: n,
1687
1691
  title: "Toggle minimap",
1688
1692
  // Tooltip text
1689
- icon: b(() => s.settings.enableMinimap ? Is : ks)
1693
+ icon: b(() => s.settings.enableMinimap ? Is : Cs)
1690
1694
  }
1691
1695
  ];
1692
1696
  }, Q = {
@@ -1706,15 +1710,15 @@ const hn = (s) => {
1706
1710
  };
1707
1711
  export {
1708
1712
  xt as AbstractCodeNode,
1709
- Cn as CheckboxInterface,
1713
+ kn as CheckboxInterface,
1710
1714
  Lt as Code,
1711
1715
  jn as CodeGraphEditor,
1712
- Se as CodeNode,
1713
- Y as CodeNodeInputInterface,
1714
- P as CodeNodeInterface,
1715
- de as CodeNodeInterfaceComponent,
1716
+ Be as CodeNode,
1717
+ J as CodeNodeInputInterface,
1718
+ H as CodeNodeInterface,
1719
+ le as CodeNodeInterfaceComponent,
1716
1720
  Ot as CodeNodeOutputInterface,
1717
- Pt as CodeVariable,
1721
+ Ht as CodeVariable,
1718
1722
  Q as DEFAULT_SETTINGS,
1719
1723
  Xt as DotsVertical,
1720
1724
  jt as DynamicCodeNode,
@@ -1727,7 +1731,7 @@ export {
1727
1731
  xn as ListInputInterface,
1728
1732
  gs as LockCode,
1729
1733
  In as NumberInterface,
1730
- ks as Schema,
1734
+ Cs as Schema,
1731
1735
  Is as SchemaOff,
1732
1736
  Nn as SelectInterface,
1733
1737
  Mn as SliderInterface,
@@ -1735,26 +1739,26 @@ export {
1735
1739
  zt as TextInputInterfaceComponent,
1736
1740
  On as TextareaInputInterface,
1737
1741
  Os as TransitionBottom,
1738
- Vs as TrashOff,
1739
- Tn as TupleInputInterface,
1740
- kn as addDefaultInterfaceTypes,
1742
+ Bs as TrashOff,
1743
+ En as TupleInputInterface,
1744
+ Cn as addDefaultInterfaceTypes,
1741
1745
  hn as addToolbarCommands,
1742
- Be as booleanType,
1743
- En as defineCodeNode,
1746
+ ze as booleanType,
1747
+ Tn as defineCodeNode,
1744
1748
  Sn as defineDynamicCodeNode,
1745
1749
  $t as dictType,
1746
1750
  It as formatInputs,
1747
- oe as getCodeNodes,
1748
- Vn as getPositionAtColumn,
1749
- Bn as getPositionBeforeNode,
1750
- ze as listType,
1751
+ ae as getCodeNodes,
1752
+ Bn as getPositionAtColumn,
1753
+ Vn as getPositionBeforeNode,
1754
+ je as listType,
1751
1755
  Ve as loadNodeState,
1752
1756
  X as nodeType,
1753
- le as numberType,
1757
+ ue as numberType,
1754
1758
  Nt as saveNodeState,
1755
1759
  _n as setOptional,
1756
- ue as stringType,
1760
+ ce as stringType,
1757
1761
  zn as transferCodeScript,
1758
- je as tupleType,
1762
+ Le as tupleType,
1759
1763
  Ln as useCodeGraph
1760
1764
  };