@morningfast/platform 1.0.7 → 1.0.9

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.
Files changed (93) hide show
  1. package/dist/chunks/{Login-7n7MU-kG.js → Login-BU39vYjX.js} +2 -4
  2. package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-C7oT7l8o.js} +2 -3
  3. package/dist/chunks/{application-config-DePctoXE.js → application-config-Bz36uajb.js} +12 -13
  4. package/dist/chunks/{system-DZaKDrG6.js → main-C2CR17WW.js} +3340 -91
  5. package/dist/index.js +4 -7
  6. package/dist/main.js +2 -5
  7. package/dist/{auth → src/auth}/index.d.ts +1 -1
  8. package/dist/{main → src/main}/api/client.d.ts +2 -2
  9. package/dist/src/main/api/types.d.ts +1 -0
  10. package/dist/{main → src/main}/app/create-app.d.ts +2 -2
  11. package/dist/{main → src/main}/layouts/components/AppHeaderMenuNode.vue.d.ts +1 -1
  12. package/dist/{main → src/main}/layouts/components/AppMenuSearchItem.vue.d.ts +1 -1
  13. package/dist/{main → src/main}/layouts/components/AppMenuSearchTrigger.vue.d.ts +1 -1
  14. package/dist/{main → src/main}/layouts/components/AppSidebarNode.vue.d.ts +1 -1
  15. package/dist/{main → src/main}/layouts/components/AppTabsContextMenu.vue.d.ts +1 -1
  16. package/dist/{main → src/main}/layouts/utils/menuSearch.d.ts +1 -1
  17. package/dist/{main → src/main}/router/index.d.ts +1 -1
  18. package/dist/{main → src/main}/stores/app.d.ts +1 -1
  19. package/dist/{main → src/main}/stores/auth.d.ts +4 -4
  20. package/dist/{main → src/main}/utils/auth.d.ts +1 -1
  21. package/dist/{sub → src/sub}/composables/useRequestClient.d.ts +2 -2
  22. package/dist/{sub → src/sub}/router/index.d.ts +2 -2
  23. package/dist/sub.js +2 -2
  24. package/package.json +8 -8
  25. package/dist/chunks/_plugin-vue_export-helper-DvRHjpsZ.js +0 -8
  26. package/dist/chunks/auth-C3RvRgcW.js +0 -248
  27. package/dist/chunks/main-z6Df1mR9.js +0 -2443
  28. package/dist/chunks/register-dGBgzdRh.js +0 -575
  29. package/dist/main/api/types.d.ts +0 -1
  30. /package/dist/chunks/{Forbidden-Cu2QQ-FY.js → Forbidden-BM9uDrLP.js} +0 -0
  31. /package/dist/chunks/{NotFound-VRL7_aMx.js → NotFound-CeLeTD4e.js} +0 -0
  32. /package/dist/chunks/{route-items-CYTYHd0U.js → route-items-9aVNyGkB.js} +0 -0
  33. /package/dist/chunks/{storage-DNllLr_D.js → storage-BSJwKVAK.js} +0 -0
  34. /package/dist/chunks/{sub-LssKnIb1.js → sub-DtGKYpEu.js} +0 -0
  35. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  36. /package/dist/{main → src/main}/api/adapter.d.ts +0 -0
  37. /package/dist/{main → src/main}/api/auth.d.ts +0 -0
  38. /package/dist/{main → src/main}/app/AppUpdateDialog.vue.d.ts +0 -0
  39. /package/dist/{main → src/main}/app/runtime-config.d.ts +0 -0
  40. /package/dist/{main → src/main}/app/update-checker.d.ts +0 -0
  41. /package/dist/{main → src/main}/app/update-preferences.d.ts +0 -0
  42. /package/dist/{main → src/main}/auth/expired.d.ts +0 -0
  43. /package/dist/{main → src/main}/composables/useSortable.d.ts +0 -0
  44. /package/dist/{main → src/main}/directives/index.d.ts +0 -0
  45. /package/dist/{main → src/main}/index.d.ts +0 -0
  46. /package/dist/{main → src/main}/layouts/AppLayout.vue.d.ts +0 -0
  47. /package/dist/{main → src/main}/layouts/components/AppBrandLogo.vue.d.ts +0 -0
  48. /package/dist/{main → src/main}/layouts/components/AppContentView.vue.d.ts +0 -0
  49. /package/dist/{main → src/main}/layouts/components/AppHeader.vue.d.ts +0 -0
  50. /package/dist/{main → src/main}/layouts/components/AppMenuSearch.vue.d.ts +0 -0
  51. /package/dist/{main → src/main}/layouts/components/AppSidebar.vue.d.ts +0 -0
  52. /package/dist/{main → src/main}/layouts/components/AppSidebarSearch.vue.d.ts +0 -0
  53. /package/dist/{main → src/main}/layouts/components/AppTabs.vue.d.ts +0 -0
  54. /package/dist/{main → src/main}/layouts/composables/useAppMenus.d.ts +0 -0
  55. /package/dist/{main → src/main}/layouts/composables/useShortcutLabel.d.ts +0 -0
  56. /package/dist/{main → src/main}/layouts/utils/menuIcons.d.ts +0 -0
  57. /package/dist/{main → src/main}/micro-apps/config.d.ts +0 -0
  58. /package/dist/{main → src/main}/micro-apps/register.d.ts +0 -0
  59. /package/dist/{main → src/main}/micro-apps/status.d.ts +0 -0
  60. /package/dist/{main → src/main}/micro-apps/types.d.ts +0 -0
  61. /package/dist/{main → src/main}/pages/auth/Login.vue.d.ts +0 -0
  62. /package/dist/{main → src/main}/pages/error/Forbidden.vue.d.ts +0 -0
  63. /package/dist/{main → src/main}/pages/error/NotFound.vue.d.ts +0 -0
  64. /package/dist/{main → src/main}/pages/micro/MicroAppView.vue.d.ts +0 -0
  65. /package/dist/{main → src/main}/pages/system/SystemConfig.vue.d.ts +0 -0
  66. /package/dist/{main → src/main}/pages/system/application-config/index.vue.d.ts +0 -0
  67. /package/dist/{main → src/main}/router/base-routes.d.ts +0 -0
  68. /package/dist/{main → src/main}/router/guard.d.ts +0 -0
  69. /package/dist/{main → src/main}/router/route-items.d.ts +0 -0
  70. /package/dist/{main → src/main}/settings/components/AppearanceSettings.vue.d.ts +0 -0
  71. /package/dist/{main → src/main}/settings/components/GeneralSettings.vue.d.ts +0 -0
  72. /package/dist/{main → src/main}/settings/components/LayoutSettings.vue.d.ts +0 -0
  73. /package/dist/{main → src/main}/settings/components/ShortcutSettings.vue.d.ts +0 -0
  74. /package/dist/{main → src/main}/settings/components/SystemSettingsDrawer.vue.d.ts +0 -0
  75. /package/dist/{main → src/main}/settings/components/ThemeToggleButton.vue.d.ts +0 -0
  76. /package/dist/{main → src/main}/settings/components/ThemedSvgImage.vue.d.ts +0 -0
  77. /package/dist/{main → src/main}/stores/index.d.ts +0 -0
  78. /package/dist/{main → src/main}/stores/shortcut.d.ts +0 -0
  79. /package/dist/{main → src/main}/stores/system.d.ts +0 -0
  80. /package/dist/{main → src/main}/stores/tabs.d.ts +0 -0
  81. /package/dist/{main → src/main}/utils/keyboard-shortcut.d.ts +0 -0
  82. /package/dist/{main → src/main}/utils/persistence.d.ts +0 -0
  83. /package/dist/{main → src/main}/utils/storage.d.ts +0 -0
  84. /package/dist/{main → src/main}/utils/theme.d.ts +0 -0
  85. /package/dist/{micro-contract → src/micro-contract}/index.d.ts +0 -0
  86. /package/dist/{request → src/request}/index.d.ts +0 -0
  87. /package/dist/{shared → src/shared}/router/route-items.d.ts +0 -0
  88. /package/dist/{sub → src/sub}/app/mount.d.ts +0 -0
  89. /package/dist/{sub → src/sub}/composables/useSubAppContext.d.ts +0 -0
  90. /package/dist/{sub → src/sub}/context/sub-app-context.d.ts +0 -0
  91. /package/dist/{sub → src/sub}/index.d.ts +0 -0
  92. /package/dist/{sub → src/sub}/qiankun/index.d.ts +0 -0
  93. /package/dist/{sub → src/sub}/theme/index.d.ts +0 -0
