valaxy-theme-yun 1.2.2 → 1.3.1
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 +27 -12
- package/client/components/YunArtalk.vue +12 -0
- package/client/components/YunFireworks.vue +29 -0
- package/client/components/YunFuseSearch.vue +418 -0
- package/client/components/YunTwikoo.vue +14 -0
- package/client/components/YunWaline.vue +17 -0
- package/components/YunBanner.vue +12 -3
- package/components/YunCloud.vue +14 -1
- package/components/YunFireworks.vue +4 -27
- package/components/YunFuseSearch.vue +4 -476
- package/components/YunPostCategories.vue +6 -3
- package/components/YunPostDateMeta.vue +26 -9
- package/components/YunSearchTrigger.vue +8 -2
- package/components/author/YunAuthorAvatar.vue +2 -0
- package/components/collection/YunCollectionCard.vue +6 -18
- package/components/menu/YunNavMenuItem.vue +4 -1
- package/components/prologue/YunPrologueSquare.vue +23 -100
- package/components/theme/nimbo/YunNimboNavMenu.vue +56 -79
- package/components/theme/strato/YunStratoNavMenu.vue +25 -46
- package/components/third/YunArtalk.vue +4 -10
- package/components/third/YunTwikoo.vue +4 -12
- package/components/third/YunWaline.vue +4 -15
- package/layouts/home.vue +31 -25
- package/layouts/post.vue +14 -5
- package/package.json +2 -2
- package/stores/app.ts +3 -3
- package/styles/common/nav.scss +3 -3
- package/styles/index.ts +1 -0
- package/styles/widgets/search.scss +57 -0
- package/types/index.d.ts +3 -0
- package/utils/animation.ts +4 -8
- package/utils/scroll.ts +7 -0
package/App.vue
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useHead } from '@unhead/vue'
|
|
3
|
+
import { useEventListener } from '@vueuse/core'
|
|
3
4
|
import { TooltipProvider } from 'reka-ui'
|
|
4
5
|
import { useAppStore } from 'valaxy'
|
|
5
|
-
import { computed, onBeforeUnmount, onMounted, watch } from 'vue'
|
|
6
|
+
import { computed, onBeforeUnmount, onMounted, shallowRef, watch } from 'vue'
|
|
6
7
|
import { useRoute } from 'vue-router'
|
|
7
8
|
import { useThemeConfig } from './composables'
|
|
8
9
|
import { useYunAppStore } from './stores'
|
|
9
10
|
|
|
10
11
|
const appStore = useAppStore()
|
|
12
|
+
const themeConfig = useThemeConfig()
|
|
13
|
+
const route = useRoute()
|
|
11
14
|
|
|
12
15
|
// Use a safe default for SSR; real themeColor is applied after mount
|
|
13
16
|
// to avoid hydration mismatch when user prefers dark mode.
|
|
14
17
|
const safeThemeColor = computed(() => appStore.themeColor)
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
})
|
|
24
|
+
function loadFonts() {
|
|
25
|
+
loadSerifFont.value = true
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Use the fallback font for first paint, then load the optional web font.
|
|
29
|
+
useEventListener('load', loadFonts, { once: true })
|
|
30
|
+
|
|
31
|
+
useHead(() => ({
|
|
32
|
+
link: showSerifFont.value
|
|
33
|
+
? [{
|
|
34
|
+
rel: 'stylesheet',
|
|
35
|
+
href: 'https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@900&display=swap',
|
|
36
|
+
}]
|
|
37
|
+
: [],
|
|
23
38
|
|
|
24
39
|
meta: [
|
|
25
40
|
{
|
|
@@ -31,13 +46,10 @@ useHead({
|
|
|
31
46
|
content: safeThemeColor,
|
|
32
47
|
},
|
|
33
48
|
],
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
const themeConfig = useThemeConfig()
|
|
49
|
+
}))
|
|
37
50
|
|
|
38
51
|
const app = useAppStore()
|
|
39
52
|
const yun = useYunAppStore()
|
|
40
|
-
const route = useRoute()
|
|
41
53
|
|
|
42
54
|
watch(
|
|
43
55
|
() => route.meta.layout,
|
|
@@ -55,6 +67,9 @@ function updateViewportHeight() {
|
|
|
55
67
|
}
|
|
56
68
|
|
|
57
69
|
onMounted(() => {
|
|
70
|
+
if (document.readyState === 'complete')
|
|
71
|
+
loadFonts()
|
|
72
|
+
|
|
58
73
|
// The viewport can be zero when an iframe mounts inside a hidden panel.
|
|
59
74
|
updateViewportHeight()
|
|
60
75
|
window.addEventListener('resize', updateViewportHeight)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { getAddonModule, isEmptyAddon } from 'valaxy'
|
|
3
|
+
import * as addonArtalk from 'valaxy-addon-artalk'
|
|
4
|
+
import 'valaxy-addon-artalk/client/styles/index.scss'
|
|
5
|
+
|
|
6
|
+
if (!isEmptyAddon(addonArtalk))
|
|
7
|
+
getAddonModule<{ useArtalkWithOptions: () => void }>(addonArtalk).useArtalkWithOptions?.()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<ArtalkClient />
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { YunTheme } from '../../types'
|
|
3
|
+
import { createFireworks } from '@explosions/fireworks'
|
|
4
|
+
import { useThemeConfig } from 'valaxy'
|
|
5
|
+
import { onMounted } from 'vue'
|
|
6
|
+
|
|
7
|
+
const themeConfig = useThemeConfig<YunTheme.Config>()
|
|
8
|
+
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
createFireworks({
|
|
11
|
+
selector: 'canvas.fireworks',
|
|
12
|
+
colors: themeConfig.value.fireworks?.colors,
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<canvas class="fireworks" />
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
canvas.fireworks {
|
|
23
|
+
position: fixed;
|
|
24
|
+
left: 0;
|
|
25
|
+
top: 0;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useResizeObserver, useScroll } from '@vueuse/core'
|
|
3
|
+
import { DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, VisuallyHidden } from 'reka-ui'
|
|
4
|
+
import { useFuseSearch } from 'valaxy'
|
|
5
|
+
import { computed, nextTick, shallowRef, watch } from 'vue'
|
|
6
|
+
import { useI18n } from 'vue-i18n'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{ open: boolean }>()
|
|
9
|
+
const emit = defineEmits<{ close: [] }>()
|
|
10
|
+
const { t, locale } = useI18n()
|
|
11
|
+
const zh = computed(() => locale.value.startsWith('zh'))
|
|
12
|
+
const input = shallowRef('')
|
|
13
|
+
const query = computed(() => input.value.trim())
|
|
14
|
+
const { results, fetchFuseListData } = useFuseSearch(query)
|
|
15
|
+
const dialog = shallowRef<HTMLElement>()
|
|
16
|
+
const searchInput = shallowRef<HTMLInputElement>()
|
|
17
|
+
const resultsContainer = shallowRef<HTMLElement>()
|
|
18
|
+
const { arrivedState, measure } = useScroll(resultsContainer, { offset: { bottom: 1 } })
|
|
19
|
+
useResizeObserver(resultsContainer, measure)
|
|
20
|
+
watch(results, () => nextTick(measure), { flush: 'post' })
|
|
21
|
+
const activeIndex = shallowRef(0)
|
|
22
|
+
const loading = shallowRef(false)
|
|
23
|
+
const failed = shallowRef(false)
|
|
24
|
+
let loaded = false
|
|
25
|
+
|
|
26
|
+
async function load() {
|
|
27
|
+
if (loaded || loading.value)
|
|
28
|
+
return
|
|
29
|
+
loading.value = true
|
|
30
|
+
failed.value = false
|
|
31
|
+
try {
|
|
32
|
+
await fetchFuseListData()
|
|
33
|
+
loaded = true
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
failed.value = true
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
loading.value = false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
watch(() => props.open, (open) => {
|
|
44
|
+
if (open)
|
|
45
|
+
void load()
|
|
46
|
+
}, { immediate: true })
|
|
47
|
+
watch(query, () => {
|
|
48
|
+
activeIndex.value = 0
|
|
49
|
+
})
|
|
50
|
+
function onKeydown(event: KeyboardEvent) {
|
|
51
|
+
if (event.isComposing || !results.value.length)
|
|
52
|
+
return
|
|
53
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
54
|
+
event.preventDefault()
|
|
55
|
+
activeIndex.value = (activeIndex.value + (event.key === 'ArrowDown' ? 1 : -1) + results.value.length) % results.value.length
|
|
56
|
+
nextTick(() => dialog.value?.querySelectorAll<HTMLElement>('.yun-search-result')[activeIndex.value]?.focus())
|
|
57
|
+
}
|
|
58
|
+
else if (event.key === 'Enter' && event.target === searchInput.value) {
|
|
59
|
+
event.preventDefault()
|
|
60
|
+
dialog.value?.querySelectorAll<HTMLElement>('.yun-search-result')[activeIndex.value]?.click()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function onBackdrop(event: MouseEvent) {
|
|
65
|
+
if (event.target !== dialog.value)
|
|
66
|
+
return
|
|
67
|
+
emit('close')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function excerpt(text: string = '') {
|
|
71
|
+
return text.replace(/<!--[\s\S]*?(?:-->|$)/g, '').replace(/!\[[^\]]*\]\([^)]*\)/g, '').replace(/\[([^\]]+)\]\([^)]*\)/g, '$1').replace(/<[^>]*>/g, '').replace(/[#*>`_]/g, '').replace(/\s+/g, ' ').trim().slice(0, 180)
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<DialogRoot :open="open" @update:open="value => !value && emit('close')">
|
|
77
|
+
<DialogPortal to="#valaxy-teleports">
|
|
78
|
+
<DialogOverlay class="yun-search-backdrop" />
|
|
79
|
+
<DialogContent as-child @open-auto-focus.prevent="searchInput?.focus()">
|
|
80
|
+
<div ref="dialog" class="yun-fuse-dialog" @click="onBackdrop" @keydown="onKeydown">
|
|
81
|
+
<VisuallyHidden as-child>
|
|
82
|
+
<DialogTitle>{{ zh ? '搜索文章' : 'Search articles' }}</DialogTitle>
|
|
83
|
+
</VisuallyHidden>
|
|
84
|
+
<VisuallyHidden as-child>
|
|
85
|
+
<DialogDescription>{{ zh ? '搜索标题、正文或标签,使用方向键选择结果,按 Enter 打开。' : 'Search titles, content, or tags. Use arrow keys to select and Enter to open.' }}</DialogDescription>
|
|
86
|
+
</VisuallyHidden>
|
|
87
|
+
<div class="yun-search-field">
|
|
88
|
+
<span class="i-ri-search-line" aria-hidden="true" />
|
|
89
|
+
<input
|
|
90
|
+
ref="searchInput" v-model="input" type="search" autocomplete="off"
|
|
91
|
+
:placeholder="zh ? '搜索文章…' : 'Search articles…'" :aria-label="zh ? '搜索文章' : 'Search articles'"
|
|
92
|
+
>
|
|
93
|
+
<DialogClose class="yun-search-dismiss yun-icon-btn yun-search-action" :aria-label="zh ? '关闭搜索' : 'Close search'">
|
|
94
|
+
<div class="i-ri-close-line" aria-hidden="true" />
|
|
95
|
+
</DialogClose>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="yun-search-status" role="status" aria-live="polite">
|
|
98
|
+
<template v-if="loading">
|
|
99
|
+
{{ zh ? '正在加载文章…' : 'Loading articles…' }}
|
|
100
|
+
</template>
|
|
101
|
+
<template v-else-if="failed">
|
|
102
|
+
{{ zh ? '文章加载失败。' : 'Unable to load articles.' }}
|
|
103
|
+
<button type="button" @click="load">
|
|
104
|
+
{{ zh ? '重试' : 'Retry' }}
|
|
105
|
+
</button>
|
|
106
|
+
</template>
|
|
107
|
+
<template v-else-if="query">
|
|
108
|
+
{{ t('search.hits', results.length) }}
|
|
109
|
+
</template>
|
|
110
|
+
<template v-else>
|
|
111
|
+
{{ zh ? '搜索标题、正文或标签' : 'Search titles, content, or tags' }}
|
|
112
|
+
</template>
|
|
113
|
+
</div>
|
|
114
|
+
<div
|
|
115
|
+
v-if="query && results.length" ref="resultsContainer" class="yun-search-results"
|
|
116
|
+
:style="{ '--yun-search-fade-bottom': arrivedState.bottom ? '0px' : '56px' }"
|
|
117
|
+
>
|
|
118
|
+
<AppLink
|
|
119
|
+
v-for="(result, index) in results" :key="result.item.link" :to="result.item.link"
|
|
120
|
+
class="yun-search-result" :class="{ 'is-selected': index === activeIndex }"
|
|
121
|
+
@focus="activeIndex = index" @click="emit('close')"
|
|
122
|
+
>
|
|
123
|
+
<span class="yun-search-result-title">{{ result.item.title }}</span>
|
|
124
|
+
<span v-if="result.item.excerpt" class="yun-search-result-excerpt">{{ excerpt(result.item.excerpt) }}</span>
|
|
125
|
+
<span class="yun-search-result-path">{{ result.item.link }}</span>
|
|
126
|
+
</AppLink>
|
|
127
|
+
</div>
|
|
128
|
+
<p v-else-if="query && !loading && !failed" class="yun-search-empty">
|
|
129
|
+
{{ zh ? '没有匹配的文章,试试更短的关键词。' : 'No matching articles. Try a shorter keyword.' }}
|
|
130
|
+
</p>
|
|
131
|
+
<footer class="yun-search-footer">
|
|
132
|
+
<span>{{ zh ? '站内搜索' : 'Site search' }}</span>
|
|
133
|
+
<span class="yun-search-shortcuts"><kbd>↑</kbd><kbd>↓</kbd> {{ zh ? '选择' : 'Select' }} <kbd>↵</kbd> {{ zh ? '打开' : 'Open' }} <kbd>esc</kbd> {{ zh ? '关闭' : 'Close' }}</span>
|
|
134
|
+
</footer>
|
|
135
|
+
</div>
|
|
136
|
+
</DialogContent>
|
|
137
|
+
</DialogPortal>
|
|
138
|
+
</DialogRoot>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<style lang="scss" scoped>
|
|
142
|
+
.yun-fuse-dialog {
|
|
143
|
+
--search-line: rgb(30 40 60 / 0.14);
|
|
144
|
+
--search-selection: rgb(0 102 204 / 0.05);
|
|
145
|
+
--search-muted: #626b77;
|
|
146
|
+
|
|
147
|
+
position: fixed;
|
|
148
|
+
z-index: 1001;
|
|
149
|
+
inset: 0;
|
|
150
|
+
width: 100%;
|
|
151
|
+
height: 100dvh;
|
|
152
|
+
max-width: none;
|
|
153
|
+
max-height: none;
|
|
154
|
+
margin: 0;
|
|
155
|
+
padding: clamp(64px, 10vh, 100px) 24px 24px;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
border: 0;
|
|
158
|
+
border-radius: 0;
|
|
159
|
+
color: var(--va-c-text);
|
|
160
|
+
background: transparent;
|
|
161
|
+
box-shadow: none;
|
|
162
|
+
font-family: var(--va-font-sans, sans-serif);
|
|
163
|
+
font-weight: 400;
|
|
164
|
+
line-height: 1.5;
|
|
165
|
+
text-align: left;
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
|
|
168
|
+
&[data-state="open"] {
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
align-items: center;
|
|
172
|
+
animation: search-appear 180ms ease-out;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
button {
|
|
176
|
+
font: inherit;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
button:focus-visible, a:focus-visible {
|
|
181
|
+
outline: 2px solid var(--yun-focus-color, #06c);
|
|
182
|
+
outline-offset: -2px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:global(html.dark .yun-fuse-dialog) {
|
|
187
|
+
--search-line: rgb(255 255 255 / 0.14);
|
|
188
|
+
--search-selection: rgb(100 181 246 / 0.07);
|
|
189
|
+
--search-muted: #aeb6c2;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.yun-search-backdrop {
|
|
193
|
+
position: fixed;
|
|
194
|
+
inset: 0;
|
|
195
|
+
z-index: 1000;
|
|
196
|
+
background: rgb(250 251 253 / 0.84);
|
|
197
|
+
backdrop-filter: blur(30px);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
:global(html.dark .yun-search-backdrop) {
|
|
201
|
+
background: rgb(22 24 29 / 0.84);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.yun-search-field {
|
|
205
|
+
width: min(100%, 960px);
|
|
206
|
+
flex-shrink: 0;
|
|
207
|
+
|
|
208
|
+
> span {
|
|
209
|
+
display: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
input {
|
|
213
|
+
box-sizing: border-box;
|
|
214
|
+
width: 100%;
|
|
215
|
+
min-width: 0;
|
|
216
|
+
padding: 20px 40px;
|
|
217
|
+
border: 1px solid var(--search-line);
|
|
218
|
+
outline: none;
|
|
219
|
+
border-radius: 999px;
|
|
220
|
+
background: transparent;
|
|
221
|
+
color: inherit;
|
|
222
|
+
font-family: var(--va-font-serif, serif);
|
|
223
|
+
font-weight: 500;
|
|
224
|
+
font-size: clamp(26px, 3vw, 36px);
|
|
225
|
+
line-height: 1.5;
|
|
226
|
+
text-align: center;
|
|
227
|
+
transition: border-color 160ms ease, box-shadow 160ms ease;
|
|
228
|
+
|
|
229
|
+
&::placeholder {
|
|
230
|
+
color: var(--search-muted);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&:focus {
|
|
234
|
+
border-color: var(--yun-focus-color, #06c);
|
|
235
|
+
box-shadow: 0 0 0 1px var(--yun-focus-color, #06c);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&::-webkit-search-cancel-button {
|
|
239
|
+
display: none;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.yun-search-dismiss {
|
|
245
|
+
position: absolute;
|
|
246
|
+
top: calc((var(--yun-nav-height, 50px) - 3rem) / 2);
|
|
247
|
+
right: 0;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.yun-search-status {
|
|
251
|
+
padding: 24px 0 20px;
|
|
252
|
+
font-size: 13px;
|
|
253
|
+
letter-spacing: 0.04em;
|
|
254
|
+
color: var(--search-muted);
|
|
255
|
+
flex-shrink: 0;
|
|
256
|
+
text-align: center;
|
|
257
|
+
|
|
258
|
+
button {
|
|
259
|
+
color: var(--va-c-link);
|
|
260
|
+
margin-left: 4px;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.yun-search-results {
|
|
265
|
+
mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--yun-search-fade-bottom, 0px)), transparent 100%);
|
|
266
|
+
width: min(100%, 800px);
|
|
267
|
+
padding: 0 8px;
|
|
268
|
+
overflow-y: auto;
|
|
269
|
+
overscroll-behavior: contain;
|
|
270
|
+
min-height: 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.yun-search-result {
|
|
274
|
+
display: flex;
|
|
275
|
+
flex-direction: column;
|
|
276
|
+
gap: 8px;
|
|
277
|
+
padding: 22px 16px;
|
|
278
|
+
border-top: 1px solid var(--search-line);
|
|
279
|
+
border-radius: 0;
|
|
280
|
+
color: inherit;
|
|
281
|
+
text-decoration: none;
|
|
282
|
+
overflow-wrap: anywhere;
|
|
283
|
+
font-weight: 400;
|
|
284
|
+
|
|
285
|
+
&.is-selected, &:hover {
|
|
286
|
+
background: var(--search-selection);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&.is-selected .yun-search-result-title {
|
|
290
|
+
color: var(--va-c-link);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.yun-search-result-title {
|
|
295
|
+
font-family: var(--va-font-serif, serif);
|
|
296
|
+
font-size: 22px;
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
line-height: 1.5;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.yun-search-result-excerpt {
|
|
302
|
+
font-size: 14px;
|
|
303
|
+
line-height: 1.8;
|
|
304
|
+
color: var(--search-muted);
|
|
305
|
+
display: -webkit-box;
|
|
306
|
+
-webkit-box-orient: vertical;
|
|
307
|
+
-webkit-line-clamp: 2;
|
|
308
|
+
overflow: hidden;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.yun-search-result-path {
|
|
312
|
+
font-size: 12px;
|
|
313
|
+
color: var(--search-muted);
|
|
314
|
+
white-space: nowrap;
|
|
315
|
+
overflow: hidden;
|
|
316
|
+
text-overflow: ellipsis;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.yun-search-empty {
|
|
320
|
+
margin: 0;
|
|
321
|
+
padding: 32px 0;
|
|
322
|
+
font-size: 14px;
|
|
323
|
+
color: var(--search-muted);
|
|
324
|
+
text-align: center;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.yun-search-footer {
|
|
328
|
+
display: flex;
|
|
329
|
+
justify-content: center;
|
|
330
|
+
align-items: center;
|
|
331
|
+
gap: 24px;
|
|
332
|
+
padding-top: 24px;
|
|
333
|
+
margin-top: auto;
|
|
334
|
+
color: var(--search-muted);
|
|
335
|
+
font-size: 11px;
|
|
336
|
+
flex-shrink: 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.yun-search-shortcuts {
|
|
340
|
+
display: flex;
|
|
341
|
+
align-items: center;
|
|
342
|
+
gap: 6px;
|
|
343
|
+
|
|
344
|
+
kbd {
|
|
345
|
+
font: inherit;
|
|
346
|
+
min-width: 16px;
|
|
347
|
+
text-align: center;
|
|
348
|
+
border: 1px solid var(--search-line);
|
|
349
|
+
border-radius: 4px;
|
|
350
|
+
padding: 0 3px;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@keyframes search-appear {
|
|
355
|
+
from {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
to {
|
|
360
|
+
opacity: 1;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@media (width <= 640px) {
|
|
365
|
+
.yun-fuse-dialog {
|
|
366
|
+
padding: max(76px, calc(env(safe-area-inset-top) + 60px)) 20px max(20px, env(safe-area-inset-bottom));
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.yun-search-field input {
|
|
370
|
+
padding: 14px 24px;
|
|
371
|
+
font-size: 26px;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.yun-search-status {
|
|
375
|
+
padding: 20px 0;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.yun-search-results {
|
|
379
|
+
padding: 0;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.yun-search-result {
|
|
383
|
+
padding: 18px 8px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.yun-search-result-title {
|
|
387
|
+
font-size: 19px;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.yun-search-footer {
|
|
391
|
+
padding-top: 16px;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.yun-search-shortcuts {
|
|
395
|
+
display: none;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
@media (prefers-reduced-motion: reduce) {
|
|
400
|
+
.yun-fuse-dialog[data-state="open"] {
|
|
401
|
+
animation: none;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.yun-search-field input {
|
|
405
|
+
transition: none;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
@media (prefers-reduced-transparency: reduce) {
|
|
410
|
+
.yun-search-backdrop {
|
|
411
|
+
backdrop-filter: none;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.yun-fuse-dialog {
|
|
415
|
+
background: var(--va-c-bg);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { getAddonModule, isEmptyAddon } from 'valaxy'
|
|
3
|
+
import * as addonTwikoo from 'valaxy-addon-twikoo'
|
|
4
|
+
import 'valaxy-addon-twikoo/client/styles/index.scss'
|
|
5
|
+
|
|
6
|
+
if (!isEmptyAddon(addonTwikoo))
|
|
7
|
+
getAddonModule<{ useTwikooWithOptions: () => void }>(addonTwikoo).useTwikooWithOptions()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<div>
|
|
12
|
+
<div id="tcomment" w="full" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { isEmptyAddon } from 'valaxy'
|
|
3
|
+
import * as addonWaline from 'valaxy-addon-waline'
|
|
4
|
+
|
|
5
|
+
if (isEmptyAddon(addonWaline))
|
|
6
|
+
throw new Error('Please install valaxy-addon-waline')
|
|
7
|
+
|
|
8
|
+
const addon = addonWaline.useAddonWaline()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<WalineClient
|
|
13
|
+
w="full" :options="addon?.options || {
|
|
14
|
+
serverURL: '',
|
|
15
|
+
}"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
package/components/YunBanner.vue
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type { CSSProperties } from 'vue'
|
|
9
9
|
import { sleep } from 'valaxy'
|
|
10
|
-
import { computed, onMounted, ref } from 'vue'
|
|
10
|
+
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
11
11
|
import { useThemeConfig } from '../composables'
|
|
12
12
|
import { useYunBanner } from '../composables/useYunBanner'
|
|
13
13
|
import { useYunAppStore } from '../stores'
|
|
@@ -39,10 +39,9 @@ const lineStatusClass = computed(() => {
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
const animationStatus = ref('banner')
|
|
42
|
+
let disposed = false
|
|
42
43
|
|
|
43
44
|
onMounted(async () => {
|
|
44
|
-
// Reset banner animation state to ensure prologue waits for banner
|
|
45
|
-
// This is needed when navigating back from post to home (SPA navigation)
|
|
46
45
|
yun.bannerAnimationDone = false
|
|
47
46
|
|
|
48
47
|
// 减少动态效果时不再等待动画时序,直接进入终态
|
|
@@ -50,16 +49,25 @@ onMounted(async () => {
|
|
|
50
49
|
|
|
51
50
|
if (!reducedMotion)
|
|
52
51
|
await sleep(500)
|
|
52
|
+
if (disposed)
|
|
53
|
+
return
|
|
53
54
|
lineStatus.value = 'active'
|
|
54
55
|
if (yun.isNimbo) {
|
|
55
56
|
if (!reducedMotion)
|
|
56
57
|
await sleep(themeConfig.value.banner?.duration || 500)
|
|
58
|
+
if (disposed)
|
|
59
|
+
return
|
|
57
60
|
lineStatus.value = 'exit'
|
|
58
61
|
|
|
59
62
|
animationStatus.value = 'prologue'
|
|
60
63
|
yun.bannerAnimationDone = true
|
|
61
64
|
}
|
|
62
65
|
})
|
|
66
|
+
|
|
67
|
+
onBeforeUnmount(() => {
|
|
68
|
+
disposed = true
|
|
69
|
+
yun.bannerAnimationDone = false
|
|
70
|
+
})
|
|
63
71
|
</script>
|
|
64
72
|
|
|
65
73
|
<template>
|
|
@@ -76,6 +84,7 @@ onMounted(async () => {
|
|
|
76
84
|
v-if="animationStatus === 'banner'"
|
|
77
85
|
:title="bannerTitle"
|
|
78
86
|
:chars="chars"
|
|
87
|
+
aria-hidden="true"
|
|
79
88
|
/>
|
|
80
89
|
</template>
|
|
81
90
|
<template v-if="yun.isStrato">
|
package/components/YunCloud.vue
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useElementVisibility } from '@vueuse/core'
|
|
3
|
+
import { useTemplateRef } from 'vue'
|
|
4
|
+
|
|
5
|
+
const cloud = useTemplateRef<HTMLElement>('cloud')
|
|
6
|
+
const inView = useElementVisibility(cloud)
|
|
7
|
+
</script>
|
|
8
|
+
|
|
1
9
|
<template>
|
|
2
|
-
<div class="yun-cloud">
|
|
10
|
+
<div ref="cloud" class="yun-cloud" :class="{ 'is-in-view': inView }">
|
|
3
11
|
<svg class="waves" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
|
|
4
12
|
<defs>
|
|
5
13
|
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" fill="var(--yun-c-cloud)" />
|
|
@@ -37,6 +45,7 @@
|
|
|
37
45
|
.parallax {
|
|
38
46
|
> use {
|
|
39
47
|
animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
|
|
48
|
+
animation-play-state: paused;
|
|
40
49
|
}
|
|
41
50
|
|
|
42
51
|
> use:nth-child(1) {
|
|
@@ -62,6 +71,10 @@
|
|
|
62
71
|
animation-duration: 20s;
|
|
63
72
|
}
|
|
64
73
|
}
|
|
74
|
+
|
|
75
|
+
&.is-in-view .parallax > use {
|
|
76
|
+
animation-play-state: running;
|
|
77
|
+
}
|
|
65
78
|
}
|
|
66
79
|
|
|
67
80
|
@keyframes move-forever {
|
|
@@ -1,29 +1,6 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
import
|
|
3
|
-
import { createFireworks } from '@explosions/fireworks'
|
|
4
|
-
import { useThemeConfig } from 'valaxy'
|
|
5
|
-
import { onMounted } from 'vue'
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { defineAsyncComponent } from 'vue'
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onMounted(() => {
|
|
10
|
-
createFireworks({
|
|
11
|
-
selector: 'canvas.fireworks',
|
|
12
|
-
colors: themeConfig.value.fireworks?.colors,
|
|
13
|
-
})
|
|
14
|
-
})
|
|
4
|
+
// Keep the public component auto-imported so site/addon overrides still win.
|
|
5
|
+
export default defineAsyncComponent(() => import('../client/components/YunFireworks.vue'))
|
|
15
6
|
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<canvas class="fireworks" />
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<style>
|
|
22
|
-
canvas.fireworks {
|
|
23
|
-
position: fixed;
|
|
24
|
-
left: 0;
|
|
25
|
-
top: 0;
|
|
26
|
-
z-index: 1;
|
|
27
|
-
pointer-events: none;
|
|
28
|
-
}
|
|
29
|
-
</style>
|