valaxy-theme-yun 1.3.0 → 1.3.2
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 +7 -4
- package/components/YunBanner.vue +51 -22
- package/components/prologue/YunPrologueSquare.vue +1 -31
- package/layouts/home.vue +33 -8
- package/package.json +2 -2
- package/types/index.d.ts +3 -0
package/App.vue
CHANGED
|
@@ -9,12 +9,18 @@ import { useThemeConfig } from './composables'
|
|
|
9
9
|
import { useYunAppStore } from './stores'
|
|
10
10
|
|
|
11
11
|
const appStore = useAppStore()
|
|
12
|
+
const themeConfig = useThemeConfig()
|
|
13
|
+
const route = useRoute()
|
|
12
14
|
|
|
13
15
|
// Use a safe default for SSR; real themeColor is applied after mount
|
|
14
16
|
// to avoid hydration mismatch when user prefers dark mode.
|
|
15
17
|
const safeThemeColor = computed(() => appStore.themeColor)
|
|
16
18
|
|
|
17
19
|
const loadSerifFont = shallowRef(false)
|
|
20
|
+
const showSerifFont = computed(() => {
|
|
21
|
+
const scope = themeConfig.value.serifFont
|
|
22
|
+
return loadSerifFont.value && scope !== 'off' && (scope !== 'except-home' || route.meta.layout !== 'home')
|
|
23
|
+
})
|
|
18
24
|
function loadFonts() {
|
|
19
25
|
loadSerifFont.value = true
|
|
20
26
|
}
|
|
@@ -23,7 +29,7 @@ function loadFonts() {
|
|
|
23
29
|
useEventListener('load', loadFonts, { once: true })
|
|
24
30
|
|
|
25
31
|
useHead(() => ({
|
|
26
|
-
link:
|
|
32
|
+
link: showSerifFont.value
|
|
27
33
|
? [{
|
|
28
34
|
rel: 'stylesheet',
|
|
29
35
|
href: 'https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&display=swap',
|
|
@@ -42,11 +48,8 @@ useHead(() => ({
|
|
|
42
48
|
],
|
|
43
49
|
}))
|
|
44
50
|
|
|
45
|
-
const themeConfig = useThemeConfig()
|
|
46
|
-
|
|
47
51
|
const app = useAppStore()
|
|
48
52
|
const yun = useYunAppStore()
|
|
49
|
-
const route = useRoute()
|
|
50
53
|
|
|
51
54
|
watch(
|
|
52
55
|
() => route.meta.layout,
|
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>
|
|
@@ -18,7 +18,7 @@ const grouped = computed(() => themeConfig.value.banner?.prologue === 'grouped')
|
|
|
18
18
|
<div
|
|
19
19
|
flex="~ col"
|
|
20
20
|
class="yun-square-container items-center justify-center text-center max-w-2xl"
|
|
21
|
-
:class="{ 'is-grouped': grouped
|
|
21
|
+
:class="{ 'is-grouped': grouped }"
|
|
22
22
|
>
|
|
23
23
|
<slot />
|
|
24
24
|
|
|
@@ -84,42 +84,12 @@ const grouped = computed(() => themeConfig.value.banner?.prologue === 'grouped')
|
|
|
84
84
|
|
|
85
85
|
.yun-square-container {
|
|
86
86
|
--avatar-size: 100px;
|
|
87
|
-
--yun-reveal-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
88
87
|
|
|
89
88
|
.info {
|
|
90
89
|
position: relative;
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
@media (width > 768px) {
|
|
95
|
-
.yun-square-container {
|
|
96
|
-
.yun-square {
|
|
97
|
-
transition: opacity 640ms var(--yun-reveal-ease), transform 640ms var(--yun-reveal-ease);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.info > * {
|
|
101
|
-
transition: opacity 640ms var(--yun-reveal-ease), transform 720ms var(--yun-reveal-ease);
|
|
102
|
-
transition-delay: calc(300ms + var(--yun-reveal-delay, 0ms));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.prologue-introduction { --yun-reveal-delay: 70ms; }
|
|
106
|
-
.prologue-social { --yun-reveal-delay: 140ms; }
|
|
107
|
-
.prologue-navigation { --yun-reveal-delay: 210ms; }
|
|
108
|
-
|
|
109
|
-
&:not(.is-intro-complete) {
|
|
110
|
-
.yun-square {
|
|
111
|
-
opacity: 0;
|
|
112
|
-
transform: translateY(20px) rotate(-6deg);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.info > * {
|
|
116
|
-
opacity: 0;
|
|
117
|
-
transform: translateY(18px);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
93
|
.yun-square-container.is-grouped {
|
|
124
94
|
.prologue-divider {
|
|
125
95
|
position: relative;
|
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
|
|
|
@@ -19,19 +29,20 @@ const showNotice = computed(() => {
|
|
|
19
29
|
|
|
20
30
|
<template>
|
|
21
31
|
<YunLayoutWrapper :no-margin="!isPage">
|
|
22
|
-
<div class="w-full flex flex-col items-center pb-4">
|
|
32
|
+
<div class="yun-home-layout w-full flex flex-col items-center pb-4">
|
|
23
33
|
<template v-if="themeConfig.banner?.enable">
|
|
24
34
|
<template v-if="!isPage">
|
|
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"
|
|
36
47
|
:class="{ 'is-intro-complete': yun.bannerAnimationDone }"
|
|
37
48
|
>
|
|
@@ -64,18 +75,32 @@ const showNotice = computed(() => {
|
|
|
64
75
|
</template>
|
|
65
76
|
|
|
66
77
|
<style scoped>
|
|
67
|
-
@media (width > 768px) {
|
|
78
|
+
@media (width > 768px) and (prefers-reduced-motion: no-preference) and (scripting: enabled) {
|
|
68
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 {
|
|
69
97
|
visibility: hidden;
|
|
70
98
|
opacity: 0;
|
|
71
|
-
scale: 0.6;
|
|
72
|
-
transition: opacity 800ms var(--yun-ease-in-out), scale 300ms var(--yun-ease-in-out);
|
|
73
99
|
}
|
|
74
100
|
|
|
75
|
-
|
|
101
|
+
to {
|
|
76
102
|
visibility: visible;
|
|
77
103
|
opacity: 1;
|
|
78
|
-
scale: 1;
|
|
79
104
|
}
|
|
80
105
|
}
|
|
81
106
|
|
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.2",
|
|
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.2",
|
|
45
45
|
"valaxy-addon-waline": "0.2.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
package/types/index.d.ts
CHANGED
|
@@ -163,6 +163,9 @@ export interface ThemeConfig extends DefaultTheme.Config {
|
|
|
163
163
|
*/
|
|
164
164
|
banner: YunTheme.Banner
|
|
165
165
|
|
|
166
|
+
/** Where to load the optional Noto Serif SC web font. @default 'all' */
|
|
167
|
+
serifFont?: 'all' | 'except-home' | 'off'
|
|
168
|
+
|
|
166
169
|
/** Post list presentation; per-post title classes take precedence. */
|
|
167
170
|
postCard?: {
|
|
168
171
|
/** Show the bottom excerpt gradient. @default true */
|