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