@versa-stack/v-craft 1.1.0-alpha.3 → 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.
- package/dist/types/components/CraftEditorPanelNodeSlotPropsSettings.vue.d.ts +2 -2
- package/dist/types/components/CraftEditorPanelSettings.vue.d.ts +1 -1
- package/dist/types/components/composable/useCraftFrame.d.ts +30 -16
- package/dist/types/components/composable/useCraftNodeWrapper.d.ts +30 -16
- package/dist/types/components/composable/useResolveCraftNodeProps.d.ts +2 -1
- package/dist/types/components/utils.d.ts +1 -1
- package/dist/types/lib/CraftNodeResolver.d.ts +11 -0
- package/dist/types/lib/craftNode.d.ts +7 -1
- package/dist/types/store/editor.d.ts +30 -16
- package/dist/v-craft.css +1 -1
- package/dist/v-craft.es.js +742 -715
- package/dist/v-craft.es.js.map +1 -1
- package/package.json +1 -1
package/dist/v-craft.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as
|
|
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
2
|
import { defineStore as Ze, storeToRefs as se } from "pinia";
|
|
3
3
|
import { v4 as ee } from "uuid";
|
|
4
4
|
import { debounce as Je } from "lodash-es";
|
|
@@ -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
|
|
376
|
-
for (; 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,
|
|
@@ -791,10 +791,10 @@ var jt = {
|
|
|
791
791
|
});
|
|
792
792
|
}
|
|
793
793
|
};
|
|
794
|
-
const
|
|
794
|
+
const ke = 43, Bt = 45, fe = {
|
|
795
795
|
name: "assignment",
|
|
796
796
|
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
797
|
-
updateOperators: [
|
|
797
|
+
updateOperators: [ke, Bt],
|
|
798
798
|
assignmentPrecedence: 0.9,
|
|
799
799
|
init(t) {
|
|
800
800
|
const e = [t.IDENTIFIER, t.MEMBER_EXP];
|
|
@@ -802,7 +802,7 @@ const we = 43, Bt = 45, fe = {
|
|
|
802
802
|
const s = this.code;
|
|
803
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 ===
|
|
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}`));
|
|
@@ -811,7 +811,7 @@ const we = 43, Bt = 45, fe = {
|
|
|
811
811
|
const s = this.code;
|
|
812
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 ===
|
|
814
|
+
operator: s === ke ? "++" : "--",
|
|
815
815
|
argument: o.node,
|
|
816
816
|
prefix: !1
|
|
817
817
|
});
|
|
@@ -831,7 +831,7 @@ re.addUnaryOp("typeof");
|
|
|
831
831
|
re.addUnaryOp("void");
|
|
832
832
|
re.addLiteral("null", null);
|
|
833
833
|
re.addLiteral("undefined", void 0);
|
|
834
|
-
const Lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]),
|
|
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 Lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
840
840
|
switch (t.type) {
|
|
841
841
|
case "BinaryExpression":
|
|
842
842
|
case "LogicalExpression":
|
|
843
|
-
return
|
|
843
|
+
return $.evalBinaryExpression(t, e);
|
|
844
844
|
case "Compound":
|
|
845
|
-
return
|
|
845
|
+
return $.evalCompound(t, e);
|
|
846
846
|
case "ConditionalExpression":
|
|
847
|
-
return
|
|
847
|
+
return $.evalConditionalExpression(t, e);
|
|
848
848
|
case "Identifier":
|
|
849
|
-
return
|
|
849
|
+
return $.evalIdentifier(t, e);
|
|
850
850
|
case "Literal":
|
|
851
|
-
return
|
|
851
|
+
return $.evalLiteral(t, e);
|
|
852
852
|
case "MemberExpression":
|
|
853
|
-
return
|
|
853
|
+
return $.evalMemberExpression(t, e);
|
|
854
854
|
case "UnaryExpression":
|
|
855
|
-
return
|
|
855
|
+
return $.evalUnaryExpression(t, e);
|
|
856
856
|
case "ArrayExpression":
|
|
857
|
-
return
|
|
857
|
+
return $.evalArrayExpression(t, e);
|
|
858
858
|
case "CallExpression":
|
|
859
|
-
return
|
|
859
|
+
return $.evalCallExpression(t, e);
|
|
860
860
|
case "AssignmentExpression":
|
|
861
|
-
return
|
|
861
|
+
return $.evalAssignmentExpression(t, e);
|
|
862
862
|
default:
|
|
863
863
|
throw SyntaxError("Unexpected expression", t);
|
|
864
864
|
}
|
|
@@ -888,19 +888,19 @@ const Lt = /* @__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](
|
|
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 =
|
|
898
|
+
r = $.evalAst(o, e);
|
|
899
899
|
}
|
|
900
900
|
return r;
|
|
901
901
|
},
|
|
902
902
|
evalConditionalExpression(t, e) {
|
|
903
|
-
return
|
|
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,9 +915,9 @@ const Lt = /* @__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 ?
|
|
918
|
+
t.computed ? $.evalAst(t.property) : t.property.name
|
|
919
919
|
// `object.property` property is Identifier
|
|
920
|
-
), n =
|
|
920
|
+
), n = $.evalAst(t.object, e);
|
|
921
921
|
if (n == null)
|
|
922
922
|
throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);
|
|
923
923
|
if (!Object.hasOwn(n, r) && Lt.has(r))
|
|
@@ -927,21 +927,21 @@ const Lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
927
927
|
},
|
|
928
928
|
evalUnaryExpression(t, e) {
|
|
929
929
|
return {
|
|
930
|
-
"-": (n) =>
|
|
931
|
-
"!": (n) =>
|
|
932
|
-
"~": (n) =>
|
|
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) =>
|
|
935
|
-
typeof: (n) => typeof
|
|
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
|
|
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) =>
|
|
941
|
+
return t.elements.map((r) => $.evalAst(r, e));
|
|
942
942
|
},
|
|
943
943
|
evalCallExpression(t, e) {
|
|
944
|
-
const r = t.arguments.map((o) =>
|
|
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,7 +949,7 @@ const Lt = /* @__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 =
|
|
952
|
+
const r = t.left.name, n = $.evalAst(t.right, e);
|
|
953
953
|
return e[r] = n, e[r];
|
|
954
954
|
}
|
|
955
955
|
};
|
|
@@ -967,13 +967,13 @@ class Ft {
|
|
|
967
967
|
*/
|
|
968
968
|
runInNewContext(e) {
|
|
969
969
|
const r = Object.assign(/* @__PURE__ */ Object.create(null), e);
|
|
970
|
-
return
|
|
970
|
+
return $.evalAst(this.ast, r);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
973
|
function ae(t, e) {
|
|
974
974
|
return t = t.slice(), t.push(e), t;
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function De(t, e) {
|
|
977
977
|
return e = e.slice(), e.unshift(t), e;
|
|
978
978
|
}
|
|
979
979
|
class Ht extends Error {
|
|
@@ -984,10 +984,10 @@ class Ht 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
|
|
988
|
-
if (!(this instanceof
|
|
987
|
+
function k(t, e, r, n, o) {
|
|
988
|
+
if (!(this instanceof k))
|
|
989
989
|
try {
|
|
990
|
-
return new
|
|
990
|
+
return new k(t, e, r, n, o);
|
|
991
991
|
} catch (a) {
|
|
992
992
|
if (!a.avoidNew)
|
|
993
993
|
throw a;
|
|
@@ -1008,7 +1008,7 @@ function D(t, e, r, n, o) {
|
|
|
1008
1008
|
return i;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
|
|
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 @@ D.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 =
|
|
1025
|
+
if (o = o || null, s = s || null, Array.isArray(t) && (t = k.toPathString(t)), !t && t !== "" || !e)
|
|
1026
1026
|
return;
|
|
1027
|
-
const l =
|
|
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(
|
|
1030
|
-
return
|
|
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((
|
|
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) ?
|
|
1034
|
+
return a && Array.isArray(f) ? d = d.concat(f) : d.push(f), d;
|
|
1035
1035
|
}, []) : i ? [] : void 0;
|
|
1036
1036
|
};
|
|
1037
|
-
|
|
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 :
|
|
1042
|
-
return t.pointer =
|
|
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
|
|
1049
|
+
return k.toPathString(t[e]);
|
|
1050
1050
|
case "pointer":
|
|
1051
|
-
return
|
|
1051
|
+
return k.toPointer(t.path);
|
|
1052
1052
|
default:
|
|
1053
1053
|
throw new TypeError("Unknown result type");
|
|
1054
1054
|
}
|
|
1055
1055
|
};
|
|
1056
|
-
|
|
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 :
|
|
1059
|
+
t.path = typeof t.path == "string" ? t.path : k.toPathString(t.path), e(n, r, t);
|
|
1060
1060
|
}
|
|
1061
1061
|
};
|
|
1062
|
-
|
|
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,27 +1069,27 @@ D.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],
|
|
1072
|
+
const u = t[0], d = t.slice(1), m = [];
|
|
1073
1073
|
function f(h) {
|
|
1074
|
-
Array.isArray(h) ? h.forEach((
|
|
1075
|
-
m.push(
|
|
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(
|
|
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(
|
|
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(
|
|
1085
|
+
f(this._trace(d, e, r, n, o, s, a)), this._walk(e, (h) => {
|
|
1086
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:
|
|
1092
|
+
expr: d,
|
|
1093
1093
|
isParentSelector: !0
|
|
1094
1094
|
};
|
|
1095
1095
|
if (u === "~")
|
|
@@ -1100,27 +1100,27 @@ D.prototype._trace = function(t, e, r, n, o, s, a, i) {
|
|
|
1100
1100
|
parentProperty: null
|
|
1101
1101
|
}, this._handleCallback(l, s, "property"), l;
|
|
1102
1102
|
if (u === "$")
|
|
1103
|
-
f(this._trace(
|
|
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,
|
|
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"),
|
|
1110
|
-
|
|
1111
|
-
const A = [
|
|
1112
|
-
this._trace(A,
|
|
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
1113
|
}) : this._walk(e, (P) => {
|
|
1114
|
-
this._eval(h, e[P], P, r, n, o) && f(this._trace(
|
|
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(
|
|
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
|
|
1123
|
-
switch (
|
|
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 @@ D.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 ===
|
|
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 @@ D.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 ===
|
|
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 @@ D.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 " +
|
|
1156
|
+
throw new TypeError("Unknown value type " + b);
|
|
1157
1157
|
}
|
|
1158
1158
|
if (h)
|
|
1159
1159
|
return l = {
|
|
@@ -1164,30 +1164,30 @@ D.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(
|
|
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
|
|
1171
|
-
f(this._trace(
|
|
1172
|
-
} else !i && e && Object.hasOwn(e, u) && f(this._trace(
|
|
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
|
|
1177
|
-
if (
|
|
1178
|
-
const P = this._trace(
|
|
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
1179
|
if (Array.isArray(P)) {
|
|
1180
1180
|
m[h] = P[0];
|
|
1181
1181
|
const A = P.length;
|
|
1182
|
-
for (let
|
|
1183
|
-
h++, m.splice(h, 0, P[
|
|
1182
|
+
for (let T = 1; T < A; T++)
|
|
1183
|
+
h++, m.splice(h, 0, P[T]);
|
|
1184
1184
|
} else
|
|
1185
1185
|
m[h] = P;
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
1188
|
return m;
|
|
1189
1189
|
};
|
|
1190
|
-
|
|
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 @@ D.prototype._walk = function(t, e) {
|
|
|
1196
1196
|
e(r);
|
|
1197
1197
|
});
|
|
1198
1198
|
};
|
|
1199
|
-
|
|
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
|
|
1204
|
-
|
|
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 =
|
|
1207
|
-
this._trace(
|
|
1206
|
+
for (let h = d; h < m; h += u)
|
|
1207
|
+
this._trace(De(h, e), r, n, o, s, a, !0).forEach((P) => {
|
|
1208
1208
|
f.push(P);
|
|
1209
1209
|
});
|
|
1210
1210
|
return f;
|
|
1211
1211
|
};
|
|
1212
|
-
|
|
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 =
|
|
1215
|
+
a && (this.currSandbox._$_path = k.toPathString(n.concat([r])));
|
|
1216
1216
|
const i = this.currEval + "Script:" + t;
|
|
1217
|
-
if (!
|
|
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
|
-
|
|
1220
|
+
k.cache[i] = new this.safeVm.Script(l);
|
|
1221
1221
|
else if (this.currEval === "native")
|
|
1222
|
-
|
|
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
|
-
|
|
1225
|
+
k.cache[i] = new u(l);
|
|
1226
1226
|
} else if (typeof this.currEval == "function")
|
|
1227
|
-
|
|
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
|
|
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
|
-
|
|
1242
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1256
|
+
k.toPathArray = function(t) {
|
|
1257
1257
|
const {
|
|
1258
1258
|
cache: e
|
|
1259
|
-
} =
|
|
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,7 +1271,7 @@ D.toPathArray = function(t) {
|
|
|
1271
1271
|
});
|
|
1272
1272
|
return e[t] = o, e[t].concat();
|
|
1273
1273
|
};
|
|
1274
|
-
|
|
1274
|
+
k.prototype.safeVm = {
|
|
1275
1275
|
Script: Ft
|
|
1276
1276
|
};
|
|
1277
1277
|
const Vt = function(t, e, r) {
|
|
@@ -1298,18 +1298,18 @@ class Kt {
|
|
|
1298
1298
|
const n = Object.keys(e), o = [];
|
|
1299
1299
|
Vt(n, o, (u) => typeof e[u] == "function");
|
|
1300
1300
|
const s = n.map((u) => e[u]);
|
|
1301
|
-
r = o.reduce((u,
|
|
1302
|
-
let m = e[
|
|
1303
|
-
return /function/u.test(m) || (m = "function " + m), "var " +
|
|
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
|
-
|
|
1309
|
+
k.prototype.vm = {
|
|
1310
1310
|
Script: Kt
|
|
1311
1311
|
};
|
|
1312
|
-
function
|
|
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 De(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
|
|
1321
|
-
Array.isArray(o[i]) || (o[i] = []), o[i].length <=
|
|
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
|
}
|
|
@@ -1332,33 +1332,41 @@ function De(t, e, r) {
|
|
|
1332
1332
|
o[s] = r;
|
|
1333
1333
|
}
|
|
1334
1334
|
const Xt = (t, e) => {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
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
|
-
}),
|
|
1347
|
-
},
|
|
1348
|
-
props:
|
|
1349
|
-
() =>
|
|
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
|
-
}),
|
|
1355
|
+
}), Yt = (t, e) => {
|
|
1352
1356
|
if (!t)
|
|
1353
1357
|
return e.componentName;
|
|
1354
1358
|
const r = t.resolveComponent(e);
|
|
1355
1359
|
return r ? typeof r == "function" && !("setup" in r) && !("render" in r) ? Et(r) : r : t.resolve(e.componentName)?.componentName || e.componentName;
|
|
1356
|
-
},
|
|
1357
|
-
const r = ge("resolver"), n =
|
|
1360
|
+
}, Pe = (t, e = {}) => {
|
|
1361
|
+
const r = ge("resolver"), n = C(() => !r || !t?.value ? {} : r.value.resolve(
|
|
1358
1362
|
t.value.componentName
|
|
1359
|
-
)), o =
|
|
1360
|
-
() =>
|
|
1361
|
-
), { props: a } =
|
|
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,47 +1378,47 @@ const Xt = (t, e) => {
|
|
|
1370
1378
|
componentToRender: s,
|
|
1371
1379
|
props: i
|
|
1372
1380
|
};
|
|
1373
|
-
},
|
|
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 = Qe(), r = Ct(), n = t, o =
|
|
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 } =
|
|
1386
|
-
return (a, i) =>
|
|
1387
|
-
|
|
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: G((
|
|
1390
|
-
J(a.$slots, u, Le(Nt(
|
|
1397
|
+
fn: G((d) => [
|
|
1398
|
+
J(a.$slots, u, Le(Nt(d || {})))
|
|
1391
1399
|
])
|
|
1392
1400
|
}))
|
|
1393
|
-
]), 1040)) :
|
|
1401
|
+
]), 1040)) : R("", !0);
|
|
1394
1402
|
}
|
|
1395
|
-
}),
|
|
1403
|
+
}), Gt = () => {
|
|
1396
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 } =
|
|
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
|
-
}, tt = (t) => t.visible === void 0 || t.visible,
|
|
1414
|
+
}, tt = (t) => t.visible === void 0 || t.visible, Wt = (t) => {
|
|
1407
1415
|
let e = t;
|
|
1408
1416
|
const r = q();
|
|
1409
1417
|
for (; e.parentUuid; )
|
|
1410
1418
|
if (e = r.nodeMap.get(e.parentUuid), W(e))
|
|
1411
1419
|
return !0;
|
|
1412
1420
|
return !1;
|
|
1413
|
-
},
|
|
1421
|
+
}, Zt = (t) => Wt(t) ? t.rules?.canDrag ? t.rules.canDrag(t) : !0 : !1, rt = (t, e) => {
|
|
1414
1422
|
const r = q();
|
|
1415
1423
|
let n = e;
|
|
1416
1424
|
for (; n?.parentUuid; ) {
|
|
@@ -1429,7 +1437,7 @@ const Xt = (t, e) => {
|
|
|
1429
1437
|
return;
|
|
1430
1438
|
}
|
|
1431
1439
|
return !(a.canMoveInto && !a.canMoveInto(t, e, r) || rt(t, e) || s.canMoveIn && !s.canMoveIn(t, e, r));
|
|
1432
|
-
}, W = (t) => t.componentName === "CraftCanvas",
|
|
1440
|
+
}, W = (t) => t.componentName === "CraftCanvas", _e = (t, e, r) => {
|
|
1433
1441
|
const n = q();
|
|
1434
1442
|
return e.uuid === t.uuid || !e.parentUuid ? !1 : me(
|
|
1435
1443
|
t,
|
|
@@ -1593,7 +1601,7 @@ const Xt = (t, e) => {
|
|
|
1593
1601
|
},
|
|
1594
1602
|
insertNodeBefore(t, e, r) {
|
|
1595
1603
|
if (!this.resolver) throw new Error("Resolver is not set");
|
|
1596
|
-
if (!
|
|
1604
|
+
if (!_e(t, e, this.resolver))
|
|
1597
1605
|
throw new Error("Can not be the sibling of the target node.");
|
|
1598
1606
|
t = this.emancipateNode(t);
|
|
1599
1607
|
const n = e.parentUuid;
|
|
@@ -1613,7 +1621,7 @@ const Xt = (t, e) => {
|
|
|
1613
1621
|
},
|
|
1614
1622
|
insertNodeAfter(t, e, r) {
|
|
1615
1623
|
if (!this.resolver) throw new Error("Resolver is not set");
|
|
1616
|
-
if (!
|
|
1624
|
+
if (!_e(t, e, this.resolver))
|
|
1617
1625
|
throw new Error("Can not be the sibling of the target node.");
|
|
1618
1626
|
t = this.emancipateNode(t);
|
|
1619
1627
|
const n = e.parentUuid;
|
|
@@ -1663,7 +1671,7 @@ const Xt = (t, e) => {
|
|
|
1663
1671
|
return t.rootNodes.map((r) => e(r));
|
|
1664
1672
|
}
|
|
1665
1673
|
}
|
|
1666
|
-
}),
|
|
1674
|
+
}), Jt = ["value", "onKeyup"], er = /* @__PURE__ */ L({
|
|
1667
1675
|
__name: "CraftComponentSimpleText",
|
|
1668
1676
|
props: {
|
|
1669
1677
|
content: { default: "Lorem ipsum dolor sit amet..." },
|
|
@@ -1678,9 +1686,9 @@ const Xt = (t, e) => {
|
|
|
1678
1686
|
} catch {
|
|
1679
1687
|
return null;
|
|
1680
1688
|
}
|
|
1681
|
-
})(), a = s ? se(s).enabled : K(!1), i = K(!1), l = K(null), u = K(""), { craftNode:
|
|
1682
|
-
f.value &&
|
|
1683
|
-
},
|
|
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 = () => {
|
|
1684
1692
|
u.value = r.content, i.value = !0, s?.disableDragging(), ve(() => {
|
|
1685
1693
|
l.value && (l.value.focus(), P());
|
|
1686
1694
|
});
|
|
@@ -1689,20 +1697,20 @@ const Xt = (t, e) => {
|
|
|
1689
1697
|
}, A = async () => {
|
|
1690
1698
|
if (s?.enableDragging(), !i.value) return;
|
|
1691
1699
|
i.value = !1;
|
|
1692
|
-
const
|
|
1693
|
-
|
|
1694
|
-
...
|
|
1700
|
+
const U = l.value?.value.trim() ?? "";
|
|
1701
|
+
U !== r.content && d.value?.uuid && (s?.nodeMap.set(d.value.uuid, {
|
|
1702
|
+
...d.value,
|
|
1695
1703
|
props: {
|
|
1696
|
-
...
|
|
1697
|
-
content:
|
|
1704
|
+
...d.value.props,
|
|
1705
|
+
content: U
|
|
1698
1706
|
}
|
|
1699
|
-
}), await ve(), n("update:content",
|
|
1700
|
-
},
|
|
1707
|
+
}), await ve(), n("update:content", U));
|
|
1708
|
+
}, T = () => {
|
|
1701
1709
|
i.value = !1, n("update:content", u.value);
|
|
1702
1710
|
};
|
|
1703
|
-
return s && ne(a, (
|
|
1704
|
-
!
|
|
1705
|
-
}), (
|
|
1711
|
+
return s && ne(a, (U) => {
|
|
1712
|
+
!U && i.value && T();
|
|
1713
|
+
}), (U, _) => (v(), M(Ce(t.componentName), {
|
|
1706
1714
|
class: ye({
|
|
1707
1715
|
"pre-wrap": !i.value,
|
|
1708
1716
|
"editable-text": m.value,
|
|
@@ -1713,7 +1721,7 @@ const Xt = (t, e) => {
|
|
|
1713
1721
|
}, {
|
|
1714
1722
|
default: G(() => [
|
|
1715
1723
|
ie(oe(i.value ? "" : t.content) + " ", 1),
|
|
1716
|
-
i.value ? (v(),
|
|
1724
|
+
i.value ? (v(), E("textarea", {
|
|
1717
1725
|
key: 0,
|
|
1718
1726
|
ref_key: "textareaRef",
|
|
1719
1727
|
ref: l,
|
|
@@ -1723,9 +1731,9 @@ const Xt = (t, e) => {
|
|
|
1723
1731
|
onBlur: A,
|
|
1724
1732
|
onKeyup: [
|
|
1725
1733
|
Fe(V(A, ["exact"]), ["enter"]),
|
|
1726
|
-
Fe(
|
|
1734
|
+
Fe(T, ["esc"])
|
|
1727
1735
|
]
|
|
1728
|
-
}, null, 40,
|
|
1736
|
+
}, null, 40, Jt)) : R("", !0)
|
|
1729
1737
|
]),
|
|
1730
1738
|
_: 1
|
|
1731
1739
|
}, 40, ["class"]));
|
|
@@ -1734,6 +1742,7 @@ const Xt = (t, e) => {
|
|
|
1734
1742
|
class Oe {
|
|
1735
1743
|
resolverMap = {};
|
|
1736
1744
|
resolveComponentHook;
|
|
1745
|
+
resolvePropertyValueHook;
|
|
1737
1746
|
constructor(e = {}) {
|
|
1738
1747
|
return this.setResolverMap(e), Ge(this);
|
|
1739
1748
|
}
|
|
@@ -1745,6 +1754,16 @@ class Oe {
|
|
|
1745
1754
|
onResolveComponent(e) {
|
|
1746
1755
|
this.resolveComponentHook = e;
|
|
1747
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
|
+
}
|
|
1748
1767
|
resolve(e) {
|
|
1749
1768
|
return this.resolverMap[e];
|
|
1750
1769
|
}
|
|
@@ -1780,7 +1799,7 @@ class Oe {
|
|
|
1780
1799
|
return this.resolveNode(e)?.slotsProps || {};
|
|
1781
1800
|
}
|
|
1782
1801
|
}
|
|
1783
|
-
const
|
|
1802
|
+
const je = Ze("indicator", {
|
|
1784
1803
|
state: () => ({
|
|
1785
1804
|
barSize: 2,
|
|
1786
1805
|
visible: !1,
|
|
@@ -1850,7 +1869,7 @@ function Ke(t) {
|
|
|
1850
1869
|
s[a] = parseInt(s[a].slice(0, -2), 10);
|
|
1851
1870
|
}), s;
|
|
1852
1871
|
}
|
|
1853
|
-
const
|
|
1872
|
+
const tr = /* @__PURE__ */ L({
|
|
1854
1873
|
__name: "CraftEditor",
|
|
1855
1874
|
props: {
|
|
1856
1875
|
config: {},
|
|
@@ -1858,7 +1877,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1858
1877
|
},
|
|
1859
1878
|
emits: ["nodeDragStart", "nodeDragEnd", "iframeLoad"],
|
|
1860
1879
|
setup(t, { emit: e }) {
|
|
1861
|
-
const r = t, n = e, o = q(), s =
|
|
1880
|
+
const r = t, n = e, o = q(), s = je(), { getDraggedNode: a } = se(o);
|
|
1862
1881
|
ne(a, (l) => {
|
|
1863
1882
|
if (l) {
|
|
1864
1883
|
n("nodeDragStart", l);
|
|
@@ -1870,8 +1889,8 @@ const er = /* @__PURE__ */ B({
|
|
|
1870
1889
|
r.config.resolver || new Oe(r.config.resolverMap)
|
|
1871
1890
|
);
|
|
1872
1891
|
return te("resolver", i), (l, u) => {
|
|
1873
|
-
const
|
|
1874
|
-
return v(),
|
|
1892
|
+
const d = H("CraftFrame"), m = H("CraftEditorPanelLayout");
|
|
1893
|
+
return v(), M(m, {
|
|
1875
1894
|
blueprints: t.config.blueprintsLibrary
|
|
1876
1895
|
}, Ne({ _: 2 }, [
|
|
1877
1896
|
l.$slots["panel-layout"] ? {
|
|
@@ -1886,7 +1905,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1886
1905
|
} : {
|
|
1887
1906
|
name: "default",
|
|
1888
1907
|
fn: G(() => [
|
|
1889
|
-
Q(
|
|
1908
|
+
Q(d, {
|
|
1890
1909
|
iframe: t.iframe,
|
|
1891
1910
|
resolverMap: t.config.resolverMap,
|
|
1892
1911
|
onIframeLoad: u[0] || (u[0] = (f) => n("iframeLoad", f))
|
|
@@ -1902,7 +1921,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1902
1921
|
]), 1032, ["blueprints"]);
|
|
1903
1922
|
};
|
|
1904
1923
|
}
|
|
1905
|
-
}),
|
|
1924
|
+
}), rr = /* @__PURE__ */ L({
|
|
1906
1925
|
name: "CraftEditorBlueprint",
|
|
1907
1926
|
__name: "CraftEditorBlueprint",
|
|
1908
1927
|
props: {
|
|
@@ -1914,7 +1933,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1914
1933
|
}, o = (s) => {
|
|
1915
1934
|
s.stopPropagation(), e.dragNode(null);
|
|
1916
1935
|
};
|
|
1917
|
-
return (s, a) => (v(),
|
|
1936
|
+
return (s, a) => (v(), E("div", {
|
|
1918
1937
|
draggable: !0,
|
|
1919
1938
|
onDragstart: V(n, ["stop"]),
|
|
1920
1939
|
onDragend: o
|
|
@@ -1937,11 +1956,11 @@ const er = /* @__PURE__ */ B({
|
|
|
1937
1956
|
e = t.charCodeAt(s) + ((e << 5) - e);
|
|
1938
1957
|
const r = e % 360, n = 70 + e % 30, o = 45 + e % 30;
|
|
1939
1958
|
return `hsla(${r}, ${n}%, ${o}%, 0.9)`;
|
|
1940
|
-
},
|
|
1959
|
+
}, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1941
1960
|
__proto__: null,
|
|
1942
1961
|
blueprintsWithDefaults: st,
|
|
1943
1962
|
generateColorFromUUID: at
|
|
1944
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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({
|
|
1945
1964
|
__name: "CraftEditorBlueprintsList",
|
|
1946
1965
|
props: {
|
|
1947
1966
|
blueprints: {}
|
|
@@ -1950,21 +1969,21 @@ const er = /* @__PURE__ */ B({
|
|
|
1950
1969
|
const e = ge("resolver");
|
|
1951
1970
|
return (r, n) => {
|
|
1952
1971
|
const o = H("CraftEditorBlueprint");
|
|
1953
|
-
return
|
|
1954
|
-
(v(!0),
|
|
1972
|
+
return p(e) ? (v(), E("div", or, [
|
|
1973
|
+
(v(!0), E(B, null, j(t.blueprints.groups, (s) => (v(), E("div", null, [
|
|
1955
1974
|
J(r.$slots, "blueprint-group", {
|
|
1956
1975
|
group: s,
|
|
1957
|
-
resolver:
|
|
1976
|
+
resolver: p(e)
|
|
1958
1977
|
}, () => [
|
|
1959
1978
|
O("h4", null, oe(s.label), 1),
|
|
1960
|
-
O("div",
|
|
1961
|
-
(v(!0),
|
|
1979
|
+
O("div", sr, [
|
|
1980
|
+
(v(!0), E(B, null, j(p(st)(s, p(e)), (a, i) => (v(), M(o, {
|
|
1962
1981
|
craftNode: a,
|
|
1963
1982
|
key: i
|
|
1964
1983
|
}, {
|
|
1965
1984
|
default: G(() => [
|
|
1966
|
-
O("div",
|
|
1967
|
-
O("div",
|
|
1985
|
+
O("div", ar, [
|
|
1986
|
+
O("div", ir, oe(a.label), 1)
|
|
1968
1987
|
])
|
|
1969
1988
|
]),
|
|
1970
1989
|
_: 2
|
|
@@ -1972,10 +1991,10 @@ const er = /* @__PURE__ */ B({
|
|
|
1972
1991
|
])
|
|
1973
1992
|
])
|
|
1974
1993
|
]))), 256))
|
|
1975
|
-
])) :
|
|
1994
|
+
])) : R("", !0);
|
|
1976
1995
|
};
|
|
1977
1996
|
}
|
|
1978
|
-
}),
|
|
1997
|
+
}), ur = { class: "v-craft-panel v-craft-blueprints-panel" }, cr = { class: "v-craft-panel-content" }, dr = /* @__PURE__ */ L({
|
|
1979
1998
|
name: "CraftEditorPanelBlueprints",
|
|
1980
1999
|
__name: "CraftEditorPanelBlueprints",
|
|
1981
2000
|
props: {
|
|
@@ -1985,9 +2004,9 @@ const er = /* @__PURE__ */ B({
|
|
|
1985
2004
|
setup(t) {
|
|
1986
2005
|
return (e, r) => {
|
|
1987
2006
|
const n = H("CraftEditorBlueprintsList");
|
|
1988
|
-
return v(),
|
|
2007
|
+
return v(), E("div", ur, [
|
|
1989
2008
|
r[0] || (r[0] = O("h3", { class: "v-craft-title" }, "blueprints", -1)),
|
|
1990
|
-
O("div",
|
|
2009
|
+
O("div", cr, [
|
|
1991
2010
|
Q(n, { blueprints: t.blueprints }, null, 8, ["blueprints"])
|
|
1992
2011
|
])
|
|
1993
2012
|
]);
|
|
@@ -1998,7 +2017,7 @@ const er = /* @__PURE__ */ B({
|
|
|
1998
2017
|
for (const [n, o] of e)
|
|
1999
2018
|
r[n] = o;
|
|
2000
2019
|
return r;
|
|
2001
|
-
},
|
|
2020
|
+
}, pr = /* @__PURE__ */ Ee(dr, [["__scopeId", "data-v-a6de4dca"]]), fr = /* @__PURE__ */ L({
|
|
2002
2021
|
__name: "CraftEditorPanelForm",
|
|
2003
2022
|
props: {
|
|
2004
2023
|
craftNode: {},
|
|
@@ -2007,21 +2026,21 @@ const er = /* @__PURE__ */ B({
|
|
|
2007
2026
|
},
|
|
2008
2027
|
emits: ["update"],
|
|
2009
2028
|
setup(t, { emit: e }) {
|
|
2010
|
-
const r = t, n = e, o = he(r, "model"), s = he(r, "schema"), a = he(r, "craftNode"), i =
|
|
2029
|
+
const r = t, n = e, o = he(r, "model"), s = he(r, "schema"), a = he(r, "craftNode"), i = C(
|
|
2011
2030
|
() => o.value ? { ...o.value } : {}
|
|
2012
|
-
), l = Je((
|
|
2013
|
-
n("update",
|
|
2014
|
-
}, 50), u = (
|
|
2015
|
-
|
|
2031
|
+
), l = Je((d) => {
|
|
2032
|
+
n("update", d);
|
|
2033
|
+
}, 50), u = (d) => {
|
|
2034
|
+
d != null && l(d);
|
|
2016
2035
|
};
|
|
2017
|
-
return
|
|
2036
|
+
return Pt(() => l.cancel()), (d, m) => J(d.$slots, "panel-content", {
|
|
2018
2037
|
craftNode: a.value,
|
|
2019
2038
|
model: i.value,
|
|
2020
2039
|
handleFormInput: u,
|
|
2021
2040
|
schema: s.value
|
|
2022
2041
|
});
|
|
2023
2042
|
}
|
|
2024
|
-
}),
|
|
2043
|
+
}), hr = { class: "v-craft-panel v-craft-layers-panel" }, vr = { class: "v-craft-layers" }, mr = { class: "v-craft-node-layers" }, gr = /* @__PURE__ */ L({
|
|
2025
2044
|
name: "CraftEditorPanelLayers",
|
|
2026
2045
|
__name: "CraftEditorPanelLayers",
|
|
2027
2046
|
setup(t) {
|
|
@@ -2030,11 +2049,11 @@ const er = /* @__PURE__ */ B({
|
|
|
2030
2049
|
};
|
|
2031
2050
|
return (o, s) => {
|
|
2032
2051
|
const a = H("CraftEditorPanelNodeLayer");
|
|
2033
|
-
return v(),
|
|
2052
|
+
return v(), E("div", hr, [
|
|
2034
2053
|
s[0] || (s[0] = O("h3", { class: "v-craft-title" }, "tree", -1)),
|
|
2035
|
-
O("div",
|
|
2036
|
-
O("ul",
|
|
2037
|
-
(v(!0),
|
|
2054
|
+
O("div", vr, [
|
|
2055
|
+
O("ul", mr, [
|
|
2056
|
+
(v(!0), E(B, null, j(p(r), (i, l) => (v(), M(a, {
|
|
2038
2057
|
key: l,
|
|
2039
2058
|
craftNode: i,
|
|
2040
2059
|
onLayerClick: n
|
|
@@ -2044,10 +2063,10 @@ const er = /* @__PURE__ */ B({
|
|
|
2044
2063
|
]);
|
|
2045
2064
|
};
|
|
2046
2065
|
}
|
|
2047
|
-
}),
|
|
2066
|
+
}), yr = /* @__PURE__ */ Ee(gr, [["__scopeId", "data-v-ab795ec3"]]), br = { key: 0 }, Er = {
|
|
2048
2067
|
key: 1,
|
|
2049
2068
|
class: "v-craft-panel-manager"
|
|
2050
|
-
},
|
|
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({
|
|
2051
2070
|
__name: "CraftEditorPanelLayout",
|
|
2052
2071
|
props: {
|
|
2053
2072
|
blueprints: {}
|
|
@@ -2058,14 +2077,14 @@ const er = /* @__PURE__ */ B({
|
|
|
2058
2077
|
};
|
|
2059
2078
|
return (n, o) => {
|
|
2060
2079
|
const s = H("CraftEditorPanelBlueprints"), a = H("CraftEditorPanelLayers"), i = H("CraftEditorPanelSettings");
|
|
2061
|
-
return n.$slots["panel-layout"] ? (v(),
|
|
2080
|
+
return n.$slots["panel-layout"] ? (v(), E("div", br, [
|
|
2062
2081
|
J(n.$slots, "panel-layout", {
|
|
2063
2082
|
blueprints: t.blueprints,
|
|
2064
2083
|
deselectNodes: r
|
|
2065
2084
|
}, void 0, !0)
|
|
2066
|
-
])) : (v(),
|
|
2067
|
-
O("div",
|
|
2068
|
-
O("div",
|
|
2085
|
+
])) : (v(), E("div", Er, [
|
|
2086
|
+
O("div", Cr, [
|
|
2087
|
+
O("div", Nr, [
|
|
2069
2088
|
Q(s, { blueprints: t.blueprints }, null, 8, ["blueprints"])
|
|
2070
2089
|
]),
|
|
2071
2090
|
O("div", {
|
|
@@ -2074,7 +2093,7 @@ const er = /* @__PURE__ */ B({
|
|
|
2074
2093
|
}, [
|
|
2075
2094
|
J(n.$slots, "default", {}, void 0, !0)
|
|
2076
2095
|
]),
|
|
2077
|
-
O("div",
|
|
2096
|
+
O("div", Pr, [
|
|
2078
2097
|
Q(a),
|
|
2079
2098
|
Q(i)
|
|
2080
2099
|
])
|
|
@@ -2082,13 +2101,13 @@ const er = /* @__PURE__ */ B({
|
|
|
2082
2101
|
]));
|
|
2083
2102
|
};
|
|
2084
2103
|
}
|
|
2085
|
-
}),
|
|
2104
|
+
}), Sr = /* @__PURE__ */ Ee(_r, [["__scopeId", "data-v-7dd1d43b"]]), xr = {
|
|
2086
2105
|
key: 0,
|
|
2087
2106
|
class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
|
|
2088
|
-
},
|
|
2107
|
+
}, Or = {
|
|
2089
2108
|
key: 0,
|
|
2090
2109
|
class: "formkit-help v-craft-data-source-error"
|
|
2091
|
-
},
|
|
2110
|
+
}, wr = /* @__PURE__ */ L({
|
|
2092
2111
|
__name: "CraftEditorPanelNodeDataSourceSettings",
|
|
2093
2112
|
props: {
|
|
2094
2113
|
craftNode: {},
|
|
@@ -2119,12 +2138,12 @@ const er = /* @__PURE__ */ B({
|
|
|
2119
2138
|
} catch {
|
|
2120
2139
|
i.value = "Invalid JSON - not applied until fixed.";
|
|
2121
2140
|
}
|
|
2122
|
-
},
|
|
2141
|
+
}, d = (f) => {
|
|
2123
2142
|
s.value = f === "list" ? "list" : "single", u();
|
|
2124
2143
|
}, m = (f) => {
|
|
2125
2144
|
a.value = f, u();
|
|
2126
2145
|
};
|
|
2127
|
-
return (f, h) => o.value ? (v(),
|
|
2146
|
+
return (f, h) => o.value ? (v(), E("fieldset", xr, [
|
|
2128
2147
|
h[2] || (h[2] = O("legend", { class: "formkit-legend" }, "Data Source", -1)),
|
|
2129
2148
|
h[3] || (h[3] = O("p", { class: "formkit-help" }, [
|
|
2130
2149
|
ie(" Paste JSON here to experiment with mapping data fields into this subtree's props. Descendants read it via "),
|
|
@@ -2137,7 +2156,7 @@ const er = /* @__PURE__ */ B({
|
|
|
2137
2156
|
O("code", null, "editor.setNodeData()"),
|
|
2138
2157
|
ie(" directly. ")
|
|
2139
2158
|
], -1)),
|
|
2140
|
-
Q(
|
|
2159
|
+
Q(p(le), {
|
|
2141
2160
|
type: "select",
|
|
2142
2161
|
label: "Type",
|
|
2143
2162
|
options: [
|
|
@@ -2145,22 +2164,22 @@ const er = /* @__PURE__ */ B({
|
|
|
2145
2164
|
{ value: "list", label: "List" }
|
|
2146
2165
|
],
|
|
2147
2166
|
value: s.value,
|
|
2148
|
-
onInput: h[0] || (h[0] = (
|
|
2167
|
+
onInput: h[0] || (h[0] = (b) => d(String(b ?? "single")))
|
|
2149
2168
|
}, null, 8, ["value"]),
|
|
2150
|
-
Q(
|
|
2169
|
+
Q(p(le), {
|
|
2151
2170
|
type: "textarea",
|
|
2152
2171
|
label: "JSON",
|
|
2153
2172
|
placeholder: s.value === "list" ? '[{ "title": "Alice" }, { "title": "Bob" }]' : '{ "title": "Alice" }',
|
|
2154
2173
|
value: a.value,
|
|
2155
|
-
onInput: h[1] || (h[1] = (
|
|
2174
|
+
onInput: h[1] || (h[1] = (b) => m(String(b ?? "")))
|
|
2156
2175
|
}, null, 8, ["placeholder", "value"]),
|
|
2157
|
-
i.value ? (v(),
|
|
2158
|
-
])) :
|
|
2176
|
+
i.value ? (v(), E("p", Or, oe(i.value), 1)) : R("", !0)
|
|
2177
|
+
])) : R("", !0);
|
|
2159
2178
|
}
|
|
2160
|
-
}),
|
|
2179
|
+
}), kr = /* @__PURE__ */ Ee(wr, [["__scopeId", "data-v-7c1c5696"]]), Dr = {
|
|
2161
2180
|
key: 0,
|
|
2162
2181
|
class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
|
|
2163
|
-
},
|
|
2182
|
+
}, Ar = /* @__PURE__ */ L({
|
|
2164
2183
|
__name: "CraftEditorPanelNodeEventsSettings",
|
|
2165
2184
|
props: {
|
|
2166
2185
|
craftNode: {},
|
|
@@ -2171,37 +2190,37 @@ const er = /* @__PURE__ */ B({
|
|
|
2171
2190
|
const r = t, { craftNode: n, schema: o } = be(r), s = e;
|
|
2172
2191
|
return (a, i) => {
|
|
2173
2192
|
const l = H("CraftEditorPanelForm");
|
|
2174
|
-
return v(),
|
|
2175
|
-
craftNode:
|
|
2176
|
-
schema:
|
|
2177
|
-
model:
|
|
2193
|
+
return v(), M(l, {
|
|
2194
|
+
craftNode: p(n),
|
|
2195
|
+
schema: p(o),
|
|
2196
|
+
model: p(n)?.events,
|
|
2178
2197
|
onUpdate: i[0] || (i[0] = (u) => s("update:events", u))
|
|
2179
2198
|
}, {
|
|
2180
|
-
"panel-content": G(({ craftNode: u, model:
|
|
2181
|
-
f ? (v(),
|
|
2199
|
+
"panel-content": G(({ craftNode: u, model: d, handleFormInput: m, schema: f }) => [
|
|
2200
|
+
f ? (v(), E("fieldset", Dr, [
|
|
2182
2201
|
i[1] || (i[1] = O("legend", { class: "formkit-legend" }, "Events", -1)),
|
|
2183
|
-
(v(),
|
|
2202
|
+
(v(), M(p(le), {
|
|
2184
2203
|
key: u?.uuid,
|
|
2185
2204
|
type: "form",
|
|
2186
|
-
value:
|
|
2205
|
+
value: d,
|
|
2187
2206
|
onInput: m,
|
|
2188
2207
|
actions: !1
|
|
2189
2208
|
}, {
|
|
2190
2209
|
default: G(() => [
|
|
2191
|
-
Q(
|
|
2210
|
+
Q(p(et), { schema: f }, null, 8, ["schema"])
|
|
2192
2211
|
]),
|
|
2193
2212
|
_: 2
|
|
2194
2213
|
}, 1032, ["value", "onInput"]))
|
|
2195
|
-
])) :
|
|
2214
|
+
])) : R("", !0)
|
|
2196
2215
|
]),
|
|
2197
2216
|
_: 1
|
|
2198
2217
|
}, 8, ["craftNode", "schema", "model"]);
|
|
2199
2218
|
};
|
|
2200
2219
|
}
|
|
2201
|
-
}),
|
|
2220
|
+
}), Rr = { class: "v-craft-component-layer-face" }, Mr = { class: "v-craft-component-name" }, $r = {
|
|
2202
2221
|
key: 0,
|
|
2203
2222
|
class: "v-craft-node-layers nested-layers"
|
|
2204
|
-
},
|
|
2223
|
+
}, Ir = /* @__PURE__ */ L({
|
|
2205
2224
|
__name: "CraftEditorPanelNodeLayer",
|
|
2206
2225
|
props: {
|
|
2207
2226
|
craftNode: {},
|
|
@@ -2209,46 +2228,46 @@ const er = /* @__PURE__ */ B({
|
|
|
2209
2228
|
},
|
|
2210
2229
|
emits: ["layer-click"],
|
|
2211
2230
|
setup(t, { emit: e }) {
|
|
2212
|
-
const r = t, { craftNode: n, visible: o } = be(r), s =
|
|
2231
|
+
const r = t, { craftNode: n, visible: o } = be(r), s = C(
|
|
2213
2232
|
() => o.value && n.value.visible === void 0 || n.value.visible
|
|
2214
|
-
), a = e, i = q(), { selectedNode: l } = se(i), u =
|
|
2233
|
+
), a = e, i = q(), { selectedNode: l } = se(i), u = C(() => ue(n.value)), d = C(
|
|
2215
2234
|
() => l?.value?.uuid === n.value.uuid
|
|
2216
2235
|
), m = () => {
|
|
2217
2236
|
i.toggleNodeVisibility(n.value);
|
|
2218
2237
|
};
|
|
2219
2238
|
return (f, h) => {
|
|
2220
|
-
const
|
|
2221
|
-
return v(),
|
|
2239
|
+
const b = H("CraftEditorPanelNodeLayer", !0);
|
|
2240
|
+
return v(), E("li", {
|
|
2222
2241
|
class: ye(["v-craft-node-layer", {
|
|
2223
|
-
"v-craft-node-layer-selected":
|
|
2242
|
+
"v-craft-node-layer-selected": d.value
|
|
2224
2243
|
}]),
|
|
2225
|
-
onClick: h[1] || (h[1] = V((P) => a("layer-click",
|
|
2244
|
+
onClick: h[1] || (h[1] = V((P) => a("layer-click", p(n)), ["prevent", "stop"]))
|
|
2226
2245
|
}, [
|
|
2227
|
-
O("div",
|
|
2228
|
-
O("div",
|
|
2246
|
+
O("div", Rr, [
|
|
2247
|
+
O("div", Mr, oe(u.value), 1),
|
|
2229
2248
|
O("button", {
|
|
2230
2249
|
type: "button",
|
|
2231
2250
|
class: "v-craft-component-icon",
|
|
2232
2251
|
onClick: V(m, ["prevent", "stop"])
|
|
2233
2252
|
}, oe(s.value ? "hide" : "show"), 1)
|
|
2234
2253
|
]),
|
|
2235
|
-
|
|
2236
|
-
(v(!0),
|
|
2237
|
-
(v(!0),
|
|
2238
|
-
key: `${A}-${
|
|
2239
|
-
craftNode:
|
|
2240
|
-
onLayerClick: h[0] || (h[0] = (
|
|
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", _)),
|
|
2241
2260
|
visible: s.value
|
|
2242
2261
|
}, null, 8, ["craftNode", "visible"]))), 128))
|
|
2243
2262
|
], 64))), 128))
|
|
2244
|
-
])) :
|
|
2263
|
+
])) : R("", !0)
|
|
2245
2264
|
], 2);
|
|
2246
2265
|
};
|
|
2247
2266
|
}
|
|
2248
|
-
}),
|
|
2267
|
+
}), Tr = /* @__PURE__ */ Ee(Ir, [["__scopeId", "data-v-208a4e02"]]), Ur = {
|
|
2249
2268
|
key: 0,
|
|
2250
2269
|
class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
|
|
2251
|
-
},
|
|
2270
|
+
}, jr = /* @__PURE__ */ L({
|
|
2252
2271
|
__name: "CraftEditorPanelNodeSettings",
|
|
2253
2272
|
props: {
|
|
2254
2273
|
craftNode: {},
|
|
@@ -2259,47 +2278,47 @@ const er = /* @__PURE__ */ B({
|
|
|
2259
2278
|
const r = t, { craftNode: n, schema: o } = be(r), s = e;
|
|
2260
2279
|
return (a, i) => {
|
|
2261
2280
|
const l = H("CraftEditorPanelForm");
|
|
2262
|
-
return v(),
|
|
2263
|
-
craftNode:
|
|
2264
|
-
schema:
|
|
2265
|
-
model:
|
|
2281
|
+
return v(), M(l, {
|
|
2282
|
+
craftNode: p(n),
|
|
2283
|
+
schema: p(o),
|
|
2284
|
+
model: p(n)?.props,
|
|
2266
2285
|
onUpdate: i[0] || (i[0] = (u) => s("update:props", u))
|
|
2267
2286
|
}, {
|
|
2268
|
-
"panel-content": G(({ craftNode: u, model:
|
|
2269
|
-
f ? (v(),
|
|
2287
|
+
"panel-content": G(({ craftNode: u, model: d, handleFormInput: m, schema: f }) => [
|
|
2288
|
+
f ? (v(), E("fieldset", Ur, [
|
|
2270
2289
|
i[1] || (i[1] = O("legend", { class: "formkit-legend" }, "Properties", -1)),
|
|
2271
|
-
(v(),
|
|
2290
|
+
(v(), M(p(le), {
|
|
2272
2291
|
key: u?.uuid,
|
|
2273
2292
|
type: "form",
|
|
2274
|
-
value:
|
|
2293
|
+
value: d,
|
|
2275
2294
|
onInput: m,
|
|
2276
2295
|
actions: !1
|
|
2277
2296
|
}, {
|
|
2278
2297
|
default: G(() => [
|
|
2279
|
-
Q(
|
|
2298
|
+
Q(p(et), { schema: f }, null, 8, ["schema"])
|
|
2280
2299
|
]),
|
|
2281
2300
|
_: 2
|
|
2282
2301
|
}, 1032, ["value", "onInput"]))
|
|
2283
|
-
])) :
|
|
2302
|
+
])) : R("", !0)
|
|
2284
2303
|
]),
|
|
2285
2304
|
_: 1
|
|
2286
2305
|
}, 8, ["craftNode", "schema", "model"]);
|
|
2287
2306
|
};
|
|
2288
2307
|
}
|
|
2289
|
-
}),
|
|
2308
|
+
}), Br = (t) => {
|
|
2290
2309
|
if (!t) return [];
|
|
2291
2310
|
const e = t.type === "single" ? t.item : t.list?.[0];
|
|
2292
2311
|
return e ? Object.keys(e) : [];
|
|
2293
|
-
},
|
|
2312
|
+
}, Lr = (t) => {
|
|
2294
2313
|
const e = q(), r = ge("resolver");
|
|
2295
|
-
return { buckets:
|
|
2314
|
+
return { buckets: C(() => {
|
|
2296
2315
|
const o = [];
|
|
2297
2316
|
let s = t.value;
|
|
2298
2317
|
for (; s?.parentUuid; ) {
|
|
2299
2318
|
const a = e.nodeMap.get(s.parentUuid);
|
|
2300
2319
|
if (!a) break;
|
|
2301
2320
|
const i = Object.entries(a.slots || {}).find(
|
|
2302
|
-
([, u]) => u.some((
|
|
2321
|
+
([, u]) => u.some((d) => d.uuid === s.uuid)
|
|
2303
2322
|
);
|
|
2304
2323
|
if (i) {
|
|
2305
2324
|
const [u] = i;
|
|
@@ -2315,18 +2334,18 @@ const er = /* @__PURE__ */ B({
|
|
|
2315
2334
|
slotName: "data",
|
|
2316
2335
|
ancestorUuid: a.uuid,
|
|
2317
2336
|
ancestorComponentName: a.componentName,
|
|
2318
|
-
keys:
|
|
2337
|
+
keys: Br(l)
|
|
2319
2338
|
}), s = a;
|
|
2320
2339
|
}
|
|
2321
2340
|
return o;
|
|
2322
2341
|
}) };
|
|
2323
|
-
},
|
|
2342
|
+
}, Fr = {
|
|
2324
2343
|
key: 0,
|
|
2325
2344
|
class: "v-craft-panel-settings formkit-fieldset v-craft-scrollable-content"
|
|
2326
|
-
},
|
|
2345
|
+
}, Hr = {
|
|
2327
2346
|
key: 0,
|
|
2328
2347
|
class: "formkit-help"
|
|
2329
|
-
},
|
|
2348
|
+
}, Vr = ["onClick"], Kr = ["onClick"], Xr = ["onClick"], zr = /* @__PURE__ */ L({
|
|
2330
2349
|
__name: "CraftEditorPanelNodeSlotPropsSettings",
|
|
2331
2350
|
props: {
|
|
2332
2351
|
craftNode: {},
|
|
@@ -2334,145 +2353,153 @@ const er = /* @__PURE__ */ B({
|
|
|
2334
2353
|
},
|
|
2335
2354
|
emits: ["update:slotsPropsPropsMap"],
|
|
2336
2355
|
setup(t, { emit: e }) {
|
|
2337
|
-
const r = t, n = e, o =
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
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})`
|
|
2342
2369
|
}));
|
|
2343
|
-
}),
|
|
2344
|
-
const
|
|
2345
|
-
return !
|
|
2346
|
-
},
|
|
2347
|
-
ne(() =>
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2350
|
-
([
|
|
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]) => ({
|
|
2351
2378
|
id: ee(),
|
|
2352
|
-
bucket:
|
|
2353
|
-
fields: Object.entries(
|
|
2379
|
+
bucket: g,
|
|
2380
|
+
fields: Object.entries(w).map(([y, N]) => ({
|
|
2354
2381
|
id: ee(),
|
|
2355
|
-
targetProp:
|
|
2356
|
-
fromPath:
|
|
2382
|
+
targetProp: y,
|
|
2383
|
+
fromPath: s(N)
|
|
2357
2384
|
}))
|
|
2358
2385
|
})
|
|
2359
2386
|
);
|
|
2360
2387
|
}, { immediate: !0 });
|
|
2361
|
-
const
|
|
2362
|
-
const
|
|
2363
|
-
|
|
2364
|
-
if (!
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
}), Object.keys(
|
|
2369
|
-
}), n("update:slotsPropsPropsMap",
|
|
2370
|
-
},
|
|
2371
|
-
|
|
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({
|
|
2372
2399
|
id: ee(),
|
|
2373
|
-
bucket:
|
|
2400
|
+
bucket: l.value[0]?.value || "",
|
|
2374
2401
|
fields: [{ id: ee(), targetProp: "", fromPath: "" }]
|
|
2375
|
-
}),
|
|
2376
|
-
},
|
|
2377
|
-
|
|
2378
|
-
},
|
|
2379
|
-
|
|
2380
|
-
},
|
|
2381
|
-
|
|
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({
|
|
2382
2409
|
id: ee(),
|
|
2383
2410
|
targetProp: "",
|
|
2384
2411
|
fromPath: ""
|
|
2385
2412
|
});
|
|
2386
|
-
},
|
|
2387
|
-
|
|
2388
|
-
},
|
|
2389
|
-
|
|
2413
|
+
}, T = (_, g) => {
|
|
2414
|
+
d.value[_].fields.splice(g, 1), f();
|
|
2415
|
+
}, U = (_, g, w, y) => {
|
|
2416
|
+
d.value[_].fields[g][w] = y, f();
|
|
2390
2417
|
};
|
|
2391
|
-
return (
|
|
2392
|
-
craftNode:
|
|
2393
|
-
mappingGroups:
|
|
2394
|
-
bucketOptions:
|
|
2418
|
+
return (_, g) => J(_.$slots, "panel-content", {
|
|
2419
|
+
craftNode: a.value,
|
|
2420
|
+
mappingGroups: d.value,
|
|
2421
|
+
bucketOptions: l.value,
|
|
2395
2422
|
availableProps: t.availableProps ?? [],
|
|
2396
|
-
targetPropOptionsFor:
|
|
2397
|
-
addGroup:
|
|
2398
|
-
removeGroup:
|
|
2399
|
-
updateBucket:
|
|
2400
|
-
addField:
|
|
2401
|
-
removeField:
|
|
2402
|
-
updateField:
|
|
2423
|
+
targetPropOptionsFor: u,
|
|
2424
|
+
addGroup: h,
|
|
2425
|
+
removeGroup: b,
|
|
2426
|
+
updateBucket: P,
|
|
2427
|
+
addField: A,
|
|
2428
|
+
removeField: T,
|
|
2429
|
+
updateField: U
|
|
2403
2430
|
}, () => [
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
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" }, [
|
|
2407
2434
|
ie(" Map fields from an ancestor slot's context into this component's own props using JSONPath (e.g. "),
|
|
2408
2435
|
O("code", null, "$.item.name"),
|
|
2409
|
-
ie("). ")
|
|
2436
|
+
ie("), or paste a JSON mapping object if the app supports richer transforms. ")
|
|
2410
2437
|
], -1)),
|
|
2411
|
-
|
|
2412
|
-
(v(!0),
|
|
2413
|
-
key:
|
|
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,
|
|
2414
2441
|
class: "v-craft-slot-props-map-group"
|
|
2415
2442
|
}, [
|
|
2416
|
-
Q(
|
|
2443
|
+
Q(p(le), {
|
|
2417
2444
|
type: "select",
|
|
2418
2445
|
label: "Context",
|
|
2419
2446
|
placeholder: "Select context",
|
|
2420
|
-
options:
|
|
2421
|
-
value:
|
|
2422
|
-
onInput: (
|
|
2447
|
+
options: l.value,
|
|
2448
|
+
value: w.bucket,
|
|
2449
|
+
onInput: (N) => P(y, String(N ?? ""))
|
|
2423
2450
|
}, null, 8, ["options", "value", "onInput"]),
|
|
2424
|
-
(v(!0),
|
|
2425
|
-
key:
|
|
2451
|
+
(v(!0), E(B, null, j(w.fields, (N, S) => (v(), E(B, {
|
|
2452
|
+
key: N.id
|
|
2426
2453
|
}, [
|
|
2427
|
-
t.availableProps && t.availableProps.length ? (v(),
|
|
2454
|
+
t.availableProps && t.availableProps.length ? (v(), M(p(le), {
|
|
2428
2455
|
key: 0,
|
|
2429
2456
|
type: "select",
|
|
2430
2457
|
label: "Target Prop",
|
|
2431
2458
|
placeholder: "target prop",
|
|
2432
|
-
options:
|
|
2433
|
-
value:
|
|
2434
|
-
onInput: (
|
|
2435
|
-
}, null, 8, ["options", "value", "onInput"])) : (v(),
|
|
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), {
|
|
2436
2463
|
key: 1,
|
|
2437
2464
|
type: "text",
|
|
2438
2465
|
label: "Target Prop",
|
|
2439
2466
|
placeholder: "target prop",
|
|
2440
|
-
value:
|
|
2441
|
-
onInput: (
|
|
2467
|
+
value: N.targetProp,
|
|
2468
|
+
onInput: (I) => U(y, S, "targetProp", String(I ?? ""))
|
|
2442
2469
|
}, null, 8, ["value", "onInput"])),
|
|
2443
|
-
Q(
|
|
2444
|
-
type: "
|
|
2445
|
-
label: "JSONPath",
|
|
2446
|
-
placeholder: "$.item.name",
|
|
2447
|
-
value:
|
|
2448
|
-
onInput: (
|
|
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 ?? ""))
|
|
2449
2476
|
}, null, 8, ["value", "onInput"]),
|
|
2450
2477
|
O("button", {
|
|
2451
2478
|
type: "button",
|
|
2452
2479
|
class: "formkit-input v-craft-slot-props-remove",
|
|
2453
|
-
onClick: V((
|
|
2454
|
-
}, " Remove field ", 8,
|
|
2480
|
+
onClick: V((I) => T(y, S), ["prevent"])
|
|
2481
|
+
}, " Remove field ", 8, Vr)
|
|
2455
2482
|
], 64))), 128)),
|
|
2456
2483
|
O("button", {
|
|
2457
2484
|
type: "button",
|
|
2458
2485
|
class: "formkit-input v-craft-slot-props-add",
|
|
2459
|
-
onClick: V((
|
|
2460
|
-
}, " + Add field ", 8,
|
|
2486
|
+
onClick: V((N) => A(y), ["prevent"])
|
|
2487
|
+
}, " + Add field ", 8, Kr),
|
|
2461
2488
|
O("button", {
|
|
2462
2489
|
type: "button",
|
|
2463
2490
|
class: "formkit-input v-craft-slot-props-remove",
|
|
2464
|
-
onClick: V((
|
|
2465
|
-
}, " Remove group ", 8,
|
|
2491
|
+
onClick: V((N) => b(y), ["prevent"])
|
|
2492
|
+
}, " Remove group ", 8, Xr)
|
|
2466
2493
|
]))), 128)),
|
|
2467
2494
|
O("button", {
|
|
2468
2495
|
type: "button",
|
|
2469
2496
|
class: "formkit-input v-craft-slot-props-add",
|
|
2470
|
-
onClick: V(
|
|
2497
|
+
onClick: V(h, ["prevent"])
|
|
2471
2498
|
}, " + Add mapping group ")
|
|
2472
|
-
])) :
|
|
2499
|
+
])) : R("", !0)
|
|
2473
2500
|
], !0);
|
|
2474
2501
|
}
|
|
2475
|
-
}),
|
|
2502
|
+
}), qr = /* @__PURE__ */ Ee(zr, [["__scopeId", "data-v-74ec0ff3"]]), Yr = (t) => Array.isArray(t) ? t.filter(
|
|
2476
2503
|
(e) => typeof e == "object" && e !== null && typeof e.name == "string"
|
|
2477
2504
|
).map((e) => {
|
|
2478
2505
|
const r = e.name, n = e.label;
|
|
@@ -2480,29 +2507,29 @@ const er = /* @__PURE__ */ B({
|
|
|
2480
2507
|
value: r,
|
|
2481
2508
|
label: typeof n == "string" && n.trim() ? n : r
|
|
2482
2509
|
};
|
|
2483
|
-
}) : [],
|
|
2510
|
+
}) : [], Qr = { class: "text-sm" }, Gr = { key: 0 }, Wr = {
|
|
2484
2511
|
key: 0,
|
|
2485
2512
|
class: "v-craft-settings"
|
|
2486
|
-
},
|
|
2513
|
+
}, Zr = {
|
|
2487
2514
|
key: 1,
|
|
2488
2515
|
class: "v-craft-settings"
|
|
2489
|
-
},
|
|
2516
|
+
}, Jr = {
|
|
2490
2517
|
key: 2,
|
|
2491
2518
|
class: "v-craft-settings"
|
|
2492
|
-
},
|
|
2519
|
+
}, en = {
|
|
2493
2520
|
key: 3,
|
|
2494
2521
|
class: "v-craft-settings"
|
|
2495
|
-
},
|
|
2522
|
+
}, tn = {
|
|
2496
2523
|
class: "v-craft-actions",
|
|
2497
2524
|
"data-type": "button"
|
|
2498
|
-
},
|
|
2525
|
+
}, rn = /* @__PURE__ */ L({
|
|
2499
2526
|
__name: "CraftEditorPanelSettings",
|
|
2500
2527
|
setup(t) {
|
|
2501
|
-
const e = q(), { selectedNode: r, nodeDataMap: n } = se(e), o = ge("resolver"), s =
|
|
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(
|
|
2502
2529
|
() => r.value && r.value.parentUuid
|
|
2503
2530
|
), u = () => {
|
|
2504
2531
|
r.value && e.removeNode(r.value);
|
|
2505
|
-
},
|
|
2532
|
+
}, d = C(
|
|
2506
2533
|
() => r.value ? `${o?.value?.resolveNode(r.value)?.componentName || "Unknown"}` : ""
|
|
2507
2534
|
), m = (A) => {
|
|
2508
2535
|
r.value && A && e.updateNodeProps(r.value.uuid, A);
|
|
@@ -2513,23 +2540,23 @@ const er = /* @__PURE__ */ B({
|
|
|
2513
2540
|
r.value.uuid,
|
|
2514
2541
|
A
|
|
2515
2542
|
);
|
|
2516
|
-
},
|
|
2543
|
+
}, b = C(
|
|
2517
2544
|
() => r.value ? n.value[r.value.uuid] ?? null : null
|
|
2518
2545
|
), P = (A) => {
|
|
2519
2546
|
r.value && e.setNodeData(r.value.uuid, A);
|
|
2520
2547
|
};
|
|
2521
|
-
return (A,
|
|
2522
|
-
const
|
|
2548
|
+
return (A, T) => {
|
|
2549
|
+
const U = H("CraftEditorPanelNodeSettings"), _ = H("CraftEditorPanelNodeEventsSettings"), g = H("CraftEditorPanelNodeSlotPropsSettings"), w = H("CraftEditorPanelNodeDataSourceSettings");
|
|
2523
2550
|
return J(A.$slots, "panel-content", {
|
|
2524
|
-
selectedNode:
|
|
2525
|
-
nodeName:
|
|
2551
|
+
selectedNode: p(r),
|
|
2552
|
+
nodeName: d.value,
|
|
2526
2553
|
handlePropsUpdate: m,
|
|
2527
2554
|
schema: s.value,
|
|
2528
2555
|
eventsSchema: a.value,
|
|
2529
2556
|
handleEventsUpdate: f,
|
|
2530
2557
|
availableProps: i.value,
|
|
2531
2558
|
handleSlotsPropsPropsMapUpdate: h,
|
|
2532
|
-
nodeData:
|
|
2559
|
+
nodeData: b.value,
|
|
2533
2560
|
handleNodeDataUpdate: P,
|
|
2534
2561
|
deleteable: l.value,
|
|
2535
2562
|
removeNode: u
|
|
@@ -2539,59 +2566,59 @@ const er = /* @__PURE__ */ B({
|
|
|
2539
2566
|
class: "v-craft-panel v-craft-settings-panel",
|
|
2540
2567
|
onClick: V(() => !1, ["prevent", "stop"])
|
|
2541
2568
|
}, [
|
|
2542
|
-
|
|
2543
|
-
O("span",
|
|
2544
|
-
|
|
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] = [
|
|
2545
2572
|
O("p", null, "select a component to inspect", -1)
|
|
2546
2573
|
])])),
|
|
2547
2574
|
O("div", {
|
|
2548
|
-
class: ye(["v-craft-properties", { "v-craft-visible":
|
|
2575
|
+
class: ye(["v-craft-properties", { "v-craft-visible": p(r) }])
|
|
2549
2576
|
}, [
|
|
2550
|
-
O("h4", null, oe(
|
|
2551
|
-
s.value ? (v(),
|
|
2552
|
-
Q(
|
|
2553
|
-
craftNode:
|
|
2577
|
+
O("h4", null, oe(d.value), 1),
|
|
2578
|
+
s.value ? (v(), E("div", Wr, [
|
|
2579
|
+
Q(U, {
|
|
2580
|
+
craftNode: p(r),
|
|
2554
2581
|
schema: s.value,
|
|
2555
2582
|
"onUpdate:props": m
|
|
2556
2583
|
}, null, 8, ["craftNode", "schema"])
|
|
2557
|
-
])) :
|
|
2558
|
-
a.value &&
|
|
2559
|
-
Q(
|
|
2560
|
-
craftNode:
|
|
2584
|
+
])) : R("", !0),
|
|
2585
|
+
a.value && p(r) ? (v(), E("div", Zr, [
|
|
2586
|
+
Q(_, {
|
|
2587
|
+
craftNode: p(r),
|
|
2561
2588
|
schema: a.value,
|
|
2562
2589
|
"onUpdate:events": f
|
|
2563
2590
|
}, null, 8, ["craftNode", "schema"])
|
|
2564
|
-
])) :
|
|
2565
|
-
|
|
2566
|
-
Q(
|
|
2567
|
-
craftNode:
|
|
2591
|
+
])) : R("", !0),
|
|
2592
|
+
p(r) ? (v(), E("div", Jr, [
|
|
2593
|
+
Q(g, {
|
|
2594
|
+
craftNode: p(r),
|
|
2568
2595
|
availableProps: i.value,
|
|
2569
2596
|
"onUpdate:slotsPropsPropsMap": h
|
|
2570
2597
|
}, null, 8, ["craftNode", "availableProps"])
|
|
2571
|
-
])) :
|
|
2572
|
-
|
|
2598
|
+
])) : R("", !0),
|
|
2599
|
+
p(r) ? (v(), E("div", en, [
|
|
2573
2600
|
Q(w, {
|
|
2574
|
-
craftNode:
|
|
2575
|
-
nodeData:
|
|
2601
|
+
craftNode: p(r),
|
|
2602
|
+
nodeData: b.value,
|
|
2576
2603
|
"onUpdate:nodeData": P
|
|
2577
2604
|
}, null, 8, ["craftNode", "nodeData"])
|
|
2578
|
-
])) :
|
|
2579
|
-
O("div",
|
|
2580
|
-
l.value ? (v(),
|
|
2605
|
+
])) : R("", !0),
|
|
2606
|
+
O("div", tn, [
|
|
2607
|
+
l.value ? (v(), E("button", {
|
|
2581
2608
|
key: 0,
|
|
2582
2609
|
class: "formkit-input v-craft-delete",
|
|
2583
2610
|
onClick: V(u, ["prevent"])
|
|
2584
|
-
}, " Delete ")) :
|
|
2611
|
+
}, " Delete ")) : R("", !0)
|
|
2585
2612
|
])
|
|
2586
2613
|
], 2)
|
|
2587
2614
|
], 512)
|
|
2588
2615
|
]);
|
|
2589
2616
|
};
|
|
2590
2617
|
}
|
|
2591
|
-
}), Xe = /* @__PURE__ */
|
|
2618
|
+
}), Xe = /* @__PURE__ */ L({
|
|
2592
2619
|
__name: "CraftDropIndicator",
|
|
2593
2620
|
setup(t) {
|
|
2594
|
-
const e =
|
|
2621
|
+
const e = je(), r = () => {
|
|
2595
2622
|
const { top: n, left: o } = e.position, { width: s, height: a } = e.size;
|
|
2596
2623
|
return {
|
|
2597
2624
|
top: `${n}px`,
|
|
@@ -2600,13 +2627,13 @@ const er = /* @__PURE__ */ B({
|
|
|
2600
2627
|
width: `${s}px`
|
|
2601
2628
|
};
|
|
2602
2629
|
};
|
|
2603
|
-
return (n, o) =>
|
|
2630
|
+
return (n, o) => p(e).isShown ? (v(), E("div", {
|
|
2604
2631
|
key: 0,
|
|
2605
|
-
class: ye(["v-craft-indicator", { "v-craft-forbidden":
|
|
2606
|
-
style:
|
|
2607
|
-
}, null, 6)) :
|
|
2632
|
+
class: ye(["v-craft-indicator", { "v-craft-forbidden": p(e).isForbidden }]),
|
|
2633
|
+
style: Te(r())
|
|
2634
|
+
}, null, 6)) : R("", !0);
|
|
2608
2635
|
}
|
|
2609
|
-
}), it = /* @__PURE__ */
|
|
2636
|
+
}), it = /* @__PURE__ */ L({
|
|
2610
2637
|
__name: "CraftIframe",
|
|
2611
2638
|
props: {
|
|
2612
2639
|
iframeClass: { type: [Boolean, null, String, Object, Array], default: "" },
|
|
@@ -2624,7 +2651,7 @@ const er = /* @__PURE__ */ B({
|
|
|
2624
2651
|
console.error("iframe could not be loaded.");
|
|
2625
2652
|
return;
|
|
2626
2653
|
}
|
|
2627
|
-
m("iframeLoad", n.value), n.value?.setAttribute("data-iframe-ready", "true"),
|
|
2654
|
+
m("iframeLoad", n.value), n.value?.setAttribute("data-iframe-ready", "true"), d(), r.inheritStyles && i(), r.styles.forEach((f) => {
|
|
2628
2655
|
n.value && l(n.value, f);
|
|
2629
2656
|
}), r.styleSheets.forEach((f) => {
|
|
2630
2657
|
n.value && u(n.value, f);
|
|
@@ -2641,40 +2668,40 @@ const er = /* @__PURE__ */ B({
|
|
|
2641
2668
|
n.value?.contentDocument?.head.appendChild(P.cloneNode(!0));
|
|
2642
2669
|
});
|
|
2643
2670
|
}, l = (f, h) => {
|
|
2644
|
-
const
|
|
2645
|
-
|
|
2671
|
+
const b = document.createElement("style");
|
|
2672
|
+
b.innerHTML = h, f?.contentWindow?.document.getElementsByTagName("head").item(0)?.appendChild(b);
|
|
2646
2673
|
}, u = (f, h) => {
|
|
2647
|
-
const
|
|
2648
|
-
|
|
2649
|
-
},
|
|
2674
|
+
const b = document.createElement("link");
|
|
2675
|
+
b.rel = "stylesheet", b.href = h, f.contentWindow?.document.head.appendChild(b);
|
|
2676
|
+
}, d = () => {
|
|
2650
2677
|
const f = n.value?.contentWindow?.document;
|
|
2651
2678
|
if (!f) return;
|
|
2652
2679
|
const h = f.querySelector("body");
|
|
2653
2680
|
if (!h) return;
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2681
|
+
const b = f.createAttribute("id");
|
|
2682
|
+
b.nodeValue = "v-craft-body", h.attributes.setNamedItem(b);
|
|
2656
2683
|
}, m = e;
|
|
2657
|
-
return (f, h) =>
|
|
2684
|
+
return (f, h) => _t((v(), E("div", null, [
|
|
2658
2685
|
O("iframe", {
|
|
2659
2686
|
id: "v-craft-iframe",
|
|
2660
2687
|
ref_key: "iframeRef",
|
|
2661
2688
|
ref: n,
|
|
2662
2689
|
class: ye(t.iframeClass),
|
|
2663
|
-
style:
|
|
2690
|
+
style: Te(t.iframeStyle),
|
|
2664
2691
|
onload: a
|
|
2665
2692
|
}, null, 6),
|
|
2666
|
-
o.value ? (v(),
|
|
2693
|
+
o.value ? (v(), M(St, {
|
|
2667
2694
|
key: 0,
|
|
2668
2695
|
to: n.value?.contentWindow?.document.body
|
|
2669
2696
|
}, [
|
|
2670
2697
|
J(f.$slots, "default")
|
|
2671
|
-
], 8, ["to"])) :
|
|
2698
|
+
], 8, ["to"])) : R("", !0)
|
|
2672
2699
|
], 512)), [
|
|
2673
|
-
[
|
|
2700
|
+
[xt, f.$slots.default]
|
|
2674
2701
|
]);
|
|
2675
2702
|
}
|
|
2676
|
-
}),
|
|
2677
|
-
const n =
|
|
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 = {
|
|
2678
2705
|
componentName: n,
|
|
2679
2706
|
props: o,
|
|
2680
2707
|
slots: {},
|
|
@@ -2695,7 +2722,7 @@ const er = /* @__PURE__ */ B({
|
|
|
2695
2722
|
e.children,
|
|
2696
2723
|
s
|
|
2697
2724
|
))), s;
|
|
2698
|
-
}, ze = (t, e, r) => !e || !(e instanceof Array) ? [] : e.map((n) =>
|
|
2725
|
+
}, ze = (t, e, r) => !e || !(e instanceof Array) ? [] : e.map((n) => Re(t, n, r)).filter((n) => !!n), on = (t) => {
|
|
2699
2726
|
const e = q(), { hasNodes: r } = se(e), n = t ? K(new Oe(t)) : ge("resolver");
|
|
2700
2727
|
n?.value && e.setResolver(n.value), t && te("resolver", n);
|
|
2701
2728
|
const o = () => {
|
|
@@ -2703,18 +2730,18 @@ const er = /* @__PURE__ */ B({
|
|
|
2703
2730
|
const s = Qe(), i = (s.default ? s.default() : []).flatMap((l) => {
|
|
2704
2731
|
if (l.key === "_default" && l.children && Array.isArray(l.children))
|
|
2705
2732
|
return l.children.map((u) => {
|
|
2706
|
-
const
|
|
2707
|
-
return
|
|
2733
|
+
const d = Re(n.value, u);
|
|
2734
|
+
return d || console.error("Invalid node created from child:", u), d;
|
|
2708
2735
|
}).filter(Boolean);
|
|
2709
2736
|
{
|
|
2710
|
-
const u =
|
|
2737
|
+
const u = Re(n.value, l);
|
|
2711
2738
|
return u || console.error("Invalid node created from slot:", l), [u];
|
|
2712
2739
|
}
|
|
2713
2740
|
}).filter(Boolean);
|
|
2714
2741
|
i.length && e.setNodes(i);
|
|
2715
2742
|
}
|
|
2716
2743
|
};
|
|
2717
|
-
return
|
|
2744
|
+
return xe(o), ne(
|
|
2718
2745
|
() => n?.value,
|
|
2719
2746
|
(s) => {
|
|
2720
2747
|
s && e.setResolver(s);
|
|
@@ -2723,7 +2750,7 @@ const er = /* @__PURE__ */ B({
|
|
|
2723
2750
|
editor: e,
|
|
2724
2751
|
mountNodes: o
|
|
2725
2752
|
};
|
|
2726
|
-
},
|
|
2753
|
+
}, sn = { class: "v-craft-frame" }, an = /* @__PURE__ */ L({
|
|
2727
2754
|
name: "CraftFrame",
|
|
2728
2755
|
__name: "CraftFrame",
|
|
2729
2756
|
props: {
|
|
@@ -2733,67 +2760,67 @@ const er = /* @__PURE__ */ B({
|
|
|
2733
2760
|
},
|
|
2734
2761
|
emits: ["iframeLoad"],
|
|
2735
2762
|
setup(t, { emit: e }) {
|
|
2736
|
-
const r = t, { iframe: n } = be(r), o = (
|
|
2737
|
-
s("iframeLoad",
|
|
2738
|
-
}, s = e, { editor: a } =
|
|
2739
|
-
return (
|
|
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) => {
|
|
2740
2767
|
const f = H("CraftNodeViewer"), h = H("CraftNodeEditor");
|
|
2741
|
-
return v(),
|
|
2742
|
-
|
|
2768
|
+
return v(), E("div", sn, [
|
|
2769
|
+
p(n) ? (v(), M(it, {
|
|
2743
2770
|
key: 0,
|
|
2744
2771
|
onIframeLoad: o,
|
|
2745
|
-
inheritStyles:
|
|
2746
|
-
iframeStyle:
|
|
2747
|
-
iframeClass:
|
|
2748
|
-
class: ye(
|
|
2749
|
-
style:
|
|
2750
|
-
styles:
|
|
2751
|
-
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
|
|
2752
2779
|
}, {
|
|
2753
2780
|
default: G(() => [
|
|
2754
|
-
(t.viewOnly || !
|
|
2755
|
-
key: `${
|
|
2756
|
-
craftNode:
|
|
2757
|
-
}, null, 8, ["craftNode"]))), 128)) :
|
|
2758
|
-
!t.viewOnly &&
|
|
2759
|
-
key: `${
|
|
2760
|
-
craftNode:
|
|
2761
|
-
}, null, 8, ["craftNode"]))), 128)) :
|
|
2762
|
-
!t.viewOnly &&
|
|
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)
|
|
2763
2790
|
]),
|
|
2764
2791
|
_: 1
|
|
2765
|
-
}, 8, ["inheritStyles", "iframeStyle", "iframeClass", "class", "style", "styles", "styleSheets"])) :
|
|
2766
|
-
!
|
|
2767
|
-
key: `${
|
|
2768
|
-
craftNode:
|
|
2769
|
-
}, null, 8, ["craftNode"]))), 128)) :
|
|
2770
|
-
!
|
|
2771
|
-
key: `${
|
|
2772
|
-
craftNode:
|
|
2773
|
-
}, null, 8, ["craftNode"]))), 128)) :
|
|
2774
|
-
!
|
|
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)
|
|
2775
2802
|
]);
|
|
2776
2803
|
};
|
|
2777
2804
|
}
|
|
2778
|
-
}),
|
|
2805
|
+
}), ln = (t, e) => {
|
|
2779
2806
|
const r = q(), { enabled: n, selectedUuid: o, draggingDisabled: s } = se(r);
|
|
2780
2807
|
let a = null;
|
|
2781
2808
|
const i = () => {
|
|
2782
2809
|
const m = e?.value?.$el;
|
|
2783
2810
|
m && m !== a && (a = m, r.setNodeRef(t, m));
|
|
2784
2811
|
};
|
|
2785
|
-
|
|
2786
|
-
const l =
|
|
2812
|
+
xe(i), ne(e, i, { flush: "post" });
|
|
2813
|
+
const l = C(
|
|
2787
2814
|
() => o.value === t.uuid
|
|
2788
2815
|
);
|
|
2789
2816
|
return {
|
|
2790
|
-
isDraggable:
|
|
2817
|
+
isDraggable: C(() => n.value && !s.value && Zt(t)),
|
|
2791
2818
|
isSelected: l,
|
|
2792
2819
|
selectNode: () => {
|
|
2793
2820
|
n.value && r.selectNode(t);
|
|
2794
2821
|
}
|
|
2795
2822
|
};
|
|
2796
|
-
},
|
|
2823
|
+
}, Be = (t, e, r = {}) => {
|
|
2797
2824
|
const n = /* @__PURE__ */ new Map(), o = () => {
|
|
2798
2825
|
!t.value?.events || !Object.values(t.value.events).length || Object.entries(t.value.events).forEach(([s, a]) => {
|
|
2799
2826
|
if (!a.trim())
|
|
@@ -2833,7 +2860,7 @@ Error:`,
|
|
|
2833
2860
|
}), wt(() => {
|
|
2834
2861
|
n.clear();
|
|
2835
2862
|
}), {
|
|
2836
|
-
eventHandlers:
|
|
2863
|
+
eventHandlers: C(() => Object.fromEntries(n))
|
|
2837
2864
|
};
|
|
2838
2865
|
}, lt = (t) => {
|
|
2839
2866
|
const e = (() => {
|
|
@@ -2842,7 +2869,7 @@ Error:`,
|
|
|
2842
2869
|
} catch {
|
|
2843
2870
|
return null;
|
|
2844
2871
|
}
|
|
2845
|
-
})(), r =
|
|
2872
|
+
})(), r = C(() => e ? se(e).enabled?.value ?? !1 : !1), n = C(() => t.value?.visible !== !1);
|
|
2846
2873
|
return te("craftNode", We(t)), {
|
|
2847
2874
|
editor: e,
|
|
2848
2875
|
craftNode: t,
|
|
@@ -2863,13 +2890,13 @@ Error:`,
|
|
|
2863
2890
|
return t.clientX - r.left < 15 || t.clientY - r.top < 15 || r.right - t.clientX < 15 || r.bottom - t.clientY < 15;
|
|
2864
2891
|
}, pt = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
|
|
2865
2892
|
if (r.draggedNode) {
|
|
2866
|
-
if (n.setIsForbidden(!
|
|
2893
|
+
if (n.setIsForbidden(!_e(r.draggedNode, o.value, s)), ut(t, e)) {
|
|
2867
2894
|
n.pointBefore(e);
|
|
2868
2895
|
return;
|
|
2869
2896
|
}
|
|
2870
2897
|
n.pointAfter(e);
|
|
2871
2898
|
}
|
|
2872
|
-
},
|
|
2899
|
+
}, un = (t, e, { editor: r, indicator: n, craftNode: o, resolver: s }) => {
|
|
2873
2900
|
if (!r.draggedNode) return;
|
|
2874
2901
|
const i = t.target.closest(".v-craft-drop-text");
|
|
2875
2902
|
if (i) {
|
|
@@ -2887,14 +2914,14 @@ Error:`,
|
|
|
2887
2914
|
return;
|
|
2888
2915
|
}
|
|
2889
2916
|
n.pointInside(e);
|
|
2890
|
-
},
|
|
2917
|
+
}, cn = (t, e, r) => {
|
|
2891
2918
|
if (W(r.craftNode.value)) {
|
|
2892
|
-
|
|
2919
|
+
un(t, e, r);
|
|
2893
2920
|
return;
|
|
2894
2921
|
}
|
|
2895
2922
|
pt(t, e, r);
|
|
2896
2923
|
}, ft = (t, e, r, n) => {
|
|
2897
|
-
if (!
|
|
2924
|
+
if (!_e(
|
|
2898
2925
|
r,
|
|
2899
2926
|
n.craftNode.value,
|
|
2900
2927
|
n.resolver
|
|
@@ -2913,15 +2940,15 @@ Error:`,
|
|
|
2913
2940
|
craftNode: K(l)
|
|
2914
2941
|
}), n.craftNode.value;
|
|
2915
2942
|
const u = i.closest(".v-craft-drop-text");
|
|
2916
|
-
let
|
|
2943
|
+
let d = "default";
|
|
2917
2944
|
if (u) {
|
|
2918
2945
|
const m = u.getAttribute("data-slot-name");
|
|
2919
|
-
m && (
|
|
2946
|
+
m && (d = m);
|
|
2920
2947
|
} else {
|
|
2921
2948
|
if (dt(t, e))
|
|
2922
2949
|
return ft(t, e, r, n);
|
|
2923
2950
|
const m = n.craftNode.value.slots || {}, f = Object.keys(m);
|
|
2924
|
-
|
|
2951
|
+
d = f.length > 0 ? f[0] : "default";
|
|
2925
2952
|
}
|
|
2926
2953
|
return me(
|
|
2927
2954
|
r,
|
|
@@ -2930,9 +2957,9 @@ Error:`,
|
|
|
2930
2957
|
) && (ct(t, e) ? n.editor.prependNodeTo(
|
|
2931
2958
|
r,
|
|
2932
2959
|
n.craftNode.value,
|
|
2933
|
-
|
|
2934
|
-
) : n.editor.appendNodeTo(r, n.craftNode.value,
|
|
2935
|
-
},
|
|
2960
|
+
d
|
|
2961
|
+
) : n.editor.appendNodeTo(r, n.craftNode.value, d)), n.craftNode.value;
|
|
2962
|
+
}, dn = (t, e, r) => {
|
|
2936
2963
|
if (!r.editor.draggedNode)
|
|
2937
2964
|
return r.craftNode.value;
|
|
2938
2965
|
const n = (() => {
|
|
@@ -2943,10 +2970,10 @@ Error:`,
|
|
|
2943
2970
|
})();
|
|
2944
2971
|
return W(r.craftNode.value) ? ht(t, e, n, r) : ft(t, e, n, r);
|
|
2945
2972
|
}, qe = {
|
|
2946
|
-
handleDragOver:
|
|
2947
|
-
handleDrop:
|
|
2948
|
-
},
|
|
2949
|
-
const n = q(), o =
|
|
2973
|
+
handleDragOver: cn,
|
|
2974
|
+
handleDrop: dn
|
|
2975
|
+
}, pn = (t, e, r) => {
|
|
2976
|
+
const n = q(), o = je(), s = (u) => {
|
|
2950
2977
|
n.enabled && n.dragNode(t.value);
|
|
2951
2978
|
}, a = Je((u) => {
|
|
2952
2979
|
n.enabled && e.value?.$el && qe.handleDragOver(u, e.value.$el, {
|
|
@@ -2971,7 +2998,7 @@ Error:`,
|
|
|
2971
2998
|
n.enabled && n.dragNode(null);
|
|
2972
2999
|
}
|
|
2973
3000
|
};
|
|
2974
|
-
},
|
|
3001
|
+
}, fn = ["data-slot-name"], hn = { class: "v-craft-slot-name" }, vn = /* @__PURE__ */ L({
|
|
2975
3002
|
name: "CraftNodeEditor",
|
|
2976
3003
|
__name: "CraftNodeEditor",
|
|
2977
3004
|
props: {
|
|
@@ -2979,86 +3006,86 @@ Error:`,
|
|
|
2979
3006
|
context: {}
|
|
2980
3007
|
},
|
|
2981
3008
|
setup(t) {
|
|
2982
|
-
const e = t, { craftNode: r } = be(e), { editor: n, visible: o } = lt(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } =
|
|
2983
|
-
const Z = a?.value?.getSlotsProps?.(r.value)?.[
|
|
2984
|
-
Z.filter((Y) => Y in
|
|
2985
|
-
) :
|
|
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 = {
|
|
2986
3013
|
...e.context || {},
|
|
2987
|
-
[
|
|
3014
|
+
[x]: z
|
|
2988
3015
|
};
|
|
2989
3016
|
return F !== void 0 && (pe.data = F), pe;
|
|
2990
3017
|
};
|
|
2991
3018
|
ne(
|
|
2992
3019
|
a,
|
|
2993
|
-
(
|
|
2994
|
-
|
|
3020
|
+
(x) => {
|
|
3021
|
+
x && te("resolver", a);
|
|
2995
3022
|
},
|
|
2996
3023
|
{ immediate: !0 }
|
|
2997
3024
|
);
|
|
2998
|
-
const
|
|
3025
|
+
const d = K(null), m = K(null), f = C(() => n?.nodeDataMap[r.value.uuid]), { isSelected: h, isDraggable: b, selectNode: P } = ln(
|
|
2999
3026
|
r.value,
|
|
3000
|
-
|
|
3001
|
-
), { handleDragStart: A, handleDragOver:
|
|
3027
|
+
d
|
|
3028
|
+
), { handleDragStart: A, handleDragOver: T, handleDrop: U, handleDragEnd: _ } = pn(r, d, a.value), { eventHandlers: g } = Be(
|
|
3002
3029
|
r,
|
|
3003
3030
|
n?.eventsContext || {},
|
|
3004
3031
|
{
|
|
3005
3032
|
getNodes: () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
|
|
3006
|
-
getNode: (
|
|
3033
|
+
getNode: (x) => n?.nodeMap.get(x) ?? null,
|
|
3007
3034
|
nodeValues: n?.nodeRuntimeProps,
|
|
3008
|
-
setNodeProps: (
|
|
3035
|
+
setNodeProps: (x, D) => n?.setNodeRuntimeProps(x, D),
|
|
3009
3036
|
state: n?.pageState
|
|
3010
3037
|
}
|
|
3011
|
-
), w =
|
|
3012
|
-
n?.setNodeRuntimeProps(r.value.uuid, { value:
|
|
3013
|
-
},
|
|
3014
|
-
const
|
|
3015
|
-
F(...Z),
|
|
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);
|
|
3016
3043
|
};
|
|
3017
3044
|
return {
|
|
3018
|
-
...
|
|
3019
|
-
input:
|
|
3020
|
-
change:
|
|
3021
|
-
"update:modelValue":
|
|
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))
|
|
3022
3049
|
};
|
|
3023
|
-
}),
|
|
3024
|
-
const
|
|
3025
|
-
return
|
|
3026
|
-
}),
|
|
3027
|
-
const
|
|
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(
|
|
3028
3055
|
`[data-craft-uuid="${r.value.uuid}"]`
|
|
3029
3056
|
);
|
|
3030
|
-
if (
|
|
3031
|
-
let F =
|
|
3057
|
+
if (D) return D;
|
|
3058
|
+
let F = d.value?.$el;
|
|
3032
3059
|
for (; F && !(F instanceof HTMLElement); )
|
|
3033
3060
|
F = F.nextElementSibling ?? null;
|
|
3034
3061
|
return F ?? null;
|
|
3035
|
-
}, ce = (
|
|
3036
|
-
if (!(
|
|
3037
|
-
console.error("resolveNodeEl returned a non-Element:",
|
|
3062
|
+
}, ce = (x, D, F) => {
|
|
3063
|
+
if (!(x instanceof Element)) {
|
|
3064
|
+
console.error("resolveNodeEl returned a non-Element:", x);
|
|
3038
3065
|
return;
|
|
3039
3066
|
}
|
|
3040
|
-
|
|
3067
|
+
x.style.setProperty("--node-name", D), x.style.setProperty("--node-color", F), x.setAttribute("data-node-name", D);
|
|
3041
3068
|
}, de = () => {
|
|
3042
|
-
const
|
|
3043
|
-
|
|
3069
|
+
const x = X();
|
|
3070
|
+
x && (m.value = x, ce(x, S.value ?? "(n/a)", I.value));
|
|
3044
3071
|
};
|
|
3045
|
-
|
|
3046
|
-
m.value && ce(m.value,
|
|
3072
|
+
xe(() => ve(de)), kt(() => ve(de)), ne([S, I], () => {
|
|
3073
|
+
m.value && ce(m.value, S.value ?? "", I.value);
|
|
3047
3074
|
});
|
|
3048
|
-
const vt =
|
|
3049
|
-
const
|
|
3050
|
-
return
|
|
3051
|
-
}), mt =
|
|
3052
|
-
(
|
|
3053
|
-
)), gt = () => P(), yt = (
|
|
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) => ({
|
|
3054
3081
|
key: `${F.uuid}-single`,
|
|
3055
3082
|
craftNode: {
|
|
3056
3083
|
...F,
|
|
3057
|
-
props: { ...F.props, ...
|
|
3084
|
+
props: { ...F.props, ...x.item || {} }
|
|
3058
3085
|
},
|
|
3059
|
-
dataItem:
|
|
3060
|
-
})) :
|
|
3061
|
-
|
|
3086
|
+
dataItem: x.item || {}
|
|
3087
|
+
})) : x.type === "list" ? x.list ? D.reduce((F, Z) => F.concat(
|
|
3088
|
+
x.list.map((z, pe) => ({
|
|
3062
3089
|
key: `${Z.uuid}-data-${pe}`,
|
|
3063
3090
|
craftNode: {
|
|
3064
3091
|
...Z,
|
|
@@ -3067,73 +3094,73 @@ Error:`,
|
|
|
3067
3094
|
dataItem: z || {}
|
|
3068
3095
|
}))
|
|
3069
3096
|
), []) : [] : [];
|
|
3070
|
-
return (
|
|
3097
|
+
return (x, D) => {
|
|
3071
3098
|
const F = H("CraftNodeViewer"), Z = H("CraftNodeEditor", !0);
|
|
3072
|
-
return
|
|
3099
|
+
return p(o) && p(r) && p(s) ? (v(), M(Ce(p(i)), Se({
|
|
3073
3100
|
key: 0,
|
|
3074
3101
|
ref_key: "nodeRef",
|
|
3075
|
-
ref:
|
|
3102
|
+
ref: d
|
|
3076
3103
|
}, {
|
|
3077
|
-
...
|
|
3104
|
+
...p(l),
|
|
3078
3105
|
...w.value,
|
|
3079
|
-
"data-craft-uuid":
|
|
3080
|
-
},
|
|
3106
|
+
"data-craft-uuid": p(r).uuid
|
|
3107
|
+
}, Ue(N.value), {
|
|
3081
3108
|
class: {
|
|
3082
|
-
"v-craft-node-selected":
|
|
3083
|
-
"v-craft-node":
|
|
3084
|
-
"v-craft-canvas":
|
|
3085
|
-
"v-craft-empty": !
|
|
3086
|
-
"v-craft-other-node-dragged":
|
|
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))
|
|
3087
3114
|
},
|
|
3088
|
-
draggable:
|
|
3115
|
+
draggable: p(n)?.enabled && p(b),
|
|
3089
3116
|
onClick: V(gt, ["prevent", "stop"]),
|
|
3090
|
-
onDragend: V(
|
|
3091
|
-
onDragover: V(
|
|
3092
|
-
onDragstart: V(
|
|
3093
|
-
onDrop: V(
|
|
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"])
|
|
3094
3121
|
}), Ne({ _: 2 }, [
|
|
3095
|
-
|
|
3122
|
+
j(vt.value, (z) => ({
|
|
3096
3123
|
name: z,
|
|
3097
3124
|
fn: G((pe) => [
|
|
3098
|
-
|
|
3125
|
+
p(W)(p(r)) && (!p(r).slots || p(r).slots[z]?.length == 0) ? (v(), E("div", {
|
|
3099
3126
|
key: 0,
|
|
3100
3127
|
class: "v-craft-drop-text",
|
|
3101
3128
|
"data-slot-name": z,
|
|
3102
|
-
onDragover:
|
|
3129
|
+
onDragover: D[0] || (D[0] = V(
|
|
3103
3130
|
//@ts-ignore
|
|
3104
|
-
(...Y) =>
|
|
3131
|
+
(...Y) => p(T) && p(T)(...Y),
|
|
3105
3132
|
["prevent", "stop"]
|
|
3106
3133
|
)),
|
|
3107
|
-
onDrop:
|
|
3134
|
+
onDrop: D[1] || (D[1] = V(
|
|
3108
3135
|
//@ts-ignore
|
|
3109
|
-
(...Y) =>
|
|
3136
|
+
(...Y) => p(U) && p(U)(...Y),
|
|
3110
3137
|
["prevent", "stop"]
|
|
3111
3138
|
))
|
|
3112
3139
|
}, [
|
|
3113
|
-
|
|
3114
|
-
O("span",
|
|
3115
|
-
], 40,
|
|
3116
|
-
mt.value ? (v(),
|
|
3117
|
-
f.value?.type && (!f.value.slotName || f.value.slotName === z) ? (v(!0),
|
|
3118
|
-
|
|
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] || [],
|
|
3119
3146
|
z
|
|
3120
|
-
), (Y) => (v(),
|
|
3147
|
+
), (Y) => (v(), M(F, {
|
|
3121
3148
|
key: Y.key,
|
|
3122
3149
|
craftNode: Y.craftNode,
|
|
3123
3150
|
context: u(z, pe, Y.dataItem)
|
|
3124
|
-
}, null, 8, ["craftNode", "context"]))), 128)) :
|
|
3125
|
-
(v(!0),
|
|
3151
|
+
}, null, 8, ["craftNode", "context"]))), 128)) : R("", !0),
|
|
3152
|
+
(v(!0), E(B, null, j(p(r).slots?.[z] || [], (Y) => (v(), M(Z, {
|
|
3126
3153
|
key: Y.uuid,
|
|
3127
3154
|
craftNode: Y,
|
|
3128
3155
|
context: u(z, pe)
|
|
3129
3156
|
}, null, 8, ["craftNode", "context"]))), 128))
|
|
3130
|
-
], 64)) :
|
|
3157
|
+
], 64)) : R("", !0)
|
|
3131
3158
|
])
|
|
3132
3159
|
}))
|
|
3133
|
-
]), 1040, ["class", "draggable", "onDragend", "onDragover", "onDragstart", "onDrop"])) :
|
|
3160
|
+
]), 1040, ["class", "draggable", "onDragend", "onDragover", "onDragstart", "onDrop"])) : R("", !0);
|
|
3134
3161
|
};
|
|
3135
3162
|
}
|
|
3136
|
-
}),
|
|
3163
|
+
}), Me = /* @__PURE__ */ L({
|
|
3137
3164
|
name: "CraftNodeViewer",
|
|
3138
3165
|
__name: "CraftNodeViewer",
|
|
3139
3166
|
props: {
|
|
@@ -3143,94 +3170,94 @@ Error:`,
|
|
|
3143
3170
|
context: {}
|
|
3144
3171
|
},
|
|
3145
3172
|
setup(t) {
|
|
3146
|
-
const e = t, r = he(e, "craftNode"), { editor: n, visible: o } = lt(r), { resolvedNode: s, resolver: a, componentToRender: i, props: l } =
|
|
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 || {});
|
|
3147
3174
|
te("resolver", a);
|
|
3148
|
-
const u = (y,
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3151
|
-
) :
|
|
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 = {
|
|
3152
3179
|
...e.context || {},
|
|
3153
3180
|
[y]: X
|
|
3154
3181
|
};
|
|
3155
|
-
return
|
|
3156
|
-
},
|
|
3157
|
-
if (!
|
|
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)
|
|
3158
3185
|
return [];
|
|
3159
|
-
const y = [],
|
|
3160
|
-
return
|
|
3161
|
-
}),
|
|
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(
|
|
3162
3189
|
r,
|
|
3163
3190
|
e.eventsContext || n?.eventsContext || {},
|
|
3164
3191
|
{
|
|
3165
3192
|
getNodes: () => n?.nodeMap ? Object.fromEntries(n.nodeMap.entries()) : null,
|
|
3166
3193
|
getNode: (y) => n?.nodeMap.get(y) ?? null,
|
|
3167
3194
|
nodeValues: n?.nodeRuntimeProps,
|
|
3168
|
-
setNodeProps: (y,
|
|
3195
|
+
setNodeProps: (y, N) => n?.setNodeRuntimeProps(y, N),
|
|
3169
3196
|
state: n?.pageState
|
|
3170
3197
|
}
|
|
3171
|
-
),
|
|
3198
|
+
), U = C(() => n?.nodeRuntimeProps[r.value.uuid] || {}), _ = (y) => {
|
|
3172
3199
|
n?.setNodeRuntimeProps(r.value.uuid, { value: y });
|
|
3173
|
-
},
|
|
3174
|
-
const y = (
|
|
3175
|
-
|
|
3200
|
+
}, g = C(() => {
|
|
3201
|
+
const y = (N, S) => (...I) => {
|
|
3202
|
+
S(...I), T.value[N]?.(...I);
|
|
3176
3203
|
};
|
|
3177
3204
|
return {
|
|
3178
|
-
...
|
|
3179
|
-
input: y("input", (
|
|
3180
|
-
change: y("change", (
|
|
3181
|
-
"update:modelValue": y("update:modelValue", (
|
|
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))
|
|
3182
3209
|
};
|
|
3183
3210
|
});
|
|
3184
|
-
|
|
3211
|
+
xe(() => {
|
|
3185
3212
|
A.value && r.value && n && n.setNodeRef(r.value, A.value);
|
|
3186
3213
|
});
|
|
3187
|
-
const w = (y,
|
|
3188
|
-
key: `${
|
|
3214
|
+
const w = (y, N) => y.type === "single" ? N.map((S) => ({
|
|
3215
|
+
key: `${S.uuid}-single`,
|
|
3189
3216
|
craftNode: {
|
|
3190
|
-
...
|
|
3217
|
+
...S,
|
|
3191
3218
|
props: {
|
|
3192
|
-
...
|
|
3219
|
+
...S.props,
|
|
3193
3220
|
...y.item || {}
|
|
3194
3221
|
}
|
|
3195
3222
|
},
|
|
3196
3223
|
dataItem: y.item || {}
|
|
3197
|
-
})) : y.type === "list" ? y.list ?
|
|
3224
|
+
})) : y.type === "list" ? y.list ? N.reduce((S, I) => S.concat(
|
|
3198
3225
|
//@ts-ignore
|
|
3199
3226
|
y.list.map((X, ce) => ({
|
|
3200
|
-
key: `${
|
|
3227
|
+
key: `${I.uuid}-data-${ce}`,
|
|
3201
3228
|
craftNode: {
|
|
3202
|
-
...
|
|
3229
|
+
...I,
|
|
3203
3230
|
props: {
|
|
3204
|
-
...
|
|
3231
|
+
...I.props,
|
|
3205
3232
|
...X || {}
|
|
3206
3233
|
}
|
|
3207
3234
|
}
|
|
3208
3235
|
}))
|
|
3209
3236
|
), []) : [] : [];
|
|
3210
|
-
return (y,
|
|
3237
|
+
return (y, N) => p(o) && p(a) && p(s) ? (v(), M(Ce(p(i)), Se({
|
|
3211
3238
|
key: 0,
|
|
3212
3239
|
ref_key: "nodeRef",
|
|
3213
3240
|
ref: A
|
|
3214
|
-
}, { ...
|
|
3215
|
-
|
|
3216
|
-
name:
|
|
3217
|
-
fn: G((
|
|
3218
|
-
|
|
3219
|
-
|
|
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, {
|
|
3220
3247
|
key: X.key,
|
|
3221
3248
|
craftNode: X.craftNode,
|
|
3222
|
-
context: u(
|
|
3223
|
-
}, null, 8, ["craftNode", "context"]))), 128)) : (v(!0),
|
|
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, {
|
|
3224
3251
|
key: X.uuid,
|
|
3225
3252
|
craftNode: X,
|
|
3226
|
-
context: u(
|
|
3253
|
+
context: u(S, I)
|
|
3227
3254
|
}, null, 8, ["craftNode", "context"]))), 128))
|
|
3228
|
-
], 64)) :
|
|
3255
|
+
], 64)) : R("", !0)
|
|
3229
3256
|
])
|
|
3230
3257
|
}))
|
|
3231
|
-
]), 1040)) :
|
|
3258
|
+
]), 1040)) : R("", !0);
|
|
3232
3259
|
}
|
|
3233
|
-
}),
|
|
3260
|
+
}), $e = /* @__PURE__ */ L({
|
|
3234
3261
|
name: "CraftNodeStatic",
|
|
3235
3262
|
__name: "CraftNodeStatic",
|
|
3236
3263
|
props: {
|
|
@@ -3243,101 +3270,101 @@ Error:`,
|
|
|
3243
3270
|
context: {}
|
|
3244
3271
|
},
|
|
3245
3272
|
setup(t) {
|
|
3246
|
-
const e = t, { craftNode: r, nodeMap: n } = be(e), { resolvedNode: o, resolver: s, componentToRender: a, props: i } =
|
|
3273
|
+
const e = t, { craftNode: r, nodeMap: n } = be(e), { resolvedNode: o, resolver: s, componentToRender: a, props: i } = Pe(r, () => e.context || {});
|
|
3247
3274
|
te("resolver", s), te("craftNode", We(r.value));
|
|
3248
|
-
const l = (
|
|
3249
|
-
const
|
|
3250
|
-
|
|
3251
|
-
) : w,
|
|
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 = {
|
|
3252
3279
|
...e.context || {},
|
|
3253
|
-
[
|
|
3280
|
+
[g]: S
|
|
3254
3281
|
};
|
|
3255
|
-
return y !== void 0 && (
|
|
3256
|
-
}, u =
|
|
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(() => {
|
|
3257
3284
|
if (!h.value)
|
|
3258
3285
|
return [];
|
|
3259
|
-
const
|
|
3260
|
-
return y && y.length > 0 ?
|
|
3261
|
-
}), h =
|
|
3262
|
-
e.nodeRuntimeProps && (e.nodeRuntimeProps[
|
|
3263
|
-
}, { eventHandlers: A } =
|
|
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(
|
|
3264
3291
|
r,
|
|
3265
3292
|
e.eventsContext || {},
|
|
3266
3293
|
{
|
|
3267
3294
|
getNodes: () => Object.fromEntries(n.value.entries()),
|
|
3268
|
-
getNode: (
|
|
3295
|
+
getNode: (g) => n.value.get(g) ?? null,
|
|
3269
3296
|
nodeValues: e.nodeRuntimeProps,
|
|
3270
3297
|
setNodeProps: P,
|
|
3271
3298
|
state: e.pageState
|
|
3272
3299
|
}
|
|
3273
|
-
),
|
|
3300
|
+
), T = C(() => ({
|
|
3274
3301
|
...i.value,
|
|
3275
3302
|
...e.nodeRuntimeProps?.[r.value.uuid] || {}
|
|
3276
|
-
})),
|
|
3277
|
-
const
|
|
3278
|
-
y(...
|
|
3303
|
+
})), U = C(() => {
|
|
3304
|
+
const g = (w, y) => (...N) => {
|
|
3305
|
+
y(...N), A.value[w]?.(...N);
|
|
3279
3306
|
};
|
|
3280
3307
|
return {
|
|
3281
3308
|
...A.value,
|
|
3282
|
-
input:
|
|
3283
|
-
change:
|
|
3284
|
-
"update:modelValue":
|
|
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 }))
|
|
3285
3312
|
};
|
|
3286
|
-
}),
|
|
3313
|
+
}), _ = (g, w) => g.type === "single" ? w.map((y) => ({
|
|
3287
3314
|
key: `${y.uuid}-single`,
|
|
3288
3315
|
craftNode: {
|
|
3289
3316
|
...y,
|
|
3290
3317
|
props: {
|
|
3291
3318
|
...y.props,
|
|
3292
|
-
...
|
|
3319
|
+
...g.item || {}
|
|
3293
3320
|
}
|
|
3294
3321
|
},
|
|
3295
|
-
dataItem:
|
|
3296
|
-
})) :
|
|
3322
|
+
dataItem: g.item || {}
|
|
3323
|
+
})) : g.type === "list" ? g.list ? w.reduce((y, N) => y.concat(
|
|
3297
3324
|
//@ts-ignore
|
|
3298
|
-
|
|
3299
|
-
key: `${
|
|
3325
|
+
g.list.map((S, I) => ({
|
|
3326
|
+
key: `${N.uuid}-data-${I}`,
|
|
3300
3327
|
craftNode: {
|
|
3301
|
-
...
|
|
3328
|
+
...N,
|
|
3302
3329
|
props: {
|
|
3303
|
-
...
|
|
3304
|
-
...
|
|
3330
|
+
...N.props,
|
|
3331
|
+
...S || {}
|
|
3305
3332
|
}
|
|
3306
3333
|
},
|
|
3307
|
-
dataItem:
|
|
3334
|
+
dataItem: S || {}
|
|
3308
3335
|
}))
|
|
3309
3336
|
), []) : [] : [];
|
|
3310
|
-
return (
|
|
3337
|
+
return (g, w) => (p(r).visible || p(r).visible === void 0) && p(s) && p(o) ? (v(), M(Ce(p(a)), Se({
|
|
3311
3338
|
key: 0,
|
|
3312
3339
|
ref: "nodeRef"
|
|
3313
|
-
},
|
|
3314
|
-
|
|
3340
|
+
}, T.value, Ue(U.value)), Ne({ _: 2 }, [
|
|
3341
|
+
j(f.value, (y) => ({
|
|
3315
3342
|
name: y,
|
|
3316
|
-
fn: G((
|
|
3317
|
-
u.value?.type ? (v(!0),
|
|
3318
|
-
key:
|
|
3319
|
-
craftNode:
|
|
3320
|
-
nodeMap:
|
|
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),
|
|
3321
3348
|
nodeDataMap: t.nodeDataMap,
|
|
3322
3349
|
eventsContext: t.eventsContext,
|
|
3323
3350
|
nodeRuntimeProps: t.nodeRuntimeProps,
|
|
3324
3351
|
pageState: t.pageState,
|
|
3325
|
-
context: l(y,
|
|
3326
|
-
}, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "nodeRuntimeProps", "pageState", "context"]))), 128)) : (v(!0),
|
|
3327
|
-
key:
|
|
3328
|
-
craftNode:
|
|
3329
|
-
nodeMap:
|
|
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),
|
|
3330
3357
|
nodeDataMap: t.nodeDataMap,
|
|
3331
3358
|
eventsContext: t.eventsContext,
|
|
3332
3359
|
nodeRuntimeProps: t.nodeRuntimeProps,
|
|
3333
3360
|
pageState: t.pageState,
|
|
3334
|
-
context: l(y,
|
|
3361
|
+
context: l(y, N)
|
|
3335
3362
|
}, null, 8, ["craftNode", "nodeMap", "nodeDataMap", "eventsContext", "nodeRuntimeProps", "pageState", "context"]))), 128))
|
|
3336
3363
|
])
|
|
3337
3364
|
}))
|
|
3338
|
-
]), 1040)) :
|
|
3365
|
+
]), 1040)) : R("", !0);
|
|
3339
3366
|
}
|
|
3340
|
-
}),
|
|
3367
|
+
}), mn = /* @__PURE__ */ L({
|
|
3341
3368
|
name: "CraftStaticRenderer",
|
|
3342
3369
|
__name: "CraftStaticRenderer",
|
|
3343
3370
|
props: {
|
|
@@ -3349,18 +3376,18 @@ Error:`,
|
|
|
3349
3376
|
},
|
|
3350
3377
|
setup(t) {
|
|
3351
3378
|
const e = t, r = (i, l) => {
|
|
3352
|
-
l.set(i.uuid, i), Object.entries(i.slots).forEach(([u,
|
|
3353
|
-
|
|
3379
|
+
l.set(i.uuid, i), Object.entries(i.slots).forEach(([u, d]) => {
|
|
3380
|
+
d?.forEach && d.forEach((m) => r(m, l));
|
|
3354
3381
|
});
|
|
3355
|
-
}, n =
|
|
3382
|
+
}, n = C(() => {
|
|
3356
3383
|
const i = /* @__PURE__ */ new Map();
|
|
3357
3384
|
return e.nodes.forEach((l) => r(l, i)), i;
|
|
3358
|
-
}), o =
|
|
3385
|
+
}), o = C(
|
|
3359
3386
|
() => e.resolver || new Oe(e.resolverMap)
|
|
3360
3387
|
);
|
|
3361
3388
|
te("resolver", o), te("nodeDataMap", e.nodeDataMap || {}), te("eventsContext", e.eventsContext || {});
|
|
3362
3389
|
const s = He({}), a = He({});
|
|
3363
|
-
return (i, l) => (v(!0),
|
|
3390
|
+
return (i, l) => (v(!0), E(B, null, j(t.nodes, (u) => (v(), M($e, {
|
|
3364
3391
|
key: u.uuid,
|
|
3365
3392
|
craftNode: u,
|
|
3366
3393
|
nodeMap: n.value,
|
|
@@ -3372,27 +3399,27 @@ Error:`,
|
|
|
3372
3399
|
}
|
|
3373
3400
|
}), Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3374
3401
|
__proto__: null,
|
|
3375
|
-
CraftCanvas:
|
|
3376
|
-
CraftComponentSimpleText:
|
|
3377
|
-
CraftEditor:
|
|
3378
|
-
CraftEditorBlueprint:
|
|
3379
|
-
CraftEditorBlueprintsList:
|
|
3380
|
-
CraftEditorPanelBlueprints:
|
|
3381
|
-
CraftEditorPanelForm:
|
|
3382
|
-
CraftEditorPanelLayers:
|
|
3383
|
-
CraftEditorPanelLayout:
|
|
3384
|
-
CraftEditorPanelNodeDataSourceSettings:
|
|
3385
|
-
CraftEditorPanelNodeEventsSettings:
|
|
3386
|
-
CraftEditorPanelNodeLayer:
|
|
3387
|
-
CraftEditorPanelNodeSettings:
|
|
3388
|
-
CraftEditorPanelNodeSlotPropsSettings:
|
|
3389
|
-
CraftEditorPanelSettings:
|
|
3390
|
-
CraftFrame:
|
|
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,
|
|
3391
3418
|
CraftIframe: it,
|
|
3392
|
-
CraftNodeEditor:
|
|
3393
|
-
CraftNodeViewer:
|
|
3394
|
-
CraftStaticRenderer:
|
|
3395
|
-
Utils:
|
|
3419
|
+
CraftNodeEditor: vn,
|
|
3420
|
+
CraftNodeViewer: Me,
|
|
3421
|
+
CraftStaticRenderer: mn,
|
|
3422
|
+
Utils: nr
|
|
3396
3423
|
}, Symbol.toStringTag, { value: "Module" })), xn = {
|
|
3397
3424
|
metadata: {
|
|
3398
3425
|
name: "default"
|
|
@@ -3409,7 +3436,7 @@ Error:`,
|
|
|
3409
3436
|
}
|
|
3410
3437
|
}
|
|
3411
3438
|
};
|
|
3412
|
-
function
|
|
3439
|
+
function On() {
|
|
3413
3440
|
const t = K(null);
|
|
3414
3441
|
return { nodeEl: t, vNodeEl: {
|
|
3415
3442
|
mounted(r) {
|
|
@@ -3423,27 +3450,27 @@ function Sn() {
|
|
|
3423
3450
|
}
|
|
3424
3451
|
} };
|
|
3425
3452
|
}
|
|
3426
|
-
const
|
|
3453
|
+
const wn = (t, e, r) => {
|
|
3427
3454
|
const n = {
|
|
3428
3455
|
type: e.type,
|
|
3429
3456
|
item: e.type === "single" ? {} : void 0,
|
|
3430
3457
|
list: e.type === "list" ? [] : void 0
|
|
3431
3458
|
}, o = (a, i) => {
|
|
3432
3459
|
let l = a;
|
|
3433
|
-
return i.patchSource === "value" ? i.value ?? i.defaultValue ?? null : (i.patchSource === "child" && (l = r), (i.type === "single" ?
|
|
3434
|
-
}, s = e.type === "single" ?
|
|
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 });
|
|
3435
3462
|
return e.type === "single" ? e.patches.forEach((a) => {
|
|
3436
3463
|
const i = o(s, a);
|
|
3437
|
-
|
|
3464
|
+
Ae(n.item, a.toPath, i);
|
|
3438
3465
|
}) : e.type === "list" && (n.list = s.map((a) => {
|
|
3439
3466
|
const i = {};
|
|
3440
3467
|
return e.patches.forEach((l) => {
|
|
3441
3468
|
const u = o(a, l);
|
|
3442
|
-
|
|
3469
|
+
Ae(i, l.toPath, u);
|
|
3443
3470
|
}), i;
|
|
3444
3471
|
})), n;
|
|
3445
3472
|
};
|
|
3446
|
-
function
|
|
3473
|
+
function gn(t, e) {
|
|
3447
3474
|
const r = {};
|
|
3448
3475
|
return !t.events || !Object.keys(t.events).length || Object.entries(t.events).forEach(([n, o]) => {
|
|
3449
3476
|
o?.trim() && (r[n] = (...s) => {
|
|
@@ -3466,7 +3493,7 @@ Error:`,
|
|
|
3466
3493
|
});
|
|
3467
3494
|
}), r;
|
|
3468
3495
|
}
|
|
3469
|
-
function
|
|
3496
|
+
function yn(t, e, r = "default") {
|
|
3470
3497
|
if (!t.slots || !t.slots[r]) return [];
|
|
3471
3498
|
const n = t.slots[r];
|
|
3472
3499
|
return e.type === "single" ? n.map((o) => ({
|
|
@@ -3481,20 +3508,20 @@ function gn(t, e, r = "default") {
|
|
|
3481
3508
|
}))
|
|
3482
3509
|
) : [];
|
|
3483
3510
|
}
|
|
3484
|
-
function
|
|
3511
|
+
function Ie(t, e, r, n, o) {
|
|
3485
3512
|
if (!tt(t))
|
|
3486
3513
|
return null;
|
|
3487
3514
|
const s = e.resolveNode(t), a = s?.componentName || t.componentName, i = r?.[a] || a, l = {
|
|
3488
3515
|
...s?.defaultProps || {},
|
|
3489
3516
|
...t.props
|
|
3490
|
-
}, u = o ?
|
|
3517
|
+
}, u = o ? gn(t, o) : {}, d = n?.[t.uuid];
|
|
3491
3518
|
let m;
|
|
3492
|
-
return
|
|
3519
|
+
return d?.type ? m = yn(
|
|
3493
3520
|
t,
|
|
3494
|
-
|
|
3495
|
-
|
|
3521
|
+
d,
|
|
3522
|
+
d.slotName || "default"
|
|
3496
3523
|
).map(
|
|
3497
|
-
(h) =>
|
|
3524
|
+
(h) => Ie(
|
|
3498
3525
|
h,
|
|
3499
3526
|
e,
|
|
3500
3527
|
r,
|
|
@@ -3502,7 +3529,7 @@ function $e(t, e, r, n, o) {
|
|
|
3502
3529
|
o
|
|
3503
3530
|
)
|
|
3504
3531
|
).filter((h) => h !== null) : t.slots && (m = Object.values(t.slots).flat().map(
|
|
3505
|
-
(f) =>
|
|
3532
|
+
(f) => Ie(
|
|
3506
3533
|
f,
|
|
3507
3534
|
e,
|
|
3508
3535
|
r,
|
|
@@ -3511,10 +3538,10 @@ function $e(t, e, r, n, o) {
|
|
|
3511
3538
|
)
|
|
3512
3539
|
).filter((f) => f !== null)), Dt(i, { key: t.uuid, ...l, ...u }, m);
|
|
3513
3540
|
}
|
|
3514
|
-
function
|
|
3541
|
+
function kn(t, e) {
|
|
3515
3542
|
const r = new Oe(e.resolverMap);
|
|
3516
3543
|
return t.map(
|
|
3517
|
-
(n) =>
|
|
3544
|
+
(n) => Ie(
|
|
3518
3545
|
n,
|
|
3519
3546
|
r,
|
|
3520
3547
|
e.componentRegistry,
|
|
@@ -3523,7 +3550,7 @@ function wn(t, e) {
|
|
|
3523
3550
|
)
|
|
3524
3551
|
).filter((n) => n !== null);
|
|
3525
3552
|
}
|
|
3526
|
-
const
|
|
3553
|
+
const Dn = {
|
|
3527
3554
|
CraftComponentSimpleText: {
|
|
3528
3555
|
componentName: "CraftComponentSimpleText",
|
|
3529
3556
|
eventsSchema: {
|
|
@@ -3569,55 +3596,55 @@ const kn = {
|
|
|
3569
3596
|
CraftCanvas: {
|
|
3570
3597
|
componentName: "CraftCanvas"
|
|
3571
3598
|
}
|
|
3572
|
-
},
|
|
3599
|
+
}, bn = (t) => {
|
|
3573
3600
|
for (const e in Ye)
|
|
3574
3601
|
t.component(e, Ye[e]);
|
|
3575
|
-
},
|
|
3602
|
+
}, An = { install: bn };
|
|
3576
3603
|
export {
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
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,
|
|
3593
3620
|
it as CraftIframe,
|
|
3594
|
-
|
|
3621
|
+
vn as CraftNodeEditor,
|
|
3595
3622
|
Oe as CraftNodeResolver,
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3623
|
+
Me as CraftNodeViewer,
|
|
3624
|
+
mn as CraftStaticRenderer,
|
|
3625
|
+
nr as Utils,
|
|
3626
|
+
An as VCraft,
|
|
3600
3627
|
nt as buildCraftNodeTree,
|
|
3601
3628
|
me as craftNodeCanBeChildOf,
|
|
3602
|
-
|
|
3603
|
-
|
|
3629
|
+
_e as craftNodeCanBeSiblingOf,
|
|
3630
|
+
Wt as craftNodeInCanvas,
|
|
3604
3631
|
rt as craftNodeIsAncestorOf,
|
|
3605
3632
|
W as craftNodeIsCanvas,
|
|
3606
|
-
|
|
3633
|
+
Zt as craftNodeIsDraggable,
|
|
3607
3634
|
xn as defaultBlueprints,
|
|
3608
|
-
|
|
3635
|
+
Dn as defaultResolvers,
|
|
3609
3636
|
ot as initializeSlotsFromResolver,
|
|
3610
3637
|
tt as isVisible,
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3638
|
+
wn as mapData,
|
|
3639
|
+
Ie as renderCraftNodeToVNode,
|
|
3640
|
+
kn as renderCraftNodesToVNodes,
|
|
3614
3641
|
ue as resolveNodeName,
|
|
3615
|
-
|
|
3616
|
-
|
|
3642
|
+
Lr as useAncestorContextBuckets,
|
|
3643
|
+
Gt as useCraftNode,
|
|
3617
3644
|
q as useEditor,
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3645
|
+
je as useIndicator,
|
|
3646
|
+
On as useNodeElement,
|
|
3647
|
+
Pe as useResolveCraftNode,
|
|
3648
|
+
qt as useResolveCraftNodeProps
|
|
3622
3649
|
};
|
|
3623
3650
|
//# sourceMappingURL=v-craft.es.js.map
|