@morningfast/platform 0.0.7 → 0.0.8

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/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { MICRO_AUTH_EXPIRED_EVENT as e } from "./micro-contract.js";
2
- import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./chunks/main-B00aDVlh.js";
3
- import { ApiError as d, RequestManager as f, createRequestClient as p, formatErrorMessage as m } from "./request.js";
4
- import { a as h, i as g, n as _, r as v, t as y } from "./chunks/auth-C3RvRgcW.js";
5
- import { t as b } from "./chunks/system-BbMsTIBR.js";
6
- import { t as x } from "./chunks/app-Cn5iHmfI.js";
7
- import { a as S, c as C, d as w, i as T, l as E, n as D, o as O, r as k, s as A, t as j, u as M } from "./chunks/sub-DlD5e1ys.js";
8
- export { d as ApiError, O as DEFAULT_SUB_APP_BASE, r as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, f as RequestManager, A as SUB_APP_NAME, C as SUB_APP_THEME_CHANGE_EVENT, T as applySubAppTheme, o as configureMorningfastRequestClient, c as createApi, _ as createMockLoginResult, v as createMockUserProfile, s as createMorningfastBaseRoutes, a as createMorningfastRouter, p as createRequestClient, M as createSubAppContext, S as createSubAppRouter, m as formatErrorMessage, n as http, l as mountMorningfastApp, k as mountSubApp, g as normalizeLoginResult, h as normalizeUserProfile, i as requestManager, E as resolveSubAppBasePath, u as setupAuthExpiredHandler, w as subAppContextKey, x as useAppStore, y as useAuthStore, j as useRequestClient, D as useSubAppContext, b as useSystemStore, t as useTabsStore };
2
+ import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l, s as u, t as d, u as f } from "./chunks/main-Ln0xOplS.js";
3
+ import { ApiError as p, RequestManager as m, createRequestClient as h, formatErrorMessage as g } from "./request.js";
4
+ import { a as _, i as v, n as y, r as b, t as x } from "./chunks/auth-C3RvRgcW.js";
5
+ import { t as S } from "./chunks/system-BbMsTIBR.js";
6
+ import { a as C, c as w, d as T, i as E, l as D, n as O, o as k, r as A, s as j, t as M, u as N } from "./chunks/sub-DlD5e1ys.js";
7
+ export { p as ApiError, k as DEFAULT_SUB_APP_BASE, c as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, d as MicroAppView, m as RequestManager, j as SUB_APP_NAME, w as SUB_APP_THEME_CHANGE_EVENT, E as applySubAppTheme, n as configureMorningfastRequestClient, o as createApi, y as createMockLoginResult, b as createMockUserProfile, a as createMorningfastBaseRoutes, l as createMorningfastRouter, h as createRequestClient, N as createSubAppContext, C as createSubAppRouter, g as formatErrorMessage, f as http, s as mountMorningfastApp, A as mountSubApp, v as normalizeLoginResult, _ as normalizeUserProfile, r as requestManager, D as resolveSubAppBasePath, i as setupAuthExpiredHandler, T as subAppContextKey, t as useAppStore, x as useAuthStore, M as useRequestClient, O as useSubAppContext, S as useSystemStore, u as useTabsStore };
@@ -3,6 +3,7 @@ export { createMorningfastRouter } from './router';
3
3
  export type { CreateMorningfastRouterOptions } from './router';
4
4
  export { createMorningfastBaseRoutes } from './router/base-routes';
5
5
  export { mountMorningfastApp } from './app/create-app';
6
+ export { default as MicroAppView } from './pages/micro/MicroAppView.vue';
6
7
  export type { MountedMorningfastAppContext, MountMorningfastAppContext, MountMorningfastAppOptions, } from './app/create-app';
7
8
  export type { MorningfastAppConfig } from './app/runtime-config';
8
9
  export * from './api/client';
@@ -8,9 +8,9 @@ export interface AppConfigItem {
8
8
  basePath: string;
9
9
  entry: string;
10
10
  }
11
- export declare const DEFAULT_SUB_APPS: AppConfigItem[];
12
11
  export declare const MICRO_APP_CONTAINER_ID = "micro-app-container";
