vitepress-theme-element-plus 0.0.3 → 0.0.5
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 +87 -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 +71 -71
- 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 -90
- package/index.ts +26 -26
- package/package.json +73 -73
- package/shared/constants.ts +3 -3
- package/styles/base.scss +37 -37
- package/styles/code.scss +282 -282
- package/styles/doc-content.scss +162 -161
- package/styles/index.scss +69 -69
- package/styles/tag-content.scss +30 -30
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { useData, useRoute } from 'vitepress'
|
|
3
|
-
import VPBackdrop from 'vitepress/dist/client/theme-default/components/VPBackdrop.vue'
|
|
4
|
-
import VPSkipLink from 'vitepress/dist/client/theme-default/components/VPSkipLink.vue'
|
|
5
|
-
import { layoutInfoInjectionKey, registerWatchers } from 'vitepress/dist/client/theme-default/composables/layout'
|
|
6
|
-
import { useSidebarControl } from 'vitepress/dist/client/theme-default/composables/sidebar'
|
|
7
|
-
import { computed, provide, useSlots, watch } from 'vue'
|
|
8
|
-
import { useCloseSidebarOnEscape } from '../hooks/useSidebar'
|
|
9
|
-
import Content from './Content.vue'
|
|
10
|
-
import LocalNav from './LocalNav.vue'
|
|
11
|
-
import Nav from './Nav.vue'
|
|
12
|
-
import Sidebar from './Sidebar.vue'
|
|
13
|
-
|
|
14
|
-
const { frontmatter } = useData()
|
|
15
|
-
|
|
16
|
-
useCloseSidebarOnEscape()
|
|
17
|
-
const {
|
|
18
|
-
isOpen: isSidebarOpen,
|
|
19
|
-
open: openSidebar,
|
|
20
|
-
close: closeSidebar,
|
|
21
|
-
} = useSidebarControl()
|
|
22
|
-
|
|
23
|
-
const route = useRoute()
|
|
24
|
-
watch(() => route.path, closeSidebar)
|
|
25
|
-
|
|
26
|
-
registerWatchers({ closeSidebar })
|
|
27
|
-
|
|
28
|
-
const slots = useSlots()
|
|
29
|
-
const heroImageSlotExists = computed(() => !!slots['home-hero-image'])
|
|
30
|
-
|
|
31
|
-
provide(layoutInfoInjectionKey, heroImageSlotExists)
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<template>
|
|
35
|
-
<div v-if="frontmatter.layout !== false" class="Layout VMLayout" :class="frontmatter.pageClass">
|
|
36
|
-
<slot name="layout-top" />
|
|
37
|
-
<VPSkipLink />
|
|
38
|
-
<VPBackdrop class="backdrop" :show="isSidebarOpen" @click="closeSidebar()" />
|
|
39
|
-
<Nav>
|
|
40
|
-
<template #nav-bar-title-before>
|
|
41
|
-
<slot name="nav-bar-title-before" />
|
|
42
|
-
</template>
|
|
43
|
-
<template #nav-bar-title-after>
|
|
44
|
-
<slot name="nav-bar-title-after" />
|
|
45
|
-
</template>
|
|
46
|
-
<template #nav-bar-content-before>
|
|
47
|
-
<slot name="nav-bar-content-before" />
|
|
48
|
-
</template>
|
|
49
|
-
<template #nav-bar-content-after>
|
|
50
|
-
<slot name="nav-bar-content-after" />
|
|
51
|
-
</template>
|
|
52
|
-
<template #nav-screen-content-before>
|
|
53
|
-
<slot name="nav-screen-content-before" />
|
|
54
|
-
</template>
|
|
55
|
-
<template #nav-screen-content-after>
|
|
56
|
-
<slot name="nav-screen-content-after" />
|
|
57
|
-
</template>
|
|
58
|
-
</Nav>
|
|
59
|
-
<LocalNav :open="isSidebarOpen" @open-menu="openSidebar" />
|
|
60
|
-
|
|
61
|
-
<Sidebar :open="isSidebarOpen">
|
|
62
|
-
<template #sidebar-nav-before>
|
|
63
|
-
<slot name="sidebar-nav-before" />
|
|
64
|
-
</template>
|
|
65
|
-
<template #sidebar-nav-after>
|
|
66
|
-
<slot name="sidebar-nav-after" />
|
|
67
|
-
</template>
|
|
68
|
-
</Sidebar>
|
|
69
|
-
|
|
70
|
-
<Content>
|
|
71
|
-
<template #page-top>
|
|
72
|
-
<slot name="page-top" />
|
|
73
|
-
</template>
|
|
74
|
-
<template #page-bottom>
|
|
75
|
-
<slot name="page-bottom" />
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<template #not-found>
|
|
79
|
-
<slot name="not-found" />
|
|
80
|
-
</template>
|
|
81
|
-
<template #home-hero-before>
|
|
82
|
-
<slot name="home-hero-before" />
|
|
83
|
-
</template>
|
|
84
|
-
<template #home-hero-info-before>
|
|
85
|
-
<slot name="home-hero-info-before" />
|
|
86
|
-
</template>
|
|
87
|
-
<template #home-hero-info>
|
|
88
|
-
<slot name="home-hero-info" />
|
|
89
|
-
</template>
|
|
90
|
-
<template #home-hero-info-after>
|
|
91
|
-
<slot name="home-hero-info-after" />
|
|
92
|
-
</template>
|
|
93
|
-
<template #home-hero-actions-after>
|
|
94
|
-
<slot name="home-hero-actions-after" />
|
|
95
|
-
</template>
|
|
96
|
-
<template #home-hero-image>
|
|
97
|
-
<slot name="home-hero-image" />
|
|
98
|
-
</template>
|
|
99
|
-
<template #home-hero-after>
|
|
100
|
-
<slot name="home-hero-after" />
|
|
101
|
-
</template>
|
|
102
|
-
<template #home-features-before>
|
|
103
|
-
<slot name="home-features-before" />
|
|
104
|
-
</template>
|
|
105
|
-
<template #home-features-after>
|
|
106
|
-
<slot name="home-features-after" />
|
|
107
|
-
</template>
|
|
108
|
-
|
|
109
|
-
<template #doc-footer-before>
|
|
110
|
-
<slot name="doc-footer-before" />
|
|
111
|
-
</template>
|
|
112
|
-
<template #doc-before>
|
|
113
|
-
<slot name="doc-before" />
|
|
114
|
-
</template>
|
|
115
|
-
<template #doc-after>
|
|
116
|
-
<slot name="doc-after" />
|
|
117
|
-
</template>
|
|
118
|
-
<template #doc-top>
|
|
119
|
-
<slot name="doc-top" />
|
|
120
|
-
</template>
|
|
121
|
-
<template #doc-bottom>
|
|
122
|
-
<slot name="doc-bottom" />
|
|
123
|
-
</template>
|
|
124
|
-
|
|
125
|
-
<template #aside-top>
|
|
126
|
-
<slot name="aside-top" />
|
|
127
|
-
</template>
|
|
128
|
-
<template #aside-bottom>
|
|
129
|
-
<slot name="aside-bottom" />
|
|
130
|
-
</template>
|
|
131
|
-
<template #aside-outline-before>
|
|
132
|
-
<slot name="aside-outline-before" />
|
|
133
|
-
</template>
|
|
134
|
-
<template #aside-outline-after>
|
|
135
|
-
<slot name="aside-outline-after" />
|
|
136
|
-
</template>
|
|
137
|
-
<template #aside-ads-before>
|
|
138
|
-
<slot name="aside-ads-before" />
|
|
139
|
-
</template>
|
|
140
|
-
<template #aside-ads-after>
|
|
141
|
-
<slot name="aside-ads-after" />
|
|
142
|
-
</template>
|
|
143
|
-
</Content>
|
|
144
|
-
|
|
145
|
-
<slot name="layout-bottom" />
|
|
146
|
-
</div>
|
|
147
|
-
<Content v-else />
|
|
148
|
-
</template>
|
|
149
|
-
|
|
150
|
-
<style scoped lang="scss">
|
|
151
|
-
.Layout {
|
|
152
|
-
display: flex;
|
|
153
|
-
flex-direction: column;
|
|
154
|
-
min-height: 100vh;
|
|
155
|
-
}
|
|
156
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useData, useRoute } from 'vitepress'
|
|
3
|
+
import VPBackdrop from 'vitepress/dist/client/theme-default/components/VPBackdrop.vue'
|
|
4
|
+
import VPSkipLink from 'vitepress/dist/client/theme-default/components/VPSkipLink.vue'
|
|
5
|
+
import { layoutInfoInjectionKey, registerWatchers } from 'vitepress/dist/client/theme-default/composables/layout'
|
|
6
|
+
import { useSidebarControl } from 'vitepress/dist/client/theme-default/composables/sidebar'
|
|
7
|
+
import { computed, provide, useSlots, watch } from 'vue'
|
|
8
|
+
import { useCloseSidebarOnEscape } from '../hooks/useSidebar'
|
|
9
|
+
import Content from './Content.vue'
|
|
10
|
+
import LocalNav from './LocalNav.vue'
|
|
11
|
+
import Nav from './Nav.vue'
|
|
12
|
+
import Sidebar from './Sidebar.vue'
|
|
13
|
+
|
|
14
|
+
const { frontmatter } = useData()
|
|
15
|
+
|
|
16
|
+
useCloseSidebarOnEscape()
|
|
17
|
+
const {
|
|
18
|
+
isOpen: isSidebarOpen,
|
|
19
|
+
open: openSidebar,
|
|
20
|
+
close: closeSidebar,
|
|
21
|
+
} = useSidebarControl()
|
|
22
|
+
|
|
23
|
+
const route = useRoute()
|
|
24
|
+
watch(() => route.path, closeSidebar)
|
|
25
|
+
|
|
26
|
+
registerWatchers({ closeSidebar })
|
|
27
|
+
|
|
28
|
+
const slots = useSlots()
|
|
29
|
+
const heroImageSlotExists = computed(() => !!slots['home-hero-image'])
|
|
30
|
+
|
|
31
|
+
provide(layoutInfoInjectionKey, heroImageSlotExists)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<div v-if="frontmatter.layout !== false" class="Layout VMLayout" :class="frontmatter.pageClass">
|
|
36
|
+
<slot name="layout-top" />
|
|
37
|
+
<VPSkipLink />
|
|
38
|
+
<VPBackdrop class="backdrop" :show="isSidebarOpen" @click="closeSidebar()" />
|
|
39
|
+
<Nav>
|
|
40
|
+
<template #nav-bar-title-before>
|
|
41
|
+
<slot name="nav-bar-title-before" />
|
|
42
|
+
</template>
|
|
43
|
+
<template #nav-bar-title-after>
|
|
44
|
+
<slot name="nav-bar-title-after" />
|
|
45
|
+
</template>
|
|
46
|
+
<template #nav-bar-content-before>
|
|
47
|
+
<slot name="nav-bar-content-before" />
|
|
48
|
+
</template>
|
|
49
|
+
<template #nav-bar-content-after>
|
|
50
|
+
<slot name="nav-bar-content-after" />
|
|
51
|
+
</template>
|
|
52
|
+
<template #nav-screen-content-before>
|
|
53
|
+
<slot name="nav-screen-content-before" />
|
|
54
|
+
</template>
|
|
55
|
+
<template #nav-screen-content-after>
|
|
56
|
+
<slot name="nav-screen-content-after" />
|
|
57
|
+
</template>
|
|
58
|
+
</Nav>
|
|
59
|
+
<LocalNav :open="isSidebarOpen" @open-menu="openSidebar" />
|
|
60
|
+
|
|
61
|
+
<Sidebar :open="isSidebarOpen">
|
|
62
|
+
<template #sidebar-nav-before>
|
|
63
|
+
<slot name="sidebar-nav-before" />
|
|
64
|
+
</template>
|
|
65
|
+
<template #sidebar-nav-after>
|
|
66
|
+
<slot name="sidebar-nav-after" />
|
|
67
|
+
</template>
|
|
68
|
+
</Sidebar>
|
|
69
|
+
|
|
70
|
+
<Content>
|
|
71
|
+
<template #page-top>
|
|
72
|
+
<slot name="page-top" />
|
|
73
|
+
</template>
|
|
74
|
+
<template #page-bottom>
|
|
75
|
+
<slot name="page-bottom" />
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template #not-found>
|
|
79
|
+
<slot name="not-found" />
|
|
80
|
+
</template>
|
|
81
|
+
<template #home-hero-before>
|
|
82
|
+
<slot name="home-hero-before" />
|
|
83
|
+
</template>
|
|
84
|
+
<template #home-hero-info-before>
|
|
85
|
+
<slot name="home-hero-info-before" />
|
|
86
|
+
</template>
|
|
87
|
+
<template #home-hero-info>
|
|
88
|
+
<slot name="home-hero-info" />
|
|
89
|
+
</template>
|
|
90
|
+
<template #home-hero-info-after>
|
|
91
|
+
<slot name="home-hero-info-after" />
|
|
92
|
+
</template>
|
|
93
|
+
<template #home-hero-actions-after>
|
|
94
|
+
<slot name="home-hero-actions-after" />
|
|
95
|
+
</template>
|
|
96
|
+
<template #home-hero-image>
|
|
97
|
+
<slot name="home-hero-image" />
|
|
98
|
+
</template>
|
|
99
|
+
<template #home-hero-after>
|
|
100
|
+
<slot name="home-hero-after" />
|
|
101
|
+
</template>
|
|
102
|
+
<template #home-features-before>
|
|
103
|
+
<slot name="home-features-before" />
|
|
104
|
+
</template>
|
|
105
|
+
<template #home-features-after>
|
|
106
|
+
<slot name="home-features-after" />
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<template #doc-footer-before>
|
|
110
|
+
<slot name="doc-footer-before" />
|
|
111
|
+
</template>
|
|
112
|
+
<template #doc-before>
|
|
113
|
+
<slot name="doc-before" />
|
|
114
|
+
</template>
|
|
115
|
+
<template #doc-after>
|
|
116
|
+
<slot name="doc-after" />
|
|
117
|
+
</template>
|
|
118
|
+
<template #doc-top>
|
|
119
|
+
<slot name="doc-top" />
|
|
120
|
+
</template>
|
|
121
|
+
<template #doc-bottom>
|
|
122
|
+
<slot name="doc-bottom" />
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<template #aside-top>
|
|
126
|
+
<slot name="aside-top" />
|
|
127
|
+
</template>
|
|
128
|
+
<template #aside-bottom>
|
|
129
|
+
<slot name="aside-bottom" />
|
|
130
|
+
</template>
|
|
131
|
+
<template #aside-outline-before>
|
|
132
|
+
<slot name="aside-outline-before" />
|
|
133
|
+
</template>
|
|
134
|
+
<template #aside-outline-after>
|
|
135
|
+
<slot name="aside-outline-after" />
|
|
136
|
+
</template>
|
|
137
|
+
<template #aside-ads-before>
|
|
138
|
+
<slot name="aside-ads-before" />
|
|
139
|
+
</template>
|
|
140
|
+
<template #aside-ads-after>
|
|
141
|
+
<slot name="aside-ads-after" />
|
|
142
|
+
</template>
|
|
143
|
+
</Content>
|
|
144
|
+
|
|
145
|
+
<slot name="layout-bottom" />
|
|
146
|
+
</div>
|
|
147
|
+
<Content v-else />
|
|
148
|
+
</template>
|
|
149
|
+
|
|
150
|
+
<style scoped lang="scss">
|
|
151
|
+
.Layout {
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
min-height: 100vh;
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ElIcon } from 'element-plus'
|
|
3
|
-
import { EXTERNAL_URL_RE } from 'vitepress/dist/client/shared.js'
|
|
4
|
-
import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js'
|
|
5
|
-
import { computed } from 'vue'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
8
|
-
tag?: string
|
|
9
|
-
href?: string
|
|
10
|
-
noIcon?: boolean
|
|
11
|
-
target?: string
|
|
12
|
-
rel?: string
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const tag = computed(() => props.tag ?? (props.href ? 'a' : 'span'))
|
|
16
|
-
const isExternal = computed(
|
|
17
|
-
() =>
|
|
18
|
-
(props.href && EXTERNAL_URL_RE.test(props.href))
|
|
19
|
-
|| props.target === '_blank',
|
|
20
|
-
)
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<component
|
|
25
|
-
:is="tag"
|
|
26
|
-
class="VPLink"
|
|
27
|
-
:class="{
|
|
28
|
-
'link': href,
|
|
29
|
-
'vp-external-link-icon': isExternal,
|
|
30
|
-
'no-icon': noIcon,
|
|
31
|
-
}"
|
|
32
|
-
:href="href ? normalizeLink(href) : undefined"
|
|
33
|
-
:target="target ?? (isExternal ? '_blank' : undefined)"
|
|
34
|
-
:rel="rel ?? (isExternal ? 'noreferrer' : undefined)"
|
|
35
|
-
>
|
|
36
|
-
<slot />
|
|
37
|
-
<ElIcon v-if="href && isExternal && !noIcon">
|
|
38
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z" /></svg>
|
|
39
|
-
</ElIcon>
|
|
40
|
-
</component>
|
|
41
|
-
</template>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ElIcon } from 'element-plus'
|
|
3
|
+
import { EXTERNAL_URL_RE } from 'vitepress/dist/client/shared.js'
|
|
4
|
+
import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
tag?: string
|
|
9
|
+
href?: string
|
|
10
|
+
noIcon?: boolean
|
|
11
|
+
target?: string
|
|
12
|
+
rel?: string
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const tag = computed(() => props.tag ?? (props.href ? 'a' : 'span'))
|
|
16
|
+
const isExternal = computed(
|
|
17
|
+
() =>
|
|
18
|
+
(props.href && EXTERNAL_URL_RE.test(props.href))
|
|
19
|
+
|| props.target === '_blank',
|
|
20
|
+
)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<component
|
|
25
|
+
:is="tag"
|
|
26
|
+
class="VPLink"
|
|
27
|
+
:class="{
|
|
28
|
+
'link': href,
|
|
29
|
+
'vp-external-link-icon': isExternal,
|
|
30
|
+
'no-icon': noIcon,
|
|
31
|
+
}"
|
|
32
|
+
:href="href ? normalizeLink(href) : undefined"
|
|
33
|
+
:target="target ?? (isExternal ? '_blank' : undefined)"
|
|
34
|
+
:rel="rel ?? (isExternal ? 'noreferrer' : undefined)"
|
|
35
|
+
>
|
|
36
|
+
<slot />
|
|
37
|
+
<ElIcon v-if="href && isExternal && !noIcon">
|
|
38
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z" /></svg>
|
|
39
|
+
</ElIcon>
|
|
40
|
+
</component>
|
|
41
|
+
</template>
|