@morningfast/platform 0.0.6
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 +13 -0
- package/dist/assets/main.css +1 -0
- package/dist/assets/sub/style.css +1 -0
- package/dist/auth/index.d.ts +32 -0
- package/dist/auth.js +49 -0
- package/dist/chunks/Forbidden-gf6y5Zsh.js +30 -0
- package/dist/chunks/Login-rBkUOl6l.js +209 -0
- package/dist/chunks/MicroAppView-DqTrIZZa.js +249 -0
- package/dist/chunks/NotFound-D0ybyfbK.js +30 -0
- package/dist/chunks/SystemConfig-DxkDxCnC.js +194 -0
- package/dist/chunks/_plugin-vue_export-helper-DvRHjpsZ.js +8 -0
- package/dist/chunks/app-Cn5iHmfI.js +221 -0
- package/dist/chunks/application-config-0d6f-odq.js +287 -0
- package/dist/chunks/auth-C3RvRgcW.js +248 -0
- package/dist/chunks/config-DkMAgPn_.js +44 -0
- package/dist/chunks/main-CfTD1njJ.js +1798 -0
- package/dist/chunks/storage-DNllLr_D.js +18 -0
- package/dist/chunks/sub-DlD5e1ys.js +140 -0
- package/dist/chunks/system-BbMsTIBR.js +160 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/main/api/adapter.d.ts +25 -0
- package/dist/main/api/auth.d.ts +12 -0
- package/dist/main/api/client.d.ts +3 -0
- package/dist/main/api/types.d.ts +1 -0
- package/dist/main/app/create-app.d.ts +29 -0
- package/dist/main/app/runtime-config.d.ts +5 -0
- package/dist/main/auth/expired.d.ts +2 -0
- package/dist/main/composables/useSortable.d.ts +197 -0
- package/dist/main/directives/index.d.ts +2 -0
- package/dist/main/index.d.ts +11 -0
- package/dist/main/layouts/AppLayout.vue.d.ts +3 -0
- package/dist/main/layouts/components/AppContentView.vue.d.ts +6 -0
- package/dist/main/layouts/components/AppHeader.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppHeaderMenuNode.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppMenuSearch.vue.d.ts +10 -0
- package/dist/main/layouts/components/AppMenuSearchItem.vue.d.ts +17 -0
- package/dist/main/layouts/components/AppMenuSearchTrigger.vue.d.ts +11 -0
- package/dist/main/layouts/components/AppSidebar.vue.d.ts +3 -0
- package/dist/main/layouts/components/AppSidebarNode.vue.d.ts +8 -0
- package/dist/main/layouts/components/AppSidebarSearch.vue.d.ts +11 -0
- package/dist/main/layouts/components/AppTabs.vue.d.ts +7 -0
- package/dist/main/layouts/components/AppTabsContextMenu.vue.d.ts +38 -0
- package/dist/main/layouts/composables/useAppMenus.d.ts +23 -0
- package/dist/main/layouts/composables/useShortcutLabel.d.ts +4 -0
- package/dist/main/layouts/utils/menuIcons.d.ts +1 -0
- package/dist/main/layouts/utils/menuSearch.d.ts +3 -0
- package/dist/main/micro-apps/config.d.ts +25 -0
- package/dist/main/micro-apps/register.d.ts +1 -0
- package/dist/main/micro-apps/status.d.ts +39 -0
- package/dist/main/micro-apps/types.d.ts +39 -0
- package/dist/main/pages/auth/Login.vue.d.ts +3 -0
- package/dist/main/pages/error/Forbidden.vue.d.ts +3 -0
- package/dist/main/pages/error/NotFound.vue.d.ts +3 -0
- package/dist/main/pages/micro/MicroAppView.vue.d.ts +3 -0
- package/dist/main/pages/system/SystemConfig.vue.d.ts +3 -0
- package/dist/main/pages/system/application-config/index.vue.d.ts +3 -0
- package/dist/main/router/base-routes.d.ts +2 -0
- package/dist/main/router/guard.d.ts +2 -0
- package/dist/main/router/index.d.ts +8 -0
- package/dist/main/settings/components/SystemSettingsDrawer.vue.d.ts +3 -0
- package/dist/main/settings/components/ThemeToggleButton.vue.d.ts +3 -0
- package/dist/main/settings/components/ThemedSvgImage.vue.d.ts +10 -0
- package/dist/main/stores/app.d.ts +85 -0
- package/dist/main/stores/auth.d.ts +110 -0
- package/dist/main/stores/index.d.ts +4 -0
- package/dist/main/stores/system.d.ts +111 -0
- package/dist/main/stores/tabs.d.ts +83 -0
- package/dist/main/utils/auth.d.ts +1 -0
- package/dist/main/utils/persistence.d.ts +3 -0
- package/dist/main/utils/storage.d.ts +3 -0
- package/dist/main/utils/theme.d.ts +20 -0
- package/dist/main.js +5 -0
- package/dist/micro-contract/index.d.ts +13 -0
- package/dist/micro-contract.js +4 -0
- package/dist/request/index.d.ts +72 -0
- package/dist/request.js +153 -0
- package/dist/sub/app/mount.d.ts +7 -0
- package/dist/sub/composables/useRequestClient.d.ts +5 -0
- package/dist/sub/composables/useSubAppContext.d.ts +1 -0
- package/dist/sub/context/sub-app-context.d.ts +10 -0
- package/dist/sub/index.d.ts +8 -0
- package/dist/sub/qiankun/index.d.ts +38 -0
- package/dist/sub/router/index.d.ts +2 -0
- package/dist/sub/theme/index.d.ts +2 -0
- package/dist/sub.js +2 -0
- package/package.json +86 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/main/utils/storage.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = localStorage.getItem(e);
|
|
4
|
+
if (!n) return t;
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(n);
|
|
7
|
+
} catch {
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function t(e, t) {
|
|
12
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
13
|
+
}
|
|
14
|
+
function n(e) {
|
|
15
|
+
localStorage.removeItem(e);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { n, t as r, e as t };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { emitAuthExpired as e, getAccessToken as t } from "../auth.js";
|
|
2
|
+
import { createRequestClient as n } from "../request.js";
|
|
3
|
+
import { createRouter as r, createWebHistory as i } from "vue-router";
|
|
4
|
+
import a, { ElMessage as o } from "element-plus";
|
|
5
|
+
import { createApp as s, inject as c } from "vue";
|
|
6
|
+
import { registerMpFormFieldComponents as l } from "morningfast-plus/components";
|
|
7
|
+
import u from "element-plus/es/locale/lang/zh-cn";
|
|
8
|
+
import "element-plus/dist/index.css";
|
|
9
|
+
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
10
|
+
import { qiankunWindow as d, renderWithQiankun as f } from "vite-plugin-qiankun/dist/helper";
|
|
11
|
+
//#region src/sub/context/sub-app-context.ts
|
|
12
|
+
var p = Symbol("subAppContext");
|
|
13
|
+
function m(e = {}) {
|
|
14
|
+
return {
|
|
15
|
+
basePath: e.basePath || "/",
|
|
16
|
+
app: e.app,
|
|
17
|
+
runtime: {
|
|
18
|
+
env: "production",
|
|
19
|
+
apiBaseUrl: "/api",
|
|
20
|
+
...e.runtime
|
|
21
|
+
},
|
|
22
|
+
theme: e.theme
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/sub/qiankun/index.ts
|
|
27
|
+
var h = "morningfast-sub-app", g = "/", _ = "morningfast:theme-change";
|
|
28
|
+
function v(e) {
|
|
29
|
+
let t = e?.basePath || "/";
|
|
30
|
+
return t.endsWith("/") ? t : `${t}/`;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/sub/router/index.ts
|
|
34
|
+
function y(e, t = "/") {
|
|
35
|
+
let n = r({
|
|
36
|
+
history: i(t),
|
|
37
|
+
routes: e
|
|
38
|
+
});
|
|
39
|
+
return n.afterEach((e) => {
|
|
40
|
+
document.title = String(e.meta.title ?? "Morningfast Sub App");
|
|
41
|
+
}), n;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/sub/theme/index.ts
|
|
45
|
+
var b = {
|
|
46
|
+
colorPrimary: "--el-color-primary",
|
|
47
|
+
colorPrimaryLight3: "--el-color-primary-light-3",
|
|
48
|
+
colorPrimaryLight5: "--el-color-primary-light-5",
|
|
49
|
+
colorPrimaryLight7: "--el-color-primary-light-7",
|
|
50
|
+
colorPrimaryLight8: "--el-color-primary-light-8",
|
|
51
|
+
colorPrimaryLight9: "--el-color-primary-light-9",
|
|
52
|
+
colorPrimaryDark2: "--el-color-primary-dark-2"
|
|
53
|
+
};
|
|
54
|
+
function x(e) {
|
|
55
|
+
let t = document.documentElement;
|
|
56
|
+
e && (Object.entries(b).forEach(([n, r]) => {
|
|
57
|
+
let i = e[n];
|
|
58
|
+
i && t.style.setProperty(r, i);
|
|
59
|
+
}), t.classList.toggle("dark", e.mode === "dark"), t.style.colorScheme = e.mode === "dark" ? "dark" : "light");
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/sub/app/mount.ts
|
|
63
|
+
var S = null, C = null;
|
|
64
|
+
function w(e) {
|
|
65
|
+
f({
|
|
66
|
+
bootstrap() {},
|
|
67
|
+
mount(t) {
|
|
68
|
+
T(e.rootComponent, e.routes, t);
|
|
69
|
+
},
|
|
70
|
+
unmount() {
|
|
71
|
+
C?.(), S?.unmount(), S = null;
|
|
72
|
+
},
|
|
73
|
+
update(e) {
|
|
74
|
+
x(E(e).theme);
|
|
75
|
+
}
|
|
76
|
+
}), d.__POWERED_BY_QIANKUN__ || T(e.rootComponent, e.routes);
|
|
77
|
+
}
|
|
78
|
+
function T(e, t, n = {}) {
|
|
79
|
+
let r = E(n);
|
|
80
|
+
x(r.theme), D(), l();
|
|
81
|
+
let i = n.container?.querySelector("#sub-app") || document.querySelector("#sub-app");
|
|
82
|
+
if (!i) return;
|
|
83
|
+
let o = y(t, v(n));
|
|
84
|
+
S = s(e, {
|
|
85
|
+
app: n.app,
|
|
86
|
+
basePath: n.basePath,
|
|
87
|
+
runtime: n.runtime,
|
|
88
|
+
theme: r.theme
|
|
89
|
+
}), S.provide(p, m({
|
|
90
|
+
app: n.app,
|
|
91
|
+
basePath: v(n),
|
|
92
|
+
runtime: n.runtime,
|
|
93
|
+
theme: r.theme
|
|
94
|
+
})), S.use(a, { locale: u }), S.use(o), S.mount(i);
|
|
95
|
+
}
|
|
96
|
+
function E(e = {}) {
|
|
97
|
+
return {
|
|
98
|
+
theme: e.theme,
|
|
99
|
+
...e.getRuntimeProps?.()
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function D() {
|
|
103
|
+
C?.();
|
|
104
|
+
let e = (e) => {
|
|
105
|
+
x(e.detail);
|
|
106
|
+
};
|
|
107
|
+
window.addEventListener(_, e), C = () => {
|
|
108
|
+
window.removeEventListener(_, e), C = null;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/sub/composables/useSubAppContext.ts
|
|
113
|
+
function O() {
|
|
114
|
+
return c(p, m());
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/sub/composables/useRequestClient.ts
|
|
118
|
+
var k = /* @__PURE__ */ new Map();
|
|
119
|
+
function A() {
|
|
120
|
+
let r = O(), i = r.runtime.apiBaseUrl, a = k.get(i);
|
|
121
|
+
if (a) return a;
|
|
122
|
+
let s = n({
|
|
123
|
+
baseURL: r.runtime.apiBaseUrl,
|
|
124
|
+
getToken: t,
|
|
125
|
+
onError(e) {
|
|
126
|
+
o.error(e);
|
|
127
|
+
},
|
|
128
|
+
onUnauthorized(t) {
|
|
129
|
+
e({
|
|
130
|
+
source: "sub-app",
|
|
131
|
+
reason: "unauthorized",
|
|
132
|
+
code: t.code,
|
|
133
|
+
message: t.message
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return k.set(i, s), s;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { y as a, _ as c, p as d, x as i, v as l, O as n, g as o, w as r, h as s, A as t, m as u };
|