@@ -1,575 +0,0 @@
1
- import { n as e, r as t, t as n } from "./storage-DNllLr_D.js";
2
- import { computed as r, reactive as i, ref as a, watch as o } from "vue";
3
- import { defineStore as s } from "pinia";
4
- import { addErrorHandler as c, registerMicroApps as l, start as u } from "qiankun";
5
- import { getAppNames as d, triggerAppChange as f, unloadApplication as ee, unregisterApplication as p } from "single-spa";
6
- //#region src/main/utils/theme.ts
7
- var m = "theme-color", h = "theme-mode", g = "theme-position", _ = [
8
- {
9
- label: "默认蓝",
10
- value: "#409EFF"
11
- },
12
- {
13
- label: "深蓝色",
14
- value: "#0960BE"
15
- },
16
- {
17
- label: "靛蓝色",
18
- value: "#045277"
19
- },
20
- {
21
- label: "天空蓝",
22
- value: "#78B5FE"
23
- },
24
- {
25
- label: "深绿色",
26
- value: "#0C522B"
27
- },
28
- {
29
- label: "翡翠绿",
30
- value: "#009773"
31
- },
32
- {
33
- label: "浅绿色",
34
- value: "#0BD092"
35
- },
36
- {
37
- label: "紫罗兰",
38
- value: "#7166F0"
39
- },
40
- {
41
- label: "樱花粉",
42
- value: "#FFB7C5"
43
- },
44
- {
45
- label: "柠檬黄",
46
- value: "#EFBD48"
47
- },
48
- {
49
- label: "橙黄色",
50
- value: "#C1420B"
51
- },
52
- {
53
- label: "玫瑰红",
54
- value: "#BB1B1B"
55
- },
56
- {
57
- label: "锌色灰",
58
- value: "#3F3F46"
59
- },
60
- {
61
- label: "中性灰",
62
- value: "#404040"
63
- },
64
- {
65
- label: "石板灰",
66
- value: "#344256"
67
- }
68
- ];
69
- function v() {
70
- return localStorage.getItem(m) || "#409EFF";
71
- }
72
- function y() {
73
- let e = localStorage.getItem(h);
74
- return e === "light" || e === "dark" || e === "system" ? e : "light";
75
- }
76
- function te(e) {
77
- localStorage.setItem(m, e);
78
- }
79
- function ne(e) {
80
- localStorage.setItem(h, e);
81
- }
82
- function b() {
83
- let e = localStorage.getItem(g);
84
- return e === "none" || e === "header" || e === "sidebar" ? e : "none";
85
- }
86
- function re(e) {
87
- localStorage.setItem(g, e);
88
- }
89
- function x() {
90
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
91
- }
92
- function ie(e) {
93
- return e === "dark" || e === "system" && x();
94
- }
95
- function ae(e) {
96
- let t = ie(e);
97
- document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
98
- }
99
- function S(e) {
100
- let t = document.documentElement, n = t.classList.contains("dark");
101
- t.style.setProperty("--el-color-primary", e), t.style.setProperty("--el-color-primary-light-3", w(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", w(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", w(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", w(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", w(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", w(e, n ? "#ffffff" : "#000000", .2));
102
- }
103
- function oe() {
104
- ae(y()), S(v()), se(b());
105
- }
106
- function se(e) {
107
- document.documentElement.setAttribute("data-theme-position", e);
108
- }
109
- function C(e = 50) {
110
- return new Promise((t) => {
111
- setTimeout(() => {
112
- S(v()), t();
113
- }, e);
114
- });
115
- }
116
- async function ce(e, t) {
117
- if (!document.startViewTransition) {
118
- t(), await C();
119
- return;
120
- }
121
- let n = e.clientX, r = e.clientY, i = Math.hypot(Math.max(n, innerWidth - n), Math.max(r, innerHeight - r));
122
- try {
123
- document.startViewTransition(() => {
124
- t();
125
- }).ready.then(() => {
126
- let e = 100 * n / innerWidth, t = 100 * r / innerHeight, a = Math.hypot(innerWidth, innerHeight) / Math.SQRT2, o = 100 * i / a, s = [`circle(0% at ${e}% ${t}%)`, `circle(${o}% at ${e}% ${t}%)`], c = document.documentElement.classList.contains("dark");
127
- document.documentElement.animate({ clipPath: c ? s.reverse() : s }, {
128
- duration: 400,
129
- easing: "ease-in",
130
- fill: "both",
131
- pseudoElement: c ? "::view-transition-old(root)" : "::view-transition-new(root)"
132
- });
133
- }), await C();
134
- } catch {
135
- t(), await C();
136
- }
137
- }
138
- function w(e, t, n) {
139
- let [r, i, a] = T(e), [o, s, c] = T(t), l = (e, t) => Math.round(e * (1 - n) + t * n);
140
- return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
141
- }
142
- function T(e) {
143
- let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
144
- return [
145
- r >> 16 & 255,
146
- r >> 8 & 255,
147
- r & 255
148
- ];
149
- }
150
- //#endregion
151
- //#region src/main/stores/app.ts
152
- var le = "sidebar-collapsed", E = "menu-search-placement", D = "layout-mode", O = "top-menu-path", k = "(max-width: 768px)", A = null, j = s("app", () => {
153
- let e = a(localStorage.getItem(le) === "true"), t = a(!1), n = a(ue()), i = a(!1), o = a("theme"), s = a(y()), c = a(v()), l = a(b()), u = a(fe(localStorage.getItem(D))), d = a(localStorage.getItem(E) || "header"), f = a(localStorage.getItem(O) || ""), ee = a(!0), p = r(() => ie(s.value)), m = r(() => u.value === "top" ? ["header"] : ["header", "sidebar"]), h = r(() => u.value !== "top" && d.value === "sidebar");
154
- function g() {
155
- if (n.value) {
156
- t.value = !t.value;
157
- return;
158
- }
159
- e.value = !e.value;
160
- }
161
- function _(t) {
162
- e.value = t, localStorage.setItem(le, String(e.value));
163
- }
164
- function C() {
165
- t.value = !1;
166
- }
167
- function ce(e = "theme") {
168
- o.value = e, i.value = !0;
169
- }
170
- function w() {
171
- i.value = !1;
172
- }
173
- function T(e) {
174
- i.value = e;
175
- }
176
- function k(e) {
177
- s.value = e, ne(e), ae(e), S(c.value);
178
- }
179
- function A() {
180
- k(x() && s.value === "system" || p.value ? "light" : "dark");
181
- }
182
- function j(e) {
183
- c.value = e, te(e), S(e);
184
- }
185
- function M(e) {
186
- l.value = e, re(e), se(e);
187
- }
188
- function N(e) {
189
- u.value = e, localStorage.setItem(D, e), e === "top" && d.value === "sidebar" && P("header");
190
- }
191
- function P(e) {
192
- let t = u.value === "top" ? "header" : e;
193
- d.value = t, localStorage.setItem(E, t);
194
- }
195
- function F(e) {
196
- f.value = e, localStorage.setItem(O, e);
197
- }
198
- function I() {
199
- oe(), de();
200
- }
201
- return {
202
- closeMobileSidebar: C,
203
- closeSettings: w,
204
- initializePreferences: I,
205
- isDark: p,
206
- isMobileViewport: n,
207
- layoutMode: u,
208
- menuSearchPlacement: d,
209
- menuSearchPlacementOptions: m,
210
- mobileSidebarVisible: t,
211
- openSettings: ce,
212
- isSidebarMenuSearch: h,
213
- settingsActiveTab: o,
214
- selectedTopMenuPath: f,
215
- setLayoutMode: N,
216
- setMenuSearchPlacement: P,
217
- setSelectedTopMenuPath: F,
218
- setSettingsVisible: T,
219
- setSidebarCollapsed: _,
220
- setThemeColor: j,
221
- setThemeColorPosition: M,
222
- setThemeMode: k,
223
- settingsVisible: i,
224
- sidebarCollapsed: e,
225
- shortcutTipVisible: ee,
226
- themeColor: c,
227
- themeColorPosition: l,
228
- themeMode: s,
229
- toggleDarkMode: A,
230
- toggleSidebar: g
231
- };
232
- });
233
- function ue() {
234
- return typeof window > "u" ? !1 : window.matchMedia(k).matches;
235
- }
236
- function de() {
237
- if (typeof window > "u" || A) return;
238
- let e = window.matchMedia(k), t = j(), n = () => {
239
- t.isMobileViewport = e.matches, e.matches || t.closeMobileSidebar();
240
- };
241
- n(), e.addEventListener("change", n), A = () => {
242
- e.removeEventListener("change", n), A = null;
243
- };
244
- }
245
- function fe(e) {
246
- return e === "side" || e === "top" || e === "mix" ? e : "default";
247
- }
248
- //#endregion
249
- //#region src/main/micro-apps/config.ts
250
- var M = "system:apps", N = "system:micro-app-entry-overrides", P = [], F = "micro-app-container";
251
- function I() {
252
- return ye(n(M, P).filter((e) => e.type === "sub").map(H));
253
- }
254
- function pe(e) {
255
- P = e.map(H);
256
- }
257
- async function me(e) {
258
- let n = e.map(H), r = n.find((e) => B(e.entry));
259
- if (r) throw Error(`公共应用配置不能保存本地或内网入口:${r.name} ${r.entry}`);
260
- await t(M, n);
261
- }
262
- function L(e) {
263
- return e.map((e) => ({
264
- id: e.id,
265
- name: ge(e),
266
- title: e.name,
267
- entry: R(e).entry,
268
- activeRule: V(e.basePath),
269
- container: "#micro-app-container"
270
- }));
271
- }
272
- function he(e) {
273
- return {
274
- id: "id" in e ? String(e.id) : e.name,
275
- name: e.name,
276
- title: e.title,
277
- entry: e.entry,
278
- activeRule: e.activeRule
279
- };
280
- }
281
- function ge(e) {
282
- return `morningfast-${e.id}`;
283
- }
284
- function R(e) {
285
- let t = z()[e.id]?.trim() || "", n = e.entry.trim(), r = be(e);
286
- return t ? {
287
- entry: t,
288
- source: "local",
289
- localEntry: t,
290
- configEntry: n,
291
- envEntry: r
292
- } : n && !B(n) ? {
293
- entry: n,
294
- source: "config",
295
- localEntry: t,
296
- configEntry: n,
297
- envEntry: r
298
- } : {
299
- entry: r,
300
- source: "env",
301
- localEntry: t,
302
- configEntry: n,
303
- envEntry: r
304
- };
305
- }
306
- function z() {
307
- let e = n(N, {});
308
- return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t.trim()]).filter(([, e]) => !!e));
309
- }
310
- async function _e(e, t) {
311
- let n = e.trim(), r = t.trim();
312
- if (!n) return;
313
- let i = z();
314
- r ? i[n] = r : delete i[n], U(i);
315
- }
316
- async function ve(e) {
317
- let t = z();
318
- delete t[e], U(t);
319
- }
320
- function B(e) {
321
- let t = Se(e);
322
- if (!t) return !1;
323
- let n = t.toLowerCase();
324
- if (n === "localhost" || n.endsWith(".localhost") || n === "0.0.0.0" || n === "::1") return !0;
325
- let r = n.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
326
- if (!r) return !1;
327
- let i = Number(r[1]), a = Number(r[2] ?? 0);
328
- return i === 10 || i === 127 || i === 172 && a >= 16 && a <= 31 || i === 192 && a === 168;
329
- }
330
- function V(e) {
331
- let t = e.trim() || "/micro";
332
- return t.startsWith("/") ? t : `/${t}`;
333
- }
334
- function H(e) {
335
- return {
336
- id: e.id?.trim() || `app-${Date.now()}`,
337
- name: e.name?.trim() || "未命名子应用",
338
- type: "sub",
339
- description: e.description?.trim() || "",
340
- basePath: V(e.basePath),
341
- entry: e.entry?.trim() || ""
342
- };
343
- }
344
- function ye(e) {
345
- let n = !1, r = !1, i = z(), a = e.map((e) => B(e.entry) ? (i[e.id] || (i[e.id] = e.entry, r = !0), n = !0, {
346
- ...e,
347
- entry: ""
348
- }) : e);
349
- return r && U(i), n && t(M, a), a;
350
- }
351
- function U(n) {
352
- let r = Object.fromEntries(Object.entries(n).map(([e, t]) => [e, t.trim()]).filter(([e, t]) => !!e.trim() && !!t));
353
- Object.keys(r).length ? t(N, r) : e(N);
354
- }
355
- function be(e) {
356
- let t = {
357
- BASE_URL: "/",
358
- DEV: !1,
359
- MODE: "production",
360
- PROD: !0,
361
- SSR: !1
362
- }, n = [
363
- e.id,
364
- e.basePath.split("/").filter(Boolean).at(-1) || "",
365
- e.name
366
- ].map((e) => `VITE_MICRO_APP_ENTRY_${xe(e)}`).find((e) => !!t[e]);
367
- return (n ? t[n] : "") || t.VITE_MICRO_APP_ENTRY || t.VITE_SUB_APP_ENTRY || "http://localhost:8082";
368
- }
369
- function xe(e) {
370
- return e.trim().replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
371
- }
372
- function Se(e) {
373
- let t = e.trim();
374
- if (!t) return "";
375
- try {
376
- if (/^https?:\/\//i.test(t)) return new URL(t).hostname;
377
- if (/^\/\//.test(t)) return new URL(`http:${t}`).hostname;
378
- let e = (t.split("/")[0] || "").split(":")[0] || "";
379
- if (e === "localhost" || e.includes(".") || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(e)) return e;
380
- } catch {
381
- return "";
382
- }
383
- return "";
384
- }
385
- //#endregion
386
- //#region src/main/micro-apps/status.ts
387
- var W = i({}), G = i({});
388
- function K() {
389
- return W;
390
- }
391
- function Ce(e) {
392
- return G[e];
393
- }
394
- function we(e) {
395
- return L(I()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
396
- }
397
- function Te(e) {
398
- let t = W[e.name];
399
- return t ? (t.title = e.title, t.entry = e.entry, t.activeRule = e.activeRule, t) : (W[e.name] = {
400
- name: e.name,
401
- title: e.title,
402
- entry: e.entry,
403
- activeRule: e.activeRule,
404
- status: "idle",
405
- updatedAt: Date.now()
406
- }, W[e.name]);
407
- }
408
- function q(e) {
409
- ke(e, {
410
- status: "loading",
411
- message: void 0
412
- });
413
- }
414
- function Ee(e) {
415
- ke(e, {
416
- status: "mounted",
417
- message: void 0
418
- });
419
- }
420
- function De(e, t) {
421
- let n = W[e];
422
- return n ? (n.status = "error", n.message = Ae(t), n.updatedAt = Date.now(), !0) : !1;
423
- }
424
- function Oe(e, t, n) {
425
- G[t] = {
426
- path: t,
427
- name: e.name,
428
- title: e.title,
429
- entry: e.entry,
430
- activeRule: e.activeRule,
431
- message: Ae(n),
432
- updatedAt: Date.now()
433
- };
434
- }
435
- function J(e) {
436
- delete G[e];
437
- }
438
- function ke(e, t) {
439
- let n = W[e];
440
- n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
441
- }
442
- function Ae(e) {
443
- let t = je(e);
444
- return t ? Ne(Me(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
445
- }
446
- function je(e) {
447
- return e instanceof Error ? e.message : typeof e == "string" ? e : "";
448
- }
449
- function Me(e) {
450
- return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
451
- }
452
- function Ne(e) {
453
- let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
454
- 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;
455
- }
456
- //#endregion
457
- //#region src/main/micro-apps/types.ts
458
- var Pe = "morningfast:theme-change", Y = !1, Fe = !1, Ie = !1, Le = !1, X = /* @__PURE__ */ new Set(), Re = new Set(["idle", "loading"]);
459
- function Z() {
460
- if (Y) {
461
- Ve();
462
- return;
463
- }
464
- Y = !0;
465
- let e = L(I());
466
- e.forEach(Te), X.clear(), e.forEach((e) => X.add(e.name)), l(e.map((e) => ({
467
- name: e.name,
468
- entry: e.entry,
469
- container: e.container,
470
- activeRule: e.activeRule,
471
- loader: (t) => {
472
- t && (J(window.location.pathname), q(e.name));
473
- },
474
- props: Ge(e)
475
- })), {
476
- beforeLoad: [async (e) => {
477
- J(window.location.pathname), q(e.name);
478
- }],
479
- beforeMount: [async (e) => {
480
- J(window.location.pathname), q(e.name);
481
- }],
482
- afterMount: [async (e) => {
483
- J(window.location.pathname), Ee(e.name);
484
- }]
485
- }), He(), Ve(), Ke();
486
- }
487
- async function ze() {
488
- let e = Array.from(new Set([...X, ...d().filter((e) => e.startsWith("morningfast-"))]));
489
- Y = !1, X.clear(), await Promise.all(e.map(async (e) => {
490
- try {
491
- await p(e);
492
- } catch {}
493
- })), Z(), await f();
494
- }
495
- async function Be(e) {
496
- let t = we(e);
497
- if (!t) return !1;
498
- Z(), J(e), q(t.name);
499
- try {
500
- await ee(t.name), await f();
501
- } catch (n) {
502
- De(t.name, n) && Oe(t, e, n);
503
- }
504
- return !0;
505
- }
506
- function Ve() {
507
- Fe || document.querySelector("#micro-app-container") && (Fe = !0, u({
508
- prefetch: !1,
509
- sandbox: { experimentalStyleIsolation: !0 },
510
- urlRerouteOnly: !0
511
- }));
512
- }
513
- function He() {
514
- Ie || (Ie = !0, c((e) => {
515
- let t = e.appOrParcelName;
516
- if (!t || !We(t)) return;
517
- let n = L(I()).find((e) => e.name === t);
518
- !n || !Ue(n, window.location.pathname) || De(t, e) && Oe(n, window.location.pathname, e);
519
- }));
520
- }
521
- function Ue(e, t) {
522
- return t === e.activeRule || t.startsWith(`${e.activeRule}/`);
523
- }
524
- function We(e) {
525
- let t = K()[e]?.status;
526
- return !t || Re.has(t);
527
- }
528
- function Ge(e) {
529
- let t = j();
530
- return {
531
- basePath: e.activeRule,
532
- app: he(e),
533
- runtime: {
534
- env: "production",
535
- apiBaseUrl: "/api"
536
- },
537
- theme: Q(t.isDark),
538
- getRuntimeProps: () => ({ theme: Q(t.isDark) })
539
- };
540
- }
541
- function Ke() {
542
- if (Le) return;
543
- Le = !0;
544
- let e = j();
545
- o(() => [
546
- e.isDark,
547
- e.themeColor,
548
- e.themeColorPosition
549
- ], () => {
550
- window.setTimeout(() => {
551
- qe(Q(e.isDark));
552
- }, 0);
553
- });
554
- }
555
- function qe(e) {
556
- window.dispatchEvent(new CustomEvent(Pe, { detail: e }));
557
- }
558
- function Q(e) {
559
- let t = getComputedStyle(document.documentElement);
560
- return {
561
- colorPrimary: $(t, "--el-color-primary", "#409EFF"),
562
- colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
563
- colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
564
- colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
565
- colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
566
- colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
567
- colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
568
- mode: e ? "dark" : "light"
569
- };
570
- }
571
- function $(e, t, n) {
572
- return e.getPropertyValue(t).trim() || n;
573
- }
574
- //#endregion
575
- export { ce as _, Ce as a, I as c, ve as d, R as f, j as g, pe as h, we as i, B as l, _e as m, Be as n, K as o, me as p, Z as r, F as s, ze as t, V as u, _ as v };
@@ -1 +0,0 @@
1
- export type { ApiResponse, ManagedRequestConfig, PageQuery, PageResult, RequestConfig, RequestErrorContext, } from '../../request';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes