valaxy-theme-yun 0.13.8 → 0.13.10
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/components/YunPostCard.vue +2 -14
- package/components/YunPostCategories.vue +20 -0
- package/components/YunPostCategoriesAndTags.vue +17 -0
- package/components/YunPostList.vue +4 -3
- package/components/YunPostTags.vue +14 -0
- package/components/YunSidebarNav.vue +4 -3
- package/layouts/archives.vue +3 -3
- package/layouts/categories.vue +4 -3
- package/layouts/post.vue +1 -1
- package/layouts/tags.vue +3 -3
- package/package.json +2 -2
- package/stores/app.ts +10 -0
@@ -57,24 +57,12 @@ const { icon, styles } = usePostProperty(props.post.type)
|
|
57
57
|
<!-- always show -->
|
58
58
|
<div w="full" class="yun-card-actions flex justify-between" border="t" text="sm">
|
59
59
|
<div class="inline-flex">
|
60
|
-
<
|
61
|
-
:to="{
|
62
|
-
path: '/categories/',
|
63
|
-
query: { category: Array.isArray(post.categories) ? post.categories[post.categories.length - 1] : post.categories },
|
64
|
-
}"
|
65
|
-
class="post-categories inline-flex justify-center items-center" m="l-2"
|
66
|
-
>
|
67
|
-
<div m="x-1" i-ri-folder-2-line />
|
68
|
-
{{ Array.isArray(post.categories) ? post.categories.join(' > ') : post.categories }}
|
69
|
-
</router-link>
|
60
|
+
<YunPostCategories :categories="post.categories" />
|
70
61
|
</div>
|
71
62
|
|
72
63
|
<div class="post-tags inline-flex" m="r-2">
|
73
64
|
<template v-if="post.tags">
|
74
|
-
<
|
75
|
-
<div m="r-1" i-ri-price-tag-3-line />
|
76
|
-
{{ tag }}
|
77
|
-
</router-link>
|
65
|
+
<YunPostTags :tags="post.tags" />
|
78
66
|
</template>
|
79
67
|
</div>
|
80
68
|
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import type { Post } from 'valaxy'
|
3
|
+
|
4
|
+
defineProps<{
|
5
|
+
categories: Post['categories']
|
6
|
+
}>()
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<template>
|
10
|
+
<router-link
|
11
|
+
:to="{
|
12
|
+
path: '/categories/',
|
13
|
+
query: { category: Array.isArray(categories) ? categories[categories.length - 1] : categories },
|
14
|
+
}"
|
15
|
+
class="post-categories inline-flex justify-center items-center" m="l-2"
|
16
|
+
>
|
17
|
+
<div m="x-1" i-ri-folder-2-line />
|
18
|
+
{{ Array.isArray(categories) ? categories.join(' > ') : categories }}
|
19
|
+
</router-link>
|
20
|
+
</template>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import type { Post } from 'valaxy'
|
3
|
+
|
4
|
+
defineProps<{
|
5
|
+
frontmatter: Post
|
6
|
+
}>()
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<template>
|
10
|
+
<div class="inline-flex" text="sm" py="1">
|
11
|
+
<YunPostCategories :categories="frontmatter.categories" />
|
12
|
+
<span v-if="frontmatter.categories && frontmatter.tags" mx="2">-</span>
|
13
|
+
<template v-if="frontmatter.tags">
|
14
|
+
<YunPostTags :tags="frontmatter.tags" />
|
15
|
+
</template>
|
16
|
+
</div>
|
17
|
+
</template>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<script setup lang="ts">
|
2
2
|
import { computed, ref } from 'vue'
|
3
|
+
import { useSiteStore } from 'valaxy'
|
3
4
|
import type { Post } from 'valaxy'
|
4
|
-
import { usePostList } from 'valaxy'
|
5
5
|
|
6
6
|
const props = withDefaults(defineProps<{
|
7
7
|
type?: string
|
@@ -11,10 +11,11 @@ const props = withDefaults(defineProps<{
|
|
11
11
|
curPage: 1,
|
12
12
|
})
|
13
13
|
|
14
|
+
const site = useSiteStore()
|
15
|
+
|
14
16
|
const pageSize = ref(7)
|
15
17
|
|
16
|
-
const
|
17
|
-
const posts = computed(() => props.posts || routes.value)
|
18
|
+
const posts = computed(() => props.posts || site.postList)
|
18
19
|
const displayedPosts = computed(() => posts.value.slice((props.curPage - 1) * pageSize.value, props.curPage * pageSize.value))
|
19
20
|
</script>
|
20
21
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<script lang="ts" setup>
|
2
|
+
import type { Post } from 'valaxy'
|
3
|
+
|
4
|
+
defineProps<{
|
5
|
+
tags: Post['tags']
|
6
|
+
}>()
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<template>
|
10
|
+
<router-link v-for="tag, i in tags" :key="i" :to="{ path: '/tags/', query: { tag } }" m="x-1" class="post-tag inline-flex justify-center items-center">
|
11
|
+
<div m="r-1" i-ri-price-tag-3-line />
|
12
|
+
{{ tag }}
|
13
|
+
</router-link>
|
14
|
+
</template>
|
@@ -1,12 +1,13 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { useCategory,
|
2
|
+
import { useCategory, useSiteStore, useTag } from 'valaxy'
|
3
3
|
import { useI18n } from 'vue-i18n'
|
4
4
|
import { useThemeConfig } from '../composables'
|
5
5
|
|
6
6
|
const { t } = useI18n()
|
7
7
|
|
8
|
+
const site = useSiteStore()
|
9
|
+
|
8
10
|
const themeConfig = useThemeConfig()
|
9
|
-
const posts = usePostList()
|
10
11
|
const categories = useCategory()
|
11
12
|
const tags = useTag()
|
12
13
|
</script>
|
@@ -19,7 +20,7 @@ const tags = useTag()
|
|
19
20
|
|
20
21
|
<router-link class="site-link-item" to="/archives/" :title="t('menu.archives')">
|
21
22
|
<div class="icon" i-ri-archive-line />
|
22
|
-
<span class="count">{{
|
23
|
+
<span class="count">{{ site.postList.length }}</span>
|
23
24
|
</router-link>
|
24
25
|
<router-link class="site-link-item" to="/categories/" :title="t('menu.categories')">
|
25
26
|
<div class="icon" i-ri-folder-2-line />
|
package/layouts/archives.vue
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { useFrontmatter,
|
2
|
+
import { useFrontmatter, usePostTitle, useSiteStore } from 'valaxy'
|
3
3
|
import { useI18n } from 'vue-i18n'
|
4
4
|
|
5
5
|
const { t } = useI18n()
|
6
6
|
|
7
7
|
const frontmatter = useFrontmatter()
|
8
|
-
const postList = usePostList()
|
9
8
|
|
10
9
|
const title = usePostTitle(frontmatter)
|
10
|
+
const site = useSiteStore()
|
11
11
|
</script>
|
12
12
|
|
13
13
|
<template>
|
@@ -17,7 +17,7 @@ const title = usePostTitle(frontmatter)
|
|
17
17
|
</template>
|
18
18
|
<template #main-content>
|
19
19
|
<router-view />
|
20
|
-
<YunPostCollapse :posts="postList" />
|
20
|
+
<YunPostCollapse :posts="site.postList" />
|
21
21
|
</template>
|
22
22
|
</Layout>
|
23
23
|
</template>
|
package/layouts/categories.vue
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { computed, ref } from 'vue'
|
3
|
-
import { useCategory, useFrontmatter, useInvisibleElement,
|
3
|
+
import { useCategory, useFrontmatter, useInvisibleElement, usePostTitle, useSiteStore } from 'valaxy'
|
4
4
|
import { useI18n } from 'vue-i18n'
|
5
5
|
import { useRoute, useRouter } from 'vue-router'
|
6
6
|
|
7
7
|
const { t } = useI18n()
|
8
8
|
|
9
|
+
const site = useSiteStore()
|
10
|
+
|
9
11
|
const frontmatter = useFrontmatter()
|
10
12
|
const categories = useCategory()
|
11
13
|
|
12
14
|
const route = useRoute()
|
13
15
|
const curCategory = computed(() => (route.query.category as string || ''))
|
14
16
|
|
15
|
-
const postList = usePostList()
|
16
17
|
const posts = computed(() => {
|
17
|
-
const list = postList.
|
18
|
+
const list = site.postList.filter((post) => {
|
18
19
|
if (post.categories && curCategory.value !== 'Uncategorized') {
|
19
20
|
if (typeof post.categories === 'string')
|
20
21
|
return post.categories === curCategory.value
|
package/layouts/post.vue
CHANGED
@@ -18,8 +18,8 @@ const showSponsor = computed(() => {
|
|
18
18
|
<Layout>
|
19
19
|
<template #main-header-after>
|
20
20
|
<YunPostMeta :frontmatter="frontmatter" />
|
21
|
-
|
22
21
|
<YunWalineMeta />
|
22
|
+
<YunPostCategoriesAndTags :frontmatter="frontmatter" />
|
23
23
|
</template>
|
24
24
|
|
25
25
|
<template #main-content-after>
|
package/layouts/tags.vue
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import { useFrontmatter, useInvisibleElement,
|
2
|
+
import { useFrontmatter, useInvisibleElement, usePostTitle, useSiteStore, useTags } from 'valaxy'
|
3
3
|
import { useI18n } from 'vue-i18n'
|
4
4
|
import { computed, ref } from 'vue'
|
5
5
|
import { useRoute, useRouter } from 'vue-router'
|
@@ -16,11 +16,11 @@ const { tags, getTagStyle } = useTags({
|
|
16
16
|
primary: themeConfig.value.colors.primary,
|
17
17
|
})
|
18
18
|
|
19
|
-
const postList = usePostList()
|
20
19
|
const curTag = computed(() => route.query.tag as string || '')
|
20
|
+
const site = useSiteStore()
|
21
21
|
|
22
22
|
const posts = computed(() => {
|
23
|
-
const list = postList.
|
23
|
+
const list = site.postList.filter((post) => {
|
24
24
|
if (post.tags) {
|
25
25
|
if (typeof post.tags === 'string')
|
26
26
|
return post.tags === curTag.value
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
|
-
"version": "0.13.
|
3
|
+
"version": "0.13.10",
|
4
4
|
"author": {
|
5
5
|
"email": "me@yunyoujun.cn",
|
6
6
|
"name": "YunYouJun",
|
@@ -22,6 +22,6 @@
|
|
22
22
|
"valaxy-addon-waline": "0.0.9"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"valaxy": "0.13.
|
25
|
+
"valaxy": "0.13.10"
|
26
26
|
}
|
27
27
|
}
|
package/stores/app.ts
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
import { acceptHMRUpdate, defineStore } from 'pinia'
|
2
|
+
|
3
|
+
export const useYunAppStore = defineStore('yun-app', () => {
|
4
|
+
// global cache for yun
|
5
|
+
|
6
|
+
return {}
|
7
|
+
})
|
8
|
+
|
9
|
+
if (import.meta.hot)
|
10
|
+
import.meta.hot.accept(acceptHMRUpdate(useYunAppStore, import.meta.hot))
|