valaxy-theme-press 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/index.ts +1 -0
- package/components/PressAlgoliaSearch.vue +208 -0
- package/components/PressArticle.vue +27 -16
- package/components/PressArticleCard.vue +6 -2
- package/components/PressAside.vue +38 -27
- package/components/PressBackdrop.vue +1 -1
- package/components/PressButton.vue +5 -12
- package/components/PressCategories.vue +24 -3
- package/components/PressCategory.vue +24 -15
- package/components/PressDocFooter.vue +15 -0
- package/components/PressDocFooterLastUpdated.vue +44 -0
- package/components/PressFeature.vue +1 -1
- package/components/PressFeatures.vue +1 -1
- package/components/PressFooter.vue +53 -0
- package/components/PressHome.vue +1 -7
- package/components/PressHomeFeatures.vue +1 -0
- package/components/PressHomeHero.vue +7 -8
- package/components/PressLocalNav.vue +9 -9
- package/components/PressNav.vue +30 -5
- package/components/PressNavBar.vue +94 -0
- package/components/PressNavBarAppearance.vue +5 -0
- package/components/PressNavBarHamburger.vue +79 -0
- package/components/PressNavBarMenu.vue +14 -0
- package/components/PressNavBarSearch.vue +40 -0
- package/components/PressNavBarSocialLinks.vue +26 -0
- package/components/PressNavBarTranslations.vue +5 -0
- package/components/PressNavItemGroup.vue +101 -0
- package/components/PressNavItemLink.vue +40 -0
- package/components/PressNavScreen.vue +95 -0
- package/components/PressNavScreenAppearance.vue +32 -0
- package/components/PressNavScreenMenu.vue +22 -0
- package/components/PressNavScreenMenuGroup.vue +115 -0
- package/components/PressNavScreenMenuGroupLink.vue +32 -0
- package/components/PressNavScreenMenuGroupSection.vue +37 -0
- package/components/PressNavScreenMenuLink.vue +33 -0
- package/components/PressNavScreenSocialLinks.vue +13 -0
- package/components/PressNavScreenTranslations.vue +7 -0
- package/components/{PressToc.vue → PressOutline.vue} +14 -39
- package/components/PressOutlineItem.vue +48 -0
- package/components/PressPostList.vue +3 -3
- package/components/PressSidebar.vue +31 -10
- package/components/PressSocialLink.vue +40 -0
- package/components/PressSocialLinks.vue +26 -0
- package/components/ValaxyMain.vue +60 -42
- package/composables/edit-link.ts +14 -0
- package/composables/index.ts +1 -0
- package/composables/nav.ts +37 -0
- package/config/index.ts +13 -2
- package/layouts/layout.vue +5 -3
- package/package.json +15 -5
- package/pages/[..all].vue +1 -0
- package/setup/main.ts +5 -4
- package/styles/css-vars.scss +16 -8
- package/styles/helper.scss +0 -10
- package/styles/markdown.scss +18 -8
- package/types/index.d.ts +76 -22
- package/utils/index.ts +9 -0
- package/valaxy.config.ts +7 -0
- package/LICENSE +0 -21
- package/components/DocsBoard.vue +0 -24
- package/components/nav/PressNavBar.vue +0 -123
- /package/components/{nav/PressSwitchAppearance.vue → PressSwitchAppearance.vue} +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useRoute } from 'vue-router'
|
|
3
|
+
import type { NavItemLink } from '../types'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
item: NavItemLink
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const route = useRoute()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AppLink
|
|
14
|
+
class="press-nav-item-link"
|
|
15
|
+
:class="{
|
|
16
|
+
active: route.path === item.link,
|
|
17
|
+
}"
|
|
18
|
+
:to="item.link"
|
|
19
|
+
rel="noopener"
|
|
20
|
+
show-external-icon
|
|
21
|
+
>
|
|
22
|
+
{{ item.text }}
|
|
23
|
+
</AppLink>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style lang="scss" scoped>
|
|
27
|
+
.press-nav-item-link{
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: var(--pr-nav-text);
|
|
31
|
+
transition: color 0.25s;
|
|
32
|
+
|
|
33
|
+
&:hover{
|
|
34
|
+
color: var(--va-c-brand);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
.active{
|
|
38
|
+
color: var(--va-c-brand);
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { useBodyScrollLock } from 'valaxy'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
open: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const screen = ref<HTMLElement>()
|
|
10
|
+
const { lockBodyScroll, unlockBodyScroll } = useBodyScrollLock(screen)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<transition
|
|
15
|
+
name="fade"
|
|
16
|
+
@enter="lockBodyScroll"
|
|
17
|
+
@after-leave="unlockBodyScroll"
|
|
18
|
+
>
|
|
19
|
+
<div v-if="open" ref="screen" class="pr-NavScreen">
|
|
20
|
+
<div class="container" flex="~ col">
|
|
21
|
+
<slot name="nav-screen-content-before" />
|
|
22
|
+
<PressNavScreenMenu class="menu" />
|
|
23
|
+
<PressNavScreenTranslations class="translations" />
|
|
24
|
+
<PressNavScreenAppearance class="appearance" />
|
|
25
|
+
<PressNavScreenSocialLinks class="social-links" />
|
|
26
|
+
|
|
27
|
+
<slot name="nav-screen-content-after" />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</transition>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.pr-NavScreen {
|
|
35
|
+
position: fixed;
|
|
36
|
+
top: calc(var(--pr-nav-height) + var(--pr-layout-top-height, 0px) + 1px);
|
|
37
|
+
/*rtl:ignore*/
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
/*rtl:ignore*/
|
|
41
|
+
left: 0;
|
|
42
|
+
padding: 0 32px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
background-color: var(--pr-nav-screen-bg-color);
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
transition: background-color 0.5s;
|
|
47
|
+
pointer-events: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.pr-NavScreen.fade-enter-active,
|
|
51
|
+
.pr-NavScreen.fade-leave-active {
|
|
52
|
+
transition: opacity 0.25s;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pr-NavScreen.fade-enter-active .container,
|
|
56
|
+
.pr-NavScreen.fade-leave-active .container {
|
|
57
|
+
transition: transform 0.25s ease;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.pr-NavScreen.fade-enter-from,
|
|
61
|
+
.pr-NavScreen.fade-leave-to {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pr-NavScreen.fade-enter-from .container,
|
|
66
|
+
.pr-NavScreen.fade-leave-to .container {
|
|
67
|
+
transform: translateY(-8px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (min-width: 768px) {
|
|
71
|
+
.pr-NavScreen {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.container {
|
|
77
|
+
margin: 0 auto;
|
|
78
|
+
padding: 24px 0 96px;
|
|
79
|
+
max-width: 288px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.menu + .translations,
|
|
83
|
+
.menu + .appearance,
|
|
84
|
+
.translations + .appearance {
|
|
85
|
+
margin-top: 24px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.menu + .social-links {
|
|
89
|
+
margin-top: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.appearance + .social-links {
|
|
93
|
+
margin-top: 16px;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables/config'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="pr-nav-screen-appearance" flex="~ 1">
|
|
9
|
+
<p class="text">
|
|
10
|
+
{{ themeConfig.darkModeSwitchLabel || 'Appearance' }}
|
|
11
|
+
</p>
|
|
12
|
+
<PressSwitchAppearance />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.pr-nav-screen-appearance {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
align-items: center;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
padding: 12px 14px 12px 16px;
|
|
23
|
+
background-color: var(--va-c-bg-soft);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.text {
|
|
27
|
+
line-height: 24px;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: var(--va-c-text-2);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<nav v-if="themeConfig.nav" class="pr-nav-screen-menu">
|
|
9
|
+
<template v-for="item in themeConfig.nav" :key="item.text">
|
|
10
|
+
<PressNavScreenMenuLink
|
|
11
|
+
v-if="'link' in item"
|
|
12
|
+
:text="item.text"
|
|
13
|
+
:link="item.link"
|
|
14
|
+
/>
|
|
15
|
+
<PressNavScreenMenuGroup
|
|
16
|
+
v-else
|
|
17
|
+
:text="item.text || ''"
|
|
18
|
+
:items="item.items"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
</nav>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
items: any[]
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const isOpen = ref(false)
|
|
10
|
+
|
|
11
|
+
const groupId = computed(() =>
|
|
12
|
+
`NavScreenGroup-${props.text.replace(' ', '-').toLowerCase()}`,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
function toggle() {
|
|
16
|
+
isOpen.value = !isOpen.value
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="pr-nav-screen-menu-group" :class="{ open: isOpen }">
|
|
22
|
+
<button
|
|
23
|
+
class="button"
|
|
24
|
+
:aria-controls="groupId"
|
|
25
|
+
:aria-expanded="isOpen"
|
|
26
|
+
@click="toggle"
|
|
27
|
+
>
|
|
28
|
+
<span class="button-text">{{ text }}</span>
|
|
29
|
+
<div i-ri-add-line class="button-icon" />
|
|
30
|
+
</button>
|
|
31
|
+
|
|
32
|
+
<div :id="groupId" class="items">
|
|
33
|
+
<template v-for="item in items" :key="item.text">
|
|
34
|
+
<div v-if="'link' in item" :key="item.text" class="item">
|
|
35
|
+
<PressNavScreenMenuGroupLink
|
|
36
|
+
:text="item.text"
|
|
37
|
+
:link="item.link"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div v-else class="group">
|
|
42
|
+
<PressNavScreenMenuGroupSection
|
|
43
|
+
:text="item.text"
|
|
44
|
+
:items="item.items"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.pr-nav-screen-menu-group {
|
|
54
|
+
border-bottom: 1px solid var(--pr-c-divider);
|
|
55
|
+
height: 48px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
transition: border-color 0.5s;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.pr-nav-screen-menu-group .items {
|
|
61
|
+
visibility: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.pr-nav-screen-menu-group.open .items {
|
|
65
|
+
visibility: visible;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pr-nav-screen-menu-group.open {
|
|
69
|
+
padding-bottom: 10px;
|
|
70
|
+
height: auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pr-nav-screen-menu-group.open .button {
|
|
74
|
+
padding-bottom: 6px;
|
|
75
|
+
color: var(--pr-c-brand);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pr-nav-screen-menu-group.open .button-icon {
|
|
79
|
+
/*rtl:ignore*/
|
|
80
|
+
transform: rotate(45deg);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button {
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
align-items: center;
|
|
87
|
+
padding: 12px 4px 11px 0;
|
|
88
|
+
width: 100%;
|
|
89
|
+
line-height: 24px;
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
color: var(--pr-c-text-1);
|
|
93
|
+
transition: color 0.25s;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.button:hover {
|
|
97
|
+
color: var(--pr-c-brand);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.button-icon {
|
|
101
|
+
width: 14px;
|
|
102
|
+
height: 14px;
|
|
103
|
+
fill: var(--pr-c-text-2);
|
|
104
|
+
transition: fill 0.5s, transform 0.25s;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.group:first-child {
|
|
108
|
+
padding-top: 0px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.group + .group,
|
|
112
|
+
.group + .item {
|
|
113
|
+
padding-top: 4px;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
link: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const closeScreen = inject('close-screen') as () => void
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AppLink class="pr-nav-screen-menu-group-link" :to="link" @click="closeScreen">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</AppLink>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.pr-nav-screen-menu-group-link {
|
|
20
|
+
display: block;
|
|
21
|
+
margin-left: 12px;
|
|
22
|
+
line-height: 32px;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
color: var(--pr-c-text-1);
|
|
26
|
+
transition: color 0.25s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.pr-nav-screen-menu-group-link:hover {
|
|
30
|
+
color: var(--pr-c-brand);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { NavItemLink } from '../types'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text?: string
|
|
6
|
+
// todo
|
|
7
|
+
items: NavItemLink[]
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div class="pr-nav-screen-menu-group-section">
|
|
13
|
+
<p v-if="text" class="title">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</p>
|
|
16
|
+
<PressNavScreenMenuGroupLink
|
|
17
|
+
v-for="item in items"
|
|
18
|
+
:key="item.text"
|
|
19
|
+
:text="item.text"
|
|
20
|
+
:link="item.link"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
.pr-nav-screen-menu-group-section {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.title {
|
|
31
|
+
line-height: 32px;
|
|
32
|
+
font-size: 13px;
|
|
33
|
+
font-weight: 700;
|
|
34
|
+
color: var(--pr-c-text-2);
|
|
35
|
+
transition: color 0.25s;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
link: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const closeScreen = inject('close-screen') as () => void
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AppLink class="pr-nav-screen-menu-link" :href="link" @click="closeScreen">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</AppLink>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.pr-nav-screen-menu-link {
|
|
20
|
+
display: block;
|
|
21
|
+
border-bottom: 1px solid var(--pr-c-divider);
|
|
22
|
+
padding: 12px 0 11px;
|
|
23
|
+
line-height: 24px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
color: var(--pr-c-text-1);
|
|
27
|
+
transition: border-color 0.25s, color 0.25s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pr-nav-screen-menu-link:hover {
|
|
31
|
+
color: var(--pr-c-brand);
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<PressSocialLinks
|
|
9
|
+
v-if="themeConfig.socialLinks"
|
|
10
|
+
class="pr-nav-screen-social-links"
|
|
11
|
+
:links="themeConfig.socialLinks"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
@@ -1,38 +1,25 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { useI18n } from 'vue-i18n'
|
|
4
|
-
import type { Header } from 'valaxy'
|
|
2
|
+
import { ref } from 'vue'
|
|
5
3
|
import {
|
|
6
|
-
resolveHeaders,
|
|
7
4
|
useActiveAnchor,
|
|
8
|
-
|
|
5
|
+
useOutline,
|
|
9
6
|
} from 'valaxy'
|
|
7
|
+
import { useI18n } from 'vue-i18n'
|
|
10
8
|
import { useThemeConfig } from '../composables'
|
|
11
9
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const frontmatter = useFrontmatter()
|
|
10
|
+
const { t } = useI18n()
|
|
15
11
|
const themeConfig = useThemeConfig()
|
|
16
12
|
|
|
17
|
-
const { locale, t } = useI18n()
|
|
18
13
|
const container = ref()
|
|
19
14
|
const marker = ref()
|
|
20
15
|
|
|
21
16
|
useActiveAnchor(container, marker)
|
|
22
17
|
|
|
23
|
-
const
|
|
24
|
-
return resolveHeaders(props.headers || [])
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
function handleClick({ target: el }: Event) {
|
|
28
|
-
const id = `#${(el as HTMLAnchorElement).href!.split('#')[1]}`
|
|
29
|
-
const heading = document.querySelector(decodeURIComponent(id)) as HTMLAnchorElement
|
|
30
|
-
heading?.focus()
|
|
31
|
-
}
|
|
18
|
+
const { headers, handleClick } = useOutline()
|
|
32
19
|
</script>
|
|
33
20
|
|
|
34
21
|
<template>
|
|
35
|
-
<div v-show="headers.length" ref="container"
|
|
22
|
+
<div v-show="headers.length" ref="container">
|
|
36
23
|
<div class="content">
|
|
37
24
|
<div class="outline-title">
|
|
38
25
|
{{ themeConfig.outlineTitle || t('sidebar.toc') }}
|
|
@@ -45,26 +32,12 @@ function handleClick({ target: el }: Event) {
|
|
|
45
32
|
Table of Contents for current page
|
|
46
33
|
</span>
|
|
47
34
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
:lang="lang || locale"
|
|
55
|
-
>
|
|
56
|
-
<a class="outline-link" :href="link" @click="handleClick">
|
|
57
|
-
{{ text }}
|
|
58
|
-
</a>
|
|
59
|
-
<ul v-if="children && frontmatter.outline === 'deep'">
|
|
60
|
-
<li v-for="item in children" v-show="!item.hidden" :key="item.link" :lang="lang || locale">
|
|
61
|
-
<a class="outline-link" p="l-3" :href="link" @click="handleClick">
|
|
62
|
-
{{ item.text }}
|
|
63
|
-
</a>
|
|
64
|
-
</li>
|
|
65
|
-
</ul>
|
|
66
|
-
</li>
|
|
67
|
-
</ul>
|
|
35
|
+
<PressOutlineItem
|
|
36
|
+
class="va-toc relative z-1"
|
|
37
|
+
:headers="headers"
|
|
38
|
+
:on-click="handleClick"
|
|
39
|
+
root
|
|
40
|
+
/>
|
|
68
41
|
</nav>
|
|
69
42
|
</div>
|
|
70
43
|
</div>
|
|
@@ -85,6 +58,7 @@ function handleClick({ target: el }: Event) {
|
|
|
85
58
|
font-size: 14px;
|
|
86
59
|
text-align: left;
|
|
87
60
|
border-left: 1px solid var(--pr-aside-divider);
|
|
61
|
+
width: var(--va-aside-width + 16px);
|
|
88
62
|
}
|
|
89
63
|
|
|
90
64
|
.outline-marker {
|
|
@@ -106,6 +80,7 @@ function handleClick({ target: el }: Event) {
|
|
|
106
80
|
line-height: 28px;
|
|
107
81
|
font-size: 14px;
|
|
108
82
|
font-weight: 600;
|
|
83
|
+
color: var(--pr-c-text-1);
|
|
109
84
|
}
|
|
110
85
|
|
|
111
86
|
.outline-link {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { MenuItem } from 'valaxy'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
headers: MenuItem[]
|
|
7
|
+
onClick: (e: MouseEvent) => void
|
|
8
|
+
root?: boolean
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const { locale } = useI18n()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<ul :class="root ? 'root' : 'nested'">
|
|
16
|
+
<li v-for="{ children, link, title, lang } in headers" :key="link" class="va-toc-item" :lang="lang || locale">
|
|
17
|
+
<a class="outline-link" :href="link" @click="onClick">{{ title }}</a>
|
|
18
|
+
<template v-if="children?.length">
|
|
19
|
+
<PressOutlineItem :headers="children" :on-click="onClick" />
|
|
20
|
+
</template>
|
|
21
|
+
</li>
|
|
22
|
+
</ul>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<style lang="scss" scoped>
|
|
26
|
+
.va-toc {
|
|
27
|
+
.va-toc-item {
|
|
28
|
+
.outline-link {
|
|
29
|
+
color: var(--va-c-text-light);
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
text-overflow: ellipsis;
|
|
33
|
+
transition: color 0.5s;
|
|
34
|
+
|
|
35
|
+
&:hover,
|
|
36
|
+
&.active {
|
|
37
|
+
color: var(--va-c-brand);
|
|
38
|
+
transition: color 0.25s;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nested {
|
|
44
|
+
padding-left: 0.8rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import type { Post } from 'valaxy'
|
|
4
|
-
import {
|
|
4
|
+
import { useSiteStore } from 'valaxy'
|
|
5
5
|
|
|
6
6
|
const props = withDefaults(defineProps<{
|
|
7
7
|
type?: string
|
|
@@ -11,8 +11,8 @@ const props = withDefaults(defineProps<{
|
|
|
11
11
|
curPage: 1,
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
const posts = computed(() => props.posts ||
|
|
14
|
+
const site = useSiteStore()
|
|
15
|
+
const posts = computed(() => props.posts || site.postList)
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { removeItemFromCategory, useCategory, usePageList, useSidebar } from 'valaxy'
|
|
4
|
+
import { useThemeConfig } from '../composables'
|
|
3
5
|
|
|
4
6
|
defineProps<{
|
|
5
7
|
open: boolean
|
|
6
8
|
}>()
|
|
7
9
|
|
|
8
10
|
const pages = usePageList()
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
+
const themeConfig = useThemeConfig()
|
|
12
|
+
|
|
13
|
+
const categories = computed(() => {
|
|
14
|
+
const cs = useCategory('', pages.value)
|
|
15
|
+
const cList = cs.value
|
|
16
|
+
removeItemFromCategory(cList, 'Uncategorized')
|
|
17
|
+
|
|
18
|
+
const sidebar = themeConfig.value.sidebar
|
|
19
|
+
if (sidebar) {
|
|
20
|
+
cList.children.forEach((item) => {
|
|
21
|
+
if (!themeConfig.value.sidebar.includes(item.name))
|
|
22
|
+
removeItemFromCategory(cList, item.name)
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
return cList
|
|
26
|
+
})
|
|
11
27
|
|
|
12
28
|
const { hasSidebar } = useSidebar()
|
|
13
29
|
</script>
|
|
@@ -25,22 +41,23 @@ const { hasSidebar } = useSidebar()
|
|
|
25
41
|
</template>
|
|
26
42
|
|
|
27
43
|
<style lang="scss">
|
|
28
|
-
@use 'valaxy/client/styles/mixins' as *;
|
|
44
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
29
45
|
|
|
30
46
|
.press-sidebar {
|
|
31
47
|
position: fixed;
|
|
32
48
|
top: 0;
|
|
33
49
|
bottom: 0;
|
|
34
50
|
left: 0;
|
|
35
|
-
padding:
|
|
36
|
-
|
|
37
|
-
z-index: var(--pr-z-
|
|
51
|
+
padding: 1rem;
|
|
52
|
+
top: var(--pr-nav-height);
|
|
53
|
+
z-index: var(--pr-z-sidebar);
|
|
38
54
|
width: calc(100vw - 64px);
|
|
39
55
|
max-width: 320px;
|
|
40
56
|
background-color: var(--va-c-bg);
|
|
41
57
|
opacity: 0;
|
|
42
58
|
overflow-x: hidden;
|
|
43
59
|
overflow-y: auto;
|
|
60
|
+
overflow-y: overlay;
|
|
44
61
|
transform: translateX(-100%);
|
|
45
62
|
transition: opacity 0.5s, transform 0.25s ease;
|
|
46
63
|
|
|
@@ -52,11 +69,9 @@ const { hasSidebar } = useSidebar()
|
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
71
|
|
|
55
|
-
@include
|
|
72
|
+
@include screen('md') {
|
|
56
73
|
.press-sidebar {
|
|
57
74
|
z-index: 1;
|
|
58
|
-
padding: 1.5rem 1rem;
|
|
59
|
-
padding-top: var(--pr-nav-height);
|
|
60
75
|
width: var(--va-sidebar-width);
|
|
61
76
|
max-width: 100%;
|
|
62
77
|
background-color: var(--va-c-bg-alt);
|
|
@@ -65,4 +80,10 @@ const { hasSidebar } = useSidebar()
|
|
|
65
80
|
transform: translateX(0);
|
|
66
81
|
}
|
|
67
82
|
}
|
|
83
|
+
|
|
84
|
+
@include mobile {
|
|
85
|
+
.press-sidebar {
|
|
86
|
+
top: 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
68
89
|
</style>
|