vitepress-theme-element-plus 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/README.md +3 -3
- package/client/components/A11yTag.vue +29 -29
- package/client/components/ApiTyping.vue +54 -54
- package/client/components/Backdrop.vue +41 -41
- package/client/components/Bili.vue +94 -94
- package/client/components/Content.vue +148 -150
- package/client/components/DeprecatedTag.vue +19 -19
- package/client/components/Doc.vue +181 -181
- package/client/components/DocAside.vue +46 -46
- package/client/components/DocAsideOutline.vue +82 -82
- package/client/components/DocFooter.vue +159 -159
- package/client/components/Footer.vue +77 -77
- package/client/components/FooterCopyright.vue +27 -27
- package/client/components/Layout.vue +156 -156
- package/client/components/Link.vue +41 -41
- package/client/components/LocalNav.vue +160 -160
- package/client/components/Nav.vue +69 -69
- package/client/components/NavBar.vue +203 -203
- package/client/components/NavBarTitle.vue +75 -75
- package/client/components/Sidebar.vue +129 -129
- package/client/components/SidebarGroup.vue +51 -51
- package/client/components/SidebarItem.vue +302 -302
- package/client/components/Tag.vue +25 -25
- package/client/components/VPNavBarSearch.vue +23 -23
- package/client/components/VersionTag.vue +18 -18
- package/client/hooks/useBackTop.ts +72 -72
- package/client/hooks/useLangs.ts +50 -50
- package/client/hooks/useSidebar.ts +93 -18
- package/client/hooks/useSidebarControl.ts +78 -78
- package/client/hooks/useSize.ts +69 -69
- package/client/utils/client/common.ts +49 -49
- package/client/utils/client/outline.ts +113 -113
- package/client/utils/common.ts +90 -86
- package/client/utils/throttle.ts +46 -0
- package/index.ts +26 -26
- package/package.json +73 -72
- package/shared/constants.ts +3 -3
- package/styles/base.scss +37 -37
- package/styles/code.scss +282 -282
- package/styles/doc-content.scss +161 -161
- package/styles/index.scss +69 -69
- package/styles/tag-content.scss +30 -30
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { useWindowScroll } from '@vueuse/core'
|
|
3
|
-
import { ElButton } from 'element-plus'
|
|
4
|
-
import { useData } from 'vitepress'
|
|
5
|
-
import { useLayout } from 'vitepress/theme'
|
|
6
|
-
import { computed, onMounted, ref } from 'vue'
|
|
7
|
-
import { useBackTop } from '../hooks/useBackTop'
|
|
8
|
-
import 'element-plus/theme-chalk/el-button.css'
|
|
9
|
-
|
|
10
|
-
defineProps<{
|
|
11
|
-
open: boolean
|
|
12
|
-
}>()
|
|
13
|
-
|
|
14
|
-
defineEmits<{
|
|
15
|
-
(e: 'openMenu'): void
|
|
16
|
-
}>()
|
|
17
|
-
|
|
18
|
-
const { theme } = useData()
|
|
19
|
-
const { isHome, hasSidebar, hasLocalNav } = useLayout()
|
|
20
|
-
const { y } = useWindowScroll()
|
|
21
|
-
|
|
22
|
-
const navHeight = ref(0)
|
|
23
|
-
|
|
24
|
-
onMounted(() => {
|
|
25
|
-
navHeight.value = Number.parseInt(
|
|
26
|
-
getComputedStyle(document.documentElement).getPropertyValue(
|
|
27
|
-
'--vp-nav-height',
|
|
28
|
-
),
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const classes = computed(() => {
|
|
33
|
-
return {
|
|
34
|
-
'VPLocalNav': true,
|
|
35
|
-
'has-sidebar': hasSidebar.value,
|
|
36
|
-
'empty': !hasLocalNav.value,
|
|
37
|
-
'fixed': !hasLocalNav.value && !hasSidebar.value,
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const { shouldShow, scrollToTop } = useBackTop()
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<template>
|
|
45
|
-
<div
|
|
46
|
-
v-if="!isHome && (hasLocalNav || hasSidebar || y >= navHeight)"
|
|
47
|
-
:class="classes"
|
|
48
|
-
>
|
|
49
|
-
<div class="container">
|
|
50
|
-
<button
|
|
51
|
-
v-if="hasSidebar"
|
|
52
|
-
class="menu"
|
|
53
|
-
:aria-expanded="open"
|
|
54
|
-
aria-controls="VPSidebarNav"
|
|
55
|
-
@click="$emit('openMenu')"
|
|
56
|
-
>
|
|
57
|
-
<span class="vpi-align-left menu-icon" />
|
|
58
|
-
<span class="menu-text">
|
|
59
|
-
{{ theme.sidebarMenuLabel || 'Menu' }}
|
|
60
|
-
</span>
|
|
61
|
-
</button>
|
|
62
|
-
<Transition name="shifting">
|
|
63
|
-
<ElButton
|
|
64
|
-
:class="{ show: shouldShow }"
|
|
65
|
-
link
|
|
66
|
-
class="height-5 go-back-top"
|
|
67
|
-
@click.prevent.stop="scrollToTop"
|
|
68
|
-
>
|
|
69
|
-
Back to top
|
|
70
|
-
</ElButton>
|
|
71
|
-
</Transition>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</template>
|
|
75
|
-
|
|
76
|
-
<style scoped>
|
|
77
|
-
.VPLocalNav {
|
|
78
|
-
position: sticky;
|
|
79
|
-
top: 0;
|
|
80
|
-
/*rtl:ignore*/
|
|
81
|
-
left: 0;
|
|
82
|
-
z-index: var(--vp-z-index-local-nav);
|
|
83
|
-
border-bottom: 1px solid var(--vp-c-gutter);
|
|
84
|
-
padding-top: var(--vp-layout-top-height, 0px);
|
|
85
|
-
width: 100%;
|
|
86
|
-
background-color: var(--vp-local-nav-bg-color);
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.VPLocalNav.fixed {
|
|
91
|
-
position: fixed;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
@media (min-width: 960px) {
|
|
95
|
-
.VPLocalNav {
|
|
96
|
-
display: none;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@media (min-width: 1440px) {
|
|
101
|
-
.VPLocalNav {
|
|
102
|
-
display: none;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.container {
|
|
107
|
-
display: flex;
|
|
108
|
-
justify-content: space-between;
|
|
109
|
-
align-items: center;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.menu {
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
line-height: 24px;
|
|
116
|
-
font-size: 16px;
|
|
117
|
-
font-weight: 500;
|
|
118
|
-
color: var(--vp-c-text-2);
|
|
119
|
-
transition: color 0.5s;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.menu:hover {
|
|
123
|
-
color: var(--vp-c-text-1);
|
|
124
|
-
transition: color 0.25s;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@media (min-width: 960px) {
|
|
128
|
-
.menu {
|
|
129
|
-
display: none;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.menu-icon {
|
|
134
|
-
margin-right: 8px;
|
|
135
|
-
font-size: 16px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.menu,
|
|
139
|
-
:deep(.VPLocalNavOutlineDropdown > button) {
|
|
140
|
-
padding: 12px 24px 11px;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
@media (min-width: 768px) {
|
|
144
|
-
.menu,
|
|
145
|
-
:deep(.VPLocalNavOutlineDropdown > button) {
|
|
146
|
-
padding: 12px 32px 11px;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.go-back-top {
|
|
151
|
-
transform: translateY(100%);
|
|
152
|
-
opacity: 0;
|
|
153
|
-
padding: 12px 32px 11px;
|
|
154
|
-
|
|
155
|
-
&.show {
|
|
156
|
-
transform: translateY(0);
|
|
157
|
-
opacity: 1;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
</style>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useWindowScroll } from '@vueuse/core'
|
|
3
|
+
import { ElButton } from 'element-plus'
|
|
4
|
+
import { useData } from 'vitepress'
|
|
5
|
+
import { useLayout } from 'vitepress/theme'
|
|
6
|
+
import { computed, onMounted, ref } from 'vue'
|
|
7
|
+
import { useBackTop } from '../hooks/useBackTop'
|
|
8
|
+
import 'element-plus/theme-chalk/el-button.css'
|
|
9
|
+
|
|
10
|
+
defineProps<{
|
|
11
|
+
open: boolean
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
defineEmits<{
|
|
15
|
+
(e: 'openMenu'): void
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const { theme } = useData()
|
|
19
|
+
const { isHome, hasSidebar, hasLocalNav } = useLayout()
|
|
20
|
+
const { y } = useWindowScroll()
|
|
21
|
+
|
|
22
|
+
const navHeight = ref(0)
|
|
23
|
+
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
navHeight.value = Number.parseInt(
|
|
26
|
+
getComputedStyle(document.documentElement).getPropertyValue(
|
|
27
|
+
'--vp-nav-height',
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const classes = computed(() => {
|
|
33
|
+
return {
|
|
34
|
+
'VPLocalNav': true,
|
|
35
|
+
'has-sidebar': hasSidebar.value,
|
|
36
|
+
'empty': !hasLocalNav.value,
|
|
37
|
+
'fixed': !hasLocalNav.value && !hasSidebar.value,
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const { shouldShow, scrollToTop } = useBackTop()
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div
|
|
46
|
+
v-if="!isHome && (hasLocalNav || hasSidebar || y >= navHeight)"
|
|
47
|
+
:class="classes"
|
|
48
|
+
>
|
|
49
|
+
<div class="container">
|
|
50
|
+
<button
|
|
51
|
+
v-if="hasSidebar"
|
|
52
|
+
class="menu"
|
|
53
|
+
:aria-expanded="open"
|
|
54
|
+
aria-controls="VPSidebarNav"
|
|
55
|
+
@click="$emit('openMenu')"
|
|
56
|
+
>
|
|
57
|
+
<span class="vpi-align-left menu-icon" />
|
|
58
|
+
<span class="menu-text">
|
|
59
|
+
{{ theme.sidebarMenuLabel || 'Menu' }}
|
|
60
|
+
</span>
|
|
61
|
+
</button>
|
|
62
|
+
<Transition name="shifting">
|
|
63
|
+
<ElButton
|
|
64
|
+
:class="{ show: shouldShow }"
|
|
65
|
+
link
|
|
66
|
+
class="height-5 go-back-top"
|
|
67
|
+
@click.prevent.stop="scrollToTop"
|
|
68
|
+
>
|
|
69
|
+
Back to top
|
|
70
|
+
</ElButton>
|
|
71
|
+
</Transition>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<style scoped>
|
|
77
|
+
.VPLocalNav {
|
|
78
|
+
position: sticky;
|
|
79
|
+
top: 0;
|
|
80
|
+
/*rtl:ignore*/
|
|
81
|
+
left: 0;
|
|
82
|
+
z-index: var(--vp-z-index-local-nav);
|
|
83
|
+
border-bottom: 1px solid var(--vp-c-gutter);
|
|
84
|
+
padding-top: var(--vp-layout-top-height, 0px);
|
|
85
|
+
width: 100%;
|
|
86
|
+
background-color: var(--vp-local-nav-bg-color);
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.VPLocalNav.fixed {
|
|
91
|
+
position: fixed;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (min-width: 960px) {
|
|
95
|
+
.VPLocalNav {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media (min-width: 1440px) {
|
|
101
|
+
.VPLocalNav {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.container {
|
|
107
|
+
display: flex;
|
|
108
|
+
justify-content: space-between;
|
|
109
|
+
align-items: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.menu {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
line-height: 24px;
|
|
116
|
+
font-size: 16px;
|
|
117
|
+
font-weight: 500;
|
|
118
|
+
color: var(--vp-c-text-2);
|
|
119
|
+
transition: color 0.5s;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.menu:hover {
|
|
123
|
+
color: var(--vp-c-text-1);
|
|
124
|
+
transition: color 0.25s;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@media (min-width: 960px) {
|
|
128
|
+
.menu {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.menu-icon {
|
|
134
|
+
margin-right: 8px;
|
|
135
|
+
font-size: 16px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.menu,
|
|
139
|
+
:deep(.VPLocalNavOutlineDropdown > button) {
|
|
140
|
+
padding: 12px 24px 11px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@media (min-width: 768px) {
|
|
144
|
+
.menu,
|
|
145
|
+
:deep(.VPLocalNavOutlineDropdown > button) {
|
|
146
|
+
padding: 12px 32px 11px;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.go-back-top {
|
|
151
|
+
transform: translateY(100%);
|
|
152
|
+
opacity: 0;
|
|
153
|
+
padding: 12px 32px 11px;
|
|
154
|
+
|
|
155
|
+
&.show {
|
|
156
|
+
transform: translateY(0);
|
|
157
|
+
opacity: 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { inBrowser } from 'vitepress'
|
|
3
|
-
import { useData } from 'vitepress/client'
|
|
4
|
-
import VPNavScreen from 'vitepress/dist/client/theme-default/components/VPNavScreen.vue'
|
|
5
|
-
import { navInjectionKey, useNav } from 'vitepress/dist/client/theme-default/composables/nav'
|
|
6
|
-
import { computed, provide, watchEffect } from 'vue'
|
|
7
|
-
import NavBar from './NavBar.vue'
|
|
8
|
-
|
|
9
|
-
const { isScreenOpen, closeScreen, toggleScreen } = useNav()
|
|
10
|
-
const { frontmatter } = useData()
|
|
11
|
-
|
|
12
|
-
const hasNavbar = computed(() => {
|
|
13
|
-
return frontmatter.value.navbar !== false
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
provide(navInjectionKey, { closeScreen })
|
|
17
|
-
|
|
18
|
-
watchEffect(() => {
|
|
19
|
-
if (inBrowser) {
|
|
20
|
-
document.documentElement.classList.toggle('hide-nav', !hasNavbar.value)
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<template>
|
|
26
|
-
<header v-if="hasNavbar" class="VPNav">
|
|
27
|
-
<NavBar :is-screen-open="isScreenOpen" @toggle-screen="toggleScreen">
|
|
28
|
-
<template #nav-bar-title-before>
|
|
29
|
-
<slot name="nav-bar-title-before" />
|
|
30
|
-
</template>
|
|
31
|
-
<template #nav-bar-title-after>
|
|
32
|
-
<slot name="nav-bar-title-after" />
|
|
33
|
-
</template>
|
|
34
|
-
<template #nav-bar-content-before>
|
|
35
|
-
<slot name="nav-bar-content-before" />
|
|
36
|
-
</template>
|
|
37
|
-
<template #nav-bar-content-after>
|
|
38
|
-
<slot name="nav-bar-content-after" />
|
|
39
|
-
</template>
|
|
40
|
-
</NavBar>
|
|
41
|
-
<VPNavScreen :open="isScreenOpen">
|
|
42
|
-
<template #nav-screen-content-before>
|
|
43
|
-
<slot name="nav-screen-content-before" />
|
|
44
|
-
</template>
|
|
45
|
-
<template #nav-screen-content-after>
|
|
46
|
-
<slot name="nav-screen-content-after" />
|
|
47
|
-
</template>
|
|
48
|
-
</VPNavScreen>
|
|
49
|
-
</header>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<style scoped>
|
|
53
|
-
.VPNav {
|
|
54
|
-
position: relative;
|
|
55
|
-
top: var(--vp-layout-top-height, 0px);
|
|
56
|
-
/*rtl:ignore*/
|
|
57
|
-
left: 0;
|
|
58
|
-
z-index: var(--vp-z-index-nav);
|
|
59
|
-
width: 100%;
|
|
60
|
-
pointer-events: none;
|
|
61
|
-
transition: background-color 0.5s;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@media (min-width: 960px) {
|
|
65
|
-
.VPNav {
|
|
66
|
-
position: fixed;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inBrowser } from 'vitepress'
|
|
3
|
+
import { useData } from 'vitepress/client'
|
|
4
|
+
import VPNavScreen from 'vitepress/dist/client/theme-default/components/VPNavScreen.vue'
|
|
5
|
+
import { navInjectionKey, useNav } from 'vitepress/dist/client/theme-default/composables/nav'
|
|
6
|
+
import { computed, provide, watchEffect } from 'vue'
|
|
7
|
+
import NavBar from './NavBar.vue'
|
|
8
|
+
|
|
9
|
+
const { isScreenOpen, closeScreen, toggleScreen } = useNav()
|
|
10
|
+
const { frontmatter } = useData()
|
|
11
|
+
|
|
12
|
+
const hasNavbar = computed(() => {
|
|
13
|
+
return frontmatter.value.navbar !== false
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
provide(navInjectionKey, { closeScreen })
|
|
17
|
+
|
|
18
|
+
watchEffect(() => {
|
|
19
|
+
if (inBrowser) {
|
|
20
|
+
document.documentElement.classList.toggle('hide-nav', !hasNavbar.value)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<header v-if="hasNavbar" class="VPNav">
|
|
27
|
+
<NavBar :is-screen-open="isScreenOpen" @toggle-screen="toggleScreen">
|
|
28
|
+
<template #nav-bar-title-before>
|
|
29
|
+
<slot name="nav-bar-title-before" />
|
|
30
|
+
</template>
|
|
31
|
+
<template #nav-bar-title-after>
|
|
32
|
+
<slot name="nav-bar-title-after" />
|
|
33
|
+
</template>
|
|
34
|
+
<template #nav-bar-content-before>
|
|
35
|
+
<slot name="nav-bar-content-before" />
|
|
36
|
+
</template>
|
|
37
|
+
<template #nav-bar-content-after>
|
|
38
|
+
<slot name="nav-bar-content-after" />
|
|
39
|
+
</template>
|
|
40
|
+
</NavBar>
|
|
41
|
+
<VPNavScreen :open="isScreenOpen">
|
|
42
|
+
<template #nav-screen-content-before>
|
|
43
|
+
<slot name="nav-screen-content-before" />
|
|
44
|
+
</template>
|
|
45
|
+
<template #nav-screen-content-after>
|
|
46
|
+
<slot name="nav-screen-content-after" />
|
|
47
|
+
</template>
|
|
48
|
+
</VPNavScreen>
|
|
49
|
+
</header>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.VPNav {
|
|
54
|
+
position: relative;
|
|
55
|
+
top: var(--vp-layout-top-height, 0px);
|
|
56
|
+
/*rtl:ignore*/
|
|
57
|
+
left: 0;
|
|
58
|
+
z-index: var(--vp-z-index-nav);
|
|
59
|
+
width: 100%;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
transition: background-color 0.5s;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (min-width: 960px) {
|
|
65
|
+
.VPNav {
|
|
66
|
+
position: fixed;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</style>
|