| @@ -1,6 +1,6 @@ |
| 1 | 1 | <script lang="ts" setup> |
| 2 | 2 | import MiniSearch, { type SearchResult } from 'minisearch' |
| 3 | | import { type DefaultTheme, dataSymbol, inBrowser, useRouter } from 'vitepress' |
| 3 | import { dataSymbol, type DefaultTheme, inBrowser, useRouter } from 'vitepress' |
| 4 | 4 | import { |
| 5 | 5 | computed, |
| 6 | 6 | createApp, |
| @@ -26,9 +26,11 @@ import { |
| 26 | 26 | useLocalStorage, |
| 27 | 27 | useScrollLock, |
| 28 | 28 | useSessionStorage, |
| 29 | useStorage, |
| 29 | 30 | watchDebounced |
| 30 | 31 | } from '@vueuse/core' |
| 31 | 32 | import { useFocusTrap } from '@vueuse/integrations/useFocusTrap' |
| 33 | import { AnimatePresence, motion } from 'motion-v' |
| 32 | 34 | |
| 33 | 35 | // @ts-ignore |
| 34 | 36 | import localSearchIndex from '@localSearchIndex' |
| @@ -37,23 +39,22 @@ import { |
| 37 | 39 | ArrowRight, |
| 38 | 40 | ChevronRight, |
| 39 | 41 | Delete, |
| 40 | | ExternalLink, |
| 41 | 42 | File, |
| 42 | 43 | Globe, |
| 43 | 44 | Hash, |
| 44 | | LayoutList, |
| 45 | 45 | List, |
| 46 | | Locate, |
| 47 | 46 | LocateOff, |
| 47 | Regex, |
| 48 | 48 | TextAlignStart |
| 49 | 49 | } from 'lucide-vue-next' |
| 50 | 50 | import Mark from 'mark.js/dist/mark.es6.js' |
| 51 | 51 | import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' |
| 52 | | import { LRUCache } from '../composables/search/lru-cache' |
| 52 | import { sidebar } from '../../configs/constants' |
| 53 | 53 | import type { PageLink } from '../../plugins/urlSearchPlugin' |
| 54 | import { LRUCache } from '../composables/search/lru-cache' |
| 54 | 55 | import { createSearchTranslate } from '../composables/search/translation' |
| 55 | 56 | import { useData } from '../composables/search/use-data' |
| 56 | | import { sidebar } from '../../configs/constants' |
| 57 | import { LowEndDeviceModeStorageKey } from '../constants' |
| 57 | 58 | |
| 58 | 59 | export interface FooterTranslations { |
| 59 | 60 | selectText?: string |
| @@ -139,6 +140,117 @@ const filterText = disableQueryPersistence.value |
| 139 | 140 | ? ref('') |
| 140 | 141 | : useSessionStorage('vitepress:local-search-filter', '') |
| 141 | 142 | |
| 143 | const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off') |
| 144 | const searchAnimationsEnabled = computed(() => lowEndDeviceMode.value !== 'on') |
| 145 | const showKeyboardShortcuts = computed(() => !filterText.value) |
| 146 | |
| 147 | const SearchMotionDiv = motion.div |
| 148 | const SearchMotionForm = motion.form |
| 149 | const SearchMotionLi = motion.li |
| 150 | const searchMotionDiv = computed(() => |
| 151 | searchAnimationsEnabled.value ? SearchMotionDiv : 'div' |
| 152 | ) |
| 153 | const searchMotionForm = computed(() => |
| 154 | searchAnimationsEnabled.value ? SearchMotionForm : 'form' |
| 155 | ) |
| 156 | const searchMotionLi = computed(() => |
| 157 | searchAnimationsEnabled.value ? SearchMotionLi : 'li' |
| 158 | ) |
| 159 | const searchMotionEase = [0.16, 1, 0.3, 1] |
| 160 | |
| 161 | const 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 | |
| 172 | const 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 | |
| 184 | const formMotion = computed(() => |
| 185 | searchAnimationsEnabled.value ? { layout: 'position' } : {} |
| 186 | ) |
| 187 | |
| 188 | const 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 | |
| 200 | const 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 | |
| 218 | function 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 | |
| 238 | const 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 | |
| 250 | const footerMotion = computed(() => |
| 251 | searchAnimationsEnabled.value ? { layout: true } : {} |
| 252 | ) |
| 253 | |
| 142 | 254 | const urlFilterDebounced = ref(filterText.value) |
| 143 | 255 | let urlDebounceTimer: ReturnType<typeof setTimeout> | undefined |
| 144 | 256 | watch(filterText, (v) => { |
| @@ -180,7 +292,10 @@ let allLinksFetchPromise: Promise<void> | null = null |
| 180 | 292 | |
| 181 | 293 | async function ensureAllLinks() { |
| 182 | 294 | if (allLinks.value.length > 0) return |
| 183 | | if (allLinksFetchPromise) { await allLinksFetchPromise; return } |
| 295 | if (allLinksFetchPromise) { |
| 296 | await allLinksFetchPromise |
| 297 | return |
| 298 | } |
| 184 | 299 | allLinksFetchPromise = fetch('/url-search-index.json') |
| 185 | 300 | .then((r) => r.json()) |
| 186 | 301 | .then((data: PageLink[]) => { |
| @@ -191,12 +306,18 @@ async function ensureAllLinks() { |
| 191 | 306 | }) |
| 192 | 307 | allLinks.value = data |
| 193 | 308 | }) |
| 194 | | .catch(() => { allLinks.value = [] }) |
| 195 | | .finally(() => { allLinksFetchPromise = null }) |
| 309 | .catch(() => { |
| 310 | allLinks.value = [] |
| 311 | }) |
| 312 | .finally(() => { |
| 313 | allLinksFetchPromise = null |
| 314 | }) |
| 196 | 315 | await allLinksFetchPromise |
| 197 | 316 | } |
| 198 | 317 | |
| 199 | | watch(urlSearchMode, (active) => { if (active) ensureAllLinks() }, { immediate: true }) |
| 318 | watch(urlSearchMode, (active) => { |
| 319 | if (active) ensureAllLinks() |
| 320 | }, { immediate: true }) |
| 200 | 321 | |
| 201 | 322 | interface UrlResult { |
| 202 | 323 | href: string |
| @@ -236,7 +357,9 @@ const urlPageGroups = computed(() => { |
| 236 | 357 | if (existing) existing.count++ |
| 237 | 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 | 365 | // Full match set honoring the active ribbon page filter (uncapped). |
| @@ -261,6 +384,7 @@ const filteredUrlResults = computed((): UrlResult[] => { |
| 261 | 384 | const start = (urlCurrentPage.value - 1) * URL_PAGE_SIZE |
| 262 | 385 | const end = start + URL_PAGE_SIZE |
| 263 | 386 | const out: UrlResult[] = [] |
| 387 | const query = urlFilterDebounced.value.trim() |
| 264 | 388 | for (let i = start; i < end && i < matches.length; i++) { |
| 265 | 389 | const link = matches[i] |
| 266 | 390 | out.push({ |
| @@ -269,12 +393,43 @@ const filteredUrlResults = computed((): UrlResult[] => { |
| 269 | 393 | pageId: link.pageId, |
| 270 | 394 | anchor: link.anchor, |
| 271 | 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 | 399 | return out |
| 276 | 400 | }) |
| 277 | 401 | |
| 402 | function escapeHtml(value: string) { |
| 403 | return value |
| 404 | .replace(/&/g, '&') |
| 405 | .replace(/</g, '<') |
| 406 | .replace(/>/g, '>') |
| 407 | .replace(/"/g, '"') |
| 408 | .replace(/'/g, ''') |
| 409 | } |
| 410 | |
| 411 | function 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 | 433 | // Compact page-number list with ellipses, e.g. [1, '…', 4, 5, 6, '…', 12]. |
| 279 | 434 | const urlPageList = computed<(number | '…')[]>(() => { |
| 280 | 435 | const total = urlTotalPages.value |
| @@ -333,7 +488,6 @@ function setUrlPageFilter(key: string | null) { |
| 333 | 488 | }) |
| 334 | 489 | } |
| 335 | 490 | |
| 336 | | |
| 337 | 491 | const disableDetailedView = computed(() => { |
| 338 | 492 | return ( |
| 339 | 493 | theme.value.search?.provider === 'local' && |
| @@ -548,7 +702,7 @@ const ribbonCanScrollRight = ref(false) |
| 548 | 702 | function getRibbonTrack(): HTMLElement | null { |
| 549 | 703 | return ( |
| 550 | 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 | 718 | track.scrollWidth - track.clientWidth - track.scrollLeft > 2 |
| 565 | 719 | } |
| 566 | 720 | |
| 721 | function 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 | |
| 567 | 763 | let ribbonAnimHandle = 0 |
| 568 | 764 | |
| 569 | 765 | function scrollRibbon(direction: number) { |
| @@ -576,6 +772,13 @@ function scrollRibbon(direction: number) { |
| 576 | 772 | if (to === from) return |
| 577 | 773 | |
| 578 | 774 | if (ribbonAnimHandle) cancelAnimationFrame(ribbonAnimHandle) |
| 775 | |
| 776 | if (!searchAnimationsEnabled.value) { |
| 777 | track.scrollLeft = to |
| 778 | updateRibbonOverflow() |
| 779 | return |
| 780 | } |
| 781 | |
| 579 | 782 | const duration = 280 |
| 580 | 783 | const start = performance.now() |
| 581 | 784 | const ease = (t: number) => 1 - Math.pow(1 - t, 3) |
| @@ -688,8 +891,18 @@ function buildDocExcerpt( |
| 688 | 891 | } |
| 689 | 892 | |
| 690 | 893 | watchDebounced( |
| 691 | | () => [searchIndex.value, filterText.value, showDetailedList.value, searchMode.value] as const, |
| 692 | | async ([index, filterTextValue, showDetailedListValue, mode], old, onCleanup) => { |
| 894 | () => |
| 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 | 906 | if (old?.[0] !== index) { |
| 694 | 907 | // in case of hmr |
| 695 | 908 | cache.clear() |
| @@ -714,11 +927,14 @@ watchDebounced( |
| 714 | 927 | fuzzy: mode === 'fuzzy' ? (0.3 as number | false) : false, |
| 715 | 928 | prefix: mode === 'fuzzy' ? (term: string) => term.length > 3 : false, |
| 716 | 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 | 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 | 939 | const top = ranked.slice(0, 50) |
| 724 | 940 | const seen = new Set(top.map((r) => r.id)) |
| @@ -748,8 +964,8 @@ watchDebounced( |
| 748 | 964 | return { ...r, text: map?.get(anchor) ?? '' } |
| 749 | 965 | }) |
| 750 | 966 | .sort((a, b) => { |
| 751 | | const pageDiff = |
| 752 | | getPageOrder(getPageKey(a.id)) - getPageOrder(getPageKey(b.id)) |
| 967 | const pageDiff = getPageOrder(getPageKey(a.id)) - |
| 968 | getPageOrder(getPageKey(b.id)) |
| 753 | 969 | if (pageDiff !== 0) return pageDiff |
| 754 | 970 | return getDocOrder(a.id) - getDocOrder(b.id) |
| 755 | 971 | }) |
| @@ -855,21 +1071,37 @@ function centerExcerpts() { |
| 855 | 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 | 1076 | excerptElement.scrollTop = Math.max(0, targetScrollTop) |
| 860 | 1077 | } |
| 861 | 1078 | } |
| 862 | 1079 | |
| 863 | 1080 | let centerHandle = 0 |
| 864 | 1081 | |
| 865 | | function centerExcerptsUntilSettled() { |
| 866 | | // No layout animations to wait on anymore — a single pass after the |
| 867 | | // DOM has painted is enough. |
| 1082 | function centerExcerptsUntilSettled( |
| 1083 | duration = searchAnimationsEnabled.value ? 450 : 0 |
| 1084 | ) { |
| 868 | 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 | 1097 | centerExcerpts() |
| 871 | | centerHandle = 0 |
| 872 | | }) |
| 1098 | if (performance.now() - start < duration) { |
| 1099 | centerHandle = requestAnimationFrame(tick) |
| 1100 | } else { |
| 1101 | centerHandle = 0 |
| 1102 | } |
| 1103 | } |
| 1104 | centerHandle = requestAnimationFrame(tick) |
| 873 | 1105 | } |
| 874 | 1106 | |
| 875 | 1107 | onBeforeUnmount(() => { |
| @@ -980,7 +1212,9 @@ const disableMouseOver = ref(true) |
| 980 | 1212 | |
| 981 | 1213 | // Active result list length (URL mode vs normal mode) — current page only |
| 982 | 1214 | const 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 | |
| 986 | 1220 | watch(pagedResults, (r) => { |
| @@ -1004,6 +1238,40 @@ function scrollToSelectedResult() { |
| 1004 | 1238 | }) |
| 1005 | 1239 | } |
| 1006 | 1240 | |
| 1241 | function 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 | |
| 1255 | function 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 | |
| 1007 | 1275 | onKeyStroke('ArrowUp', (event) => { |
| 1008 | 1276 | event.preventDefault() |
| 1009 | 1277 | selectedIndex.value-- |
| @@ -1024,8 +1292,36 @@ onKeyStroke('ArrowDown', (event) => { |
| 1024 | 1292 | scrollToSelectedResult() |
| 1025 | 1293 | }) |
| 1026 | 1294 | |
| 1295 | onKeyStroke('ArrowLeft', (event) => { |
| 1296 | if (!goToSearchPageDelta(-1)) return |
| 1297 | event.preventDefault() |
| 1298 | disableMouseOver.value = true |
| 1299 | }) |
| 1300 | |
| 1301 | onKeyStroke('ArrowRight', (event) => { |
| 1302 | if (!goToSearchPageDelta(1)) return |
| 1303 | event.preventDefault() |
| 1304 | disableMouseOver.value = true |
| 1305 | }) |
| 1306 | |
| 1307 | onKeyStroke('Tab', (event) => { |
| 1308 | if (!showSearch.value) return |
| 1309 | if (!cyclePageTab(event.shiftKey ? -1 : 1)) return |
| 1310 | event.preventDefault() |
| 1311 | disableMouseOver.value = true |
| 1312 | }) |
| 1313 | |
| 1027 | 1314 | const router = useRouter() |
| 1028 | 1315 | |
| 1316 | function 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 | |
| 1029 | 1325 | onKeyStroke('Enter', (e) => { |
| 1030 | 1326 | if (e.isComposing) return |
| 1031 | 1327 | |
| @@ -1046,10 +1342,7 @@ onKeyStroke('Enter', (e) => { |
| 1046 | 1342 | if (urlSearchMode.value) { |
| 1047 | 1343 | const selectedUrl = filteredUrlResults.value[index] |
| 1048 | 1344 | if (selectedUrl) { |
| 1049 | | window.dispatchEvent(new CustomEvent('search-nav', { detail: { query: filterText.value } })) |
| 1050 | | const dest = selectedUrl.anchor ? selectedUrl.pageId + '#' + selectedUrl.anchor : selectedUrl.pageId |
| 1051 | | router.go(dest) |
| 1052 | | showSearch.value = false |
| 1345 | navigateToUrlResult(selectedUrl) |
| 1053 | 1346 | } |
| 1054 | 1347 | return |
| 1055 | 1348 | } |
| @@ -1177,406 +1470,524 @@ function onMouseMove(e: MouseEvent) { |
| 1177 | 1470 | class="VPLocalSearchBox" |
| 1178 | 1471 | :class="{ 'pointer-events-none': !showSearch }" |
| 1179 | 1472 | > |
| 1180 | | <div |
| 1181 | | v-if="showSearch" |
| 1182 | | class="backdrop" |
| 1183 | | @click="showSearch = false" |
| 1184 | | /> |
| 1185 | | |
| 1186 | | <div |
| 1187 | | v-if="showSearch" |
| 1188 | | class="shell" |
| 1189 | | > |
| 1190 | | <form |
| 1191 | | class="search-bar" |
| 1192 | | @pointerup="onSearchBarClick($event)" |
| 1193 | | @submit.prevent="" |
| 1473 | <AnimatePresence> |
| 1474 | <component |
| 1475 | :is="searchMotionDiv" |
| 1476 | v-if="showSearch" |
| 1477 | class="backdrop" |
| 1478 | @click="showSearch = false" |
| 1479 | v-bind="backdropMotion" |
| 1480 | /> |
| 1481 | </AnimatePresence> |
| 1482 | |
| 1483 | <AnimatePresence> |
| 1484 | <component |
| 1485 | :is="searchMotionDiv" |
| 1486 | v-if="showSearch" |
| 1487 | class="shell" |
| 1488 | v-bind="shellMotion" |
| 1194 | 1489 | > |
| 1195 | | <label |
| 1196 | | :title="buttonText" |
| 1197 | | id="localsearch-label" |
| 1198 | | for="localsearch-input" |
| 1490 | <component |
| 1491 | :is="searchMotionForm" |
| 1492 | class="search-bar" |
| 1493 | v-bind="formMotion" |
| 1494 | @pointerup="onSearchBarClick($event)" |
| 1495 | @submit.prevent="" |
| 1199 | 1496 | > |
| 1200 | | <span |
| 1201 | | aria-hidden="true" |
| 1202 | | class="vpi-search search-icon local-search-icon" |
| 1203 | | /> |
| 1204 | | </label> |
| 1205 | | <div class="search-actions before"> |
| 1206 | | <button |
| 1207 | | class="back-button" |
| 1208 | | :title="translate('modal.backButtonTitle')" |
| 1209 | | @click="showSearch = false" |
| 1497 | <label |
| 1498 | :title="buttonText" |
| 1499 | id="localsearch-label" |
| 1500 | for="localsearch-input" |
| 1210 | 1501 | > |
| 1211 | | <span class="vpi-arrow-left local-search-icon" /> |
| 1212 | | </button> |
| 1213 | | </div> |
| 1214 | | <input |
| 1215 | | ref="searchInput" |
| 1216 | | v-model="filterText" |
| 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"> |
| 1502 | <span |
| 1503 | aria-hidden="true" |
| 1504 | class="vpi-search search-icon local-search-icon" |
| 1505 | /> |
| 1506 | </label> |
| 1507 | <div class="search-actions before"> |
| 1236 | 1508 | <button |
| 1237 | | type="button" |
| 1238 | | class="mode-btn" |
| 1239 | | :class="{ 'mode-active': showDetailedList }" |
| 1240 | | title="Detail view (Consumes more RAM)" |
| 1241 | | @click="showDetailedList ? showDetailedList = false : showDetailedList = true" |
| 1509 | class="back-button" |
| 1510 | :title="translate('modal.backButtonTitle')" |
| 1511 | @click="showSearch = false" |
| 1242 | 1512 | > |
| 1243 | | <LayoutList :size="18" stroke-width="1.25" /> |
| 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" /> |
| 1513 | <span class="vpi-arrow-left local-search-icon" /> |
| 1253 | 1514 | </button> |
| 1254 | 1515 | </div> |
| 1255 | | <div class="search-mode-group toolbar-group"> |
| 1256 | | <button |
| 1257 | | type="button" |
| 1258 | | class="mode-btn" |
| 1259 | | :class="{ 'mode-active': searchMode === 'exact' }" |
| 1260 | | title="Exact search" |
| 1261 | | @click="searchMode === 'exact' ? cycleSearchMode() : searchMode = 'exact'" |
| 1516 | <input |
| 1517 | ref="searchInput" |
| 1518 | v-model="filterText" |
| 1519 | :aria-activedescendant="selectedIndex > -1 |
| 1520 | ? 'localsearch-item-' + selectedIndex |
| 1521 | : undefined" |
| 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" /> |
| 1264 | | </button> |
| 1541 | <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 | 1599 | <button |
| 1266 | | type="button" |
| 1267 | | class="mode-btn" |
| 1268 | | :class="{ 'mode-active': searchMode === 'fuzzy' }" |
| 1269 | | title="Fuzzy search" |
| 1270 | | @click="searchMode === 'fuzzy' ? cycleSearchMode() : searchMode = 'fuzzy'" |
| 1600 | class="clear-button" |
| 1601 | type="reset" |
| 1602 | :disabled="disableReset" |
| 1603 | :title="translate('modal.resetButtonTitle')" |
| 1604 | @click="resetSearch" |
| 1271 | 1605 | > |
| 1272 | | <LocateOff :size="18" 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" /> |
| 1606 | <Delete :size="19" stroke-width="1.25" /> |
| 1282 | 1607 | </button> |
| 1283 | 1608 | </div> |
| 1284 | | <button |
| 1285 | | class="clear-button" |
| 1286 | | type="reset" |
| 1287 | | :disabled="disableReset" |
| 1288 | | :title="translate('modal.resetButtonTitle')" |
| 1289 | | @click="resetSearch" |
| 1609 | </component> |
| 1610 | |
| 1611 | <AnimatePresence> |
| 1612 | <component |
| 1613 | :is="searchMotionDiv" |
| 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 | 1624 | <button |
| 1326 | | v-for="group in urlPageGroups" |
| 1327 | | :key="group.key" |
| 1625 | v-if="ribbonCanScrollLeft" |
| 1328 | 1626 | type="button" |
| 1329 | | class="page-pill" |
| 1330 | | :class="{ active: urlActivePageFilter === group.key }" |
| 1331 | | @click="setUrlPageFilter(group.key)" |
| 1627 | class="page-ribbon-arrow left" |
| 1628 | aria-label="Scroll filters left" |
| 1629 | @click="scrollRibbon(-1)" |
| 1332 | 1630 | > |
| 1333 | | <span class="page-pill-label">{{ group.label }}</span> |
| 1334 | | <span class="page-pill-count">{{ group.count }}</span> |
| 1631 | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1335 | 1632 | </button> |
| 1336 | | </template> |
| 1337 | | <!-- Normal mode tabs --> |
| 1338 | | <template v-else> |
| 1339 | | <button |
| 1340 | | type="button" |
| 1341 | | class="page-pill" |
| 1342 | | :class="{ active: activePageFilter === null }" |
| 1343 | | @click="setPageFilter(null)" |
| 1633 | <div |
| 1634 | ref="ribbonTrack" |
| 1635 | class="page-ribbon-track" |
| 1636 | @scroll="updateRibbonOverflow" |
| 1344 | 1637 | > |
| 1345 | | All |
| 1346 | | <span class="page-pill-count">{{ results.length }}</span> |
| 1347 | | </button> |
| 1638 | <!-- URL mode tabs --> |
| 1639 | <template v-if="urlSearchMode"> |
| 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 | 1692 | <button |
| 1349 | | v-for="group in pageGroups" |
| 1350 | | :key="group.key" |
| 1693 | v-if="ribbonCanScrollRight" |
| 1351 | 1694 | type="button" |
| 1352 | | class="page-pill" |
| 1353 | | :class="{ active: activePageFilter === group.key }" |
| 1354 | | @click="setPageFilter(group.key)" |
| 1695 | class="page-ribbon-arrow right" |
| 1696 | aria-label="Scroll filters right" |
| 1697 | @click="scrollRibbon(1)" |
| 1355 | 1698 | > |
| 1356 | | <span class="page-pill-label">{{ group.label }}</span> |
| 1357 | | <span class="page-pill-count">{{ group.count }}</span> |
| 1699 | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1358 | 1700 | </button> |
| 1359 | | </template> |
| 1360 | | </div> |
| 1361 | | <button |
| 1362 | | v-if="ribbonCanScrollRight" |
| 1363 | | type="button" |
| 1364 | | class="page-ribbon-arrow right" |
| 1365 | | aria-label="Scroll filters right" |
| 1366 | | @click="scrollRibbon(1)" |
| 1701 | </component> |
| 1702 | </AnimatePresence> |
| 1703 | |
| 1704 | <ul |
| 1705 | ref="resultsEl" |
| 1706 | :id="results?.length ? 'localsearch-list' : undefined" |
| 1707 | :role="results?.length ? 'listbox' : undefined" |
| 1708 | :aria-labelledby="results?.length ? 'localsearch-label' : undefined" |
| 1709 | class="results" |
| 1710 | @mousemove="onMouseMove" |
| 1367 | 1711 | > |
| 1368 | | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1369 | | </button> |
| 1370 | | </div> |
| 1371 | | |
| 1372 | | <ul |
| 1373 | | ref="resultsEl" |
| 1374 | | :id="results?.length ? 'localsearch-list' : undefined" |
| 1375 | | :role="results?.length ? 'listbox' : undefined" |
| 1376 | | :aria-labelledby="results?.length ? 'localsearch-label' : undefined" |
| 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" |
| 1712 | <!-- Empty state (shared) --> |
| 1713 | <AnimatePresence> |
| 1714 | <component |
| 1715 | :is="searchMotionDiv" |
| 1716 | v-if="urlSearchMode |
| 1717 | ? (!filterText || !urlMatches.length) |
| 1718 | : (!filterText || !filteredResults.length)" |
| 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" |
| 1720 | v-bind="emptyStateMotion" |
| 1415 | 1721 | > |
| 1416 | | <div class="url-result-body"> |
| 1417 | | <div class="titles url-titles"> |
| 1418 | | <Hash v-if="item.titles.length > 0" stroke-width="1.25" :size="18" /> |
| 1419 | | <File v-else stroke-width="1.25" :size="18" /> |
| 1420 | | <span |
| 1421 | | v-for="(t, ti) in item.titles" |
| 1422 | | :key="ti" |
| 1423 | | class="title" |
| 1424 | | > |
| 1425 | | <span class="text" v-html="t" /> |
| 1426 | | <ArrowRight stroke-width="1.25" :size="18" class="mx-0.5" /> |
| 1427 | | </span> |
| 1428 | | <span class="title main"> |
| 1429 | | <span class="text">{{ item.linkText || item.href }}</span> |
| 1430 | | </span> |
| 1431 | | </div> |
| 1432 | | <a |
| 1433 | | :href="item.href" |
| 1434 | | target="_blank" |
| 1435 | | rel="noopener noreferrer" |
| 1436 | | class="url-open-btn" |
| 1437 | | :class="{ 'url-open-btn-selected': selectedIndex === index + 1 }" |
| 1438 | | title="Open link" |
| 1439 | | @click.stop |
| 1722 | <img |
| 1723 | class="h-40 object-contain object-center" |
| 1724 | src="/asset/smolame.png" |
| 1725 | alt="Smol ame" |
| 1726 | /> |
| 1727 | <h1 v-if="filterText">Couldn't find anything, try again?</h1> |
| 1728 | <h1 v-else>Looking for something?</h1> |
| 1729 | </component> |
| 1730 | </AnimatePresence> |
| 1731 | |
| 1732 | <!-- URL search results --> |
| 1733 | <template v-if="urlSearchMode"> |
| 1734 | <AnimatePresence> |
| 1735 | <component |
| 1736 | :is="searchMotionLi" |
| 1737 | v-for="(item, index) in filteredUrlResults" |
| 1738 | :key="'url-' + urlCurrentPage + '-' + |
| 1739 | item.pageId + '-' + |
| 1740 | item.anchor + '-' + index" |
| 1741 | class="result-layout" |
| 1742 | :id="'localsearch-item-' + (index + 1)" |
| 1743 | :aria-selected="selectedIndex === index + 1 |
| 1744 | ? 'true' |
| 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" /> |
| 1442 | | </a> |
| 1443 | | </div> |
| 1444 | | </a> |
| 1445 | | </li> |
| 1446 | | </template> |
| 1447 | | |
| 1448 | | <!-- Normal search results --> |
| 1449 | | <template v-else> |
| 1450 | | <li |
| 1451 | | v-for="(p, index) in pagedResults" |
| 1452 | | :key="'normal-' + normalCurrentPage + '-' + p.id" |
| 1453 | | class="result-layout" |
| 1454 | | :id="'localsearch-item-' + (index + 1)" |
| 1455 | | :aria-selected="selectedIndex === index + 1 ? 'true' : 'false'" |
| 1456 | | role="option" |
| 1457 | | > |
| 1458 | | <a |
| 1459 | | :href="p.id" |
| 1460 | | class="result" |
| 1461 | | :class="{ selected: selectedIndex === index + 1 }" |
| 1462 | | :aria-label="[...p.titles, p.title].join(' > ')" |
| 1463 | | @mouseenter="!disableMouseOver && (selectedIndex = index + 1)" |
| 1464 | | @focusin="selectedIndex = index + 1" |
| 1465 | | @click="onResultClick" |
| 1466 | | :data-index="index + 1" |
| 1467 | | > |
| 1468 | | <div> |
| 1469 | | <div class="titles"> |
| 1470 | | <Hash v-if="p.titles.length > 0" stroke-width="1.25" :size="18" /> |
| 1471 | | <File v-else stroke-width="1.25" :size="18" /> |
| 1472 | | <span |
| 1473 | | v-for="(t, index) in p.titles" |
| 1474 | | :key="index" |
| 1475 | | class="title" |
| 1476 | | > |
| 1477 | | <span class="text" v-html="t" /> |
| 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> |
| 1762 | <div class="url-result-body"> |
| 1763 | <div class="url-path"> |
| 1764 | <Hash |
| 1765 | v-if="item.titles.length > 0" |
| 1766 | stroke-width="1.25" |
| 1767 | :size="18" |
| 1768 | /> |
| 1769 | <File v-else stroke-width="1.25" :size="18" /> |
| 1770 | <span |
| 1771 | v-for="(t, ti) in item.titles" |
| 1772 | :key="ti" |
| 1773 | class="url-path-segment" |
| 1774 | > |
| 1775 | <span class="text" v-html="t" /> |
| 1776 | <ArrowRight |
| 1777 | stroke-width="1.25" |
| 1778 | :size="18" |
| 1779 | class="mx-0.5" |
| 1780 | /> |
| 1781 | </span> |
| 1782 | <span |
| 1783 | v-if="item.linkText" |
| 1784 | class="url-path-current" |
| 1785 | v-html="item.linkText" |
| 1786 | /> |
| 1787 | </div> |
| 1788 | <a |
| 1789 | :href="item.href" |
| 1790 | target="_blank" |
| 1791 | rel="noopener noreferrer" |
| 1792 | class="url-link" |
| 1793 | :title="item.href" |
| 1794 | @click.stop |
| 1795 | v-html="item.highlighted" |
| 1796 | > |
| 1797 | </a> |
| 1798 | </div> |
| 1483 | 1799 | </div> |
| 1800 | </component> |
| 1801 | </AnimatePresence> |
| 1802 | </template> |
| 1484 | 1803 | |
| 1485 | | <div v-if="showDetailedList" class="excerpt-wrapper"> |
| 1486 | | <div v-if="p.text" class="excerpt" inert> |
| 1487 | | <div class="vp-doc" v-html="p.text" /> |
| 1804 | <!-- Normal search results --> |
| 1805 | <template v-else> |
| 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 | 1870 | </div> |
| 1489 | | <div class="excerpt-gradient-bottom" /> |
| 1490 | | <div class="excerpt-gradient-top" /> |
| 1491 | | </div> |
| 1492 | | </div> |
| 1493 | | </a> |
| 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> |
| 1871 | </a> |
| 1872 | </component> |
| 1873 | </AnimatePresence> |
| 1874 | </template> |
| 1875 | </ul> |
| 1516 | 1876 | |
| 1517 | | <template |
| 1518 | | v-for="(p, pi) in (urlSearchMode ? urlPageList : normalPageList)" |
| 1519 | | :key="pi" |
| 1877 | <!-- Bottom section: pagination (when needed). Always rendered so the |
| 1878 | shell's rounded bottom edge stays consistent. --> |
| 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 | 1889 | <button |
| 1523 | | v-else |
| 1524 | 1890 | type="button" |
| 1525 | | class="url-page-btn" |
| 1526 | | :class="{ active: p === (urlSearchMode ? urlCurrentPage : normalCurrentPage) }" |
| 1527 | | :aria-current="p === (urlSearchMode ? urlCurrentPage : normalCurrentPage) ? 'page' : undefined" |
| 1528 | | @click="urlSearchMode ? goToUrlPage(p as number) : goToNormalPage(p as number)" |
| 1891 | class="url-page-btn url-page-nav" |
| 1892 | :disabled="(urlSearchMode |
| 1893 | ? urlCurrentPage |
| 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 | 1905 | </button> |
| 1532 | | </template> |
| 1533 | 1906 | |
| 1534 | | <button |
| 1535 | | type="button" |
| 1536 | | class="url-page-btn url-page-nav" |
| 1537 | | :disabled="(urlSearchMode ? urlCurrentPage : normalCurrentPage) >= (urlSearchMode ? urlTotalPages : normalTotalPages)" |
| 1538 | | aria-label="Next page" |
| 1539 | | @click="urlSearchMode |
| 1907 | <template |
| 1908 | v-for="(p, pi) in urlSearchMode ? urlPageList : normalPageList" |
| 1909 | :key="pi" |
| 1910 | > |
| 1911 | <span v-if="p === '…'" class="url-page-ellipsis">…</span> |
| 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 | 1945 | ? goToUrlPage(urlCurrentPage + 1) |
| 1541 | 1946 | : goToNormalPage(normalCurrentPage + 1)" |
| 1542 | | > |
| 1543 | | <ChevronRight :size="14" stroke-width="2" /> |
| 1544 | | </button> |
| 1545 | | </div> |
| 1546 | | </nav> |
| 1547 | | |
| 1548 | | <div class="search-keyboard-shortcuts"> |
| 1549 | | <span> |
| 1550 | | <kbd |
| 1551 | | :aria-label="translate( |
| 1552 | | 'modal.footer.navigateUpKeyAriaLabel' |
| 1553 | | )" |
| 1554 | | > |
| 1555 | | <span class="vpi-arrow-up navigate-icon" /> |
| 1556 | | </kbd> |
| 1557 | | <kbd |
| 1558 | | :aria-label="translate( |
| 1559 | | 'modal.footer.navigateDownKeyAriaLabel' |
| 1560 | | )" |
| 1561 | | > |
| 1562 | | <span class="vpi-arrow-down navigate-icon" /> |
| 1563 | | </kbd> |
| 1564 | | {{ translate('modal.footer.navigateText') }} |
| 1565 | | </span> |
| 1566 | | <span> |
| 1567 | | <kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')"> |
| 1568 | | <span class="vpi-corner-down-left navigate-icon" /> |
| 1569 | | </kbd> |
| 1570 | | {{ translate('modal.footer.selectText') }} |
| 1571 | | </span> |
| 1572 | | <span> |
| 1573 | | <kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')"> |
| 1574 | | esc |
| 1575 | | </kbd> |
| 1576 | | {{ translate('modal.footer.closeText') }} |
| 1577 | | </span> |
| 1578 | | </div> |
| 1579 | | </div> |
| 1947 | > |
| 1948 | <ChevronRight :size="14" stroke-width="2" /> |
| 1949 | </button> |
| 1950 | </div> |
| 1951 | </nav> |
| 1952 | |
| 1953 | <component |
| 1954 | :is="searchMotionDiv" |
| 1955 | v-if="showKeyboardShortcuts" |
| 1956 | class="search-keyboard-shortcuts" |
| 1957 | v-bind="footerMotion" |
| 1958 | > |
| 1959 | <span> |
| 1960 | <kbd |
| 1961 | :aria-label="translate( |
| 1962 | 'modal.footer.navigateUpKeyAriaLabel' |
| 1963 | )" |
| 1964 | > |
| 1965 | <span class="vpi-arrow-up navigate-icon" /> |
| 1966 | </kbd> |
| 1967 | <kbd |
| 1968 | :aria-label="translate( |
| 1969 | 'modal.footer.navigateDownKeyAriaLabel' |
| 1970 | )" |
| 1971 | > |
| 1972 | <span class="vpi-arrow-down navigate-icon" /> |
| 1973 | </kbd> |
| 1974 | {{ translate('modal.footer.navigateText') }} |
| 1975 | </span> |
| 1976 | <span> |
| 1977 | <kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')"> |
| 1978 | <span class="vpi-corner-down-left navigate-icon" /> |
| 1979 | </kbd> |
| 1980 | {{ translate('modal.footer.selectText') }} |
| 1981 | </span> |
| 1982 | <span> |
| 1983 | <kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')"> |
| 1984 | esc |
| 1985 | </kbd> |
| 1986 | {{ translate('modal.footer.closeText') }} |
| 1987 | </span> |
| 1988 | </component> |
| 1989 | </component> |
| 1990 | </AnimatePresence> |
| 1580 | 1991 | |
| 1581 | 1992 | <button v-if="!showSearch" /> |
| 1582 | 1993 | </div> |
| @@ -1607,7 +2018,7 @@ function onMouseMove(e: MouseEvent) { |
| 1607 | 2018 | .shell { |
| 1608 | 2019 | position: relative; |
| 1609 | 2020 | box-sizing: border-box; |
| 1610 | | padding: 12px; |
| 2021 | padding: 12px 12px 8px; |
| 1611 | 2022 | margin: 64px auto; |
| 1612 | 2023 | display: flex; |
| 1613 | 2024 | flex-direction: column; |
| @@ -1663,6 +2074,15 @@ function onMouseMove(e: MouseEvent) { |
| 1663 | 2074 | min-width: 0; |
| 1664 | 2075 | flex: none; |
| 1665 | 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 | 2088 | .page-ribbon-track { |
| @@ -1706,14 +2126,12 @@ function onMouseMove(e: MouseEvent) { |
| 1706 | 2126 | |
| 1707 | 2127 | .page-ribbon-arrow.right { |
| 1708 | 2128 | right: 0; |
| 1709 | | background: linear-gradient(to right, transparent, var(--vp-local-search-bg, var(--vp-c-bg-soft)) 70%); |
| 1710 | 2129 | justify-content: flex-end; |
| 1711 | 2130 | padding-right: 6px; |
| 1712 | 2131 | } |
| 1713 | 2132 | |
| 1714 | 2133 | .page-ribbon-arrow.left { |
| 1715 | 2134 | left: 0; |
| 1716 | | background: linear-gradient(to left, transparent, var(--vp-local-search-bg, var(--vp-c-bg-soft)) 70%); |
| 1717 | 2135 | justify-content: flex-start; |
| 1718 | 2136 | padding-left: 6px; |
| 1719 | 2137 | } |
| @@ -1894,6 +2312,10 @@ function onMouseMove(e: MouseEvent) { |
| 1894 | 2312 | overscroll-behavior: contain; |
| 1895 | 2313 | } |
| 1896 | 2314 | |
| 2315 | .result-layout { |
| 2316 | will-change: transform, opacity, height; |
| 2317 | } |
| 2318 | |
| 1897 | 2319 | .result { |
| 1898 | 2320 | display: flex; |
| 1899 | 2321 | align-items: center; |
| @@ -1927,15 +2349,83 @@ function onMouseMove(e: MouseEvent) { |
| 1927 | 2349 | align-items: center; |
| 1928 | 2350 | } |
| 1929 | 2351 | |
| 1930 | | /* URL-mode card: breadcrumb text wraps freely, open-link button is pinned |
| 1931 | | to the top-right corner so it never detaches when the title wraps. */ |
| 2352 | .url-result-card { |
| 2353 | cursor: pointer; |
| 2354 | } |
| 2355 | |
| 1932 | 2356 | .url-result-body { |
| 1933 | | position: relative; |
| 1934 | | padding-right: 28px; |
| 2357 | display: flex; |
| 2358 | flex-direction: column; |
| 2359 | gap: 6px; |
| 1935 | 2360 | } |
| 1936 | 2361 | |
| 1937 | | .url-titles { |
| 1938 | | z-index: auto; |
| 2362 | .url-path { |
| 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 | 2431 | .titles > svg { |
| @@ -1962,15 +2452,6 @@ function onMouseMove(e: MouseEvent) { |
| 1962 | 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 | 2455 | .result.selected { |
| 1975 | 2456 | --vp-local-search-result-bg: var(--vp-local-search-result-selected-bg); |
| 1976 | 2457 | border-color: var(--vp-local-search-result-selected-border); |
| @@ -2119,42 +2600,6 @@ svg { |
| 2119 | 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 | 2603 | :deep(.url-highlight) { |
| 2159 | 2604 | background-color: var(--vp-local-search-highlight-bg); |
| 2160 | 2605 | color: var(--vp-local-search-highlight-text); |
| @@ -2163,20 +2608,18 @@ svg { |
| 2163 | 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 | 2614 | .url-pagination { |
| 2168 | 2615 | display: flex; |
| 2169 | 2616 | align-items: center; |
| 2170 | 2617 | justify-content: center; |
| 2171 | 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) { |
| 2177 | | .url-pagination { |
| 2178 | | padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); |
| 2179 | | } |
| 2621 | .url-pagination:has(.url-pagination-segment) { |
| 2622 | padding-top: 8px; |
| 2180 | 2623 | } |
| 2181 | 2624 | |
| 2182 | 2625 | .url-pagination-segment { |
| @@ -2243,4 +2686,4 @@ svg { |
| 2243 | 2686 | user-select: none; |
| 2244 | 2687 | background: transparent; |
| 2245 | 2688 | } |
| 2246 | | </style> |
| \ No newline at end of file |
| 2689 | </style> |