@morningfast/platform 0.0.6 → 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-CfTD1njJ.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';
@@ -1,5 +1,5 @@
1
1
  import { MicroAppConfig, MicroAppInfo } from './types';
2
- export declare const DEFAULT_SUB_APP_ENTRY = "http://localhost:5174";
2
+ export declare const DEFAULT_SUB_APP_ENTRY = "http://localhost:8082";
3
3
  export interface AppConfigItem {
4
4
  id: string;
5
5
  name: string;
@@ -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-CfTD1njJ.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.6",
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,249 +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-DkMAgPn_.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 ee, 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";
6
- import { Link as te, RefreshRight as T, WarningFilled as ne } from "@element-plus/icons-vue";
7
- import { addGlobalUncaughtErrorHandler as E, registerMicroApps as D, start as O } from "qiankun";
8
- //#region src/main/micro-apps/status.ts
9
- var k = v({}), A = v({});
10
- function j() {
11
- return k;
12
- }
13
- function M(e) {
14
- return A[e];
15
- }
16
- function N(e) {
17
- return i(n()).find((t) => e === t.activeRule || e.startsWith(`${t.activeRule}/`));
18
- }
19
- function P(e) {
20
- return k[e.name] || (k[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
- }, k[e.name]);
28
- }
29
- function F(e) {
30
- V(e, {
31
- status: "loading",
32
- message: void 0
33
- });
34
- }
35
- function I(e) {
36
- V(e, {
37
- status: "mounted",
38
- message: void 0
39
- });
40
- }
41
- function L(e, t) {
42
- H(e, {
43
- status: "error",
44
- message: U(t)
45
- });
46
- }
47
- function R(e, t) {
48
- let n = k[e];
49
- return n ? (n.status = "error", n.message = U(t), n.updatedAt = Date.now(), !0) : !1;
50
- }
51
- function z(e, t, n) {
52
- A[t] = {
53
- path: t,
54
- name: e.name,
55
- title: e.title,
56
- entry: e.entry,
57
- activeRule: e.activeRule,
58
- message: U(n),
59
- updatedAt: Date.now()
60
- };
61
- }
62
- function B(e) {
63
- delete A[e];
64
- }
65
- function V(e, t) {
66
- let n = k[e];
67
- n && (n.status = t.status, n.message = t.message, n.updatedAt = Date.now());
68
- }
69
- function H(e, t) {
70
- let n = P(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 U(e) {
74
- let t = W(e);
75
- return t ? G(t) : "子应用入口不可访问、服务未启动,或加载过程中发生异常。";
76
- }
77
- function W(e) {
78
- return e instanceof Error ? e.message : typeof e == "string" ? e : "";
79
- }
80
- function G(e) {
81
- return e.trim().replace(/^(application ['"][^'"]+['"] died in status [A-Z_]+:\s*)\1+/, "$1");
82
- }
83
- //#endregion
84
- //#region src/main/micro-apps/types.ts
85
- var K = "morningfast:theme-change", q = !1, J = !1;
86
- function Y() {
87
- if (q) {
88
- X();
89
- return;
90
- }
91
- q = !0;
92
- let e = i(n());
93
- e.forEach(P), D(e.map((e) => ({
94
- name: e.name,
95
- entry: e.entry,
96
- container: e.container,
97
- activeRule: e.activeRule,
98
- props: re(e)
99
- })), {
100
- beforeLoad: [async (e) => {
101
- B(window.location.pathname), F(e.name);
102
- }],
103
- afterMount: [async (e) => {
104
- B(window.location.pathname), I(e.name);
105
- }]
106
- }), E((t) => {
107
- let n = t instanceof ErrorEvent ? t.error || t.message : t, r = Z(n) || Z(t);
108
- if (r && R(r, n)) {
109
- let t = e.find((e) => e.name === r);
110
- t && z(t, window.location.pathname, n);
111
- return;
112
- }
113
- e.forEach((e) => {
114
- (window.location.pathname === e.activeRule || window.location.pathname.startsWith(`${e.activeRule}/`)) && (L(e, n), z(e, window.location.pathname, n));
115
- });
116
- }), X(), ie();
117
- }
118
- function X() {
119
- J || document.querySelector("#micro-app-container") && (J = !0, O({
120
- prefetch: !1,
121
- sandbox: { experimentalStyleIsolation: !0 },
122
- urlRerouteOnly: !0
123
- }));
124
- }
125
- function Z(e) {
126
- return (e instanceof Error ? e.message : String(e || "")).match(/application ['"]?([^'"\s]+)['"]?/i)?.[1];
127
- }
128
- function re(t) {
129
- let n = e();
130
- return {
131
- basePath: t.activeRule,
132
- app: r(t),
133
- runtime: {
134
- env: "production",
135
- apiBaseUrl: "/api"
136
- },
137
- theme: Q(n.isDark),
138
- getRuntimeProps: () => ({ theme: Q(n.isDark) })
139
- };
140
- }
141
- function ie() {
142
- let t = e();
143
- C(() => [
144
- t.isDark,
145
- t.themeColor,
146
- t.themeColorPosition
147
- ], () => {
148
- window.setTimeout(() => {
149
- ae(Q(t.isDark));
150
- }, 0);
151
- });
152
- }
153
- function ae(e) {
154
- window.dispatchEvent(new CustomEvent(K, { detail: e }));
155
- }
156
- function Q(e) {
157
- let t = getComputedStyle(document.documentElement);
158
- return {
159
- colorPrimary: $(t, "--el-color-primary", "#409EFF"),
160
- colorPrimaryLight3: $(t, "--el-color-primary-light-3", "#79bbff"),
161
- colorPrimaryLight5: $(t, "--el-color-primary-light-5", "#a0cfff"),
162
- colorPrimaryLight7: $(t, "--el-color-primary-light-7", "#c6e2ff"),
163
- colorPrimaryLight8: $(t, "--el-color-primary-light-8", "#d9ecff"),
164
- colorPrimaryLight9: $(t, "--el-color-primary-light-9", "#ecf5ff"),
165
- colorPrimaryDark2: $(t, "--el-color-primary-dark-2", "#337ecc"),
166
- mode: e ? "dark" : "light"
167
- };
168
- }
169
- function $(e, t, n) {
170
- return e.getPropertyValue(t).trim() || n;
171
- }
172
- //#endregion
173
- //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
174
- var oe = { class: "micro-app-page" }, se = {
175
- key: 0,
176
- class: "micro-app-page__state micro-app-page__state--error"
177
- }, ce = { class: "micro-app-page__body" }, le = { class: "micro-app-page__desc" }, ue = { class: "micro-app-page__meta" }, de = { key: 0 }, fe = { key: 1 }, pe = { key: 2 }, me = { class: "micro-app-page__actions" }, he = ["id"], ge = /* @__PURE__ */ t(/* @__PURE__ */ m({
178
- name: "MicroAppView",
179
- __name: "MicroAppView",
180
- setup(e) {
181
- let t = o(), n = j(), r = y(""), i = null, m = s(() => N(t.path)), v = s(() => {
182
- let e = m.value;
183
- return e ? n[e.name] : void 0;
184
- }), E = s(() => M(t.path)), D = s(() => v.value?.title || m.value?.title || E.value?.title || "未知子应用"), O = s(() => v.value?.entry || m.value?.entry || E.value?.entry || "-"), k = s(() => v.value?.message ? v.value.message : E.value?.message ? E.value.message : m.value ? "子应用暂时无法访问,请稍后重试。" : "当前路径没有匹配到子应用配置,请检查应用配置里的路由前缀。"), A = s(() => t.path.startsWith("/micro/")), P = s(() => v.value?.status === "error" || !!E.value || !!r.value || A.value && !m.value);
185
- C(() => t.path, () => {
186
- h(() => {
187
- Y(), F();
188
- });
189
- }, { immediate: !0 }), ee(() => {
190
- h(() => {
191
- Y(), F();
192
- });
193
- }), C(() => v.value?.status, (e) => {
194
- e === "mounted" && (I(), r.value = "");
195
- }), g(() => {
196
- I();
197
- });
198
- function F() {
199
- I(), r.value = "", !(!A.value || !m.value) && (i = window.setTimeout(() => {
200
- v.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
201
- }, 15e3));
202
- }
203
- function I() {
204
- i !== null && (window.clearTimeout(i), i = null);
205
- }
206
- function L() {
207
- window.location.reload();
208
- }
209
- function R() {
210
- let e = O.value;
211
- e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
212
- }
213
- return (e, t) => {
214
- let n = b("el-icon"), i = b("el-button");
215
- return _(), u("div", oe, [P.value ? (_(), u("div", se, [p(n, { class: "micro-app-page__icon" }, {
216
- default: w(() => [p(S(ne))]),
217
- _: 1
218
- }), d("div", ce, [
219
- t[6] ||= d("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
220
- d("p", le, x(k.value), 1),
221
- d("dl", ue, [
222
- d("div", null, [t[0] ||= d("dt", null, "应用", -1), d("dd", null, x(D.value), 1)]),
223
- S(!1) ? (_(), u("div", de, [t[1] ||= d("dt", null, "入口", -1), d("dd", null, x(O.value), 1)])) : l("", !0),
224
- v.value?.message ? (_(), u("div", fe, [t[2] ||= d("dt", null, "原因", -1), d("dd", null, x(v.value.message), 1)])) : r.value ? (_(), u("div", pe, [t[3] ||= d("dt", null, "原因", -1), d("dd", null, x(r.value), 1)])) : l("", !0)
225
- ]),
226
- d("div", me, [p(i, {
227
- type: "primary",
228
- icon: S(T),
229
- onClick: L
230
- }, {
231
- default: w(() => [...t[4] ||= [f("重新加载", -1)]]),
232
- _: 1
233
- }, 8, ["icon"]), S(!1) && (v.value?.entry || m.value?.entry) ? (_(), c(i, {
234
- key: 0,
235
- icon: S(te),
236
- onClick: R
237
- }, {
238
- default: w(() => [...t[5] ||= [f(" 打开入口 ", -1)]]),
239
- _: 1
240
- }, 8, ["icon"])) : l("", !0)])
241
- ])])) : l("", !0), d("section", {
242
- id: S(a),
243
- class: "micro-app-page__container"
244
- }, null, 8, he)]);
245
- };
246
- }
247
- }), [["__scopeId", "data-v-90c11f85"]]);
248
- //#endregion
249
- export { ge 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 };