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