vitepress-theme-element-plus 1.1.1 → 1.1.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 +87 -87
  12. package/client/components/DocFooter.vue +159 -159
  13. package/client/components/Footer.vue +81 -81
  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 +302 -302
  24. package/client/components/ThemeToggler.vue +129 -118
  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 +113 -113
  34. package/client/utils/common.ts +90 -90
  35. package/index.ts +45 -45
  36. package/package.json +1 -1
  37. package/shared/constants.ts +3 -3
  38. package/styles/base.scss +105 -105
  39. package/styles/code.scss +282 -282
  40. package/styles/doc-content.scss +346 -346
  41. package/styles/index.scss +66 -66
  42. package/styles/tag-content.scss +30 -30
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Hezhengxu
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hezhengxu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # vitepress-theme-element-plus
2
-
3
- 轻量的 VitePress 文档主题。
1
+ # vitepress-theme-element-plus
2
+
3
+ 轻量的 VitePress 文档主题。
@@ -1,29 +1,29 @@
1
- <script setup lang="ts">
2
- import { ElTag } from 'element-plus'
3
- </script>
4
-
5
- <template>
6
- <ElTag
7
- size="small"
8
- effect="plain"
9
- hit
10
- round
11
- >
12
- a11y
13
- </ElTag>
14
- </template>
15
-
16
- <style lang="scss" scoped>
17
- .el-tag {
18
- color: #6222c2;
19
- }
20
- .el-tag.is-hit {
21
- border-color: #9065db;
22
- }
23
- .dark .el-tag {
24
- color: #9065db;
25
- }
26
- .dark .el-tag.is-hit {
27
- border-color: #6222c2;
28
- }
29
- </style>
1
+ <script setup lang="ts">
2
+ import { ElTag } from 'element-plus'
3
+ </script>
4
+
5
+ <template>
6
+ <ElTag
7
+ size="small"
8
+ effect="plain"
9
+ hit
10
+ round
11
+ >
12
+ a11y
13
+ </ElTag>
14
+ </template>
15
+
16
+ <style lang="scss" scoped>
17
+ .el-tag {
18
+ color: #6222c2;
19
+ }
20
+ .el-tag.is-hit {
21
+ border-color: #9065db;
22
+ }
23
+ .dark .el-tag {
24
+ color: #9065db;
25
+ }
26
+ .dark .el-tag.is-hit {
27
+ border-color: #6222c2;
28
+ }
29
+ </style>
@@ -1,54 +1,54 @@
1
- <script setup lang="ts">
2
- import { Warning } from '@element-plus/icons-vue'
3
- import { ElButton, ElTooltip } from 'element-plus'
4
-
5
- defineProps({
6
- type: String,
7
- details: String,
8
- })
9
- </script>
10
-
11
- <template>
12
- <span class="api-typing-container">
13
- <code class="api-typing">
14
- {{ type }}
15
- </code>
16
- <ClientOnly>
17
- <ElTooltip v-if="details" effect="light" trigger="click">
18
- <ElButton
19
- text
20
- :icon="Warning"
21
- aria-label="Type details"
22
- class="api-typing__warning-icon"
23
- />
24
- <template #content>
25
- <slot>
26
- <div class="m-1" style="max-width: 600px">
27
- <code
28
- style="
29
- color: var(--code-tooltip-color);
30
- background-color: var(--code-tooltip-bg-color);
31
- "
32
- >
33
- {{ details }}
34
- </code>
35
- </div>
36
- </slot>
37
- </template>
38
- </ElTooltip>
39
- </ClientOnly>
40
- </span>
41
- </template>
42
-
43
- <style scoped lang="scss">
44
- .api-typing-container {
45
- display: inline-flex;
46
- align-items: center;
47
- }
48
- .api-typing {
49
- margin-right: 4px;
50
- }
51
- .api-typing__warning-icon {
52
- padding: 8px;
53
- }
54
- </style>
1
+ <script setup lang="ts">
2
+ import { Warning } from '@element-plus/icons-vue'
3
+ import { ElButton, ElTooltip } from 'element-plus'
4
+
5
+ defineProps({
6
+ type: String,
7
+ details: String,
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <span class="api-typing-container">
13
+ <code class="api-typing">
14
+ {{ type }}
15
+ </code>
16
+ <ClientOnly>
17
+ <ElTooltip v-if="details" effect="light" trigger="click">
18
+ <ElButton
19
+ text
20
+ :icon="Warning"
21
+ aria-label="Type details"
22
+ class="api-typing__warning-icon"
23
+ />
24
+ <template #content>
25
+ <slot>
26
+ <div class="m-1" style="max-width: 600px">
27
+ <code
28
+ style="
29
+ color: var(--code-tooltip-color);
30
+ background-color: var(--code-tooltip-bg-color);
31
+ "
32
+ >
33
+ {{ details }}
34
+ </code>
35
+ </div>
36
+ </slot>
37
+ </template>
38
+ </ElTooltip>
39
+ </ClientOnly>
40
+ </span>
41
+ </template>
42
+
43
+ <style scoped lang="scss">
44
+ .api-typing-container {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ }
48
+ .api-typing {
49
+ margin-right: 4px;
50
+ }
51
+ .api-typing__warning-icon {
52
+ padding: 8px;
53
+ }
54
+ </style>
@@ -1,41 +1,41 @@
1
- <script lang="ts" setup>
2
- import { useSidebar } from '../hooks/useSidebar'
3
-
4
- const { isOpen, close } = useSidebar()
5
- </script>
6
-
7
- <template>
8
- <transition name="fade">
9
- <div v-if="isOpen" class="VPBackdrop" @click="close()" />
10
- </transition>
11
- </template>
12
-
13
- <style scoped lang="scss">
14
- .VPBackdrop {
15
- position: fixed;
16
- top: 0;
17
- /*rtl:ignore*/
18
- right: 0;
19
- bottom: 0;
20
- /*rtl:ignore*/
21
- left: 0;
22
- z-index: var(--vp-z-index-backdrop);
23
- background: var(--vp-backdrop-bg-color);
24
- transition: opacity 0.5s;
25
- }
26
-
27
- .VPBackdrop.fade-enter-from,
28
- .VPBackdrop.fade-leave-to {
29
- opacity: 0;
30
- }
31
-
32
- .VPBackdrop.fade-leave-active {
33
- transition-duration: 0.25s;
34
- }
35
-
36
- @media (min-width: 1440px) {
37
- .VPBackdrop {
38
- display: none;
39
- }
40
- }
41
- </style>
1
+ <script lang="ts" setup>
2
+ import { useSidebar } from '../hooks/useSidebar'
3
+
4
+ const { isOpen, close } = useSidebar()
5
+ </script>
6
+
7
+ <template>
8
+ <transition name="fade">
9
+ <div v-if="isOpen" class="VPBackdrop" @click="close()" />
10
+ </transition>
11
+ </template>
12
+
13
+ <style scoped lang="scss">
14
+ .VPBackdrop {
15
+ position: fixed;
16
+ top: 0;
17
+ /*rtl:ignore*/
18
+ right: 0;
19
+ bottom: 0;
20
+ /*rtl:ignore*/
21
+ left: 0;
22
+ z-index: var(--vp-z-index-backdrop);
23
+ background: var(--vp-backdrop-bg-color);
24
+ transition: opacity 0.5s;
25
+ }
26
+
27
+ .VPBackdrop.fade-enter-from,
28
+ .VPBackdrop.fade-leave-to {
29
+ opacity: 0;
30
+ }
31
+
32
+ .VPBackdrop.fade-leave-active {
33
+ transition-duration: 0.25s;
34
+ }
35
+
36
+ @media (min-width: 1440px) {
37
+ .VPBackdrop {
38
+ display: none;
39
+ }
40
+ }
41
+ </style>
@@ -1,94 +1,94 @@
1
- <script lang="ts" setup>
2
- import { computed, ref } from 'vue'
3
- import { useSize } from '../hooks/useSize'
4
-
5
- interface Props {
6
- /**
7
- * aid
8
- */
9
- aid?: string
10
- /**
11
- * bvid
12
- */
13
- bvid?: string
14
- /**
15
- * cid
16
- */
17
- cid?: string
18
- /**
19
- * 是否开启自动播放
20
- */
21
- autoplay?: boolean
22
- /**
23
- * 指定播放时间
24
- */
25
- time?: number | string
26
- /**
27
- * 指定视频分p
28
- */
29
- page?: number
30
- /**
31
- * 宽度
32
- */
33
- width?: number
34
- /**
35
- * 高度
36
- */
37
- height?: number
38
- /**
39
- * 尺寸比例
40
- */
41
- ratio?: number
42
-
43
- /**
44
- * 是否展示封面
45
- * @default true
46
- */
47
- poster?: boolean
48
- }
49
- const props = withDefaults(defineProps<Props>(), {
50
- ratio: 16 / 9,
51
- poster: true,
52
- })
53
-
54
- const VIDEO_LINK = 'https://player.bilibili.com/player.html'
55
- const { el, width, height, resize } = useSize<HTMLIFrameElement>(props)
56
- const loaded = ref(false)
57
-
58
- const videoLink = computed(() => {
59
- const { aid, bvid, cid, autoplay, time, page, poster } = props
60
-
61
- return aid && cid
62
- ? `${VIDEO_LINK}?aid=${aid}&cid=${cid}&t=${time}&autoplay=${
63
- autoplay ? 1 : 0
64
- }&p=${page}&poster=${poster ? 1 : 0}`
65
- : bvid
66
- ? `${VIDEO_LINK}?bvid=${bvid}&t=${time}&autoplay=${autoplay ? 1 : 0}&poster=${poster ? 1 : 0}`
67
- : ''
68
- })
69
-
70
- function handleLoad() {
71
- loaded.value = true
72
- resize()
73
- }
74
- </script>
75
-
76
- <template>
77
- <iframe
78
- ref="el"
79
- class="bili-iframe"
80
- :src="videoLink"
81
- :style="{ width, height }"
82
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture"
83
- @load="handleLoad"
84
- />
85
- </template>
86
-
87
- <style lang="scss" scoped>
88
- .bili-iframe {
89
- border-radius: 8px;
90
- border: none;
91
- background-color: #000;
92
- transition: all 0.3s;
93
- }
94
- </style>
1
+ <script lang="ts" setup>
2
+ import { computed, ref } from 'vue'
3
+ import { useSize } from '../hooks/useSize'
4
+
5
+ interface Props {
6
+ /**
7
+ * aid
8
+ */
9
+ aid?: string
10
+ /**
11
+ * bvid
12
+ */
13
+ bvid?: string
14
+ /**
15
+ * cid
16
+ */
17
+ cid?: string
18
+ /**
19
+ * 是否开启自动播放
20
+ */
21
+ autoplay?: boolean
22
+ /**
23
+ * 指定播放时间
24
+ */
25
+ time?: number | string
26
+ /**
27
+ * 指定视频分p
28
+ */
29
+ page?: number
30
+ /**
31
+ * 宽度
32
+ */
33
+ width?: number
34
+ /**
35
+ * 高度
36
+ */
37
+ height?: number
38
+ /**
39
+ * 尺寸比例
40
+ */
41
+ ratio?: number
42
+
43
+ /**
44
+ * 是否展示封面
45
+ * @default true
46
+ */
47
+ poster?: boolean
48
+ }
49
+ const props = withDefaults(defineProps<Props>(), {
50
+ ratio: 16 / 9,
51
+ poster: true,
52
+ })
53
+
54
+ const VIDEO_LINK = 'https://player.bilibili.com/player.html'
55
+ const { el, width, height, resize } = useSize<HTMLIFrameElement>(props)
56
+ const loaded = ref(false)
57
+
58
+ const videoLink = computed(() => {
59
+ const { aid, bvid, cid, autoplay, time, page, poster } = props
60
+
61
+ return aid && cid
62
+ ? `${VIDEO_LINK}?aid=${aid}&cid=${cid}&t=${time}&autoplay=${
63
+ autoplay ? 1 : 0
64
+ }&p=${page}&poster=${poster ? 1 : 0}`
65
+ : bvid
66
+ ? `${VIDEO_LINK}?bvid=${bvid}&t=${time}&autoplay=${autoplay ? 1 : 0}&poster=${poster ? 1 : 0}`
67
+ : ''
68
+ })
69
+
70
+ function handleLoad() {
71
+ loaded.value = true
72
+ resize()
73
+ }
74
+ </script>
75
+
76
+ <template>
77
+ <iframe
78
+ ref="el"
79
+ class="bili-iframe"
80
+ :src="videoLink"
81
+ :style="{ width, height }"
82
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture"
83
+ @load="handleLoad"
84
+ />
85
+ </template>
86
+
87
+ <style lang="scss" scoped>
88
+ .bili-iframe {
89
+ border-radius: 8px;
90
+ border: none;
91
+ background-color: #000;
92
+ transition: all 0.3s;
93
+ }
94
+ </style>