valaxy 0.20.3 → 0.20.5

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.
@@ -1,7 +1,8 @@
1
1
  import { isClient, useStorage } from '@vueuse/core'
2
2
  import { useI18n } from 'vue-i18n'
3
- import { setDefaultOptions } from 'date-fns'
4
- import { enUS, zhCN } from 'date-fns/locale'
3
+ import { setDefaultOptions } from 'date-fns/setDefaultOptions'
4
+ import { zhCN } from 'date-fns/locale/zh-CN'
5
+ import { enUS } from 'date-fns/locale/en-US'
5
6
 
6
7
  export function useLocale() {
7
8
  const { availableLocales, locale } = useI18n()
@@ -1 +1 @@
1
- export * from './fuse'
1
+ export * from './useFuseSearch'
@@ -1,4 +1,4 @@
1
- import { computed, onMounted, shallowRef } from 'vue'
1
+ import { computed, shallowRef } from 'vue'
2
2
  import { useSiteConfig } from 'valaxy'
3
3
  import type { MaybeRefOrGetter } from '@vueuse/shared'
4
4
  import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
@@ -31,12 +31,13 @@ export function useFuseSearch<T extends FuseListItem = FuseListItem>(
31
31
  // resultLimit: resultLimit.value,
32
32
  // matchAllWhenSearchEmpty: matchAllWhenSearchEmpty.value,
33
33
  }
34
+
34
35
  const useFuseOptions = computed<UseFuseOptions<T>>(() => ({
35
36
  ...defaultOptions,
36
37
  ...options,
37
38
  }))
38
39
 
39
- const ruse = useFuse<T>(search, fuseListData, useFuseOptions)
40
+ const { fuse, results } = useFuse<T>(search, fuseListData, useFuseOptions)
40
41
 
41
42
  async function fetchFuseListData(path?: string) {
42
43
  const fuseListDataPath = path
@@ -51,7 +52,10 @@ export function useFuseSearch<T extends FuseListItem = FuseListItem>(
51
52
  fuseListData.value = data
52
53
  }
53
54
 
54
- onMounted(fetchFuseListData)
55
+ return {
56
+ fuse,
57
+ results,
55
58
 
56
- return ruse
59
+ fetchFuseListData,
60
+ }
57
61
  }
@@ -1,6 +1,7 @@
1
1
  import type { ToDateOptionsWithTZ } from 'date-fns-tz'
2
2
  import { format as formatWithTZ, toZonedTime } from 'date-fns-tz'
3
- import { format, toDate } from 'date-fns'
3
+ import { format } from 'date-fns/format'
4
+ import { toDate } from 'date-fns/toDate'
4
5
  import { DateTime } from 'luxon'
5
6
  import type { Post } from '../../types'
6
7
  import { i18n } from '../modules/valaxy'