| @@ -6,11 +6,7 @@ |
| 6 | All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder. |
6 | All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder. |
| 7 | --> |
7 | --> |
| 8 | <script setup lang="ts"> |
8 | <script setup lang="ts"> |
| 9 | import { |
9 | import { useEventListener, useStorage, useThrottleFn } from '@vueuse/core' |
| 10 | useEventListener, |
| |
| 11 | useStorage, |
| |
| 12 | useThrottleFn |
| |
| 13 | } from '@vueuse/core' |
| |
| 14 | import { getScrollOffset, useData, useRoute } from 'vitepress' |
10 | import { getScrollOffset, useData, useRoute } from 'vitepress' |
| 15 | import type { DefaultTheme as Theme } from 'vitepress' |
11 | import type { DefaultTheme as Theme } from 'vitepress' |
| 16 | import VPSidebarGroup from 'vitepress/dist/client/theme-default/components/VPSidebarGroup.vue' |
12 | import VPSidebarGroup from 'vitepress/dist/client/theme-default/components/VPSidebarGroup.vue' |
| @@ -26,16 +22,24 @@ import { |
| 26 | watchEffect |
22 | watchEffect |
| 27 | } from 'vue' |
23 | } from 'vue' |
| 28 | import { sidebar } from '../configs/constants' |
24 | import { sidebar } from '../configs/constants' |
| 29 | import { useBookmarks, BOOKMARK_CHANGE_EVENT } from './composables/useBookmarks' |
| |
| 30 | import AnnouncementPill from './components/AnnouncementPill.vue' |
25 | import AnnouncementPill from './components/AnnouncementPill.vue' |
| 31 | import SiteFooter from './components/SiteFooter.vue' |
26 | import NavActions from './components/NavActions.vue' |
| 32 | import NotFoundComponent from './components/NotFound.vue' |
27 | import NotFoundComponent from './components/NotFound.vue' |
| 33 | import { NolebaseEnhancedReadabilitiesScreenMenu } from './components/settings' |
28 | import { NolebaseEnhancedReadabilitiesScreenMenu } from './components/settings' |
| 34 | import NavActions from './components/NavActions.vue' |
| |
| 35 | import SidebarCard from './components/SidebarCard.vue' |
29 | import SidebarCard from './components/SidebarCard.vue' |
| 36 | import { AccentBgStorageKey, AccentBgStrengthStorageKey, AccentColorStorageKey } from './constants' |
30 | import SiteFooter from './components/SiteFooter.vue' |
| |
31 | import { BOOKMARK_CHANGE_EVENT, useBookmarks } from './composables/useBookmarks' |
| 37 | import { useEffects } from './composables/useEffects' |
32 | import { useEffects } from './composables/useEffects' |
| 38 | import { applyFavicons, removeFavicons, useFavicons } from './composables/useFavicons' |
33 | import { |
| |
34 | applyFavicons, |
| |
35 | removeFavicons, |
| |
36 | useFavicons |
| |
37 | } from './composables/useFavicons' |
| |
38 | import { |
| |
39 | AccentBgStorageKey, |
| |
40 | AccentBgStrengthStorageKey, |
| |
41 | AccentColorStorageKey |
| |
42 | } from './constants' |
| 39 | import { searchResultHighlightMode } from './searchState' |
43 | import { searchResultHighlightMode } from './searchState' |
| 40 | |
44 | |
| 41 | const route = useRoute() |
45 | const route = useRoute() |
| @@ -84,6 +88,12 @@ if (!import.meta.env.SSR) { |
| 84 | if (target) { |
88 | if (target) { |
| 85 | void nextTick(() => { |
89 | void nextTick(() => { |
| 86 | if (searchNavigated) { |
90 | if (searchNavigated) { |
| |
91 | scanSectionForTerms( |
| |
92 | target, |
| |
93 | getSearchTerms(searchQuery), |
| |
94 | () => {}, |
| |
95 | expandTableMoreEl |
| |
96 | ) |
| 87 | highlightSearchResult(target) |
97 | highlightSearchResult(target) |
| 88 | resetSearchNavigation() |
98 | resetSearchNavigation() |
| 89 | } |
99 | } |
| @@ -99,6 +109,12 @@ if (!import.meta.env.SSR) { |
| 99 | if (!currentHash) return |
109 | if (!currentHash) return |
| 100 | const target = getTargetByHash(currentHash) |
110 | const target = getTargetByHash(currentHash) |
| 101 | if (target) { |
111 | if (target) { |
| |
112 | scanSectionForTerms( |
| |
113 | target, |
| |
114 | getSearchTerms(searchQuery), |
| |
115 | () => {}, |
| |
116 | expandTableMoreEl |
| |
117 | ) |
| 102 | highlightSearchResult(target) |
118 | highlightSearchResult(target) |
| 103 | resetSearchNavigation() |
119 | resetSearchNavigation() |
| 104 | } else if (attempts < 15) { |
120 | } else if (attempts < 15) { |
| @@ -131,7 +147,6 @@ const removeSearchResultHighlights = () => { |
| 131 | ) |
147 | ) |
| 132 | } |
148 | } |
| 133 | |
149 | |
| 134 | |
| |
| 135 | let highlightTerm = '' |
150 | let highlightTerm = '' |
| 136 | let highlightTabPath: string[] | null = null |
151 | let highlightTabPath: string[] | null = null |
| 137 | |
152 | |
| @@ -164,7 +179,9 @@ const applyHighlightWithin = (root: HTMLElement, term: string) => { |
| 164 | const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { |
179 | const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, { |
| 165 | acceptNode(node) { |
180 | acceptNode(node) { |
| 166 | const parent = node.parentElement |
181 | const parent = node.parentElement |
| 167 | if (!parent || parent.closest('.search-result-highlight, script, style')) { |
182 | if ( |
| |
183 | !parent || parent.closest('.search-result-highlight, script, style') |
| |
184 | ) { |
| 168 | return NodeFilter.FILTER_REJECT |
185 | return NodeFilter.FILTER_REJECT |
| 169 | } |
186 | } |
| 170 | return NodeFilter.FILTER_ACCEPT |
187 | return NodeFilter.FILTER_ACCEPT |
| @@ -225,7 +242,7 @@ const highlightSearchResult = (target?: HTMLElement) => { |
| 225 | ) |
242 | ) |
| 226 | highlightTabPath = panel ? getPanelTabPath(panel) : null |
243 | highlightTabPath = panel ? getPanelTabPath(panel) : null |
| 227 | highlightTerm = term |
244 | highlightTerm = term |
| 228 | |
245 | |
| 229 | if (!applyHighlightWithin(target, term)) { |
246 | if (!applyHighlightWithin(target, term)) { |
| 230 | const docRoot = document.querySelector<HTMLElement>('.VPDoc .vp-doc') |
247 | const docRoot = document.querySelector<HTMLElement>('.VPDoc .vp-doc') |
| 231 | if (docRoot) { |
248 | if (docRoot) { |
| @@ -271,6 +288,7 @@ const getScrollTargetForAnchor = (target: HTMLElement) => { |
| 271 | |
288 | |
| 272 | const TAB_QUERY_PARAM = 't' |
289 | const TAB_QUERY_PARAM = 't' |
| 273 | const COLLAPSIBLE_QUERY_PARAM = 'c' |
290 | const COLLAPSIBLE_QUERY_PARAM = 'c' |
| |
291 | const TABLE_MORE_QUERY_PARAM = 'm' |
| 274 | |
292 | |
| 275 | const getRequestedAnchorPath = (param: string) => { |
293 | const getRequestedAnchorPath = (param: string) => { |
| 276 | const value = new URLSearchParams(window.location.search).get(param) |
294 | const value = new URLSearchParams(window.location.search).get(param) |
| @@ -283,29 +301,43 @@ const getRequestedAnchorPath = (param: string) => { |
| 283 | const getRequestedTabPath = () => getRequestedAnchorPath(TAB_QUERY_PARAM) |
301 | const getRequestedTabPath = () => getRequestedAnchorPath(TAB_QUERY_PARAM) |
| 284 | const getRequestedCollapsiblePath = () => |
302 | const getRequestedCollapsiblePath = () => |
| 285 | getRequestedAnchorPath(COLLAPSIBLE_QUERY_PARAM) |
303 | getRequestedAnchorPath(COLLAPSIBLE_QUERY_PARAM) |
| |
304 | const getRequestedTableMorePath = () => |
| |
305 | getRequestedAnchorPath(TABLE_MORE_QUERY_PARAM) |
| 286 | |
306 | |
| 287 | const encodeAnchorList = (anchors: string[]) => |
307 | const encodeAnchorList = (anchors: string[]) => |
| 288 | anchors.map((anchor) => encodeURIComponent(anchor)).join(',') |
308 | anchors.map((anchor) => encodeURIComponent(anchor)).join(',') |
| 289 | |
309 | |
| 290 | const buildUrl = ( |
310 | const buildUrl = ( |
| 291 | options: { tabs?: string[]; collapsibles?: string[]; hash?: string } = {} |
311 | options: { |
| |
312 | tabs?: string[] |
| |
313 | collapsibles?: string[] |
| |
314 | tables?: string[] |
| |
315 | hash?: string |
| |
316 | } = {} |
| 292 | ) => { |
317 | ) => { |
| 293 | const params = new URLSearchParams(window.location.search) |
318 | const params = new URLSearchParams(window.location.search) |
| 294 | const currentTabs = params.get(TAB_QUERY_PARAM) |
319 | const currentTabs = params.get(TAB_QUERY_PARAM) |
| 295 | const currentCollapsibles = params.get(COLLAPSIBLE_QUERY_PARAM) |
320 | const currentCollapsibles = params.get(COLLAPSIBLE_QUERY_PARAM) |
| |
321 | const currentTables = params.get(TABLE_MORE_QUERY_PARAM) |
| 296 | params.delete(TAB_QUERY_PARAM) |
322 | params.delete(TAB_QUERY_PARAM) |
| 297 | params.delete(COLLAPSIBLE_QUERY_PARAM) |
323 | params.delete(COLLAPSIBLE_QUERY_PARAM) |
| |
324 | params.delete(TABLE_MORE_QUERY_PARAM) |
| 298 | |
325 | |
| 299 | const tabs = options.tabs ?? |
326 | const tabs = options.tabs ?? |
| 300 | (currentTabs ? currentTabs.split(',').filter(Boolean) : []) |
327 | (currentTabs ? currentTabs.split(',').filter(Boolean) : []) |
| 301 | const collapsibles = options.collapsibles ?? |
328 | const collapsibles = options.collapsibles ?? |
| 302 | (currentCollapsibles ? currentCollapsibles.split(',').filter(Boolean) : []) |
329 | (currentCollapsibles ? currentCollapsibles.split(',').filter(Boolean) : []) |
| |
330 | const tables = options.tables ?? |
| |
331 | (currentTables ? currentTables.split(',').filter(Boolean) : []) |
| 303 | |
332 | |
| 304 | const queryParts = [ |
333 | const queryParts = [ |
| 305 | params.toString(), |
334 | params.toString(), |
| 306 | tabs.length ? `${TAB_QUERY_PARAM}=${encodeAnchorList(tabs)}` : '', |
335 | tabs.length ? `${TAB_QUERY_PARAM}=${encodeAnchorList(tabs)}` : '', |
| 307 | collapsibles.length |
336 | collapsibles.length |
| 308 | ? `${COLLAPSIBLE_QUERY_PARAM}=${encodeAnchorList(collapsibles)}` |
337 | ? `${COLLAPSIBLE_QUERY_PARAM}=${encodeAnchorList(collapsibles)}` |
| |
338 | : '', |
| |
339 | tables.length |
| |
340 | ? `${TABLE_MORE_QUERY_PARAM}=${encodeAnchorList(tables)}` |
| 309 | : '' |
341 | : '' |
| 310 | ].filter(Boolean) |
342 | ].filter(Boolean) |
| 311 | |
343 | |
| @@ -374,6 +406,73 @@ const queueTabQueryUpdateForSelection = (target: EventTarget | null) => { |
| 374 | |
406 | |
| 375 | const COLLAPSIBLE_SELECTOR = 'details[data-collapsible-anchor]' |
407 | const COLLAPSIBLE_SELECTOR = 'details[data-collapsible-anchor]' |
| 376 | |
408 | |
| |
409 | const detailsContainsTerms = (d: HTMLElement, terms: string[]) => { |
| |
410 | if (!terms.length) return false |
| |
411 | const text = (d.textContent ?? '').toLowerCase() |
| |
412 | return terms.every((term) => text.includes(term)) |
| |
413 | } |
| |
414 | |
| |
415 | // Expand tables whose hidden rows hold all searched terms. |
| |
416 | const tableContainsTerms = (t: HTMLElement, terms: string[]) => { |
| |
417 | if (!terms.length) return false |
| |
418 | const hidden = t.querySelector('tbody.table-more-hidden') |
| |
419 | const text = ((hidden ?? t).textContent ?? '').toLowerCase() |
| |
420 | return terms.every((term) => text.includes(term)) |
| |
421 | } |
| |
422 | |
| |
423 | const expandTableMoreEl = (t: HTMLElement) => { |
| |
424 | const box = getTableMoreCheckbox(t) |
| |
425 | if (box && !box.checked) box.checked = true |
| |
426 | } |
| |
427 | |
| |
428 | const scanSectionForTerms = ( |
| |
429 | target: HTMLElement, |
| |
430 | terms: string[], |
| |
431 | onDetails: (d: HTMLElement) => void, |
| |
432 | onTable: (t: HTMLElement) => void |
| |
433 | ) => { |
| |
434 | const tagName = target.tagName |
| |
435 | if (tagName.length !== 2 || tagName[0] !== 'H') return |
| |
436 | const level = +tagName[1] |
| |
437 | if (level < 1 || level > 6 || !terms.length) return |
| |
438 | |
| |
439 | let sibling = target.nextElementSibling |
| |
440 | |
| |
441 | while (sibling) { |
| |
442 | const siblingTag = sibling.tagName |
| |
443 | if ( |
| |
444 | siblingTag.length === 2 && siblingTag[0] === 'H' && |
| |
445 | +siblingTag[1] <= level |
| |
446 | ) break |
| |
447 | |
| |
448 | if (siblingTag === 'DETAILS') { |
| |
449 | if (detailsContainsTerms(sibling as HTMLElement, terms)) { |
| |
450 | onDetails(sibling as HTMLElement) |
| |
451 | } |
| |
452 | } |
| |
453 | |
| |
454 | const nested = sibling.getElementsByTagName('details') |
| |
455 | for (let i = 0, len = nested.length; i < len; i++) { |
| |
456 | if (detailsContainsTerms(nested[i], terms)) onDetails(nested[i]) |
| |
457 | } |
| |
458 | |
| |
459 | if (siblingTag === 'TABLE') { |
| |
460 | if (tableContainsTerms(sibling as HTMLElement, terms)) { |
| |
461 | onTable(sibling as HTMLElement) |
| |
462 | } |
| |
463 | } |
| |
464 | |
| |
465 | const nestedTables = sibling.getElementsByTagName('table') |
| |
466 | for (let i = 0, len = nestedTables.length; i < len; i++) { |
| |
467 | if (tableContainsTerms(nestedTables[i], terms)) { |
| |
468 | onTable(nestedTables[i]) |
| |
469 | } |
| |
470 | } |
| |
471 | |
| |
472 | sibling = sibling.nextElementSibling |
| |
473 | } |
| |
474 | } |
| |
475 | |
| 377 | const getOpenCollapsiblePath = (details: HTMLElement) => { |
476 | const getOpenCollapsiblePath = (details: HTMLElement) => { |
| 378 | const path: string[] = [] |
477 | const path: string[] = [] |
| 379 | let el: HTMLElement | null = details |
478 | let el: HTMLElement | null = details |
| @@ -430,6 +529,34 @@ const queueCollapsibleQueryUpdate = (target: EventTarget | null) => { |
| 430 | } |
529 | } |
| 431 | } |
530 | } |
| 432 | |
531 | |
| |
532 | const updateQueryForTableMore = async (table: HTMLElement) => { |
| |
533 | await nextTick() |
| |
534 | await nextFrame() |
| |
535 | |
| |
536 | const tables = getOpenTableMorePath() |
| |
537 | const tabPath = getEnclosingTabPath(table) |
| |
538 | |
| |
539 | const nextUrl = buildUrl({ |
| |
540 | tabs: tabPath.length ? tabPath : undefined, |
| |
541 | tables |
| |
542 | }) |
| |
543 | const currentUrl = |
| |
544 | `${window.location.pathname}${window.location.search}${window.location.hash}` |
| |
545 | if (nextUrl === currentUrl) return |
| |
546 | |
| |
547 | window.history.pushState(null, '', nextUrl) |
| |
548 | rewriteAnchorLinks() |
| |
549 | } |
| |
550 | |
| |
551 | const queueTableMoreQueryUpdate = (target: EventTarget | null) => { |
| |
552 | if (!(target instanceof HTMLElement)) return |
| |
553 | |
| |
554 | const box = target.closest<HTMLInputElement>('.table-more-checkbox') |
| |
555 | if (!box) return |
| |
556 | const table = box.closest<HTMLElement>('table') |
| |
557 | if (table) void updateQueryForTableMore(table) |
| |
558 | } |
| |
559 | |
| 433 | const selectCollapsiblesByPath = async (collapsiblePath: string[]) => { |
560 | const selectCollapsiblesByPath = async (collapsiblePath: string[]) => { |
| 434 | let root: ParentNode = document |
561 | let root: ParentNode = document |
| 435 | let opened: HTMLElement | undefined |
562 | let opened: HTMLElement | undefined |
| @@ -453,6 +580,45 @@ const selectCollapsiblesByPath = async (collapsiblePath: string[]) => { |
| 453 | return opened |
580 | return opened |
| 454 | } |
581 | } |
| 455 | |
582 | |
| |
583 | const TABLE_MORE_SELECTOR = 'table[data-table-more]' |
| |
584 | |
| |
585 | const getTableMoreCheckbox = (table: HTMLElement) => |
| |
586 | table.querySelector<HTMLInputElement>('.table-more-checkbox') |
| |
587 | |
| |
588 | const selectTablesByPath = async (anchors: string[]) => { |
| |
589 | let opened: HTMLTableElement | undefined |
| |
590 | |
| |
591 | for (const anchor of anchors) { |
| |
592 | const table = document.querySelector<HTMLTableElement>( |
| |
593 | `table[data-table-more="${CSS.escape(anchor)}"]` |
| |
594 | ) |
| |
595 | if (!table) continue |
| |
596 | |
| |
597 | const box = getTableMoreCheckbox(table) |
| |
598 | if (box && !box.checked) { |
| |
599 | box.checked = true |
| |
600 | await nextTick() |
| |
601 | await nextFrame() |
| |
602 | } |
| |
603 | opened = table |
| |
604 | } |
| |
605 | |
| |
606 | return opened |
| |
607 | } |
| |
608 | |
| |
609 | const getOpenTableMorePath = () => { |
| |
610 | const anchors: string[] = [] |
| |
611 | document.querySelectorAll<HTMLTableElement>(TABLE_MORE_SELECTOR).forEach( |
| |
612 | (table) => { |
| |
613 | if (getTableMoreCheckbox(table)?.checked) { |
| |
614 | const anchor = table.dataset.tableMore |
| |
615 | if (anchor) anchors.push(anchor) |
| |
616 | } |
| |
617 | } |
| |
618 | ) |
| |
619 | return anchors |
| |
620 | } |
| |
621 | |
| 456 | const TAB_LINK_MARKER = 'tab-' |
622 | const TAB_LINK_MARKER = 'tab-' |
| 457 | |
623 | |
| 458 | const rewriteAnchorLinks = () => { |
624 | const rewriteAnchorLinks = () => { |
| @@ -585,44 +751,19 @@ const openCollapsibles = async (target: HTMLElement) => { |
| 585 | |
751 | |
| 586 | const tagName = activeTarget.tagName |
752 | const tagName = activeTarget.tagName |
| 587 | if (tagName.length === 2 && tagName[0] === 'H') { |
753 | if (tagName.length === 2 && tagName[0] === 'H') { |
| 588 | const level = +tagName[1] |
754 | const terms = getSearchTerms(searchQuery) |
| 589 | if (level >= 1 && level <= 6) { |
755 | scanSectionForTerms( |
| 590 | const terms = getSearchTerms(searchQuery) |
756 | activeTarget, |
| 591 | const detailsContainsTerms = (d: HTMLElement) => { |
757 | terms, |
| 592 | if (!terms.length) return false |
758 | (d) => { |
| 593 | const text = (d.textContent ?? '').toLowerCase() |
759 | ;(d as HTMLDetailsElement).open = true |
| 594 | return terms.every((term) => text.includes(term)) |
760 | if (scrollTarget === activeTarget) scrollTarget = d |
| 595 | } |
761 | }, |
| 596 | |
762 | (t) => { |
| 597 | let sibling = activeTarget.nextElementSibling |
763 | expandTableMoreEl(t) |
| 598 | |
764 | if (scrollTarget === activeTarget) scrollTarget = t |
| 599 | while (sibling) { |
| |
| 600 | const siblingTag = sibling.tagName |
| |
| 601 | if ( |
| |
| 602 | siblingTag.length === 2 && siblingTag[0] === 'H' && |
| |
| 603 | +siblingTag[1] <= level |
| |
| 604 | ) break |
| |
| 605 | |
| |
| 606 | if (siblingTag === 'DETAILS') { |
| |
| 607 | if (detailsContainsTerms(sibling as HTMLElement)) { |
| |
| 608 | ;(sibling as HTMLDetailsElement).open = true |
| |
| 609 | if (scrollTarget === activeTarget) { |
| |
| 610 | scrollTarget = sibling as HTMLElement |
| |
| 611 | } |
| |
| 612 | } |
| |
| 613 | } |
| |
| 614 | |
| |
| 615 | const nested = sibling.getElementsByTagName('details') |
| |
| 616 | for (let i = 0, len = nested.length; i < len; i++) { |
| |
| 617 | if (detailsContainsTerms(nested[i])) { |
| |
| 618 | nested[i].open = true |
| |
| 619 | if (scrollTarget === activeTarget) scrollTarget = nested[i] |
| |
| 620 | } |
| |
| 621 | } |
| |
| 622 | |
| |
| 623 | sibling = sibling.nextElementSibling |
| |
| 624 | } |
765 | } |
| 625 | } |
766 | ) |
| 626 | } |
767 | } |
| 627 | |
768 | |
| 628 | await nextTick() |
769 | await nextTick() |
| @@ -649,6 +790,10 @@ const tryOpenAnchoredContent = async () => { |
| 649 | const openedCollapsible = requestedCollapsibles.length |
790 | const openedCollapsible = requestedCollapsibles.length |
| 650 | ? await selectCollapsiblesByPath(requestedCollapsibles) |
791 | ? await selectCollapsiblesByPath(requestedCollapsibles) |
| 651 | : undefined |
792 | : undefined |
| |
793 | const requestedTables = getRequestedTableMorePath() |
| |
794 | const openedTable = requestedTables.length |
| |
795 | ? await selectTablesByPath(requestedTables) |
| |
796 | : undefined |
| 652 | const hash = window.location.hash.slice(1) |
797 | const hash = window.location.hash.slice(1) |
| 653 | |
798 | |
| 654 | if (!hash) { |
799 | if (!hash) { |
| @@ -662,6 +807,8 @@ const tryOpenAnchoredContent = async () => { |
| 662 | scrollToElement(openedCollapsible, false) |
807 | scrollToElement(openedCollapsible, false) |
| 663 | } else if (selectedTabs) { |
808 | } else if (selectedTabs) { |
| 664 | scrollToElement(getSelectedTabScrollTarget(selectedTabs), false) |
809 | scrollToElement(getSelectedTabScrollTarget(selectedTabs), false) |
| |
810 | } else if (openedTable) { |
| |
811 | scrollToElement(openedTable, false) |
| 665 | } |
812 | } |
| 666 | return |
813 | return |
| 667 | } |
814 | } |
| @@ -686,14 +833,16 @@ const tryOpenAnchoredContent = async () => { |
| 686 | await openCollapsibles(target) |
833 | await openCollapsibles(target) |
| 687 | highlightSearchResult(target) |
834 | highlightSearchResult(target) |
| 688 | const collapsiblePath = getOpenCollapsiblePath(target) |
835 | const collapsiblePath = getOpenCollapsiblePath(target) |
| 689 | if (collapsiblePath.length) { |
836 | const tablePath = getOpenTableMorePath() |
| |
837 | if (collapsiblePath.length || tablePath.length) { |
| 690 | const tabPath = getEnclosingTabPath(target) |
838 | const tabPath = getEnclosingTabPath(target) |
| 691 | window.history.replaceState( |
839 | window.history.replaceState( |
| 692 | null, |
840 | null, |
| 693 | '', |
841 | '', |
| 694 | buildUrl({ |
842 | buildUrl({ |
| 695 | tabs: tabPath.length ? tabPath : undefined, |
843 | tabs: tabPath.length ? tabPath : undefined, |
| 696 | collapsibles: collapsiblePath |
844 | collapsibles: collapsiblePath, |
| |
845 | tables: tablePath |
| 697 | }) |
846 | }) |
| 698 | ) |
847 | ) |
| 699 | rewriteAnchorLinks() |
848 | rewriteAnchorLinks() |
| @@ -833,7 +982,8 @@ const setupOutlineFollow = () => { |
| 833 | followActiveOutlineLink() |
982 | followActiveOutlineLink() |
| 834 | } |
983 | } |
| 835 | |
984 | |
| 836 | const BOOKMARK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/></svg>` |
985 | const BOOKMARK_SVG = |
| |
986 | `<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z"/></svg>` |
| 837 | |
987 | |
| 838 | function syncTocBookmarkStates() { |
988 | function syncTocBookmarkStates() { |
| 839 | const path = route.path |
989 | const path = route.path |
| @@ -877,14 +1027,20 @@ let tocRaf = 0 |
| 877 | |
1027 | |
| 878 | function scanTocItems(path: string) { |
1028 | function scanTocItems(path: string) { |
| 879 | // Desktop sidebar — VPDocOutlineItem is called with :root="true" |
1029 | // Desktop sidebar — VPDocOutlineItem is called with :root="true" |
| 880 | document.querySelectorAll<HTMLElement>('.VPDocOutlineItem.root > li').forEach(li => addBookmarkBtnToLi(li, path)) |
1030 | document.querySelectorAll<HTMLElement>('.VPDocOutlineItem.root > li').forEach( |
| |
1031 | li => addBookmarkBtnToLi(li, path) |
| |
1032 | ) |
| 881 | // Mobile dropdown — VPDocOutlineItem is called without root prop, so the ul gets class "nested" |
1033 | // Mobile dropdown — VPDocOutlineItem is called without root prop, so the ul gets class "nested" |
| 882 | document.querySelectorAll<HTMLElement>('.VPLocalNavOutlineDropdown .outline > .VPDocOutlineItem > li').forEach(li => addBookmarkBtnToLi(li, path)) |
1034 | document.querySelectorAll<HTMLElement>( |
| |
1035 | '.VPLocalNavOutlineDropdown .outline > .VPDocOutlineItem > li' |
| |
1036 | ).forEach(li => addBookmarkBtnToLi(li, path)) |
| 883 | } |
1037 | } |
| 884 | |
1038 | |
| 885 | function setupTocBookmarks() { |
1039 | function setupTocBookmarks() { |
| 886 | const path = route.path |
1040 | const path = route.path |
| 887 | document.querySelectorAll<HTMLElement>('.toc-bookmark-btn').forEach(btn => btn.remove()) |
1041 | document.querySelectorAll<HTMLElement>('.toc-bookmark-btn').forEach(btn => |
| |
1042 | btn.remove() |
| |
1043 | ) |
| 888 | scanTocItems(path) |
1044 | scanTocItems(path) |
| 889 | |
1045 | |
| 890 | // Mobile dropdown items are v-if rendered on open — watch for them being added |
1046 | // Mobile dropdown items are v-if rendered on open — watch for them being added |
| @@ -903,7 +1059,9 @@ onMounted(tryOpenAnchoredContent) |
| 903 | onMounted(rewriteAnchorLinksDeferred) |
1059 | onMounted(rewriteAnchorLinksDeferred) |
| 904 | onMounted(() => nextTick(setupOutlineFollow)) |
1060 | onMounted(() => nextTick(setupOutlineFollow)) |
| 905 | onMounted(() => nextTick(setupTocBookmarks)) |
1061 | onMounted(() => nextTick(setupTocBookmarks)) |
| 906 | onMounted(() => window.addEventListener('scroll', onMobileOutlineScroll, { passive: true })) |
1062 | onMounted(() => |
| |
1063 | window.addEventListener('scroll', onMobileOutlineScroll, { passive: true }) |
| |
1064 | ) |
| 907 | onUnmounted(() => window.removeEventListener('scroll', onMobileOutlineScroll)) |
1065 | onUnmounted(() => window.removeEventListener('scroll', onMobileOutlineScroll)) |
| 908 | watch(() => route.data, () => { |
1066 | watch(() => route.data, () => { |
| 909 | void tryOpenAnchoredContent() |
1067 | void tryOpenAnchoredContent() |
| @@ -987,7 +1145,10 @@ watch(faviconsEnabled, (enabled) => { |
| 987 | |
1145 | |
| 988 | watch( |
1146 | watch( |
| 989 | () => route.path, |
1147 | () => route.path, |
| 990 | () => nextTick(() => { if (faviconsEnabled.value) applyFavicons(document) }), |
1148 | () => |
| |
1149 | nextTick(() => { |
| |
1150 | if (faviconsEnabled.value) applyFavicons(document) |
| |
1151 | }), |
| 991 | { flush: 'post' } |
1152 | { flush: 'post' } |
| 992 | ) |
1153 | ) |
| 993 | |
1154 | |
| @@ -1000,56 +1161,56 @@ const accentPalettes: Record<string, PaletteEntry> = { |
| 1000 | 500: 'oklch(0.626 0.098 247.46)', |
1161 | 500: 'oklch(0.626 0.098 247.46)', |
| 1001 | 600: 'oklch(0.523 0.081 246.86)', |
1162 | 600: 'oklch(0.523 0.081 246.86)', |
| 1002 | 700: 'oklch(0.43 0.066 246.75)', |
1163 | 700: 'oklch(0.43 0.066 246.75)', |
| 1003 | 800: 'oklch(0.335 0.052 246.76)', |
1164 | 800: 'oklch(0.335 0.052 246.76)' |
| 1004 | }, |
1165 | }, |
| 1005 | asuka: { |
1166 | asuka: { |
| 1006 | 400: 'oklch(0.740 0.210 32)', |
1167 | 400: 'oklch(0.740 0.210 32)', |
| 1007 | 500: 'oklch(0.650 0.240 30)', |
1168 | 500: 'oklch(0.650 0.240 30)', |
| 1008 | 600: 'oklch(0.555 0.238 28)', |
1169 | 600: 'oklch(0.555 0.238 28)', |
| 1009 | 700: 'oklch(0.455 0.205 26)', |
1170 | 700: 'oklch(0.455 0.205 26)', |
| 1010 | 800: 'oklch(0.370 0.165 24)', |
1171 | 800: 'oklch(0.370 0.165 24)' |
| 1011 | }, |
1172 | }, |
| 1012 | irys: { |
1173 | irys: { |
| 1013 | 400: 'oklch(0.716 0.188 5.18)', |
1174 | 400: 'oklch(0.716 0.188 5.18)', |
| 1014 | 500: 'oklch(0.659 0.237 8.99)', |
1175 | 500: 'oklch(0.659 0.237 8.99)', |
| 1015 | 600: 'oklch(0.584 0.229 10.32)', |
1176 | 600: 'oklch(0.584 0.229 10.32)', |
| 1016 | 700: 'oklch(0.538 0.213 9.67)', |
1177 | 700: 'oklch(0.538 0.213 9.67)', |
| 1017 | 800: 'oklch(0.475 0.187 5.94)', |
1178 | 800: 'oklch(0.475 0.187 5.94)' |
| 1018 | }, |
1179 | }, |
| 1019 | inanis: { |
1180 | inanis: { |
| 1020 | 400: 'oklch(0.762 0.073 302.02)', |
1181 | 400: 'oklch(0.762 0.073 302.02)', |
| 1021 | 500: 'oklch(0.663 0.102 301.22)', |
1182 | 500: 'oklch(0.663 0.102 301.22)', |
| 1022 | 600: 'oklch(0.580 0.119 301.34)', |
1183 | 600: 'oklch(0.580 0.119 301.34)', |
| 1023 | 700: 'oklch(0.508 0.114 301.00)', |
1184 | 700: 'oklch(0.508 0.114 301.00)', |
| 1024 | 800: 'oklch(0.452 0.094 302.20)', |
1185 | 800: 'oklch(0.452 0.094 302.20)' |
| 1025 | }, |
1186 | }, |
| 1026 | baelz: { |
1187 | baelz: { |
| 1027 | 400: 'oklch(0.720 0.215 22.00)', |
1188 | 400: 'oklch(0.720 0.215 22.00)', |
| 1028 | 500: 'oklch(0.640 0.255 22.00)', |
1189 | 500: 'oklch(0.640 0.255 22.00)', |
| 1029 | 600: 'oklch(0.555 0.268 22.00)', |
1190 | 600: 'oklch(0.555 0.268 22.00)', |
| 1030 | 700: 'oklch(0.472 0.248 22.00)', |
1191 | 700: 'oklch(0.472 0.248 22.00)', |
| 1031 | 800: 'oklch(0.395 0.208 22.00)', |
1192 | 800: 'oklch(0.395 0.208 22.00)' |
| 1032 | }, |
1193 | }, |
| 1033 | amelia: { |
1194 | amelia: { |
| 1034 | 400: 'oklch(0.800 0.085 75.49)', |
1195 | 400: 'oklch(0.800 0.085 75.49)', |
| 1035 | 500: 'oklch(0.710 0.090 72.47)', |
1196 | 500: 'oklch(0.710 0.090 72.47)', |
| 1036 | 600: 'oklch(0.594 0.085 69.07)', |
1197 | 600: 'oklch(0.594 0.085 69.07)', |
| 1037 | 700: 'oklch(0.496 0.078 72.12)', |
1198 | 700: 'oklch(0.496 0.078 72.12)', |
| 1038 | 800: 'oklch(0.391 0.062 68.86)', |
1199 | 800: 'oklch(0.391 0.062 68.86)' |
| 1039 | }, |
1200 | }, |
| 1040 | suisei: { |
1201 | suisei: { |
| 1041 | 400: 'oklch(0.827 0.096 224.60)', |
1202 | 400: 'oklch(0.827 0.096 224.60)', |
| 1042 | 500: 'oklch(0.740 0.119 230.91)', |
1203 | 500: 'oklch(0.740 0.119 230.91)', |
| 1043 | 600: 'oklch(0.645 0.127 236.29)', |
1204 | 600: 'oklch(0.645 0.127 236.29)', |
| 1044 | 700: 'oklch(0.548 0.120 241.26)', |
1205 | 700: 'oklch(0.548 0.120 241.26)', |
| 1045 | 800: 'oklch(0.451 0.106 244.63)', |
1206 | 800: 'oklch(0.451 0.106 244.63)' |
| 1046 | }, |
1207 | }, |
| 1047 | miku: { |
1208 | miku: { |
| 1048 | 400: 'oklch(0.788 0.133 184.43)', |
1209 | 400: 'oklch(0.788 0.133 184.43)', |
| 1049 | 500: 'oklch(0.711 0.123 185.28)', |
1210 | 500: 'oklch(0.711 0.123 185.28)', |
| 1050 | 600: 'oklch(0.607 0.104 187.31)', |
1211 | 600: 'oklch(0.607 0.104 187.31)', |
| 1051 | 700: 'oklch(0.515 0.086 189.60)', |
1212 | 700: 'oklch(0.515 0.086 189.60)', |
| 1052 | 800: 'oklch(0.441 0.071 190.95)', |
1213 | 800: 'oklch(0.441 0.071 190.95)' |
| 1053 | }, |
1214 | }, |
| 1054 | fubuki: { |
1215 | fubuki: { |
| 1055 | dark: { |
1216 | dark: { |
| @@ -1057,16 +1218,16 @@ const accentPalettes: Record<string, PaletteEntry> = { |
| 1057 | 500: 'oklch(0.78 0 0)', |
1218 | 500: 'oklch(0.78 0 0)', |
| 1058 | 600: 'oklch(0.68 0 0)', |
1219 | 600: 'oklch(0.68 0 0)', |
| 1059 | 700: 'oklch(0.58 0 0)', |
1220 | 700: 'oklch(0.58 0 0)', |
| 1060 | 800: 'oklch(0.48 0 0)', |
1221 | 800: 'oklch(0.48 0 0)' |
| 1061 | }, |
1222 | }, |
| 1062 | light: { |
1223 | light: { |
| 1063 | 400: 'oklch(0.52 0 0)', |
1224 | 400: 'oklch(0.52 0 0)', |
| 1064 | 500: 'oklch(0.42 0 0)', |
1225 | 500: 'oklch(0.42 0 0)', |
| 1065 | 600: 'oklch(0.32 0 0)', |
1226 | 600: 'oklch(0.32 0 0)', |
| 1066 | 700: 'oklch(0.22 0 0)', |
1227 | 700: 'oklch(0.22 0 0)', |
| 1067 | 800: 'oklch(0.12 0 0)', |
1228 | 800: 'oklch(0.12 0 0)' |
| 1068 | }, |
1229 | } |
| 1069 | }, |
1230 | } |
| 1070 | } |
1231 | } |
| 1071 | |
1232 | |
| 1072 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') |
1233 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') |
| @@ -1091,7 +1252,7 @@ const accentBgTokens: Record<'dark' | 'light', Record<string, TintEntry>> = { |
| 1091 | '--wk-c-menu-bg': [0.295, 0.032], |
1252 | '--wk-c-menu-bg': [0.295, 0.032], |
| 1092 | '--wk-c-nav-solid-bg': [0.2, 0.024], |
1253 | '--wk-c-nav-solid-bg': [0.2, 0.024], |
| 1093 | '--nav-pill-bg': [0.205, 0.024, 0.7], |
1254 | '--nav-pill-bg': [0.205, 0.024, 0.7], |
| 1094 | '--wk-fs-header-divider': [0.44, 0.02, 0.65], |
1255 | '--wk-fs-header-divider': [0.44, 0.02, 0.65] |
| 1095 | }, |
1256 | }, |
| 1096 | light: { |
1257 | light: { |
| 1097 | '--vp-c-bg': [0.986, 0.012], |
1258 | '--vp-c-bg': [0.986, 0.012], |
| @@ -1107,13 +1268,15 @@ const accentBgTokens: Record<'dark' | 'light', Record<string, TintEntry>> = { |
| 1107 | '--wk-c-menu-bg': [0.928, 0.026], |
1268 | '--wk-c-menu-bg': [0.928, 0.026], |
| 1108 | '--wk-c-nav-solid-bg': [0.986, 0.012], |
1269 | '--wk-c-nav-solid-bg': [0.986, 0.012], |
| 1109 | '--nav-pill-bg': [0.99, 0.01, 0.8], |
1270 | '--nav-pill-bg': [0.99, 0.01, 0.8], |
| 1110 | '--wk-fs-header-divider': [0.715, 0.02, 0.25], |
1271 | '--wk-fs-header-divider': [0.715, 0.02, 0.25] |
| 1111 | }, |
1272 | } |
| 1112 | } |
1273 | } |
| 1113 | const accentBgTokenKeys = [...new Set([ |
1274 | const accentBgTokenKeys = [ |
| 1114 | ...Object.keys(accentBgTokens.dark), |
1275 | ...new Set([ |
| 1115 | ...Object.keys(accentBgTokens.light), |
1276 | ...Object.keys(accentBgTokens.dark), |
| 1116 | ])] |
1277 | ...Object.keys(accentBgTokens.light) |
| |
1278 | ]) |
| |
1279 | ] |
| 1117 | |
1280 | |
| 1118 | const applyAccentTheme = () => { |
1281 | const applyAccentTheme = () => { |
| 1119 | if (import.meta.env.SSR) return |
1282 | if (import.meta.env.SSR) return |
| @@ -1126,14 +1289,26 @@ const applyAccentTheme = () => { |
| 1126 | el.style.setProperty('--vp-c-brand-1', shades['400']) |
1289 | el.style.setProperty('--vp-c-brand-1', shades['400']) |
| 1127 | el.style.setProperty('--vp-c-brand-2', shades['500']) |
1290 | el.style.setProperty('--vp-c-brand-2', shades['500']) |
| 1128 | el.style.setProperty('--vp-c-brand-3', shades['700']) |
1291 | el.style.setProperty('--vp-c-brand-3', shades['700']) |
| 1129 | el.style.setProperty('--vp-c-brand-soft', `color-mix(in srgb, ${shades['500']} 20%, transparent)`) |
1292 | el.style.setProperty( |
| 1130 | el.style.setProperty('--vp-c-sidebar-active', `color-mix(in srgb, ${shades['500']} 15%, transparent)`) |
1293 | '--vp-c-brand-soft', |
| |
1294 | `color-mix(in srgb, ${shades['500']} 20%, transparent)` |
| |
1295 | ) |
| |
1296 | el.style.setProperty( |
| |
1297 | '--vp-c-sidebar-active', |
| |
1298 | `color-mix(in srgb, ${shades['500']} 15%, transparent)` |
| |
1299 | ) |
| 1131 | } else { |
1300 | } else { |
| 1132 | el.style.setProperty('--vp-c-brand-1', shades['500']) |
1301 | el.style.setProperty('--vp-c-brand-1', shades['500']) |
| 1133 | el.style.setProperty('--vp-c-brand-2', shades['600']) |
1302 | el.style.setProperty('--vp-c-brand-2', shades['600']) |
| 1134 | el.style.setProperty('--vp-c-brand-3', shades['800']) |
1303 | el.style.setProperty('--vp-c-brand-3', shades['800']) |
| 1135 | el.style.setProperty('--vp-c-brand-soft', `color-mix(in srgb, ${shades['400']} 40%, transparent)`) |
1304 | el.style.setProperty( |
| 1136 | el.style.setProperty('--vp-c-sidebar-active', `color-mix(in srgb, ${shades['800']} 15%, transparent)`) |
1305 | '--vp-c-brand-soft', |
| |
1306 | `color-mix(in srgb, ${shades['400']} 40%, transparent)` |
| |
1307 | ) |
| |
1308 | el.style.setProperty( |
| |
1309 | '--vp-c-sidebar-active', |
| |
1310 | `color-mix(in srgb, ${shades['800']} 15%, transparent)` |
| |
1311 | ) |
| 1137 | } |
1312 | } |
| 1138 | |
1313 | |
| 1139 | for (const key of accentBgTokenKeys) el.style.removeProperty(key) |
1314 | for (const key of accentBgTokenKeys) el.style.removeProperty(key) |
| @@ -1145,7 +1320,8 @@ const applyAccentTheme = () => { |
| 1145 | if (parsed) { |
1320 | if (parsed) { |
| 1146 | // Tint scales with the accent's own chroma (full tint at C >= 0.10, |
1321 | // Tint scales with the accent's own chroma (full tint at C >= 0.10, |
| 1147 | // grayscale accents stay gray), then with the intensity preset. |
1322 | // grayscale accents stay gray), then with the intensity preset. |
| 1148 | const strength = Math.min(1, Number(parsed[1]) / 0.10) * userStrength * 1.5 |
1323 | const strength = Math.min(1, Number(parsed[1]) / 0.10) * userStrength * |
| |
1324 | 1.5 |
| 1149 | const hue = parsed[2] |
1325 | const hue = parsed[2] |
| 1150 | const tokens = accentBgTokens[isDark.value ? 'dark' : 'light'] |
1326 | const tokens = accentBgTokens[isDark.value ? 'dark' : 'light'] |
| 1151 | for (const [key, [l, c, alpha]] of Object.entries(tokens)) { |
1327 | for (const [key, [l, c, alpha]] of Object.entries(tokens)) { |
| @@ -1177,15 +1353,25 @@ function initTitleOnly() { |
| 1177 | }) |
1353 | }) |
| 1178 | } |
1354 | } |
| 1179 | |
1355 | |
| |
1356 | // Browsers restore checkbox state on reload; always start collapsed. |
| |
1357 | function resetTableMoreInRoot(root: ParentNode) { |
| |
1358 | root.querySelectorAll<HTMLInputElement>('.table-more-checkbox:checked') |
| |
1359 | .forEach((el) => { |
| |
1360 | el.checked = false |
| |
1361 | }) |
| |
1362 | } |
| |
1363 | |
| 1180 | // Wrap bare tables in their own scroll container so they scroll independently of sibling content. |
1364 | // Wrap bare tables in their own scroll container so they scroll independently of sibling content. |
| 1181 | function wrapTablesInRoot(root: ParentNode) { |
1365 | function wrapTablesInRoot(root: ParentNode) { |
| 1182 | root.querySelectorAll<HTMLTableElement>('table:not(.scrape-table)').forEach(table => { |
1366 | root.querySelectorAll<HTMLTableElement>('table:not(.scrape-table)').forEach( |
| 1183 | if (table.parentElement?.classList.contains('table-scroll')) return |
1367 | table => { |
| 1184 | const wrapper = document.createElement('div') |
1368 | if (table.parentElement?.classList.contains('table-scroll')) return |
| 1185 | wrapper.className = 'table-scroll' |
1369 | const wrapper = document.createElement('div') |
| 1186 | table.replaceWith(wrapper) |
1370 | wrapper.className = 'table-scroll' |
| 1187 | wrapper.appendChild(table) |
1371 | table.replaceWith(wrapper) |
| 1188 | }) |
1372 | wrapper.appendChild(table) |
| |
1373 | } |
| |
1374 | ) |
| 1189 | } |
1375 | } |
| 1190 | |
1376 | |
| 1191 | function initCopyButtonsInRoot(root: ParentNode) { |
1377 | function initCopyButtonsInRoot(root: ParentNode) { |
| @@ -1269,6 +1455,7 @@ let copyButtonObserver: MutationObserver | null = null |
| 1269 | |
1455 | |
| 1270 | function setupManualCopyButtons() { |
1456 | function setupManualCopyButtons() { |
| 1271 | wrapTablesInRoot(document) |
1457 | wrapTablesInRoot(document) |
| |
1458 | resetTableMoreInRoot(document) |
| 1272 | initCopyButtonsInRoot(document) |
1459 | initCopyButtonsInRoot(document) |
| 1273 | |
1460 | |
| 1274 | copyButtonObserver?.disconnect() |
1461 | copyButtonObserver?.disconnect() |
| @@ -1278,6 +1465,7 @@ function setupManualCopyButtons() { |
| 1278 | if (!(node instanceof HTMLElement)) continue |
1465 | if (!(node instanceof HTMLElement)) continue |
| 1279 | if (node.classList.contains('plugin-tabs--content')) { |
1466 | if (node.classList.contains('plugin-tabs--content')) { |
| 1280 | wrapTablesInRoot(node) |
1467 | wrapTablesInRoot(node) |
| |
1468 | resetTableMoreInRoot(node) |
| 1281 | initCopyButtonsInRoot(node) |
1469 | initCopyButtonsInRoot(node) |
| 1282 | if (faviconsEnabled.value) applyFavicons(node) |
1470 | if (faviconsEnabled.value) applyFavicons(node) |
| 1283 | reapplyHighlightIfNeeded(node) |
1471 | reapplyHighlightIfNeeded(node) |
| @@ -1285,6 +1473,7 @@ function setupManualCopyButtons() { |
| 1285 | node.querySelectorAll<HTMLElement>('.plugin-tabs--content').forEach( |
1473 | node.querySelectorAll<HTMLElement>('.plugin-tabs--content').forEach( |
| 1286 | (panel) => { |
1474 | (panel) => { |
| 1287 | wrapTablesInRoot(panel) |
1475 | wrapTablesInRoot(panel) |
| |
1476 | resetTableMoreInRoot(panel) |
| 1288 | initCopyButtonsInRoot(panel) |
1477 | initCopyButtonsInRoot(panel) |
| 1289 | if (faviconsEnabled.value) applyFavicons(panel) |
1478 | if (faviconsEnabled.value) applyFavicons(panel) |
| 1290 | reapplyHighlightIfNeeded(panel) |
1479 | reapplyHighlightIfNeeded(panel) |
| @@ -1302,7 +1491,10 @@ watch( |
| 1302 | () => { |
1491 | () => { |
| 1303 | highlightTerm = '' |
1492 | highlightTerm = '' |
| 1304 | highlightTabPath = null |
1493 | highlightTabPath = null |
| 1305 | nextTick(() => { initTitleOnly(); setupManualCopyButtons() }) |
1494 | nextTick(() => { |
| |
1495 | initTitleOnly() |
| |
1496 | setupManualCopyButtons() |
| |
1497 | }) |
| 1306 | }, |
1498 | }, |
| 1307 | { flush: 'post' } |
1499 | { flush: 'post' } |
| 1308 | ) |
1500 | ) |
| @@ -1315,6 +1507,11 @@ onMounted(() => { |
| 1315 | initTitleOnly() |
1507 | initTitleOnly() |
| 1316 | nextTick(setupManualCopyButtons) |
1508 | nextTick(setupManualCopyButtons) |
| 1317 | |
1509 | |
| |
1510 | // bfcache can restore the <more> table checkboxes as checked. |
| |
1511 | window.addEventListener('pageshow', (e) => { |
| |
1512 | if (e.persisted) resetTableMoreInRoot(document) |
| |
1513 | }) |
| |
1514 | |
| 1318 | // Icon tooltip: fixed-position popup appended to <body> to escape table overflow clipping |
1515 | // Icon tooltip: fixed-position popup appended to <body> to escape table overflow clipping |
| 1319 | const tooltipEl = document.createElement('div') |
1516 | const tooltipEl = document.createElement('div') |
| 1320 | tooltipEl.className = 'icon-tip-popup' |
1517 | tooltipEl.className = 'icon-tip-popup' |
| @@ -1421,6 +1618,11 @@ onMounted(() => { |
| 1421 | queueCollapsibleQueryUpdate(e.target) |
1618 | queueCollapsibleQueryUpdate(e.target) |
| 1422 | }) |
1619 | }) |
| 1423 | |
1620 | |
| |
1621 | useEventListener(document, 'change', (e: Event) => { |
| |
1622 | if (!e.isTrusted) return |
| |
1623 | queueTableMoreQueryUpdate(e.target) |
| |
1624 | }) |
| |
1625 | |
| 1424 | useEventListener(document, 'keydown', (e: KeyboardEvent) => { |
1626 | useEventListener(document, 'keydown', (e: KeyboardEvent) => { |
| 1425 | if (!e.isTrusted || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) { |
1627 | if (!e.isTrusted || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) { |
| 1426 | return |
1628 | return |
| @@ -1627,4 +1829,4 @@ onUnmounted(() => { |
| 1627 | </span> |
1829 | </span> |
| 1628 | </template> |
1830 | </template> |
| 1629 | </Layout> |
1831 | </Layout> |
| 1630 | </template>\ No newline at end of file |
1832 | </template> |