|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onClickOutside, onKeyStroke } from '@vueuse/core'
|
|
|
|
|
import { onContentUpdated } from 'vitepress'
|
|
|
|
|
import { nextTick, ref } from 'vue'
|
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
@ -14,8 +15,17 @@ const props = defineProps<{
|
|
|
|
|
const { theme } = useData()
|
|
|
|
|
const open = ref(false)
|
|
|
|
|
const vh = ref(0)
|
|
|
|
|
const main = ref<HTMLDivElement>()
|
|
|
|
|
const items = ref<HTMLDivElement>()
|
|
|
|
|
|
|
|
|
|
onClickOutside(main, () => {
|
|
|
|
|
open.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onKeyStroke('Escape', () => {
|
|
|
|
|
open.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onContentUpdated(() => {
|
|
|
|
|
open.value = false
|
|
|
|
|
})
|
|
|
|
@ -44,7 +54,11 @@ function scrollToTop() {
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="VPLocalNavOutlineDropdown" :style="{ '--vp-vh': vh + 'px' }">
|
|
|
|
|
<div
|
|
|
|
|
class="VPLocalNavOutlineDropdown"
|
|
|
|
|
:style="{ '--vp-vh': vh + 'px' }"
|
|
|
|
|
ref="main"
|
|
|
|
|
>
|
|
|
|
|
<button @click="toggle" :class="{ open }" v-if="headers.length > 0">
|
|
|
|
|
{{ resolveTitle(theme) }}
|
|
|
|
|
<VPIconChevronRight class="icon" />
|
|
|
|
@ -53,11 +67,7 @@ function scrollToTop() {
|
|
|
|
|
{{ theme.returnToTopLabel || 'Return to top' }}
|
|
|
|
|
</button>
|
|
|
|
|
<Transition name="flyout">
|
|
|
|
|
<div v-if="open"
|
|
|
|
|
ref="items"
|
|
|
|
|
class="items"
|
|
|
|
|
@click="onItemClick"
|
|
|
|
|
>
|
|
|
|
|
<div v-if="open" ref="items" class="items" @click="onItemClick">
|
|
|
|
|
<div class="header">
|
|
|
|
|
<a class="top-link" href="#" @click="scrollToTop">
|
|
|
|
|
{{ theme.returnToTopLabel || 'Return to top' }}
|
|
|
|
@ -162,11 +172,11 @@ function scrollToTop() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.flyout-enter-active {
|
|
|
|
|
transition: all .2s ease-out;
|
|
|
|
|
transition: all 0.2s ease-out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.flyout-leave-active {
|
|
|
|
|
transition: all .15s ease-in;
|
|
|
|
|
transition: all 0.15s ease-in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.flyout-enter-from,
|
|
|
|
|