| @@ -22,7 +22,6 @@ import { escapeRegExp } from 'vitepress/dist/client/shared' |
| 22 | 22 | import { |
| 23 | 23 | computedAsync, |
| 24 | 24 | onKeyStroke, |
| 25 | | refDebounced, |
| 26 | 25 | useEventListener, |
| 27 | 26 | useLocalStorage, |
| 28 | 27 | useScrollLock, |
| @@ -140,7 +139,19 @@ const filterText = disableQueryPersistence.value |
| 140 | 139 | ? ref('') |
| 141 | 140 | : useSessionStorage('vitepress:local-search-filter', '') |
| 142 | 141 | |
| 143 | | const debouncedFilterText = refDebounced(filterText, 300) |
| 142 | const urlFilterDebounced = ref(filterText.value) |
| 143 | let urlDebounceTimer: ReturnType<typeof setTimeout> | undefined |
| 144 | watch(filterText, (v) => { |
| 145 | clearTimeout(urlDebounceTimer) |
| 146 | if (!v) { |
| 147 | urlFilterDebounced.value = '' // instant clear, no trailing-edge delay |
| 148 | return |
| 149 | } |
| 150 | urlDebounceTimer = setTimeout(() => { |
| 151 | urlFilterDebounced.value = v |
| 152 | }, 60) |
| 153 | }) |
| 154 | onBeforeUnmount(() => clearTimeout(urlDebounceTimer)) |
| 144 | 155 | |
| 145 | 156 | const showDetailedList = useLocalStorage( |
| 146 | 157 | 'vitepress:local-search-detailed-list', |
| @@ -196,18 +207,22 @@ interface UrlResult { |
| 196 | 207 | highlighted: string |
| 197 | 208 | } |
| 198 | 209 | |
| 199 | | const urlResults = computed((): UrlResult[] => { |
| 200 | | if (!urlSearchMode.value || !debouncedFilterText.value.trim()) return [] |
| 201 | | const query = debouncedFilterText.value.trim().toLowerCase() |
| 202 | | const escaped = query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') |
| 203 | | const regex = new RegExp(`(${escaped})`, 'gi') |
| 204 | | // allLinks is pre-sorted by page order — no sort needed here |
| 205 | | return allLinks.value |
| 206 | | .filter(({ href }) => href.toLowerCase().includes(query)) |
| 207 | | .map(({ href, linkText, pageId, anchor, titles }) => ({ |
| 208 | | href, linkText, pageId, anchor, titles, |
| 209 | | highlighted: href.replace(regex, '<mark class="url-highlight">$1</mark>') |
| 210 | | })) |
| 210 | const URL_PAGE_SIZE = 50 |
| 211 | |
| 212 | // 1-indexed current page within the URL results. |
| 213 | const urlPage = ref(1) |
| 214 | |
| 215 | // Full match set — cheap string filtering only (no regex, no object churn). |
| 216 | // Used for accurate page-group counts in the ribbon and for pagination. |
| 217 | const urlMatches = computed((): PageLink[] => { |
| 218 | if (!urlSearchMode.value || !filterText.value.trim()) return [] |
| 219 | const query = urlFilterDebounced.value.trim().toLowerCase() |
| 220 | if (!query) return [] |
| 221 | const out: PageLink[] = [] |
| 222 | for (const link of allLinks.value) { |
| 223 | if (link.href.toLowerCase().includes(query)) out.push(link) |
| 224 | } |
| 225 | return out |
| 211 | 226 | }) |
| 212 | 227 | |
| 213 | 228 | // URL mode page ribbon — mirrors the normal pageGroups/filteredResults logic |
| @@ -215,7 +230,7 @@ const urlActivePageFilter = ref<string | null>(null) |
| 215 | 230 | |
| 216 | 231 | const urlPageGroups = computed(() => { |
| 217 | 232 | const map = new Map<string, { key: string; label: string; count: number }>() |
| 218 | | for (const r of urlResults.value) { |
| 233 | for (const r of urlMatches.value) { |
| 219 | 234 | const key = r.pageId |
| 220 | 235 | const existing = map.get(key) |
| 221 | 236 | if (existing) existing.count++ |
| @@ -224,24 +239,93 @@ const urlPageGroups = computed(() => { |
| 224 | 239 | return [...map.values()].sort((a, b) => getPageOrder(a.key) - getPageOrder(b.key)) |
| 225 | 240 | }) |
| 226 | 241 | |
| 227 | | const filteredUrlResults = computed(() => { |
| 228 | | if (!urlActivePageFilter.value) return urlResults.value |
| 229 | | return urlResults.value.filter((r) => r.pageId === urlActivePageFilter.value) |
| 242 | // Full match set honoring the active ribbon page filter (uncapped). |
| 243 | const urlFilteredMatches = computed((): PageLink[] => { |
| 244 | if (!urlActivePageFilter.value) return urlMatches.value |
| 245 | return urlMatches.value.filter((l) => l.pageId === urlActivePageFilter.value) |
| 246 | }) |
| 247 | |
| 248 | // Total number of result pages (Google-style paging through urlFilteredMatches). |
| 249 | const urlTotalPages = computed(() => |
| 250 | Math.max(1, Math.ceil(urlFilteredMatches.value.length / URL_PAGE_SIZE)) |
| 251 | ) |
| 252 | |
| 253 | // Clamp the current page whenever the result set shrinks. |
| 254 | const urlCurrentPage = computed(() => |
| 255 | Math.min(urlPage.value, urlTotalPages.value) |
| 256 | ) |
| 257 | |
| 258 | // The rows actually rendered: the current page's slice of the filtered matches. |
| 259 | const filteredUrlResults = computed((): UrlResult[] => { |
| 260 | const matches = urlFilteredMatches.value |
| 261 | const start = (urlCurrentPage.value - 1) * URL_PAGE_SIZE |
| 262 | const end = start + URL_PAGE_SIZE |
| 263 | const out: UrlResult[] = [] |
| 264 | for (let i = start; i < end && i < matches.length; i++) { |
| 265 | const link = matches[i] |
| 266 | out.push({ |
| 267 | href: link.href, |
| 268 | linkText: link.linkText, |
| 269 | pageId: link.pageId, |
| 270 | anchor: link.anchor, |
| 271 | titles: link.titles, |
| 272 | highlighted: link.href // not currently rendered; kept for type compat |
| 273 | }) |
| 274 | } |
| 275 | return out |
| 276 | }) |
| 277 | |
| 278 | // Compact page-number list with ellipses, e.g. [1, '…', 4, 5, 6, '…', 12]. |
| 279 | const urlPageList = computed<(number | '…')[]>(() => { |
| 280 | const total = urlTotalPages.value |
| 281 | const current = urlCurrentPage.value |
| 282 | if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1) |
| 283 | const pages: (number | '…')[] = [1] |
| 284 | const left = Math.max(2, current - 1) |
| 285 | const right = Math.min(total - 1, current + 1) |
| 286 | if (left > 2) pages.push('…') |
| 287 | for (let p = left; p <= right; p++) pages.push(p) |
| 288 | if (right < total - 1) pages.push('…') |
| 289 | pages.push(total) |
| 290 | return pages |
| 291 | }) |
| 292 | |
| 293 | function goToUrlPage(p: number) { |
| 294 | const target = Math.min(Math.max(1, p), urlTotalPages.value) |
| 295 | if (target === urlCurrentPage.value) return |
| 296 | urlPage.value = target |
| 297 | selectedIndex.value = filteredUrlResults.value.length ? 1 : -1 |
| 298 | nextTick(() => { |
| 299 | if (resultsEl.value) resultsEl.value.scrollTop = 0 |
| 300 | scrollToSelectedResult() |
| 301 | }) |
| 302 | } |
| 303 | |
| 304 | // Reset to page 1 whenever the query changes or the page filter changes. |
| 305 | watch([urlFilterDebounced, urlActivePageFilter], () => { |
| 306 | urlPage.value = 1 |
| 230 | 307 | }) |
| 231 | 308 | |
| 232 | | // Reset URL filter when query changes or mode switches |
| 233 | | watch(urlResults, (r) => { |
| 234 | | if (urlActivePageFilter.value && !urlPageGroups.value.some((g) => g.key === urlActivePageFilter.value)) { |
| 309 | // Reset URL ribbon filter if the active page disappears from the groups. |
| 310 | watch(urlMatches, () => { |
| 311 | if ( |
| 312 | urlActivePageFilter.value && |
| 313 | !urlPageGroups.value.some((g) => g.key === urlActivePageFilter.value) |
| 314 | ) { |
| 235 | 315 | urlActivePageFilter.value = null |
| 236 | 316 | } |
| 237 | 317 | }) |
| 238 | 318 | |
| 239 | 319 | watch(urlSearchMode, (active) => { |
| 240 | | if (!active) urlActivePageFilter.value = null |
| 320 | if (!active) { |
| 321 | urlActivePageFilter.value = null |
| 322 | urlPage.value = 1 |
| 323 | } |
| 241 | 324 | }) |
| 242 | 325 | |
| 243 | 326 | function setUrlPageFilter(key: string | null) { |
| 244 | 327 | urlActivePageFilter.value = urlActivePageFilter.value === key ? null : key |
| 328 | urlPage.value = 1 |
| 245 | 329 | selectedIndex.value = filteredUrlResults.value.length ? 1 : -1 |
| 246 | 330 | nextTick(() => { |
| 247 | 331 | if (resultsEl.value) resultsEl.value.scrollTop = 0 |
| @@ -364,6 +448,58 @@ const filteredResults = computed(() => { |
| 364 | 448 | ) |
| 365 | 449 | }) |
| 366 | 450 | |
| 451 | // --- Normal-mode (exact/fuzzy) pagination --------------------------------- |
| 452 | // Mirrors the URL-mode pager. filteredResults stays the full filtered set; |
| 453 | // pagedResults is the current page slice that actually renders. |
| 454 | const NORMAL_PAGE_SIZE = URL_PAGE_SIZE |
| 455 | |
| 456 | const normalPage = ref(1) |
| 457 | |
| 458 | const normalTotalPages = computed(() => |
| 459 | Math.max(1, Math.ceil(filteredResults.value.length / NORMAL_PAGE_SIZE)) |
| 460 | ) |
| 461 | |
| 462 | const normalCurrentPage = computed(() => |
| 463 | Math.min(normalPage.value, normalTotalPages.value) |
| 464 | ) |
| 465 | |
| 466 | const pagedResults = computed(() => { |
| 467 | const start = (normalCurrentPage.value - 1) * NORMAL_PAGE_SIZE |
| 468 | return filteredResults.value.slice(start, start + NORMAL_PAGE_SIZE) |
| 469 | }) |
| 470 | |
| 471 | const normalPageList = computed<(number | '…')[]>(() => { |
| 472 | const total = normalTotalPages.value |
| 473 | const current = normalCurrentPage.value |
| 474 | if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1) |
| 475 | const pages: (number | '…')[] = [1] |
| 476 | const left = Math.max(2, current - 1) |
| 477 | const right = Math.min(total - 1, current + 1) |
| 478 | if (left > 2) pages.push('…') |
| 479 | for (let p = left; p <= right; p++) pages.push(p) |
| 480 | if (right < total - 1) pages.push('…') |
| 481 | pages.push(total) |
| 482 | return pages |
| 483 | }) |
| 484 | |
| 485 | function goToNormalPage(p: number) { |
| 486 | const target = Math.min(Math.max(1, p), normalTotalPages.value) |
| 487 | if (target === normalCurrentPage.value) return |
| 488 | normalPage.value = target |
| 489 | selectedIndex.value = pagedResults.value.length ? 1 : -1 |
| 490 | nextTick(() => { |
| 491 | if (resultsEl.value) resultsEl.value.scrollTop = 0 |
| 492 | scrollToSelectedResult() |
| 493 | reapplyHighlights() |
| 494 | }) |
| 495 | } |
| 496 | |
| 497 | // Reset to page 1 when the query changes (results replaced) or filter changes. |
| 498 | watch([results, activePageFilter], () => { |
| 499 | normalPage.value = 1 |
| 500 | }) |
| 501 | // --------------------------------------------------------------------------- |
| 502 | |
| 367 | 503 | function setPageFilter(key: string | null) { |
| 368 | 504 | activePageFilter.value = activePageFilter.value === key ? null : key |
| 369 | 505 | selectedIndex.value = filteredResults.value.length ? 1 : -1 |
| @@ -842,12 +978,12 @@ function onSearchBarClick(event: PointerEvent) { |
| 842 | 978 | const selectedIndex = ref(-1) |
| 843 | 979 | const disableMouseOver = ref(true) |
| 844 | 980 | |
| 845 | | // Active result list length (URL mode vs normal mode) |
| 981 | // Active result list length (URL mode vs normal mode) — current page only |
| 846 | 982 | const activeResultsLength = computed(() => |
| 847 | | urlSearchMode.value ? filteredUrlResults.value.length : filteredResults.value.length |
| 983 | urlSearchMode.value ? filteredUrlResults.value.length : pagedResults.value.length |
| 848 | 984 | ) |
| 849 | 985 | |
| 850 | | watch(filteredResults, (r) => { |
| 986 | watch(pagedResults, (r) => { |
| 851 | 987 | if (!urlSearchMode.value) { |
| 852 | 988 | selectedIndex.value = r.length ? 0 : -1 |
| 853 | 989 | scrollToSelectedResult() |
| @@ -918,7 +1054,7 @@ onKeyStroke('Enter', (e) => { |
| 918 | 1054 | return |
| 919 | 1055 | } |
| 920 | 1056 | |
| 921 | | const selectedPackage = filteredResults.value[index] |
| 1057 | const selectedPackage = pagedResults.value[index] |
| 922 | 1058 | if (e.target instanceof HTMLInputElement && !selectedPackage) { |
| 923 | 1059 | e.preventDefault() |
| 924 | 1060 | return |
| @@ -1051,346 +1187,396 @@ function onMouseMove(e: MouseEvent) { |
| 1051 | 1187 | v-if="showSearch" |
| 1052 | 1188 | class="shell" |
| 1053 | 1189 | > |
| 1054 | | <form |
| 1055 | | class="search-bar" |
| 1056 | | @pointerup="onSearchBarClick($event)" |
| 1057 | | @submit.prevent="" |
| 1190 | <form |
| 1191 | class="search-bar" |
| 1192 | @pointerup="onSearchBarClick($event)" |
| 1193 | @submit.prevent="" |
| 1194 | > |
| 1195 | <label |
| 1196 | :title="buttonText" |
| 1197 | id="localsearch-label" |
| 1198 | for="localsearch-input" |
| 1058 | 1199 | > |
| 1059 | | <label |
| 1060 | | :title="buttonText" |
| 1061 | | id="localsearch-label" |
| 1062 | | for="localsearch-input" |
| 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" |
| 1063 | 1210 | > |
| 1064 | | <span |
| 1065 | | aria-hidden="true" |
| 1066 | | class="vpi-search search-icon local-search-icon" |
| 1067 | | /> |
| 1068 | | </label> |
| 1069 | | <div class="search-actions before"> |
| 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"> |
| 1236 | <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" |
| 1242 | > |
| 1243 | <LayoutList :size="18" stroke-width="1.25" /> |
| 1244 | </button> |
| 1070 | 1245 | <button |
| 1071 | | class="back-button" |
| 1072 | | :title="translate('modal.backButtonTitle')" |
| 1073 | | @click="showSearch = false" |
| 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" |
| 1074 | 1251 | > |
| 1075 | | <span class="vpi-arrow-left local-search-icon" /> |
| 1252 | <List :size="18" stroke-width="1.25" /> |
| 1076 | 1253 | </button> |
| 1077 | 1254 | </div> |
| 1078 | | <input |
| 1079 | | ref="searchInput" |
| 1080 | | v-model="filterText" |
| 1081 | | :aria-activedescendant="selectedIndex > -1 |
| 1082 | | ? 'localsearch-item-' + selectedIndex |
| 1083 | | : undefined" |
| 1084 | | aria-autocomplete="both" |
| 1085 | | :aria-controls="results?.length ? 'localsearch-list' : undefined" |
| 1086 | | aria-labelledby="localsearch-label" |
| 1087 | | autocapitalize="off" |
| 1088 | | autocomplete="off" |
| 1089 | | autocorrect="off" |
| 1090 | | class="search-input" |
| 1091 | | id="localsearch-input" |
| 1092 | | enterkeyhint="go" |
| 1093 | | maxlength="64" |
| 1094 | | :placeholder="buttonText" |
| 1095 | | spellcheck="false" |
| 1096 | | type="search" |
| 1097 | | /> |
| 1098 | | <div class="search-actions"> |
| 1099 | | <div v-if="!disableDetailedView && searchMode !== 'url'" class="view-group toolbar-group"> |
| 1100 | | <button |
| 1101 | | type="button" |
| 1102 | | class="mode-btn" |
| 1103 | | :class="{ 'mode-active': showDetailedList }" |
| 1104 | | title="Detail view (Consumes more RAM)" |
| 1105 | | @click="showDetailedList ? showDetailedList = false : showDetailedList = true" |
| 1106 | | > |
| 1107 | | <LayoutList :size="18" stroke-width="1.25" /> |
| 1108 | | </button> |
| 1109 | | <button |
| 1110 | | type="button" |
| 1111 | | class="mode-btn" |
| 1112 | | :class="{ 'mode-active': !showDetailedList }" |
| 1113 | | title="List view (Consumes less RAM)" |
| 1114 | | @click="!showDetailedList ? showDetailedList = true : showDetailedList = false" |
| 1115 | | > |
| 1116 | | <List :size="18" stroke-width="1.25" /> |
| 1117 | | </button> |
| 1118 | | </div> |
| 1119 | | <div class="search-mode-group toolbar-group"> |
| 1120 | | <button |
| 1121 | | type="button" |
| 1122 | | class="mode-btn" |
| 1123 | | :class="{ 'mode-active': searchMode === 'exact' }" |
| 1124 | | title="Exact search" |
| 1125 | | @click="searchMode === 'exact' ? cycleSearchMode() : searchMode = 'exact'" |
| 1126 | | > |
| 1127 | | <Locate :size="18" stroke-width="1.25" /> |
| 1128 | | </button> |
| 1129 | | <button |
| 1130 | | type="button" |
| 1131 | | class="mode-btn" |
| 1132 | | :class="{ 'mode-active': searchMode === 'fuzzy' }" |
| 1133 | | title="Fuzzy search" |
| 1134 | | @click="searchMode === 'fuzzy' ? cycleSearchMode() : searchMode = 'fuzzy'" |
| 1135 | | > |
| 1136 | | <LocateOff :size="18" stroke-width="1.25" /> |
| 1137 | | </button> |
| 1138 | | <button |
| 1139 | | type="button" |
| 1140 | | class="mode-btn" |
| 1141 | | :class="{ 'mode-active': searchMode === 'url' }" |
| 1142 | | title="URL search" |
| 1143 | | @click="searchMode === 'url' ? cycleSearchMode() : searchMode = 'url'" |
| 1144 | | > |
| 1145 | | <Globe :size="18" stroke-width="1.25" /> |
| 1146 | | </button> |
| 1147 | | </div> |
| 1255 | <div class="search-mode-group toolbar-group"> |
| 1148 | 1256 | <button |
| 1149 | | class="clear-button" |
| 1150 | | type="reset" |
| 1151 | | :disabled="disableReset" |
| 1152 | | :title="translate('modal.resetButtonTitle')" |
| 1153 | | @click="resetSearch" |
| 1257 | type="button" |
| 1258 | class="mode-btn" |
| 1259 | :class="{ 'mode-active': searchMode === 'exact' }" |
| 1260 | title="Exact search" |
| 1261 | @click="searchMode === 'exact' ? cycleSearchMode() : searchMode = 'exact'" |
| 1262 | > |
| 1263 | <Locate :size="18" stroke-width="1.25" /> |
| 1264 | </button> |
| 1265 | <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'" |
| 1271 | > |
| 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'" |
| 1154 | 1280 | > |
| 1155 | | <Delete :size="19" stroke-width="1.25" /> |
| 1281 | <Globe :size="18" stroke-width="1.25" /> |
| 1156 | 1282 | </button> |
| 1157 | 1283 | </div> |
| 1158 | | </form> |
| 1159 | | |
| 1284 | <button |
| 1285 | class="clear-button" |
| 1286 | type="reset" |
| 1287 | :disabled="disableReset" |
| 1288 | :title="translate('modal.resetButtonTitle')" |
| 1289 | @click="resetSearch" |
| 1290 | > |
| 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> |
| 1160 | 1309 | <div |
| 1161 | | v-if="urlSearchMode ? urlPageGroups.length > 1 : pageGroups.length > 1" |
| 1162 | | class="page-ribbon" |
| 1310 | ref="ribbonTrack" |
| 1311 | class="page-ribbon-track" |
| 1312 | @scroll="updateRibbonOverflow" |
| 1163 | 1313 | > |
| 1314 | <!-- URL mode tabs --> |
| 1315 | <template v-if="urlSearchMode"> |
| 1164 | 1316 | <button |
| 1165 | | v-if="ribbonCanScrollLeft" |
| 1166 | 1317 | type="button" |
| 1167 | | class="page-ribbon-arrow left" |
| 1168 | | aria-label="Scroll filters left" |
| 1169 | | @click="scrollRibbon(-1)" |
| 1318 | class="page-pill" |
| 1319 | :class="{ active: urlActivePageFilter === null }" |
| 1320 | @click="setUrlPageFilter(null)" |
| 1170 | 1321 | > |
| 1171 | | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1322 | All |
| 1323 | <span class="page-pill-count">{{ urlMatches.length }}</span> |
| 1172 | 1324 | </button> |
| 1173 | | <div |
| 1174 | | ref="ribbonTrack" |
| 1175 | | class="page-ribbon-track" |
| 1176 | | @scroll="updateRibbonOverflow" |
| 1325 | <button |
| 1326 | v-for="group in urlPageGroups" |
| 1327 | :key="group.key" |
| 1328 | type="button" |
| 1329 | class="page-pill" |
| 1330 | :class="{ active: urlActivePageFilter === group.key }" |
| 1331 | @click="setUrlPageFilter(group.key)" |
| 1177 | 1332 | > |
| 1178 | | <!-- URL mode tabs --> |
| 1179 | | <template v-if="urlSearchMode"> |
| 1180 | | <button |
| 1181 | | type="button" |
| 1182 | | class="page-pill" |
| 1183 | | :class="{ active: urlActivePageFilter === null }" |
| 1184 | | @click="setUrlPageFilter(null)" |
| 1185 | | > |
| 1186 | | All |
| 1187 | | <span class="page-pill-count">{{ urlResults.length }}</span> |
| 1188 | | </button> |
| 1189 | | <button |
| 1190 | | v-for="group in urlPageGroups" |
| 1191 | | :key="group.key" |
| 1192 | | type="button" |
| 1193 | | class="page-pill" |
| 1194 | | :class="{ active: urlActivePageFilter === group.key }" |
| 1195 | | @click="setUrlPageFilter(group.key)" |
| 1196 | | > |
| 1197 | | <span class="page-pill-label">{{ group.label }}</span> |
| 1198 | | <span class="page-pill-count">{{ group.count }}</span> |
| 1199 | | </button> |
| 1200 | | </template> |
| 1201 | | <!-- Normal mode tabs --> |
| 1202 | | <template v-else> |
| 1203 | | <button |
| 1204 | | type="button" |
| 1205 | | class="page-pill" |
| 1206 | | :class="{ active: activePageFilter === null }" |
| 1207 | | @click="setPageFilter(null)" |
| 1208 | | > |
| 1209 | | All |
| 1210 | | <span class="page-pill-count">{{ results.length }}</span> |
| 1211 | | </button> |
| 1212 | | <button |
| 1213 | | v-for="group in pageGroups" |
| 1214 | | :key="group.key" |
| 1215 | | type="button" |
| 1216 | | class="page-pill" |
| 1217 | | :class="{ active: activePageFilter === group.key }" |
| 1218 | | @click="setPageFilter(group.key)" |
| 1219 | | > |
| 1220 | | <span class="page-pill-label">{{ group.label }}</span> |
| 1221 | | <span class="page-pill-count">{{ group.count }}</span> |
| 1222 | | </button> |
| 1223 | | </template> |
| 1224 | | </div> |
| 1333 | <span class="page-pill-label">{{ group.label }}</span> |
| 1334 | <span class="page-pill-count">{{ group.count }}</span> |
| 1335 | </button> |
| 1336 | </template> |
| 1337 | <!-- Normal mode tabs --> |
| 1338 | <template v-else> |
| 1225 | 1339 | <button |
| 1226 | | v-if="ribbonCanScrollRight" |
| 1227 | 1340 | type="button" |
| 1228 | | class="page-ribbon-arrow right" |
| 1229 | | aria-label="Scroll filters right" |
| 1230 | | @click="scrollRibbon(1)" |
| 1341 | class="page-pill" |
| 1342 | :class="{ active: activePageFilter === null }" |
| 1343 | @click="setPageFilter(null)" |
| 1231 | 1344 | > |
| 1232 | | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1345 | All |
| 1346 | <span class="page-pill-count">{{ results.length }}</span> |
| 1233 | 1347 | </button> |
| 1234 | | </div> |
| 1348 | <button |
| 1349 | v-for="group in pageGroups" |
| 1350 | :key="group.key" |
| 1351 | type="button" |
| 1352 | class="page-pill" |
| 1353 | :class="{ active: activePageFilter === group.key }" |
| 1354 | @click="setPageFilter(group.key)" |
| 1355 | > |
| 1356 | <span class="page-pill-label">{{ group.label }}</span> |
| 1357 | <span class="page-pill-count">{{ group.count }}</span> |
| 1358 | </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)" |
| 1367 | > |
| 1368 | <ChevronRight :size="18" stroke-width="1.75" /> |
| 1369 | </button> |
| 1370 | </div> |
| 1235 | 1371 | |
| 1236 | | <ul |
| 1237 | | ref="resultsEl" |
| 1238 | | :id="results?.length ? 'localsearch-list' : undefined" |
| 1239 | | :role="results?.length ? 'listbox' : undefined" |
| 1240 | | :aria-labelledby="results?.length ? 'localsearch-label' : undefined" |
| 1241 | | class="results" |
| 1242 | | @mousemove="onMouseMove" |
| 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" |
| 1243 | 1386 | > |
| 1244 | | <!-- Empty state (shared) --> |
| 1245 | | <div |
| 1246 | | v-if="urlSearchMode |
| 1247 | | ? (!filterText || !urlResults.length) |
| 1248 | | : (!filterText || !filteredResults.length)" |
| 1249 | | 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" |
| 1250 | | > |
| 1251 | | <img |
| 1252 | | class="h-40 object-contain object-center -translate-x-2" |
| 1253 | | src="/asset/smolame.png" |
| 1254 | | alt="Smol ame" |
| 1255 | | /> |
| 1256 | | <h1 v-if="filterText">Couldn't find anything, try again?</h1> |
| 1257 | | <h1 v-else>Looking for something?</h1> |
| 1258 | | </div> |
| 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> |
| 1259 | 1395 | |
| 1260 | | <!-- URL search results --> |
| 1261 | | <template v-if="urlSearchMode"> |
| 1262 | | <li |
| 1263 | | v-for="(item, index) in filteredUrlResults" |
| 1264 | | :key="item.href + item.pageId" |
| 1265 | | class="result-layout" |
| 1266 | | :id="'localsearch-item-' + (index + 1)" |
| 1267 | | :aria-selected="selectedIndex === index + 1 ? 'true' : 'false'" |
| 1268 | | role="option" |
| 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" |
| 1269 | 1415 | > |
| 1270 | | <a |
| 1271 | | :href="item.anchor ? item.pageId + '#' + item.anchor : item.pageId" |
| 1272 | | class="result" |
| 1273 | | :class="{ selected: selectedIndex === index + 1 }" |
| 1274 | | :aria-label="item.linkText || item.href" |
| 1275 | | @mouseenter="!disableMouseOver && (selectedIndex = index + 1)" |
| 1276 | | @focusin="selectedIndex = index + 1" |
| 1277 | | @click="onResultClick" |
| 1278 | | :data-index="index + 1" |
| 1279 | | > |
| 1280 | | <div> |
| 1281 | | <div class="titles"> |
| 1282 | | <Hash v-if="item.titles.length > 0" stroke-width="1.25" :size="18" /> |
| 1283 | | <File v-else stroke-width="1.25" :size="18" /> |
| 1284 | | <span |
| 1285 | | v-for="(t, ti) in item.titles" |
| 1286 | | :key="ti" |
| 1287 | | class="title" |
| 1288 | | > |
| 1289 | | <span class="text" v-html="t" /> |
| 1290 | | <ArrowRight stroke-width="1.25" :size="18" class="mx-0.5" /> |
| 1291 | | </span> |
| 1292 | | <span class="title main"> |
| 1293 | | <span class="text">{{ item.linkText || item.href }}</span> |
| 1294 | | </span> |
| 1295 | | <a |
| 1296 | | :href="item.href" |
| 1297 | | target="_blank" |
| 1298 | | rel="noopener noreferrer" |
| 1299 | | class="url-open-btn" |
| 1300 | | :class="{ 'url-open-btn-selected': selectedIndex === index + 1 }" |
| 1301 | | title="Open link" |
| 1302 | | @click.stop |
| 1303 | | > |
| 1304 | | <ExternalLink :size="14" stroke-width="1.5" /> |
| 1305 | | </a> |
| 1306 | | </div> |
| 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> |
| 1307 | 1431 | </div> |
| 1308 | | </a> |
| 1309 | | </li> |
| 1310 | | </template> |
| 1311 | | |
| 1312 | | <!-- Normal search results --> |
| 1313 | | <template v-else> |
| 1314 | | <li |
| 1315 | | v-for="(p, index) in filteredResults" |
| 1316 | | :key="p.id" |
| 1317 | | class="result-layout" |
| 1318 | | :id="'localsearch-item-' + (index + 1)" |
| 1319 | | :aria-selected="selectedIndex === index + 1 ? 'true' : 'false'" |
| 1320 | | role="option" |
| 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 |
| 1440 | > |
| 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" |
| 1321 | 1467 | > |
| 1322 | | <a |
| 1323 | | :href="p.id" |
| 1324 | | class="result" |
| 1325 | | :class="{ selected: selectedIndex === index + 1 }" |
| 1326 | | :aria-label="[...p.titles, p.title].join(' > ')" |
| 1327 | | @mouseenter="!disableMouseOver && (selectedIndex = index + 1)" |
| 1328 | | @focusin="selectedIndex = index + 1" |
| 1329 | | @click="onResultClick" |
| 1330 | | :data-index="index + 1" |
| 1331 | | > |
| 1332 | | <div> |
| 1333 | | <div class="titles"> |
| 1334 | | <Hash v-if="p.titles.length > 0" stroke-width="1.25" :size="18" /> |
| 1335 | | <File v-else stroke-width="1.25" :size="18" /> |
| 1336 | | <span |
| 1337 | | v-for="(t, index) in p.titles" |
| 1338 | | :key="index" |
| 1339 | | class="title" |
| 1340 | | > |
| 1341 | | <span class="text" v-html="t" /> |
| 1342 | | <ArrowRight stroke-width="1.25" :size="18" class="mx-0.5" /> |
| 1343 | | </span> |
| 1344 | | <span class="title main"> |
| 1345 | | <span class="text" v-html="p.title" /> |
| 1346 | | </span> |
| 1347 | | </div> |
| 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> |
| 1483 | </div> |
| 1348 | 1484 | |
| 1349 | | <div v-if="showDetailedList" class="excerpt-wrapper"> |
| 1350 | | <div v-if="p.text" class="excerpt" inert> |
| 1351 | | <div class="vp-doc" v-html="p.text" /> |
| 1352 | | </div> |
| 1353 | | <div class="excerpt-gradient-bottom" /> |
| 1354 | | <div class="excerpt-gradient-top" /> |
| 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" /> |
| 1355 | 1488 | </div> |
| 1489 | <div class="excerpt-gradient-bottom" /> |
| 1490 | <div class="excerpt-gradient-top" /> |
| 1356 | 1491 | </div> |
| 1357 | | </a> |
| 1358 | | </li> |
| 1359 | | </template> |
| 1360 | | </ul> |
| 1361 | | |
| 1362 | | <div class="search-keyboard-shortcuts"> |
| 1363 | | <span> |
| 1364 | | <kbd |
| 1365 | | :aria-label="translate( |
| 1366 | | 'modal.footer.navigateUpKeyAriaLabel' |
| 1367 | | )" |
| 1368 | | > |
| 1369 | | <span class="vpi-arrow-up navigate-icon" /> |
| 1370 | | </kbd> |
| 1371 | | <kbd |
| 1372 | | :aria-label="translate( |
| 1373 | | 'modal.footer.navigateDownKeyAriaLabel' |
| 1374 | | )" |
| 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> |
| 1516 | |
| 1517 | <template |
| 1518 | v-for="(p, pi) in (urlSearchMode ? urlPageList : normalPageList)" |
| 1519 | :key="pi" |
| 1520 | > |
| 1521 | <span v-if="p === '…'" class="url-page-ellipsis">…</span> |
| 1522 | <button |
| 1523 | v-else |
| 1524 | 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)" |
| 1375 | 1529 | > |
| 1376 | | <span class="vpi-arrow-down navigate-icon" /> |
| 1377 | | </kbd> |
| 1378 | | {{ translate('modal.footer.navigateText') }} |
| 1379 | | </span> |
| 1380 | | <span> |
| 1381 | | <kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')"> |
| 1382 | | <span class="vpi-corner-down-left navigate-icon" /> |
| 1383 | | </kbd> |
| 1384 | | {{ translate('modal.footer.selectText') }} |
| 1385 | | </span> |
| 1386 | | <span> |
| 1387 | | <kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')"> |
| 1388 | | esc |
| 1389 | | </kbd> |
| 1390 | | {{ translate('modal.footer.closeText') }} |
| 1391 | | </span> |
| 1530 | {{ p }} |
| 1531 | </button> |
| 1532 | </template> |
| 1533 | |
| 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 |
| 1540 | ? goToUrlPage(urlCurrentPage + 1) |
| 1541 | : goToNormalPage(normalCurrentPage + 1)" |
| 1542 | > |
| 1543 | <ChevronRight :size="14" stroke-width="2" /> |
| 1544 | </button> |
| 1392 | 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> |
| 1393 | 1578 | </div> |
| 1579 | </div> |
| 1394 | 1580 | |
| 1395 | 1581 | <button v-if="!showSearch" /> |
| 1396 | 1582 | </div> |
| @@ -1403,6 +1589,13 @@ function onMouseMove(e: MouseEvent) { |
| 1403 | 1589 | z-index: 100; |
| 1404 | 1590 | inset: 0; |
| 1405 | 1591 | display: flex; |
| 1592 | align-items: flex-start; |
| 1593 | } |
| 1594 | |
| 1595 | @media (max-width: 767px) { |
| 1596 | .VPLocalSearchBox { |
| 1597 | align-items: stretch; |
| 1598 | } |
| 1406 | 1599 | } |
| 1407 | 1600 | |
| 1408 | 1601 | .backdrop { |
| @@ -1413,6 +1606,7 @@ function onMouseMove(e: MouseEvent) { |
| 1413 | 1606 | |
| 1414 | 1607 | .shell { |
| 1415 | 1608 | position: relative; |
| 1609 | box-sizing: border-box; |
| 1416 | 1610 | padding: 12px; |
| 1417 | 1611 | margin: 64px auto; |
| 1418 | 1612 | display: flex; |
| @@ -1420,7 +1614,7 @@ function onMouseMove(e: MouseEvent) { |
| 1420 | 1614 | gap: 16px; |
| 1421 | 1615 | background: var(--vp-local-search-bg); |
| 1422 | 1616 | width: min(100vw - 60px, 900px); |
| 1423 | | height: min-content; |
| 1617 | height: 100%; |
| 1424 | 1618 | max-height: min(100vh - 128px, 900px); |
| 1425 | 1619 | border-radius: 6px; |
| 1426 | 1620 | } |
| @@ -1430,12 +1624,17 @@ function onMouseMove(e: MouseEvent) { |
| 1430 | 1624 | margin: 0; |
| 1431 | 1625 | width: 100vw; |
| 1432 | 1626 | height: 100vh; |
| 1627 | height: 100dvh; |
| 1433 | 1628 | max-height: none; |
| 1434 | 1629 | border-radius: 0; |
| 1630 | overflow: hidden; |
| 1631 | gap: 8px; |
| 1435 | 1632 | } |
| 1436 | 1633 | } |
| 1437 | 1634 | |
| 1438 | 1635 | .search-bar { |
| 1636 | flex: 0 0 auto !important; |
| 1637 | min-height: 44px !important; |
| 1439 | 1638 | border: 1px solid var(--vp-c-divider); |
| 1440 | 1639 | border-radius: 4px; |
| 1441 | 1640 | display: flex; |
| @@ -1447,6 +1646,7 @@ function onMouseMove(e: MouseEvent) { |
| 1447 | 1646 | @media (max-width: 767px) { |
| 1448 | 1647 | .search-bar { |
| 1449 | 1648 | padding: 0 8px; |
| 1649 | min-height: 40px !important; |
| 1450 | 1650 | } |
| 1451 | 1651 | } |
| 1452 | 1652 | |
| @@ -1687,6 +1887,8 @@ function onMouseMove(e: MouseEvent) { |
| 1687 | 1887 | display: flex; |
| 1688 | 1888 | flex-direction: column; |
| 1689 | 1889 | gap: 6px; |
| 1890 | flex: 1 1 auto; |
| 1891 | min-height: 0 !important; |
| 1690 | 1892 | overflow-x: hidden; |
| 1691 | 1893 | overflow-y: auto; |
| 1692 | 1894 | overscroll-behavior: contain; |
| @@ -1725,6 +1927,17 @@ function onMouseMove(e: MouseEvent) { |
| 1725 | 1927 | align-items: center; |
| 1726 | 1928 | } |
| 1727 | 1929 | |
| 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. */ |
| 1932 | .url-result-body { |
| 1933 | position: relative; |
| 1934 | padding-right: 28px; |
| 1935 | } |
| 1936 | |
| 1937 | .url-titles { |
| 1938 | z-index: auto; |
| 1939 | } |
| 1940 | |
| 1728 | 1941 | .titles > svg { |
| 1729 | 1942 | flex-shrink: 0; |
| 1730 | 1943 | align-self: center; |
| @@ -1749,6 +1962,15 @@ function onMouseMove(e: MouseEvent) { |
| 1749 | 1962 | opacity: 0.5; |
| 1750 | 1963 | } |
| 1751 | 1964 | |
| 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 | |
| 1752 | 1974 | .result.selected { |
| 1753 | 1975 | --vp-local-search-result-bg: var(--vp-local-search-result-selected-bg); |
| 1754 | 1976 | border-color: var(--vp-local-search-result-selected-border); |
| @@ -1898,6 +2120,9 @@ svg { |
| 1898 | 2120 | } |
| 1899 | 2121 | |
| 1900 | 2122 | .url-open-btn { |
| 2123 | position: absolute; |
| 2124 | top: 0; |
| 2125 | right: 0; |
| 1901 | 2126 | flex: none; |
| 1902 | 2127 | display: flex; |
| 1903 | 2128 | align-items: center; |
| @@ -1908,7 +2133,6 @@ svg { |
| 1908 | 2133 | color: var(--vp-c-text-3); |
| 1909 | 2134 | opacity: 0; |
| 1910 | 2135 | transition: opacity 0.15s, color 0.15s, background 0.15s; |
| 1911 | | margin-left: auto; |
| 1912 | 2136 | } |
| 1913 | 2137 | |
| 1914 | 2138 | .result:hover .url-open-btn, |
| @@ -1938,4 +2162,85 @@ svg { |
| 1938 | 2162 | padding: 0 2px; |
| 1939 | 2163 | font-style: normal; |
| 1940 | 2164 | } |
| 2165 | |
| 2166 | /* Redesigned Unified Mode Switching Segmented Style Pagination Controls */ |
| 2167 | .url-pagination { |
| 2168 | display: flex; |
| 2169 | align-items: center; |
| 2170 | justify-content: center; |
| 2171 | flex: 0 0 auto !important; |
| 2172 | padding: 10px 8px; |
| 2173 | border-top: 1px solid var(--vp-c-divider); |
| 2174 | } |
| 2175 | |
| 2176 | @media (max-width: 767px) { |
| 2177 | .url-pagination { |
| 2178 | padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); |
| 2179 | } |
| 2180 | } |
| 2181 | |
| 2182 | .url-pagination-segment { |
| 2183 | display: flex; |
| 2184 | align-items: center; |
| 2185 | border: 1px solid var(--vp-c-divider); |
| 2186 | border-radius: 5px; |
| 2187 | overflow: hidden; |
| 2188 | background: transparent; |
| 2189 | } |
| 2190 | |
| 2191 | .url-page-btn { |
| 2192 | display: flex; |
| 2193 | align-items: center; |
| 2194 | justify-content: center; |
| 2195 | min-width: 32px; |
| 2196 | height: 28px; |
| 2197 | padding: 0 8px; |
| 2198 | border: none; |
| 2199 | background: transparent; |
| 2200 | color: var(--vp-c-text-2); |
| 2201 | font-size: 0.82rem; |
| 2202 | cursor: pointer; |
| 2203 | transition: color 0.15s, background-color 0.15s; |
| 2204 | border-radius: 0; |
| 2205 | } |
| 2206 | |
| 2207 | .url-page-btn + .url-page-btn, |
| 2208 | .url-page-ellipsis + .url-page-btn, |
| 2209 | .url-page-btn + .url-page-ellipsis { |
| 2210 | border-left: 1px solid var(--vp-c-divider); |
| 2211 | } |
| 2212 | |
| 2213 | .url-page-btn:hover:not(:disabled):not(.active) { |
| 2214 | color: var(--vp-c-text-1); |
| 2215 | background: var(--vp-c-default-soft); |
| 2216 | } |
| 2217 | |
| 2218 | .url-page-btn.active { |
| 2219 | color: var(--vp-c-brand-1); |
| 2220 | background: rgba(60, 120, 210, 0.10); |
| 2221 | font-weight: 500; |
| 2222 | cursor: default; |
| 2223 | } |
| 2224 | |
| 2225 | .url-page-btn:disabled { |
| 2226 | opacity: 0.25; |
| 2227 | cursor: not-allowed; |
| 2228 | background: transparent; |
| 2229 | } |
| 2230 | |
| 2231 | .url-page-nav { |
| 2232 | padding: 0 6px; |
| 2233 | } |
| 2234 | |
| 2235 | .url-page-ellipsis { |
| 2236 | display: flex; |
| 2237 | align-items: center; |
| 2238 | justify-content: center; |
| 2239 | min-width: 28px; |
| 2240 | height: 28px; |
| 2241 | color: var(--vp-c-text-3); |
| 2242 | font-size: 0.8rem; |
| 2243 | user-select: none; |
| 2244 | background: transparent; |
| 2245 | } |
| 1941 | 2246 | </style> |
| \ No newline at end of file |