labull-framework 0.1.25 → 0.1.26
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 +300 -266
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/magic-block.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Re, ref as
|
|
1
|
+
import { defineComponent as Re, ref as x, computed as O, watch as Ot, nextTick as Ze, onMounted as ln, onBeforeUnmount as un, openBlock as c, createElementBlock as d, normalizeStyle as rn, normalizeClass as H, unref as _t, createElementVNode as s, toDisplayString as p, createCommentVNode as k, Fragment as T, renderList as I, withModifiers as Ce, createBlock as ls, createTextVNode as y, withDirectives as ft, vModelCheckbox as is, vModelText as Yt, withKeys as us, vShow as Zt } from "vue";
|
|
2
2
|
import { useRouter as cn, useRoute as rs } from "vue-router";
|
|
3
3
|
import { A as cs, b as at, c as te, u as dn } from "./chunk-index-BWpDbB19.js";
|
|
4
4
|
import { u as ds, o as Ee, b as pn, _ as bn, d as ps } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-BpRKKThg.js";
|
|
@@ -85,66 +85,66 @@ async function vs(a, o, l) {
|
|
|
85
85
|
if (!fs.test(o)) throw new Error(`路由名不合法:${o}(要写成 类名.方法名,例如 Customer.create)`);
|
|
86
86
|
const i = hn(`/bx/${a}/${o}`);
|
|
87
87
|
if (i.origin !== Xe) throw new Error(`后端地址必须是本应用的(${Xe}):${i.origin}`);
|
|
88
|
-
const r = l instanceof Blob ? l : null,
|
|
88
|
+
const r = l instanceof Blob ? l : null, f = await fetch(i.toString(), {
|
|
89
89
|
method: "POST",
|
|
90
90
|
credentials: "include",
|
|
91
91
|
// 带上 HttpOnly 会话 cookie;authHeaders('POST') 给 CSRF 头(缺了 403)
|
|
92
92
|
headers: r ? { "Content-Type": r.type || "application/octet-stream", ...te("POST") } : { "Content-Type": "application/json", ...te("POST") },
|
|
93
93
|
body: r ?? JSON.stringify(l ?? {})
|
|
94
|
-
}),
|
|
95
|
-
if (
|
|
96
|
-
if (!
|
|
94
|
+
}), m = await f.text().catch(() => "");
|
|
95
|
+
if (f.ok) {
|
|
96
|
+
if (!m) return null;
|
|
97
97
|
try {
|
|
98
|
-
return JSON.parse(
|
|
98
|
+
return JSON.parse(m);
|
|
99
99
|
} catch {
|
|
100
|
-
return
|
|
100
|
+
return m;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
let b =
|
|
103
|
+
let b = m;
|
|
104
104
|
try {
|
|
105
|
-
const h = JSON.parse(
|
|
105
|
+
const h = JSON.parse(m);
|
|
106
106
|
typeof h?.message == "string" && (b = h.message);
|
|
107
107
|
} catch {
|
|
108
|
-
b =
|
|
108
|
+
b = m;
|
|
109
109
|
}
|
|
110
|
-
throw new Error(b ? `${o} 调用失败:${b.slice(0, 300)}` : `${o} 调用失败(${
|
|
110
|
+
throw new Error(b ? `${o} 调用失败:${b.slice(0, 300)}` : `${o} 调用失败(${f.status})`);
|
|
111
111
|
}
|
|
112
112
|
function hs(a, o) {
|
|
113
|
-
const l = (
|
|
113
|
+
const l = (m) => {
|
|
114
114
|
try {
|
|
115
|
-
a.contentWindow?.postMessage(
|
|
115
|
+
a.contentWindow?.postMessage(m, "*");
|
|
116
116
|
} catch (b) {
|
|
117
117
|
console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):", b);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
|
-
async function i(
|
|
121
|
-
if (
|
|
122
|
-
if (
|
|
120
|
+
async function i(m, b) {
|
|
121
|
+
if (m === "getMe") return await at("/auth/me");
|
|
122
|
+
if (m === "navigateTab") {
|
|
123
123
|
const h = typeof b[0] == "string" ? b[0].trim() : "";
|
|
124
124
|
if (!h || !o.onNavigateTab) throw new Error(`跳不了 ${h || "(空地址)"}:这个页面没有把宿主接到路由上`);
|
|
125
125
|
return await o.onNavigateTab(h);
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
if (
|
|
129
|
-
const h = typeof b[0] == "string" ? b[0].trim() : "",
|
|
127
|
+
if (m === "context") return o.context ? o.context() : {};
|
|
128
|
+
if (m === "setTabTitle") {
|
|
129
|
+
const h = typeof b[0] == "string" ? b[0].trim() : "", v = typeof b[1] == "string" ? b[1].trim() : "";
|
|
130
130
|
if (!h) throw new Error("setTabTitle 要给一个非空的名字");
|
|
131
|
-
return o.onTabTitle?.(h,
|
|
131
|
+
return o.onTabTitle?.(h, v || void 0), !0;
|
|
132
132
|
}
|
|
133
|
-
if (
|
|
134
|
-
const h = typeof b[0] == "string" ? b[0].trim() : "",
|
|
133
|
+
if (m === "backend") {
|
|
134
|
+
const h = typeof b[0] == "string" ? b[0].trim() : "", v = b[1];
|
|
135
135
|
if (!h) throw new Error("后端调用的路由名是空的:要写成 magicBackendApi.类名.方法名(参数)");
|
|
136
|
-
if (!
|
|
137
|
-
return await vs(o.uuid, h,
|
|
136
|
+
if (!v || typeof v != "object" || Array.isArray(v)) throw new Error(`magicBackendApi.${h}(params) 的参数要么是一个对象,要么是一个文件(File / Blob)`);
|
|
137
|
+
return await vs(o.uuid, h, v);
|
|
138
138
|
}
|
|
139
|
-
throw new Error(`不认识的方法:${String(
|
|
139
|
+
throw new Error(`不认识的方法:${String(m)}(这块桥只有 getMe / navigateTab / context / setTabTitle / backend 五个)`);
|
|
140
140
|
}
|
|
141
|
-
const r = (
|
|
142
|
-
if (
|
|
143
|
-
const b =
|
|
141
|
+
const r = (m) => {
|
|
142
|
+
if (m.source !== a.contentWindow) return;
|
|
143
|
+
const b = m.data;
|
|
144
144
|
if (!b) return;
|
|
145
145
|
if (b[dt] === vn) {
|
|
146
|
-
const
|
|
147
|
-
Number.isFinite(
|
|
146
|
+
const v = typeof b.height == "number" ? b.height : NaN;
|
|
147
|
+
Number.isFinite(v) && v > 0 && o.onHeight?.(v);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
150
|
if (b[dt] !== mn) return;
|
|
@@ -152,18 +152,18 @@ function hs(a, o) {
|
|
|
152
152
|
(async () => {
|
|
153
153
|
try {
|
|
154
154
|
l({ [dt]: Se, id: h, ok: !0, value: await i(String(b.method), b.args ?? []) });
|
|
155
|
-
} catch (
|
|
156
|
-
l({ [dt]: Se, id: h, ok: !1, error:
|
|
155
|
+
} catch (v) {
|
|
156
|
+
l({ [dt]: Se, id: h, ok: !1, error: v instanceof Error ? v.message : String(v) });
|
|
157
157
|
}
|
|
158
158
|
})();
|
|
159
159
|
};
|
|
160
160
|
window.addEventListener("message", r);
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
window.removeEventListener("message", r), a.removeEventListener("load",
|
|
161
|
+
const f = () => l({ [dt]: fn });
|
|
162
|
+
return f(), a.addEventListener("load", f), () => {
|
|
163
|
+
window.removeEventListener("message", r), a.removeEventListener("load", f);
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
const
|
|
166
|
+
const zt = "index.open.html", _e = "magic-block.open.yaml", ge = ["id", "module", "name", "brief", "detail"], Qe = ["id", "module", "name", "brief"], Oe = 40, _s = /^(?![A-Za-z]:)(?!\/)[A-Za-z0-9._\-/]+$/, gs = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, ys = /^[a-z][a-z0-9]*$/, ks = /^[A-Za-z_][A-Za-z0-9_]*$/, $s = "_";
|
|
167
167
|
function tn(a) {
|
|
168
168
|
return String(a ?? "").split("/").some((o) => o.startsWith($s));
|
|
169
169
|
}
|
|
@@ -210,44 +210,44 @@ function Ss(a) {
|
|
|
210
210
|
}
|
|
211
211
|
function Ts(a) {
|
|
212
212
|
const o = [], l = {}, i = {};
|
|
213
|
-
a.split(/\r?\n/).forEach((r,
|
|
214
|
-
const
|
|
213
|
+
a.split(/\r?\n/).forEach((r, f) => {
|
|
214
|
+
const m = f + 1, b = Cs(r).trim();
|
|
215
215
|
if (!b) return;
|
|
216
216
|
if (b.startsWith("-")) {
|
|
217
|
-
o.push(`第 ${
|
|
217
|
+
o.push(`第 ${m} 行是列表写法(${b}):清单只认「键: 值」,每个键各占一行 —— 例如 name: 客户档案`);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
const h = Es(b);
|
|
221
221
|
if (h < 0) {
|
|
222
|
-
o.push(`第 ${
|
|
222
|
+
o.push(`第 ${m} 行不是「键: 值」(${b}):清单只认「键: 值」与 # 注释 —— 要么删掉这一行,要么照 name: 客户档案 写`);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
if (!ks.test(
|
|
227
|
-
o.push(`第 ${
|
|
225
|
+
const v = b.slice(0, h).trim();
|
|
226
|
+
if (!ks.test(v)) {
|
|
227
|
+
o.push(`第 ${m} 行的键名不合法(${v}):键名只许字母或下划线开头,认得的键只有 ${ge.join(" / ")}`);
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
if (!ge.includes(
|
|
230
|
+
if (!ge.includes(v)) {
|
|
231
231
|
o.push(
|
|
232
|
-
`第 ${
|
|
232
|
+
`第 ${m} 行的键不认识(${v}):清单只有 ${ge.join(" / ")} 这几个键(其中 ${Qe.join(" / ")} 必填,detail 可以不写)`
|
|
233
233
|
);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
if (
|
|
237
|
-
o.push(`第 ${
|
|
236
|
+
if (v in i) {
|
|
237
|
+
o.push(`第 ${m} 行重复写了 ${v}(第 ${i[v]} 行已经写过):一个键只许出现一次`);
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
i[
|
|
240
|
+
i[v] = m, l[v] = Ss(b.slice(h + 1).trim());
|
|
241
241
|
});
|
|
242
242
|
for (const r of Qe) {
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
243
|
+
const f = l[r] ?? "";
|
|
244
|
+
if (f === "") {
|
|
245
245
|
o.push(`清单里缺少 ${r}(或者是空的):${xs[r]}`);
|
|
246
246
|
continue;
|
|
247
247
|
}
|
|
248
|
-
r === "id" && !gs.test(
|
|
249
|
-
`清单里的 module 不合法:${
|
|
250
|
-
) : r === "name" && !ws(
|
|
248
|
+
r === "id" && !gs.test(f) ? o.push(`清单里的 id 不是 uuid:${f} —— 要 8-4-4-4-12 那种十六进制`) : r === "module" && !ys.test(f) ? o.push(
|
|
249
|
+
`清单里的 module 不合法:${f} —— 它同时是 Django 的 app label,所以只许小写字母与数字、必须以字母开头(不能有横线与下划线),例如 home / orders`
|
|
250
|
+
) : r === "name" && !ws(f) && o.push(`清单里的 name 不合法:${f} —— 不能超过 ${Oe} 个字符、不能含控制字符(中文可以)`);
|
|
251
251
|
}
|
|
252
252
|
return [l, o];
|
|
253
253
|
}
|
|
@@ -255,8 +255,8 @@ function Bs(a) {
|
|
|
255
255
|
return _s.test(a) && !a.split("/").includes("..");
|
|
256
256
|
}
|
|
257
257
|
function Ms(a) {
|
|
258
|
-
const o = [], l = a[
|
|
259
|
-
l === void 0 ? o.push(`包里缺入口:必须有 ${
|
|
258
|
+
const o = [], l = a[zt];
|
|
259
|
+
l === void 0 ? o.push(`包里缺入口:必须有 ${zt}(${en(a)})`) : l.trim() || o.push(`${zt} 不能是空文件`);
|
|
260
260
|
const i = a[_e];
|
|
261
261
|
let r = {};
|
|
262
262
|
if (i === void 0)
|
|
@@ -264,11 +264,11 @@ function Ms(a) {
|
|
|
264
264
|
else if (!i.trim())
|
|
265
265
|
o.push(`${_e} 不能是空文件`);
|
|
266
266
|
else {
|
|
267
|
-
const [
|
|
268
|
-
r =
|
|
267
|
+
const [f, m] = Ts(i);
|
|
268
|
+
r = f, o.push(...m);
|
|
269
269
|
}
|
|
270
|
-
for (const
|
|
271
|
-
Bs(
|
|
270
|
+
for (const f of Object.keys(a))
|
|
271
|
+
Bs(f) || o.push(`文件名不合法:${f}(只许字母数字与 . _ - /,且不许 .. 与绝对路径)`);
|
|
272
272
|
return { manifest: r, issues: o };
|
|
273
273
|
}
|
|
274
274
|
function As(a) {
|
|
@@ -295,16 +295,16 @@ function Ps(a) {
|
|
|
295
295
|
}
|
|
296
296
|
const Ls = /<script\b([^>]*?)\bsrc\s*=\s*(["'])(.*?)\2([^>]*)>\s*<\/script\s*>/gi, js = /<link\b([^>]*?)\bhref\s*=\s*(["'])(.*?)\2([^>]*?)\/?>/gi;
|
|
297
297
|
function Ds(a, o) {
|
|
298
|
-
const l = [], i = (
|
|
299
|
-
return { html: a.replace(Ls, (
|
|
300
|
-
const _ = nn(
|
|
301
|
-
return _ === void 0 ?
|
|
298
|
+
const l = [], i = (m) => (l.push(m), Ps(l.length - 1));
|
|
299
|
+
return { html: a.replace(Ls, (m, b, h, v, w) => {
|
|
300
|
+
const _ = nn(v, o);
|
|
301
|
+
return _ === void 0 ? m : i(`<script${b}${w}>
|
|
302
302
|
${gn(o[_] ?? "")}
|
|
303
303
|
<\/script>`);
|
|
304
|
-
}).replace(js, (
|
|
305
|
-
if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${b}${
|
|
306
|
-
const _ = nn(
|
|
307
|
-
return _ === void 0 ?
|
|
304
|
+
}).replace(js, (m, b, h, v, w) => {
|
|
305
|
+
if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${b}${w}`)) return m;
|
|
306
|
+
const _ = nn(v, o);
|
|
307
|
+
return _ === void 0 ? m : i(`<style>
|
|
308
308
|
${o[_]}
|
|
309
309
|
</style>`);
|
|
310
310
|
}), slots: l };
|
|
@@ -329,16 +329,16 @@ ${o}
|
|
|
329
329
|
`) : a;
|
|
330
330
|
}
|
|
331
331
|
function Ns(a, o = {}) {
|
|
332
|
-
const l = o.bootstrap ?? "", i = o.css ?? "", r = o.themeCss ?? "",
|
|
333
|
-
if (
|
|
334
|
-
const { html:
|
|
335
|
-
if (
|
|
336
|
-
let
|
|
337
|
-
for (let _ = 1; _ <
|
|
338
|
-
const g =
|
|
339
|
-
|
|
332
|
+
const l = o.bootstrap ?? "", i = o.css ?? "", r = o.themeCss ?? "", f = a[zt];
|
|
333
|
+
if (f === void 0) return "";
|
|
334
|
+
const { html: m, slots: b } = Ds(f, a), h = Is(sn(sn(m, r), i), l), v = h.split(_n);
|
|
335
|
+
if (v.length === 1) return h;
|
|
336
|
+
let w = v[0] ?? "";
|
|
337
|
+
for (let _ = 1; _ < v.length; _ += 1) {
|
|
338
|
+
const g = v[_] ?? "", M = g.indexOf("\0"), F = Number(g.slice(0, M));
|
|
339
|
+
w += (b[F] ?? "") + g.slice(M + 1);
|
|
340
340
|
}
|
|
341
|
-
return
|
|
341
|
+
return w;
|
|
342
342
|
}
|
|
343
343
|
const Ft = /* @__PURE__ */ new Map();
|
|
344
344
|
let Pt = null;
|
|
@@ -348,11 +348,11 @@ function Fs(a) {
|
|
|
348
348
|
Te.delete(a);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function zs() {
|
|
352
352
|
Ft.clear(), Pt = null;
|
|
353
353
|
for (const a of Te) a();
|
|
354
354
|
}
|
|
355
|
-
async function
|
|
355
|
+
async function Us(a) {
|
|
356
356
|
const o = [...new Set(a)].filter(Boolean);
|
|
357
357
|
if (o.some((l) => !Ft.has(l))) {
|
|
358
358
|
Pt && await Pt.catch(() => {
|
|
@@ -377,36 +377,36 @@ function Hs(a, o) {
|
|
|
377
377
|
}
|
|
378
378
|
function kn(a, o, l) {
|
|
379
379
|
for (let i = 0; i < a.length; i += 1) {
|
|
380
|
-
const r = a[i],
|
|
380
|
+
const r = a[i], f = String(r.cssText || ""), m = String(r.selectorText || "");
|
|
381
381
|
if (r.cssRules && r.cssRules.length > 0) {
|
|
382
382
|
const b = [];
|
|
383
383
|
if (kn(r.cssRules, b, l), b.length === 0) continue;
|
|
384
|
-
const h =
|
|
384
|
+
const h = f.slice(0, f.indexOf("{")).trim();
|
|
385
385
|
o.push(`${h} {
|
|
386
|
-
${b.map((
|
|
386
|
+
${b.map((v) => " " + v).join(`
|
|
387
387
|
`)}
|
|
388
388
|
}`);
|
|
389
389
|
continue;
|
|
390
390
|
}
|
|
391
|
-
Hs(
|
|
391
|
+
Hs(m, f) && (o.push(f), l.n += 1);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
function $n() {
|
|
395
395
|
const a = [], o = [], l = { n: 0 };
|
|
396
396
|
let i = 0;
|
|
397
397
|
const r = typeof document > "u" ? [] : Array.from(document.styleSheets);
|
|
398
|
-
for (const
|
|
399
|
-
const b =
|
|
398
|
+
for (const m of r) {
|
|
399
|
+
const b = m.href || "(内联 <style>)";
|
|
400
400
|
let h = null;
|
|
401
401
|
try {
|
|
402
|
-
h =
|
|
402
|
+
h = m.cssRules;
|
|
403
403
|
} catch {
|
|
404
404
|
o.push(b);
|
|
405
405
|
continue;
|
|
406
406
|
}
|
|
407
407
|
if (!h || h.length === 0) continue;
|
|
408
|
-
const
|
|
409
|
-
kn(h,
|
|
408
|
+
const v = [];
|
|
409
|
+
kn(h, v, l), v.length !== 0 && (i += 1, a.push(`/* ── ${b} ── */`, ...v));
|
|
410
410
|
}
|
|
411
411
|
return { css: [
|
|
412
412
|
"/* 生成物:每次导出都会重写,别手改。",
|
|
@@ -429,8 +429,21 @@ function $n() {
|
|
|
429
429
|
`, sheets: i, skipped: o, rules: l.n };
|
|
430
430
|
}
|
|
431
431
|
function Ks() {
|
|
432
|
-
const
|
|
433
|
-
|
|
432
|
+
const a = '<button class="p-button" type="button">主要按钮</button>', o = (m, b, h) => ` <li class="labull-step${m ? ` ${m}` : ""}">
|
|
433
|
+
<span class="labull-step-node"></span>
|
|
434
|
+
<span class="labull-step-label">${b}</span>
|
|
435
|
+
<span class="labull-step-desc">${h}</span>
|
|
436
|
+
</li>`, l = (m, b = "") => `<ol class="labull-steps${b ? ` ${b}` : ""}">
|
|
437
|
+
` + m.map(([h, v, w]) => o(h, v, w)).join(`
|
|
438
|
+
`) + `
|
|
439
|
+
</ol>`, i = l([
|
|
440
|
+
["is-done", "草稿", "需求已创建"],
|
|
441
|
+
["is-current", "待审批", "等管理员审批"],
|
|
442
|
+
["", "审批通过", "待处理"],
|
|
443
|
+
["", "开发完成", "待处理"],
|
|
444
|
+
["", "验收完成", "待处理"]
|
|
445
|
+
]), f = [
|
|
446
|
+
["按钮", a],
|
|
434
447
|
["次要按钮", '<button class="p-button p-button-outlined" type="button">次要按钮</button>'],
|
|
435
448
|
["纯文字按钮", '<button class="p-button p-button-text" type="button">纯文字</button>'],
|
|
436
449
|
["小按钮 + 图标", '<button class="p-button p-button-sm" type="button"><i class="pi pi-refresh"></i> 刷新</button>'],
|
|
@@ -444,12 +457,33 @@ function Ks() {
|
|
|
444
457
|
["弹窗(原生 <code><dialog></code> + <code>showModal()</code>)", `<button class="p-button p-button-sm" type="button" onclick="document.getElementById('demoDialog').showModal()">打开弹窗</button><dialog id="demoDialog"><h3 style="margin:0 0 .5rem">弹窗标题</h3><p style="margin:0 0 .75rem">弹窗正文。遮罩与长相来自主题,块里不必自己画一层浮层。</p><form method="dialog"><button class="p-button p-button-sm">关闭</button></form></dialog>`],
|
|
445
458
|
['"选择文件"另一种写法(文案更干净)', '<label class="p-button p-button-sm p-button-outlined" for="demo-file"><i class="pi pi-folder-open"></i> 选择照片</label><input id="demo-file" class="visually-hidden" type="file" />'],
|
|
446
459
|
["面板 + 标题", '<div class="labull-panel"><h2 class="labull-subject-title"><i class="pi pi-list"></i> 面板标题</h2><p>面板正文。</p></div>'],
|
|
460
|
+
/* 🔴 流程链条:**纯 CSS**(没有 JS),状态加在 `<li>` 上;桌面横向、手机自动转纵向。
|
|
461
|
+
* 三行分别是:默认那条链 / 强制纵向那个参数 / 四个状态各长什么样。 */
|
|
462
|
+
["流程链条(工作流步骤条):桌面横向、手机自动纵向;节点空着会自动编号,已完成自动显示 ✓", i],
|
|
463
|
+
["流程链条 · 参数 <code>labull-steps--vertical</code>(强制纵向:手机那一套,侧栏那种窄容器也用它)", l([
|
|
464
|
+
["is-done", "草稿", "需求已创建"],
|
|
465
|
+
["is-current", "待审批", "等管理员审批"],
|
|
466
|
+
["", "审批通过", "待处理"],
|
|
467
|
+
["", "开发完成", "待处理"],
|
|
468
|
+
["", "验收完成", "待处理"]
|
|
469
|
+
], "labull-steps--vertical")],
|
|
470
|
+
["流程链条 · 参数 <code>labull-steps--horizontal</code>(强制横向:在手机上也横着排)", l([
|
|
471
|
+
["is-done", "提交", "10-05"],
|
|
472
|
+
["is-current", "审批", "进行中"],
|
|
473
|
+
["", "完成", "待处理"]
|
|
474
|
+
], "labull-steps--horizontal")],
|
|
475
|
+
["流程链条 · 状态:<code>is-done</code> / <code>is-current</code> / 不写(待处理)/ <code>is-danger</code>(退回 · 终止)", l([
|
|
476
|
+
["is-done", "已修复", "张三 10-05"],
|
|
477
|
+
["is-current", "待验收", "等提出人确认"],
|
|
478
|
+
["is-danger", "被退回", "原因:信息不全"],
|
|
479
|
+
["", "已关闭", "待处理"]
|
|
480
|
+
])],
|
|
447
481
|
["表格", "<table><thead><tr><th>列 A</th><th>列 B</th></tr></thead><tbody><tr><td>值</td><td>值</td></tr></tbody></table>"]
|
|
448
482
|
].map(
|
|
449
|
-
([
|
|
450
|
-
<h3>${
|
|
451
|
-
<div class="demo">${
|
|
452
|
-
<pre>${
|
|
483
|
+
([m, b]) => ` <section>
|
|
484
|
+
<h3>${m}</h3>
|
|
485
|
+
<div class="demo">${b}</div>
|
|
486
|
+
<pre>${b.replace(/&/g, "&").replace(/</g, "<")}</pre>
|
|
453
487
|
</section>`
|
|
454
488
|
).join(`
|
|
455
489
|
`);
|
|
@@ -484,7 +518,7 @@ function Ks() {
|
|
|
484
518
|
<br />
|
|
485
519
|
⚠️ 这里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为(块里没有构建步骤)。
|
|
486
520
|
</p>
|
|
487
|
-
${
|
|
521
|
+
${f}
|
|
488
522
|
</body>
|
|
489
523
|
</html>
|
|
490
524
|
`;
|
|
@@ -508,8 +542,8 @@ function Js(a, o) {
|
|
|
508
542
|
};
|
|
509
543
|
let r = Bt.get(l);
|
|
510
544
|
return r || (r = /* @__PURE__ */ new Set(), Bt.set(l, r)), r.add(i), () => {
|
|
511
|
-
const
|
|
512
|
-
|
|
545
|
+
const f = Bt.get(l);
|
|
546
|
+
f && (f.delete(i), f.size === 0 && Bt.delete(l));
|
|
513
547
|
};
|
|
514
548
|
}
|
|
515
549
|
function Ae(a, o, l) {
|
|
@@ -551,13 +585,13 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
551
585
|
theme: { type: Boolean, default: !0 }
|
|
552
586
|
},
|
|
553
587
|
setup(a) {
|
|
554
|
-
const o = a, l = ds(), i = cn(), { isStaff: r } = dn(),
|
|
588
|
+
const o = a, l = ds(), i = cn(), { isStaff: r } = dn(), f = x(null), m = x(null), b = x(null), h = x(!1), v = x(0), w = x(0);
|
|
555
589
|
let _ = null, g = null, M = null, F = null, B = null, R = null;
|
|
556
|
-
const L = O(() => o.name.trim() || o.uuid), G = O(() => b.value?.state ?? ""), pt = O(() => G.value === "invalid" ? "校验不通过" : G.value === "draft" ? "未开发" : L.value), Z = O(() => (b.value?.brief ?? "").trim() || (b.value?.name ?? "").trim() || L.value), gt = O(() => (b.value?.reason ?? "").trim()), yt = O(() => b.value?.issues ?? []), C = O(() => Math.max(
|
|
590
|
+
const L = O(() => o.name.trim() || o.uuid), G = O(() => b.value?.state ?? ""), pt = O(() => G.value === "invalid" ? "校验不通过" : G.value === "draft" ? "未开发" : L.value), Z = O(() => (b.value?.brief ?? "").trim() || (b.value?.name ?? "").trim() || L.value), gt = O(() => (b.value?.reason ?? "").trim()), yt = O(() => b.value?.issues ?? []), C = O(() => Math.max(w.value, v.value, 1)), Lt = O(() => ({ height: `${C.value}px` })), lt = O(() => {
|
|
557
591
|
const $ = {};
|
|
558
592
|
for (const [E, j] of Object.entries(b.value?.files ?? {})) E !== Rs && ($[E] = j);
|
|
559
593
|
return $;
|
|
560
|
-
}), kt = O(() => G.value === "ok" && typeof lt.value[
|
|
594
|
+
}), kt = O(() => G.value === "ok" && typeof lt.value[zt] == "string");
|
|
561
595
|
let nt = null;
|
|
562
596
|
function K() {
|
|
563
597
|
if (!o.theme) return "";
|
|
@@ -569,7 +603,7 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
569
603
|
}
|
|
570
604
|
return nt;
|
|
571
605
|
}
|
|
572
|
-
const
|
|
606
|
+
const z = O(() => {
|
|
573
607
|
if (!kt.value) return "";
|
|
574
608
|
const $ = { bootstrap: ms, css: bs }, E = K();
|
|
575
609
|
return E && ($.themeCss = E), Ns(lt.value, $);
|
|
@@ -587,11 +621,11 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
587
621
|
}
|
|
588
622
|
function bt() {
|
|
589
623
|
M?.(), M = null;
|
|
590
|
-
const $ =
|
|
624
|
+
const $ = m.value;
|
|
591
625
|
$ && (M = hs($, {
|
|
592
626
|
uuid: o.uuid,
|
|
593
627
|
onHeight: (E) => {
|
|
594
|
-
|
|
628
|
+
v.value = E;
|
|
595
629
|
},
|
|
596
630
|
onNavigateTab: $t,
|
|
597
631
|
context: X,
|
|
@@ -601,10 +635,10 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
601
635
|
}));
|
|
602
636
|
}
|
|
603
637
|
async function wt() {
|
|
604
|
-
const $ = o.uuid, E = await
|
|
638
|
+
const $ = o.uuid, E = await Us([$]);
|
|
605
639
|
$ === o.uuid && (b.value = E.find((j) => j.id === $) ?? null);
|
|
606
640
|
}
|
|
607
|
-
function
|
|
641
|
+
function Ut() {
|
|
608
642
|
window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid: o.uuid } }));
|
|
609
643
|
}
|
|
610
644
|
function Ht($ = !1) {
|
|
@@ -629,33 +663,33 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
629
663
|
return document.documentElement;
|
|
630
664
|
}
|
|
631
665
|
function W() {
|
|
632
|
-
const $ =
|
|
666
|
+
const $ = f.value;
|
|
633
667
|
if (!$) return 0;
|
|
634
|
-
const E = it($), j = getComputedStyle(E), ut = parseFloat(j.paddingTop) || 0, jt = parseFloat(j.paddingBottom) || 0,
|
|
668
|
+
const E = it($), j = getComputedStyle(E), ut = parseFloat(j.paddingTop) || 0, jt = parseFloat(j.paddingBottom) || 0, U = parseFloat(j.borderTopWidth) || 0, Dt = E === document.documentElement, ne = Dt ? Math.max(0, window.innerHeight - ut - jt) : Math.max(0, E.clientHeight - ut - jt), se = Dt ? ut : E.getBoundingClientRect().top + U + ut, oe = Dt ? window.scrollY || 0 : E.scrollTop, q = $.getBoundingClientRect().top - se + oe;
|
|
635
669
|
return Math.max(0, Math.floor(ne - q));
|
|
636
670
|
}
|
|
637
671
|
function Y() {
|
|
638
|
-
if (!l.active.value || !
|
|
672
|
+
if (!l.active.value || !f.value) return;
|
|
639
673
|
const $ = W();
|
|
640
|
-
$ > 0 && Math.abs($ -
|
|
674
|
+
$ > 0 && Math.abs($ - w.value) > 1 && (w.value = $);
|
|
641
675
|
}
|
|
642
676
|
function st() {
|
|
643
|
-
if (!
|
|
644
|
-
const $ = it(
|
|
677
|
+
if (!f.value) return;
|
|
678
|
+
const $ = it(f.value);
|
|
645
679
|
_ !== $ && (_ = $, g?.disconnect(), g = null), Y(), !(g || typeof ResizeObserver > "u") && (g = new ResizeObserver(() => Y()), g.observe($));
|
|
646
680
|
}
|
|
647
|
-
return Ot(
|
|
648
|
-
|
|
681
|
+
return Ot(m, () => bt()), Ot(z, () => {
|
|
682
|
+
v.value = 0, w.value = 0, st();
|
|
649
683
|
}, { flush: "post" }), Ot(() => o.uuid, () => {
|
|
650
684
|
Ze().then(() => st());
|
|
651
685
|
}), Ot(() => l.active.value, ($) => {
|
|
652
686
|
$ && Ze().then(() => {
|
|
653
687
|
st();
|
|
654
|
-
const E =
|
|
688
|
+
const E = f.value;
|
|
655
689
|
!E || !E.isConnected || E.offsetParent === null || h.value && E.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
656
690
|
});
|
|
657
691
|
}), Ot(() => o.uuid, () => {
|
|
658
|
-
|
|
692
|
+
v.value = 0, b.value = null, Ht(!0), h.value = ye() === o.uuid, wt();
|
|
659
693
|
}), ln(() => {
|
|
660
694
|
F = Fs(() => void wt()), R = qs(() => {
|
|
661
695
|
h.value = ye() === o.uuid;
|
|
@@ -664,7 +698,7 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
664
698
|
g?.disconnect(), g = null, F?.(), F = null, R?.(), R = null, B?.(), B = null, M?.(), M = null;
|
|
665
699
|
}), ($, E) => (c(), d("div", {
|
|
666
700
|
ref_key: "el",
|
|
667
|
-
ref:
|
|
701
|
+
ref: f,
|
|
668
702
|
class: H(["mb", { "mb--admin": _t(r), "mb--lit": _t(r) && h.value }]),
|
|
669
703
|
style: rn(Lt.value),
|
|
670
704
|
"data-magic-block": a.uuid,
|
|
@@ -673,9 +707,9 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
673
707
|
kt.value ? (c(), d("iframe", {
|
|
674
708
|
key: 0,
|
|
675
709
|
ref_key: "frame",
|
|
676
|
-
ref:
|
|
710
|
+
ref: m,
|
|
677
711
|
class: "mb__frame",
|
|
678
|
-
srcdoc:
|
|
712
|
+
srcdoc: z.value,
|
|
679
713
|
title: L.value,
|
|
680
714
|
scrolling: "no",
|
|
681
715
|
sandbox: "allow-scripts allow-forms allow-modals allow-popups allow-downloads"
|
|
@@ -696,7 +730,7 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
696
730
|
s("button", {
|
|
697
731
|
class: "mb__go",
|
|
698
732
|
type: "button",
|
|
699
|
-
onClick: Ce(
|
|
733
|
+
onClick: Ce(Ut, ["stop"])
|
|
700
734
|
}, "去控制台")
|
|
701
735
|
], 2)),
|
|
702
736
|
_t(r) ? (c(), d("span", no)) : k("", !0),
|
|
@@ -745,7 +779,7 @@ const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"],
|
|
|
745
779
|
const r = l.meta?.blockUuid;
|
|
746
780
|
return typeof r == "string" && r.trim() ? r.trim() : o.uuid;
|
|
747
781
|
});
|
|
748
|
-
return (r,
|
|
782
|
+
return (r, f) => (c(), ls(uo, {
|
|
749
783
|
uuid: i.value,
|
|
750
784
|
name: a.name,
|
|
751
785
|
module: a.module,
|
|
@@ -768,11 +802,11 @@ function po(a, o) {
|
|
|
768
802
|
const l = [], i = /* @__PURE__ */ new Set();
|
|
769
803
|
for (const r of a ?? []) {
|
|
770
804
|
if (!r || r.redirect || r.components?.default !== o) continue;
|
|
771
|
-
const
|
|
772
|
-
if (!
|
|
773
|
-
i.add(
|
|
774
|
-
const
|
|
775
|
-
l.push({ uuid:
|
|
805
|
+
const f = co(r);
|
|
806
|
+
if (!f || i.has(f)) continue;
|
|
807
|
+
i.add(f);
|
|
808
|
+
const m = ht(r.path), b = ht(r.meta?.title) || ht(r.meta?.sub) || m;
|
|
809
|
+
l.push({ uuid: f, path: m, title: b, module: ht(r.meta?.module), brief: ht(r.meta?.brief) });
|
|
776
810
|
}
|
|
777
811
|
return l;
|
|
778
812
|
}
|
|
@@ -797,11 +831,11 @@ function fo(a, o) {
|
|
|
797
831
|
return o.add(i), i;
|
|
798
832
|
}
|
|
799
833
|
function vo(a) {
|
|
800
|
-
const o = (a ?? []).filter((
|
|
801
|
-
o.forEach((
|
|
802
|
-
const b =
|
|
803
|
-
let h = i.find((
|
|
804
|
-
h || (h = { title: b, rows: [] }, i.push(h)), h.rows.push({ key: fo(mo(
|
|
834
|
+
const o = (a ?? []).filter((f) => f && typeof f.path == "string" && f.path.trim() !== ""), l = /* @__PURE__ */ new Set(), i = [];
|
|
835
|
+
o.forEach((f, m) => {
|
|
836
|
+
const b = f.group?.trim() || "(没写 meta.group)";
|
|
837
|
+
let h = i.find((v) => v.title === b);
|
|
838
|
+
h || (h = { title: b, rows: [] }, i.push(h)), h.rows.push({ key: fo(mo(f.path, m), l), row: f });
|
|
805
839
|
});
|
|
806
840
|
const r = [
|
|
807
841
|
"/* 生成物:**每次导出都会重写**,别手改 —— 改了下次导出就没了。",
|
|
@@ -832,10 +866,10 @@ function vo(a) {
|
|
|
832
866
|
r.push("/* ⚠️ 这次导出没拿到路由表(这个应用没装 vue-router,或者一条页面路由都没有)。 */", "export const Page = {} as const", "");
|
|
833
867
|
else {
|
|
834
868
|
r.push("export const Page = {");
|
|
835
|
-
for (const
|
|
836
|
-
r.push(` // ── ${
|
|
837
|
-
for (const
|
|
838
|
-
r.push(` /** ${
|
|
869
|
+
for (const f of i) {
|
|
870
|
+
r.push(` // ── ${f.title} ──`);
|
|
871
|
+
for (const m of f.rows)
|
|
872
|
+
r.push(` /** ${m.row.title?.trim() || m.row.path}(${m.row.path}) */`), r.push(` ${m.key}: '${m.row.path}',`);
|
|
839
873
|
}
|
|
840
874
|
r.push("} as const", "");
|
|
841
875
|
}
|
|
@@ -922,8 +956,8 @@ function _o(a) {
|
|
|
922
956
|
const o = String(a ?? "");
|
|
923
957
|
let l = 3735928559, i = 1103547991;
|
|
924
958
|
for (let r = 0; r < o.length; r += 1) {
|
|
925
|
-
const
|
|
926
|
-
l = Math.imul(l ^
|
|
959
|
+
const f = o.charCodeAt(r);
|
|
960
|
+
l = Math.imul(l ^ f, 2654435761), i = Math.imul(i ^ f, 1597334677);
|
|
927
961
|
}
|
|
928
962
|
return l = Math.imul(l ^ l >>> 16, 2246822507) ^ Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507) ^ Math.imul(l ^ l >>> 13, 3266489909), `${(4294967296 * (2097151 & i) + (l >>> 0)).toString(36)}:${o.length}`;
|
|
929
963
|
}
|
|
@@ -944,12 +978,12 @@ function yo(a) {
|
|
|
944
978
|
return (l) => {
|
|
945
979
|
const i = l.join("\0"), r = o.get(i);
|
|
946
980
|
if (r) return r;
|
|
947
|
-
let
|
|
948
|
-
for (let
|
|
949
|
-
const b = l[
|
|
950
|
-
|
|
981
|
+
let f = Promise.resolve(a);
|
|
982
|
+
for (let m = 0; m < l.length; m += 1) {
|
|
983
|
+
const b = l[m], h = l.slice(0, m + 1).join("\0"), v = o.get(h);
|
|
984
|
+
f = v ?? f.then((w) => w.getDirectoryHandle(b, { create: !0 })), v || o.set(h, f);
|
|
951
985
|
}
|
|
952
|
-
return
|
|
986
|
+
return f;
|
|
953
987
|
};
|
|
954
988
|
}
|
|
955
989
|
async function ko(a, o, l) {
|
|
@@ -963,11 +997,11 @@ async function $o(a, o, l, i = {}) {
|
|
|
963
997
|
const r = Object.entries(o ?? {}).map(([B, R]) => {
|
|
964
998
|
const L = String(R ?? "");
|
|
965
999
|
return { path: B, parts: Pe(B), body: L, digest: _o(L) };
|
|
966
|
-
}),
|
|
1000
|
+
}), f = r.length, m = [], b = yo(a.handle), h = i.verify === !0, v = i.trust, w = i.existing, _ = /* @__PURE__ */ new Map();
|
|
967
1001
|
let g = 0, M = 0, F = 0;
|
|
968
|
-
return l?.(0,
|
|
1002
|
+
return l?.(0, f), await vt(r, async (B) => {
|
|
969
1003
|
try {
|
|
970
|
-
if (
|
|
1004
|
+
if (v?.get(B.path) === B.digest && (w?.has(B.path) ?? !1))
|
|
971
1005
|
F += 1, _.set(B.path, B.digest);
|
|
972
1006
|
else {
|
|
973
1007
|
const R = await b(B.parts.slice(0, -1)), L = B.parts[B.parts.length - 1];
|
|
@@ -984,30 +1018,30 @@ async function $o(a, o, l, i = {}) {
|
|
|
984
1018
|
}
|
|
985
1019
|
}
|
|
986
1020
|
} catch (R) {
|
|
987
|
-
|
|
1021
|
+
m.push({ path: B.path, message: ee(R) });
|
|
988
1022
|
}
|
|
989
|
-
l?.(g + M + F +
|
|
990
|
-
}),
|
|
1023
|
+
l?.(g + M + F + m.length, f);
|
|
1024
|
+
}), m.sort((B, R) => B.path < R.path ? -1 : B.path > R.path ? 1 : 0), { written: g, failed: m, total: f, skipped: M, trusted: F, fingerprints: _ };
|
|
991
1025
|
}
|
|
992
1026
|
async function we(a, o) {
|
|
993
|
-
const l = { items: [], topCount: 0, files: 0, dirs: 0 }, i = async (
|
|
1027
|
+
const l = { items: [], topCount: 0, files: 0, dirs: 0 }, i = async (m, b) => {
|
|
994
1028
|
const h = [];
|
|
995
|
-
for (const
|
|
996
|
-
if (
|
|
1029
|
+
for (const v of await Mt(m)) {
|
|
1030
|
+
if (v.kind === "file") {
|
|
997
1031
|
l.files += 1;
|
|
998
1032
|
continue;
|
|
999
1033
|
}
|
|
1000
|
-
l.dirs += 1, !(b >= o.maxDepth) && (o.skipDirs.includes(
|
|
1034
|
+
l.dirs += 1, !(b >= o.maxDepth) && (o.skipDirs.includes(v.name) || h.push(v));
|
|
1001
1035
|
}
|
|
1002
|
-
await vt(h, (
|
|
1003
|
-
}, r = await Mt(a.handle),
|
|
1004
|
-
for (const
|
|
1005
|
-
if (l.items.push({ name:
|
|
1036
|
+
await vt(h, (v) => i(v, b + 1));
|
|
1037
|
+
}, r = await Mt(a.handle), f = [];
|
|
1038
|
+
for (const m of r)
|
|
1039
|
+
if (l.items.push({ name: m.name, dir: m.kind === "directory" }), m.kind === "file") l.files += 1;
|
|
1006
1040
|
else {
|
|
1007
|
-
if (l.dirs += 1, o.skipDirs.includes(
|
|
1008
|
-
|
|
1041
|
+
if (l.dirs += 1, o.skipDirs.includes(m.name) || o.maxDepth <= 0) continue;
|
|
1042
|
+
f.push(m);
|
|
1009
1043
|
}
|
|
1010
|
-
return await vt(
|
|
1044
|
+
return await vt(f, (m) => i(m, 1)), l.topCount = l.items.length, l;
|
|
1011
1045
|
}
|
|
1012
1046
|
async function wo(a) {
|
|
1013
1047
|
const o = [];
|
|
@@ -1019,46 +1053,46 @@ async function wo(a) {
|
|
|
1019
1053
|
}
|
|
1020
1054
|
async function xo(a, o) {
|
|
1021
1055
|
const { wantedFiles: l, wantedDirs: i } = Cn(o), r = /* @__PURE__ */ new Set();
|
|
1022
|
-
let
|
|
1023
|
-
const
|
|
1024
|
-
const
|
|
1056
|
+
let f = 0;
|
|
1057
|
+
const m = async (b, h) => {
|
|
1058
|
+
const v = [], w = [];
|
|
1025
1059
|
for (const _ of await Mt(b)) {
|
|
1026
1060
|
const g = h ? `${h}/${_.name}` : _.name;
|
|
1027
1061
|
if (_.kind === "file") {
|
|
1028
|
-
l.has(g) ? r.add(g) :
|
|
1062
|
+
l.has(g) ? r.add(g) : v.push(_.name);
|
|
1029
1063
|
continue;
|
|
1030
1064
|
}
|
|
1031
|
-
i.has(g) ?
|
|
1065
|
+
i.has(g) ? w.push([g, _]) : v.push(_.name);
|
|
1032
1066
|
}
|
|
1033
|
-
await vt(
|
|
1034
|
-
await b.removeEntry(_, { recursive: !0 }),
|
|
1035
|
-
}), await vt(
|
|
1067
|
+
await vt(v, async (_) => {
|
|
1068
|
+
await b.removeEntry(_, { recursive: !0 }), f += 1;
|
|
1069
|
+
}), await vt(w, ([_, g]) => m(g, _));
|
|
1036
1070
|
};
|
|
1037
|
-
return await
|
|
1071
|
+
return await m(a.handle, ""), { removed: f, existing: r };
|
|
1038
1072
|
}
|
|
1039
1073
|
function Cn(a) {
|
|
1040
1074
|
const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
1041
1075
|
for (const i of Object.keys(a ?? {})) {
|
|
1042
1076
|
const r = Pe(i);
|
|
1043
1077
|
o.add(r.join("/"));
|
|
1044
|
-
for (let
|
|
1078
|
+
for (let f = 1; f < r.length; f += 1) l.add(r.slice(0, f).join("/"));
|
|
1045
1079
|
}
|
|
1046
1080
|
return { wantedFiles: o, wantedDirs: l };
|
|
1047
1081
|
}
|
|
1048
1082
|
async function Co(a, o) {
|
|
1049
|
-
const { wantedFiles: l, wantedDirs: i } = Cn(o), r = /* @__PURE__ */ new Set(),
|
|
1083
|
+
const { wantedFiles: l, wantedDirs: i } = Cn(o), r = /* @__PURE__ */ new Set(), f = async (m, b) => {
|
|
1050
1084
|
const h = [];
|
|
1051
|
-
for (const
|
|
1052
|
-
const
|
|
1053
|
-
if (
|
|
1054
|
-
l.has(
|
|
1085
|
+
for (const v of await Mt(m)) {
|
|
1086
|
+
const w = b ? `${b}/${v.name}` : v.name;
|
|
1087
|
+
if (v.kind === "file") {
|
|
1088
|
+
l.has(w) && r.add(w);
|
|
1055
1089
|
continue;
|
|
1056
1090
|
}
|
|
1057
|
-
i.has(
|
|
1091
|
+
i.has(w) && h.push([w, v]);
|
|
1058
1092
|
}
|
|
1059
|
-
await vt(h, ([
|
|
1093
|
+
await vt(h, ([v, w]) => f(w, v));
|
|
1060
1094
|
};
|
|
1061
|
-
return await
|
|
1095
|
+
return await f(a.handle, ""), r;
|
|
1062
1096
|
}
|
|
1063
1097
|
function Eo(a, o) {
|
|
1064
1098
|
if (a.name === o.blocksDir)
|
|
@@ -1082,20 +1116,20 @@ const Bo = { folders: [], failures: [], truncated: !1 };
|
|
|
1082
1116
|
async function En(a, o, l) {
|
|
1083
1117
|
const i = await Mt(a), r = new Array(i.length);
|
|
1084
1118
|
await vt(i, async (b, h) => {
|
|
1085
|
-
const
|
|
1086
|
-
if (r[h] =
|
|
1119
|
+
const v = o ? `${o}/${b.name}` : b.name, w = { files: {}, failures: [] };
|
|
1120
|
+
if (r[h] = w, b.kind === "directory") {
|
|
1087
1121
|
if (l.skipDirs.includes(b.name)) return;
|
|
1088
|
-
const g = await En(b,
|
|
1122
|
+
const g = await En(b, v, l);
|
|
1089
1123
|
for (const [M, F] of Object.entries(g.files))
|
|
1090
|
-
|
|
1091
|
-
|
|
1124
|
+
w.files[`${b.name}/${M}`] = F;
|
|
1125
|
+
w.failures.push(...g.failures);
|
|
1092
1126
|
return;
|
|
1093
1127
|
}
|
|
1094
1128
|
if (!l.platformFiles.includes(b.name)) {
|
|
1095
1129
|
if (!l.textExt.includes(To(b.name))) {
|
|
1096
|
-
|
|
1130
|
+
w.failures.push({
|
|
1097
1131
|
kind: "file",
|
|
1098
|
-
where:
|
|
1132
|
+
where: v,
|
|
1099
1133
|
message: `不是文本文件(认得的扩展名:${l.textExt.join(" ")}),已跳过`
|
|
1100
1134
|
});
|
|
1101
1135
|
return;
|
|
@@ -1103,37 +1137,37 @@ async function En(a, o, l) {
|
|
|
1103
1137
|
try {
|
|
1104
1138
|
const _ = await b.getFile();
|
|
1105
1139
|
if (_.size > l.maxFileBytes) {
|
|
1106
|
-
|
|
1140
|
+
w.failures.push({
|
|
1107
1141
|
kind: "file",
|
|
1108
|
-
where:
|
|
1142
|
+
where: v,
|
|
1109
1143
|
message: `文件 ${Math.round(_.size / 1024)} KB 超过上限 ${Math.floor(l.maxFileBytes / 1024)} KB,已跳过`
|
|
1110
1144
|
});
|
|
1111
1145
|
return;
|
|
1112
1146
|
}
|
|
1113
|
-
|
|
1147
|
+
w.files[b.name] = So(await _.text());
|
|
1114
1148
|
} catch (_) {
|
|
1115
|
-
|
|
1149
|
+
w.failures.push({ kind: "file", where: v, message: `读不了这个文件:${ee(_)}` });
|
|
1116
1150
|
}
|
|
1117
1151
|
}
|
|
1118
1152
|
});
|
|
1119
|
-
const
|
|
1153
|
+
const f = {}, m = [];
|
|
1120
1154
|
for (const b of r)
|
|
1121
|
-
b && (Object.assign(
|
|
1122
|
-
return { files:
|
|
1155
|
+
b && (Object.assign(f, b.files), m.push(...b.failures));
|
|
1156
|
+
return { files: f, failures: m };
|
|
1123
1157
|
}
|
|
1124
1158
|
async function Sn(a, o, l, i) {
|
|
1125
|
-
const r = await Mt(a),
|
|
1126
|
-
if (
|
|
1159
|
+
const r = await Mt(a), f = r.filter((_) => _.kind === "directory"), m = r.filter((_) => _.kind === "file"), b = o.join("/"), h = { folders: [], failures: [], truncated: !1 };
|
|
1160
|
+
if (f.length === 0 || m.some((_) => _.name === i.entry)) {
|
|
1127
1161
|
const _ = await En(a, b, i);
|
|
1128
1162
|
return h.folders.push({ where: b, files: _.files }), h.failures.push(..._.failures), h;
|
|
1129
1163
|
}
|
|
1130
|
-
for (const _ of
|
|
1164
|
+
for (const _ of m)
|
|
1131
1165
|
o.length === 0 && i.rootSkipFiles.includes(_.name.toLowerCase()) || h.failures.push({
|
|
1132
1166
|
kind: "file",
|
|
1133
1167
|
where: [...o, _.name].join("/"),
|
|
1134
1168
|
message: `这一层直接放着一份文件,但它自己不是块文件夹、也没有 ${i.entry},文件没有归属`
|
|
1135
1169
|
});
|
|
1136
|
-
const
|
|
1170
|
+
const v = f.map((_) => async () => i.skipDirs.includes(_.name) ? Bo : l >= i.maxDepth ? {
|
|
1137
1171
|
folders: [],
|
|
1138
1172
|
failures: [{
|
|
1139
1173
|
kind: "dir",
|
|
@@ -1141,11 +1175,11 @@ async function Sn(a, o, l, i) {
|
|
|
1141
1175
|
message: `超过最大层数 ${i.maxDepth} 层还没见到 ${i.entry},没有继续往下找`
|
|
1142
1176
|
}],
|
|
1143
1177
|
truncated: !0
|
|
1144
|
-
} : Sn(_, [...o, _.name], l + 1, i)),
|
|
1145
|
-
await vt(
|
|
1146
|
-
|
|
1178
|
+
} : Sn(_, [...o, _.name], l + 1, i)), w = new Array(v.length);
|
|
1179
|
+
await vt(v, async (_, g) => {
|
|
1180
|
+
w[g] = await _();
|
|
1147
1181
|
});
|
|
1148
|
-
for (const _ of
|
|
1182
|
+
for (const _ of w)
|
|
1149
1183
|
_ && (h.folders.push(..._.folders), h.failures.push(..._.failures), _.truncated && (h.truncated = !0));
|
|
1150
1184
|
return h;
|
|
1151
1185
|
}
|
|
@@ -1159,7 +1193,7 @@ async function Mo(a, o) {
|
|
|
1159
1193
|
failures: l.failures,
|
|
1160
1194
|
truncated: l.truncated
|
|
1161
1195
|
}, r = i.folders.reduce(
|
|
1162
|
-
(
|
|
1196
|
+
(f, m) => f + Object.values(m.files).reduce((b, h) => b + h.length, 0),
|
|
1163
1197
|
0
|
|
1164
1198
|
);
|
|
1165
1199
|
if (r > o.maxBodyBytes)
|
|
@@ -1174,7 +1208,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1174
1208
|
}, Lo = ["aria-selected"], jo = { class: "mbc__count" }, Do = ["title"], Io = ["aria-selected"], No = ["title"], Fo = {
|
|
1175
1209
|
key: 1,
|
|
1176
1210
|
class: "mbc__chip is-ok"
|
|
1177
|
-
},
|
|
1211
|
+
}, zo = { class: "mbc__body" }, Uo = {
|
|
1178
1212
|
key: 0,
|
|
1179
1213
|
class: "mbc__running"
|
|
1180
1214
|
}, Ho = ["aria-valuenow"], Ko = {
|
|
@@ -1216,7 +1250,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1216
1250
|
}, Pa = ["title", "onClick"], La = {
|
|
1217
1251
|
key: 1,
|
|
1218
1252
|
class: "mbc__tagbar"
|
|
1219
|
-
}, ja = ["title", "onClick"], Da = { class: "mbc__mono" }, Ia = { class: "mbc__actions mbc__actions--row" }, Na = ["disabled", "onClick"], Fa = { class: "mbc__versions" },
|
|
1253
|
+
}, ja = ["title", "onClick"], Da = { class: "mbc__mono" }, Ia = { class: "mbc__actions mbc__actions--row" }, Na = ["disabled", "onClick"], Fa = { class: "mbc__versions" }, za = { class: "mbc__versions-head" }, Ua = ["disabled", "onClick"], Ha = {
|
|
1220
1254
|
key: 0,
|
|
1221
1255
|
class: "mbc__hint"
|
|
1222
1256
|
}, Ka = {
|
|
@@ -1252,7 +1286,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1252
1286
|
}, Nl = { class: "mbc__hint mbc__mono" }, Fl = {
|
|
1253
1287
|
key: 2,
|
|
1254
1288
|
class: "mbc__hint"
|
|
1255
|
-
},
|
|
1289
|
+
}, zl = { class: "mbc__field" }, Ul = ["title"], Hl = {
|
|
1256
1290
|
key: 1,
|
|
1257
1291
|
class: "mbc__chip is-ok"
|
|
1258
1292
|
}, Kl = ["title"], Vl = {
|
|
@@ -1300,7 +1334,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1300
1334
|
}, Fi = {
|
|
1301
1335
|
key: 4,
|
|
1302
1336
|
class: "mbc__hint"
|
|
1303
|
-
},
|
|
1337
|
+
}, zi = { class: "mbc__modal-foot" }, Ui = { class: "mbc__modal-box" }, Hi = { class: "mbc__modal-head" }, Ki = { class: "mbc__modal-body" }, Vi = { class: "mbc__reports" }, qi = { class: "mbc__report-head" }, Ji = { class: "mbc__mono" }, Gi = { class: "mbc__report-text" }, Wi = {
|
|
1304
1338
|
key: 0,
|
|
1305
1339
|
class: "mbc__hint"
|
|
1306
1340
|
}, Yi = { class: "mbc__modal-foot" }, xe = 2, Zi = 100, Xi = 250, Qi = /* @__PURE__ */ Re({
|
|
@@ -1314,8 +1348,8 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1314
1348
|
两种情形共用它(前端声明了、手里却还没有那个文件夹 / 手里那个文件夹的清单 id 库里没有)
|
|
1315
1349
|
—— 对用户是同一件事:这个块不在库里。 */
|
|
1316
1350
|
"not-in-db": "不在数据库"
|
|
1317
|
-
}, l = o["not-in-db"], { isStaff: i } = dn(), r = cn(), { active:
|
|
1318
|
-
function
|
|
1351
|
+
}, l = o["not-in-db"], { isStaff: i } = dn(), r = cn(), { active: f } = ps(), m = (n) => !pn(n, r), b = x(!1), h = x(""), v = x([]), w = x(""), _ = x(""), g = x(""), M = x([]), F = x(!1), B = x(!1), R = x("blocks"), L = x(""), G = x([]), pt = x(""), Z = x(""), gt = x(""), yt = x(""), C = x(!1), Lt = x(!1), lt = x(!1), kt = x(!1), nt = x(!1), K = x(null), z = x(null), X = x("one"), $t = x(Ht()), bt = O(() => v.value.find((n) => n.id === $t.value) ?? null), wt = () => X.value === "all" ? {} : { blocks: [$t.value] };
|
|
1352
|
+
function Ut(n) {
|
|
1319
1353
|
$t.value = n;
|
|
1320
1354
|
try {
|
|
1321
1355
|
window.localStorage.setItem("mb:export-block", n);
|
|
@@ -1329,10 +1363,10 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1329
1363
|
return "";
|
|
1330
1364
|
}
|
|
1331
1365
|
}
|
|
1332
|
-
Ot(
|
|
1333
|
-
n.length !== 0 && (n.some((t) => t.id === $t.value) ||
|
|
1366
|
+
Ot(v, (n) => {
|
|
1367
|
+
n.length !== 0 && (n.some((t) => t.id === $t.value) || Ut(n[0].id));
|
|
1334
1368
|
});
|
|
1335
|
-
const Q =
|
|
1369
|
+
const Q = x(null), V = x(""), A = x(null), it = x({}), W = x([]), Y = x([]), st = x({}), $ = x(""), E = x(null);
|
|
1336
1370
|
async function j(n) {
|
|
1337
1371
|
$.value = n;
|
|
1338
1372
|
try {
|
|
@@ -1351,7 +1385,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1351
1385
|
function jt(n) {
|
|
1352
1386
|
return n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
1353
1387
|
}
|
|
1354
|
-
const
|
|
1388
|
+
const U = x(null);
|
|
1355
1389
|
function Dt(n, t) {
|
|
1356
1390
|
return `${String(t || "").replace(/[\\/:*?"<>|]/g, "").trim() || "block"}-${n}`;
|
|
1357
1391
|
}
|
|
@@ -1364,10 +1398,10 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1364
1398
|
} catch {
|
|
1365
1399
|
e = null, u = null;
|
|
1366
1400
|
}
|
|
1367
|
-
|
|
1401
|
+
U.value = { row: n, target: e, folder: t, inventory: u };
|
|
1368
1402
|
}, C), se = () => J(async () => {
|
|
1369
|
-
const n =
|
|
1370
|
-
if (
|
|
1403
|
+
const n = U.value;
|
|
1404
|
+
if (U.value = null, !n) return;
|
|
1371
1405
|
const t = `「${n.row.module} / ${n.row.name || n.row.id}」`;
|
|
1372
1406
|
je(), N.value = { active: !0, percent: 0, stage: "清本机那个文件夹…", failed: !1 };
|
|
1373
1407
|
let e = "";
|
|
@@ -1394,7 +1428,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1394
1428
|
e = await e.getDirectoryHandle(u, { create: !0 });
|
|
1395
1429
|
return { handle: e, name: `${n.name}/${t}` };
|
|
1396
1430
|
}
|
|
1397
|
-
const q =
|
|
1431
|
+
const q = x(null), Kt = x(!1), N = x({ active: !1, percent: 0, stage: "", failed: !1 }), Tn = O(() => ({
|
|
1398
1432
|
width: `${Math.max(0, Math.min(100, N.value.percent))}%`,
|
|
1399
1433
|
background: N.value.failed ? "var(--sp-color-danger)" : "var(--sp-color-primary, var(--primary-color))"
|
|
1400
1434
|
}));
|
|
@@ -1419,8 +1453,8 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1419
1453
|
}
|
|
1420
1454
|
const De = (n) => (n.disabledReason ?? "").trim(), ie = (n) => (n.issues ?? []).map((t) => String(t?.message ?? "")).filter(Boolean), Vt = (n) => Gs(n.id);
|
|
1421
1455
|
function Bn(n) {
|
|
1422
|
-
|
|
1423
|
-
const t =
|
|
1456
|
+
w.value = w.value === n.id ? "" : n.id, w.value === n.id && j(n.id);
|
|
1457
|
+
const t = f.value;
|
|
1424
1458
|
wn(n.id);
|
|
1425
1459
|
const e = n.name || n.id, u = Vt(n);
|
|
1426
1460
|
if (u.length === 0) {
|
|
@@ -1431,7 +1465,7 @@ const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
|
1431
1465
|
g.value = `「${e}」就在这一条标签上(${u.join(" / ")}):已经把它标红`;
|
|
1432
1466
|
return;
|
|
1433
1467
|
}
|
|
1434
|
-
const S = Ws(n.id, t,
|
|
1468
|
+
const S = Ws(n.id, t, m);
|
|
1435
1469
|
if (S) {
|
|
1436
1470
|
g.value = `「${e}」不在这一条标签上:正在切到 ${S} 那条标签`, Ee(S);
|
|
1437
1471
|
return;
|
|
@@ -1497,9 +1531,9 @@ ${e}` : e;
|
|
|
1497
1531
|
}
|
|
1498
1532
|
const Ne = O(() => {
|
|
1499
1533
|
const n = h.value.trim().toLowerCase();
|
|
1500
|
-
return
|
|
1501
|
-
}), qt = O(() => (A.value?.blocks ?? []).filter((n) => n.canApply)), Jt = O(() => qt.value.filter((n) => it.value[n.id] === !0)), At =
|
|
1502
|
-
function
|
|
1534
|
+
return v.value.filter((t) => Nn(t) ? n ? `${t.module} ${t.name} ${t.brief} ${t.detail ?? ""} ${t.id} v${t.version ?? ""} ${(t.tags ?? []).join(" ")}`.toLowerCase().includes(n) : !0 : !1);
|
|
1535
|
+
}), qt = O(() => (A.value?.blocks ?? []).filter((n) => n.canApply)), Jt = O(() => qt.value.filter((n) => it.value[n.id] === !0)), At = x(!1), rt = O(() => W.value.length + (A.value?.failures ?? []).length + Y.value.filter((n) => !n.ok).length), It = O(() => Y.value.filter((n) => !n.ok)), ue = O(() => Y.value.filter((n) => n.ok).length), re = O(() => v.value.filter((n) => n.enabled === !1).length);
|
|
1536
|
+
function zn() {
|
|
1503
1537
|
const n = /* @__PURE__ */ new Set(), t = [];
|
|
1504
1538
|
for (const e of Fe()) {
|
|
1505
1539
|
const u = typeof e?.path == "string" ? e.path.trim() : "";
|
|
@@ -1517,11 +1551,11 @@ ${e}` : e;
|
|
|
1517
1551
|
function Fe() {
|
|
1518
1552
|
return r?.getRoutes?.() ?? [];
|
|
1519
1553
|
}
|
|
1520
|
-
const ce = O(() => bo(Fe(), ro,
|
|
1554
|
+
const ce = O(() => bo(Fe(), ro, v.value.map((n) => n.id)));
|
|
1521
1555
|
function Rt(n) {
|
|
1522
1556
|
return (n instanceof Error ? n.message.trim() : String(n)) || "请求没有到达后端(网络或登录态的问题),请重试";
|
|
1523
1557
|
}
|
|
1524
|
-
function
|
|
1558
|
+
function Un(n) {
|
|
1525
1559
|
const t = n?.issues;
|
|
1526
1560
|
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : String(e?.message ?? "")).filter(Boolean) : [];
|
|
1527
1561
|
}
|
|
@@ -1535,7 +1569,7 @@ ${e}` : e;
|
|
|
1535
1569
|
credentials: "include",
|
|
1536
1570
|
headers: { "Content-Type": "application/json", ...te("POST", !0) },
|
|
1537
1571
|
body: e
|
|
1538
|
-
}).then((mt) => mt.json()).catch(() => null), P =
|
|
1572
|
+
}).then((mt) => mt.json()).catch(() => null), P = Un(D);
|
|
1539
1573
|
throw P.length === 0 ? new Error(S) : new Error(`${String(D?.message ?? S)}
|
|
1540
1574
|
- ${P.join(`
|
|
1541
1575
|
- `)}`);
|
|
@@ -1584,7 +1618,7 @@ ${t.text}`).join(`
|
|
|
1584
1618
|
async function Et() {
|
|
1585
1619
|
try {
|
|
1586
1620
|
const n = await at("/magic-blocks/index");
|
|
1587
|
-
|
|
1621
|
+
v.value = n.blocks ?? [], G.value = n.tags ?? [];
|
|
1588
1622
|
} catch (n) {
|
|
1589
1623
|
Nt(n, "读块清单");
|
|
1590
1624
|
}
|
|
@@ -1592,7 +1626,7 @@ ${t.text}`).join(`
|
|
|
1592
1626
|
async function J(n, t, e = "") {
|
|
1593
1627
|
t.value = !0, de();
|
|
1594
1628
|
try {
|
|
1595
|
-
await n(),
|
|
1629
|
+
await n(), zs();
|
|
1596
1630
|
} catch (u) {
|
|
1597
1631
|
Nt(u, e || "这个动作");
|
|
1598
1632
|
} finally {
|
|
@@ -1606,9 +1640,9 @@ ${t.text}`).join(`
|
|
|
1606
1640
|
} finally {
|
|
1607
1641
|
Lt.value = !1;
|
|
1608
1642
|
}
|
|
1609
|
-
}, C),
|
|
1643
|
+
}, C), ze = (n) => J(async () => {
|
|
1610
1644
|
const t = await $e();
|
|
1611
|
-
n === "export" ? (K.value = t,
|
|
1645
|
+
n === "export" ? (K.value = t, z.value || (z.value = t)) : (z.value = t, K.value || (K.value = t)), g.value = n === "export" ? `导出目录:${t.name}${z.value === t ? "(读回目录也填成它了)" : ""}` : `读回目录:${t.name}`;
|
|
1612
1646
|
}, C);
|
|
1613
1647
|
async function pe() {
|
|
1614
1648
|
if (Q.value) return Q.value;
|
|
@@ -1622,7 +1656,7 @@ ${t.text}`).join(`
|
|
|
1622
1656
|
lt.value = !0, g.value = "", V.value = "", de(), je(), Gt.length = 0, N.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
|
|
1623
1657
|
try {
|
|
1624
1658
|
const n = K.value ?? await $e();
|
|
1625
|
-
K.value = n,
|
|
1659
|
+
K.value = n, z.value || (z.value = n);
|
|
1626
1660
|
const t = Ct("/magic-blocks/export", wt()), e = be(), u = Q.value ? we(n, Q.value) : null, S = await St("取包", t);
|
|
1627
1661
|
Q.value = S.rules, Eo(n, S.rules);
|
|
1628
1662
|
const D = u ? await St("数目录", u) : await St("数目录", we(n, S.rules));
|
|
@@ -1636,7 +1670,7 @@ ${t.text}`).join(`
|
|
|
1636
1670
|
} finally {
|
|
1637
1671
|
lt.value = !1;
|
|
1638
1672
|
}
|
|
1639
|
-
}, C),
|
|
1673
|
+
}, C), Ue = /* @__PURE__ */ new WeakMap(), Gt = [];
|
|
1640
1674
|
function He(n, t) {
|
|
1641
1675
|
Gt.push([n, Math.round(performance.now() - t)]);
|
|
1642
1676
|
}
|
|
@@ -1667,7 +1701,7 @@ ${t.text}`).join(`
|
|
|
1667
1701
|
const { clean: u, verify: S, thorough: D, front: P } = e;
|
|
1668
1702
|
try {
|
|
1669
1703
|
ot(20, "准备写盘…");
|
|
1670
|
-
const mt = vo(
|
|
1704
|
+
const mt = vo(zn()), ct = { ...t.files };
|
|
1671
1705
|
ct[ke] = mt, P.css && (ct[Tt] = P.css), P.controls && (ct[Qt] = P.controls), t.exampleDir && (ct[`${t.exampleDir}/${ke}`] = mt, P.css && (ct[`${t.exampleDir}/${Tt}`] = P.css), P.controls && (ct[`${t.exampleDir}/${Qt}`] = P.controls));
|
|
1672
1706
|
const ts = P.note;
|
|
1673
1707
|
await new Promise((et) => {
|
|
@@ -1680,7 +1714,7 @@ ${t.text}`).join(`
|
|
|
1680
1714
|
fe = et.existing, Ge = et.removed > 0 ? `,先清掉了 ${et.removed} 项` : ",没有多余的东西要清";
|
|
1681
1715
|
} else
|
|
1682
1716
|
ot(35, "看一眼目录里有什么…"), fe = await St("看目录", Co(n, ct));
|
|
1683
|
-
const es =
|
|
1717
|
+
const es = Ue.get(n.handle), ns = Object.keys(ct).length, ve = u ? 45 : 30;
|
|
1684
1718
|
ot(ve, `写文件 0/${ns}…`);
|
|
1685
1719
|
let We = 0;
|
|
1686
1720
|
const ss = performance.now(), tt = await $o(n, ct, (et, he) => {
|
|
@@ -1692,7 +1726,7 @@ ${t.text}`).join(`
|
|
|
1692
1726
|
trust: D ? void 0 : es,
|
|
1693
1727
|
existing: fe
|
|
1694
1728
|
});
|
|
1695
|
-
He("写盘", ss),
|
|
1729
|
+
He("写盘", ss), Ue.set(n.handle, tt.fingerprints), ot(98, "收尾…");
|
|
1696
1730
|
const os = tt.failed.length > 0 ? `;⚠️ ${tt.failed.length} 个文件没写成:${tt.failed.slice(0, 3).map((et) => `${et.path}(${et.message})`).join("、")}` + (tt.failed.length > 3 ? ` 等 ${tt.failed.length} 条` : "") : "", Wt = [];
|
|
1697
1731
|
tt.skipped > 0 && Wt.push(`${tt.skipped} 个与库里一字不差(逐字节比过)`), tt.trusted > 0 && Wt.push(`${tt.trusted} 个按上一趟的账本跳过(没再碰磁盘)`);
|
|
1698
1732
|
const as = Wt.length > 0 ? `,跳过 ${Wt.join(" / ")}` : "";
|
|
@@ -1734,8 +1768,8 @@ ${t.text}`).join(`
|
|
|
1734
1768
|
q.value = null, N.value = { active: !1, percent: 0, stage: "", failed: !1 }, g.value = "这次没有导出(目录里的东西一个字节都没动)", V.value = "";
|
|
1735
1769
|
}
|
|
1736
1770
|
const Ke = () => J(async () => {
|
|
1737
|
-
const n =
|
|
1738
|
-
|
|
1771
|
+
const n = z.value ?? await $e();
|
|
1772
|
+
z.value = n, K.value || (K.value = n), kt.value = !0, g.value = "", W.value = [], Y.value = [];
|
|
1739
1773
|
try {
|
|
1740
1774
|
const t = await pe().catch((P) => {
|
|
1741
1775
|
throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${Rt(P)}`);
|
|
@@ -1779,7 +1813,7 @@ ${t.text}`).join(`
|
|
|
1779
1813
|
}
|
|
1780
1814
|
function qe(n) {
|
|
1781
1815
|
const t = n.detail?.uuid ?? "";
|
|
1782
|
-
b.value = !0,
|
|
1816
|
+
b.value = !0, w.value = t;
|
|
1783
1817
|
}
|
|
1784
1818
|
function Je(n) {
|
|
1785
1819
|
n.key === "Escape" && b.value && (b.value = !1);
|
|
@@ -1807,8 +1841,8 @@ ${t.text}`).join(`
|
|
|
1807
1841
|
t[43] || (t[43] = s("strong", { class: "mbc__brand" }, "magic block", -1)),
|
|
1808
1842
|
s("span", {
|
|
1809
1843
|
class: "mbc__count",
|
|
1810
|
-
title: `库里一共 ${
|
|
1811
|
-
}, p(
|
|
1844
|
+
title: `库里一共 ${v.value.length} 个块`
|
|
1845
|
+
}, p(v.value.length) + " 个块", 9, Ro),
|
|
1812
1846
|
t[44] || (t[44] = s("span", { class: "mbc__grow" }, null, -1)),
|
|
1813
1847
|
s("button", {
|
|
1814
1848
|
class: "p-button p-button-sm p-button-text",
|
|
@@ -1831,7 +1865,7 @@ ${t.text}`).join(`
|
|
|
1831
1865
|
onClick: t[3] || (t[3] = (e) => R.value = "blocks")
|
|
1832
1866
|
}, [
|
|
1833
1867
|
t[45] || (t[45] = y(" 块 ", -1)),
|
|
1834
|
-
s("span", jo, p(
|
|
1868
|
+
s("span", jo, p(v.value.length), 1),
|
|
1835
1869
|
re.value > 0 ? (c(), d("span", {
|
|
1836
1870
|
key: 0,
|
|
1837
1871
|
class: "mbc__chip is-bad",
|
|
@@ -1853,8 +1887,8 @@ ${t.text}`).join(`
|
|
|
1853
1887
|
}, p(rt.value), 9, No)) : Y.value.length > 0 ? (c(), d("span", Fo, p(ue.value) + " 存成", 1)) : k("", !0)
|
|
1854
1888
|
], 10, Io)
|
|
1855
1889
|
]),
|
|
1856
|
-
s("div",
|
|
1857
|
-
N.value.active ? (c(), d("div",
|
|
1890
|
+
s("div", zo, [
|
|
1891
|
+
N.value.active ? (c(), d("div", Uo, [
|
|
1858
1892
|
s("div", {
|
|
1859
1893
|
class: H(["mbc__progress", { "is-failed": N.value.failed }]),
|
|
1860
1894
|
role: "progressbar",
|
|
@@ -1919,15 +1953,15 @@ ${t.text}`).join(`
|
|
|
1919
1953
|
}, "取消", 8, Xo)
|
|
1920
1954
|
])
|
|
1921
1955
|
])) : k("", !0),
|
|
1922
|
-
|
|
1923
|
-
s("p", ta, "删掉「" + p(
|
|
1956
|
+
U.value ? (c(), d("div", Qo, [
|
|
1957
|
+
s("p", ta, "删掉「" + p(U.value.row.module) + " / " + p(U.value.row.name || U.value.row.id) + "」的代码文件", 1),
|
|
1924
1958
|
s("p", ea, [
|
|
1925
1959
|
t[66] || (t[66] = s("b", null, "库里那一份代码正文会被清空", -1)),
|
|
1926
1960
|
t[67] || (t[67] = y("(入口 / 清单 / 后端一起); ", -1)),
|
|
1927
|
-
|
|
1961
|
+
U.value.target ? (c(), d(T, { key: 0 }, [
|
|
1928
1962
|
t[58] || (t[58] = y(" 同时清掉你本机那个块文件夹 ", -1)),
|
|
1929
|
-
s("span", na, p(
|
|
1930
|
-
|
|
1963
|
+
s("span", na, p(U.value.target.name) + "/" + p(U.value.folder), 1),
|
|
1964
|
+
U.value.inventory && U.value.inventory.items.some((e) => e.name === U.value?.folder) ? (c(), d(T, { key: 0 }, [
|
|
1931
1965
|
y(" (它现在在顶层,里面有东西:本次会先清空)。 ")
|
|
1932
1966
|
], 64)) : k("", !0),
|
|
1933
1967
|
t[59] || (t[59] = s("b", null, "只动这一个块的文件夹", -1)),
|
|
@@ -1955,14 +1989,14 @@ ${t.text}`).join(`
|
|
|
1955
1989
|
class: "p-button p-button-sm p-button-text",
|
|
1956
1990
|
type: "button",
|
|
1957
1991
|
disabled: C.value,
|
|
1958
|
-
onClick: t[10] || (t[10] = (e) =>
|
|
1992
|
+
onClick: t[10] || (t[10] = (e) => U.value = null)
|
|
1959
1993
|
}, "取消", 8, aa)
|
|
1960
1994
|
])
|
|
1961
1995
|
])) : k("", !0),
|
|
1962
1996
|
ft(s("section", la, [
|
|
1963
1997
|
s("h3", ia, [
|
|
1964
1998
|
t[72] || (t[72] = y(" 库里的块 ", -1)),
|
|
1965
|
-
s("span", ua, p(Ne.value.length) + " / " + p(
|
|
1999
|
+
s("span", ua, p(Ne.value.length) + " / " + p(v.value.length), 1),
|
|
1966
2000
|
L.value.trim() ? (c(), d("span", ra, "标签:" + p(L.value), 1)) : k("", !0)
|
|
1967
2001
|
]),
|
|
1968
2002
|
ft(s("input", {
|
|
@@ -2003,7 +2037,7 @@ ${t.text}`).join(`
|
|
|
2003
2037
|
}, [
|
|
2004
2038
|
s("button", {
|
|
2005
2039
|
type: "button",
|
|
2006
|
-
class: H(["mbc__row", { "is-active": e.id ===
|
|
2040
|
+
class: H(["mbc__row", { "is-active": e.id === w.value, "is-off": e.enabled === !1 }]),
|
|
2007
2041
|
title: Fn(e),
|
|
2008
2042
|
onClick: (u) => Bn(e)
|
|
2009
2043
|
}, [
|
|
@@ -2032,7 +2066,7 @@ ${t.text}`).join(`
|
|
|
2032
2066
|
title: e.detail
|
|
2033
2067
|
}, p(e.detail), 9, _a)) : k("", !0)
|
|
2034
2068
|
], 10, ba),
|
|
2035
|
-
|
|
2069
|
+
w.value === e.id ? (c(), d("div", ga, [
|
|
2036
2070
|
(c(!0), d(T, null, I(ie(e).slice(0, xe), (u, S) => (c(), d("p", {
|
|
2037
2071
|
key: S,
|
|
2038
2072
|
class: "mbc__problem"
|
|
@@ -2156,14 +2190,14 @@ ${t.text}`).join(`
|
|
|
2156
2190
|
}, "删除代码文件", 8, Na)
|
|
2157
2191
|
]),
|
|
2158
2192
|
s("div", Fa, [
|
|
2159
|
-
s("div",
|
|
2193
|
+
s("div", za, [
|
|
2160
2194
|
t[83] || (t[83] = s("strong", null, "版本(每次上传 +1,旧的都留着)", -1)),
|
|
2161
2195
|
s("button", {
|
|
2162
2196
|
class: "p-button p-button-sm p-button-text",
|
|
2163
2197
|
type: "button",
|
|
2164
2198
|
disabled: C.value,
|
|
2165
2199
|
onClick: (u) => j(e.id)
|
|
2166
|
-
}, p($.value === e.id ? "读版本中…" : "刷新版本"), 9,
|
|
2200
|
+
}, p($.value === e.id ? "读版本中…" : "刷新版本"), 9, Ua)
|
|
2167
2201
|
]),
|
|
2168
2202
|
st.value[e.id] ? st.value[e.id].length > 0 ? (c(), d("ul", Ka, [
|
|
2169
2203
|
(c(!0), d(T, null, I(st.value[e.id], (u) => (c(), d("li", {
|
|
@@ -2267,17 +2301,17 @@ ${t.text}`).join(`
|
|
|
2267
2301
|
checked: X.value === "all",
|
|
2268
2302
|
onChange: t[21] || (t[21] = (e) => X.value = "all")
|
|
2269
2303
|
}, null, 40, cl),
|
|
2270
|
-
y(" 全部块(" + p(
|
|
2304
|
+
y(" 全部块(" + p(v.value.length) + " 个) ", 1)
|
|
2271
2305
|
]),
|
|
2272
2306
|
X.value === "one" ? (c(), d("select", {
|
|
2273
2307
|
key: 0,
|
|
2274
2308
|
class: "p-inputtext p-component mbc__grow",
|
|
2275
2309
|
value: $t.value,
|
|
2276
|
-
disabled: C.value ||
|
|
2277
|
-
onChange: t[22] || (t[22] = (e) =>
|
|
2310
|
+
disabled: C.value || v.value.length === 0,
|
|
2311
|
+
onChange: t[22] || (t[22] = (e) => Ut(e.target.value))
|
|
2278
2312
|
}, [
|
|
2279
|
-
|
|
2280
|
-
(c(!0), d(T, null, I(
|
|
2313
|
+
v.value.length === 0 ? (c(), d("option", pl, "(库里还没有块)")) : k("", !0),
|
|
2314
|
+
(c(!0), d(T, null, I(v.value, (e) => (c(), d("option", {
|
|
2281
2315
|
key: e.id,
|
|
2282
2316
|
value: e.id
|
|
2283
2317
|
}, p(e.module) + " / " + p(e.name || e.id), 9, bl))), 128))
|
|
@@ -2296,7 +2330,7 @@ ${t.text}`).join(`
|
|
|
2296
2330
|
class: "p-button p-button-sm p-button-outlined",
|
|
2297
2331
|
type: "button",
|
|
2298
2332
|
disabled: C.value,
|
|
2299
|
-
onClick: t[23] || (t[23] = (e) =>
|
|
2333
|
+
onClick: t[23] || (t[23] = (e) => ze("export"))
|
|
2300
2334
|
}, "选择文件夹", 8, vl),
|
|
2301
2335
|
s("button", {
|
|
2302
2336
|
class: "p-button p-button-sm mbc__act-export",
|
|
@@ -2307,7 +2341,7 @@ ${t.text}`).join(`
|
|
|
2307
2341
|
}, p(lt.value ? "导出中…" : "导出"), 9, hl)
|
|
2308
2342
|
]),
|
|
2309
2343
|
s("p", _l, [
|
|
2310
|
-
y(p(X.value === "all" ? `这一趟铺全部 ${
|
|
2344
|
+
y(p(X.value === "all" ? `这一趟铺全部 ${v.value.length} 个块` : bt.value ? `这一趟只铺「${bt.value.module} / ${bt.value.name || bt.value.id}」` : "先挑一个块") + " ⇒ ", 1),
|
|
2311
2345
|
t[89] || (t[89] = s("span", { class: "mbc__mono" }, "workspace/<可读名>-<块 uuid>/", -1)),
|
|
2312
2346
|
t[90] || (t[90] = y(",顶层另附开发说明与 ", -1)),
|
|
2313
2347
|
t[91] || (t[91] = s("span", { class: "mbc__mono" }, "example/", -1)),
|
|
@@ -2326,13 +2360,13 @@ ${t.text}`).join(`
|
|
|
2326
2360
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
2327
2361
|
type: "text",
|
|
2328
2362
|
readonly: "",
|
|
2329
|
-
value:
|
|
2363
|
+
value: z.value ? z.value.name : "(还没选:导出会自动填上,也可以自己选一个)"
|
|
2330
2364
|
}, null, 8, $l),
|
|
2331
2365
|
s("button", {
|
|
2332
2366
|
class: "p-button p-button-sm p-button-outlined",
|
|
2333
2367
|
type: "button",
|
|
2334
2368
|
disabled: C.value,
|
|
2335
|
-
onClick: t[25] || (t[25] = (e) =>
|
|
2369
|
+
onClick: t[25] || (t[25] = (e) => ze("read"))
|
|
2336
2370
|
}, "选择文件夹", 8, wl),
|
|
2337
2371
|
s("button", {
|
|
2338
2372
|
class: "p-button p-button-sm p-button-outlined",
|
|
@@ -2341,7 +2375,7 @@ ${t.text}`).join(`
|
|
|
2341
2375
|
onClick: t[26] || (t[26] = (e) => Ke())
|
|
2342
2376
|
}, p(kt.value ? "读回中…" : "读回改动"), 9, xl)
|
|
2343
2377
|
]),
|
|
2344
|
-
|
|
2378
|
+
z.value && K.value && z.value.name !== K.value.name ? (c(), d("p", Cl, " 读回的是「" + p(z.value.name) + "」(与导出目录「" + p(K.value.name) + "」不是同一个 —— 想同步就再选一次)。 ", 1)) : (c(), d("p", El, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
|
|
2345
2379
|
A.value ? (c(), d(T, { key: 2 }, [
|
|
2346
2380
|
qt.value.length > 0 ? (c(), d("p", Sl, [
|
|
2347
2381
|
t[96] || (t[96] = y(" 扫到 ", -1)),
|
|
@@ -2404,14 +2438,14 @@ ${t.text}`).join(`
|
|
|
2404
2438
|
s("p", Nl, p(e.folder || e.where), 1)
|
|
2405
2439
|
], 2))), 128))
|
|
2406
2440
|
])) : (c(), d("p", Fl, "这个目录里没有认出任何块(点上面那个按钮再扫一次,或者确认文件夹名里有那个块的 uuid)。")),
|
|
2407
|
-
s("div",
|
|
2441
|
+
s("div", zl, [
|
|
2408
2442
|
rt.value > 0 ? (c(), d("button", {
|
|
2409
2443
|
key: 0,
|
|
2410
2444
|
class: "p-button p-button-sm mbc__report-btn",
|
|
2411
2445
|
type: "button",
|
|
2412
2446
|
title: "点开看这一趟的全部问题(" + rt.value + " 条)",
|
|
2413
2447
|
onClick: t[29] || (t[29] = (e) => At.value = !0)
|
|
2414
|
-
}, "查看问题(" + p(rt.value) + ")⚠", 9,
|
|
2448
|
+
}, "查看问题(" + p(rt.value) + ")⚠", 9, Ul)) : (c(), d("span", Hl, "这一趟没有问题")),
|
|
2415
2449
|
A.value.unmatched.length > 0 ? (c(), d("span", {
|
|
2416
2450
|
key: 2,
|
|
2417
2451
|
class: "mbc__chip is-bad",
|
|
@@ -2571,7 +2605,7 @@ ${t.text}`).join(`
|
|
|
2571
2605
|
])) : k("", !0),
|
|
2572
2606
|
rt.value === 0 ? (c(), d("p", Fi, "这一趟没有问题。")) : k("", !0)
|
|
2573
2607
|
]),
|
|
2574
|
-
s("footer",
|
|
2608
|
+
s("footer", zi, [
|
|
2575
2609
|
s("button", {
|
|
2576
2610
|
class: "p-button p-button-sm p-button-outlined",
|
|
2577
2611
|
type: "button",
|
|
@@ -2592,7 +2626,7 @@ ${t.text}`).join(`
|
|
|
2592
2626
|
"aria-modal": "true",
|
|
2593
2627
|
onClick: t[41] || (t[41] = Ce((e) => F.value = !1, ["self"]))
|
|
2594
2628
|
}, [
|
|
2595
|
-
s("div",
|
|
2629
|
+
s("div", Ui, [
|
|
2596
2630
|
s("header", Hi, [
|
|
2597
2631
|
s("strong", null, "报错(" + p(M.value.length) + " 条)", 1),
|
|
2598
2632
|
s("button", {
|
|
@@ -2645,7 +2679,7 @@ ${t.text}`).join(`
|
|
|
2645
2679
|
export {
|
|
2646
2680
|
cs as API_BASE,
|
|
2647
2681
|
Rs as BLOCK_BACKEND_FILE,
|
|
2648
|
-
|
|
2682
|
+
zt as BLOCK_ENTRY,
|
|
2649
2683
|
_e as BLOCK_MANIFEST,
|
|
2650
2684
|
ms as CLIENT_SOURCE,
|
|
2651
2685
|
ge as MANIFEST_KEYS,
|
|
@@ -2659,10 +2693,10 @@ export {
|
|
|
2659
2693
|
co as declaredUuidOf,
|
|
2660
2694
|
po as declaredUuidsOf,
|
|
2661
2695
|
hs as installBridge,
|
|
2662
|
-
|
|
2696
|
+
Us as loadBlockRender,
|
|
2663
2697
|
Fs as onBlockRenderRefresh,
|
|
2664
2698
|
Ts as parseManifest,
|
|
2665
|
-
|
|
2699
|
+
zs as refreshBlockRender,
|
|
2666
2700
|
Bs as validFileName,
|
|
2667
2701
|
ws as validName,
|
|
2668
2702
|
Ms as validateBlock
|