@morningfast/platform 0.0.10 → 0.0.11
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/assets/main/style.css +4 -4
- package/dist/chunks/Login-BKuPkkY9.js +242 -0
- package/dist/chunks/{SystemConfig-C7yyDmB8.js → SystemConfig-DGZUwXWB.js} +1 -1
- package/dist/chunks/{main-BRpmAK9d.js → main-CA2I4UGE.js} +598 -549
- package/dist/chunks/{route-items-DZFRXefX.js → route-items-CIUjZc6w.js} +74 -69
- package/dist/chunks/system-DZaKDrG6.js +160 -0
- package/dist/index.js +8 -8
- package/dist/main/index.d.ts +3 -0
- package/dist/main/layouts/components/AppBrandLogo.vue.d.ts +14 -0
- package/dist/main/stores/app.d.ts +1 -1
- package/dist/main.js +6 -6
- package/dist/sub.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/Login-BivuNuD7.js +0 -209
- package/dist/chunks/system-BbMsTIBR.js +0 -160
|
@@ -152,7 +152,7 @@ function U(e) {
|
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/main/stores/app.ts
|
|
154
154
|
var W = "sidebar-collapsed", G = "menu-search-placement", K = "layout-mode", q = "top-menu-path", J = T("app", () => {
|
|
155
|
-
let e = y(localStorage.getItem(W) === "true"), t = y(!1), n = y("theme"), r = y(I()), i = y(F()), a = y(re()), s = y(localStorage.getItem(K)
|
|
155
|
+
let e = y(localStorage.getItem(W) === "true"), t = y(!1), n = y("theme"), r = y(I()), i = y(F()), a = y(re()), s = y(ce(localStorage.getItem(K))), c = y(localStorage.getItem(G) || "header"), l = y(localStorage.getItem(q) || ""), u = y(!0), d = o(() => L(r.value)), f = o(() => s.value === "top" ? ["header"] : ["header", "sidebar"]), p = o(() => s.value !== "top" && c.value === "sidebar");
|
|
156
156
|
function m() {
|
|
157
157
|
e.value = !e.value;
|
|
158
158
|
}
|
|
@@ -221,17 +221,23 @@ var W = "sidebar-collapsed", G = "menu-search-placement", K = "layout-mode", q =
|
|
|
221
221
|
toggleDarkMode: x,
|
|
222
222
|
toggleSidebar: m
|
|
223
223
|
};
|
|
224
|
-
})
|
|
225
|
-
function ce() {
|
|
224
|
+
});
|
|
225
|
+
function ce(e) {
|
|
226
|
+
return e === "side" || e === "top" || e === "mix" ? e : "default";
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/main/micro-apps/status.ts
|
|
230
|
+
var Y = v({}), X = v({});
|
|
231
|
+
function le() {
|
|
226
232
|
return Y;
|
|
227
233
|
}
|
|
228
|
-
function
|
|
234
|
+
function ue(e) {
|
|
229
235
|
return X[e];
|
|
230
236
|
}
|
|
231
|
-
function
|
|
237
|
+
function de(e) {
|
|
232
238
|
return n(t()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
|
|
233
239
|
}
|
|
234
|
-
function
|
|
240
|
+
function fe(e) {
|
|
235
241
|
return Y[e.name] || (Y[e.name] = {
|
|
236
242
|
name: e.name,
|
|
237
243
|
title: e.title,
|
|
@@ -241,29 +247,29 @@ function de(e) {
|
|
|
241
247
|
updatedAt: Date.now()
|
|
242
248
|
}, Y[e.name]);
|
|
243
249
|
}
|
|
244
|
-
function
|
|
245
|
-
|
|
250
|
+
function pe(e) {
|
|
251
|
+
ye(e, {
|
|
246
252
|
status: "loading",
|
|
247
253
|
message: void 0
|
|
248
254
|
});
|
|
249
255
|
}
|
|
250
|
-
function
|
|
251
|
-
|
|
256
|
+
function me(e) {
|
|
257
|
+
ye(e, {
|
|
252
258
|
status: "mounted",
|
|
253
259
|
message: void 0
|
|
254
260
|
});
|
|
255
261
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
262
|
+
function he(e, t) {
|
|
263
|
+
be(e, {
|
|
258
264
|
status: "error",
|
|
259
265
|
message: Z(t)
|
|
260
266
|
});
|
|
261
267
|
}
|
|
262
|
-
function
|
|
268
|
+
function ge(e, t) {
|
|
263
269
|
let n = Y[e];
|
|
264
270
|
return n ? (n.status = "error", n.message = Z(t), n.updatedAt = Date.now(), !0) : !1;
|
|
265
271
|
}
|
|
266
|
-
function
|
|
272
|
+
function _e(e, t, n) {
|
|
267
273
|
X[t] = {
|
|
268
274
|
path: t,
|
|
269
275
|
name: e.name,
|
|
@@ -274,77 +280,77 @@ function ge(e, t, n) {
|
|
|
274
280
|
updatedAt: Date.now()
|
|
275
281
|
};
|
|
276
282
|
}
|
|
277
|
-
function
|
|
283
|
+
function ve(e) {
|
|
278
284
|
delete X[e];
|
|
279
285
|
}
|
|
280
|
-
function
|
|
286
|
+
function ye(e, t) {
|
|
281
287
|
let n = Y[e];
|
|
282
288
|
n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
|
|
283
289
|
}
|
|
284
|
-
function
|
|
285
|
-
let n =
|
|
290
|
+
function be(e, t) {
|
|
291
|
+
let n = fe(e);
|
|
286
292
|
n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
|
|
287
293
|
}
|
|
288
294
|
function Z(e) {
|
|
289
|
-
let t =
|
|
290
|
-
return t ? Se(
|
|
295
|
+
let t = xe(e);
|
|
296
|
+
return t ? Ce(Se(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
|
|
291
297
|
}
|
|
292
|
-
function
|
|
298
|
+
function xe(e) {
|
|
293
299
|
return e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
294
300
|
}
|
|
295
|
-
function
|
|
301
|
+
function Se(e) {
|
|
296
302
|
return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
|
|
297
303
|
}
|
|
298
|
-
function
|
|
304
|
+
function Ce(e) {
|
|
299
305
|
let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
|
|
300
|
-
return n.includes("cannot use import statement outside a module") ? `${i}
|
|
306
|
+
return n.includes("cannot use import statement outside a module") ? `${i}入口已响应,但加载失败。请确认子应用服务已启动,并确认入口地址指向子应用服务。` : n.includes("unexpected token <") ? `${i}入口返回了 HTML,但 qiankun 正在按脚本解析。请检查入口地址是否填错、子应用服务是否启动,以及访问入口时是否被重定向到了登录页或 404 页面。` : n.includes("failed to fetch") || n.includes("networkerror") || n.includes("load failed") || n.includes("loading source code") || n.includes("loading_source_code") ? `${i}入口资源加载失败。请确认子应用服务已启动、入口地址可直接访问,并检查浏览器控制台是否有跨域、404 或网络连接错误。` : n.includes("application died in status not_mounted") ? `${i}加载后挂载失败。请检查子应用是否正确导出了 qiankun 生命周期,并确认挂载容器和路由基座配置正确。` : t;
|
|
301
307
|
}
|
|
302
308
|
//#endregion
|
|
303
309
|
//#region src/main/micro-apps/types.ts
|
|
304
|
-
var
|
|
305
|
-
function
|
|
306
|
-
if (
|
|
307
|
-
|
|
310
|
+
var we = "morningfast:theme-change", Te = !1, Ee = !1;
|
|
311
|
+
function De() {
|
|
312
|
+
if (Te) {
|
|
313
|
+
Oe();
|
|
308
314
|
return;
|
|
309
315
|
}
|
|
310
|
-
|
|
316
|
+
Te = !0;
|
|
311
317
|
let e = n(t());
|
|
312
|
-
e.forEach(
|
|
318
|
+
e.forEach(fe), k(e.map((e) => ({
|
|
313
319
|
name: e.name,
|
|
314
320
|
entry: e.entry,
|
|
315
321
|
container: e.container,
|
|
316
322
|
activeRule: e.activeRule,
|
|
317
|
-
props:
|
|
323
|
+
props: Ae(e)
|
|
318
324
|
})), {
|
|
319
325
|
beforeLoad: [async (e) => {
|
|
320
|
-
|
|
326
|
+
ve(window.location.pathname), pe(e.name);
|
|
321
327
|
}],
|
|
322
328
|
afterMount: [async (e) => {
|
|
323
|
-
|
|
329
|
+
ve(window.location.pathname), me(e.name);
|
|
324
330
|
}]
|
|
325
331
|
}), O((t) => {
|
|
326
|
-
let n = t instanceof ErrorEvent ? t.error || t.message : t, r =
|
|
327
|
-
if (r &&
|
|
332
|
+
let n = t instanceof ErrorEvent ? t.error || t.message : t, r = ke(n) || ke(t);
|
|
333
|
+
if (r && ge(r, n)) {
|
|
328
334
|
let t = e.find((e) => e.name === r);
|
|
329
|
-
t &&
|
|
335
|
+
t && _e(t, window.location.pathname, n);
|
|
330
336
|
return;
|
|
331
337
|
}
|
|
332
338
|
e.forEach((e) => {
|
|
333
|
-
(window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (
|
|
339
|
+
(window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (he(e, n), _e(e, window.location.pathname, n));
|
|
334
340
|
});
|
|
335
|
-
}),
|
|
341
|
+
}), Oe(), je();
|
|
336
342
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
343
|
+
function Oe() {
|
|
344
|
+
Ee || document.querySelector("#micro-app-container") && (Ee = !0, A({
|
|
339
345
|
prefetch: !1,
|
|
340
346
|
sandbox: { experimentalStyleIsolation: !0 },
|
|
341
347
|
urlRerouteOnly: !0
|
|
342
348
|
}));
|
|
343
349
|
}
|
|
344
|
-
function
|
|
350
|
+
function ke(e) {
|
|
345
351
|
return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
|
|
346
352
|
}
|
|
347
|
-
function
|
|
353
|
+
function Ae(e) {
|
|
348
354
|
let t = J();
|
|
349
355
|
return {
|
|
350
356
|
basePath: e.activeRule,
|
|
@@ -357,7 +363,7 @@ function ke(e) {
|
|
|
357
363
|
getRuntimeProps: () => ({ theme: Q(t.isDark) })
|
|
358
364
|
};
|
|
359
365
|
}
|
|
360
|
-
function
|
|
366
|
+
function je() {
|
|
361
367
|
let e = J();
|
|
362
368
|
C(() => [
|
|
363
369
|
e.isDark,
|
|
@@ -365,12 +371,12 @@ function Ae() {
|
|
|
365
371
|
e.themeColorPosition
|
|
366
372
|
], () => {
|
|
367
373
|
window.setTimeout(() => {
|
|
368
|
-
|
|
374
|
+
Me(Q(e.isDark));
|
|
369
375
|
}, 0);
|
|
370
376
|
});
|
|
371
377
|
}
|
|
372
|
-
function
|
|
373
|
-
window.dispatchEvent(new CustomEvent(
|
|
378
|
+
function Me(e) {
|
|
379
|
+
window.dispatchEvent(new CustomEvent(we, { detail: e }));
|
|
374
380
|
}
|
|
375
381
|
function Q(e) {
|
|
376
382
|
let t = getComputedStyle(document.documentElement);
|
|
@@ -390,24 +396,24 @@ function $(e, t, n) {
|
|
|
390
396
|
}
|
|
391
397
|
//#endregion
|
|
392
398
|
//#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
|
|
393
|
-
var
|
|
399
|
+
var Ne = { class: "micro-app-page" }, Pe = {
|
|
394
400
|
key: 0,
|
|
395
401
|
class: "micro-app-page__state micro-app-page__state--error"
|
|
396
|
-
},
|
|
402
|
+
}, Fe = { class: "micro-app-page__body" }, Ie = { class: "micro-app-page__meta" }, Le = { key: 0 }, Re = { key: 1 }, ze = { class: "micro-app-page__actions" }, Be = ["id"], Ve = /* @__PURE__ */ e(/* @__PURE__ */ p({
|
|
397
403
|
name: "MicroAppView",
|
|
398
404
|
__name: "MicroAppView",
|
|
399
405
|
setup(e) {
|
|
400
|
-
let t = a(), n =
|
|
406
|
+
let t = a(), n = le(), r = y(""), p = null, v = o(() => de(t.path)), T = o(() => {
|
|
401
407
|
let e = v.value;
|
|
402
408
|
return e ? n[e.name] : void 0;
|
|
403
|
-
}), O = o(() =>
|
|
409
|
+
}), O = o(() => ue(t.path)), k = o(() => T.value?.title || v.value?.title || O.value?.title || "未知子应用"), A = o(() => T.value?.entry || v.value?.entry || O.value?.entry || "-"), j = o(() => "子应用暂时无法访问,请稍后重试。"), M = o(() => T.value?.status === "error" || !!O.value || !!r.value || !v.value);
|
|
404
410
|
C(() => t.path, () => {
|
|
405
411
|
m(() => {
|
|
406
|
-
|
|
412
|
+
De(), N();
|
|
407
413
|
});
|
|
408
414
|
}, { immediate: !0 }), g(() => {
|
|
409
415
|
m(() => {
|
|
410
|
-
|
|
416
|
+
De(), N();
|
|
411
417
|
});
|
|
412
418
|
}), C(() => T.value?.status, (e) => {
|
|
413
419
|
e === "mounted" && (P(), r.value = "");
|
|
@@ -430,46 +436,45 @@ var Me = { class: "micro-app-page" }, Ne = {
|
|
|
430
436
|
e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
|
|
431
437
|
}
|
|
432
438
|
return (e, t) => {
|
|
433
|
-
let n = b("el-icon"),
|
|
434
|
-
return _(), l("div",
|
|
439
|
+
let n = b("el-icon"), r = b("el-button");
|
|
440
|
+
return _(), l("div", Ne, [M.value ? (_(), l("div", Pe, [f(n, { class: "micro-app-page__icon" }, {
|
|
435
441
|
default: w(() => [f(S(ee))]),
|
|
436
442
|
_: 1
|
|
437
|
-
}), u("div",
|
|
438
|
-
t[
|
|
439
|
-
u("p", Fe, x(j.value), 1),
|
|
443
|
+
}), u("div", Fe, [
|
|
444
|
+
t[5] ||= u("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
|
|
440
445
|
u("dl", Ie, [
|
|
441
446
|
u("div", null, [t[0] ||= u("dt", null, "应用", -1), u("dd", null, x(k.value), 1)]),
|
|
442
447
|
S(!1) ? (_(), l("div", Le, [t[1] ||= u("dt", null, "入口", -1), u("dd", null, x(A.value), 1)])) : c("", !0),
|
|
443
|
-
|
|
448
|
+
j.value ? (_(), l("div", Re, [t[2] ||= u("dt", null, "原因", -1), u("dd", null, x(j.value), 1)])) : c("", !0)
|
|
444
449
|
]),
|
|
445
|
-
u("div",
|
|
450
|
+
u("div", ze, [f(r, {
|
|
446
451
|
type: "primary",
|
|
447
452
|
icon: S(D),
|
|
448
453
|
onClick: F
|
|
449
454
|
}, {
|
|
450
|
-
default: w(() => [...t[
|
|
455
|
+
default: w(() => [...t[3] ||= [d("重新加载", -1)]]),
|
|
451
456
|
_: 1
|
|
452
|
-
}, 8, ["icon"]), S(!1) && (T.value?.entry || v.value?.entry) ? (_(), s(
|
|
457
|
+
}, 8, ["icon"]), S(!1) && (T.value?.entry || v.value?.entry) ? (_(), s(r, {
|
|
453
458
|
key: 0,
|
|
454
459
|
icon: S(E),
|
|
455
460
|
onClick: I
|
|
456
461
|
}, {
|
|
457
|
-
default: w(() => [...t[
|
|
462
|
+
default: w(() => [...t[4] ||= [d(" 打开入口 ", -1)]]),
|
|
458
463
|
_: 1
|
|
459
464
|
}, 8, ["icon"])) : c("", !0)])
|
|
460
465
|
])])) : c("", !0), u("section", {
|
|
461
466
|
id: S(i),
|
|
462
467
|
class: "micro-app-page__container"
|
|
463
|
-
}, null, 8,
|
|
468
|
+
}, null, 8, Be)]);
|
|
464
469
|
};
|
|
465
470
|
}
|
|
466
|
-
}), [["__scopeId", "data-v-
|
|
471
|
+
}), [["__scopeId", "data-v-944de23f"]]);
|
|
467
472
|
//#endregion
|
|
468
473
|
//#region src/main/router/route-items.ts
|
|
469
|
-
function
|
|
470
|
-
return e.map((e) =>
|
|
474
|
+
function He(e, t) {
|
|
475
|
+
return e.map((e) => Ue(e, t));
|
|
471
476
|
}
|
|
472
|
-
function
|
|
477
|
+
function Ue(e, t) {
|
|
473
478
|
let n = {
|
|
474
479
|
path: e.path,
|
|
475
480
|
name: e.name,
|
|
@@ -480,7 +485,7 @@ function We(e, t) {
|
|
|
480
485
|
hidden: e.hidden
|
|
481
486
|
}
|
|
482
487
|
};
|
|
483
|
-
return e.redirect && (n.redirect = e.redirect), e.componentKey && (n.component = t[e.componentKey]), e.microApp && (n.component =
|
|
488
|
+
return e.redirect && (n.redirect = e.redirect), e.componentKey && (n.component = t[e.componentKey]), e.microApp && (n.component = Ve), e.children?.length && (n.children = He(e.children, t)), n;
|
|
484
489
|
}
|
|
485
490
|
//#endregion
|
|
486
|
-
export { P as a, se as i,
|
|
491
|
+
export { P as a, se as i, Ve as n, J as r, He as t };
|