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,203 +1,203 @@
1
- <script lang="ts" setup>
2
- import { useWindowScroll } from '@vueuse/core'
3
- import { useData } from 'vitepress'
4
- import VPNavBarExtra from 'vitepress/dist/client/theme-default/components/VPNavBarExtra.vue'
5
- import VPNavBarHamburger from 'vitepress/dist/client/theme-default/components/VPNavBarHamburger.vue'
6
- import VPNavBarMenu from 'vitepress/dist/client/theme-default/components/VPNavBarMenu.vue'
7
- import VPNavBarSocialLinks from 'vitepress/dist/client/theme-default/components/VPNavBarSocialLinks.vue'
8
- import VPNavBarTranslations from 'vitepress/dist/client/theme-default/components/VPNavBarTranslations.vue'
9
- import { ref, watchPostEffect } from 'vue'
10
- import VPNavBarTitle from './NavBarTitle.vue'
11
- import ThemeToggler from './ThemeToggler.vue'
12
- import VPNavBarSearch from './VPNavBarSearch.vue'
13
-
14
- const props = defineProps<{
15
- isScreenOpen: boolean
16
- }>()
17
-
18
- defineEmits<{
19
- (e: 'toggleScreen'): void
20
- }>()
21
-
22
- const { y } = useWindowScroll()
23
- const { frontmatter } = useData()
24
- const classes = ref<Record<string, boolean>>({})
25
-
26
- watchPostEffect(() => {
27
- classes.value = {
28
- 'home': frontmatter.value.layout === 'home',
29
- 'top': y.value === 0,
30
- 'screen-open': props.isScreenOpen,
31
- }
32
- })
33
- </script>
34
-
35
- <template>
36
- <div class="VPNavBar" :class="classes">
37
- <div class="wrapper">
38
- <div class="container">
39
- <div class="title">
40
- <VPNavBarTitle>
41
- <template #nav-bar-title-before>
42
- <slot name="nav-bar-title-before" />
43
- </template>
44
- <template #nav-bar-title-after>
45
- <slot name="nav-bar-title-after" />
46
- </template>
47
- </VPNavBarTitle>
48
- </div>
49
-
50
- <div class="content">
51
- <div class="content-body">
52
- <slot name="nav-bar-content-before" />
53
- <VPNavBarSearch class="search" />
54
- <VPNavBarMenu class="menu" />
55
- <VPNavBarTranslations class="translations" />
56
- <ThemeToggler class="appearance" />
57
- <VPNavBarSocialLinks class="social-links" />
58
- <VPNavBarExtra class="extra" />
59
- <slot name="nav-bar-content-after" />
60
- <VPNavBarHamburger class="hamburger" :active="isScreenOpen" @click="$emit('toggleScreen')" />
61
- </div>
62
- </div>
63
- </div>
64
- </div>
65
-
66
- <div class="divider">
67
- <div class="divider-line" />
68
- </div>
69
- </div>
70
- </template>
71
-
72
- <style scoped lang="scss">
73
- .VPNavBar {
74
- position: relative;
75
- height: var(--vp-nav-height);
76
- pointer-events: none;
77
- white-space: nowrap;
78
- transition: background-color 0.25s;
79
- background-image: radial-gradient(transparent 1px, var(--vp-c-bg) 1px);
80
- background-size: 4px 4px;
81
- backdrop-filter: saturate(50%) blur(4px);
82
- -webkit-backdrop-filter: saturate(50%) blur(4px);
83
- }
84
-
85
- .VPNavBar.screen-open {
86
- transition: none;
87
- background-color: var(--vp-nav-bg-color);
88
- border-bottom: 1px solid var(--vp-c-divider);
89
- }
90
-
91
- .VPNavBar:not(.home) {
92
- background-color: var(--vp-nav-bg-color);
93
- }
94
-
95
- :deep(.VPNavBarMenuLink) {
96
- border-bottom: 2px solid transparent;
97
- }
98
-
99
- :deep(.VPNavBarMenuLink.active) {
100
- border-bottom-color: var(--vp-c-brand);
101
- }
102
-
103
- @media (min-width: 960px) {
104
- .VPNavBar:not(.home) {
105
- background-color: transparent;
106
- }
107
- }
108
-
109
- .wrapper {
110
- padding: 0 8px 0 24px;
111
- }
112
-
113
- @media (min-width: 768px) {
114
- .wrapper {
115
- padding: 0 32px;
116
- }
117
- }
118
-
119
- @media screen and (min-width: var(--vp-layout-max-width)) {
120
- .wrapper {
121
- padding: 0px 48px;
122
- }
123
- }
124
-
125
- .container {
126
- display: flex;
127
- justify-content: space-between;
128
- margin: 0 auto;
129
- height: var(--vp-nav-height);
130
- pointer-events: none;
131
- }
132
-
133
- .container > .title,
134
- .container > .content {
135
- pointer-events: none;
136
- }
137
-
138
- .container :deep(*) {
139
- pointer-events: auto;
140
- }
141
-
142
- .title {
143
- flex-shrink: 0;
144
- height: calc(var(--vp-nav-height) - 1px);
145
- transition: background-color 0.5s;
146
- }
147
-
148
- .content {
149
- flex-grow: 1;
150
- }
151
-
152
- .content-body {
153
- display: flex;
154
- justify-content: flex-end;
155
- align-items: center;
156
- height: var(--vp-nav-height);
157
- transition: background-color 0.5s;
158
- }
159
-
160
- @media (max-width: 767px) {
161
- .content-body {
162
- column-gap: 0.5rem;
163
- }
164
- }
165
-
166
- .menu + .translations::before,
167
- .menu + .appearance::before,
168
- .menu + .social-links::before,
169
- .translations + .appearance::before,
170
- .appearance + .social-links::before {
171
- margin-right: 8px;
172
- margin-left: 8px;
173
- width: 1px;
174
- height: 24px;
175
- background-color: var(--vp-c-divider);
176
- content: '';
177
- }
178
-
179
- .menu + .appearance::before,
180
- .translations + .appearance::before {
181
- margin-right: 16px;
182
- }
183
-
184
- .appearance + .social-links::before {
185
- margin-left: 16px;
186
- }
187
-
188
- .social-links {
189
- margin-right: -8px;
190
- }
191
-
192
- .divider {
193
- width: 100%;
194
- height: 1px;
195
- }
196
-
197
- .divider-line {
198
- width: 100%;
199
- height: 1px;
200
- transition: background-color 0.5s;
201
- background-color: var(--vp-c-gutter);
202
- }
203
- </style>
1
+ <script lang="ts" setup>
2
+ import { useWindowScroll } from '@vueuse/core'
3
+ import { useData } from 'vitepress'
4
+ import VPNavBarExtra from 'vitepress/dist/client/theme-default/components/VPNavBarExtra.vue'
5
+ import VPNavBarHamburger from 'vitepress/dist/client/theme-default/components/VPNavBarHamburger.vue'
6
+ import VPNavBarMenu from 'vitepress/dist/client/theme-default/components/VPNavBarMenu.vue'
7
+ import VPNavBarSocialLinks from 'vitepress/dist/client/theme-default/components/VPNavBarSocialLinks.vue'
8
+ import VPNavBarTranslations from 'vitepress/dist/client/theme-default/components/VPNavBarTranslations.vue'
9
+ import { ref, watchPostEffect } from 'vue'
10
+ import VPNavBarTitle from './NavBarTitle.vue'
11
+ import ThemeToggler from './ThemeToggler.vue'
12
+ import VPNavBarSearch from './VPNavBarSearch.vue'
13
+
14
+ const props = defineProps<{
15
+ isScreenOpen: boolean
16
+ }>()
17
+
18
+ defineEmits<{
19
+ (e: 'toggleScreen'): void
20
+ }>()
21
+
22
+ const { y } = useWindowScroll()
23
+ const { frontmatter } = useData()
24
+ const classes = ref<Record<string, boolean>>({})
25
+
26
+ watchPostEffect(() => {
27
+ classes.value = {
28
+ 'home': frontmatter.value.layout === 'home',
29
+ 'top': y.value === 0,
30
+ 'screen-open': props.isScreenOpen,
31
+ }
32
+ })
33
+ </script>
34
+
35
+ <template>
36
+ <div class="VPNavBar" :class="classes">
37
+ <div class="wrapper">
38
+ <div class="container">
39
+ <div class="title">
40
+ <VPNavBarTitle>
41
+ <template #nav-bar-title-before>
42
+ <slot name="nav-bar-title-before" />
43
+ </template>
44
+ <template #nav-bar-title-after>
45
+ <slot name="nav-bar-title-after" />
46
+ </template>
47
+ </VPNavBarTitle>
48
+ </div>
49
+
50
+ <div class="content">
51
+ <div class="content-body">
52
+ <slot name="nav-bar-content-before" />
53
+ <VPNavBarSearch class="search" />
54
+ <VPNavBarMenu class="menu" />
55
+ <VPNavBarTranslations class="translations" />
56
+ <ThemeToggler class="appearance" />
57
+ <VPNavBarSocialLinks class="social-links" />
58
+ <VPNavBarExtra class="extra" />
59
+ <slot name="nav-bar-content-after" />
60
+ <VPNavBarHamburger class="hamburger" :active="isScreenOpen" @click="$emit('toggleScreen')" />
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ <div class="divider">
67
+ <div class="divider-line" />
68
+ </div>
69
+ </div>
70
+ </template>
71
+
72
+ <style scoped lang="scss">
73
+ .VPNavBar {
74
+ position: relative;
75
+ height: var(--vp-nav-height);
76
+ pointer-events: none;
77
+ white-space: nowrap;
78
+ transition: background-color 0.25s;
79
+ background-image: radial-gradient(transparent 1px, var(--vp-c-bg) 1px);
80
+ background-size: 4px 4px;
81
+ backdrop-filter: saturate(50%) blur(4px);
82
+ -webkit-backdrop-filter: saturate(50%) blur(4px);
83
+ }
84
+
85
+ .VPNavBar.screen-open {
86
+ transition: none;
87
+ background-color: var(--vp-nav-bg-color);
88
+ border-bottom: 1px solid var(--vp-c-divider);
89
+ }
90
+
91
+ .VPNavBar:not(.home) {
92
+ background-color: var(--vp-nav-bg-color);
93
+ }
94
+
95
+ :deep(.VPNavBarMenuLink) {
96
+ border-bottom: 2px solid transparent;
97
+ }
98
+
99
+ :deep(.VPNavBarMenuLink.active) {
100
+ border-bottom-color: var(--vp-c-brand);
101
+ }
102
+
103
+ @media (min-width: 960px) {
104
+ .VPNavBar:not(.home) {
105
+ background-color: transparent;
106
+ }
107
+ }
108
+
109
+ .wrapper {
110
+ padding: 0 8px 0 24px;
111
+ }
112
+
113
+ @media (min-width: 768px) {
114
+ .wrapper {
115
+ padding: 0 32px;
116
+ }
117
+ }
118
+
119
+ @media screen and (min-width: var(--vp-layout-max-width)) {
120
+ .wrapper {
121
+ padding: 0px 48px;
122
+ }
123
+ }
124
+
125
+ .container {
126
+ display: flex;
127
+ justify-content: space-between;
128
+ margin: 0 auto;
129
+ height: var(--vp-nav-height);
130
+ pointer-events: none;
131
+ }
132
+
133
+ .container > .title,
134
+ .container > .content {
135
+ pointer-events: none;
136
+ }
137
+
138
+ .container :deep(*) {
139
+ pointer-events: auto;
140
+ }
141
+
142
+ .title {
143
+ flex-shrink: 0;
144
+ height: calc(var(--vp-nav-height) - 1px);
145
+ transition: background-color 0.5s;
146
+ }
147
+
148
+ .content {
149
+ flex-grow: 1;
150
+ }
151
+
152
+ .content-body {
153
+ display: flex;
154
+ justify-content: flex-end;
155
+ align-items: center;
156
+ height: var(--vp-nav-height);
157
+ transition: background-color 0.5s;
158
+ }
159
+
160
+ @media (max-width: 767px) {
161
+ .content-body {
162
+ column-gap: 0.5rem;
163
+ }
164
+ }
165
+
166
+ .menu + .translations::before,
167
+ .menu + .appearance::before,
168
+ .menu + .social-links::before,
169
+ .translations + .appearance::before,
170
+ .appearance + .social-links::before {
171
+ margin-right: 8px;
172
+ margin-left: 8px;
173
+ width: 1px;
174
+ height: 24px;
175
+ background-color: var(--vp-c-divider);
176
+ content: '';
177
+ }
178
+
179
+ .menu + .appearance::before,
180
+ .translations + .appearance::before {
181
+ margin-right: 16px;
182
+ }
183
+
184
+ .appearance + .social-links::before {
185
+ margin-left: 16px;
186
+ }
187
+
188
+ .social-links {
189
+ margin-right: -8px;
190
+ }
191
+
192
+ .divider {
193
+ width: 100%;
194
+ height: 1px;
195
+ }
196
+
197
+ .divider-line {
198
+ width: 100%;
199
+ height: 1px;
200
+ transition: background-color 0.5s;
201
+ background-color: var(--vp-c-gutter);
202
+ }
203
+ </style>
@@ -1,89 +1,89 @@
1
- <script setup lang="ts">
2
- import { ElTag } from 'element-plus'
3
- import { useData } from 'vitepress'
4
- import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue'
5
- import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js'
6
- import { computed } from 'vue'
7
- import { useLangs } from '../hooks/useLangs'
8
-
9
- const { site, theme } = useData()
10
- const { currentLang } = useLangs()
11
- const link = computed(() =>
12
- typeof theme.value.logoLink === 'string'
13
- ? theme.value.logoLink
14
- : theme.value.logoLink?.link,
15
- )
16
-
17
- const rel = computed(() =>
18
- typeof theme.value.logoLink === 'string'
19
- ? undefined
20
- : theme.value.logoLink?.rel,
21
- )
22
-
23
- const target = computed(() =>
24
- typeof theme.value.logoLink === 'string'
25
- ? undefined
26
- : theme.value.logoLink?.target,
27
- )
28
- </script>
29
-
30
- <template>
31
- <div class="VPNavBarTitle">
32
- <a
33
- class="title"
34
- :href="link ?? normalizeLink(currentLang.link)"
35
- :rel="rel"
36
- :target="target"
37
- >
38
- <slot name="nav-bar-title-before" />
39
- <VPImage v-if="theme.logo" class="logo" :image="theme.logo" />
40
- <span v-if="theme.siteTitle" class="site-title" v-html="theme.siteTitle" />
41
- <span v-else-if="theme.siteTitle === undefined" class="site-title">{{ site.title }}</span>
42
- <ElTag v-if="theme.version" type="primary" round>{{ theme.version }}</ElTag>
43
- <slot name="nav-bar-title-after" />
44
- </a>
45
- </div>
46
- </template>
47
-
48
- <style scoped lang="scss">
49
- .title {
50
- display: flex;
51
- align-items: center;
52
- border-bottom: 1px solid transparent;
53
- width: 100%;
54
- height: var(--vp-nav-height);
55
- font-size: 16px;
56
- color: var(--vp-c-text-1);
57
- transition: opacity 0.25s;
58
-
59
- .site-title {
60
- margin-left: 14px;
61
- }
62
- }
63
-
64
- .title .el-tag {
65
- font-weight: normal;
66
- }
67
-
68
- @media (min-width: 960px) {
69
- .title {
70
- flex-shrink: 0;
71
- }
72
- }
73
-
74
- @media (max-width: 768px) {
75
- .title .site-title {
76
- display: none;
77
- }
78
- }
79
-
80
- :deep(.logo) {
81
- height: var(--vp-nav-logo-height);
82
- }
83
-
84
- :deep(.el-tag.el-tag--primary) {
85
- background-color: var(--bg-brand-color);
86
- color: var(--vp-c-brand);
87
- margin-left: 14px;
88
- }
89
- </style>
1
+ <script setup lang="ts">
2
+ import { ElTag } from 'element-plus'
3
+ import { useData } from 'vitepress'
4
+ import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue'
5
+ import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js'
6
+ import { computed } from 'vue'
7
+ import { useLangs } from '../hooks/useLangs'
8
+
9
+ const { site, theme } = useData()
10
+ const { currentLang } = useLangs()
11
+ const link = computed(() =>
12
+ typeof theme.value.logoLink === 'string'
13
+ ? theme.value.logoLink
14
+ : theme.value.logoLink?.link,
15
+ )
16
+
17
+ const rel = computed(() =>
18
+ typeof theme.value.logoLink === 'string'
19
+ ? undefined
20
+ : theme.value.logoLink?.rel,
21
+ )
22
+
23
+ const target = computed(() =>
24
+ typeof theme.value.logoLink === 'string'
25
+ ? undefined
26
+ : theme.value.logoLink?.target,
27
+ )
28
+ </script>
29
+
30
+ <template>
31
+ <div class="VPNavBarTitle">
32
+ <a
33
+ class="title"
34
+ :href="link ?? normalizeLink(currentLang.link)"
35
+ :rel="rel"
36
+ :target="target"
37
+ >
38
+ <slot name="nav-bar-title-before" />
39
+ <VPImage v-if="theme.logo" class="logo" :image="theme.logo" />
40
+ <span v-if="theme.siteTitle" class="site-title" v-html="theme.siteTitle" />
41
+ <span v-else-if="theme.siteTitle === undefined" class="site-title">{{ site.title }}</span>
42
+ <ElTag v-if="theme.version" type="primary" round>{{ theme.version }}</ElTag>
43
+ <slot name="nav-bar-title-after" />
44
+ </a>
45
+ </div>
46
+ </template>
47
+
48
+ <style scoped lang="scss">
49
+ .title {
50
+ display: flex;
51
+ align-items: center;
52
+ border-bottom: 1px solid transparent;
53
+ width: 100%;
54
+ height: var(--vp-nav-height);
55
+ font-size: 16px;
56
+ color: var(--vp-c-text-1);
57
+ transition: opacity 0.25s;
58
+
59
+ .site-title {
60
+ margin-left: 14px;
61
+ }
62
+ }
63
+
64
+ .title .el-tag {
65
+ font-weight: normal;
66
+ }
67
+
68
+ @media (min-width: 960px) {
69
+ .title {
70
+ flex-shrink: 0;
71
+ }
72
+ }
73
+
74
+ @media (max-width: 768px) {
75
+ .title .site-title {
76
+ display: none;
77
+ }
78
+ }
79
+
80
+ :deep(.logo) {
81
+ height: var(--vp-nav-logo-height);
82
+ }
83
+
84
+ :deep(.el-tag.el-tag--primary) {
85
+ background-color: var(--bg-brand-color);
86
+ color: var(--vp-c-brand);
87
+ margin-left: 14px;
88
+ }
89
+ </style>