labull-framework 0.1.24 → 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 +1480 -1340
- package/dist/style.css +1 -1
- package/dist/types/magic-block-localfs.d.ts +61 -5
- package/package.json +1 -1
package/dist/magic-block.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { A as
|
|
4
|
-
import { u as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as 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
|
+
import { useRouter as cn, useRoute as rs } from "vue-router";
|
|
3
|
+
import { A as cs, b as at, c as te, u as dn } from "./chunk-index-BWpDbB19.js";
|
|
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";
|
|
5
|
+
const dt = "__mb", mn = "call", Se = "reply", fn = "host-ready", vn = "height", bs = "html, body { overflow: hidden !important; }", ms = `
|
|
6
6
|
(function () {
|
|
7
7
|
var seq = 0, waiting = {}, queue = [], ready = false, last = -1;
|
|
8
8
|
function call(method, args) {
|
|
@@ -10,16 +10,16 @@ const lt = "__mb", on = "call", ye = "reply", an = "host-ready", ln = "height",
|
|
|
10
10
|
function run() {
|
|
11
11
|
var id = ++seq;
|
|
12
12
|
waiting[id] = { resolve: resolve, reject: reject };
|
|
13
|
-
parent.postMessage({ '${
|
|
13
|
+
parent.postMessage({ '${dt}': '${mn}', id: id, method: method, args: args }, '*');
|
|
14
14
|
}
|
|
15
15
|
if (ready) run(); else queue.push(run);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
window.addEventListener('message', function (event) {
|
|
19
19
|
var data = event.data, pending;
|
|
20
|
-
if (!data || data['${
|
|
21
|
-
if (data['${
|
|
22
|
-
if (data['${
|
|
20
|
+
if (!data || data['${dt}'] === undefined) return;
|
|
21
|
+
if (data['${dt}'] === '${fn}') { ready = true; queue.splice(0).forEach(function (run) { run(); }); return; }
|
|
22
|
+
if (data['${dt}'] !== '${Se}') return;
|
|
23
23
|
if (!(pending = waiting[data.id])) return;
|
|
24
24
|
delete waiting[data.id];
|
|
25
25
|
if (data.ok) pending.resolve(data.value); else pending.reject(new Error(data.error || '调用失败'));
|
|
@@ -60,7 +60,7 @@ const lt = "__mb", on = "call", ye = "reply", an = "host-ready", ln = "height",
|
|
|
60
60
|
if (height > 0) height += 1;
|
|
61
61
|
if (height === last) return; /* 一样高就不再发:否则「宿主改高度 → 触发观察 → 又发一次」会转个不停 */
|
|
62
62
|
last = height;
|
|
63
|
-
parent.postMessage({ '${
|
|
63
|
+
parent.postMessage({ '${dt}': '${vn}', height: height }, '*');
|
|
64
64
|
}
|
|
65
65
|
function start() {
|
|
66
66
|
report();
|
|
@@ -69,30 +69,30 @@ const lt = "__mb", on = "call", ye = "reply", an = "host-ready", ln = "height",
|
|
|
69
69
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
70
70
|
setInterval(report, 500);
|
|
71
71
|
})();
|
|
72
|
-
`,
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
return new URL(`${
|
|
72
|
+
`, fs = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
|
|
73
|
+
function hn(a) {
|
|
74
|
+
const o = typeof window > "u" ? "http://localhost" : window.location.href;
|
|
75
|
+
return new URL(`${cs}${a}`, o);
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const Xe = (() => {
|
|
78
78
|
try {
|
|
79
|
-
return
|
|
79
|
+
return hn("").origin;
|
|
80
80
|
} catch {
|
|
81
81
|
return typeof window > "u" ? "" : window.location.origin;
|
|
82
82
|
}
|
|
83
83
|
})();
|
|
84
|
-
async function
|
|
85
|
-
if (!
|
|
86
|
-
const i =
|
|
87
|
-
if (i.origin !==
|
|
88
|
-
const
|
|
84
|
+
async function vs(a, o, l) {
|
|
85
|
+
if (!fs.test(o)) throw new Error(`路由名不合法:${o}(要写成 类名.方法名,例如 Customer.create)`);
|
|
86
|
+
const i = hn(`/bx/${a}/${o}`);
|
|
87
|
+
if (i.origin !== Xe) throw new Error(`后端地址必须是本应用的(${Xe}):${i.origin}`);
|
|
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
|
-
headers:
|
|
93
|
-
body:
|
|
94
|
-
}), m = await
|
|
95
|
-
if (
|
|
92
|
+
headers: r ? { "Content-Type": r.type || "application/octet-stream", ...te("POST") } : { "Content-Type": "application/json", ...te("POST") },
|
|
93
|
+
body: r ?? JSON.stringify(l ?? {})
|
|
94
|
+
}), m = await f.text().catch(() => "");
|
|
95
|
+
if (f.ok) {
|
|
96
96
|
if (!m) return null;
|
|
97
97
|
try {
|
|
98
98
|
return JSON.parse(m);
|
|
@@ -102,335 +102,348 @@ async function Qn(o, a, l) {
|
|
|
102
102
|
}
|
|
103
103
|
let b = m;
|
|
104
104
|
try {
|
|
105
|
-
const
|
|
106
|
-
typeof
|
|
105
|
+
const h = JSON.parse(m);
|
|
106
|
+
typeof h?.message == "string" && (b = h.message);
|
|
107
107
|
} catch {
|
|
108
108
|
b = m;
|
|
109
109
|
}
|
|
110
|
-
throw new Error(b ? `${
|
|
110
|
+
throw new Error(b ? `${o} 调用失败:${b.slice(0, 300)}` : `${o} 调用失败(${f.status})`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function hs(a, o) {
|
|
113
113
|
const l = (m) => {
|
|
114
114
|
try {
|
|
115
|
-
|
|
115
|
+
a.contentWindow?.postMessage(m, "*");
|
|
116
116
|
} catch (b) {
|
|
117
117
|
console.warn("[magic-block] 有一条宿主消息没能发给块(协议继续走):", b);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
async function i(m, b) {
|
|
121
|
-
if (m === "getMe") return await
|
|
121
|
+
if (m === "getMe") return await at("/auth/me");
|
|
122
122
|
if (m === "navigateTab") {
|
|
123
|
-
const
|
|
124
|
-
if (!
|
|
125
|
-
return await
|
|
123
|
+
const h = typeof b[0] == "string" ? b[0].trim() : "";
|
|
124
|
+
if (!h || !o.onNavigateTab) throw new Error(`跳不了 ${h || "(空地址)"}:这个页面没有把宿主接到路由上`);
|
|
125
|
+
return await o.onNavigateTab(h);
|
|
126
126
|
}
|
|
127
|
-
if (m === "context") return
|
|
127
|
+
if (m === "context") return o.context ? o.context() : {};
|
|
128
128
|
if (m === "setTabTitle") {
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
131
|
-
return
|
|
129
|
+
const h = typeof b[0] == "string" ? b[0].trim() : "", v = typeof b[1] == "string" ? b[1].trim() : "";
|
|
130
|
+
if (!h) throw new Error("setTabTitle 要给一个非空的名字");
|
|
131
|
+
return o.onTabTitle?.(h, v || void 0), !0;
|
|
132
132
|
}
|
|
133
133
|
if (m === "backend") {
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
if (!
|
|
137
|
-
return await
|
|
134
|
+
const h = typeof b[0] == "string" ? b[0].trim() : "", v = b[1];
|
|
135
|
+
if (!h) throw new Error("后端调用的路由名是空的:要写成 magicBackendApi.类名.方法名(参数)");
|
|
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
139
|
throw new Error(`不认识的方法:${String(m)}(这块桥只有 getMe / navigateTab / context / setTabTitle / backend 五个)`);
|
|
140
140
|
}
|
|
141
|
-
const
|
|
142
|
-
if (m.source !==
|
|
141
|
+
const r = (m) => {
|
|
142
|
+
if (m.source !== a.contentWindow) return;
|
|
143
143
|
const b = m.data;
|
|
144
144
|
if (!b) return;
|
|
145
|
-
if (b[
|
|
146
|
-
const
|
|
147
|
-
Number.isFinite(
|
|
145
|
+
if (b[dt] === vn) {
|
|
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
|
-
if (b[
|
|
151
|
-
const
|
|
150
|
+
if (b[dt] !== mn) return;
|
|
151
|
+
const h = b.id;
|
|
152
152
|
(async () => {
|
|
153
153
|
try {
|
|
154
|
-
l({ [
|
|
155
|
-
} catch (
|
|
156
|
-
l({ [
|
|
154
|
+
l({ [dt]: Se, id: h, ok: !0, value: await i(String(b.method), b.args ?? []) });
|
|
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
|
-
window.addEventListener("message",
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
window.removeEventListener("message",
|
|
160
|
+
window.addEventListener("message", r);
|
|
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
|
|
167
|
-
function
|
|
168
|
-
return String(
|
|
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
|
+
function tn(a) {
|
|
168
|
+
return String(a ?? "").split("/").some((o) => o.startsWith($s));
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
170
|
+
function ws(a) {
|
|
171
|
+
return a.length > 0 && a.length <= Oe && !/[\u0000-\u001f\u007f]/.test(a);
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const xs = {
|
|
174
174
|
id: "块的 uuid,必须与页面里挂载它时写死的那个 uuid 逐字一致",
|
|
175
175
|
module: "模块名(小写字母与数字,必须以字母开头),例如 home",
|
|
176
|
-
name: `可读名:可以用中文,不超过 ${
|
|
176
|
+
name: `可读名:可以用中文,不超过 ${Oe} 个字符`,
|
|
177
177
|
brief: "一句话说明这个块解决什么问题",
|
|
178
178
|
// 可选键:这一句不会出现在"缺少 xxx"的报文里(它不在 MANIFEST_REQUIRED 里),
|
|
179
179
|
// 留着是为了让这份 Map 与 MANIFEST_KEYS 一一对上(少一个键 `tsc` 就会报)。
|
|
180
180
|
detail: "详情介绍(可选):一段给人读的说明,比 brief 那一句长;一行写完,控制台会显示它"
|
|
181
181
|
};
|
|
182
|
-
function
|
|
183
|
-
const
|
|
184
|
-
return
|
|
185
|
-
}
|
|
186
|
-
function
|
|
187
|
-
let
|
|
188
|
-
for (let l = 0; l <
|
|
189
|
-
const i =
|
|
190
|
-
if (
|
|
191
|
-
i ===
|
|
192
|
-
else if (i === '"' || i === "'")
|
|
193
|
-
else if (i === "#") return
|
|
182
|
+
function en(a) {
|
|
183
|
+
const o = Object.keys(a);
|
|
184
|
+
return o.length > 0 ? `现在包里有:${o.join(" / ")}` : "现在这个包是空的";
|
|
185
|
+
}
|
|
186
|
+
function Cs(a) {
|
|
187
|
+
let o = "";
|
|
188
|
+
for (let l = 0; l < a.length; l += 1) {
|
|
189
|
+
const i = a[l];
|
|
190
|
+
if (o)
|
|
191
|
+
i === o && (o = "");
|
|
192
|
+
else if (i === '"' || i === "'") o = i;
|
|
193
|
+
else if (i === "#") return a.slice(0, l);
|
|
194
194
|
}
|
|
195
|
-
return
|
|
195
|
+
return a;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
let
|
|
199
|
-
for (let l = 0; l <
|
|
200
|
-
const i =
|
|
201
|
-
if (
|
|
202
|
-
i ===
|
|
203
|
-
else if (i === '"' || i === "'")
|
|
197
|
+
function Es(a) {
|
|
198
|
+
let o = "";
|
|
199
|
+
for (let l = 0; l < a.length; l += 1) {
|
|
200
|
+
const i = a[l];
|
|
201
|
+
if (o)
|
|
202
|
+
i === o && (o = "");
|
|
203
|
+
else if (i === '"' || i === "'") o = i;
|
|
204
204
|
else if (i === ":") return l;
|
|
205
205
|
}
|
|
206
206
|
return -1;
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
return !
|
|
208
|
+
function Ss(a) {
|
|
209
|
+
return !a || a[0] !== '"' && a[0] !== "'" ? a : a.length >= 2 && a[a.length - 1] === a[0] ? a.slice(1, -1).trim() : a;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
const m =
|
|
211
|
+
function Ts(a) {
|
|
212
|
+
const o = [], l = {}, i = {};
|
|
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
|
-
|
|
217
|
+
o.push(`第 ${m} 行是列表写法(${b}):清单只认「键: 值」,每个键各占一行 —— 例如 name: 客户档案`);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
|
|
220
|
+
const h = Es(b);
|
|
221
|
+
if (h < 0) {
|
|
222
|
+
o.push(`第 ${m} 行不是「键: 值」(${b}):清单只认「键: 值」与 # 注释 —— 要么删掉这一行,要么照 name: 客户档案 写`);
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
|
|
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 (!
|
|
231
|
-
|
|
232
|
-
`第 ${m} 行的键不认识(${
|
|
230
|
+
if (!ge.includes(v)) {
|
|
231
|
+
o.push(
|
|
232
|
+
`第 ${m} 行的键不认识(${v}):清单只有 ${ge.join(" / ")} 这几个键(其中 ${Qe.join(" / ")} 必填,detail 可以不写)`
|
|
233
233
|
);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
if (
|
|
237
|
-
|
|
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
|
-
for (const
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
245
|
-
|
|
242
|
+
for (const r of Qe) {
|
|
243
|
+
const f = l[r] ?? "";
|
|
244
|
+
if (f === "") {
|
|
245
|
+
o.push(`清单里缺少 ${r}(或者是空的):${xs[r]}`);
|
|
246
246
|
continue;
|
|
247
247
|
}
|
|
248
|
-
|
|
249
|
-
`清单里的 module 不合法:${
|
|
250
|
-
) :
|
|
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
|
-
return [l,
|
|
252
|
+
return [l, o];
|
|
253
253
|
}
|
|
254
|
-
function
|
|
255
|
-
return
|
|
254
|
+
function Bs(a) {
|
|
255
|
+
return _s.test(a) && !a.split("/").includes("..");
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
l === void 0 ?
|
|
260
|
-
const i =
|
|
261
|
-
let
|
|
257
|
+
function Ms(a) {
|
|
258
|
+
const o = [], l = a[zt];
|
|
259
|
+
l === void 0 ? o.push(`包里缺入口:必须有 ${zt}(${en(a)})`) : l.trim() || o.push(`${zt} 不能是空文件`);
|
|
260
|
+
const i = a[_e];
|
|
261
|
+
let r = {};
|
|
262
262
|
if (i === void 0)
|
|
263
|
-
|
|
263
|
+
o.push(`包里缺清单:必须有 ${_e}(${en(a)})`);
|
|
264
264
|
else if (!i.trim())
|
|
265
|
-
|
|
265
|
+
o.push(`${_e} 不能是空文件`);
|
|
266
266
|
else {
|
|
267
|
-
const [
|
|
268
|
-
|
|
267
|
+
const [f, m] = Ts(i);
|
|
268
|
+
r = f, o.push(...m);
|
|
269
269
|
}
|
|
270
|
-
for (const
|
|
271
|
-
|
|
272
|
-
return { manifest:
|
|
273
|
-
}
|
|
274
|
-
function
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
return
|
|
278
|
-
for (const l of
|
|
270
|
+
for (const f of Object.keys(a))
|
|
271
|
+
Bs(f) || o.push(`文件名不合法:${f}(只许字母数字与 . _ - /,且不许 .. 与绝对路径)`);
|
|
272
|
+
return { manifest: r, issues: o };
|
|
273
|
+
}
|
|
274
|
+
function As(a) {
|
|
275
|
+
const o = [];
|
|
276
|
+
if (a.length === 0)
|
|
277
|
+
return o.push("一个块都没勾:请在「读回改动」的结果里勾上要保存的块"), { selected: 0, issues: o };
|
|
278
|
+
for (const l of a) {
|
|
279
279
|
const i = l.name?.trim() || "(没有名字的块)";
|
|
280
|
-
for (const
|
|
280
|
+
for (const r of Ms(l.files ?? {}).issues) o.push(`${i}:${r}`);
|
|
281
281
|
}
|
|
282
|
-
return { selected:
|
|
282
|
+
return { selected: a.length, issues: o };
|
|
283
283
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
286
|
-
if (
|
|
287
|
-
const l = (
|
|
288
|
-
if (l in
|
|
284
|
+
const Rs = "backend_open.py", Os = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
285
|
+
function nn(a, o) {
|
|
286
|
+
if (Os.test(a)) return;
|
|
287
|
+
const l = (a.split(/[?#]/)[0] ?? "").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
288
|
+
if (l in o) return tn(l) ? void 0 : l;
|
|
289
289
|
const i = l.split("/").pop() ?? "";
|
|
290
|
-
return i ? Object.keys(
|
|
291
|
-
}
|
|
292
|
-
const
|
|
293
|
-
function
|
|
294
|
-
return `${
|
|
295
|
-
}
|
|
296
|
-
const
|
|
297
|
-
function
|
|
298
|
-
const l = [], i = (m) => (l.push(m),
|
|
299
|
-
return { html:
|
|
300
|
-
const
|
|
301
|
-
return
|
|
302
|
-
${
|
|
290
|
+
return i ? Object.keys(o).find((r) => !tn(r) && (r.split("/").pop() ?? "") === i) : void 0;
|
|
291
|
+
}
|
|
292
|
+
const _n = "\0mb:";
|
|
293
|
+
function Ps(a) {
|
|
294
|
+
return `${_n}${a}\0`;
|
|
295
|
+
}
|
|
296
|
+
const Ls = /<script\b([^>]*?)\bsrc\s*=\s*(["'])(.*?)\2([^>]*)>\s*<\/script\s*>/gi, js = /<link\b([^>]*?)\bhref\s*=\s*(["'])(.*?)\2([^>]*?)\/?>/gi;
|
|
297
|
+
function Ds(a, o) {
|
|
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
|
+
${gn(o[_] ?? "")}
|
|
303
303
|
<\/script>`);
|
|
304
|
-
}).replace(
|
|
304
|
+
}).replace(js, (m, b, h, v, w) => {
|
|
305
305
|
if (!/\brel\s*=\s*(?:"|')?stylesheet/i.test(`${b}${w}`)) return m;
|
|
306
|
-
const
|
|
307
|
-
return
|
|
308
|
-
${
|
|
306
|
+
const _ = nn(v, o);
|
|
307
|
+
return _ === void 0 ? m : i(`<style>
|
|
308
|
+
${o[_]}
|
|
309
309
|
</style>`);
|
|
310
310
|
}), slots: l };
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
return
|
|
312
|
+
function gn(a) {
|
|
313
|
+
return a.replace(/<\/(script)/gi, "<\\/$1");
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
const l = /<\/head\s*>/i.exec(
|
|
317
|
-
return l ? `${
|
|
315
|
+
function yn(a, o) {
|
|
316
|
+
const l = /<\/head\s*>/i.exec(a);
|
|
317
|
+
return l ? `${a.slice(0, l.index)}${o}${a.slice(l.index)}` : `${o}${a}`;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
return
|
|
321
|
-
${
|
|
319
|
+
function Is(a, o) {
|
|
320
|
+
return o ? yn(a, `<script>
|
|
321
|
+
${gn(o)}
|
|
322
322
|
<\/script>
|
|
323
|
-
`) :
|
|
323
|
+
`) : a;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
return
|
|
327
|
-
${
|
|
325
|
+
function sn(a, o) {
|
|
326
|
+
return o ? yn(a, `<style data-magic-block="host">
|
|
327
|
+
${o}
|
|
328
328
|
</style>
|
|
329
|
-
`) :
|
|
330
|
-
}
|
|
331
|
-
function
|
|
332
|
-
const l =
|
|
333
|
-
if (
|
|
334
|
-
const { html: m, slots: b } =
|
|
335
|
-
if (
|
|
336
|
-
let w =
|
|
337
|
-
for (let
|
|
338
|
-
const g =
|
|
339
|
-
w += (b[
|
|
329
|
+
`) : a;
|
|
330
|
+
}
|
|
331
|
+
function Ns(a, o = {}) {
|
|
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
341
|
return w;
|
|
342
342
|
}
|
|
343
|
-
const
|
|
344
|
-
let
|
|
345
|
-
const
|
|
346
|
-
function
|
|
347
|
-
return
|
|
348
|
-
|
|
343
|
+
const Ft = /* @__PURE__ */ new Map();
|
|
344
|
+
let Pt = null;
|
|
345
|
+
const Te = /* @__PURE__ */ new Set();
|
|
346
|
+
function Fs(a) {
|
|
347
|
+
return Te.add(a), () => {
|
|
348
|
+
Te.delete(a);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
for (const
|
|
351
|
+
function zs() {
|
|
352
|
+
Ft.clear(), Pt = null;
|
|
353
|
+
for (const a of Te) a();
|
|
354
354
|
}
|
|
355
|
-
async function
|
|
356
|
-
const
|
|
357
|
-
if (
|
|
358
|
-
|
|
355
|
+
async function Us(a) {
|
|
356
|
+
const o = [...new Set(a)].filter(Boolean);
|
|
357
|
+
if (o.some((l) => !Ft.has(l))) {
|
|
358
|
+
Pt && await Pt.catch(() => {
|
|
359
359
|
});
|
|
360
|
-
const l =
|
|
361
|
-
l.length > 0 && (
|
|
362
|
-
for (const
|
|
360
|
+
const l = o.filter((i) => !Ft.has(i));
|
|
361
|
+
l.length > 0 && (Pt = at(`/magic-blocks/render?ids=${l.map(encodeURIComponent).join(",")}`).then((i) => {
|
|
362
|
+
for (const r of i) r?.id && Ft.set(r.id, r);
|
|
363
363
|
return i;
|
|
364
364
|
}).catch(() => []).finally(() => {
|
|
365
|
-
|
|
366
|
-
}), await
|
|
365
|
+
Pt = null;
|
|
366
|
+
}), await Pt.catch(() => {
|
|
367
367
|
}));
|
|
368
368
|
}
|
|
369
|
-
return
|
|
369
|
+
return o.map((l) => Ft.get(l)).filter((l) => !!l);
|
|
370
370
|
}
|
|
371
|
-
const
|
|
372
|
-
function
|
|
373
|
-
const l = String(
|
|
371
|
+
const Tt = "labull.css", Qt = "CONTROLS.lock.html";
|
|
372
|
+
function Hs(a, o) {
|
|
373
|
+
const l = String(o || "");
|
|
374
374
|
if (/@font-face|@keyframes/i.test(l)) return !0;
|
|
375
|
-
const i = String(
|
|
375
|
+
const i = String(a || "");
|
|
376
376
|
return /(^|[\s,>+~])(\.p-|\.pi(?![a-z])|\.pi-|\.labull-|:root|html(?![a-z-])|body(?![a-z-])|\*|:where\()/.test(i) ? !0 : /--(?:sp|surface|primary|text-color|content|highlight|focus-ring|p-)/.test(l);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
for (let i = 0; i <
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
378
|
+
function kn(a, o, l) {
|
|
379
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
380
|
+
const r = a[i], f = String(r.cssText || ""), m = String(r.selectorText || "");
|
|
381
|
+
if (r.cssRules && r.cssRules.length > 0) {
|
|
382
382
|
const b = [];
|
|
383
|
-
if (
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
${b.map((
|
|
383
|
+
if (kn(r.cssRules, b, l), b.length === 0) continue;
|
|
384
|
+
const h = f.slice(0, f.indexOf("{")).trim();
|
|
385
|
+
o.push(`${h} {
|
|
386
|
+
${b.map((v) => " " + v).join(`
|
|
387
387
|
`)}
|
|
388
388
|
}`);
|
|
389
389
|
continue;
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
Hs(m, f) && (o.push(f), l.n += 1);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
const
|
|
394
|
+
function $n() {
|
|
395
|
+
const a = [], o = [], l = { n: 0 };
|
|
396
396
|
let i = 0;
|
|
397
|
-
const
|
|
398
|
-
for (const m of
|
|
397
|
+
const r = typeof document > "u" ? [] : Array.from(document.styleSheets);
|
|
398
|
+
for (const m of r) {
|
|
399
399
|
const b = m.href || "(内联 <style>)";
|
|
400
|
-
let
|
|
400
|
+
let h = null;
|
|
401
401
|
try {
|
|
402
|
-
|
|
402
|
+
h = m.cssRules;
|
|
403
403
|
} catch {
|
|
404
|
-
|
|
404
|
+
o.push(b);
|
|
405
405
|
continue;
|
|
406
406
|
}
|
|
407
|
-
if (!
|
|
408
|
-
const
|
|
409
|
-
|
|
407
|
+
if (!h || h.length === 0) continue;
|
|
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
|
"/* 生成物:每次导出都会重写,别手改。",
|
|
413
413
|
" *",
|
|
414
414
|
" * 这是这个应用此刻真正在用的 **labull 主题 + 控件样式**(token / PrimeVue 控件 / 结构类 / 图标)。",
|
|
415
415
|
` * 收自 ${i} 张样式表、${l.n} 条规则。`,
|
|
416
|
-
|
|
416
|
+
o.length > 0 ? ` * ⚠️ 有 ${o.length} 张样式表读不到规则(跨源,浏览器不让读):${o.join(" / ")} —— 需要的话手动补一份。` : " * (没有读不到的样式表:收全了。)",
|
|
417
417
|
" *",
|
|
418
418
|
" * 怎么用(块里):**什么都不用加** —— 宿主会把这一份注入每个块的 iframe(`MagicBlockHost` 的 `theme` prop),",
|
|
419
419
|
' * 所以直接写类名就行:`<button class="p-button">` / `<input class="p-inputtext">` / `<span class="p-tag">`。',
|
|
420
|
-
" * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" +
|
|
420
|
+
" * 这一份放在开发包里是给你**查 / 对照 / 抄**用的(`" + Qt + "` 里的每一块 markup 都能直接用)。",
|
|
421
421
|
" * ⚠️ 别把它当块包文件塞进块里:它 500 KB 上下,而且宿主已经注入了一份(重复只会更慢)。",
|
|
422
422
|
" * ⚠️ 块里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为,",
|
|
423
423
|
" * 这里能用的是类名(按钮、输入框、标签、面板、表格、图标)。",
|
|
424
424
|
" */",
|
|
425
425
|
""
|
|
426
426
|
].join(`
|
|
427
|
-
`) +
|
|
427
|
+
`) + a.join(`
|
|
428
428
|
`) + `
|
|
429
|
-
`, sheets: i, skipped:
|
|
429
|
+
`, sheets: i, skipped: o, rules: l.n };
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
const
|
|
433
|
-
|
|
431
|
+
function Ks() {
|
|
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 Ts() {
|
|
|
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
|
`);
|
|
@@ -461,7 +495,7 @@ function Ts() {
|
|
|
461
495
|
<head>
|
|
462
496
|
<meta charset="utf-8">
|
|
463
497
|
<title>labull 控件清单</title>
|
|
464
|
-
<link rel="stylesheet" href="${
|
|
498
|
+
<link rel="stylesheet" href="${Tt}">
|
|
465
499
|
<style>
|
|
466
500
|
body { margin: 0; padding: 16px; }
|
|
467
501
|
h1 { margin: 0 0 4px; font-size: 18px; }
|
|
@@ -477,72 +511,72 @@ function Ts() {
|
|
|
477
511
|
<body>
|
|
478
512
|
<h1>labull 控件清单</h1>
|
|
479
513
|
<p class="lead">
|
|
480
|
-
这些类名来自 <code>${
|
|
514
|
+
这些类名来自 <code>${Tt}</code>(与应用同源同版本)。块里别自己写一套配色 / 按钮:
|
|
481
515
|
把这一行加进 <code>index.open.html</code> 的 <code><head></code>,
|
|
482
516
|
下面每一块 markup 都能直接用:
|
|
483
|
-
<code><link rel="stylesheet" href="${
|
|
517
|
+
<code><link rel="stylesheet" href="${Tt}"></code>
|
|
484
518
|
<br />
|
|
485
519
|
⚠️ 这里**只有 CSS,没有 JS 组件**:下拉 / 日期 / 弹窗那些要装了 PrimeVue 才有行为(块里没有构建步骤)。
|
|
486
520
|
</p>
|
|
487
|
-
${
|
|
521
|
+
${f}
|
|
488
522
|
</body>
|
|
489
523
|
</html>
|
|
490
524
|
`;
|
|
491
525
|
}
|
|
492
|
-
const
|
|
493
|
-
let
|
|
494
|
-
function
|
|
495
|
-
for (const
|
|
526
|
+
const Bt = /* @__PURE__ */ new Map(), Be = /* @__PURE__ */ new Set(), Vs = 4e3;
|
|
527
|
+
let Me = "", Xt = null;
|
|
528
|
+
function on() {
|
|
529
|
+
for (const a of Be) a();
|
|
496
530
|
}
|
|
497
|
-
function
|
|
498
|
-
return
|
|
499
|
-
|
|
531
|
+
function qs(a) {
|
|
532
|
+
return Be.add(a), () => {
|
|
533
|
+
Be.delete(a);
|
|
500
534
|
};
|
|
501
535
|
}
|
|
502
|
-
function
|
|
503
|
-
return
|
|
536
|
+
function ye() {
|
|
537
|
+
return Me;
|
|
504
538
|
}
|
|
505
|
-
function
|
|
506
|
-
const l = String(
|
|
539
|
+
function Js(a, o) {
|
|
540
|
+
const l = String(a || "").trim(), i = String(o || "").trim();
|
|
507
541
|
if (!l || !i) return () => {
|
|
508
542
|
};
|
|
509
|
-
let
|
|
510
|
-
return
|
|
511
|
-
const
|
|
512
|
-
|
|
543
|
+
let r = Bt.get(l);
|
|
544
|
+
return r || (r = /* @__PURE__ */ new Set(), Bt.set(l, r)), r.add(i), () => {
|
|
545
|
+
const f = Bt.get(l);
|
|
546
|
+
f && (f.delete(i), f.size === 0 && Bt.delete(l));
|
|
513
547
|
};
|
|
514
548
|
}
|
|
515
|
-
function
|
|
516
|
-
const i =
|
|
549
|
+
function Ae(a, o, l) {
|
|
550
|
+
const i = Bt.get(String(a || ""));
|
|
517
551
|
if (!i) return null;
|
|
518
|
-
for (const
|
|
519
|
-
if (
|
|
520
|
-
return
|
|
552
|
+
for (const r of i)
|
|
553
|
+
if (r !== o && !(l && !l(r)))
|
|
554
|
+
return r;
|
|
521
555
|
return null;
|
|
522
556
|
}
|
|
523
|
-
function
|
|
524
|
-
return [...
|
|
557
|
+
function Gs(a) {
|
|
558
|
+
return [...Bt.get(String(a || "")) ?? []];
|
|
525
559
|
}
|
|
526
|
-
function
|
|
527
|
-
const i =
|
|
528
|
-
return !i || i.size === 0 || i.has(
|
|
560
|
+
function Ws(a, o, l) {
|
|
561
|
+
const i = Bt.get(String(a || ""));
|
|
562
|
+
return !i || i.size === 0 || i.has(o) ? null : Ae(a, o, l);
|
|
529
563
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}, Math.max(1,
|
|
564
|
+
function wn(a, o = Vs) {
|
|
565
|
+
Me = String(a || ""), Xt !== null && clearTimeout(Xt), Xt = setTimeout(() => {
|
|
566
|
+
Xt = null, Me = "", on();
|
|
567
|
+
}, Math.max(1, o)), on();
|
|
534
568
|
}
|
|
535
|
-
const
|
|
569
|
+
const Ys = ["data-magic-block", "data-magic-module"], Zs = ["srcdoc", "title"], Xs = { class: "mb__state" }, Qs = { class: "mb__brief" }, to = {
|
|
536
570
|
key: 0,
|
|
537
571
|
class: "mb__reason"
|
|
538
|
-
},
|
|
572
|
+
}, eo = {
|
|
539
573
|
key: 1,
|
|
540
574
|
class: "mb__issues"
|
|
541
|
-
},
|
|
575
|
+
}, no = {
|
|
542
576
|
key: 2,
|
|
543
577
|
class: "mb__ring",
|
|
544
578
|
"aria-hidden": "true"
|
|
545
|
-
},
|
|
579
|
+
}, so = ["title", "aria-label"], oo = ["title", "aria-label"], ao = ["title", "aria-label"], lo = ["title", "aria-label"], io = /* @__PURE__ */ Re({
|
|
546
580
|
__name: "MagicBlockHost",
|
|
547
581
|
props: {
|
|
548
582
|
uuid: {},
|
|
@@ -550,189 +584,189 @@ const Rs = ["data-magic-block", "data-magic-module"], Ps = ["srcdoc", "title"],
|
|
|
550
584
|
module: { default: "" },
|
|
551
585
|
theme: { type: Boolean, default: !0 }
|
|
552
586
|
},
|
|
553
|
-
setup(
|
|
554
|
-
const
|
|
555
|
-
let
|
|
556
|
-
const
|
|
587
|
+
setup(a) {
|
|
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);
|
|
589
|
+
let _ = null, g = null, M = null, F = null, B = null, R = null;
|
|
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
|
-
for (const [
|
|
592
|
+
for (const [E, j] of Object.entries(b.value?.files ?? {})) E !== Rs && ($[E] = j);
|
|
559
593
|
return $;
|
|
560
|
-
}),
|
|
561
|
-
let
|
|
562
|
-
function
|
|
563
|
-
if (!
|
|
564
|
-
if (
|
|
594
|
+
}), kt = O(() => G.value === "ok" && typeof lt.value[zt] == "string");
|
|
595
|
+
let nt = null;
|
|
596
|
+
function K() {
|
|
597
|
+
if (!o.theme) return "";
|
|
598
|
+
if (nt !== null || (nt = "", typeof document > "u")) return nt;
|
|
565
599
|
try {
|
|
566
|
-
|
|
600
|
+
nt = $n().css;
|
|
567
601
|
} catch {
|
|
568
|
-
|
|
602
|
+
nt = "";
|
|
569
603
|
}
|
|
570
|
-
return
|
|
604
|
+
return nt;
|
|
571
605
|
}
|
|
572
|
-
const
|
|
573
|
-
if (!
|
|
574
|
-
const $ = { bootstrap:
|
|
575
|
-
return
|
|
606
|
+
const z = O(() => {
|
|
607
|
+
if (!kt.value) return "";
|
|
608
|
+
const $ = { bootstrap: ms, css: bs }, E = K();
|
|
609
|
+
return E && ($.themeCss = E), Ns(lt.value, $);
|
|
576
610
|
});
|
|
577
|
-
function
|
|
611
|
+
function X() {
|
|
578
612
|
return { key: l.key, path: l.path, params: l.params, query: l.query };
|
|
579
613
|
}
|
|
580
|
-
async function
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
583
|
-
const
|
|
584
|
-
throw new Error(`这个应用里没有页面 ${$}。能跳的页面只有:${
|
|
614
|
+
async function $t($) {
|
|
615
|
+
const E = i.resolve($);
|
|
616
|
+
if (E.matched.length === 0) {
|
|
617
|
+
const j = i.getRoutes().map((ut) => ut.path);
|
|
618
|
+
throw new Error(`这个应用里没有页面 ${$}。能跳的页面只有:${j.length > 0 ? j.join(" / ") : "(还没有配路由)"}`);
|
|
585
619
|
}
|
|
586
|
-
return
|
|
620
|
+
return Ee($) || E.fullPath;
|
|
587
621
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
622
|
+
function bt() {
|
|
623
|
+
M?.(), M = null;
|
|
590
624
|
const $ = m.value;
|
|
591
|
-
$ && (
|
|
592
|
-
uuid:
|
|
593
|
-
onHeight: (
|
|
594
|
-
|
|
625
|
+
$ && (M = hs($, {
|
|
626
|
+
uuid: o.uuid,
|
|
627
|
+
onHeight: (E) => {
|
|
628
|
+
v.value = E;
|
|
595
629
|
},
|
|
596
|
-
onNavigateTab:
|
|
597
|
-
context:
|
|
630
|
+
onNavigateTab: $t,
|
|
631
|
+
context: X,
|
|
598
632
|
/* 🔴 块给**自己所属那条标签**起名:整页就是一个块时(`MagicBlockPage`),标签栏上那条
|
|
599
633
|
* 默认只有路由的 `meta.title`("订单详情"),而"订单 SO-42"只有块自己知道。 */
|
|
600
|
-
onTabTitle: (
|
|
634
|
+
onTabTitle: (E, j) => l.setTitle(E, j)
|
|
601
635
|
}));
|
|
602
636
|
}
|
|
603
|
-
async function
|
|
604
|
-
const $ =
|
|
605
|
-
$ ===
|
|
637
|
+
async function wt() {
|
|
638
|
+
const $ = o.uuid, E = await Us([$]);
|
|
639
|
+
$ === o.uuid && (b.value = E.find((j) => j.id === $) ?? null);
|
|
606
640
|
}
|
|
607
|
-
function
|
|
608
|
-
window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid:
|
|
641
|
+
function Ut() {
|
|
642
|
+
window.dispatchEvent(new CustomEvent("magic-block:open-console", { detail: { uuid: o.uuid } }));
|
|
609
643
|
}
|
|
610
|
-
function
|
|
611
|
-
$ &&
|
|
644
|
+
function Ht($ = !1) {
|
|
645
|
+
$ && B?.(), B = Js(o.uuid, l.key);
|
|
612
646
|
}
|
|
613
|
-
const
|
|
614
|
-
if (!
|
|
615
|
-
const $ =
|
|
647
|
+
const Q = ($) => !pn($, i), V = O(() => {
|
|
648
|
+
if (!r.value) return "";
|
|
649
|
+
const $ = Ae(o.uuid, l.key, Q);
|
|
616
650
|
return $ ? `管理员:切到还挂着这个块的标签 ${$}(点一下这一块会亮红框)` : "管理员:这个块只在这一条标签里挂着 —— 点一下会亮几秒红框";
|
|
617
651
|
});
|
|
618
|
-
function
|
|
619
|
-
if (!
|
|
620
|
-
const $ =
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
let
|
|
625
|
-
for (;
|
|
626
|
-
if (getComputedStyle(
|
|
627
|
-
|
|
652
|
+
function A() {
|
|
653
|
+
if (!r.value) return;
|
|
654
|
+
const $ = Ae(o.uuid, l.key, Q);
|
|
655
|
+
wn(o.uuid), $ && Ee($);
|
|
656
|
+
}
|
|
657
|
+
function it($) {
|
|
658
|
+
let E = $.parentElement;
|
|
659
|
+
for (; E; ) {
|
|
660
|
+
if (getComputedStyle(E).overflowY !== "visible" && E.clientHeight > 0) return E;
|
|
661
|
+
E = E.parentElement;
|
|
628
662
|
}
|
|
629
663
|
return document.documentElement;
|
|
630
664
|
}
|
|
631
|
-
function
|
|
632
|
-
const $ =
|
|
665
|
+
function W() {
|
|
666
|
+
const $ = f.value;
|
|
633
667
|
if (!$) return 0;
|
|
634
|
-
const
|
|
635
|
-
return Math.max(0, Math.floor(
|
|
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;
|
|
669
|
+
return Math.max(0, Math.floor(ne - q));
|
|
636
670
|
}
|
|
637
|
-
function
|
|
638
|
-
if (!l.active.value || !
|
|
639
|
-
const $ =
|
|
671
|
+
function Y() {
|
|
672
|
+
if (!l.active.value || !f.value) return;
|
|
673
|
+
const $ = W();
|
|
640
674
|
$ > 0 && Math.abs($ - w.value) > 1 && (w.value = $);
|
|
641
675
|
}
|
|
642
|
-
function
|
|
643
|
-
if (!
|
|
644
|
-
const $ =
|
|
645
|
-
|
|
646
|
-
}
|
|
647
|
-
return
|
|
648
|
-
|
|
649
|
-
}, { flush: "post" }),
|
|
650
|
-
|
|
651
|
-
}),
|
|
652
|
-
$ &&
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
!
|
|
676
|
+
function st() {
|
|
677
|
+
if (!f.value) return;
|
|
678
|
+
const $ = it(f.value);
|
|
679
|
+
_ !== $ && (_ = $, g?.disconnect(), g = null), Y(), !(g || typeof ResizeObserver > "u") && (g = new ResizeObserver(() => Y()), g.observe($));
|
|
680
|
+
}
|
|
681
|
+
return Ot(m, () => bt()), Ot(z, () => {
|
|
682
|
+
v.value = 0, w.value = 0, st();
|
|
683
|
+
}, { flush: "post" }), Ot(() => o.uuid, () => {
|
|
684
|
+
Ze().then(() => st());
|
|
685
|
+
}), Ot(() => l.active.value, ($) => {
|
|
686
|
+
$ && Ze().then(() => {
|
|
687
|
+
st();
|
|
688
|
+
const E = f.value;
|
|
689
|
+
!E || !E.isConnected || E.offsetParent === null || h.value && E.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
656
690
|
});
|
|
657
|
-
}),
|
|
658
|
-
|
|
659
|
-
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}),
|
|
663
|
-
}),
|
|
664
|
-
g?.disconnect(), g = null,
|
|
665
|
-
}), ($,
|
|
691
|
+
}), Ot(() => o.uuid, () => {
|
|
692
|
+
v.value = 0, b.value = null, Ht(!0), h.value = ye() === o.uuid, wt();
|
|
693
|
+
}), ln(() => {
|
|
694
|
+
F = Fs(() => void wt()), R = qs(() => {
|
|
695
|
+
h.value = ye() === o.uuid;
|
|
696
|
+
}), h.value = ye() === o.uuid, Ht(), st(), wt();
|
|
697
|
+
}), un(() => {
|
|
698
|
+
g?.disconnect(), g = null, F?.(), F = null, R?.(), R = null, B?.(), B = null, M?.(), M = null;
|
|
699
|
+
}), ($, E) => (c(), d("div", {
|
|
666
700
|
ref_key: "el",
|
|
667
|
-
ref:
|
|
668
|
-
class:
|
|
669
|
-
style:
|
|
670
|
-
"data-magic-block":
|
|
671
|
-
"data-magic-module":
|
|
701
|
+
ref: f,
|
|
702
|
+
class: H(["mb", { "mb--admin": _t(r), "mb--lit": _t(r) && h.value }]),
|
|
703
|
+
style: rn(Lt.value),
|
|
704
|
+
"data-magic-block": a.uuid,
|
|
705
|
+
"data-magic-module": a.module
|
|
672
706
|
}, [
|
|
673
|
-
|
|
707
|
+
kt.value ? (c(), d("iframe", {
|
|
674
708
|
key: 0,
|
|
675
709
|
ref_key: "frame",
|
|
676
710
|
ref: m,
|
|
677
711
|
class: "mb__frame",
|
|
678
|
-
srcdoc:
|
|
679
|
-
title:
|
|
712
|
+
srcdoc: z.value,
|
|
713
|
+
title: L.value,
|
|
680
714
|
scrolling: "no",
|
|
681
715
|
sandbox: "allow-scripts allow-forms allow-modals allow-popups allow-downloads"
|
|
682
|
-
}, null, 8,
|
|
716
|
+
}, null, 8, Zs)) : (c(), d("div", {
|
|
683
717
|
key: 1,
|
|
684
|
-
class:
|
|
685
|
-
onClick:
|
|
718
|
+
class: H(["mb__empty", { "mb__empty--off": G.value === "invalid", "mb__empty--draft": G.value === "draft" }]),
|
|
719
|
+
onClick: A
|
|
686
720
|
}, [
|
|
687
|
-
s("p",
|
|
688
|
-
s("p",
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
(
|
|
692
|
-
key:
|
|
721
|
+
s("p", Xs, p(pt.value), 1),
|
|
722
|
+
s("p", Qs, p(Z.value), 1),
|
|
723
|
+
G.value === "invalid" && gt.value ? (c(), d("p", to, p(gt.value), 1)) : k("", !0),
|
|
724
|
+
G.value === "invalid" && yt.value.length > 0 ? (c(), d("ul", eo, [
|
|
725
|
+
(c(!0), d(T, null, I(yt.value, (j, ut) => (c(), d("li", {
|
|
726
|
+
key: ut,
|
|
693
727
|
class: "mb__issue"
|
|
694
|
-
}, p(
|
|
695
|
-
])) :
|
|
728
|
+
}, p(j.message), 1))), 128))
|
|
729
|
+
])) : k("", !0),
|
|
696
730
|
s("button", {
|
|
697
731
|
class: "mb__go",
|
|
698
732
|
type: "button",
|
|
699
|
-
onClick:
|
|
733
|
+
onClick: Ce(Ut, ["stop"])
|
|
700
734
|
}, "去控制台")
|
|
701
735
|
], 2)),
|
|
702
|
-
|
|
703
|
-
|
|
736
|
+
_t(r) ? (c(), d("span", no)) : k("", !0),
|
|
737
|
+
_t(r) && kt.value ? (c(), d(T, { key: 3 }, [
|
|
704
738
|
s("button", {
|
|
705
739
|
class: "mb__grab mb__grab--top",
|
|
706
740
|
type: "button",
|
|
707
|
-
title:
|
|
708
|
-
"aria-label":
|
|
709
|
-
onClick:
|
|
710
|
-
}, null, 8,
|
|
741
|
+
title: V.value,
|
|
742
|
+
"aria-label": V.value,
|
|
743
|
+
onClick: A
|
|
744
|
+
}, null, 8, so),
|
|
711
745
|
s("button", {
|
|
712
746
|
class: "mb__grab mb__grab--right",
|
|
713
747
|
type: "button",
|
|
714
|
-
title:
|
|
715
|
-
"aria-label":
|
|
716
|
-
onClick:
|
|
717
|
-
}, null, 8,
|
|
748
|
+
title: V.value,
|
|
749
|
+
"aria-label": V.value,
|
|
750
|
+
onClick: A
|
|
751
|
+
}, null, 8, oo),
|
|
718
752
|
s("button", {
|
|
719
753
|
class: "mb__grab mb__grab--bottom",
|
|
720
754
|
type: "button",
|
|
721
|
-
title:
|
|
722
|
-
"aria-label":
|
|
723
|
-
onClick:
|
|
724
|
-
}, null, 8,
|
|
755
|
+
title: V.value,
|
|
756
|
+
"aria-label": V.value,
|
|
757
|
+
onClick: A
|
|
758
|
+
}, null, 8, ao),
|
|
725
759
|
s("button", {
|
|
726
760
|
class: "mb__grab mb__grab--left",
|
|
727
761
|
type: "button",
|
|
728
|
-
title:
|
|
729
|
-
"aria-label":
|
|
730
|
-
onClick:
|
|
731
|
-
}, null, 8,
|
|
732
|
-
], 64)) :
|
|
733
|
-
], 14,
|
|
762
|
+
title: V.value,
|
|
763
|
+
"aria-label": V.value,
|
|
764
|
+
onClick: A
|
|
765
|
+
}, null, 8, lo)
|
|
766
|
+
], 64)) : k("", !0)
|
|
767
|
+
], 14, Ys));
|
|
734
768
|
}
|
|
735
|
-
}),
|
|
769
|
+
}), uo = /* @__PURE__ */ bn(io, [["__scopeId", "data-v-8e1e849f"]]), ro = /* @__PURE__ */ Re({
|
|
736
770
|
__name: "MagicBlockPage",
|
|
737
771
|
props: {
|
|
738
772
|
uuid: { default: "" },
|
|
@@ -740,70 +774,70 @@ const Rs = ["data-magic-block", "data-magic-module"], Ps = ["srcdoc", "title"],
|
|
|
740
774
|
module: { default: "" },
|
|
741
775
|
theme: { type: Boolean, default: !0 }
|
|
742
776
|
},
|
|
743
|
-
setup(
|
|
744
|
-
const
|
|
745
|
-
const
|
|
746
|
-
return typeof
|
|
777
|
+
setup(a) {
|
|
778
|
+
const o = a, l = rs(), i = O(() => {
|
|
779
|
+
const r = l.meta?.blockUuid;
|
|
780
|
+
return typeof r == "string" && r.trim() ? r.trim() : o.uuid;
|
|
747
781
|
});
|
|
748
|
-
return (
|
|
782
|
+
return (r, f) => (c(), ls(uo, {
|
|
749
783
|
uuid: i.value,
|
|
750
|
-
name:
|
|
751
|
-
module:
|
|
752
|
-
theme:
|
|
784
|
+
name: a.name,
|
|
785
|
+
module: a.module,
|
|
786
|
+
theme: a.theme
|
|
753
787
|
}, null, 8, ["uuid", "name", "module", "theme"]));
|
|
754
788
|
}
|
|
755
789
|
});
|
|
756
|
-
function
|
|
757
|
-
return typeof
|
|
790
|
+
function ht(a) {
|
|
791
|
+
return typeof a == "string" ? a.trim() : "";
|
|
758
792
|
}
|
|
759
|
-
function
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
762
|
-
const l =
|
|
793
|
+
function co(a) {
|
|
794
|
+
const o = ht(a?.meta?.blockUuid);
|
|
795
|
+
if (o) return o;
|
|
796
|
+
const l = a?.props;
|
|
763
797
|
if (!l || typeof l != "object" || Array.isArray(l)) return "";
|
|
764
798
|
const i = l.default;
|
|
765
|
-
return !i || typeof i != "object" || Array.isArray(i) ? "" :
|
|
799
|
+
return !i || typeof i != "object" || Array.isArray(i) ? "" : ht(i.uuid);
|
|
766
800
|
}
|
|
767
|
-
function
|
|
801
|
+
function po(a, o) {
|
|
768
802
|
const l = [], i = /* @__PURE__ */ new Set();
|
|
769
|
-
for (const
|
|
770
|
-
if (!
|
|
771
|
-
const
|
|
772
|
-
if (!
|
|
773
|
-
i.add(
|
|
774
|
-
const m =
|
|
775
|
-
l.push({ uuid:
|
|
803
|
+
for (const r of a ?? []) {
|
|
804
|
+
if (!r || r.redirect || r.components?.default !== o) continue;
|
|
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
|
}
|
|
779
|
-
function
|
|
813
|
+
function bo(a, o, l) {
|
|
780
814
|
const i = /* @__PURE__ */ new Set();
|
|
781
|
-
for (const
|
|
782
|
-
return
|
|
783
|
-
}
|
|
784
|
-
const
|
|
785
|
-
function
|
|
786
|
-
const l = String(
|
|
787
|
-
if (l.length === 0) return `Page${
|
|
788
|
-
const i = l.map((
|
|
815
|
+
for (const r of l ?? []) i.add(ht(r));
|
|
816
|
+
return po(a, o).filter((r) => !i.has(r.uuid));
|
|
817
|
+
}
|
|
818
|
+
const ke = "pages.lock.ts";
|
|
819
|
+
function mo(a, o) {
|
|
820
|
+
const l = String(a || "").split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
821
|
+
if (l.length === 0) return `Page${o + 1}`;
|
|
822
|
+
const i = l.map((r) => r[0].toUpperCase() + r.slice(1)).join("");
|
|
789
823
|
return /^[0-9]/.test(i) ? `P${i}` : i;
|
|
790
824
|
}
|
|
791
|
-
function
|
|
792
|
-
if (!
|
|
793
|
-
return
|
|
825
|
+
function fo(a, o) {
|
|
826
|
+
if (!o.has(a))
|
|
827
|
+
return o.add(a), a;
|
|
794
828
|
let l = 2;
|
|
795
|
-
for (;
|
|
796
|
-
const i = `${
|
|
797
|
-
return
|
|
798
|
-
}
|
|
799
|
-
function
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
const b =
|
|
803
|
-
let
|
|
804
|
-
|
|
829
|
+
for (; o.has(`${a}${l}`); ) l += 1;
|
|
830
|
+
const i = `${a}${l}`;
|
|
831
|
+
return o.add(i), i;
|
|
832
|
+
}
|
|
833
|
+
function vo(a) {
|
|
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
|
-
const
|
|
840
|
+
const r = [
|
|
807
841
|
"/* 生成物:**每次导出都会重写**,别手改 —— 改了下次导出就没了。",
|
|
808
842
|
" *",
|
|
809
843
|
" * 这个文件回答「块的前端(index.open.html 那一侧)里我能跳哪些页面、能调什么」。",
|
|
@@ -829,17 +863,17 @@ function Xs(o) {
|
|
|
829
863
|
""
|
|
830
864
|
];
|
|
831
865
|
if (i.length === 0)
|
|
832
|
-
|
|
866
|
+
r.push("/* ⚠️ 这次导出没拿到路由表(这个应用没装 vue-router,或者一条页面路由都没有)。 */", "export const Page = {} as const", "");
|
|
833
867
|
else {
|
|
834
|
-
|
|
835
|
-
for (const
|
|
836
|
-
|
|
837
|
-
for (const m of
|
|
838
|
-
|
|
868
|
+
r.push("export const Page = {");
|
|
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
|
}
|
|
842
|
-
return
|
|
876
|
+
return r.push(
|
|
843
877
|
"/** `Page` 里那些路径的联合类型(只想收页面路径的参数可以写它)。 */",
|
|
844
878
|
"export type PagePath = (typeof Page)[keyof typeof Page]",
|
|
845
879
|
"",
|
|
@@ -891,387 +925,422 @@ function Xs(o) {
|
|
|
891
925
|
"",
|
|
892
926
|
"export {}",
|
|
893
927
|
""
|
|
894
|
-
),
|
|
928
|
+
), r.join(`
|
|
895
929
|
`);
|
|
896
930
|
}
|
|
897
|
-
function
|
|
931
|
+
function xn() {
|
|
898
932
|
return typeof window < "u" && typeof window.showDirectoryPicker == "function";
|
|
899
933
|
}
|
|
900
|
-
const
|
|
901
|
-
async function
|
|
902
|
-
if (!
|
|
934
|
+
const ho = "这个浏览器没法直接写你本机的文件夹(少了 File System Access API):请用 Chrome / Edge,并且从 https 或 http://localhost 打开这个页面(内网 http 会更少 API)。";
|
|
935
|
+
async function $e() {
|
|
936
|
+
if (!xn()) throw new Error(ho);
|
|
903
937
|
try {
|
|
904
|
-
const
|
|
905
|
-
return { name:
|
|
906
|
-
} catch (
|
|
907
|
-
const
|
|
908
|
-
throw
|
|
938
|
+
const a = await window.showDirectoryPicker({ mode: "readwrite", id: "labull-magic-block" });
|
|
939
|
+
return { name: a.name, handle: a };
|
|
940
|
+
} catch (a) {
|
|
941
|
+
const o = a instanceof Error ? a.name : "";
|
|
942
|
+
throw o === "AbortError" ? new Error("取消选目录了:想导出就再点一次「选择文件夹」") : o === "SecurityError" ? new Error(`选不了这个目录:浏览器不让(${ee(a)})—— 换一个目录,或确认页面是 https / localhost`) : new Error(`选目录失败:${ee(a)}`);
|
|
909
943
|
}
|
|
910
944
|
}
|
|
911
|
-
function
|
|
912
|
-
return (
|
|
945
|
+
function ee(a) {
|
|
946
|
+
return (a instanceof Error ? a.message.trim() : String(a)) || "没有说原因";
|
|
913
947
|
}
|
|
914
|
-
function
|
|
915
|
-
const
|
|
916
|
-
for (const l of
|
|
948
|
+
function Pe(a) {
|
|
949
|
+
const o = String(a ?? "").split("/");
|
|
950
|
+
for (const l of o)
|
|
917
951
|
if (!l || l === "." || l === ".." || l.includes("\\") || /^[A-Za-z]:/.test(l))
|
|
918
|
-
throw new Error(`路径不合法:${
|
|
919
|
-
return
|
|
952
|
+
throw new Error(`路径不合法:${a}(要相对路径,不许 .. / 盘符 / 反斜杠)`);
|
|
953
|
+
return o;
|
|
920
954
|
}
|
|
921
|
-
|
|
922
|
-
|
|
955
|
+
function _o(a) {
|
|
956
|
+
const o = String(a ?? "");
|
|
957
|
+
let l = 3735928559, i = 1103547991;
|
|
958
|
+
for (let r = 0; r < o.length; r += 1) {
|
|
959
|
+
const f = o.charCodeAt(r);
|
|
960
|
+
l = Math.imul(l ^ f, 2654435761), i = Math.imul(i ^ f, 1597334677);
|
|
961
|
+
}
|
|
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}`;
|
|
963
|
+
}
|
|
964
|
+
const go = 8;
|
|
965
|
+
async function vt(a, o) {
|
|
923
966
|
let l = 0;
|
|
924
967
|
const i = async () => {
|
|
925
968
|
for (; ; ) {
|
|
926
|
-
const
|
|
927
|
-
if (l += 1,
|
|
928
|
-
await a
|
|
969
|
+
const r = l;
|
|
970
|
+
if (l += 1, r >= a.length) return;
|
|
971
|
+
await o(a[r], r);
|
|
929
972
|
}
|
|
930
973
|
};
|
|
931
|
-
await Promise.all(Array.from({ length: Math.max(1, Math.min(
|
|
974
|
+
await Promise.all(Array.from({ length: Math.max(1, Math.min(go, a.length)) }, () => i()));
|
|
932
975
|
}
|
|
933
|
-
function
|
|
934
|
-
const
|
|
976
|
+
function yo(a) {
|
|
977
|
+
const o = /* @__PURE__ */ new Map();
|
|
935
978
|
return (l) => {
|
|
936
|
-
const i = l.join("\0"),
|
|
937
|
-
if (
|
|
938
|
-
let
|
|
979
|
+
const i = l.join("\0"), r = o.get(i);
|
|
980
|
+
if (r) return r;
|
|
981
|
+
let f = Promise.resolve(a);
|
|
939
982
|
for (let m = 0; m < l.length; m += 1) {
|
|
940
|
-
const b = l[m],
|
|
941
|
-
|
|
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);
|
|
942
985
|
}
|
|
943
|
-
return
|
|
986
|
+
return f;
|
|
944
987
|
};
|
|
945
988
|
}
|
|
946
|
-
async function
|
|
989
|
+
async function ko(a, o, l) {
|
|
947
990
|
try {
|
|
948
|
-
return await (await (await
|
|
991
|
+
return await (await (await a.getFileHandle(o)).getFile()).text() === l;
|
|
949
992
|
} catch {
|
|
950
993
|
return !1;
|
|
951
994
|
}
|
|
952
995
|
}
|
|
953
|
-
async function
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
|
|
996
|
+
async function $o(a, o, l, i = {}) {
|
|
997
|
+
const r = Object.entries(o ?? {}).map(([B, R]) => {
|
|
998
|
+
const L = String(R ?? "");
|
|
999
|
+
return { path: B, parts: Pe(B), body: L, digest: _o(L) };
|
|
1000
|
+
}), f = r.length, m = [], b = yo(a.handle), h = i.verify === !0, v = i.trust, w = i.existing, _ = /* @__PURE__ */ new Map();
|
|
1001
|
+
let g = 0, M = 0, F = 0;
|
|
1002
|
+
return l?.(0, f), await vt(r, async (B) => {
|
|
957
1003
|
try {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
w += 1;
|
|
1004
|
+
if (v?.get(B.path) === B.digest && (w?.has(B.path) ?? !1))
|
|
1005
|
+
F += 1, _.set(B.path, B.digest);
|
|
961
1006
|
else {
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
await
|
|
1007
|
+
const R = await b(B.parts.slice(0, -1)), L = B.parts[B.parts.length - 1];
|
|
1008
|
+
if (h && await ko(R, L, B.body))
|
|
1009
|
+
M += 1, _.set(B.path, B.digest);
|
|
1010
|
+
else {
|
|
1011
|
+
const pt = await (await R.getFileHandle(L, { create: !0 })).createWritable();
|
|
1012
|
+
try {
|
|
1013
|
+
await pt.write(B.body);
|
|
1014
|
+
} finally {
|
|
1015
|
+
await pt.close();
|
|
1016
|
+
}
|
|
1017
|
+
g += 1, _.set(B.path, B.digest);
|
|
967
1018
|
}
|
|
968
|
-
f += 1;
|
|
969
1019
|
}
|
|
970
|
-
} catch (
|
|
971
|
-
m.push({ path:
|
|
1020
|
+
} catch (R) {
|
|
1021
|
+
m.push({ path: B.path, message: ee(R) });
|
|
972
1022
|
}
|
|
973
|
-
l?.(
|
|
974
|
-
}), m.sort((
|
|
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: _ };
|
|
975
1025
|
}
|
|
976
|
-
async function
|
|
1026
|
+
async function we(a, o) {
|
|
977
1027
|
const l = { items: [], topCount: 0, files: 0, dirs: 0 }, i = async (m, b) => {
|
|
978
|
-
const
|
|
979
|
-
for (const
|
|
980
|
-
if (
|
|
1028
|
+
const h = [];
|
|
1029
|
+
for (const v of await Mt(m)) {
|
|
1030
|
+
if (v.kind === "file") {
|
|
981
1031
|
l.files += 1;
|
|
982
1032
|
continue;
|
|
983
1033
|
}
|
|
984
|
-
l.dirs += 1, !(b >=
|
|
1034
|
+
l.dirs += 1, !(b >= o.maxDepth) && (o.skipDirs.includes(v.name) || h.push(v));
|
|
985
1035
|
}
|
|
986
|
-
await
|
|
987
|
-
},
|
|
988
|
-
for (const m of
|
|
1036
|
+
await vt(h, (v) => i(v, b + 1));
|
|
1037
|
+
}, r = await Mt(a.handle), f = [];
|
|
1038
|
+
for (const m of r)
|
|
989
1039
|
if (l.items.push({ name: m.name, dir: m.kind === "directory" }), m.kind === "file") l.files += 1;
|
|
990
1040
|
else {
|
|
991
|
-
if (l.dirs += 1,
|
|
992
|
-
|
|
1041
|
+
if (l.dirs += 1, o.skipDirs.includes(m.name) || o.maxDepth <= 0) continue;
|
|
1042
|
+
f.push(m);
|
|
993
1043
|
}
|
|
994
|
-
return await
|
|
1044
|
+
return await vt(f, (m) => i(m, 1)), l.topCount = l.items.length, l;
|
|
995
1045
|
}
|
|
996
|
-
async function
|
|
997
|
-
const
|
|
998
|
-
for (const i of await
|
|
1046
|
+
async function wo(a) {
|
|
1047
|
+
const o = [];
|
|
1048
|
+
for (const i of await Mt(a.handle)) o.push(i.name);
|
|
999
1049
|
let l = 0;
|
|
1000
|
-
return await
|
|
1001
|
-
await
|
|
1050
|
+
return await vt(o, async (i) => {
|
|
1051
|
+
await a.handle.removeEntry(i, { recursive: !0 }), l += 1;
|
|
1002
1052
|
}), l;
|
|
1003
1053
|
}
|
|
1004
|
-
async function
|
|
1005
|
-
const l
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
for (
|
|
1054
|
+
async function xo(a, o) {
|
|
1055
|
+
const { wantedFiles: l, wantedDirs: i } = Cn(o), r = /* @__PURE__ */ new Set();
|
|
1056
|
+
let f = 0;
|
|
1057
|
+
const m = async (b, h) => {
|
|
1058
|
+
const v = [], w = [];
|
|
1059
|
+
for (const _ of await Mt(b)) {
|
|
1060
|
+
const g = h ? `${h}/${_.name}` : _.name;
|
|
1061
|
+
if (_.kind === "file") {
|
|
1062
|
+
l.has(g) ? r.add(g) : v.push(_.name);
|
|
1063
|
+
continue;
|
|
1064
|
+
}
|
|
1065
|
+
i.has(g) ? w.push([g, _]) : v.push(_.name);
|
|
1066
|
+
}
|
|
1067
|
+
await vt(v, async (_) => {
|
|
1068
|
+
await b.removeEntry(_, { recursive: !0 }), f += 1;
|
|
1069
|
+
}), await vt(w, ([_, g]) => m(g, _));
|
|
1070
|
+
};
|
|
1071
|
+
return await m(a.handle, ""), { removed: f, existing: r };
|
|
1072
|
+
}
|
|
1073
|
+
function Cn(a) {
|
|
1074
|
+
const o = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
|
|
1075
|
+
for (const i of Object.keys(a ?? {})) {
|
|
1076
|
+
const r = Pe(i);
|
|
1077
|
+
o.add(r.join("/"));
|
|
1078
|
+
for (let f = 1; f < r.length; f += 1) l.add(r.slice(0, f).join("/"));
|
|
1010
1079
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1080
|
+
return { wantedFiles: o, wantedDirs: l };
|
|
1081
|
+
}
|
|
1082
|
+
async function Co(a, o) {
|
|
1083
|
+
const { wantedFiles: l, wantedDirs: i } = Cn(o), r = /* @__PURE__ */ new Set(), f = async (m, b) => {
|
|
1084
|
+
const h = [];
|
|
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);
|
|
1018
1089
|
continue;
|
|
1019
1090
|
}
|
|
1020
|
-
i.has(
|
|
1091
|
+
i.has(w) && h.push([w, v]);
|
|
1021
1092
|
}
|
|
1022
|
-
await
|
|
1023
|
-
await m.removeEntry(w, { recursive: !0 }), d += 1;
|
|
1024
|
-
}), await ft(f, ([w, h]) => v(h, w));
|
|
1093
|
+
await vt(h, ([v, w]) => f(w, v));
|
|
1025
1094
|
};
|
|
1026
|
-
return await
|
|
1095
|
+
return await f(a.handle, ""), r;
|
|
1027
1096
|
}
|
|
1028
|
-
function
|
|
1029
|
-
if (
|
|
1097
|
+
function Eo(a, o) {
|
|
1098
|
+
if (a.name === o.blocksDir)
|
|
1030
1099
|
throw new Error(
|
|
1031
|
-
`你选中的是「${
|
|
1100
|
+
`你选中的是「${o.blocksDir}」这一层(它就是放代码的那一层):导出会铺成 ${o.blocksDir}/${o.blocksDir}/…。请选它**上面**那一层 —— 也就是开发目录本身。`
|
|
1032
1101
|
);
|
|
1033
1102
|
}
|
|
1034
|
-
async function
|
|
1035
|
-
const
|
|
1036
|
-
for await (const l of
|
|
1037
|
-
return
|
|
1103
|
+
async function Mt(a) {
|
|
1104
|
+
const o = [];
|
|
1105
|
+
for await (const l of a.values()) o.push(l);
|
|
1106
|
+
return o.sort((l, i) => l.name < i.name ? -1 : l.name > i.name ? 1 : 0), o;
|
|
1038
1107
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return
|
|
1108
|
+
function So(a) {
|
|
1109
|
+
return a.charCodeAt(0) === 65279 ? a.slice(1) : a;
|
|
1041
1110
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const
|
|
1044
|
-
return
|
|
1111
|
+
function To(a) {
|
|
1112
|
+
const o = a.lastIndexOf(".");
|
|
1113
|
+
return o <= 0 ? "" : a.slice(o).toLowerCase();
|
|
1045
1114
|
}
|
|
1046
|
-
const
|
|
1047
|
-
async function
|
|
1048
|
-
const i = await
|
|
1049
|
-
await
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1115
|
+
const Bo = { folders: [], failures: [], truncated: !1 };
|
|
1116
|
+
async function En(a, o, l) {
|
|
1117
|
+
const i = await Mt(a), r = new Array(i.length);
|
|
1118
|
+
await vt(i, async (b, h) => {
|
|
1119
|
+
const v = o ? `${o}/${b.name}` : b.name, w = { files: {}, failures: [] };
|
|
1120
|
+
if (r[h] = w, b.kind === "directory") {
|
|
1052
1121
|
if (l.skipDirs.includes(b.name)) return;
|
|
1053
|
-
const g = await
|
|
1054
|
-
for (const [
|
|
1055
|
-
w.files[`${b.name}/${
|
|
1122
|
+
const g = await En(b, v, l);
|
|
1123
|
+
for (const [M, F] of Object.entries(g.files))
|
|
1124
|
+
w.files[`${b.name}/${M}`] = F;
|
|
1056
1125
|
w.failures.push(...g.failures);
|
|
1057
1126
|
return;
|
|
1058
1127
|
}
|
|
1059
1128
|
if (!l.platformFiles.includes(b.name)) {
|
|
1060
|
-
if (!l.textExt.includes(
|
|
1129
|
+
if (!l.textExt.includes(To(b.name))) {
|
|
1061
1130
|
w.failures.push({
|
|
1062
1131
|
kind: "file",
|
|
1063
|
-
where:
|
|
1132
|
+
where: v,
|
|
1064
1133
|
message: `不是文本文件(认得的扩展名:${l.textExt.join(" ")}),已跳过`
|
|
1065
1134
|
});
|
|
1066
1135
|
return;
|
|
1067
1136
|
}
|
|
1068
1137
|
try {
|
|
1069
|
-
const
|
|
1070
|
-
if (
|
|
1138
|
+
const _ = await b.getFile();
|
|
1139
|
+
if (_.size > l.maxFileBytes) {
|
|
1071
1140
|
w.failures.push({
|
|
1072
1141
|
kind: "file",
|
|
1073
|
-
where:
|
|
1074
|
-
message: `文件 ${Math.round(
|
|
1142
|
+
where: v,
|
|
1143
|
+
message: `文件 ${Math.round(_.size / 1024)} KB 超过上限 ${Math.floor(l.maxFileBytes / 1024)} KB,已跳过`
|
|
1075
1144
|
});
|
|
1076
1145
|
return;
|
|
1077
1146
|
}
|
|
1078
|
-
w.files[b.name] =
|
|
1079
|
-
} catch (
|
|
1080
|
-
w.failures.push({ kind: "file", where:
|
|
1147
|
+
w.files[b.name] = So(await _.text());
|
|
1148
|
+
} catch (_) {
|
|
1149
|
+
w.failures.push({ kind: "file", where: v, message: `读不了这个文件:${ee(_)}` });
|
|
1081
1150
|
}
|
|
1082
1151
|
}
|
|
1083
1152
|
});
|
|
1084
|
-
const
|
|
1085
|
-
for (const b of
|
|
1086
|
-
b && (Object.assign(
|
|
1087
|
-
return { files:
|
|
1088
|
-
}
|
|
1089
|
-
async function
|
|
1090
|
-
const
|
|
1091
|
-
if (
|
|
1092
|
-
const
|
|
1093
|
-
return
|
|
1153
|
+
const f = {}, m = [];
|
|
1154
|
+
for (const b of r)
|
|
1155
|
+
b && (Object.assign(f, b.files), m.push(...b.failures));
|
|
1156
|
+
return { files: f, failures: m };
|
|
1157
|
+
}
|
|
1158
|
+
async function Sn(a, o, l, i) {
|
|
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)) {
|
|
1161
|
+
const _ = await En(a, b, i);
|
|
1162
|
+
return h.folders.push({ where: b, files: _.files }), h.failures.push(..._.failures), h;
|
|
1094
1163
|
}
|
|
1095
|
-
for (const
|
|
1096
|
-
|
|
1164
|
+
for (const _ of m)
|
|
1165
|
+
o.length === 0 && i.rootSkipFiles.includes(_.name.toLowerCase()) || h.failures.push({
|
|
1097
1166
|
kind: "file",
|
|
1098
|
-
where: [...
|
|
1167
|
+
where: [...o, _.name].join("/"),
|
|
1099
1168
|
message: `这一层直接放着一份文件,但它自己不是块文件夹、也没有 ${i.entry},文件没有归属`
|
|
1100
1169
|
});
|
|
1101
|
-
const
|
|
1170
|
+
const v = f.map((_) => async () => i.skipDirs.includes(_.name) ? Bo : l >= i.maxDepth ? {
|
|
1102
1171
|
folders: [],
|
|
1103
1172
|
failures: [{
|
|
1104
1173
|
kind: "dir",
|
|
1105
|
-
where: [...
|
|
1174
|
+
where: [...o, _.name].join("/"),
|
|
1106
1175
|
message: `超过最大层数 ${i.maxDepth} 层还没见到 ${i.entry},没有继续往下找`
|
|
1107
1176
|
}],
|
|
1108
1177
|
truncated: !0
|
|
1109
|
-
} :
|
|
1110
|
-
await
|
|
1111
|
-
w[g] = await
|
|
1178
|
+
} : Sn(_, [...o, _.name], l + 1, i)), w = new Array(v.length);
|
|
1179
|
+
await vt(v, async (_, g) => {
|
|
1180
|
+
w[g] = await _();
|
|
1112
1181
|
});
|
|
1113
|
-
for (const
|
|
1114
|
-
|
|
1115
|
-
return
|
|
1182
|
+
for (const _ of w)
|
|
1183
|
+
_ && (h.folders.push(..._.folders), h.failures.push(..._.failures), _.truncated && (h.truncated = !0));
|
|
1184
|
+
return h;
|
|
1116
1185
|
}
|
|
1117
|
-
function
|
|
1118
|
-
return
|
|
1186
|
+
function an(a) {
|
|
1187
|
+
return a >= 1024 * 1024 ? `${(a / 1024 / 1024).toFixed(1)} MB` : `${Math.max(1, Math.round(a / 1024))} KB`;
|
|
1119
1188
|
}
|
|
1120
|
-
async function
|
|
1121
|
-
const l = await
|
|
1122
|
-
root:
|
|
1189
|
+
async function Mo(a, o) {
|
|
1190
|
+
const l = await Sn(a.handle, [], 0, o), i = {
|
|
1191
|
+
root: a.name,
|
|
1123
1192
|
folders: l.folders,
|
|
1124
1193
|
failures: l.failures,
|
|
1125
1194
|
truncated: l.truncated
|
|
1126
|
-
},
|
|
1127
|
-
(
|
|
1195
|
+
}, r = i.folders.reduce(
|
|
1196
|
+
(f, m) => f + Object.values(m.files).reduce((b, h) => b + h.length, 0),
|
|
1128
1197
|
0
|
|
1129
1198
|
);
|
|
1130
|
-
if (
|
|
1199
|
+
if (r > o.maxBodyBytes)
|
|
1131
1200
|
throw new Error(
|
|
1132
|
-
`这个目录读到的正文有 ${
|
|
1201
|
+
`这个目录读到的正文有 ${an(r)},超过一次读回的上限 ${an(o.maxBodyBytes)}:请先只留要改的那几个块,或者把大文件挪走。`
|
|
1133
1202
|
);
|
|
1134
1203
|
return i;
|
|
1135
1204
|
}
|
|
1136
|
-
const
|
|
1205
|
+
const Ao = { class: "mbc__head" }, Ro = ["title"], Oo = ["title"], Po = {
|
|
1137
1206
|
class: "mbc__tabs",
|
|
1138
1207
|
role: "tablist"
|
|
1139
|
-
},
|
|
1208
|
+
}, Lo = ["aria-selected"], jo = { class: "mbc__count" }, Do = ["title"], Io = ["aria-selected"], No = ["title"], Fo = {
|
|
1140
1209
|
key: 1,
|
|
1141
1210
|
class: "mbc__chip is-ok"
|
|
1142
|
-
},
|
|
1211
|
+
}, zo = { class: "mbc__body" }, Uo = {
|
|
1143
1212
|
key: 0,
|
|
1144
1213
|
class: "mbc__running"
|
|
1145
|
-
},
|
|
1214
|
+
}, Ho = ["aria-valuenow"], Ko = {
|
|
1146
1215
|
key: 1,
|
|
1147
1216
|
class: "mbc__confirm"
|
|
1148
|
-
},
|
|
1217
|
+
}, Vo = { class: "mbc__confirm-title" }, qo = { class: "mbc__confirm-body" }, Jo = {
|
|
1149
1218
|
key: 0,
|
|
1150
1219
|
class: "mbc__mono"
|
|
1151
|
-
},
|
|
1220
|
+
}, Go = { class: "mbc__confirm-check" }, Wo = { class: "mbc__actions" }, Yo = ["disabled"], Zo = ["disabled"], Xo = ["disabled"], Qo = {
|
|
1152
1221
|
key: 2,
|
|
1153
1222
|
class: "mbc__confirm"
|
|
1154
|
-
},
|
|
1223
|
+
}, ta = { class: "mbc__confirm-title" }, ea = { class: "mbc__confirm-body" }, na = { class: "mbc__mono" }, sa = { class: "mbc__actions" }, oa = ["disabled"], aa = ["disabled"], la = { class: "mbc__panel mbc__panel--blocks" }, ia = { class: "mbc__title" }, ua = { class: "mbc__count" }, ra = {
|
|
1155
1224
|
key: 0,
|
|
1156
1225
|
class: "mbc__count mbc__count--tag"
|
|
1157
|
-
},
|
|
1226
|
+
}, ca = {
|
|
1158
1227
|
key: 0,
|
|
1159
1228
|
class: "mbc__tagbar"
|
|
1160
|
-
},
|
|
1229
|
+
}, da = ["title", "onClick"], pa = { class: "mbc__list" }, ba = ["title", "onClick"], ma = { class: "mbc__module" }, fa = { class: "mbc__name" }, va = ["title"], ha = {
|
|
1161
1230
|
key: 0,
|
|
1162
1231
|
class: "mbc__where"
|
|
1163
|
-
},
|
|
1232
|
+
}, _a = ["title"], ga = {
|
|
1164
1233
|
key: 0,
|
|
1165
1234
|
class: "mbc__detail"
|
|
1166
|
-
},
|
|
1235
|
+
}, ya = {
|
|
1167
1236
|
key: 0,
|
|
1168
1237
|
class: "mbc__hint"
|
|
1169
|
-
},
|
|
1238
|
+
}, ka = { class: "mbc__meta" }, $a = {
|
|
1170
1239
|
key: 0,
|
|
1171
1240
|
class: "mbc__blockdetail"
|
|
1172
|
-
},
|
|
1241
|
+
}, wa = {
|
|
1173
1242
|
key: 1,
|
|
1174
1243
|
class: "mbc__hint"
|
|
1175
|
-
},
|
|
1244
|
+
}, xa = ["disabled", "onClick"], Ca = ["disabled", "onClick"], Ea = ["disabled"], Sa = { class: "mbc__hint" }, Ta = {
|
|
1176
1245
|
key: 0,
|
|
1177
1246
|
class: "mbc__hint"
|
|
1178
|
-
},
|
|
1247
|
+
}, Ba = ["disabled", "onClick"], Ma = ["onKeyup"], Aa = ["disabled", "onClick"], Ra = ["disabled"], Oa = {
|
|
1179
1248
|
key: 0,
|
|
1180
1249
|
class: "mbc__tagbar"
|
|
1181
|
-
},
|
|
1250
|
+
}, Pa = ["title", "onClick"], La = {
|
|
1182
1251
|
key: 1,
|
|
1183
1252
|
class: "mbc__tagbar"
|
|
1184
|
-
},
|
|
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 = {
|
|
1185
1254
|
key: 0,
|
|
1186
1255
|
class: "mbc__hint"
|
|
1187
|
-
},
|
|
1256
|
+
}, Ka = {
|
|
1188
1257
|
key: 1,
|
|
1189
1258
|
class: "mbc__versions-list"
|
|
1190
|
-
},
|
|
1259
|
+
}, Va = { class: "mbc__mono" }, qa = { class: "mbc__hint" }, Ja = { class: "mbc__actions" }, Ga = ["disabled", "onClick", "title"], Wa = ["disabled", "onClick", "title"], Ya = ["disabled", "onClick", "title"], Za = ["disabled", "onClick", "title"], Xa = {
|
|
1191
1260
|
key: 2,
|
|
1192
1261
|
class: "mbc__hint"
|
|
1193
|
-
},
|
|
1262
|
+
}, Qa = {
|
|
1194
1263
|
key: 3,
|
|
1195
1264
|
class: "mbc__viewer"
|
|
1196
|
-
},
|
|
1265
|
+
}, tl = { class: "mbc__versions-head" }, el = { class: "mbc__mono" }, nl = { class: "mbc__viewer-body" }, sl = { class: "mbc__panel mbc__panel--export" }, ol = { class: "mbc__field" }, al = ["disabled"], ll = { class: "mbc__field" }, il = { class: "mbc__radio" }, ul = ["checked"], rl = { class: "mbc__radio" }, cl = ["checked"], dl = ["value", "disabled"], pl = {
|
|
1197
1266
|
key: 0,
|
|
1198
1267
|
value: ""
|
|
1199
|
-
},
|
|
1268
|
+
}, bl = ["value"], ml = { class: "mbc__field" }, fl = ["value"], vl = ["disabled"], hl = ["disabled", "title"], _l = { class: "mbc__hint" }, gl = {
|
|
1200
1269
|
key: 0,
|
|
1201
1270
|
class: "mbc__hint"
|
|
1202
|
-
},
|
|
1271
|
+
}, yl = { class: "mbc__panel mbc__panel--read" }, kl = { class: "mbc__field" }, $l = ["value"], wl = ["disabled"], xl = ["disabled"], Cl = {
|
|
1203
1272
|
key: 0,
|
|
1204
1273
|
class: "mbc__hint"
|
|
1205
|
-
},
|
|
1274
|
+
}, El = {
|
|
1206
1275
|
key: 1,
|
|
1207
1276
|
class: "mbc__hint"
|
|
1208
|
-
},
|
|
1277
|
+
}, Sl = {
|
|
1209
1278
|
key: 0,
|
|
1210
1279
|
class: "mbc__hint"
|
|
1211
|
-
},
|
|
1280
|
+
}, Tl = { class: "mbc__ok-text" }, Bl = ["disabled"], Ml = ["disabled"], Al = {
|
|
1212
1281
|
key: 1,
|
|
1213
1282
|
class: "mbc__scan"
|
|
1214
|
-
},
|
|
1283
|
+
}, Rl = { class: "mbc__pick" }, Ol = ["disabled", "checked", "onChange"], Pl = { class: "mbc__name" }, Ll = { class: "mbc__module" }, jl = { class: "mbc__hint" }, Dl = { class: "mbc__mono" }, Il = {
|
|
1215
1284
|
key: 0,
|
|
1216
1285
|
class: "mbc__problem"
|
|
1217
|
-
},
|
|
1286
|
+
}, Nl = { class: "mbc__hint mbc__mono" }, Fl = {
|
|
1218
1287
|
key: 2,
|
|
1219
1288
|
class: "mbc__hint"
|
|
1220
|
-
},
|
|
1289
|
+
}, zl = { class: "mbc__field" }, Ul = ["title"], Hl = {
|
|
1221
1290
|
key: 1,
|
|
1222
1291
|
class: "mbc__chip is-ok"
|
|
1223
|
-
},
|
|
1292
|
+
}, Kl = ["title"], Vl = {
|
|
1224
1293
|
key: 3,
|
|
1225
1294
|
class: "mbc__hint"
|
|
1226
|
-
},
|
|
1295
|
+
}, ql = { class: "mbc__field mbc__field--end" }, Jl = ["disabled"], Gl = { class: "mbc__panel mbc__panel--declared" }, Wl = { class: "mbc__title" }, Yl = { class: "p-tag p-tag-info" }, Zl = { class: "mbc__count" }, Xl = {
|
|
1227
1296
|
key: 0,
|
|
1228
1297
|
class: "mbc__hint"
|
|
1229
|
-
},
|
|
1298
|
+
}, Ql = { class: "mbc__hint" }, ti = { class: "mbc__scan" }, ei = { class: "mbc__pick" }, ni = { class: "mbc__name" }, si = { class: "p-tag p-tag-info" }, oi = { class: "mbc__module" }, ai = { class: "mbc__hint" }, li = { class: "mbc__mono" }, ii = { class: "mbc__hint mbc__mono" }, ui = {
|
|
1230
1299
|
key: 3,
|
|
1231
1300
|
class: "mbc__panel mbc__panel--result"
|
|
1232
|
-
},
|
|
1301
|
+
}, ri = { class: "mbc__summary" }, ci = { class: "mbc__chip is-ok" }, di = {
|
|
1233
1302
|
key: 0,
|
|
1234
1303
|
class: "mbc__chip is-bad"
|
|
1235
|
-
},
|
|
1304
|
+
}, pi = {
|
|
1236
1305
|
key: 1,
|
|
1237
1306
|
class: "mbc__chip is-bad"
|
|
1238
|
-
},
|
|
1307
|
+
}, bi = {
|
|
1239
1308
|
key: 2,
|
|
1240
1309
|
class: "mbc__hint"
|
|
1241
|
-
},
|
|
1310
|
+
}, mi = { class: "mbc__actions" }, fi = { class: "mbc__foot" }, vi = ["title"], hi = {
|
|
1242
1311
|
key: 1,
|
|
1243
1312
|
class: "mbc__error"
|
|
1244
|
-
},
|
|
1313
|
+
}, _i = {
|
|
1245
1314
|
key: 2,
|
|
1246
1315
|
class: "mbc__notice"
|
|
1247
|
-
},
|
|
1316
|
+
}, gi = {
|
|
1248
1317
|
key: 3,
|
|
1249
1318
|
class: "mbc__hint mbc__foot-idle"
|
|
1250
|
-
},
|
|
1319
|
+
}, yi = { class: "mbc__modal-box" }, ki = { class: "mbc__modal-head" }, $i = { class: "mbc__modal-body" }, wi = {
|
|
1251
1320
|
key: 0,
|
|
1252
1321
|
class: "mbc__issues-group"
|
|
1253
|
-
},
|
|
1322
|
+
}, xi = { class: "mbc__title" }, Ci = { class: "mbc__failures" }, Ei = {
|
|
1254
1323
|
key: 1,
|
|
1255
1324
|
class: "mbc__issues-group"
|
|
1256
|
-
},
|
|
1325
|
+
}, Si = { class: "mbc__title" }, Ti = { class: "mbc__failures" }, Bi = { class: "mbc__kind" }, Mi = { class: "mbc__mono" }, Ai = {
|
|
1257
1326
|
key: 2,
|
|
1258
1327
|
class: "mbc__issues-group"
|
|
1259
|
-
},
|
|
1328
|
+
}, Ri = { class: "mbc__title" }, Oi = { class: "mbc__failures" }, Pi = { class: "mbc__mono" }, Li = {
|
|
1260
1329
|
key: 3,
|
|
1261
1330
|
class: "mbc__issues-group"
|
|
1262
|
-
},
|
|
1331
|
+
}, ji = { class: "mbc__title" }, Di = { class: "mbc__failures" }, Ii = { key: 0 }, Ni = {
|
|
1263
1332
|
key: 1,
|
|
1264
1333
|
class: "mbc__failures mbc__failures--nested"
|
|
1265
|
-
},
|
|
1334
|
+
}, Fi = {
|
|
1266
1335
|
key: 4,
|
|
1267
1336
|
class: "mbc__hint"
|
|
1268
|
-
},
|
|
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 = {
|
|
1269
1338
|
key: 0,
|
|
1270
1339
|
class: "mbc__hint"
|
|
1271
|
-
},
|
|
1340
|
+
}, Yi = { class: "mbc__modal-foot" }, xe = 2, Zi = 100, Xi = 250, Qi = /* @__PURE__ */ Re({
|
|
1272
1341
|
__name: "MagicBlockConsole",
|
|
1273
|
-
setup(
|
|
1274
|
-
const
|
|
1342
|
+
setup(a) {
|
|
1343
|
+
const o = {
|
|
1275
1344
|
modified: "有改动",
|
|
1276
1345
|
unchanged: "没改动",
|
|
1277
1346
|
missing: "目录里没有",
|
|
@@ -1279,115 +1348,115 @@ const po = { class: "mbc__head" }, bo = ["title"], mo = ["title"], fo = {
|
|
|
1279
1348
|
两种情形共用它(前端声明了、手里却还没有那个文件夹 / 手里那个文件夹的清单 id 库里没有)
|
|
1280
1349
|
—— 对用户是同一件事:这个块不在库里。 */
|
|
1281
1350
|
"not-in-db": "不在数据库"
|
|
1282
|
-
}, l =
|
|
1283
|
-
function
|
|
1284
|
-
|
|
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) {
|
|
1353
|
+
$t.value = n;
|
|
1285
1354
|
try {
|
|
1286
1355
|
window.localStorage.setItem("mb:export-block", n);
|
|
1287
1356
|
} catch {
|
|
1288
1357
|
}
|
|
1289
1358
|
}
|
|
1290
|
-
function
|
|
1359
|
+
function Ht() {
|
|
1291
1360
|
try {
|
|
1292
1361
|
return window.localStorage.getItem("mb:export-block") ?? "";
|
|
1293
1362
|
} catch {
|
|
1294
1363
|
return "";
|
|
1295
1364
|
}
|
|
1296
1365
|
}
|
|
1297
|
-
|
|
1298
|
-
n.length !== 0 && (n.some((t) => t.id ===
|
|
1366
|
+
Ot(v, (n) => {
|
|
1367
|
+
n.length !== 0 && (n.some((t) => t.id === $t.value) || Ut(n[0].id));
|
|
1299
1368
|
});
|
|
1300
|
-
const
|
|
1301
|
-
async function
|
|
1302
|
-
|
|
1369
|
+
const Q = x(null), V = x(""), A = x(null), it = x({}), W = x([]), Y = x([]), st = x({}), $ = x(""), E = x(null);
|
|
1370
|
+
async function j(n) {
|
|
1371
|
+
$.value = n;
|
|
1303
1372
|
try {
|
|
1304
|
-
const t = await
|
|
1305
|
-
|
|
1373
|
+
const t = await at(`/magic-blocks/${encodeURIComponent(n)}/versions`);
|
|
1374
|
+
st.value = { ...st.value, [n]: t.versions ?? [] };
|
|
1306
1375
|
} catch (t) {
|
|
1307
|
-
|
|
1376
|
+
Nt(t, "读版本列表");
|
|
1308
1377
|
} finally {
|
|
1309
|
-
|
|
1378
|
+
$.value = "";
|
|
1310
1379
|
}
|
|
1311
1380
|
}
|
|
1312
|
-
function
|
|
1381
|
+
function ut(n) {
|
|
1313
1382
|
const t = [n.current ? "当前" : "", n.empty ? "空包(代码被删过)" : ""].filter(Boolean).join("、");
|
|
1314
1383
|
return `v${n.number}${t ? ` · ${t}` : ""}`;
|
|
1315
1384
|
}
|
|
1316
|
-
function
|
|
1385
|
+
function jt(n) {
|
|
1317
1386
|
return n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
1318
1387
|
}
|
|
1319
|
-
const
|
|
1320
|
-
function
|
|
1388
|
+
const U = x(null);
|
|
1389
|
+
function Dt(n, t) {
|
|
1321
1390
|
return `${String(t || "").replace(/[\\/:*?"<>|]/g, "").trim() || "block"}-${n}`;
|
|
1322
1391
|
}
|
|
1323
|
-
const
|
|
1324
|
-
const t =
|
|
1325
|
-
let e =
|
|
1392
|
+
const ne = (n) => J(async () => {
|
|
1393
|
+
const t = Dt(n.id, n.name || n.module);
|
|
1394
|
+
let e = K.value, u = null;
|
|
1326
1395
|
if (e)
|
|
1327
1396
|
try {
|
|
1328
|
-
u = await
|
|
1397
|
+
u = await we(e, Q.value ?? await pe());
|
|
1329
1398
|
} catch {
|
|
1330
1399
|
e = null, u = null;
|
|
1331
1400
|
}
|
|
1332
|
-
|
|
1333
|
-
}, C),
|
|
1334
|
-
const n =
|
|
1335
|
-
if (
|
|
1401
|
+
U.value = { row: n, target: e, folder: t, inventory: u };
|
|
1402
|
+
}, C), se = () => J(async () => {
|
|
1403
|
+
const n = U.value;
|
|
1404
|
+
if (U.value = null, !n) return;
|
|
1336
1405
|
const t = `「${n.row.module} / ${n.row.name || n.row.id}」`;
|
|
1337
|
-
|
|
1406
|
+
je(), N.value = { active: !0, percent: 0, stage: "清本机那个文件夹…", failed: !1 };
|
|
1338
1407
|
let e = "";
|
|
1339
1408
|
if (n.target)
|
|
1340
1409
|
try {
|
|
1341
|
-
const u = await
|
|
1342
|
-
e = `清掉了本机「${n.target.name}/${n.folder}」里的 ${
|
|
1410
|
+
const u = await oe(n.target, n.folder), S = await wo(u);
|
|
1411
|
+
e = `清掉了本机「${n.target.name}/${n.folder}」里的 ${S} 项`;
|
|
1343
1412
|
} catch (u) {
|
|
1344
|
-
e = `本机那份没清成(${
|
|
1413
|
+
e = `本机那份没清成(${Rt(u)})`;
|
|
1345
1414
|
}
|
|
1346
1415
|
else
|
|
1347
1416
|
e = "没选开发目录 ⇒ 本机那份没动";
|
|
1348
1417
|
ot(60, "清库里那份代码…");
|
|
1349
1418
|
try {
|
|
1350
|
-
await
|
|
1419
|
+
await at(`/magic-blocks/${n.row.id}`, { method: "DELETE" });
|
|
1351
1420
|
} catch (u) {
|
|
1352
|
-
throw
|
|
1421
|
+
throw xt(!1, "本机清了,但库里那份代码没清成"), new Error(`${e};但**库里那份代码没清成**(${Rt(u)})—— 再点一次「删除代码文件」`);
|
|
1353
1422
|
}
|
|
1354
|
-
await
|
|
1423
|
+
await Et(), V.value = `${t}的代码文件已删除:${e};库里那一份也清空了 ——**块还在**(页面上会显示成占位框)。想找回来:上面「块」那一屏点开这一块 → 版本史 → 对上一版点「切回」`, g.value = `删掉了${t}的代码文件(块本身还在)`, xt(!0, "完成");
|
|
1355
1424
|
}, C);
|
|
1356
|
-
async function
|
|
1425
|
+
async function oe(n, t) {
|
|
1357
1426
|
let e = n.handle;
|
|
1358
|
-
for (const u of
|
|
1427
|
+
for (const u of Pe(t))
|
|
1359
1428
|
e = await e.getDirectoryHandle(u, { create: !0 });
|
|
1360
1429
|
return { handle: e, name: `${n.name}/${t}` };
|
|
1361
1430
|
}
|
|
1362
|
-
const
|
|
1363
|
-
width: `${Math.max(0, Math.min(100,
|
|
1364
|
-
background:
|
|
1431
|
+
const q = x(null), Kt = x(!1), N = x({ active: !1, percent: 0, stage: "", failed: !1 }), Tn = O(() => ({
|
|
1432
|
+
width: `${Math.max(0, Math.min(100, N.value.percent))}%`,
|
|
1433
|
+
background: N.value.failed ? "var(--sp-color-danger)" : "var(--sp-color-primary, var(--primary-color))"
|
|
1365
1434
|
}));
|
|
1366
|
-
let
|
|
1367
|
-
function
|
|
1368
|
-
if (!(!n && performance.now() -
|
|
1369
|
-
|
|
1435
|
+
let ae = [], Le = 0;
|
|
1436
|
+
function le(n = !1) {
|
|
1437
|
+
if (!(!n && performance.now() - Le < Xi)) {
|
|
1438
|
+
Le = performance.now();
|
|
1370
1439
|
try {
|
|
1371
|
-
window.localStorage.setItem("mb:progress", JSON.stringify(
|
|
1440
|
+
window.localStorage.setItem("mb:progress", JSON.stringify(ae));
|
|
1372
1441
|
} catch {
|
|
1373
1442
|
}
|
|
1374
1443
|
}
|
|
1375
1444
|
}
|
|
1376
1445
|
function ot(n, t) {
|
|
1377
|
-
|
|
1446
|
+
N.value = { active: !0, percent: Math.max(N.value.percent, n), stage: t, failed: !1 }, ae.push({ p: N.value.percent, s: t, t: Math.round(performance.now()) }), le();
|
|
1378
1447
|
}
|
|
1379
|
-
function
|
|
1380
|
-
ot(n ? 100 :
|
|
1448
|
+
function xt(n, t) {
|
|
1449
|
+
ot(n ? 100 : N.value.percent, t), N.value = { active: !n, percent: n ? 100 : N.value.percent, stage: t, failed: !n }, le(!0);
|
|
1381
1450
|
}
|
|
1382
|
-
function
|
|
1383
|
-
|
|
1451
|
+
function je() {
|
|
1452
|
+
ae = [], le(!0);
|
|
1384
1453
|
}
|
|
1385
|
-
const
|
|
1386
|
-
function
|
|
1387
|
-
w.value = w.value === n.id ? "" : n.id, w.value === n.id &&
|
|
1388
|
-
const t =
|
|
1389
|
-
|
|
1390
|
-
const e = n.name || n.id, u =
|
|
1454
|
+
const De = (n) => (n.disabledReason ?? "").trim(), ie = (n) => (n.issues ?? []).map((t) => String(t?.message ?? "")).filter(Boolean), Vt = (n) => Gs(n.id);
|
|
1455
|
+
function Bn(n) {
|
|
1456
|
+
w.value = w.value === n.id ? "" : n.id, w.value === n.id && j(n.id);
|
|
1457
|
+
const t = f.value;
|
|
1458
|
+
wn(n.id);
|
|
1459
|
+
const e = n.name || n.id, u = Vt(n);
|
|
1391
1460
|
if (u.length === 0) {
|
|
1392
1461
|
g.value = `「${e}」这次会话里还没在哪条标签上露过面:先打开挂着它的那一页,再点一次`;
|
|
1393
1462
|
return;
|
|
@@ -1396,127 +1465,133 @@ const po = { class: "mbc__head" }, bo = ["title"], mo = ["title"], fo = {
|
|
|
1396
1465
|
g.value = `「${e}」就在这一条标签上(${u.join(" / ")}):已经把它标红`;
|
|
1397
1466
|
return;
|
|
1398
1467
|
}
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1401
|
-
g.value = `「${e}」不在这一条标签上:正在切到 ${
|
|
1468
|
+
const S = Ws(n.id, t, m);
|
|
1469
|
+
if (S) {
|
|
1470
|
+
g.value = `「${e}」不在这一条标签上:正在切到 ${S} 那条标签`, Ee(S);
|
|
1402
1471
|
return;
|
|
1403
1472
|
}
|
|
1404
1473
|
g.value = `「${e}」只挂在带参数的实例标签上(${u.join(" / ")}):不替你挑一单 —— 自己打开要看的那一页再点`;
|
|
1405
1474
|
}
|
|
1406
|
-
const
|
|
1407
|
-
const e = await
|
|
1475
|
+
const Mn = (n, t) => J(async () => {
|
|
1476
|
+
const e = await at(
|
|
1408
1477
|
`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`
|
|
1409
1478
|
);
|
|
1410
|
-
|
|
1411
|
-
}, C),
|
|
1479
|
+
E.value = { id: n.id, number: t, files: e.files ?? {} }, g.value = `正在看「${n.name || n.id}」的 v${t}(只读:不会改库里任何东西)`;
|
|
1480
|
+
}, C), An = (n, t) => J(async () => {
|
|
1412
1481
|
window.confirm(`把「${n.name || n.id}」切回 v${t}?
|
|
1413
1482
|
|
|
1414
|
-
这会把那一版的代码变成**当前版**,并且记成一个**新版本**(号继续 +1):历史只追加,旧版本一个都不会没。`) && (await
|
|
1415
|
-
}, C),
|
|
1483
|
+
这会把那一版的代码变成**当前版**,并且记成一个**新版本**(号继续 +1):历史只追加,旧版本一个都不会没。`) && (await Ct(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { updatedBy: "" }), g.value = `「${n.name || n.id}」已切回 v${t}(并记成了一个新版本)`, await Et(), await j(n.id));
|
|
1484
|
+
}, C), Rn = (n, t) => J(async () => {
|
|
1416
1485
|
window.confirm(`删掉「${n.name || n.id}」的 v${t}?
|
|
1417
1486
|
|
|
1418
|
-
这一版的代码就找不回来了(别的版本不受影响)。`) && (await
|
|
1419
|
-
}, C),
|
|
1487
|
+
这一版的代码就找不回来了(别的版本不受影响)。`) && (await at(`/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}`, { method: "DELETE" }), g.value = `删掉了「${n.name || n.id}」的 v${t}`, await j(n.id));
|
|
1488
|
+
}, C), On = (n, t) => J(async () => {
|
|
1420
1489
|
const e = await fetch(
|
|
1421
1490
|
`http://localhost:3000/magic-blocks/${encodeURIComponent(n.id)}/versions/${t}?download=1`,
|
|
1422
|
-
{ credentials: "include", headers:
|
|
1491
|
+
{ credentials: "include", headers: te("GET", !1) }
|
|
1423
1492
|
);
|
|
1424
1493
|
if (!e.ok) throw new Error(`下载失败(HTTP ${e.status})`);
|
|
1425
|
-
const u = await e.blob(),
|
|
1494
|
+
const u = await e.blob(), S = URL.createObjectURL(u);
|
|
1426
1495
|
try {
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1496
|
+
const D = document.createElement("a");
|
|
1497
|
+
D.href = S, D.download = `magic-block-${n.name || n.id}-v${t}.zip`, document.body.appendChild(D), D.click(), D.remove();
|
|
1429
1498
|
} finally {
|
|
1430
|
-
setTimeout(() => URL.revokeObjectURL(
|
|
1499
|
+
setTimeout(() => URL.revokeObjectURL(S), 0);
|
|
1431
1500
|
}
|
|
1432
1501
|
g.value = `已下载「${n.name || n.id}」的 v${t}`;
|
|
1433
1502
|
}, C);
|
|
1434
|
-
function
|
|
1435
|
-
|
|
1436
|
-
}
|
|
1437
|
-
const
|
|
1438
|
-
const t =
|
|
1439
|
-
|
|
1440
|
-
}, C, "存标签")
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1503
|
+
function Pn(n) {
|
|
1504
|
+
pt.value = n.id, Z.value = (n.tags ?? []).join(", ");
|
|
1505
|
+
}
|
|
1506
|
+
const Ie = (n) => J(async () => {
|
|
1507
|
+
const t = Z.value.split(/[,,\s]+/).map((u) => u.trim()).filter(Boolean), e = await Ct(`/magic-blocks/${encodeURIComponent(n.id)}/tags`, { tags: t });
|
|
1508
|
+
pt.value = "", g.value = `「${n.name || n.id}」的标签已存:${(e.tags ?? []).join(" / ") || "(一个都不剩)"}`, await Et();
|
|
1509
|
+
}, C, "存标签"), Ln = (n) => J(async () => {
|
|
1510
|
+
const t = await Ct(`/magic-blocks/${encodeURIComponent(n.id)}/detail`, { detail: yt.value });
|
|
1511
|
+
gt.value = "", g.value = `「${n.name || n.id}」的详情已存${(t.detail ?? "").trim() ? "" : "(清掉了)"};下次导出会写进它的 magic-block.open.yaml`, await Et();
|
|
1512
|
+
}, C, "存详情");
|
|
1513
|
+
function jn(n) {
|
|
1514
|
+
gt.value = n.id, yt.value = (n.detail ?? "").trim();
|
|
1515
|
+
}
|
|
1516
|
+
function Dn(n) {
|
|
1517
|
+
const t = Z.value.split(/[,,\s]+/).map((e) => e.trim()).filter(Boolean);
|
|
1518
|
+
t.some((e) => e.toLowerCase() === n.toLowerCase()) || t.push(n), Z.value = t.join(", ");
|
|
1519
|
+
}
|
|
1520
|
+
function In(n) {
|
|
1521
|
+
Z.value = Z.value.split(/[,,\s]+/).map((t) => t.trim()).filter((t) => t && t.toLowerCase() !== n.toLowerCase()).join(", ");
|
|
1522
|
+
}
|
|
1523
|
+
function Nn(n) {
|
|
1524
|
+
const t = L.value.trim().toLowerCase();
|
|
1450
1525
|
return t ? (n.tags ?? []).some((e) => e.toLowerCase().includes(t)) : !0;
|
|
1451
1526
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const t =
|
|
1527
|
+
function Fn(n) {
|
|
1528
|
+
const t = Vt(n), e = t.length === 0 ? "点一下:这次会话里它还没在哪条标签上露过面" : `点一下:把「${n.name || n.id}」标红,并在需要时切到挂着它的标签(${t.join(" / ")})`, u = De(n);
|
|
1454
1529
|
return u ? `${u}
|
|
1455
1530
|
${e}` : e;
|
|
1456
1531
|
}
|
|
1457
|
-
const
|
|
1458
|
-
const n =
|
|
1459
|
-
return
|
|
1460
|
-
}),
|
|
1461
|
-
function
|
|
1532
|
+
const Ne = O(() => {
|
|
1533
|
+
const n = h.value.trim().toLowerCase();
|
|
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() {
|
|
1462
1537
|
const n = /* @__PURE__ */ new Set(), t = [];
|
|
1463
|
-
for (const e of
|
|
1538
|
+
for (const e of Fe()) {
|
|
1464
1539
|
const u = typeof e?.path == "string" ? e.path.trim() : "";
|
|
1465
1540
|
if (!u || n.has(u) || u.includes(":") || u.includes("*") || e.redirect || !e.components?.default || e.meta?.tab === !1) continue;
|
|
1466
1541
|
n.add(u);
|
|
1467
|
-
const
|
|
1542
|
+
const S = e.meta?.title ?? e.meta?.sub, D = e.meta?.group;
|
|
1468
1543
|
t.push({
|
|
1469
1544
|
path: u,
|
|
1470
|
-
title: typeof
|
|
1471
|
-
group: typeof
|
|
1545
|
+
title: typeof S == "string" && S.trim() ? S.trim() : u,
|
|
1546
|
+
group: typeof D == "string" ? D.trim() : ""
|
|
1472
1547
|
});
|
|
1473
1548
|
}
|
|
1474
1549
|
return t;
|
|
1475
1550
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
1551
|
+
function Fe() {
|
|
1552
|
+
return r?.getRoutes?.() ?? [];
|
|
1478
1553
|
}
|
|
1479
|
-
const
|
|
1480
|
-
function
|
|
1554
|
+
const ce = O(() => bo(Fe(), ro, v.value.map((n) => n.id)));
|
|
1555
|
+
function Rt(n) {
|
|
1481
1556
|
return (n instanceof Error ? n.message.trim() : String(n)) || "请求没有到达后端(网络或登录态的问题),请重试";
|
|
1482
1557
|
}
|
|
1483
|
-
function
|
|
1558
|
+
function Un(n) {
|
|
1484
1559
|
const t = n?.issues;
|
|
1485
1560
|
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : String(e?.message ?? "")).filter(Boolean) : [];
|
|
1486
1561
|
}
|
|
1487
|
-
async function
|
|
1562
|
+
async function Ct(n, t) {
|
|
1488
1563
|
const e = JSON.stringify(t);
|
|
1489
1564
|
try {
|
|
1490
|
-
return await
|
|
1565
|
+
return await at(n, { method: "POST", body: e });
|
|
1491
1566
|
} catch (u) {
|
|
1492
|
-
const
|
|
1567
|
+
const S = Rt(u), D = await fetch(`http://localhost:3000${n}`, {
|
|
1493
1568
|
method: "POST",
|
|
1494
1569
|
credentials: "include",
|
|
1495
|
-
headers: { "Content-Type": "application/json", ...
|
|
1570
|
+
headers: { "Content-Type": "application/json", ...te("POST", !0) },
|
|
1496
1571
|
body: e
|
|
1497
|
-
}).then((
|
|
1498
|
-
throw
|
|
1499
|
-
- ${
|
|
1572
|
+
}).then((mt) => mt.json()).catch(() => null), P = Un(D);
|
|
1573
|
+
throw P.length === 0 ? new Error(S) : new Error(`${String(D?.message ?? S)}
|
|
1574
|
+
- ${P.join(`
|
|
1500
1575
|
- `)}`);
|
|
1501
1576
|
}
|
|
1502
1577
|
}
|
|
1503
|
-
async function
|
|
1504
|
-
const n =
|
|
1578
|
+
async function Hn() {
|
|
1579
|
+
const n = M.value.map((t) => `[${t.at}] ${t.where}
|
|
1505
1580
|
${t.text}`).join(`
|
|
1506
1581
|
|
|
1507
1582
|
`);
|
|
1508
1583
|
try {
|
|
1509
|
-
await navigator.clipboard.writeText(n), g.value = `已复制 ${
|
|
1584
|
+
await navigator.clipboard.writeText(n), g.value = `已复制 ${M.value.length} 条报错`;
|
|
1510
1585
|
} catch (t) {
|
|
1511
|
-
|
|
1586
|
+
Nt(t, "复制报错");
|
|
1512
1587
|
}
|
|
1513
1588
|
}
|
|
1514
|
-
function
|
|
1589
|
+
function Kn() {
|
|
1515
1590
|
const n = [];
|
|
1516
|
-
|
|
1517
|
-
for (const t of
|
|
1591
|
+
W.value.length > 0 && n.push("【前端校验拦下的】", ...W.value.map((t) => `- ${t}`), "");
|
|
1592
|
+
for (const t of A.value?.failures ?? [])
|
|
1518
1593
|
n.push(`【读回:${t.kind || "问题"}】${t.where || ""}`, `- ${t.message || ""}`, "");
|
|
1519
|
-
for (const t of
|
|
1594
|
+
for (const t of It.value)
|
|
1520
1595
|
n.push(
|
|
1521
1596
|
`【没存成】${t.name || t.id}`,
|
|
1522
1597
|
`- ${t.error || ""}`,
|
|
@@ -1526,209 +1601,231 @@ ${t.text}`).join(`
|
|
|
1526
1601
|
return n.join(`
|
|
1527
1602
|
`).trim() || "这一趟没有问题。";
|
|
1528
1603
|
}
|
|
1529
|
-
async function
|
|
1604
|
+
async function Vn() {
|
|
1530
1605
|
try {
|
|
1531
|
-
await navigator.clipboard.writeText(
|
|
1606
|
+
await navigator.clipboard.writeText(Kn()), g.value = `已复制这一趟的 ${rt.value} 条问题`;
|
|
1532
1607
|
} catch (n) {
|
|
1533
|
-
|
|
1608
|
+
Nt(n, "复制问题");
|
|
1534
1609
|
}
|
|
1535
1610
|
}
|
|
1536
|
-
function
|
|
1537
|
-
const e =
|
|
1538
|
-
|
|
1611
|
+
function Nt(n, t) {
|
|
1612
|
+
const e = Rt(n);
|
|
1613
|
+
_.value = e, M.value = [...M.value, { at: (/* @__PURE__ */ new Date()).toLocaleTimeString(), where: t, text: e }];
|
|
1539
1614
|
}
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1615
|
+
function de() {
|
|
1616
|
+
_.value = "", M.value = [];
|
|
1542
1617
|
}
|
|
1543
|
-
async function
|
|
1618
|
+
async function Et() {
|
|
1544
1619
|
try {
|
|
1545
|
-
const n = await
|
|
1546
|
-
|
|
1620
|
+
const n = await at("/magic-blocks/index");
|
|
1621
|
+
v.value = n.blocks ?? [], G.value = n.tags ?? [];
|
|
1547
1622
|
} catch (n) {
|
|
1548
|
-
|
|
1623
|
+
Nt(n, "读块清单");
|
|
1549
1624
|
}
|
|
1550
1625
|
}
|
|
1551
|
-
async function
|
|
1552
|
-
t.value = !0,
|
|
1626
|
+
async function J(n, t, e = "") {
|
|
1627
|
+
t.value = !0, de();
|
|
1553
1628
|
try {
|
|
1554
|
-
await n(),
|
|
1629
|
+
await n(), zs();
|
|
1555
1630
|
} catch (u) {
|
|
1556
|
-
|
|
1631
|
+
Nt(u, e || "这个动作");
|
|
1557
1632
|
} finally {
|
|
1558
1633
|
t.value = !1;
|
|
1559
1634
|
}
|
|
1560
1635
|
}
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1636
|
+
const qn = () => J(async () => {
|
|
1637
|
+
Lt.value = !0;
|
|
1563
1638
|
try {
|
|
1564
|
-
await
|
|
1639
|
+
await at("/magic-blocks/check", { method: "POST", body: JSON.stringify({}) }), g.value = "全部魔法块重新校验完了", await Et();
|
|
1565
1640
|
} finally {
|
|
1566
|
-
|
|
1641
|
+
Lt.value = !1;
|
|
1567
1642
|
}
|
|
1568
|
-
}, C),
|
|
1569
|
-
const t = await
|
|
1570
|
-
n === "export" ? (
|
|
1643
|
+
}, C), ze = (n) => J(async () => {
|
|
1644
|
+
const t = await $e();
|
|
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}`;
|
|
1571
1646
|
}, C);
|
|
1572
|
-
async function
|
|
1573
|
-
if (
|
|
1574
|
-
const n = await
|
|
1575
|
-
return
|
|
1576
|
-
}
|
|
1577
|
-
const
|
|
1578
|
-
if (!
|
|
1579
|
-
if (
|
|
1647
|
+
async function pe() {
|
|
1648
|
+
if (Q.value) return Q.value;
|
|
1649
|
+
const n = await at("/magic-blocks/rules");
|
|
1650
|
+
return Q.value = n.rules, n.rules;
|
|
1651
|
+
}
|
|
1652
|
+
const Jn = () => J(async () => {
|
|
1653
|
+
if (!xn()) throw new Error("这个浏览器没法直接写你本机的文件夹:请用 Chrome / Edge,并从 https 或 localhost 打开");
|
|
1654
|
+
if (X.value === "one" && !bt.value)
|
|
1580
1655
|
throw new Error("还没挑块:上面选「仅这一个块」时要先在下拉里挑一个块(或者把范围改成「全部块」)");
|
|
1581
|
-
|
|
1656
|
+
lt.value = !0, g.value = "", V.value = "", de(), je(), Gt.length = 0, N.value = { active: !0, percent: 0, stage: "准备…", failed: !1 };
|
|
1582
1657
|
try {
|
|
1583
|
-
const n =
|
|
1584
|
-
|
|
1585
|
-
const t =
|
|
1586
|
-
|
|
1587
|
-
const
|
|
1588
|
-
if (
|
|
1589
|
-
ot(5, "等你确认要不要先清空"),
|
|
1658
|
+
const n = K.value ?? await $e();
|
|
1659
|
+
K.value = n, z.value || (z.value = n);
|
|
1660
|
+
const t = Ct("/magic-blocks/export", wt()), e = be(), u = Q.value ? we(n, Q.value) : null, S = await St("取包", t);
|
|
1661
|
+
Q.value = S.rules, Eo(n, S.rules);
|
|
1662
|
+
const D = u ? await St("数目录", u) : await St("数目录", we(n, S.rules));
|
|
1663
|
+
if (D.topCount > 0) {
|
|
1664
|
+
ot(5, "等你确认要不要先清空"), q.value = { target: n, inventory: D };
|
|
1590
1665
|
return;
|
|
1591
1666
|
}
|
|
1592
|
-
await
|
|
1667
|
+
await me(n, S, { clean: !1, verify: !1, front: e });
|
|
1593
1668
|
} catch (n) {
|
|
1594
|
-
throw
|
|
1669
|
+
throw xt(!1, "导出失败"), n;
|
|
1595
1670
|
} finally {
|
|
1596
|
-
|
|
1671
|
+
lt.value = !1;
|
|
1597
1672
|
}
|
|
1598
|
-
}, C);
|
|
1599
|
-
function
|
|
1673
|
+
}, C), Ue = /* @__PURE__ */ new WeakMap(), Gt = [];
|
|
1674
|
+
function He(n, t) {
|
|
1675
|
+
Gt.push([n, Math.round(performance.now() - t)]);
|
|
1676
|
+
}
|
|
1677
|
+
async function St(n, t) {
|
|
1678
|
+
const e = performance.now();
|
|
1600
1679
|
try {
|
|
1601
|
-
|
|
1680
|
+
return await t;
|
|
1681
|
+
} finally {
|
|
1682
|
+
He(n, e);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
function Gn() {
|
|
1686
|
+
return Gt.length > 0 ? `;耗时:${Gt.map(([n, t]) => `${n} ${t}ms`).join(" · ")}` : "";
|
|
1687
|
+
}
|
|
1688
|
+
function be() {
|
|
1689
|
+
try {
|
|
1690
|
+
const n = $n();
|
|
1602
1691
|
return {
|
|
1603
1692
|
css: n.css,
|
|
1604
|
-
controls:
|
|
1693
|
+
controls: Ks(),
|
|
1605
1694
|
note: n.skipped.length > 0 ? `;⚠️ 有 ${n.skipped.length} 张样式表读不到规则(跨源):${n.skipped.join(" / ")}` : ""
|
|
1606
1695
|
};
|
|
1607
1696
|
} catch (n) {
|
|
1608
|
-
return { css: "", controls: "", note: `;主题 CSS 没收成(${
|
|
1697
|
+
return { css: "", controls: "", note: `;主题 CSS 没收成(${Rt(n)}):${Tt} 没写,其余照旧` };
|
|
1609
1698
|
}
|
|
1610
1699
|
}
|
|
1611
|
-
async function
|
|
1700
|
+
async function me(n, t, e) {
|
|
1701
|
+
const { clean: u, verify: S, thorough: D, front: P } = e;
|
|
1612
1702
|
try {
|
|
1613
|
-
const B = E ?? Kt();
|
|
1614
1703
|
ot(20, "准备写盘…");
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
const
|
|
1618
|
-
await new Promise((
|
|
1619
|
-
setTimeout(
|
|
1704
|
+
const mt = vo(zn()), ct = { ...t.files };
|
|
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));
|
|
1706
|
+
const ts = P.note;
|
|
1707
|
+
await new Promise((et) => {
|
|
1708
|
+
setTimeout(et, 0);
|
|
1620
1709
|
});
|
|
1621
|
-
let
|
|
1622
|
-
if (
|
|
1710
|
+
let Ge = "", fe;
|
|
1711
|
+
if (u) {
|
|
1623
1712
|
ot(35, "清掉这一包不要的东西…");
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1713
|
+
const et = await St("清多余", xo(n, ct));
|
|
1714
|
+
fe = et.existing, Ge = et.removed > 0 ? `,先清掉了 ${et.removed} 项` : ",没有多余的东西要清";
|
|
1715
|
+
} else
|
|
1716
|
+
ot(35, "看一眼目录里有什么…"), fe = await St("看目录", Co(n, ct));
|
|
1717
|
+
const es = Ue.get(n.handle), ns = Object.keys(ct).length, ve = u ? 45 : 30;
|
|
1718
|
+
ot(ve, `写文件 0/${ns}…`);
|
|
1719
|
+
let We = 0;
|
|
1720
|
+
const ss = performance.now(), tt = await $o(n, ct, (et, he) => {
|
|
1721
|
+
const Ye = Date.now();
|
|
1722
|
+
et < he && Ye - We < Zi || (We = Ye, ot(ve + Math.round(et / Math.max(1, he) * (95 - ve)), `写文件 ${et}/${he}…`));
|
|
1723
|
+
}, {
|
|
1724
|
+
verify: S,
|
|
1725
|
+
// 🔴 账本:勾了「逐个核对磁盘」就不给它 —— 那样连上一趟铺过的也重新核对一遍。
|
|
1726
|
+
trust: D ? void 0 : es,
|
|
1727
|
+
existing: fe
|
|
1728
|
+
});
|
|
1729
|
+
He("写盘", ss), Ue.set(n.handle, tt.fingerprints), ot(98, "收尾…");
|
|
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 = [];
|
|
1731
|
+
tt.skipped > 0 && Wt.push(`${tt.skipped} 个与库里一字不差(逐字节比过)`), tt.trusted > 0 && Wt.push(`${tt.trusted} 个按上一趟的账本跳过(没再碰磁盘)`);
|
|
1732
|
+
const as = Wt.length > 0 ? `,跳过 ${Wt.join(" / ")}` : "";
|
|
1733
|
+
V.value = `铺到「${n.name}」:${t.blocks} 个块、写了 ${tt.written} 个文件${as}(含 ${ke} / ${Tt} / ${Qt})${Ge}${os}${ts}${Gn()}`, g.value = tt.failed.length > 0 ? "导出完了,但有文件没写成(见下面那句)" : "导出完了:用你自己的编辑器改,改完回这里「读回改动」", xt(!0, "完成");
|
|
1734
|
+
} catch (mt) {
|
|
1735
|
+
throw xt(!1, "导出中途失败(已经铺进去的文件不会自己删掉)"), mt;
|
|
1639
1736
|
}
|
|
1640
1737
|
}
|
|
1641
|
-
const
|
|
1642
|
-
const n =
|
|
1643
|
-
if (
|
|
1644
|
-
|
|
1738
|
+
const Wn = () => J(async () => {
|
|
1739
|
+
const n = q.value;
|
|
1740
|
+
if (q.value = null, !!n) {
|
|
1741
|
+
lt.value = !0;
|
|
1645
1742
|
try {
|
|
1646
1743
|
ot(15, "重新取一份开发包…");
|
|
1647
|
-
const t =
|
|
1648
|
-
|
|
1744
|
+
const t = Ct("/magic-blocks/export", wt()), e = be(), u = await St("取包", t);
|
|
1745
|
+
Q.value = u.rules, await me(n.target, u, { clean: !0, verify: !0, thorough: Kt.value, front: e });
|
|
1649
1746
|
} catch (t) {
|
|
1650
|
-
throw
|
|
1747
|
+
throw xt(!1, "导出失败"), t;
|
|
1651
1748
|
} finally {
|
|
1652
|
-
|
|
1749
|
+
lt.value = !1;
|
|
1653
1750
|
}
|
|
1654
1751
|
}
|
|
1655
|
-
}, C),
|
|
1656
|
-
const n =
|
|
1657
|
-
if (
|
|
1658
|
-
|
|
1752
|
+
}, C), Yn = () => J(async () => {
|
|
1753
|
+
const n = q.value;
|
|
1754
|
+
if (q.value = null, !!n) {
|
|
1755
|
+
lt.value = !0;
|
|
1659
1756
|
try {
|
|
1660
1757
|
ot(15, "重新取一份开发包…");
|
|
1661
|
-
const t =
|
|
1662
|
-
|
|
1758
|
+
const t = Ct("/magic-blocks/export", wt()), e = be(), u = await St("取包", t);
|
|
1759
|
+
Q.value = u.rules, await me(n.target, u, { clean: !1, verify: !0, thorough: Kt.value, front: e });
|
|
1663
1760
|
} catch (t) {
|
|
1664
|
-
throw
|
|
1761
|
+
throw xt(!1, "导出失败"), t;
|
|
1665
1762
|
} finally {
|
|
1666
|
-
|
|
1763
|
+
lt.value = !1;
|
|
1667
1764
|
}
|
|
1668
1765
|
}
|
|
1669
1766
|
}, C);
|
|
1670
|
-
function
|
|
1671
|
-
|
|
1767
|
+
function Zn() {
|
|
1768
|
+
q.value = null, N.value = { active: !1, percent: 0, stage: "", failed: !1 }, g.value = "这次没有导出(目录里的东西一个字节都没动)", V.value = "";
|
|
1672
1769
|
}
|
|
1673
|
-
const
|
|
1674
|
-
const n =
|
|
1675
|
-
|
|
1770
|
+
const Ke = () => J(async () => {
|
|
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 = [];
|
|
1676
1773
|
try {
|
|
1677
|
-
const t = await
|
|
1678
|
-
throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${
|
|
1679
|
-
}), e = await
|
|
1774
|
+
const t = await pe().catch((P) => {
|
|
1775
|
+
throw new Error(`取不到扫描规则(GET /magic-blocks/rules):${Rt(P)}`);
|
|
1776
|
+
}), e = await Mo(n, t), u = await at("/magic-blocks/read", {
|
|
1680
1777
|
method: "POST",
|
|
1681
1778
|
body: JSON.stringify({ ...e, includeMissing: !1 })
|
|
1682
1779
|
});
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
for (const
|
|
1686
|
-
|
|
1687
|
-
const
|
|
1688
|
-
g.value = `扫到 ${u.folders} 个文件夹、${u.files} 个文件:有改动 ${
|
|
1780
|
+
A.value = u;
|
|
1781
|
+
const S = {};
|
|
1782
|
+
for (const P of u.blocks ?? []) S[P.id] = P.status === "modified" && P.canApply;
|
|
1783
|
+
it.value = S;
|
|
1784
|
+
const D = (u.blocks ?? []).reduce((P, mt) => ({ ...P, [mt.status]: (P[mt.status] ?? 0) + 1 }), {});
|
|
1785
|
+
g.value = `扫到 ${u.folders} 个文件夹、${u.files} 个文件:有改动 ${D.modified ?? 0} / 没改动 ${D.unchanged ?? 0}` + (u.complete ? "" : "(层数到了上限,没走完,可能还有块没扫到)");
|
|
1689
1786
|
} finally {
|
|
1690
|
-
|
|
1787
|
+
kt.value = !1;
|
|
1691
1788
|
}
|
|
1692
|
-
}, C),
|
|
1693
|
-
const n =
|
|
1694
|
-
if (
|
|
1789
|
+
}, C), Xn = () => J(async () => {
|
|
1790
|
+
const n = Jt.value, t = As(n);
|
|
1791
|
+
if (W.value = t.issues, Y.value = [], t.issues.length > 0)
|
|
1695
1792
|
throw g.value = "", new Error(`前端校验没过(${t.issues.length} 条),没有发请求:
|
|
1696
1793
|
- ${t.issues.join(`
|
|
1697
1794
|
- `)}`);
|
|
1698
|
-
|
|
1795
|
+
nt.value = !0, g.value = "";
|
|
1699
1796
|
try {
|
|
1700
|
-
const e = await
|
|
1701
|
-
|
|
1797
|
+
const e = await Ct("/magic-blocks/import", { updatedBy: "", blocks: n });
|
|
1798
|
+
Y.value = e.results ?? [], g.value = `保存:成功 ${e.saved} 个、失败 ${e.failed} 个`, await Et();
|
|
1702
1799
|
const u = g.value;
|
|
1703
|
-
await
|
|
1800
|
+
await Ke(), g.value = `${u};已重新读回该目录`;
|
|
1704
1801
|
} finally {
|
|
1705
|
-
|
|
1802
|
+
nt.value = !1;
|
|
1706
1803
|
}
|
|
1707
1804
|
}, C);
|
|
1708
|
-
function
|
|
1805
|
+
function Qn(n, t) {
|
|
1709
1806
|
const e = t.target;
|
|
1710
|
-
|
|
1807
|
+
it.value[n] = e?.checked === !0;
|
|
1711
1808
|
}
|
|
1712
|
-
function
|
|
1713
|
-
const t = { ...
|
|
1714
|
-
for (const e of
|
|
1715
|
-
|
|
1809
|
+
function Ve(n) {
|
|
1810
|
+
const t = { ...it.value };
|
|
1811
|
+
for (const e of qt.value) t[e.id] = n;
|
|
1812
|
+
it.value = t;
|
|
1716
1813
|
}
|
|
1717
|
-
function
|
|
1814
|
+
function qe(n) {
|
|
1718
1815
|
const t = n.detail?.uuid ?? "";
|
|
1719
1816
|
b.value = !0, w.value = t;
|
|
1720
1817
|
}
|
|
1721
|
-
function
|
|
1818
|
+
function Je(n) {
|
|
1722
1819
|
n.key === "Escape" && b.value && (b.value = !1);
|
|
1723
1820
|
}
|
|
1724
|
-
return
|
|
1725
|
-
window.addEventListener("magic-block:open-console",
|
|
1821
|
+
return ln(() => {
|
|
1822
|
+
window.addEventListener("magic-block:open-console", qe), window.addEventListener("keydown", Je), Et(), pe().catch(() => {
|
|
1726
1823
|
});
|
|
1727
|
-
}),
|
|
1728
|
-
window.removeEventListener("magic-block:open-console",
|
|
1729
|
-
}), (n, t) =>
|
|
1824
|
+
}), un(() => {
|
|
1825
|
+
window.removeEventListener("magic-block:open-console", qe), window.removeEventListener("keydown", Je);
|
|
1826
|
+
}), (n, t) => _t(i) ? (c(), d("div", {
|
|
1730
1827
|
key: 0,
|
|
1731
|
-
class:
|
|
1828
|
+
class: H(["mbc__shell", { "is-wide": B.value }])
|
|
1732
1829
|
}, [
|
|
1733
1830
|
s("button", {
|
|
1734
1831
|
class: "fab",
|
|
@@ -1736,622 +1833,665 @@ ${t.text}`).join(`
|
|
|
1736
1833
|
title: "magic block 控制台",
|
|
1737
1834
|
onClick: t[0] || (t[0] = (e) => b.value = !0)
|
|
1738
1835
|
}, "块"),
|
|
1739
|
-
b.value ? (
|
|
1836
|
+
b.value ? (c(), d("aside", {
|
|
1740
1837
|
key: 0,
|
|
1741
|
-
class:
|
|
1838
|
+
class: H(["mbc", { "is-wide": B.value }])
|
|
1742
1839
|
}, [
|
|
1743
|
-
s("header",
|
|
1744
|
-
t[
|
|
1840
|
+
s("header", Ao, [
|
|
1841
|
+
t[43] || (t[43] = s("strong", { class: "mbc__brand" }, "magic block", -1)),
|
|
1745
1842
|
s("span", {
|
|
1746
1843
|
class: "mbc__count",
|
|
1747
|
-
title: `库里一共 ${
|
|
1748
|
-
}, p(
|
|
1749
|
-
t[
|
|
1844
|
+
title: `库里一共 ${v.value.length} 个块`
|
|
1845
|
+
}, p(v.value.length) + " 个块", 9, Ro),
|
|
1846
|
+
t[44] || (t[44] = s("span", { class: "mbc__grow" }, null, -1)),
|
|
1750
1847
|
s("button", {
|
|
1751
1848
|
class: "p-button p-button-sm p-button-text",
|
|
1752
1849
|
type: "button",
|
|
1753
|
-
title:
|
|
1754
|
-
onClick: t[1] || (t[1] = (e) =>
|
|
1755
|
-
}, p(
|
|
1850
|
+
title: B.value ? "收起(回到右侧那条窄抽屉)" : "展开:整屏(块 / 工作区两个页签)",
|
|
1851
|
+
onClick: t[1] || (t[1] = (e) => B.value = !B.value)
|
|
1852
|
+
}, p(B.value ? "收起" : "展开全屏"), 9, Oo),
|
|
1756
1853
|
s("button", {
|
|
1757
1854
|
class: "p-button p-button-sm p-button-text",
|
|
1758
1855
|
type: "button",
|
|
1759
1856
|
onClick: t[2] || (t[2] = (e) => b.value = !1)
|
|
1760
1857
|
}, "关闭")
|
|
1761
1858
|
]),
|
|
1762
|
-
s("div",
|
|
1859
|
+
s("div", Po, [
|
|
1763
1860
|
s("button", {
|
|
1764
|
-
class:
|
|
1861
|
+
class: H(["mbc__tab", { "is-on": R.value === "blocks" }]),
|
|
1765
1862
|
type: "button",
|
|
1766
1863
|
role: "tab",
|
|
1767
|
-
"aria-selected":
|
|
1768
|
-
onClick: t[3] || (t[3] = (e) =>
|
|
1864
|
+
"aria-selected": R.value === "blocks",
|
|
1865
|
+
onClick: t[3] || (t[3] = (e) => R.value = "blocks")
|
|
1769
1866
|
}, [
|
|
1770
|
-
t[
|
|
1771
|
-
s("span",
|
|
1772
|
-
|
|
1867
|
+
t[45] || (t[45] = y(" 块 ", -1)),
|
|
1868
|
+
s("span", jo, p(v.value.length), 1),
|
|
1869
|
+
re.value > 0 ? (c(), d("span", {
|
|
1773
1870
|
key: 0,
|
|
1774
1871
|
class: "mbc__chip is-bad",
|
|
1775
|
-
title: `${
|
|
1776
|
-
}, p(
|
|
1777
|
-
], 10,
|
|
1872
|
+
title: `${re.value} 个块被停用(体检没过)`
|
|
1873
|
+
}, p(re.value) + " 停用", 9, Do)) : k("", !0)
|
|
1874
|
+
], 10, Lo),
|
|
1778
1875
|
s("button", {
|
|
1779
|
-
class:
|
|
1876
|
+
class: H(["mbc__tab", { "is-on": R.value === "workspace" }]),
|
|
1780
1877
|
type: "button",
|
|
1781
1878
|
role: "tab",
|
|
1782
|
-
"aria-selected":
|
|
1783
|
-
onClick: t[4] || (t[4] = (e) =>
|
|
1879
|
+
"aria-selected": R.value === "workspace",
|
|
1880
|
+
onClick: t[4] || (t[4] = (e) => R.value = "workspace")
|
|
1784
1881
|
}, [
|
|
1785
|
-
t[
|
|
1786
|
-
|
|
1882
|
+
t[46] || (t[46] = y(" 工作区(导出 / 读回 / 校验) ", -1)),
|
|
1883
|
+
rt.value > 0 ? (c(), d("span", {
|
|
1787
1884
|
key: 0,
|
|
1788
1885
|
class: "mbc__chip is-bad",
|
|
1789
|
-
title: `这一趟有 ${
|
|
1790
|
-
}, p(
|
|
1791
|
-
], 10,
|
|
1886
|
+
title: `这一趟有 ${rt.value} 条问题`
|
|
1887
|
+
}, p(rt.value), 9, No)) : Y.value.length > 0 ? (c(), d("span", Fo, p(ue.value) + " 存成", 1)) : k("", !0)
|
|
1888
|
+
], 10, Io)
|
|
1792
1889
|
]),
|
|
1793
|
-
s("div",
|
|
1794
|
-
|
|
1890
|
+
s("div", zo, [
|
|
1891
|
+
N.value.active ? (c(), d("div", Uo, [
|
|
1795
1892
|
s("div", {
|
|
1796
|
-
class:
|
|
1893
|
+
class: H(["mbc__progress", { "is-failed": N.value.failed }]),
|
|
1797
1894
|
role: "progressbar",
|
|
1798
|
-
"aria-valuenow":
|
|
1895
|
+
"aria-valuenow": N.value.percent,
|
|
1799
1896
|
"aria-valuemin": "0",
|
|
1800
1897
|
"aria-valuemax": "100"
|
|
1801
1898
|
}, [
|
|
1802
1899
|
s("div", {
|
|
1803
1900
|
class: "mbc__progress-bar",
|
|
1804
|
-
style:
|
|
1901
|
+
style: rn(Tn.value)
|
|
1805
1902
|
}, null, 4)
|
|
1806
|
-
], 10,
|
|
1903
|
+
], 10, Ho),
|
|
1807
1904
|
s("p", {
|
|
1808
|
-
class:
|
|
1809
|
-
}, p(
|
|
1810
|
-
])) :
|
|
1811
|
-
|
|
1812
|
-
s("p",
|
|
1813
|
-
s("p",
|
|
1814
|
-
t[
|
|
1815
|
-
t[
|
|
1816
|
-
t[
|
|
1817
|
-
t[
|
|
1818
|
-
t[
|
|
1819
|
-
t[
|
|
1820
|
-
t[
|
|
1821
|
-
t[
|
|
1822
|
-
|
|
1905
|
+
class: H(["mbc__hint", { "mbc__progress-note": N.value.failed }])
|
|
1906
|
+
}, p(N.value.failed ? "✗" : "") + " " + p(N.value.percent) + "% · " + p(N.value.stage), 3)
|
|
1907
|
+
])) : k("", !0),
|
|
1908
|
+
q.value ? (c(), d("div", Ko, [
|
|
1909
|
+
s("p", Vo, "「" + p(q.value.target.name) + "」里现在有 " + p(q.value.inventory.dirs) + " 个文件夹 / " + p(q.value.inventory.files) + " 个文件", 1),
|
|
1910
|
+
s("p", qo, [
|
|
1911
|
+
t[47] || (t[47] = s("b", null, "只覆盖", -1)),
|
|
1912
|
+
t[48] || (t[48] = y("(天天用这个):只把库里", -1)),
|
|
1913
|
+
t[49] || (t[49] = s("b", null, "改过 / 缺了", -1)),
|
|
1914
|
+
t[50] || (t[50] = y("的那些写下去 —— 上一趟铺过、 这一趟一字没变的**一概不碰**(所以很快;代价是你自己在编辑器里改过、还没读回库的那些 ", -1)),
|
|
1915
|
+
t[51] || (t[51] = s("b", null, "会留着", -1)),
|
|
1916
|
+
t[52] || (t[52] = y(")。 ", -1)),
|
|
1917
|
+
t[53] || (t[53] = s("b", null, "清空并导出", -1)),
|
|
1918
|
+
t[54] || (t[54] = y(":先删掉这一包没有的东西,其余同上。 两种都只动这个目录", -1)),
|
|
1919
|
+
t[55] || (t[55] = s("b", null, "里面", -1)),
|
|
1920
|
+
t[56] || (t[56] = y("的子项:目录本身、以及它外面的任何东西都不会被碰。", -1)),
|
|
1921
|
+
q.value.inventory.items.length > 0 ? (c(), d("span", Jo, "(" + p(q.value.inventory.items.slice(0, 6).map((e) => e.name).join(" / ")) + p(q.value.inventory.items.length > 6 ? " …" : "") + ")", 1)) : k("", !0)
|
|
1823
1922
|
]),
|
|
1824
|
-
s("
|
|
1923
|
+
s("label", Go, [
|
|
1924
|
+
ft(s("input", {
|
|
1925
|
+
"onUpdate:modelValue": t[5] || (t[5] = (e) => Kt.value = e),
|
|
1926
|
+
type: "checkbox"
|
|
1927
|
+
}, null, 512), [
|
|
1928
|
+
[is, Kt.value]
|
|
1929
|
+
]),
|
|
1930
|
+
t[57] || (t[57] = s("span", null, [
|
|
1931
|
+
y("逐个核对磁盘(慢):把上一趟铺过的也重新读一遍比对,"),
|
|
1932
|
+
s("b", null, "你在编辑器里改过、还没读回库的那些会被库里的那份盖掉")
|
|
1933
|
+
], -1))
|
|
1934
|
+
]),
|
|
1935
|
+
s("div", Wo, [
|
|
1825
1936
|
s("button", {
|
|
1826
1937
|
class: "p-button p-button-sm",
|
|
1827
1938
|
type: "button",
|
|
1828
1939
|
disabled: C.value,
|
|
1829
|
-
onClick: t[
|
|
1830
|
-
}, "清空并导出", 8,
|
|
1940
|
+
onClick: t[6] || (t[6] = (e) => Wn())
|
|
1941
|
+
}, "清空并导出", 8, Yo),
|
|
1831
1942
|
s("button", {
|
|
1832
1943
|
class: "p-button p-button-sm p-button-outlined",
|
|
1833
1944
|
type: "button",
|
|
1834
1945
|
disabled: C.value,
|
|
1835
|
-
onClick: t[
|
|
1836
|
-
}, "只覆盖", 8,
|
|
1946
|
+
onClick: t[7] || (t[7] = (e) => Yn())
|
|
1947
|
+
}, "只覆盖", 8, Zo),
|
|
1837
1948
|
s("button", {
|
|
1838
1949
|
class: "p-button p-button-sm p-button-text",
|
|
1839
1950
|
type: "button",
|
|
1840
1951
|
disabled: C.value,
|
|
1841
|
-
onClick: t[
|
|
1842
|
-
}, "取消", 8,
|
|
1952
|
+
onClick: t[8] || (t[8] = (e) => Zn())
|
|
1953
|
+
}, "取消", 8, Xo)
|
|
1843
1954
|
])
|
|
1844
|
-
])) :
|
|
1845
|
-
|
|
1846
|
-
s("p",
|
|
1847
|
-
s("p",
|
|
1848
|
-
t[
|
|
1849
|
-
t[
|
|
1850
|
-
|
|
1851
|
-
t[
|
|
1852
|
-
s("span",
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
], 64)) :
|
|
1856
|
-
t[
|
|
1857
|
-
t[
|
|
1858
|
-
t[
|
|
1859
|
-
t[
|
|
1860
|
-
], 64)) : (
|
|
1861
|
-
t[
|
|
1862
|
-
t[
|
|
1863
|
-
t[
|
|
1955
|
+
])) : k("", !0),
|
|
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),
|
|
1958
|
+
s("p", ea, [
|
|
1959
|
+
t[66] || (t[66] = s("b", null, "库里那一份代码正文会被清空", -1)),
|
|
1960
|
+
t[67] || (t[67] = y("(入口 / 清单 / 后端一起); ", -1)),
|
|
1961
|
+
U.value.target ? (c(), d(T, { key: 0 }, [
|
|
1962
|
+
t[58] || (t[58] = y(" 同时清掉你本机那个块文件夹 ", -1)),
|
|
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 }, [
|
|
1965
|
+
y(" (它现在在顶层,里面有东西:本次会先清空)。 ")
|
|
1966
|
+
], 64)) : k("", !0),
|
|
1967
|
+
t[59] || (t[59] = s("b", null, "只动这一个块的文件夹", -1)),
|
|
1968
|
+
t[60] || (t[60] = y(":别的块、", -1)),
|
|
1969
|
+
t[61] || (t[61] = s("span", { class: "mbc__mono" }, "example/", -1)),
|
|
1970
|
+
t[62] || (t[62] = y("、以及目录外面的一切都不会被碰。 ", -1))
|
|
1971
|
+
], 64)) : (c(), d(T, { key: 1 }, [
|
|
1972
|
+
t[63] || (t[63] = y(" 现在没有选中开发目录 / 或者读不到它,所以", -1)),
|
|
1973
|
+
t[64] || (t[64] = s("b", null, "本机那份不动", -1)),
|
|
1974
|
+
t[65] || (t[65] = y(",只清库里那份。 ", -1))
|
|
1864
1975
|
], 64)),
|
|
1865
|
-
t[
|
|
1866
|
-
t[
|
|
1867
|
-
t[
|
|
1868
|
-
t[
|
|
1976
|
+
t[68] || (t[68] = s("br", null, null, -1)),
|
|
1977
|
+
t[69] || (t[69] = y(" 🔴 ", -1)),
|
|
1978
|
+
t[70] || (t[70] = s("b", null, "块本身留着", -1)),
|
|
1979
|
+
t[71] || (t[71] = y('(这一行不动):页面上那块会显示成占位框,而不是"库里没有这个块"; 删错了也能救回来:展开这一块 → 版本史 → 「切回」删之前那一版。 ', -1))
|
|
1869
1980
|
]),
|
|
1870
|
-
s("div",
|
|
1981
|
+
s("div", sa, [
|
|
1871
1982
|
s("button", {
|
|
1872
1983
|
class: "p-button p-button-sm",
|
|
1873
1984
|
type: "button",
|
|
1874
1985
|
disabled: C.value,
|
|
1875
|
-
onClick: t[
|
|
1876
|
-
}, "确认删除代码文件", 8,
|
|
1986
|
+
onClick: t[9] || (t[9] = (e) => se())
|
|
1987
|
+
}, "确认删除代码文件", 8, oa),
|
|
1877
1988
|
s("button", {
|
|
1878
1989
|
class: "p-button p-button-sm p-button-text",
|
|
1879
1990
|
type: "button",
|
|
1880
1991
|
disabled: C.value,
|
|
1881
|
-
onClick: t[
|
|
1882
|
-
}, "取消", 8,
|
|
1992
|
+
onClick: t[10] || (t[10] = (e) => U.value = null)
|
|
1993
|
+
}, "取消", 8, aa)
|
|
1883
1994
|
])
|
|
1884
|
-
])) :
|
|
1885
|
-
|
|
1886
|
-
s("h3",
|
|
1887
|
-
t[
|
|
1888
|
-
s("span",
|
|
1889
|
-
|
|
1995
|
+
])) : k("", !0),
|
|
1996
|
+
ft(s("section", la, [
|
|
1997
|
+
s("h3", ia, [
|
|
1998
|
+
t[72] || (t[72] = y(" 库里的块 ", -1)),
|
|
1999
|
+
s("span", ua, p(Ne.value.length) + " / " + p(v.value.length), 1),
|
|
2000
|
+
L.value.trim() ? (c(), d("span", ra, "标签:" + p(L.value), 1)) : k("", !0)
|
|
1890
2001
|
]),
|
|
1891
|
-
|
|
1892
|
-
"onUpdate:modelValue": t[
|
|
2002
|
+
ft(s("input", {
|
|
2003
|
+
"onUpdate:modelValue": t[11] || (t[11] = (e) => h.value = e),
|
|
1893
2004
|
class: "p-inputtext p-component mbc__search",
|
|
1894
2005
|
type: "search",
|
|
1895
2006
|
placeholder: "筛选 module / 名字 / 备注 / 详情 / id / 版本号 / 标签"
|
|
1896
2007
|
}, null, 512), [
|
|
1897
|
-
[
|
|
2008
|
+
[Yt, h.value]
|
|
1898
2009
|
]),
|
|
1899
|
-
|
|
1900
|
-
t[
|
|
1901
|
-
|
|
1902
|
-
"onUpdate:modelValue": t[
|
|
2010
|
+
G.value.length > 0 ? (c(), d("div", ca, [
|
|
2011
|
+
t[73] || (t[73] = s("span", { class: "mbc__label" }, "标签", -1)),
|
|
2012
|
+
ft(s("input", {
|
|
2013
|
+
"onUpdate:modelValue": t[12] || (t[12] = (e) => L.value = e),
|
|
1903
2014
|
class: "p-inputtext p-component mbc__tagfilter",
|
|
1904
2015
|
type: "search",
|
|
1905
2016
|
placeholder: "只看贴了…的块"
|
|
1906
2017
|
}, null, 512), [
|
|
1907
|
-
[
|
|
2018
|
+
[Yt, L.value]
|
|
1908
2019
|
]),
|
|
1909
|
-
(
|
|
2020
|
+
(c(!0), d(T, null, I(G.value.slice(0, 24), (e) => (c(), d("button", {
|
|
1910
2021
|
key: e.tag,
|
|
1911
|
-
class:
|
|
2022
|
+
class: H(["p-tag mbc__tag", { "is-on": L.value.trim().toLowerCase() === e.tag.toLowerCase() }]),
|
|
1912
2023
|
type: "button",
|
|
1913
2024
|
title: `只看贴了「${e.tag}」的块(${e.count} 个)`,
|
|
1914
|
-
onClick: (u) =>
|
|
1915
|
-
}, p(e.tag) + " " + p(e.count), 11,
|
|
1916
|
-
|
|
2025
|
+
onClick: (u) => L.value = L.value.trim().toLowerCase() === e.tag.toLowerCase() ? "" : e.tag
|
|
2026
|
+
}, p(e.tag) + " " + p(e.count), 11, da))), 128)),
|
|
2027
|
+
L.value ? (c(), d("button", {
|
|
1917
2028
|
key: 0,
|
|
1918
2029
|
class: "p-button p-button-sm p-button-text",
|
|
1919
2030
|
type: "button",
|
|
1920
|
-
onClick: t[
|
|
1921
|
-
}, "清掉标签筛选")) :
|
|
1922
|
-
])) :
|
|
1923
|
-
s("ul",
|
|
1924
|
-
(
|
|
2031
|
+
onClick: t[13] || (t[13] = (e) => L.value = "")
|
|
2032
|
+
}, "清掉标签筛选")) : k("", !0)
|
|
2033
|
+
])) : k("", !0),
|
|
2034
|
+
s("ul", pa, [
|
|
2035
|
+
(c(!0), d(T, null, I(Ne.value, (e) => (c(), d("li", {
|
|
1925
2036
|
key: e.id
|
|
1926
2037
|
}, [
|
|
1927
2038
|
s("button", {
|
|
1928
2039
|
type: "button",
|
|
1929
|
-
class:
|
|
1930
|
-
title:
|
|
1931
|
-
onClick: (u) =>
|
|
2040
|
+
class: H(["mbc__row", { "is-active": e.id === w.value, "is-off": e.enabled === !1 }]),
|
|
2041
|
+
title: Fn(e),
|
|
2042
|
+
onClick: (u) => Bn(e)
|
|
1932
2043
|
}, [
|
|
1933
|
-
s("span",
|
|
1934
|
-
s("span",
|
|
2044
|
+
s("span", ma, p(e.module || "unassigned"), 1),
|
|
2045
|
+
s("span", fa, p(e.name || e.id), 1),
|
|
1935
2046
|
s("span", {
|
|
1936
2047
|
class: "mbc__version-badge",
|
|
1937
2048
|
title: `当前是第 ${e.version || 1} 版,一共留着 ${e.versionCount ?? 1} 版`
|
|
1938
2049
|
}, [
|
|
1939
|
-
|
|
1940
|
-
(e.versionCount ?? 1) > 1 ? (
|
|
1941
|
-
|
|
1942
|
-
], 64)) :
|
|
1943
|
-
], 8,
|
|
1944
|
-
(
|
|
2050
|
+
y("v" + p(e.version || 1), 1),
|
|
2051
|
+
(e.versionCount ?? 1) > 1 ? (c(), d(T, { key: 0 }, [
|
|
2052
|
+
y("/" + p(e.versionCount), 1)
|
|
2053
|
+
], 64)) : k("", !0)
|
|
2054
|
+
], 8, va),
|
|
2055
|
+
(c(!0), d(T, null, I(e.tags ?? [], (u) => (c(), d("span", {
|
|
1945
2056
|
key: u,
|
|
1946
2057
|
class: "p-tag mbc__tag mbc__tag--on-row"
|
|
1947
2058
|
}, p(u), 1))), 128)),
|
|
1948
|
-
|
|
2059
|
+
Vt(e).length > 0 ? (c(), d("span", ha, p(Vt(e).join(" / ")), 1)) : k("", !0),
|
|
1949
2060
|
s("em", {
|
|
1950
|
-
class:
|
|
1951
|
-
}, p(e.enabled === !1 ?
|
|
1952
|
-
(e.detail ?? "").trim() ? (
|
|
2061
|
+
class: H({ "is-off": e.enabled === !1 })
|
|
2062
|
+
}, p(e.enabled === !1 ? De(e) || "校验失败已停用" : "可用"), 3),
|
|
2063
|
+
(e.detail ?? "").trim() ? (c(), d("span", {
|
|
1953
2064
|
key: 1,
|
|
1954
2065
|
class: "mbc__detail-line",
|
|
1955
2066
|
title: e.detail
|
|
1956
|
-
}, p(e.detail), 9,
|
|
1957
|
-
], 10,
|
|
1958
|
-
w.value === e.id ? (
|
|
1959
|
-
(
|
|
1960
|
-
key:
|
|
2067
|
+
}, p(e.detail), 9, _a)) : k("", !0)
|
|
2068
|
+
], 10, ba),
|
|
2069
|
+
w.value === e.id ? (c(), d("div", ga, [
|
|
2070
|
+
(c(!0), d(T, null, I(ie(e).slice(0, xe), (u, S) => (c(), d("p", {
|
|
2071
|
+
key: S,
|
|
1961
2072
|
class: "mbc__problem"
|
|
1962
2073
|
}, p(u), 1))), 128)),
|
|
1963
|
-
|
|
1964
|
-
s("dl",
|
|
1965
|
-
t[
|
|
1966
|
-
(
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
2074
|
+
ie(e).length > xe ? (c(), d("p", ya, "还有 " + p(ie(e).length - xe) + " 条问题没显示出来:点上面的「校验全部魔法块」重算一遍(这几条是上次校验的结论)", 1)) : k("", !0),
|
|
2075
|
+
s("dl", ka, [
|
|
2076
|
+
t[77] || (t[77] = s("dt", null, "详情", -1)),
|
|
2077
|
+
s("dd", null, [
|
|
2078
|
+
gt.value !== e.id ? (c(), d(T, { key: 0 }, [
|
|
2079
|
+
(e.detail ?? "").trim() ? (c(), d("span", $a, p(e.detail), 1)) : (c(), d("span", wa, [...t[74] || (t[74] = [
|
|
2080
|
+
y("(这一块没写详情 —— 点右边「写详情」写一段:它会存进库,下次导出还会写进它的 ", -1),
|
|
2081
|
+
s("span", { class: "mbc__mono" }, "magic-block.open.yaml", -1),
|
|
2082
|
+
y(")", -1)
|
|
2083
|
+
])])),
|
|
2084
|
+
s("button", {
|
|
2085
|
+
class: "p-button p-button-sm p-button-text",
|
|
2086
|
+
type: "button",
|
|
2087
|
+
disabled: C.value,
|
|
2088
|
+
onClick: (u) => jn(e)
|
|
2089
|
+
}, p((e.detail ?? "").trim() ? "改详情" : "写详情"), 9, xa)
|
|
2090
|
+
], 64)) : (c(), d(T, { key: 1 }, [
|
|
2091
|
+
ft(s("textarea", {
|
|
2092
|
+
"onUpdate:modelValue": t[14] || (t[14] = (u) => yt.value = u),
|
|
2093
|
+
class: "p-inputtext p-component mbc__detailinput",
|
|
2094
|
+
rows: "3",
|
|
2095
|
+
placeholder: "一段给人读的说明:这个块解决什么、怎么用、有哪些前提(只占一行)"
|
|
2096
|
+
}, null, 512), [
|
|
2097
|
+
[Yt, yt.value]
|
|
2098
|
+
]),
|
|
2099
|
+
s("button", {
|
|
2100
|
+
class: "p-button p-button-sm",
|
|
2101
|
+
type: "button",
|
|
2102
|
+
disabled: C.value,
|
|
2103
|
+
onClick: (u) => Ln(e)
|
|
2104
|
+
}, "存详情", 8, Ca),
|
|
2105
|
+
s("button", {
|
|
2106
|
+
class: "p-button p-button-sm p-button-text",
|
|
2107
|
+
type: "button",
|
|
2108
|
+
disabled: C.value,
|
|
2109
|
+
onClick: t[15] || (t[15] = (u) => gt.value = "")
|
|
2110
|
+
}, "取消", 8, Ea)
|
|
2111
|
+
], 64))
|
|
2112
|
+
]),
|
|
2113
|
+
t[78] || (t[78] = s("dt", null, "文件", -1)),
|
|
1974
2114
|
s("dd", null, p((e.fileNames || []).join(" / ") || "(没有文件)"), 1),
|
|
1975
|
-
t[
|
|
2115
|
+
t[79] || (t[79] = s("dt", null, "版本", -1)),
|
|
1976
2116
|
s("dd", null, [
|
|
1977
|
-
|
|
1978
|
-
s("span",
|
|
2117
|
+
y("v" + p(e.version || 1), 1),
|
|
2118
|
+
s("span", Sa, "(一共留着 " + p(e.versionCount ?? st.value[e.id]?.length ?? 1) + " 版)", 1)
|
|
1979
2119
|
]),
|
|
1980
|
-
t[
|
|
2120
|
+
t[80] || (t[80] = s("dt", null, "标签", -1)),
|
|
1981
2121
|
s("dd", null, [
|
|
1982
|
-
|
|
1983
|
-
(
|
|
2122
|
+
pt.value !== e.id ? (c(), d(T, { key: 0 }, [
|
|
2123
|
+
(c(!0), d(T, null, I(e.tags ?? [], (u) => (c(), d("span", {
|
|
1984
2124
|
key: u,
|
|
1985
2125
|
class: "p-tag mbc__tag"
|
|
1986
2126
|
}, p(u), 1))), 128)),
|
|
1987
|
-
(e.tags ?? []).length === 0 ? (
|
|
2127
|
+
(e.tags ?? []).length === 0 ? (c(), d("span", Ta, "(没贴标签)")) : k("", !0),
|
|
1988
2128
|
s("button", {
|
|
1989
2129
|
class: "p-button p-button-sm p-button-text",
|
|
1990
2130
|
type: "button",
|
|
1991
2131
|
disabled: C.value,
|
|
1992
|
-
onClick: (u) =>
|
|
1993
|
-
}, "改标签", 8,
|
|
1994
|
-
], 64)) : (
|
|
1995
|
-
|
|
1996
|
-
"onUpdate:modelValue": t[
|
|
2132
|
+
onClick: (u) => Pn(e)
|
|
2133
|
+
}, "改标签", 8, Ba)
|
|
2134
|
+
], 64)) : (c(), d(T, { key: 1 }, [
|
|
2135
|
+
ft(s("input", {
|
|
2136
|
+
"onUpdate:modelValue": t[16] || (t[16] = (u) => Z.value = u),
|
|
1997
2137
|
class: "p-inputtext p-component mbc__taginput",
|
|
1998
2138
|
type: "text",
|
|
1999
2139
|
placeholder: "逗号分隔,例如:订单, 报表",
|
|
2000
|
-
onKeyup:
|
|
2001
|
-
}, null, 40,
|
|
2002
|
-
[
|
|
2140
|
+
onKeyup: us((u) => Ie(e), ["enter"])
|
|
2141
|
+
}, null, 40, Ma), [
|
|
2142
|
+
[Yt, Z.value]
|
|
2003
2143
|
]),
|
|
2004
2144
|
s("button", {
|
|
2005
2145
|
class: "p-button p-button-sm",
|
|
2006
2146
|
type: "button",
|
|
2007
2147
|
disabled: C.value,
|
|
2008
|
-
onClick: (u) =>
|
|
2009
|
-
}, "存标签", 8,
|
|
2148
|
+
onClick: (u) => Ie(e)
|
|
2149
|
+
}, "存标签", 8, Aa),
|
|
2010
2150
|
s("button", {
|
|
2011
2151
|
class: "p-button p-button-sm p-button-text",
|
|
2012
2152
|
type: "button",
|
|
2013
2153
|
disabled: C.value,
|
|
2014
|
-
onClick: t[
|
|
2015
|
-
}, "取消", 8,
|
|
2016
|
-
|
|
2017
|
-
t[
|
|
2018
|
-
(
|
|
2154
|
+
onClick: t[17] || (t[17] = (u) => pt.value = "")
|
|
2155
|
+
}, "取消", 8, Ra),
|
|
2156
|
+
G.value.length > 0 ? (c(), d("div", Oa, [
|
|
2157
|
+
t[75] || (t[75] = s("span", { class: "mbc__hint" }, "点现成的加进去:", -1)),
|
|
2158
|
+
(c(!0), d(T, null, I(G.value.slice(0, 16), (u) => (c(), d("button", {
|
|
2019
2159
|
key: u.tag,
|
|
2020
2160
|
class: "p-tag mbc__tag",
|
|
2021
2161
|
type: "button",
|
|
2022
2162
|
title: `把「${u.tag}」加进去`,
|
|
2023
|
-
onClick: (
|
|
2024
|
-
}, p(u.tag), 9,
|
|
2025
|
-
])) :
|
|
2026
|
-
|
|
2027
|
-
t[
|
|
2028
|
-
(
|
|
2163
|
+
onClick: (S) => Dn(u.tag)
|
|
2164
|
+
}, p(u.tag), 9, Pa))), 128))
|
|
2165
|
+
])) : k("", !0),
|
|
2166
|
+
Z.value.trim() ? (c(), d("div", La, [
|
|
2167
|
+
t[76] || (t[76] = s("span", { class: "mbc__hint" }, "这一块会贴:", -1)),
|
|
2168
|
+
(c(!0), d(T, null, I(Z.value.split(/[,,\s]+/).filter(Boolean), (u) => (c(), d("button", {
|
|
2029
2169
|
key: u,
|
|
2030
2170
|
class: "p-tag mbc__tag",
|
|
2031
2171
|
type: "button",
|
|
2032
2172
|
title: `从这一块上摘掉「${u}」`,
|
|
2033
|
-
onClick: (
|
|
2034
|
-
}, p(u) + " ×", 9,
|
|
2035
|
-
])) :
|
|
2173
|
+
onClick: (S) => In(u)
|
|
2174
|
+
}, p(u) + " ×", 9, ja))), 128))
|
|
2175
|
+
])) : k("", !0)
|
|
2036
2176
|
], 64))
|
|
2037
2177
|
]),
|
|
2038
|
-
t[
|
|
2178
|
+
t[81] || (t[81] = s("dt", null, "更新", -1)),
|
|
2039
2179
|
s("dd", null, p(e.updatedAt || "—"), 1),
|
|
2040
|
-
t[
|
|
2041
|
-
s("dd",
|
|
2180
|
+
t[82] || (t[82] = s("dt", null, "id", -1)),
|
|
2181
|
+
s("dd", Da, p(e.id), 1)
|
|
2042
2182
|
]),
|
|
2043
|
-
s("div",
|
|
2183
|
+
s("div", Ia, [
|
|
2044
2184
|
s("button", {
|
|
2045
2185
|
class: "p-button p-button-sm p-button-outlined",
|
|
2046
2186
|
type: "button",
|
|
2047
2187
|
disabled: C.value,
|
|
2048
|
-
onClick: (u) =>
|
|
2188
|
+
onClick: (u) => ne(e),
|
|
2049
2189
|
title: "删掉这一块的代码文件:本机的文件夹 + 库里那份代码正文(点下去会先问你确认)。块本身留着,页面上会显示成占位框"
|
|
2050
|
-
}, "删除代码文件", 8,
|
|
2190
|
+
}, "删除代码文件", 8, Na)
|
|
2051
2191
|
]),
|
|
2052
|
-
s("div",
|
|
2053
|
-
s("div",
|
|
2054
|
-
t[
|
|
2192
|
+
s("div", Fa, [
|
|
2193
|
+
s("div", za, [
|
|
2194
|
+
t[83] || (t[83] = s("strong", null, "版本(每次上传 +1,旧的都留着)", -1)),
|
|
2055
2195
|
s("button", {
|
|
2056
2196
|
class: "p-button p-button-sm p-button-text",
|
|
2057
2197
|
type: "button",
|
|
2058
2198
|
disabled: C.value,
|
|
2059
|
-
onClick: (u) =>
|
|
2060
|
-
}, p(
|
|
2199
|
+
onClick: (u) => j(e.id)
|
|
2200
|
+
}, p($.value === e.id ? "读版本中…" : "刷新版本"), 9, Ua)
|
|
2061
2201
|
]),
|
|
2062
|
-
|
|
2063
|
-
(
|
|
2202
|
+
st.value[e.id] ? st.value[e.id].length > 0 ? (c(), d("ul", Ka, [
|
|
2203
|
+
(c(!0), d(T, null, I(st.value[e.id], (u) => (c(), d("li", {
|
|
2064
2204
|
key: u.number,
|
|
2065
|
-
class:
|
|
2205
|
+
class: H({ "is-current": u.current })
|
|
2066
2206
|
}, [
|
|
2067
|
-
s("span",
|
|
2068
|
-
s("span",
|
|
2069
|
-
|
|
2070
|
-
u.createdBy ? (
|
|
2071
|
-
|
|
2072
|
-
], 64)) :
|
|
2073
|
-
|
|
2207
|
+
s("span", Va, p(ut(u)), 1),
|
|
2208
|
+
s("span", qa, [
|
|
2209
|
+
y(p(u.fileCount) + " 个文件 · " + p(jt(u.sizeBytes)), 1),
|
|
2210
|
+
u.createdBy ? (c(), d(T, { key: 0 }, [
|
|
2211
|
+
y(" · " + p(u.createdBy), 1)
|
|
2212
|
+
], 64)) : k("", !0),
|
|
2213
|
+
y(" · " + p(u.createdAt || "—"), 1)
|
|
2074
2214
|
]),
|
|
2075
|
-
s("span",
|
|
2215
|
+
s("span", Ja, [
|
|
2076
2216
|
s("button", {
|
|
2077
2217
|
class: "p-button p-button-sm p-button-text",
|
|
2078
2218
|
type: "button",
|
|
2079
2219
|
disabled: C.value || u.empty,
|
|
2080
|
-
onClick: (
|
|
2220
|
+
onClick: (S) => Mn(e, u.number),
|
|
2081
2221
|
title: u.empty ? "这一版是空包(代码被删过),没有正文可看" : "看这一版的正文(只读)"
|
|
2082
|
-
}, "查看", 8,
|
|
2222
|
+
}, "查看", 8, Ga),
|
|
2083
2223
|
s("button", {
|
|
2084
2224
|
class: "p-button p-button-sm p-button-text",
|
|
2085
2225
|
type: "button",
|
|
2086
2226
|
disabled: C.value || u.current || u.empty,
|
|
2087
|
-
onClick: (
|
|
2227
|
+
onClick: (S) => An(e, u.number),
|
|
2088
2228
|
title: u.current ? "这一版正在跑" : "把这一版变成当前版(会记成一个新版本)"
|
|
2089
|
-
}, "切回", 8,
|
|
2229
|
+
}, "切回", 8, Wa),
|
|
2090
2230
|
s("button", {
|
|
2091
2231
|
class: "p-button p-button-sm p-button-text",
|
|
2092
2232
|
type: "button",
|
|
2093
2233
|
disabled: C.value || u.empty,
|
|
2094
|
-
onClick: (
|
|
2234
|
+
onClick: (S) => On(e, u.number),
|
|
2095
2235
|
title: u.empty ? "空包没什么可下的" : "下载这一版(一个 zip)"
|
|
2096
|
-
}, "下载", 8,
|
|
2236
|
+
}, "下载", 8, Ya),
|
|
2097
2237
|
s("button", {
|
|
2098
2238
|
class: "p-button p-button-sm p-button-text",
|
|
2099
2239
|
type: "button",
|
|
2100
2240
|
disabled: C.value || u.current,
|
|
2101
|
-
onClick: (
|
|
2241
|
+
onClick: (S) => Rn(e, u.number),
|
|
2102
2242
|
title: u.current ? "当前那一版不许删:先切到别的版本" : "删掉这一版(别的版本不受影响)"
|
|
2103
|
-
}, "删", 8,
|
|
2243
|
+
}, "删", 8, Za)
|
|
2104
2244
|
])
|
|
2105
2245
|
], 2))), 128))
|
|
2106
|
-
])) : (
|
|
2107
|
-
|
|
2108
|
-
s("div",
|
|
2109
|
-
s("strong", null, "看 v" + p(
|
|
2246
|
+
])) : (c(), d("p", Xa, "这个块还没有版本记录(它从没被保存过)。")) : (c(), d("p", Ha, "正在读版本…(没读到时点「刷新版本」)")),
|
|
2247
|
+
E.value && E.value.id === e.id ? (c(), d("div", Qa, [
|
|
2248
|
+
s("div", tl, [
|
|
2249
|
+
s("strong", null, "看 v" + p(E.value.number) + " 的正文(只读)", 1),
|
|
2110
2250
|
s("button", {
|
|
2111
2251
|
class: "p-button p-button-sm p-button-text",
|
|
2112
2252
|
type: "button",
|
|
2113
|
-
onClick: t[
|
|
2253
|
+
onClick: t[18] || (t[18] = (u) => E.value = null)
|
|
2114
2254
|
}, "收起")
|
|
2115
2255
|
]),
|
|
2116
|
-
(
|
|
2117
|
-
key:
|
|
2256
|
+
(c(!0), d(T, null, I(E.value.files, (u, S) => (c(), d("details", {
|
|
2257
|
+
key: S,
|
|
2118
2258
|
class: "mbc__viewer-file"
|
|
2119
2259
|
}, [
|
|
2120
|
-
s("summary",
|
|
2121
|
-
s("pre",
|
|
2260
|
+
s("summary", el, p(S) + "(" + p(jt(u.length)) + ")", 1),
|
|
2261
|
+
s("pre", nl, p(u), 1)
|
|
2122
2262
|
]))), 128))
|
|
2123
|
-
])) :
|
|
2263
|
+
])) : k("", !0)
|
|
2124
2264
|
])
|
|
2125
|
-
])) :
|
|
2265
|
+
])) : k("", !0)
|
|
2126
2266
|
]))), 128))
|
|
2127
2267
|
])
|
|
2128
2268
|
], 512), [
|
|
2129
|
-
[
|
|
2269
|
+
[Zt, R.value === "blocks"]
|
|
2130
2270
|
]),
|
|
2131
|
-
|
|
2132
|
-
t[
|
|
2133
|
-
s("div",
|
|
2134
|
-
t[
|
|
2271
|
+
ft(s("section", sl, [
|
|
2272
|
+
t[93] || (t[93] = s("h3", { class: "mbc__title" }, "导出去改(用你自己的编辑器)", -1)),
|
|
2273
|
+
s("div", ol, [
|
|
2274
|
+
t[84] || (t[84] = s("span", { class: "mbc__label" }, "体检", -1)),
|
|
2135
2275
|
s("button", {
|
|
2136
2276
|
class: "p-button p-button-sm",
|
|
2137
2277
|
type: "button",
|
|
2138
2278
|
disabled: C.value,
|
|
2139
|
-
onClick: t[
|
|
2140
|
-
}, p(
|
|
2141
|
-
t[
|
|
2279
|
+
onClick: t[19] || (t[19] = (e) => qn())
|
|
2280
|
+
}, p(Lt.value ? "校验中…" : "校验全部魔法块"), 9, al),
|
|
2281
|
+
t[85] || (t[85] = s("span", { class: "mbc__hint" }, "重新跑一遍逐块判据(试加载 + 引用深检),过不了的整块停用;改好再点一次就恢复。", -1))
|
|
2142
2282
|
]),
|
|
2143
|
-
t[
|
|
2144
|
-
s("div",
|
|
2145
|
-
t[
|
|
2146
|
-
s("label",
|
|
2283
|
+
t[94] || (t[94] = s("hr", { class: "mbc__rule" }, null, -1)),
|
|
2284
|
+
s("div", ll, [
|
|
2285
|
+
t[87] || (t[87] = s("span", { class: "mbc__label" }, "导出范围", -1)),
|
|
2286
|
+
s("label", il, [
|
|
2147
2287
|
s("input", {
|
|
2148
2288
|
type: "radio",
|
|
2149
2289
|
name: "mbc-scope",
|
|
2150
2290
|
value: "one",
|
|
2151
|
-
checked:
|
|
2152
|
-
onChange: t[
|
|
2153
|
-
}, null, 40,
|
|
2154
|
-
t[
|
|
2291
|
+
checked: X.value === "one",
|
|
2292
|
+
onChange: t[20] || (t[20] = (e) => X.value = "one")
|
|
2293
|
+
}, null, 40, ul),
|
|
2294
|
+
t[86] || (t[86] = y(" 仅这一个块 ", -1))
|
|
2155
2295
|
]),
|
|
2156
|
-
s("label",
|
|
2296
|
+
s("label", rl, [
|
|
2157
2297
|
s("input", {
|
|
2158
2298
|
type: "radio",
|
|
2159
2299
|
name: "mbc-scope",
|
|
2160
2300
|
value: "all",
|
|
2161
|
-
checked:
|
|
2162
|
-
onChange: t[
|
|
2163
|
-
}, null, 40,
|
|
2164
|
-
|
|
2301
|
+
checked: X.value === "all",
|
|
2302
|
+
onChange: t[21] || (t[21] = (e) => X.value = "all")
|
|
2303
|
+
}, null, 40, cl),
|
|
2304
|
+
y(" 全部块(" + p(v.value.length) + " 个) ", 1)
|
|
2165
2305
|
]),
|
|
2166
|
-
|
|
2306
|
+
X.value === "one" ? (c(), d("select", {
|
|
2167
2307
|
key: 0,
|
|
2168
2308
|
class: "p-inputtext p-component mbc__grow",
|
|
2169
|
-
value:
|
|
2170
|
-
disabled: C.value ||
|
|
2171
|
-
onChange: t[
|
|
2309
|
+
value: $t.value,
|
|
2310
|
+
disabled: C.value || v.value.length === 0,
|
|
2311
|
+
onChange: t[22] || (t[22] = (e) => Ut(e.target.value))
|
|
2172
2312
|
}, [
|
|
2173
|
-
|
|
2174
|
-
(
|
|
2313
|
+
v.value.length === 0 ? (c(), d("option", pl, "(库里还没有块)")) : k("", !0),
|
|
2314
|
+
(c(!0), d(T, null, I(v.value, (e) => (c(), d("option", {
|
|
2175
2315
|
key: e.id,
|
|
2176
2316
|
value: e.id
|
|
2177
|
-
}, p(e.module) + " / " + p(e.name || e.id), 9,
|
|
2178
|
-
], 40,
|
|
2317
|
+
}, p(e.module) + " / " + p(e.name || e.id), 9, bl))), 128))
|
|
2318
|
+
], 40, dl)) : k("", !0)
|
|
2179
2319
|
]),
|
|
2180
|
-
s("div",
|
|
2181
|
-
t[
|
|
2320
|
+
s("div", ml, [
|
|
2321
|
+
t[88] || (t[88] = s("label", { for: "mbc-dir" }, "导出目录", -1)),
|
|
2182
2322
|
s("input", {
|
|
2183
2323
|
id: "mbc-dir",
|
|
2184
2324
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
2185
2325
|
type: "text",
|
|
2186
2326
|
readonly: "",
|
|
2187
|
-
value:
|
|
2188
|
-
}, null, 8,
|
|
2327
|
+
value: K.value ? K.value.name : "(还没选:点右边那个按钮选一个文件夹)"
|
|
2328
|
+
}, null, 8, fl),
|
|
2189
2329
|
s("button", {
|
|
2190
2330
|
class: "p-button p-button-sm p-button-outlined",
|
|
2191
2331
|
type: "button",
|
|
2192
2332
|
disabled: C.value,
|
|
2193
|
-
onClick: t[
|
|
2194
|
-
}, "选择文件夹", 8,
|
|
2333
|
+
onClick: t[23] || (t[23] = (e) => ze("export"))
|
|
2334
|
+
}, "选择文件夹", 8, vl),
|
|
2195
2335
|
s("button", {
|
|
2196
2336
|
class: "p-button p-button-sm mbc__act-export",
|
|
2197
2337
|
type: "button",
|
|
2198
|
-
disabled: C.value ||
|
|
2199
|
-
title:
|
|
2200
|
-
onClick: t[
|
|
2201
|
-
}, p(
|
|
2338
|
+
disabled: C.value || X.value === "one" && !bt.value,
|
|
2339
|
+
title: X.value === "one" && !bt.value ? "先在左边挑一个块(或者把范围改成「全部块」)" : "把库里的块铺到你选的文件夹",
|
|
2340
|
+
onClick: t[24] || (t[24] = (e) => Jn())
|
|
2341
|
+
}, p(lt.value ? "导出中…" : "导出"), 9, hl)
|
|
2202
2342
|
]),
|
|
2203
|
-
s("p",
|
|
2204
|
-
|
|
2205
|
-
t[
|
|
2206
|
-
t[
|
|
2207
|
-
t[
|
|
2208
|
-
t[
|
|
2343
|
+
s("p", _l, [
|
|
2344
|
+
y(p(X.value === "all" ? `这一趟铺全部 ${v.value.length} 个块` : bt.value ? `这一趟只铺「${bt.value.module} / ${bt.value.name || bt.value.id}」` : "先挑一个块") + " ⇒ ", 1),
|
|
2345
|
+
t[89] || (t[89] = s("span", { class: "mbc__mono" }, "workspace/<可读名>-<块 uuid>/", -1)),
|
|
2346
|
+
t[90] || (t[90] = y(",顶层另附开发说明与 ", -1)),
|
|
2347
|
+
t[91] || (t[91] = s("span", { class: "mbc__mono" }, "example/", -1)),
|
|
2348
|
+
t[92] || (t[92] = y("。 ", -1))
|
|
2209
2349
|
]),
|
|
2210
|
-
|
|
2350
|
+
V.value ? (c(), d("p", gl, p(V.value), 1)) : k("", !0)
|
|
2211
2351
|
], 512), [
|
|
2212
|
-
[
|
|
2352
|
+
[Zt, R.value === "workspace"]
|
|
2213
2353
|
]),
|
|
2214
|
-
|
|
2215
|
-
t[
|
|
2216
|
-
s("div",
|
|
2217
|
-
t[
|
|
2354
|
+
ft(s("section", yl, [
|
|
2355
|
+
t[103] || (t[103] = s("h3", { class: "mbc__title" }, "读回改动", -1)),
|
|
2356
|
+
s("div", kl, [
|
|
2357
|
+
t[95] || (t[95] = s("label", { for: "mbc-read-dir" }, "读回目录", -1)),
|
|
2218
2358
|
s("input", {
|
|
2219
2359
|
id: "mbc-read-dir",
|
|
2220
2360
|
class: "p-inputtext p-component mbc__grow mbc__mono",
|
|
2221
2361
|
type: "text",
|
|
2222
2362
|
readonly: "",
|
|
2223
|
-
value:
|
|
2224
|
-
}, null, 8,
|
|
2363
|
+
value: z.value ? z.value.name : "(还没选:导出会自动填上,也可以自己选一个)"
|
|
2364
|
+
}, null, 8, $l),
|
|
2225
2365
|
s("button", {
|
|
2226
2366
|
class: "p-button p-button-sm p-button-outlined",
|
|
2227
2367
|
type: "button",
|
|
2228
2368
|
disabled: C.value,
|
|
2229
|
-
onClick: t[
|
|
2230
|
-
}, "选择文件夹", 8,
|
|
2369
|
+
onClick: t[25] || (t[25] = (e) => ze("read"))
|
|
2370
|
+
}, "选择文件夹", 8, wl),
|
|
2231
2371
|
s("button", {
|
|
2232
2372
|
class: "p-button p-button-sm p-button-outlined",
|
|
2233
2373
|
type: "button",
|
|
2234
2374
|
disabled: C.value,
|
|
2235
|
-
onClick: t[
|
|
2236
|
-
}, p(
|
|
2375
|
+
onClick: t[26] || (t[26] = (e) => Ke())
|
|
2376
|
+
}, p(kt.value ? "读回中…" : "读回改动"), 9, xl)
|
|
2237
2377
|
]),
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
t[
|
|
2242
|
-
s("b", null, p(
|
|
2243
|
-
t[
|
|
2244
|
-
s("b",
|
|
2245
|
-
t[
|
|
2246
|
-
s("b", null, p(
|
|
2247
|
-
t[
|
|
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, "读回目录默认跟着导出目录;要读别的文件夹就点「选择文件夹」单独选一个。")),
|
|
2379
|
+
A.value ? (c(), d(T, { key: 2 }, [
|
|
2380
|
+
qt.value.length > 0 ? (c(), d("p", Sl, [
|
|
2381
|
+
t[96] || (t[96] = y(" 扫到 ", -1)),
|
|
2382
|
+
s("b", null, p(A.value.blocks.length), 1),
|
|
2383
|
+
t[97] || (t[97] = y(" 个块,其中 ", -1)),
|
|
2384
|
+
s("b", Tl, p(qt.value.length), 1),
|
|
2385
|
+
t[98] || (t[98] = y(" 个可以存;已经勾了 ", -1)),
|
|
2386
|
+
s("b", null, p(Jt.value.length), 1),
|
|
2387
|
+
t[99] || (t[99] = y(" 个。 ", -1)),
|
|
2248
2388
|
s("button", {
|
|
2249
2389
|
class: "p-button p-button-sm p-button-text",
|
|
2250
2390
|
type: "button",
|
|
2251
2391
|
disabled: C.value,
|
|
2252
|
-
onClick: t[
|
|
2253
|
-
}, "全选可存的", 8,
|
|
2392
|
+
onClick: t[27] || (t[27] = (e) => Ve(!0))
|
|
2393
|
+
}, "全选可存的", 8, Bl),
|
|
2254
2394
|
s("button", {
|
|
2255
2395
|
class: "p-button p-button-sm p-button-text",
|
|
2256
2396
|
type: "button",
|
|
2257
|
-
disabled: C.value ||
|
|
2258
|
-
onClick: t[
|
|
2259
|
-
}, "全不选", 8,
|
|
2260
|
-
])) :
|
|
2261
|
-
|
|
2262
|
-
(
|
|
2397
|
+
disabled: C.value || Jt.value.length === 0,
|
|
2398
|
+
onClick: t[28] || (t[28] = (e) => Ve(!1))
|
|
2399
|
+
}, "全不选", 8, Ml)
|
|
2400
|
+
])) : k("", !0),
|
|
2401
|
+
A.value.blocks.length > 0 ? (c(), d("ul", Al, [
|
|
2402
|
+
(c(!0), d(T, null, I(A.value.blocks, (e) => (c(), d("li", {
|
|
2263
2403
|
key: e.id,
|
|
2264
|
-
class:
|
|
2404
|
+
class: H(["mbc__block", { "is-picked": it.value[e.id] === !0, "is-blocked": !e.canApply }])
|
|
2265
2405
|
}, [
|
|
2266
|
-
s("label",
|
|
2406
|
+
s("label", Rl, [
|
|
2267
2407
|
s("span", {
|
|
2268
|
-
class:
|
|
2408
|
+
class: H(["p-checkbox p-component", { "p-disabled": !e.canApply }])
|
|
2269
2409
|
}, [
|
|
2270
2410
|
s("input", {
|
|
2271
2411
|
class: "p-checkbox-input",
|
|
2272
2412
|
type: "checkbox",
|
|
2273
2413
|
disabled: !e.canApply,
|
|
2274
|
-
checked:
|
|
2275
|
-
onChange: (u) =>
|
|
2276
|
-
}, null, 40,
|
|
2277
|
-
t[
|
|
2414
|
+
checked: it.value[e.id] === !0,
|
|
2415
|
+
onChange: (u) => Qn(e.id, u)
|
|
2416
|
+
}, null, 40, Ol),
|
|
2417
|
+
t[100] || (t[100] = s("span", { class: "p-checkbox-box" }, null, -1))
|
|
2278
2418
|
], 2),
|
|
2279
|
-
s("span",
|
|
2419
|
+
s("span", Pl, p(e.name || e.id), 1),
|
|
2280
2420
|
s("span", {
|
|
2281
|
-
class:
|
|
2282
|
-
}, p(
|
|
2283
|
-
s("span",
|
|
2421
|
+
class: H(["p-tag", e.status === "modified" ? "p-tag-success" : e.status === "missing" ? "p-tag-warning" : e.status === "not-in-db" ? "p-tag-info" : ""])
|
|
2422
|
+
}, p(o[e.status]), 3),
|
|
2423
|
+
s("span", Ll, p(e.module || "—"), 1)
|
|
2284
2424
|
]),
|
|
2285
|
-
s("p",
|
|
2286
|
-
e.status === "missing" ? (
|
|
2287
|
-
|
|
2288
|
-
], 64)) : e.status === "not-in-db" ? (
|
|
2289
|
-
|
|
2290
|
-
], 64)) : e.changedFiles.length > 0 ? (
|
|
2291
|
-
t[
|
|
2292
|
-
s("span",
|
|
2293
|
-
], 64)) : (
|
|
2294
|
-
|
|
2425
|
+
s("p", jl, [
|
|
2426
|
+
e.status === "missing" ? (c(), d(T, { key: 0 }, [
|
|
2427
|
+
y("目录里没有这一块,勾不上")
|
|
2428
|
+
], 64)) : e.status === "not-in-db" ? (c(), d(T, { key: 1 }, [
|
|
2429
|
+
y("库里还没有这一块 —— 勾上它保存,就是按这一包新建")
|
|
2430
|
+
], 64)) : e.changedFiles.length > 0 ? (c(), d(T, { key: 2 }, [
|
|
2431
|
+
t[101] || (t[101] = y("改了:", -1)),
|
|
2432
|
+
s("span", Dl, p(e.changedFiles.join(" / ")), 1)
|
|
2433
|
+
], 64)) : (c(), d(T, { key: 3 }, [
|
|
2434
|
+
y("内容与库里一致")
|
|
2295
2435
|
], 64))
|
|
2296
2436
|
]),
|
|
2297
|
-
e.blockedWhy ? (
|
|
2298
|
-
s("p",
|
|
2437
|
+
e.blockedWhy ? (c(), d("p", Il, "不能存:" + p(e.blockedWhy), 1)) : k("", !0),
|
|
2438
|
+
s("p", Nl, p(e.folder || e.where), 1)
|
|
2299
2439
|
], 2))), 128))
|
|
2300
|
-
])) : (
|
|
2301
|
-
s("div",
|
|
2302
|
-
|
|
2440
|
+
])) : (c(), d("p", Fl, "这个目录里没有认出任何块(点上面那个按钮再扫一次,或者确认文件夹名里有那个块的 uuid)。")),
|
|
2441
|
+
s("div", zl, [
|
|
2442
|
+
rt.value > 0 ? (c(), d("button", {
|
|
2303
2443
|
key: 0,
|
|
2304
2444
|
class: "p-button p-button-sm mbc__report-btn",
|
|
2305
2445
|
type: "button",
|
|
2306
|
-
title: "点开看这一趟的全部问题(" +
|
|
2307
|
-
onClick: t[
|
|
2308
|
-
}, "查看问题(" + p(
|
|
2309
|
-
|
|
2446
|
+
title: "点开看这一趟的全部问题(" + rt.value + " 条)",
|
|
2447
|
+
onClick: t[29] || (t[29] = (e) => At.value = !0)
|
|
2448
|
+
}, "查看问题(" + p(rt.value) + ")⚠", 9, Ul)) : (c(), d("span", Hl, "这一趟没有问题")),
|
|
2449
|
+
A.value.unmatched.length > 0 ? (c(), d("span", {
|
|
2310
2450
|
key: 2,
|
|
2311
2451
|
class: "mbc__chip is-bad",
|
|
2312
|
-
title:
|
|
2313
|
-
}, "认不出归属的文件夹 " + p(
|
|
2452
|
+
title: A.value.unmatched.join(" / ")
|
|
2453
|
+
}, "认不出归属的文件夹 " + p(A.value.unmatched.length), 9, Kl)) : k("", !0)
|
|
2314
2454
|
]),
|
|
2315
|
-
(
|
|
2316
|
-
|
|
2317
|
-
t[
|
|
2318
|
-
|
|
2319
|
-
])) :
|
|
2320
|
-
s("div",
|
|
2455
|
+
(A.value.skipped ?? []).length > 0 ? (c(), d("p", Vl, [
|
|
2456
|
+
y(" 忽略了 " + p((A.value.skipped ?? []).length) + " 个文件夹(名字里没有 uuid,当测试文件处理 —— 与忽略 ", 1),
|
|
2457
|
+
t[102] || (t[102] = s("span", { class: "mbc__mono" }, "example/", -1)),
|
|
2458
|
+
y(" 同一个规矩):" + p((A.value.skipped ?? []).join(" / ")), 1)
|
|
2459
|
+
])) : k("", !0),
|
|
2460
|
+
s("div", ql, [
|
|
2321
2461
|
s("button", {
|
|
2322
2462
|
class: "p-button p-button-sm mbc__act-import",
|
|
2323
2463
|
type: "button",
|
|
2324
2464
|
disabled: C.value,
|
|
2325
|
-
onClick: t[
|
|
2326
|
-
}, p(
|
|
2465
|
+
onClick: t[30] || (t[30] = (e) => Xn())
|
|
2466
|
+
}, p(nt.value ? "保存中…" : `保存选中的块(${Jt.value.length})`), 9, Jl)
|
|
2327
2467
|
])
|
|
2328
|
-
], 64)) :
|
|
2468
|
+
], 64)) : k("", !0)
|
|
2329
2469
|
], 512), [
|
|
2330
|
-
[
|
|
2470
|
+
[Zt, R.value === "workspace"]
|
|
2331
2471
|
]),
|
|
2332
|
-
|
|
2333
|
-
s("h3",
|
|
2334
|
-
t[
|
|
2335
|
-
s("span",
|
|
2336
|
-
s("span",
|
|
2472
|
+
ft(s("section", Gl, [
|
|
2473
|
+
s("h3", Wl, [
|
|
2474
|
+
t[104] || (t[104] = y(" 不在数据库 ", -1)),
|
|
2475
|
+
s("span", Yl, p(_t(l)), 1),
|
|
2476
|
+
s("span", Zl, p(ce.value.length), 1)
|
|
2337
2477
|
]),
|
|
2338
|
-
|
|
2339
|
-
s("p",
|
|
2340
|
-
t[
|
|
2341
|
-
t[
|
|
2342
|
-
t[
|
|
2343
|
-
t[
|
|
2344
|
-
t[
|
|
2345
|
-
t[
|
|
2346
|
-
|
|
2478
|
+
ce.value.length === 0 ? (c(), d("p", Xl, "路由表里声明的块,库里都有那一行。")) : (c(), d(T, { key: 1 }, [
|
|
2479
|
+
s("p", Ql, [
|
|
2480
|
+
t[105] || (t[105] = y(" 这些页面的路由(", -1)),
|
|
2481
|
+
t[106] || (t[106] = s("span", { class: "mbc__mono" }, "component: MagicBlockPage", -1)),
|
|
2482
|
+
t[107] || (t[107] = y(")声明了块的 uuid, ", -1)),
|
|
2483
|
+
t[108] || (t[108] = s("span", { class: "mbc__mono" }, "/magic-blocks/index", -1)),
|
|
2484
|
+
t[109] || (t[109] = y(" 里却没有这一行 —— 页面上那一块现在是占位框。 ", -1)),
|
|
2485
|
+
t[110] || (t[110] = s("b", null, "要建进库", -1)),
|
|
2486
|
+
y(":在上面「读回改动」里选中放这一块的文件夹(文件夹名里有 uuid), 扫出来就是一条标签写着「" + p(_t(l)) + "」、能勾能存的条目。 ", 1)
|
|
2347
2487
|
]),
|
|
2348
|
-
s("ul",
|
|
2349
|
-
(
|
|
2488
|
+
s("ul", ti, [
|
|
2489
|
+
(c(!0), d(T, null, I(ce.value, (e) => (c(), d("li", {
|
|
2350
2490
|
key: e.uuid,
|
|
2351
2491
|
class: "mbc__block is-blocked"
|
|
2352
2492
|
}, [
|
|
2353
|
-
s("label",
|
|
2354
|
-
t[
|
|
2493
|
+
s("label", ei, [
|
|
2494
|
+
t[111] || (t[111] = s("span", { class: "p-checkbox p-component p-disabled" }, [
|
|
2355
2495
|
s("input", {
|
|
2356
2496
|
class: "p-checkbox-input",
|
|
2357
2497
|
type: "checkbox",
|
|
@@ -2359,205 +2499,205 @@ ${t.text}`).join(`
|
|
|
2359
2499
|
}),
|
|
2360
2500
|
s("span", { class: "p-checkbox-box" })
|
|
2361
2501
|
], -1)),
|
|
2362
|
-
s("span",
|
|
2363
|
-
s("span",
|
|
2364
|
-
s("span",
|
|
2502
|
+
s("span", ni, p(e.title || e.uuid), 1),
|
|
2503
|
+
s("span", si, p(_t(l)), 1),
|
|
2504
|
+
s("span", oi, p(e.module || "—"), 1)
|
|
2365
2505
|
]),
|
|
2366
|
-
s("p",
|
|
2367
|
-
t[
|
|
2368
|
-
s("span",
|
|
2369
|
-
t[
|
|
2506
|
+
s("p", ai, [
|
|
2507
|
+
t[112] || (t[112] = y(" 路由 ", -1)),
|
|
2508
|
+
s("span", li, p(e.path), 1),
|
|
2509
|
+
t[113] || (t[113] = y(" 声明了它,库里没有这个块 —— 手里还没有放这个块的文件夹,所以这里勾不上(勾上了也没有正文可存)。 ", -1))
|
|
2370
2510
|
]),
|
|
2371
|
-
s("p",
|
|
2511
|
+
s("p", ii, p(e.uuid), 1)
|
|
2372
2512
|
]))), 128))
|
|
2373
2513
|
])
|
|
2374
2514
|
], 64))
|
|
2375
2515
|
], 512), [
|
|
2376
|
-
[
|
|
2516
|
+
[Zt, R.value === "workspace"]
|
|
2377
2517
|
]),
|
|
2378
|
-
|
|
2379
|
-
t[
|
|
2380
|
-
s("p",
|
|
2381
|
-
s("span",
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2518
|
+
R.value === "workspace" && (W.value.length > 0 || Y.value.length > 0) ? (c(), d("section", ui, [
|
|
2519
|
+
t[114] || (t[114] = s("h3", { class: "mbc__title" }, "保存结果", -1)),
|
|
2520
|
+
s("p", ri, [
|
|
2521
|
+
s("span", ci, "存成 " + p(ue.value), 1),
|
|
2522
|
+
It.value.length > 0 ? (c(), d("span", di, "没存成 " + p(It.value.length), 1)) : k("", !0),
|
|
2523
|
+
W.value.length > 0 ? (c(), d("span", pi, "前端拦下 " + p(W.value.length), 1)) : k("", !0),
|
|
2524
|
+
It.value.length === 0 && W.value.length === 0 ? (c(), d("span", bi, "明细在下面那个「查看问题」里(没问题时是空的)。")) : k("", !0)
|
|
2385
2525
|
]),
|
|
2386
|
-
s("div",
|
|
2526
|
+
s("div", mi, [
|
|
2387
2527
|
s("button", {
|
|
2388
2528
|
class: "p-button p-button-sm mbc__report-btn",
|
|
2389
2529
|
type: "button",
|
|
2390
|
-
onClick: t[
|
|
2391
|
-
}, "查看问题(" + p(
|
|
2530
|
+
onClick: t[31] || (t[31] = (e) => At.value = !0)
|
|
2531
|
+
}, "查看问题(" + p(rt.value) + ")⚠", 1)
|
|
2392
2532
|
])
|
|
2393
|
-
])) :
|
|
2394
|
-
t[
|
|
2533
|
+
])) : k("", !0),
|
|
2534
|
+
t[115] || (t[115] = s("div", {
|
|
2395
2535
|
class: "mbc__tailspace",
|
|
2396
2536
|
"aria-hidden": "true"
|
|
2397
2537
|
}, null, -1))
|
|
2398
2538
|
]),
|
|
2399
|
-
s("footer",
|
|
2400
|
-
|
|
2539
|
+
s("footer", fi, [
|
|
2540
|
+
M.value.length > 0 ? (c(), d("button", {
|
|
2401
2541
|
key: 0,
|
|
2402
2542
|
class: "p-button p-button-sm mbc__report-btn",
|
|
2403
2543
|
type: "button",
|
|
2404
|
-
title: "点开看全部报错(" +
|
|
2405
|
-
onClick: t[
|
|
2406
|
-
}, "查看报错(" + p(
|
|
2407
|
-
|
|
2544
|
+
title: "点开看全部报错(" + M.value.length + " 条)",
|
|
2545
|
+
onClick: t[32] || (t[32] = (e) => F.value = !0)
|
|
2546
|
+
}, "查看报错(" + p(M.value.length) + " 条)⚠", 9, vi)) : k("", !0),
|
|
2547
|
+
_.value ? (c(), d("p", hi, p(_.value), 1)) : g.value ? (c(), d("p", _i, p(g.value), 1)) : (c(), d("p", gi, "—"))
|
|
2408
2548
|
])
|
|
2409
|
-
], 2)) :
|
|
2410
|
-
b.value &&
|
|
2549
|
+
], 2)) : k("", !0),
|
|
2550
|
+
b.value && At.value ? (c(), d("div", {
|
|
2411
2551
|
key: 1,
|
|
2412
2552
|
class: "mbc__modal",
|
|
2413
2553
|
role: "dialog",
|
|
2414
2554
|
"aria-modal": "true",
|
|
2415
|
-
onClick: t[
|
|
2555
|
+
onClick: t[36] || (t[36] = Ce((e) => At.value = !1, ["self"]))
|
|
2416
2556
|
}, [
|
|
2417
|
-
s("div",
|
|
2418
|
-
s("header",
|
|
2419
|
-
s("strong", null, "读回 / 保存的问题(" + p(
|
|
2557
|
+
s("div", yi, [
|
|
2558
|
+
s("header", ki, [
|
|
2559
|
+
s("strong", null, "读回 / 保存的问题(" + p(rt.value) + " 条)", 1),
|
|
2420
2560
|
s("button", {
|
|
2421
2561
|
class: "p-button p-button-sm p-button-text",
|
|
2422
2562
|
type: "button",
|
|
2423
|
-
onClick: t[
|
|
2563
|
+
onClick: t[33] || (t[33] = (e) => At.value = !1)
|
|
2424
2564
|
}, "收起")
|
|
2425
2565
|
]),
|
|
2426
|
-
s("div",
|
|
2427
|
-
|
|
2428
|
-
s("h4",
|
|
2429
|
-
s("ul",
|
|
2430
|
-
(
|
|
2566
|
+
s("div", $i, [
|
|
2567
|
+
W.value.length > 0 ? (c(), d("section", wi, [
|
|
2568
|
+
s("h4", xi, "前端校验拦下的(" + p(W.value.length) + ")", 1),
|
|
2569
|
+
s("ul", Ci, [
|
|
2570
|
+
(c(!0), d(T, null, I(W.value, (e, u) => (c(), d("li", { key: u }, p(e), 1))), 128))
|
|
2431
2571
|
])
|
|
2432
|
-
])) :
|
|
2433
|
-
(
|
|
2434
|
-
s("h4",
|
|
2435
|
-
s("ul",
|
|
2436
|
-
(
|
|
2437
|
-
s("span",
|
|
2438
|
-
s("span",
|
|
2439
|
-
|
|
2572
|
+
])) : k("", !0),
|
|
2573
|
+
(A.value?.failures ?? []).length > 0 ? (c(), d("section", Ei, [
|
|
2574
|
+
s("h4", Si, "读回时逐条回的(" + p((A.value?.failures ?? []).length) + ")", 1),
|
|
2575
|
+
s("ul", Ti, [
|
|
2576
|
+
(c(!0), d(T, null, I(A.value?.failures ?? [], (e, u) => (c(), d("li", { key: u }, [
|
|
2577
|
+
s("span", Bi, p(e.kind || "问题"), 1),
|
|
2578
|
+
s("span", Mi, p(e.where), 1),
|
|
2579
|
+
y(" " + p(e.message), 1)
|
|
2440
2580
|
]))), 128))
|
|
2441
2581
|
])
|
|
2442
|
-
])) :
|
|
2443
|
-
(
|
|
2444
|
-
s("h4",
|
|
2445
|
-
s("ul",
|
|
2446
|
-
(
|
|
2447
|
-
s("span",
|
|
2582
|
+
])) : k("", !0),
|
|
2583
|
+
(A.value?.unmatched ?? []).length > 0 ? (c(), d("section", Ai, [
|
|
2584
|
+
s("h4", Ri, "认不出归属的文件夹(" + p((A.value?.unmatched ?? []).length) + ")", 1),
|
|
2585
|
+
s("ul", Oi, [
|
|
2586
|
+
(c(!0), d(T, null, I(A.value?.unmatched ?? [], (e, u) => (c(), d("li", { key: u }, [
|
|
2587
|
+
s("span", Pi, p(e), 1)
|
|
2448
2588
|
]))), 128))
|
|
2449
2589
|
])
|
|
2450
|
-
])) :
|
|
2451
|
-
|
|
2452
|
-
s("h4",
|
|
2453
|
-
s("ul",
|
|
2454
|
-
(
|
|
2590
|
+
])) : k("", !0),
|
|
2591
|
+
Y.value.length > 0 ? (c(), d("section", Li, [
|
|
2592
|
+
s("h4", ji, "保存结果(" + p(Y.value.length) + ":存成 " + p(ue.value) + ",没存成 " + p(It.value.length) + ")", 1),
|
|
2593
|
+
s("ul", Di, [
|
|
2594
|
+
(c(!0), d(T, null, I(Y.value, (e) => (c(), d("li", {
|
|
2455
2595
|
key: e.id,
|
|
2456
|
-
class:
|
|
2596
|
+
class: H({ "is-ok": e.ok })
|
|
2457
2597
|
}, [
|
|
2458
2598
|
s("strong", null, p(e.name || e.id) + ":" + p(e.ok ? "已保存" : "没保存"), 1),
|
|
2459
|
-
!e.ok && e.error ? (
|
|
2460
|
-
!e.ok && (e.issues ?? []).length > 0 ? (
|
|
2461
|
-
(
|
|
2462
|
-
])) :
|
|
2599
|
+
!e.ok && e.error ? (c(), d("span", Ii, p(e.error), 1)) : k("", !0),
|
|
2600
|
+
!e.ok && (e.issues ?? []).length > 0 ? (c(), d("ul", Ni, [
|
|
2601
|
+
(c(!0), d(T, null, I(e.issues, (u, S) => (c(), d("li", { key: S }, p(u), 1))), 128))
|
|
2602
|
+
])) : k("", !0)
|
|
2463
2603
|
], 2))), 128))
|
|
2464
2604
|
])
|
|
2465
|
-
])) :
|
|
2466
|
-
|
|
2605
|
+
])) : k("", !0),
|
|
2606
|
+
rt.value === 0 ? (c(), d("p", Fi, "这一趟没有问题。")) : k("", !0)
|
|
2467
2607
|
]),
|
|
2468
|
-
s("footer",
|
|
2608
|
+
s("footer", zi, [
|
|
2469
2609
|
s("button", {
|
|
2470
2610
|
class: "p-button p-button-sm p-button-outlined",
|
|
2471
2611
|
type: "button",
|
|
2472
|
-
onClick: t[
|
|
2612
|
+
onClick: t[34] || (t[34] = (e) => Vn())
|
|
2473
2613
|
}, "复制全部"),
|
|
2474
2614
|
s("button", {
|
|
2475
2615
|
class: "p-button p-button-sm",
|
|
2476
2616
|
type: "button",
|
|
2477
|
-
onClick: t[
|
|
2617
|
+
onClick: t[35] || (t[35] = (e) => At.value = !1)
|
|
2478
2618
|
}, "知道了")
|
|
2479
2619
|
])
|
|
2480
2620
|
])
|
|
2481
|
-
])) :
|
|
2482
|
-
b.value &&
|
|
2621
|
+
])) : k("", !0),
|
|
2622
|
+
b.value && F.value ? (c(), d("div", {
|
|
2483
2623
|
key: 2,
|
|
2484
2624
|
class: "mbc__modal",
|
|
2485
2625
|
role: "dialog",
|
|
2486
2626
|
"aria-modal": "true",
|
|
2487
|
-
onClick: t[
|
|
2627
|
+
onClick: t[41] || (t[41] = Ce((e) => F.value = !1, ["self"]))
|
|
2488
2628
|
}, [
|
|
2489
|
-
s("div",
|
|
2490
|
-
s("header",
|
|
2491
|
-
s("strong", null, "报错(" + p(
|
|
2629
|
+
s("div", Ui, [
|
|
2630
|
+
s("header", Hi, [
|
|
2631
|
+
s("strong", null, "报错(" + p(M.value.length) + " 条)", 1),
|
|
2492
2632
|
s("button", {
|
|
2493
2633
|
class: "p-button p-button-sm p-button-text",
|
|
2494
2634
|
type: "button",
|
|
2495
|
-
onClick: t[
|
|
2635
|
+
onClick: t[37] || (t[37] = (e) => F.value = !1)
|
|
2496
2636
|
}, "收起")
|
|
2497
2637
|
]),
|
|
2498
|
-
s("div",
|
|
2499
|
-
s("ol",
|
|
2500
|
-
(
|
|
2501
|
-
s("div",
|
|
2502
|
-
s("span",
|
|
2503
|
-
|
|
2638
|
+
s("div", Ki, [
|
|
2639
|
+
s("ol", Vi, [
|
|
2640
|
+
(c(!0), d(T, null, I(M.value, (e, u) => (c(), d("li", { key: u }, [
|
|
2641
|
+
s("div", qi, [
|
|
2642
|
+
s("span", Ji, p(e.at), 1),
|
|
2643
|
+
y(" · " + p(e.where), 1)
|
|
2504
2644
|
]),
|
|
2505
|
-
s("pre",
|
|
2645
|
+
s("pre", Gi, p(e.text), 1)
|
|
2506
2646
|
]))), 128))
|
|
2507
2647
|
]),
|
|
2508
|
-
|
|
2648
|
+
M.value.length === 0 ? (c(), d("p", Wi, "这一轮没有报错。")) : k("", !0)
|
|
2509
2649
|
]),
|
|
2510
|
-
s("footer",
|
|
2650
|
+
s("footer", Yi, [
|
|
2511
2651
|
s("button", {
|
|
2512
2652
|
class: "p-button p-button-sm p-button-outlined",
|
|
2513
2653
|
type: "button",
|
|
2514
|
-
onClick: t[
|
|
2654
|
+
onClick: t[38] || (t[38] = (e) => Hn())
|
|
2515
2655
|
}, "复制全部"),
|
|
2516
2656
|
s("button", {
|
|
2517
2657
|
class: "p-button p-button-sm p-button-text",
|
|
2518
2658
|
type: "button",
|
|
2519
|
-
onClick: t[
|
|
2659
|
+
onClick: t[39] || (t[39] = (e) => de())
|
|
2520
2660
|
}, "清空报错"),
|
|
2521
2661
|
s("button", {
|
|
2522
2662
|
class: "p-button p-button-sm",
|
|
2523
2663
|
type: "button",
|
|
2524
|
-
onClick: t[
|
|
2664
|
+
onClick: t[40] || (t[40] = (e) => F.value = !1)
|
|
2525
2665
|
}, "知道了")
|
|
2526
2666
|
])
|
|
2527
2667
|
])
|
|
2528
|
-
])) :
|
|
2529
|
-
b.value ? (
|
|
2668
|
+
])) : k("", !0),
|
|
2669
|
+
b.value ? (c(), d("button", {
|
|
2530
2670
|
key: 3,
|
|
2531
2671
|
class: "mbc__close",
|
|
2532
2672
|
type: "button",
|
|
2533
2673
|
title: "关掉 magic block 控制台(Esc)",
|
|
2534
|
-
onClick: t[
|
|
2535
|
-
}, "×")) :
|
|
2536
|
-
], 2)) :
|
|
2674
|
+
onClick: t[42] || (t[42] = (e) => b.value = !1)
|
|
2675
|
+
}, "×")) : k("", !0)
|
|
2676
|
+
], 2)) : k("", !0);
|
|
2537
2677
|
}
|
|
2538
|
-
}),
|
|
2678
|
+
}), ou = /* @__PURE__ */ bn(Qi, [["__scopeId", "data-v-8e10f9f2"]]);
|
|
2539
2679
|
export {
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2680
|
+
cs as API_BASE,
|
|
2681
|
+
Rs as BLOCK_BACKEND_FILE,
|
|
2682
|
+
zt as BLOCK_ENTRY,
|
|
2683
|
+
_e as BLOCK_MANIFEST,
|
|
2684
|
+
ms as CLIENT_SOURCE,
|
|
2685
|
+
ge as MANIFEST_KEYS,
|
|
2686
|
+
Qe as MANIFEST_REQUIRED,
|
|
2687
|
+
ou as MagicBlockConsole,
|
|
2688
|
+
ro as MagicBlockPage,
|
|
2689
|
+
Oe as NAME_MAX,
|
|
2690
|
+
Ns as buildPreview,
|
|
2691
|
+
As as checkSelection,
|
|
2692
|
+
bo as declaredMissing,
|
|
2693
|
+
co as declaredUuidOf,
|
|
2694
|
+
po as declaredUuidsOf,
|
|
2695
|
+
hs as installBridge,
|
|
2696
|
+
Us as loadBlockRender,
|
|
2697
|
+
Fs as onBlockRenderRefresh,
|
|
2698
|
+
Ts as parseManifest,
|
|
2699
|
+
zs as refreshBlockRender,
|
|
2700
|
+
Bs as validFileName,
|
|
2701
|
+
ws as validName,
|
|
2702
|
+
Ms as validateBlock
|
|
2563
2703
|
};
|