labull-framework 0.1.10 → 0.1.11
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 +1084 -970
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/magic-block.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { A as
|
|
4
|
-
import { u as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as ot, ref as w, computed as R, watch as ye, nextTick as ct, onMounted as gt, onBeforeUnmount as yt, openBlock as b, createElementBlock as h, normalizeStyle as _t, normalizeClass as ne, unref as Te, createElementVNode as r, toDisplayString as v, createCommentVNode as S, Fragment as I, renderList as te, withModifiers as Gt, createBlock as Yt, withDirectives as Wt, vModelText as Zt, createTextVNode as W, createStaticVNode as Xt } from "vue";
|
|
2
|
+
import { useRouter as kt } from "vue-router";
|
|
3
|
+
import { A as Qt, b as Z, c as Ye, u as wt } from "./chunk-index-BWpDbB19.js";
|
|
4
|
+
import { u as en, o as We, b as $t, _ as xt, d as tn } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_0fb37099_lang-BpRKKThg.js";
|
|
5
|
+
const X = "__mb", Et = "call", Ze = "reply", St = "host-ready", Ct = "height", nn = "html, body { overflow: hidden !important; }", on = `
|
|
6
6
|
(function () {
|
|
7
7
|
var seq = 0, waiting = {}, queue = [], ready = false, last = -1;
|
|
8
8
|
function call(method, args) {
|
|
@@ -10,16 +10,16 @@ const V = "__mb", mt = "call", Ue = "reply", bt = "host-ready", ht = "height", q
|
|
|
10
10
|
function run() {
|
|
11
11
|
var id = ++seq;
|
|
12
12
|
waiting[id] = { resolve: resolve, reject: reject };
|
|
13
|
-
parent.postMessage({ '${
|
|
13
|
+
parent.postMessage({ '${X}': '${Et}', id: id, method: method, args: args }, '*');
|
|
14
14
|
}
|
|
15
15
|
if (ready) run(); else queue.push(run);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
window.addEventListener('message', function (event) {
|
|
19
19
|
var data = event.data, pending;
|
|
20
|
-
if (!data || data['${
|
|
21
|
-
if (data['${
|
|
22
|
-
if (data['${
|
|
20
|
+
if (!data || data['${X}'] === undefined) return;
|
|
21
|
+
if (data['${X}'] === '${St}') { ready = true; queue.splice(0).forEach(function (run) { run(); }); return; }
|
|
22
|
+
if (data['${X}'] !== '${Ze}') return;
|
|
23
23
|
if (!(pending = waiting[data.id])) return;
|
|
24
24
|
delete waiting[data.id];
|
|
25
25
|
if (data.ok) pending.resolve(data.value); else pending.reject(new Error(data.error || '调用失败'));
|
|
@@ -60,7 +60,7 @@ const V = "__mb", mt = "call", Ue = "reply", bt = "host-ready", ht = "height", q
|
|
|
60
60
|
if (height > 0) height += 1;
|
|
61
61
|
if (height === last) return; /* 一样高就不再发:否则「宿主改高度 → 触发观察 → 又发一次」会转个不停 */
|
|
62
62
|
last = height;
|
|
63
|
-
parent.postMessage({ '${
|
|
63
|
+
parent.postMessage({ '${X}': '${Ct}', height: height }, '*');
|
|
64
64
|
}
|
|
65
65
|
function start() {
|
|
66
66
|
report();
|
|
@@ -69,237 +69,237 @@ const V = "__mb", mt = "call", Ue = "reply", bt = "host-ready", ht = "height", q
|
|
|
69
69
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
70
70
|
setInterval(report, 500);
|
|
71
71
|
})();
|
|
72
|
-
`,
|
|
73
|
-
function
|
|
72
|
+
`, sn = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
|
|
73
|
+
function Tt(t) {
|
|
74
74
|
const e = typeof window > "u" ? "http://localhost" : window.location.href;
|
|
75
|
-
return new URL(`${
|
|
75
|
+
return new URL(`${Qt}${t}`, e);
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const ut = (() => {
|
|
78
78
|
try {
|
|
79
|
-
return
|
|
79
|
+
return Tt("").origin;
|
|
80
80
|
} catch {
|
|
81
81
|
return typeof window > "u" ? "" : window.location.origin;
|
|
82
82
|
}
|
|
83
83
|
})();
|
|
84
|
-
async function
|
|
85
|
-
if (!
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
const
|
|
84
|
+
async function an(t, e, s) {
|
|
85
|
+
if (!sn.test(e)) throw new Error(`路由名不合法:${e}(要写成 类名.方法名,例如 Customer.create)`);
|
|
86
|
+
const l = Tt(`/bx/${t}/${e}`);
|
|
87
|
+
if (l.origin !== ut) throw new Error(`后端地址必须是本应用的(${ut}):${l.origin}`);
|
|
88
|
+
const i = s instanceof Blob ? s : null, c = await fetch(l.toString(), {
|
|
89
89
|
method: "POST",
|
|
90
90
|
credentials: "include",
|
|
91
91
|
// 带上 HttpOnly 会话 cookie;authHeaders('POST') 给 CSRF 头(缺了 403)
|
|
92
|
-
headers:
|
|
93
|
-
body:
|
|
94
|
-
}),
|
|
95
|
-
if (
|
|
96
|
-
if (!
|
|
92
|
+
headers: i ? { "Content-Type": i.type || "application/octet-stream", ...Ye("POST") } : { "Content-Type": "application/json", ...Ye("POST") },
|
|
93
|
+
body: i ?? JSON.stringify(s ?? {})
|
|
94
|
+
}), d = await c.text().catch(() => "");
|
|
95
|
+
if (c.ok) {
|
|
96
|
+
if (!d) return null;
|
|
97
97
|
try {
|
|
98
|
-
return JSON.parse(
|
|
98
|
+
return JSON.parse(d);
|
|
99
99
|
} catch {
|
|
100
|
-
return
|
|
100
|
+
return d;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
let
|
|
103
|
+
let u = d;
|
|
104
104
|
try {
|
|
105
|
-
const
|
|
106
|
-
typeof
|
|
105
|
+
const p = JSON.parse(d);
|
|
106
|
+
typeof p?.message == "string" && (u = p.message);
|
|
107
107
|
} catch {
|
|
108
|
-
|
|
108
|
+
u = d;
|
|
109
109
|
}
|
|
110
|
-
throw new Error(
|
|
110
|
+
throw new Error(u ? `${e} 调用失败:${u.slice(0, 300)}` : `${e} 调用失败(${c.status})`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
112
|
+
function ln(t, e) {
|
|
113
|
+
const s = (d) => {
|
|
114
114
|
try {
|
|
115
|
-
t.contentWindow?.postMessage(
|
|
116
|
-
} catch (
|
|
117
|
-
console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):",
|
|
115
|
+
t.contentWindow?.postMessage(d, "*");
|
|
116
|
+
} catch (u) {
|
|
117
|
+
console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):", u);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
async function
|
|
121
|
-
if (
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
if (!
|
|
125
|
-
return await e.onNavigateTab(
|
|
120
|
+
async function l(d, u) {
|
|
121
|
+
if (d === "getMe") return await Z("/auth/me");
|
|
122
|
+
if (d === "navigateTab") {
|
|
123
|
+
const p = typeof u[0] == "string" ? u[0].trim() : "";
|
|
124
|
+
if (!p || !e.onNavigateTab) throw new Error(`跳不了 ${p || "(空地址)"}:这个页面没有把宿主接到路由上`);
|
|
125
|
+
return await e.onNavigateTab(p);
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
131
|
-
return e.onTabTitle?.(
|
|
127
|
+
if (d === "context") return e.context ? e.context() : {};
|
|
128
|
+
if (d === "setTabTitle") {
|
|
129
|
+
const p = typeof u[0] == "string" ? u[0].trim() : "", f = typeof u[1] == "string" ? u[1].trim() : "";
|
|
130
|
+
if (!p) throw new Error("setTabTitle 要给一个非空的名字");
|
|
131
|
+
return e.onTabTitle?.(p, f || void 0), !0;
|
|
132
132
|
}
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
if (!f || typeof f != "object" || Array.isArray(f)) throw new Error(`magicBackendApi.${
|
|
137
|
-
return await
|
|
133
|
+
if (d === "backend") {
|
|
134
|
+
const p = typeof u[0] == "string" ? u[0].trim() : "", f = u[1];
|
|
135
|
+
if (!p) throw new Error("后端调用的路由名是空的:要写成 magicBackendApi.类名.方法名(参数)");
|
|
136
|
+
if (!f || typeof f != "object" || Array.isArray(f)) throw new Error(`magicBackendApi.${p}(params) 的参数要么是一个对象,要么是一个文件(File / Blob)`);
|
|
137
|
+
return await an(e.uuid, p, f);
|
|
138
138
|
}
|
|
139
|
-
throw new Error(`不认识的方法:${String(
|
|
139
|
+
throw new Error(`不认识的方法:${String(d)}(这块桥只有 getMe / navigateTab / context / setTabTitle / backend 五个)`);
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
145
|
-
if (
|
|
146
|
-
const f = typeof
|
|
141
|
+
const i = (d) => {
|
|
142
|
+
if (d.source !== t.contentWindow) return;
|
|
143
|
+
const u = d.data;
|
|
144
|
+
if (!u) return;
|
|
145
|
+
if (u[X] === Ct) {
|
|
146
|
+
const f = typeof u.height == "number" ? u.height : NaN;
|
|
147
147
|
Number.isFinite(f) && f > 0 && e.onHeight?.(f);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
150
|
+
if (u[X] !== Et) return;
|
|
151
|
+
const p = u.id;
|
|
152
152
|
(async () => {
|
|
153
153
|
try {
|
|
154
|
-
|
|
154
|
+
s({ [X]: Ze, id: p, ok: !0, value: await l(String(u.method), u.args ?? []) });
|
|
155
155
|
} catch (f) {
|
|
156
|
-
|
|
156
|
+
s({ [X]: Ze, id: p, ok: !1, error: f instanceof Error ? f.message : String(f) });
|
|
157
157
|
}
|
|
158
158
|
})();
|
|
159
159
|
};
|
|
160
|
-
window.addEventListener("message",
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
window.removeEventListener("message",
|
|
160
|
+
window.addEventListener("message", i);
|
|
161
|
+
const c = () => s({ [X]: St });
|
|
162
|
+
return c(), t.addEventListener("load", c), () => {
|
|
163
|
+
window.removeEventListener("message", i), t.removeEventListener("load", c);
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
168
|
-
if (
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
return
|
|
166
|
+
const Bt = "index.open.html", rn = "backend_open.py", cn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
167
|
+
function dt(t, e) {
|
|
168
|
+
if (cn.test(t)) return;
|
|
169
|
+
const s = (t.split(/[?#]/)[0] ?? "").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
170
|
+
if (s in e) return s;
|
|
171
|
+
const l = s.split("/").pop() ?? "";
|
|
172
|
+
return l ? Object.keys(e).find((i) => (i.split("/").pop() ?? "") === l) : void 0;
|
|
173
173
|
}
|
|
174
|
-
const
|
|
175
|
-
function
|
|
176
|
-
return `${
|
|
174
|
+
const Ot = "\0mb:";
|
|
175
|
+
function un(t) {
|
|
176
|
+
return `${Ot}${t}\0`;
|
|
177
177
|
}
|
|
178
|
-
const
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
return { html: t.replace(
|
|
182
|
-
const
|
|
183
|
-
return
|
|
184
|
-
${
|
|
178
|
+
const dn = /<script\b([^>]*?)\bsrc\s*=\s*(["'])(.*?)\2([^>]*)>\s*<\/script\s*>/gi, pn = /<link\b([^>]*?)\bhref\s*=\s*(["'])(.*?)\2([^>]*?)\/?>/gi;
|
|
179
|
+
function fn(t, e) {
|
|
180
|
+
const s = [], l = (d) => (s.push(d), un(s.length - 1));
|
|
181
|
+
return { html: t.replace(dn, (d, u, p, f, x) => {
|
|
182
|
+
const g = dt(f, e);
|
|
183
|
+
return g === void 0 ? d : l(`<script${u}${x}>
|
|
184
|
+
${Mt(e[g] ?? "")}
|
|
185
185
|
<\/script>`);
|
|
186
|
-
}).replace(
|
|
187
|
-
if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${
|
|
188
|
-
const
|
|
189
|
-
return
|
|
190
|
-
${e[
|
|
186
|
+
}).replace(pn, (d, u, p, f, x) => {
|
|
187
|
+
if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${u}${x}`)) return d;
|
|
188
|
+
const g = dt(f, e);
|
|
189
|
+
return g === void 0 ? d : l(`<style>
|
|
190
|
+
${e[g]}
|
|
191
191
|
</style>`);
|
|
192
|
-
}), slots:
|
|
192
|
+
}), slots: s };
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Mt(t) {
|
|
195
195
|
return t.replace(/<\/(script)/gi, "<\\/$1");
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
const
|
|
199
|
-
return
|
|
197
|
+
function At(t, e) {
|
|
198
|
+
const s = /<\/head\s*>/i.exec(t);
|
|
199
|
+
return s ? `${t.slice(0, s.index)}${e}${t.slice(s.index)}` : `${e}${t}`;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
return e ?
|
|
203
|
-
${
|
|
201
|
+
function mn(t, e) {
|
|
202
|
+
return e ? At(t, `<script>
|
|
203
|
+
${Mt(e)}
|
|
204
204
|
<\/script>
|
|
205
205
|
`) : t;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
return e ?
|
|
207
|
+
function pt(t, e) {
|
|
208
|
+
return e ? At(t, `<style data-magic-block="host">
|
|
209
209
|
${e}
|
|
210
210
|
</style>
|
|
211
211
|
`) : t;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
const { html:
|
|
217
|
-
if (f.length === 1) return
|
|
218
|
-
let
|
|
219
|
-
for (let
|
|
220
|
-
const
|
|
221
|
-
|
|
213
|
+
function bn(t, e = "") {
|
|
214
|
+
const s = typeof e == "string" ? e : e.bootstrap ?? "", l = typeof e == "string" ? "" : e.css ?? "", i = typeof e == "string" ? "" : e.themeCss ?? "", c = t[Bt];
|
|
215
|
+
if (c === void 0) return "";
|
|
216
|
+
const { html: d, slots: u } = fn(c, t), p = mn(pt(pt(d, i), l), s), f = p.split(Ot);
|
|
217
|
+
if (f.length === 1) return p;
|
|
218
|
+
let x = f[0] ?? "";
|
|
219
|
+
for (let g = 1; g < f.length; g += 1) {
|
|
220
|
+
const k = f[g] ?? "", D = k.indexOf("\0"), j = Number(k.slice(0, D));
|
|
221
|
+
x += (u[j] ?? "") + k.slice(D + 1);
|
|
222
222
|
}
|
|
223
|
-
return
|
|
223
|
+
return x;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
let
|
|
227
|
-
const
|
|
228
|
-
function
|
|
229
|
-
return
|
|
230
|
-
|
|
225
|
+
const Be = /* @__PURE__ */ new Map();
|
|
226
|
+
let _e = null;
|
|
227
|
+
const Xe = /* @__PURE__ */ new Set();
|
|
228
|
+
function hn(t) {
|
|
229
|
+
return Xe.add(t), () => {
|
|
230
|
+
Xe.delete(t);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
for (const t of
|
|
233
|
+
function vn() {
|
|
234
|
+
Be.clear(), _e = null;
|
|
235
|
+
for (const t of Xe) t();
|
|
236
236
|
}
|
|
237
|
-
async function
|
|
237
|
+
async function gn(t) {
|
|
238
238
|
const e = [...new Set(t)].filter(Boolean);
|
|
239
|
-
if (e.some((
|
|
240
|
-
|
|
239
|
+
if (e.some((s) => !Be.has(s))) {
|
|
240
|
+
_e && await _e.catch(() => {
|
|
241
241
|
});
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
for (const
|
|
245
|
-
return
|
|
242
|
+
const s = e.filter((l) => !Be.has(l));
|
|
243
|
+
s.length > 0 && (_e = Z(`/magic-blocks/render?ids=${s.map(encodeURIComponent).join(",")}`).then((l) => {
|
|
244
|
+
for (const i of l) i?.id && Be.set(i.id, i);
|
|
245
|
+
return l;
|
|
246
246
|
}).catch(() => []).finally(() => {
|
|
247
|
-
|
|
248
|
-
}), await
|
|
247
|
+
_e = null;
|
|
248
|
+
}), await _e.catch(() => {
|
|
249
249
|
}));
|
|
250
250
|
}
|
|
251
|
-
return e.map((
|
|
251
|
+
return e.map((s) => Be.get(s)).filter((s) => !!s);
|
|
252
252
|
}
|
|
253
|
-
const
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
if (/@font-face|@keyframes/i.test(
|
|
257
|
-
const
|
|
258
|
-
return /(^|[\s,>+~])(\.p-|\.pi(?![a-z])|\.pi-|\.labull-|:root|html(?![a-z-])|body(?![a-z-])|\*|:where\()/.test(
|
|
253
|
+
const ue = "labull.css", Ie = "CONTROLS.lock.html";
|
|
254
|
+
function yn(t, e) {
|
|
255
|
+
const s = String(e || "");
|
|
256
|
+
if (/@font-face|@keyframes/i.test(s)) return !0;
|
|
257
|
+
const l = String(t || "");
|
|
258
|
+
return /(^|[\s,>+~])(\.p-|\.pi(?![a-z])|\.pi-|\.labull-|:root|html(?![a-z-])|body(?![a-z-])|\*|:where\()/.test(l) ? !0 : /--(?:sp|surface|primary|text-color|content|highlight|focus-ring|p-)/.test(s);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
for (let
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
e.push(`${
|
|
268
|
-
${
|
|
260
|
+
function Pt(t, e, s) {
|
|
261
|
+
for (let l = 0; l < t.length; l += 1) {
|
|
262
|
+
const i = t[l], c = String(i.cssText || ""), d = String(i.selectorText || "");
|
|
263
|
+
if (i.cssRules && i.cssRules.length > 0) {
|
|
264
|
+
const u = [];
|
|
265
|
+
if (Pt(i.cssRules, u, s), u.length === 0) continue;
|
|
266
|
+
const p = c.slice(0, c.indexOf("{")).trim();
|
|
267
|
+
e.push(`${p} {
|
|
268
|
+
${u.map((f) => " " + f).join(`
|
|
269
269
|
`)}
|
|
270
270
|
}`);
|
|
271
271
|
continue;
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
yn(d, c) && (e.push(c), s.n += 1);
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const t = [], e = [],
|
|
278
|
-
let
|
|
279
|
-
const
|
|
280
|
-
for (const
|
|
281
|
-
const
|
|
282
|
-
let
|
|
276
|
+
function Rt() {
|
|
277
|
+
const t = [], e = [], s = { n: 0 };
|
|
278
|
+
let l = 0;
|
|
279
|
+
const i = typeof document > "u" ? [] : Array.from(document.styleSheets);
|
|
280
|
+
for (const d of i) {
|
|
281
|
+
const u = d.href || "(内联 <style>)";
|
|
282
|
+
let p = null;
|
|
283
283
|
try {
|
|
284
|
-
|
|
284
|
+
p = d.cssRules;
|
|
285
285
|
} catch {
|
|
286
|
-
e.push(
|
|
286
|
+
e.push(u);
|
|
287
287
|
continue;
|
|
288
288
|
}
|
|
289
|
-
if (!
|
|
289
|
+
if (!p || p.length === 0) continue;
|
|
290
290
|
const f = [];
|
|
291
|
-
|
|
291
|
+
Pt(p, f, s), f.length !== 0 && (l += 1, t.push(`/* ── ${u} ── */`, ...f));
|
|
292
292
|
}
|
|
293
293
|
return { css: [
|
|
294
294
|
"/* 生成物:每次导出都会重写,别手改。",
|
|
295
295
|
" *",
|
|
296
296
|
" * 这是这个应用此刻真正在用的 **labull 主题 + 控件样式**(token / PrimeVue 控件 / 结构类 / 图标)。",
|
|
297
|
-
` * 收自 ${
|
|
297
|
+
` * 收自 ${l} 张样式表、${s.n} 条规则。`,
|
|
298
298
|
e.length > 0 ? ` * ⚠️ 有 ${e.length} 张样式表读不到规则(跨源,浏览器不让读):${e.join(" / ")} —— 需要的话手动补一份。` : " * (没有读不到的样式表:收全了。)",
|
|
299
299
|
" *",
|
|
300
300
|
" * 怎么用(块里):**什么都不用加** —— 宿主会把这一份注入每个块的 iframe(`MagicBlockHost` 的 `theme` prop),",
|
|
301
301
|
' * 所以直接写类名就行:`<button class="p-button">` / `<input class="p-inputtext">` / `<span class="p-tag">`。',
|
|
302
|
-
" * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" +
|
|
302
|
+
" * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" + Ie + "` 里的每一块 markup 都能直接用)。",
|
|
303
303
|
" * ⚠️ 别把它当块包文件塞进块里:它 500 KB 上下,而且宿主已经注入了一份(重复只会更慢)。",
|
|
304
304
|
" * ⚠️ 块里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为,",
|
|
305
305
|
" * 这里能用的是类名(按钮、输入框、标签、面板、表格、图标)。",
|
|
@@ -308,10 +308,10 @@ function $t() {
|
|
|
308
308
|
].join(`
|
|
309
309
|
`) + t.join(`
|
|
310
310
|
`) + `
|
|
311
|
-
`, sheets:
|
|
311
|
+
`, sheets: l, skipped: e, rules: s.n };
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
const
|
|
313
|
+
function _n() {
|
|
314
|
+
const s = [
|
|
315
315
|
["按钮", '<button class="p-button" type="button">主要按钮</button>'],
|
|
316
316
|
["次要按钮", '<button class="p-button p-button-outlined" type="button">次要按钮</button>'],
|
|
317
317
|
["纯文字按钮", '<button class="p-button p-button-text" type="button">纯文字</button>'],
|
|
@@ -328,10 +328,10 @@ function rn() {
|
|
|
328
328
|
["面板 + 标题", '<div class="labull-panel"><h2 class="labull-subject-title"><i class="pi pi-list"></i> 面板标题</h2><p>面板正文。</p></div>'],
|
|
329
329
|
["表格", "<table><thead><tr><th>列 A</th><th>列 B</th></tr></thead><tbody><tr><td>值</td><td>值</td></tr></tbody></table>"]
|
|
330
330
|
].map(
|
|
331
|
-
([
|
|
332
|
-
<h3>${
|
|
333
|
-
<div class="demo">${
|
|
334
|
-
<pre>${
|
|
331
|
+
([l, i]) => ` <section>
|
|
332
|
+
<h3>${l}</h3>
|
|
333
|
+
<div class="demo">${i}</div>
|
|
334
|
+
<pre>${i.replace(/&/g, "&").replace(/</g, "<")}</pre>
|
|
335
335
|
</section>`
|
|
336
336
|
).join(`
|
|
337
337
|
`);
|
|
@@ -343,7 +343,7 @@ function rn() {
|
|
|
343
343
|
<head>
|
|
344
344
|
<meta charset="utf-8">
|
|
345
345
|
<title>labull 控件清单</title>
|
|
346
|
-
<link rel="stylesheet" href="${
|
|
346
|
+
<link rel="stylesheet" href="${ue}">
|
|
347
347
|
<style>
|
|
348
348
|
body { margin: 0; padding: 16px; }
|
|
349
349
|
h1 { margin: 0 0 4px; font-size: 18px; }
|
|
@@ -359,72 +359,72 @@ function rn() {
|
|
|
359
359
|
<body>
|
|
360
360
|
<h1>labull 控件清单</h1>
|
|
361
361
|
<p class="lead">
|
|
362
|
-
这些类名来自 <code>${
|
|
362
|
+
这些类名来自 <code>${ue}</code>(与应用同源同版本)。块里别自己写一套配色 / 按钮:
|
|
363
363
|
把这一行加进 <code>index.open.html</code> 的 <code><head></code>,
|
|
364
364
|
下面每一块 markup 都能直接用:
|
|
365
|
-
<code><link rel="stylesheet" href="${
|
|
365
|
+
<code><link rel="stylesheet" href="${ue}"></code>
|
|
366
366
|
<br />
|
|
367
367
|
⚠️ 这里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为(块里没有构建步骤)。
|
|
368
368
|
</p>
|
|
369
|
-
${
|
|
369
|
+
${s}
|
|
370
370
|
</body>
|
|
371
371
|
</html>
|
|
372
372
|
`;
|
|
373
373
|
}
|
|
374
|
-
const
|
|
375
|
-
let
|
|
376
|
-
function
|
|
377
|
-
for (const t of
|
|
374
|
+
const de = /* @__PURE__ */ new Map(), Qe = /* @__PURE__ */ new Set(), kn = 4e3;
|
|
375
|
+
let et = "", Re = null;
|
|
376
|
+
function ft() {
|
|
377
|
+
for (const t of Qe) t();
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
381
|
-
|
|
379
|
+
function wn(t) {
|
|
380
|
+
return Qe.add(t), () => {
|
|
381
|
+
Qe.delete(t);
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
return
|
|
384
|
+
function qe() {
|
|
385
|
+
return et;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
389
|
-
if (!
|
|
387
|
+
function $n(t, e) {
|
|
388
|
+
const s = String(t || "").trim(), l = String(e || "").trim();
|
|
389
|
+
if (!s || !l) return () => {
|
|
390
390
|
};
|
|
391
|
-
let
|
|
392
|
-
return
|
|
393
|
-
const
|
|
394
|
-
|
|
391
|
+
let i = de.get(s);
|
|
392
|
+
return i || (i = /* @__PURE__ */ new Set(), de.set(s, i)), i.add(l), () => {
|
|
393
|
+
const c = de.get(s);
|
|
394
|
+
c && (c.delete(l), c.size === 0 && de.delete(s));
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
if (!
|
|
400
|
-
for (const
|
|
401
|
-
if (
|
|
402
|
-
return
|
|
397
|
+
function tt(t, e, s) {
|
|
398
|
+
const l = de.get(String(t || ""));
|
|
399
|
+
if (!l) return null;
|
|
400
|
+
for (const i of l)
|
|
401
|
+
if (i !== e && !(s && !s(i)))
|
|
402
|
+
return i;
|
|
403
403
|
return null;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
406
|
-
return [...
|
|
405
|
+
function xn(t) {
|
|
406
|
+
return [...de.get(String(t || "")) ?? []];
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
const
|
|
410
|
-
return !
|
|
408
|
+
function En(t, e, s) {
|
|
409
|
+
const l = de.get(String(t || ""));
|
|
410
|
+
return !l || l.size === 0 || l.has(e) ? null : tt(t, e, s);
|
|
411
411
|
}
|
|
412
|
-
function
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}, Math.max(1, e)),
|
|
412
|
+
function jt(t, e = kn) {
|
|
413
|
+
et = String(t || ""), Re !== null && clearTimeout(Re), Re = setTimeout(() => {
|
|
414
|
+
Re = null, et = "", ft();
|
|
415
|
+
}, Math.max(1, e)), ft();
|
|
416
416
|
}
|
|
417
|
-
const
|
|
417
|
+
const Sn = ["data-magic-block", "data-magic-module"], Cn = ["srcdoc", "title"], Tn = { class: "mb__state" }, Bn = { class: "mb__brief" }, On = {
|
|
418
418
|
key: 0,
|
|
419
419
|
class: "mb__reason"
|
|
420
|
-
},
|
|
420
|
+
}, Mn = {
|
|
421
421
|
key: 1,
|
|
422
422
|
class: "mb__issues"
|
|
423
|
-
},
|
|
423
|
+
}, An = {
|
|
424
424
|
key: 2,
|
|
425
425
|
class: "mb__ring",
|
|
426
426
|
"aria-hidden": "true"
|
|
427
|
-
},
|
|
427
|
+
}, Pn = ["title", "aria-label"], Rn = ["title", "aria-label"], jn = ["title", "aria-label"], Nn = ["title", "aria-label"], In = /* @__PURE__ */ ot({
|
|
428
428
|
__name: "MagicBlockHost",
|
|
429
429
|
props: {
|
|
430
430
|
uuid: {},
|
|
@@ -433,188 +433,188 @@ const mn = ["data-magic-block", "data-magic-module"], bn = ["srcdoc", "title"],
|
|
|
433
433
|
theme: { type: Boolean, default: !0 }
|
|
434
434
|
},
|
|
435
435
|
setup(t) {
|
|
436
|
-
const e = t,
|
|
437
|
-
let
|
|
438
|
-
const
|
|
439
|
-
const
|
|
440
|
-
for (const [
|
|
441
|
-
return
|
|
442
|
-
}),
|
|
443
|
-
let
|
|
444
|
-
function
|
|
436
|
+
const e = t, s = en(), l = kt(), { isStaff: i } = wt(), c = w(null), d = w(null), u = w(null), p = w(!1), f = w(0), x = w(0);
|
|
437
|
+
let g = null, k = null, D = null, j = null, oe = null, le = null;
|
|
438
|
+
const M = R(() => e.name.trim() || e.uuid), C = R(() => u.value?.state ?? ""), L = R(() => C.value === "invalid" ? "校验不通过" : C.value === "draft" ? "未开发" : M.value), ie = R(() => (u.value?.brief ?? "").trim() || (u.value?.name ?? "").trim() || M.value), J = R(() => (u.value?.reason ?? "").trim()), pe = R(() => u.value?.issues ?? []), ke = R(() => Math.max(x.value, f.value, 1)), Le = R(() => ({ height: `${ke.value}px` })), V = R(() => {
|
|
439
|
+
const y = {};
|
|
440
|
+
for (const [_, T] of Object.entries(u.value?.files ?? {})) _ !== rn && (y[_] = T);
|
|
441
|
+
return y;
|
|
442
|
+
}), F = R(() => C.value === "ok" && typeof V.value[Bt] == "string");
|
|
443
|
+
let A = null;
|
|
444
|
+
function fe() {
|
|
445
445
|
if (!e.theme) return "";
|
|
446
|
-
if (
|
|
446
|
+
if (A !== null || (A = "", typeof document > "u")) return A;
|
|
447
447
|
try {
|
|
448
|
-
|
|
448
|
+
A = Rt().css;
|
|
449
449
|
} catch {
|
|
450
|
-
|
|
450
|
+
A = "";
|
|
451
451
|
}
|
|
452
|
-
return
|
|
452
|
+
return A;
|
|
453
453
|
}
|
|
454
|
-
const
|
|
455
|
-
if (!
|
|
456
|
-
const
|
|
457
|
-
return
|
|
454
|
+
const Q = R(() => {
|
|
455
|
+
if (!F.value) return "";
|
|
456
|
+
const y = { bootstrap: on, css: nn }, _ = fe();
|
|
457
|
+
return _ && (y.themeCss = _), bn(V.value, y);
|
|
458
458
|
});
|
|
459
|
-
function
|
|
460
|
-
return { key:
|
|
459
|
+
function re() {
|
|
460
|
+
return { key: s.key, path: s.path, params: s.params, query: s.query };
|
|
461
461
|
}
|
|
462
|
-
async function
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
const
|
|
466
|
-
throw new Error(`这个应用里没有页面 ${
|
|
462
|
+
async function we(y) {
|
|
463
|
+
const _ = l.resolve(y);
|
|
464
|
+
if (_.matched.length === 0) {
|
|
465
|
+
const T = l.getRoutes().map((K) => K.path);
|
|
466
|
+
throw new Error(`这个应用里没有页面 ${y}。能跳的页面只有:${T.length > 0 ? T.join(" / ") : "(还没有配路由)"}`);
|
|
467
467
|
}
|
|
468
|
-
return
|
|
468
|
+
return We(y) || _.fullPath;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
|
|
472
|
-
const
|
|
473
|
-
|
|
470
|
+
function ee() {
|
|
471
|
+
D?.(), D = null;
|
|
472
|
+
const y = d.value;
|
|
473
|
+
y && (D = ln(y, {
|
|
474
474
|
uuid: e.uuid,
|
|
475
|
-
onHeight: (
|
|
476
|
-
f.value =
|
|
475
|
+
onHeight: (_) => {
|
|
476
|
+
f.value = _;
|
|
477
477
|
},
|
|
478
|
-
onNavigateTab:
|
|
479
|
-
context:
|
|
478
|
+
onNavigateTab: we,
|
|
479
|
+
context: re,
|
|
480
480
|
/* 🔴 块给**自己所属那条标签**起名:整页就是一个块时(`MagicBlockPage`),标签栏上那条
|
|
481
481
|
* 默认只有路由的 `meta.title`("订单详情"),而"订单 SO-42"只有块自己知道。 */
|
|
482
|
-
onTabTitle: (
|
|
482
|
+
onTabTitle: (_, T) => s.setTitle(_, T)
|
|
483
483
|
}));
|
|
484
484
|
}
|
|
485
|
-
async function
|
|
486
|
-
const
|
|
487
|
-
|
|
485
|
+
async function z() {
|
|
486
|
+
const y = e.uuid, _ = await gn([y]);
|
|
487
|
+
y === e.uuid && (u.value = _.find((T) => T.id === y) ?? null);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function se() {
|
|
490
490
|
window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid: e.uuid } }));
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
|
|
492
|
+
function H(y = !1) {
|
|
493
|
+
y && oe?.(), oe = $n(e.uuid, s.key);
|
|
494
494
|
}
|
|
495
|
-
const
|
|
496
|
-
if (!
|
|
497
|
-
const
|
|
498
|
-
return
|
|
495
|
+
const ce = (y) => !$t(y, l), G = R(() => {
|
|
496
|
+
if (!i.value) return "";
|
|
497
|
+
const y = tt(e.uuid, s.key, ce);
|
|
498
|
+
return y ? `管理员:切到还挂着这个块的标签 ${y}(点一下这一块会亮红框)` : "管理员:这个块只在这一条标签里挂着 —— 点一下会亮几秒红框";
|
|
499
499
|
});
|
|
500
|
-
function
|
|
501
|
-
if (!
|
|
502
|
-
const
|
|
503
|
-
|
|
500
|
+
function ae() {
|
|
501
|
+
if (!i.value) return;
|
|
502
|
+
const y = tt(e.uuid, s.key, ce);
|
|
503
|
+
jt(e.uuid), y && We(y);
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
let
|
|
507
|
-
for (;
|
|
508
|
-
if (getComputedStyle(
|
|
509
|
-
|
|
505
|
+
function Me(y) {
|
|
506
|
+
let _ = y.parentElement;
|
|
507
|
+
for (; _; ) {
|
|
508
|
+
if (getComputedStyle(_).overflowY !== "visible" && _.clientHeight > 0) return _;
|
|
509
|
+
_ = _.parentElement;
|
|
510
510
|
}
|
|
511
511
|
return document.documentElement;
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
const
|
|
515
|
-
if (!
|
|
516
|
-
const
|
|
517
|
-
return Math.max(0, Math.floor(
|
|
513
|
+
function Fe() {
|
|
514
|
+
const y = c.value;
|
|
515
|
+
if (!y) return 0;
|
|
516
|
+
const _ = Me(y), T = getComputedStyle(_), K = parseFloat(T.paddingTop) || 0, me = parseFloat(T.paddingBottom) || 0, be = parseFloat(T.borderTopWidth) || 0, $e = _ === document.documentElement, ze = $e ? Math.max(0, window.innerHeight - K - me) : Math.max(0, _.clientHeight - K - me), Ae = $e ? K : _.getBoundingClientRect().top + be + K, He = $e ? window.scrollY || 0 : _.scrollTop, Pe = y.getBoundingClientRect().top - Ae + He;
|
|
517
|
+
return Math.max(0, Math.floor(ze - Pe));
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
if (!
|
|
521
|
-
const
|
|
522
|
-
|
|
519
|
+
function O() {
|
|
520
|
+
if (!s.active.value || !c.value) return;
|
|
521
|
+
const y = Fe();
|
|
522
|
+
y > 0 && Math.abs(y - x.value) > 1 && (x.value = y);
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
if (!
|
|
526
|
-
const
|
|
527
|
-
|
|
524
|
+
function E() {
|
|
525
|
+
if (!c.value) return;
|
|
526
|
+
const y = Me(c.value);
|
|
527
|
+
g !== y && (g = y, k?.disconnect(), k = null), O(), !(k || typeof ResizeObserver > "u") && (k = new ResizeObserver(() => O()), k.observe(y));
|
|
528
528
|
}
|
|
529
|
-
return
|
|
530
|
-
f.value = 0,
|
|
531
|
-
}, { flush: "post" }),
|
|
532
|
-
|
|
533
|
-
}),
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
!
|
|
529
|
+
return ye(d, () => ee()), ye(Q, () => {
|
|
530
|
+
f.value = 0, x.value = 0, E();
|
|
531
|
+
}, { flush: "post" }), ye(() => e.uuid, () => {
|
|
532
|
+
ct().then(() => E());
|
|
533
|
+
}), ye(() => s.active.value, (y) => {
|
|
534
|
+
y && ct().then(() => {
|
|
535
|
+
E();
|
|
536
|
+
const _ = c.value;
|
|
537
|
+
!_ || !_.isConnected || _.offsetParent === null || p.value && _.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
538
538
|
});
|
|
539
|
-
}),
|
|
540
|
-
f.value = 0,
|
|
541
|
-
}),
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}),
|
|
545
|
-
}),
|
|
546
|
-
|
|
547
|
-
}), (
|
|
539
|
+
}), ye(() => e.uuid, () => {
|
|
540
|
+
f.value = 0, u.value = null, H(!0), p.value = qe() === e.uuid, z();
|
|
541
|
+
}), gt(() => {
|
|
542
|
+
j = hn(() => void z()), le = wn(() => {
|
|
543
|
+
p.value = qe() === e.uuid;
|
|
544
|
+
}), p.value = qe() === e.uuid, H(), E(), z();
|
|
545
|
+
}), yt(() => {
|
|
546
|
+
k?.disconnect(), k = null, j?.(), j = null, le?.(), le = null, oe?.(), oe = null, D?.(), D = null;
|
|
547
|
+
}), (y, _) => (b(), h("div", {
|
|
548
548
|
ref_key: "el",
|
|
549
|
-
ref:
|
|
550
|
-
class:
|
|
551
|
-
style:
|
|
549
|
+
ref: c,
|
|
550
|
+
class: ne(["mb", { "mb--admin": Te(i), "mb--lit": Te(i) && p.value }]),
|
|
551
|
+
style: _t(Le.value),
|
|
552
552
|
"data-magic-block": t.uuid,
|
|
553
553
|
"data-magic-module": t.module
|
|
554
554
|
}, [
|
|
555
|
-
|
|
555
|
+
F.value ? (b(), h("iframe", {
|
|
556
556
|
key: 0,
|
|
557
557
|
ref_key: "frame",
|
|
558
|
-
ref:
|
|
558
|
+
ref: d,
|
|
559
559
|
class: "mb__frame",
|
|
560
|
-
srcdoc:
|
|
561
|
-
title:
|
|
560
|
+
srcdoc: Q.value,
|
|
561
|
+
title: M.value,
|
|
562
562
|
scrolling: "no",
|
|
563
563
|
sandbox: "allow-scripts allow-forms allow-modals allow-popups allow-downloads"
|
|
564
|
-
}, null, 8,
|
|
564
|
+
}, null, 8, Cn)) : (b(), h("div", {
|
|
565
565
|
key: 1,
|
|
566
|
-
class:
|
|
567
|
-
onClick:
|
|
566
|
+
class: ne(["mb__empty", { "mb__empty--off": C.value === "invalid", "mb__empty--draft": C.value === "draft" }]),
|
|
567
|
+
onClick: ae
|
|
568
568
|
}, [
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
(
|
|
574
|
-
key:
|
|
569
|
+
r("p", Tn, v(L.value), 1),
|
|
570
|
+
r("p", Bn, v(ie.value), 1),
|
|
571
|
+
C.value === "invalid" && J.value ? (b(), h("p", On, v(J.value), 1)) : S("", !0),
|
|
572
|
+
C.value === "invalid" && pe.value.length > 0 ? (b(), h("ul", Mn, [
|
|
573
|
+
(b(!0), h(I, null, te(pe.value, (T, K) => (b(), h("li", {
|
|
574
|
+
key: K,
|
|
575
575
|
class: "mb__issue"
|
|
576
|
-
},
|
|
577
|
-
])) :
|
|
578
|
-
|
|
576
|
+
}, v(T.message), 1))), 128))
|
|
577
|
+
])) : S("", !0),
|
|
578
|
+
r("button", {
|
|
579
579
|
class: "mb__go",
|
|
580
580
|
type: "button",
|
|
581
|
-
onClick:
|
|
581
|
+
onClick: Gt(se, ["stop"])
|
|
582
582
|
}, "去控制台")
|
|
583
583
|
], 2)),
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
Te(i) ? (b(), h("span", An)) : S("", !0),
|
|
585
|
+
Te(i) && F.value ? (b(), h(I, { key: 3 }, [
|
|
586
|
+
r("button", {
|
|
587
587
|
class: "mb__grab mb__grab--top",
|
|
588
588
|
type: "button",
|
|
589
|
-
title:
|
|
590
|
-
"aria-label":
|
|
591
|
-
onClick:
|
|
592
|
-
}, null, 8,
|
|
593
|
-
|
|
589
|
+
title: G.value,
|
|
590
|
+
"aria-label": G.value,
|
|
591
|
+
onClick: ae
|
|
592
|
+
}, null, 8, Pn),
|
|
593
|
+
r("button", {
|
|
594
594
|
class: "mb__grab mb__grab--right",
|
|
595
595
|
type: "button",
|
|
596
|
-
title:
|
|
597
|
-
"aria-label":
|
|
598
|
-
onClick:
|
|
599
|
-
}, null, 8,
|
|
600
|
-
|
|
596
|
+
title: G.value,
|
|
597
|
+
"aria-label": G.value,
|
|
598
|
+
onClick: ae
|
|
599
|
+
}, null, 8, Rn),
|
|
600
|
+
r("button", {
|
|
601
601
|
class: "mb__grab mb__grab--bottom",
|
|
602
602
|
type: "button",
|
|
603
|
-
title:
|
|
604
|
-
"aria-label":
|
|
605
|
-
onClick:
|
|
606
|
-
}, null, 8,
|
|
607
|
-
|
|
603
|
+
title: G.value,
|
|
604
|
+
"aria-label": G.value,
|
|
605
|
+
onClick: ae
|
|
606
|
+
}, null, 8, jn),
|
|
607
|
+
r("button", {
|
|
608
608
|
class: "mb__grab mb__grab--left",
|
|
609
609
|
type: "button",
|
|
610
|
-
title:
|
|
611
|
-
"aria-label":
|
|
612
|
-
onClick:
|
|
613
|
-
}, null, 8,
|
|
614
|
-
], 64)) :
|
|
615
|
-
], 14,
|
|
610
|
+
title: G.value,
|
|
611
|
+
"aria-label": G.value,
|
|
612
|
+
onClick: ae
|
|
613
|
+
}, null, 8, Nn)
|
|
614
|
+
], 64)) : S("", !0)
|
|
615
|
+
], 14, Sn));
|
|
616
616
|
}
|
|
617
|
-
}),
|
|
617
|
+
}), Dn = /* @__PURE__ */ xt(In, [["__scopeId", "data-v-8e1e849f"]]), Ks = /* @__PURE__ */ ot({
|
|
618
618
|
__name: "MagicBlockPage",
|
|
619
619
|
props: {
|
|
620
620
|
uuid: {},
|
|
@@ -623,146 +623,146 @@ const mn = ["data-magic-block", "data-magic-module"], bn = ["srcdoc", "title"],
|
|
|
623
623
|
theme: { type: Boolean, default: !0 }
|
|
624
624
|
},
|
|
625
625
|
setup(t) {
|
|
626
|
-
return (e,
|
|
626
|
+
return (e, s) => (b(), Yt(Dn, {
|
|
627
627
|
uuid: t.uuid,
|
|
628
628
|
name: t.name,
|
|
629
629
|
module: t.module,
|
|
630
630
|
theme: t.theme
|
|
631
631
|
}, null, 8, ["uuid", "name", "module", "theme"]));
|
|
632
632
|
}
|
|
633
|
-
}),
|
|
634
|
-
function
|
|
635
|
-
return t.length > 0 && t.length <=
|
|
633
|
+
}), Ue = "index.open.html", Je = "magic-block.open.yaml", je = ["id", "module", "name", "brief"], st = 40, Ln = /^(?![A-Za-z]:)(?!\/)[A-Za-z0-9._\-/]+$/, Fn = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, zn = /^[a-z][a-z0-9]*$/, Hn = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
634
|
+
function Kn(t) {
|
|
635
|
+
return t.length > 0 && t.length <= st && !/[\u0000-\u001f\u007f]/.test(t);
|
|
636
636
|
}
|
|
637
|
-
const
|
|
637
|
+
const qn = {
|
|
638
638
|
id: "块的 uuid,必须与页面里挂载它时写死的那个 uuid 逐字一致",
|
|
639
639
|
module: "模块名(小写字母与数字,必须以字母开头),例如 home",
|
|
640
|
-
name: `可读名:可以用中文,不超过 ${
|
|
640
|
+
name: `可读名:可以用中文,不超过 ${st} 个字符`,
|
|
641
641
|
brief: "一句话说明这个块解决什么问题"
|
|
642
642
|
};
|
|
643
|
-
function
|
|
643
|
+
function mt(t) {
|
|
644
644
|
const e = Object.keys(t);
|
|
645
645
|
return e.length > 0 ? `现在包里有:${e.join(" / ")}` : "现在这个包是空的";
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Un(t) {
|
|
648
648
|
let e = "";
|
|
649
|
-
for (let
|
|
650
|
-
const
|
|
649
|
+
for (let s = 0; s < t.length; s += 1) {
|
|
650
|
+
const l = t[s];
|
|
651
651
|
if (e)
|
|
652
|
-
|
|
653
|
-
else if (
|
|
654
|
-
else if (
|
|
652
|
+
l === e && (e = "");
|
|
653
|
+
else if (l === '"' || l === "'") e = l;
|
|
654
|
+
else if (l === "#") return t.slice(0, s);
|
|
655
655
|
}
|
|
656
656
|
return t;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Jn(t) {
|
|
659
659
|
let e = "";
|
|
660
|
-
for (let
|
|
661
|
-
const
|
|
660
|
+
for (let s = 0; s < t.length; s += 1) {
|
|
661
|
+
const l = t[s];
|
|
662
662
|
if (e)
|
|
663
|
-
|
|
664
|
-
else if (
|
|
665
|
-
else if (
|
|
663
|
+
l === e && (e = "");
|
|
664
|
+
else if (l === '"' || l === "'") e = l;
|
|
665
|
+
else if (l === ":") return s;
|
|
666
666
|
}
|
|
667
667
|
return -1;
|
|
668
668
|
}
|
|
669
|
-
function
|
|
669
|
+
function Vn(t) {
|
|
670
670
|
return !t || t[0] !== '"' && t[0] !== "'" ? t : t.length >= 2 && t[t.length - 1] === t[0] ? t.slice(1, -1).trim() : t;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
673
|
-
const e = [],
|
|
674
|
-
t.split(/\r?\n/).forEach((
|
|
675
|
-
const
|
|
676
|
-
if (!
|
|
677
|
-
if (
|
|
678
|
-
e.push(`第 ${
|
|
672
|
+
function Gn(t) {
|
|
673
|
+
const e = [], s = {}, l = {};
|
|
674
|
+
t.split(/\r?\n/).forEach((i, c) => {
|
|
675
|
+
const d = c + 1, u = Un(i).trim();
|
|
676
|
+
if (!u) return;
|
|
677
|
+
if (u.startsWith("-")) {
|
|
678
|
+
e.push(`第 ${d} 行是列表写法(${u}):清单只认「键: 值」,四个键各占一行 —— 例如 name: 客户档案`);
|
|
679
679
|
return;
|
|
680
680
|
}
|
|
681
|
-
const
|
|
682
|
-
if (
|
|
683
|
-
e.push(`第 ${
|
|
681
|
+
const p = Jn(u);
|
|
682
|
+
if (p < 0) {
|
|
683
|
+
e.push(`第 ${d} 行不是「键: 值」(${u}):清单只认「键: 值」与 # 注释 —— 要么删掉这一行,要么照 name: 客户档案 写`);
|
|
684
684
|
return;
|
|
685
685
|
}
|
|
686
|
-
const f =
|
|
687
|
-
if (!
|
|
688
|
-
e.push(`第 ${
|
|
686
|
+
const f = u.slice(0, p).trim();
|
|
687
|
+
if (!Hn.test(f)) {
|
|
688
|
+
e.push(`第 ${d} 行的键名不合法(${f}):键名只许字母或下划线开头,认得的键只有 ${je.join(" / ")}`);
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
|
-
if (!
|
|
692
|
-
e.push(`第 ${
|
|
691
|
+
if (!je.includes(f)) {
|
|
692
|
+
e.push(`第 ${d} 行的键不认识(${f}):清单只有 ${je.join(" / ")} 这四个键`);
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
|
-
if (f in
|
|
696
|
-
e.push(`第 ${
|
|
695
|
+
if (f in l) {
|
|
696
|
+
e.push(`第 ${d} 行重复写了 ${f}(第 ${l[f]} 行已经写过):一个键只许出现一次`);
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
|
-
|
|
699
|
+
l[f] = d, s[f] = Vn(u.slice(p + 1).trim());
|
|
700
700
|
});
|
|
701
|
-
for (const
|
|
702
|
-
const
|
|
703
|
-
if (
|
|
704
|
-
e.push(`清单里缺少 ${
|
|
701
|
+
for (const i of je) {
|
|
702
|
+
const c = s[i] ?? "";
|
|
703
|
+
if (c === "") {
|
|
704
|
+
e.push(`清单里缺少 ${i}(或者是空的):${qn[i]}`);
|
|
705
705
|
continue;
|
|
706
706
|
}
|
|
707
|
-
|
|
708
|
-
`清单里的 module 不合法:${
|
|
709
|
-
) :
|
|
707
|
+
i === "id" && !Fn.test(c) ? e.push(`清单里的 id 不是 uuid:${c} —— 要 8-4-4-4-12 那种十六进制`) : i === "module" && !zn.test(c) ? e.push(
|
|
708
|
+
`清单里的 module 不合法:${c} —— 它同时是 Django 的 app label,所以只许小写字母与数字、必须以字母开头(不能有横线与下划线),例如 home / orders`
|
|
709
|
+
) : i === "name" && !Kn(c) && e.push(`清单里的 name 不合法:${c} —— 不能超过 ${st} 个字符、不能含控制字符(中文可以)`);
|
|
710
710
|
}
|
|
711
|
-
return [
|
|
711
|
+
return [s, e];
|
|
712
712
|
}
|
|
713
|
-
function
|
|
714
|
-
return
|
|
713
|
+
function Yn(t) {
|
|
714
|
+
return Ln.test(t) && !t.split("/").includes("..");
|
|
715
715
|
}
|
|
716
|
-
function
|
|
717
|
-
const e = [],
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
if (
|
|
722
|
-
e.push(`包里缺清单:必须有 ${
|
|
723
|
-
else if (!
|
|
724
|
-
e.push(`${
|
|
716
|
+
function Wn(t) {
|
|
717
|
+
const e = [], s = t[Ue];
|
|
718
|
+
s === void 0 ? e.push(`包里缺入口:必须有 ${Ue}(${mt(t)})`) : s.trim() || e.push(`${Ue} 不能是空文件`);
|
|
719
|
+
const l = t[Je];
|
|
720
|
+
let i = {};
|
|
721
|
+
if (l === void 0)
|
|
722
|
+
e.push(`包里缺清单:必须有 ${Je}(${mt(t)})`);
|
|
723
|
+
else if (!l.trim())
|
|
724
|
+
e.push(`${Je} 不能是空文件`);
|
|
725
725
|
else {
|
|
726
|
-
const [
|
|
727
|
-
|
|
726
|
+
const [c, d] = Gn(l);
|
|
727
|
+
i = c, e.push(...d);
|
|
728
728
|
}
|
|
729
|
-
for (const
|
|
730
|
-
|
|
731
|
-
return { manifest:
|
|
729
|
+
for (const c of Object.keys(t))
|
|
730
|
+
Yn(c) || e.push(`文件名不合法:${c}(只许字母数字与 . _ - /,且不许 .. 与绝对路径)`);
|
|
731
|
+
return { manifest: i, issues: e };
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function Zn(t) {
|
|
734
734
|
const e = [];
|
|
735
735
|
if (t.length === 0)
|
|
736
736
|
return e.push("一个块都没勾:请在「读回改动」的结果里勾上要保存的块"), { selected: 0, issues: e };
|
|
737
|
-
for (const
|
|
738
|
-
const
|
|
739
|
-
for (const
|
|
737
|
+
for (const s of t) {
|
|
738
|
+
const l = s.name?.trim() || "(没有名字的块)";
|
|
739
|
+
for (const i of Wn(s.files ?? {}).issues) e.push(`${l}:${i}`);
|
|
740
740
|
}
|
|
741
741
|
return { selected: t.length, issues: e };
|
|
742
742
|
}
|
|
743
|
-
const
|
|
744
|
-
function
|
|
745
|
-
const
|
|
746
|
-
if (
|
|
747
|
-
const
|
|
748
|
-
return /^[0-9]/.test(
|
|
743
|
+
const Ve = "pages.lock.ts";
|
|
744
|
+
function Xn(t, e) {
|
|
745
|
+
const s = String(t || "").split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
746
|
+
if (s.length === 0) return `Page${e + 1}`;
|
|
747
|
+
const l = s.map((i) => i[0].toUpperCase() + i.slice(1)).join("");
|
|
748
|
+
return /^[0-9]/.test(l) ? `P${l}` : l;
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function Qn(t, e) {
|
|
751
751
|
if (!e.has(t))
|
|
752
752
|
return e.add(t), t;
|
|
753
|
-
let
|
|
754
|
-
for (; e.has(`${t}${
|
|
755
|
-
const
|
|
756
|
-
return e.add(
|
|
753
|
+
let s = 2;
|
|
754
|
+
for (; e.has(`${t}${s}`); ) s += 1;
|
|
755
|
+
const l = `${t}${s}`;
|
|
756
|
+
return e.add(l), l;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
const e = (t ?? []).filter((
|
|
760
|
-
e.forEach((
|
|
761
|
-
const
|
|
762
|
-
let
|
|
763
|
-
|
|
758
|
+
function eo(t) {
|
|
759
|
+
const e = (t ?? []).filter((c) => c && typeof c.path == "string" && c.path.trim() !== ""), s = /* @__PURE__ */ new Set(), l = [];
|
|
760
|
+
e.forEach((c, d) => {
|
|
761
|
+
const u = c.group?.trim() || "(没写 meta.group)";
|
|
762
|
+
let p = l.find((f) => f.title === u);
|
|
763
|
+
p || (p = { title: u, rows: [] }, l.push(p)), p.rows.push({ key: Qn(Xn(c.path, d), s), row: c });
|
|
764
764
|
});
|
|
765
|
-
const
|
|
765
|
+
const i = [
|
|
766
766
|
"/* 生成物:**每次导出都会重写**,别手改 —— 改了下次导出就没了。",
|
|
767
767
|
" *",
|
|
768
768
|
" * 这个文件回答「块的前端(index.open.html 那一侧)里我能跳哪些页面、能调什么」。",
|
|
@@ -787,18 +787,18 @@ function Hn(t) {
|
|
|
787
787
|
" */",
|
|
788
788
|
""
|
|
789
789
|
];
|
|
790
|
-
if (
|
|
791
|
-
|
|
790
|
+
if (l.length === 0)
|
|
791
|
+
i.push("/* ⚠️ 这次导出没拿到路由表(这个应用没装 vue-router,或者一条页面路由都没有)。 */", "export const Page = {} as const", "");
|
|
792
792
|
else {
|
|
793
|
-
|
|
794
|
-
for (const
|
|
795
|
-
|
|
796
|
-
for (const
|
|
797
|
-
|
|
793
|
+
i.push("export const Page = {");
|
|
794
|
+
for (const c of l) {
|
|
795
|
+
i.push(` // ── ${c.title} ──`);
|
|
796
|
+
for (const d of c.rows)
|
|
797
|
+
i.push(` /** ${d.row.title?.trim() || d.row.path}(${d.row.path}) */`), i.push(` ${d.key}: '${d.row.path}',`);
|
|
798
798
|
}
|
|
799
|
-
|
|
799
|
+
i.push("} as const", "");
|
|
800
800
|
}
|
|
801
|
-
return
|
|
801
|
+
return i.push(
|
|
802
802
|
"/** `Page` 里那些路径的联合类型(只想收页面路径的参数可以写它)。 */",
|
|
803
803
|
"export type PagePath = (typeof Page)[keyof typeof Page]",
|
|
804
804
|
"",
|
|
@@ -850,856 +850,970 @@ function Hn(t) {
|
|
|
850
850
|
"",
|
|
851
851
|
"export {}",
|
|
852
852
|
""
|
|
853
|
-
),
|
|
853
|
+
), i.join(`
|
|
854
854
|
`);
|
|
855
855
|
}
|
|
856
|
-
function
|
|
856
|
+
function nt() {
|
|
857
857
|
return typeof window < "u" && typeof window.showDirectoryPicker == "function";
|
|
858
858
|
}
|
|
859
|
-
const
|
|
860
|
-
async function
|
|
861
|
-
if (!
|
|
859
|
+
const to = "这个浏览器没法直接写你本机的文件夹(少了 File System Access API):请用 Chrome / Edge,并且从 https 或 http://localhost 打开这个页面(内网 http 会更少 API)。";
|
|
860
|
+
async function Ne() {
|
|
861
|
+
if (!nt()) throw new Error(to);
|
|
862
862
|
try {
|
|
863
863
|
const t = await window.showDirectoryPicker({ mode: "readwrite", id: "labull-magic-block" });
|
|
864
864
|
return { name: t.name, handle: t };
|
|
865
865
|
} catch (t) {
|
|
866
866
|
const e = t instanceof Error ? t.name : "";
|
|
867
|
-
throw e === "AbortError" ? new Error("取消选目录了:想导出就再点一次「选择文件夹」") : e === "SecurityError" ? new Error(`选不了这个目录:浏览器不让(${
|
|
867
|
+
throw e === "AbortError" ? new Error("取消选目录了:想导出就再点一次「选择文件夹」") : e === "SecurityError" ? new Error(`选不了这个目录:浏览器不让(${De(t)})—— 换一个目录,或确认页面是 https / localhost`) : new Error(`选目录失败:${De(t)}`);
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
function
|
|
870
|
+
function De(t) {
|
|
871
871
|
return (t instanceof Error ? t.message.trim() : String(t)) || "没有说原因";
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function no(t) {
|
|
874
874
|
const e = String(t ?? "").split("/");
|
|
875
|
-
for (const
|
|
876
|
-
if (!
|
|
875
|
+
for (const s of e)
|
|
876
|
+
if (!s || s === "." || s === ".." || s.includes("\\") || /^[A-Za-z]:/.test(s))
|
|
877
877
|
throw new Error(`路径不合法:${t}(要相对路径,不许 .. / 盘符 / 反斜杠)`);
|
|
878
878
|
return e;
|
|
879
879
|
}
|
|
880
|
-
const
|
|
881
|
-
function
|
|
880
|
+
const oo = 8;
|
|
881
|
+
function so(t) {
|
|
882
882
|
const e = /* @__PURE__ */ new Map();
|
|
883
|
-
return (
|
|
884
|
-
const
|
|
885
|
-
if (
|
|
886
|
-
let
|
|
887
|
-
for (let
|
|
888
|
-
const
|
|
889
|
-
|
|
883
|
+
return (s) => {
|
|
884
|
+
const l = s.join("\0"), i = e.get(l);
|
|
885
|
+
if (i) return i;
|
|
886
|
+
let c = Promise.resolve(t);
|
|
887
|
+
for (let d = 0; d < s.length; d += 1) {
|
|
888
|
+
const u = s[d], p = s.slice(0, d + 1).join("\0"), f = e.get(p);
|
|
889
|
+
c = f ?? c.then((x) => x.getDirectoryHandle(u, { create: !0 })), f || e.set(p, c);
|
|
890
890
|
}
|
|
891
|
-
return
|
|
891
|
+
return c;
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
|
-
async function
|
|
895
|
-
const
|
|
896
|
-
let
|
|
897
|
-
|
|
894
|
+
async function ao(t, e, s) {
|
|
895
|
+
const l = Object.entries(e ?? {}).map(([x, g]) => ({ path: x, parts: no(x), body: String(g ?? "") })), i = l.length, c = [], d = so(t.handle);
|
|
896
|
+
let u = 0, p = 0;
|
|
897
|
+
s?.(0, i);
|
|
898
898
|
const f = async () => {
|
|
899
899
|
for (; ; ) {
|
|
900
|
-
const
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
if (!
|
|
900
|
+
const x = u;
|
|
901
|
+
u += 1;
|
|
902
|
+
const g = l[x];
|
|
903
|
+
if (!g) return;
|
|
904
904
|
try {
|
|
905
|
-
const
|
|
905
|
+
const j = await (await (await d(g.parts.slice(0, -1))).getFileHandle(g.parts[g.parts.length - 1], { create: !0 })).createWritable();
|
|
906
906
|
try {
|
|
907
|
-
await
|
|
907
|
+
await j.write(g.body);
|
|
908
908
|
} finally {
|
|
909
|
-
await
|
|
909
|
+
await j.close();
|
|
910
910
|
}
|
|
911
|
-
|
|
912
|
-
} catch (
|
|
913
|
-
|
|
911
|
+
p += 1;
|
|
912
|
+
} catch (k) {
|
|
913
|
+
c.push({ path: g.path, message: De(k) });
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
s?.(p + c.length, i);
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
|
-
return await Promise.all(Array.from({ length: Math.max(1, Math.min(
|
|
918
|
+
return await Promise.all(Array.from({ length: Math.max(1, Math.min(oo, i)) }, () => f())), c.sort((x, g) => x.path < g.path ? -1 : x.path > g.path ? 1 : 0), { written: p, failed: c, total: i };
|
|
919
919
|
}
|
|
920
|
-
async function
|
|
921
|
-
const
|
|
922
|
-
for (const
|
|
923
|
-
if (
|
|
924
|
-
|
|
920
|
+
async function bt(t, e) {
|
|
921
|
+
const s = { items: [], topCount: 0, files: 0, dirs: 0 }, l = async (i, c) => {
|
|
922
|
+
for (const d of await Oe(i)) {
|
|
923
|
+
if (d.kind === "file") {
|
|
924
|
+
s.files += 1;
|
|
925
925
|
continue;
|
|
926
926
|
}
|
|
927
|
-
|
|
927
|
+
s.dirs += 1, !(c >= e.maxDepth) && (e.skipDirs.includes(d.name) || await l(d, c + 1));
|
|
928
928
|
}
|
|
929
929
|
};
|
|
930
|
-
for (const
|
|
931
|
-
if (
|
|
930
|
+
for (const i of await Oe(t.handle))
|
|
931
|
+
if (s.items.push({ name: i.name, dir: i.kind === "directory" }), i.kind === "file") s.files += 1;
|
|
932
932
|
else {
|
|
933
|
-
if (
|
|
934
|
-
await
|
|
933
|
+
if (s.dirs += 1, e.skipDirs.includes(i.name) || e.maxDepth <= 0) continue;
|
|
934
|
+
await l(i, 1);
|
|
935
935
|
}
|
|
936
|
-
return
|
|
936
|
+
return s.topCount = s.items.length, s;
|
|
937
937
|
}
|
|
938
|
-
async function
|
|
938
|
+
async function lo(t) {
|
|
939
939
|
const e = [];
|
|
940
|
-
for (const
|
|
941
|
-
let
|
|
942
|
-
for (const
|
|
943
|
-
await t.handle.removeEntry(
|
|
944
|
-
return
|
|
940
|
+
for (const l of await Oe(t.handle)) e.push(l.name);
|
|
941
|
+
let s = 0;
|
|
942
|
+
for (const l of e)
|
|
943
|
+
await t.handle.removeEntry(l, { recursive: !0 }), s += 1;
|
|
944
|
+
return s;
|
|
945
945
|
}
|
|
946
|
-
function
|
|
946
|
+
function ht(t, e) {
|
|
947
947
|
if (t.name === e.blocksDir)
|
|
948
948
|
throw new Error(
|
|
949
949
|
`你选中的是「${e.blocksDir}」这一层(它就是放代码的那一层):导出会铺成 ${e.blocksDir}/${e.blocksDir}/…。请选它**上面**那一层 —— 也就是开发目录本身。`
|
|
950
950
|
);
|
|
951
951
|
}
|
|
952
|
-
async function
|
|
952
|
+
async function Oe(t) {
|
|
953
953
|
const e = [];
|
|
954
|
-
for await (const
|
|
955
|
-
return e.sort((
|
|
954
|
+
for await (const s of t.values()) e.push(s);
|
|
955
|
+
return e.sort((s, l) => s.name < l.name ? -1 : s.name > l.name ? 1 : 0), e;
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function io(t) {
|
|
958
958
|
return t.charCodeAt(0) === 65279 ? t.slice(1) : t;
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function ro(t) {
|
|
961
961
|
const e = t.lastIndexOf(".");
|
|
962
962
|
return e <= 0 ? "" : t.slice(e).toLowerCase();
|
|
963
963
|
}
|
|
964
|
-
async function
|
|
965
|
-
const
|
|
966
|
-
for (const
|
|
967
|
-
const
|
|
968
|
-
if (
|
|
969
|
-
if (
|
|
970
|
-
const
|
|
971
|
-
for (const [
|
|
972
|
-
|
|
964
|
+
async function Nt(t, e, s, l) {
|
|
965
|
+
const i = {};
|
|
966
|
+
for (const c of await Oe(t)) {
|
|
967
|
+
const d = e ? `${e}/${c.name}` : c.name;
|
|
968
|
+
if (c.kind === "directory") {
|
|
969
|
+
if (s.skipDirs.includes(c.name)) continue;
|
|
970
|
+
const u = c;
|
|
971
|
+
for (const [p, f] of Object.entries(await Nt(u, d, s, l)))
|
|
972
|
+
i[`${c.name}/${p}`] = f;
|
|
973
973
|
continue;
|
|
974
974
|
}
|
|
975
|
-
if (!
|
|
976
|
-
if (!
|
|
977
|
-
|
|
975
|
+
if (!s.platformFiles.includes(c.name)) {
|
|
976
|
+
if (!s.textExt.includes(ro(c.name))) {
|
|
977
|
+
l.failures.push({
|
|
978
978
|
kind: "file",
|
|
979
|
-
where:
|
|
980
|
-
message: `不是文本文件(认得的扩展名:${
|
|
979
|
+
where: d,
|
|
980
|
+
message: `不是文本文件(认得的扩展名:${s.textExt.join(" ")}),已跳过`
|
|
981
981
|
});
|
|
982
982
|
continue;
|
|
983
983
|
}
|
|
984
984
|
try {
|
|
985
|
-
const
|
|
986
|
-
if (
|
|
987
|
-
|
|
985
|
+
const u = await c.getFile();
|
|
986
|
+
if (u.size > s.maxFileBytes) {
|
|
987
|
+
l.failures.push({
|
|
988
988
|
kind: "file",
|
|
989
|
-
where:
|
|
990
|
-
message: `文件 ${Math.round(
|
|
989
|
+
where: d,
|
|
990
|
+
message: `文件 ${Math.round(u.size / 1024)} KB 超过上限 ${Math.floor(s.maxFileBytes / 1024)} KB,已跳过`
|
|
991
991
|
});
|
|
992
992
|
continue;
|
|
993
993
|
}
|
|
994
|
-
|
|
995
|
-
} catch (
|
|
996
|
-
|
|
994
|
+
i[c.name] = io(await u.text());
|
|
995
|
+
} catch (u) {
|
|
996
|
+
l.failures.push({ kind: "file", where: d, message: `读不了这个文件:${De(u)}` });
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
return
|
|
1000
|
+
return i;
|
|
1001
1001
|
}
|
|
1002
|
-
async function
|
|
1003
|
-
const
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
1002
|
+
async function It(t, e, s, l, i) {
|
|
1003
|
+
const c = await Oe(t), d = c.filter((p) => p.kind === "directory"), u = c.filter((p) => p.kind === "file");
|
|
1004
|
+
if (d.length === 0 || u.some((p) => p.name === l.entry)) {
|
|
1005
|
+
i.folders.push({ where: e.join("/"), files: await Nt(t, e.join("/"), l, i) });
|
|
1006
1006
|
return;
|
|
1007
1007
|
}
|
|
1008
|
-
for (const
|
|
1009
|
-
e.length === 0 &&
|
|
1008
|
+
for (const p of u)
|
|
1009
|
+
e.length === 0 && l.rootSkipFiles.includes(p.name.toLowerCase()) || i.failures.push({
|
|
1010
1010
|
kind: "file",
|
|
1011
|
-
where: [...e,
|
|
1012
|
-
message: `这一层直接放着一份文件,但它自己不是块文件夹、也没有 ${
|
|
1011
|
+
where: [...e, p.name].join("/"),
|
|
1012
|
+
message: `这一层直接放着一份文件,但它自己不是块文件夹、也没有 ${l.entry},文件没有归属`
|
|
1013
1013
|
});
|
|
1014
|
-
for (const
|
|
1015
|
-
if (!
|
|
1016
|
-
if (
|
|
1017
|
-
|
|
1014
|
+
for (const p of d)
|
|
1015
|
+
if (!l.skipDirs.includes(p.name)) {
|
|
1016
|
+
if (s >= l.maxDepth) {
|
|
1017
|
+
i.truncated = !0, i.failures.push({
|
|
1018
1018
|
kind: "dir",
|
|
1019
|
-
where: [...e,
|
|
1020
|
-
message: `超过最大层数 ${
|
|
1019
|
+
where: [...e, p.name].join("/"),
|
|
1020
|
+
message: `超过最大层数 ${l.maxDepth} 层还没见到 ${l.entry},没有继续往下找`
|
|
1021
1021
|
});
|
|
1022
1022
|
continue;
|
|
1023
1023
|
}
|
|
1024
|
-
await
|
|
1024
|
+
await It(p, [...e, p.name], s + 1, l, i);
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function vt(t) {
|
|
1028
1028
|
return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : `${Math.max(1, Math.round(t / 1024))} KB`;
|
|
1029
1029
|
}
|
|
1030
|
-
async function
|
|
1031
|
-
const
|
|
1032
|
-
await
|
|
1033
|
-
const
|
|
1034
|
-
(
|
|
1030
|
+
async function co(t, e) {
|
|
1031
|
+
const s = { root: t.name, folders: [], failures: [], truncated: !1 };
|
|
1032
|
+
await It(t.handle, [], 0, e, s);
|
|
1033
|
+
const l = s.folders.reduce(
|
|
1034
|
+
(i, c) => i + Object.values(c.files).reduce((d, u) => d + u.length, 0),
|
|
1035
1035
|
0
|
|
1036
1036
|
);
|
|
1037
|
-
if (
|
|
1037
|
+
if (l > e.maxBodyBytes)
|
|
1038
1038
|
throw new Error(
|
|
1039
|
-
`这个目录读到的正文有 ${
|
|
1039
|
+
`这个目录读到的正文有 ${vt(l)},超过一次读回的上限 ${vt(e.maxBodyBytes)}:请先只留要改的那几个块,或者把大文件挪走。`
|
|
1040
1040
|
);
|
|
1041
|
-
return
|
|
1041
|
+
return s;
|
|
1042
1042
|
}
|
|
1043
|
-
const
|
|
1043
|
+
const uo = {
|
|
1044
1044
|
key: 0,
|
|
1045
1045
|
class: "mbc"
|
|
1046
|
-
},
|
|
1046
|
+
}, po = { class: "mbc__head" }, fo = ["disabled"], mo = {
|
|
1047
1047
|
key: 0,
|
|
1048
1048
|
class: "mbc__error"
|
|
1049
|
-
},
|
|
1049
|
+
}, bo = {
|
|
1050
1050
|
key: 1,
|
|
1051
1051
|
class: "mbc__notice"
|
|
1052
|
-
},
|
|
1052
|
+
}, ho = { class: "mbc__panel" }, vo = { class: "mbc__field" }, go = ["value"], yo = { class: "mbc__field" }, _o = ["value"], ko = { class: "mbc__field" }, wo = ["value"], $o = { class: "mbc__actions" }, xo = ["disabled"], Eo = { class: "mbc__panel" }, So = { class: "mbc__title" }, Co = { class: "mbc__list" }, To = ["title", "onClick"], Bo = { class: "mbc__module" }, Oo = { class: "mbc__name" }, Mo = {
|
|
1053
1053
|
key: 0,
|
|
1054
1054
|
class: "mbc__where"
|
|
1055
|
-
},
|
|
1055
|
+
}, Ao = {
|
|
1056
1056
|
key: 0,
|
|
1057
1057
|
class: "mbc__detail"
|
|
1058
|
-
},
|
|
1058
|
+
}, Po = {
|
|
1059
1059
|
key: 0,
|
|
1060
1060
|
class: "mbc__hint"
|
|
1061
|
-
},
|
|
1061
|
+
}, Ro = { class: "mbc__meta" }, jo = { class: "mbc__mono" }, No = { class: "mbc__actions" }, Io = ["disabled", "onClick"], Do = ["disabled", "onClick"], Lo = ["disabled", "onClick"], Fo = ["disabled", "onClick"], zo = { class: "mbc__panel" }, Ho = { class: "mbc__field" }, Ko = { class: "mbc__radio" }, qo = ["checked"], Uo = { class: "mbc__radio" }, Jo = ["checked"], Vo = ["value", "disabled"], Go = {
|
|
1062
1062
|
key: 0,
|
|
1063
1063
|
value: ""
|
|
1064
|
-
},
|
|
1064
|
+
}, Yo = ["value"], Wo = { class: "mbc__field" }, Zo = ["value"], Xo = ["disabled"], Qo = ["disabled", "title"], es = { class: "mbc__hint" }, ts = {
|
|
1065
1065
|
key: 0,
|
|
1066
1066
|
class: "mbc__hint"
|
|
1067
|
-
},
|
|
1067
|
+
}, ns = ["aria-valuenow"], os = {
|
|
1068
1068
|
key: 3,
|
|
1069
1069
|
class: "mbc__confirm"
|
|
1070
|
-
},
|
|
1070
|
+
}, ss = { class: "mbc__confirm-title" }, as = { class: "mbc__confirm-body" }, ls = {
|
|
1071
1071
|
key: 0,
|
|
1072
1072
|
class: "mbc__mono"
|
|
1073
|
-
},
|
|
1073
|
+
}, is = { class: "mbc__actions" }, rs = ["disabled"], cs = ["disabled"], us = ["disabled"], ds = { class: "mbc__panel" }, ps = { class: "mbc__field" }, fs = ["value"], ms = ["disabled"], bs = ["disabled"], hs = {
|
|
1074
1074
|
key: 0,
|
|
1075
1075
|
class: "mbc__hint"
|
|
1076
|
-
},
|
|
1076
|
+
}, vs = {
|
|
1077
1077
|
key: 1,
|
|
1078
1078
|
class: "mbc__hint"
|
|
1079
|
-
},
|
|
1079
|
+
}, gs = {
|
|
1080
1080
|
key: 0,
|
|
1081
1081
|
class: "mbc__scan"
|
|
1082
|
-
},
|
|
1082
|
+
}, ys = { class: "mbc__pick" }, _s = ["disabled", "checked", "onChange"], ks = { class: "mbc__name" }, ws = { class: "mbc__module" }, $s = { class: "mbc__hint" }, xs = { class: "mbc__mono" }, Es = {
|
|
1083
1083
|
key: 0,
|
|
1084
1084
|
class: "mbc__problem"
|
|
1085
|
-
},
|
|
1085
|
+
}, Ss = { class: "mbc__hint mbc__mono" }, Cs = {
|
|
1086
1086
|
key: 1,
|
|
1087
1087
|
class: "mbc__hint"
|
|
1088
|
-
},
|
|
1088
|
+
}, Ts = {
|
|
1089
1089
|
key: 2,
|
|
1090
1090
|
class: "mbc__problem"
|
|
1091
|
-
},
|
|
1091
|
+
}, Bs = {
|
|
1092
1092
|
key: 3,
|
|
1093
1093
|
class: "mbc__failures"
|
|
1094
|
-
},
|
|
1094
|
+
}, Os = { class: "mbc__field mbc__field--end" }, Ms = ["disabled"], As = {
|
|
1095
1095
|
key: 2,
|
|
1096
1096
|
class: "mbc__panel"
|
|
1097
|
-
},
|
|
1097
|
+
}, Ps = { class: "mbc__title" }, Rs = {
|
|
1098
1098
|
key: 0,
|
|
1099
1099
|
class: "mbc__failures"
|
|
1100
|
-
},
|
|
1100
|
+
}, js = {
|
|
1101
1101
|
key: 1,
|
|
1102
1102
|
class: "mbc__failures"
|
|
1103
|
-
},
|
|
1103
|
+
}, Ns = { key: 0 }, Is = {
|
|
1104
1104
|
key: 1,
|
|
1105
1105
|
class: "mbc__failures mbc__failures--nested"
|
|
1106
|
-
},
|
|
1106
|
+
}, Ge = 2, Ds = /* @__PURE__ */ ot({
|
|
1107
1107
|
__name: "MagicBlockConsole",
|
|
1108
1108
|
setup(t) {
|
|
1109
|
-
const e = { modified: "有改动", unchanged: "没改动", missing: "目录里没有" }, { isStaff:
|
|
1110
|
-
function
|
|
1111
|
-
|
|
1109
|
+
const e = { modified: "有改动", unchanged: "没改动", missing: "目录里没有" }, { isStaff: s } = wt(), l = kt(), { active: i } = tn(), c = (a) => !$t(a, l), d = w(!1), u = w(""), p = w([]), f = w(""), x = w(""), g = w(""), k = w(!1), D = w(!1), j = w(!1), oe = w(!1), le = w(!1), M = w(null), C = w(null), L = w("one"), ie = w(Le()), J = R(() => p.value.find((a) => a.id === ie.value) ?? null), pe = () => L.value === "all" ? {} : { blocks: [ie.value] };
|
|
1110
|
+
function ke(a) {
|
|
1111
|
+
ie.value = a;
|
|
1112
1112
|
try {
|
|
1113
|
-
window.localStorage.setItem("mb:export-block",
|
|
1113
|
+
window.localStorage.setItem("mb:export-block", a);
|
|
1114
1114
|
} catch {
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function Le() {
|
|
1118
1118
|
try {
|
|
1119
1119
|
return window.localStorage.getItem("mb:export-block") ?? "";
|
|
1120
1120
|
} catch {
|
|
1121
1121
|
return "";
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1124
|
+
ye(p, (a) => {
|
|
1125
|
+
a.length !== 0 && (a.some((n) => n.id === ie.value) || ke(a[0].id));
|
|
1126
1126
|
});
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
|
|
1127
|
+
const V = w(null), F = w(""), A = w(null), fe = w({}), Q = w([]), re = w([]), we = w(!1), ee = w(""), z = w(""), se = w(""), H = w(null), ce = w("");
|
|
1128
|
+
function G(a, n) {
|
|
1129
|
+
return `${String(n || "").replace(/[\\/:*?"<>|]/g, "").trim() || "block"}-${a}`;
|
|
1130
|
+
}
|
|
1131
|
+
async function ae(a, n, o, m) {
|
|
1132
|
+
if (!nt()) throw new Error("这个浏览器没法直接写你本机的文件夹:请用 Chrome / Edge,并从 https 或 localhost 打开");
|
|
1133
|
+
const $ = M.value ?? await Ne();
|
|
1134
|
+
M.value = $, C.value || (C.value = $);
|
|
1135
|
+
const N = V.value ?? await Ke();
|
|
1136
|
+
ht($, N);
|
|
1137
|
+
const B = G(a || "new", n), Y = {};
|
|
1138
|
+
for (const [Se, P] of Object.entries(o)) Y[`${B}/${Se}`] = P;
|
|
1139
|
+
const ge = await bt($, N);
|
|
1140
|
+
_(10, `准备铺到「${$.name}/${B}」…`);
|
|
1141
|
+
const U = { target: $, data: { files: Y, blocks: 1, rules: N }, clean: !1 };
|
|
1142
|
+
if (ge.items.some((Se) => Se.name === B)) {
|
|
1143
|
+
O.value = { target: $, inventory: ge }, H.value = U, ce.value = m;
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
await ve(U.target, U.data, !1), F.value = `${m}:铺到「${$.name}/${B}」(${Object.keys(Y).length} 个文件)`, g.value = "铺好了:用你自己的编辑器改,改完回这里「读回改动」→ 保存", T(!0, "完成");
|
|
1147
|
+
}
|
|
1148
|
+
const Me = () => q(async () => {
|
|
1149
|
+
if (!ee.value.trim() || !z.value.trim() || !se.value.trim())
|
|
1150
|
+
throw new Error("module / name / brief 三个都要填(module 只许小写字母与数字:它同时是 Django 的 app label)");
|
|
1151
|
+
we.value = !0, E.value = { active: !0, percent: 0, stage: "建块…", failed: !1 };
|
|
1152
|
+
try {
|
|
1153
|
+
const a = await Ee("/magic-blocks/new", {
|
|
1154
|
+
module: ee.value.trim(),
|
|
1155
|
+
name: z.value.trim(),
|
|
1156
|
+
brief: se.value.trim()
|
|
1157
|
+
});
|
|
1158
|
+
ke(a.id), await he(), await ae(
|
|
1159
|
+
"",
|
|
1160
|
+
z.value.trim(),
|
|
1161
|
+
a.scaffold ?? a.files,
|
|
1162
|
+
`新建了「${ee.value.trim()} / ${z.value.trim()}」`
|
|
1163
|
+
), ee.value = "", z.value = "", se.value = "";
|
|
1164
|
+
} catch (a) {
|
|
1165
|
+
throw T(!1, "建块失败"), a;
|
|
1166
|
+
} finally {
|
|
1167
|
+
we.value = !1;
|
|
1168
|
+
}
|
|
1169
|
+
}, k), Fe = (a) => q(async () => {
|
|
1170
|
+
E.value = { active: !0, percent: 0, stage: "取库里那一版…", failed: !1 };
|
|
1171
|
+
try {
|
|
1172
|
+
const n = await Z(`/magic-blocks/${a.id}`);
|
|
1173
|
+
await ae(
|
|
1174
|
+
a.id,
|
|
1175
|
+
a.name || a.module,
|
|
1176
|
+
n.files ?? {},
|
|
1177
|
+
`初始化「${a.module} / ${a.name || a.id}」`
|
|
1178
|
+
);
|
|
1179
|
+
} catch (n) {
|
|
1180
|
+
throw T(!1, "初始化失败"), n;
|
|
1181
|
+
}
|
|
1182
|
+
}, k), O = w(null), E = w({ active: !1, percent: 0, stage: "", failed: !1 }), y = R(() => ({
|
|
1183
|
+
width: `${Math.max(0, Math.min(100, E.value.percent))}%`,
|
|
1184
|
+
background: E.value.failed ? "var(--sp-color-danger)" : "var(--sp-color-primary, var(--primary-color))"
|
|
1130
1185
|
}));
|
|
1131
|
-
function
|
|
1132
|
-
|
|
1186
|
+
function _(a, n) {
|
|
1187
|
+
E.value = { active: !0, percent: Math.max(E.value.percent, a), stage: n, failed: !1 };
|
|
1133
1188
|
try {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1189
|
+
const o = window.localStorage.getItem("mb:progress") ?? "[]", m = JSON.parse(o);
|
|
1190
|
+
m.push({ p: E.value.percent, s: n, t: Math.round(performance.now()) }), window.localStorage.setItem("mb:progress", JSON.stringify(m));
|
|
1136
1191
|
} catch {
|
|
1137
1192
|
}
|
|
1138
1193
|
}
|
|
1139
|
-
function
|
|
1140
|
-
|
|
1194
|
+
function T(a, n) {
|
|
1195
|
+
_(a ? 100 : E.value.percent, n), E.value = { active: !a, percent: a ? 100 : E.value.percent, stage: n, failed: !a };
|
|
1141
1196
|
}
|
|
1142
|
-
const
|
|
1143
|
-
function
|
|
1144
|
-
f.value = f.value ===
|
|
1145
|
-
const n =
|
|
1146
|
-
|
|
1147
|
-
const
|
|
1148
|
-
if (
|
|
1149
|
-
|
|
1197
|
+
const K = (a) => (a.disabledReason ?? "").trim(), me = (a) => (a.issues ?? []).map((n) => String(n?.message ?? "")).filter(Boolean), be = (a) => xn(a.id);
|
|
1198
|
+
function $e(a) {
|
|
1199
|
+
f.value = f.value === a.id ? "" : a.id;
|
|
1200
|
+
const n = i.value;
|
|
1201
|
+
jt(a.id);
|
|
1202
|
+
const o = a.name || a.id, m = be(a);
|
|
1203
|
+
if (m.length === 0) {
|
|
1204
|
+
g.value = `「${o}」这次会话里还没在哪条标签上露过面:先打开挂着它的那一页,再点一次`;
|
|
1150
1205
|
return;
|
|
1151
1206
|
}
|
|
1152
|
-
if (
|
|
1153
|
-
|
|
1207
|
+
if (m.includes(n)) {
|
|
1208
|
+
g.value = `「${o}」就在这一条标签上(${m.join(" / ")}):已经把它标红`;
|
|
1154
1209
|
return;
|
|
1155
1210
|
}
|
|
1156
|
-
const
|
|
1157
|
-
if (
|
|
1158
|
-
|
|
1211
|
+
const $ = En(a.id, n, c);
|
|
1212
|
+
if ($) {
|
|
1213
|
+
g.value = `「${o}」不在这一条标签上:正在切到 ${$} 那条标签`, We($);
|
|
1159
1214
|
return;
|
|
1160
1215
|
}
|
|
1161
|
-
|
|
1216
|
+
g.value = `「${o}」只挂在带参数的实例标签上(${m.join(" / ")}):不替你挑一单 —— 自己打开要看的那一页再点`;
|
|
1162
1217
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const n =
|
|
1165
|
-
return
|
|
1166
|
-
${
|
|
1218
|
+
function ze(a) {
|
|
1219
|
+
const n = be(a), o = n.length === 0 ? "点一下:这次会话里它还没在哪条标签上露过面" : `点一下:把「${a.name || a.id}」标红,并在需要时切到挂着它的标签(${n.join(" / ")})`, m = K(a);
|
|
1220
|
+
return m ? `${m}
|
|
1221
|
+
${o}` : o;
|
|
1167
1222
|
}
|
|
1168
|
-
const
|
|
1169
|
-
const
|
|
1170
|
-
return
|
|
1171
|
-
}),
|
|
1172
|
-
function
|
|
1173
|
-
const
|
|
1174
|
-
for (const
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
n.add(
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
path:
|
|
1181
|
-
title: typeof
|
|
1182
|
-
group: typeof
|
|
1223
|
+
const Ae = R(() => {
|
|
1224
|
+
const a = u.value.trim().toLowerCase();
|
|
1225
|
+
return a ? p.value.filter((n) => `${n.module} ${n.name} ${n.brief}`.toLowerCase().includes(a)) : p.value;
|
|
1226
|
+
}), He = R(() => (A.value?.blocks ?? []).filter((a) => a.canApply)), Pe = R(() => He.value.filter((a) => fe.value[a.id] === !0));
|
|
1227
|
+
function Dt() {
|
|
1228
|
+
const a = l?.getRoutes?.() ?? [], n = /* @__PURE__ */ new Set(), o = [];
|
|
1229
|
+
for (const m of a) {
|
|
1230
|
+
const $ = typeof m?.path == "string" ? m.path.trim() : "";
|
|
1231
|
+
if (!$ || n.has($) || $.includes(":") || $.includes("*") || m.redirect || !m.components?.default || m.meta?.tab === !1) continue;
|
|
1232
|
+
n.add($);
|
|
1233
|
+
const N = m.meta?.title ?? m.meta?.sub, B = m.meta?.group;
|
|
1234
|
+
o.push({
|
|
1235
|
+
path: $,
|
|
1236
|
+
title: typeof N == "string" && N.trim() ? N.trim() : $,
|
|
1237
|
+
group: typeof B == "string" ? B.trim() : ""
|
|
1183
1238
|
});
|
|
1184
1239
|
}
|
|
1185
|
-
return
|
|
1240
|
+
return o;
|
|
1186
1241
|
}
|
|
1187
|
-
function
|
|
1188
|
-
return (
|
|
1242
|
+
function xe(a) {
|
|
1243
|
+
return (a instanceof Error ? a.message.trim() : String(a)) || "请求没有到达后端(网络或登录态的问题),请重试";
|
|
1189
1244
|
}
|
|
1190
|
-
function
|
|
1191
|
-
const n =
|
|
1192
|
-
return Array.isArray(n) ? n.map((
|
|
1245
|
+
function Lt(a) {
|
|
1246
|
+
const n = a?.issues;
|
|
1247
|
+
return Array.isArray(n) ? n.map((o) => typeof o == "string" ? o : String(o?.message ?? "")).filter(Boolean) : [];
|
|
1193
1248
|
}
|
|
1194
|
-
async function
|
|
1195
|
-
const
|
|
1249
|
+
async function Ee(a, n) {
|
|
1250
|
+
const o = JSON.stringify(n);
|
|
1196
1251
|
try {
|
|
1197
|
-
return await
|
|
1198
|
-
} catch (
|
|
1199
|
-
const
|
|
1252
|
+
return await Z(a, { method: "POST", body: o });
|
|
1253
|
+
} catch (m) {
|
|
1254
|
+
const $ = xe(m), N = await fetch(`http://localhost:3000${a}`, {
|
|
1200
1255
|
method: "POST",
|
|
1201
1256
|
credentials: "include",
|
|
1202
|
-
headers: { "Content-Type": "application/json", ...
|
|
1203
|
-
body:
|
|
1204
|
-
}).then((
|
|
1205
|
-
throw
|
|
1206
|
-
- ${
|
|
1257
|
+
headers: { "Content-Type": "application/json", ...Ye("POST", !0) },
|
|
1258
|
+
body: o
|
|
1259
|
+
}).then((Y) => Y.json()).catch(() => null), B = Lt(N);
|
|
1260
|
+
throw B.length === 0 ? new Error($) : new Error(`${String(N?.message ?? $)}
|
|
1261
|
+
- ${B.join(`
|
|
1207
1262
|
- `)}`);
|
|
1208
1263
|
}
|
|
1209
1264
|
}
|
|
1210
|
-
async function
|
|
1265
|
+
async function he() {
|
|
1211
1266
|
try {
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1214
|
-
} catch (
|
|
1215
|
-
|
|
1267
|
+
const a = await Z("/magic-blocks/index");
|
|
1268
|
+
p.value = a.blocks ?? [];
|
|
1269
|
+
} catch (a) {
|
|
1270
|
+
x.value = xe(a);
|
|
1216
1271
|
}
|
|
1217
1272
|
}
|
|
1218
|
-
async function
|
|
1219
|
-
n.value = !0,
|
|
1273
|
+
async function q(a, n) {
|
|
1274
|
+
n.value = !0, x.value = "";
|
|
1220
1275
|
try {
|
|
1221
|
-
await
|
|
1222
|
-
} catch (
|
|
1223
|
-
|
|
1276
|
+
await a(), vn();
|
|
1277
|
+
} catch (o) {
|
|
1278
|
+
x.value = xe(o);
|
|
1224
1279
|
} finally {
|
|
1225
1280
|
n.value = !1;
|
|
1226
1281
|
}
|
|
1227
1282
|
}
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1283
|
+
const at = (a) => q(async () => {
|
|
1284
|
+
D.value = !0;
|
|
1230
1285
|
try {
|
|
1231
|
-
await
|
|
1286
|
+
await Z("/magic-blocks/check", { method: "POST", body: JSON.stringify(a ? { blocks: [a] } : {}) }), g.value = a ? "这一块重新体检完了" : "全部块重新体检完了", await he();
|
|
1232
1287
|
} finally {
|
|
1233
|
-
|
|
1288
|
+
D.value = !1;
|
|
1234
1289
|
}
|
|
1235
|
-
},
|
|
1236
|
-
const n = await
|
|
1237
|
-
|
|
1238
|
-
},
|
|
1239
|
-
async function
|
|
1240
|
-
if (
|
|
1241
|
-
const
|
|
1242
|
-
return
|
|
1290
|
+
}, k), lt = (a) => q(async () => {
|
|
1291
|
+
const n = await Ne();
|
|
1292
|
+
a === "export" ? (M.value = n, C.value || (C.value = n)) : (C.value = n, M.value || (M.value = n)), g.value = a === "export" ? `导出目录:${n.name}${C.value === n ? "(读回目录也填成它了)" : ""}` : `读回目录:${n.name}`;
|
|
1293
|
+
}, k);
|
|
1294
|
+
async function Ke() {
|
|
1295
|
+
if (V.value) return V.value;
|
|
1296
|
+
const a = await Z("/magic-blocks/rules");
|
|
1297
|
+
return V.value = a.rules, a.rules;
|
|
1243
1298
|
}
|
|
1244
|
-
const
|
|
1245
|
-
if (!
|
|
1246
|
-
if (
|
|
1299
|
+
const Ft = () => q(async () => {
|
|
1300
|
+
if (!nt()) throw new Error("这个浏览器没法直接写你本机的文件夹:请用 Chrome / Edge,并从 https 或 localhost 打开");
|
|
1301
|
+
if (L.value === "one" && !J.value)
|
|
1247
1302
|
throw new Error("还没挑块:上面选「仅这一个块」时要先在下拉里挑一个块(或者把范围改成「全部块」)");
|
|
1248
|
-
|
|
1303
|
+
j.value = !0, g.value = "", F.value = "", x.value = "", E.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
|
|
1249
1304
|
try {
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1252
|
-
const n = await
|
|
1253
|
-
|
|
1254
|
-
const
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1305
|
+
const a = M.value ?? await Ne();
|
|
1306
|
+
M.value = a, C.value || (C.value = a);
|
|
1307
|
+
const n = await Ee("/magic-blocks/export", pe());
|
|
1308
|
+
V.value = n.rules, ht(a, n.rules);
|
|
1309
|
+
const o = await bt(a, n.rules);
|
|
1310
|
+
if (o.topCount > 0) {
|
|
1311
|
+
_(5, "等你确认要不要先清空"), O.value = { target: a, inventory: o };
|
|
1257
1312
|
return;
|
|
1258
1313
|
}
|
|
1259
|
-
await
|
|
1260
|
-
} catch (
|
|
1261
|
-
throw
|
|
1314
|
+
await ve(a, n, !1);
|
|
1315
|
+
} catch (a) {
|
|
1316
|
+
throw T(!1, "导出失败"), a;
|
|
1262
1317
|
} finally {
|
|
1263
|
-
|
|
1318
|
+
j.value = !1;
|
|
1264
1319
|
}
|
|
1265
|
-
},
|
|
1266
|
-
async function
|
|
1320
|
+
}, k);
|
|
1321
|
+
async function ve(a, n, o) {
|
|
1267
1322
|
try {
|
|
1268
|
-
|
|
1269
|
-
const
|
|
1270
|
-
let
|
|
1271
|
-
await new Promise((
|
|
1272
|
-
setTimeout(
|
|
1323
|
+
_(20, "收主题与控件清单…");
|
|
1324
|
+
const m = { ...n.files };
|
|
1325
|
+
let $ = "";
|
|
1326
|
+
await new Promise((P) => {
|
|
1327
|
+
setTimeout(P, 0);
|
|
1273
1328
|
});
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1329
|
+
const N = eo(Dt());
|
|
1330
|
+
m[Ve] = N;
|
|
1276
1331
|
try {
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1279
|
-
} catch (
|
|
1280
|
-
|
|
1332
|
+
const P = Rt(), Ce = _n();
|
|
1333
|
+
m[ue] = P.css, m[Ie] = Ce, n.exampleDir && (m[`${n.exampleDir}/${Ve}`] = N, m[`${n.exampleDir}/${ue}`] = P.css, m[`${n.exampleDir}/${Ie}`] = Ce), $ = P.skipped.length > 0 ? `;⚠️ 有 ${P.skipped.length} 张样式表读不到规则(跨源):${P.skipped.join(" / ")}` : "";
|
|
1334
|
+
} catch (P) {
|
|
1335
|
+
$ = `;主题 CSS 没收成(${xe(P)}):${ue} 没写,其余照旧`;
|
|
1281
1336
|
}
|
|
1282
|
-
let
|
|
1283
|
-
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1337
|
+
let B = "";
|
|
1338
|
+
o && (_(35, "清空目录…"), B = `,先清掉了 ${await lo(a)} 项`);
|
|
1339
|
+
const Y = Object.keys(m).length, ge = o ? 45 : 30;
|
|
1340
|
+
_(ge, `写文件 0/${Y}…`);
|
|
1341
|
+
const U = await ao(a, m, (P, Ce) => {
|
|
1342
|
+
_(ge + Math.round(P / Math.max(1, Ce) * (95 - ge)), `写文件 ${P}/${Ce}…`);
|
|
1288
1343
|
});
|
|
1289
|
-
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
} catch (
|
|
1293
|
-
throw
|
|
1344
|
+
_(98, "收尾…");
|
|
1345
|
+
const Se = U.failed.length > 0 ? `;⚠️ ${U.failed.length} 个文件没写成:${U.failed.slice(0, 3).map((P) => `${P.path}(${P.message})`).join("、")}` + (U.failed.length > 3 ? ` 等 ${U.failed.length} 条` : "") : "";
|
|
1346
|
+
F.value = `铺到「${a.name}」:${n.blocks} 个块、${U.written} 个文件(含 ${Ve} / ${ue} / ${Ie})${B}${Se}${$}`, g.value = U.failed.length > 0 ? "导出完了,但有文件没写成(见下面那句)" : "导出完了:用你自己的编辑器改,改完回这里「读回改动」", T(!0, "完成");
|
|
1347
|
+
} catch (m) {
|
|
1348
|
+
throw T(!1, "导出中途失败(已经铺进去的文件不会自己删掉)"), m;
|
|
1294
1349
|
}
|
|
1295
1350
|
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1351
|
+
R(() => H.value !== null);
|
|
1352
|
+
const zt = () => q(async () => {
|
|
1353
|
+
const a = H.value;
|
|
1354
|
+
if (a) {
|
|
1355
|
+
O.value = null, H.value = null, await ve(a.target, a.data, !0), F.value = `${ce.value}:清了并铺到「${a.target.name}」(${Object.keys(a.data.files).length} 个文件)`, g.value = "铺好了:用你自己的编辑器改,改完回这里「读回改动」→ 保存";
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
const n = O.value;
|
|
1359
|
+
if (O.value = null, !!n) {
|
|
1360
|
+
j.value = !0;
|
|
1300
1361
|
try {
|
|
1301
|
-
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
} catch (
|
|
1305
|
-
throw
|
|
1362
|
+
_(15, "重新取一份开发包…");
|
|
1363
|
+
const o = await Ee("/magic-blocks/export", pe());
|
|
1364
|
+
V.value = o.rules, await ve(n.target, o, !0);
|
|
1365
|
+
} catch (o) {
|
|
1366
|
+
throw T(!1, "导出失败"), o;
|
|
1306
1367
|
} finally {
|
|
1307
|
-
|
|
1368
|
+
j.value = !1;
|
|
1308
1369
|
}
|
|
1309
1370
|
}
|
|
1310
|
-
},
|
|
1311
|
-
const
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1371
|
+
}, k), Ht = () => q(async () => {
|
|
1372
|
+
const a = H.value;
|
|
1373
|
+
if (a) {
|
|
1374
|
+
O.value = null, H.value = null, await ve(a.target, a.data, !1), F.value = `${ce.value}:只覆盖写到「${a.target.name}」(${Object.keys(a.data.files).length} 个文件)`, g.value = "铺好了:用你自己的编辑器改,改完回这里「读回改动」→ 保存";
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const n = O.value;
|
|
1378
|
+
if (O.value = null, !!n) {
|
|
1379
|
+
j.value = !0;
|
|
1314
1380
|
try {
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1318
|
-
} catch (
|
|
1319
|
-
throw
|
|
1381
|
+
_(15, "重新取一份开发包…");
|
|
1382
|
+
const o = await Ee("/magic-blocks/export", pe());
|
|
1383
|
+
V.value = o.rules, await ve(n.target, o, !1);
|
|
1384
|
+
} catch (o) {
|
|
1385
|
+
throw T(!1, "导出失败"), o;
|
|
1320
1386
|
} finally {
|
|
1321
|
-
|
|
1387
|
+
j.value = !1;
|
|
1322
1388
|
}
|
|
1323
1389
|
}
|
|
1324
|
-
},
|
|
1325
|
-
function
|
|
1326
|
-
|
|
1390
|
+
}, k);
|
|
1391
|
+
function Kt() {
|
|
1392
|
+
const a = H.value !== null;
|
|
1393
|
+
O.value = null, H.value = null, ce.value = "", E.value = { active: !1, percent: 0, stage: "", failed: !1 }, g.value = a ? "这次没有铺(本地一个字节都没动)" : "这次没有导出(目录里的东西一个字节都没动)", F.value = "";
|
|
1327
1394
|
}
|
|
1328
|
-
const
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1395
|
+
const it = () => q(async () => {
|
|
1396
|
+
const a = C.value ?? await Ne();
|
|
1397
|
+
C.value = a, M.value || (M.value = a), oe.value = !0, g.value = "", Q.value = [], re.value = [];
|
|
1331
1398
|
try {
|
|
1332
|
-
const n = await
|
|
1333
|
-
throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${
|
|
1334
|
-
}),
|
|
1399
|
+
const n = await Ke().catch((B) => {
|
|
1400
|
+
throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${xe(B)}`);
|
|
1401
|
+
}), o = await co(a, n), m = await Z("/magic-blocks/read", {
|
|
1335
1402
|
method: "POST",
|
|
1336
|
-
body: JSON.stringify({ ...
|
|
1403
|
+
body: JSON.stringify({ ...o, includeMissing: !1 })
|
|
1337
1404
|
});
|
|
1338
|
-
|
|
1339
|
-
const
|
|
1340
|
-
for (const
|
|
1341
|
-
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1405
|
+
A.value = m;
|
|
1406
|
+
const $ = {};
|
|
1407
|
+
for (const B of m.blocks ?? []) $[B.id] = B.status === "modified" && B.canApply;
|
|
1408
|
+
fe.value = $;
|
|
1409
|
+
const N = (m.blocks ?? []).reduce((B, Y) => ({ ...B, [Y.status]: (B[Y.status] ?? 0) + 1 }), {});
|
|
1410
|
+
g.value = `扫到 ${m.folders} 个文件夹、${m.files} 个文件:有改动 ${N.modified ?? 0} / 没改动 ${N.unchanged ?? 0}` + (m.complete ? "" : "(层数到了上限,没走完,可能还有块没扫到)");
|
|
1344
1411
|
} finally {
|
|
1345
|
-
|
|
1412
|
+
oe.value = !1;
|
|
1346
1413
|
}
|
|
1347
|
-
},
|
|
1348
|
-
const
|
|
1349
|
-
if (
|
|
1350
|
-
throw
|
|
1414
|
+
}, k), qt = () => q(async () => {
|
|
1415
|
+
const a = Pe.value, n = Zn(a);
|
|
1416
|
+
if (Q.value = n.issues, re.value = [], n.issues.length > 0)
|
|
1417
|
+
throw g.value = "", new Error(`前端校验没过(${n.issues.length} 条),没有发请求:
|
|
1351
1418
|
- ${n.issues.join(`
|
|
1352
1419
|
- `)}`);
|
|
1353
|
-
|
|
1420
|
+
le.value = !0, g.value = "";
|
|
1354
1421
|
try {
|
|
1355
|
-
const
|
|
1356
|
-
|
|
1357
|
-
const
|
|
1358
|
-
await
|
|
1422
|
+
const o = await Ee("/magic-blocks/import", { updatedBy: "", blocks: a });
|
|
1423
|
+
re.value = o.results ?? [], g.value = `保存:成功 ${o.saved} 个、失败 ${o.failed} 个`, await he();
|
|
1424
|
+
const m = g.value;
|
|
1425
|
+
await it(), g.value = `${m};已重新读回该目录`;
|
|
1359
1426
|
} finally {
|
|
1360
|
-
|
|
1427
|
+
le.value = !1;
|
|
1361
1428
|
}
|
|
1362
|
-
},
|
|
1363
|
-
await
|
|
1364
|
-
},
|
|
1365
|
-
window.confirm(`删掉「${
|
|
1366
|
-
},
|
|
1367
|
-
function
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1429
|
+
}, k), Ut = (a) => q(async () => {
|
|
1430
|
+
await Z(`/magic-blocks/${encodeURIComponent(a.id)}/rollback`, { method: "POST" }), g.value = `「${a.name || a.id}」已回滚到上一版`, await he();
|
|
1431
|
+
}, k), Jt = (a) => q(async () => {
|
|
1432
|
+
window.confirm(`删掉「${a.name || a.id}」?库里这一行(连同它的文件包)会一起没。`) && (await Z(`/magic-blocks/${encodeURIComponent(a.id)}`, { method: "DELETE" }), g.value = `「${a.name || a.id}」已删除`, await he());
|
|
1433
|
+
}, k);
|
|
1434
|
+
function Vt(a, n) {
|
|
1435
|
+
const o = n.target;
|
|
1436
|
+
fe.value[a] = o?.checked === !0;
|
|
1370
1437
|
}
|
|
1371
|
-
function
|
|
1372
|
-
const n =
|
|
1373
|
-
|
|
1438
|
+
function rt(a) {
|
|
1439
|
+
const n = a.detail?.uuid ?? "";
|
|
1440
|
+
d.value = !0, f.value = n;
|
|
1374
1441
|
}
|
|
1375
|
-
return
|
|
1376
|
-
window.addEventListener("magic-block:open-console",
|
|
1442
|
+
return gt(() => {
|
|
1443
|
+
window.addEventListener("magic-block:open-console", rt), he(), Ke().catch(() => {
|
|
1377
1444
|
});
|
|
1378
|
-
}),
|
|
1379
|
-
|
|
1445
|
+
}), yt(() => window.removeEventListener("magic-block:open-console", rt)), (a, n) => Te(s) ? (b(), h(I, { key: 0 }, [
|
|
1446
|
+
r("button", {
|
|
1380
1447
|
class: "fab",
|
|
1381
1448
|
type: "button",
|
|
1382
1449
|
title: "magic block 控制台",
|
|
1383
|
-
onClick: n[0] || (n[0] = (
|
|
1450
|
+
onClick: n[0] || (n[0] = (o) => d.value = !0)
|
|
1384
1451
|
}, "块"),
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
n[
|
|
1388
|
-
|
|
1389
|
-
"onUpdate:modelValue": n[1] || (n[1] = (
|
|
1452
|
+
d.value ? (b(), h("aside", uo, [
|
|
1453
|
+
r("header", po, [
|
|
1454
|
+
n[19] || (n[19] = r("strong", null, "magic block", -1)),
|
|
1455
|
+
Wt(r("input", {
|
|
1456
|
+
"onUpdate:modelValue": n[1] || (n[1] = (o) => u.value = o),
|
|
1390
1457
|
class: "p-inputtext p-component mbc__grow",
|
|
1391
1458
|
type: "search",
|
|
1392
1459
|
placeholder: "筛选 module / 名字"
|
|
1393
1460
|
}, null, 512), [
|
|
1394
|
-
[
|
|
1461
|
+
[Zt, u.value]
|
|
1395
1462
|
]),
|
|
1396
|
-
|
|
1463
|
+
r("button", {
|
|
1397
1464
|
class: "p-button p-button-sm",
|
|
1398
1465
|
type: "button",
|
|
1399
|
-
disabled:
|
|
1400
|
-
onClick: n[2] || (n[2] = (
|
|
1401
|
-
},
|
|
1402
|
-
|
|
1466
|
+
disabled: k.value,
|
|
1467
|
+
onClick: n[2] || (n[2] = (o) => at())
|
|
1468
|
+
}, v(D.value ? "体检中…" : "重新体检全部"), 9, fo),
|
|
1469
|
+
r("button", {
|
|
1403
1470
|
class: "p-button p-button-sm p-button-text",
|
|
1404
1471
|
type: "button",
|
|
1405
|
-
onClick: n[3] || (n[3] = (
|
|
1472
|
+
onClick: n[3] || (n[3] = (o) => d.value = !1)
|
|
1406
1473
|
}, "关闭")
|
|
1407
1474
|
]),
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1475
|
+
x.value ? (b(), h("p", mo, v(x.value), 1)) : S("", !0),
|
|
1476
|
+
g.value ? (b(), h("p", bo, v(g.value), 1)) : S("", !0),
|
|
1477
|
+
r("section", ho, [
|
|
1478
|
+
n[24] || (n[24] = r("h3", { class: "mbc__title" }, "新建块(初始化)", -1)),
|
|
1479
|
+
r("div", vo, [
|
|
1480
|
+
n[20] || (n[20] = r("span", { class: "mbc__label" }, "module", -1)),
|
|
1481
|
+
r("input", {
|
|
1482
|
+
class: "p-inputtext p-component mbc__grow",
|
|
1483
|
+
value: ee.value,
|
|
1484
|
+
placeholder: "小写字母与数字,例如 home",
|
|
1485
|
+
onInput: n[4] || (n[4] = (o) => ee.value = o.target.value)
|
|
1486
|
+
}, null, 40, go)
|
|
1487
|
+
]),
|
|
1488
|
+
r("div", yo, [
|
|
1489
|
+
n[21] || (n[21] = r("span", { class: "mbc__label" }, "name", -1)),
|
|
1490
|
+
r("input", {
|
|
1491
|
+
class: "p-inputtext p-component mbc__grow",
|
|
1492
|
+
value: z.value,
|
|
1493
|
+
placeholder: "不超过 40 个字(可以是中文)",
|
|
1494
|
+
onInput: n[5] || (n[5] = (o) => z.value = o.target.value)
|
|
1495
|
+
}, null, 40, _o)
|
|
1496
|
+
]),
|
|
1497
|
+
r("div", ko, [
|
|
1498
|
+
n[22] || (n[22] = r("span", { class: "mbc__label" }, "brief", -1)),
|
|
1499
|
+
r("input", {
|
|
1500
|
+
class: "p-inputtext p-component mbc__grow",
|
|
1501
|
+
value: se.value,
|
|
1502
|
+
placeholder: "一句话说明这个块解决什么问题",
|
|
1503
|
+
onInput: n[6] || (n[6] = (o) => se.value = o.target.value)
|
|
1504
|
+
}, null, 40, wo)
|
|
1505
|
+
]),
|
|
1506
|
+
r("div", $o, [
|
|
1507
|
+
r("button", {
|
|
1508
|
+
class: "p-button p-button-sm",
|
|
1509
|
+
type: "button",
|
|
1510
|
+
disabled: k.value || !ee.value.trim() || !z.value.trim() || !se.value.trim(),
|
|
1511
|
+
onClick: n[7] || (n[7] = (o) => Me())
|
|
1512
|
+
}, v(we.value ? "建中…" : "新建并铺到开发目录"), 9, xo),
|
|
1513
|
+
n[23] || (n[23] = r("span", { class: "mbc__hint" }, "建完**当场就是库里的块**(页面上挂得上),骨架铺进你选的文件夹:入口 / 清单 / 后端 / README。", -1))
|
|
1514
|
+
]),
|
|
1515
|
+
n[25] || (n[25] = r("p", { class: "mbc__hint" }, '要给**已有的块**"回到初始"(丢弃本地改动):在下面那一行点「初始化」。', -1))
|
|
1516
|
+
]),
|
|
1517
|
+
r("section", Eo, [
|
|
1518
|
+
r("h3", So, "库里的块(" + v(Ae.value.length) + " / " + v(p.value.length) + ")", 1),
|
|
1519
|
+
r("ul", Co, [
|
|
1520
|
+
(b(!0), h(I, null, te(Ae.value, (o) => (b(), h("li", {
|
|
1521
|
+
key: o.id
|
|
1415
1522
|
}, [
|
|
1416
|
-
|
|
1523
|
+
r("button", {
|
|
1417
1524
|
type: "button",
|
|
1418
|
-
class:
|
|
1419
|
-
title:
|
|
1420
|
-
onClick: (
|
|
1525
|
+
class: ne(["mbc__row", { "is-active": o.id === f.value }]),
|
|
1526
|
+
title: ze(o),
|
|
1527
|
+
onClick: (m) => $e(o)
|
|
1421
1528
|
}, [
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
class:
|
|
1427
|
-
},
|
|
1428
|
-
], 10,
|
|
1429
|
-
f.value ===
|
|
1430
|
-
(
|
|
1431
|
-
key:
|
|
1529
|
+
r("span", Bo, v(o.module || "unassigned"), 1),
|
|
1530
|
+
r("span", Oo, v(o.name || o.id), 1),
|
|
1531
|
+
be(o).length > 0 ? (b(), h("span", Mo, v(be(o).join(" / ")), 1)) : S("", !0),
|
|
1532
|
+
r("em", {
|
|
1533
|
+
class: ne({ "is-off": o.enabled === !1 })
|
|
1534
|
+
}, v(o.enabled === !1 ? K(o) || "校验失败已停用" : "可用"), 3)
|
|
1535
|
+
], 10, To),
|
|
1536
|
+
f.value === o.id ? (b(), h("div", Ao, [
|
|
1537
|
+
(b(!0), h(I, null, te(me(o).slice(0, Ge), (m, $) => (b(), h("p", {
|
|
1538
|
+
key: $,
|
|
1432
1539
|
class: "mbc__problem"
|
|
1433
|
-
},
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
n[
|
|
1437
|
-
|
|
1438
|
-
n[
|
|
1439
|
-
|
|
1440
|
-
n[
|
|
1441
|
-
|
|
1442
|
-
n[
|
|
1443
|
-
|
|
1540
|
+
}, v(m), 1))), 128)),
|
|
1541
|
+
me(o).length > Ge ? (b(), h("p", Po, "还有 " + v(me(o).length - Ge) + " 条体检问题,点「体检这一块」看最新结论", 1)) : S("", !0),
|
|
1542
|
+
r("dl", Ro, [
|
|
1543
|
+
n[26] || (n[26] = r("dt", null, "文件", -1)),
|
|
1544
|
+
r("dd", null, v((o.fileNames || []).join(" / ") || "(没有文件)"), 1),
|
|
1545
|
+
n[27] || (n[27] = r("dt", null, "更新", -1)),
|
|
1546
|
+
r("dd", null, v(o.updatedAt || "—"), 1),
|
|
1547
|
+
n[28] || (n[28] = r("dt", null, "上一版", -1)),
|
|
1548
|
+
r("dd", null, v(o.hasPrev ? o.prevUpdatedAt || "有" : "没有"), 1),
|
|
1549
|
+
n[29] || (n[29] = r("dt", null, "id", -1)),
|
|
1550
|
+
r("dd", jo, v(o.id), 1)
|
|
1444
1551
|
]),
|
|
1445
|
-
|
|
1446
|
-
|
|
1552
|
+
r("div", No, [
|
|
1553
|
+
r("button", {
|
|
1554
|
+
class: "p-button p-button-sm p-button-outlined",
|
|
1555
|
+
type: "button",
|
|
1556
|
+
disabled: k.value,
|
|
1557
|
+
onClick: (m) => at(o.id)
|
|
1558
|
+
}, "体检这一块", 8, Io),
|
|
1559
|
+
r("button", {
|
|
1447
1560
|
class: "p-button p-button-sm p-button-outlined",
|
|
1448
1561
|
type: "button",
|
|
1449
|
-
disabled:
|
|
1450
|
-
onClick: (
|
|
1451
|
-
|
|
1452
|
-
|
|
1562
|
+
disabled: k.value,
|
|
1563
|
+
onClick: (m) => Fe(o),
|
|
1564
|
+
title: "把它库里那一版铺回开发目录:本地改动会被覆盖(不是重置成空白骨架)"
|
|
1565
|
+
}, "初始化", 8, Do),
|
|
1566
|
+
r("button", {
|
|
1453
1567
|
class: "p-button p-button-sm p-button-outlined",
|
|
1454
1568
|
type: "button",
|
|
1455
|
-
disabled:
|
|
1456
|
-
onClick: (
|
|
1457
|
-
}, "回滚上一版", 8,
|
|
1458
|
-
|
|
1569
|
+
disabled: k.value || !o.hasPrev,
|
|
1570
|
+
onClick: (m) => Ut(o)
|
|
1571
|
+
}, "回滚上一版", 8, Lo),
|
|
1572
|
+
r("button", {
|
|
1459
1573
|
class: "p-button p-button-sm p-button-text",
|
|
1460
1574
|
type: "button",
|
|
1461
|
-
disabled:
|
|
1462
|
-
onClick: (
|
|
1463
|
-
}, "删除", 8,
|
|
1575
|
+
disabled: k.value,
|
|
1576
|
+
onClick: (m) => Jt(o)
|
|
1577
|
+
}, "删除", 8, Fo)
|
|
1464
1578
|
])
|
|
1465
|
-
])) :
|
|
1579
|
+
])) : S("", !0)
|
|
1466
1580
|
]))), 128))
|
|
1467
1581
|
])
|
|
1468
1582
|
]),
|
|
1469
|
-
|
|
1470
|
-
n[
|
|
1471
|
-
|
|
1472
|
-
n[
|
|
1473
|
-
|
|
1474
|
-
|
|
1583
|
+
r("section", zo, [
|
|
1584
|
+
n[40] || (n[40] = r("h3", { class: "mbc__title" }, "导出去改(用你自己的编辑器)", -1)),
|
|
1585
|
+
r("div", Ho, [
|
|
1586
|
+
n[31] || (n[31] = r("span", { class: "mbc__label" }, "导出范围", -1)),
|
|
1587
|
+
r("label", Ko, [
|
|
1588
|
+
r("input", {
|
|
1475
1589
|
type: "radio",
|
|
1476
1590
|
name: "mbc-scope",
|
|
1477
1591
|
value: "one",
|
|
1478
|
-
checked:
|
|
1479
|
-
onChange: n[
|
|
1480
|
-
}, null, 40,
|
|
1481
|
-
n[
|
|
1592
|
+
checked: L.value === "one",
|
|
1593
|
+
onChange: n[8] || (n[8] = (o) => L.value = "one")
|
|
1594
|
+
}, null, 40, qo),
|
|
1595
|
+
n[30] || (n[30] = W(" 仅这一个块 ", -1))
|
|
1482
1596
|
]),
|
|
1483
|
-
|
|
1484
|
-
|
|
1597
|
+
r("label", Uo, [
|
|
1598
|
+
r("input", {
|
|
1485
1599
|
type: "radio",
|
|
1486
1600
|
name: "mbc-scope",
|
|
1487
1601
|
value: "all",
|
|
1488
|
-
checked:
|
|
1489
|
-
onChange: n[
|
|
1490
|
-
}, null, 40,
|
|
1491
|
-
|
|
1602
|
+
checked: L.value === "all",
|
|
1603
|
+
onChange: n[9] || (n[9] = (o) => L.value = "all")
|
|
1604
|
+
}, null, 40, Jo),
|
|
1605
|
+
W(" 全部块(" + v(p.value.length) + " 个) ", 1)
|
|
1492
1606
|
]),
|
|
1493
|
-
|
|
1607
|
+
L.value === "one" ? (b(), h("select", {
|
|
1494
1608
|
key: 0,
|
|
1495
1609
|
class: "p-inputtext p-component mbc__grow",
|
|
1496
|
-
value:
|
|
1497
|
-
disabled:
|
|
1498
|
-
onChange: n[
|
|
1610
|
+
value: ie.value,
|
|
1611
|
+
disabled: k.value || p.value.length === 0,
|
|
1612
|
+
onChange: n[10] || (n[10] = (o) => ke(o.target.value))
|
|
1499
1613
|
}, [
|
|
1500
|
-
|
|
1501
|
-
(
|
|
1502
|
-
key:
|
|
1503
|
-
value:
|
|
1504
|
-
},
|
|
1505
|
-
], 40,
|
|
1614
|
+
p.value.length === 0 ? (b(), h("option", Go, "(库里还没有块)")) : S("", !0),
|
|
1615
|
+
(b(!0), h(I, null, te(p.value, (o) => (b(), h("option", {
|
|
1616
|
+
key: o.id,
|
|
1617
|
+
value: o.id
|
|
1618
|
+
}, v(o.module) + " / " + v(o.name || o.id), 9, Yo))), 128))
|
|
1619
|
+
], 40, Vo)) : S("", !0)
|
|
1506
1620
|
]),
|
|
1507
|
-
|
|
1508
|
-
n[
|
|
1509
|
-
|
|
1621
|
+
r("div", Wo, [
|
|
1622
|
+
n[32] || (n[32] = r("label", { for: "mbc-dir" }, "导出目录", -1)),
|
|
1623
|
+
r("input", {
|
|
1510
1624
|
id: "mbc-dir",
|
|
1511
1625
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
1512
1626
|
type: "text",
|
|
1513
1627
|
readonly: "",
|
|
1514
|
-
value:
|
|
1515
|
-
}, null, 8,
|
|
1516
|
-
|
|
1628
|
+
value: M.value ? M.value.name : "(还没选:点右边那个按钮选一个文件夹)"
|
|
1629
|
+
}, null, 8, Zo),
|
|
1630
|
+
r("button", {
|
|
1517
1631
|
class: "p-button p-button-sm p-button-outlined",
|
|
1518
1632
|
type: "button",
|
|
1519
|
-
disabled:
|
|
1520
|
-
onClick: n[
|
|
1521
|
-
}, "选择文件夹", 8,
|
|
1522
|
-
|
|
1633
|
+
disabled: k.value,
|
|
1634
|
+
onClick: n[11] || (n[11] = (o) => lt("export"))
|
|
1635
|
+
}, "选择文件夹", 8, Xo),
|
|
1636
|
+
r("button", {
|
|
1523
1637
|
class: "p-button p-button-sm",
|
|
1524
1638
|
type: "button",
|
|
1525
|
-
disabled:
|
|
1526
|
-
title:
|
|
1527
|
-
onClick: n[
|
|
1528
|
-
},
|
|
1639
|
+
disabled: k.value || L.value === "one" && !J.value,
|
|
1640
|
+
title: L.value === "one" && !J.value ? "先在左边挑一个块(或者把范围改成「全部块」)" : "",
|
|
1641
|
+
onClick: n[12] || (n[12] = (o) => Ft())
|
|
1642
|
+
}, v(j.value ? "导出中…" : "导出"), 9, Qo)
|
|
1529
1643
|
]),
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
n[
|
|
1533
|
-
n[
|
|
1644
|
+
r("p", es, [
|
|
1645
|
+
W(v(L.value === "all" ? `这一趟会铺全部 ${p.value.length} 个块` : J.value ? `这一趟只铺「${J.value.module} / ${J.value.name || J.value.id}」这一个块` : "先挑一个块") + "; ", 1),
|
|
1646
|
+
n[33] || (n[33] = r("span", { class: "mbc__mono" }, "workspace/<可读名>-<块 uuid>/", -1)),
|
|
1647
|
+
n[34] || (n[34] = W(" 只在选中块的包里出现。 ", -1))
|
|
1534
1648
|
]),
|
|
1535
|
-
n[
|
|
1536
|
-
|
|
1537
|
-
|
|
1649
|
+
n[41] || (n[41] = Xt('<p class="mbc__hint" data-v-3986834e> 代码会铺在 <span class="mbc__mono" data-v-3986834e>workspace/<可读名>-<块 uuid>/</span>, 顶层另附 <span class="mbc__mono" data-v-3986834e>GUIDE.lock.md</span>(怎么改)、<span class="mbc__mono" data-v-3986834e>pages.lock.ts</span>(Page 枚举)、 <span class="mbc__mono" data-v-3986834e>backend.lock.pyi</span>(能用的库 / ctx / 环境变量 / 模型)、 <span class="mbc__mono" data-v-3986834e>labull.css</span> 与 <span class="mbc__mono" data-v-3986834e>CONTROLS.lock.html</span>(主题与控件清单)—— 那几份都是**生成物**。 另外还有一份 <span class="mbc__mono" data-v-3986834e>example/</span>(身份证 OCR 的完整例子):它**与这个顶层同构**, 顶层那几份生成物在里面各有一份同名副本,改名 / 搬走之后参考清单还跟着走。 </p>', 1)),
|
|
1650
|
+
F.value ? (b(), h("p", ts, v(F.value), 1)) : S("", !0),
|
|
1651
|
+
E.value.active ? (b(), h("div", {
|
|
1538
1652
|
key: 1,
|
|
1539
|
-
class:
|
|
1653
|
+
class: ne(["mbc__progress", { "is-failed": E.value.failed }]),
|
|
1540
1654
|
role: "progressbar",
|
|
1541
|
-
"aria-valuenow":
|
|
1655
|
+
"aria-valuenow": E.value.percent,
|
|
1542
1656
|
"aria-valuemin": "0",
|
|
1543
1657
|
"aria-valuemax": "100"
|
|
1544
1658
|
}, [
|
|
1545
|
-
|
|
1659
|
+
r("div", {
|
|
1546
1660
|
class: "mbc__progress-bar",
|
|
1547
|
-
style:
|
|
1661
|
+
style: _t(y.value)
|
|
1548
1662
|
}, null, 4)
|
|
1549
|
-
], 10,
|
|
1550
|
-
|
|
1663
|
+
], 10, ns)) : S("", !0),
|
|
1664
|
+
E.value.active ? (b(), h("p", {
|
|
1551
1665
|
key: 2,
|
|
1552
|
-
class:
|
|
1553
|
-
},
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
n[
|
|
1558
|
-
n[
|
|
1559
|
-
n[
|
|
1560
|
-
n[
|
|
1561
|
-
n[
|
|
1562
|
-
|
|
1666
|
+
class: ne(["mbc__hint", { "mbc__progress-note": E.value.failed }])
|
|
1667
|
+
}, v(E.value.failed ? "✗" : "") + " " + v(E.value.percent) + "% · " + v(E.value.stage), 3)) : S("", !0),
|
|
1668
|
+
O.value ? (b(), h("div", os, [
|
|
1669
|
+
r("p", ss, "「" + v(O.value.target.name) + "」里现在有 " + v(O.value.inventory.dirs) + " 个文件夹 / " + v(O.value.inventory.files) + " 个文件", 1),
|
|
1670
|
+
r("p", as, [
|
|
1671
|
+
n[35] || (n[35] = W(" 接下来会", -1)),
|
|
1672
|
+
n[36] || (n[36] = r("b", null, "先全部删掉", -1)),
|
|
1673
|
+
n[37] || (n[37] = W("再铺一遍 —— 包括你改过、还没读回库的东西。 清空只动这个目录", -1)),
|
|
1674
|
+
n[38] || (n[38] = r("b", null, "里面", -1)),
|
|
1675
|
+
n[39] || (n[39] = W("的子项:目录本身、以及它外面的任何东西都不会被碰。 ", -1)),
|
|
1676
|
+
O.value.inventory.items.length > 0 ? (b(), h("span", ls, "(" + v(O.value.inventory.items.slice(0, 6).map((o) => o.name).join(" / ")) + v(O.value.inventory.items.length > 6 ? " …" : "") + ")", 1)) : S("", !0)
|
|
1563
1677
|
]),
|
|
1564
|
-
|
|
1565
|
-
|
|
1678
|
+
r("div", is, [
|
|
1679
|
+
r("button", {
|
|
1566
1680
|
class: "p-button p-button-sm",
|
|
1567
1681
|
type: "button",
|
|
1568
|
-
disabled:
|
|
1569
|
-
onClick: n[
|
|
1570
|
-
}, "清空并导出", 8,
|
|
1571
|
-
|
|
1682
|
+
disabled: k.value,
|
|
1683
|
+
onClick: n[13] || (n[13] = (o) => zt())
|
|
1684
|
+
}, "清空并导出", 8, rs),
|
|
1685
|
+
r("button", {
|
|
1572
1686
|
class: "p-button p-button-sm p-button-outlined",
|
|
1573
1687
|
type: "button",
|
|
1574
|
-
disabled:
|
|
1575
|
-
onClick: n[
|
|
1576
|
-
}, "只覆盖", 8,
|
|
1577
|
-
|
|
1688
|
+
disabled: k.value,
|
|
1689
|
+
onClick: n[14] || (n[14] = (o) => Ht())
|
|
1690
|
+
}, "只覆盖", 8, cs),
|
|
1691
|
+
r("button", {
|
|
1578
1692
|
class: "p-button p-button-sm p-button-text",
|
|
1579
1693
|
type: "button",
|
|
1580
|
-
disabled:
|
|
1581
|
-
onClick: n[
|
|
1582
|
-
}, "取消", 8,
|
|
1694
|
+
disabled: k.value,
|
|
1695
|
+
onClick: n[15] || (n[15] = (o) => Kt())
|
|
1696
|
+
}, "取消", 8, us)
|
|
1583
1697
|
])
|
|
1584
|
-
])) :
|
|
1698
|
+
])) : S("", !0)
|
|
1585
1699
|
]),
|
|
1586
|
-
|
|
1587
|
-
n[
|
|
1588
|
-
|
|
1589
|
-
n[
|
|
1590
|
-
|
|
1700
|
+
r("section", ds, [
|
|
1701
|
+
n[45] || (n[45] = r("h3", { class: "mbc__title" }, "读回改动", -1)),
|
|
1702
|
+
r("div", ps, [
|
|
1703
|
+
n[42] || (n[42] = r("label", { for: "mbc-read-dir" }, "读回目录", -1)),
|
|
1704
|
+
r("input", {
|
|
1591
1705
|
id: "mbc-read-dir",
|
|
1592
1706
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
1593
1707
|
type: "text",
|
|
1594
1708
|
readonly: "",
|
|
1595
|
-
value:
|
|
1596
|
-
}, null, 8,
|
|
1597
|
-
|
|
1709
|
+
value: C.value ? C.value.name : "(还没选:导出会自动填上,也可以自己选一个)"
|
|
1710
|
+
}, null, 8, fs),
|
|
1711
|
+
r("button", {
|
|
1598
1712
|
class: "p-button p-button-sm p-button-outlined",
|
|
1599
1713
|
type: "button",
|
|
1600
|
-
disabled:
|
|
1601
|
-
onClick: n[
|
|
1602
|
-
}, "选择文件夹", 8,
|
|
1603
|
-
|
|
1714
|
+
disabled: k.value,
|
|
1715
|
+
onClick: n[16] || (n[16] = (o) => lt("read"))
|
|
1716
|
+
}, "选择文件夹", 8, ms),
|
|
1717
|
+
r("button", {
|
|
1604
1718
|
class: "p-button p-button-sm p-button-outlined",
|
|
1605
1719
|
type: "button",
|
|
1606
|
-
disabled:
|
|
1607
|
-
onClick: n[
|
|
1608
|
-
},
|
|
1720
|
+
disabled: k.value,
|
|
1721
|
+
onClick: n[17] || (n[17] = (o) => it())
|
|
1722
|
+
}, v(oe.value ? "读回中…" : "读回改动"), 9, bs)
|
|
1609
1723
|
]),
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
(
|
|
1614
|
-
key:
|
|
1724
|
+
C.value && M.value && C.value.name !== M.value.name ? (b(), h("p", hs, " 读回的是「" + v(C.value.name) + "」(与导出目录「" + v(M.value.name) + "」不是同一个 —— 想同步就再选一次)。 ", 1)) : (b(), h("p", vs, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
|
|
1725
|
+
A.value ? (b(), h(I, { key: 2 }, [
|
|
1726
|
+
A.value.blocks.length > 0 ? (b(), h("ul", gs, [
|
|
1727
|
+
(b(!0), h(I, null, te(A.value.blocks, (o) => (b(), h("li", {
|
|
1728
|
+
key: o.id,
|
|
1615
1729
|
class: "mbc__block"
|
|
1616
1730
|
}, [
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
class:
|
|
1731
|
+
r("label", ys, [
|
|
1732
|
+
r("span", {
|
|
1733
|
+
class: ne(["p-checkbox p-component", { "p-disabled": !o.canApply }])
|
|
1620
1734
|
}, [
|
|
1621
|
-
|
|
1735
|
+
r("input", {
|
|
1622
1736
|
class: "p-checkbox-input",
|
|
1623
1737
|
type: "checkbox",
|
|
1624
|
-
disabled: !
|
|
1625
|
-
checked:
|
|
1626
|
-
onChange: (
|
|
1627
|
-
}, null, 40,
|
|
1628
|
-
n[
|
|
1738
|
+
disabled: !o.canApply,
|
|
1739
|
+
checked: fe.value[o.id] === !0,
|
|
1740
|
+
onChange: (m) => Vt(o.id, m)
|
|
1741
|
+
}, null, 40, _s),
|
|
1742
|
+
n[43] || (n[43] = r("span", { class: "p-checkbox-box" }, null, -1))
|
|
1629
1743
|
], 2),
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
class:
|
|
1633
|
-
},
|
|
1634
|
-
|
|
1744
|
+
r("span", ks, v(o.name || o.id), 1),
|
|
1745
|
+
r("span", {
|
|
1746
|
+
class: ne(["p-tag", o.status === "modified" ? "p-tag-success" : o.status === "missing" ? "p-tag-warning" : ""])
|
|
1747
|
+
}, v(e[o.status]), 3),
|
|
1748
|
+
r("span", ws, v(o.module || "—"), 1)
|
|
1635
1749
|
]),
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
], 64)) :
|
|
1640
|
-
n[
|
|
1641
|
-
|
|
1642
|
-
], 64)) : (
|
|
1643
|
-
|
|
1750
|
+
r("p", $s, [
|
|
1751
|
+
o.status === "missing" ? (b(), h(I, { key: 0 }, [
|
|
1752
|
+
W("目录里没有这一块,勾不上")
|
|
1753
|
+
], 64)) : o.changedFiles.length > 0 ? (b(), h(I, { key: 1 }, [
|
|
1754
|
+
n[44] || (n[44] = W("改了:", -1)),
|
|
1755
|
+
r("span", xs, v(o.changedFiles.join(" / ")), 1)
|
|
1756
|
+
], 64)) : (b(), h(I, { key: 2 }, [
|
|
1757
|
+
W("内容与库里一致")
|
|
1644
1758
|
], 64))
|
|
1645
1759
|
]),
|
|
1646
|
-
|
|
1647
|
-
|
|
1760
|
+
o.blockedWhy ? (b(), h("p", Es, "不能存:" + v(o.blockedWhy), 1)) : S("", !0),
|
|
1761
|
+
r("p", Ss, v(o.folder || o.where), 1)
|
|
1648
1762
|
]))), 128))
|
|
1649
|
-
])) : (
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
(
|
|
1653
|
-
])) :
|
|
1654
|
-
|
|
1655
|
-
|
|
1763
|
+
])) : (b(), h("p", Cs, "这个目录里没有认出任何块。")),
|
|
1764
|
+
A.value.unmatched.length > 0 ? (b(), h("p", Ts, "认不出归属的文件夹(" + v(A.value.unmatched.length) + "):" + v(A.value.unmatched.join(" / ")), 1)) : S("", !0),
|
|
1765
|
+
A.value.failures.length > 0 ? (b(), h("ul", Bs, [
|
|
1766
|
+
(b(!0), h(I, null, te(A.value.failures, (o, m) => (b(), h("li", { key: m }, v(o.where || o.kind) + ":" + v(o.message), 1))), 128))
|
|
1767
|
+
])) : S("", !0),
|
|
1768
|
+
r("div", Os, [
|
|
1769
|
+
r("button", {
|
|
1656
1770
|
class: "p-button p-button-sm",
|
|
1657
1771
|
type: "button",
|
|
1658
|
-
disabled:
|
|
1659
|
-
onClick: n[
|
|
1660
|
-
},
|
|
1772
|
+
disabled: k.value,
|
|
1773
|
+
onClick: n[18] || (n[18] = (o) => qt())
|
|
1774
|
+
}, v(le.value ? "保存中…" : `保存选中的块(${Pe.value.length})`), 9, Ms)
|
|
1661
1775
|
])
|
|
1662
|
-
], 64)) :
|
|
1776
|
+
], 64)) : S("", !0)
|
|
1663
1777
|
]),
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
(
|
|
1668
|
-
])) : (
|
|
1669
|
-
(
|
|
1670
|
-
key:
|
|
1671
|
-
class:
|
|
1778
|
+
Q.value.length > 0 || re.value.length > 0 ? (b(), h("section", As, [
|
|
1779
|
+
r("h3", Ps, v(Q.value.length > 0 ? "前端校验拦下的问题" : "保存结果"), 1),
|
|
1780
|
+
Q.value.length > 0 ? (b(), h("ul", Rs, [
|
|
1781
|
+
(b(!0), h(I, null, te(Q.value, (o, m) => (b(), h("li", { key: m }, v(o), 1))), 128))
|
|
1782
|
+
])) : (b(), h("ul", js, [
|
|
1783
|
+
(b(!0), h(I, null, te(re.value, (o) => (b(), h("li", {
|
|
1784
|
+
key: o.id,
|
|
1785
|
+
class: ne({ "is-ok": o.ok })
|
|
1672
1786
|
}, [
|
|
1673
|
-
|
|
1674
|
-
!
|
|
1675
|
-
!
|
|
1676
|
-
(
|
|
1677
|
-
])) :
|
|
1787
|
+
r("strong", null, v(o.name || o.id) + ":" + v(o.ok ? "已保存" : "没保存"), 1),
|
|
1788
|
+
!o.ok && o.error ? (b(), h("span", Ns, v(o.error), 1)) : S("", !0),
|
|
1789
|
+
!o.ok && (o.issues ?? []).length > 0 ? (b(), h("ul", Is, [
|
|
1790
|
+
(b(!0), h(I, null, te(o.issues, (m, $) => (b(), h("li", { key: $ }, v(m), 1))), 128))
|
|
1791
|
+
])) : S("", !0)
|
|
1678
1792
|
], 2))), 128))
|
|
1679
1793
|
]))
|
|
1680
|
-
])) :
|
|
1681
|
-
])) :
|
|
1682
|
-
], 64)) :
|
|
1794
|
+
])) : S("", !0)
|
|
1795
|
+
])) : S("", !0)
|
|
1796
|
+
], 64)) : S("", !0);
|
|
1683
1797
|
}
|
|
1684
|
-
}),
|
|
1798
|
+
}), qs = /* @__PURE__ */ xt(Ds, [["__scopeId", "data-v-3986834e"]]);
|
|
1685
1799
|
export {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1800
|
+
Qt as API_BASE,
|
|
1801
|
+
rn as BLOCK_BACKEND_FILE,
|
|
1802
|
+
Bt as BLOCK_ENTRY,
|
|
1803
|
+
Je as BLOCK_MANIFEST,
|
|
1804
|
+
on as CLIENT_SOURCE,
|
|
1805
|
+
je as MANIFEST_KEYS,
|
|
1806
|
+
qs as MagicBlockConsole,
|
|
1807
|
+
Ks as MagicBlockPage,
|
|
1808
|
+
st as NAME_MAX,
|
|
1809
|
+
bn as buildPreview,
|
|
1810
|
+
Zn as checkSelection,
|
|
1811
|
+
ln as installBridge,
|
|
1812
|
+
gn as loadBlockRender,
|
|
1813
|
+
hn as onBlockRenderRefresh,
|
|
1814
|
+
Gn as parseManifest,
|
|
1815
|
+
vn as refreshBlockRender,
|
|
1816
|
+
Yn as validFileName,
|
|
1817
|
+
Kn as validName,
|
|
1818
|
+
Wn as validateBlock
|
|
1705
1819
|
};
|