@versa-stack/v-craft 1.1.0-alpha.2 → 1.1.0-alpha.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,9 +1,9 @@
1
- import { computed as N, toValue as Te, inject as he, defineAsyncComponent as mt, defineComponent as j, useSlots as Xe, useAttrs as gt, unref as d, openBlock as v, createBlock as A, resolveDynamicComponent as ye, normalizeProps as Ue, mergeProps as _e, createSlots as be, renderList as T, withCtx as q, renderSlot as Q, guardReactiveProps as yt, createCommentVNode as D, markRaw as ze, ref as H, watch as J, normalizeClass as ve, createTextVNode as oe, toDisplayString as ee, createElementBlock as _, withKeys as je, withModifiers as F, nextTick as pe, provide as W, resolveComponent as B, createVNode as z, Fragment as U, createElementVNode as w, toRef as de, onUnmounted as bt, toRefs as me, normalizeStyle as Me, withDirectives as Et, Teleport as Ct, vShow as _t, onMounted as Ne, onBeforeMount as Nt, onBeforeUnmount as xt, readonly as qe, onUpdated as Ot, toHandlers as $e, h as wt } from "vue";
2
- import { defineStore as Ye, storeToRefs as te } from "pinia";
3
- import { v4 as G } from "uuid";
4
- import { debounce as Qe } from "lodash-es";
5
- import { FormKit as se, FormKitSchema as Ge } from "@formkit/vue";
6
- class St {
1
+ import { computed as C, toValue as we, inject as ge, defineAsyncComponent as Et, defineComponent as L, useSlots as Qe, useAttrs as Ct, unref as p, openBlock as v, createBlock as M, resolveDynamicComponent as Ce, normalizeProps as Le, mergeProps as Se, createSlots as Ne, renderList as j, withCtx as G, renderSlot as J, guardReactiveProps as Nt, createCommentVNode as R, markRaw as Ge, ref as K, watch as ne, normalizeClass as ye, createTextVNode as ie, toDisplayString as oe, createElementBlock as E, withKeys as Fe, withModifiers as V, nextTick as ve, provide as te, resolveComponent as H, createVNode as Q, Fragment as B, createElementVNode as O, toRef as he, onUnmounted as Pt, toRefs as be, normalizeStyle as Te, withDirectives as _t, Teleport as St, vShow as xt, onMounted as xe, onBeforeMount as Ot, onBeforeUnmount as wt, readonly as We, onUpdated as kt, toHandlers as Ue, reactive as He, h as Dt } from "vue";
2
+ import { defineStore as Ze, storeToRefs as se } from "pinia";
3
+ import { v4 as ee } from "uuid";
4
+ import { debounce as Je } from "lodash-es";
5
+ import { FormKit as le, FormKitSchema as et } from "@formkit/vue";
6
+ class At {
7
7
  /**
8
8
  * @callback HookCallback
9
9
  * @this {*|Jsep} this
@@ -46,7 +46,7 @@ class St {
46
46
  });
47
47
  }
48
48
  }
49
- class Pt {
49
+ class Rt {
50
50
  constructor(e) {
51
51
  this.jsep = e, this.registered = {};
52
52
  }
@@ -372,8 +372,8 @@ class c {
372
372
  prec: n,
373
373
  right_a: c.right_associative.has(r)
374
374
  }, u = r;
375
- const p = (m) => s.right_a && m.right_a ? n > m.prec : n <= m.prec;
376
- for (; o.length > 2 && p(o[o.length - 2]); )
375
+ const d = (m) => s.right_a && m.right_a ? n > m.prec : n <= m.prec;
376
+ for (; o.length > 2 && d(o[o.length - 2]); )
377
377
  i = o.pop(), r = o.pop().value, a = o.pop(), e = {
378
378
  type: c.BINARY_EXP,
379
379
  operator: r,
@@ -619,10 +619,10 @@ class c {
619
619
  };
620
620
  }
621
621
  }
622
- const kt = new St();
622
+ const Mt = new At();
623
623
  Object.assign(c, {
624
- hooks: kt,
625
- plugins: new Pt(c),
624
+ hooks: Mt,
625
+ plugins: new Rt(c),
626
626
  // Node Types
627
627
  // ----------
628
628
  // This is the full set of types that any JSEP node can be.
@@ -718,14 +718,14 @@ Object.assign(c, {
718
718
  });
719
719
  c.max_unop_len = c.getMaxKeyLen(c.unary_ops);
720
720
  c.max_binop_len = c.getMaxKeyLen(c.binary_ops);
721
- const Z = (t) => new c(t).parse(), Dt = Object.getOwnPropertyNames(class {
721
+ const re = (t) => new c(t).parse(), $t = Object.getOwnPropertyNames(class {
722
722
  });
723
- Object.getOwnPropertyNames(c).filter((t) => !Dt.includes(t) && Z[t] === void 0).forEach((t) => {
724
- Z[t] = c[t];
723
+ Object.getOwnPropertyNames(c).filter((t) => !$t.includes(t) && re[t] === void 0).forEach((t) => {
724
+ re[t] = c[t];
725
725
  });
726
- Z.Jsep = c;
727
- const At = "ConditionalExpression";
728
- var Mt = {
726
+ re.Jsep = c;
727
+ const It = "ConditionalExpression";
728
+ var Tt = {
729
729
  name: "ternary",
730
730
  init(t) {
731
731
  t.hooks.add("after-expression", function(r) {
@@ -736,7 +736,7 @@ var Mt = {
736
736
  this.index++;
737
737
  const s = this.gobbleExpression();
738
738
  if (s || this.throwError("Expected expression"), r.node = {
739
- type: At,
739
+ type: It,
740
740
  test: n,
741
741
  consequent: o,
742
742
  alternate: s
@@ -752,17 +752,17 @@ var Mt = {
752
752
  });
753
753
  }
754
754
  };
755
- Z.plugins.register(Mt);
756
- const Be = 47, $t = 92;
757
- var Rt = {
755
+ re.plugins.register(Tt);
756
+ const Ve = 47, Ut = 92;
757
+ var jt = {
758
758
  name: "regex",
759
759
  init(t) {
760
760
  t.hooks.add("gobble-token", function(r) {
761
- if (this.code === Be) {
761
+ if (this.code === Ve) {
762
762
  const n = ++this.index;
763
763
  let o = !1;
764
764
  for (; this.index < this.expr.length; ) {
765
- if (this.code === Be && !o) {
765
+ if (this.code === Ve && !o) {
766
766
  const s = this.expr.slice(n, this.index);
767
767
  let a = "";
768
768
  for (; ++this.index < this.expr.length; ) {
@@ -784,34 +784,34 @@ var Rt = {
784
784
  raw: this.expr.slice(n - 1, this.index)
785
785
  }, r.node = this.gobbleTokenProperty(r.node), r.node;
786
786
  }
787
- this.code === t.OBRACK_CODE ? o = !0 : o && this.code === t.CBRACK_CODE && (o = !1), this.index += this.code === $t ? 2 : 1;
787
+ this.code === t.OBRACK_CODE ? o = !0 : o && this.code === t.CBRACK_CODE && (o = !1), this.index += this.code === Ut ? 2 : 1;
788
788
  }
789
789
  this.throwError("Unclosed Regex");
790
790
  }
791
791
  });
792
792
  }
793
793
  };
794
- const Oe = 43, It = 45, ce = {
794
+ const ke = 43, Bt = 45, fe = {
795
795
  name: "assignment",
796
796
  assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
797
- updateOperators: [Oe, It],
797
+ updateOperators: [ke, Bt],
798
798
  assignmentPrecedence: 0.9,
799
799
  init(t) {
800
800
  const e = [t.IDENTIFIER, t.MEMBER_EXP];
801
- ce.assignmentOperators.forEach((n) => t.addBinaryOp(n, ce.assignmentPrecedence, !0)), t.hooks.add("gobble-token", function(o) {
801
+ fe.assignmentOperators.forEach((n) => t.addBinaryOp(n, fe.assignmentPrecedence, !0)), t.hooks.add("gobble-token", function(o) {
802
802
  const s = this.code;
803
- ce.updateOperators.some((a) => a === s && a === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, o.node = {
803
+ fe.updateOperators.some((a) => a === s && a === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, o.node = {
804
804
  type: "UpdateExpression",
805
- operator: s === Oe ? "++" : "--",
805
+ operator: s === ke ? "++" : "--",
806
806
  argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
807
807
  prefix: !0
808
808
  }, (!o.node.argument || !e.includes(o.node.argument.type)) && this.throwError(`Unexpected ${o.node.operator}`));
809
809
  }), t.hooks.add("after-token", function(o) {
810
810
  if (o.node) {
811
811
  const s = this.code;
812
- ce.updateOperators.some((a) => a === s && a === this.expr.charCodeAt(this.index + 1)) && (e.includes(o.node.type) || this.throwError(`Unexpected ${o.node.operator}`), this.index += 2, o.node = {
812
+ fe.updateOperators.some((a) => a === s && a === this.expr.charCodeAt(this.index + 1)) && (e.includes(o.node.type) || this.throwError(`Unexpected ${o.node.operator}`), this.index += 2, o.node = {
813
813
  type: "UpdateExpression",
814
- operator: s === Oe ? "++" : "--",
814
+ operator: s === ke ? "++" : "--",
815
815
  argument: o.node,
816
816
  prefix: !1
817
817
  });
@@ -820,18 +820,18 @@ const Oe = 43, It = 45, ce = {
820
820
  o.node && r(o.node);
821
821
  });
822
822
  function r(n) {
823
- ce.assignmentOperators.has(n.operator) ? (n.type = "AssignmentExpression", r(n.left), r(n.right)) : n.operator || Object.values(n).forEach((o) => {
823
+ fe.assignmentOperators.has(n.operator) ? (n.type = "AssignmentExpression", r(n.left), r(n.right)) : n.operator || Object.values(n).forEach((o) => {
824
824
  o && typeof o == "object" && r(o);
825
825
  });
826
826
  }
827
827
  }
828
828
  };
829
- Z.plugins.register(Rt, ce);
830
- Z.addUnaryOp("typeof");
831
- Z.addUnaryOp("void");
832
- Z.addLiteral("null", null);
833
- Z.addLiteral("undefined", void 0);
834
- const Tt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]), M = {
829
+ re.plugins.register(jt, fe);
830
+ re.addUnaryOp("typeof");
831
+ re.addUnaryOp("void");
832
+ re.addLiteral("null", null);
833
+ re.addLiteral("undefined", void 0);
834
+ const Lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]), $ = {
835
835
  /**
836
836
  * @param {jsep.Expression} ast
837
837
  * @param {Record<string, any>} subs
@@ -840,25 +840,25 @@ const Tt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
840
840
  switch (t.type) {
841
841
  case "BinaryExpression":
842
842
  case "LogicalExpression":
843
- return M.evalBinaryExpression(t, e);
843
+ return $.evalBinaryExpression(t, e);
844
844
  case "Compound":
845
- return M.evalCompound(t, e);
845
+ return $.evalCompound(t, e);
846
846
  case "ConditionalExpression":
847
- return M.evalConditionalExpression(t, e);
847
+ return $.evalConditionalExpression(t, e);
848
848
  case "Identifier":
849
- return M.evalIdentifier(t, e);
849
+ return $.evalIdentifier(t, e);
850
850
  case "Literal":
851
- return M.evalLiteral(t, e);
851
+ return $.evalLiteral(t, e);
852
852
  case "MemberExpression":
853
- return M.evalMemberExpression(t, e);
853
+ return $.evalMemberExpression(t, e);
854
854
  case "UnaryExpression":
855
- return M.evalUnaryExpression(t, e);
855
+ return $.evalUnaryExpression(t, e);
856
856
  case "ArrayExpression":
857
- return M.evalArrayExpression(t, e);
857
+ return $.evalArrayExpression(t, e);
858
858
  case "CallExpression":
859
- return M.evalCallExpression(t, e);
859
+ return $.evalCallExpression(t, e);
860
860
  case "AssignmentExpression":
861
- return M.evalAssignmentExpression(t, e);
861
+ return $.evalAssignmentExpression(t, e);
862
862
  default:
863
863
  throw SyntaxError("Unexpected expression", t);
864
864
  }
@@ -888,19 +888,19 @@ const Tt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
888
888
  "*": (n, o) => n * o(),
889
889
  "/": (n, o) => n / o(),
890
890
  "%": (n, o) => n % o()
891
- }[t.operator](M.evalAst(t.left, e), () => M.evalAst(t.right, e));
891
+ }[t.operator]($.evalAst(t.left, e), () => $.evalAst(t.right, e));
892
892
  },
893
893
  evalCompound(t, e) {
894
894
  let r;
895
895
  for (let n = 0; n < t.body.length; n++) {
896
896
  t.body[n].type === "Identifier" && ["var", "let", "const"].includes(t.body[n].name) && t.body[n + 1] && t.body[n + 1].type === "AssignmentExpression" && (n += 1);
897
897
  const o = t.body[n];
898
- r = M.evalAst(o, e);
898
+ r = $.evalAst(o, e);
899
899
  }
900
900
  return r;
901
901
  },
902
902
  evalConditionalExpression(t, e) {
903
- return M.evalAst(t.test, e) ? M.evalAst(t.consequent, e) : M.evalAst(t.alternate, e);
903
+ return $.evalAst(t.test, e) ? $.evalAst(t.consequent, e) : $.evalAst(t.alternate, e);
904
904
  },
905
905
  evalIdentifier(t, e) {
906
906
  if (Object.hasOwn(e, t.name))
@@ -915,33 +915,33 @@ const Tt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
915
915
  // NOTE: `String(value)` throws error when
916
916
  // value has overwritten the toString method to return non-string
917
917
  // i.e. `value = {toString: () => []}`
918
- t.computed ? M.evalAst(t.property) : t.property.name
918
+ t.computed ? $.evalAst(t.property) : t.property.name
919
919
  // `object.property` property is Identifier
920
- ), n = M.evalAst(t.object, e);
920
+ ), n = $.evalAst(t.object, e);
921
921
  if (n == null)
922
922
  throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);
923
- if (!Object.hasOwn(n, r) && Tt.has(r))
923
+ if (!Object.hasOwn(n, r) && Lt.has(r))
924
924
  throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);
925
925
  const o = n[r];
926
926
  return typeof o == "function" ? o.bind(n) : o;
927
927
  },
928
928
  evalUnaryExpression(t, e) {
929
929
  return {
930
- "-": (n) => -M.evalAst(n, e),
931
- "!": (n) => !M.evalAst(n, e),
932
- "~": (n) => ~M.evalAst(n, e),
930
+ "-": (n) => -$.evalAst(n, e),
931
+ "!": (n) => !$.evalAst(n, e),
932
+ "~": (n) => ~$.evalAst(n, e),
933
933
  // eslint-disable-next-line no-implicit-coercion -- API
934
- "+": (n) => +M.evalAst(n, e),
935
- typeof: (n) => typeof M.evalAst(n, e),
934
+ "+": (n) => +$.evalAst(n, e),
935
+ typeof: (n) => typeof $.evalAst(n, e),
936
936
  // eslint-disable-next-line no-void, sonarjs/void-use -- feature
937
- void: (n) => void M.evalAst(n, e)
937
+ void: (n) => void $.evalAst(n, e)
938
938
  }[t.operator](t.argument);
939
939
  },
940
940
  evalArrayExpression(t, e) {
941
- return t.elements.map((r) => M.evalAst(r, e));
941
+ return t.elements.map((r) => $.evalAst(r, e));
942
942
  },
943
943
  evalCallExpression(t, e) {
944
- const r = t.arguments.map((o) => M.evalAst(o, e)), n = M.evalAst(t.callee, e);
944
+ const r = t.arguments.map((o) => $.evalAst(o, e)), n = $.evalAst(t.callee, e);
945
945
  if (n === Function)
946
946
  throw new Error("Function constructor is disabled");
947
947
  return n(...r);
@@ -949,16 +949,16 @@ const Tt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
949
949
  evalAssignmentExpression(t, e) {
950
950
  if (t.left.type !== "Identifier")
951
951
  throw SyntaxError("Invalid left-hand side in assignment");
952
- const r = t.left.name, n = M.evalAst(t.right, e);
952
+ const r = t.left.name, n = $.evalAst(t.right, e);
953
953
  return e[r] = n, e[r];
954
954
  }
955
955
  };
956
- class Ut {
956
+ class Ft {
957
957
  /**
958
958
  * @param {string} expr Expression to evaluate
959
959
  */
960
960
  constructor(e) {
961
- this.code = e, this.ast = Z(this.code);
961
+ this.code = e, this.ast = re(this.code);
962
962
  }
963
963
  /**
964
964
  * @param {object} context Object whose items will be added
@@ -967,16 +967,16 @@ class Ut {
967
967
  */
968
968
  runInNewContext(e) {
969
969
  const r = Object.assign(/* @__PURE__ */ Object.create(null), e);
970
- return M.evalAst(this.ast, r);
970
+ return $.evalAst(this.ast, r);
971
971
  }
972
972
  }
973
- function ne(t, e) {
973
+ function ae(t, e) {
974
974
  return t = t.slice(), t.push(e), t;
975
975
  }
976
- function we(t, e) {
976
+ function De(t, e) {
977
977
  return e = e.slice(), e.unshift(t), e;
978
978
  }
979
- class jt extends Error {
979
+ class Ht extends Error {
980
980
  /**
981
981
  * @param {AnyResult} value The evaluated scalar value
982
982
  */
@@ -984,10 +984,10 @@ class jt extends Error {
984
984
  super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'), this.avoidNew = !0, this.value = e, this.name = "NewError";
985
985
  }
986
986
  }
987
- function S(t, e, r, n, o) {
988
- if (!(this instanceof S))
987
+ function k(t, e, r, n, o) {
988
+ if (!(this instanceof k))
989
989
  try {
990
- return new S(t, e, r, n, o);
990
+ return new k(t, e, r, n, o);
991
991
  } catch (a) {
992
992
  if (!a.avoidNew)
993
993
  throw a;
@@ -1004,11 +1004,11 @@ function S(t, e, r, n, o) {
1004
1004
  s ? "json" in t && (a.json = t.json) : a.json = r;
1005
1005
  const i = this.evaluate(a);
1006
1006
  if (!i || typeof i != "object")
1007
- throw new jt(i);
1007
+ throw new Ht(i);
1008
1008
  return i;
1009
1009
  }
1010
1010
  }
1011
- S.prototype.evaluate = function(t, e, r, n) {
1011
+ k.prototype.evaluate = function(t, e, r, n) {
1012
1012
  let o = this.parent, s = this.parentProperty, {
1013
1013
  flatten: a,
1014
1014
  wrap: i
@@ -1022,44 +1022,44 @@ S.prototype.evaluate = function(t, e, r, n) {
1022
1022
  json: e
1023
1023
  } = t), a = Object.hasOwn(t, "flatten") ? t.flatten : a, this.currResultType = Object.hasOwn(t, "resultType") ? t.resultType : this.currResultType, this.currSandbox = Object.hasOwn(t, "sandbox") ? t.sandbox : this.currSandbox, i = Object.hasOwn(t, "wrap") ? t.wrap : i, this.currEval = Object.hasOwn(t, "eval") ? t.eval : this.currEval, r = Object.hasOwn(t, "callback") ? t.callback : r, this.currOtherTypeCallback = Object.hasOwn(t, "otherTypeCallback") ? t.otherTypeCallback : this.currOtherTypeCallback, o = Object.hasOwn(t, "parent") ? t.parent : o, s = Object.hasOwn(t, "parentProperty") ? t.parentProperty : s, t = t.path;
1024
1024
  }
1025
- if (o = o || null, s = s || null, Array.isArray(t) && (t = S.toPathString(t)), !t && t !== "" || !e)
1025
+ if (o = o || null, s = s || null, Array.isArray(t) && (t = k.toPathString(t)), !t && t !== "" || !e)
1026
1026
  return;
1027
- const l = S.toPathArray(t);
1027
+ const l = k.toPathArray(t);
1028
1028
  l[0] === "$" && l.length > 1 && l.shift(), this._hasParentSelector = null;
1029
- const u = this._trace(l, e, ["$"], o, s, r).filter(function(p) {
1030
- return p && !p.isParentSelector;
1029
+ const u = this._trace(l, e, ["$"], o, s, r).filter(function(d) {
1030
+ return d && !d.isParentSelector;
1031
1031
  });
1032
- return u.length ? !i && u.length === 1 && !u[0].hasArrExpr ? this._getPreferredOutput(u[0]) : u.reduce((p, m) => {
1032
+ return u.length ? !i && u.length === 1 && !u[0].hasArrExpr ? this._getPreferredOutput(u[0]) : u.reduce((d, m) => {
1033
1033
  const f = this._getPreferredOutput(m);
1034
- return a && Array.isArray(f) ? p = p.concat(f) : p.push(f), p;
1034
+ return a && Array.isArray(f) ? d = d.concat(f) : d.push(f), d;
1035
1035
  }, []) : i ? [] : void 0;
1036
1036
  };
1037
- S.prototype._getPreferredOutput = function(t) {
1037
+ k.prototype._getPreferredOutput = function(t) {
1038
1038
  const e = this.currResultType;
1039
1039
  switch (e) {
1040
1040
  case "all": {
1041
- const r = Array.isArray(t.path) ? t.path : S.toPathArray(t.path);
1042
- return t.pointer = S.toPointer(r), t.path = typeof t.path == "string" ? t.path : S.toPathString(t.path), t;
1041
+ const r = Array.isArray(t.path) ? t.path : k.toPathArray(t.path);
1042
+ return t.pointer = k.toPointer(r), t.path = typeof t.path == "string" ? t.path : k.toPathString(t.path), t;
1043
1043
  }
1044
1044
  case "value":
1045
1045
  case "parent":
1046
1046
  case "parentProperty":
1047
1047
  return t[e];
1048
1048
  case "path":
1049
- return S.toPathString(t[e]);
1049
+ return k.toPathString(t[e]);
1050
1050
  case "pointer":
1051
- return S.toPointer(t.path);
1051
+ return k.toPointer(t.path);
1052
1052
  default:
1053
1053
  throw new TypeError("Unknown result type");
1054
1054
  }
1055
1055
  };
1056
- S.prototype._handleCallback = function(t, e, r) {
1056
+ k.prototype._handleCallback = function(t, e, r) {
1057
1057
  if (e) {
1058
1058
  const n = this._getPreferredOutput(t);
1059
- t.path = typeof t.path == "string" ? t.path : S.toPathString(t.path), e(n, r, t);
1059
+ t.path = typeof t.path == "string" ? t.path : k.toPathString(t.path), e(n, r, t);
1060
1060
  }
1061
1061
  };
1062
- S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1062
+ k.prototype._trace = function(t, e, r, n, o, s, a, i) {
1063
1063
  let l;
1064
1064
  if (!t.length)
1065
1065
  return l = {
@@ -1069,58 +1069,58 @@ S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1069
1069
  parentProperty: o,
1070
1070
  hasArrExpr: a
1071
1071
  }, this._handleCallback(l, s, "value"), l;
1072
- const u = t[0], p = t.slice(1), m = [];
1072
+ const u = t[0], d = t.slice(1), m = [];
1073
1073
  function f(h) {
1074
- Array.isArray(h) ? h.forEach((y) => {
1075
- m.push(y);
1074
+ Array.isArray(h) ? h.forEach((b) => {
1075
+ m.push(b);
1076
1076
  }) : m.push(h);
1077
1077
  }
1078
1078
  if ((typeof u != "string" || i) && e && Object.hasOwn(e, u))
1079
- f(this._trace(p, e[u], ne(r, u), e, u, s, a));
1079
+ f(this._trace(d, e[u], ae(r, u), e, u, s, a));
1080
1080
  else if (u === "*")
1081
1081
  this._walk(e, (h) => {
1082
- f(this._trace(p, e[h], ne(r, h), e, h, s, !0, !0));
1082
+ f(this._trace(d, e[h], ae(r, h), e, h, s, !0, !0));
1083
1083
  });
1084
1084
  else if (u === "..")
1085
- f(this._trace(p, e, r, n, o, s, a)), this._walk(e, (h) => {
1086
- typeof e[h] == "object" && f(this._trace(t.slice(), e[h], ne(r, h), e, h, s, !0));
1085
+ f(this._trace(d, e, r, n, o, s, a)), this._walk(e, (h) => {
1086
+ typeof e[h] == "object" && f(this._trace(t.slice(), e[h], ae(r, h), e, h, s, !0));
1087
1087
  });
1088
1088
  else {
1089
1089
  if (u === "^")
1090
1090
  return this._hasParentSelector = !0, {
1091
1091
  path: r.slice(0, -1),
1092
- expr: p,
1092
+ expr: d,
1093
1093
  isParentSelector: !0
1094
1094
  };
1095
1095
  if (u === "~")
1096
1096
  return l = {
1097
- path: ne(r, u),
1097
+ path: ae(r, u),
1098
1098
  value: o,
1099
1099
  parent: n,
1100
1100
  parentProperty: null
1101
1101
  }, this._handleCallback(l, s, "property"), l;
1102
1102
  if (u === "$")
1103
- f(this._trace(p, e, r, null, null, s, a));
1103
+ f(this._trace(d, e, r, null, null, s, a));
1104
1104
  else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(u))
1105
- f(this._slice(u, p, e, r, n, o, s));
1105
+ f(this._slice(u, d, e, r, n, o, s));
1106
1106
  else if (u.indexOf("?(") === 0) {
1107
1107
  if (this.currEval === !1)
1108
1108
  throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
1109
- const h = u.replace(/^\?\((.*?)\)$/u, "$1"), y = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(h);
1110
- y ? this._walk(e, (x) => {
1111
- const P = [y[2]], g = y[1] ? e[x][y[1]] : e[x];
1112
- this._trace(P, g, r, n, o, s, !0).length > 0 && f(this._trace(p, e[x], ne(r, x), e, x, s, !0));
1113
- }) : this._walk(e, (x) => {
1114
- this._eval(h, e[x], x, r, n, o) && f(this._trace(p, e[x], ne(r, x), e, x, s, !0));
1109
+ const h = u.replace(/^\?\((.*?)\)$/u, "$1"), b = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(h);
1110
+ b ? this._walk(e, (P) => {
1111
+ const A = [b[2]], T = b[1] ? e[P][b[1]] : e[P];
1112
+ this._trace(A, T, r, n, o, s, !0).length > 0 && f(this._trace(d, e[P], ae(r, P), e, P, s, !0));
1113
+ }) : this._walk(e, (P) => {
1114
+ this._eval(h, e[P], P, r, n, o) && f(this._trace(d, e[P], ae(r, P), e, P, s, !0));
1115
1115
  });
1116
1116
  } else if (u[0] === "(") {
1117
1117
  if (this.currEval === !1)
1118
1118
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
1119
- f(this._trace(we(this._eval(u, e, r.at(-1), r.slice(0, -1), n, o), p), e, r, n, o, s, a));
1119
+ f(this._trace(De(this._eval(u, e, r.at(-1), r.slice(0, -1), n, o), d), e, r, n, o, s, a));
1120
1120
  } else if (u[0] === "@") {
1121
1121
  let h = !1;
1122
- const y = u.slice(1, -2);
1123
- switch (y) {
1122
+ const b = u.slice(1, -2);
1123
+ switch (b) {
1124
1124
  case "scalar":
1125
1125
  (!e || !["object", "function"].includes(typeof e)) && (h = !0);
1126
1126
  break;
@@ -1128,7 +1128,7 @@ S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1128
1128
  case "string":
1129
1129
  case "undefined":
1130
1130
  case "function":
1131
- typeof e === y && (h = !0);
1131
+ typeof e === b && (h = !0);
1132
1132
  break;
1133
1133
  case "integer":
1134
1134
  Number.isFinite(e) && !(e % 1) && (h = !0);
@@ -1140,7 +1140,7 @@ S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1140
1140
  typeof e == "number" && !Number.isFinite(e) && (h = !0);
1141
1141
  break;
1142
1142
  case "object":
1143
- e && typeof e === y && (h = !0);
1143
+ e && typeof e === b && (h = !0);
1144
1144
  break;
1145
1145
  case "array":
1146
1146
  Array.isArray(e) && (h = !0);
@@ -1153,7 +1153,7 @@ S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1153
1153
  break;
1154
1154
  /* c8 ignore next 2 */
1155
1155
  default:
1156
- throw new TypeError("Unknown value type " + y);
1156
+ throw new TypeError("Unknown value type " + b);
1157
1157
  }
1158
1158
  if (h)
1159
1159
  return l = {
@@ -1164,30 +1164,30 @@ S.prototype._trace = function(t, e, r, n, o, s, a, i) {
1164
1164
  }, this._handleCallback(l, s, "value"), l;
1165
1165
  } else if (u[0] === "`" && e && Object.hasOwn(e, u.slice(1))) {
1166
1166
  const h = u.slice(1);
1167
- f(this._trace(p, e[h], ne(r, h), e, h, s, a, !0));
1167
+ f(this._trace(d, e[h], ae(r, h), e, h, s, a, !0));
1168
1168
  } else if (u.includes(",")) {
1169
1169
  const h = u.split(",");
1170
- for (const y of h)
1171
- f(this._trace(we(y, p), e, r, n, o, s, !0));
1172
- } else !i && e && Object.hasOwn(e, u) && f(this._trace(p, e[u], ne(r, u), e, u, s, a, !0));
1170
+ for (const b of h)
1171
+ f(this._trace(De(b, d), e, r, n, o, s, !0));
1172
+ } else !i && e && Object.hasOwn(e, u) && f(this._trace(d, e[u], ae(r, u), e, u, s, a, !0));
1173
1173
  }
1174
1174
  if (this._hasParentSelector)
1175
1175
  for (let h = 0; h < m.length; h++) {
1176
- const y = m[h];
1177
- if (y && y.isParentSelector) {
1178
- const x = this._trace(y.expr, e, y.path, n, o, s, a);
1179
- if (Array.isArray(x)) {
1180
- m[h] = x[0];
1181
- const P = x.length;
1182
- for (let g = 1; g < P; g++)
1183
- h++, m.splice(h, 0, x[g]);
1176
+ const b = m[h];
1177
+ if (b && b.isParentSelector) {
1178
+ const P = this._trace(b.expr, e, b.path, n, o, s, a);
1179
+ if (Array.isArray(P)) {
1180
+ m[h] = P[0];
1181
+ const A = P.length;
1182
+ for (let T = 1; T < A; T++)
1183
+ h++, m.splice(h, 0, P[T]);
1184
1184
  } else
1185
- m[h] = x;
1185
+ m[h] = P;
1186
1186
  }
1187
1187
  }
1188
1188
  return m;
1189
1189
  };
1190
- S.prototype._walk = function(t, e) {
1190
+ k.prototype._walk = function(t, e) {
1191
1191
  if (Array.isArray(t)) {
1192
1192
  const r = t.length;
1193
1193
  for (let n = 0; n < r; n++)
@@ -1196,67 +1196,67 @@ S.prototype._walk = function(t, e) {
1196
1196
  e(r);
1197
1197
  });
1198
1198
  };
1199
- S.prototype._slice = function(t, e, r, n, o, s, a) {
1199
+ k.prototype._slice = function(t, e, r, n, o, s, a) {
1200
1200
  if (!Array.isArray(r))
1201
1201
  return;
1202
1202
  const i = r.length, l = t.split(":"), u = l[2] && Number.parseInt(l[2]) || 1;
1203
- let p = l[0] && Number.parseInt(l[0]) || 0, m = l[1] && Number.parseInt(l[1]) || i;
1204
- p = p < 0 ? Math.max(0, p + i) : Math.min(i, p), m = m < 0 ? Math.max(0, m + i) : Math.min(i, m);
1203
+ let d = l[0] && Number.parseInt(l[0]) || 0, m = l[1] && Number.parseInt(l[1]) || i;
1204
+ d = d < 0 ? Math.max(0, d + i) : Math.min(i, d), m = m < 0 ? Math.max(0, m + i) : Math.min(i, m);
1205
1205
  const f = [];
1206
- for (let h = p; h < m; h += u)
1207
- this._trace(we(h, e), r, n, o, s, a, !0).forEach((x) => {
1208
- f.push(x);
1206
+ for (let h = d; h < m; h += u)
1207
+ this._trace(De(h, e), r, n, o, s, a, !0).forEach((P) => {
1208
+ f.push(P);
1209
1209
  });
1210
1210
  return f;
1211
1211
  };
1212
- S.prototype._eval = function(t, e, r, n, o, s) {
1212
+ k.prototype._eval = function(t, e, r, n, o, s) {
1213
1213
  this.currSandbox._$_parentProperty = s, this.currSandbox._$_parent = o, this.currSandbox._$_property = r, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
1214
1214
  const a = t.includes("@path");
1215
- a && (this.currSandbox._$_path = S.toPathString(n.concat([r])));
1215
+ a && (this.currSandbox._$_path = k.toPathString(n.concat([r])));
1216
1216
  const i = this.currEval + "Script:" + t;
1217
- if (!S.cache[i]) {
1217
+ if (!k.cache[i]) {
1218
1218
  let l = t.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1219
1219
  if (a && (l = l.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1220
- S.cache[i] = new this.safeVm.Script(l);
1220
+ k.cache[i] = new this.safeVm.Script(l);
1221
1221
  else if (this.currEval === "native")
1222
- S.cache[i] = new this.vm.Script(l);
1222
+ k.cache[i] = new this.vm.Script(l);
1223
1223
  else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
1224
1224
  const u = this.currEval;
1225
- S.cache[i] = new u(l);
1225
+ k.cache[i] = new u(l);
1226
1226
  } else if (typeof this.currEval == "function")
1227
- S.cache[i] = {
1227
+ k.cache[i] = {
1228
1228
  runInNewContext: (u) => this.currEval(l, u)
1229
1229
  };
1230
1230
  else
1231
1231
  throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
1232
1232
  }
1233
1233
  try {
1234
- return S.cache[i].runInNewContext(this.currSandbox);
1234
+ return k.cache[i].runInNewContext(this.currSandbox);
1235
1235
  } catch (l) {
1236
1236
  if (this.ignoreEvalErrors)
1237
1237
  return !1;
1238
1238
  throw new Error("jsonPath: " + l.message + ": " + t);
1239
1239
  }
1240
1240
  };
1241
- S.cache = {};
1242
- S.toPathString = function(t) {
1241
+ k.cache = {};
1242
+ k.toPathString = function(t) {
1243
1243
  const e = t, r = e.length;
1244
1244
  let n = "$";
1245
1245
  for (let o = 1; o < r; o++)
1246
1246
  /^(~|\^|@.*?\(\))$/u.test(e[o]) || (n += /^[0-9*]+$/u.test(e[o]) ? "[" + e[o] + "]" : "['" + e[o] + "']");
1247
1247
  return n;
1248
1248
  };
1249
- S.toPointer = function(t) {
1249
+ k.toPointer = function(t) {
1250
1250
  const e = t, r = e.length;
1251
1251
  let n = "";
1252
1252
  for (let o = 1; o < r; o++)
1253
1253
  /^(~|\^|@.*?\(\))$/u.test(e[o]) || (n += "/" + e[o].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
1254
1254
  return n;
1255
1255
  };
1256
- S.toPathArray = function(t) {
1256
+ k.toPathArray = function(t) {
1257
1257
  const {
1258
1258
  cache: e
1259
- } = S;
1259
+ } = k;
1260
1260
  if (e[t])
1261
1261
  return e[t].concat();
1262
1262
  const r = [], o = t.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(s, a) {
@@ -1271,17 +1271,17 @@ S.toPathArray = function(t) {
1271
1271
  });
1272
1272
  return e[t] = o, e[t].concat();
1273
1273
  };
1274
- S.prototype.safeVm = {
1275
- Script: Ut
1274
+ k.prototype.safeVm = {
1275
+ Script: Ft
1276
1276
  };
1277
- const Bt = function(t, e, r) {
1277
+ const Vt = function(t, e, r) {
1278
1278
  const n = t.length;
1279
1279
  for (let o = 0; o < n; o++) {
1280
1280
  const s = t[o];
1281
1281
  r(s) && e.push(t.splice(o--, 1)[0]);
1282
1282
  }
1283
1283
  };
1284
- class Lt {
1284
+ class Kt {
1285
1285
  /**
1286
1286
  * @param {string} expr Expression to evaluate
1287
1287
  */
@@ -1296,20 +1296,20 @@ class Lt {
1296
1296
  runInNewContext(e) {
1297
1297
  let r = this.code;
1298
1298
  const n = Object.keys(e), o = [];
1299
- Bt(n, o, (u) => typeof e[u] == "function");
1299
+ Vt(n, o, (u) => typeof e[u] == "function");
1300
1300
  const s = n.map((u) => e[u]);
1301
- r = o.reduce((u, p) => {
1302
- let m = e[p].toString();
1303
- return /function/u.test(m) || (m = "function " + m), "var " + p + "=" + m + ";" + u;
1301
+ r = o.reduce((u, d) => {
1302
+ let m = e[d].toString();
1303
+ return /function/u.test(m) || (m = "function " + m), "var " + d + "=" + m + ";" + u;
1304
1304
  }, "") + r, !/(['"])use strict\1/u.test(r) && !n.includes("arguments") && (r = "var arguments = undefined;" + r), r = r.replace(/;\s*$/u, "");
1305
1305
  const i = r.lastIndexOf(";"), l = i !== -1 ? r.slice(0, i + 1) + " return " + r.slice(i + 1) : " return " + r;
1306
1306
  return new Function(...n, l)(...s);
1307
1307
  }
1308
1308
  }
1309
- S.prototype.vm = {
1310
- Script: Lt
1309
+ k.prototype.vm = {
1310
+ Script: Kt
1311
1311
  };
1312
- function Se(t, e, r) {
1312
+ function Ae(t, e, r) {
1313
1313
  const n = e.replace(/^\$\.?/, "").split(/\.|\[|\]/).filter(Boolean);
1314
1314
  let o = t;
1315
1315
  for (let a = 0; a < n.length - 1; a++) {
@@ -1317,8 +1317,8 @@ function Se(t, e, r) {
1317
1317
  if (i === "__proto__" || i === "constructor" || i === "prototype")
1318
1318
  throw new Error("Invalid path part: " + i);
1319
1319
  if (i in o || (o[i] = u ? [] : {}), u) {
1320
- const p = parseInt(l, 10);
1321
- Array.isArray(o[i]) || (o[i] = []), o[i].length <= p && (o[i][p] = a === n.length - 2 ? r : {}), o = o[i][p], a++;
1320
+ const d = parseInt(l, 10);
1321
+ Array.isArray(o[i]) || (o[i] = []), o[i].length <= d && (o[i][d] = a === n.length - 2 ? r : {}), o = o[i][d], a++;
1322
1322
  } else
1323
1323
  o = o[i];
1324
1324
  }
@@ -1331,34 +1331,42 @@ function Se(t, e, r) {
1331
1331
  } else
1332
1332
  o[s] = r;
1333
1333
  }
1334
- const Ft = (t, e) => {
1335
- const r = {};
1336
- return t && Object.entries(t).forEach(([n, o]) => {
1337
- const s = e[n];
1338
- s !== void 0 && Object.entries(o).forEach(([a, i]) => {
1339
- const l = S({
1340
- path: i,
1341
- json: s,
1342
- resultType: "value"
1343
- });
1344
- l.length && Se(r, a, l[0]);
1334
+ const Xt = (t, e) => {
1335
+ if (typeof t != "string") return;
1336
+ const r = k({ path: t, json: e, resultType: "value" });
1337
+ return r.length ? r[0] : void 0;
1338
+ }, zt = (t, e, r) => {
1339
+ const n = {};
1340
+ return t && Object.entries(t).forEach(([o, s]) => {
1341
+ const a = e[o];
1342
+ a !== void 0 && Object.entries(s).forEach(([i, l]) => {
1343
+ const u = r ? r.resolvePropertyValue(l, a) : Xt(l, a);
1344
+ u !== void 0 && Ae(n, i, u);
1345
1345
  });
1346
- }), r;
1347
- }, Ht = (t, e = {}) => ({
1348
- props: N(
1349
- () => Ft(Te(t)?.slotsPropsPropsMap, Te(e) || {})
1346
+ }), n;
1347
+ }, qt = (t, e = {}, r) => ({
1348
+ props: C(
1349
+ () => zt(
1350
+ we(t)?.slotsPropsPropsMap,
1351
+ we(e) || {},
1352
+ we(r)
1353
+ )
1350
1354
  )
1351
- }), Kt = (t, e) => {
1355
+ }), Yt = (t, e) => {
1352
1356
  if (!t)
1353
1357
  return e.componentName;
1354
1358
  const r = t.resolveComponent(e);
1355
- return r ? typeof r == "function" && !("setup" in r) && !("render" in r) ? mt(r) : r : t.resolve(e.componentName)?.componentName || e.componentName;
1356
- }, Ee = (t, e = {}) => {
1357
- const r = he("resolver"), n = N(() => !r || !t?.value ? {} : r.value.resolve(
1359
+ return r ? typeof r == "function" && !("setup" in r) && !("render" in r) ? Et(r) : r : t.resolve(e.componentName)?.componentName || e.componentName;
1360
+ }, Pe = (t, e = {}) => {
1361
+ const r = ge("resolver"), n = C(() => !r || !t?.value ? {} : r.value.resolve(
1358
1362
  t.value.componentName
1359
- )), o = N(() => n.value?.defaultProps || {}), s = N(
1360
- () => Kt(r?.value, t.value)
1361
- ), { props: a } = Ht(t, e), i = N(() => ({
1363
+ )), o = C(() => n.value?.defaultProps || {}), s = C(
1364
+ () => Yt(r?.value, t.value)
1365
+ ), { props: a } = qt(
1366
+ t,
1367
+ e,
1368
+ () => r?.value
1369
+ ), i = C(() => ({
1362
1370
  ...o.value,
1363
1371
  ...t.value?.props,
1364
1372
  ...a.value
@@ -1370,48 +1378,48 @@ const Ft = (t, e) => {
1370
1378
  componentToRender: s,
1371
1379
  props: i
1372
1380
  };
1373
- }, Vt = /* @__PURE__ */ j({
1381
+ }, Qt = /* @__PURE__ */ L({
1374
1382
  name: "CraftCanvas",
1375
1383
  __name: "CraftCanvas",
1376
1384
  props: {
1377
1385
  componentName: {}
1378
1386
  },
1379
1387
  setup(t) {
1380
- const e = Xe(), r = gt(), n = t, o = N(() => ({
1388
+ const e = Qe(), r = Ct(), n = t, o = C(() => ({
1381
1389
  componentName: n.componentName,
1382
1390
  props: {},
1383
1391
  slots: {},
1384
1392
  uuid: ""
1385
- })), { componentToRender: s } = Ee(o);
1386
- return (a, i) => d(s) ? (v(), A(ye(d(s)), Ue(_e({ key: 0 }, d(r))), be({ _: 2 }, [
1387
- T(d(e), (l, u) => ({
1393
+ })), { componentToRender: s } = Pe(o);
1394
+ return (a, i) => p(s) ? (v(), M(Ce(p(s)), Le(Se({ key: 0 }, p(r))), Ne({ _: 2 }, [
1395
+ j(p(e), (l, u) => ({
1388
1396
  name: u,
1389
- fn: q((p) => [
1390
- Q(a.$slots, u, Ue(yt(p || {})))
1397
+ fn: G((d) => [
1398
+ J(a.$slots, u, Le(Nt(d || {})))
1391
1399
  ])
1392
1400
  }))
1393
- ]), 1040)) : D("", !0);
1401
+ ]), 1040)) : R("", !0);
1394
1402
  }
1395
- }), Xt = () => {
1396
- const t = he("craftNode");
1403
+ }), Gt = () => {
1404
+ const t = ge("craftNode");
1397
1405
  if (!t)
1398
1406
  throw new Error("craftNode or resolver not provided");
1399
- const { resolver: e, resolvedNode: r, defaultProps: n } = Ee(t);
1407
+ const { resolver: e, resolvedNode: r, defaultProps: n } = Pe(t);
1400
1408
  return {
1401
1409
  craftNode: t,
1402
1410
  resolver: e,
1403
1411
  resolvedNode: r,
1404
1412
  defaultProps: n
1405
1413
  };
1406
- }, We = (t) => t.visible === void 0 || t.visible, zt = (t) => {
1414
+ }, tt = (t) => t.visible === void 0 || t.visible, Wt = (t) => {
1407
1415
  let e = t;
1408
- const r = V();
1416
+ const r = q();
1409
1417
  for (; e.parentUuid; )
1410
- if (e = r.nodeMap.get(e.parentUuid), Y(e))
1418
+ if (e = r.nodeMap.get(e.parentUuid), W(e))
1411
1419
  return !0;
1412
1420
  return !1;
1413
- }, qt = (t) => zt(t) ? t.rules?.canDrag ? t.rules.canDrag(t) : !0 : !1, Ze = (t, e) => {
1414
- const r = V();
1421
+ }, Zt = (t) => Wt(t) ? t.rules?.canDrag ? t.rules.canDrag(t) : !0 : !1, rt = (t, e) => {
1422
+ const r = q();
1415
1423
  let n = e;
1416
1424
  for (; n?.parentUuid; ) {
1417
1425
  if (n.parentUuid === t.uuid)
@@ -1419,26 +1427,26 @@ const Ft = (t, e) => {
1419
1427
  n = r.nodeMap.get(n.parentUuid);
1420
1428
  }
1421
1429
  return !1;
1422
- }, ae = (t) => t.componentName === "CraftCanvas" ? t.props.componentName : t.componentName, fe = (t, e, r) => {
1423
- if (!Y(e) || t.uuid === e.uuid)
1430
+ }, ue = (t) => t.componentName === "CraftCanvas" ? t.props.componentName : t.componentName, me = (t, e, r) => {
1431
+ if (!W(e) || t.uuid === e.uuid)
1424
1432
  return !1;
1425
- const n = r.resolve(ae(e)), o = r.resolve(ae(t)), s = n?.rules || {}, a = o?.rules || {};
1433
+ const n = r.resolve(ue(e)), o = r.resolve(ue(t)), s = n?.rules || {}, a = o?.rules || {};
1426
1434
  if (t.parentUuid) {
1427
- const l = V().nodeMap.get(t.parentUuid), u = r.resolve(ae(l))?.rules || {};
1435
+ const l = q().nodeMap.get(t.parentUuid), u = r.resolve(ue(l))?.rules || {};
1428
1436
  if (u.canMoveOut && !u.canMoveOut(t, e, r))
1429
1437
  return;
1430
1438
  }
1431
- return !(a.canMoveInto && !a.canMoveInto(t, e, r) || Ze(t, e) || s.canMoveIn && !s.canMoveIn(t, e, r));
1432
- }, Y = (t) => t.componentName === "CraftCanvas", Ce = (t, e, r) => {
1433
- const n = V();
1434
- return e.uuid === t.uuid || !e.parentUuid ? !1 : fe(
1439
+ return !(a.canMoveInto && !a.canMoveInto(t, e, r) || rt(t, e) || s.canMoveIn && !s.canMoveIn(t, e, r));
1440
+ }, W = (t) => t.componentName === "CraftCanvas", _e = (t, e, r) => {
1441
+ const n = q();
1442
+ return e.uuid === t.uuid || !e.parentUuid ? !1 : me(
1435
1443
  t,
1436
1444
  n.nodeMap.get(e.parentUuid),
1437
1445
  r
1438
1446
  );
1439
- }, Je = (t) => (t.uuid || (t.uuid = G()), t.slots && Object.values(t.slots).forEach((e) => {
1440
- e.forEach((r) => (r.uuid || (r.uuid = G()), r.parentUuid !== t.uuid && (r.parentUuid = t.uuid), Je(r), r));
1441
- }), t), et = (t, e) => {
1447
+ }, nt = (t) => (t.uuid || (t.uuid = ee()), t.slots && Object.values(t.slots).forEach((e) => {
1448
+ e.forEach((r) => (r.uuid || (r.uuid = ee()), r.parentUuid !== t.uuid && (r.parentUuid = t.uuid), nt(r), r));
1449
+ }), t), ot = (t, e) => {
1442
1450
  if (!t.slots || Object.keys(t.slots).length === 0) {
1443
1451
  const n = e.resolveNode?.(t)?.slots;
1444
1452
  n && n.length > 0 ? (t.slots = {}, n.forEach((o) => {
@@ -1446,7 +1454,7 @@ const Ft = (t, e) => {
1446
1454
  })) : t.slots = { default: [] };
1447
1455
  }
1448
1456
  return t;
1449
- }, V = Ye("editor", {
1457
+ }, q = Ze("editor", {
1450
1458
  state: () => ({
1451
1459
  nodeMap: /* @__PURE__ */ new Map(),
1452
1460
  rootNodes: [],
@@ -1457,7 +1465,9 @@ const Ft = (t, e) => {
1457
1465
  resolver: null,
1458
1466
  eventsContext: {},
1459
1467
  nodeDataMap: {},
1460
- draggingDisabled: !1
1468
+ draggingDisabled: !1,
1469
+ nodeRuntimeProps: {},
1470
+ pageState: {}
1461
1471
  }),
1462
1472
  actions: {
1463
1473
  clear() {
@@ -1484,7 +1494,7 @@ const Ft = (t, e) => {
1484
1494
  toggleNodeVisibility(t) {
1485
1495
  const e = this.nodeMap.get(t.uuid);
1486
1496
  if (e) {
1487
- if (e.visible = !We(e), e.slots) {
1497
+ if (e.visible = !tt(e), e.slots) {
1488
1498
  const r = (n) => (n.visible = e.visible, n.slots && Object.values(n.slots).forEach((o) => {
1489
1499
  o.forEach((s) => r(s));
1490
1500
  }), this.nodeMap.set(n.uuid, n), n);
@@ -1513,7 +1523,7 @@ const Ft = (t, e) => {
1513
1523
  setNodes(t) {
1514
1524
  this.clear(), this.rootNodes = [];
1515
1525
  const e = (r) => {
1516
- this.resolver && r.componentName === "CraftCanvas" && et(r, this.resolver);
1526
+ this.resolver && r.componentName === "CraftCanvas" && ot(r, this.resolver);
1517
1527
  const n = r.slots ? {} : { default: [] };
1518
1528
  r.slots && Object.keys(r.slots).forEach((o) => {
1519
1529
  n[o] = [];
@@ -1526,8 +1536,8 @@ const Ft = (t, e) => {
1526
1536
  t.forEach(e);
1527
1537
  },
1528
1538
  addNodeRecursively(t, e = null) {
1529
- const r = t.uuid || G(), n = { ...t, uuid: r, parentUuid: e };
1530
- this.nodeMap.set(r, ze(n)), e || this.rootNodes.push(r), t.slots && Object.values(t.slots).forEach((o) => {
1539
+ const r = t.uuid || ee(), n = { ...t, uuid: r, parentUuid: e };
1540
+ this.nodeMap.set(r, Ge(n)), e || this.rootNodes.push(r), t.slots && Object.values(t.slots).forEach((o) => {
1531
1541
  o.forEach((s) => this.addNodeRecursively(s, r));
1532
1542
  });
1533
1543
  },
@@ -1567,11 +1577,11 @@ const Ft = (t, e) => {
1567
1577
  },
1568
1578
  appendNodeTo(t, e, r = "default") {
1569
1579
  if (!this.resolver) throw new Error("Resolver is not set.");
1570
- if (!fe(t, e, this.resolver))
1580
+ if (!me(t, e, this.resolver))
1571
1581
  throw new Error(
1572
- `${ae(
1582
+ `${ue(
1573
1583
  t
1574
- )} is not allowed to be a child of ${ae(e)}.`
1584
+ )} is not allowed to be a child of ${ue(e)}.`
1575
1585
  );
1576
1586
  t = this.emancipateNode(t), t.parentUuid = e.uuid;
1577
1587
  const n = this.nodeMap.get(e.uuid);
@@ -1579,11 +1589,11 @@ const Ft = (t, e) => {
1579
1589
  },
1580
1590
  prependNodeTo(t, e, r = "default") {
1581
1591
  if (!this.resolver) throw new Error("Resolver is not set");
1582
- if (!fe(t, e, this.resolver))
1592
+ if (!me(t, e, this.resolver))
1583
1593
  throw new Error(
1584
- `${ae(
1594
+ `${ue(
1585
1595
  t
1586
- )} is not allowed to be a child of ${ae(e)}.`
1596
+ )} is not allowed to be a child of ${ue(e)}.`
1587
1597
  );
1588
1598
  t = this.emancipateNode(t), t.parentUuid = e.uuid;
1589
1599
  const n = this.nodeMap.get(e.uuid);
@@ -1591,7 +1601,7 @@ const Ft = (t, e) => {
1591
1601
  },
1592
1602
  insertNodeBefore(t, e, r) {
1593
1603
  if (!this.resolver) throw new Error("Resolver is not set");
1594
- if (!Ce(t, e, this.resolver))
1604
+ if (!_e(t, e, this.resolver))
1595
1605
  throw new Error("Can not be the sibling of the target node.");
1596
1606
  t = this.emancipateNode(t);
1597
1607
  const n = e.parentUuid;
@@ -1611,7 +1621,7 @@ const Ft = (t, e) => {
1611
1621
  },
1612
1622
  insertNodeAfter(t, e, r) {
1613
1623
  if (!this.resolver) throw new Error("Resolver is not set");
1614
- if (!Ce(t, e, this.resolver))
1624
+ if (!_e(t, e, this.resolver))
1615
1625
  throw new Error("Can not be the sibling of the target node.");
1616
1626
  t = this.emancipateNode(t);
1617
1627
  const n = e.parentUuid;
@@ -1631,6 +1641,9 @@ const Ft = (t, e) => {
1631
1641
  },
1632
1642
  setEventsContext(t) {
1633
1643
  this.eventsContext = t;
1644
+ },
1645
+ setNodeRuntimeProps(t, e) {
1646
+ this.nodeRuntimeProps[t] = { ...this.nodeRuntimeProps[t] || {}, ...e };
1634
1647
  }
1635
1648
  },
1636
1649
  getters: {
@@ -1658,7 +1671,7 @@ const Ft = (t, e) => {
1658
1671
  return t.rootNodes.map((r) => e(r));
1659
1672
  }
1660
1673
  }
1661
- }), Yt = ["value", "onKeyup"], Qt = /* @__PURE__ */ j({
1674
+ }), Jt = ["value", "onKeyup"], er = /* @__PURE__ */ L({
1662
1675
  __name: "CraftComponentSimpleText",
1663
1676
  props: {
1664
1677
  content: { default: "Lorem ipsum dolor sit amet..." },
@@ -1669,36 +1682,36 @@ const Ft = (t, e) => {
1669
1682
  setup(t, { emit: e }) {
1670
1683
  const r = t, n = e, s = (() => {
1671
1684
  try {
1672
- return V();
1685
+ return q();
1673
1686
  } catch {
1674
1687
  return null;
1675
1688
  }
1676
- })(), a = s ? te(s).enabled : H(!1), i = H(!1), l = H(null), u = H(""), { craftNode: p } = Xt(), m = N(() => !!s && a.value), f = N(() => m.value && !i.value), h = () => {
1677
- f.value && y();
1678
- }, y = () => {
1679
- u.value = r.content, i.value = !0, s?.disableDragging(), pe(() => {
1680
- l.value && (l.value.focus(), x());
1689
+ })(), a = s ? se(s).enabled : K(!1), i = K(!1), l = K(null), u = K(""), { craftNode: d } = Gt(), m = C(() => !!s && a.value), f = C(() => m.value && !i.value), h = () => {
1690
+ f.value && b();
1691
+ }, b = () => {
1692
+ u.value = r.content, i.value = !0, s?.disableDragging(), ve(() => {
1693
+ l.value && (l.value.focus(), P());
1681
1694
  });
1682
- }, x = () => {
1695
+ }, P = () => {
1683
1696
  l.value && (l.value.style.height = "auto", l.value.style.height = `${l.value.scrollHeight}px`);
1684
- }, P = async () => {
1697
+ }, A = async () => {
1685
1698
  if (s?.enableDragging(), !i.value) return;
1686
1699
  i.value = !1;
1687
- const E = l.value?.value.trim() ?? "";
1688
- E !== r.content && p.value?.uuid && (s?.nodeMap.set(p.value.uuid, {
1689
- ...p.value,
1700
+ const U = l.value?.value.trim() ?? "";
1701
+ U !== r.content && d.value?.uuid && (s?.nodeMap.set(d.value.uuid, {
1702
+ ...d.value,
1690
1703
  props: {
1691
- ...p.value.props,
1692
- content: E
1704
+ ...d.value.props,
1705
+ content: U
1693
1706
  }
1694
- }), await pe(), n("update:content", E));
1695
- }, g = () => {
1707
+ }), await ve(), n("update:content", U));
1708
+ }, T = () => {
1696
1709
  i.value = !1, n("update:content", u.value);
1697
1710
  };
1698
- return s && J(a, (E) => {
1699
- !E && i.value && g();
1700
- }), (E, b) => (v(), A(ye(t.componentName), {
1701
- class: ve({
1711
+ return s && ne(a, (U) => {
1712
+ !U && i.value && T();
1713
+ }), (U, _) => (v(), M(Ce(t.componentName), {
1714
+ class: ye({
1702
1715
  "pre-wrap": !i.value,
1703
1716
  "editable-text": m.value,
1704
1717
  "is-editable": m.value,
@@ -1706,31 +1719,32 @@ const Ft = (t, e) => {
1706
1719
  }),
1707
1720
  onDblclick: h
1708
1721
  }, {
1709
- default: q(() => [
1710
- oe(ee(i.value ? "" : t.content) + " ", 1),
1711
- i.value ? (v(), _("textarea", {
1722
+ default: G(() => [
1723
+ ie(oe(i.value ? "" : t.content) + " ", 1),
1724
+ i.value ? (v(), E("textarea", {
1712
1725
  key: 0,
1713
1726
  ref_key: "textareaRef",
1714
1727
  ref: l,
1715
1728
  class: "editable-text__textarea",
1716
1729
  value: t.content,
1717
- onInput: x,
1718
- onBlur: P,
1730
+ onInput: P,
1731
+ onBlur: A,
1719
1732
  onKeyup: [
1720
- je(F(P, ["exact"]), ["enter"]),
1721
- je(g, ["esc"])
1733
+ Fe(V(A, ["exact"]), ["enter"]),
1734
+ Fe(T, ["esc"])
1722
1735
  ]
1723
- }, null, 40, Yt)) : D("", !0)
1736
+ }, null, 40, Jt)) : R("", !0)
1724
1737
  ]),
1725
1738
  _: 1
1726
1739
  }, 40, ["class"]));
1727
1740
  }
1728
1741
  });
1729
- class xe {
1742
+ class Oe {
1730
1743
  resolverMap = {};
1731
1744
  resolveComponentHook;
1745
+ resolvePropertyValueHook;
1732
1746
  constructor(e = {}) {
1733
- return this.setResolverMap(e), ze(this);
1747
+ return this.setResolverMap(e), Ge(this);
1734
1748
  }
1735
1749
  setResolverMap(e) {
1736
1750
  this.resolverMap = {}, Object.entries(e).forEach(([r, n]) => {
@@ -1740,11 +1754,21 @@ class xe {
1740
1754
  onResolveComponent(e) {
1741
1755
  this.resolveComponentHook = e;
1742
1756
  }
1757
+ onResolvePropertyValue(e) {
1758
+ this.resolvePropertyValueHook = e;
1759
+ }
1760
+ resolvePropertyValue(e, r) {
1761
+ const n = (o) => {
1762
+ const s = k({ path: o, json: r, resultType: "value" });
1763
+ return s.length ? s[0] : void 0;
1764
+ };
1765
+ return this.resolvePropertyValueHook ? this.resolvePropertyValueHook(e, r, n) : typeof e == "string" ? n(e) : void 0;
1766
+ }
1743
1767
  resolve(e) {
1744
1768
  return this.resolverMap[e];
1745
1769
  }
1746
1770
  resolveComponent(e) {
1747
- const r = Y(e) ? e.props.componentName : e.componentName, n = (o) => {
1771
+ const r = W(e) ? e.props.componentName : e.componentName, n = (o) => {
1748
1772
  const s = this.resolve(o);
1749
1773
  if (s?.component)
1750
1774
  return typeof s.component == "function" && !("setup" in s.component) && !("render" in s.component), s.component;
@@ -1760,7 +1784,7 @@ class xe {
1760
1784
  return this.resolveNode(e)?.defaultProps || {};
1761
1785
  }
1762
1786
  resolveNode(e) {
1763
- return Y(e) ? this.resolve(e.props.componentName) : this.resolve(e.componentName);
1787
+ return W(e) ? this.resolve(e.props.componentName) : this.resolve(e.componentName);
1764
1788
  }
1765
1789
  getSchema(e) {
1766
1790
  return this.resolveNode(e)?.propsSchema || {};
@@ -1775,7 +1799,7 @@ class xe {
1775
1799
  return this.resolveNode(e)?.slotsProps || {};
1776
1800
  }
1777
1801
  }
1778
- const Re = Ye("indicator", {
1802
+ const je = Ze("indicator", {
1779
1803
  state: () => ({
1780
1804
  barSize: 2,
1781
1805
  visible: !1,
@@ -1811,12 +1835,12 @@ const Re = Ye("indicator", {
1811
1835
  },
1812
1836
  pointInside(t) {
1813
1837
  this.show();
1814
- const e = Le(t), { top: r, left: n, width: o, height: s } = t.getBoundingClientRect(), a = Number.parseInt(e.paddingLeft), i = Number.parseInt(e.paddingTop), l = Number.parseInt(e.paddingRight);
1838
+ const e = Ke(t), { top: r, left: n, width: o, height: s } = t.getBoundingClientRect(), a = Number.parseInt(e.paddingLeft), i = Number.parseInt(e.paddingTop), l = Number.parseInt(e.paddingRight);
1815
1839
  this.coordinates.top = r + s - i, this.coordinates.left = n + a, this.dimensions.width = o - a - l, this.dimensions.height = this.barSize;
1816
1840
  },
1817
1841
  pointInsideTop(t) {
1818
1842
  this.show();
1819
- const e = Le(t), { top: r, left: n, width: o } = t.getBoundingClientRect(), s = Number.parseInt(e.paddingLeft), a = Number.parseInt(e.paddingTop), i = Number.parseInt(e.paddingRight);
1843
+ const e = Ke(t), { top: r, left: n, width: o } = t.getBoundingClientRect(), s = Number.parseInt(e.paddingLeft), a = Number.parseInt(e.paddingTop), i = Number.parseInt(e.paddingRight);
1820
1844
  this.coordinates.top = r + a, this.coordinates.left = n + s, this.dimensions.width = o - s - i, this.dimensions.height = this.barSize;
1821
1845
  }
1822
1846
  },
@@ -1827,7 +1851,7 @@ const Re = Ye("indicator", {
1827
1851
  size: (t) => t.dimensions
1828
1852
  }
1829
1853
  });
1830
- function Le(t) {
1854
+ function Ke(t) {
1831
1855
  if (!(t instanceof HTMLElement))
1832
1856
  return {
1833
1857
  paddingTop: "0",
@@ -1845,7 +1869,7 @@ function Le(t) {
1845
1869
  s[a] = parseInt(s[a].slice(0, -2), 10);
1846
1870
  }), s;
1847
1871
  }
1848
- const Gt = /* @__PURE__ */ j({
1872
+ const tr = /* @__PURE__ */ L({
1849
1873
  __name: "CraftEditor",
1850
1874
  props: {
1851
1875
  config: {},
@@ -1853,26 +1877,26 @@ const Gt = /* @__PURE__ */ j({
1853
1877
  },
1854
1878
  emits: ["nodeDragStart", "nodeDragEnd", "iframeLoad"],
1855
1879
  setup(t, { emit: e }) {
1856
- const r = t, n = e, o = V(), s = Re(), { getDraggedNode: a } = te(o);
1857
- J(a, (l) => {
1880
+ const r = t, n = e, o = q(), s = je(), { getDraggedNode: a } = se(o);
1881
+ ne(a, (l) => {
1858
1882
  if (l) {
1859
1883
  n("nodeDragStart", l);
1860
1884
  return;
1861
1885
  }
1862
1886
  n("nodeDragEnd"), s.hide();
1863
1887
  });
1864
- const i = H(
1865
- r.config.resolver || new xe(r.config.resolverMap)
1888
+ const i = K(
1889
+ r.config.resolver || new Oe(r.config.resolverMap)
1866
1890
  );
1867
- return W("resolver", i), (l, u) => {
1868
- const p = B("CraftFrame"), m = B("CraftEditorPanelLayout");
1869
- return v(), A(m, {
1891
+ return te("resolver", i), (l, u) => {
1892
+ const d = H("CraftFrame"), m = H("CraftEditorPanelLayout");
1893
+ return v(), M(m, {
1870
1894
  blueprints: t.config.blueprintsLibrary
1871
- }, be({ _: 2 }, [
1895
+ }, Ne({ _: 2 }, [
1872
1896
  l.$slots["panel-layout"] ? {
1873
1897
  name: "panel-layout",
1874
- fn: q(({ blueprints: f, deselectNodes: h }) => [
1875
- Q(l.$slots, "panel-layout", {
1898
+ fn: G(({ blueprints: f, deselectNodes: h }) => [
1899
+ J(l.$slots, "panel-layout", {
1876
1900
  blueprints: f,
1877
1901
  deselectNodes: h
1878
1902
  })
@@ -1880,14 +1904,14 @@ const Gt = /* @__PURE__ */ j({
1880
1904
  key: "0"
1881
1905
  } : {
1882
1906
  name: "default",
1883
- fn: q(() => [
1884
- z(p, {
1907
+ fn: G(() => [
1908
+ Q(d, {
1885
1909
  iframe: t.iframe,
1886
1910
  resolverMap: t.config.resolverMap,
1887
1911
  onIframeLoad: u[0] || (u[0] = (f) => n("iframeLoad", f))
1888
1912
  }, {
1889
- default: q(() => [
1890
- Q(l.$slots, "default")
1913
+ default: G(() => [
1914
+ J(l.$slots, "default")
1891
1915
  ]),
1892
1916
  _: 3
1893
1917
  }, 8, ["iframe", "resolverMap"])
@@ -1897,69 +1921,69 @@ const Gt = /* @__PURE__ */ j({
1897
1921
  ]), 1032, ["blueprints"]);
1898
1922
  };
1899
1923
  }
1900
- }), Wt = /* @__PURE__ */ j({
1924
+ }), rr = /* @__PURE__ */ L({
1901
1925
  name: "CraftEditorBlueprint",
1902
1926
  __name: "CraftEditorBlueprint",
1903
1927
  props: {
1904
1928
  craftNode: {}
1905
1929
  },
1906
1930
  setup(t) {
1907
- const e = V(), r = t, n = (s) => {
1931
+ const e = q(), r = t, n = (s) => {
1908
1932
  console.log("CraftEditorBlueprint - dragging node:", r.craftNode), console.log("CraftEditorBlueprint - node.componentName:", r.craftNode.componentName), console.log("CraftEditorBlueprint - node.props:", r.craftNode.props), e.dragNode(r.craftNode);
1909
1933
  }, o = (s) => {
1910
1934
  s.stopPropagation(), e.dragNode(null);
1911
1935
  };
1912
- return (s, a) => (v(), _("div", {
1936
+ return (s, a) => (v(), E("div", {
1913
1937
  draggable: !0,
1914
- onDragstart: F(n, ["stop"]),
1938
+ onDragstart: V(n, ["stop"]),
1915
1939
  onDragend: o
1916
1940
  }, [
1917
- Q(s.$slots, "default")
1941
+ J(s.$slots, "default")
1918
1942
  ], 32));
1919
1943
  }
1920
- }), tt = (t, e) => Object.keys(t.blueprints).map((r) => {
1944
+ }), st = (t, e) => Object.keys(t.blueprints).map((r) => {
1921
1945
  const n = t.blueprints[r], o = e.getDefaultProps({
1922
1946
  ...n,
1923
- uuid: G()
1947
+ uuid: ee()
1924
1948
  });
1925
1949
  return {
1926
1950
  ...n,
1927
1951
  props: { ...o, ...n.props }
1928
1952
  };
1929
- }), rt = (t) => {
1953
+ }), at = (t) => {
1930
1954
  let e = 0;
1931
1955
  for (let s = 0; s < t.length; s++)
1932
1956
  e = t.charCodeAt(s) + ((e << 5) - e);
1933
1957
  const r = e % 360, n = 70 + e % 30, o = 45 + e % 30;
1934
1958
  return `hsla(${r}, ${n}%, ${o}%, 0.9)`;
1935
- }, Zt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1959
+ }, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1936
1960
  __proto__: null,
1937
- blueprintsWithDefaults: tt,
1938
- generateColorFromUUID: rt
1939
- }, Symbol.toStringTag, { value: "Module" })), Jt = { key: 0 }, er = { class: "flex flex-wrap gap-2 p-1" }, tr = { class: "v-craft-blueprint" }, rr = { class: "v-craft-blueprint-label" }, nr = /* @__PURE__ */ j({
1961
+ blueprintsWithDefaults: st,
1962
+ generateColorFromUUID: at
1963
+ }, Symbol.toStringTag, { value: "Module" })), or = { key: 0 }, sr = { class: "flex flex-wrap gap-2 p-1" }, ar = { class: "v-craft-blueprint" }, ir = { class: "v-craft-blueprint-label" }, lr = /* @__PURE__ */ L({
1940
1964
  __name: "CraftEditorBlueprintsList",
1941
1965
  props: {
1942
1966
  blueprints: {}
1943
1967
  },
1944
1968
  setup(t) {
1945
- const e = he("resolver");
1969
+ const e = ge("resolver");
1946
1970
  return (r, n) => {
1947
- const o = B("CraftEditorBlueprint");
1948
- return d(e) ? (v(), _("div", Jt, [
1949
- (v(!0), _(U, null, T(t.blueprints.groups, (s) => (v(), _("div", null, [
1950
- Q(r.$slots, "blueprint-group", {
1971
+ const o = H("CraftEditorBlueprint");
1972
+ return p(e) ? (v(), E("div", or, [
1973
+ (v(!0), E(B, null, j(t.blueprints.groups, (s) => (v(), E("div", null, [
1974
+ J(r.$slots, "blueprint-group", {
1951
1975
  group: s,
1952
- resolver: d(e)
1976
+ resolver: p(e)
1953
1977
  }, () => [
1954
- w("h4", null, ee(s.label), 1),
1955
- w("div", er, [
1956
- (v(!0), _(U, null, T(d(tt)(s, d(e)), (a, i) => (v(), A(o, {
1978
+ O("h4", null, oe(s.label), 1),
1979
+ O("div", sr, [
1980
+ (v(!0), E(B, null, j(p(st)(s, p(e)), (a, i) => (v(), M(o, {
1957
1981
  craftNode: a,
1958
1982
  key: i
1959
1983
  }, {
1960
- default: q(() => [
1961
- w("div", tr, [
1962
- w("div", rr, ee(a.label), 1)
1984
+ default: G(() => [
1985
+ O("div", ar, [
1986
+ O("div", ir, oe(a.label), 1)
1963
1987
  ])
1964
1988
  ]),
1965
1989
  _: 2
@@ -1967,10 +1991,10 @@ const Gt = /* @__PURE__ */ j({
1967
1991
  ])
1968
1992
  ])
1969
1993
  ]))), 256))
1970
- ])) : D("", !0);
1994
+ ])) : R("", !0);
1971
1995
  };
1972
1996
  }
1973
- }), or = { class: "v-craft-panel v-craft-blueprints-panel" }, sr = { class: "v-craft-panel-content" }, ar = /* @__PURE__ */ j({
1997
+ }), ur = { class: "v-craft-panel v-craft-blueprints-panel" }, cr = { class: "v-craft-panel-content" }, dr = /* @__PURE__ */ L({
1974
1998
  name: "CraftEditorPanelBlueprints",
1975
1999
  __name: "CraftEditorPanelBlueprints",
1976
2000
  props: {
@@ -1979,21 +2003,21 @@ const Gt = /* @__PURE__ */ j({
1979
2003
  emits: ["close"],
1980
2004
  setup(t) {
1981
2005
  return (e, r) => {
1982
- const n = B("CraftEditorBlueprintsList");
1983
- return v(), _("div", or, [
1984
- r[0] || (r[0] = w("h3", { class: "v-craft-title" }, "blueprints", -1)),
1985
- w("div", sr, [
1986
- z(n, { blueprints: t.blueprints }, null, 8, ["blueprints"])
2006
+ const n = H("CraftEditorBlueprintsList");
2007
+ return v(), E("div", ur, [
2008
+ r[0] || (r[0] = O("h3", { class: "v-craft-title" }, "blueprints", -1)),
2009
+ O("div", cr, [
2010
+ Q(n, { blueprints: t.blueprints }, null, 8, ["blueprints"])
1987
2011
  ])
1988
2012
  ]);
1989
2013
  };
1990
2014
  }
1991
- }), ge = (t, e) => {
2015
+ }), Ee = (t, e) => {
1992
2016
  const r = t.__vccOpts || t;
1993
2017
  for (const [n, o] of e)
1994
2018
  r[n] = o;
1995
2019
  return r;
1996
- }, ir = /* @__PURE__ */ ge(ar, [["__scopeId", "data-v-a6de4dca"]]), lr = /* @__PURE__ */ j({
2020
+ }, pr = /* @__PURE__ */ Ee(dr, [["__scopeId", "data-v-a6de4dca"]]), fr = /* @__PURE__ */ L({
1997
2021
  __name: "CraftEditorPanelForm",
1998
2022
  props: {
1999
2023
  craftNode: {},
@@ -2002,34 +2026,34 @@ const Gt = /* @__PURE__ */ j({
2002
2026
  },
2003
2027
  emits: ["update"],
2004
2028
  setup(t, { emit: e }) {
2005
- const r = t, n = e, o = de(r, "model"), s = de(r, "schema"), a = de(r, "craftNode"), i = N(
2029
+ const r = t, n = e, o = he(r, "model"), s = he(r, "schema"), a = he(r, "craftNode"), i = C(
2006
2030
  () => o.value ? { ...o.value } : {}
2007
- ), l = Qe((p) => {
2008
- n("update", p);
2009
- }, 50), u = (p) => {
2010
- p != null && l(p);
2031
+ ), l = Je((d) => {
2032
+ n("update", d);
2033
+ }, 50), u = (d) => {
2034
+ d != null && l(d);
2011
2035
  };
2012
- return bt(() => l.cancel()), (p, m) => Q(p.$slots, "panel-content", {
2036
+ return Pt(() => l.cancel()), (d, m) => J(d.$slots, "panel-content", {
2013
2037
  craftNode: a.value,
2014
2038
  model: i.value,
2015
2039
  handleFormInput: u,
2016
2040
  schema: s.value
2017
2041
  });
2018
2042
  }
2019
- }), ur = { class: "v-craft-panel v-craft-layers-panel" }, cr = { class: "v-craft-layers" }, dr = { class: "v-craft-node-layers" }, pr = /* @__PURE__ */ j({
2043
+ }), hr = { class: "v-craft-panel v-craft-layers-panel" }, vr = { class: "v-craft-layers" }, mr = { class: "v-craft-node-layers" }, gr = /* @__PURE__ */ L({
2020
2044
  name: "CraftEditorPanelLayers",
2021
2045
  __name: "CraftEditorPanelLayers",
2022
2046
  setup(t) {
2023
- const e = V(), { nodeTree: r } = te(e), n = (o) => {
2047
+ const e = q(), { nodeTree: r } = se(e), n = (o) => {
2024
2048
  e.selectNode(o);
2025
2049
  };
2026
2050
  return (o, s) => {
2027
- const a = B("CraftEditorPanelNodeLayer");
2028
- return v(), _("div", ur, [
2029
- s[0] || (s[0] = w("h3", { class: "v-craft-title" }, "tree", -1)),
2030
- w("div", cr, [
2031
- w("ul", dr, [
2032
- (v(!0), _(U, null, T(d(r), (i, l) => (v(), A(a, {
2051
+ const a = H("CraftEditorPanelNodeLayer");
2052
+ return v(), E("div", hr, [
2053
+ s[0] || (s[0] = O("h3", { class: "v-craft-title" }, "tree", -1)),
2054
+ O("div", vr, [
2055
+ O("ul", mr, [
2056
+ (v(!0), E(B, null, j(p(r), (i, l) => (v(), M(a, {
2033
2057
  key: l,
2034
2058
  craftNode: i,
2035
2059
  onLayerClick: n
@@ -2039,51 +2063,51 @@ const Gt = /* @__PURE__ */ j({
2039
2063
  ]);
2040
2064
  };
2041
2065
  }
2042
- }), fr = /* @__PURE__ */ ge(pr, [["__scopeId", "data-v-ab795ec3"]]), hr = { key: 0 }, vr = {
2066
+ }), yr = /* @__PURE__ */ Ee(gr, [["__scopeId", "data-v-ab795ec3"]]), br = { key: 0 }, Er = {
2043
2067
  key: 1,
2044
2068
  class: "v-craft-panel-manager"
2045
- }, mr = { class: "flex w-full justify-between gap-10" }, gr = { class: "v-craft-grid-panel v-craft-panel-left shrink" }, yr = { class: "v-craft-grid-panel v-craft-panel-right shrink max-w-[20vw]" }, br = /* @__PURE__ */ j({
2069
+ }, Cr = { class: "flex w-full justify-between gap-10" }, Nr = { class: "v-craft-grid-panel v-craft-panel-left shrink" }, Pr = { class: "v-craft-grid-panel v-craft-panel-right shrink max-w-[20vw]" }, _r = /* @__PURE__ */ L({
2046
2070
  __name: "CraftEditorPanelLayout",
2047
2071
  props: {
2048
2072
  blueprints: {}
2049
2073
  },
2050
2074
  setup(t) {
2051
- const e = V(), r = () => {
2075
+ const e = q(), r = () => {
2052
2076
  e.selectNode(null);
2053
2077
  };
2054
2078
  return (n, o) => {
2055
- const s = B("CraftEditorPanelBlueprints"), a = B("CraftEditorPanelLayers"), i = B("CraftEditorPanelSettings");
2056
- return n.$slots["panel-layout"] ? (v(), _("div", hr, [
2057
- Q(n.$slots, "panel-layout", {
2079
+ const s = H("CraftEditorPanelBlueprints"), a = H("CraftEditorPanelLayers"), i = H("CraftEditorPanelSettings");
2080
+ return n.$slots["panel-layout"] ? (v(), E("div", br, [
2081
+ J(n.$slots, "panel-layout", {
2058
2082
  blueprints: t.blueprints,
2059
2083
  deselectNodes: r
2060
2084
  }, void 0, !0)
2061
- ])) : (v(), _("div", vr, [
2062
- w("div", mr, [
2063
- w("div", gr, [
2064
- z(s, { blueprints: t.blueprints }, null, 8, ["blueprints"])
2085
+ ])) : (v(), E("div", Er, [
2086
+ O("div", Cr, [
2087
+ O("div", Nr, [
2088
+ Q(s, { blueprints: t.blueprints }, null, 8, ["blueprints"])
2065
2089
  ]),
2066
- w("div", {
2090
+ O("div", {
2067
2091
  class: "v-craft-panel-center flex grow",
2068
- onClick: F(r, ["stop"])
2092
+ onClick: V(r, ["stop"])
2069
2093
  }, [
2070
- Q(n.$slots, "default", {}, void 0, !0)
2094
+ J(n.$slots, "default", {}, void 0, !0)
2071
2095
  ]),
2072
- w("div", yr, [
2073
- z(a),
2074
- z(i)
2096
+ O("div", Pr, [
2097
+ Q(a),
2098
+ Q(i)
2075
2099
  ])
2076
2100
  ])
2077
2101
  ]));
2078
2102
  };
2079
2103
  }
2080
- }), Er = /* @__PURE__ */ ge(br, [["__scopeId", "data-v-7dd1d43b"]]), Cr = {
2104
+ }), Sr = /* @__PURE__ */ Ee(_r, [["__scopeId", "data-v-7dd1d43b"]]), xr = {
2081
2105
  key: 0,
2082
2106
  class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
2083
- }, _r = {
2107
+ }, Or = {
2084
2108
  key: 0,
2085
2109
  class: "formkit-help v-craft-data-source-error"
2086
- }, Nr = /* @__PURE__ */ j({
2110
+ }, wr = /* @__PURE__ */ L({
2087
2111
  __name: "CraftEditorPanelNodeDataSourceSettings",
2088
2112
  props: {
2089
2113
  craftNode: {},
@@ -2091,8 +2115,8 @@ const Gt = /* @__PURE__ */ j({
2091
2115
  },
2092
2116
  emits: ["update:nodeData"],
2093
2117
  setup(t, { emit: e }) {
2094
- const r = t, n = e, o = de(r, "craftNode"), s = H("single"), a = H(""), i = H("");
2095
- J(() => o.value?.uuid, () => {
2118
+ const r = t, n = e, o = he(r, "craftNode"), s = K("single"), a = K(""), i = K("");
2119
+ ne(() => o.value?.uuid, () => {
2096
2120
  const f = r.nodeData;
2097
2121
  s.value = f?.type === "list" ? "list" : "single", a.value = f ? JSON.stringify(
2098
2122
  f.type === "list" ? f.list || [] : f.item || {},
@@ -2114,25 +2138,25 @@ const Gt = /* @__PURE__ */ j({
2114
2138
  } catch {
2115
2139
  i.value = "Invalid JSON - not applied until fixed.";
2116
2140
  }
2117
- }, p = (f) => {
2141
+ }, d = (f) => {
2118
2142
  s.value = f === "list" ? "list" : "single", u();
2119
2143
  }, m = (f) => {
2120
2144
  a.value = f, u();
2121
2145
  };
2122
- return (f, h) => o.value ? (v(), _("fieldset", Cr, [
2123
- h[2] || (h[2] = w("legend", { class: "formkit-legend" }, "Data Source", -1)),
2124
- h[3] || (h[3] = w("p", { class: "formkit-help" }, [
2125
- oe(" Paste JSON here to experiment with mapping data fields into this subtree's props. Descendants read it via "),
2126
- w("code", null, "slotsPropsPropsMap"),
2127
- oe(" using the reserved "),
2128
- w("code", null, "data"),
2129
- oe(" context bucket (e.g. "),
2130
- w("code", null, '{ data: { title: "$.name" } }'),
2131
- oe("). This panel is a convenience for experimentation - production apps normally feed real data in via "),
2132
- w("code", null, "editor.setNodeData()"),
2133
- oe(" directly. ")
2146
+ return (f, h) => o.value ? (v(), E("fieldset", xr, [
2147
+ h[2] || (h[2] = O("legend", { class: "formkit-legend" }, "Data Source", -1)),
2148
+ h[3] || (h[3] = O("p", { class: "formkit-help" }, [
2149
+ ie(" Paste JSON here to experiment with mapping data fields into this subtree's props. Descendants read it via "),
2150
+ O("code", null, "slotsPropsPropsMap"),
2151
+ ie(" using the reserved "),
2152
+ O("code", null, "data"),
2153
+ ie(" context bucket (e.g. "),
2154
+ O("code", null, '{ data: { title: "$.name" } }'),
2155
+ ie("). This panel is a convenience for experimentation - production apps normally feed real data in via "),
2156
+ O("code", null, "editor.setNodeData()"),
2157
+ ie(" directly. ")
2134
2158
  ], -1)),
2135
- z(d(se), {
2159
+ Q(p(le), {
2136
2160
  type: "select",
2137
2161
  label: "Type",
2138
2162
  options: [
@@ -2140,22 +2164,22 @@ const Gt = /* @__PURE__ */ j({
2140
2164
  { value: "list", label: "List" }
2141
2165
  ],
2142
2166
  value: s.value,
2143
- onInput: h[0] || (h[0] = (y) => p(String(y ?? "single")))
2167
+ onInput: h[0] || (h[0] = (b) => d(String(b ?? "single")))
2144
2168
  }, null, 8, ["value"]),
2145
- z(d(se), {
2169
+ Q(p(le), {
2146
2170
  type: "textarea",
2147
2171
  label: "JSON",
2148
2172
  placeholder: s.value === "list" ? '[{ "title": "Alice" }, { "title": "Bob" }]' : '{ "title": "Alice" }',
2149
2173
  value: a.value,
2150
- onInput: h[1] || (h[1] = (y) => m(String(y ?? "")))
2174
+ onInput: h[1] || (h[1] = (b) => m(String(b ?? "")))
2151
2175
  }, null, 8, ["placeholder", "value"]),
2152
- i.value ? (v(), _("p", _r, ee(i.value), 1)) : D("", !0)
2153
- ])) : D("", !0);
2176
+ i.value ? (v(), E("p", Or, oe(i.value), 1)) : R("", !0)
2177
+ ])) : R("", !0);
2154
2178
  }
2155
- }), xr = /* @__PURE__ */ ge(Nr, [["__scopeId", "data-v-7c1c5696"]]), Or = {
2179
+ }), kr = /* @__PURE__ */ Ee(wr, [["__scopeId", "data-v-7c1c5696"]]), Dr = {
2156
2180
  key: 0,
2157
2181
  class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
2158
- }, wr = /* @__PURE__ */ j({
2182
+ }, Ar = /* @__PURE__ */ L({
2159
2183
  __name: "CraftEditorPanelNodeEventsSettings",
2160
2184
  props: {
2161
2185
  craftNode: {},
@@ -2163,40 +2187,40 @@ const Gt = /* @__PURE__ */ j({
2163
2187
  },
2164
2188
  emits: ["update:events"],
2165
2189
  setup(t, { emit: e }) {
2166
- const r = t, { craftNode: n, schema: o } = me(r), s = e;
2190
+ const r = t, { craftNode: n, schema: o } = be(r), s = e;
2167
2191
  return (a, i) => {
2168
- const l = B("CraftEditorPanelForm");
2169
- return v(), A(l, {
2170
- craftNode: d(n),
2171
- schema: d(o),
2172
- model: d(n)?.events,
2192
+ const l = H("CraftEditorPanelForm");
2193
+ return v(), M(l, {
2194
+ craftNode: p(n),
2195
+ schema: p(o),
2196
+ model: p(n)?.events,
2173
2197
  onUpdate: i[0] || (i[0] = (u) => s("update:events", u))
2174
2198
  }, {
2175
- "panel-content": q(({ craftNode: u, model: p, handleFormInput: m, schema: f }) => [
2176
- f ? (v(), _("fieldset", Or, [
2177
- i[1] || (i[1] = w("legend", { class: "formkit-legend" }, "Events", -1)),
2178
- (v(), A(d(se), {
2199
+ "panel-content": G(({ craftNode: u, model: d, handleFormInput: m, schema: f }) => [
2200
+ f ? (v(), E("fieldset", Dr, [
2201
+ i[1] || (i[1] = O("legend", { class: "formkit-legend" }, "Events", -1)),
2202
+ (v(), M(p(le), {
2179
2203
  key: u?.uuid,
2180
2204
  type: "form",
2181
- value: p,
2205
+ value: d,
2182
2206
  onInput: m,
2183
2207
  actions: !1
2184
2208
  }, {
2185
- default: q(() => [
2186
- z(d(Ge), { schema: f }, null, 8, ["schema"])
2209
+ default: G(() => [
2210
+ Q(p(et), { schema: f }, null, 8, ["schema"])
2187
2211
  ]),
2188
2212
  _: 2
2189
2213
  }, 1032, ["value", "onInput"]))
2190
- ])) : D("", !0)
2214
+ ])) : R("", !0)
2191
2215
  ]),
2192
2216
  _: 1
2193
2217
  }, 8, ["craftNode", "schema", "model"]);
2194
2218
  };
2195
2219
  }
2196
- }), Sr = { class: "v-craft-component-layer-face" }, Pr = { class: "v-craft-component-name" }, kr = {
2220
+ }), Rr = { class: "v-craft-component-layer-face" }, Mr = { class: "v-craft-component-name" }, $r = {
2197
2221
  key: 0,
2198
2222
  class: "v-craft-node-layers nested-layers"
2199
- }, Dr = /* @__PURE__ */ j({
2223
+ }, Ir = /* @__PURE__ */ L({
2200
2224
  __name: "CraftEditorPanelNodeLayer",
2201
2225
  props: {
2202
2226
  craftNode: {},
@@ -2204,46 +2228,46 @@ const Gt = /* @__PURE__ */ j({
2204
2228
  },
2205
2229
  emits: ["layer-click"],
2206
2230
  setup(t, { emit: e }) {
2207
- const r = t, { craftNode: n, visible: o } = me(r), s = N(
2231
+ const r = t, { craftNode: n, visible: o } = be(r), s = C(
2208
2232
  () => o.value && n.value.visible === void 0 || n.value.visible
2209
- ), a = e, i = V(), { selectedNode: l } = te(i), u = N(() => ae(n.value)), p = N(
2233
+ ), a = e, i = q(), { selectedNode: l } = se(i), u = C(() => ue(n.value)), d = C(
2210
2234
  () => l?.value?.uuid === n.value.uuid
2211
2235
  ), m = () => {
2212
2236
  i.toggleNodeVisibility(n.value);
2213
2237
  };
2214
2238
  return (f, h) => {
2215
- const y = B("CraftEditorPanelNodeLayer", !0);
2216
- return v(), _("li", {
2217
- class: ve(["v-craft-node-layer", {
2218
- "v-craft-node-layer-selected": p.value
2239
+ const b = H("CraftEditorPanelNodeLayer", !0);
2240
+ return v(), E("li", {
2241
+ class: ye(["v-craft-node-layer", {
2242
+ "v-craft-node-layer-selected": d.value
2219
2243
  }]),
2220
- onClick: h[1] || (h[1] = F((x) => a("layer-click", d(n)), ["prevent", "stop"]))
2244
+ onClick: h[1] || (h[1] = V((P) => a("layer-click", p(n)), ["prevent", "stop"]))
2221
2245
  }, [
2222
- w("div", Sr, [
2223
- w("div", Pr, ee(u.value), 1),
2224
- w("button", {
2246
+ O("div", Rr, [
2247
+ O("div", Mr, oe(u.value), 1),
2248
+ O("button", {
2225
2249
  type: "button",
2226
2250
  class: "v-craft-component-icon",
2227
- onClick: F(m, ["prevent", "stop"])
2228
- }, ee(s.value ? "hide" : "show"), 1)
2251
+ onClick: V(m, ["prevent", "stop"])
2252
+ }, oe(s.value ? "hide" : "show"), 1)
2229
2253
  ]),
2230
- d(n).slots && Object.keys(d(n).slots).length > 0 ? (v(), _("ul", kr, [
2231
- (v(!0), _(U, null, T(d(n).slots, (x, P) => (v(), _(U, { key: P }, [
2232
- (v(!0), _(U, null, T(x, (g, E) => (v(), A(y, {
2233
- key: `${P}-${E}`,
2234
- craftNode: g,
2235
- onLayerClick: h[0] || (h[0] = (b) => a("layer-click", b)),
2254
+ p(n).slots && Object.keys(p(n).slots).length > 0 ? (v(), E("ul", $r, [
2255
+ (v(!0), E(B, null, j(p(n).slots, (P, A) => (v(), E(B, { key: A }, [
2256
+ (v(!0), E(B, null, j(P, (T, U) => (v(), M(b, {
2257
+ key: `${A}-${U}`,
2258
+ craftNode: T,
2259
+ onLayerClick: h[0] || (h[0] = (_) => a("layer-click", _)),
2236
2260
  visible: s.value
2237
2261
  }, null, 8, ["craftNode", "visible"]))), 128))
2238
2262
  ], 64))), 128))
2239
- ])) : D("", !0)
2263
+ ])) : R("", !0)
2240
2264
  ], 2);
2241
2265
  };
2242
2266
  }
2243
- }), Ar = /* @__PURE__ */ ge(Dr, [["__scopeId", "data-v-208a4e02"]]), Mr = {
2267
+ }), Tr = /* @__PURE__ */ Ee(Ir, [["__scopeId", "data-v-208a4e02"]]), Ur = {
2244
2268
  key: 0,
2245
2269
  class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
2246
- }, $r = /* @__PURE__ */ j({
2270
+ }, jr = /* @__PURE__ */ L({
2247
2271
  __name: "CraftEditorPanelNodeSettings",
2248
2272
  props: {
2249
2273
  craftNode: {},
@@ -2251,50 +2275,50 @@ const Gt = /* @__PURE__ */ j({
2251
2275
  },
2252
2276
  emits: ["update:props"],
2253
2277
  setup(t, { emit: e }) {
2254
- const r = t, { craftNode: n, schema: o } = me(r), s = e;
2278
+ const r = t, { craftNode: n, schema: o } = be(r), s = e;
2255
2279
  return (a, i) => {
2256
- const l = B("CraftEditorPanelForm");
2257
- return v(), A(l, {
2258
- craftNode: d(n),
2259
- schema: d(o),
2260
- model: d(n)?.props,
2280
+ const l = H("CraftEditorPanelForm");
2281
+ return v(), M(l, {
2282
+ craftNode: p(n),
2283
+ schema: p(o),
2284
+ model: p(n)?.props,
2261
2285
  onUpdate: i[0] || (i[0] = (u) => s("update:props", u))
2262
2286
  }, {
2263
- "panel-content": q(({ craftNode: u, model: p, handleFormInput: m, schema: f }) => [
2264
- f ? (v(), _("fieldset", Mr, [
2265
- i[1] || (i[1] = w("legend", { class: "formkit-legend" }, "Properties", -1)),
2266
- (v(), A(d(se), {
2287
+ "panel-content": G(({ craftNode: u, model: d, handleFormInput: m, schema: f }) => [
2288
+ f ? (v(), E("fieldset", Ur, [
2289
+ i[1] || (i[1] = O("legend", { class: "formkit-legend" }, "Properties", -1)),
2290
+ (v(), M(p(le), {
2267
2291
  key: u?.uuid,
2268
2292
  type: "form",
2269
- value: p,
2293
+ value: d,
2270
2294
  onInput: m,
2271
2295
  actions: !1
2272
2296
  }, {
2273
- default: q(() => [
2274
- z(d(Ge), { schema: f }, null, 8, ["schema"])
2297
+ default: G(() => [
2298
+ Q(p(et), { schema: f }, null, 8, ["schema"])
2275
2299
  ]),
2276
2300
  _: 2
2277
2301
  }, 1032, ["value", "onInput"]))
2278
- ])) : D("", !0)
2302
+ ])) : R("", !0)
2279
2303
  ]),
2280
2304
  _: 1
2281
2305
  }, 8, ["craftNode", "schema", "model"]);
2282
2306
  };
2283
2307
  }
2284
- }), Rr = (t) => {
2308
+ }), Br = (t) => {
2285
2309
  if (!t) return [];
2286
2310
  const e = t.type === "single" ? t.item : t.list?.[0];
2287
2311
  return e ? Object.keys(e) : [];
2288
- }, Ir = (t) => {
2289
- const e = V(), r = he("resolver");
2290
- return { buckets: N(() => {
2312
+ }, Lr = (t) => {
2313
+ const e = q(), r = ge("resolver");
2314
+ return { buckets: C(() => {
2291
2315
  const o = [];
2292
2316
  let s = t.value;
2293
2317
  for (; s?.parentUuid; ) {
2294
2318
  const a = e.nodeMap.get(s.parentUuid);
2295
2319
  if (!a) break;
2296
2320
  const i = Object.entries(a.slots || {}).find(
2297
- ([, u]) => u.some((p) => p.uuid === s.uuid)
2321
+ ([, u]) => u.some((d) => d.uuid === s.uuid)
2298
2322
  );
2299
2323
  if (i) {
2300
2324
  const [u] = i;
@@ -2310,18 +2334,18 @@ const Gt = /* @__PURE__ */ j({
2310
2334
  slotName: "data",
2311
2335
  ancestorUuid: a.uuid,
2312
2336
  ancestorComponentName: a.componentName,
2313
- keys: Rr(l)
2337
+ keys: Br(l)
2314
2338
  }), s = a;
2315
2339
  }
2316
2340
  return o;
2317
2341
  }) };
2318
- }, Tr = {
2342
+ }, Fr = {
2319
2343
  key: 0,
2320
2344
  class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
2321
- }, Ur = {
2345
+ }, Hr = {
2322
2346
  key: 0,
2323
2347
  class: "formkit-help"
2324
- }, jr = ["onClick"], Br = ["onClick"], Lr = ["onClick"], Fr = /* @__PURE__ */ j({
2348
+ }, Vr = ["onClick"], Kr = ["onClick"], Xr = ["onClick"], zr = /* @__PURE__ */ L({
2325
2349
  __name: "CraftEditorPanelNodeSlotPropsSettings",
2326
2350
  props: {
2327
2351
  craftNode: {},
@@ -2329,145 +2353,153 @@ const Gt = /* @__PURE__ */ j({
2329
2353
  },
2330
2354
  emits: ["update:slotsPropsPropsMap"],
2331
2355
  setup(t, { emit: e }) {
2332
- const r = t, n = e, o = de(r, "craftNode"), { buckets: s } = Ir(o), a = N(() => {
2333
- const g = /* @__PURE__ */ new Set();
2334
- return s.value.filter((E) => g.has(E.slotName) ? !1 : (g.add(E.slotName), !0)).map((E) => ({
2335
- value: E.slotName,
2336
- label: E.keys.length ? `${E.slotName} (${E.ancestorComponentName}: ${E.keys.join(", ")})` : `${E.slotName} (${E.ancestorComponentName})`
2356
+ const r = t, n = e, o = (_) => {
2357
+ const g = _.trim();
2358
+ if (!g.startsWith("{")) return g;
2359
+ try {
2360
+ return JSON.parse(g);
2361
+ } catch {
2362
+ return g;
2363
+ }
2364
+ }, s = (_) => typeof _ == "string" ? _ : JSON.stringify(_), a = he(r, "craftNode"), { buckets: i } = Lr(a), l = C(() => {
2365
+ const _ = /* @__PURE__ */ new Set();
2366
+ return i.value.filter((g) => _.has(g.slotName) ? !1 : (_.add(g.slotName), !0)).map((g) => ({
2367
+ value: g.slotName,
2368
+ label: g.keys.length ? `${g.slotName} (${g.ancestorComponentName}: ${g.keys.join(", ")})` : `${g.slotName} (${g.ancestorComponentName})`
2337
2369
  }));
2338
- }), i = (g) => {
2339
- const E = r.availableProps || [];
2340
- return !g || E.some((b) => b.value === g) ? E : [{ value: g, label: `${g} (custom)` }, ...E];
2341
- }, l = H([]);
2342
- J(() => o.value?.uuid, () => {
2343
- const g = o.value;
2344
- l.value = Object.entries(g?.slotsPropsPropsMap || {}).map(
2345
- ([E, b]) => ({
2346
- id: G(),
2347
- bucket: E,
2348
- fields: Object.entries(b).map(([O, C]) => ({
2349
- id: G(),
2350
- targetProp: O,
2351
- fromPath: C
2370
+ }), u = (_) => {
2371
+ const g = r.availableProps || [];
2372
+ return !_ || g.some((w) => w.value === _) ? g : [{ value: _, label: `${_} (custom)` }, ...g];
2373
+ }, d = K([]);
2374
+ ne(() => a.value?.uuid, () => {
2375
+ const _ = a.value;
2376
+ d.value = Object.entries(_?.slotsPropsPropsMap || {}).map(
2377
+ ([g, w]) => ({
2378
+ id: ee(),
2379
+ bucket: g,
2380
+ fields: Object.entries(w).map(([y, N]) => ({
2381
+ id: ee(),
2382
+ targetProp: y,
2383
+ fromPath: s(N)
2352
2384
  }))
2353
2385
  })
2354
2386
  );
2355
2387
  }, { immediate: !0 });
2356
- const p = () => {
2357
- const g = {};
2358
- l.value.forEach((E) => {
2359
- if (!E.bucket.trim()) return;
2360
- const b = {};
2361
- E.fields.forEach((O) => {
2362
- O.targetProp.trim() && O.fromPath.trim() && (b[O.targetProp.trim()] = O.fromPath.trim());
2363
- }), Object.keys(b).length && (g[E.bucket.trim()] = b);
2364
- }), n("update:slotsPropsPropsMap", g);
2365
- }, m = () => {
2366
- l.value.push({
2367
- id: G(),
2368
- bucket: a.value[0]?.value || "",
2369
- fields: [{ id: G(), targetProp: "", fromPath: "" }]
2370
- }), p();
2371
- }, f = (g) => {
2372
- l.value.splice(g, 1), p();
2373
- }, h = (g, E) => {
2374
- l.value[g].bucket = E, p();
2375
- }, y = (g) => {
2376
- l.value[g].fields.push({
2377
- id: G(),
2388
+ const f = () => {
2389
+ const _ = {};
2390
+ d.value.forEach((g) => {
2391
+ if (!g.bucket.trim()) return;
2392
+ const w = {};
2393
+ g.fields.forEach((y) => {
2394
+ y.targetProp.trim() && y.fromPath.trim() && (w[y.targetProp.trim()] = o(y.fromPath));
2395
+ }), Object.keys(w).length && (_[g.bucket.trim()] = w);
2396
+ }), n("update:slotsPropsPropsMap", _);
2397
+ }, h = () => {
2398
+ d.value.push({
2399
+ id: ee(),
2400
+ bucket: l.value[0]?.value || "",
2401
+ fields: [{ id: ee(), targetProp: "", fromPath: "" }]
2402
+ }), f();
2403
+ }, b = (_) => {
2404
+ d.value.splice(_, 1), f();
2405
+ }, P = (_, g) => {
2406
+ d.value[_].bucket = g, f();
2407
+ }, A = (_) => {
2408
+ d.value[_].fields.push({
2409
+ id: ee(),
2378
2410
  targetProp: "",
2379
2411
  fromPath: ""
2380
2412
  });
2381
- }, x = (g, E) => {
2382
- l.value[g].fields.splice(E, 1), p();
2383
- }, P = (g, E, b, O) => {
2384
- l.value[g].fields[E][b] = O, p();
2413
+ }, T = (_, g) => {
2414
+ d.value[_].fields.splice(g, 1), f();
2415
+ }, U = (_, g, w, y) => {
2416
+ d.value[_].fields[g][w] = y, f();
2385
2417
  };
2386
- return (g, E) => Q(g.$slots, "panel-content", {
2387
- craftNode: o.value,
2388
- mappingGroups: l.value,
2389
- bucketOptions: a.value,
2418
+ return (_, g) => J(_.$slots, "panel-content", {
2419
+ craftNode: a.value,
2420
+ mappingGroups: d.value,
2421
+ bucketOptions: l.value,
2390
2422
  availableProps: t.availableProps ?? [],
2391
- targetPropOptionsFor: i,
2392
- addGroup: m,
2393
- removeGroup: f,
2394
- updateBucket: h,
2395
- addField: y,
2396
- removeField: x,
2397
- updateField: P
2423
+ targetPropOptionsFor: u,
2424
+ addGroup: h,
2425
+ removeGroup: b,
2426
+ updateBucket: P,
2427
+ addField: A,
2428
+ removeField: T,
2429
+ updateField: U
2398
2430
  }, () => [
2399
- o.value ? (v(), _("fieldset", Tr, [
2400
- E[0] || (E[0] = w("legend", { class: "formkit-legend" }, "Props Mapping", -1)),
2401
- E[1] || (E[1] = w("p", { class: "formkit-help" }, [
2402
- oe(" Map fields from an ancestor slot's context into this component's own props using JSONPath (e.g. "),
2403
- w("code", null, "$.item.name"),
2404
- oe("). ")
2431
+ a.value ? (v(), E("fieldset", Fr, [
2432
+ g[0] || (g[0] = O("legend", { class: "formkit-legend" }, "Props Mapping", -1)),
2433
+ g[1] || (g[1] = O("p", { class: "formkit-help" }, [
2434
+ ie(" Map fields from an ancestor slot's context into this component's own props using JSONPath (e.g. "),
2435
+ O("code", null, "$.item.name"),
2436
+ ie("), or paste a JSON mapping object if the app supports richer transforms. ")
2405
2437
  ], -1)),
2406
- l.value.length ? D("", !0) : (v(), _("p", Ur, " No mappings configured. ")),
2407
- (v(!0), _(U, null, T(l.value, (b, O) => (v(), _("div", {
2408
- key: b.id,
2438
+ d.value.length ? R("", !0) : (v(), E("p", Hr, " No mappings configured. ")),
2439
+ (v(!0), E(B, null, j(d.value, (w, y) => (v(), E("div", {
2440
+ key: w.id,
2409
2441
  class: "v-craft-slot-props-map-group"
2410
2442
  }, [
2411
- z(d(se), {
2443
+ Q(p(le), {
2412
2444
  type: "select",
2413
2445
  label: "Context",
2414
2446
  placeholder: "Select context",
2415
- options: a.value,
2416
- value: b.bucket,
2417
- onInput: (C) => h(O, String(C ?? ""))
2447
+ options: l.value,
2448
+ value: w.bucket,
2449
+ onInput: (N) => P(y, String(N ?? ""))
2418
2450
  }, null, 8, ["options", "value", "onInput"]),
2419
- (v(!0), _(U, null, T(b.fields, (C, I) => (v(), _(U, {
2420
- key: C.id
2451
+ (v(!0), E(B, null, j(w.fields, (N, S) => (v(), E(B, {
2452
+ key: N.id
2421
2453
  }, [
2422
- t.availableProps && t.availableProps.length ? (v(), A(d(se), {
2454
+ t.availableProps && t.availableProps.length ? (v(), M(p(le), {
2423
2455
  key: 0,
2424
2456
  type: "select",
2425
2457
  label: "Target Prop",
2426
2458
  placeholder: "target prop",
2427
- options: i(C.targetProp),
2428
- value: C.targetProp,
2429
- onInput: (R) => P(O, I, "targetProp", String(R ?? ""))
2430
- }, null, 8, ["options", "value", "onInput"])) : (v(), A(d(se), {
2459
+ options: u(N.targetProp),
2460
+ value: N.targetProp,
2461
+ onInput: (I) => U(y, S, "targetProp", String(I ?? ""))
2462
+ }, null, 8, ["options", "value", "onInput"])) : (v(), M(p(le), {
2431
2463
  key: 1,
2432
2464
  type: "text",
2433
2465
  label: "Target Prop",
2434
2466
  placeholder: "target prop",
2435
- value: C.targetProp,
2436
- onInput: (R) => P(O, I, "targetProp", String(R ?? ""))
2467
+ value: N.targetProp,
2468
+ onInput: (I) => U(y, S, "targetProp", String(I ?? ""))
2437
2469
  }, null, 8, ["value", "onInput"])),
2438
- z(d(se), {
2439
- type: "text",
2440
- label: "JSONPath",
2441
- placeholder: "$.item.name",
2442
- value: C.fromPath,
2443
- onInput: (R) => P(O, I, "fromPath", String(R ?? ""))
2470
+ Q(p(le), {
2471
+ type: "textarea",
2472
+ label: "JSONPath (or JSON mapping object)",
2473
+ placeholder: "$.item.name (or paste a JSON transform object)",
2474
+ value: N.fromPath,
2475
+ onInput: (I) => U(y, S, "fromPath", String(I ?? ""))
2444
2476
  }, null, 8, ["value", "onInput"]),
2445
- w("button", {
2477
+ O("button", {
2446
2478
  type: "button",
2447
2479
  class: "formkit-input v-craft-slot-props-remove",
2448
- onClick: F((R) => x(O, I), ["prevent"])
2449
- }, " Remove field ", 8, jr)
2480
+ onClick: V((I) => T(y, S), ["prevent"])
2481
+ }, " Remove field ", 8, Vr)
2450
2482
  ], 64))), 128)),
2451
- w("button", {
2483
+ O("button", {
2452
2484
  type: "button",
2453
2485
  class: "formkit-input v-craft-slot-props-add",
2454
- onClick: F((C) => y(O), ["prevent"])
2455
- }, " + Add field ", 8, Br),
2456
- w("button", {
2486
+ onClick: V((N) => A(y), ["prevent"])
2487
+ }, " + Add field ", 8, Kr),
2488
+ O("button", {
2457
2489
  type: "button",
2458
2490
  class: "formkit-input v-craft-slot-props-remove",
2459
- onClick: F((C) => f(O), ["prevent"])
2460
- }, " Remove group ", 8, Lr)
2491
+ onClick: V((N) => b(y), ["prevent"])
2492
+ }, " Remove group ", 8, Xr)
2461
2493
  ]))), 128)),
2462
- w("button", {
2494
+ O("button", {
2463
2495
  type: "button",
2464
2496
  class: "formkit-input v-craft-slot-props-add",
2465
- onClick: F(m, ["prevent"])
2497
+ onClick: V(h, ["prevent"])
2466
2498
  }, " + Add mapping group ")
2467
- ])) : D("", !0)
2499
+ ])) : R("", !0)
2468
2500
  ], !0);
2469
2501
  }
2470
- }), Hr = /* @__PURE__ */ ge(Fr, [["__scopeId", "data-v-f762baf8"]]), Kr = (t) => Array.isArray(t) ? t.filter(
2502
+ }), qr = /* @__PURE__ */ Ee(zr, [["__scopeId", "data-v-74ec0ff3"]]), Yr = (t) => Array.isArray(t) ? t.filter(
2471
2503
  (e) => typeof e == "object" && e !== null && typeof e.name == "string"
2472
2504
  ).map((e) => {
2473
2505
  const r = e.name, n = e.label;
@@ -2475,118 +2507,118 @@ const Gt = /* @__PURE__ */ j({
2475
2507
  value: r,
2476
2508
  label: typeof n == "string" && n.trim() ? n : r
2477
2509
  };
2478
- }) : [], Vr = { class: "text-sm" }, Xr = { key: 0 }, zr = {
2510
+ }) : [], Qr = { class: "text-sm" }, Gr = { key: 0 }, Wr = {
2479
2511
  key: 0,
2480
2512
  class: "v-craft-settings"
2481
- }, qr = {
2513
+ }, Zr = {
2482
2514
  key: 1,
2483
2515
  class: "v-craft-settings"
2484
- }, Yr = {
2516
+ }, Jr = {
2485
2517
  key: 2,
2486
2518
  class: "v-craft-settings"
2487
- }, Qr = {
2519
+ }, en = {
2488
2520
  key: 3,
2489
2521
  class: "v-craft-settings"
2490
- }, Gr = {
2522
+ }, tn = {
2491
2523
  class: "v-craft-actions",
2492
2524
  "data-type": "button"
2493
- }, Wr = /* @__PURE__ */ j({
2525
+ }, rn = /* @__PURE__ */ L({
2494
2526
  __name: "CraftEditorPanelSettings",
2495
2527
  setup(t) {
2496
- const e = V(), { selectedNode: r, nodeDataMap: n } = te(e), o = he("resolver"), s = N(() => !r.value || !o?.value ? [] : o.value.getSchema(r.value)), a = N(() => !r.value || !o?.value ? [] : o.value.getEventsSchema(r.value)), i = N(() => Kr(s.value)), l = N(
2528
+ const e = q(), { selectedNode: r, nodeDataMap: n } = se(e), o = ge("resolver"), s = C(() => !r.value || !o?.value ? [] : o.value.getSchema(r.value)), a = C(() => !r.value || !o?.value ? [] : o.value.getEventsSchema(r.value)), i = C(() => Yr(s.value)), l = C(
2497
2529
  () => r.value && r.value.parentUuid
2498
2530
  ), u = () => {
2499
2531
  r.value && e.removeNode(r.value);
2500
- }, p = N(
2532
+ }, d = C(
2501
2533
  () => r.value ? `${o?.value?.resolveNode(r.value)?.componentName || "Unknown"}` : ""
2502
- ), m = (P) => {
2503
- r.value && P && e.updateNodeProps(r.value.uuid, P);
2504
- }, f = (P) => {
2505
- r.value && P && e.updateNodeEvents(r.value.uuid, P);
2506
- }, h = (P) => {
2534
+ ), m = (A) => {
2535
+ r.value && A && e.updateNodeProps(r.value.uuid, A);
2536
+ }, f = (A) => {
2537
+ r.value && A && e.updateNodeEvents(r.value.uuid, A);
2538
+ }, h = (A) => {
2507
2539
  r.value && e.updateNodeSlotsPropsPropsMap(
2508
2540
  r.value.uuid,
2509
- P
2541
+ A
2510
2542
  );
2511
- }, y = N(
2543
+ }, b = C(
2512
2544
  () => r.value ? n.value[r.value.uuid] ?? null : null
2513
- ), x = (P) => {
2514
- r.value && e.setNodeData(r.value.uuid, P);
2545
+ ), P = (A) => {
2546
+ r.value && e.setNodeData(r.value.uuid, A);
2515
2547
  };
2516
- return (P, g) => {
2517
- const E = B("CraftEditorPanelNodeSettings"), b = B("CraftEditorPanelNodeEventsSettings"), O = B("CraftEditorPanelNodeSlotPropsSettings"), C = B("CraftEditorPanelNodeDataSourceSettings");
2518
- return Q(P.$slots, "panel-content", {
2519
- selectedNode: d(r),
2520
- nodeName: p.value,
2548
+ return (A, T) => {
2549
+ const U = H("CraftEditorPanelNodeSettings"), _ = H("CraftEditorPanelNodeEventsSettings"), g = H("CraftEditorPanelNodeSlotPropsSettings"), w = H("CraftEditorPanelNodeDataSourceSettings");
2550
+ return J(A.$slots, "panel-content", {
2551
+ selectedNode: p(r),
2552
+ nodeName: d.value,
2521
2553
  handlePropsUpdate: m,
2522
2554
  schema: s.value,
2523
2555
  eventsSchema: a.value,
2524
2556
  handleEventsUpdate: f,
2525
2557
  availableProps: i.value,
2526
2558
  handleSlotsPropsPropsMapUpdate: h,
2527
- nodeData: y.value,
2528
- handleNodeDataUpdate: x,
2559
+ nodeData: b.value,
2560
+ handleNodeDataUpdate: P,
2529
2561
  deleteable: l.value,
2530
2562
  removeNode: u
2531
2563
  }, () => [
2532
- w("div", {
2564
+ O("div", {
2533
2565
  ref: "panel",
2534
2566
  class: "v-craft-panel v-craft-settings-panel",
2535
- onClick: F(() => !1, ["prevent", "stop"])
2567
+ onClick: V(() => !1, ["prevent", "stop"])
2536
2568
  }, [
2537
- g[1] || (g[1] = w("h3", { class: "v-craft-title" }, "component inspector", -1)),
2538
- w("span", Vr, ee(d(r)?.uuid), 1),
2539
- d(r) ? D("", !0) : (v(), _("div", Xr, [...g[0] || (g[0] = [
2540
- w("p", null, "select a component to inspect", -1)
2569
+ T[1] || (T[1] = O("h3", { class: "v-craft-title" }, "component inspector", -1)),
2570
+ O("span", Qr, oe(p(r)?.uuid), 1),
2571
+ p(r) ? R("", !0) : (v(), E("div", Gr, [...T[0] || (T[0] = [
2572
+ O("p", null, "select a component to inspect", -1)
2541
2573
  ])])),
2542
- w("div", {
2543
- class: ve(["v-craft-properties", { "v-craft-visible": d(r) }])
2574
+ O("div", {
2575
+ class: ye(["v-craft-properties", { "v-craft-visible": p(r) }])
2544
2576
  }, [
2545
- w("h4", null, ee(p.value), 1),
2546
- s.value ? (v(), _("div", zr, [
2547
- z(E, {
2548
- craftNode: d(r),
2577
+ O("h4", null, oe(d.value), 1),
2578
+ s.value ? (v(), E("div", Wr, [
2579
+ Q(U, {
2580
+ craftNode: p(r),
2549
2581
  schema: s.value,
2550
2582
  "onUpdate:props": m
2551
2583
  }, null, 8, ["craftNode", "schema"])
2552
- ])) : D("", !0),
2553
- a.value && d(r) ? (v(), _("div", qr, [
2554
- z(b, {
2555
- craftNode: d(r),
2584
+ ])) : R("", !0),
2585
+ a.value && p(r) ? (v(), E("div", Zr, [
2586
+ Q(_, {
2587
+ craftNode: p(r),
2556
2588
  schema: a.value,
2557
2589
  "onUpdate:events": f
2558
2590
  }, null, 8, ["craftNode", "schema"])
2559
- ])) : D("", !0),
2560
- d(r) ? (v(), _("div", Yr, [
2561
- z(O, {
2562
- craftNode: d(r),
2591
+ ])) : R("", !0),
2592
+ p(r) ? (v(), E("div", Jr, [
2593
+ Q(g, {
2594
+ craftNode: p(r),
2563
2595
  availableProps: i.value,
2564
2596
  "onUpdate:slotsPropsPropsMap": h
2565
2597
  }, null, 8, ["craftNode", "availableProps"])
2566
- ])) : D("", !0),
2567
- d(r) ? (v(), _("div", Qr, [
2568
- z(C, {
2569
- craftNode: d(r),
2570
- nodeData: y.value,
2571
- "onUpdate:nodeData": x
2598
+ ])) : R("", !0),
2599
+ p(r) ? (v(), E("div", en, [
2600
+ Q(w, {
2601
+ craftNode: p(r),
2602
+ nodeData: b.value,
2603
+ "onUpdate:nodeData": P
2572
2604
  }, null, 8, ["craftNode", "nodeData"])
2573
- ])) : D("", !0),
2574
- w("div", Gr, [
2575
- l.value ? (v(), _("button", {
2605
+ ])) : R("", !0),
2606
+ O("div", tn, [
2607
+ l.value ? (v(), E("button", {
2576
2608
  key: 0,
2577
2609
  class: "formkit-input v-craft-delete",
2578
- onClick: F(u, ["prevent"])
2579
- }, " Delete ")) : D("", !0)
2610
+ onClick: V(u, ["prevent"])
2611
+ }, " Delete ")) : R("", !0)
2580
2612
  ])
2581
2613
  ], 2)
2582
2614
  ], 512)
2583
2615
  ]);
2584
2616
  };
2585
2617
  }
2586
- }), Fe = /* @__PURE__ */ j({
2618
+ }), Xe = /* @__PURE__ */ L({
2587
2619
  __name: "CraftDropIndicator",
2588
2620
  setup(t) {
2589
- const e = Re(), r = () => {
2621
+ const e = je(), r = () => {
2590
2622
  const { top: n, left: o } = e.position, { width: s, height: a } = e.size;
2591
2623
  return {
2592
2624
  top: `${n}px`,
@@ -2595,13 +2627,13 @@ const Gt = /* @__PURE__ */ j({
2595
2627
  width: `${s}px`
2596
2628
  };
2597
2629
  };
2598
- return (n, o) => d(e).isShown ? (v(), _("div", {
2630
+ return (n, o) => p(e).isShown ? (v(), E("div", {
2599
2631
  key: 0,
2600
- class: ve(["v-craft-indicator", { "v-craft-forbidden": d(e).isForbidden }]),
2601
- style: Me(r())
2602
- }, null, 6)) : D("", !0);
2632
+ class: ye(["v-craft-indicator", { "v-craft-forbidden": p(e).isForbidden }]),
2633
+ style: Te(r())
2634
+ }, null, 6)) : R("", !0);
2603
2635
  }
2604
- }), nt = /* @__PURE__ */ j({
2636
+ }), it = /* @__PURE__ */ L({
2605
2637
  __name: "CraftIframe",
2606
2638
  props: {
2607
2639
  iframeClass: { type: [Boolean, null, String, Object, Array], default: "" },
@@ -2613,103 +2645,103 @@ const Gt = /* @__PURE__ */ j({
2613
2645
  },
2614
2646
  emits: ["iframeLoad"],
2615
2647
  setup(t, { emit: e }) {
2616
- const r = t, n = H(), o = H(!1), s = H(), a = () => {
2617
- pe(() => {
2648
+ const r = t, n = K(), o = K(!1), s = K(), a = () => {
2649
+ ve(() => {
2618
2650
  if (!n.value) {
2619
2651
  console.error("iframe could not be loaded.");
2620
2652
  return;
2621
2653
  }
2622
- m("iframeLoad", n.value), n.value?.setAttribute("data-iframe-ready", "true"), p(), r.inheritStyles && i(), r.styles.forEach((f) => {
2654
+ m("iframeLoad", n.value), n.value?.setAttribute("data-iframe-ready", "true"), d(), r.inheritStyles && i(), r.styles.forEach((f) => {
2623
2655
  n.value && l(n.value, f);
2624
2656
  }), r.styleSheets.forEach((f) => {
2625
2657
  n.value && u(n.value, f);
2626
- }), o.value = !0, pe(() => {
2658
+ }), o.value = !0, ve(() => {
2627
2659
  n.value && (s.value = n.value?.contentWindow?.document.body);
2628
2660
  });
2629
2661
  });
2630
2662
  }, i = () => {
2631
2663
  const f = n.value?.contentWindow?.parent.document;
2632
2664
  if (!f) return;
2633
- Array.from(f.querySelectorAll("style") ?? []).forEach((x) => {
2634
- n.value?.contentDocument?.head.appendChild(x.cloneNode(!0));
2635
- }), Array.from(f.querySelectorAll("link[rel='stylesheet']") ?? []).forEach((x) => {
2636
- n.value?.contentDocument?.head.appendChild(x.cloneNode(!0));
2665
+ Array.from(f.querySelectorAll("style") ?? []).forEach((P) => {
2666
+ n.value?.contentDocument?.head.appendChild(P.cloneNode(!0));
2667
+ }), Array.from(f.querySelectorAll("link[rel='stylesheet']") ?? []).forEach((P) => {
2668
+ n.value?.contentDocument?.head.appendChild(P.cloneNode(!0));
2637
2669
  });
2638
2670
  }, l = (f, h) => {
2639
- const y = document.createElement("style");
2640
- y.innerHTML = h, f?.contentWindow?.document.getElementsByTagName("head").item(0)?.appendChild(y);
2671
+ const b = document.createElement("style");
2672
+ b.innerHTML = h, f?.contentWindow?.document.getElementsByTagName("head").item(0)?.appendChild(b);
2641
2673
  }, u = (f, h) => {
2642
- const y = document.createElement("link");
2643
- y.rel = "stylesheet", y.href = h, f.contentWindow?.document.head.appendChild(y);
2644
- }, p = () => {
2674
+ const b = document.createElement("link");
2675
+ b.rel = "stylesheet", b.href = h, f.contentWindow?.document.head.appendChild(b);
2676
+ }, d = () => {
2645
2677
  const f = n.value?.contentWindow?.document;
2646
2678
  if (!f) return;
2647
2679
  const h = f.querySelector("body");
2648
2680
  if (!h) return;
2649
- const y = f.createAttribute("id");
2650
- y.nodeValue = "v-craft-body", h.attributes.setNamedItem(y);
2681
+ const b = f.createAttribute("id");
2682
+ b.nodeValue = "v-craft-body", h.attributes.setNamedItem(b);
2651
2683
  }, m = e;
2652
- return (f, h) => Et((v(), _("div", null, [
2653
- w("iframe", {
2684
+ return (f, h) => _t((v(), E("div", null, [
2685
+ O("iframe", {
2654
2686
  id: "v-craft-iframe",
2655
2687
  ref_key: "iframeRef",
2656
2688
  ref: n,
2657
- class: ve(t.iframeClass),
2658
- style: Me(t.iframeStyle),
2689
+ class: ye(t.iframeClass),
2690
+ style: Te(t.iframeStyle),
2659
2691
  onload: a
2660
2692
  }, null, 6),
2661
- o.value ? (v(), A(Ct, {
2693
+ o.value ? (v(), M(St, {
2662
2694
  key: 0,
2663
2695
  to: n.value?.contentWindow?.document.body
2664
2696
  }, [
2665
- Q(f.$slots, "default")
2666
- ], 8, ["to"])) : D("", !0)
2697
+ J(f.$slots, "default")
2698
+ ], 8, ["to"])) : R("", !0)
2667
2699
  ], 512)), [
2668
- [_t, f.$slots.default]
2700
+ [xt, f.$slots.default]
2669
2701
  ]);
2670
2702
  }
2671
- }), Zr = (t) => typeof t.type == "symbol" ? "Fragment" : typeof t.type == "string" ? t.type : t.type.name ? t.type.name : "anonmymous", Pe = (t, e, r = null) => {
2672
- const n = Zr(e), { props: o } = e, s = {
2703
+ }), nn = (t) => typeof t.type == "symbol" ? "Fragment" : typeof t.type == "string" ? t.type : t.type.name ? t.type.name : "anonmymous", Re = (t, e, r = null) => {
2704
+ const n = nn(e), { props: o } = e, s = {
2673
2705
  componentName: n,
2674
2706
  props: o,
2675
2707
  slots: {},
2676
2708
  parentUuid: r?.uuid ?? null,
2677
- uuid: G()
2709
+ uuid: ee()
2678
2710
  };
2679
2711
  return e.children && (typeof e.children == "object" && !Array.isArray(e.children) ? Object.entries(e.children).forEach(([a, i]) => {
2680
2712
  if (typeof i == "function") {
2681
2713
  const l = i();
2682
- l && (s.slots[a] = He(
2714
+ l && (s.slots[a] = ze(
2683
2715
  t,
2684
2716
  l,
2685
2717
  s
2686
2718
  ));
2687
2719
  }
2688
- }) : Array.isArray(e.children) && (s.slots.default = He(
2720
+ }) : Array.isArray(e.children) && (s.slots.default = ze(
2689
2721
  t,
2690
2722
  e.children,
2691
2723
  s
2692
2724
  ))), s;
2693
- }, He = (t, e, r) => !e || !(e instanceof Array) ? [] : e.map((n) => Pe(t, n, r)).filter((n) => !!n), Jr = (t) => {
2694
- const e = V(), { hasNodes: r } = te(e), n = t ? H(new xe(t)) : he("resolver");
2695
- n?.value && e.setResolver(n.value), t && W("resolver", n);
2725
+ }, ze = (t, e, r) => !e || !(e instanceof Array) ? [] : e.map((n) => Re(t, n, r)).filter((n) => !!n), on = (t) => {
2726
+ const e = q(), { hasNodes: r } = se(e), n = t ? K(new Oe(t)) : ge("resolver");
2727
+ n?.value && e.setResolver(n.value), t && te("resolver", n);
2696
2728
  const o = () => {
2697
2729
  if (n?.value && !r.value) {
2698
- const s = Xe(), i = (s.default ? s.default() : []).flatMap((l) => {
2730
+ const s = Qe(), i = (s.default ? s.default() : []).flatMap((l) => {
2699
2731
  if (l.key === "_default" && l.children && Array.isArray(l.children))
2700
2732
  return l.children.map((u) => {
2701
- const p = Pe(n.value, u);
2702
- return p || console.error("Invalid node created from child:", u), p;
2733
+ const d = Re(n.value, u);
2734
+ return d || console.error("Invalid node created from child:", u), d;
2703
2735
  }).filter(Boolean);
2704
2736
  {
2705
- const u = Pe(n.value, l);
2737
+ const u = Re(n.value, l);
2706
2738
  return u || console.error("Invalid node created from slot:", l), [u];
2707
2739
  }
2708
2740
  }).filter(Boolean);
2709
2741
  i.length && e.setNodes(i);
2710
2742
  }
2711
2743
  };
2712
- return Ne(o), J(
2744
+ return xe(o), ne(
2713
2745
  () => n?.value,
2714
2746
  (s) => {
2715
2747
  s && e.setResolver(s);
@@ -2718,7 +2750,7 @@ const Gt = /* @__PURE__ */ j({
2718
2750
  editor: e,
2719
2751
  mountNodes: o
2720
2752
  };
2721
- }, en = { class: "v-craft-frame" }, tn = /* @__PURE__ */ j({
2753
+ }, sn = { class: "v-craft-frame" }, an = /* @__PURE__ */ L({
2722
2754
  name: "CraftFrame",
2723
2755
  __name: "CraftFrame",
2724
2756
  props: {
@@ -2728,168 +2760,168 @@ const Gt = /* @__PURE__ */ j({
2728
2760
  },
2729
2761
  emits: ["iframeLoad"],
2730
2762
  setup(t, { emit: e }) {
2731
- const r = t, { iframe: n } = me(r), o = (p) => {
2732
- s("iframeLoad", p);
2733
- }, s = e, { editor: a } = Jr(r.resolverMap), { nodeTree: i, hasNodes: l, enabled: u } = te(a);
2734
- return (p, m) => {
2735
- const f = B("CraftNodeViewer"), h = B("CraftNodeEditor");
2736
- return v(), _("div", en, [
2737
- d(n) ? (v(), A(nt, {
2763
+ const r = t, { iframe: n } = be(r), o = (d) => {
2764
+ s("iframeLoad", d);
2765
+ }, s = e, { editor: a } = on(r.resolverMap), { nodeTree: i, hasNodes: l, enabled: u } = se(a);
2766
+ return (d, m) => {
2767
+ const f = H("CraftNodeViewer"), h = H("CraftNodeEditor");
2768
+ return v(), E("div", sn, [
2769
+ p(n) ? (v(), M(it, {
2738
2770
  key: 0,
2739
2771
  onIframeLoad: o,
2740
- inheritStyles: d(n)?.inheritStyles,
2741
- iframeStyle: d(n)?.iframeStyle,
2742
- iframeClass: d(n)?.iframeClass,
2743
- class: ve(d(n)?.wrapperClass),
2744
- style: Me(d(n)?.wrapperStyle),
2745
- styles: d(n)?.styles,
2746
- styleSheets: d(n)?.styleSheets
2772
+ inheritStyles: p(n)?.inheritStyles,
2773
+ iframeStyle: p(n)?.iframeStyle,
2774
+ iframeClass: p(n)?.iframeClass,
2775
+ class: ye(p(n)?.wrapperClass),
2776
+ style: Te(p(n)?.wrapperStyle),
2777
+ styles: p(n)?.styles,
2778
+ styleSheets: p(n)?.styleSheets
2747
2779
  }, {
2748
- default: q(() => [
2749
- (t.viewOnly || !d(u)) && d(l) ? (v(!0), _(U, { key: 0 }, T(d(i), (y) => (v(), A(f, {
2750
- key: `${y.uuid}-view`,
2751
- craftNode: y
2752
- }, null, 8, ["craftNode"]))), 128)) : D("", !0),
2753
- !t.viewOnly && d(u) && d(l) ? (v(!0), _(U, { key: 1 }, T(d(i), (y) => (v(), A(h, {
2754
- key: `${y.uuid}-edit`,
2755
- craftNode: y
2756
- }, null, 8, ["craftNode"]))), 128)) : D("", !0),
2757
- !t.viewOnly && d(u) ? (v(), A(Fe, { key: 2 })) : D("", !0)
2780
+ default: G(() => [
2781
+ (t.viewOnly || !p(u)) && p(l) ? (v(!0), E(B, { key: 0 }, j(p(i), (b) => (v(), M(f, {
2782
+ key: `${b.uuid}-view`,
2783
+ craftNode: b
2784
+ }, null, 8, ["craftNode"]))), 128)) : R("", !0),
2785
+ !t.viewOnly && p(u) && p(l) ? (v(!0), E(B, { key: 1 }, j(p(i), (b) => (v(), M(h, {
2786
+ key: `${b.uuid}-edit`,
2787
+ craftNode: b
2788
+ }, null, 8, ["craftNode"]))), 128)) : R("", !0),
2789
+ !t.viewOnly && p(u) ? (v(), M(Xe, { key: 2 })) : R("", !0)
2758
2790
  ]),
2759
2791
  _: 1
2760
- }, 8, ["inheritStyles", "iframeStyle", "iframeClass", "class", "style", "styles", "styleSheets"])) : D("", !0),
2761
- !d(n) && (t.viewOnly || !d(u)) && d(l) ? (v(!0), _(U, { key: 1 }, T(d(i), (y) => (v(), A(f, {
2762
- key: `${y.uuid}-view`,
2763
- craftNode: y
2764
- }, null, 8, ["craftNode"]))), 128)) : D("", !0),
2765
- !d(n) && !t.viewOnly && d(u) && d(l) ? (v(!0), _(U, { key: 2 }, T(d(i), (y) => (v(), A(h, {
2766
- key: `${y.uuid}-edit`,
2767
- craftNode: y
2768
- }, null, 8, ["craftNode"]))), 128)) : D("", !0),
2769
- !d(n) && !t.viewOnly && d(u) ? (v(), A(Fe, { key: 3 })) : D("", !0)
2792
+ }, 8, ["inheritStyles", "iframeStyle", "iframeClass", "class", "style", "styles", "styleSheets"])) : R("", !0),
2793
+ !p(n) && (t.viewOnly || !p(u)) && p(l) ? (v(!0), E(B, { key: 1 }, j(p(i), (b) => (v(), M(f, {
2794
+ key: `${b.uuid}-view`,
2795
+ craftNode: b
2796
+ }, null, 8, ["craftNode"]))), 128)) : R("", !0),
2797
+ !p(n) && !t.viewOnly && p(u) && p(l) ? (v(!0), E(B, { key: 2 }, j(p(i), (b) => (v(), M(h, {
2798
+ key: `${b.uuid}-edit`,
2799
+ craftNode: b
2800
+ }, null, 8, ["craftNode"]))), 128)) : R("", !0),
2801
+ !p(n) && !t.viewOnly && p(u) ? (v(), M(Xe, { key: 3 })) : R("", !0)
2770
2802
  ]);
2771
2803
  };
2772
2804
  }
2773
- }), rn = (t, e) => {
2774
- const r = V(), { enabled: n, selectedUuid: o, draggingDisabled: s } = te(r);
2805
+ }), ln = (t, e) => {
2806
+ const r = q(), { enabled: n, selectedUuid: o, draggingDisabled: s } = se(r);
2775
2807
  let a = null;
2776
2808
  const i = () => {
2777
2809
  const m = e?.value?.$el;
2778
2810
  m && m !== a && (a = m, r.setNodeRef(t, m));
2779
2811
  };
2780
- Ne(i), J(e, i, { flush: "post" });
2781
- const l = N(
2812
+ xe(i), ne(e, i, { flush: "post" });
2813
+ const l = C(
2782
2814
  () => o.value === t.uuid
2783
2815
  );
2784
2816
  return {
2785
- isDraggable: N(() => n.value && !s.value && qt(t)),
2817
+ isDraggable: C(() => n.value && !s.value && Zt(t)),
2786
2818
  isSelected: l,
2787
2819
  selectNode: () => {
2788
2820
  n.value && r.selectNode(t);
2789
2821
  }
2790
2822
  };
2791
- }, Ie = (t, e, r, n) => {
2792
- const o = /* @__PURE__ */ new Map(), s = () => {
2793
- !t.value?.events || !Object.values(t.value.events).length || Object.entries(t.value.events).forEach(([a, i]) => {
2794
- if (!i.trim())
2823
+ }, Be = (t, e, r = {}) => {
2824
+ const n = /* @__PURE__ */ new Map(), o = () => {
2825
+ !t.value?.events || !Object.values(t.value.events).length || Object.entries(t.value.events).forEach(([s, a]) => {
2826
+ if (!a.trim())
2795
2827
  return;
2796
- const l = (...u) => {
2828
+ const i = (...l) => {
2797
2829
  try {
2798
2830
  new Function(
2799
2831
  "ctx",
2800
2832
  "craftNode",
2801
2833
  "args",
2802
- i
2834
+ a
2803
2835
  )(
2804
- { ...e, getNodes: r, getNode: n },
2836
+ { ...e, ...r },
2805
2837
  t.value.uuid,
2806
- ...u
2838
+ ...l
2807
2839
  );
2808
- } catch (p) {
2840
+ } catch (u) {
2809
2841
  console.error(
2810
2842
  `Event code execution failed with code:
2811
- ${i}
2843
+ ${a}
2812
2844
 
2813
2845
  Error:`,
2814
- p
2846
+ u
2815
2847
  );
2816
2848
  }
2817
2849
  };
2818
- o.set(a, l);
2850
+ n.set(s, i);
2819
2851
  });
2820
2852
  };
2821
- return J(
2853
+ return ne(
2822
2854
  () => t,
2823
2855
  () => {
2824
- s();
2856
+ o();
2825
2857
  }
2826
- ), Nt(() => {
2827
- s();
2828
- }), xt(() => {
2829
- o.clear();
2858
+ ), Ot(() => {
2859
+ o();
2860
+ }), wt(() => {
2861
+ n.clear();
2830
2862
  }), {
2831
- eventHandlers: N(() => Object.fromEntries(o))
2863
+ eventHandlers: C(() => Object.fromEntries(n))
2832
2864
  };
2833
- }, ot = (t) => {
2865
+ }, lt = (t) => {
2834
2866
  const e = (() => {
2835
2867
  try {
2836
- return V();
2868
+ return q();
2837
2869
  } catch {
2838
2870
  return null;
2839
2871
  }
2840
- })(), r = N(() => e ? te(e).enabled?.value ?? !1 : !1), n = N(() => t.value?.visible !== !1);
2841
- return W("craftNode", qe(t)), {
2872
+ })(), r = C(() => e ? se(e).enabled?.value ?? !1 : !1), n = C(() => t.value?.visible !== !1);
2873
+ return te("craftNode", We(t)), {
2842
2874
  editor: e,
2843
2875
  craftNode: t,
2844
2876
  enabled: r,
2845
2877
  visible: n
2846
2878
  };
2847
- }, st = (t, e) => {
2879
+ }, ut = (t, e) => {
2848
2880
  if (!e.getBoundingClientRect) return !1;
2849
2881
  const r = e.getBoundingClientRect();
2850
2882
  return t.clientX - r.left < r.width / 2;
2851
- }, at = (t, e) => {
2883
+ }, ct = (t, e) => {
2852
2884
  if (!e.getBoundingClientRect) return !1;
2853
2885
  const r = e.getBoundingClientRect();
2854
2886
  return t.clientY - r.top < r.height / 2;
2855
- }, it = (t, e) => {
2887
+ }, dt = (t, e) => {
2856
2888
  if (!e.getBoundingClientRect) return !1;
2857
2889
  const r = e.getBoundingClientRect();
2858
2890
  return t.clientX - r.left < 15 || t.clientY - r.top < 15 || r.right - t.clientX < 15 || r.bottom - t.clientY < 15;
2859
- }, lt = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
2891
+ }, pt = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
2860
2892
  if (r.draggedNode) {
2861
- if (n.setIsForbidden(!Ce(r.draggedNode, o.value, s)), st(t, e)) {
2893
+ if (n.setIsForbidden(!_e(r.draggedNode, o.value, s)), ut(t, e)) {
2862
2894
  n.pointBefore(e);
2863
2895
  return;
2864
2896
  }
2865
2897
  n.pointAfter(e);
2866
2898
  }
2867
- }, nn = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
2899
+ }, un = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
2868
2900
  if (!r.draggedNode) return;
2869
2901
  const i = t.target.closest(".v-craft-drop-text");
2870
2902
  if (i) {
2871
- const u = !fe(r.draggedNode, o.value, s);
2903
+ const u = !me(r.draggedNode, o.value, s);
2872
2904
  n.setIsForbidden(u), n.pointInside(i);
2873
2905
  return;
2874
2906
  }
2875
- if (it(t, e)) {
2876
- lt(t, e, { editor: r, indicator: n, craftNode: o, resolver: s });
2907
+ if (dt(t, e)) {
2908
+ pt(t, e, { editor: r, indicator: n, craftNode: o, resolver: s });
2877
2909
  return;
2878
2910
  }
2879
- const l = !fe(r.draggedNode, o.value, s);
2880
- if (n.setIsForbidden(l), at(t, e)) {
2911
+ const l = !me(r.draggedNode, o.value, s);
2912
+ if (n.setIsForbidden(l), ct(t, e)) {
2881
2913
  n.pointInsideTop(e);
2882
2914
  return;
2883
2915
  }
2884
2916
  n.pointInside(e);
2885
- }, on = (t, e, r) => {
2886
- if (Y(r.craftNode.value)) {
2887
- nn(t, e, r);
2917
+ }, cn = (t, e, r) => {
2918
+ if (W(r.craftNode.value)) {
2919
+ un(t, e, r);
2888
2920
  return;
2889
2921
  }
2890
- lt(t, e, r);
2891
- }, ut = (t, e, r, n) => {
2892
- if (!Ce(
2922
+ pt(t, e, r);
2923
+ }, ft = (t, e, r, n) => {
2924
+ if (!_e(
2893
2925
  r,
2894
2926
  n.craftNode.value,
2895
2927
  n.resolver
@@ -2899,52 +2931,52 @@ Error:`,
2899
2931
  if (!o)
2900
2932
  return n.craftNode.value;
2901
2933
  const s = Object.values(o.slots || {}).flat().find((a) => a.uuid === n.craftNode.value.uuid);
2902
- return !s || s.uuid === r.uuid || (st(t, e) ? n.editor.insertNodeBefore(r, s) : n.editor.insertNodeAfter(r, s)), n.craftNode.value;
2903
- }, ct = (t, e, r, n) => {
2934
+ return !s || s.uuid === r.uuid || (ut(t, e) ? n.editor.insertNodeBefore(r, s) : n.editor.insertNodeAfter(r, s)), n.craftNode.value;
2935
+ }, ht = (t, e, r, n) => {
2904
2936
  const { editor: o, resolver: s, craftNode: a } = n, i = t.target, l = o.nodeMap.get(i.id);
2905
- if (l && Y(l))
2906
- return ct(t, e, r, {
2937
+ if (l && W(l))
2938
+ return ht(t, e, r, {
2907
2939
  ...n,
2908
- craftNode: H(l)
2940
+ craftNode: K(l)
2909
2941
  }), n.craftNode.value;
2910
2942
  const u = i.closest(".v-craft-drop-text");
2911
- let p = "default";
2943
+ let d = "default";
2912
2944
  if (u) {
2913
2945
  const m = u.getAttribute("data-slot-name");
2914
- m && (p = m);
2946
+ m && (d = m);
2915
2947
  } else {
2916
- if (it(t, e))
2917
- return ut(t, e, r, n);
2948
+ if (dt(t, e))
2949
+ return ft(t, e, r, n);
2918
2950
  const m = n.craftNode.value.slots || {}, f = Object.keys(m);
2919
- p = f.length > 0 ? f[0] : "default";
2951
+ d = f.length > 0 ? f[0] : "default";
2920
2952
  }
2921
- return fe(
2953
+ return me(
2922
2954
  r,
2923
2955
  n.craftNode.value,
2924
2956
  n.resolver
2925
- ) && (at(t, e) ? n.editor.prependNodeTo(
2957
+ ) && (ct(t, e) ? n.editor.prependNodeTo(
2926
2958
  r,
2927
2959
  n.craftNode.value,
2928
- p
2929
- ) : n.editor.appendNodeTo(r, n.craftNode.value, p)), n.craftNode.value;
2930
- }, sn = (t, e, r) => {
2960
+ d
2961
+ ) : n.editor.appendNodeTo(r, n.craftNode.value, d)), n.craftNode.value;
2962
+ }, dn = (t, e, r) => {
2931
2963
  if (!r.editor.draggedNode)
2932
2964
  return r.craftNode.value;
2933
2965
  const n = (() => {
2934
2966
  let o;
2935
- return r.editor.draggedNode?.uuid ? o = JSON.parse(JSON.stringify(r.editor.draggedNode)) : o = Je(
2967
+ return r.editor.draggedNode?.uuid ? o = JSON.parse(JSON.stringify(r.editor.draggedNode)) : o = nt(
2936
2968
  JSON.parse(JSON.stringify(r.editor.draggedNode))
2937
- ), et(o, r.resolver);
2969
+ ), ot(o, r.resolver);
2938
2970
  })();
2939
- return Y(r.craftNode.value) ? ct(t, e, n, r) : ut(t, e, n, r);
2940
- }, Ke = {
2941
- handleDragOver: on,
2942
- handleDrop: sn
2943
- }, an = (t, e, r) => {
2944
- const n = V(), o = Re(), s = (u) => {
2971
+ return W(r.craftNode.value) ? ht(t, e, n, r) : ft(t, e, n, r);
2972
+ }, qe = {
2973
+ handleDragOver: cn,
2974
+ handleDrop: dn
2975
+ }, pn = (t, e, r) => {
2976
+ const n = q(), o = je(), s = (u) => {
2945
2977
  n.enabled && n.dragNode(t.value);
2946
- }, a = Qe((u) => {
2947
- n.enabled && e.value?.$el && Ke.handleDragOver(u, e.value.$el, {
2978
+ }, a = Je((u) => {
2979
+ n.enabled && e.value?.$el && qe.handleDragOver(u, e.value.$el, {
2948
2980
  editor: n,
2949
2981
  indicator: o,
2950
2982
  craftNode: t,
@@ -2955,7 +2987,7 @@ Error:`,
2955
2987
  handleDragStart: s,
2956
2988
  handleDragOver: a,
2957
2989
  handleDrop: (u) => {
2958
- n.enabled && e.value?.$el && Ke.handleDrop(u, e.value.$el, {
2990
+ n.enabled && e.value?.$el && qe.handleDrop(u, e.value.$el, {
2959
2991
  editor: n,
2960
2992
  indicator: o,
2961
2993
  craftNode: t,
@@ -2966,7 +2998,7 @@ Error:`,
2966
2998
  n.enabled && n.dragNode(null);
2967
2999
  }
2968
3000
  };
2969
- }, ln = ["data-slot-name"], un = { class: "v-craft-slot-name" }, cn = /* @__PURE__ */ j({
3001
+ }, fn = ["data-slot-name"], hn = { class: "v-craft-slot-name" }, vn = /* @__PURE__ */ L({
2970
3002
  name: "CraftNodeEditor",
2971
3003
  __name: "CraftNodeEditor",
2972
3004
  props: {
@@ -2974,143 +3006,161 @@ Error:`,
2974
3006
  context: {}
2975
3007
  },
2976
3008
  setup(t) {
2977
- const e = t, { craftNode: r } = me(e), { editor: n, visible: o } = ot(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } = Ee(r, () => e.context || {}), u = (k, $ = {}, L) => {
2978
- const re = a?.value?.getSlotsProps?.(r.value)?.[k], K = re ? Object.fromEntries(
2979
- re.filter((X) => X in $).map((X) => [X, $[X]])
2980
- ) : $, ue = {
3009
+ const e = t, { craftNode: r } = be(e), { editor: n, visible: o } = lt(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } = Pe(r, () => e.context || {}), u = (x, D = {}, F) => {
3010
+ const Z = a?.value?.getSlotsProps?.(r.value)?.[x], z = Z ? Object.fromEntries(
3011
+ Z.filter((Y) => Y in D).map((Y) => [Y, D[Y]])
3012
+ ) : D, pe = {
2981
3013
  ...e.context || {},
2982
- [k]: K
3014
+ [x]: z
2983
3015
  };
2984
- return L !== void 0 && (ue.data = L), ue;
3016
+ return F !== void 0 && (pe.data = F), pe;
2985
3017
  };
2986
- J(
3018
+ ne(
2987
3019
  a,
2988
- (k) => {
2989
- k && W("resolver", a);
3020
+ (x) => {
3021
+ x && te("resolver", a);
2990
3022
  },
2991
3023
  { immediate: !0 }
2992
3024
  );
2993
- const p = H(null), m = H(null), f = N(() => n?.nodeDataMap[r.value.uuid]), { isSelected: h, isDraggable: y, selectNode: x } = rn(
3025
+ const d = K(null), m = K(null), f = C(() => n?.nodeDataMap[r.value.uuid]), { isSelected: h, isDraggable: b, selectNode: P } = ln(
2994
3026
  r.value,
2995
- p
2996
- ), { handleDragStart: P, handleDragOver: g, handleDrop: E, handleDragEnd: b } = an(r, p, a.value), { eventHandlers: O } = Ie(
3027
+ d
3028
+ ), { handleDragStart: A, handleDragOver: T, handleDrop: U, handleDragEnd: _ } = pn(r, d, a.value), { eventHandlers: g } = Be(
2997
3029
  r,
2998
3030
  n?.eventsContext || {},
2999
- () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
3000
- (k) => n?.nodeMap[k] ?? null
3001
- ), C = N(() => {
3002
- const k = a?.value?.resolve(r.value.componentName);
3003
- return k?.label ? k.label : Y(r.value) ? r.value.props.componentName : k?.componentName || r.value.componentName;
3004
- }), I = N(() => rt(r.value.uuid)), R = () => {
3005
- const $ = (m.value?.ownerDocument ?? p.value?.$el?.ownerDocument ?? document).querySelector(
3031
+ {
3032
+ getNodes: () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
3033
+ getNode: (x) => n?.nodeMap.get(x) ?? null,
3034
+ nodeValues: n?.nodeRuntimeProps,
3035
+ setNodeProps: (x, D) => n?.setNodeRuntimeProps(x, D),
3036
+ state: n?.pageState
3037
+ }
3038
+ ), w = C(() => n?.nodeRuntimeProps[r.value.uuid] || {}), y = (x) => {
3039
+ n?.setNodeRuntimeProps(r.value.uuid, { value: x });
3040
+ }, N = C(() => {
3041
+ const x = (D, F) => (...Z) => {
3042
+ F(...Z), g.value[D]?.(...Z);
3043
+ };
3044
+ return {
3045
+ ...g.value,
3046
+ input: x("input", (D) => y(D?.target?.value)),
3047
+ change: x("change", (D) => y(D?.target?.value)),
3048
+ "update:modelValue": x("update:modelValue", (D) => y(D))
3049
+ };
3050
+ }), S = C(() => {
3051
+ const x = a?.value?.resolve(r.value.componentName);
3052
+ return x?.label ? x.label : W(r.value) ? r.value.props.componentName : x?.componentName || r.value.componentName;
3053
+ }), I = C(() => at(r.value.uuid)), X = () => {
3054
+ const D = (m.value?.ownerDocument ?? d.value?.$el?.ownerDocument ?? document).querySelector(
3006
3055
  `[data-craft-uuid="${r.value.uuid}"]`
3007
3056
  );
3008
- if ($) return $;
3009
- let L = p.value?.$el;
3010
- for (; L && !(L instanceof HTMLElement); )
3011
- L = L.nextElementSibling ?? null;
3012
- return L ?? null;
3013
- }, ie = (k, $, L) => {
3014
- if (!(k instanceof Element)) {
3015
- console.error("resolveNodeEl returned a non-Element:", k);
3057
+ if (D) return D;
3058
+ let F = d.value?.$el;
3059
+ for (; F && !(F instanceof HTMLElement); )
3060
+ F = F.nextElementSibling ?? null;
3061
+ return F ?? null;
3062
+ }, ce = (x, D, F) => {
3063
+ if (!(x instanceof Element)) {
3064
+ console.error("resolveNodeEl returned a non-Element:", x);
3016
3065
  return;
3017
3066
  }
3018
- k.style.setProperty("--node-name", $), k.style.setProperty("--node-color", L), k.setAttribute("data-node-name", $);
3019
- }, le = () => {
3020
- const k = R();
3021
- k && (m.value = k, ie(k, C.value ?? "(n/a)", I.value));
3067
+ x.style.setProperty("--node-name", D), x.style.setProperty("--node-color", F), x.setAttribute("data-node-name", D);
3068
+ }, de = () => {
3069
+ const x = X();
3070
+ x && (m.value = x, ce(x, S.value ?? "(n/a)", I.value));
3022
3071
  };
3023
- Ne(() => pe(le)), Ot(() => pe(le)), J([C, I], () => {
3024
- m.value && ie(m.value, C.value ?? "", I.value);
3072
+ xe(() => ve(de)), kt(() => ve(de)), ne([S, I], () => {
3073
+ m.value && ce(m.value, S.value ?? "", I.value);
3025
3074
  });
3026
- const dt = N(() => {
3027
- const $ = a?.value?.resolveNode?.(r.value)?.slots;
3028
- return $ && $.length > 0 ? $ : ["default"];
3029
- }), pt = N(() => Y(r.value) ? !0 : Object.values(r.value.slots || {}).some(
3030
- (k) => k.length > 0
3031
- )), ft = () => x(), ht = (k, $) => f.value ? f.value.slotName && f.value.slotName !== $ ? [] : vt(f.value, k) : [], vt = (k, $) => k.type === "single" ? $.map((L) => ({
3032
- key: `${L.uuid}-single`,
3075
+ const vt = C(() => {
3076
+ const D = a?.value?.resolveNode?.(r.value)?.slots;
3077
+ return D && D.length > 0 ? D : ["default"];
3078
+ }), mt = C(() => W(r.value) ? !0 : Object.values(r.value.slots || {}).some(
3079
+ (x) => x.length > 0
3080
+ )), gt = () => P(), yt = (x, D) => f.value ? f.value.slotName && f.value.slotName !== D ? [] : bt(f.value, x) : [], bt = (x, D) => x.type === "single" ? D.map((F) => ({
3081
+ key: `${F.uuid}-single`,
3033
3082
  craftNode: {
3034
- ...L,
3035
- props: { ...L.props, ...k.item || {} }
3083
+ ...F,
3084
+ props: { ...F.props, ...x.item || {} }
3036
3085
  },
3037
- dataItem: k.item || {}
3038
- })) : k.type === "list" ? k.list ? $.reduce((L, re) => L.concat(
3039
- k.list.map((K, ue) => ({
3040
- key: `${re.uuid}-data-${ue}`,
3086
+ dataItem: x.item || {}
3087
+ })) : x.type === "list" ? x.list ? D.reduce((F, Z) => F.concat(
3088
+ x.list.map((z, pe) => ({
3089
+ key: `${Z.uuid}-data-${pe}`,
3041
3090
  craftNode: {
3042
- ...re,
3043
- props: { ...re.props, ...K || {} }
3091
+ ...Z,
3092
+ props: { ...Z.props, ...z || {} }
3044
3093
  },
3045
- dataItem: K || {}
3094
+ dataItem: z || {}
3046
3095
  }))
3047
3096
  ), []) : [] : [];
3048
- return (k, $) => {
3049
- const L = B("CraftNodeViewer"), re = B("CraftNodeEditor", !0);
3050
- return d(o) && d(r) && d(s) ? (v(), A(ye(d(i)), _e({
3097
+ return (x, D) => {
3098
+ const F = H("CraftNodeViewer"), Z = H("CraftNodeEditor", !0);
3099
+ return p(o) && p(r) && p(s) ? (v(), M(Ce(p(i)), Se({
3051
3100
  key: 0,
3052
3101
  ref_key: "nodeRef",
3053
- ref: p
3102
+ ref: d
3054
3103
  }, {
3055
- ...d(l),
3056
- "data-craft-uuid": d(r).uuid
3057
- }, $e(d(O)), {
3104
+ ...p(l),
3105
+ ...w.value,
3106
+ "data-craft-uuid": p(r).uuid
3107
+ }, Ue(N.value), {
3058
3108
  class: {
3059
- "v-craft-node-selected": d(h),
3060
- "v-craft-node": d(n)?.enabled,
3061
- "v-craft-canvas": d(Y)(d(r)),
3062
- "v-craft-empty": !d(r).slots || Object.keys(d(r).slots).length === 0 || Object.values(d(r).slots).every((K) => K.length === 0),
3063
- "v-craft-other-node-dragged": d(n)?.draggedNode && !d(Ze)(d(n).draggedNode, d(r))
3109
+ "v-craft-node-selected": p(h),
3110
+ "v-craft-node": p(n)?.enabled,
3111
+ "v-craft-canvas": p(W)(p(r)),
3112
+ "v-craft-empty": !p(r).slots || Object.keys(p(r).slots).length === 0 || Object.values(p(r).slots).every((z) => z.length === 0),
3113
+ "v-craft-other-node-dragged": p(n)?.draggedNode && !p(rt)(p(n).draggedNode, p(r))
3064
3114
  },
3065
- draggable: d(n)?.enabled && d(y),
3066
- onClick: F(ft, ["prevent", "stop"]),
3067
- onDragend: F(d(b), ["prevent", "stop"]),
3068
- onDragover: F(d(g), ["prevent", "stop"]),
3069
- onDragstart: F(d(P), ["stop"]),
3070
- onDrop: F(d(E), ["prevent", "stop"])
3071
- }), be({ _: 2 }, [
3072
- T(dt.value, (K) => ({
3073
- name: K,
3074
- fn: q((ue) => [
3075
- d(Y)(d(r)) && (!d(r).slots || d(r).slots[K]?.length == 0) ? (v(), _("div", {
3115
+ draggable: p(n)?.enabled && p(b),
3116
+ onClick: V(gt, ["prevent", "stop"]),
3117
+ onDragend: V(p(_), ["prevent", "stop"]),
3118
+ onDragover: V(p(T), ["prevent", "stop"]),
3119
+ onDragstart: V(p(A), ["stop"]),
3120
+ onDrop: V(p(U), ["prevent", "stop"])
3121
+ }), Ne({ _: 2 }, [
3122
+ j(vt.value, (z) => ({
3123
+ name: z,
3124
+ fn: G((pe) => [
3125
+ p(W)(p(r)) && (!p(r).slots || p(r).slots[z]?.length == 0) ? (v(), E("div", {
3076
3126
  key: 0,
3077
3127
  class: "v-craft-drop-text",
3078
- "data-slot-name": K,
3079
- onDragover: $[0] || ($[0] = F(
3128
+ "data-slot-name": z,
3129
+ onDragover: D[0] || (D[0] = V(
3080
3130
  //@ts-ignore
3081
- (...X) => d(g) && d(g)(...X),
3131
+ (...Y) => p(T) && p(T)(...Y),
3082
3132
  ["prevent", "stop"]
3083
3133
  )),
3084
- onDrop: $[1] || ($[1] = F(
3134
+ onDrop: D[1] || (D[1] = V(
3085
3135
  //@ts-ignore
3086
- (...X) => d(E) && d(E)(...X),
3136
+ (...Y) => p(U) && p(U)(...Y),
3087
3137
  ["prevent", "stop"]
3088
3138
  ))
3089
3139
  }, [
3090
- $[2] || ($[2] = w("span", { class: "v-craft-drop-text-label" }, "Drop a component here", -1)),
3091
- w("span", un, ee(K), 1)
3092
- ], 40, ln)) : D("", !0),
3093
- pt.value ? (v(), _(U, { key: 1 }, [
3094
- f.value?.type && (!f.value.slotName || f.value.slotName === K) ? (v(!0), _(U, { key: 0 }, T(ht(
3095
- d(r).slots?.[K] || [],
3096
- K
3097
- ), (X) => (v(), A(L, {
3098
- key: X.key,
3099
- craftNode: X.craftNode,
3100
- context: u(K, ue, X.dataItem)
3101
- }, null, 8, ["craftNode", "context"]))), 128)) : D("", !0),
3102
- (v(!0), _(U, null, T(d(r).slots?.[K] || [], (X) => (v(), A(re, {
3103
- key: X.uuid,
3104
- craftNode: X,
3105
- context: u(K, ue)
3140
+ D[2] || (D[2] = O("span", { class: "v-craft-drop-text-label" }, "Drop a component here", -1)),
3141
+ O("span", hn, oe(z), 1)
3142
+ ], 40, fn)) : R("", !0),
3143
+ mt.value ? (v(), E(B, { key: 1 }, [
3144
+ f.value?.type && (!f.value.slotName || f.value.slotName === z) ? (v(!0), E(B, { key: 0 }, j(yt(
3145
+ p(r).slots?.[z] || [],
3146
+ z
3147
+ ), (Y) => (v(), M(F, {
3148
+ key: Y.key,
3149
+ craftNode: Y.craftNode,
3150
+ context: u(z, pe, Y.dataItem)
3151
+ }, null, 8, ["craftNode", "context"]))), 128)) : R("", !0),
3152
+ (v(!0), E(B, null, j(p(r).slots?.[z] || [], (Y) => (v(), M(Z, {
3153
+ key: Y.uuid,
3154
+ craftNode: Y,
3155
+ context: u(z, pe)
3106
3156
  }, null, 8, ["craftNode", "context"]))), 128))
3107
- ], 64)) : D("", !0)
3157
+ ], 64)) : R("", !0)
3108
3158
  ])
3109
3159
  }))
3110
- ]), 1040, ["class", "draggable", "onDragend", "onDragover", "onDragstart", "onDrop"])) : D("", !0);
3160
+ ]), 1040, ["class", "draggable", "onDragend", "onDragover", "onDragstart", "onDrop"])) : R("", !0);
3111
3161
  };
3112
3162
  }
3113
- }), ke = /* @__PURE__ */ j({
3163
+ }), Me = /* @__PURE__ */ L({
3114
3164
  name: "CraftNodeViewer",
3115
3165
  __name: "CraftNodeViewer",
3116
3166
  props: {
@@ -3120,77 +3170,94 @@ Error:`,
3120
3170
  context: {}
3121
3171
  },
3122
3172
  setup(t) {
3123
- const e = t, r = de(e, "craftNode"), { editor: n, visible: o } = ot(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } = Ee(r, () => e.context || {});
3124
- W("resolver", a);
3125
- const u = (b, O = {}, C) => {
3126
- const I = a?.value?.getSlotsProps?.(r.value)?.[b], R = I ? Object.fromEntries(
3127
- I.filter((le) => le in O).map((le) => [le, O[le]])
3128
- ) : O, ie = {
3173
+ const e = t, r = he(e, "craftNode"), { editor: n, visible: o } = lt(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } = Pe(r, () => e.context || {});
3174
+ te("resolver", a);
3175
+ const u = (y, N = {}, S) => {
3176
+ const I = a?.value?.getSlotsProps?.(r.value)?.[y], X = I ? Object.fromEntries(
3177
+ I.filter((de) => de in N).map((de) => [de, N[de]])
3178
+ ) : N, ce = {
3129
3179
  ...e.context || {},
3130
- [b]: R
3180
+ [y]: X
3131
3181
  };
3132
- return C !== void 0 && (ie.data = C), ie;
3133
- }, p = N(() => e.nodeDataMap?.[r.value.uuid] || n?.nodeDataMap?.[r.value.uuid]), m = N(() => r.value.slots || {}), f = N(() => Y(r.value)), h = N(() => {
3134
- if (!y.value)
3182
+ return S !== void 0 && (ce.data = S), ce;
3183
+ }, d = C(() => e.nodeDataMap?.[r.value.uuid] || n?.nodeDataMap?.[r.value.uuid]), m = C(() => r.value.slots || {}), f = C(() => W(r.value)), h = C(() => {
3184
+ if (!b.value)
3135
3185
  return [];
3136
- const b = [], C = a?.value?.resolveNode?.(r.value)?.slots;
3137
- return C && C.length > 0 ? b.push(...C) : b.push("default"), b;
3138
- }), y = N(() => f.value ? !0 : Object.values(m.value).some((b) => b.length > 0)), x = (b, O) => p.value ? p.value.slotName && p.value.slotName !== O ? [] : E(p.value, b) : [], P = H(null), { eventHandlers: g } = Ie(
3186
+ const y = [], S = a?.value?.resolveNode?.(r.value)?.slots;
3187
+ return S && S.length > 0 ? y.push(...S) : y.push("default"), y;
3188
+ }), b = C(() => f.value ? !0 : Object.values(m.value).some((y) => y.length > 0)), P = (y, N) => d.value ? d.value.slotName && d.value.slotName !== N ? [] : w(d.value, y) : [], A = K(null), { eventHandlers: T } = Be(
3139
3189
  r,
3140
3190
  e.eventsContext || n?.eventsContext || {},
3141
- () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
3142
- (b) => n?.nodeMap[b] ?? null
3143
- );
3144
- Ne(() => {
3145
- P.value && r.value && n && n.setNodeRef(r.value, P.value);
3191
+ {
3192
+ getNodes: () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
3193
+ getNode: (y) => n?.nodeMap.get(y) ?? null,
3194
+ nodeValues: n?.nodeRuntimeProps,
3195
+ setNodeProps: (y, N) => n?.setNodeRuntimeProps(y, N),
3196
+ state: n?.pageState
3197
+ }
3198
+ ), U = C(() => n?.nodeRuntimeProps[r.value.uuid] || {}), _ = (y) => {
3199
+ n?.setNodeRuntimeProps(r.value.uuid, { value: y });
3200
+ }, g = C(() => {
3201
+ const y = (N, S) => (...I) => {
3202
+ S(...I), T.value[N]?.(...I);
3203
+ };
3204
+ return {
3205
+ ...T.value,
3206
+ input: y("input", (N) => _(N?.target?.value)),
3207
+ change: y("change", (N) => _(N?.target?.value)),
3208
+ "update:modelValue": y("update:modelValue", (N) => _(N))
3209
+ };
3210
+ });
3211
+ xe(() => {
3212
+ A.value && r.value && n && n.setNodeRef(r.value, A.value);
3146
3213
  });
3147
- const E = (b, O) => b.type === "single" ? O.map((C) => ({
3148
- key: `${C.uuid}-single`,
3214
+ const w = (y, N) => y.type === "single" ? N.map((S) => ({
3215
+ key: `${S.uuid}-single`,
3149
3216
  craftNode: {
3150
- ...C,
3217
+ ...S,
3151
3218
  props: {
3152
- ...C.props,
3153
- ...b.item || {}
3219
+ ...S.props,
3220
+ ...y.item || {}
3154
3221
  }
3155
3222
  },
3156
- dataItem: b.item || {}
3157
- })) : b.type === "list" ? b.list ? O.reduce((C, I) => C.concat(
3223
+ dataItem: y.item || {}
3224
+ })) : y.type === "list" ? y.list ? N.reduce((S, I) => S.concat(
3158
3225
  //@ts-ignore
3159
- b.list.map((R, ie) => ({
3160
- key: `${I.uuid}-data-${ie}`,
3226
+ y.list.map((X, ce) => ({
3227
+ key: `${I.uuid}-data-${ce}`,
3161
3228
  craftNode: {
3162
3229
  ...I,
3163
3230
  props: {
3164
3231
  ...I.props,
3165
- ...R || {}
3232
+ ...X || {}
3166
3233
  }
3167
3234
  }
3168
3235
  }))
3169
3236
  ), []) : [] : [];
3170
- return (b, O) => d(o) && d(a) && d(s) ? (v(), A(ye(d(i)), _e({
3237
+ return (y, N) => p(o) && p(a) && p(s) ? (v(), M(Ce(p(i)), Se({
3171
3238
  key: 0,
3172
3239
  ref_key: "nodeRef",
3173
- ref: P
3174
- }, d(l), $e(d(g))), be({ _: 2 }, [
3175
- T(h.value, (C) => ({
3176
- name: C,
3177
- fn: q((I) => [
3178
- y.value ? (v(), _(U, { key: 0 }, [
3179
- p.value?.type ? (v(!0), _(U, { key: 1 }, T(x(m.value[C], C), (R) => (v(), A(ke, {
3180
- key: R.key,
3181
- craftNode: R.craftNode,
3182
- context: u(C, I, R.dataItem)
3183
- }, null, 8, ["craftNode", "context"]))), 128)) : (v(!0), _(U, { key: 0 }, T(m.value[C], (R) => (v(), A(ke, {
3184
- key: R.uuid,
3185
- craftNode: R,
3186
- context: u(C, I)
3240
+ ref: A
3241
+ }, { ...p(l), ...U.value }, Ue(g.value)), Ne({ _: 2 }, [
3242
+ j(h.value, (S) => ({
3243
+ name: S,
3244
+ fn: G((I) => [
3245
+ b.value ? (v(), E(B, { key: 0 }, [
3246
+ d.value?.type ? (v(!0), E(B, { key: 1 }, j(P(m.value[S], S), (X) => (v(), M(Me, {
3247
+ key: X.key,
3248
+ craftNode: X.craftNode,
3249
+ context: u(S, I, X.dataItem)
3250
+ }, null, 8, ["craftNode", "context"]))), 128)) : (v(!0), E(B, { key: 0 }, j(m.value[S], (X) => (v(), M(Me, {
3251
+ key: X.uuid,
3252
+ craftNode: X,
3253
+ context: u(S, I)
3187
3254
  }, null, 8, ["craftNode", "context"]))), 128))
3188
- ], 64)) : D("", !0)
3255
+ ], 64)) : R("", !0)
3189
3256
  ])
3190
3257
  }))
3191
- ]), 1040)) : D("", !0);
3258
+ ]), 1040)) : R("", !0);
3192
3259
  }
3193
- }), De = /* @__PURE__ */ j({
3260
+ }), $e = /* @__PURE__ */ L({
3194
3261
  name: "CraftNodeStatic",
3195
3262
  __name: "CraftNodeStatic",
3196
3263
  props: {
@@ -3198,80 +3265,106 @@ Error:`,
3198
3265
  nodeMap: {},
3199
3266
  nodeDataMap: {},
3200
3267
  eventsContext: {},
3268
+ nodeRuntimeProps: {},
3269
+ pageState: {},
3201
3270
  context: {}
3202
3271
  },
3203
3272
  setup(t) {
3204
- const e = t, { craftNode: r, nodeMap: n } = me(e), { resolvedNode: o, resolver: s, componentToRender: a, props: i } = Ee(r, () => e.context || {});
3205
- W("resolver", s), W("craftNode", qe(r.value));
3206
- const l = (g, E = {}, b) => {
3207
- const O = s?.value?.getSlotsProps?.(r.value)?.[g], C = O ? Object.fromEntries(
3208
- O.filter((R) => R in E).map((R) => [R, E[R]])
3209
- ) : E, I = {
3273
+ const e = t, { craftNode: r, nodeMap: n } = be(e), { resolvedNode: o, resolver: s, componentToRender: a, props: i } = Pe(r, () => e.context || {});
3274
+ te("resolver", s), te("craftNode", We(r.value));
3275
+ const l = (g, w = {}, y) => {
3276
+ const N = s?.value?.getSlotsProps?.(r.value)?.[g], S = N ? Object.fromEntries(
3277
+ N.filter((X) => X in w).map((X) => [X, w[X]])
3278
+ ) : w, I = {
3210
3279
  ...e.context || {},
3211
- [g]: C
3280
+ [g]: S
3212
3281
  };
3213
- return b !== void 0 && (I.data = b), I;
3214
- }, u = N(() => e.nodeDataMap?.[r.value.uuid] || null), p = N(() => r.value.slots || {}), m = N(() => Y(r.value)), f = N(() => {
3282
+ return y !== void 0 && (I.data = y), I;
3283
+ }, u = C(() => e.nodeDataMap?.[r.value.uuid] || null), d = C(() => r.value.slots || {}), m = C(() => W(r.value)), f = C(() => {
3215
3284
  if (!h.value)
3216
3285
  return [];
3217
- const g = [], b = s?.value?.resolveNode?.(r.value)?.slots;
3218
- return b && b.length > 0 ? g.push(...b) : g.push("default"), g;
3219
- }), h = N(() => m.value ? !0 : Object.values(p.value).some((g) => g.length > 0)), y = (g, E) => u.value ? u.value.slotName && u.value.slotName !== E ? [] : P(u.value, g) : [], { eventHandlers: x } = Ie(
3286
+ const g = [], y = s?.value?.resolveNode?.(r.value)?.slots;
3287
+ return y && y.length > 0 ? g.push(...y) : g.push("default"), g;
3288
+ }), h = C(() => m.value ? !0 : Object.values(d.value).some((g) => g.length > 0)), b = (g, w) => u.value ? u.value.slotName && u.value.slotName !== w ? [] : _(u.value, g) : [], P = (g, w) => {
3289
+ e.nodeRuntimeProps && (e.nodeRuntimeProps[g] = { ...e.nodeRuntimeProps[g] || {}, ...w });
3290
+ }, { eventHandlers: A } = Be(
3220
3291
  r,
3221
3292
  e.eventsContext || {},
3222
- () => Object.fromEntries(n.value.entries()),
3223
- (g) => n.value[g] ?? null
3224
- ), P = (g, E) => g.type === "single" ? E.map((b) => ({
3225
- key: `${b.uuid}-single`,
3293
+ {
3294
+ getNodes: () => Object.fromEntries(n.value.entries()),
3295
+ getNode: (g) => n.value.get(g) ?? null,
3296
+ nodeValues: e.nodeRuntimeProps,
3297
+ setNodeProps: P,
3298
+ state: e.pageState
3299
+ }
3300
+ ), T = C(() => ({
3301
+ ...i.value,
3302
+ ...e.nodeRuntimeProps?.[r.value.uuid] || {}
3303
+ })), U = C(() => {
3304
+ const g = (w, y) => (...N) => {
3305
+ y(...N), A.value[w]?.(...N);
3306
+ };
3307
+ return {
3308
+ ...A.value,
3309
+ input: g("input", (w) => P(r.value.uuid, { value: w?.target?.value })),
3310
+ change: g("change", (w) => P(r.value.uuid, { value: w?.target?.value })),
3311
+ "update:modelValue": g("update:modelValue", (w) => P(r.value.uuid, { value: w }))
3312
+ };
3313
+ }), _ = (g, w) => g.type === "single" ? w.map((y) => ({
3314
+ key: `${y.uuid}-single`,
3226
3315
  craftNode: {
3227
- ...b,
3316
+ ...y,
3228
3317
  props: {
3229
- ...b.props,
3318
+ ...y.props,
3230
3319
  ...g.item || {}
3231
3320
  }
3232
3321
  },
3233
3322
  dataItem: g.item || {}
3234
- })) : g.type === "list" ? g.list ? E.reduce((b, O) => b.concat(
3323
+ })) : g.type === "list" ? g.list ? w.reduce((y, N) => y.concat(
3235
3324
  //@ts-ignore
3236
- g.list.map((C, I) => ({
3237
- key: `${O.uuid}-data-${I}`,
3325
+ g.list.map((S, I) => ({
3326
+ key: `${N.uuid}-data-${I}`,
3238
3327
  craftNode: {
3239
- ...O,
3328
+ ...N,
3240
3329
  props: {
3241
- ...O.props,
3242
- ...C || {}
3330
+ ...N.props,
3331
+ ...S || {}
3243
3332
  }
3244
3333
  },
3245
- dataItem: C || {}
3334
+ dataItem: S || {}
3246
3335
  }))
3247
3336
  ), []) : [] : [];
3248
- return (g, E) => (d(r).visible || d(r).visible === void 0) && d(s) && d(o) ? (v(), A(ye(d(a)), _e({
3337
+ return (g, w) => (p(r).visible || p(r).visible === void 0) && p(s) && p(o) ? (v(), M(Ce(p(a)), Se({
3249
3338
  key: 0,
3250
3339
  ref: "nodeRef"
3251
- }, d(i), $e(d(x))), be({ _: 2 }, [
3252
- T(f.value, (b) => ({
3253
- name: b,
3254
- fn: q((O) => [
3255
- u.value?.type ? (v(!0), _(U, { key: 1 }, T(y(p.value[b], b), (C) => (v(), A(De, {
3256
- key: C.key,
3257
- craftNode: C.craftNode,
3258
- nodeMap: d(n),
3340
+ }, T.value, Ue(U.value)), Ne({ _: 2 }, [
3341
+ j(f.value, (y) => ({
3342
+ name: y,
3343
+ fn: G((N) => [
3344
+ u.value?.type ? (v(!0), E(B, { key: 1 }, j(b(d.value[y], y), (S) => (v(), M($e, {
3345
+ key: S.key,
3346
+ craftNode: S.craftNode,
3347
+ nodeMap: p(n),
3259
3348
  nodeDataMap: t.nodeDataMap,
3260
3349
  eventsContext: t.eventsContext,
3261
- context: l(b, O, C.dataItem)
3262
- }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "context"]))), 128)) : (v(!0), _(U, { key: 0 }, T(p.value[b], (C) => (v(), A(De, {
3263
- key: C.uuid,
3264
- craftNode: C,
3265
- nodeMap: d(n),
3350
+ nodeRuntimeProps: t.nodeRuntimeProps,
3351
+ pageState: t.pageState,
3352
+ context: l(y, N, S.dataItem)
3353
+ }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "nodeRuntimeProps", "pageState", "context"]))), 128)) : (v(!0), E(B, { key: 0 }, j(d.value[y], (S) => (v(), M($e, {
3354
+ key: S.uuid,
3355
+ craftNode: S,
3356
+ nodeMap: p(n),
3266
3357
  nodeDataMap: t.nodeDataMap,
3267
3358
  eventsContext: t.eventsContext,
3268
- context: l(b, O)
3269
- }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "context"]))), 128))
3359
+ nodeRuntimeProps: t.nodeRuntimeProps,
3360
+ pageState: t.pageState,
3361
+ context: l(y, N)
3362
+ }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "nodeRuntimeProps", "pageState", "context"]))), 128))
3270
3363
  ])
3271
3364
  }))
3272
- ]), 1040)) : D("", !0);
3365
+ ]), 1040)) : R("", !0);
3273
3366
  }
3274
- }), dn = /* @__PURE__ */ j({
3367
+ }), mn = /* @__PURE__ */ L({
3275
3368
  name: "CraftStaticRenderer",
3276
3369
  __name: "CraftStaticRenderer",
3277
3370
  props: {
@@ -3282,48 +3375,52 @@ Error:`,
3282
3375
  eventsContext: {}
3283
3376
  },
3284
3377
  setup(t) {
3285
- const e = t, r = (s, a) => {
3286
- a.set(s.uuid, s), Object.entries(s.slots).forEach(([i, l]) => {
3287
- l?.forEach && l.forEach((u) => r(u, a));
3378
+ const e = t, r = (i, l) => {
3379
+ l.set(i.uuid, i), Object.entries(i.slots).forEach(([u, d]) => {
3380
+ d?.forEach && d.forEach((m) => r(m, l));
3288
3381
  });
3289
- }, n = N(() => {
3290
- const s = /* @__PURE__ */ new Map();
3291
- return e.nodes.forEach((a) => r(a, s)), s;
3292
- }), o = N(
3293
- () => e.resolver || new xe(e.resolverMap)
3382
+ }, n = C(() => {
3383
+ const i = /* @__PURE__ */ new Map();
3384
+ return e.nodes.forEach((l) => r(l, i)), i;
3385
+ }), o = C(
3386
+ () => e.resolver || new Oe(e.resolverMap)
3294
3387
  );
3295
- return W("resolver", o), W("nodeDataMap", e.nodeDataMap || {}), W("eventsContext", e.eventsContext || {}), (s, a) => (v(!0), _(U, null, T(t.nodes, (i) => (v(), A(De, {
3296
- key: i.uuid,
3297
- craftNode: i,
3388
+ te("resolver", o), te("nodeDataMap", e.nodeDataMap || {}), te("eventsContext", e.eventsContext || {});
3389
+ const s = He({}), a = He({});
3390
+ return (i, l) => (v(!0), E(B, null, j(t.nodes, (u) => (v(), M($e, {
3391
+ key: u.uuid,
3392
+ craftNode: u,
3298
3393
  nodeMap: n.value,
3299
3394
  nodeDataMap: t.nodeDataMap,
3300
- eventsContext: t.eventsContext
3301
- }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext"]))), 128));
3395
+ eventsContext: t.eventsContext,
3396
+ nodeRuntimeProps: s,
3397
+ pageState: a
3398
+ }, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "nodeRuntimeProps", "pageState"]))), 128));
3302
3399
  }
3303
- }), Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3400
+ }), Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3304
3401
  __proto__: null,
3305
- CraftCanvas: Vt,
3306
- CraftComponentSimpleText: Qt,
3307
- CraftEditor: Gt,
3308
- CraftEditorBlueprint: Wt,
3309
- CraftEditorBlueprintsList: nr,
3310
- CraftEditorPanelBlueprints: ir,
3311
- CraftEditorPanelForm: lr,
3312
- CraftEditorPanelLayers: fr,
3313
- CraftEditorPanelLayout: Er,
3314
- CraftEditorPanelNodeDataSourceSettings: xr,
3315
- CraftEditorPanelNodeEventsSettings: wr,
3316
- CraftEditorPanelNodeLayer: Ar,
3317
- CraftEditorPanelNodeSettings: $r,
3318
- CraftEditorPanelNodeSlotPropsSettings: Hr,
3319
- CraftEditorPanelSettings: Wr,
3320
- CraftFrame: tn,
3321
- CraftIframe: nt,
3322
- CraftNodeEditor: cn,
3323
- CraftNodeViewer: ke,
3324
- CraftStaticRenderer: dn,
3325
- Utils: Zt
3326
- }, Symbol.toStringTag, { value: "Module" })), Cn = {
3402
+ CraftCanvas: Qt,
3403
+ CraftComponentSimpleText: er,
3404
+ CraftEditor: tr,
3405
+ CraftEditorBlueprint: rr,
3406
+ CraftEditorBlueprintsList: lr,
3407
+ CraftEditorPanelBlueprints: pr,
3408
+ CraftEditorPanelForm: fr,
3409
+ CraftEditorPanelLayers: yr,
3410
+ CraftEditorPanelLayout: Sr,
3411
+ CraftEditorPanelNodeDataSourceSettings: kr,
3412
+ CraftEditorPanelNodeEventsSettings: Ar,
3413
+ CraftEditorPanelNodeLayer: Tr,
3414
+ CraftEditorPanelNodeSettings: jr,
3415
+ CraftEditorPanelNodeSlotPropsSettings: qr,
3416
+ CraftEditorPanelSettings: rn,
3417
+ CraftFrame: an,
3418
+ CraftIframe: it,
3419
+ CraftNodeEditor: vn,
3420
+ CraftNodeViewer: Me,
3421
+ CraftStaticRenderer: mn,
3422
+ Utils: nr
3423
+ }, Symbol.toStringTag, { value: "Module" })), xn = {
3327
3424
  metadata: {
3328
3425
  name: "default"
3329
3426
  },
@@ -3339,8 +3436,8 @@ Error:`,
3339
3436
  }
3340
3437
  }
3341
3438
  };
3342
- function _n() {
3343
- const t = H(null);
3439
+ function On() {
3440
+ const t = K(null);
3344
3441
  return { nodeEl: t, vNodeEl: {
3345
3442
  mounted(r) {
3346
3443
  t.value = r;
@@ -3353,27 +3450,27 @@ function _n() {
3353
3450
  }
3354
3451
  } };
3355
3452
  }
3356
- const Nn = (t, e, r) => {
3453
+ const wn = (t, e, r) => {
3357
3454
  const n = {
3358
3455
  type: e.type,
3359
3456
  item: e.type === "single" ? {} : void 0,
3360
3457
  list: e.type === "list" ? [] : void 0
3361
3458
  }, o = (a, i) => {
3362
3459
  let l = a;
3363
- return i.patchSource === "value" ? i.value ?? i.defaultValue ?? null : (i.patchSource === "child" && (l = r), (i.type === "single" ? S({ path: i.fromPath, json: l, resultType: "value" }) : S({ path: i.fromPath, json: l })) ?? i.defaultValue ?? null);
3364
- }, s = e.type === "single" ? S({ path: e.fromPath, json: t, resultType: "value" }) : S({ path: e.fromPath, json: t });
3460
+ return i.patchSource === "value" ? i.value ?? i.defaultValue ?? null : (i.patchSource === "child" && (l = r), (i.type === "single" ? k({ path: i.fromPath, json: l, resultType: "value" }) : k({ path: i.fromPath, json: l })) ?? i.defaultValue ?? null);
3461
+ }, s = e.type === "single" ? k({ path: e.fromPath, json: t, resultType: "value" }) : k({ path: e.fromPath, json: t });
3365
3462
  return e.type === "single" ? e.patches.forEach((a) => {
3366
3463
  const i = o(s, a);
3367
- Se(n.item, a.toPath, i);
3464
+ Ae(n.item, a.toPath, i);
3368
3465
  }) : e.type === "list" && (n.list = s.map((a) => {
3369
3466
  const i = {};
3370
3467
  return e.patches.forEach((l) => {
3371
3468
  const u = o(a, l);
3372
- Se(i, l.toPath, u);
3469
+ Ae(i, l.toPath, u);
3373
3470
  }), i;
3374
3471
  })), n;
3375
3472
  };
3376
- function pn(t, e) {
3473
+ function gn(t, e) {
3377
3474
  const r = {};
3378
3475
  return !t.events || !Object.keys(t.events).length || Object.entries(t.events).forEach(([n, o]) => {
3379
3476
  o?.trim() && (r[n] = (...s) => {
@@ -3396,7 +3493,7 @@ Error:`,
3396
3493
  });
3397
3494
  }), r;
3398
3495
  }
3399
- function fn(t, e, r = "default") {
3496
+ function yn(t, e, r = "default") {
3400
3497
  if (!t.slots || !t.slots[r]) return [];
3401
3498
  const n = t.slots[r];
3402
3499
  return e.type === "single" ? n.map((o) => ({
@@ -3411,20 +3508,20 @@ function fn(t, e, r = "default") {
3411
3508
  }))
3412
3509
  ) : [];
3413
3510
  }
3414
- function Ae(t, e, r, n, o) {
3415
- if (!We(t))
3511
+ function Ie(t, e, r, n, o) {
3512
+ if (!tt(t))
3416
3513
  return null;
3417
3514
  const s = e.resolveNode(t), a = s?.componentName || t.componentName, i = r?.[a] || a, l = {
3418
3515
  ...s?.defaultProps || {},
3419
3516
  ...t.props
3420
- }, u = o ? pn(t, o) : {}, p = n?.[t.uuid];
3517
+ }, u = o ? gn(t, o) : {}, d = n?.[t.uuid];
3421
3518
  let m;
3422
- return p?.type ? m = fn(
3519
+ return d?.type ? m = yn(
3423
3520
  t,
3424
- p,
3425
- p.slotName || "default"
3521
+ d,
3522
+ d.slotName || "default"
3426
3523
  ).map(
3427
- (h) => Ae(
3524
+ (h) => Ie(
3428
3525
  h,
3429
3526
  e,
3430
3527
  r,
@@ -3432,19 +3529,19 @@ function Ae(t, e, r, n, o) {
3432
3529
  o
3433
3530
  )
3434
3531
  ).filter((h) => h !== null) : t.slots && (m = Object.values(t.slots).flat().map(
3435
- (f) => Ae(
3532
+ (f) => Ie(
3436
3533
  f,
3437
3534
  e,
3438
3535
  r,
3439
3536
  n,
3440
3537
  o
3441
3538
  )
3442
- ).filter((f) => f !== null)), wt(i, { key: t.uuid, ...l, ...u }, m);
3539
+ ).filter((f) => f !== null)), Dt(i, { key: t.uuid, ...l, ...u }, m);
3443
3540
  }
3444
- function xn(t, e) {
3445
- const r = new xe(e.resolverMap);
3541
+ function kn(t, e) {
3542
+ const r = new Oe(e.resolverMap);
3446
3543
  return t.map(
3447
- (n) => Ae(
3544
+ (n) => Ie(
3448
3545
  n,
3449
3546
  r,
3450
3547
  e.componentRegistry,
@@ -3453,7 +3550,7 @@ function xn(t, e) {
3453
3550
  )
3454
3551
  ).filter((n) => n !== null);
3455
3552
  }
3456
- const On = {
3553
+ const Dn = {
3457
3554
  CraftComponentSimpleText: {
3458
3555
  componentName: "CraftComponentSimpleText",
3459
3556
  eventsSchema: {
@@ -3499,55 +3596,55 @@ const On = {
3499
3596
  CraftCanvas: {
3500
3597
  componentName: "CraftCanvas"
3501
3598
  }
3502
- }, hn = (t) => {
3503
- for (const e in Ve)
3504
- t.component(e, Ve[e]);
3505
- }, wn = { install: hn };
3599
+ }, bn = (t) => {
3600
+ for (const e in Ye)
3601
+ t.component(e, Ye[e]);
3602
+ }, An = { install: bn };
3506
3603
  export {
3507
- Vt as CraftCanvas,
3508
- Qt as CraftComponentSimpleText,
3509
- Gt as CraftEditor,
3510
- Wt as CraftEditorBlueprint,
3511
- nr as CraftEditorBlueprintsList,
3512
- ir as CraftEditorPanelBlueprints,
3513
- lr as CraftEditorPanelForm,
3514
- fr as CraftEditorPanelLayers,
3515
- Er as CraftEditorPanelLayout,
3516
- xr as CraftEditorPanelNodeDataSourceSettings,
3517
- wr as CraftEditorPanelNodeEventsSettings,
3518
- Ar as CraftEditorPanelNodeLayer,
3519
- $r as CraftEditorPanelNodeSettings,
3520
- Hr as CraftEditorPanelNodeSlotPropsSettings,
3521
- Wr as CraftEditorPanelSettings,
3522
- tn as CraftFrame,
3523
- nt as CraftIframe,
3524
- cn as CraftNodeEditor,
3525
- xe as CraftNodeResolver,
3526
- ke as CraftNodeViewer,
3527
- dn as CraftStaticRenderer,
3528
- Zt as Utils,
3529
- wn as VCraft,
3530
- Je as buildCraftNodeTree,
3531
- fe as craftNodeCanBeChildOf,
3532
- Ce as craftNodeCanBeSiblingOf,
3533
- zt as craftNodeInCanvas,
3534
- Ze as craftNodeIsAncestorOf,
3535
- Y as craftNodeIsCanvas,
3536
- qt as craftNodeIsDraggable,
3537
- Cn as defaultBlueprints,
3538
- On as defaultResolvers,
3539
- et as initializeSlotsFromResolver,
3540
- We as isVisible,
3541
- Nn as mapData,
3542
- Ae as renderCraftNodeToVNode,
3543
- xn as renderCraftNodesToVNodes,
3544
- ae as resolveNodeName,
3545
- Ir as useAncestorContextBuckets,
3546
- Xt as useCraftNode,
3547
- V as useEditor,
3548
- Re as useIndicator,
3549
- _n as useNodeElement,
3550
- Ee as useResolveCraftNode,
3551
- Ht as useResolveCraftNodeProps
3604
+ Qt as CraftCanvas,
3605
+ er as CraftComponentSimpleText,
3606
+ tr as CraftEditor,
3607
+ rr as CraftEditorBlueprint,
3608
+ lr as CraftEditorBlueprintsList,
3609
+ pr as CraftEditorPanelBlueprints,
3610
+ fr as CraftEditorPanelForm,
3611
+ yr as CraftEditorPanelLayers,
3612
+ Sr as CraftEditorPanelLayout,
3613
+ kr as CraftEditorPanelNodeDataSourceSettings,
3614
+ Ar as CraftEditorPanelNodeEventsSettings,
3615
+ Tr as CraftEditorPanelNodeLayer,
3616
+ jr as CraftEditorPanelNodeSettings,
3617
+ qr as CraftEditorPanelNodeSlotPropsSettings,
3618
+ rn as CraftEditorPanelSettings,
3619
+ an as CraftFrame,
3620
+ it as CraftIframe,
3621
+ vn as CraftNodeEditor,
3622
+ Oe as CraftNodeResolver,
3623
+ Me as CraftNodeViewer,
3624
+ mn as CraftStaticRenderer,
3625
+ nr as Utils,
3626
+ An as VCraft,
3627
+ nt as buildCraftNodeTree,
3628
+ me as craftNodeCanBeChildOf,
3629
+ _e as craftNodeCanBeSiblingOf,
3630
+ Wt as craftNodeInCanvas,
3631
+ rt as craftNodeIsAncestorOf,
3632
+ W as craftNodeIsCanvas,
3633
+ Zt as craftNodeIsDraggable,
3634
+ xn as defaultBlueprints,
3635
+ Dn as defaultResolvers,
3636
+ ot as initializeSlotsFromResolver,
3637
+ tt as isVisible,
3638
+ wn as mapData,
3639
+ Ie as renderCraftNodeToVNode,
3640
+ kn as renderCraftNodesToVNodes,
3641
+ ue as resolveNodeName,
3642
+ Lr as useAncestorContextBuckets,
3643
+ Gt as useCraftNode,
3644
+ q as useEditor,
3645
+ je as useIndicator,
3646
+ On as useNodeElement,
3647
+ Pe as useResolveCraftNode,
3648
+ qt as useResolveCraftNodeProps
3552
3649
  };
3553
3650
  //# sourceMappingURL=v-craft.es.js.map