@morningfast/platform 0.0.11 → 0.0.13

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 (33) hide show
  1. package/dist/assets/main/style.css +2 -5
  2. package/dist/assets/sub/style.css +1 -1
  3. package/dist/chunks/{Login-BKuPkkY9.js → Login-8fZ-l3ST.js} +11 -11
  4. package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-Xa8FuNBK.js} +1 -1
  5. package/dist/chunks/{application-config-DLHtmY_2.js → application-config-DpfzdbAa.js} +2 -2
  6. package/dist/chunks/main-CX2uCPdt.js +2841 -0
  7. package/dist/chunks/route-items-DXwaEe0Y.js +21 -0
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +7 -8
  10. package/dist/main/app/AppUpdateDialog.vue.d.ts +14 -0
  11. package/dist/main/app/runtime-config.d.ts +5 -0
  12. package/dist/main/app/update-checker.d.ts +8 -0
  13. package/dist/main/app/update-preferences.d.ts +2 -0
  14. package/dist/main/index.d.ts +2 -0
  15. package/dist/main/layouts/composables/useShortcutLabel.d.ts +1 -1
  16. package/dist/main/router/route-items.d.ts +3 -15
  17. package/dist/main/settings/components/AppearanceSettings.vue.d.ts +3 -0
  18. package/dist/main/settings/components/GeneralSettings.vue.d.ts +3 -0
  19. package/dist/main/settings/components/LayoutSettings.vue.d.ts +3 -0
  20. package/dist/main/settings/components/ShortcutSettings.vue.d.ts +3 -0
  21. package/dist/main/stores/app.d.ts +11 -2
  22. package/dist/main/stores/index.d.ts +1 -0
  23. package/dist/main/stores/shortcut.d.ts +77 -0
  24. package/dist/main/utils/keyboard-shortcut.d.ts +39 -0
  25. package/dist/main.js +5 -6
  26. package/dist/shared/router/route-items.d.ts +15 -0
  27. package/dist/sub/index.d.ts +2 -2
  28. package/dist/sub.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunks/main-CA2I4UGE.js +0 -1822
  31. package/dist/chunks/route-items-CIUjZc6w.js +0 -491
  32. /package/dist/chunks/{_plugin-vue_export-helper-DvRHjpsZ.js → _plugin-vue_export-helper-CZc-Y3Wh.js} +0 -0
  33. /package/dist/chunks/{config-Cd-9BYBy.js → config-CJOAan9n.js} +0 -0
