valaxy-theme-yun 0.21.1 → 0.22.0
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/App.vue +1 -1
- package/components/YunBanner.vue +1 -1
- package/components/YunFullscreenMenu.vue +2 -2
- package/components/YunMdTimeWarning.vue +18 -10
- package/components/YunPostCollapse.vue +4 -4
- package/components/YunPostCollapseItem.vue +3 -1
- package/components/theme/nimbo/YunNimboNavMenu.vue +2 -2
- package/layouts/gallery.vue +4 -2
- package/layouts/post.vue +3 -3
- package/package.json +5 -5
- package/utils/index.ts +4 -2
package/App.vue
CHANGED
@@ -61,7 +61,7 @@ const isDev = import.meta.env.DEV
|
|
61
61
|
<YunPageHeaderGradient />
|
62
62
|
<YunNavMenu />
|
63
63
|
|
64
|
-
<YunFullscreenMenu v-if="yun.isNimbo && !yun.size.
|
64
|
+
<YunFullscreenMenu v-if="yun.isNimbo && !yun.size.isLg" />
|
65
65
|
<YunStratoSidebar v-if="yun.isStrato" />
|
66
66
|
|
67
67
|
<YunFireworks v-if="themeConfig.fireworks.enable" />
|
package/components/YunBanner.vue
CHANGED
@@ -53,7 +53,7 @@ onMounted(async () => {
|
|
53
53
|
</script>
|
54
54
|
|
55
55
|
<template>
|
56
|
-
<div id="yun-banner" :style="bannerStyles">
|
56
|
+
<div id="yun-banner" border="b-1px b-solid b-$banner-line-color" :style="bannerStyles">
|
57
57
|
<div class="banner-line-container">
|
58
58
|
<div
|
59
59
|
class="banner-line vertical-line-top"
|
@@ -15,7 +15,7 @@ const app = useAppStore()
|
|
15
15
|
v-if="yunApp.fullscreenMenu.isOpen"
|
16
16
|
ref="fullscreenMenuRef"
|
17
17
|
p="t-12 md:t-20"
|
18
|
-
class="yun-fullscreen-menu fixed left-0 right-0 bottom-0 top-0 bg-$va-c-bg-soft z-$yun-z-fullscreen-menu overflow-auto"
|
18
|
+
class="yun-fullscreen-menu fixed left-0 right-0 bottom-0 top-0 bg-$va-c-bg-soft z-$yun-z-fullscreen-menu overflow-auto max-w-md shadow-2xl"
|
19
19
|
>
|
20
20
|
<!-- <div v-if="app.isMobile" class="flex-center gap-2">
|
21
21
|
<YunToggleDark transition />
|
@@ -49,7 +49,7 @@ const app = useAppStore()
|
|
49
49
|
.slide-down-enter-active,
|
50
50
|
.slide-down-leave-active {
|
51
51
|
opacity: 1;
|
52
|
-
transition: transform 0.
|
52
|
+
transition: transform 0.3s map.get($cubic-bezier, 'ease-in-out'),
|
53
53
|
opacity 0.2s map.get($cubic-bezier, 'ease-in-out');
|
54
54
|
transform: translateY(0);
|
55
55
|
}
|
@@ -1,27 +1,35 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
|
-
import
|
2
|
+
import dayjs from 'dayjs'
|
3
|
+
|
4
|
+
import relativeTime from 'dayjs/plugin/relativeTime'
|
3
5
|
import { useFrontmatter } from 'valaxy'
|
4
6
|
|
5
|
-
import { computed
|
7
|
+
import { computed } from 'vue'
|
6
8
|
import { useI18n } from 'vue-i18n'
|
7
9
|
|
10
|
+
dayjs.extend(relativeTime)
|
11
|
+
|
8
12
|
const fm = useFrontmatter()
|
9
|
-
const { t
|
13
|
+
const { t } = useI18n()
|
10
14
|
|
11
|
-
const updated = computed(() =>
|
12
|
-
|
15
|
+
const updated = computed(() => {
|
16
|
+
return dayjs(fm.value.updated || fm.value.date)
|
17
|
+
})
|
13
18
|
|
14
|
-
|
15
|
-
const fromNow =
|
16
|
-
|
17
|
-
|
19
|
+
const ago = computed(() => {
|
20
|
+
const fromNow = updated.value.fromNow()
|
21
|
+
if (/^\d/.test(fromNow))
|
22
|
+
return ` ${fromNow}`
|
23
|
+
else
|
24
|
+
return fromNow
|
25
|
+
})
|
18
26
|
|
19
27
|
/**
|
20
28
|
* when the post is updated more than 180 days ago, show a warning
|
21
29
|
* default 180 days, you can set `time_warning` in frontmatter to change it
|
22
30
|
*/
|
23
31
|
const time_warning = computed(() => {
|
24
|
-
const diff =
|
32
|
+
const diff = dayjs().valueOf() - updated.value.valueOf()
|
25
33
|
/**
|
26
34
|
* if `time_warning` is a number, compare the time difference
|
27
35
|
* if `time_warning` is a boolean, show warning by flag
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import type { Post } from 'valaxy'
|
3
|
-
import { formatDate, sortByDate
|
3
|
+
import { formatDate, sortByDate } from 'valaxy'
|
4
4
|
import { computed, ref, watch } from 'vue'
|
5
5
|
import { useI18n } from 'vue-i18n'
|
6
6
|
|
@@ -13,8 +13,6 @@ const { t } = useI18n()
|
|
13
13
|
const years = ref<number[]>([])
|
14
14
|
const postListByYear = ref<Record<string, Post[]>>({})
|
15
15
|
|
16
|
-
const siteConfig = useSiteConfig()
|
17
|
-
|
18
16
|
watch(() => props.posts, () => {
|
19
17
|
postListByYear.value = {}
|
20
18
|
years.value = []
|
@@ -22,7 +20,9 @@ watch(() => props.posts, () => {
|
|
22
20
|
if (post.hide && post.hide !== 'index')
|
23
21
|
return
|
24
22
|
if (post.date) {
|
25
|
-
const year = Number.parseInt(formatDate(post.date,
|
23
|
+
const year = Number.parseInt(formatDate(post.date, {
|
24
|
+
template: 'YYYY',
|
25
|
+
}))
|
26
26
|
if (postListByYear.value[year]) {
|
27
27
|
postListByYear.value[year].push(post)
|
28
28
|
}
|
@@ -41,7 +41,9 @@ useMotion(itemRef, {
|
|
41
41
|
>
|
42
42
|
<div class="post-meta">
|
43
43
|
<time v-if="post.date" class="post-time" font="mono" opacity="80">{{
|
44
|
-
formatDate(post.date,
|
44
|
+
formatDate(post.date, {
|
45
|
+
template: 'MM-DD',
|
46
|
+
}) }}
|
45
47
|
</time>
|
46
48
|
</div>
|
47
49
|
<h2 class="post-title w-full" inline-flex items-center font="serif black">
|
@@ -48,7 +48,7 @@ const app = useAppStore()
|
|
48
48
|
<!-- -->
|
49
49
|
<div class="inline-flex justify-start items-center flex-1">
|
50
50
|
<ValaxyHamburger
|
51
|
-
v-if="!yunApp.size.
|
51
|
+
v-if="!yunApp.size.isLg"
|
52
52
|
:active="yunApp.fullscreenMenu.isOpen"
|
53
53
|
class="menu-btn sidebar-toggle leading-4 size-12"
|
54
54
|
inline-flex cursor="pointer"
|
@@ -57,7 +57,7 @@ const app = useAppStore()
|
|
57
57
|
@click="yunApp.fullscreenMenu.toggle()"
|
58
58
|
/>
|
59
59
|
<YunNavMenuItem icon="i-ri-home-4-line" to="/" />
|
60
|
-
<template v-if="yunApp.size.
|
60
|
+
<template v-if="yunApp.size.isLg">
|
61
61
|
<YunNavMenuItem
|
62
62
|
icon="i-ri-article-line" to="/posts/"
|
63
63
|
title="博客文章"
|
package/layouts/gallery.vue
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<script lang="ts" setup>
|
2
2
|
import { defineWebPage, useSchemaOrg } from '@unhead/schema-org'
|
3
|
-
import { useFrontmatter, usePostTitle, useRuntimeConfig } from 'valaxy'
|
3
|
+
import { useEncryptedPhotos, useFrontmatter, usePostTitle, useRuntimeConfig } from 'valaxy'
|
4
4
|
import { computed, defineAsyncComponent } from 'vue'
|
5
5
|
import { useI18n } from 'vue-i18n'
|
6
6
|
import { useRouter } from 'vue-router'
|
@@ -26,6 +26,8 @@ const runtimeConfig = useRuntimeConfig()
|
|
26
26
|
const YunGallery = runtimeConfig.value.addons['valaxy-addon-lightgallery']
|
27
27
|
? defineAsyncComponent(() => import('../components/YunGallery.vue'))
|
28
28
|
: () => null
|
29
|
+
|
30
|
+
const encryptedPhotos = useEncryptedPhotos()
|
29
31
|
</script>
|
30
32
|
|
31
33
|
<template>
|
@@ -51,7 +53,7 @@ const YunGallery = runtimeConfig.value.addons['valaxy-addon-lightgallery']
|
|
51
53
|
<div i-ri-arrow-go-back-line />
|
52
54
|
</a>
|
53
55
|
</div>
|
54
|
-
<ValaxyGalleryDecrypt v-if="
|
56
|
+
<ValaxyGalleryDecrypt v-if="encryptedPhotos" :encrypted-photos="encryptedPhotos" />
|
55
57
|
<YunGallery v-else :photos="photos" />
|
56
58
|
<RouterView />
|
57
59
|
</template>
|
package/layouts/post.vue
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import type { Article } from '@unhead/schema-org'
|
3
3
|
import { defineArticle, useSchemaOrg } from '@unhead/schema-org'
|
4
4
|
|
5
|
-
import
|
5
|
+
import dayjs from 'dayjs'
|
6
6
|
import { useFrontmatter, useFullUrl, useSiteConfig } from 'valaxy'
|
7
7
|
import { computed } from 'vue'
|
8
8
|
|
@@ -27,8 +27,8 @@ const article: Article = {
|
|
27
27
|
url: siteConfig.value.author.link,
|
28
28
|
},
|
29
29
|
],
|
30
|
-
'datePublished':
|
31
|
-
'dateModified':
|
30
|
+
'datePublished': dayjs(frontmatter.value.date || '').toDate(),
|
31
|
+
'dateModified': dayjs(frontmatter.value.updated || '').toDate(),
|
32
32
|
}
|
33
33
|
|
34
34
|
const image = frontmatter.value.image || frontmatter.value.cover
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "valaxy-theme-yun",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.22.0",
|
5
5
|
"author": {
|
6
6
|
"email": "me@yunyoujun.cn",
|
7
7
|
"name": "YunYouJun",
|
@@ -23,8 +23,8 @@
|
|
23
23
|
"dependencies": {
|
24
24
|
"@ctrl/tinycolor": "^4.1.0",
|
25
25
|
"@explosions/fireworks": "^0.1.0",
|
26
|
-
"@iconify-json/ant-design": "^1.2.
|
27
|
-
"@iconify-json/simple-icons": "^1.2.
|
26
|
+
"@iconify-json/ant-design": "^1.2.5",
|
27
|
+
"@iconify-json/simple-icons": "^1.2.16",
|
28
28
|
"@vueuse/motion": "^2.2.6",
|
29
29
|
"animejs": "^3.2.2",
|
30
30
|
"gsap": "^3.12.5",
|
@@ -32,8 +32,8 @@
|
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@types/animejs": "^3.1.12",
|
35
|
-
"valaxy
|
36
|
-
"valaxy": "0.
|
35
|
+
"valaxy": "0.22.0",
|
36
|
+
"valaxy-addon-waline": "0.2.0"
|
37
37
|
},
|
38
38
|
"scripts": {
|
39
39
|
"release": "bumpp && pnpm publish"
|
package/utils/index.ts
CHANGED
@@ -14,9 +14,11 @@ export function onImgError(e: Event, defaultImg = noneImg) {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
/**
|
17
|
-
* date-fns format date with '
|
17
|
+
* date-fns format date with 'YYYY-MM-DD HH:mm:ss'
|
18
18
|
* @param date
|
19
19
|
*/
|
20
20
|
export function formatTimestamp(date: string | number | Date): string {
|
21
|
-
return formatDate(date,
|
21
|
+
return formatDate(date, {
|
22
|
+
template: 'YYYY-MM-DD HH:mm:ss',
|
23
|
+
})
|
22
24
|
}
|