labull-framework 1.0.4 → 1.1.0
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/magic-block.js +85 -85
- package/dist/style.css +1 -1
- package/dist/types/magic-block-dialogs.d.ts +5 -1
- package/package.json +1 -1
package/dist/magic-block.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shallowRef as mo, ref as
|
|
1
|
+
import { shallowRef as mo, ref as A, computed as N, defineComponent as xe, watch as jt, nextTick as sn, onMounted as fn, onBeforeUnmount as mn, openBlock as c, createElementBlock as d, normalizeStyle as bn, normalizeClass as J, unref as V, createElementVNode as l, toDisplayString as b, createCommentVNode as w, Fragment as S, renderList as q, withModifiers as on, getCurrentInstance as bo, createBlock as ho, createTextVNode as y, withDirectives as pt, vModelCheckbox as is, vModelText as oe, withKeys as vo, vShow as _e, createStaticVNode as go, vModelSelect as _o, vModelDynamic as yo } from "vue";
|
|
2
2
|
import { useRouter as as, useRoute as ko } from "vue-router";
|
|
3
3
|
import { b as kt, c as re, A as $e, u as rs } from "./chunk-index-BVIJeFeJ.js";
|
|
4
4
|
import { s as nd } from "./chunk-index-BVIJeFeJ.js";
|
|
@@ -309,7 +309,7 @@ function Po(n) {
|
|
|
309
309
|
const e = n && typeof n == "object" && !Array.isArray(n) ? n : {}, s = $t(e.button, Ot) || null, i = e.closed === "escape" || e.closed === "backdrop" || e.closed === "host" ? e.closed : "button";
|
|
310
310
|
return { button: s, values: vs(e.values), closed: i };
|
|
311
311
|
}
|
|
312
|
-
const Tt = mo([]), vn =
|
|
312
|
+
const Tt = mo([]), vn = A(!1);
|
|
313
313
|
let Io = 0;
|
|
314
314
|
const No = N(() => Tt.value[Tt.value.length - 1] ?? null);
|
|
315
315
|
function qo() {
|
|
@@ -998,15 +998,15 @@ const Dl = ["data-magic-block", "data-magic-module"], jl = ["srcdoc", "title"],
|
|
|
998
998
|
theme: { type: Boolean, default: !0 }
|
|
999
999
|
},
|
|
1000
1000
|
setup(n) {
|
|
1001
|
-
const e = n, s = $o(), i = as(), { isStaff: r } = rs(), p =
|
|
1001
|
+
const e = n, s = $o(), i = as(), { isStaff: r } = rs(), p = A(null), u = A(null), m = A(null), h = A(!1), v = A(0), _ = A(0);
|
|
1002
1002
|
let k = null, g = null, x = null, R = null, D = null, L = null;
|
|
1003
1003
|
const P = N(() => e.name.trim() || e.uuid), z = N(() => m.value?.state ?? ""), lt = N(() => z.value === "invalid" ? "校验不通过" : z.value === "draft" ? "未开发" : P.value), it = N(() => (m.value?.brief ?? "").trim() || (m.value?.name ?? "").trim() || P.value), gt = N(() => (m.value?.reason ?? "").trim()), xt = N(() => m.value?.issues ?? []), j = N(() => Math.max(_.value, v.value, 1)), Lt = N(() => ({ height: `${j.value}px` })), ft = N(() => {
|
|
1004
|
-
const
|
|
1005
|
-
for (const [O, H] of Object.entries(m.value?.files ?? {})) O !== bl && (
|
|
1006
|
-
return
|
|
1004
|
+
const T = {};
|
|
1005
|
+
for (const [O, H] of Object.entries(m.value?.files ?? {})) O !== bl && (T[O] = H);
|
|
1006
|
+
return T;
|
|
1007
1007
|
}), Et = N(() => z.value === "ok" && typeof ft.value[Kt] == "string");
|
|
1008
1008
|
let E = null;
|
|
1009
|
-
function
|
|
1009
|
+
function B() {
|
|
1010
1010
|
if (!e.theme) return "";
|
|
1011
1011
|
if (E !== null || (E = "", typeof document > "u")) return E;
|
|
1012
1012
|
try {
|
|
@@ -1018,24 +1018,24 @@ const Dl = ["data-magic-block", "data-magic-module"], jl = ["srcdoc", "title"],
|
|
|
1018
1018
|
}
|
|
1019
1019
|
const $ = N(() => {
|
|
1020
1020
|
if (!Et.value) return "";
|
|
1021
|
-
const
|
|
1022
|
-
return O && (
|
|
1021
|
+
const T = { bootstrap: fs, css: xo }, O = B();
|
|
1022
|
+
return O && (T.themeCss = O), Es(ft.value, T);
|
|
1023
1023
|
});
|
|
1024
1024
|
function M() {
|
|
1025
1025
|
return { key: s.key, path: s.path, params: s.params, query: s.query };
|
|
1026
1026
|
}
|
|
1027
|
-
async function mt(
|
|
1028
|
-
const O = i.resolve(
|
|
1027
|
+
async function mt(T) {
|
|
1028
|
+
const O = i.resolve(T);
|
|
1029
1029
|
if (O.matched.length === 0) {
|
|
1030
1030
|
const H = i.getRoutes().map((st) => st.path);
|
|
1031
|
-
throw new Error(`这个应用里没有页面 ${
|
|
1031
|
+
throw new Error(`这个应用里没有页面 ${T}。能跳的页面只有:${H.length > 0 ? H.join(" / ") : "(还没有配路由)"}`);
|
|
1032
1032
|
}
|
|
1033
|
-
return ln(
|
|
1033
|
+
return ln(T) || O.fullPath;
|
|
1034
1034
|
}
|
|
1035
1035
|
function et() {
|
|
1036
1036
|
x?.(), x = null;
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1037
|
+
const T = u.value;
|
|
1038
|
+
T && (x = Pn(T, {
|
|
1039
1039
|
uuid: e.uuid,
|
|
1040
1040
|
onHeight: (O) => {
|
|
1041
1041
|
v.value = O;
|
|
@@ -1048,10 +1048,10 @@ const Dl = ["data-magic-block", "data-magic-module"], jl = ["srcdoc", "title"],
|
|
|
1048
1048
|
onTabTitle: (O, H) => s.setTitle(O, H)
|
|
1049
1049
|
}));
|
|
1050
1050
|
}
|
|
1051
|
-
function Wt(
|
|
1052
|
-
return Ho(
|
|
1051
|
+
function Wt(T) {
|
|
1052
|
+
return Ho(T, {
|
|
1053
1053
|
uuid: e.uuid,
|
|
1054
|
-
buildDoc: (O) => wl(m.value?.files ?? {}, O, { bootstrap: Co, themeCss:
|
|
1054
|
+
buildDoc: (O) => wl(m.value?.files ?? {}, O, { bootstrap: Co, themeCss: B() }),
|
|
1055
1055
|
mountBridge: (O, H) => Pn(O, {
|
|
1056
1056
|
uuid: e.uuid,
|
|
1057
1057
|
onDone: H.onDone,
|
|
@@ -1065,27 +1065,27 @@ const Dl = ["data-magic-block", "data-magic-module"], jl = ["srcdoc", "title"],
|
|
|
1065
1065
|
});
|
|
1066
1066
|
}
|
|
1067
1067
|
async function Zt() {
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1068
|
+
const T = e.uuid, O = await Cl([T]);
|
|
1069
|
+
T === e.uuid && (m.value = O.find((H) => H.id === T) ?? null);
|
|
1070
1070
|
}
|
|
1071
1071
|
function ue() {
|
|
1072
1072
|
window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid: e.uuid } }));
|
|
1073
1073
|
}
|
|
1074
|
-
function ce(
|
|
1075
|
-
|
|
1074
|
+
function ce(T = !1) {
|
|
1075
|
+
T && D?.(), D = Tl(e.uuid, s.key);
|
|
1076
1076
|
}
|
|
1077
|
-
const bt = (
|
|
1077
|
+
const bt = (T) => !us(T, i), nt = N(() => {
|
|
1078
1078
|
if (!r.value) return "";
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
1079
|
+
const T = pn(e.uuid, s.key, bt);
|
|
1080
|
+
return T ? `管理员:切到还挂着这个块的标签 ${T}(点一下这一块会亮红框)` : "管理员:这个块只在这一条标签里挂着 —— 点一下会亮几秒红框";
|
|
1081
1081
|
});
|
|
1082
1082
|
function U() {
|
|
1083
1083
|
if (!r.value) return;
|
|
1084
|
-
const
|
|
1085
|
-
Cs(e.uuid),
|
|
1084
|
+
const T = pn(e.uuid, s.key, bt);
|
|
1085
|
+
Cs(e.uuid), T && ln(T);
|
|
1086
1086
|
}
|
|
1087
|
-
function _t(
|
|
1088
|
-
let O =
|
|
1087
|
+
function _t(T) {
|
|
1088
|
+
let O = T.parentElement;
|
|
1089
1089
|
for (; O; ) {
|
|
1090
1090
|
if (getComputedStyle(O).overflowY !== "visible" && O.clientHeight > 0) return O;
|
|
1091
1091
|
O = O.parentElement;
|
|
@@ -1093,40 +1093,40 @@ const Dl = ["data-magic-block", "data-magic-module"], jl = ["srcdoc", "title"],
|
|
|
1093
1093
|
return document.documentElement;
|
|
1094
1094
|
}
|
|
1095
1095
|
function at() {
|
|
1096
|
-
const
|
|
1097
|
-
if (!
|
|
1098
|
-
const O = _t(
|
|
1096
|
+
const T = p.value;
|
|
1097
|
+
if (!T) return 0;
|
|
1098
|
+
const O = _t(T), H = getComputedStyle(O), st = parseFloat(H.paddingTop) || 0, Gt = parseFloat(H.paddingBottom) || 0, de = parseFloat(H.borderTopWidth) || 0, Y = O === document.documentElement, Ae = Y ? Math.max(0, window.innerHeight - st - Gt) : Math.max(0, O.clientHeight - st - Gt), Me = Y ? st : O.getBoundingClientRect().top + de + st, De = Y ? window.scrollY || 0 : O.scrollTop, je = T.getBoundingClientRect().top - Me + De;
|
|
1099
1099
|
return Math.max(0, Math.floor(Ae - je));
|
|
1100
1100
|
}
|
|
1101
1101
|
function rt() {
|
|
1102
1102
|
if (!s.active.value || !p.value) return;
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1103
|
+
const T = at();
|
|
1104
|
+
T > 0 && Math.abs(T - _.value) > 1 && (_.value = T);
|
|
1105
1105
|
}
|
|
1106
1106
|
function Z() {
|
|
1107
1107
|
if (!p.value) return;
|
|
1108
|
-
const
|
|
1109
|
-
k !==
|
|
1108
|
+
const T = _t(p.value);
|
|
1109
|
+
k !== T && (k = T, g?.disconnect(), g = null), rt(), !(g || typeof ResizeObserver > "u") && (g = new ResizeObserver(() => rt()), g.observe(T));
|
|
1110
1110
|
}
|
|
1111
1111
|
return jt(u, () => et()), jt($, () => {
|
|
1112
1112
|
v.value = 0, _.value = 0, Z();
|
|
1113
1113
|
}, { flush: "post" }), jt(() => e.uuid, () => {
|
|
1114
1114
|
sn().then(() => Z());
|
|
1115
|
-
}), jt(() => s.active.value, (
|
|
1116
|
-
|
|
1115
|
+
}), jt(() => s.active.value, (T) => {
|
|
1116
|
+
T && sn().then(() => {
|
|
1117
1117
|
Z();
|
|
1118
1118
|
const O = p.value;
|
|
1119
1119
|
!O || !O.isConnected || O.offsetParent === null || h.value && O.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1120
1120
|
});
|
|
1121
|
-
}), jt(() => e.uuid, (
|
|
1122
|
-
O && O !==
|
|
1121
|
+
}), jt(() => e.uuid, (T, O) => {
|
|
1122
|
+
O && O !== T && Hn(O), v.value = 0, m.value = null, ce(!0), h.value = Qe() === e.uuid, Zt();
|
|
1123
1123
|
}), fn(() => {
|
|
1124
1124
|
R = xl(() => void Zt()), L = Bl(() => {
|
|
1125
1125
|
h.value = Qe() === e.uuid;
|
|
1126
1126
|
}), h.value = Qe() === e.uuid, ce(), Z(), Zt();
|
|
1127
1127
|
}), mn(() => {
|
|
1128
1128
|
Hn(e.uuid), g?.disconnect(), g = null, R?.(), R = null, L?.(), L = null, D?.(), D = null, x?.(), x = null;
|
|
1129
|
-
}), (
|
|
1129
|
+
}), (T, O) => (c(), d("div", {
|
|
1130
1130
|
ref_key: "el",
|
|
1131
1131
|
ref: p,
|
|
1132
1132
|
class: J(["mb", { "mb--admin": V(r), "mb--lit": V(r) && h.value }]),
|
|
@@ -2080,7 +2080,7 @@ const ki = { class: "mbc__head" }, $i = ["title"], wi = ["title"], xi = {
|
|
|
2080
2080
|
两种情形共用它(前端声明了、手里却还没有那个文件夹 / 手里那个文件夹的清单 id 库里没有)
|
|
2081
2081
|
—— 对用户是同一件事:这个块不在库里。 */
|
|
2082
2082
|
"not-in-db": "不在数据库"
|
|
2083
|
-
}, s = e["not-in-db"], { isStaff: i } = rs(), r = as(), { active: p } = wo(), u = (a) => !us(a, r), m =
|
|
2083
|
+
}, s = e["not-in-db"], { isStaff: i } = rs(), r = as(), { active: p } = wo(), u = (a) => !us(a, r), m = A(!1), h = A(""), v = A([]), _ = A(""), k = A(""), g = A(""), x = A([]), R = A(!1), D = A(!1), L = A("blocks"), P = A(""), z = A([]), lt = A(""), it = A(""), gt = A(""), xt = A(""), j = A(!1), Lt = A(!1), ft = A(!1), Et = A(!1), E = A(!1), B = A(null), $ = A(null), M = A("one"), mt = A(ce()), et = N(() => v.value.find((a) => a.id === mt.value) ?? null), Wt = () => M.value === "framework" ? { framework: !0 } : M.value === "all" ? {} : { blocks: [mt.value] }, Zt = N(() => M.value === "framework" ? "只铺框架文件(顶层那几份生成物 + example/):workspace/ 里的块代码一个字节都不写、也不删" : M.value === "one" && !et.value ? "先在左边挑一个块(或者把范围改成「全部块」/「只铺框架文件」)" : "把库里的块铺到你选的文件夹");
|
|
2084
2084
|
function ue(a) {
|
|
2085
2085
|
mt.value = a;
|
|
2086
2086
|
try {
|
|
@@ -2098,12 +2098,12 @@ const ki = { class: "mbc__head" }, $i = ["title"], wi = ["title"], xi = {
|
|
|
2098
2098
|
jt(v, (a) => {
|
|
2099
2099
|
a.length !== 0 && (a.some((t) => t.id === mt.value) || ue(a[0].id));
|
|
2100
2100
|
});
|
|
2101
|
-
const bt =
|
|
2101
|
+
const bt = A(null), nt = A(""), U = A(null), _t = A({}), at = A([]), rt = A([]), Z = A(null), T = A({}), O = A(""), H = A(null);
|
|
2102
2102
|
async function st(a) {
|
|
2103
2103
|
O.value = a;
|
|
2104
2104
|
try {
|
|
2105
2105
|
const t = await kt(`/magic-blocks/${encodeURIComponent(a)}/versions`);
|
|
2106
|
-
|
|
2106
|
+
T.value = { ...T.value, [a]: t.versions ?? [] };
|
|
2107
2107
|
} catch (t) {
|
|
2108
2108
|
ee(t, "读版本列表");
|
|
2109
2109
|
} finally {
|
|
@@ -2117,13 +2117,13 @@ const ki = { class: "mbc__head" }, $i = ["title"], wi = ["title"], xi = {
|
|
|
2117
2117
|
function de(a) {
|
|
2118
2118
|
return a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${Math.round(a / 1024)} KB` : `${(a / 1024 / 1024).toFixed(1)} MB`;
|
|
2119
2119
|
}
|
|
2120
|
-
const Y =
|
|
2120
|
+
const Y = A(null);
|
|
2121
2121
|
function Ae(a, t) {
|
|
2122
2122
|
return `${String(t || "").replace(/[\\/:*?"<>|]/g, "").trim() || "block"}-${a}`;
|
|
2123
2123
|
}
|
|
2124
2124
|
const Me = (a) => ot(async () => {
|
|
2125
2125
|
const t = Ae(a.id, a.name || a.module);
|
|
2126
|
-
let o =
|
|
2126
|
+
let o = B.value, f = null;
|
|
2127
2127
|
if (o)
|
|
2128
2128
|
try {
|
|
2129
2129
|
f = await en(o, bt.value ?? await ze());
|
|
@@ -2160,7 +2160,7 @@ const ki = { class: "mbc__head" }, $i = ["title"], wi = ["title"], xi = {
|
|
|
2160
2160
|
o = await o.getDirectoryHandle(f, { create: !0 });
|
|
2161
2161
|
return { handle: o, name: `${a.name}/${t}` };
|
|
2162
2162
|
}
|
|
2163
|
-
const W =
|
|
2163
|
+
const W = A(null), pe = A(!1), G = A({ active: !1, percent: 0, stage: "", failed: !1 }), Os = N(() => ({
|
|
2164
2164
|
width: `${Math.max(0, Math.min(100, G.value.percent))}%`,
|
|
2165
2165
|
background: G.value.failed ? "var(--sp-color-danger)" : "var(--sp-color-primary, var(--primary-color))"
|
|
2166
2166
|
}));
|
|
@@ -2291,7 +2291,7 @@ ${o}` : o;
|
|
|
2291
2291
|
const Cn = N(() => {
|
|
2292
2292
|
const a = h.value.trim().toLowerCase();
|
|
2293
2293
|
return v.value.filter((t) => Ks(t) ? a ? `${t.module} ${t.name} ${t.brief} ${t.detail ?? ""} ${t.id} v${t.version ?? ""} ${(t.tags ?? []).join(" ")}`.toLowerCase().includes(a) : !0 : !1);
|
|
2294
|
-
}), be = N(() => (U.value?.blocks ?? []).filter((a) => a.canApply)), Pt = N(() => be.value.filter((a) => _t.value[a.id] === !0)), It =
|
|
2294
|
+
}), be = N(() => (U.value?.blocks ?? []).filter((a) => a.canApply)), Pt = N(() => be.value.filter((a) => _t.value[a.id] === !0)), It = A(!1), yt = N(() => at.value.length + (U.value?.failures ?? []).length + rt.value.filter((a) => !a.ok).length), te = N(() => rt.value.filter((a) => !a.ok)), Ie = N(() => rt.value.filter((a) => a.ok).length), Ne = N(() => v.value.filter((a) => a.enabled === !1).length), Nt = N(() => (Z.value?.results ?? []).filter((a) => (a.verifyNotes ?? []).length > 0)), Mt = N(() => Nt.value.reduce((a, t) => a + (t.verifyNotes ?? []).length, 0)), ut = N(() => (Z.value?.results ?? []).filter((a) => a.probeRan !== !0).map((a) => a.name || a.id));
|
|
2295
2295
|
function Ws() {
|
|
2296
2296
|
const a = /* @__PURE__ */ new Set(), t = [];
|
|
2297
2297
|
for (const o of qe()) {
|
|
@@ -2440,7 +2440,7 @@ ${t.text}`).join(`
|
|
|
2440
2440
|
}
|
|
2441
2441
|
}, j), Bn = (a) => ot(async () => {
|
|
2442
2442
|
const t = await tn();
|
|
2443
|
-
a === "export" ? (
|
|
2443
|
+
a === "export" ? (B.value = t, $.value || ($.value = t)) : ($.value = t, B.value || (B.value = t)), g.value = a === "export" ? `导出目录:${t.name}${$.value === t ? "(读回目录也填成它了)" : ""}` : `读回目录:${t.name}`;
|
|
2444
2444
|
}, j);
|
|
2445
2445
|
async function ze() {
|
|
2446
2446
|
if (bt.value) return bt.value;
|
|
@@ -2454,8 +2454,8 @@ ${t.text}`).join(`
|
|
|
2454
2454
|
throw new Error("还没挑块:上面选「仅这一个块」时要先在下拉里挑一个块(或者把范围改成「全部块」/「只铺框架文件」)");
|
|
2455
2455
|
ft.value = !0, g.value = "", nt.value = "", Ue(), Le(), He.length = 0, he = performance.now(), Xt = null, Jt = null, G.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
|
|
2456
2456
|
try {
|
|
2457
|
-
const t =
|
|
2458
|
-
|
|
2457
|
+
const t = B.value ?? await tn();
|
|
2458
|
+
B.value = t, $.value || ($.value = t);
|
|
2459
2459
|
const o = Ft("/magic-blocks/export", Wt()), f = Ve(), C = bt.value ? en(t, bt.value) : null, I = await zt("取包", o);
|
|
2460
2460
|
bt.value = I.rules, bi(t, I.rules);
|
|
2461
2461
|
const Q = C ? await zt("数目录", C) : await zt("数目录", en(t, I.rules));
|
|
@@ -2639,7 +2639,7 @@ ${t.text}`).join(`
|
|
|
2639
2639
|
}
|
|
2640
2640
|
const An = () => ot(async () => {
|
|
2641
2641
|
const a = $.value ?? await tn();
|
|
2642
|
-
$.value = a,
|
|
2642
|
+
$.value = a, B.value || (B.value = a), Et.value = !0, g.value = "", at.value = [], rt.value = [], Le(), G.value = { active: !0, percent: 0, stage: "扫描本地目录…", failed: !1 };
|
|
2643
2643
|
const t = performance.now();
|
|
2644
2644
|
let o = 0, f = 0;
|
|
2645
2645
|
try {
|
|
@@ -3096,7 +3096,7 @@ ${t.text}`).join(`
|
|
|
3096
3096
|
t[105] || (t[105] = l("dt", null, "版本", -1)),
|
|
3097
3097
|
l("dd", null, [
|
|
3098
3098
|
y("v" + b(o.version || 1), 1),
|
|
3099
|
-
l("span", La, "(一共留着 " + b(o.versionCount ??
|
|
3099
|
+
l("span", La, "(一共留着 " + b(o.versionCount ?? T.value[o.id]?.length ?? 1) + " 版)", 1)
|
|
3100
3100
|
]),
|
|
3101
3101
|
t[106] || (t[106] = l("dt", null, "标签", -1)),
|
|
3102
3102
|
l("dd", null, [
|
|
@@ -3180,8 +3180,8 @@ ${t.text}`).join(`
|
|
|
3180
3180
|
onClick: (f) => st(o.id)
|
|
3181
3181
|
}, b(O.value === o.id ? "读版本中…" : "刷新版本"), 9, Ya)
|
|
3182
3182
|
]),
|
|
3183
|
-
|
|
3184
|
-
(c(!0), d(S, null, q(
|
|
3183
|
+
T.value[o.id] ? T.value[o.id].length > 0 ? (c(), d("ul", Za, [
|
|
3184
|
+
(c(!0), d(S, null, q(T.value[o.id], (f) => (c(), d("li", {
|
|
3185
3185
|
key: f.number,
|
|
3186
3186
|
class: J({ "is-current": f.current })
|
|
3187
3187
|
}, [
|
|
@@ -3356,7 +3356,7 @@ ${t.text}`).join(`
|
|
|
3356
3356
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
3357
3357
|
type: "text",
|
|
3358
3358
|
readonly: "",
|
|
3359
|
-
value:
|
|
3359
|
+
value: B.value ? B.value.name : "(还没选:点右边那个按钮选一个文件夹)"
|
|
3360
3360
|
}, null, 8, Or),
|
|
3361
3361
|
l("button", {
|
|
3362
3362
|
class: "p-button p-button-sm p-button-outlined",
|
|
@@ -3409,7 +3409,7 @@ ${t.text}`).join(`
|
|
|
3409
3409
|
onClick: t[28] || (t[28] = (o) => An())
|
|
3410
3410
|
}, b(Et.value ? "读回中…" : "读回改动"), 9, Hr)
|
|
3411
3411
|
]),
|
|
3412
|
-
$.value &&
|
|
3412
|
+
$.value && B.value && $.value.name !== B.value.name ? (c(), d("p", Kr, " 读回的是「" + b($.value.name) + "」(与导出目录「" + b(B.value.name) + "」不是同一个 —— 想同步就再选一次)。 ", 1)) : (c(), d("p", Vr, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
|
|
3413
3413
|
l("div", Wr, [
|
|
3414
3414
|
l("button", {
|
|
3415
3415
|
class: "p-button p-button-sm mbc__act-import",
|
|
@@ -3757,18 +3757,18 @@ ${t.text}`).join(`
|
|
|
3757
3757
|
}, Kc = { class: "mbd__foot" }, Vc = ["onClick"], Wc = /* @__PURE__ */ xe({
|
|
3758
3758
|
__name: "MagicBlockDialogs",
|
|
3759
3759
|
setup(n) {
|
|
3760
|
-
const { current: e } = qo(), s =
|
|
3760
|
+
const { current: e } = qo(), s = A(null), i = A(null), r = A(null), p = A({}), u = A({}), m = A([]), h = /* @__PURE__ */ new Map(), v = A(0);
|
|
3761
3761
|
let _ = null, k = null;
|
|
3762
3762
|
const g = N(() => e.value?.options.mode === "html"), x = N(() => e.value?.options.fields ?? []), R = N(() => e.value?.options.buttons ?? []), D = N(() => {
|
|
3763
|
-
const E = e.value?.options.size
|
|
3764
|
-
return
|
|
3763
|
+
const E = {}, B = e.value?.options.size;
|
|
3764
|
+
return !g.value || !B || (B.width && (E.width = B.width), B.height ? E.height = B.height : v.value > 0 && (E.height = `${v.value}px`)), E;
|
|
3765
3765
|
}), L = N(() => e.value?.options.title || "弹窗");
|
|
3766
|
-
jt(() => e.value?.id, (E,
|
|
3767
|
-
|
|
3766
|
+
jt(() => e.value?.id, (E, B) => {
|
|
3767
|
+
B !== void 0 && h.set(B, { text: { ...p.value }, checked: { ...u.value } });
|
|
3768
3768
|
for (const M of [...h.keys()]) Fo(M) || h.delete(M);
|
|
3769
3769
|
m.value = [], v.value = 0, P();
|
|
3770
3770
|
const $ = E === void 0 ? void 0 : h.get(E);
|
|
3771
|
-
p.value = $ ? { ...$.text } : Object.fromEntries(x.value.map((M) => [M.name, typeof M.value == "string" ? M.value : ""])), u.value = $ ? { ...$.checked } : Object.fromEntries(x.value.map((M) => [M.name, M.value === !0])),
|
|
3771
|
+
p.value = $ ? { ...$.text } : Object.fromEntries(x.value.map((M) => [M.name, typeof M.value == "string" ? M.value : ""])), u.value = $ ? { ...$.checked } : Object.fromEntries(x.value.map((M) => [M.name, M.value === !0])), B === void 0 && (_ = document.activeElement ?? null), sn().then(() => {
|
|
3772
3772
|
e.value && (z(), lt());
|
|
3773
3773
|
});
|
|
3774
3774
|
});
|
|
@@ -3776,8 +3776,8 @@ ${t.text}`).join(`
|
|
|
3776
3776
|
k?.(), k = null;
|
|
3777
3777
|
}
|
|
3778
3778
|
function z() {
|
|
3779
|
-
const E = e.value,
|
|
3780
|
-
!E || !
|
|
3779
|
+
const E = e.value, B = r.value;
|
|
3780
|
+
!E || !B || !E.mountBridge || (k = E.mountBridge(B, {
|
|
3781
3781
|
onDone: ($) => {
|
|
3782
3782
|
zo(E, $);
|
|
3783
3783
|
},
|
|
@@ -3794,14 +3794,14 @@ ${t.text}`).join(`
|
|
|
3794
3794
|
}
|
|
3795
3795
|
function it() {
|
|
3796
3796
|
const E = i.value;
|
|
3797
|
-
return E ? [...E.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter((
|
|
3797
|
+
return E ? [...E.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter((B) => B.offsetParent !== null) : [];
|
|
3798
3798
|
}
|
|
3799
3799
|
function gt(E) {
|
|
3800
|
-
const
|
|
3801
|
-
if (!
|
|
3800
|
+
const B = e.value;
|
|
3801
|
+
if (!B) return;
|
|
3802
3802
|
if (E.key === "Escape") {
|
|
3803
3803
|
if (g.value) return;
|
|
3804
|
-
E.preventDefault(), Xe(
|
|
3804
|
+
E.preventDefault(), Xe(B, "escape");
|
|
3805
3805
|
return;
|
|
3806
3806
|
}
|
|
3807
3807
|
if (E.key !== "Tab" || g.value) return;
|
|
@@ -3811,14 +3811,14 @@ ${t.text}`).join(`
|
|
|
3811
3811
|
!E.shiftKey && et === mt ? (E.preventDefault(), M.focus()) : E.shiftKey && (et === M || et === i.value) && (E.preventDefault(), mt.focus());
|
|
3812
3812
|
}
|
|
3813
3813
|
function xt(E) {
|
|
3814
|
-
const
|
|
3815
|
-
!
|
|
3814
|
+
const B = e.value;
|
|
3815
|
+
!B || E.target !== s.value || Xe(B, "backdrop");
|
|
3816
3816
|
}
|
|
3817
3817
|
function j(E) {
|
|
3818
3818
|
E.target === s.value && E.preventDefault();
|
|
3819
3819
|
}
|
|
3820
|
-
function Lt(E,
|
|
3821
|
-
if (
|
|
3820
|
+
function Lt(E, B) {
|
|
3821
|
+
if (B.primary) {
|
|
3822
3822
|
const $ = x.value.filter((M) => M.required && ft(M));
|
|
3823
3823
|
if ($.length > 0) {
|
|
3824
3824
|
m.value = $.map((et) => et.name);
|
|
@@ -3827,26 +3827,26 @@ ${t.text}`).join(`
|
|
|
3827
3827
|
return;
|
|
3828
3828
|
}
|
|
3829
3829
|
}
|
|
3830
|
-
Uo(E,
|
|
3830
|
+
Uo(E, B.id, Et());
|
|
3831
3831
|
}
|
|
3832
3832
|
function ft(E) {
|
|
3833
3833
|
return E.type === "checkbox" ? u.value[E.name] !== !0 : (p.value[E.name] ?? "").trim() === "";
|
|
3834
3834
|
}
|
|
3835
3835
|
function Et() {
|
|
3836
3836
|
const E = {};
|
|
3837
|
-
for (const
|
|
3838
|
-
const $ = p.value[
|
|
3839
|
-
|
|
3837
|
+
for (const B of x.value) {
|
|
3838
|
+
const $ = p.value[B.name] ?? "";
|
|
3839
|
+
B.type === "checkbox" ? E[B.name] = u.value[B.name] === !0 : B.type === "number" ? E[B.name] = $.trim() === "" ? "" : Number($) : E[B.name] = $;
|
|
3840
3840
|
}
|
|
3841
3841
|
return E;
|
|
3842
3842
|
}
|
|
3843
|
-
return jt(e, (E,
|
|
3844
|
-
E || !
|
|
3843
|
+
return jt(e, (E, B) => {
|
|
3844
|
+
E || !B || (P(), _ && _.isConnected && _.focus(), _ = null);
|
|
3845
3845
|
}), fn(() => {
|
|
3846
3846
|
zn(!0), window.addEventListener("keydown", gt);
|
|
3847
3847
|
}), mn(() => {
|
|
3848
3848
|
window.removeEventListener("keydown", gt), P(), zn(!1);
|
|
3849
|
-
}), (E,
|
|
3849
|
+
}), (E, B) => V(e) ? (c(), d("div", {
|
|
3850
3850
|
key: 0,
|
|
3851
3851
|
ref_key: "mask",
|
|
3852
3852
|
ref: s,
|
|
@@ -3859,7 +3859,6 @@ ${t.text}`).join(`
|
|
|
3859
3859
|
ref_key: "box",
|
|
3860
3860
|
ref: i,
|
|
3861
3861
|
class: J(["mbd__box", { "mbd__box--html": g.value }]),
|
|
3862
|
-
style: bn(D.value),
|
|
3863
3862
|
role: "dialog",
|
|
3864
3863
|
"aria-modal": "true",
|
|
3865
3864
|
"aria-label": g.value ? "块自己的弹窗" : L.value,
|
|
@@ -3870,10 +3869,11 @@ ${t.text}`).join(`
|
|
|
3870
3869
|
ref_key: "frame",
|
|
3871
3870
|
ref: r,
|
|
3872
3871
|
class: "mbd__frame",
|
|
3872
|
+
style: bn(D.value),
|
|
3873
3873
|
srcdoc: V(e).doc,
|
|
3874
3874
|
sandbox: "allow-scripts allow-forms allow-modals allow-popups allow-downloads",
|
|
3875
3875
|
title: "magic block 的弹窗"
|
|
3876
|
-
}, null,
|
|
3876
|
+
}, null, 12, Bc)) : (c(), d(S, { key: 1 }, [
|
|
3877
3877
|
l("header", Tc, [
|
|
3878
3878
|
l("strong", Ac, b(V(e).options.title || "请确认"), 1),
|
|
3879
3879
|
V(e).options.dismissible ? (c(), d("button", {
|
|
@@ -3882,7 +3882,7 @@ ${t.text}`).join(`
|
|
|
3882
3882
|
type: "button",
|
|
3883
3883
|
title: "关闭(Esc)",
|
|
3884
3884
|
"aria-label": "关闭",
|
|
3885
|
-
onClick:
|
|
3885
|
+
onClick: B[0] || (B[0] = ($) => V(Xe)(V(e), "escape"))
|
|
3886
3886
|
}, "×")) : w("", !0)
|
|
3887
3887
|
]),
|
|
3888
3888
|
V(e).options.body ? (c(), d("p", Mc, b(V(e).options.body), 1)) : w("", !0),
|
|
@@ -3946,10 +3946,10 @@ ${t.text}`).join(`
|
|
|
3946
3946
|
}, b($.label), 11, Vc))), 128))
|
|
3947
3947
|
])
|
|
3948
3948
|
], 64))
|
|
3949
|
-
],
|
|
3949
|
+
], 10, Sc)
|
|
3950
3950
|
], 544)) : w("", !0);
|
|
3951
3951
|
}
|
|
3952
|
-
}), Zc = /* @__PURE__ */ hn(Wc, [["__scopeId", "data-v-
|
|
3952
|
+
}), Zc = /* @__PURE__ */ hn(Wc, [["__scopeId", "data-v-ccbd4127"]]);
|
|
3953
3953
|
Object.assign(Ts, { [Bs]: !0 });
|
|
3954
3954
|
export {
|
|
3955
3955
|
$e as API_BASE,
|