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