valaxy-theme-yun 0.24.5 → 0.25.1

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,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { CategoryList, Post } from 'valaxy'
3
- import { useInvisibleElement } from 'valaxy'
3
+ import { useInvisibleElement, useValaxyI18n } from 'valaxy'
4
4
  import { onMounted, ref } from 'vue'
5
5
  import { useI18n } from 'vue-i18n'
6
6
  import { useRouter } from 'vue-router'
@@ -25,6 +25,7 @@ const router = useRouter()
25
25
 
26
26
  const collapse = ref(props.collapsable)
27
27
  const { t } = useI18n()
28
+ const { $t } = useValaxyI18n()
28
29
 
29
30
  const postCollapseElRef = ref<HTMLElement>()
30
31
  const { show } = useInvisibleElement(postCollapseElRef)
@@ -79,7 +80,7 @@ if (props.level === 1) {
79
80
  @click="jumpToDisplayCategory(parentKey)"
80
81
  >
81
82
  <span>
82
- {{ category.name === 'Uncategorized' ? t('category.uncategorized') : category.name }}
83
+ {{ category.name === 'Uncategorized' ? t('category.uncategorized') : $t(category.name) }}
83
84
  </span>
84
85
  <span class="rounded-full px-1.5 bg-black/5 shadow-sm op-60" text="xs">
85
86
  {{ category.total }}
@@ -1,8 +1,6 @@
1
1
  <script setup lang="ts">
2
- import type { Post } from 'valaxy'
3
- import { isCategoryList, tObject } from 'valaxy'
2
+ import { isCategoryList, useValaxyI18n } from 'valaxy'
4
3
  import { computed } from 'vue'
5
- import { useI18n } from 'vue-i18n'
6
4
  import { useRoute } from 'vue-router'
7
5
 
8
6
  defineProps<{
@@ -14,10 +12,8 @@ defineProps<{
14
12
  /**
15
13
  * i18n
16
14
  */
17
- const { locale } = useI18n()
18
- function getTitle(post: Post | any) {
19
- return tObject(post.title || '', locale.value)
20
- }
15
+ const { $tO } = useValaxyI18n()
16
+
21
17
  const route = useRoute()
22
18
  const categoryList = computed(() => {
23
19
  const c = (route.query.category as string) || ''
@@ -42,7 +38,7 @@ const categoryList = computed(() => {
42
38
  hover="bg-black/5"
43
39
  >
44
40
  <div i-ri-file-text-line />
45
- <span font="serif black">{{ getTitle(categoryItem) }}</span>
41
+ <span class="st-text">{{ $tO(categoryItem.title) }}</span>
46
42
  </RouterLink>
47
43
  </template>
48
44
  </template>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useSiteConfig, useValaxyConfig, useValaxyDark } from 'valaxy'
2
+ import { useSiteConfig, useValaxyConfig, useValaxyDark, useValaxyI18n } from 'valaxy'
3
3
  import pkg from 'valaxy/package.json'
4
4
  import { capitalize, computed } from 'vue'
5
5
  import { useI18n } from 'vue-i18n'
@@ -21,6 +21,7 @@ const gradientStyles = computed(() => {
21
21
  })
22
22
 
23
23
  const { t } = useI18n()
24
+ const { $t } = useValaxyI18n()
24
25
  const config = useValaxyConfig()
25
26
  const siteConfig = useSiteConfig()
26
27
  const themeConfig = useThemeConfig()
@@ -72,7 +73,7 @@ const footerIcon = computed(() => themeConfig.value.footer.icon || {
72
73
  >
73
74
  <div :class="footerIcon.name" />
74
75
  </a>
75
- <span>{{ siteConfig.author.name }}</span>
76
+ <span>{{ $t(siteConfig.author.name) }}</span>
76
77
  </div>
77
78
 
78
79
  <div v-if="themeConfig.footer.powered" class="powered" m="2">
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import { useValaxyI18n } from 'valaxy'
2
3
  import { ref } from 'vue'
3
4
  import { useYunSpringAnimation } from '../composables/animation'
4
5
 
@@ -8,6 +9,8 @@ const props = defineProps<{
8
9
  count: number
9
10
  }>()
10
11
 
12
+ const { $t } = useValaxyI18n()
13
+
11
14
  const tagRef = ref<HTMLElement>()
12
15
  useYunSpringAnimation(tagRef, {
13
16
  i: props.i || 0,
@@ -21,7 +24,7 @@ useYunSpringAnimation(tagRef, {
21
24
  inline-flex my="2" p="1"
22
25
  class="post-tag cursor-pointer items-baseline leading-4"
23
26
  >
24
- <span inline-flex>#{{ title }}</span>
27
+ <span inline-flex>#{{ $t(title) }}</span>
25
28
  <span inline-flex text="xs">[{{ count }}]</span>
26
29
  </span>
27
30
  </template>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Post } from 'valaxy'
3
- import { tObject } from 'valaxy'
3
+ import { useValaxyI18n } from 'valaxy'
4
4
  import { computed, ref } from 'vue'
5
5
  import { useI18n } from 'vue-i18n'
6
6
  import { usePostProperty } from '../composables'
@@ -9,7 +9,8 @@ const props = defineProps<{
9
9
  post: Post
10
10
  }>()
11
11
 
12
- const { t, locale } = useI18n()
12
+ const { t } = useI18n()
13
+ const { $tO } = useValaxyI18n()
13
14
 
14
15
  const { icon, styles, color } = usePostProperty(props.post.type)
15
16
 
@@ -20,10 +21,6 @@ const postTitleClass = computed(() => {
20
21
  }
21
22
  return props.post.postTitleClass || gradientClasses.value
22
23
  })
23
-
24
- const postTitle = computed(() => {
25
- return tObject(props.post.title || '', locale.value)
26
- })
27
24
  </script>
28
25
 
29
26
  <template>
@@ -44,7 +41,7 @@ const postTitle = computed(() => {
44
41
  loading="lazy"
45
42
  >
46
43
 
47
- <div class="flex flex-col items-center relative" :class="post.cover && 'h-54'" w="full">
44
+ <div class="flex flex-col items-center relative px-6" :class="post.cover && 'h-54'" w="full">
48
45
  <AppLink
49
46
  class="post-title-link cursor-pointer"
50
47
  :to="post.path || ''"
@@ -56,7 +53,7 @@ const postTitle = computed(() => {
56
53
  text="center" font="serif black"
57
54
  >
58
55
  <div v-if="post.type" class="inline-flex" m="r-1" :class="icon" />
59
- <span>{{ postTitle }}</span>
56
+ <span>{{ $tO(post.title) }}</span>
60
57
  </div>
61
58
  </AppLink>
62
59
 
@@ -86,7 +83,7 @@ const postTitle = computed(() => {
86
83
 
87
84
  <!-- always show -->
88
85
  <div
89
- w="full" class="yun-card-actions flex justify-between"
86
+ w="full" class="yun-card-actions flex justify-between px-6"
90
87
  min-h="10"
91
88
  text="sm"
92
89
  >
@@ -1,9 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Post } from 'valaxy'
3
+ import { useValaxyI18n } from 'valaxy'
3
4
 
4
5
  defineProps<{
5
6
  categories: Post['categories']
6
7
  }>()
8
+
9
+ const { $t } = useValaxyI18n()
7
10
  </script>
8
11
 
9
12
  <template>
@@ -19,7 +22,7 @@ defineProps<{
19
22
  >
20
23
  <div m="x-1" inline-flex i-ri-folder-2-line />
21
24
  <span>
22
- {{ Array.isArray(categories) ? categories.join(' / ') : categories }}
25
+ {{ Array.isArray(categories) ? categories.map($t).join(' / ') : $t(categories || '') }}
23
26
  </span>
24
27
  </RouterLink>
25
28
  </template>
@@ -1,10 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import type { Post } from 'valaxy'
3
3
  import { useMotion } from '@vueuse/motion'
4
- import { formatDate, tObject } from 'valaxy'
5
- import { computed, ref } from 'vue'
6
-
7
- import { useI18n } from 'vue-i18n'
4
+ import { formatDate, useValaxyI18n } from 'valaxy'
5
+ import { ref } from 'vue'
8
6
 
9
7
  const props = defineProps<{
10
8
  i: number
@@ -29,10 +27,7 @@ useMotion(itemRef, {
29
27
  },
30
28
  })
31
29
 
32
- const { locale } = useI18n()
33
- const postTitle = computed(() => {
34
- return tObject(props.post.title || '', locale.value)
35
- })
30
+ const { $tO } = useValaxyI18n()
36
31
  </script>
37
32
 
38
33
  <template>
@@ -55,7 +50,7 @@ const postTitle = computed(() => {
55
50
  </div>
56
51
  <h2 class="post-title w-full" inline-flex items-center font="serif black">
57
52
  <RouterLink :to="post.path || ''" class="post-title-link">
58
- {{ postTitle }}
53
+ {{ $tO(post.title) }}
59
54
  </RouterLink>
60
55
  </h2>
61
56
  </header>
@@ -1,9 +1,12 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Post } from 'valaxy'
3
+ import { useValaxyI18n } from 'valaxy'
3
4
 
4
5
  defineProps<{
5
6
  tags: Post['tags']
6
7
  }>()
8
+
9
+ const { $t } = useValaxyI18n()
7
10
  </script>
8
11
 
9
12
  <template>
@@ -19,7 +22,7 @@ defineProps<{
19
22
  border
20
23
  hover="bg-blue-500 text-white"
21
24
  >
22
- <span>{{ tag }}</span>
25
+ <span>{{ $t(tag) }}</span>
23
26
  </RouterLink>
24
27
  </div>
25
28
  </template>
@@ -16,7 +16,7 @@ function togglePopup() {
16
16
 
17
17
  const algoliaRef = ref()
18
18
  onMounted(() => {
19
- // algolia has its own hotkey
19
+ // algolia has its own hotkey handling in YunAlgoliaSearch component
20
20
  if (isFuse.value)
21
21
  useHotKey('k', togglePopup)
22
22
  })
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" setup>
2
+ import { useValaxyI18n } from 'valaxy'
2
3
  import { useThemeConfig } from '../composables'
3
4
 
4
5
  const themeConfig = useThemeConfig()
6
+ const { $t } = useValaxyI18n()
5
7
  </script>
6
8
 
7
9
  <template>
@@ -9,7 +11,8 @@ const themeConfig = useThemeConfig()
9
11
  <AppLink
10
12
  v-for="item, i in themeConfig.pages" :key="i"
11
13
  class="link-item yun-icon-btn" inline-flex
12
- :to="item.url" :title="item.name"
14
+ :to="item.url"
15
+ :title="$t(item.name)"
13
16
  :style="`color:${item.color}`"
14
17
  >
15
18
  <div :class="item.icon" class="icon size-6" />
@@ -1,8 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import { useSiteConfig } from 'valaxy'
3
- import { useI18n } from 'vue-i18n'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
4
3
 
5
- const { t } = useI18n()
4
+ const { $t } = useValaxyI18n()
6
5
  const siteConfig = useSiteConfig()
7
6
  </script>
8
7
 
@@ -16,14 +15,14 @@ const siteConfig = useSiteConfig()
16
15
  <YunAuthorName />
17
16
  <YunSiteTitle />
18
17
  <h4
19
- v-if="siteConfig.subtitle"
18
+ v-if="$t(siteConfig.subtitle)"
20
19
  class="site-subtitle block"
21
20
  text="xs"
22
21
  >
23
- {{ t(siteConfig.subtitle) }}
22
+ {{ $t(siteConfig.subtitle) }}
24
23
  </h4>
25
24
  <div v-if="siteConfig.description" class="site-description">
26
- {{ t(siteConfig.description) }}
25
+ {{ $t(siteConfig.description) }}
27
26
  </div>
28
27
  </div>
29
28
  </template>
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import type { SocialLink } from 'valaxy/types'
3
- import { useAppStore } from 'valaxy'
3
+ import { useAppStore, useValaxyI18n } from 'valaxy'
4
4
  import { computed } from 'vue'
5
5
 
6
6
  const props = defineProps<{
7
7
  social: SocialLink
8
8
  }>()
9
9
 
10
+ const { $t } = useValaxyI18n()
11
+
10
12
  const appStore = useAppStore()
11
13
  const color = computed(() => {
12
14
  return (appStore.isDark && props.social.color === 'black') ? 'white' : props.social.color
@@ -16,7 +18,7 @@ const color = computed(() => {
16
18
  <template>
17
19
  <a
18
20
  class="links-of-author-item yun-icon-btn"
19
- rel="noopener" :href="social.link" :title="social.name"
21
+ rel="noopener" :href="social.link" :title="$t(social.name)"
20
22
  target="_blank"
21
23
  :style="`color:${color}`"
22
24
  >
@@ -1,9 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import { useSiteConfig } from 'valaxy'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
3
3
  import { computed, ref } from 'vue'
4
4
  import { useI18n } from 'vue-i18n'
5
5
 
6
6
  const { t } = useI18n()
7
+ const { $t } = useValaxyI18n()
7
8
 
8
9
  const siteConfig = useSiteConfig()
9
10
  const showQr = ref(false)
@@ -35,7 +36,7 @@ const sponsorBtnTitle = computed(() => {
35
36
  :href="method.url" target="_blank"
36
37
  :style="`color:${method.color}`"
37
38
  >
38
- <img class="sponsor-method-img" border="~ rounded" p="1" loading="lazy" :src="method.url" :title="method.name">
39
+ <img class="sponsor-method-img" border="~ rounded" p="1" loading="lazy" :src="method.url" :title="$t(method.name)">
39
40
  <div text="xl" m="2" :class="method.icon" />
40
41
  </a>
41
42
  </div>
@@ -1,13 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { useSiteConfig } from 'valaxy'
3
- import { useI18n } from 'vue-i18n'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
4
3
 
5
4
  const siteConfig = useSiteConfig()
6
- const { t } = useI18n()
5
+ const { $t } = useValaxyI18n()
7
6
  </script>
8
7
 
9
8
  <template>
10
9
  <div v-if="siteConfig.author.intro" class="site-author-intro" m="t-0 b-4">
11
- {{ t(siteConfig.author.intro) }}
10
+ {{ $t(siteConfig.author.intro) }}
12
11
  </div>
13
12
  </template>
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { useSiteConfig } from 'valaxy'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
3
3
 
4
4
  const siteConfig = useSiteConfig()
5
+ const { $t } = useValaxyI18n()
5
6
  </script>
6
7
 
7
8
  <template>
@@ -9,6 +10,6 @@ const siteConfig = useSiteConfig()
9
10
  class="site-author-name font-black font-serif text-$va-c-text op-80 hover:op-100 flex-center"
10
11
  to="/about"
11
12
  >
12
- {{ siteConfig.author.name }}
13
+ {{ $t(siteConfig.author.name) }}
13
14
  </RouterLink>
14
15
  </template>
@@ -1,11 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { useFrontmatter, useSiteConfig } from 'valaxy'
2
+ import { useFrontmatter, useSiteConfig, useValaxyI18n } from 'valaxy'
3
3
  import { computed, ref, watch } from 'vue'
4
- import { useI18n } from 'vue-i18n'
5
4
  import { useRoute, useRouter } from 'vue-router'
6
5
  import { useYunAppStore } from '../../stores'
7
6
 
8
- const { t } = useI18n()
7
+ const { $t, $tO } = useValaxyI18n()
9
8
 
10
9
  const yunApp = useYunAppStore()
11
10
  const fm = useFrontmatter()
@@ -64,14 +63,14 @@ function goToLink() {
64
63
  class="size-4"
65
64
  :class="fm.icon || 'i-ri-article-line'"
66
65
  />
67
- <span class="truncate"> {{ fm.title }}</span>
66
+ <span class="truncate"> {{ $tO(fm.title || '') }}</span>
68
67
  </div>
69
68
  <span v-if="fm.subtitle" class="font-light op-80">
70
- {{ fm.subtitle }}
69
+ {{ $tO(fm.subtitle || '') }}
71
70
  </span>
72
71
  </div>
73
72
  <span v-if="showSiteTitle" class="font-light truncate">
74
- {{ t(siteConfig.title) }}
73
+ {{ $t(siteConfig.title) }}
75
74
  </span>
76
75
  </div>
77
76
  </template>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useMotion } from '@vueuse/motion'
3
- import { ref } from 'vue'
3
+ import { useValaxyI18n } from 'valaxy/client'
4
+ import { computed, ref } from 'vue'
4
5
 
5
6
  const props = defineProps<{
6
7
  social: {
@@ -12,7 +13,7 @@ const props = defineProps<{
12
13
  // animation
13
14
  delay: number
14
15
  }>()
15
-
16
+ const { $t } = useValaxyI18n()
16
17
  const iconRef = ref<HTMLElement>()
17
18
  useMotion(iconRef, {
18
19
  initial: {
@@ -34,18 +35,20 @@ useMotion(iconRef, {
34
35
  },
35
36
  },
36
37
  })
38
+
39
+ const socialName = computed(() => $t(props.social.name))
37
40
  </script>
38
41
 
39
42
  <template>
40
43
  <div
41
- v-tooltip="social.name"
44
+ v-tooltip="socialName"
42
45
  class="size-10 inline-flex-center"
43
46
  >
44
47
  <a
45
48
  ref="iconRef"
46
49
  class="prologue-social-icon inline-flex-center w-full h-full text-white bg-$c-brand hover:bg-white hover:text-$c-brand"
47
50
  rel="noopener"
48
- :href="social.link" :title="social.name"
51
+ :href="social.link" :title="socialName"
49
52
  target="_blank"
50
53
  :style="`--c-brand:${social.color}`"
51
54
  >
@@ -1,8 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
+ import { useI18n } from 'vue-i18n'
4
+
3
5
  import { useThemeConfig } from '../../composables'
4
6
 
5
7
  const themeConfig = useThemeConfig()
8
+ const { t } = useI18n()
6
9
 
7
10
  const showContent = ref(false)
8
11
  </script>
@@ -79,7 +82,7 @@ const showContent = ref(false)
79
82
  >
80
83
  <YunSiteLinkItem
81
84
  :page="{
82
- name: '博客文章',
85
+ name: t('menu.posts'),
83
86
  icon: 'i-ri-article-line',
84
87
  url: '/posts/',
85
88
  }"
@@ -1,13 +1,12 @@
1
1
  <script setup lang="ts">
2
- import { useSiteConfig } from 'valaxy'
3
- import { useI18n } from 'vue-i18n'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
4
3
 
5
4
  const siteConfig = useSiteConfig()
6
- const { t } = useI18n()
5
+ const { $t } = useValaxyI18n()
7
6
  </script>
8
7
 
9
8
  <template>
10
9
  <div v-if="siteConfig.description" class="site-description text-$va-c-text text-sm">
11
- {{ t(siteConfig.description) }}
10
+ {{ $t(siteConfig.description) }}
12
11
  </div>
13
12
  </template>
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import type { PageProps } from '../../types'
3
+ import { useValaxyI18n } from 'valaxy'
3
4
  import { useYunAppStore } from '../../stores'
4
5
 
5
6
  defineProps<{
6
7
  page: PageProps
7
8
  }>()
8
9
 
10
+ const { $t } = useValaxyI18n()
11
+
9
12
  const yunApp = useYunAppStore()
10
13
  </script>
11
14
 
@@ -14,14 +17,15 @@ const yunApp = useYunAppStore()
14
17
  class="link-item inline-flex-center gap-2 transition rounded-lg text-xl p-2 md:(text-lg p-2) lg:(text-xl p-3) text-$va-c-text"
15
18
  bg="white/5 dark:black/5"
16
19
  inline-flex
17
- :to="page.url" :title="page.name"
20
+ :to="page.url"
21
+ :title="$t(page.name)"
18
22
  :style="`color:${page.color}`"
19
23
  hover="bg-white/80 dark:bg-black/80"
20
24
  @click="yunApp.fullscreenMenu.isOpen = false"
21
25
  >
22
26
  <div :class="page.icon" class="icon" />
23
27
  <span>
24
- {{ page.name }}
28
+ {{ $t(page.name) }}
25
29
  </span>
26
30
  </AppLink>
27
31
  </template>
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
- import { useSiteConfig } from 'valaxy'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
3
3
 
4
+ const { $t } = useValaxyI18n()
4
5
  const siteConfig = useSiteConfig()
5
6
  </script>
6
7
 
@@ -9,6 +10,6 @@ const siteConfig = useSiteConfig()
9
10
  v-if="siteConfig.subtitle"
10
11
  class="site-subtitle block text-$va-c-text op-80 font-medium" text="sm"
11
12
  >
12
- {{ siteConfig.subtitle }}
13
+ {{ $t(siteConfig.subtitle) }}
13
14
  </h4>
14
15
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useSiteConfig } from 'valaxy'
3
- import { useI18n } from 'vue-i18n'
2
+ import { useSiteConfig, useValaxyI18n } from 'valaxy'
4
3
  import { useRouter } from 'vue-router'
5
4
  import { useThemeConfig } from '../../composables'
6
5
 
@@ -8,8 +7,7 @@ const router = useRouter()
8
7
  const siteConfig = useSiteConfig()
9
8
  const themeConfig = useThemeConfig()
10
9
 
11
- const { t } = useI18n()
12
-
10
+ const { $t } = useValaxyI18n()
13
11
  // bg-gradient-to-r gradient-text from-#1e3c72 to-dark dark:(from-#66a6ff to-blue-500)
14
12
  </script>
15
13
 
@@ -19,14 +17,14 @@ const { t } = useI18n()
19
17
  class="site-name text-lg leading-loose"
20
18
  :class="themeConfig.banner.siteNameClass"
21
19
  >
22
- {{ t(siteConfig.title) }}
20
+ {{ $t(siteConfig.title) }}
23
21
  </RouterLink>
24
22
  <span
25
23
  v-else
26
24
  class="site-name text-lg leading-loose"
27
25
  :class="themeConfig.banner.siteNameClass"
28
26
  >
29
- {{ t(siteConfig.title) }}
27
+ {{ $t(siteConfig.title) }}
30
28
  </span>
31
29
  </template>
32
30
 
@@ -1,10 +1,14 @@
1
1
  <script setup lang="ts">
2
- import { useAppStore, useSiteConfig } from 'valaxy'
2
+ import { useAppStore, useSiteConfig, useValaxyI18n } from 'valaxy'
3
3
  import { onMounted, ref, watch } from 'vue'
4
+ import { useI18n } from 'vue-i18n'
4
5
  import { useRoute } from 'vue-router'
5
6
  import { useThemeConfig } from '../../../composables'
6
7
  import { useYunAppStore } from '../../../stores'
7
8
 
9
+ const { t } = useI18n()
10
+ const { $t } = useValaxyI18n()
11
+
8
12
  // const app = useAppStore()
9
13
  const yunApp = useYunAppStore()
10
14
  const siteConfig = useSiteConfig()
@@ -60,7 +64,7 @@ const app = useAppStore()
60
64
  <template v-if="yunApp.size.isLg">
61
65
  <YunNavMenuItem
62
66
  icon="i-ri-article-line" to="/posts/"
63
- title="博客文章"
67
+ :title="t('menu.posts')"
64
68
  />
65
69
 
66
70
  <YunNavMenuItem
@@ -68,7 +72,7 @@ const app = useAppStore()
68
72
  :key="i"
69
73
  :icon="item.icon"
70
74
  :to="item.link"
71
- :title="item.text"
75
+ :title="$t(item.text)"
72
76
  />
73
77
  </template>
74
78
  </div>
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { isEmptyAddon } from 'valaxy'
3
3
  import * as addonAlgolia from 'valaxy-addon-algolia'
4
+ import { onMounted, onUnmounted } from 'vue'
4
5
 
5
6
  defineProps<{
6
7
  open: boolean
@@ -16,6 +17,40 @@ defineExpose({
16
17
  load,
17
18
  dispatchEvent,
18
19
  })
20
+
21
+ function isEditingContent(event: KeyboardEvent): boolean {
22
+ const element = event.target as HTMLElement
23
+ const tagName = element.tagName
24
+
25
+ return (
26
+ element.isContentEditable
27
+ || tagName === 'INPUT'
28
+ || tagName === 'SELECT'
29
+ || tagName === 'TEXTAREA'
30
+ )
31
+ }
32
+
33
+ onMounted(() => {
34
+ const handleSearchHotKey = (event: KeyboardEvent) => {
35
+ if (
36
+ (event.key?.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey))
37
+ || (!isEditingContent(event) && event.key === '/')
38
+ ) {
39
+ event.preventDefault()
40
+ load()
41
+ // eslint-disable-next-line ts/no-use-before-define
42
+ remove()
43
+ }
44
+ }
45
+
46
+ const remove = () => {
47
+ window.removeEventListener('keydown', handleSearchHotKey)
48
+ }
49
+
50
+ window.addEventListener('keydown', handleSearchHotKey)
51
+
52
+ onUnmounted(remove)
53
+ })
19
54
  </script>
20
55
 
21
56
  <template>
package/layouts/post.vue CHANGED
@@ -2,20 +2,19 @@
2
2
  import { defineArticle, useSchemaOrg } from '@unhead/schema-org/vue'
3
3
 
4
4
  import dayjs from 'dayjs'
5
- import { tObject, useFrontmatter, useSiteConfig } from 'valaxy'
6
- import { useI18n } from 'vue-i18n'
5
+ import { useFrontmatter, useSiteConfig, useValaxyI18n } from 'valaxy'
7
6
 
8
7
  const siteConfig = useSiteConfig()
9
8
  const frontmatter = useFrontmatter()
10
9
 
11
- const { locale } = useI18n()
10
+ const { $t, $tO } = useValaxyI18n()
12
11
  const article: Parameters<typeof defineArticle>[0] = {
13
12
  '@type': 'BlogPosting',
14
- 'headline': tObject(frontmatter.value.title || '', locale.value),
15
- 'description': tObject(frontmatter.value.description || '', locale.value),
13
+ 'headline': $tO(frontmatter.value.title),
14
+ 'description': $tO(frontmatter.value.description),
16
15
  'author': [
17
16
  {
18
- name: siteConfig.value.author.name,
17
+ name: $t(siteConfig.value.author.name),
19
18
  url: siteConfig.value.author.link,
20
19
  },
21
20
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
3
  "type": "module",
4
- "version": "0.24.5",
4
+ "version": "0.25.1",
5
5
  "author": {
6
6
  "email": "me@yunyoujun.cn",
7
7
  "name": "YunYouJun",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/animejs": "^3.1.13",
35
- "valaxy": "0.24.5",
35
+ "valaxy": "0.25.1",
36
36
  "valaxy-addon-waline": "0.2.1"
37
37
  },
38
38
  "scripts": {
package/styles/main.scss CHANGED
@@ -8,9 +8,10 @@ $c-primary: #0078e7 !default;
8
8
  );
9
9
 
10
10
  // override the default style of star-markdown-css
11
+ @use "./animations/index.scss" as *;
11
12
  @use "./common/button.scss" as *;
12
13
  @use "./common/markdown.scss" as *;
14
+ // valaxy client styles
13
15
  @use 'valaxy/client/styles/components/code.scss' as *;
14
16
  @use 'valaxy/client/styles/components/code-group.scss' as *;
15
17
  @use 'valaxy/client/styles/components/custom-block.scss' as *;
16
- @use "./animations/index.scss" as *;