vitepress-theme-element-plus 1.3.0 → 1.3.2

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.
Files changed (42) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +3 -3
  3. package/client/components/A11yTag.vue +29 -29
  4. package/client/components/ApiTyping.vue +54 -54
  5. package/client/components/Backdrop.vue +41 -41
  6. package/client/components/Bili.vue +94 -94
  7. package/client/components/Content.vue +148 -148
  8. package/client/components/DeprecatedTag.vue +19 -19
  9. package/client/components/Doc.vue +185 -185
  10. package/client/components/DocAside.vue +46 -46
  11. package/client/components/DocAsideOutline.vue +145 -145
  12. package/client/components/DocFooter.vue +162 -162
  13. package/client/components/Footer.vue +100 -100
  14. package/client/components/FooterCopyright.vue +27 -27
  15. package/client/components/Layout.vue +156 -156
  16. package/client/components/Link.vue +41 -41
  17. package/client/components/LocalNav.vue +160 -160
  18. package/client/components/Nav.vue +69 -69
  19. package/client/components/NavBar.vue +203 -203
  20. package/client/components/NavBarTitle.vue +89 -89
  21. package/client/components/Sidebar.vue +129 -129
  22. package/client/components/SidebarGroup.vue +51 -51
  23. package/client/components/SidebarItem.vue +304 -304
  24. package/client/components/ThemeToggler.vue +129 -129
  25. package/client/components/VPNavBarSearch.vue +23 -23
  26. package/client/hooks/useBackTop.ts +71 -71
  27. package/client/hooks/useLangs.ts +50 -50
  28. package/client/hooks/useSidebarControl.ts +78 -78
  29. package/client/hooks/useSize.ts +69 -69
  30. package/client/icons/dark.vue +8 -8
  31. package/client/icons/light.vue +8 -8
  32. package/client/utils/client/common.ts +49 -49
  33. package/client/utils/client/outline.ts +133 -126
  34. package/client/utils/common.ts +90 -90
  35. package/index.ts +45 -45
  36. package/package.json +2 -2
  37. package/shared/constants.ts +3 -3
  38. package/styles/base.scss +105 -105
  39. package/styles/code.scss +290 -290
  40. package/styles/doc-content.scss +363 -363
  41. package/styles/index.scss +71 -71
  42. package/styles/tag-content.scss +30 -30
