valaxy-theme-press 0.25.9 → 0.25.11
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const open = ref(false)
|
|
5
|
+
|
|
6
|
+
function toggleSearch() {
|
|
7
|
+
open.value = !open.value
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<PressFuseSearchButton :open="open" @toggle="toggleSearch" />
|
|
13
|
+
<PressFuseSearchModal :open="open" @close="open = false" />
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useI18n } from 'vue-i18n'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
open: boolean
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(['toggle'])
|
|
9
|
+
const { t } = useI18n()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<button
|
|
14
|
+
class="press-search-btn"
|
|
15
|
+
:class="{ 'press-search-btn--active': open }"
|
|
16
|
+
:title="t('menu.search')"
|
|
17
|
+
@click="emit('toggle')"
|
|
18
|
+
>
|
|
19
|
+
<div class="press-search-btn-content">
|
|
20
|
+
<svg
|
|
21
|
+
v-if="!open"
|
|
22
|
+
class="press-search-btn-icon"
|
|
23
|
+
width="20"
|
|
24
|
+
height="20"
|
|
25
|
+
viewBox="0 0 20 20"
|
|
26
|
+
fill="none"
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
>
|
|
29
|
+
<path d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" fill="currentColor" />
|
|
30
|
+
</svg>
|
|
31
|
+
<svg
|
|
32
|
+
v-else
|
|
33
|
+
class="press-search-btn-icon press-search-btn-icon--close"
|
|
34
|
+
width="20"
|
|
35
|
+
height="20"
|
|
36
|
+
viewBox="0 0 20 20"
|
|
37
|
+
fill="none"
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
>
|
|
40
|
+
<path d="M6.28 5.72a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.72z" fill="currentColor" />
|
|
41
|
+
</svg>
|
|
42
|
+
</div>
|
|
43
|
+
</button>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.press-search-btn {
|
|
48
|
+
position: relative;
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
width: 2.75rem;
|
|
53
|
+
height: 2.75rem;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
color: var(--vp-c-text-2);
|
|
56
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
57
|
+
outline: none;
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
color: var(--vp-c-text-1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:active {
|
|
64
|
+
transform: translateY(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&:focus-visible {
|
|
68
|
+
outline: 2px solid var(--vp-c-brand);
|
|
69
|
+
outline-offset: 2px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--active {
|
|
73
|
+
color: var(--vp-c-brand);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.press-search-btn-content {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.press-search-btn-icon {
|
|
87
|
+
width: 1.25rem;
|
|
88
|
+
height: 1.25rem;
|
|
89
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
90
|
+
opacity: 0.8;
|
|
91
|
+
|
|
92
|
+
.press-search-btn:hover & {
|
|
93
|
+
opacity: 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&--close {
|
|
97
|
+
transform: rotate(0deg);
|
|
98
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
99
|
+
|
|
100
|
+
.press-search-btn:hover & {
|
|
101
|
+
transform: rotate(90deg);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media (width <= 768px) {
|
|
107
|
+
.press-search-btn {
|
|
108
|
+
width: 2.5rem;
|
|
109
|
+
height: 2.5rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.press-search-btn-icon {
|
|
113
|
+
width: 1.125rem;
|
|
114
|
+
height: 1.125rem;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { isClient, useScrollLock } from '@vueuse/core'
|
|
3
|
+
import MarkdownIt from 'markdown-it'
|
|
4
|
+
import { useFuseSearch } from 'valaxy'
|
|
5
|
+
import { nextTick, ref, watch } from 'vue'
|
|
6
|
+
import { useI18n } from 'vue-i18n'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
open: boolean
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const emit = defineEmits(['close'])
|
|
13
|
+
|
|
14
|
+
const md = new MarkdownIt({
|
|
15
|
+
html: true,
|
|
16
|
+
linkify: true,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const input = ref('')
|
|
20
|
+
const isLocked = useScrollLock(isClient ? document.documentElement : null)
|
|
21
|
+
const { t, locale } = useI18n()
|
|
22
|
+
const { results, fetchFuseListData } = useFuseSearch(input)
|
|
23
|
+
|
|
24
|
+
const searchInputRef = ref<HTMLInputElement>()
|
|
25
|
+
|
|
26
|
+
function handleModalClick(event: Event) {
|
|
27
|
+
if (event.target === event.currentTarget) {
|
|
28
|
+
emit('close')
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
watch(() => props.open, (val) => {
|
|
33
|
+
if (val) {
|
|
34
|
+
fetchFuseListData()
|
|
35
|
+
nextTick(() => {
|
|
36
|
+
searchInputRef.value?.focus()
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
input.value = ''
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
function getResultTitle(title: string | Record<string, string>): string {
|
|
45
|
+
return typeof title === 'string'
|
|
46
|
+
? title
|
|
47
|
+
: title[locale.value] || title.en || Object.values(title)[0]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getResultKey(title: string | Record<string, string>): string {
|
|
51
|
+
return typeof title === 'string'
|
|
52
|
+
? title
|
|
53
|
+
: title.en || Object.values(title)[0]
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<Teleport to="body">
|
|
59
|
+
<Transition
|
|
60
|
+
name="modal"
|
|
61
|
+
@enter="isLocked = true"
|
|
62
|
+
@after-leave="isLocked = false"
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
v-if="open"
|
|
66
|
+
class="press-search-modal"
|
|
67
|
+
@click="handleModalClick"
|
|
68
|
+
>
|
|
69
|
+
<div class="press-search-content">
|
|
70
|
+
<div class="press-search-header">
|
|
71
|
+
<div class="press-search-input-wrapper">
|
|
72
|
+
<div class="press-search-icon">
|
|
73
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
74
|
+
<path d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" fill="currentColor" />
|
|
75
|
+
</svg>
|
|
76
|
+
</div>
|
|
77
|
+
<input
|
|
78
|
+
ref="searchInputRef"
|
|
79
|
+
v-model="input"
|
|
80
|
+
class="press-search-input"
|
|
81
|
+
:placeholder="t('search.placeholder')"
|
|
82
|
+
@keydown.esc="emit('close')"
|
|
83
|
+
>
|
|
84
|
+
<button
|
|
85
|
+
class="press-search-close"
|
|
86
|
+
@click="emit('close')"
|
|
87
|
+
>
|
|
88
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
89
|
+
<path d="M6.28 5.72a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.72z" fill="currentColor" />
|
|
90
|
+
</svg>
|
|
91
|
+
</button>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div v-if="input" class="press-search-hits">
|
|
96
|
+
<span class="press-search-hits-text">
|
|
97
|
+
{{ t('search.hits', results.length || 0) }}
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div v-if="results.length > 0" class="press-search-results">
|
|
102
|
+
<div class="press-search-container">
|
|
103
|
+
<div class="press-result-list">
|
|
104
|
+
<AppLink
|
|
105
|
+
v-for="(result, index) in results"
|
|
106
|
+
:key="getResultKey(result.item.title)"
|
|
107
|
+
:to="result.item.link"
|
|
108
|
+
class="press-result-item"
|
|
109
|
+
:style="{ animationDelay: `${index * 50}ms` }"
|
|
110
|
+
@click="emit('close')"
|
|
111
|
+
>
|
|
112
|
+
<div class="press-result-content">
|
|
113
|
+
<h3 class="press-result-title">
|
|
114
|
+
{{ getResultTitle(result.item.title) }}
|
|
115
|
+
</h3>
|
|
116
|
+
<p class="press-result-excerpt markdown-body" v-html="md.render(result.item.excerpt || '')" />
|
|
117
|
+
<div class="press-result-meta">
|
|
118
|
+
<span class="press-result-link">
|
|
119
|
+
{{ result.item.link }}
|
|
120
|
+
</span>
|
|
121
|
+
<span class="press-result-score">
|
|
122
|
+
<span class="press-result-score-label">Score:</span>
|
|
123
|
+
<span class="press-result-score-value">{{ result.refIndex }}</span>
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="press-result-arrow">
|
|
128
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
|
+
<path d="M7.5 4.5L12.5 9.5L7.5 14.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
|
130
|
+
</svg>
|
|
131
|
+
</div>
|
|
132
|
+
</AppLink>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div class="press-search-footer">
|
|
137
|
+
<div class="press-search-footer-content">
|
|
138
|
+
<span class="press-search-powered-by">Search by Local</span>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div v-else-if="input && results.length === 0" class="press-search-empty">
|
|
144
|
+
<div class="press-search-empty-icon">
|
|
145
|
+
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
146
|
+
<path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
147
|
+
</svg>
|
|
148
|
+
</div>
|
|
149
|
+
<p class="press-search-empty-text">
|
|
150
|
+
No results found
|
|
151
|
+
</p>
|
|
152
|
+
<p class="press-search-empty-subtext">
|
|
153
|
+
Try adjusting your search terms
|
|
154
|
+
</p>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</Transition>
|
|
159
|
+
</Teleport>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<style lang="scss" scoped>
|
|
163
|
+
.press-search-modal {
|
|
164
|
+
position: fixed;
|
|
165
|
+
top: 0;
|
|
166
|
+
left: 0;
|
|
167
|
+
width: 100%;
|
|
168
|
+
height: 100%;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
align-items: center;
|
|
172
|
+
padding-top: 2rem;
|
|
173
|
+
backdrop-filter: blur(20px);
|
|
174
|
+
z-index: var(--pr-z-search);
|
|
175
|
+
background-color: rgb(0 0 0 / 0.4);
|
|
176
|
+
pointer-events: auto;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.press-search-content {
|
|
180
|
+
width: 100%;
|
|
181
|
+
max-width: 680px;
|
|
182
|
+
padding: 0 1.5rem;
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
align-items: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.press-search-header {
|
|
189
|
+
width: 100%;
|
|
190
|
+
margin-bottom: 1.5rem;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.press-search-input-wrapper {
|
|
194
|
+
position: relative;
|
|
195
|
+
width: 100%;
|
|
196
|
+
max-width: 600px;
|
|
197
|
+
margin: 0 auto;
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
background: var(--vp-c-bg);
|
|
201
|
+
border-radius: 12px;
|
|
202
|
+
border: 2px solid var(--vp-c-divider);
|
|
203
|
+
box-shadow: 0 4px 20px rgb(0 0 0 / 0.1);
|
|
204
|
+
transition: all 0.2s ease;
|
|
205
|
+
|
|
206
|
+
&:focus-within {
|
|
207
|
+
border-color: var(--vp-c-brand);
|
|
208
|
+
box-shadow: 0 4px 20px rgb(var(--vp-c-brand-rgb), 0.15);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.press-search-icon {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
width: 48px;
|
|
217
|
+
height: 48px;
|
|
218
|
+
color: var(--vp-c-text-3);
|
|
219
|
+
flex-shrink: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.press-search-input {
|
|
223
|
+
flex: 1;
|
|
224
|
+
padding: 0.875rem 0;
|
|
225
|
+
font-size: 1.125rem;
|
|
226
|
+
line-height: 1.5;
|
|
227
|
+
color: var(--vp-c-text-1);
|
|
228
|
+
background: transparent;
|
|
229
|
+
border: none;
|
|
230
|
+
outline: none;
|
|
231
|
+
font-weight: 500;
|
|
232
|
+
|
|
233
|
+
&::placeholder {
|
|
234
|
+
color: var(--vp-c-text-3);
|
|
235
|
+
font-weight: 400;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.press-search-close {
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
justify-content: center;
|
|
243
|
+
width: 48px;
|
|
244
|
+
height: 48px;
|
|
245
|
+
color: var(--vp-c-text-3);
|
|
246
|
+
background: transparent;
|
|
247
|
+
border: none;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
border-radius: 8px;
|
|
250
|
+
transition: all 0.2s ease;
|
|
251
|
+
flex-shrink: 0;
|
|
252
|
+
|
|
253
|
+
&:hover {
|
|
254
|
+
color: var(--vp-c-text-1);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.press-search-hits {
|
|
259
|
+
width: 100%;
|
|
260
|
+
max-width: 600px;
|
|
261
|
+
padding: 0.75rem 0;
|
|
262
|
+
margin-bottom: 1rem;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.press-search-hits-text {
|
|
266
|
+
color: var(--vp-c-text-2);
|
|
267
|
+
font-size: 0.875rem;
|
|
268
|
+
font-weight: 500;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.press-search-results {
|
|
272
|
+
width: 100%;
|
|
273
|
+
max-width: 600px;
|
|
274
|
+
max-height: calc(100vh - 280px);
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-direction: column;
|
|
277
|
+
border-radius: 12px;
|
|
278
|
+
background: var(--vp-c-bg);
|
|
279
|
+
box-shadow: 0 4px 20px rgb(0 0 0 / 0.1);
|
|
280
|
+
overflow: hidden;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.press-search-container {
|
|
284
|
+
flex: 1;
|
|
285
|
+
overflow-y: auto;
|
|
286
|
+
min-height: 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.press-result-list {
|
|
290
|
+
width: 100%;
|
|
291
|
+
flex: 1;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.press-result-item {
|
|
295
|
+
display: flex;
|
|
296
|
+
align-items: center;
|
|
297
|
+
padding: 1rem 1.25rem;
|
|
298
|
+
color: var(--vp-c-text-1);
|
|
299
|
+
text-decoration: none;
|
|
300
|
+
transition: all 0.2s ease;
|
|
301
|
+
animation: slide-in-up 0.3s ease forwards;
|
|
302
|
+
opacity: 0;
|
|
303
|
+
transform: translateY(10px);
|
|
304
|
+
|
|
305
|
+
&:hover {
|
|
306
|
+
background-color: var(--vp-c-bg-soft);
|
|
307
|
+
transform: translateY(-1px);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&:not(:last-child) {
|
|
311
|
+
border-bottom: 1px solid var(--vp-c-divider);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.press-result-content {
|
|
316
|
+
flex: 1;
|
|
317
|
+
min-width: 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.press-result-title {
|
|
321
|
+
margin: 0 0 0.5rem;
|
|
322
|
+
font-size: 1rem;
|
|
323
|
+
font-weight: 600;
|
|
324
|
+
line-height: 1.4;
|
|
325
|
+
color: var(--vp-c-text-1);
|
|
326
|
+
display: -webkit-box;
|
|
327
|
+
line-clamp: 2;
|
|
328
|
+
-webkit-box-orient: vertical;
|
|
329
|
+
overflow: hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.press-result-excerpt {
|
|
333
|
+
margin: 0 0 0.75rem;
|
|
334
|
+
font-size: 0.875rem;
|
|
335
|
+
line-height: 1.5;
|
|
336
|
+
color: var(--vp-c-text-2);
|
|
337
|
+
display: -webkit-box;
|
|
338
|
+
line-clamp: 2;
|
|
339
|
+
-webkit-box-orient: vertical;
|
|
340
|
+
overflow: hidden;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.press-result-meta {
|
|
344
|
+
display: flex;
|
|
345
|
+
justify-content: space-between;
|
|
346
|
+
align-items: center;
|
|
347
|
+
font-size: 0.75rem;
|
|
348
|
+
line-height: 1.4;
|
|
349
|
+
color: var(--vp-c-text-3);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.press-result-link {
|
|
353
|
+
flex: 1;
|
|
354
|
+
min-width: 0;
|
|
355
|
+
overflow: hidden;
|
|
356
|
+
text-overflow: ellipsis;
|
|
357
|
+
white-space: nowrap;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.press-result-score {
|
|
361
|
+
display: flex;
|
|
362
|
+
align-items: center;
|
|
363
|
+
gap: 0.25rem;
|
|
364
|
+
flex-shrink: 0;
|
|
365
|
+
margin-left: 1rem;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.press-result-score-label {
|
|
369
|
+
color: var(--vp-c-text-3);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.press-result-score-value {
|
|
373
|
+
color: var(--vp-c-brand);
|
|
374
|
+
font-weight: 600;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.press-result-arrow {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
justify-content: center;
|
|
381
|
+
width: 24px;
|
|
382
|
+
height: 24px;
|
|
383
|
+
color: var(--vp-c-text-3);
|
|
384
|
+
margin-left: 0.75rem;
|
|
385
|
+
flex-shrink: 0;
|
|
386
|
+
transition: all 0.2s ease;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.press-result-item:hover .press-result-arrow {
|
|
390
|
+
color: var(--vp-c-brand);
|
|
391
|
+
transform: translateX(2px);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.press-search-footer {
|
|
395
|
+
width: 100%;
|
|
396
|
+
padding: 0.75rem 1.25rem;
|
|
397
|
+
border-top: 1px solid var(--vp-c-divider);
|
|
398
|
+
background: var(--vp-c-bg-soft);
|
|
399
|
+
flex-shrink: 0;
|
|
400
|
+
border-bottom-left-radius: 12px;
|
|
401
|
+
border-bottom-right-radius: 12px;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.press-search-footer-content {
|
|
405
|
+
display: flex;
|
|
406
|
+
justify-content: flex-end;
|
|
407
|
+
align-items: center;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.press-search-powered-by {
|
|
411
|
+
font-size: 0.75rem;
|
|
412
|
+
color: var(--vp-c-text-3);
|
|
413
|
+
font-weight: 500;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.press-search-empty {
|
|
417
|
+
width: 100%;
|
|
418
|
+
max-width: 600px;
|
|
419
|
+
padding: 3rem 1rem;
|
|
420
|
+
text-align: center;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.press-search-empty-icon {
|
|
424
|
+
display: flex;
|
|
425
|
+
justify-content: center;
|
|
426
|
+
margin-bottom: 1rem;
|
|
427
|
+
color: var(--vp-c-text-3);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.press-search-empty-text {
|
|
431
|
+
margin: 0 0 0.5rem;
|
|
432
|
+
font-size: 1.125rem;
|
|
433
|
+
font-weight: 600;
|
|
434
|
+
color: var(--vp-c-text-1);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.press-search-empty-subtext {
|
|
438
|
+
margin: 0;
|
|
439
|
+
font-size: 0.875rem;
|
|
440
|
+
color: var(--vp-c-text-2);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
@keyframes slide-in-up {
|
|
444
|
+
to {
|
|
445
|
+
opacity: 1;
|
|
446
|
+
transform: translateY(0);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.modal-enter-active,
|
|
451
|
+
.modal-leave-active {
|
|
452
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.modal-enter-from {
|
|
456
|
+
opacity: 0;
|
|
457
|
+
transform: scale(0.95);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.modal-leave-to {
|
|
461
|
+
opacity: 0;
|
|
462
|
+
transform: scale(0.95);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Scrollbar styling
|
|
466
|
+
.press-search-container::-webkit-scrollbar {
|
|
467
|
+
width: 6px;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.press-search-container::-webkit-scrollbar-track {
|
|
471
|
+
background: transparent;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.press-search-container::-webkit-scrollbar-thumb {
|
|
475
|
+
background: var(--vp-c-divider);
|
|
476
|
+
border-radius: 3px;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.press-search-container::-webkit-scrollbar-thumb:hover {
|
|
480
|
+
background: var(--vp-c-text-3);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
@media (width <= 768px) {
|
|
484
|
+
.press-search-modal {
|
|
485
|
+
padding-top: 1rem;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.press-search-content {
|
|
489
|
+
padding: 0 1rem;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.press-search-input-wrapper {
|
|
493
|
+
max-width: 100%;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.press-search-results {
|
|
497
|
+
max-height: calc(100vh - 240px);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.press-result-item {
|
|
501
|
+
padding: 0.875rem 1rem;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.press-result-title {
|
|
505
|
+
font-size: 0.9375rem;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.press-result-excerpt {
|
|
509
|
+
font-size: 0.8125rem;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
</style>
|
|
@@ -5,10 +5,12 @@ import { computed, defineAsyncComponent } from 'vue'
|
|
|
5
5
|
// ref vitepress search box
|
|
6
6
|
const siteConfig = useSiteConfig()
|
|
7
7
|
const isAlgolia = computed(() => siteConfig.value.search.type === 'algolia')
|
|
8
|
+
const isFuse = computed(() => siteConfig.value.search.type === 'fuse')
|
|
8
9
|
|
|
9
|
-
const PressAlgoliaSearch = isAlgolia.value
|
|
10
|
-
|
|
11
|
-
: ()
|
|
10
|
+
const PressAlgoliaSearch = isAlgolia.value && defineAsyncComponent({
|
|
11
|
+
loader: () => import('./PressAlgoliaSearch.vue'),
|
|
12
|
+
errorComponent: import('./PressFuseSearchModal.vue'),
|
|
13
|
+
})
|
|
12
14
|
</script>
|
|
13
15
|
|
|
14
16
|
<template>
|
|
@@ -16,6 +18,8 @@ const PressAlgoliaSearch = isAlgolia.value
|
|
|
16
18
|
<ClientOnly>
|
|
17
19
|
<PressAlgoliaSearch v-if="isAlgolia" />
|
|
18
20
|
</ClientOnly>
|
|
21
|
+
|
|
22
|
+
<PressFuseSearch v-if="isFuse" />
|
|
19
23
|
</div>
|
|
20
24
|
</template>
|
|
21
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valaxy-theme-press",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.11",
|
|
4
4
|
"description": "Docs Theme for Valaxy",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "me@yunyoujun.cn",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"@docsearch/js": "^3.9.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"valaxy": "0.25.
|
|
29
|
+
"valaxy": "0.25.11"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/styles/css-vars.scss
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
--pr-c-bg: var(--va-c-bg);
|
|
4
4
|
--pr-c-text-code: #374562;
|
|
5
5
|
--pr-c-text-1: #213547;
|
|
6
|
-
--pr-c-text-2:
|
|
6
|
+
--pr-c-text-2: rgb(60 60 60 / 0.7);
|
|
7
7
|
|
|
8
8
|
// aside
|
|
9
9
|
--pr-aside-text-1: var(--pr-c-text-1);
|
|
10
|
-
--pr-aside-text-2:
|
|
11
|
-
--pr-aside-divider:
|
|
12
|
-
--pr-c-divider-light:
|
|
10
|
+
--pr-aside-text-2: rgb(60 60 60 / 0.702);
|
|
11
|
+
--pr-aside-divider: rgb(60 60 60 / 0.122);
|
|
12
|
+
--pr-c-divider-light: rgb(60 60 60 / 0.12);
|
|
13
13
|
|
|
14
14
|
// nav
|
|
15
15
|
--pr-nav-height: var(--pr-nav-height-mobile);
|
|
@@ -24,22 +24,23 @@
|
|
|
24
24
|
--pr-z-backdrop: 10;
|
|
25
25
|
--pr-z-aside: 11;
|
|
26
26
|
--pr-z-sidebar: 12;
|
|
27
|
+
--pr-z-search: 200;
|
|
27
28
|
|
|
28
29
|
// switch
|
|
29
|
-
--pr-switch-divider:
|
|
30
|
+
--pr-switch-divider: rgb(60 60 60 / 0.29);
|
|
30
31
|
--pr-switch-bg: #f1f1f1;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
.dark {
|
|
34
35
|
--pr-c-text-code: var(--pr-c-indigo-lighter);
|
|
35
36
|
--pr-c-text-1: #ffffffde;
|
|
36
|
-
--pr-c-text-2:
|
|
37
|
+
--pr-c-text-2: rgb(235 235 235 / 0.6);
|
|
37
38
|
|
|
38
39
|
// aside
|
|
39
40
|
--pr-aside-text-2: #ebebeb99;
|
|
40
|
-
--pr-aside-divider:
|
|
41
|
+
--pr-aside-divider: rgb(84 84 84 / 0.48);
|
|
41
42
|
|
|
42
43
|
// switch
|
|
43
|
-
--pr-switch-divider:
|
|
44
|
+
--pr-switch-divider: rgb(84 84 84 / 0.65);
|
|
44
45
|
--pr-switch-bg: #3a3a3a;
|
|
45
46
|
}
|