docs/.vitepress/theme/Layout.vue

d988ee066bb4fe0f5911b5c423254f9eaaab5419
wotaku/docs/.vitepress/theme/Layout.vue

802 lines · 22255 bytes

  1<!--
  2  All Rights Reserved
  3
  4  Copyright (c) 2025 taskylizard
  5
  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-->
  8<script setup lang="ts">
  9import {
 10  customStorageEventName,
 11  useEventListener,
 12  useStorage
 13} from '@vueuse/core'
 14import { usePreferredReducedMotion } from '@vueuse/core'
 15import { useData, useRoute } from 'vitepress'
 16import type { DefaultTheme as Theme } from 'vitepress'
 17import VPSidebarGroup from 'vitepress/dist/client/theme-default/components/VPSidebarGroup.vue'
 18import { getSidebarGroups } from 'vitepress/dist/client/theme-default/support/sidebar'
 19import DefaultTheme from 'vitepress/theme'
 20import {
 21  computed,
 22  nextTick,
 23  onMounted,
 24  onUnmounted,
 25  ref,
 26  watch,
 27  watchEffect
 28} from 'vue'
 29import { sidebar } from '../configs/constants'
 30import AnnouncementPill from './components/AnnouncementPill.vue'
 31import NotFoundComponent from './components/NotFound.vue'
 32import {
 33  NolebaseEnhancedReadabilitiesMenu,
 34  NolebaseEnhancedReadabilitiesScreenMenu
 35} from './components/settings'
 36import SidebarCard from './components/SidebarCard.vue'
 37import { LowEndDeviceModeStorageKey, TakodachiStorageKey } from './constants'
 38import { v2add, v2mag, v2norm, v2smul, v2sub, type Vec2D } from './math'
 39
 40const route = useRoute()
 41const { frontmatter, site, theme } = useData()
 42const { Layout } = DefaultTheme
 43
 44// Home sidebar menu
 45const isHome = computed(() => frontmatter.value.layout === 'home')
 46const homeSidebarOpen = ref(false)
 47const sidebarRef = ref<HTMLElement | null>(null)
 48const homeSidebarGroups = getSidebarGroups(sidebar as any)
 49const logoSrc = computed(() =>
 50  typeof theme.value.logo === 'string'
 51    ? theme.value.logo
 52    : theme.value.logo?.src
 53)
 54
 55watch(() => route.path, () => {
 56  homeSidebarOpen.value = false
 57})
 58
 59let searchNavigated = false
 60let searchQuery = ''
 61
 62if (!import.meta.env.SSR) {
 63  useEventListener(window, 'search-nav', (event) => {
 64    searchNavigated = true
 65    searchQuery = event instanceof CustomEvent &&
 66        typeof event.detail?.query === 'string'
 67      ? event.detail.query
 68      : ''
 69  })
 70}
 71
 72const nextFrame = () =>
 73  new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
 74
 75const getSearchTerms = (query: string) =>
 76  query
 77    .toLowerCase()
 78    .split(/\s+/)
 79    .map((term) => term.trim())
 80    .filter(Boolean)
 81
 82const getTargetByHash = (hash: string) => {
 83  const ids = [hash]
 84  try {
 85    const decoded = decodeURIComponent(hash)
 86    if (decoded !== hash) ids.unshift(decoded)
 87  } catch {
 88    /* keep the raw hash */
 89  }
 90
 91  for (const id of ids) {
 92    const target = document.getElementById(id)
 93    if (target) return target
 94  }
 95}
 96
 97const getScrollTargetForAnchor = (target: HTMLElement) => {
 98  if (target.classList.contains('tab-search-heading')) {
 99    return target.closest<HTMLElement>('.plugin-tabs') ?? target
100  }
101
102  return target
103}
104
105const TAB_QUERY_PARAM = 'tabs'
106
107const getRequestedTabPath = () => {
108  const value = new URLSearchParams(window.location.search).get(
109    TAB_QUERY_PARAM
110  )
111  return value
112    ?.split(',')
113    .map((tab) => tab.trim())
114    .filter(Boolean) ?? []
115}
116
117const buildUrlWithTabs = (tabs: string[], hash = '') => {
118  const params = new URLSearchParams(window.location.search)
119  params.delete(TAB_QUERY_PARAM)
120
121  const queryParts = [
122    params.toString(),
123    tabs.length
124      ? `${TAB_QUERY_PARAM}=${
125        tabs.map((tab) => encodeURIComponent(tab)).join(',')
126      }`
127      : ''
128  ].filter(Boolean)
129
130  return `${window.location.pathname}${
131    queryParts.length ? `?${queryParts.join('&')}` : ''
132  }${hash ? `#${encodeURIComponent(hash)}` : ''}`
133}
134
135const getSelectedTabAnchor = (tabs: HTMLElement) =>
136  tabs.querySelector<HTMLButtonElement>(
137    '.plugin-tabs--tab[aria-selected="true"][data-tab-anchor]'
138  )?.dataset.tabAnchor
139
140const getPanelForTabButton = (button: HTMLButtonElement) => {
141  const panelId = button.getAttribute('aria-controls')
142  return panelId ? document.getElementById(panelId) : undefined
143}
144
145const getTabPathForGroup = (tabs: HTMLElement) => {
146  const groups: HTMLElement[] = []
147  let currentTabs: HTMLElement | null = tabs
148
149  while (currentTabs) {
150    groups.unshift(currentTabs)
151    const parentPanel = currentTabs.parentElement?.closest<HTMLElement>(
152      '.plugin-tabs--content[data-tab-anchor]'
153    )
154    currentTabs = parentPanel?.closest<HTMLElement>('.plugin-tabs') ?? null
155  }
156
157  return groups
158    .map((group) => getSelectedTabAnchor(group))
159    .filter((tab): tab is string => Boolean(tab))
160}
161
162const updateQueryForSelectedTab = async (tabs: HTMLElement) => {
163  await nextTick()
164  await nextFrame()
165
166  const tabPath = getTabPathForGroup(tabs)
167  if (!tabPath.length) return
168
169  const nextUrl = buildUrlWithTabs(tabPath)
170  const currentUrl =
171    `${window.location.pathname}${window.location.search}${window.location.hash}`
172  if (nextUrl === currentUrl) return
173
174  window.history.pushState(null, '', nextUrl)
175}
176
177const queueTabQueryUpdateForSelection = (target: EventTarget | null) => {
178  if (!(target instanceof HTMLElement)) return
179
180  const button = target.closest<HTMLButtonElement>(
181    '.plugin-tabs--tab[role="tab"]'
182  )
183  const tabs = button?.closest<HTMLElement>('.plugin-tabs')
184  if (tabs) void updateQueryForSelectedTab(tabs)
185}
186
187const selectTabsByPath = async (tabPath: string[]) => {
188  let root: ParentNode = document
189  let selectedTabs: HTMLElement | undefined
190
191  for (const anchor of tabPath) {
192    const button = root.querySelector<HTMLButtonElement>(
193      `.plugin-tabs--tab[role="tab"][data-tab-anchor="${CSS.escape(anchor)}"]`
194    )
195    if (!button) return selectedTabs
196
197    const tabs = button.closest<HTMLElement>('.plugin-tabs')
198    if (!tabs) return selectedTabs
199
200    selectedTabs = tabs
201    if (button.getAttribute('aria-selected') !== 'true') {
202      button.click()
203      await nextTick()
204      await nextFrame()
205    }
206
207    root = getPanelForTabButton(button) ?? tabs
208  }
209
210  return selectedTabs
211}
212
213const selectLegacyTabHash = async (hash: string) => {
214  const button = document.querySelector<HTMLButtonElement>(
215    `.plugin-tabs--tab[role="tab"][data-tab-anchor="${CSS.escape(hash)}"]`
216  )
217  if (!button) return
218
219  if (button.getAttribute('aria-selected') !== 'true') {
220    button.click()
221    await nextTick()
222    await nextFrame()
223  }
224
225  const tabs = button.closest<HTMLElement>('.plugin-tabs')
226  if (tabs) {
227    window.history.replaceState(null, '', buildUrlWithTabs([hash]))
228  }
229  return tabs
230}
231
232const getSelectedTabScrollTarget = (tabs: HTMLElement) => {
233  const selectedTab = tabs.querySelector<HTMLButtonElement>(
234    '.plugin-tabs--tab[aria-selected="true"]'
235  )
236  return selectedTab ? getPanelForTabButton(selectedTab) ?? tabs : tabs
237}
238
239const scrollToElement = (target: HTMLElement, smooth = true) => {
240  requestAnimationFrame(() => {
241    requestAnimationFrame(() => {
242      const navBar = document.querySelector<HTMLElement>('.VPNavBar')
243      const navOffset = navBar ? navBar.offsetHeight : 0
244      window.scrollTo({
245        top: target.getBoundingClientRect().top + window.scrollY - navOffset,
246        behavior: smooth &&
247            !window.matchMedia('(prefers-reduced-motion: reduce)').matches
248          ? 'smooth'
249          : 'auto'
250      })
251      target.setAttribute('tabindex', '-1')
252      target.focus({ preventScroll: true })
253    })
254  })
255}
256
257const openCollapsibles = async (target: HTMLElement) => {
258  const activeTarget = target
259  let scrollTarget = getScrollTargetForAnchor(activeTarget)
260  let el: HTMLElement | null = activeTarget
261
262  while ((el = el.closest('details'))) {
263    el.open = true
264    scrollTarget = el
265    el = el.parentElement
266  }
267
268  const tagName = activeTarget.tagName
269  if (tagName.length === 2 && tagName[0] === 'H') {
270    const level = +tagName[1]
271    if (level >= 1 && level <= 6) {
272      const terms = getSearchTerms(searchQuery)
273      const detailsContainsTerms = (d: HTMLElement) => {
274        if (!terms.length) return false
275        const text = (d.textContent ?? '').toLowerCase()
276        return terms.every((term) => text.includes(term))
277      }
278
279      let sibling = activeTarget.nextElementSibling
280
281      while (sibling) {
282        const siblingTag = sibling.tagName
283        if (
284          siblingTag.length === 2 && siblingTag[0] === 'H' &&
285          +siblingTag[1] <= level
286        ) break
287
288        if (siblingTag === 'DETAILS') {
289          if (detailsContainsTerms(sibling as HTMLElement)) {
290            ;(sibling as HTMLDetailsElement).open = true
291            if (scrollTarget === activeTarget) {
292              scrollTarget = sibling as HTMLElement
293            }
294          }
295        }
296
297        const nested = sibling.getElementsByTagName('details')
298        for (let i = 0, len = nested.length; i < len; i++) {
299          if (detailsContainsTerms(nested[i])) {
300            nested[i].open = true
301            if (scrollTarget === activeTarget) scrollTarget = nested[i]
302          }
303        }
304
305        sibling = sibling.nextElementSibling
306      }
307    }
308  }
309
310  await nextTick()
311  await nextFrame()
312
313  scrollToElement(scrollTarget)
314}
315
316const resetSearchNavigation = () => {
317  searchNavigated = false
318  searchQuery = ''
319}
320
321const tryOpenAnchoredContent = async () => {
322  await nextTick()
323  await nextFrame()
324
325  const requestedTabs = getRequestedTabPath()
326  const selectedTabs = requestedTabs.length
327    ? await selectTabsByPath(requestedTabs)
328    : undefined
329  const hash = window.location.hash.slice(1)
330
331  if (!hash) {
332    resetSearchNavigation()
333    if (selectedTabs) {
334      scrollToElement(getSelectedTabScrollTarget(selectedTabs), false)
335    }
336    return
337  }
338
339  let target = getTargetByHash(hash)
340
341  if (!target && !requestedTabs.length) {
342    const legacyTabs = await selectLegacyTabHash(hash)
343    if (legacyTabs) {
344      resetSearchNavigation()
345      scrollToElement(getSelectedTabScrollTarget(legacyTabs), false)
346      return
347    }
348  }
349
350  if (!target) {
351    if (searchNavigated) resetSearchNavigation()
352    return
353  }
354
355  if (searchNavigated) {
356    await openCollapsibles(target)
357    resetSearchNavigation()
358    return
359  }
360
361  if (
362    !requestedTabs.length && target.classList.contains('tab-search-heading')
363  ) {
364    const tabs = target.closest<HTMLElement>('.plugin-tabs')
365    if (tabs) {
366      window.history.replaceState(
367        null,
368        '',
369        buildUrlWithTabs(getTabPathForGroup(tabs))
370      )
371    }
372  }
373
374  if (
375    selectedTabs ||
376    target.classList.contains('tab-search-heading')
377  ) {
378    scrollToElement(getScrollTargetForAnchor(target), false)
379  }
380}
381
382onMounted(tryOpenAnchoredContent)
383watch(() => route.data, tryOpenAnchoredContent, { flush: 'post' })
384watch(() => route.query, tryOpenAnchoredContent, { flush: 'post' })
385watch(() => route.hash, tryOpenAnchoredContent, { flush: 'post' })
386
387function onSidebarEnter() {
388  sidebarRef.value?.focus()
389}
390
391interface BreadcrumbItem {
392  text: string
393  link?: string
394}
395
396const buildBreadcrumbs = (
397  items: Theme.SidebarItem[],
398  currentPath: string
399): BreadcrumbItem[] => {
400  for (const item of items) {
401    // Check if this item matches the current path
402    if (item.link === currentPath) {
403      return [
404        {
405          text: item.text!.replace('mr-2 block w-4 h-4 bg-cover', '').trim(),
406          link: item.link
407        }
408      ]
409    }
410
411    // Check nested items
412    if (item.items) {
413      const nestedBreadcrumbs = buildBreadcrumbs(item.items, currentPath)
414      if (nestedBreadcrumbs.length > 0) {
415        return [
416          {
417            text: item.text!.replace('mr-2 block w-4 h-4 bg-cover', '').trim(),
418            link: item.link
419          },
420          ...nestedBreadcrumbs
421        ]
422      }
423    }
424  }
425  return []
426}
427
428const breadcrumbs = computed(() => {
429  const currentPath = route.path
430  // @ts-expect-error
431  return buildBreadcrumbs(sidebar, currentPath)
432})
433
434// Respect user's reduced motion preferences
435const prefs = usePreferredReducedMotion()
436const lowEndDeviceMode = useStorage(LowEndDeviceModeStorageKey, 'off')
437const reduceBlurEffects = computed(() => lowEndDeviceMode.value === 'on')
438
439watchEffect(() => {
440  if (import.meta.env.SSR) return
441
442  document.documentElement.classList.toggle(
443    'reduce-blur-effects',
444    reduceBlurEffects.value
445  )
446})
447
448const speed = 2
449const snapThreshold = 5 // px
450
451const takodachiRef = ref<HTMLImageElement | null>(null)
452let mousePos: Vec2D | null = null
453let target: Vec2D | null = null
454let offset: Vec2D = [0, 0]
455
456const position = ref({
457  x: 0,
458  y: 0
459})
460
461const updateMousePos = (e: MouseEvent | TouchEvent) => {
462  if (e instanceof MouseEvent) {
463    mousePos = [e.clientX, e.clientY]
464  } else {
465    mousePos = [e.touches[0].clientX, e.touches[0].clientY]
466  }
467}
468
469const takodachiDisable = ref<(() => void) | null>(null)
470const takodachiToggledOn = useStorage(TakodachiStorageKey, false)
471
472const reloadTakodachi = () => {
473  takodachiDisable.value?.()
474
475  if (prefs.value === 'reduce') return
476  const saved = takodachiToggledOn
477  if (saved.value === false) return
478
479  window.addEventListener('mousemove', updateMousePos)
480  window.addEventListener('touchstart', updateMousePos)
481
482  const chaser = takodachiRef!.value
483  if (chaser) {
484    offset = v2smul([chaser.clientWidth, chaser.clientHeight], 0.5)
485    setTimeout(() => {
486      chaser.classList.remove('opacity-0')
487    }, 1000)
488  }
489
490  const intervalId = setInterval(() => {
491    if (!mousePos) return
492
493    const currentPos: Vec2D = [
494      position.value.x + offset[0],
495      position.value.y + offset[1]
496    ]
497
498    target = target ?? currentPos
499
500    const diff = v2sub(mousePos, currentPos)
501
502    target = v2mag(diff) < snapThreshold
503      ? mousePos
504      : v2add(target, v2smul(v2norm(diff), speed))
505
506    const finalVec = v2sub(target, offset)
507
508    position.value = { x: finalVec[0], y: finalVec[1] }
509  }, 10)
510
511  takodachiDisable.value = () => {
512    chaser?.classList.add('opacity-0')
513
514    window.removeEventListener('mousemove', updateMousePos)
515    window.removeEventListener('touchstart', updateMousePos)
516    clearInterval(intervalId)
517
518    takodachiDisable.value = null
519  }
520}
521
522function initTitleOnly() {
523  document.querySelectorAll('.custom-block').forEach(block => {
524    const children = [...block.children]
525    const hasOnlyTitle = children.every(el =>
526      el.classList.contains('custom-block-title')
527    )
528    if (hasOnlyTitle) block.classList.add('title-only')
529  })
530}
531
532watch(
533  () => route.path,
534  () => nextTick(() => initTitleOnly()),
535  { flush: 'post' }
536)
537
538onMounted(() => {
539  if (import.meta.env.SSR) return
540
541  initTitleOnly()
542
543  // Icon tooltip: fixed-position popup appended to <body> to escape table overflow clipping
544  const tooltipEl = document.createElement('div')
545  tooltipEl.className = 'icon-tip-popup'
546  document.body.appendChild(tooltipEl)
547
548  const showTooltip = (e: MouseEvent) => {
549    const target = (e.target as HTMLElement).closest('.icon-tip') as
550      | HTMLElement
551      | null
552    if (!target) return
553    const tip = target.dataset.tip
554    if (!tip) return
555
556    tooltipEl.textContent = tip
557    tooltipEl.classList.add('visible')
558
559    const rect = target.getBoundingClientRect()
560    const tipWidth = tooltipEl.offsetWidth
561    const tipHeight = tooltipEl.offsetHeight
562    let left = rect.left + rect.width / 2 - tipWidth / 2
563    left = Math.max(8, Math.min(left, window.innerWidth - tipWidth - 8))
564    const top = rect.top - tipHeight - 6
565
566    tooltipEl.style.left = `${left}px`
567    tooltipEl.style.top = `${top}px`
568  }
569
570  const hideTooltip = () => {
571    tooltipEl.classList.remove('visible')
572  }
573
574  document.addEventListener('mouseover', showTooltip)
575  document.addEventListener('mouseout', hideTooltip)
576  document.addEventListener('scroll', hideTooltip, true)
577
578  useEventListener(document, 'click', (e: MouseEvent) => {
579    if (!e.isTrusted) return
580    queueTabQueryUpdateForSelection(e.target)
581  })
582
583  useEventListener(document, 'keydown', (e: KeyboardEvent) => {
584    if (!e.isTrusted || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) {
585      return
586    }
587
588    queueTabQueryUpdateForSelection(e.target)
589  })
590
591  onUnmounted(() => {
592    document.removeEventListener('mouseover', showTooltip)
593    document.removeEventListener('mouseout', hideTooltip)
594    document.removeEventListener('scroll', hideTooltip, true)
595    tooltipEl.remove()
596  })
597
598  // Arrow key scrolling + Escape close for sidebars and content
599  let activeScrollTarget: HTMLElement | Window = window
600
601  useEventListener(document, 'pointerdown', (e: PointerEvent) => {
602    const el = e.target as HTMLElement
603    if (homeSidebarOpen.value && sidebarRef.value?.contains(el)) {
604      activeScrollTarget = sidebarRef.value
605    } else if (el.closest('.VPSidebar')) {
606      activeScrollTarget = el.closest('.VPSidebar') as HTMLElement
607    } else {
608      activeScrollTarget = window
609    }
610  })
611
612  const pxPerFrame = 18
613  let scrollDirection = 0
614  let scrollRaf = 0
615
616  function tickScroll() {
617    if (!scrollDirection) return
618    activeScrollTarget.scrollBy({ top: scrollDirection * pxPerFrame })
619    scrollRaf = requestAnimationFrame(tickScroll)
620  }
621
622  function stopScroll() {
623    scrollDirection = 0
624    cancelAnimationFrame(scrollRaf)
625  }
626
627  useEventListener(document, 'keydown', (e: KeyboardEvent) => {
628    if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp' && e.key !== 'Escape') {
629      return
630    }
631
632    if (e.key === 'Escape') {
633      if (homeSidebarOpen.value) homeSidebarOpen.value = false
634      return
635    }
636
637    e.preventDefault()
638    const dir = e.key === 'ArrowDown' ? 1 : -1
639    if (scrollDirection === dir) return
640    scrollDirection = dir
641    cancelAnimationFrame(scrollRaf)
642    scrollRaf = requestAnimationFrame(tickScroll)
643  })
644
645  useEventListener(document, 'keyup', (e: KeyboardEvent) => {
646    if (e.key === 'ArrowDown' || e.key === 'ArrowUp') stopScroll()
647  })
648
649  onUnmounted(stopScroll)
650
651  // Close home NavScreen on outside click
652  useEventListener(document, 'click', (e: Event) => {
653    if (!isHome.value) return
654    const screen = document.getElementById('VPNavScreen')
655    if (!screen) return
656    const hamburger = document.querySelector('.VPNavBarHamburger')
657    if (
658      screen.contains(e.target as Node) || hamburger?.contains(e.target as Node)
659    ) return
660    requestAnimationFrame(() => (hamburger as HTMLElement)?.click())
661  })
662
663  // Storage changed in other documents.
664  useEventListener(window, 'storage', () => {
665    reloadTakodachi()
666  })
667
668  // Storage changed in the same document.
669  useEventListener(window, customStorageEventName, () => {
670    reloadTakodachi()
671  })
672
673  reloadTakodachi()
674})
675
676onUnmounted(() => {
677  takodachiDisable.value && takodachiDisable.value()
678})
679</script>
680
681<template>
682  <Layout>
683    <template #layout-top>
684      <img
685        id="takodachi"
686        ref="takodachiRef"
687        src="/takodachi.webp"
688        alt="Takodachi"
689        class="pointer-events-none fixed absolute z-[9999] h-10 w-10 opacity-0 transition-opacity duration-500"
690        :style="{
691          left: `${position.x}px`,
692          top: `${position.y}px`
693        }"
694      />
695      <!-- Home sidebar menu -->
696      <template v-if="isHome">
697        <Transition name="home-fade">
698          <div
699            v-if="homeSidebarOpen"
700            class="home-sidebar-backdrop"
701            @click="homeSidebarOpen = false"
702          />
703        </Transition>
704        <Transition name="home-slide" @after-enter="onSidebarEnter">
705          <aside
706            v-if="homeSidebarOpen"
707            ref="sidebarRef"
708            class="home-sidebar"
709            tabindex="-1"
710            @click.stop
711          >
712            <div class="home-sidebar-header">
713              <a href="/" class="home-sidebar-logo">
714                <img
715                  v-if="logoSrc"
716                  :src="logoSrc"
717                  class="home-sidebar-logo-img"
718                  alt="Logo"
719                />
720                <span>{{ theme.siteTitle ?? site.title }}</span>
721              </a>
722            </div>
723            <nav id="VPSidebarNav" class="home-sidebar-nav">
724              <VPSidebarGroup :items="homeSidebarGroups" />
725              <SidebarCard />
726            </nav>
727          </aside>
728        </Transition>
729      </template>
730    </template>
731    <template #doc-before>
732      <!-- Breadcrumb Navigation -->
733      <nav
734        v-if="breadcrumbs.length > 0"
735        class="breadcrumb mb-6 text-sm text-text-2"
736        aria-label="Breadcrumb"
737      >
738        <ol class="flex flex-wrap items-center gap-2">
739          <li>
740            <a href="/" class="hover:text-primary transition-colors">
741              <span class="i-lucide:home"></span>
742            </a>
743          </li>
744          <li
745            v-for="(crumb, index) in breadcrumbs"
746            :key="crumb.link || index"
747            class="flex items-center gap-2"
748          >
749            <span
750              class="i-lucide:chevron-right text-text-3 flex-shrink-0"
751            ></span>
752            <span
753              v-if="index === breadcrumbs.length - 1"
754              v-html="crumb.text"
755              class="font-medium text-text-1 break-words"
756            ></span>
757            <a
758              v-else
759              :href="crumb.link"
760              v-html="crumb.text"
761              class="hover:text-primary transition-colors break-words"
762            ></a>
763          </li>
764        </ol>
765      </nav>
766    </template>
767    <template #not-found>
768      <NotFoundComponent />
769    </template>
770    <template #sidebar-nav-after>
771      <SidebarCard />
772    </template>
773    <template #home-hero-info-before>
774      <AnnouncementPill />
775    </template>
776    <template #nav-bar-content-after>
777      <NolebaseEnhancedReadabilitiesMenu />
778    </template>
779    <template #nav-screen-content-before>
780      <nav v-if="isHome" id="VPSidebarNavMobile" class="home-screen-nav">
781        <VPSidebarGroup :items="homeSidebarGroups" />
782      </nav>
783    </template>
784    <template #nav-screen-content-after>
785      <NolebaseEnhancedReadabilitiesScreenMenu />
786    </template>
787
788    <template #nav-bar-title-before>
789      <span
790        v-if="isHome"
791        class="home-menu-btn"
792        role="button"
793        tabindex="0"
794        aria-label="Menu"
795        @click.prevent.stop="homeSidebarOpen = !homeSidebarOpen"
796        @keydown.enter.prevent.stop="homeSidebarOpen = !homeSidebarOpen"
797      >
798        <span class="vpi-align-left home-menu-icon" />
799      </span>
800    </template>
801  </Layout>
802</template>