@@ -1,100 +1,100 @@
1
- <script lang="ts" setup>
2
- import { ElLink } from 'element-plus'
3
- import { useData } from 'vitepress'
4
- import { useLayout } from 'vitepress/theme'
5
- import { computed } from 'vue'
6
-
7
- const { isHome } = useLayout()
8
- const { theme } = useData()
9
- const blogroll = theme.value.footer?.blogroll
10
-
11
- const linkUnderline = computed(() => {
12
- const underlineProp = (ElLink as any)?.props?.underline
13
- const types = Array.isArray(underlineProp?.type)
14
- ? underlineProp.type
15
- : underlineProp?.type
16
- ? [underlineProp.type]
17
- : []
18
- return types.includes(String) ? 'never' : false
19
- })
20
- </script>
21
-
22
- <template>
23
- <footer v-if="blogroll && blogroll.length" class="footer" :class="{ 'is-home': isHome }">
24
- <div v-for="item of blogroll" :key="item.title" class="footer-main">
25
- <h4>{{ item.title }}</h4>
26
- <ElLink
27
- v-for="child of item.children"
28
- :key="child.text"
29
- class="footer-main-link"
30
- target="_blank"
31
- :href="child.link"
32
- :underline="linkUnderline"
33
- >
34
- {{ child.text }}
35
- </ElLink>
36
- </div>
37
- </footer>
38
- </template>
39
-
40
- <style lang="scss">
41
- .footer {
42
- background-color: var(--vp-c-bg-soft);
43
- box-sizing: border-box;
44
- padding: 42px 64px 64px;
45
-
46
- &.is-home {
47
- background-color: var(--bg-color);
48
- max-width: 1200px;
49
- margin: 0 auto;
50
- padding: 40px 64px;
51
- }
52
-
53
- .container {
54
- box-sizing: border-box;
55
- width: auto;
56
- }
57
-
58
- .footer-main {
59
- font-size: 0;
60
- display: inline-block;
61
- vertical-align: top;
62
- margin-right: 130px;
63
- width: 200px;
64
-
65
- h4 {
66
- font-size: 18px;
67
- line-height: 1;
68
- margin: 0 0 15px;
69
- font-weight: 400;
70
- color: var(--el-text-color-primary);
71
- }
72
-
73
- .footer-main-link {
74
- display: block;
75
- margin: 0;
76
- line-height: 2;
77
- color: var(--text-color-light);
78
-
79
- &:hover {
80
- color: var(--text-color);
81
- }
82
-
83
- & .el-link__inner {
84
- display: block;
85
- text-overflow: ellipsis;
86
- white-space: nowrap;
87
- overflow: hidden;
88
- }
89
- }
90
- }
91
- }
92
-
93
- @media (max-width: 768px) {
94
- .footer {
95
- .footer-main {
96
- margin-bottom: 30px;
97
- }
98
- }
99
- }
100
- </style>
1
+ <script lang="ts" setup>
2
+ import { ElLink } from 'element-plus'
3
+ import { useData } from 'vitepress'
4
+ import { useLayout } from 'vitepress/theme'
5
+ import { computed } from 'vue'
6
+
7
+ const { isHome } = useLayout()
8
+ const { theme } = useData()
9
+ const blogroll = theme.value.footer?.blogroll
10
+
11
+ const linkUnderline = computed(() => {
12
+ const underlineProp = (ElLink as any)?.props?.underline
13
+ const types = Array.isArray(underlineProp?.type)
14
+ ? underlineProp.type
15
+ : underlineProp?.type
16
+ ? [underlineProp.type]
17
+ : []
18
+ return types.includes(String) ? 'never' : false
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <footer v-if="blogroll && blogroll.length" class="footer" :class="{ 'is-home': isHome }">
24
+ <div v-for="item of blogroll" :key="item.title" class="footer-main">
25
+ <h4>{{ item.title }}</h4>
26
+ <ElLink
27
+ v-for="child of item.children"
28
+ :key="child.text"
29
+ class="footer-main-link"
30
+ target="_blank"
31
+ :href="child.link"
32
+ :underline="linkUnderline"
33
+ >
34
+ {{ child.text }}
35
+ </ElLink>
36
+ </div>
37
+ </footer>
38
+ </template>
39
+
40
+ <style lang="scss">
41
+ .footer {
42
+ background-color: var(--vp-c-bg-soft);
43
+ box-sizing: border-box;
44
+ padding: 42px 64px 64px;
45
+
46
+ &.is-home {
47
+ background-color: var(--bg-color);
48
+ max-width: 1200px;
49
+ margin: 0 auto;
50
+ padding: 40px 64px;
51
+ }
52
+
53
+ .container {
54
+ box-sizing: border-box;
55
+ width: auto;
56
+ }
57
+
58
+ .footer-main {
59
+ font-size: 0;
60
+ display: inline-block;
61
+ vertical-align: top;
62
+ margin-right: 130px;
63
+ width: 200px;
64
+
65
+ h4 {
66
+ font-size: 18px;
67
+ line-height: 1;
68
+ margin: 0 0 15px;
69
+ font-weight: 400;
70
+ color: var(--el-text-color-primary);
71
+ }
72
+
73
+ .footer-main-link {
74
+ display: block;
75
+ margin: 0;
76
+ line-height: 2;
77
+ color: var(--text-color-light);
78
+
79
+ &:hover {
80
+ color: var(--text-color);
81
+ }
82
+
83
+ & .el-link__inner {
84
+ display: block;
85
+ text-overflow: ellipsis;
86
+ white-space: nowrap;
87
+ overflow: hidden;
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ @media (max-width: 768px) {
94
+ .footer {
95
+ .footer-main {
96
+ margin-bottom: 30px;
97
+ }
98
+ }
99
+ }
100
+ </style>
@@ -1,27 +1,27 @@
1
- <script lang="ts" setup>
2
- import { ElDivider } from 'element-plus'
3
- import { useData } from 'vitepress'
4
-
5
- const { theme } = useData()
6
- </script>
7
-
8
- <template>
9
- <template v-if="theme.footer?.message || theme.footer?.copyright">
10
- <ElDivider style="margin-bottom: 0px" />
11
- <div class="footer-copyright">
12
- <p>{{ theme.footer?.message }}</p>
13
- <p>{{ theme.footer?.copyright }}</p>
14
- </div>
15
- </template>
16
- </template>
17
-
18
- <style scoped lang="scss">
19
- .footer-copyright {
20
- display: flex;
21
- flex-direction: column;
22
- align-items: center;
23
- padding: 24px 0;
24
- font-size: 12px;
25
- line-height: 24px;
26
- }
27
- </style>
1
+ <script lang="ts" setup>
2
+ import { ElDivider } from 'element-plus'
3
+ import { useData } from 'vitepress'
4
+
5
+ const { theme } = useData()
6
+ </script>
7
+
8
+ <template>
9
+ <template v-if="theme.footer?.message || theme.footer?.copyright">
10
+ <ElDivider style="margin-bottom: 0px" />
11
+ <div class="footer-copyright">
12
+ <p>{{ theme.footer?.message }}</p>
13
+ <p>{{ theme.footer?.copyright }}</p>
14
+ </div>
15
+ </template>
16
+ </template>
17
+
18
+ <style scoped lang="scss">
19
+ .footer-copyright {
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: center;
23
+ padding: 24px 0;
24
+ font-size: 12px;
25
+ line-height: 24px;
26
+ }
27
+ </style>
@@ -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.js'
6
- import { useSidebarControl } from 'vitepress/dist/client/theme-default/composables/sidebar.js'
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.js'
6
+ import { useSidebarControl } from 'vitepress/dist/client/theme-default/composables/sidebar.js'
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>