vitepress-theme-element-plus 0.0.3 → 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.
Files changed (41) hide show
  1. package/README.md +3 -3
  2. package/client/components/A11yTag.vue +29 -29
  3. package/client/components/ApiTyping.vue +54 -54
  4. package/client/components/Backdrop.vue +41 -41
  5. package/client/components/Bili.vue +94 -94
  6. package/client/components/Content.vue +148 -150
  7. package/client/components/DeprecatedTag.vue +19 -19
  8. package/client/components/Doc.vue +181 -181
  9. package/client/components/DocAside.vue +46 -46
  10. package/client/components/DocAsideOutline.vue +82 -82
  11. package/client/components/DocFooter.vue +159 -159
  12. package/client/components/Footer.vue +77 -77
  13. package/client/components/FooterCopyright.vue +27 -27
  14. package/client/components/Layout.vue +156 -156
  15. package/client/components/Link.vue +41 -41
  16. package/client/components/LocalNav.vue +160 -160
  17. package/client/components/Nav.vue +69 -69
  18. package/client/components/NavBar.vue +203 -203
  19. package/client/components/NavBarTitle.vue +75 -75
  20. package/client/components/Sidebar.vue +129 -129
  21. package/client/components/SidebarGroup.vue +51 -51
  22. package/client/components/SidebarItem.vue +302 -302
  23. package/client/components/Tag.vue +25 -25
  24. package/client/components/VPNavBarSearch.vue +23 -23
  25. package/client/components/VersionTag.vue +18 -18
  26. package/client/hooks/useBackTop.ts +71 -71
  27. package/client/hooks/useLangs.ts +50 -50
  28. package/client/hooks/useSidebar.ts +93 -18
  29. package/client/hooks/useSidebarControl.ts +78 -78
  30. package/client/hooks/useSize.ts +69 -69
  31. package/client/utils/client/common.ts +49 -49
  32. package/client/utils/client/outline.ts +113 -113
  33. package/client/utils/common.ts +90 -90
  34. package/index.ts +26 -26
  35. package/package.json +73 -73
  36. package/shared/constants.ts +3 -3
  37. package/styles/base.scss +37 -37
  38. package/styles/code.scss +282 -282
  39. package/styles/doc-content.scss +161 -161
  40. package/styles/index.scss +69 -69
  41. 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 VPNavBarAppearance from 'vitepress/dist/client/theme-default/components/VPNavBarAppearance.vue'
5
- import VPNavBarExtra from 'vitepress/dist/client/theme-default/components/VPNavBarExtra.vue'
6
- import VPNavBarHamburger from 'vitepress/dist/client/theme-default/components/VPNavBarHamburger.vue'
7
- import VPNavBarMenu from 'vitepress/dist/client/theme-default/components/VPNavBarMenu.vue'
8
- import VPNavBarSocialLinks from 'vitepress/dist/client/theme-default/components/VPNavBarSocialLinks.vue'
9
- import VPNavBarTranslations from 'vitepress/dist/client/theme-default/components/VPNavBarTranslations.vue'
10
- import { ref, watchPostEffect } from 'vue'
11
- import VPNavBarTitle from './NavBarTitle.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
- <VPNavBarAppearance 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-1);
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 VPNavBarAppearance from 'vitepress/dist/client/theme-default/components/VPNavBarAppearance.vue'
5
+ import VPNavBarExtra from 'vitepress/dist/client/theme-default/components/VPNavBarExtra.vue'
6
+ import VPNavBarHamburger from 'vitepress/dist/client/theme-default/components/VPNavBarHamburger.vue'
7
+ import VPNavBarMenu from 'vitepress/dist/client/theme-default/components/VPNavBarMenu.vue'
8
+ import VPNavBarSocialLinks from 'vitepress/dist/client/theme-default/components/VPNavBarSocialLinks.vue'
9
+ import VPNavBarTranslations from 'vitepress/dist/client/theme-default/components/VPNavBarTranslations.vue'
10
+ import { ref, watchPostEffect } from 'vue'
11
+ import VPNavBarTitle from './NavBarTitle.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
+ <VPNavBarAppearance 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-1);
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,75 +1,75 @@
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'
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" v-html="theme.siteTitle" />
41
- <span v-else-if="theme.siteTitle === undefined">{{ 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
- font-weight: 600;
57
- color: var(--vp-c-text-1);
58
- transition: opacity 0.25s;
59
- }
60
-
61
- .title .el-tag {
62
- font-weight: normal;
63
- }
64
-
65
- @media (min-width: 960px) {
66
- .title {
67
- flex-shrink: 0;
68
- }
69
- }
70
-
71
- :deep(.logo) {
72
- margin-right: 14px;
73
- height: var(--vp-nav-logo-height);
74
- }
75
- </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'
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" v-html="theme.siteTitle" />
41
+ <span v-else-if="theme.siteTitle === undefined">{{ 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
+ font-weight: 600;
57
+ color: var(--vp-c-text-1);
58
+ transition: opacity 0.25s;
59
+ }
60
+
61
+ .title .el-tag {
62
+ font-weight: normal;
63
+ }
64
+
65
+ @media (min-width: 960px) {
66
+ .title {
67
+ flex-shrink: 0;
68
+ }
69
+ }
70
+
71
+ :deep(.logo) {
72
+ margin-right: 14px;
73
+ height: var(--vp-nav-logo-height);
74
+ }
75
+ </style>