13
12
  export declare function getAppConfigs(): AppConfigItem[];
13
+ export declare function setDefaultAppConfigs(apps: AppConfigItem[]): void;
14
14
  export declare function saveAppConfigs(apps: AppConfigItem[]): Promise<void>;
15
15
  export declare function getMicroAppConfigs(apps: AppConfigItem[]): {
16
16
  id: string;
package/dist/main.js CHANGED
@@ -1,5 +1,4 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./chunks/main-B00aDVlh.js";
2
- import { a as u, i as d, n as f, r as p, t as m } from "./chunks/auth-C3RvRgcW.js";
3
- import { t as h } from "./chunks/system-BbMsTIBR.js";
4
- import { t as g } from "./chunks/app-Cn5iHmfI.js";
5
- export { n as HOME_TAB_PATH, a as configureMorningfastRequestClient, s as createApi, f as createMockLoginResult, p as createMockUserProfile, o as createMorningfastBaseRoutes, i as createMorningfastRouter, t as http, c as mountMorningfastApp, d as normalizeLoginResult, u as normalizeUserProfile, r as requestManager, l as setupAuthExpiredHandler, g as useAppStore, m as useAuthStore, h as useSystemStore, e as useTabsStore };
1
+ import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/main-Ln0xOplS.js";
2
+ import { a as f, i as p, n as m, r as h, t as g } from "./chunks/auth-C3RvRgcW.js";
3
+ import { t as _ } from "./chunks/system-BbMsTIBR.js";
4
+ export { s as HOME_TAB_PATH, u as MicroAppView, t as configureMorningfastRequestClient, a as createApi, m as createMockLoginResult, h as createMockUserProfile, i as createMorningfastBaseRoutes, c as createMorningfastRouter, d as http, o as mountMorningfastApp, p as normalizeLoginResult, f as normalizeUserProfile, n as requestManager, r as setupAuthExpiredHandler, e as useAppStore, g as useAuthStore, _ as useSystemStore, l as useTabsStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morningfast/platform",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Morningfast platform runtime for main and sub applications.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1 +0,0 @@
1
- .theme-icon-btn[data-v-73aaf569] .el-icon{justify-content:center;align-items:center;display:inline-flex}
@@ -1,253 +0,0 @@
1
- import { t as e } from "./app-Cn5iHmfI.js";
2
- import { t } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
3
- import { n, o as r, r as i, t as a } from "./config-MbLdbbb7.js";
4
- import { useRoute as o } from "vue-router";
5
- import { computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, nextTick as h, onBeforeUnmount as g, onMounted as _, openBlock as v, reactive as y, ref as b, resolveComponent as x, toDisplayString as S, unref as C, watch as w, withCtx as T } from "vue";
6
- import { Link as ee, RefreshRight as te, WarningFilled as E } from "@element-plus/icons-vue";
7
- import { addGlobalUncaughtErrorHandler as D, registerMicroApps as O, start as k } from "qiankun";
8
- //#region src/main/micro-apps/status.ts
9
- var A = y({}), j = y({});
10
- function ne() {
11
- return A;
12
- }
13
- function re(e) {
14
- return j[e];
15
- }
16
- function M(e) {
17
- return i(n()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
18
- }
19
- function N(e) {
20
- return A[e.name] || (A[e.name] = {
21
- name: e.name,
22
- title: e.title,
23
- entry: e.entry,
24
- activeRule: e.activeRule,
25
- status: "idle",
26
- updatedAt: Date.now()
27
- }, A[e.name]);
28
- }
29
- function P(e) {
30
- B(e, {
31
- status: "loading",
32
- message: void 0
33
- });
34
- }
35
- function F(e) {
36
- B(e, {
37
- status: "mounted",
38
- message: void 0
39
- });
40
- }
41
- function I(e, t) {
42
- V(e, {
43
- status: "error",
44
- message: H(t)
45
- });
46
- }
47
- function L(e, t) {
48
- let n = A[e];
49
- return n ? (n.status = "error", n.message = H(t), n.updatedAt = Date.now(), !0) : !1;
50
- }
51
- function R(e, t, n) {
52
- j[t] = {
53
- path: t,
54
- name: e.name,
55
- title: e.title,
56
- entry: e.entry,
57
- activeRule: e.activeRule,
58
- message: H(n),
59
- updatedAt: Date.now()
60
- };
61
- }
62
- function z(e) {
63
- delete j[e];
64
- }
65
- function B(e, t) {
66
- let n = A[e];
67
- n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
68
- }
69
- function V(e, t) {
70
- let n = N(e);
71
- n.title = e.title, n.entry = e.entry, n.activeRule = e.activeRule, n.status = t.status, n.message = t.message, n.updatedAt = Date.now();
72
- }
73
- function H(e) {
74
- let t = U(e);
75
- return t ? G(W(t)) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
76
- }
77
- function U(e) {
78
- return e instanceof Error ? e.message : typeof e == "string" ? e : "";
79
- }
80
- function W(e) {
81
- return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
82
- }
83
- function G(e) {
84
- let t = e.trim(), n = t.toLowerCase(), r = t.match(/application ['"]([^'"]+)['"]/)?.[1], i = r ? `子应用“${r}”` : "子应用";
85
- return n.includes("cannot use import statement outside a module") ? `${i}入口已响应,但脚本格式不是 qiankun 当前加载方式可执行的格式。请确认子应用使用 qiankun dev 模式启动,或检查子应用构建配置是否输出 qiankun 需要的入口格式;同时确认主应用配置的入口地址指向子应用 dev server,而不是普通静态文件地址。` : 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;
86
- }
87
- //#endregion
88
- //#region src/main/micro-apps/types.ts
89
- var K = "morningfast:theme-change", q = !1, J = !1;
90
- function Y() {
91
- if (q) {
92
- X();
93
- return;
94
- }
95
- q = !0;
96
- let e = i(n());
97
- e.forEach(N), O(e.map((e) => ({
98
- name: e.name,
99
- entry: e.entry,
100
- container: e.container,
101
- activeRule: e.activeRule,
102
- props: ie(e)
103
- })), {
104
- beforeLoad: [async (e) => {
105
- z(window.location.pathname), P(e.name);
106
- }],
107
- afterMount: [async (e) => {
108
- z(window.location.pathname), F(e.name);
109
- }]
110
- }), D((t) => {
111
- let n = t instanceof ErrorEvent ? t.error || t.message : t, r = Z(n) || Z(t);
112
- if (r && L(r, n)) {
113
- let t = e.find((e) => e.name === r);
114
- t && R(t, window.location.pathname, n);
115
- return;
116
- }
117
- e.forEach((e) => {
118
- (window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (I(e, n), R(e, window.location.pathname, n));
119
- });
120
- }), X(), ae();
121
- }
122
- function X() {
123
- J || document.querySelector("#micro-app-container") && (J = !0, k({
124
- prefetch: !1,
125
- sandbox: { experimentalStyleIsolation: !0 },
126
- urlRerouteOnly: !0
127
- }));
128
- }
129
- function Z(e) {
130
- return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
131
- }
132
- function ie(t) {
133
- let n = e();
134
- return {
135
- basePath: t.activeRule,
136
- app: r(t),
137
- runtime: {
138
- env: "production",
139
- apiBaseUrl: "/api"
140
- },
141
- theme: Q(n.isDark),
142
- getRuntimeProps: () => ({ theme: Q(n.isDark) })
143
- };
144
- }
145
- function ae() {
146
- let t = e();
147
- w(() => [
148
- t.isDark,
149
- t.themeColor,
150
- t.themeColorPosition
151
- ], () => {
152
- window.setTimeout(() => {
153
- oe(Q(t.isDark));
154
- }, 0);
155
- });
156
- }
157
- function oe(e) {
158
- window.dispatchEvent(new CustomEvent(K, { detail: e }));
159
- }
160
- function Q(e) {
161
- let t = getComputedStyle(document.documentElement);
162
- return {
163
- colorPrimary: $(t, "--el-color-primary", "#409EFF"),
164
- colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
165
- colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
166
- colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
167
- colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
168
- colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
169
- colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
170
- mode: e ? "dark" : "light"
171
- };
172
- }
173
- function $(e, t, n) {
174
- return e.getPropertyValue(t).trim() || n;
175
- }
176
- //#endregion
177
- //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
178
- var se = { class: "micro-app-page" }, ce = {
179
- key: 0,
180
- class: "micro-app-page__state micro-app-page__state--error"
181
- }, le = { class: "micro-app-page__body" }, ue = { class: "micro-app-page__desc" }, de = { class: "micro-app-page__meta" }, fe = { key: 0 }, pe = { key: 1 }, me = { key: 2 }, he = { class: "micro-app-page__actions" }, ge = ["id"], _e = /* @__PURE__ */ t(/* @__PURE__ */ m({
182
- name: "MicroAppView",
183
- __name: "MicroAppView",
184
- setup(e) {
185
- let t = o(), n = ne(), r = b(""), i = null, m = s(() => M(t.path)), y = s(() => {
186
- let e = m.value;
187
- return e ? n[e.name] : void 0;
188
- }), D = s(() => re(t.path)), O = s(() => y.value?.title || m.value?.title || D.value?.title || "未知子应用"), k = s(() => y.value?.entry || m.value?.entry || D.value?.entry || "-"), A = s(() => y.value?.message ? y.value.message : D.value?.message ? D.value.message : m.value ? "子应用暂时无法访问,请稍后重试。" : "当前路径没有匹配到子应用配置,请检查应用配置里的路由前缀。"), j = s(() => t.path.startsWith("/micro/")), N = s(() => y.value?.status === "error" || !!D.value || !!r.value || j.value && !m.value);
189
- w(() => t.path, () => {
190
- h(() => {
191
- Y(), P();
192
- });
193
- }, { immediate: !0 }), _(() => {
194
- h(() => {
195
- Y(), P();
196
- });
197
- }), w(() => y.value?.status, (e) => {
198
- e === "mounted" && (F(), r.value = "");
199
- }), g(() => {
200
- F();
201
- });
202
- function P() {
203
- F(), r.value = "", !(!j.value || !m.value) && (i = window.setTimeout(() => {
204
- y.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
205
- }, 15e3));
206
- }
207
- function F() {
208
- i !== null && (window.clearTimeout(i), i = null);
209
- }
210
- function I() {
211
- window.location.reload();
212
- }
213
- function L() {
214
- let e = k.value;
215
- e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
216
- }
217
- return (e, t) => {
218
- let n = x("el-icon"), i = x("el-button");
219
- return v(), u("div", se, [N.value ? (v(), u("div", ce, [p(n, { class: "micro-app-page__icon" }, {
220
- default: T(() => [p(C(E))]),
221
- _: 1
222
- }), d("div", le, [
223
- t[6] ||= d("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
224
- d("p", ue, S(A.value), 1),
225
- d("dl", de, [
226
- d("div", null, [t[0] ||= d("dt", null, "应用", -1), d("dd", null, S(O.value), 1)]),
227
- C(!1) ? (v(), u("div", fe, [t[1] ||= d("dt", null, "入口", -1), d("dd", null, S(k.value), 1)])) : l("", !0),
228
- y.value?.message ? (v(), u("div", pe, [t[2] ||= d("dt", null, "原因", -1), d("dd", null, S(y.value.message), 1)])) : r.value ? (v(), u("div", me, [t[3] ||= d("dt", null, "原因", -1), d("dd", null, S(r.value), 1)])) : l("", !0)
229
- ]),
230
- d("div", he, [p(i, {
231
- type: "primary",
232
- icon: C(te),
233
- onClick: I
234
- }, {
235
- default: T(() => [...t[4] ||= [f("重新加载", -1)]]),
236
- _: 1
237
- }, 8, ["icon"]), C(!1) && (y.value?.entry || m.value?.entry) ? (v(), c(i, {
238
- key: 0,
239
- icon: C(ee),
240
- onClick: L
241
- }, {
242
- default: T(() => [...t[5] ||= [f(" 打开入口 ", -1)]]),
243
- _: 1
244
- }, 8, ["icon"])) : l("", !0)])
245
- ])])) : l("", !0), d("section", {
246
- id: C(a),
247
- class: "micro-app-page__container"
248
- }, null, 8, ge)]);
249
- };
250
- }
251
- }), [["__scopeId", "data-v-90c11f85"]]);
252
- //#endregion
253
- export { _e as default };
@@ -1,221 +0,0 @@
1
- import { computed as e, ref as t } from "vue";
2
- import { defineStore as n } from "pinia";
3
- //#region src/main/utils/theme.ts
4
- var r = "theme-color", i = "theme-mode", a = "theme-position", o = [
5
- {
6
- label: "默认蓝",
7
- value: "#409EFF"
8
- },
9
- {
10
- label: "深蓝色",
11
- value: "#0960BE"
12
- },
13
- {
14
- label: "靛蓝色",
15
- value: "#045277"
16
- },
17
- {
18
- label: "天空蓝",
19
- value: "#78B5FE"
20
- },
21
- {
22
- label: "深绿色",
23
- value: "#0C522B"
24
- },
25
- {
26
- label: "翡翠绿",
27
- value: "#009773"
28
- },
29
- {
30
- label: "浅绿色",
31
- value: "#0BD092"
32
- },
33
- {
34
- label: "紫罗兰",
35
- value: "#7166F0"
36
- },
37
- {
38
- label: "樱花粉",
39
- value: "#FFB7C5"
40
- },
41
- {
42
- label: "柠檬黄",
43
- value: "#EFBD48"
44
- },
45
- {
46
- label: "橙黄色",
47
- value: "#C1420B"
48
- },
49
- {
50
- label: "玫瑰红",
51
- value: "#BB1B1B"
52
- },
53
- {
54
- label: "锌色灰",
55
- value: "#3F3F46"
56
- },
57
- {
58
- label: "中性灰",
59
- value: "#404040"
60
- },
61
- {
62
- label: "石板灰",
63
- value: "#344256"
64
- }
65
- ];
66
- function s() {
67
- return localStorage.getItem(r) || "#409EFF";
68
- }
69
- function c() {
70
- let e = localStorage.getItem(i);
71
- return e === "light" || e === "dark" || e === "system" ? e : "light";
72
- }
73
- function l(e) {
74
- localStorage.setItem(r, e);
75
- }
76
- function u(e) {
77
- localStorage.setItem(i, e);
78
- }
79
- function d() {
80
- let e = localStorage.getItem(a);
81
- return e === "none" || e === "header" || e === "sidebar" ? e : "none";
82
- }
83
- function f(e) {
84
- localStorage.setItem(a, e);
85
- }
86
- function p() {
87
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
88
- }
89
- function m(e) {
90
- return e === "dark" || e === "system" && p();
91
- }
92
- function h(e) {
93
- let t = m(e);
94
- document.documentElement.classList.toggle("dark", t), document.documentElement.style.colorScheme = t ? "dark" : "light";
95
- }
96
- function g(e) {
97
- let t = document.documentElement, n = t.classList.contains("dark");
98
- t.style.setProperty("--el-color-primary", e), t.style.setProperty("--el-color-primary-light-3", x(e, n ? "#000000" : "#ffffff", .3)), t.style.setProperty("--el-color-primary-light-5", x(e, n ? "#000000" : "#ffffff", .5)), t.style.setProperty("--el-color-primary-light-7", x(e, n ? "#000000" : "#ffffff", .7)), t.style.setProperty("--el-color-primary-light-8", x(e, n ? "#000000" : "#ffffff", .8)), t.style.setProperty("--el-color-primary-light-9", x(e, n ? "#000000" : "#ffffff", .9)), t.style.setProperty("--el-color-primary-dark-2", x(e, n ? "#ffffff" : "#000000", .2));
99
- }
100
- function _() {
101
- h(c()), g(s()), v(d());
102
- }
103
- function v(e) {
104
- document.documentElement.setAttribute("data-theme-position", e);
105
- }
106
- function y(e = 50) {
107
- return new Promise((t) => {
108
- setTimeout(() => {
109
- g(s()), t();
110
- }, e);
111
- });
112
- }
113
- async function b(e, t) {
114
- if (!document.startViewTransition) {
115
- t(), await y();
116
- return;
117
- }
118
- let n = e.clientX, r = e.clientY, i = Math.hypot(Math.max(n, innerWidth - n), Math.max(r, innerHeight - r));
119
- try {
120
- document.startViewTransition(() => {
121
- t();
122
- }).ready.then(() => {
123
- 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");
124
- document.documentElement.animate({ clipPath: c ? s.reverse() : s }, {
125
- duration: 400,
126
- easing: "ease-in",
127
- fill: "both",
128
- pseudoElement: c ? "::view-transition-old(root)" : "::view-transition-new(root)"
129
- });
130
- }), await y();
131
- } catch {
132
- t(), await y();
133
- }
134
- }
135
- function x(e, t, n) {
136
- let [r, i, a] = S(e), [o, s, c] = S(t), l = (e, t) => Math.round(e * (1 - n) + t * n);
137
- return `rgb(${l(r, o)}, ${l(i, s)}, ${l(a, c)})`;
138
- }
139
- function S(e) {
140
- let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
141
- return [
142
- r >> 16 & 255,
143
- r >> 8 & 255,
144
- r & 255
145
- ];
146
- }
147
- //#endregion
148
- //#region src/main/stores/app.ts
149
- var C = "sidebar-collapsed", w = "menu-search-placement", T = "layout-mode", E = "top-menu-path", D = n("app", () => {
150
- let n = t(localStorage.getItem(C) === "true"), r = t(!1), i = t("theme"), a = t(c()), o = t(s()), y = t(d()), b = t(localStorage.getItem(T) || "side"), x = t(localStorage.getItem(w) || "header"), S = t(localStorage.getItem(E) || ""), D = t(!0), O = e(() => m(a.value)), k = e(() => b.value === "top" ? ["header"] : ["header", "sidebar"]), A = e(() => b.value !== "top" && x.value === "sidebar");
151
- function j() {
152
- n.value = !n.value;
153
- }
154
- function M(e) {
155
- n.value = e, localStorage.setItem(C, String(n.value));
156
- }
157
- function N(e = "theme") {
158
- i.value = e, r.value = !0;
159
- }
160
- function P() {
161
- r.value = !1;
162
- }
163
- function F(e) {
164
- r.value = e;
165
- }
166
- function I(e) {
167
- a.value = e, u(e), h(e), g(o.value);
168
- }
169
- function L() {
170
- I(p() && a.value === "system" || O.value ? "light" : "dark");
171
- }
172
- function R(e) {
173
- o.value = e, l(e), g(e);
174
- }
175
- function z(e) {
176
- y.value = e, f(e), v(e);
177
- }
178
- function B(e) {
179
- b.value = e, localStorage.setItem(T, e), e === "top" && x.value === "sidebar" && V("header");
180
- }
181
- function V(e) {
182
- let t = b.value === "top" ? "header" : e;
183
- x.value = t, localStorage.setItem(w, t);
184
- }
185
- function H(e) {
186
- S.value = e, localStorage.setItem(E, e);
187
- }
188
- function U() {
189
- _();
190
- }
191
- return {
192
- closeSettings: P,
193
- initializePreferences: U,
194
- isDark: O,
195
- layoutMode: b,
196
- menuSearchPlacement: x,
197
- menuSearchPlacementOptions: k,
198
- openSettings: N,
199
- isSidebarMenuSearch: A,
200
- settingsActiveTab: i,
201
- selectedTopMenuPath: S,
202
- setLayoutMode: B,
203
- setMenuSearchPlacement: V,
204
- setSelectedTopMenuPath: H,
205
- setSettingsVisible: F,
206
- setSidebarCollapsed: M,
207
- setThemeColor: R,
208
- setThemeColorPosition: z,
209
- setThemeMode: I,
210
- settingsVisible: r,
211
- sidebarCollapsed: n,
212
- shortcutTipVisible: D,
213
- themeColor: o,
214
- themeColorPosition: y,
215
- themeMode: a,
216
- toggleDarkMode: L,
217
- toggleSidebar: j
218
- };
219
- });
220
- //#endregion
221
- export { b as n, o as r, D as t };