@@ -1,491 +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 E, RefreshRight as D, WarningFilled as ee } 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 L(e) {
95
- return e === "dark" || e === "system" && ae();
96
- }
97
- function R(e) {
98
- let t = L(e);
99
- document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
100
- }
101
- function z(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", H(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", H(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", H(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", H(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", H(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", H(e, n ? "#ffffff" : "#000000", .2));
104
- }
105
- function oe() {
106
- R(I()), z(F()), B(re());
107
- }
108
- function B(e) {
109
- document.documentElement.setAttribute("data-theme-position", e);
110
- }
111
- function V(e = 50) {
112
- return new Promise((t) => {
113
- setTimeout(() => {
114
- z(F()), t();
115
- }, e);
116
- });
117
- }
118
- async function se(e, t) {
119
- if (!document.startViewTransition) {
120
- t(), await V();
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 V();
136
- } catch {
137
- t(), await V();
138
- }
139
- }
140
- function H(e, t, n) {
141
- let [r, i, a] = U(e), [o, s, c] = U(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 U(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 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(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
- function m() {
157
- e.value = !e.value;
158
- }
159
- function h(t) {
160
- e.value = t, localStorage.setItem(W, String(e.value));
161
- }
162
- function g(e = "theme") {
163
- n.value = e, t.value = !0;
164
- }
165
- function _() {
166
- t.value = !1;
167
- }
168
- function v(e) {
169
- t.value = e;
170
- }
171
- function b(e) {
172
- r.value = e, ne(e), R(e), z(i.value);
173
- }
174
- function x() {
175
- b(ae() && r.value === "system" || d.value ? "light" : "dark");
176
- }
177
- function S(e) {
178
- i.value = e, te(e), z(e);
179
- }
180
- function C(e) {
181
- a.value = e, ie(e), B(e);
182
- }
183
- function w(e) {
184
- s.value = e, localStorage.setItem(K, e), e === "top" && c.value === "sidebar" && T("header");
185
- }
186
- function T(e) {
187
- let t = s.value === "top" ? "header" : e;
188
- c.value = t, localStorage.setItem(G, t);
189
- }
190
- function E(e) {
191
- l.value = e, localStorage.setItem(q, e);
192
- }
193
- function D() {
194
- oe();
195
- }
196
- return {
197
- closeSettings: _,
198
- initializePreferences: D,
199
- isDark: d,
200
- layoutMode: s,
201
- menuSearchPlacement: c,
202
- menuSearchPlacementOptions: f,
203
- openSettings: g,
204
- isSidebarMenuSearch: p,
205
- settingsActiveTab: n,
206
- selectedTopMenuPath: l,
207
- setLayoutMode: w,
208
- setMenuSearchPlacement: T,
209
- setSelectedTopMenuPath: E,
210
- setSettingsVisible: v,
211
- setSidebarCollapsed: h,
212
- setThemeColor: S,
213
- setThemeColorPosition: C,
214
- setThemeMode: b,
215
- settingsVisible: t,
216
- sidebarCollapsed: e,
217
- shortcutTipVisible: u,
218
- themeColor: i,
219
- themeColorPosition: a,
220
- themeMode: r,
221
- toggleDarkMode: x,
222
- toggleSidebar: m
223
- };
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() {
232
- return Y;
233
- }
234
- function ue(e) {
235
- return X[e];
236
- }
237
- function de(e) {
238
- return n(t()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
239
- }
240
- function fe(e) {
241
- return Y[e.name] || (Y[e.name] = {
242
- name: e.name,
243
- title: e.title,
244
- entry: e.entry,
245
- activeRule: e.activeRule,
246
- status: "idle",
247
- updatedAt: Date.now()
248
- }, Y[e.name]);
249
- }
250
- function pe(e) {
251
- ye(e, {
252
- status: "loading",
253
- message: void 0
254
- });
255
- }
256
- function me(e) {
257
- ye(e, {
258
- status: "mounted",
259
- message: void 0
260
- });
261
- }
262
- function he(e, t) {
263
- be(e, {
264
- status: "error",
265
- message: Z(t)
266
- });
267
- }
268
- function ge(e, t) {
269
- let n = Y[e];
270
- return n ? (n.status = "error", n.message = Z(t), n.updatedAt = Date.now(), !0) : !1;
271
- }
272
- function _e(e, t, n) {
273
- X[t] = {
274
- path: t,
275
- name: e.name,
276
- title: e.title,
277
- entry: e.entry,
278
- activeRule: e.activeRule,
279
- message: Z(n),
280
- updatedAt: Date.now()
281
- };
282
- }
283
- function ve(e) {
284
- delete X[e];
285
- }
286
- function ye(e, t) {
287
- let n = Y[e];
288
- n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
289
- }
290
- function be(e, t) {
291
- let n = fe(e);
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();
293
- }
294
- function Z(e) {
295
- let t = xe(e);
296
- return t ? Ce(Se(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
297
- }
298
- function xe(e) {
299
- return e instanceof Error ? e.message : typeof e == "string" ? e : "";
300
- }
301
- function Se(e) {
302
- return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
303
- }
304
- function Ce(e) {
305
- let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
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;
307
- }
308
- //#endregion
309
- //#region src/main/micro-apps/types.ts
310
- var we = "morningfast:theme-change", Te = !1, Ee = !1;
311
- function De() {
312
- if (Te) {
313
- Oe();
314
- return;
315
- }
316
- Te = !0;
317
- let e = n(t());
318
- e.forEach(fe), k(e.map((e) => ({
319
- name: e.name,
320
- entry: e.entry,
321
- container: e.container,
322
- activeRule: e.activeRule,
323
- props: Ae(e)
324
- })), {
325
- beforeLoad: [async (e) => {
326
- ve(window.location.pathname), pe(e.name);
327
- }],
328
- afterMount: [async (e) => {
329
- ve(window.location.pathname), me(e.name);
330
- }]
331
- }), O((t) => {
332
- let n = t instanceof ErrorEvent ? t.error || t.message : t, r = ke(n) || ke(t);
333
- if (r && ge(r, n)) {
334
- let t = e.find((e) => e.name === r);
335
- t && _e(t, window.location.pathname, n);
336
- return;
337
- }
338
- e.forEach((e) => {
339
- (window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (he(e, n), _e(e, window.location.pathname, n));
340
- });
341
- }), Oe(), je();
342
- }
343
- function Oe() {
344
- Ee || document.querySelector("#micro-app-container") && (Ee = !0, A({
345
- prefetch: !1,
346
- sandbox: { experimentalStyleIsolation: !0 },
347
- urlRerouteOnly: !0
348
- }));
349
- }
350
- function ke(e) {
351
- return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
352
- }
353
- function Ae(e) {
354
- let t = J();
355
- return {
356
- basePath: e.activeRule,
357
- app: r(e),
358
- runtime: {
359
- env: "production",
360
- apiBaseUrl: "/api"
361
- },
362
- theme: Q(t.isDark),
363
- getRuntimeProps: () => ({ theme: Q(t.isDark) })
364
- };
365
- }
366
- function je() {
367
- let e = J();
368
- C(() => [
369
- e.isDark,
370
- e.themeColor,
371
- e.themeColorPosition
372
- ], () => {
373
- window.setTimeout(() => {
374
- Me(Q(e.isDark));
375
- }, 0);
376
- });
377
- }
378
- function Me(e) {
379
- window.dispatchEvent(new CustomEvent(we, { detail: e }));
380
- }
381
- function Q(e) {
382
- let t = getComputedStyle(document.documentElement);
383
- return {
384
- colorPrimary: $(t, "--el-color-primary", "#409EFF"),
385
- colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
386
- colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
387
- colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
388
- colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
389
- colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
390
- colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
391
- mode: e ? "dark" : "light"
392
- };
393
- }
394
- function $(e, t, n) {
395
- return e.getPropertyValue(t).trim() || n;
396
- }
397
- //#endregion
398
- //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
399
- var Ne = { class: "micro-app-page" }, Pe = {
400
- key: 0,
401
- class: "micro-app-page__state micro-app-page__state--error"
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({
403
- name: "MicroAppView",
404
- __name: "MicroAppView",
405
- setup(e) {
406
- let t = a(), n = le(), r = y(""), p = null, v = o(() => de(t.path)), T = o(() => {
407
- let e = v.value;
408
- return e ? n[e.name] : void 0;
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);
410
- C(() => t.path, () => {
411
- m(() => {
412
- De(), N();
413
- });
414
- }, { immediate: !0 }), g(() => {
415
- m(() => {
416
- De(), N();
417
- });
418
- }), C(() => T.value?.status, (e) => {
419
- e === "mounted" && (P(), r.value = "");
420
- }), h(() => {
421
- P();
422
- });
423
- function N() {
424
- P(), r.value = "", v.value && (p = window.setTimeout(() => {
425
- T.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
426
- }, 15e3));
427
- }
428
- function P() {
429
- p !== null && (window.clearTimeout(p), p = null);
430
- }
431
- function F() {
432
- window.location.reload();
433
- }
434
- function I() {
435
- let e = A.value;
436
- e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
437
- }
438
- return (e, t) => {
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" }, {
441
- default: w(() => [f(S(ee))]),
442
- _: 1
443
- }), u("div", Fe, [
444
- t[5] ||= u("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
445
- u("dl", Ie, [
446
- u("div", null, [t[0] ||= u("dt", null, "应用", -1), u("dd", null, x(k.value), 1)]),
447
- S(!1) ? (_(), l("div", Le, [t[1] ||= u("dt", null, "入口", -1), u("dd", null, x(A.value), 1)])) : c("", !0),
448
- j.value ? (_(), l("div", Re, [t[2] ||= u("dt", null, "原因", -1), u("dd", null, x(j.value), 1)])) : c("", !0)
449
- ]),
450
- u("div", ze, [f(r, {
451
- type: "primary",
452
- icon: S(D),
453
- onClick: F
454
- }, {
455
- default: w(() => [...t[3] ||= [d("重新加载", -1)]]),
456
- _: 1
457
- }, 8, ["icon"]), S(!1) && (T.value?.entry || v.value?.entry) ? (_(), s(r, {
458
- key: 0,
459
- icon: S(E),
460
- onClick: I
461
- }, {
462
- default: w(() => [...t[4] ||= [d(" 打开入口 ", -1)]]),
463
- _: 1
464
- }, 8, ["icon"])) : c("", !0)])
465
- ])])) : c("", !0), u("section", {
466
- id: S(i),
467
- class: "micro-app-page__container"
468
- }, null, 8, Be)]);
469
- };
470
- }
471
- }), [["__scopeId", "data-v-944de23f"]]);
472
- //#endregion
473
- //#region src/main/router/route-items.ts
474
- function He(e, t) {
475
- return e.map((e) => Ue(e, t));
476
- }
477
- function Ue(e, t) {
478
- let n = {
479
- path: e.path,
480
- name: e.name,
481
- meta: {
482
- title: e.title,
483
- icon: e.icon,
484
- permission: e.permission,
485
- hidden: e.hidden
486
- }
487
- };
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;
489
- }
490
- //#endregion
491
- export { P as a, se as i, Ve as n, J as r, He as t };