Package not found. Please check the package name and try again.

valaxy-theme-hairy 1.2.2 → 1.2.4

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.
@@ -26,7 +26,7 @@ function displayTag(tag: string) {
26
26
  p="1"
27
27
  @click="displayTag(key.toString())"
28
28
  >
29
- {{ key }}
29
+ {{ $t(key, {}, { missingWarn: false }) }}
30
30
  </a>
31
31
  </div>
32
32
  </div>
@@ -4,7 +4,6 @@ import dayjs from 'dayjs'
4
4
  import { withDefaults } from 'vue'
5
5
  import { last } from 'lodash-es'
6
6
  import { useRouter } from 'vue-router'
7
- import { useI18n } from 'vue-i18n'
8
7
  import { toArray } from '../../utils'
9
8
 
10
9
  withDefaults(
@@ -17,8 +16,6 @@ withDefaults(
17
16
  },
18
17
  )
19
18
 
20
- const i18n = useI18n()
21
-
22
19
  const router = useRouter()
23
20
 
24
21
  function displayCategory(keys: string | string[] = []) {
@@ -32,7 +29,7 @@ function displayCategory(keys: string | string[] = []) {
32
29
  {{ dayjs(post.date).format(format) }}
33
30
  </div>
34
31
  <HairyLink v-if="post.categories?.length" bordered type="white" @click="displayCategory(post.categories)">
35
- {{ i18n.t(last(toArray(post.categories)) || '') }}
32
+ {{ $t(last(toArray(post.categories)) || '', {}, { missingWarn: false }) }}
36
33
  </HairyLink>
37
34
  </div>
38
35
  <a class="cursor-pointer text-size-4" @click="$router.push(post.path || '')">{{ post.title }}</a>
@@ -3,7 +3,6 @@ import type { Post } from 'valaxy'
3
3
  import { computed, defineProps } from 'vue'
4
4
  import dayjs from 'dayjs'
5
5
  import { useRouter } from 'vue-router'
6
- import { useI18n } from 'vue-i18n'
7
6
  import { removeTags, toArray } from '../../utils'
8
7
  import { useLayoutPost } from '../../composables'
9
8
 
@@ -17,7 +16,6 @@ const layout = useLayoutPost()
17
16
  const slice = computed(() => layout.value.includes('slice'))
18
17
  const image = computed(() => props.post.image?.toString())
19
18
  const text = computed(() => removeTags(props.post.excerpt))
20
- const i18n = useI18n()
21
19
  function onReadMore() {
22
20
  if (props.post.path)
23
21
  router.push(props.post.path)
@@ -29,13 +27,15 @@ function displayCategory(keys: string | string[] = []) {
29
27
  </script>
30
28
 
31
29
  <template>
32
- <li class="HairyArticleImage mb-10 py-2" :class="[slice && 'slice', reverse && 'reverse']">
30
+ <li class="HairyArticleImage mb-10 py-2 lt-sm:mb-5 lt-md:mb-6" :class="[slice && 'slice', reverse && 'reverse']">
33
31
  <article>
34
32
  <div class="flex justify-between items-center">
35
33
  <a
36
- class="text-size-2xl font-bold truncate cursor-pointer lt-sm:text-size-lg"
34
+ class="text-size-2xl lt-sm:max-w-200px font-bold truncate cursor-pointer lt-sm:text-size-lg"
37
35
  :class="[reverse ? 'order-last' : 'order-first']" @click="onReadMore"
38
- >{{ post.title }}</a>
36
+ >
37
+ {{ post.title }}
38
+ </a>
39
39
  <div class="flex justify-end gap-2 text-size-sm lt-sm:text-size-xs">
40
40
  <span>{{ dayjs(post.date).format('YYYY-MM-DD') }}</span>
41
41
  <span>{{ post.wordCount }}字</span>
@@ -43,22 +43,22 @@ function displayCategory(keys: string | string[] = []) {
43
43
  </div>
44
44
  </div>
45
45
  <div
46
- class="h-200px lt-sm:h-150px flex bg-light-2 dark:bg-transparent rounded-5"
46
+ class="h-200px lt-sm:h-120px flex bg-light-2 dark:bg-transparent rounded-5"
47
47
  :class="[reverse ? 'pl-4' : 'pr-4']"
48
48
  >
49
49
  <div class="flex-1 post-image-content" :class="[reverse ? 'order-last' : 'order-first']">
50
50
  <img class="post-image rounded-1 w-full h-full object-cover cursor-pointer" :src="image" @click="onReadMore">
51
51
  </div>
52
- <div class="flex-1 flex flex-col justify-between py-2 dark:py-0">
52
+ <div class="flex-1 lt-md:flex-[1.2] flex flex-col justify-between py-2 dark:py-0">
53
53
  <div class="flex-1 text-size-sm">
54
- <div class="line-clamp-text">
54
+ <div class="line-clamp-text line-clamp-5 lt-sm:line-clamp-3">
55
55
  {{ text }}
56
56
  </div>
57
57
  </div>
58
58
  <div class="flex justify-between items-center">
59
- <a class="cursor-pointer" :class="[reverse && 'order-1']">
59
+ <a class="cursor-pointer truncate lt-sm:max-w-120px" :class="[reverse && 'order-1']">
60
60
  <span v-if="post.categories?.length" @click="displayCategory(post.categories)">
61
- {{ i18n.t(toArray(post.categories).at(-1) || '') }}
61
+ {{ $t(toArray(post.categories).at(-1) || '', {}, { missingWarn: false }) }}
62
62
  </span>
63
63
  </a>
64
64
  <div class="text-base leading-6 font-medium">
@@ -83,7 +83,6 @@ function displayCategory(keys: string | string[] = []) {
83
83
  display: -webkit-box;
84
84
  text-overflow: ellipsis;
85
85
  -webkit-box-orient: vertical;
86
- -webkit-line-clamp: 5;
87
86
  }
88
87
 
89
88
  .post-image {
@@ -57,6 +57,7 @@ async function changePost(path = '') {
57
57
  line-height: 28px;
58
58
  color: var(--va-c-text-light);
59
59
  white-space: nowrap;
60
+ overflow: hidden;
60
61
  text-overflow: ellipsis;
61
62
  transition: color 0.5s;
62
63
  cursor: pointer;
@@ -35,7 +35,7 @@ function displayCategory(keys: string | string[] = []) {
35
35
  最近更新:
36
36
  </div>
37
37
  <div class="flex-1 flex items-center justify-end gap-2 flex-wrap">
38
- <HairyLink :href="post.path">
38
+ <HairyLink class="truncate lt-sm:max-w-220px" :href="post.path">
39
39
  {{ post.title }}
40
40
  </HairyLink>
41
41
  <template v-if="post.tags?.length">
@@ -52,7 +52,7 @@ function displayCategory(keys: string | string[] = []) {
52
52
  class="dark:bg-dark-50 cursor-pointer border-none!"
53
53
  @click="$router.push(`/tags/${tag}`)"
54
54
  >
55
- {{ tag }}
55
+ {{ $t(tag, {}, { missingWarn: false }) }}
56
56
  </ElTag>
57
57
  </div>
58
58
  </div>
@@ -64,7 +64,7 @@ function displayCategory(keys: string | string[] = []) {
64
64
  <div class="lt-md:hidden flex items-center gap-2">
65
65
  <div class="i-material-symbols-folder-open-rounded text-14px" />
66
66
  <ElTag size="small" class="dark:bg-dark-50 cursor-pointer border-none!" @click="displayCategory(post.categories)">
67
- {{ toArray(post.categories).map($t).join('/') }}
67
+ {{ toArray(post.categories).map((v) => $t(v, {}, { missingWarn: false })).join('/') }}
68
68
  </ElTag>
69
69
  </div>
70
70
  </template>
package/layouts/post.vue CHANGED
@@ -34,7 +34,7 @@ function displayTag(tag: string) {
34
34
  </div>
35
35
  <div v-if="post.tags?.length" class="tags flex-center gap-2 mt-2">
36
36
  <ElTag v-for="(tag) in post.tags" :key="tag" class="dark:bg-dark-50 cursor-pointer" @click="displayTag(tag)">
37
- {{ tag }}
37
+ {{ $t(tag, {}, { missingWarn: false }) }}
38
38
  </ElTag>
39
39
  </div>
40
40
  </template>
@@ -6,7 +6,6 @@ import { createDeferred } from '../utils'
6
6
 
7
7
  let el: HTMLElement
8
8
 
9
-
10
9
  export const deferred = createDeferred<void>()
11
10
 
12
11
  export function install({ router }: ViteSSGContext) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-hairy",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "packageManager": "pnpm@8.15.8",
5
5
  "author": {
6
6
  "email": "wwu710632@gmail.com",
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed } from 'vue'
3
- import { useI18n } from 'vue-i18n'
4
3
  import { useRoute, useRouter } from 'vue-router'
5
4
  import { useThemeConfig } from 'valaxy'
6
5
  import { ElTimeline, ElTimelineItem } from 'element-plus'
@@ -19,8 +18,6 @@ const paths = computed(() => categories.value.split('/').filter(Boolean))
19
18
  const current = useCategory(paths)
20
19
  const posts = useCategoryPost(paths)
21
20
 
22
- const i18n = useI18n()
23
-
24
21
  function getBreadcrumbPath(index: number) {
25
22
  const paths = categories.value.split('/').filter(Boolean)
26
23
  if (paths[index] === paths[paths.length - 1])
@@ -42,12 +39,12 @@ function displayCategory(key: string) {
42
39
  全部
43
40
  </HairyBreadcrumbItem>
44
41
  <HairyBreadcrumbItem v-for="(key, index) in categories.split('/')" :key="key" :to="getBreadcrumbPath(index)">
45
- {{ i18n.t(key) }}
42
+ {{ $t(key, {}, { missingWarn: false }) }}
46
43
  </HairyBreadcrumbItem>
47
44
  </HairyBreadcrumb>
48
45
 
49
46
  <div class="grid__view dark:text-gray-3 flex-wrap">
50
- <template v-for="([key, item]) in current.children" :key="key">
47
+ <template v-for="([key]) in current.children" :key="key">
51
48
  <div
52
49
  v-if="!key.startsWith('/post')"
53
50
  class="relative flex items-center flex-col cursor-pointer hover:text-primary transition-colors"
@@ -55,11 +52,11 @@ function displayCategory(key: string) {
55
52
  >
56
53
  <div class="i-material-symbols-folder-open-rounded text-22 lt-sm:text-15" />
57
54
  <div class="text-center leading-normal">
58
- {{ i18n.t(key) }}
55
+ {{ $t(key, {}, { missingWarn: false }) }}
59
56
  </div>
60
- <div class="badge text-12px right-20px top-12px">
57
+ <!-- <div class="badge text-12px right-20px top-12px">
61
58
  {{ item.total }} dir
62
- </div>
59
+ </div> -->
63
60
  </div>
64
61
  </template>
65
62
  </div>
@@ -4,7 +4,7 @@ import { usePostList } from 'valaxy'
4
4
  import { ElTimeline, ElTimelineItem } from 'element-plus'
5
5
  import { useRoute } from 'vue-router'
6
6
 
7
- const tag = computed(() => useRoute().params.tag)
7
+ const tag = computed(() => useRoute().params.tag as string)
8
8
 
9
9
  const posts = computed<any[]>(() =>
10
10
  usePostList().value.filter(post => post.tags?.includes(tag.value as string)),
@@ -17,7 +17,7 @@ const posts = computed<any[]>(() =>
17
17
  首页
18
18
  </HairyBreadcrumbItem>
19
19
  <HairyBreadcrumbItem>
20
- {{ tag }}
20
+ {{ $t(tag, {}, { missingWarn: false }) }}
21
21
  </HairyBreadcrumbItem>
22
22
  </HairyBreadcrumb>
23
23
  <ElTimeline>