vitepress-theme-element-plus 0.0.7 → 0.0.8

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 (43) 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 -148
  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 +87 -87
  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 +83 -75
  20. package/client/components/Sidebar.vue +129 -129
  21. package/client/components/SidebarGroup.vue +51 -51
  22. package/client/components/SidebarItem.vue +303 -302
  23. package/client/components/ThemeToggler.vue +108 -0
  24. package/client/components/VPNavBarSearch.vue +23 -23
  25. package/client/hooks/useBackTop.ts +71 -71
  26. package/client/hooks/useLangs.ts +50 -50
  27. package/client/hooks/useSidebarControl.ts +78 -78
  28. package/client/hooks/useSize.ts +69 -69
  29. package/client/icons/dark.vue +8 -0
  30. package/client/icons/light.vue +8 -0
  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 +70 -48
  38. package/styles/code.scss +282 -282
  39. package/styles/doc-content.scss +245 -231
  40. package/styles/index.scss +63 -69
  41. package/styles/tag-content.scss +30 -30
  42. package/client/components/Tag.vue +0 -25
  43. package/client/components/VersionTag.vue +0 -18
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>