valaxy 0.18.5 → 0.18.7

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,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, onBeforeMount } from 'vue'
2
+ import { computed } from 'vue'
3
3
  import { useHead, useSeoMeta } from '@unhead/vue'
4
4
 
5
5
  // @ts-expect-error virtual module
@@ -10,7 +10,6 @@ import ValaxyThemeApp from '/@valaxyjs/ThemeAppVue'
10
10
  import pkg from 'valaxy/package.json'
11
11
  import { useI18n } from 'vue-i18n'
12
12
  import { definePerson, defineWebPage, defineWebSite, useSchemaOrg } from '@unhead/schema-org'
13
- import dayjs from 'dayjs'
14
13
 
15
14
  // https://github.com/vueuse/head
16
15
  // you can use this to manipulate the document head in any components,
@@ -97,11 +96,6 @@ useSchemaOrg([
97
96
  }),
98
97
  defineWebPage(),
99
98
  ])
100
-
101
- onBeforeMount(() => {
102
- if (siteConfig.value.timezone)
103
- dayjs.tz.setDefault(siteConfig.value.timezone)
104
- })
105
99
  </script>
106
100
 
107
101
  <template>
@@ -3,7 +3,13 @@ import { computed, unref } from 'vue'
3
3
  import type { Post } from '../../types'
4
4
  import { useSiteStore } from '../stores'
5
5
 
6
+ /**
7
+ * 基础分类
8
+ */
6
9
  export interface BaseCategory {
10
+ /**
11
+ * 分类下的文章数量
12
+ */
7
13
  total: number
8
14
  }
9
15
 
@@ -14,7 +14,6 @@ export * from './locale'
14
14
 
15
15
  export * from './sidebar'
16
16
  export * from './outline'
17
- export * from './body-scroll-lock'
18
17
 
19
18
  // utils
20
19
  export * from './back'
@@ -1,12 +1,13 @@
1
1
  import { isClient, useStorage } from '@vueuse/core'
2
2
  import { useI18n } from 'vue-i18n'
3
- import dayjs from 'dayjs'
4
- import 'dayjs/locale/zh-cn'
3
+ import { setDefaultOptions } from 'date-fns'
4
+ import { enUS, zhCN } from 'date-fns/locale'
5
5
 
6
6
  export function useLocale() {
7
7
  const { availableLocales, locale } = useI18n()
8
8
  const lang = useStorage('valaxy-locale', locale.value)
9
- dayjs.locale(lang.value.toLowerCase())
9
+ // set date locale
10
+ setDefaultOptions({ locale: locale.value === 'zh-CN' ? zhCN : enUS })
10
11
 
11
12
  const toggleLocales = () => {
12
13
  // change to some real logic
@@ -16,8 +17,8 @@ export function useLocale() {
16
17
  // for localStorage
17
18
  lang.value = locale.value
18
19
 
19
- // set dayjs locale
20
- dayjs.locale(lang.value.toLowerCase())
20
+ // set date locale
21
+ setDefaultOptions({ locale: locale.value === 'zh-CN' ? zhCN : enUS })
21
22
 
22
23
  if (isClient)
23
24
  document.documentElement.setAttribute('lang', locale.value)
@@ -49,7 +49,7 @@ post:
49
49
  view_link: 查看链接
50
50
  read_more: 阅读更多
51
51
  cover: 封面
52
- time_warning: 本文最后更新于{ago},文中所描述的信息可能已发生改变。
52
+ time_warning: '本文最后更新于{ago},文中所描述的信息可能已发生改变。'
53
53
  copyright:
54
54
  author: 本文作者
55
55
  link: 本文链接
@@ -1,11 +1,5 @@
1
1
  /* __imports__ */
2
2
  import type { ViteSSGContext } from 'vite-ssg'
3
-
4
- import dayjs from 'dayjs'
5
- import relativeTime from 'dayjs/plugin/relativeTime'
6
- import utc from 'dayjs/plugin/utc'
7
- import timezone from 'dayjs/plugin/timezone'
8
-
9
3
  import type { ComputedRef } from 'vue'
10
4
 
11
5
  // import type { RouteMeta } from 'vue-router'
@@ -32,11 +26,6 @@ export default function setupMain(ctx: ViteSSGContext, config: ComputedRef<Valax
32
26
  installPinia(ctx)
33
27
  installNprogress(ctx)
34
28
 
35
- // dayjs
36
- dayjs.extend(relativeTime)
37
- dayjs.extend(utc)
38
- dayjs.extend(timezone)
39
-
40
29
  if (import.meta.env.DEV && ctx.isClient) {
41
30
  import('../modules/devtools').then(({ install: installDevtools }) => {
42
31
  setTimeout(() => {
@@ -33,8 +33,8 @@ $colors: map.merge(
33
33
  $c-primary: map.get($colors, "primary") !default;
34
34
  $colors: map.merge(
35
35
  (
36
- "primary-light": color.adjust($c-primary, $lightness: 15%),
37
- "primary-lighter": color.adjust($c-primary, $lightness: 30%),
36
+ "primary-light": color.adjust($c-primary, $lightness: 10%),
37
+ "primary-lighter": color.adjust($c-primary, $lightness: 20%),
38
38
  "primary-dark": color.adjust($c-primary, $lightness: -5%),
39
39
  ),
40
40
  $colors
@@ -1,5 +1,11 @@
1
1
  export interface ScrollToOptions {
2
+ /**
3
+ * 平滑滚动
4
+ */
2
5
  smooth: boolean
6
+ /**
7
+ * 滚动目标的 padding
8
+ */
3
9
  targetPadding: number
4
10
  }
5
11
 
@@ -1,17 +1,13 @@
1
- import dayjs from 'dayjs'
2
- import timezone from 'dayjs/plugin/timezone'
1
+ import { format } from 'date-fns'
3
2
  import type { Post } from '../../types'
4
3
 
5
- dayjs.extend(timezone)
6
-
7
4
  /**
8
- * use dayjs format date
5
+ * date-fns format date
9
6
  * @param date
10
7
  * @param template
11
8
  */
12
- export function formatDate(date: string | number | Date, template = 'YYYY-MM-DD') {
13
- const today = dayjs.tz(date)
14
- return today.format(template)
9
+ export function formatDate(date: string | number | Date, template = 'yyyy-MM-dd') {
10
+ return format(date, template)
15
11
  }
16
12
 
17
13
  /**