@morningfast/platform 0.0.12 → 0.0.14

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 (31) hide show
  1. package/dist/assets/main/style.css +2 -5
  2. package/dist/chunks/{Login-BKuPkkY9.js → Login-8fZ-l3ST.js} +11 -11
  3. package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-Xa8FuNBK.js} +1 -1
  4. package/dist/chunks/{application-config-DLHtmY_2.js → application-config-DpfzdbAa.js} +2 -2
  5. package/dist/chunks/main-CX2uCPdt.js +2841 -0
  6. package/dist/chunks/route-items-DXwaEe0Y.js +21 -0
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +7 -8
  9. package/dist/main/app/AppUpdateDialog.vue.d.ts +14 -0
  10. package/dist/main/app/runtime-config.d.ts +5 -0
  11. package/dist/main/app/update-checker.d.ts +8 -0
  12. package/dist/main/app/update-preferences.d.ts +2 -0
  13. package/dist/main/index.d.ts +2 -0
  14. package/dist/main/layouts/composables/useShortcutLabel.d.ts +1 -1
  15. package/dist/main/router/route-items.d.ts +3 -15
  16. package/dist/main/settings/components/AppearanceSettings.vue.d.ts +3 -0
  17. package/dist/main/settings/components/GeneralSettings.vue.d.ts +3 -0
  18. package/dist/main/settings/components/LayoutSettings.vue.d.ts +3 -0
  19. package/dist/main/settings/components/ShortcutSettings.vue.d.ts +3 -0
  20. package/dist/main/stores/index.d.ts +1 -0
  21. package/dist/main/stores/shortcut.d.ts +77 -0
  22. package/dist/main/utils/keyboard-shortcut.d.ts +39 -0
  23. package/dist/main.js +5 -6
  24. package/dist/shared/router/route-items.d.ts +15 -0
  25. package/dist/sub/index.d.ts +2 -2
  26. package/dist/sub.js +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunks/main-BVdwJu-s.js +0 -1840
  29. package/dist/chunks/route-items-84k92f3O.js +0 -513
  30. /package/dist/chunks/{_plugin-vue_export-helper-DvRHjpsZ.js → _plugin-vue_export-helper-CZc-Y3Wh.js} +0 -0
  31. /package/dist/chunks/{config-Cd-9BYBy.js → config-CJOAan9n.js} +0 -0
