valaxy 0.7.5 → 0.7.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/client/App.vue CHANGED
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
  import { useHead } from '@vueuse/head'
4
- import { useCssVar } from '@vueuse/core'
5
4
  import { isDark } from './composables'
6
5
 
7
6
  // https://github.com/vueuse/head
@@ -27,11 +26,6 @@ useHead({
27
26
  },
28
27
  ],
29
28
  })
30
-
31
- const bgImg = useCssVar('--yun-bg-img')
32
- const bgImgUrl = computed(() => config.value.themeConfig.bg_image.url)
33
- if (bgImgUrl.value)
34
- bgImg.value = config.value.themeConfig.bg_image.url
35
29
  </script>
36
30
 
37
31
  <template>
@@ -10,6 +10,7 @@ export * from './helper'
10
10
  export * from './dark'
11
11
  export * from './layout'
12
12
  export * from './widgets'
13
+ export * from './locale'
13
14
 
14
15
  export * from './sidebar'
15
16
 
@@ -0,0 +1,24 @@
1
+ import { isClient, useStorage } from '@vueuse/core'
2
+ import { useI18n } from 'vue-i18n'
3
+
4
+ export const useLocale = () => {
5
+ const { availableLocales, locale } = useI18n()
6
+ const lang = useStorage('valaxy-locale', locale.value)
7
+
8
+ const toggleLocales = () => {
9
+ // change to some real logic
10
+ const locales = availableLocales
11
+
12
+ locale.value = locales[(locales.indexOf(locale.value) + 1) % locales.length]
13
+ // for localStorage
14
+ lang.value = locale.value
15
+
16
+ if (isClient)
17
+ document.documentElement.setAttribute('lang', locale.value)
18
+ }
19
+
20
+ return {
21
+ lang,
22
+ toggleLocales,
23
+ }
24
+ }
package/client/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export * from './config'
2
2
 
3
3
  export * from './composables'
4
+ export * from './stores/app'
5
+
4
6
  export * from './utils'
5
7
 
6
8
  export * from './setups'
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ // avoid compiled in index.d.ts
2
+ export * from './client'