@inzombieland/nuxt-common 1.16.16 → 1.16.17
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { defineNuxtModule, createResolver, addServerHandler, addImportsDir, addPlugin, addComponent } from '@nuxt/kit';
|
|
3
3
|
|
|
4
4
|
const name = "@inzombieland/nuxt-common";
|
|
5
|
-
const version = "1.16.
|
|
5
|
+
const version = "1.16.17";
|
|
6
6
|
|
|
7
7
|
const module = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { StyleProvider, Themes } from "@varlet/ui"
|
|
3
3
|
import { useLocalStorage } from "@vueuse/core"
|
|
4
4
|
import { useI18n, useLocalePath } from "#i18n"
|
|
5
5
|
import { useNuxtApp } from "#imports"
|
|
6
|
-
import { setNotifyDefaultOptions, Locale as VantLocale, type ConfigProviderTheme } from "vant"
|
|
7
|
-
import enUS from "vant/es/locale/lang/en-US"
|
|
8
|
-
import ruRU from "vant/es/locale/lang/ru-RU"
|
|
9
6
|
import { onMounted, ref, watch } from "vue"
|
|
10
7
|
import { useRouter } from "vue-router"
|
|
11
8
|
import { getVisitorId, getVisitorIdentifier } from "./api"
|
|
12
9
|
import { useActiveSessions } from "./composables/use-active-sessions"
|
|
13
10
|
import { useUserActions } from "./composables/use-user-actions"
|
|
14
11
|
import { useSubscribe, useUser } from "./packages/api"
|
|
12
|
+
import type { ConfigProviderTheme } from "vant"
|
|
15
13
|
import "@vant/touch-emulator"
|
|
16
14
|
|
|
17
15
|
const theme = useLocalStorage("theme", "")
|
|
@@ -54,6 +52,17 @@ onMounted(() => {
|
|
|
54
52
|
if (!theme) {
|
|
55
53
|
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
|
|
56
54
|
}
|
|
55
|
+
|
|
56
|
+
if (theme === "dark") {
|
|
57
|
+
document.documentElement.classList.remove("light", "van-theme-light")
|
|
58
|
+
document.documentElement.classList.add("dark", "van-theme-dark")
|
|
59
|
+
StyleProvider(Themes.dark)
|
|
60
|
+
} else {
|
|
61
|
+
document.documentElement.classList.remove("dark", "van-theme-dark")
|
|
62
|
+
document.documentElement.classList.add("light", "van-theme-light")
|
|
63
|
+
StyleProvider(null)
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
if ($mobileApp?.changeTheme && typeof $mobileApp.changeTheme === "function") {
|
|
58
67
|
$mobileApp.changeTheme({ theme })
|
|
59
68
|
}
|
|
@@ -63,21 +72,12 @@ onMounted(() => {
|
|
|
63
72
|
|
|
64
73
|
watch(
|
|
65
74
|
locale,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
VantLocale.use(locale.value, ruRU)
|
|
69
|
-
VarletLocale.add("en-US", VarletLocale.enUS)
|
|
70
|
-
} else {
|
|
71
|
-
VantLocale.use(locale.value, enUS)
|
|
72
|
-
VarletLocale.add("en-US", VarletLocale.enUS)
|
|
73
|
-
}
|
|
74
|
-
setLocale(locale.value as "en" | "ru")
|
|
75
|
+
locale => {
|
|
76
|
+
setLocale(locale as "en" | "ru")
|
|
75
77
|
},
|
|
76
78
|
{ immediate: true }
|
|
77
79
|
)
|
|
78
80
|
|
|
79
|
-
setNotifyDefaultOptions({ position: "bottom" })
|
|
80
|
-
|
|
81
81
|
appLoading.value = false
|
|
82
82
|
})
|
|
83
83
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Locale as VarletLocale } from "@varlet/ui";
|
|
2
2
|
import { useLocalStorage } from "@vueuse/core";
|
|
3
|
+
import { setNotifyDefaultOptions, Locale as VantLocale } from "vant";
|
|
4
|
+
import enUS from "vant/es/locale/lang/en-US";
|
|
5
|
+
import ruRU from "vant/es/locale/lang/ru-RU";
|
|
3
6
|
import { watch } from "vue";
|
|
4
7
|
import { createApiFetch } from "./api-client.mjs";
|
|
5
8
|
import bus from "./bus.mjs";
|
|
@@ -49,23 +52,19 @@ export function initApiFetch($fetch, config) {
|
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
watch(
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (theme2 === "dark") {
|
|
58
|
-
document.documentElement.classList.remove("light", "van-theme-light");
|
|
59
|
-
document.documentElement.classList.add("dark", "van-theme-dark");
|
|
60
|
-
StyleProvider(Themes.dark);
|
|
55
|
+
locale,
|
|
56
|
+
(locale2) => {
|
|
57
|
+
if (locale2 === "ru") {
|
|
58
|
+
VantLocale.use(locale2, ruRU);
|
|
59
|
+
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
61
60
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
StyleProvider(null);
|
|
61
|
+
VantLocale.use(locale2, enUS);
|
|
62
|
+
VarletLocale.add("en-US", VarletLocale.enUS);
|
|
65
63
|
}
|
|
66
64
|
},
|
|
67
65
|
{ immediate: true }
|
|
68
66
|
);
|
|
67
|
+
setNotifyDefaultOptions({ position: "bottom" });
|
|
69
68
|
}
|
|
70
69
|
return { fetch, getUser, getVisitorIdentifier, useApiFetch, userActions };
|
|
71
70
|
}
|