@@ -1,513 +0,0 @@
1
- import { t as e } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
2
- import { n as t, r as n, s as r, t as i } from "./config-Cd-9BYBy.js";
3
- import { useRoute as a } from "vue-router";
4
- import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, onBeforeUnmount as h, onMounted as g, openBlock as _, reactive as v, ref as y, resolveComponent as b, toDisplayString as x, unref as S, watch as C, withCtx as w } from "vue";
5
- import { defineStore as T } from "pinia";
6
- import { Link as ee, RefreshRight as E, WarningFilled as D } from "@element-plus/icons-vue";
7
- import { addGlobalUncaughtErrorHandler as O, registerMicroApps as k, start as A } from "qiankun";
8
- //#region src/main/utils/theme.ts
9
- var j = "theme-color", M = "theme-mode", N = "theme-position", P = [
10
- {
11
- label: "默认蓝",
12
- value: "#409EFF"
13
- },
14
- {
15
- label: "深蓝色",
16
- value: "#0960BE"
17
- },
18
- {
19
- label: "靛蓝色",
20
- value: "#045277"
21
- },
22
- {
23
- label: "天空蓝",
24
- value: "#78B5FE"
25
- },
26
- {
27
- label: "深绿色",
28
- value: "#0C522B"
29
- },
30
- {
31
- label: "翡翠绿",
32
- value: "#009773"
33
- },
34
- {
35
- label: "浅绿色",
36
- value: "#0BD092"
37
- },
38
- {
39
- label: "紫罗兰",
40
- value: "#7166F0"
41
- },
42
- {
43
- label: "樱花粉",
44
- value: "#FFB7C5"
45
- },
46
- {
47
- label: "柠檬黄",
48
- value: "#EFBD48"
49
- },
50
- {
51
- label: "橙黄色",
52
- value: "#C1420B"
53
- },
54
- {
55
- label: "玫瑰红",
56
- value: "#BB1B1B"
57
- },
58
- {
59
- label: "锌色灰",
60
- value: "#3F3F46"
61
- },
62
- {
63
- label: "中性灰",
64
- value: "#404040"
65
- },
66
- {
67
- label: "石板灰",
68
- value: "#344256"
69
- }
70
- ];
71
- function F() {
72
- return localStorage.getItem(j) || "#409EFF";
73
- }
74
- function I() {
75
- let e = localStorage.getItem(M);
76
- return e === "light" || e === "dark" || e === "system" ? e : "light";
77
- }
78
- function te(e) {
79
- localStorage.setItem(j, e);
80
- }
81
- function ne(e) {
82
- localStorage.setItem(M, e);
83
- }
84
- function re() {
85
- let e = localStorage.getItem(N);
86
- return e === "none" || e === "header" || e === "sidebar" ? e : "none";
87
- }
88
- function ie(e) {
89
- localStorage.setItem(N, e);
90
- }
91
- function ae() {
92
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
93
- }
94
- function oe(e) {
95
- return e === "dark" || e === "system" && ae();
96
- }
97
- function se(e) {
98
- let t = oe(e);
99
- document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
100
- }
101
- function L(e) {
102
- let t = document.documentElement, n = t.classList.contains("dark");
103
- t.style.setProperty("--el-color-primary", e), t.style.setProperty("--el-color-primary-light-3", B(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", B(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", B(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", B(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", B(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", B(e, n ? "#ffffff" : "#000000", .2));
104
- }
105
- function ce() {
106
- se(I()), L(F()), R(re());
107
- }
108
- function R(e) {
109
- document.documentElement.setAttribute("data-theme-position", e);
110
- }
111
- function z(e = 50) {
112
- return new Promise((t) => {
113
- setTimeout(() => {
114
- L(F()), t();
115
- }, e);
116
- });
117
- }
118
- async function le(e, t) {
119
- if (!document.startViewTransition) {
120
- t(), await z();
121
- return;
122
- }
123
- let n = e.clientX, r = e.clientY, i = Math.hypot(Math.max(n, innerWidth - n), Math.max(r, innerHeight - r));
124
- try {
125
- document.startViewTransition(() => {
126
- t();
127
- }).ready.then(() => {
128
- 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");
129
- document.documentElement.animate({ clipPath: c ? s.reverse() : s }, {
130
- duration: 400,
131
- easing: "ease-in",
132
- fill: "both",
133
- pseudoElement: c ? "::view-transition-old(root)" : "::view-transition-new(root)"
134
- });
135
- }), await z();
136
- } catch {
137
- t(), await z();
138
- }
139
- }
140
- function B(e, t, n) {
141
- let [r, i, a] = V(e), [o, s, c] = V(t), l = (e, t) => Math.round(e * (1 - n) + t * n);
142
- return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
143
- }
144
- function V(e) {
145
- let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
146
- return [
147
- r >> 16 & 255,
148
- r >> 8 & 255,
149
- r & 255
150
- ];
151
- }
152
- //#endregion
153
- //#region src/main/stores/app.ts
154
- var H = "sidebar-collapsed", U = "menu-search-placement", W = "layout-mode", G = "top-menu-path", ue = "(max-width: 768px)", K = null, q = T("app", () => {
155
- let e = y(localStorage.getItem(H) === "true"), t = y(!1), n = y(de()), r = y(!1), i = y("theme"), a = y(I()), s = y(F()), c = y(re()), l = y(pe(localStorage.getItem(W))), u = y(localStorage.getItem(U) || "header"), d = y(localStorage.getItem(G) || ""), f = y(!0), p = o(() => oe(a.value)), m = o(() => l.value === "top" ? ["header"] : ["header", "sidebar"]), h = o(() => l.value !== "top" && u.value === "sidebar");
156
- function g() {
157
- if (n.value) {
158
- t.value = !t.value;
159
- return;
160
- }
161
- e.value = !e.value;
162
- }
163
- function _(t) {
164
- e.value = t, localStorage.setItem(H, String(e.value));
165
- }
166
- function v() {
167
- t.value = !1;
168
- }
169
- function b(e = "theme") {
170
- i.value = e, r.value = !0;
171
- }
172
- function x() {
173
- r.value = !1;
174
- }
175
- function S(e) {
176
- r.value = e;
177
- }
178
- function C(e) {
179
- a.value = e, ne(e), se(e), L(s.value);
180
- }
181
- function w() {
182
- C(ae() && a.value === "system" || p.value ? "light" : "dark");
183
- }
184
- function T(e) {
185
- s.value = e, te(e), L(e);
186
- }
187
- function ee(e) {
188
- c.value = e, ie(e), R(e);
189
- }
190
- function E(e) {
191
- l.value = e, localStorage.setItem(W, e), e === "top" && u.value === "sidebar" && D("header");
192
- }
193
- function D(e) {
194
- let t = l.value === "top" ? "header" : e;
195
- u.value = t, localStorage.setItem(U, t);
196
- }
197
- function O(e) {
198
- d.value = e, localStorage.setItem(G, e);
199
- }
200
- function k() {
201
- ce(), fe();
202
- }
203
- return {
204
- closeMobileSidebar: v,
205
- closeSettings: x,
206
- initializePreferences: k,
207
- isDark: p,
208
- isMobileViewport: n,
209
- layoutMode: l,
210
- menuSearchPlacement: u,
211
- menuSearchPlacementOptions: m,
212
- mobileSidebarVisible: t,
213
- openSettings: b,
214
- isSidebarMenuSearch: h,
215
- settingsActiveTab: i,
216
- selectedTopMenuPath: d,
217
- setLayoutMode: E,
218
- setMenuSearchPlacement: D,
219
- setSelectedTopMenuPath: O,
220
- setSettingsVisible: S,
221
- setSidebarCollapsed: _,
222
- setThemeColor: T,
223
- setThemeColorPosition: ee,
224
- setThemeMode: C,
225
- settingsVisible: r,
226
- sidebarCollapsed: e,
227
- shortcutTipVisible: f,
228
- themeColor: s,
229
- themeColorPosition: c,
230
- themeMode: a,
231
- toggleDarkMode: w,
232
- toggleSidebar: g
233
- };
234
- });
235
- function de() {
236
- return typeof window > "u" ? !1 : window.matchMedia(ue).matches;
237
- }
238
- function fe() {
239
- if (typeof window > "u" || K) return;
240
- let e = window.matchMedia(ue), t = q(), n = () => {
241
- t.isMobileViewport = e.matches, e.matches || t.closeMobileSidebar();
242
- };
243
- n(), e.addEventListener("change", n), K = () => {
244
- e.removeEventListener("change", n), K = null;
245
- };
246
- }
247
- function pe(e) {
248
- return e === "side" || e === "top" || e === "mix" ? e : "default";
249
- }
250
- //#endregion
251
- //#region src/main/micro-apps/status.ts
252
- var J = v({}), Y = v({});
253
- function me() {
254
- return J;
255
- }
256
- function he(e) {
257
- return Y[e];
258
- }
259
- function ge(e) {
260
- return n(t()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
261
- }
262
- function _e(e) {
263
- return J[e.name] || (J[e.name] = {
264
- name: e.name,
265
- title: e.title,
266
- entry: e.entry,
267
- activeRule: e.activeRule,
268
- status: "idle",
269
- updatedAt: Date.now()
270
- }, J[e.name]);
271
- }
272
- function ve(e) {
273
- we(e, {
274
- status: "loading",
275
- message: void 0
276
- });
277
- }
278
- function ye(e) {
279
- we(e, {
280
- status: "mounted",
281
- message: void 0
282
- });
283
- }
284
- function be(e, t) {
285
- Te(e, {
286
- status: "error",
287
- message: X(t)
288
- });
289
- }
290
- function xe(e, t) {
291
- let n = J[e];
292
- return n ? (n.status = "error", n.message = X(t), n.updatedAt = Date.now(), !0) : !1;
293
- }
294
- function Se(e, t, n) {
295
- Y[t] = {
296
- path: t,
297
- name: e.name,
298
- title: e.title,
299
- entry: e.entry,
300
- activeRule: e.activeRule,
301
- message: X(n),
302
- updatedAt: Date.now()
303
- };
304
- }
305
- function Ce(e) {
306
- delete Y[e];
307
- }
308
- function we(e, t) {
309
- let n = J[e];
310
- n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
311
- }
312
- function Te(e, t) {
313
- let n = _e(e);
314
- n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
315
- }
316
- function X(e) {
317
- let t = Ee(e);
318
- return t ? Oe(De(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
319
- }
320
- function Ee(e) {
321
- return e instanceof Error ? e.message : typeof e == "string" ? e : "";
322
- }
323
- function De(e) {
324
- return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
325
- }
326
- function Oe(e) {
327
- let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
328
- 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;
329
- }
330
- //#endregion
331
- //#region src/main/micro-apps/types.ts
332
- var ke = "morningfast:theme-change", Ae = !1, je = !1;
333
- function Me() {
334
- if (Ae) {
335
- Ne();
336
- return;
337
- }
338
- Ae = !0;
339
- let e = n(t());
340
- e.forEach(_e), k(e.map((e) => ({
341
- name: e.name,
342
- entry: e.entry,
343
- container: e.container,
344
- activeRule: e.activeRule,
345
- props: Fe(e)
346
- })), {
347
- beforeLoad: [async (e) => {
348
- Ce(window.location.pathname), ve(e.name);
349
- }],
350
- afterMount: [async (e) => {
351
- Ce(window.location.pathname), ye(e.name);
352
- }]
353
- }), O((t) => {
354
- let n = t instanceof ErrorEvent ? t.error || t.message : t, r = Pe(n) || Pe(t);
355
- if (r && xe(r, n)) {
356
- let t = e.find((e) => e.name === r);
357
- t && Se(t, window.location.pathname, n);
358
- return;
359
- }
360
- e.forEach((e) => {
361
- (window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (be(e, n), Se(e, window.location.pathname, n));
362
- });
363
- }), Ne(), Ie();
364
- }
365
- function Ne() {
366
- je || document.querySelector("#micro-app-container") && (je = !0, A({
367
- prefetch: !1,
368
- sandbox: { experimentalStyleIsolation: !0 },
369
- urlRerouteOnly: !0
370
- }));
371
- }
372
- function Pe(e) {
373
- return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
374
- }
375
- function Fe(e) {
376
- let t = q();
377
- return {
378
- basePath: e.activeRule,
379
- app: r(e),
380
- runtime: {
381
- env: "production",
382
- apiBaseUrl: "/api"
383
- },
384
- theme: Z(t.isDark),
385
- getRuntimeProps: () => ({ theme: Z(t.isDark) })
386
- };
387
- }
388
- function Ie() {
389
- let e = q();
390
- C(() => [
391
- e.isDark,
392
- e.themeColor,
393
- e.themeColorPosition
394
- ], () => {
395
- window.setTimeout(() => {
396
- Le(Z(e.isDark));
397
- }, 0);
398
- });
399
- }
400
- function Le(e) {
401
- window.dispatchEvent(new CustomEvent(ke, { detail: e }));
402
- }
403
- function Z(e) {
404
- let t = getComputedStyle(document.documentElement);
405
- return {
406
- colorPrimary: Q(t, "--el-color-primary", "#409EFF"),
407
- colorPrimaryLight3: Q(t, "--el-color-primary-light-3", "#79bbff"),
408
- colorPrimaryLight5: Q(t, "--el-color-primary-light-5", "#a0cfff"),
409
- colorPrimaryLight7: Q(t, "--el-color-primary-light-7", "#c6e2ff"),
410
- colorPrimaryLight8: Q(t, "--el-color-primary-light-8", "#d9ecff"),
411
- colorPrimaryLight9: Q(t, "--el-color-primary-light-9", "#ecf5ff"),
412
- colorPrimaryDark2: Q(t, "--el-color-primary-dark-2", "#337ecc"),
413
- mode: e ? "dark" : "light"
414
- };
415
- }
416
- function Q(e, t, n) {
417
- return e.getPropertyValue(t).trim() || n;
418
- }
419
- //#endregion
420
- //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
421
- var Re = { class: "micro-app-page" }, ze = {
422
- key: 0,
423
- class: "micro-app-page__state micro-app-page__state--error"
424
- }, Be = { class: "micro-app-page__body" }, Ve = { class: "micro-app-page__meta" }, He = { key: 0 }, Ue = { key: 1 }, We = { class: "micro-app-page__actions" }, Ge = ["id"], Ke = /* @__PURE__ */ e(/* @__PURE__ */ p({
425
- name: "MicroAppView",
426
- __name: "MicroAppView",
427
- setup(e) {
428
- let t = a(), n = me(), r = y(""), p = null, v = o(() => ge(t.path)), T = o(() => {
429
- let e = v.value;
430
- return e ? n[e.name] : void 0;
431
- }), O = o(() => he(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);
432
- C(() => t.path, () => {
433
- m(() => {
434
- Me(), N();
435
- });
436
- }, { immediate: !0 }), g(() => {
437
- m(() => {
438
- Me(), N();
439
- });
440
- }), C(() => T.value?.status, (e) => {
441
- e === "mounted" && (P(), r.value = "");
442
- }), h(() => {
443
- P();
444
- });
445
- function N() {
446
- P(), r.value = "", v.value && (p = window.setTimeout(() => {
447
- T.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
448
- }, 15e3));
449
- }
450
- function P() {
451
- p !== null && (window.clearTimeout(p), p = null);
452
- }
453
- function F() {
454
- window.location.reload();
455
- }
456
- function I() {
457
- let e = A.value;
458
- e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
459
- }
460
- return (e, t) => {
461
- let n = b("el-icon"), r = b("el-button");
462
- return _(), l("div", Re, [M.value ? (_(), l("div", ze, [f(n, { class: "micro-app-page__icon" }, {
463
- default: w(() => [f(S(D))]),
464
- _: 1
465
- }), u("div", Be, [
466
- t[5] ||= u("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
467
- u("dl", Ve, [
468
- u("div", null, [t[0] ||= u("dt", null, "应用", -1), u("dd", null, x(k.value), 1)]),
469
- S(!1) ? (_(), l("div", He, [t[1] ||= u("dt", null, "入口", -1), u("dd", null, x(A.value), 1)])) : c("", !0),
470
- j.value ? (_(), l("div", Ue, [t[2] ||= u("dt", null, "原因", -1), u("dd", null, x(j.value), 1)])) : c("", !0)
471
- ]),
472
- u("div", We, [f(r, {
473
- type: "primary",
474
- icon: S(E),
475
- onClick: F
476
- }, {
477
- default: w(() => [...t[3] ||= [d("重新加载", -1)]]),
478
- _: 1
479
- }, 8, ["icon"]), S(!1) && (T.value?.entry || v.value?.entry) ? (_(), s(r, {
480
- key: 0,
481
- icon: S(ee),
482
- onClick: I
483
- }, {
484
- default: w(() => [...t[4] ||= [d(" 打开入口 ", -1)]]),
485
- _: 1
486
- }, 8, ["icon"])) : c("", !0)])
487
- ])])) : c("", !0), u("section", {
488
- id: S(i),
489
- class: "micro-app-page__container"
490
- }, null, 8, Ge)]);
491
- };
492
- }
493
- }), [["__scopeId", "data-v-944de23f"]]);
494
- //#endregion
495
- //#region src/main/router/route-items.ts
496
- function $(e, t) {
497
- return e.map((e) => qe(e, t));
498
- }
499
- function qe(e, t) {
500
- let n = {
501
- path: e.path,
502
- name: e.name,
503
- meta: {
504
- title: e.title,
505
- icon: e.icon,
506
- permission: e.permission,
507
- hidden: e.hidden
508
- }
509
- };
510
- return e.redirect && (n.redirect = e.redirect), e.componentKey && (n.component = t[e.componentKey]), e.microApp && (n.component = Ke), e.children?.length && (n.children = $(e.children, t)), n;
511
- }
512
- //#endregion
513
- export { P as a, le as i, Ke as n, q as r, $ as t };