|
|
@ -3,6 +3,7 @@ import type { DefaultTheme } from 'vitepress/theme'
|
|
|
|
import { computed } from 'vue'
|
|
|
|
import { computed } from 'vue'
|
|
|
|
import { useSidebarControl } from '../composables/sidebar'
|
|
|
|
import { useSidebarControl } from '../composables/sidebar'
|
|
|
|
import VPLink from './VPLink.vue'
|
|
|
|
import VPLink from './VPLink.vue'
|
|
|
|
|
|
|
|
import { isClientOnly } from '../../shared'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
const props = defineProps<{
|
|
|
|
item: DefaultTheme.SidebarItem
|
|
|
|
item: DefaultTheme.SidebarItem
|
|
|
@ -55,56 +56,32 @@ function onCaretClick() {
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<ClientOnly :isClientOnly="isClientOnly(item)">
|
|
|
|
<component :is="sectionTag" class="VPSidebarItem" :class="classes">
|
|
|
|
<component :is="sectionTag" class="VPSidebarItem" :class="classes">
|
|
|
|
<div
|
|
|
|
<div v-if="item.text" class="item" :role="itemRole" v-on="item.items
|
|
|
|
v-if="item.text"
|
|
|
|
|
|
|
|
class="item"
|
|
|
|
|
|
|
|
:role="itemRole"
|
|
|
|
|
|
|
|
v-on="
|
|
|
|
|
|
|
|
item.items
|
|
|
|
|
|
|
|
? { click: onItemInteraction, keydown: onItemInteraction }
|
|
|
|
? { click: onItemInteraction, keydown: onItemInteraction }
|
|
|
|
: {}
|
|
|
|
: {}
|
|
|
|
"
|
|
|
|
" :tabindex="item.items && 0">
|
|
|
|
:tabindex="item.items && 0"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div class="indicator" />
|
|
|
|
<div class="indicator" />
|
|
|
|
|
|
|
|
|
|
|
|
<VPLink
|
|
|
|
<VPLink v-if="item.link" :tag="linkTag" class="link" :href="item.link" :rel="item.rel" :target="item.target">
|
|
|
|
v-if="item.link"
|
|
|
|
|
|
|
|
:tag="linkTag"
|
|
|
|
|
|
|
|
class="link"
|
|
|
|
|
|
|
|
:href="item.link"
|
|
|
|
|
|
|
|
:rel="item.rel"
|
|
|
|
|
|
|
|
:target="item.target"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<component :is="textTag" class="text" v-html="item.text" />
|
|
|
|
<component :is="textTag" class="text" v-html="item.text" />
|
|
|
|
</VPLink>
|
|
|
|
</VPLink>
|
|
|
|
<component v-else :is="textTag" class="text" v-html="item.text" />
|
|
|
|
<component v-else :is="textTag" class="text" v-html="item.text" />
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
<div v-if="item.collapsed != null && item.items && item.items.length" class="caret" role="button"
|
|
|
|
v-if="item.collapsed != null && item.items && item.items.length"
|
|
|
|
aria-label="toggle section" @click="onCaretClick" @keydown.enter="onCaretClick" tabindex="0">
|
|
|
|
class="caret"
|
|
|
|
|
|
|
|
role="button"
|
|
|
|
|
|
|
|
aria-label="toggle section"
|
|
|
|
|
|
|
|
@click="onCaretClick"
|
|
|
|
|
|
|
|
@keydown.enter="onCaretClick"
|
|
|
|
|
|
|
|
tabindex="0"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<span class="vpi-chevron-right caret-icon" />
|
|
|
|
<span class="vpi-chevron-right caret-icon" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-if="item.items && item.items.length" class="items">
|
|
|
|
<div v-if="item.items && item.items.length" class="items">
|
|
|
|
<template v-if="depth < 5">
|
|
|
|
<template v-if="depth < 5">
|
|
|
|
<VPSidebarItem
|
|
|
|
<VPSidebarItem v-for="i in item.items" :key="i.text" :item="i" :depth="depth + 1" />
|
|
|
|
v-for="i in item.items"
|
|
|
|
|
|
|
|
:key="i.text"
|
|
|
|
|
|
|
|
:item="i"
|
|
|
|
|
|
|
|
:depth="depth + 1"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</component>
|
|
|
|
</component>
|
|
|
|
|
|
|
|
</ClientOnly>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
<style scoped>
|
|
|
@ -233,7 +210,9 @@ function onCaretClick() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.VPSidebarItem.collapsed .caret-icon {
|
|
|
|
.VPSidebarItem.collapsed .caret-icon {
|
|
|
|
transform: rotate(0)/*rtl:rotate(180deg)*/;
|
|
|
|
transform: rotate(0)
|
|
|
|
|
|
|
|
/*rtl:rotate(180deg)*/
|
|
|
|
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.VPSidebarItem.level-1 .items,
|
|
|
|
.VPSidebarItem.level-1 .items,
|
|
|
|