valaxy-theme-yun 1.3.1 → 1.3.3
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/YunBanner.vue +51 -22
- package/layouts/home.vue +43 -2
- package/layouts/post.vue +2 -0
- package/package.json +2 -2
package/components/YunBanner.vue
CHANGED
|
@@ -7,13 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
import type { CSSProperties } from 'vue'
|
|
9
9
|
import { sleep } from 'valaxy'
|
|
10
|
-
import { computed, onBeforeUnmount, onMounted,
|
|
10
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, shallowRef, useTemplateRef } from 'vue'
|
|
11
11
|
import { useThemeConfig } from '../composables'
|
|
12
12
|
import { useYunBanner } from '../composables/useYunBanner'
|
|
13
13
|
import { useYunAppStore } from '../stores'
|
|
14
14
|
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
shouldPlayIntro?: () => boolean
|
|
17
|
+
}>()
|
|
18
|
+
|
|
15
19
|
const yun = useYunAppStore()
|
|
16
20
|
const themeConfig = useThemeConfig()
|
|
21
|
+
const banner = useTemplateRef<HTMLElement>('banner')
|
|
17
22
|
|
|
18
23
|
// height of top/bottom line
|
|
19
24
|
|
|
@@ -31,37 +36,49 @@ const bannerStyles = computed<CSSProperties>(() => {
|
|
|
31
36
|
return styles
|
|
32
37
|
})
|
|
33
38
|
|
|
34
|
-
const lineStatus =
|
|
39
|
+
const lineStatus = shallowRef<
|
|
35
40
|
'enter' | 'active' | 'exit' | ''
|
|
36
|
-
>('
|
|
37
|
-
const lineStatusClass = computed(() => {
|
|
38
|
-
return lineStatus.value
|
|
39
|
-
})
|
|
41
|
+
>('')
|
|
40
42
|
|
|
41
|
-
const
|
|
43
|
+
const showIntroTitle = shallowRef(false)
|
|
42
44
|
let disposed = false
|
|
43
45
|
|
|
44
46
|
onMounted(async () => {
|
|
45
47
|
yun.bannerAnimationDone = false
|
|
46
48
|
|
|
47
|
-
// 减少动态效果时不再等待动画时序,直接进入终态
|
|
48
49
|
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
50
|
+
if (yun.isNimbo && (reducedMotion || props.shouldPlayIntro?.() === false)) {
|
|
51
|
+
yun.bannerAnimationDone = true
|
|
52
|
+
return
|
|
53
|
+
}
|
|
49
54
|
|
|
55
|
+
lineStatus.value = reducedMotion ? 'active' : 'enter'
|
|
56
|
+
showIntroTitle.value = yun.isNimbo
|
|
50
57
|
if (!reducedMotion)
|
|
51
58
|
await sleep(500)
|
|
52
59
|
if (disposed)
|
|
53
60
|
return
|
|
54
61
|
lineStatus.value = 'active'
|
|
55
|
-
if (yun.isNimbo)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (!yun.isNimbo)
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
await sleep(themeConfig.value.banner?.duration || 500)
|
|
66
|
+
if (disposed)
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
lineStatus.value = 'exit'
|
|
70
|
+
await nextTick()
|
|
71
|
+
|
|
72
|
+
// The title fades while the lines retract. The profile waits for all three.
|
|
73
|
+
const art = Array.from(banner.value?.querySelectorAll('.banner-line.exit, .yun-banner-intro-title.is-intro-exiting') ?? [])
|
|
74
|
+
const exits = art.flatMap(part => part.getAnimations())
|
|
75
|
+
await Promise.allSettled(exits.map(animation => animation.finished))
|
|
76
|
+
if (disposed)
|
|
77
|
+
return
|
|
78
|
+
|
|
79
|
+
showIntroTitle.value = false
|
|
80
|
+
lineStatus.value = ''
|
|
81
|
+
yun.bannerAnimationDone = true
|
|
65
82
|
})
|
|
66
83
|
|
|
67
84
|
onBeforeUnmount(() => {
|
|
@@ -71,17 +88,19 @@ onBeforeUnmount(() => {
|
|
|
71
88
|
</script>
|
|
72
89
|
|
|
73
90
|
<template>
|
|
74
|
-
<div id="yun-banner" border="b-1px b-solid" :style="bannerStyles">
|
|
91
|
+
<div id="yun-banner" ref="banner" border="b-1px b-solid" :class="{ 'is-intro-playing': yun.isNimbo && lineStatus !== '' }" :style="bannerStyles">
|
|
75
92
|
<div class="banner-line-container">
|
|
76
93
|
<div
|
|
77
94
|
class="banner-line vertical-line-top"
|
|
78
|
-
:class="
|
|
95
|
+
:class="lineStatus"
|
|
79
96
|
/>
|
|
80
97
|
</div>
|
|
81
98
|
|
|
82
99
|
<template v-if="yun.isNimbo">
|
|
83
100
|
<YunBannerCharContainer
|
|
84
|
-
v-if="
|
|
101
|
+
v-if="showIntroTitle"
|
|
102
|
+
class="yun-banner-intro-title"
|
|
103
|
+
:class="{ 'is-intro-exiting': lineStatus === 'exit' }"
|
|
85
104
|
:title="bannerTitle"
|
|
86
105
|
:chars="chars"
|
|
87
106
|
aria-hidden="true"
|
|
@@ -97,7 +116,7 @@ onBeforeUnmount(() => {
|
|
|
97
116
|
<div class="banner-line-container bottom">
|
|
98
117
|
<div
|
|
99
118
|
class="banner-line vertical-line-bottom"
|
|
100
|
-
:class="
|
|
119
|
+
:class="lineStatus"
|
|
101
120
|
/>
|
|
102
121
|
</div>
|
|
103
122
|
<YunGoDown />
|
|
@@ -112,4 +131,14 @@ onBeforeUnmount(() => {
|
|
|
112
131
|
#yun-banner {
|
|
113
132
|
border-bottom-color: var(--yun-banner-divider-color, var(--banner-line-color));
|
|
114
133
|
}
|
|
134
|
+
|
|
135
|
+
.yun-banner-intro-title.is-intro-exiting {
|
|
136
|
+
pointer-events: none;
|
|
137
|
+
animation: yun-banner-title-exit 150ms ease-out both;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@keyframes yun-banner-title-exit {
|
|
141
|
+
from { opacity: 1; }
|
|
142
|
+
to { opacity: 0; }
|
|
143
|
+
}
|
|
115
144
|
</style>
|
package/layouts/home.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { computed, useTemplateRef } from 'vue'
|
|
3
3
|
import { useRoute } from 'vue-router'
|
|
4
4
|
import { useThemeConfig } from '../composables'
|
|
5
5
|
import { useYunAppStore } from '../stores'
|
|
@@ -8,6 +8,16 @@ const yun = useYunAppStore()
|
|
|
8
8
|
|
|
9
9
|
const route = useRoute()
|
|
10
10
|
const themeConfig = useThemeConfig()
|
|
11
|
+
const prologueContent = useTemplateRef<HTMLElement>('prologueContent')
|
|
12
|
+
|
|
13
|
+
function shouldPlayIntro() {
|
|
14
|
+
if (!window.matchMedia('(width > 768px)').matches)
|
|
15
|
+
return true
|
|
16
|
+
|
|
17
|
+
// If the CSS fallback has already shown the content, keep it on screen.
|
|
18
|
+
const content = prologueContent.value
|
|
19
|
+
return content !== null && getComputedStyle(content).visibility === 'hidden'
|
|
20
|
+
}
|
|
11
21
|
|
|
12
22
|
const isPage = computed(() => route.path.startsWith('/page'))
|
|
13
23
|
|
|
@@ -25,14 +35,16 @@ const showNotice = computed(() => {
|
|
|
25
35
|
<div class="w-full">
|
|
26
36
|
<YunPrologue :class="{ 'yun-home-prologue': yun.isNimbo }" :grid="yun.isNimbo ? themeConfig.banner.grid : { enable: false }">
|
|
27
37
|
<ClientOnly>
|
|
28
|
-
<YunBanner />
|
|
38
|
+
<YunBanner :should-play-intro="shouldPlayIntro" />
|
|
29
39
|
<template #fallback>
|
|
30
40
|
<div id="yun-banner-placeholder" class="w-full h-[var(--banner-container-height,100vh)]" />
|
|
31
41
|
</template>
|
|
32
42
|
</ClientOnly>
|
|
33
43
|
<div
|
|
34
44
|
v-if="yun.isNimbo"
|
|
45
|
+
ref="prologueContent"
|
|
35
46
|
class="yun-home-prologue-content absolute top-0 left-5 right-5 bottom-0 flex-center"
|
|
47
|
+
:class="{ 'is-intro-complete': yun.bannerAnimationDone }"
|
|
36
48
|
>
|
|
37
49
|
<YunPrologueSquare class="z-1" :intro-complete="yun.bannerAnimationDone" />
|
|
38
50
|
</div>
|
|
@@ -63,6 +75,35 @@ const showNotice = computed(() => {
|
|
|
63
75
|
</template>
|
|
64
76
|
|
|
65
77
|
<style scoped>
|
|
78
|
+
@media (width > 768px) and (prefers-reduced-motion: no-preference) and (scripting: enabled) {
|
|
79
|
+
.yun-home-prologue-content {
|
|
80
|
+
transition: opacity 300ms ease-out, transform 300ms ease-out;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.yun-home-prologue-content:not(.is-intro-complete) {
|
|
84
|
+
animation: yun-home-intro-fallback 1200ms step-end;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.yun-home-prologue :deep(#yun-banner.is-intro-playing) ~ .yun-home-prologue-content {
|
|
88
|
+
animation: none;
|
|
89
|
+
visibility: hidden;
|
|
90
|
+
opacity: 0;
|
|
91
|
+
transform: translateY(5px);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes yun-home-intro-fallback {
|
|
96
|
+
from {
|
|
97
|
+
visibility: hidden;
|
|
98
|
+
opacity: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
to {
|
|
102
|
+
visibility: visible;
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
66
107
|
@media (width <= 768px) {
|
|
67
108
|
.yun-home-prologue :deep(#yun-banner),
|
|
68
109
|
.yun-home-prologue :deep(#yun-banner-placeholder) {
|
package/layouts/post.vue
CHANGED
|
@@ -17,6 +17,7 @@ const route = useRoute()
|
|
|
17
17
|
|
|
18
18
|
const { $t, $tO } = useValaxyI18n()
|
|
19
19
|
const authorLink = siteConfig.value.author.link?.trim()
|
|
20
|
+
const authorEmail = siteConfig.value.author.email?.trim()
|
|
20
21
|
const description = $tO(frontmatter.value.description) || route.meta.seoDescription || ''
|
|
21
22
|
const { image } = usePageSeo()
|
|
22
23
|
const pagePath = resolveCanonicalPath(route)
|
|
@@ -31,6 +32,7 @@ const article: Parameters<typeof defineArticle>[0] = {
|
|
|
31
32
|
{
|
|
32
33
|
name: $t(siteConfig.value.author.name),
|
|
33
34
|
...(authorLink ? { url: authorLink } : {}),
|
|
35
|
+
...(authorEmail ? { email: authorEmail } : {}),
|
|
34
36
|
},
|
|
35
37
|
],
|
|
36
38
|
'datePublished': dayjs(frontmatter.value.date || '').toDate(),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-yun",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"description": "Default theme (Yun) for Valaxy — a Vite & Vue powered static blog generator",
|
|
6
6
|
"author": {
|
|
7
7
|
"email": "me@yunyoujun.cn",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"valaxy-addon-girls": "0.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"valaxy": "1.3.
|
|
44
|
+
"valaxy": "1.3.3",
|
|
45
45
|
"valaxy-addon-waline": "0.2.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|