vitepress-theme-element-plus 0.0.6 → 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 (47) 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/dist/index.d.mts +2 -1
  35. package/dist/index.mjs +2 -1
  36. package/dist/markdown/plugins/task-list.d.mts +13 -0
  37. package/dist/markdown/plugins/task-list.mjs +51 -0
  38. package/index.ts +26 -26
  39. package/package.json +73 -73
  40. package/shared/constants.ts +3 -3
  41. package/styles/base.scss +70 -48
  42. package/styles/code.scss +282 -282
  43. package/styles/doc-content.scss +245 -223
  44. package/styles/index.scss +63 -69
  45. package/styles/tag-content.scss +30 -30
  46. package/client/components/Tag.vue +0 -25
  47. package/client/components/VersionTag.vue +0 -18
@@ -1,129 +1,129 @@
1
- <script lang="ts" setup>
2
- import { useScrollLock } from '@vueuse/core'
3
- import { inBrowser } from 'vitepress'
4
- import { useLayout } from 'vitepress/theme'
5
- import { ref, watch } from 'vue'
6
- import VPSidebarGroup from './SidebarGroup.vue'
7
-
8
- const props = defineProps<{
9
- open: boolean
10
- }>()
11
-
12
- const { sidebarGroups, hasSidebar } = useLayout()
13
-
14
- // a11y: focus Nav element when menu has opened
15
- const navEl = ref<HTMLElement | null>(null)
16
- const isLocked = useScrollLock(inBrowser ? document.body : null)
17
- watch(
18
- [props, navEl],
19
- () => {
20
- if (props.open) {
21
- isLocked.value = true
22
- navEl.value?.focus()
23
- }
24
- else {
25
- isLocked.value = false
26
- }
27
- },
28
- { immediate: true, flush: 'post' },
29
- )
30
-
31
- const key = ref(0)
32
- watch(
33
- sidebarGroups,
34
- () => {
35
- key.value += 1
36
- },
37
- { deep: true },
38
- )
39
- </script>
40
-
41
- <template>
42
- <aside v-if="hasSidebar" ref="navEl" class="VPSidebar" :class="{ open: open && hasSidebar }" @click.stop>
43
- <nav id="VPSidebarNav" class="nav" aria-labelledby="sidebar-aria-label" tabindex="-1">
44
- <span id="sidebar-aria-label" class="visually-hidden">
45
- Sidebar Navigation
46
- </span>
47
-
48
- <slot name="sidebar-nav-before" />
49
- <VPSidebarGroup :key="key" :items="sidebarGroups" />
50
- <slot name="sidebar-nav-after" />
51
- </nav>
52
- </aside>
53
- </template>
54
-
55
- <style lang="scss" scoped>
56
- .VPSidebar {
57
- position: fixed;
58
- top: 0;
59
- bottom: 0;
60
- left: 0;
61
- z-index: var(--vp-z-index-sidebar);
62
- padding: 32px 32px 96px;
63
- background-color: var(--vp-c-bg);
64
- opacity: 0;
65
- box-shadow: var(--vp-c-shadow-3);
66
- overflow-x: hidden;
67
- overflow-y: auto;
68
- transform: translateX(-100%);
69
- transition:
70
- opacity 0.5s,
71
- transform 0.25s ease;
72
- overscroll-behavior: contain;
73
- }
74
-
75
- .VPSidebar.open {
76
- opacity: 1;
77
- transform: translateX(0);
78
- transition:
79
- opacity 0.25s,
80
- transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
81
- }
82
-
83
- .dark .VPSidebar {
84
- box-shadow: var(--vp-shadow-1);
85
- }
86
-
87
- @media (max-width: 767px) {
88
- .VPSidebar {
89
- width: calc(var(--vp-sidebar-width-mobile) - 14px);
90
- }
91
- }
92
-
93
- @media screen and (min-width: 768px) {
94
- .VPSidebar {
95
- width: calc(var(--vp-sidebar-width-small));
96
- top: 0;
97
- }
98
- }
99
-
100
- @media screen and (min-width: 960px) {
101
- .VPSidebar {
102
- top: var(--vp-nav-height);
103
- padding: 48px 32px;
104
- background-color: var(--vp-c-bg);
105
- opacity: 1;
106
- visibility: visible;
107
- box-shadow: none;
108
- transform: translateX(0);
109
- }
110
- }
111
-
112
- @media screen and (min-width: 1440px) {
113
- .VPSidebar {
114
- padding: 48px 32px;
115
- width: calc(var(--vp-sidebar-width-small) + 39px)
116
- }
117
- }
118
-
119
- @media screen and (min-width: 1680px) {
120
- .VPSidebar {
121
- padding: 48px;
122
- width: calc(var(--vp-sidebar-width-small) + 48px)
123
- }
124
- }
125
-
126
- .nav {
127
- outline: 0;
128
- }
129
- </style>
1
+ <script lang="ts" setup>
2
+ import { useScrollLock } from '@vueuse/core'
3
+ import { inBrowser } from 'vitepress'
4
+ import { useLayout } from 'vitepress/theme'
5
+ import { ref, watch } from 'vue'
6
+ import VPSidebarGroup from './SidebarGroup.vue'
7
+
8
+ const props = defineProps<{
9
+ open: boolean
10
+ }>()
11
+
12
+ const { sidebarGroups, hasSidebar } = useLayout()
13
+
14
+ // a11y: focus Nav element when menu has opened
15
+ const navEl = ref<HTMLElement | null>(null)
16
+ const isLocked = useScrollLock(inBrowser ? document.body : null)
17
+ watch(
18
+ [props, navEl],
19
+ () => {
20
+ if (props.open) {
21
+ isLocked.value = true
22
+ navEl.value?.focus()
23
+ }
24
+ else {
25
+ isLocked.value = false
26
+ }
27
+ },
28
+ { immediate: true, flush: 'post' },
29
+ )
30
+
31
+ const key = ref(0)
32
+ watch(
33
+ sidebarGroups,
34
+ () => {
35
+ key.value += 1
36
+ },
37
+ { deep: true },
38
+ )
39
+ </script>
40
+
41
+ <template>
42
+ <aside v-if="hasSidebar" ref="navEl" class="VPSidebar" :class="{ open: open && hasSidebar }" @click.stop>
43
+ <nav id="VPSidebarNav" class="nav" aria-labelledby="sidebar-aria-label" tabindex="-1">
44
+ <span id="sidebar-aria-label" class="visually-hidden">
45
+ Sidebar Navigation
46
+ </span>
47
+
48
+ <slot name="sidebar-nav-before" />
49
+ <VPSidebarGroup :key="key" :items="sidebarGroups" />
50
+ <slot name="sidebar-nav-after" />
51
+ </nav>
52
+ </aside>
53
+ </template>
54
+
55
+ <style lang="scss" scoped>
56
+ .VPSidebar {
57
+ position: fixed;
58
+ top: 0;
59
+ bottom: 0;
60
+ left: 0;
61
+ z-index: var(--vp-z-index-sidebar);
62
+ padding: 32px 32px 96px;
63
+ background-color: var(--vp-c-bg);
64
+ opacity: 0;
65
+ box-shadow: var(--vp-c-shadow-3);
66
+ overflow-x: hidden;
67
+ overflow-y: auto;
68
+ transform: translateX(-100%);
69
+ transition:
70
+ opacity 0.5s,
71
+ transform 0.25s ease;
72
+ overscroll-behavior: contain;
73
+ }
74
+
75
+ .VPSidebar.open {
76
+ opacity: 1;
77
+ transform: translateX(0);
78
+ transition:
79
+ opacity 0.25s,
80
+ transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
81
+ }
82
+
83
+ .dark .VPSidebar {
84
+ box-shadow: var(--vp-shadow-1);
85
+ }
86
+
87
+ @media (max-width: 767px) {
88
+ .VPSidebar {
89
+ width: calc(var(--vp-sidebar-width-mobile) - 14px);
90
+ }
91
+ }
92
+
93
+ @media screen and (min-width: 768px) {
94
+ .VPSidebar {
95
+ width: calc(var(--vp-sidebar-width-small));
96
+ top: 0;
97
+ }
98
+ }
99
+
100
+ @media screen and (min-width: 960px) {
101
+ .VPSidebar {
102
+ top: var(--vp-nav-height);
103
+ padding: 48px 32px;
104
+ background-color: var(--vp-c-bg);
105
+ opacity: 1;
106
+ visibility: visible;
107
+ box-shadow: none;
108
+ transform: translateX(0);
109
+ }
110
+ }
111
+
112
+ @media screen and (min-width: 1440px) {
113
+ .VPSidebar {
114
+ padding: 48px 32px;
115
+ width: calc(var(--vp-sidebar-width-small) + 39px)
116
+ }
117
+ }
118
+
119
+ @media screen and (min-width: 1680px) {
120
+ .VPSidebar {
121
+ padding: 48px;
122
+ width: calc(var(--vp-sidebar-width-small) + 48px)
123
+ }
124
+ }
125
+
126
+ .nav {
127
+ outline: 0;
128
+ }
129
+ </style>
@@ -1,51 +1,51 @@
1
- <script setup lang="ts">
2
- import type { DefaultTheme } from 'vitepress/theme'
3
- import { onBeforeUnmount, onMounted, ref } from 'vue'
4
- import VPSidebarItem from './SidebarItem.vue'
5
-
6
- defineProps<{
7
- items: (DefaultTheme.SidebarItem & { hide?: boolean })[]
8
- }>()
9
-
10
- const disableTransition = ref(true)
11
- let timer: ReturnType<typeof setTimeout> | null = null
12
-
13
- onMounted(() => {
14
- timer = setTimeout(() => {
15
- timer = null
16
- disableTransition.value = false
17
- }, 300)
18
- })
19
-
20
- onBeforeUnmount(() => {
21
- if (timer !== null) {
22
- clearTimeout(timer)
23
- timer = null
24
- }
25
- })
26
- </script>
27
-
28
- <template>
29
- <template
30
- v-for="item in items"
31
- :key="item.link"
32
- >
33
- <div
34
- v-if="!item.hide"
35
- class="group"
36
- :class="{ 'no-transition': disableTransition }"
37
- >
38
- <VPSidebarItem :item="item" :depth="0" />
39
- </div>
40
- </template>
41
- </template>
42
-
43
- <style scoped lang="scss">
44
- .no-transition :deep(.caret-icon) {
45
- transition: none;
46
- }
47
-
48
- .group + .group {
49
- padding-top: 24px;
50
- }
51
- </style>
1
+ <script setup lang="ts">
2
+ import type { DefaultTheme } from 'vitepress/theme'
3
+ import { onBeforeUnmount, onMounted, ref } from 'vue'
4
+ import VPSidebarItem from './SidebarItem.vue'
5
+
6
+ defineProps<{
7
+ items: (DefaultTheme.SidebarItem & { hide?: boolean })[]
8
+ }>()
9
+
10
+ const disableTransition = ref(true)
11
+ let timer: ReturnType<typeof setTimeout> | null = null
12
+
13
+ onMounted(() => {
14
+ timer = setTimeout(() => {
15
+ timer = null
16
+ disableTransition.value = false
17
+ }, 300)
18
+ })
19
+
20
+ onBeforeUnmount(() => {
21
+ if (timer !== null) {
22
+ clearTimeout(timer)
23
+ timer = null
24
+ }
25
+ })
26
+ </script>
27
+
28
+ <template>
29
+ <template
30
+ v-for="item in items"
31
+ :key="item.link"
32
+ >
33
+ <div
34
+ v-if="!item.hide"
35
+ class="group"
36
+ :class="{ 'no-transition': disableTransition }"
37
+ >
38
+ <VPSidebarItem :item="item" :depth="0" />
39
+ </div>
40
+ </template>
41
+ </template>
42
+
43
+ <style scoped lang="scss">
44
+ .no-transition :deep(.caret-icon) {
45
+ transition: none;
46
+ }
47
+
48
+ .group + .group {
49
+ padding-top: 24px;
50
+ }
51
+ </style>