vitepress-theme-element-plus 1.3.1 → 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 +116 -116
  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,145 +1,145 @@
1
- <script setup lang="ts">
2
- import type { MenuItem } from '../utils/client/outline'
3
- import { ElAnchor, ElAnchorLink } from 'element-plus'
4
- import { onContentUpdated, useData } from 'vitepress'
5
- import { shallowRef } from 'vue'
6
- import {
7
- getHeaders,
8
-
9
- resolveTitle,
10
- } from '../utils/client/outline'
11
- import 'element-plus/dist/index.css'
12
-
13
- const { frontmatter, theme } = useData()
14
-
15
- const headers = shallowRef<MenuItem[]>([])
16
-
17
- onContentUpdated(() => {
18
- headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline)
19
- })
20
- </script>
21
-
22
- <template>
23
- <nav
24
- aria-labelledby="doc-outline-aria-label"
25
- class="VPDocAsideOutline"
26
- :class="{ 'has-outline': headers.length > 0 }"
27
- >
28
- <div class="content">
29
- <div
30
- id="doc-outline-aria-label"
31
- aria-level="2"
32
- class="outline-title"
33
- role="heading"
34
- >
35
- {{ resolveTitle(theme) }}
36
- </div>
37
- <ElAnchor :offset="70" :bound="120">
38
- <ElAnchorLink
39
- v-for="item in headers"
40
- :key="item.link"
41
- :href="item.link"
42
- :title="item.title"
43
- >
44
- <template #default>
45
- <span class="outline-link">
46
- <span
47
- class="outline-link__text"
48
- v-text="item.title"
49
- />
50
- <span
51
- v-if="item.titleTags.length"
52
- class="outline-link__tags"
53
- >
54
- <span
55
- v-for="(tagHTML, tagIndex) in item.titleTags"
56
- :key="`${item.link}-tag-${tagIndex}`"
57
- class="outline-link__tag"
58
- v-html="tagHTML"
59
- />
60
- </span>
61
- </span>
62
- </template>
63
- <template v-if="item.children && item.children.length" #sub-link>
64
- <ElAnchorLink
65
- v-for="child in item.children"
66
- :key="child.link"
67
- :href="child.link"
68
- :title="child.title"
69
- >
70
- <template #default>
71
- <span class="outline-link">
72
- <span
73
- class="outline-link__text"
74
- v-text="child.title"
75
- />
76
- <template v-if="child.titleTags.length">
77
- <span
78
- v-for="(tagHTML, tagIndex) in child.titleTags"
79
- :key="`${child.link}-tag-${tagIndex}`"
80
- v-html="tagHTML"
81
- />
82
- </template>
83
- </span>
84
- </template>
85
- </ElAnchorLink>
86
- </template>
87
- </ElAnchorLink>
88
- </ElAnchor>
89
- </div>
90
- </nav>
91
- </template>
92
-
93
- <style scoped lang="scss">
94
- .VPDocAsideOutline {
95
- display: none;
96
- }
97
-
98
- .VPDocAsideOutline.has-outline {
99
- display: block;
100
-
101
- & :deep(.el-anchor) {
102
- --el-anchor-active-color: var(--vp-c-brand);
103
- --el-anchor-marker-bg-color: var(--vp-c-brand);
104
- }
105
- }
106
-
107
- .content {
108
- position: relative;
109
- font-size: 13px;
110
- font-weight: 500;
111
- }
112
-
113
- .outline-title {
114
- font-size: 12px;
115
- line-height: 30px;
116
- padding-left: 14px;
117
- color: var(--text-color-light);
118
- font-weight: 600;
119
- text-transform: uppercase;
120
- margin-top: 0px;
121
- }
122
-
123
- .outline-link {
124
- color: inherit;
125
- width: 100%;
126
- display: inline-flex;
127
- }
128
-
129
- .outline-link__text {
130
- min-width: 0;
131
- overflow: hidden;
132
- text-overflow: ellipsis;
133
- white-space: nowrap;
134
- }
135
-
136
- :deep(.el-tag) {
137
- transform: scale(0.75);
138
- margin-left: -4px;
139
- margin-right: -4px;
140
- }
141
-
142
- :deep(.vp-tag) {
143
- margin-left: 6px;
144
- }
145
- </style>
1
+ <script setup lang="ts">
2
+ import type { MenuItem } from '../utils/client/outline'
3
+ import { ElAnchor, ElAnchorLink } from 'element-plus'
4
+ import { onContentUpdated, useData } from 'vitepress'
5
+ import { shallowRef } from 'vue'
6
+ import {
7
+ getHeaders,
8
+
9
+ resolveTitle,
10
+ } from '../utils/client/outline'
11
+ import 'element-plus/dist/index.css'
12
+
13
+ const { frontmatter, theme } = useData()
14
+
15
+ const headers = shallowRef<MenuItem[]>([])
16
+
17
+ onContentUpdated(() => {
18
+ headers.value = getHeaders(frontmatter.value.outline ?? theme.value.outline)
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <nav
24
+ aria-labelledby="doc-outline-aria-label"
25
+ class="VPDocAsideOutline"
26
+ :class="{ 'has-outline': headers.length > 0 }"
27
+ >
28
+ <div class="content">
29
+ <div
30
+ id="doc-outline-aria-label"
31
+ aria-level="2"
32
+ class="outline-title"
33
+ role="heading"
34
+ >
35
+ {{ resolveTitle(theme) }}
36
+ </div>
37
+ <ElAnchor :offset="70" :bound="120">
38
+ <ElAnchorLink
39
+ v-for="item in headers"
40
+ :key="item.link"
41
+ :href="item.link"
42
+ :title="item.title"
43
+ >
44
+ <template #default>
45
+ <span class="outline-link">
46
+ <span
47
+ class="outline-link__text"
48
+ v-text="item.title"
49
+ />
50
+ <span
51
+ v-if="item.titleTags.length"
52
+ class="outline-link__tags"
53
+ >
54
+ <span
55
+ v-for="(tagHTML, tagIndex) in item.titleTags"
56
+ :key="`${item.link}-tag-${tagIndex}`"
57
+ class="outline-link__tag"
58
+ v-html="tagHTML"
59
+ />
60
+ </span>
61
+ </span>
62
+ </template>
63
+ <template v-if="item.children && item.children.length" #sub-link>
64
+ <ElAnchorLink
65
+ v-for="child in item.children"
66
+ :key="child.link"
67
+ :href="child.link"
68
+ :title="child.title"
69
+ >
70
+ <template #default>
71
+ <span class="outline-link">
72
+ <span
73
+ class="outline-link__text"
74
+ v-text="child.title"
75
+ />
76
+ <template v-if="child.titleTags.length">
77
+ <span
78
+ v-for="(tagHTML, tagIndex) in child.titleTags"
79
+ :key="`${child.link}-tag-${tagIndex}`"
80
+ v-html="tagHTML"
81
+ />
82
+ </template>
83
+ </span>
84
+ </template>
85
+ </ElAnchorLink>
86
+ </template>
87
+ </ElAnchorLink>
88
+ </ElAnchor>
89
+ </div>
90
+ </nav>
91
+ </template>
92
+
93
+ <style scoped lang="scss">
94
+ .VPDocAsideOutline {
95
+ display: none;
96
+ }
97
+
98
+ .VPDocAsideOutline.has-outline {
99
+ display: block;
100
+
101
+ & :deep(.el-anchor) {
102
+ --el-anchor-active-color: var(--vp-c-brand);
103
+ --el-anchor-marker-bg-color: var(--vp-c-brand);
104
+ }
105
+ }
106
+
107
+ .content {
108
+ position: relative;
109
+ font-size: 13px;
110
+ font-weight: 500;
111
+ }
112
+
113
+ .outline-title {
114
+ font-size: 12px;
115
+ line-height: 30px;
116
+ padding-left: 14px;
117
+ color: var(--text-color-light);
118
+ font-weight: 600;
119
+ text-transform: uppercase;
120
+ margin-top: 0px;
121
+ }
122
+
123
+ .outline-link {
124
+ color: inherit;
125
+ width: 100%;
126
+ display: inline-flex;
127
+ }
128
+
129
+ .outline-link__text {
130
+ min-width: 0;
131
+ overflow: hidden;
132
+ text-overflow: ellipsis;
133
+ white-space: nowrap;
134
+ }
135
+
136
+ :deep(.el-tag) {
137
+ transform: scale(0.75);
138
+ margin-left: -4px;
139
+ margin-right: -4px;
140
+ }
141
+
142
+ :deep(.vp-tag) {
143
+ margin-left: 6px;
144
+ }
145
+ </style>
@@ -1,162 +1,162 @@
1
- <script setup lang="ts">
2
- import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
3
- import { ElIcon } from 'element-plus'
4
- import { useData } from 'vitepress'
5
- import VPDocFooterLastUpdated from 'vitepress/dist/client/theme-default/components/VPDocFooterLastUpdated.vue'
6
- import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
7
- import { useEditLink } from 'vitepress/dist/client/theme-default/composables/edit-link.js'
8
- import { usePrevNext } from 'vitepress/dist/client/theme-default/composables/prev-next.js'
9
- import { computed } from 'vue'
10
-
11
- const { theme, page, frontmatter } = useData()
12
-
13
- const editLink = useEditLink()
14
- const control = usePrevNext()
15
-
16
- const hasEditLink = computed(
17
- () => theme.value.editLink && frontmatter.value.editLink !== false,
18
- )
19
- const hasLastUpdated = computed(() => page.value.lastUpdated)
20
- const showFooter = computed(
21
- () =>
22
- hasEditLink.value
23
- || hasLastUpdated.value
24
- || control.value.prev
25
- || control.value.next,
26
- )
27
- </script>
28
-
29
- <template>
30
- <footer v-if="showFooter" class="VPDocFooter">
31
- <slot name="doc-footer-before" />
32
-
33
- <div v-if="hasEditLink || hasLastUpdated" class="edit-info">
34
- <div v-if="hasEditLink" class="edit-link">
35
- <VPLink class="edit-link-button" :href="editLink.url" :no-icon="true">
36
- <span class="vpi-square-pen edit-link-icon" />
37
- {{ editLink.text }}
38
- </VPLink>
39
- </div>
40
-
41
- <div v-if="hasLastUpdated" class="last-updated">
42
- <VPDocFooterLastUpdated />
43
- </div>
44
- </div>
45
-
46
- <nav
47
- v-if="control.prev?.link || control.next?.link"
48
- class="prev-next"
49
- aria-labelledby="doc-footer-aria-label"
50
- >
51
- <span id="doc-footer-aria-label" class="visually-hidden">Pager</span>
52
-
53
- <div class="pager prev">
54
- <a v-if="control.prev?.link" :href="control.prev.link">
55
- <ElIcon>
56
- <ArrowLeft />
57
- </ElIcon>
58
- <span class="title" v-html="control.prev.text" />
59
- </a>
60
- </div>
61
- <div class="pager next">
62
- <a v-if="control.next?.link" :href="control.next.link">
63
- <span class="title" v-html="control.next.text" />
64
- <ElIcon>
65
- <ArrowRight />
66
- </ElIcon>
67
- </a>
68
- </div>
69
- </nav>
70
- </footer>
71
- </template>
72
-
73
- <style scoped>
74
- .VPDocFooter {
75
- margin-top: 64px;
76
- }
77
-
78
- .edit-info {
79
- padding-bottom: 18px;
80
- }
81
-
82
- @media (min-width: 640px) {
83
- .edit-info {
84
- display: flex;
85
- justify-content: space-between;
86
- align-items: center;
87
- padding-bottom: 14px;
88
- }
89
- }
90
-
91
- .edit-link-button {
92
- display: flex;
93
- align-items: center;
94
- border: 0;
95
- line-height: 32px;
96
- font-size: 14px;
97
- font-weight: 500;
98
- color: var(--vp-c-brand);
99
- transition: color 0.25s;
100
- }
101
-
102
- .edit-link-button:hover {
103
- color: var(--vp-c-brand-2);
104
- }
105
-
106
- .edit-link-icon {
107
- margin-right: 8px;
108
- }
109
-
110
- .prev-next {
111
- display: flex;
112
- justify-content: space-between;
113
- padding-top: 16px;
114
- border-top: 1px solid var(--vp-c-divider);
115
- }
116
-
117
- .pager {
118
- display: flex;
119
- flex-shrink: 0;
120
- width: 50%;
121
- }
122
-
123
- .pager a {
124
- display: inline-flex;
125
- justify-content: center;
126
- align-items: center;
127
- max-width: 100%;
128
- height: 24px;
129
- font-size: 14px;
130
- font-weight: 500;
131
- }
132
-
133
- .pager.next {
134
- justify-content: flex-end;
135
- padding-right: 12px;
136
- }
137
-
138
- .next .el-icon {
139
- margin-left: 4px;
140
- }
141
-
142
- .pager.prev {
143
- justify-content: flex-start;
144
- padding-left: 12px;
145
- }
146
-
147
- .prev .el-icon {
148
- margin-right: 4px;
149
- }
150
-
151
- .title {
152
- display: block;
153
- line-height: 20px;
154
- font-size: 14px;
155
- font-weight: 500;
156
- color: var(--vp-c-brand);
157
- transition: color 0.25s;
158
- text-overflow: ellipsis;
159
- white-space: nowrap;
160
- overflow: hidden;
161
- }
162
- </style>
1
+ <script setup lang="ts">
2
+ import { ArrowLeft, ArrowRight } from '@element-plus/icons-vue'
3
+ import { ElIcon } from 'element-plus'
4
+ import { useData } from 'vitepress'
5
+ import VPDocFooterLastUpdated from 'vitepress/dist/client/theme-default/components/VPDocFooterLastUpdated.vue'
6
+ import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
7
+ import { useEditLink } from 'vitepress/dist/client/theme-default/composables/edit-link.js'
8
+ import { usePrevNext } from 'vitepress/dist/client/theme-default/composables/prev-next.js'
9
+ import { computed } from 'vue'
10
+
11
+ const { theme, page, frontmatter } = useData()
12
+
13
+ const editLink = useEditLink()
14
+ const control = usePrevNext()
15
+
16
+ const hasEditLink = computed(
17
+ () => theme.value.editLink && frontmatter.value.editLink !== false,
18
+ )
19
+ const hasLastUpdated = computed(() => page.value.lastUpdated)
20
+ const showFooter = computed(
21
+ () =>
22
+ hasEditLink.value
23
+ || hasLastUpdated.value
24
+ || control.value.prev
25
+ || control.value.next,
26
+ )
27
+ </script>
28
+
29
+ <template>
30
+ <footer v-if="showFooter" class="VPDocFooter">
31
+ <slot name="doc-footer-before" />
32
+
33
+ <div v-if="hasEditLink || hasLastUpdated" class="edit-info">
34
+ <div v-if="hasEditLink" class="edit-link">
35
+ <VPLink class="edit-link-button" :href="editLink.url" :no-icon="true">
36
+ <span class="vpi-square-pen edit-link-icon" />
37
+ {{ editLink.text }}
38
+ </VPLink>
39
+ </div>
40
+
41
+ <div v-if="hasLastUpdated" class="last-updated">
42
+ <VPDocFooterLastUpdated />
43
+ </div>
44
+ </div>
45
+
46
+ <nav
47
+ v-if="control.prev?.link || control.next?.link"
48
+ class="prev-next"
49
+ aria-labelledby="doc-footer-aria-label"
50
+ >
51
+ <span id="doc-footer-aria-label" class="visually-hidden">Pager</span>
52
+
53
+ <div class="pager prev">
54
+ <a v-if="control.prev?.link" :href="control.prev.link">
55
+ <ElIcon>
56
+ <ArrowLeft />
57
+ </ElIcon>
58
+ <span class="title" v-html="control.prev.text" />
59
+ </a>
60
+ </div>
61
+ <div class="pager next">
62
+ <a v-if="control.next?.link" :href="control.next.link">
63
+ <span class="title" v-html="control.next.text" />
64
+ <ElIcon>
65
+ <ArrowRight />
66
+ </ElIcon>
67
+ </a>
68
+ </div>
69
+ </nav>
70
+ </footer>
71
+ </template>
72
+
73
+ <style scoped>
74
+ .VPDocFooter {
75
+ margin-top: 64px;
76
+ }
77
+
78
+ .edit-info {
79
+ padding-bottom: 18px;
80
+ }
81
+
82
+ @media (min-width: 640px) {
83
+ .edit-info {
84
+ display: flex;
85
+ justify-content: space-between;
86
+ align-items: center;
87
+ padding-bottom: 14px;
88
+ }
89
+ }
90
+
91
+ .edit-link-button {
92
+ display: flex;
93
+ align-items: center;
94
+ border: 0;
95
+ line-height: 32px;
96
+ font-size: 14px;
97
+ font-weight: 500;
98
+ color: var(--vp-c-brand);
99
+ transition: color 0.25s;
100
+ }
101
+
102
+ .edit-link-button:hover {
103
+ color: var(--vp-c-brand-2);
104
+ }
105
+
106
+ .edit-link-icon {
107
+ margin-right: 8px;
108
+ }
109
+
110
+ .prev-next {
111
+ display: flex;
112
+ justify-content: space-between;
113
+ padding-top: 16px;
114
+ border-top: 1px solid var(--vp-c-divider);
115
+ }
116
+
117
+ .pager {
118
+ display: flex;
119
+ flex-shrink: 0;
120
+ width: 50%;
121
+ }
122
+
123
+ .pager a {
124
+ display: inline-flex;
125
+ justify-content: center;
126
+ align-items: center;
127
+ max-width: 100%;
128
+ height: 24px;
129
+ font-size: 14px;
130
+ font-weight: 500;
131
+ }
132
+
133
+ .pager.next {
134
+ justify-content: flex-end;
135
+ padding-right: 12px;
136
+ }
137
+
138
+ .next .el-icon {
139
+ margin-left: 4px;
140
+ }
141
+
142
+ .pager.prev {
143
+ justify-content: flex-start;
144
+ padding-left: 12px;
145
+ }
146
+
147
+ .prev .el-icon {
148
+ margin-right: 4px;
149
+ }
150
+
151
+ .title {
152
+ display: block;
153
+ line-height: 20px;
154
+ font-size: 14px;
155
+ font-weight: 500;
156
+ color: var(--vp-c-brand);
157
+ transition: color 0.25s;
158
+ text-overflow: ellipsis;
159
+ white-space: nowrap;
160
+ overflow: hidden;
161
+ }
162
+ </style>