Commit 6c128353a9

6c128353a9ab22a86a955527b7758071928d55e2

parent: 957cbded40

Unsigned

taskylizard <75871323+taskylizard@users.noreply.github.com> · 2026-06-04 12:56 UTC

fix search stuff

Layout: unified · split

docs/.vitepress/configs/markdown/emoji.ts +52 −33
@@ -11,22 +11,22 @@ import { iconTooltips } from './tooltip'
11 11
12// Icons that need to be used should be imported here 12// Icons that need to be used should be imported here
13import { icons as akar } from '@iconify-json/akar-icons' 13import { icons as akar } from '@iconify-json/akar-icons'
14import { icons as bi } from '@iconify-json/bi'
14import { icons as ic } from '@iconify-json/ic' 15import { icons as ic } from '@iconify-json/ic'
15import { icons as iconoir } from '@iconify-json/iconoir' 16import { icons as iconoir } from '@iconify-json/iconoir'
16import { icons as logos } from '@iconify-json/logos' 17import { icons as logos } from '@iconify-json/logos'
17import { icons as lucide } from '@iconify-json/lucide' 18import { icons as lucide } from '@iconify-json/lucide'
19import { icons as map } from '@iconify-json/map'
18import { icons as materials } from '@iconify-json/material-symbols' 20import { icons as materials } from '@iconify-json/material-symbols'
19import { icons as mdi } from '@iconify-json/mdi' 21import { icons as mdi } from '@iconify-json/mdi'
20import { icons as mingcute } from '@iconify-json/mingcute' 22import { icons as mingcute } from '@iconify-json/mingcute'
21import { icons as octicon } from '@iconify-json/octicon' 23import { icons as octicon } from '@iconify-json/octicon'
22import { icons as simple } from '@iconify-json/simple-icons' 24import { icons as simple } from '@iconify-json/simple-icons'
23import { icons as twemoji } from '@iconify-json/twemoji'
24import { icons as uil } from '@iconify-json/uil'
25import { icons as map } from '@iconify-json/map'
26import { icons as bi } from '@iconify-json/bi'
27import { icons as sl } from '@iconify-json/streamline-logos' 25import { icons as sl } from '@iconify-json/streamline-logos'
28import { icons as su } from '@iconify-json/streamline-ultimate'
29import { icons as ss } from '@iconify-json/streamline-sharp' 26import { icons as ss } from '@iconify-json/streamline-sharp'
27import { icons as su } from '@iconify-json/streamline-ultimate'
28import { icons as twemoji } from '@iconify-json/twemoji'
29import { icons as uil } from '@iconify-json/uil'
30 30
31// 1. Install emoji pack with `pnpm add -D @iconify-json/<icon>` 31// 1. Install emoji pack with `pnpm add -D @iconify-json/<icon>`
32// 2. Import them like I did above 32// 2. Import them like I did above
@@ -56,7 +56,6 @@ const emojis: { pack: IconifyJSON; prefix?: string }[] = [
56// Add aliases here: [icon, label?] 56// Add aliases here: [icon, label?]
57// Label is optional — omit for icons that don't need a tooltip. 57// Label is optional — omit for icons that don't need a tooltip.
58const aliasDefs: Record<string, [string, string?]> = { 58const aliasDefs: Record<string, [string, string?]> = {
59
60 // Operating System 59 // Operating System
61 and: ['simple-icons-android', 'Android'], 60 and: ['simple-icons-android', 'Android'],
62 ios: ['simple-icons-apple', 'iOS / iPadOS'], 61 ios: ['simple-icons-apple', 'iOS / iPadOS'],
@@ -84,10 +83,13 @@ const aliasDefs: Record<string, [string, string?]> = {
84 cs: ['mdi-package-variant-closed-remove', 'Closed Source'], 83 cs: ['mdi-package-variant-closed-remove', 'Closed Source'],
85 84
86 // Network Type 85 // Network Type
87 ddl: ['material-symbols-cloud-download-outline-rounded', 'Direct / HTTP(S) Download'], 86 ddl: [
87 'material-symbols-cloud-download-outline-rounded',
88 'Direct / HTTP(S) Download'
89 ],
88 mag: ['lucide-magnet', 'Torrent / Magnet Download'], 90 mag: ['lucide-magnet', 'Torrent / Magnet Download'],
89 usnt: ['material-symbols-newspaper-rounded', 'Usenet / NZB download'], 91 usnt: ['material-symbols-newspaper-rounded', 'Usenet / NZB download'],
90 92
91 // Device 93 // Device
92 erdr: ['material-symbols-chrome-reader-mode-outline-rounded', 'E-reader'], 94 erdr: ['material-symbols-chrome-reader-mode-outline-rounded', 'E-reader'],
93 95
@@ -104,12 +106,15 @@ const aliasDefs: Record<string, [string, string?]> = {
104 sup: ['mingcute-server-fill', 'Self-uploaded (Own storage or video host)'], 106 sup: ['mingcute-server-fill', 'Self-uploaded (Own storage or video host)'],
105 scrpr: ['mingcute-shovel-fill', 'Scraper (Pulling from other host sites)'], 107 scrpr: ['mingcute-shovel-fill', 'Scraper (Pulling from other host sites)'],
106 tv: ['material-symbols-tv-gen-outline-rounded', 'Native TV support'], 108 tv: ['material-symbols-tv-gen-outline-rounded', 'Native TV support'],
107 cast: ['material-symbols-cast-outline','TV casting support'], 109 cast: ['material-symbols-cast-outline', 'TV casting support'],
108 dlna: ['mdi-dlna','DLNA support'], 110 dlna: ['mdi-dlna', 'DLNA support'],
109 111
110 up: ['material-symbols-upload', 'User / scanlator upload'], 112 up: ['material-symbols-upload', 'User / scanlator upload'],
111 ms: ['material-symbols-file-copy-rounded', 'Multiple chapter sources'], 113 ms: ['material-symbols-file-copy-rounded', 'Multiple chapter sources'],
112 ps: ['material-symbols-file-copy-outline-rounded', 'Unlabeled / Poorly labeled / Partial multi-source'], 114 ps: [
115 'material-symbols-file-copy-outline-rounded',
116 'Unlabeled / Poorly labeled / Partial multi-source'
117 ],
113 ss: ['material-symbols-file-copy-off-rounded', 'Single source'], 118 ss: ['material-symbols-file-copy-off-rounded', 'Single source'],
114 sp: ['lucide-file', 'Single Page Mode'], 119 sp: ['lucide-file', 'Single Page Mode'],
115 dp: ['lucide-book-open', 'Dual Page Mode'], 120 dp: ['lucide-book-open', 'Dual Page Mode'],
@@ -120,7 +125,7 @@ const aliasDefs: Record<string, [string, string?]> = {
120 mal: ['simple-icons-myanimelist', 'MyAnimeList'], 125 mal: ['simple-icons-myanimelist', 'MyAnimeList'],
121 al: ['simple-icons-anilist', 'AniList'], 126 al: ['simple-icons-anilist', 'AniList'],
122 k: ['simple-icons-kitsu', 'Kitsu'], 127 k: ['simple-icons-kitsu', 'Kitsu'],
123 shiki: ['simple-icons-shikimori','Shikimori'], 128 shiki: ['simple-icons-shikimori', 'Shikimori'],
124 simkl: ['simple-icons-simkl', 'Simkl'], 129 simkl: ['simple-icons-simkl', 'Simkl'],
125 tmdb: ['simple-icons-themoviedatabase', 'TMDB'], 130 tmdb: ['simple-icons-themoviedatabase', 'TMDB'],
126 lstfm: ['simple-icons-lastdotfm', 'Lastfm'], 131 lstfm: ['simple-icons-lastdotfm', 'Lastfm'],
@@ -137,8 +142,8 @@ const aliasDefs: Record<string, [string, string?]> = {
137 steam: ['simple-icons-steam', 'Steam'], 142 steam: ['simple-icons-steam', 'Steam'],
138 gog: ['mdi-gog', 'GOG'], 143 gog: ['mdi-gog', 'GOG'],
139 iarch: ['simple-icons-internetarchive', 'Internet Archive'], 144 iarch: ['simple-icons-internetarchive', 'Internet Archive'],
140 apple: ['simple-icons-apple','Apple product'], 145 apple: ['simple-icons-apple', 'Apple product'],
141 wikip: ['simple-icons-wikipedia','WikiPedia'], 146 wikip: ['simple-icons-wikipedia', 'WikiPedia'],
142 147
143 // Price 148 // Price
144 paid: ['streamline-ultimate-cash-payment-bills-bold', "Good ol' money"], 149 paid: ['streamline-ultimate-cash-payment-bills-bold', "Good ol' money"],
@@ -184,14 +189,12 @@ const aliasDefs: Record<string, [string, string?]> = {
184 cvie: ['twemoji-flag-vietnam', 'Vietnam'], 189 cvie: ['twemoji-flag-vietnam', 'Vietnam'],
185 cbr: ['twemoji-flag-brazil', 'Brazil'], 190 cbr: ['twemoji-flag-brazil', 'Brazil'],
186 191
187
188 // Storage 192 // Storage
189 sgd: ['simple-icons-googledrive', 'Google Drive'], 193 sgd: ['simple-icons-googledrive', 'Google Drive'],
190 sm: ['simple-icons-mega', 'MEGA'], 194 sm: ['simple-icons-mega', 'MEGA'],
191 smf: ['simple-icons-mediafire', 'MediaFire'], 195 smf: ['simple-icons-mediafire', 'MediaFire'],
192 host: ['mdi-snail', 'Rate-limited / Paywalled Host'], 196 host: ['mdi-snail', 'Rate-limited / Paywalled Host'],
193 197
194
195 // General 198 // General
196 s: ['twemoji-glowing-star', 'Favorite'], 199 s: ['twemoji-glowing-star', 'Favorite'],
197 e: ['mdi-puzzle', 'Extension'], 200 e: ['mdi-puzzle', 'Extension'],
@@ -204,9 +207,9 @@ const aliasDefs: Record<string, [string, string?]> = {
204 prx: ['material-symbols-directions-alt', 'Proxies / Mirrors'], 207 prx: ['material-symbols-directions-alt', 'Proxies / Mirrors'],
205 tf: ['mdi-airplane', 'Testflight'], 208 tf: ['mdi-airplane', 'Testflight'],
206 more: ['mdi-arrow-right-bold', 'Related'], 209 more: ['mdi-arrow-right-bold', 'Related'],
207 prev: ['mdi-arrow-right-thick','Related to Prior URL'], 210 prev: ['mdi-arrow-right-thick', 'Related to Prior URL'],
208 help: ['material-symbols-help', 'Help / Docs'], 211 help: ['material-symbols-help', 'Help / Docs'],
209 ded: ['twemoji-headstone','Inactive / Retired'], 212 ded: ['twemoji-headstone', 'Inactive / Retired'],
210 strm: ['material-symbols-play-circle-outline', 'Stream'], 213 strm: ['material-symbols-play-circle-outline', 'Stream'],
211 lcl: ['iconoir-floppy-disk', 'Local file'], 214 lcl: ['iconoir-floppy-disk', 'Local file'],
212 batch: ['material-symbols-package-2-outline', 'Batch Download'], 215 batch: ['material-symbols-package-2-outline', 'Batch Download'],
@@ -250,29 +253,45 @@ for (const [alias, fullName] of Object.entries(aliases)) {
250 253
251export { aliases, defs } 254export { aliases, defs }
252 255
253export function emojiRender(md: MarkdownRenderer) { 256export function renderEmojiMarkup(markup: string) {
254 md.renderer.rules.emoji = (tokens, idx) => { 257 const label = aliasLabels[markup] || iconTooltips[markup]
255 const markup = tokens[idx].markup
256 const label = aliasLabels[markup] || iconTooltips[markup]
257 258
258 const tip = label?.replace(/"/g, '&quot;') 259 const tip = label?.replace(/"/g, '&quot;')
259 const wrap = (cls: string) => tip 260 const wrap = (cls: string) =>
261 tip
260 ? `<span class="icon-tip" data-tip="${tip}" tabindex="-1"><span class="${cls}"></span></span>` 262 ? `<span class="icon-tip" data-tip="${tip}" tabindex="-1"><span class="${cls}"></span></span>`
261 : `<span class="${cls}"></span>` 263 : `<span class="${cls}"></span>`
262 264
263 // Check for custom icon aliases first 265 // Check for custom icon aliases first
264 if (customIconAliases[markup]) return wrap(`i-${customIconAliases[markup]}`) 266 if (customIconAliases[markup]) return wrap(`i-${customIconAliases[markup]}`)
267
268 // Check for aliases
269 if (aliases[markup]) return wrap(`i-${aliases[markup]}`)
270
271 // Check for prefixed icons
272 for (const emoji of emojis) {
273 if (emoji.prefix && markup.startsWith(emoji.prefix)) {
274 return wrap(`i-${markup}`)
275 }
276 }
265 277
266 // Check for aliases 278 // Default to twemoji
267 if (aliases[markup]) return wrap(`i-${aliases[markup]}`) 279 return wrap(`i-twemoji-${markup}`)
280}
268 281
269 // Check for prefixed icons 282export function renderEmojiShortcodes(value: string) {
270 for (const emoji of emojis) { 283 return value.replace(/:([A-Za-z0-9_+-]+):/g, (match, markup) => {
271 if (markup.startsWith(emoji.prefix!)) return wrap(`i-${markup}`) 284 if (defs[markup] === undefined || defs[markup] === 'INVALID_ALIAS') {
285 return match
272 } 286 }
287 return renderEmojiMarkup(markup)
288 })
289}
273 290
274 // Default to twemoji 291export function emojiRender(md: MarkdownRenderer) {
275 return wrap(`i-twemoji-${markup}`) 292 md.renderer.rules.emoji = (tokens, idx) => {
293 const markup = tokens[idx].markup
294 return renderEmojiMarkup(markup)
276 } 295 }
277} 296}
278 297
docs/.vitepress/plugins/urlSearchPlugin.ts +87 −23
@@ -1,5 +1,6 @@
1import { writeFileSync } from 'node:fs' 1import { writeFileSync } from 'node:fs'
2import { join } from 'node:path' 2import { join } from 'node:path'
3import { renderEmojiShortcodes } from '../configs/markdown/emoji'
3 4
4export interface PageLink { 5export interface PageLink {
5 href: string 6 href: string
@@ -13,28 +14,88 @@ function extractLinksFromMarkdown(src: string, pageId: string): PageLink[] {
13 const results: PageLink[] = [] 14 const results: PageLink[] = []
14 const seen = new Set<string>() 15 const seen = new Set<string>()
15 const headingStack: string[] = [] 16 const headingStack: string[] = []
17 const slugCounts = new Map<string, number>()
18 const collapsibleStack: {
19 anchor: string
20 headings: string[]
21 }[] = []
16 let currentAnchor = '' 22 let currentAnchor = ''
17 23
18 // Strip frontmatter 24 // Strip frontmatter
19 const body = src.startsWith('---') 25 const body = src.startsWith('---')
20 ? src.replace(/^---[\s\S]*?---\n?/, '') 26 ? src.replace(/^---[\s\S]*?---\n?/, '')
21 : src 27 : src
28 const lines = body.split('\n')
29
30 const slugify = (value: string) =>
31 value
32 .replace(/\{[^}]*\}\s*$/, '')
33 .replace(/<[^>]*>/g, '')
34 .replace(/`([^`]+)`/g, '$1')
35 .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
36 .replace(/[*_~]/g, '')
37 .trim()
38 .toLowerCase()
39 .replace(/[^\w\s-]/g, '')
40 .replace(/\s+/g, '-')
41 .replace(/-+/g, '-')
42 .replace(/^-|-$/g, '')
43
44 const getAnchor = (text: string) => {
45 const slug = slugify(text)
46 const count = slugCounts.get(slug) ?? 0
47 slugCounts.set(slug, count + 1)
48 return count === 0 ? slug : `${slug}-${count}`
49 }
50
51 const setHeading = (level: number, text: string) => {
52 headingStack[level] = text
53 headingStack.length = level + 1
54 currentAnchor = getAnchor(text)
55 }
56
57 for (let i = 0; i < lines.length; i++) {
58 const line = lines[i]
59
60 const collapsibleMatch = line.match(
61 /^\s*<Collapsible\b(?=[^>]*\btitle=(['"])(.*?)\1)[^>]*>\s*$/i
62 )
63 if (collapsibleMatch) {
64 collapsibleStack.push({
65 anchor: currentAnchor,
66 headings: [...headingStack]
67 })
68
69 let nextLine = i + 1
70 while (nextLine < lines.length && lines[nextLine].trim() === '') {
71 nextLine++
72 }
73
74 // The markdown renderer injects a searchable H3 for collapsibles that
75 // don't already start with a heading. Mirror that anchor so URL search
76 // can deep-link into and auto-open those collapsibles.
77 if (!/^#{1,6}\s+/.test(lines[nextLine]?.trim() ?? '')) {
78 setHeading(2, collapsibleMatch[2].trim())
79 }
80 continue
81 }
82
83 if (/^\s*<\/Collapsible>\s*$/i.test(line)) {
84 const previous = collapsibleStack.pop()
85 if (previous) {
86 currentAnchor = previous.anchor
87 headingStack.length = 0
88 headingStack.push(...previous.headings)
89 }
90 continue
91 }
22 92
23 for (const line of body.split('\n')) {
24 // Heading: ## Title or === Title (setext-style ignored, ATX only) 93 // Heading: ## Title or === Title (setext-style ignored, ATX only)
25 const headingMatch = line.match(/^(#{1,6})\s+(.+)/) 94 const headingMatch = line.match(/^(#{1,6})\s+(.+)/)
26 if (headingMatch) { 95 if (headingMatch) {
27 const level = headingMatch[1].length - 1 96 const level = headingMatch[1].length - 1
28 const text = headingMatch[2].trim() 97 const text = headingMatch[2].trim()
29 headingStack[level] = text 98 setHeading(level, text)
30 headingStack.length = level + 1
31 // Derive anchor the same way VitePress does: lowercase, spaces→hyphens, strip non-word
32 currentAnchor = text
33 .toLowerCase()
34 .replace(/[^\w\s-]/g, '')
35 .replace(/\s+/g, '-')
36 .replace(/-+/g, '-')
37 .replace(/^-|-$/g, '')
38 continue 99 continue
39 } 100 }
40 101
@@ -42,7 +103,7 @@ function extractLinksFromMarkdown(src: string, pageId: string): PageLink[] {
42 const linkRE = /\[([^\]]*)\]\((https?:\/\/[^)]+)\)/g 103 const linkRE = /\[([^\]]*)\]\((https?:\/\/[^)]+)\)/g
43 let m: RegExpExecArray | null 104 let m: RegExpExecArray | null
44 while ((m = linkRE.exec(line)) !== null) { 105 while ((m = linkRE.exec(line)) !== null) {
45 const linkText = m[1].trim() 106 const linkText = renderEmojiShortcodes(m[1].trim())
46 const href = m[2].trim() 107 const href = m[2].trim()
47 const key = href + '\x00' + currentAnchor 108 const key = href + '\x00' + currentAnchor
48 if (seen.has(key)) continue 109 if (seen.has(key)) continue
@@ -100,17 +161,20 @@ export function urlSearchDevPlugin() {
100 return { 161 return {
101 name: 'url-search-dev', 162 name: 'url-search-dev',
102 configureServer(server: any) { 163 configureServer(server: any) {
103 server.middlewares.use('/url-search-index.json', (_req: any, res: any) => { 164 server.middlewares.use(
104 const seen = new Set<string>() 165 '/url-search-index.json',
105 const deduped = collected.filter((l) => { 166 (_req: any, res: any) => {
106 const key = l.href + '\x00' + l.pageId + '\x00' + l.anchor 167 const seen = new Set<string>()
107 if (seen.has(key)) return false 168 const deduped = collected.filter((l) => {
108 seen.add(key) 169 const key = l.href + '\x00' + l.pageId + '\x00' + l.anchor
109 return true 170 if (seen.has(key)) return false
110 }) 171 seen.add(key)
111 res.setHeader('Content-Type', 'application/json') 172 return true
112 res.end(JSON.stringify(deduped)) 173 })
113 }) 174 res.setHeader('Content-Type', 'application/json')
175 res.end(JSON.stringify(deduped))
176 }
177 )
114 } 178 }
115 } 179 }
116}\ No newline at end of file 180}
docs/.vitepress/theme/components/Search.vue +900 −457
@@ -1,6 +1,6 @@
1<script lang="ts" setup> 1<script lang="ts" setup>
2import MiniSearch, { type SearchResult } from 'minisearch' 2import MiniSearch, { type SearchResult } from 'minisearch'
3import { type DefaultTheme, dataSymbol, inBrowser, useRouter } from 'vitepress' 3import { dataSymbol, type DefaultTheme, inBrowser, useRouter } from 'vitepress'
4import { 4import {
5 computed, 5 computed,
6 createApp, 6 createApp,
@@ -26,9 +26,11 @@ import {
26 useLocalStorage, 26 useLocalStorage,
27 useScrollLock, 27 useScrollLock,
28 useSessionStorage, 28 useSessionStorage,
29 useStorage,
29 watchDebounced 30 watchDebounced
30} from '@vueuse/core' 31} from '@vueuse/core'
31import { useFocusTrap } from '@vueuse/integrations/useFocusTrap' 32import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
33import { AnimatePresence, motion } from 'motion-v'
32 34
33// @ts-ignore 35// @ts-ignore
34import localSearchIndex from '@localSearchIndex' 36import localSearchIndex from '@localSearchIndex'
@@ -37,23 +39,22 @@ import {
37 ArrowRight, 39 ArrowRight,
38 ChevronRight, 40 ChevronRight,
39 Delete, 41 Delete,
40 ExternalLink,
41 File, 42 File,
42 Globe, 43 Globe,
43 Hash, 44 Hash,
44 LayoutList,
45 List, 45 List,
46 Locate,
47 LocateOff, 46 LocateOff,
47 Regex,
48 TextAlignStart 48 TextAlignStart
49} from 'lucide-vue-next' 49} from 'lucide-vue-next'
50import Mark from 'mark.js/dist/mark.es6.js' 50import Mark from 'mark.js/dist/mark.es6.js'
51import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' 51import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
52import { LRUCache } from '../composables/search/lru-cache' 52import { sidebar } from '../../configs/constants'
53import type { PageLink } from '../../plugins/urlSearchPlugin' 53import type { PageLink } from '../../plugins/urlSearchPlugin'
54import { LRUCache } from '../composables/search/lru-cache'
54import { createSearchTranslate } from '../composables/search/translation' 55import { createSearchTranslate } from '../composables/search/translation'
55import { useData } from '../composables/search/use-data' 56import { useData } from '../composables/search/use-data'
56import { sidebar } from '../../configs/constants' 57import { LowEndDeviceModeStorageKey } from '../constants'
57 58
58export interface FooterTranslations { 59export interface FooterTranslations {
59 selectText?: string 60 selectText?: string
@@ -139,6 +140,117 @@ const filterText = disableQueryPersistence.value
139 ? ref('') 140 ? ref('')
140 : useSessionStorage('vitepress:local-search-filter', '') 141 : useSessionStorage('vitepress:local-search-filter', '')
141 142
143const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off')
144const searchAnimationsEnabled = computed(() => lowEndDeviceMode.value !== 'on')
145const showKeyboardShortcuts = computed(() => !filterText.value)
146
147const SearchMotionDiv = motion.div
148const SearchMotionForm = motion.form
149const SearchMotionLi = motion.li
150const searchMotionDiv = computed(() =>
151 searchAnimationsEnabled.value ? SearchMotionDiv : 'div'
152)
153const searchMotionForm = computed(() =>
154 searchAnimationsEnabled.value ? SearchMotionForm : 'form'
155)
156const searchMotionLi = computed(() =>
157 searchAnimationsEnabled.value ? SearchMotionLi : 'li'
158)
159const searchMotionEase = [0.16, 1, 0.3, 1]
160
161const backdropMotion = computed(() =>
162 searchAnimationsEnabled.value
163 ? {
164 initial: { opacity: 0 },
165 animate: { opacity: 1 },
166 exit: { opacity: 0 },
167 transition: { duration: 0.55, ease: searchMotionEase }
168 }
169 : {}
170)
171
172const shellMotion = computed(() =>
173 searchAnimationsEnabled.value
174 ? {
175 layout: 'size',
176 initial: { opacity: 0, scale: 0.9375 },
177 animate: { opacity: 1, scale: 1 },
178 exit: { opacity: 0, scale: 0.9375 },
179 transition: { duration: 0.55, ease: searchMotionEase }
180 }
181 : {}
182)
183
184const formMotion = computed(() =>
185 searchAnimationsEnabled.value ? { layout: 'position' } : {}
186)
187
188const ribbonMotion = computed(() =>
189 searchAnimationsEnabled.value
190 ? {
191 layout: 'position',
192 initial: { opacity: 0, height: 0 },
193 animate: { opacity: 1, height: 'auto' },
194 exit: { opacity: 0, height: 0 },
195 transition: { duration: 0.4, ease: searchMotionEase }
196 }
197 : {}
198)
199
200const emptyStateMotion = computed(() =>
201 searchAnimationsEnabled.value
202 ? {
203 initial: { opacity: 0 },
204 animate: {
205 opacity: 1,
206 transition: { delay: 0.1 }
207 },
208 exit: {
209 opacity: 0,
210 height: 0,
211 transition: { duration: 0.2 }
212 },
213 transition: { duration: 0.7, ease: searchMotionEase }
214 }
215 : {}
216)
217
218function resultMotion(index: number) {
219 if (!searchAnimationsEnabled.value) return {}
220 return {
221 layout: true,
222 initial: { opacity: 0, scale: 0.9375 },
223 animate: { opacity: 1, scale: 1 },
224 exit: {
225 opacity: 0,
226 scale: 0.9375,
227 height: 0,
228 transition: { duration: 0.25 }
229 },
230 transition: {
231 duration: 0.55,
232 ease: searchMotionEase,
233 delay: index * 0.02
234 }
235 }
236}
237
238const excerptMotion = computed(() =>
239 searchAnimationsEnabled.value
240 ? {
241 layout: true,
242 initial: { height: 0 },
243 animate: { height: '84px' },
244 exit: { height: 0 },
245 transition: { duration: 0.4, ease: searchMotionEase }
246 }
247 : {}
248)
249
250const footerMotion = computed(() =>
251 searchAnimationsEnabled.value ? { layout: true } : {}
252)
253
142const urlFilterDebounced = ref(filterText.value) 254const urlFilterDebounced = ref(filterText.value)
143let urlDebounceTimer: ReturnType<typeof setTimeout> | undefined 255let urlDebounceTimer: ReturnType<typeof setTimeout> | undefined
144watch(filterText, (v) => { 256watch(filterText, (v) => {
@@ -180,7 +292,10 @@ let allLinksFetchPromise: Promise<void> | null = null
180 292
181async function ensureAllLinks() { 293async function ensureAllLinks() {
182 if (allLinks.value.length > 0) return 294 if (allLinks.value.length > 0) return
183 if (allLinksFetchPromise) { await allLinksFetchPromise; return } 295 if (allLinksFetchPromise) {
296 await allLinksFetchPromise
297 return
298 }
184 allLinksFetchPromise = fetch('/url-search-index.json') 299 allLinksFetchPromise = fetch('/url-search-index.json')
185 .then((r) => r.json()) 300 .then((r) => r.json())
186 .then((data: PageLink[]) => { 301 .then((data: PageLink[]) => {
@@ -191,12 +306,18 @@ async function ensureAllLinks() {
191 }) 306 })
192 allLinks.value = data 307 allLinks.value = data
193 }) 308 })
194 .catch(() => { allLinks.value = [] }) 309 .catch(() => {
195 .finally(() => { allLinksFetchPromise = null }) 310 allLinks.value = []
311 })
312 .finally(() => {
313 allLinksFetchPromise = null
314 })
196 await allLinksFetchPromise 315 await allLinksFetchPromise
197} 316}
198 317
199watch(urlSearchMode, (active) => { if (active) ensureAllLinks() }, { immediate: true }) 318watch(urlSearchMode, (active) => {
319 if (active) ensureAllLinks()
320}, { immediate: true })
200 321
201interface UrlResult { 322interface UrlResult {
202 href: string 323 href: string
@@ -236,7 +357,9 @@ const urlPageGroups = computed(() => {
236 if (existing) existing.count++ 357 if (existing) existing.count++
237 else map.set(key, { key, label: getPageLabel(key), count: 1 }) 358 else map.set(key, { key, label: getPageLabel(key), count: 1 })
238 } 359 }
239 return [...map.values()].sort((a, b) => getPageOrder(a.key) - getPageOrder(b.key)) 360 return [...map.values()].sort((a, b) =>
361 getPageOrder(a.key) - getPageOrder(b.key)
362 )
240}) 363})
241 364
242// Full match set honoring the active ribbon page filter (uncapped). 365// Full match set honoring the active ribbon page filter (uncapped).
@@ -261,6 +384,7 @@ const filteredUrlResults = computed((): UrlResult[] => {
261 const start = (urlCurrentPage.value - 1) * URL_PAGE_SIZE 384 const start = (urlCurrentPage.value - 1) * URL_PAGE_SIZE
262 const end = start + URL_PAGE_SIZE 385 const end = start + URL_PAGE_SIZE
263 const out: UrlResult[] = [] 386 const out: UrlResult[] = []
387 const query = urlFilterDebounced.value.trim()
264 for (let i = start; i < end && i < matches.length; i++) { 388 for (let i = start; i < end && i < matches.length; i++) {
265 const link = matches[i] 389 const link = matches[i]
266 out.push({ 390 out.push({
@@ -269,12 +393,43 @@ const filteredUrlResults = computed((): UrlResult[] => {
269 pageId: link.pageId, 393 pageId: link.pageId,
270 anchor: link.anchor, 394 anchor: link.anchor,
271 titles: link.titles, 395 titles: link.titles,
272 highlighted: link.href // not currently rendered; kept for type compat 396 highlighted: highlightUrl(link.href, query)
273 }) 397 })
274 } 398 }
275 return out 399 return out
276}) 400})
277 401
402function escapeHtml(value: string) {
403 return value
404 .replace(/&/g, '&amp;')
405 .replace(/</g, '&lt;')
406 .replace(/>/g, '&gt;')
407 .replace(/"/g, '&quot;')
408 .replace(/'/g, '&#39;')
409}
410
411function highlightUrl(url: string, query: string) {
412 const needle = query.trim()
413 if (!needle) return escapeHtml(url)
414
415 const lowerUrl = url.toLowerCase()
416 const lowerNeedle = needle.toLowerCase()
417 let out = ''
418 let cursor = 0
419 let index = lowerUrl.indexOf(lowerNeedle)
420
421 while (index !== -1) {
422 out += escapeHtml(url.slice(cursor, index))
423 out += `<mark class="url-highlight">${
424 escapeHtml(url.slice(index, index + needle.length))
425 }</mark>`
426 cursor = index + needle.length
427 index = lowerUrl.indexOf(lowerNeedle, cursor)
428 }
429
430 return out + escapeHtml(url.slice(cursor))
431}
432
278// Compact page-number list with ellipses, e.g. [1, '…', 4, 5, 6, '…', 12]. 433// Compact page-number list with ellipses, e.g. [1, '…', 4, 5, 6, '…', 12].
279const urlPageList = computed<(number | '…')[]>(() => { 434const urlPageList = computed<(number | '…')[]>(() => {
280 const total = urlTotalPages.value 435 const total = urlTotalPages.value
@@ -333,7 +488,6 @@ function setUrlPageFilter(key: string | null) {
333 }) 488 })
334} 489}
335 490
336
337const disableDetailedView = computed(() => { 491const disableDetailedView = computed(() => {
338 return ( 492 return (
339 theme.value.search?.provider === 'local' && 493 theme.value.search?.provider === 'local' &&
@@ -548,7 +702,7 @@ const ribbonCanScrollRight = ref(false)
548function getRibbonTrack(): HTMLElement | null { 702function getRibbonTrack(): HTMLElement | null {
549 return ( 703 return (
550 ribbonTrack.value ?? 704 ribbonTrack.value ??
551 (el.value?.querySelector('.page-ribbon-track') as HTMLElement | null) 705 (el.value?.querySelector('.page-ribbon-track') as HTMLElement | null)
552 ) 706 )
553} 707}
554 708
@@ -564,6 +718,48 @@ function updateRibbonOverflow() {
564 track.scrollWidth - track.clientWidth - track.scrollLeft > 2 718 track.scrollWidth - track.clientWidth - track.scrollLeft > 2
565} 719}
566 720
721function scrollActivePagePillIntoView(direction = 0) {
722 nextTick(() => {
723 const track = getRibbonTrack()
724 if (!track) return
725
726 const pills = [...track.querySelectorAll<HTMLElement>('.page-pill')]
727 const activeIndex = pills.findIndex((pill) =>
728 pill.classList.contains('active')
729 )
730 const active = pills[activeIndex]
731 if (!active) return
732
733 const trackRect = track.getBoundingClientRect()
734 const activeRect = active.getBoundingClientRect()
735 const gap = 8
736 let nextScrollLeft = track.scrollLeft
737
738 if (activeRect.left < trackRect.left) {
739 nextScrollLeft += activeRect.left - trackRect.left - gap
740 } else if (activeRect.right > trackRect.right) {
741 nextScrollLeft += activeRect.right - trackRect.right + gap
742 }
743
744 const peek = pills[activeIndex + Math.sign(direction)]
745 if (peek) {
746 const peekRect = peek.getBoundingClientRect()
747 if (direction > 0 && peekRect.right > trackRect.right) {
748 nextScrollLeft += peekRect.right - trackRect.right + gap
749 } else if (direction < 0 && peekRect.left < trackRect.left) {
750 nextScrollLeft += peekRect.left - trackRect.left - gap
751 }
752 }
753
754 const max = track.scrollWidth - track.clientWidth
755 track.scrollTo({
756 left: Math.max(0, Math.min(max, nextScrollLeft)),
757 behavior: searchAnimationsEnabled.value ? 'smooth' : 'auto'
758 })
759 updateRibbonOverflow()
760 })
761}
762
567let ribbonAnimHandle = 0 763let ribbonAnimHandle = 0
568 764
569function scrollRibbon(direction: number) { 765function scrollRibbon(direction: number) {
@@ -576,6 +772,13 @@ function scrollRibbon(direction: number) {
576 if (to === from) return 772 if (to === from) return
577 773
578 if (ribbonAnimHandle) cancelAnimationFrame(ribbonAnimHandle) 774 if (ribbonAnimHandle) cancelAnimationFrame(ribbonAnimHandle)
775
776 if (!searchAnimationsEnabled.value) {
777 track.scrollLeft = to
778 updateRibbonOverflow()
779 return
780 }
781
579 const duration = 280 782 const duration = 280
580 const start = performance.now() 783 const start = performance.now()
581 const ease = (t: number) => 1 - Math.pow(1 - t, 3) 784 const ease = (t: number) => 1 - Math.pow(1 - t, 3)
@@ -688,8 +891,18 @@ function buildDocExcerpt(
688} 891}
689 892
690watchDebounced( 893watchDebounced(
691 () => [searchIndex.value, filterText.value, showDetailedList.value, searchMode.value] as const, 894 () =>
692 async ([index, filterTextValue, showDetailedListValue, mode], old, onCleanup) => { 895 [
896 searchIndex.value,
897 filterText.value,
898 showDetailedList.value,
899 searchMode.value
900 ] as const,
901 async (
902 [index, filterTextValue, showDetailedListValue, mode],
903 old,
904 onCleanup
905 ) => {
693 if (old?.[0] !== index) { 906 if (old?.[0] !== index) {
694 // in case of hmr 907 // in case of hmr
695 cache.clear() 908 cache.clear()
@@ -714,11 +927,14 @@ watchDebounced(
714 fuzzy: mode === 'fuzzy' ? (0.3 as number | false) : false, 927 fuzzy: mode === 'fuzzy' ? (0.3 as number | false) : false,
715 prefix: mode === 'fuzzy' ? (term: string) => term.length > 3 : false, 928 prefix: mode === 'fuzzy' ? (term: string) => term.length > 3 : false,
716 maxFuzzy: mode === 'fuzzy' ? 1 : 0, 929 maxFuzzy: mode === 'fuzzy' ? 1 : 0,
717 boost: { title: 10, titles: 4, text: 1 }, 930 boost: { title: 10, titles: 4, text: 1 }
718 } 931 }
719 932
720 // Search 933 // Search
721 const ranked = index.search(filterTextValue, dynamicSearchOptions) as (SearchResult & Result)[] 934 const ranked = index.search(
935 filterTextValue,
936 dynamicSearchOptions
937 ) as (SearchResult & Result)[]
722 938
723 const top = ranked.slice(0, 50) 939 const top = ranked.slice(0, 50)
724 const seen = new Set(top.map((r) => r.id)) 940 const seen = new Set(top.map((r) => r.id))
@@ -748,8 +964,8 @@ watchDebounced(
748 return { ...r, text: map?.get(anchor) ?? '' } 964 return { ...r, text: map?.get(anchor) ?? '' }
749 }) 965 })
750 .sort((a, b) => { 966 .sort((a, b) => {
751 const pageDiff = 967 const pageDiff = getPageOrder(getPageKey(a.id)) -
752 getPageOrder(getPageKey(a.id)) - getPageOrder(getPageKey(b.id)) 968 getPageOrder(getPageKey(b.id))
753 if (pageDiff !== 0) return pageDiff 969 if (pageDiff !== 0) return pageDiff
754 return getDocOrder(a.id) - getDocOrder(b.id) 970 return getDocOrder(a.id) - getDocOrder(b.id)
755 }) 971 })
@@ -855,21 +1071,37 @@ function centerExcerpts() {
855 node = node.offsetParent as HTMLElement | null 1071 node = node.offsetParent as HTMLElement | null
856 } 1072 }
857 1073
858 const targetScrollTop = offset - viewportHeight / 2 + markNode.offsetHeight / 2 1074 const targetScrollTop = offset - viewportHeight / 2 +
1075 markNode.offsetHeight / 2
859 excerptElement.scrollTop = Math.max(0, targetScrollTop) 1076 excerptElement.scrollTop = Math.max(0, targetScrollTop)
860 } 1077 }
861} 1078}
862 1079
863let centerHandle = 0 1080let centerHandle = 0
864 1081
865function centerExcerptsUntilSettled() { 1082function centerExcerptsUntilSettled(
866 // No layout animations to wait on anymore — a single pass after the 1083 duration = searchAnimationsEnabled.value ? 450 : 0
867 // DOM has painted is enough. 1084) {
868 if (centerHandle) cancelAnimationFrame(centerHandle) 1085 if (centerHandle) cancelAnimationFrame(centerHandle)
869 centerHandle = requestAnimationFrame(() => { 1086
1087 if (duration <= 0) {
1088 centerHandle = requestAnimationFrame(() => {
1089 centerExcerpts()
1090 centerHandle = 0
1091 })
1092 return
1093 }
1094
1095 const start = performance.now()
1096 const tick = () => {
870 centerExcerpts() 1097 centerExcerpts()
871 centerHandle = 0 1098 if (performance.now() - start < duration) {
872 }) 1099 centerHandle = requestAnimationFrame(tick)
1100 } else {
1101 centerHandle = 0
1102 }
1103 }
1104 centerHandle = requestAnimationFrame(tick)
873} 1105}
874 1106
875onBeforeUnmount(() => { 1107onBeforeUnmount(() => {
@@ -980,7 +1212,9 @@ const disableMouseOver = ref(true)
980 1212
981// Active result list length (URL mode vs normal mode) — current page only 1213// Active result list length (URL mode vs normal mode) — current page only
982const activeResultsLength = computed(() => 1214const activeResultsLength = computed(() =>
983 urlSearchMode.value ? filteredUrlResults.value.length : pagedResults.value.length 1215 urlSearchMode.value
1216 ? filteredUrlResults.value.length
1217 : pagedResults.value.length
984) 1218)
985 1219
986watch(pagedResults, (r) => { 1220watch(pagedResults, (r) => {
@@ -1004,6 +1238,40 @@ function scrollToSelectedResult() {
1004 }) 1238 })
1005} 1239}
1006 1240
1241function goToSearchPageDelta(delta: number) {
1242 if (urlSearchMode.value) {
1243 const target = urlCurrentPage.value + delta
1244 if (target < 1 || target > urlTotalPages.value) return false
1245 goToUrlPage(target)
1246 return true
1247 }
1248
1249 const target = normalCurrentPage.value + delta
1250 if (target < 1 || target > normalTotalPages.value) return false
1251 goToNormalPage(target)
1252 return true
1253}
1254
1255function cyclePageTab(delta: number) {
1256 if (urlSearchMode.value) {
1257 if (urlPageGroups.value.length <= 1) return false
1258 const keys = [null, ...urlPageGroups.value.map((group) => group.key)]
1259 const current = keys.indexOf(urlActivePageFilter.value)
1260 const next = (current + delta + keys.length) % keys.length
1261 setUrlPageFilter(keys[next])
1262 scrollActivePagePillIntoView(delta)
1263 return true
1264 }
1265
1266 if (pageGroups.value.length <= 1) return false
1267 const keys = [null, ...pageGroups.value.map((group) => group.key)]
1268 const current = keys.indexOf(activePageFilter.value)
1269 const next = (current + delta + keys.length) % keys.length
1270 setPageFilter(keys[next])
1271 scrollActivePagePillIntoView(delta)
1272 return true
1273}
1274
1007onKeyStroke('ArrowUp', (event) => { 1275onKeyStroke('ArrowUp', (event) => {
1008 event.preventDefault() 1276 event.preventDefault()
1009 selectedIndex.value-- 1277 selectedIndex.value--
@@ -1024,8 +1292,36 @@ onKeyStroke('ArrowDown', (event) => {
1024 scrollToSelectedResult() 1292 scrollToSelectedResult()
1025}) 1293})
1026 1294
1295onKeyStroke('ArrowLeft', (event) => {
1296 if (!goToSearchPageDelta(-1)) return
1297 event.preventDefault()
1298 disableMouseOver.value = true
1299})
1300
1301onKeyStroke('ArrowRight', (event) => {
1302 if (!goToSearchPageDelta(1)) return
1303 event.preventDefault()
1304 disableMouseOver.value = true
1305})
1306
1307onKeyStroke('Tab', (event) => {
1308 if (!showSearch.value) return
1309 if (!cyclePageTab(event.shiftKey ? -1 : 1)) return
1310 event.preventDefault()
1311 disableMouseOver.value = true
1312})
1313
1027const router = useRouter() 1314const router = useRouter()
1028 1315
1316function navigateToUrlResult(item: UrlResult) {
1317 window.dispatchEvent(
1318 new CustomEvent('search-nav', { detail: { query: filterText.value } })
1319 )
1320 const dest = item.anchor ? item.pageId + '#' + item.anchor : item.pageId
1321 router.go(dest)
1322 showSearch.value = false
1323}
1324
1029onKeyStroke('Enter', (e) => { 1325onKeyStroke('Enter', (e) => {
1030 if (e.isComposing) return 1326 if (e.isComposing) return
1031 1327
@@ -1046,10 +1342,7 @@ onKeyStroke('Enter', (e) => {
1046 if (urlSearchMode.value) { 1342 if (urlSearchMode.value) {
1047 const selectedUrl = filteredUrlResults.value[index] 1343 const selectedUrl = filteredUrlResults.value[index]
1048 if (selectedUrl) { 1344 if (selectedUrl) {
1049 window.dispatchEvent(new CustomEvent('search-nav', { detail: { query: filterText.value } })) 1345 navigateToUrlResult(selectedUrl)
1050 const dest = selectedUrl.anchor ? selectedUrl.pageId + '#' + selectedUrl.anchor : selectedUrl.pageId
1051 router.go(dest)
1052 showSearch.value = false
1053 } 1346 }
1054 return 1347 return
1055 } 1348 }
@@ -1177,406 +1470,524 @@ function onMouseMove(e: MouseEvent) {
1177 class="VPLocalSearchBox" 1470 class="VPLocalSearchBox"
1178 :class="{ 'pointer-events-none': !showSearch }" 1471 :class="{ 'pointer-events-none': !showSearch }"
1179 > 1472 >
1180 <div 1473 <AnimatePresence>
1181 v-if="showSearch" 1474 <component
1182 class="backdrop" 1475 :is="searchMotionDiv"
1183 @click="showSearch = false" 1476 v-if="showSearch"
1184 /> 1477 class="backdrop"
1185 1478 @click="showSearch = false"
1186 <div 1479 v-bind="backdropMotion"
1187 v-if="showSearch" 1480 />
1188 class="shell" 1481 </AnimatePresence>
1189 > 1482
1190 <form 1483 <AnimatePresence>
1191 class="search-bar" 1484 <component
1192 @pointerup="onSearchBarClick($event)" 1485 :is="searchMotionDiv"
1193 @submit.prevent="" 1486 v-if="showSearch"
1487 class="shell"
1488 v-bind="shellMotion"
1194 > 1489 >
1195 <label 1490 <component
1196 :title="buttonText" 1491 :is="searchMotionForm"
1197 id="localsearch-label" 1492 class="search-bar"
1198 for="localsearch-input" 1493 v-bind="formMotion"
1494 @pointerup="onSearchBarClick($event)"
1495 @submit.prevent=""
1199 > 1496 >
1200 <span 1497 <label
1201 aria-hidden="true" 1498 :title="buttonText"
1202 class="vpi-search search-icon local-search-icon" 1499 id="localsearch-label"
1203 /> 1500 for="localsearch-input"
1204 </label>
1205 <div class="search-actions before">
1206 <button
1207 class="back-button"
1208 :title="translate('modal.backButtonTitle')"
1209 @click="showSearch = false"
1210 > 1501 >
1211 <span class="vpi-arrow-left local-search-icon" /> 1502 <span
1212 </button> 1503 aria-hidden="true"
1213 </div> 1504 class="vpi-search search-icon local-search-icon"
1214 <input 1505 />
1215 ref="searchInput" 1506 </label>
1216 v-model="filterText" 1507 <div class="search-actions before">
1217 :aria-activedescendant="selectedIndex > -1
1218 ? 'localsearch-item-' + selectedIndex
1219 : undefined"
1220 aria-autocomplete="both"
1221 :aria-controls="results?.length ? 'localsearch-list' : undefined"
1222 aria-labelledby="localsearch-label"
1223 autocapitalize="off"
1224 autocomplete="off"
1225 autocorrect="off"
1226 class="search-input"
1227 id="localsearch-input"
1228 enterkeyhint="go"
1229 maxlength="64"
1230 :placeholder="buttonText"
1231 spellcheck="false"
1232 type="search"
1233 />
1234 <div class="search-actions">
1235 <div v-if="!disableDetailedView && searchMode !== 'url'" class="view-group toolbar-group">
1236 <button 1508 <button
1237 type="button" 1509 class="back-button"
1238 class="mode-btn" 1510 :title="translate('modal.backButtonTitle')"
1239 :class="{ 'mode-active': showDetailedList }" 1511 @click="showSearch = false"
1240 title="Detail view (Consumes more RAM)"
1241 @click="showDetailedList ? showDetailedList = false : showDetailedList = true"
1242 > 1512 >
1243 <LayoutList :size="18" stroke-width="1.25" /> 1513 <span class="vpi-arrow-left local-search-icon" />
1244 </button>
1245 <button
1246 type="button"
1247 class="mode-btn"
1248 :class="{ 'mode-active': !showDetailedList }"
1249 title="List view (Consumes less RAM)"
1250 @click="!showDetailedList ? showDetailedList = true : showDetailedList = false"
1251 >
1252 <List :size="18" stroke-width="1.25" />
1253 </button> 1514 </button>
1254 </div> 1515 </div>
1255 <div class="search-mode-group toolbar-group"> 1516 <input
1256 <button 1517 ref="searchInput"
1257 type="button" 1518 v-model="filterText"
1258 class="mode-btn" 1519 :aria-activedescendant="selectedIndex > -1
1259 :class="{ 'mode-active': searchMode === 'exact' }" 1520 ? 'localsearch-item-' + selectedIndex
1260 title="Exact search" 1521 : undefined"
1261 @click="searchMode === 'exact' ? cycleSearchMode() : searchMode = 'exact'" 1522 aria-autocomplete="both"
1523 :aria-controls="results?.length ? 'localsearch-list' : undefined"
1524 aria-labelledby="localsearch-label"
1525 autocapitalize="off"
1526 autocomplete="off"
1527 autocorrect="off"
1528 class="search-input"
1529 id="localsearch-input"
1530 enterkeyhint="go"
1531 maxlength="64"
1532 :placeholder="buttonText"
1533 spellcheck="false"
1534 type="search"
1535 />
1536 <div class="search-actions">
1537 <div
1538 v-if="!disableDetailedView && searchMode !== 'url'"
1539 class="view-group toolbar-group"
1262 > 1540 >
1263 <Locate :size="18" stroke-width="1.25" /> 1541 <button
1264 </button> 1542 type="button"
1543 class="mode-btn"
1544 :class="{ 'mode-active': showDetailedList }"
1545 title="Detail view (Consumes more RAM)"
1546 @click="showDetailedList
1547 ? showDetailedList = false
1548 : showDetailedList = true"
1549 >
1550 <TextAlignStart :size="18" stroke-width="1.25" />
1551 </button>
1552 <button
1553 type="button"
1554 class="mode-btn"
1555 :class="{ 'mode-active': !showDetailedList }"
1556 title="List view (Consumes less RAM)"
1557 @click="!showDetailedList
1558 ? showDetailedList = true
1559 : showDetailedList = false"
1560 >
1561 <List :size="18" stroke-width="1.25" />
1562 </button>
1563 </div>
1564 <div class="search-mode-group toolbar-group">
1565 <button
1566 type="button"
1567 class="mode-btn"
1568 :class="{ 'mode-active': searchMode === 'exact' }"
1569 title="Exact search"
1570 @click="searchMode === 'exact'
1571 ? cycleSearchMode()
1572 : searchMode = 'exact'"
1573 >
1574 <Regex :size="18" stroke-width="1.25" />
1575 </button>
1576 <button
1577 type="button"
1578 class="mode-btn"
1579 :class="{ 'mode-active': searchMode === 'fuzzy' }"
1580 title="Fuzzy search"
1581 @click="searchMode === 'fuzzy'
1582 ? cycleSearchMode()
1583 : searchMode = 'fuzzy'"
1584 >
1585 <LocateOff :size="18" stroke-width="1.25" />
1586 </button>
1587 <button
1588 type="button"
1589 class="mode-btn"
1590 :class="{ 'mode-active': searchMode === 'url' }"
1591 title="URL search"
1592 @click="searchMode === 'url'
1593 ? cycleSearchMode()
1594 : searchMode = 'url'"
1595 >
1596 <Globe :size="18" stroke-width="1.25" />
1597 </button>
1598 </div>
1265 <button 1599 <button
1266 type="button" 1600 class="clear-button"
1267 class="mode-btn" 1601 type="reset"
1268 :class="{ 'mode-active': searchMode === 'fuzzy' }" 1602 :disabled="disableReset"
1269 title="Fuzzy search" 1603 :title="translate('modal.resetButtonTitle')"
1270 @click="searchMode === 'fuzzy' ? cycleSearchMode() : searchMode = 'fuzzy'" 1604 @click="resetSearch"
1271 > 1605 >
1272 <LocateOff :size="18" stroke-width="1.25" /> 1606 <Delete :size="19" stroke-width="1.25" />
1273 </button>
1274 <button
1275 type="button"
1276 class="mode-btn"
1277 :class="{ 'mode-active': searchMode === 'url' }"
1278 title="URL search"
1279 @click="searchMode === 'url' ? cycleSearchMode() : searchMode = 'url'"
1280 >
1281 <Globe :size="18" stroke-width="1.25" />
1282 </button> 1607 </button>
1283 </div> 1608 </div>
1284 <button 1609 </component>
1285 class="clear-button" 1610
1286 type="reset" 1611 <AnimatePresence>
1287 :disabled="disableReset" 1612 <component
1288 :title="translate('modal.resetButtonTitle')" 1613 :is="searchMotionDiv"
1289 @click="resetSearch" 1614 v-if="urlSearchMode
1615 ? urlPageGroups.length > 1
1616 : pageGroups.length > 1"
1617 class="page-ribbon"
1618 :class="{
1619 'can-scroll-left': ribbonCanScrollLeft,
1620 'can-scroll-right': ribbonCanScrollRight
1621 }"
1622 v-bind="ribbonMotion"
1290 > 1623 >
1291 <Delete :size="19" stroke-width="1.25" />
1292 </button>
1293 </div>
1294 </form>
1295
1296 <div
1297 v-if="urlSearchMode ? urlPageGroups.length > 1 : pageGroups.length > 1"
1298 class="page-ribbon"
1299 >
1300 <button
1301 v-if="ribbonCanScrollLeft"
1302 type="button"
1303 class="page-ribbon-arrow left"
1304 aria-label="Scroll filters left"
1305 @click="scrollRibbon(-1)"
1306 >
1307 <ChevronRight :size="18" stroke-width="1.75" />
1308 </button>
1309 <div
1310 ref="ribbonTrack"
1311 class="page-ribbon-track"
1312 @scroll="updateRibbonOverflow"
1313 >
1314 <!-- URL mode tabs -->
1315 <template v-if="urlSearchMode">
1316 <button
1317 type="button"
1318 class="page-pill"
1319 :class="{ active: urlActivePageFilter === null }"
1320 @click="setUrlPageFilter(null)"
1321 >
1322 All
1323 <span class="page-pill-count">{{ urlMatches.length }}</span>
1324 </button>
1325 <button 1624 <button
1326 v-for="group in urlPageGroups" 1625 v-if="ribbonCanScrollLeft"
1327 :key="group.key"
1328 type="button" 1626 type="button"
1329 class="page-pill" 1627 class="page-ribbon-arrow left"
1330 :class="{ active: urlActivePageFilter === group.key }" 1628 aria-label="Scroll filters left"
1331 @click="setUrlPageFilter(group.key)" 1629 @click="scrollRibbon(-1)"
1332 > 1630 >
1333 <span class="page-pill-label">{{ group.label }}</span> 1631 <ChevronRight :size="18" stroke-width="1.75" />
1334 <span class="page-pill-count">{{ group.count }}</span>
1335 </button> 1632 </button>
1336 </template> 1633 <div
1337 <!-- Normal mode tabs --> 1634 ref="ribbonTrack"
1338 <template v-else> 1635 class="page-ribbon-track"
1339 <button 1636 @scroll="updateRibbonOverflow"
1340 type="button"
1341 class="page-pill"
1342 :class="{ active: activePageFilter === null }"
1343 @click="setPageFilter(null)"
1344 > 1637 >
1345 All 1638 <!-- URL mode tabs -->
1346 <span class="page-pill-count">{{ results.length }}</span> 1639 <template v-if="urlSearchMode">
1347 </button> 1640 <button
1641 type="button"
1642 class="page-pill"
1643 :class="{
1644 active: urlActivePageFilter === null
1645 }"
1646 @click="setUrlPageFilter(null)"
1647 >
1648 All
1649 <span class="page-pill-count">{{ urlMatches.length }}</span>
1650 </button>
1651 <button
1652 v-for="group in urlPageGroups"
1653 :key="group.key"
1654 type="button"
1655 class="page-pill"
1656 :class="{
1657 active:
1658 urlActivePageFilter === group.key
1659 }"
1660 @click="setUrlPageFilter(group.key)"
1661 >
1662 <span class="page-pill-label">{{ group.label }}</span>
1663 <span class="page-pill-count">{{ group.count }}</span>
1664 </button>
1665 </template>
1666 <!-- Normal mode tabs -->
1667 <template v-else>
1668 <button
1669 type="button"
1670 class="page-pill"
1671 :class="{ active: activePageFilter === null }"
1672 @click="setPageFilter(null)"
1673 >
1674 All
1675 <span class="page-pill-count">{{ results.length }}</span>
1676 </button>
1677 <button
1678 v-for="group in pageGroups"
1679 :key="group.key"
1680 type="button"
1681 class="page-pill"
1682 :class="{
1683 active: activePageFilter === group.key
1684 }"
1685 @click="setPageFilter(group.key)"
1686 >
1687 <span class="page-pill-label">{{ group.label }}</span>
1688 <span class="page-pill-count">{{ group.count }}</span>
1689 </button>
1690 </template>
1691 </div>
1348 <button 1692 <button
1349 v-for="group in pageGroups" 1693 v-if="ribbonCanScrollRight"
1350 :key="group.key"
1351 type="button" 1694 type="button"
1352 class="page-pill" 1695 class="page-ribbon-arrow right"
1353 :class="{ active: activePageFilter === group.key }" 1696 aria-label="Scroll filters right"
1354 @click="setPageFilter(group.key)" 1697 @click="scrollRibbon(1)"
1355 > 1698 >
1356 <span class="page-pill-label">{{ group.label }}</span> 1699 <ChevronRight :size="18" stroke-width="1.75" />
1357 <span class="page-pill-count">{{ group.count }}</span>
1358 </button> 1700 </button>
1359 </template> 1701 </component>
1360 </div> 1702 </AnimatePresence>
1361 <button 1703
1362 v-if="ribbonCanScrollRight" 1704 <ul
1363 type="button" 1705 ref="resultsEl"
1364 class="page-ribbon-arrow right" 1706 :id="results?.length ? 'localsearch-list' : undefined"
1365 aria-label="Scroll filters right" 1707 :role="results?.length ? 'listbox' : undefined"
1366 @click="scrollRibbon(1)" 1708 :aria-labelledby="results?.length ? 'localsearch-label' : undefined"
1709 class="results"
1710 @mousemove="onMouseMove"
1367 > 1711 >
1368 <ChevronRight :size="18" stroke-width="1.75" /> 1712 <!-- Empty state (shared) -->
1369 </button> 1713 <AnimatePresence>
1370 </div> 1714 <component
1371 1715 :is="searchMotionDiv"
1372 <ul 1716 v-if="urlSearchMode
1373 ref="resultsEl" 1717 ? (!filterText || !urlMatches.length)
1374 :id="results?.length ? 'localsearch-list' : undefined" 1718 : (!filterText || !filteredResults.length)"
1375 :role="results?.length ? 'listbox' : undefined" 1719 class="flex flex-1 flex-col justify-center items-center w-full min-h-full gap-2 font-medium text-sm text-center text-gray-500 dark:text-gray-300 m-auto opacity-90"
1376 :aria-labelledby="results?.length ? 'localsearch-label' : undefined" 1720 v-bind="emptyStateMotion"
1377 class="results"
1378 @mousemove="onMouseMove"
1379 >
1380 <!-- Empty state (shared) -->
1381 <div
1382 v-if="urlSearchMode
1383 ? (!filterText || !urlMatches.length)
1384 : (!filterText || !filteredResults.length)"
1385 class="flex flex-col justify-center items-center h-47.5 gap-2 font-medium text-sm text-gray-500 dark:text-gray-300 m-auto md:mt-10 md:mb-6 opacity-90"
1386 >
1387 <img
1388 class="h-40 object-contain object-center -translate-x-2"
1389 src="/asset/smolame.png"
1390 alt="Smol ame"
1391 />
1392 <h1 v-if="filterText">Couldn't find anything, try again?</h1>
1393 <h1 v-else>Looking for something?</h1>
1394 </div>
1395
1396 <!-- URL search results -->
1397 <template v-if="urlSearchMode">
1398 <li
1399 v-for="(item, index) in filteredUrlResults"
1400 :key="'url-' + urlCurrentPage + '-' + item.pageId + '-' + item.anchor + '-' + index"
1401 class="result-layout"
1402 :id="'localsearch-item-' + (index + 1)"
1403 :aria-selected="selectedIndex === index + 1 ? 'true' : 'false'"
1404 role="option"
1405 >
1406 <a
1407 :href="item.anchor ? item.pageId + '#' + item.anchor : item.pageId"
1408 class="result"
1409 :class="{ selected: selectedIndex === index + 1 }"
1410 :aria-label="item.linkText || item.href"
1411 @mouseenter="!disableMouseOver && (selectedIndex = index + 1)"
1412 @focusin="selectedIndex = index + 1"
1413 @click="onResultClick"
1414 :data-index="index + 1"
1415 > 1721 >
1416 <div class="url-result-body"> 1722 <img
1417 <div class="titles url-titles"> 1723 class="h-40 object-contain object-center"
1418 <Hash v-if="item.titles.length > 0" stroke-width="1.25" :size="18" /> 1724 src="/asset/smolame.png"
1419 <File v-else stroke-width="1.25" :size="18" /> 1725 alt="Smol ame"
1420 <span 1726 />
1421 v-for="(t, ti) in item.titles" 1727 <h1 v-if="filterText">Couldn't find anything, try again?</h1>
1422 :key="ti" 1728 <h1 v-else>Looking for something?</h1>
1423 class="title" 1729 </component>
1424 > 1730 </AnimatePresence>
1425 <span class="text" v-html="t" /> 1731
1426 <ArrowRight stroke-width="1.25" :size="18" class="mx-0.5" /> 1732 <!-- URL search results -->
1427 </span> 1733 <template v-if="urlSearchMode">
1428 <span class="title main"> 1734 <AnimatePresence>
1429 <span class="text">{{ item.linkText || item.href }}</span> 1735 <component
1430 </span> 1736 :is="searchMotionLi"
1431 </div> 1737 v-for="(item, index) in filteredUrlResults"
1432 <a 1738 :key="'url-' + urlCurrentPage + '-' +
1433 :href="item.href" 1739 item.pageId + '-' +
1434 target="_blank" 1740 item.anchor + '-' + index"
1435 rel="noopener noreferrer" 1741 class="result-layout"
1436 class="url-open-btn" 1742 :id="'localsearch-item-' + (index + 1)"
1437 :class="{ 'url-open-btn-selected': selectedIndex === index + 1 }" 1743 :aria-selected="selectedIndex === index + 1
1438 title="Open link" 1744 ? 'true'
1439 @click.stop 1745 : 'false'"
1746 role="option"
1747 v-bind="resultMotion(index)"
1748 >
1749 <div
1750 class="result url-result-card"
1751 :class="{
1752 selected: selectedIndex === index + 1
1753 }"
1754 :aria-label="item.href"
1755 role="button"
1756 @mouseenter="!disableMouseOver &&
1757 (selectedIndex = index + 1)"
1758 @focusin="selectedIndex = index + 1"
1759 @click="navigateToUrlResult(item)"
1760 :data-index="index + 1"
1440 > 1761 >
1441 <ExternalLink :size="14" stroke-width="1.5" /> 1762 <div class="url-result-body">
1442 </a> 1763 <div class="url-path">
1443 </div> 1764 <Hash
1444 </a> 1765 v-if="item.titles.length > 0"
1445 </li> 1766 stroke-width="1.25"
1446 </template> 1767 :size="18"
1447 1768 />
1448 <!-- Normal search results --> 1769 <File v-else stroke-width="1.25" :size="18" />
1449 <template v-else> 1770 <span
1450 <li 1771 v-for="(t, ti) in item.titles"
1451 v-for="(p, index) in pagedResults" 1772 :key="ti"
1452 :key="'normal-' + normalCurrentPage + '-' + p.id" 1773 class="url-path-segment"
1453 class="result-layout" 1774 >
1454 :id="'localsearch-item-' + (index + 1)" 1775 <span class="text" v-html="t" />
1455 :aria-selected="selectedIndex === index + 1 ? 'true' : 'false'" 1776 <ArrowRight
1456 role="option" 1777 stroke-width="1.25"
1457 > 1778 :size="18"
1458 <a 1779 class="mx-0.5"
1459 :href="p.id" 1780 />
1460 class="result" 1781 </span>
1461 :class="{ selected: selectedIndex === index + 1 }" 1782 <span
1462 :aria-label="[...p.titles, p.title].join(' > ')" 1783 v-if="item.linkText"
1463 @mouseenter="!disableMouseOver && (selectedIndex = index + 1)" 1784 class="url-path-current"
1464 @focusin="selectedIndex = index + 1" 1785 v-html="item.linkText"
1465 @click="onResultClick" 1786 />
1466 :data-index="index + 1" 1787 </div>
1467 > 1788 <a
1468 <div> 1789 :href="item.href"
1469 <div class="titles"> 1790 target="_blank"
1470 <Hash v-if="p.titles.length > 0" stroke-width="1.25" :size="18" /> 1791 rel="noopener noreferrer"
1471 <File v-else stroke-width="1.25" :size="18" /> 1792 class="url-link"
1472 <span 1793 :title="item.href"
1473 v-for="(t, index) in p.titles" 1794 @click.stop
1474 :key="index" 1795 v-html="item.highlighted"
1475 class="title" 1796 >
1476 > 1797 </a>
1477 <span class="text" v-html="t" /> 1798 </div>
1478 <ArrowRight stroke-width="1.25" :size="18" class="mx-0.5" />
1479 </span>
1480 <span class="title main">
1481 <span class="text" v-html="p.title" />
1482 </span>
1483 </div> 1799 </div>
1800 </component>
1801 </AnimatePresence>
1802 </template>
1484 1803
1485 <div v-if="showDetailedList" class="excerpt-wrapper"> 1804 <!-- Normal search results -->
1486 <div v-if="p.text" class="excerpt" inert> 1805 <template v-else>
1487 <div class="vp-doc" v-html="p.text" /> 1806 <AnimatePresence>
1807 <component
1808 :is="searchMotionLi"
1809 v-for="(p, index) in pagedResults"
1810 :key="'normal-' + normalCurrentPage + '-' + p.id"
1811 class="result-layout"
1812 :id="'localsearch-item-' + (index + 1)"
1813 :aria-selected="selectedIndex === index + 1
1814 ? 'true'
1815 : 'false'"
1816 role="option"
1817 v-bind="resultMotion(index)"
1818 >
1819 <a
1820 :href="p.id"
1821 class="result"
1822 :class="{
1823 selected: selectedIndex === index + 1
1824 }"
1825 :aria-label="[...p.titles, p.title].join(' > ')"
1826 @mouseenter="!disableMouseOver &&
1827 (selectedIndex = index + 1)"
1828 @focusin="selectedIndex = index + 1"
1829 @click="onResultClick"
1830 :data-index="index + 1"
1831 >
1832 <div>
1833 <div class="titles">
1834 <Hash
1835 v-if="p.titles.length > 0"
1836 stroke-width="1.25"
1837 :size="18"
1838 />
1839 <File v-else stroke-width="1.25" :size="18" />
1840 <span
1841 v-for="(t, index) in p.titles"
1842 :key="index"
1843 class="title"
1844 >
1845 <span class="text" v-html="t" />
1846 <ArrowRight
1847 stroke-width="1.25"
1848 :size="18"
1849 class="mx-0.5"
1850 />
1851 </span>
1852 <span class="title main">
1853 <span class="text" v-html="p.title" />
1854 </span>
1855 </div>
1856
1857 <div v-if="showDetailedList" class="excerpt-wrapper">
1858 <component
1859 :is="searchMotionDiv"
1860 v-if="p.text"
1861 class="excerpt"
1862 inert
1863 v-bind="excerptMotion"
1864 >
1865 <div class="vp-doc" v-html="p.text" />
1866 </component>
1867 <div class="excerpt-gradient-bottom" />
1868 <div class="excerpt-gradient-top" />
1869 </div>
1488 </div> 1870 </div>
1489 <div class="excerpt-gradient-bottom" /> 1871 </a>
1490 <div class="excerpt-gradient-top" /> 1872 </component>
1491 </div> 1873 </AnimatePresence>
1492 </div> 1874 </template>
1493 </a> 1875 </ul>
1494 </li>
1495 </template>
1496 </ul>
1497
1498 <!-- Pagination controls (Fixed structural segment block style wrapper) -->
1499 <nav
1500 v-if="(urlSearchMode ? urlTotalPages : normalTotalPages) > 1"
1501 class="url-pagination"
1502 aria-label="Search result pages"
1503 >
1504 <div class="url-pagination-segment">
1505 <button
1506 type="button"
1507 class="url-page-btn url-page-nav"
1508 :disabled="(urlSearchMode ? urlCurrentPage : normalCurrentPage) <= 1"
1509 aria-label="Previous page"
1510 @click="urlSearchMode
1511 ? goToUrlPage(urlCurrentPage - 1)
1512 : goToNormalPage(normalCurrentPage - 1)"
1513 >
1514 <ChevronRight :size="14" stroke-width="2" style="transform: rotate(180deg)" />
1515 </button>
1516 1876
1517 <template 1877 <!-- Bottom section: pagination (when needed). Always rendered so the
1518 v-for="(p, pi) in (urlSearchMode ? urlPageList : normalPageList)" 1878 shell's rounded bottom edge stays consistent. -->
1519 :key="pi" 1879 <nav
1880 class="url-pagination"
1881 aria-label="Search result pages"
1882 >
1883 <div
1884 v-if="(urlSearchMode
1885 ? urlTotalPages
1886 : normalTotalPages) > 1"
1887 class="url-pagination-segment"
1520 > 1888 >
1521 <span v-if="p === '…'" class="url-page-ellipsis">…</span>
1522 <button 1889 <button
1523 v-else
1524 type="button" 1890 type="button"
1525 class="url-page-btn" 1891 class="url-page-btn url-page-nav"
1526 :class="{ active: p === (urlSearchMode ? urlCurrentPage : normalCurrentPage) }" 1892 :disabled="(urlSearchMode
1527 :aria-current="p === (urlSearchMode ? urlCurrentPage : normalCurrentPage) ? 'page' : undefined" 1893 ? urlCurrentPage
1528 @click="urlSearchMode ? goToUrlPage(p as number) : goToNormalPage(p as number)" 1894 : normalCurrentPage) <= 1"
1895 aria-label="Previous page"
1896 @click="urlSearchMode
1897 ? goToUrlPage(urlCurrentPage - 1)
1898 : goToNormalPage(normalCurrentPage - 1)"
1529 > 1899 >
1530 {{ p }} 1900 <ChevronRight
1901 :size="14"
1902 stroke-width="2"
1903 style="transform: rotate(180deg)"
1904 />
1531 </button> 1905 </button>
1532 </template>
1533 1906
1534 <button 1907 <template
1535 type="button" 1908 v-for="(p, pi) in urlSearchMode ? urlPageList : normalPageList"
1536 class="url-page-btn url-page-nav" 1909 :key="pi"
1537 :disabled="(urlSearchMode ? urlCurrentPage : normalCurrentPage) >= (urlSearchMode ? urlTotalPages : normalTotalPages)" 1910 >
1538 aria-label="Next page" 1911 <span v-if="p === '…'" class="url-page-ellipsis">…</span>
1539 @click="urlSearchMode 1912 <button
1913 v-else
1914 type="button"
1915 class="url-page-btn"
1916 :class="{
1917 active: p === (urlSearchMode
1918 ? urlCurrentPage
1919 : normalCurrentPage)
1920 }"
1921 :aria-current="p === (urlSearchMode
1922 ? urlCurrentPage
1923 : normalCurrentPage)
1924 ? 'page'
1925 : undefined"
1926 @click="urlSearchMode
1927 ? goToUrlPage(p as number)
1928 : goToNormalPage(p as number)"
1929 >
1930 {{ p }}
1931 </button>
1932 </template>
1933
1934 <button
1935 type="button"
1936 class="url-page-btn url-page-nav"
1937 :disabled="(urlSearchMode
1938 ? urlCurrentPage
1939 : normalCurrentPage) >=
1940 (urlSearchMode
1941 ? urlTotalPages
1942 : normalTotalPages)"
1943 aria-label="Next page"
1944 @click="urlSearchMode
1540 ? goToUrlPage(urlCurrentPage + 1) 1945 ? goToUrlPage(urlCurrentPage + 1)
1541 : goToNormalPage(normalCurrentPage + 1)" 1946 : goToNormalPage(normalCurrentPage + 1)"
1542 > 1947 >
1543 <ChevronRight :size="14" stroke-width="2" /> 1948 <ChevronRight :size="14" stroke-width="2" />
1544 </button> 1949 </button>
1545 </div> 1950 </div>
1546 </nav> 1951 </nav>
1547 1952
1548 <div class="search-keyboard-shortcuts"> 1953 <component
1549 <span> 1954 :is="searchMotionDiv"
1550 <kbd 1955 v-if="showKeyboardShortcuts"
1551 :aria-label="translate( 1956 class="search-keyboard-shortcuts"
1552 'modal.footer.navigateUpKeyAriaLabel' 1957 v-bind="footerMotion"
1553 )" 1958 >
1554 > 1959 <span>
1555 <span class="vpi-arrow-up navigate-icon" /> 1960 <kbd
1556 </kbd> 1961 :aria-label="translate(
1557 <kbd 1962 'modal.footer.navigateUpKeyAriaLabel'
1558 :aria-label="translate( 1963 )"
1559 'modal.footer.navigateDownKeyAriaLabel' 1964 >
1560 )" 1965 <span class="vpi-arrow-up navigate-icon" />
1561 > 1966 </kbd>
1562 <span class="vpi-arrow-down navigate-icon" /> 1967 <kbd
1563 </kbd> 1968 :aria-label="translate(
1564 {{ translate('modal.footer.navigateText') }} 1969 'modal.footer.navigateDownKeyAriaLabel'
1565 </span> 1970 )"
1566 <span> 1971 >
1567 <kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')"> 1972 <span class="vpi-arrow-down navigate-icon" />
1568 <span class="vpi-corner-down-left navigate-icon" /> 1973 </kbd>
1569 </kbd> 1974 {{ translate('modal.footer.navigateText') }}
1570 {{ translate('modal.footer.selectText') }} 1975 </span>
1571 </span> 1976 <span>
1572 <span> 1977 <kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')">
1573 <kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')"> 1978 <span class="vpi-corner-down-left navigate-icon" />
1574 esc 1979 </kbd>
1575 </kbd> 1980 {{ translate('modal.footer.selectText') }}
1576 {{ translate('modal.footer.closeText') }} 1981 </span>
1577 </span> 1982 <span>
1578 </div> 1983 <kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')">
1579 </div> 1984 esc
1985 </kbd>
1986 {{ translate('modal.footer.closeText') }}
1987 </span>
1988 </component>
1989 </component>
1990 </AnimatePresence>
1580 1991
1581 <button v-if="!showSearch" /> 1992 <button v-if="!showSearch" />
1582 </div> 1993 </div>
@@ -1607,7 +2018,7 @@ function onMouseMove(e: MouseEvent) {
1607.shell { 2018.shell {
1608 position: relative; 2019 position: relative;
1609 box-sizing: border-box; 2020 box-sizing: border-box;
1610 padding: 12px; 2021 padding: 12px 12px 8px;
1611 margin: 64px auto; 2022 margin: 64px auto;
1612 display: flex; 2023 display: flex;
1613 flex-direction: column; 2024 flex-direction: column;
@@ -1663,6 +2074,15 @@ function onMouseMove(e: MouseEvent) {
1663 min-width: 0; 2074 min-width: 0;
1664 flex: none; 2075 flex: none;
1665 overflow: hidden; 2076 overflow: hidden;
2077 transition: padding-inline 0.15s;
2078}
2079
2080.page-ribbon.can-scroll-left {
2081 padding-left: 42px;
2082}
2083
2084.page-ribbon.can-scroll-right {
2085 padding-right: 42px;
1666} 2086}
1667 2087
1668.page-ribbon-track { 2088.page-ribbon-track {
@@ -1706,14 +2126,12 @@ function onMouseMove(e: MouseEvent) {
1706 2126
1707.page-ribbon-arrow.right { 2127.page-ribbon-arrow.right {
1708 right: 0; 2128 right: 0;
1709 background: linear-gradient(to right, transparent, var(--vp-local-search-bg, var(--vp-c-bg-soft)) 70%);
1710 justify-content: flex-end; 2129 justify-content: flex-end;
1711 padding-right: 6px; 2130 padding-right: 6px;
1712} 2131}
1713 2132
1714.page-ribbon-arrow.left { 2133.page-ribbon-arrow.left {
1715 left: 0; 2134 left: 0;
1716 background: linear-gradient(to left, transparent, var(--vp-local-search-bg, var(--vp-c-bg-soft)) 70%);
1717 justify-content: flex-start; 2135 justify-content: flex-start;
1718 padding-left: 6px; 2136 padding-left: 6px;
1719} 2137}
@@ -1894,6 +2312,10 @@ function onMouseMove(e: MouseEvent) {
1894 overscroll-behavior: contain; 2312 overscroll-behavior: contain;
1895} 2313}
1896 2314
2315.result-layout {
2316 will-change: transform, opacity, height;
2317}
2318
1897.result { 2319.result {
1898 display: flex; 2320 display: flex;
1899 align-items: center; 2321 align-items: center;
@@ -1927,15 +2349,83 @@ function onMouseMove(e: MouseEvent) {
1927 align-items: center; 2349 align-items: center;
1928} 2350}
1929 2351
1930/* URL-mode card: breadcrumb text wraps freely, open-link button is pinned 2352.url-result-card {
1931 to the top-right corner so it never detaches when the title wraps. */ 2353 cursor: pointer;
2354}
2355
1932.url-result-body { 2356.url-result-body {
1933 position: relative; 2357 display: flex;
1934 padding-right: 28px; 2358 flex-direction: column;
2359 gap: 6px;
1935} 2360}
1936 2361
1937.url-titles { 2362.url-path {
1938 z-index: auto; 2363 display: flex;
2364 align-items: center;
2365 flex-wrap: wrap;
2366 gap: 4px;
2367 color: var(--vp-c-text-3);
2368 font-size: 0.78rem;
2369 line-height: 1.2;
2370}
2371
2372.url-path > svg,
2373.url-path-segment svg {
2374 flex-shrink: 0;
2375 width: 1em;
2376 height: 1em;
2377 margin-top: -1px;
2378 opacity: 0.55;
2379}
2380
2381.url-path > svg {
2382 margin-top: -2px;
2383}
2384
2385.url-path-segment {
2386 display: flex;
2387 align-items: center;
2388 min-width: 0;
2389}
2390
2391.url-path-current {
2392 display: inline-flex;
2393 align-items: center;
2394 color: var(--vp-c-text-2);
2395}
2396
2397.url-path :deep(.icon-tip) {
2398 display: inline-flex;
2399 align-items: center;
2400 line-height: 1;
2401 vertical-align: middle;
2402}
2403
2404.url-path :deep(.icon-tip > span) {
2405 width: 1em;
2406 height: 1em;
2407 min-width: 1em;
2408}
2409
2410.url-link {
2411 align-self: flex-start;
2412 max-width: 100%;
2413 color: var(--vp-c-text-1);
2414 font-size: 0.95rem;
2415 font-weight: 500;
2416 line-height: 1.35;
2417 overflow-wrap: anywhere;
2418 word-break: break-word;
2419}
2420
2421.url-link:hover {
2422 color: var(--vp-c-brand-1);
2423 text-decoration: underline;
2424 text-underline-offset: 2px;
2425}
2426
2427.result.selected .url-link {
2428 color: var(--vp-c-brand-1);
1939} 2429}
1940 2430
1941.titles > svg { 2431.titles > svg {
@@ -1962,15 +2452,6 @@ function onMouseMove(e: MouseEvent) {
1962 opacity: 0.5; 2452 opacity: 0.5;
1963} 2453}
1964 2454
1965.url-titles .title.main {
1966 min-width: 0;
1967}
1968
1969.url-titles .title.main .text {
1970 overflow-wrap: anywhere;
1971 word-break: break-word;
1972}
1973
1974.result.selected { 2455.result.selected {
1975 --vp-local-search-result-bg: var(--vp-local-search-result-selected-bg); 2456 --vp-local-search-result-bg: var(--vp-local-search-result-selected-bg);
1976 border-color: var(--vp-local-search-result-selected-border); 2457 border-color: var(--vp-local-search-result-selected-border);
@@ -2119,42 +2600,6 @@ svg {
2119 background: rgba(60, 120, 210, 0.10); 2600 background: rgba(60, 120, 210, 0.10);
2120} 2601}
2121 2602
2122.url-open-btn {
2123 position: absolute;
2124 top: 0;
2125 right: 0;
2126 flex: none;
2127 display: flex;
2128 align-items: center;
2129 justify-content: center;
2130 width: 24px;
2131 height: 24px;
2132 border-radius: 4px;
2133 color: var(--vp-c-text-3);
2134 opacity: 0;
2135 transition: opacity 0.15s, color 0.15s, background 0.15s;
2136}
2137
2138.result:hover .url-open-btn,
2139.result.selected .url-open-btn {
2140 opacity: 1;
2141}
2142
2143@media (max-width: 767px) {
2144 .url-open-btn {
2145 opacity: 1;
2146 }
2147}
2148
2149.url-open-btn:hover {
2150 color: var(--vp-c-brand-1);
2151 background: var(--vp-c-default-soft);
2152}
2153
2154.url-open-btn-selected {
2155 color: var(--vp-c-brand-1) !important;
2156}
2157
2158:deep(.url-highlight) { 2603:deep(.url-highlight) {
2159 background-color: var(--vp-local-search-highlight-bg); 2604 background-color: var(--vp-local-search-highlight-bg);
2160 color: var(--vp-local-search-highlight-text); 2605 color: var(--vp-local-search-highlight-text);
@@ -2163,20 +2608,18 @@ svg {
2163 font-style: normal; 2608 font-style: normal;
2164} 2609}
2165 2610
2166/* Redesigned Unified Mode Switching Segmented Style Pagination Controls */ 2611/* Bottom-strip pagination. The <nav> is always rendered (empty when only one
2612 page) but collapses to zero height in that case so the shell's bottom
2613 rounded edge sits flush against the results. */
2167.url-pagination { 2614.url-pagination {
2168 display: flex; 2615 display: flex;
2169 align-items: center; 2616 align-items: center;
2170 justify-content: center; 2617 justify-content: center;
2171 flex: 0 0 auto !important; 2618 flex: 0 0 auto !important;
2172 padding: 10px 8px;
2173 border-top: 1px solid var(--vp-c-divider);
2174} 2619}
2175 2620
2176@media (max-width: 767px) { 2621.url-pagination:has(.url-pagination-segment) {
2177 .url-pagination { 2622 padding-top: 8px;
2178 padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
2179 }
2180} 2623}
2181 2624
2182.url-pagination-segment { 2625.url-pagination-segment {
@@ -2243,4 +2686,4 @@ svg {
2243 user-select: none; 2686 user-select: none;
2244 background: transparent; 2687 background: transparent;
2245} 2688}
2246</style>\ No newline at end of file 2689</style>
docs/.vitepress/theme/styles/style.scss +12 −11
@@ -415,8 +415,8 @@ main figure figcaption {
415} 415}
416 416
417.vp-doc h1 { 417.vp-doc h1 {
418 margin-top: 0.5rem; 418 margin-top: 0.5rem;
419 margin-bottom: 0.5rem; 419 margin-bottom: 0.5rem;
420} 420}
421 421
422.vp-doc h2 { 422.vp-doc h2 {
@@ -429,8 +429,8 @@ main figure figcaption {
429} 429}
430 430
431.vp-doc h4 { 431.vp-doc h4 {
432 margin-top: 1rem; 432 margin-top: 1rem;
433 margin-bottom: 1rem; 433 margin-bottom: 1rem;
434} 434}
435 435
436/* Make the page half the width for class `sandbox` */ 436/* Make the page half the width for class `sandbox` */
@@ -996,12 +996,6 @@ table tr:nth-child(odd) {
996 @apply hidden; 996 @apply hidden;
997 } 997 }
998 998
999 &::after {
1000 @apply fixed hidden md:block left-0 bottom-11 w-full h-0.25
1001 bg-neutral-400/25 dark:bg-neutral-600/65;
1002 content: "";
1003 }
1004
1005 & > li { 999 & > li {
1006 @apply z-10 scroll-pt-2; 1000 @apply z-10 scroll-pt-2;
1007 1001
@@ -1430,6 +1424,13 @@ html.reduce-blur-effects {
1430 animation: none !important; 1424 animation: none !important;
1431 } 1425 }
1432 1426
1427 .VPLocalSearchBox,
1428 .VPLocalSearchBox * {
1429 animation: none !important;
1430 scroll-behavior: auto !important;
1431 transition-duration: 0s !important;
1432 }
1433
1433 .VPLocalNav > .container > .menu, 1434 .VPLocalNav > .container > .menu,
1434 .VPLocalNav > .container > .VPLocalNavOutlineDropdown > button, 1435 .VPLocalNav > .container > .VPLocalNavOutlineDropdown > button,
1435 .VPLocalNav > .container > .VPLocalNavOutlineDropdown > .items, 1436 .VPLocalNav > .container > .VPLocalNavOutlineDropdown > .items,
@@ -1676,4 +1677,4 @@ html.reduce-blur-effects {
1676 1677
1677.vp-doc .custom-block.title-only { 1678.vp-doc .custom-block.title-only {
1678 padding-bottom: 16px; 1679 padding-bottom: 16px;
1679}\ No newline at end of file 1680}