mamba-layout 0.6.0 → 0.8.0
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 +22 -26
- package/dist/layout/hooks/index.js +9 -13
- package/dist/layout/hooks/useSetting.js +11 -9
- package/dist/layout/hooks/useTheme.d.ts +6 -10
- package/dist/layout/hooks/useTheme.js +31 -38
- package/dist/layout.es.js +5734 -5735
- package/dist/layout.global.js +30 -30
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as t } from "./layout/BaseLayout.vue.js";
|
|
2
2
|
import { useApp as a } from "./layout/hooks/useApp.js";
|
|
3
|
-
import { injectLayoutContext as
|
|
4
|
-
import {
|
|
5
|
-
import { provideSetting as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
11
|
-
import { messages as
|
|
3
|
+
import { injectLayoutContext as s, provideLayoutContext as m, useStateHook as p } from "./layout/hooks/useState.js";
|
|
4
|
+
import { useTheme as x } from "./layout/hooks/useTheme.js";
|
|
5
|
+
import { provideSetting as n, useSetting as i } from "./layout/hooks/useSetting.js";
|
|
6
|
+
import { default as y } from "./components/UserAvatar/src/UserAvatar.vue.js";
|
|
7
|
+
import { default as S } from "./layout/components/LayoutBreadcrumb.vue.js";
|
|
8
|
+
import { default as g } from "./layout/components/TimezoneSelect.vue.js";
|
|
9
|
+
import { default as A } from "./layout/components/UserInfo.vue.js";
|
|
10
|
+
import { default as C } from "./locales/index.js";
|
|
11
|
+
import { messages as U } from "./locales/messages.js";
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
T as provideSetting,
|
|
24
|
-
n as setTheme,
|
|
25
|
-
i as syncThemeFromSetting,
|
|
26
|
-
d as toggleTheme,
|
|
13
|
+
t as BaseLayout,
|
|
14
|
+
S as LayoutBreadcrumb,
|
|
15
|
+
g as TimezoneSelect,
|
|
16
|
+
y as UserAvatar,
|
|
17
|
+
A as UserInfo,
|
|
18
|
+
C as i18n,
|
|
19
|
+
s as injectLayoutContext,
|
|
20
|
+
U as messages,
|
|
21
|
+
m as provideLayoutContext,
|
|
22
|
+
n as provideSetting,
|
|
27
23
|
a as useApp,
|
|
28
|
-
|
|
24
|
+
i as useSetting,
|
|
29
25
|
p as useStateHook,
|
|
30
|
-
|
|
26
|
+
x as useTheme
|
|
31
27
|
};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { useApp as o } from "./useApp.js";
|
|
2
|
-
import { provideSetting as
|
|
3
|
-
import { injectLayoutContext as
|
|
4
|
-
import {
|
|
2
|
+
import { provideSetting as p, useSetting as u } from "./useSetting.js";
|
|
3
|
+
import { injectLayoutContext as i, provideLayoutContext as m, useStateHook as n } from "./useState.js";
|
|
4
|
+
import { useTheme as s } from "./useTheme.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
m as provideSetting,
|
|
10
|
-
h as setTheme,
|
|
11
|
-
T as syncThemeFromSetting,
|
|
12
|
-
f as toggleTheme,
|
|
6
|
+
i as injectLayoutContext,
|
|
7
|
+
m as provideLayoutContext,
|
|
8
|
+
p as provideSetting,
|
|
13
9
|
o as useApp,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
u as useSetting,
|
|
11
|
+
n as useStateHook,
|
|
12
|
+
s as useTheme
|
|
17
13
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { unref as m, ref as
|
|
1
|
+
import { unref as m, ref as s } from "vue";
|
|
2
2
|
import { deepMerge as u } from "../../utils/repoUtils.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useTheme as a } from "./useTheme.js";
|
|
4
4
|
import { setLayoutStyle as i } from "../utils/index.js";
|
|
5
|
-
const t =
|
|
5
|
+
const t = s({
|
|
6
6
|
menus: [],
|
|
7
7
|
layout: "classic",
|
|
8
8
|
title: "",
|
|
@@ -10,15 +10,17 @@ const t = n({
|
|
|
10
10
|
tabs: "tab",
|
|
11
11
|
pageType: "common"
|
|
12
12
|
});
|
|
13
|
-
function
|
|
13
|
+
function c() {
|
|
14
14
|
return t;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
const e =
|
|
16
|
+
const v = (o) => {
|
|
17
|
+
const e = c(), r = o && m(o) || {};
|
|
18
18
|
if (!(e != null && e.value)) return r;
|
|
19
|
-
t.value = u(e.value, r)
|
|
19
|
+
t.value = u(e.value, r);
|
|
20
|
+
const { syncThemeFromSetting: n } = a();
|
|
21
|
+
n(), i(t.value);
|
|
20
22
|
};
|
|
21
23
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
v as provideSetting,
|
|
25
|
+
c as useSetting
|
|
24
26
|
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
export type ThemeMode = "light" | "dark";
|
|
2
|
-
export declare function initTheme(fallback?: ThemeMode): ThemeMode;
|
|
3
|
-
export declare function setTheme(value: ThemeMode, options?: {
|
|
4
|
-
persist?: boolean;
|
|
5
|
-
}): void;
|
|
6
|
-
export declare function toggleTheme(): void;
|
|
7
|
-
export declare function syncThemeFromSetting(value?: ThemeMode): void;
|
|
8
2
|
export declare function useTheme(): {
|
|
9
3
|
theme: import('vue').Ref<ThemeMode, ThemeMode>;
|
|
10
4
|
isDark: import('vue').ComputedRef<boolean>;
|
|
11
|
-
initTheme:
|
|
12
|
-
setTheme:
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
initTheme: (fallback?: ThemeMode) => ThemeMode;
|
|
6
|
+
setTheme: (value: ThemeMode, options?: {
|
|
7
|
+
persist?: boolean;
|
|
8
|
+
}) => void;
|
|
9
|
+
toggleTheme: () => void;
|
|
10
|
+
syncThemeFromSetting: (value?: ThemeMode) => void;
|
|
15
11
|
};
|
|
@@ -1,44 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Storage as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
!n.value && e && i(e, { persist: !1 });
|
|
27
|
-
}
|
|
28
|
-
function w() {
|
|
1
|
+
import { ref as m, computed as E } from "vue";
|
|
2
|
+
import { Storage as l } from "../../utils/repoUtils.js";
|
|
3
|
+
const r = m("light");
|
|
4
|
+
function M() {
|
|
5
|
+
const o = "theme", u = "(prefers-color-scheme: dark)", n = m(!1);
|
|
6
|
+
let i = !1;
|
|
7
|
+
const d = (e) => e === "dark" || e === "light" ? e : null, f = () => typeof window > "u" || typeof window.matchMedia != "function" ? "light" : window.matchMedia(u).matches ? "dark" : "light", h = (e) => {
|
|
8
|
+
const t = d(l.get(o, null));
|
|
9
|
+
return t ? (n.value = !0, t) : e || f();
|
|
10
|
+
}, c = (e) => {
|
|
11
|
+
typeof document > "u" || document.documentElement.classList.toggle("dark", e === "dark");
|
|
12
|
+
}, a = (e) => {
|
|
13
|
+
const t = h(e);
|
|
14
|
+
return r.value = t, c(t), i = !0, t;
|
|
15
|
+
}, s = (e, t) => {
|
|
16
|
+
r.value = e, c(e), (t == null ? void 0 : t.persist) !== !1 && (l.set(o, e, null), n.value = !0);
|
|
17
|
+
}, T = () => {
|
|
18
|
+
s(r.value === "dark" ? "light" : "dark");
|
|
19
|
+
}, g = (e) => {
|
|
20
|
+
if (!i) {
|
|
21
|
+
a(e);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
!n.value && e && s(e, { persist: !1 });
|
|
25
|
+
}, k = E(() => r.value === "dark");
|
|
29
26
|
return {
|
|
30
27
|
theme: r,
|
|
31
|
-
isDark:
|
|
32
|
-
initTheme:
|
|
33
|
-
setTheme:
|
|
34
|
-
toggleTheme:
|
|
35
|
-
syncThemeFromSetting:
|
|
28
|
+
isDark: k,
|
|
29
|
+
initTheme: a,
|
|
30
|
+
setTheme: s,
|
|
31
|
+
toggleTheme: T,
|
|
32
|
+
syncThemeFromSetting: g
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
35
|
export {
|
|
39
|
-
|
|
40
|
-
i as setTheme,
|
|
41
|
-
k as syncThemeFromSetting,
|
|
42
|
-
g as toggleTheme,
|
|
43
|
-
w as useTheme
|
|
36
|
+
M as useTheme
|
|
44
37
|
};
|