valaxy-theme-yun 0.13.8 → 0.13.9
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/YunPostList.vue +4 -3
- package/components/YunSidebarNav.vue +4 -3
- package/layouts/archives.vue +3 -3
- package/layouts/categories.vue +4 -3
- package/layouts/tags.vue +3 -3
- package/package.json +2 -2
- package/stores/app.ts +10 -0
@@ -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
|
|
@@ -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/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.9",
|
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.9"
|
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))
|