valaxy-theme-yun 0.16.4 → 0.17.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
package/App.vue CHANGED
@@ -31,4 +31,5 @@ onMounted(() => {
31
31
  <Transition name="fade">
32
32
  <YunLoading v-if="app.showLoading" />
33
33
  </Transition>
34
+ <YunBackToTop />
34
35
  </template>
@@ -66,7 +66,9 @@ const sortedYears = computed(() => {
66
66
  >
67
67
  <header class="post-header" flex items-center relative>
68
68
  <div class="post-meta">
69
- <time v-if="post.date" class="post-time" font="mono" opacity="80">{{ formatDate(post.date, 'MM-DD') }}</time>
69
+ <time v-if="post.date" class="post-time" font="mono" opacity="80">{{
70
+ formatDate(post.date, 'MM-DD') }}
71
+ </time>
70
72
  </div>
71
73
  <h2 class="post-title" inline-flex items-center font="serif black">
72
74
  <RouterLink :to="post.path || ''" class="post-title-link">
@@ -30,14 +30,14 @@ const siteConfig = useSiteConfig()
30
30
  flex="~ col" justify="center" items="center" text="sm" py="1"
31
31
  >
32
32
  <div v-if="frontmatter.date" class="post-time flex items-center">
33
- <span class="inline-flex-center" :title="t('post.posted') + frontmatter.date">
33
+ <span class="posted-time inline-flex-center" :title="t('post.posted') + frontmatter.date">
34
34
  <div class="inline-block" i-ri-calendar-line />
35
35
  <time m="l-1">{{ formatDate(frontmatter.date) }}</time>
36
36
  </span>
37
37
 
38
38
  <span
39
39
  v-if="frontmatter.updated && frontmatter.updated !== frontmatter.date"
40
- class="inline-flex-center" :title="t('post.edited') + frontmatter.updated"
40
+ class="edited-time inline-flex-center" :title="t('post.edited') + frontmatter.updated"
41
41
  >
42
42
  <span m="x-2">-</span>
43
43
  <div i-ri-calendar-2-line />
@@ -51,15 +51,16 @@ const siteConfig = useSiteConfig()
51
51
  >
52
52
  <span
53
53
  v-if="frontmatter.wordCount"
54
- class="inline-flex-center" :title="t('statistics.word')"
54
+ class="word-count inline-flex-center" :title="t('statistics.word')"
55
55
  >
56
56
  <div class="inline-block" i-ri-file-word-line />
57
- <time m="l-1">{{ frontmatter.wordCount }}</time>
57
+ <span m="l-1">{{ frontmatter.wordCount }}</span>
58
58
  </span>
59
59
 
60
60
  <span
61
61
  v-if="frontmatter.readingTime"
62
- class="inline-flex-center" :title="t('statistics.time')"
62
+ class="reading-time inline-flex-center"
63
+ :title="t('statistics.time')"
63
64
  >
64
65
  <span m="x-2">-</span>
65
66
  <div i-ri-timer-line />
@@ -19,7 +19,6 @@ defineProps<{
19
19
  border
20
20
  bg="hover:(blue-500 opacity-10)"
21
21
  >
22
- <!-- <div m="r-1" i-ri-price-tag-3-line /> -->
23
22
  <span>{{ tag }}</span>
24
23
  </RouterLink>
25
24
  </div>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue'
3
- import { useAppStore } from 'valaxy'
2
+ import { ref, watch } from 'vue'
3
+ import { useAppStore, useLayout } from 'valaxy'
4
4
 
5
5
  defineProps<{
6
6
  showHamburger?: boolean
@@ -8,6 +8,13 @@ defineProps<{
8
8
 
9
9
  const app = useAppStore()
10
10
  const showOverview = ref(false)
11
+
12
+ const isHome = useLayout('home')
13
+ watch(isHome, () => {
14
+ app.isSidebarOpen = !isHome.value
15
+ }, {
16
+ immediate: true,
17
+ })
11
18
  </script>
12
19
 
13
20
  <template>
@@ -20,16 +20,23 @@ const albums = computed(() => frontmatter.value.albums || [])
20
20
  </script>
21
21
 
22
22
  <template>
23
- <Layout>
24
- <template #main-header>
25
- <YunPageHeader :title="title || t('title.album')" :icon="frontmatter.icon || 'i-ri-gallery-line'" :color="frontmatter.color" />
26
- </template>
27
- <template #main-content>
28
- <div text="center" class="yun-text-light" p="2">
29
- {{ t('counter.albums', albums.length) }}
30
- </div>
31
- <YunAlbumList :albums="albums" />
32
- <RouterView />
33
- </template>
34
- </Layout>
23
+ <YunSidebar v-if="$slots['sidebar-child']">
24
+ <slot name="sidebar-child" />
25
+ </YunSidebar>
26
+ <YunSidebar v-else />
27
+
28
+ <RouterView v-slot="{ Component }">
29
+ <component :is="Component">
30
+ <template #main-header>
31
+ <YunPageHeader :title="title || t('title.album')" :icon="frontmatter.icon || 'i-ri-gallery-line'" :color="frontmatter.color" />
32
+ </template>
33
+ <template #main-content>
34
+ <div text="center" class="yun-text-light" p="2">
35
+ {{ t('counter.albums', albums.length) }}
36
+ </div>
37
+ <YunAlbumList :albums="albums" />
38
+ <RouterView />
39
+ </template>
40
+ </component>
41
+ </RouterView>
35
42
  </template>
@@ -18,13 +18,20 @@ useSchemaOrg([
18
18
  </script>
19
19
 
20
20
  <template>
21
- <Layout>
22
- <template #main-header>
23
- <YunPageHeader :title="title || t('menu.archives')" :icon="frontmatter.icon || 'i-ri-archive-line'" :color="frontmatter.color" />
24
- </template>
25
- <template #main-content>
26
- <RouterView />
27
- <YunPostCollapse :posts="site.postList" />
28
- </template>
29
- </Layout>
21
+ <YunSidebar v-if="$slots['sidebar-child']">
22
+ <slot name="sidebar-child" />
23
+ </YunSidebar>
24
+ <YunSidebar v-else />
25
+
26
+ <RouterView v-slot="{ Component }">
27
+ <component :is="Component">
28
+ <template #main-header>
29
+ <YunPageHeader :title="title || t('menu.archives')" :icon="frontmatter.icon || 'i-ri-archive-line'" :color="frontmatter.color" />
30
+ </template>
31
+ <template #main-content>
32
+ <RouterView />
33
+ <YunPostCollapse :posts="site.postList" />
34
+ </template>
35
+ </component>
36
+ </RouterView>
30
37
  </template>
@@ -39,30 +39,37 @@ useSchemaOrg([
39
39
  </script>
40
40
 
41
41
  <template>
42
- <Layout>
43
- <template #main-header>
44
- <YunPageHeader
45
- :title="title || t('menu.categories')"
46
- :icon="frontmatter.icon || 'i-ri-folder-2-line'"
47
- :color="frontmatter.color"
48
- />
49
- </template>
50
- <template #main-content>
51
- <div text="center" class="yun-text-light" p="2">
52
- {{ t('counter.categories', categories.children.length) }}
53
- </div>
54
- <YunCategories :categories="categories.children" />
55
- <RouterView />
56
- </template>
42
+ <YunSidebar v-if="$slots['sidebar-child']">
43
+ <slot name="sidebar-child" />
44
+ </YunSidebar>
45
+ <YunSidebar v-else />
57
46
 
58
- <template #main-nav-before>
59
- <YunCard v-if="curCategory" class="post-collapse-container" m="t-4" w="full">
47
+ <RouterView v-slot="{ Component }">
48
+ <component :is="Component">
49
+ <template #main-header>
60
50
  <YunPageHeader
61
- :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory.split('/').join(' / ')"
62
- icon="i-ri-folder-open-line"
51
+ :title="title || t('menu.categories')"
52
+ :icon="frontmatter.icon || 'i-ri-folder-2-line'"
53
+ :color="frontmatter.color"
63
54
  />
64
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
65
- </YunCard>
66
- </template>
67
- </Layout>
55
+ </template>
56
+ <template #main-content>
57
+ <div text="center" class="yun-text-light" p="2">
58
+ {{ t('counter.categories', categories.children.length) }}
59
+ </div>
60
+ <YunCategories :categories="categories.children" />
61
+ <RouterView />
62
+ </template>
63
+
64
+ <template #main-nav-before>
65
+ <YunCard v-if="curCategory" class="post-collapse-container" m="t-4" w="full">
66
+ <YunPageHeader
67
+ :title="curCategory === 'Uncategorized' ? t('category.uncategorized') : curCategory.split('/').join(' / ')"
68
+ icon="i-ri-folder-open-line"
69
+ />
70
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
71
+ </YunCard>
72
+ </template>
73
+ </component>
74
+ </RouterView>
68
75
  </template>
@@ -1,7 +1,8 @@
1
1
  <template>
2
- <Layout>
3
- <template #content>
4
- <RouterView />
5
- </template>
6
- </Layout>
2
+ <YunSidebar v-if="$slots['sidebar-child']">
3
+ <slot name="sidebar-child" />
4
+ </YunSidebar>
5
+ <YunSidebar v-else />
6
+
7
+ <RouterView />
7
8
  </template>
@@ -29,26 +29,33 @@ const YunGallery = runtimeConfig.value.addons['valaxy-addon-lightgallery']
29
29
  </script>
30
30
 
31
31
  <template>
32
- <Layout>
33
- <template #main-header>
34
- <YunPageHeader
35
- :title="title || t('title.gallery')"
36
- :icon="frontmatter.icon || 'i-ri-gallery-line'"
37
- :color="frontmatter.color"
38
- />
39
- </template>
40
- <template #main-content>
41
- <div text="center" class="yun-text-light" p="2">
42
- {{ t('counter.photos', photos.length) }}
43
- </div>
44
- <div class="page-action" text="center">
45
- <a class="yun-icon-btn" :title="t('accessibility.back')" @click="() => router.back()">
46
- <div i-ri-arrow-go-back-line />
47
- </a>
48
- </div>
49
- <ValaxyGalleryDecrypt v-if="frontmatter.encryptedPhotos" :encrypted-photos="frontmatter.encryptedPhotos" />
50
- <YunGallery v-else :photos="photos" />
51
- <RouterView />
52
- </template>
53
- </Layout>
32
+ <YunSidebar v-if="$slots['sidebar-child']">
33
+ <slot name="sidebar-child" />
34
+ </YunSidebar>
35
+ <YunSidebar v-else />
36
+
37
+ <RouterView v-slot="{ Component }">
38
+ <component :is="Component">
39
+ <template #main-header>
40
+ <YunPageHeader
41
+ :title="title || t('title.gallery')"
42
+ :icon="frontmatter.icon || 'i-ri-gallery-line'"
43
+ :color="frontmatter.color"
44
+ />
45
+ </template>
46
+ <template #main-content>
47
+ <div text="center" class="yun-text-light" p="2">
48
+ {{ t('counter.photos', photos.length) }}
49
+ </div>
50
+ <div class="page-action" text="center">
51
+ <a class="yun-icon-btn" :title="t('accessibility.back')" @click="() => router.back()">
52
+ <div i-ri-arrow-go-back-line />
53
+ </a>
54
+ </div>
55
+ <ValaxyGalleryDecrypt v-if="frontmatter.encryptedPhotos" :encrypted-photos="frontmatter.encryptedPhotos" />
56
+ <YunGallery v-else :photos="photos" />
57
+ <RouterView />
58
+ </template>
59
+ </component>
60
+ </RouterView>
54
61
  </template>
package/layouts/post.vue CHANGED
@@ -41,20 +41,27 @@ useSchemaOrg(
41
41
  </script>
42
42
 
43
43
  <template>
44
- <Layout>
45
- <template #main-header-after>
46
- <YunPostMeta :frontmatter="frontmatter" />
47
- <YunWalineMeta />
48
- <YunPostCategoriesAndTags :frontmatter="frontmatter" />
49
- </template>
50
-
51
- <template #main-content-after>
52
- <YunSponsor v-if="showSponsor" m="t-6" />
53
- <ValaxyCopyright v-if="frontmatter.copyright || siteConfig.license.enabled" :url="url" m="y-4" />
54
- </template>
55
-
56
- <template #aside-custom>
57
- <slot name="aside-custom" />
58
- </template>
59
- </Layout>
44
+ <YunSidebar v-if="$slots['sidebar-child']">
45
+ <slot name="sidebar-child" />
46
+ </YunSidebar>
47
+ <YunSidebar v-else />
48
+
49
+ <RouterView v-slot="{ Component }">
50
+ <component :is="Component">
51
+ <template #main-header-after>
52
+ <YunPostMeta :frontmatter="frontmatter" />
53
+ <YunWalineMeta />
54
+ <YunPostCategoriesAndTags :frontmatter="frontmatter" />
55
+ </template>
56
+
57
+ <template #main-content-after>
58
+ <YunSponsor v-if="showSponsor" m="t-6" />
59
+ <ValaxyCopyright v-if="frontmatter.copyright || siteConfig.license.enabled" :url="url" m="y-4" />
60
+ </template>
61
+
62
+ <template #aside-custom>
63
+ <slot name="aside-custom" />
64
+ </template>
65
+ </component>
66
+ </RouterView>
60
67
  </template>
package/layouts/tags.vue CHANGED
@@ -58,38 +58,45 @@ const title = usePostTitle(frontmatter)
58
58
  </script>
59
59
 
60
60
  <template>
61
- <Layout>
62
- <template #main-header>
63
- <YunPageHeader
64
- :title="title || t('menu.tags')"
65
- :icon="frontmatter.icon || 'i-ri-tag-line'"
66
- :color="frontmatter.color"
67
- />
68
- </template>
69
- <template #main-content>
70
- <div class="yun-text-light" text="center" p="2">
71
- {{ t('counter.tags', Array.from(tags).length) }}
72
- </div>
73
-
74
- <div class="justify-center items-end" flex="~ wrap" gap="1">
75
- <YunLayoutPostTag
76
- v-for="[key, tag] in Array.from(tags).sort()"
77
- :key="key"
78
- :title="key"
79
- :count="tag.count"
80
- :style="getTagStyle(tag.count)"
81
- @click="displayTag(key.toString())"
61
+ <YunSidebar v-if="$slots['sidebar-child']">
62
+ <slot name="sidebar-child" />
63
+ </YunSidebar>
64
+ <YunSidebar v-else />
65
+
66
+ <RouterView v-slot="{ Component }">
67
+ <component :is="Component">
68
+ <template #main-header>
69
+ <YunPageHeader
70
+ :title="title || t('menu.tags')"
71
+ :icon="frontmatter.icon || 'i-ri-tag-line'"
72
+ :color="frontmatter.color"
82
73
  />
83
- </div>
84
-
85
- <RouterView />
86
- </template>
87
-
88
- <template #main-nav-before>
89
- <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
90
- <YunPageHeader :title="curTag" icon="i-ri-hashtag" />
91
- <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
92
- </YunCard>
93
- </template>
94
- </Layout>
74
+ </template>
75
+ <template #main-content>
76
+ <div class="yun-text-light" text="center" p="2">
77
+ {{ t('counter.tags', Array.from(tags).length) }}
78
+ </div>
79
+
80
+ <div class="justify-center items-end" flex="~ wrap" gap="1">
81
+ <YunLayoutPostTag
82
+ v-for="[key, tag] in Array.from(tags).sort()"
83
+ :key="key"
84
+ :title="key"
85
+ :count="tag.count"
86
+ :style="getTagStyle(tag.count)"
87
+ @click="displayTag(key.toString())"
88
+ />
89
+ </div>
90
+
91
+ <RouterView />
92
+ </template>
93
+
94
+ <template #main-nav-before>
95
+ <YunCard v-if="curTag" ref="collapse" m="t-4" w="full">
96
+ <YunPageHeader :title="curTag" icon="i-ri-hashtag" />
97
+ <YunPostCollapse w="full" m="b-4" p="x-20 lt-sm:x-5" :posts="posts" />
98
+ </YunCard>
99
+ </template>
100
+ </component>
101
+ </RouterView>
95
102
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valaxy-theme-yun",
3
- "version": "0.16.4",
3
+ "version": "0.17.0-beta.2",
4
4
  "author": {
5
5
  "email": "me@yunyoujun.cn",
6
6
  "name": "YunYouJun",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/animejs": "^3.1.12",
27
- "valaxy": "0.16.4",
27
+ "valaxy": "0.17.0-beta.2",
28
28
  "valaxy-addon-waline": "0.1.1"
29
29
  }
30
30
  }
@@ -1,12 +1,11 @@
1
1
  <script setup lang="ts">
2
- defineProps<{ page: string }>()
2
+ import { useRoute } from 'vue-router'
3
+ import { computed } from 'vue'
4
+
5
+ const route = useRoute()
6
+ const pageIndex = computed(() => Number.parseInt((route.params as { page: string }).page))
3
7
  </script>
4
8
 
5
9
  <template>
6
- <YunPostList :cur-page="parseInt(page)" />
10
+ <YunPostList :cur-page="pageIndex" />
7
11
  </template>
8
-
9
- <route lang="yaml">
10
- meta:
11
- layout: home
12
- </route>
package/tsconfig.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "resolveJsonModule": true,
12
12
  "types": [
13
13
  "vite/client",
14
- "vite-plugin-pages/client",
15
- "vite-plugin-vue-layouts/client"
14
+ "vite-plugin-vue-layouts/client",
15
+ "valaxy/client"
16
16
  ],
17
17
  "allowJs": true,
18
18
  "strict": true,
@@ -1,42 +0,0 @@
1
- <script lang="ts" setup>
2
- import { asAny } from 'valaxy'
3
- </script>
4
-
5
- <template>
6
- <YunSidebar v-if="$slots['sidebar-child']">
7
- <slot name="sidebar-child" />
8
- </YunSidebar>
9
- <YunSidebar v-else />
10
-
11
- <RouterView v-slot="{ Component }">
12
- <component :is="asAny(Component)">
13
- <template #main-header>
14
- <slot name="main-header" />
15
- </template>
16
-
17
- <template #main-header-after>
18
- <slot name="main-header-after" />
19
- </template>
20
- <template #main>
21
- <slot name="main" />
22
- </template>
23
- <template #main-content>
24
- <slot name="main-content" />
25
- </template>
26
- <template #main-content-after>
27
- <slot name="main-content-after" />
28
- </template>
29
- <template #main-nav-before>
30
- <slot name="main-nav-before" />
31
- </template>
32
- <template #main-nav-after>
33
- <slot name="main-nav-after" />
34
- </template>
35
- <template #aside-custom>
36
- <slot name="aside-custom" />
37
- </template>
38
- </component>
39
- </RouterView>
40
-
41
- <YunBackToTop />
42
- </template>