@vuepress/theme-default 2.0.0-rc.12 → 2.0.0-rc.120

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 (142) hide show
  1. package/lib/client/components/VPAutoLink.vue +32 -0
  2. package/lib/client/components/VPDarkIcon.vue +8 -0
  3. package/lib/client/components/VPDropdownTransition.vue +43 -0
  4. package/lib/client/components/VPEditIcon.vue +12 -0
  5. package/lib/client/components/VPFadeSlideYTransition.vue +23 -0
  6. package/lib/client/components/VPHome.vue +37 -0
  7. package/lib/client/components/VPHomeFeatures.vue +65 -0
  8. package/lib/client/components/VPHomeFooter.vue +30 -0
  9. package/lib/client/components/VPHomeHero.vue +186 -0
  10. package/lib/client/components/VPLightIcon.vue +28 -0
  11. package/lib/client/components/VPNavbar.vue +138 -0
  12. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +39 -15
  13. package/lib/client/components/VPNavbarDropdown.vue +329 -0
  14. package/lib/client/components/VPNavbarItems.vue +111 -0
  15. package/lib/client/components/VPPage.vue +71 -0
  16. package/lib/client/components/VPPageMeta.vue +141 -0
  17. package/lib/client/components/VPPageNav.vue +123 -0
  18. package/lib/client/components/VPSidebar.vue +120 -0
  19. package/lib/client/components/VPSidebarItem.vue +185 -0
  20. package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +27 -7
  21. package/lib/client/components/VPToggleColorModeButton.vue +55 -0
  22. package/lib/client/components/VPToggleSidebarButton.vue +92 -0
  23. package/lib/client/components/global/Badge.vue +83 -22
  24. package/lib/client/components/global/index.d.ts +1 -3
  25. package/lib/client/components/global/index.js +1 -3
  26. package/lib/client/composables/index.d.ts +7 -1
  27. package/lib/client/composables/index.js +7 -1
  28. package/lib/client/composables/useDarkMode.d.ts +1 -3
  29. package/lib/client/composables/useDarkMode.js +20 -17
  30. package/lib/client/composables/useData.d.ts +8 -0
  31. package/lib/client/composables/useData.js +7 -0
  32. package/lib/client/composables/useEditLink.d.ts +3 -0
  33. package/lib/client/composables/useEditLink.js +28 -0
  34. package/lib/client/composables/useHeaders.d.ts +9 -0
  35. package/lib/client/composables/useHeaders.js +38 -0
  36. package/lib/client/composables/useNavbarConfig.d.ts +3 -0
  37. package/lib/client/composables/useNavbarConfig.js +29 -0
  38. package/lib/client/composables/useNavbarRepo.d.ts +6 -0
  39. package/lib/client/composables/useNavbarRepo.js +38 -0
  40. package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
  41. package/lib/client/composables/useNavbarSelectLanguage.js +59 -0
  42. package/lib/client/composables/useNavigate.d.ts +1 -0
  43. package/lib/client/composables/useNavigate.js +22 -0
  44. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  45. package/lib/client/composables/useRelatedLinks.js +90 -0
  46. package/lib/client/composables/useScrollPromise.js +3 -1
  47. package/lib/client/composables/useSidebarItems.d.ts +21 -20
  48. package/lib/client/composables/useSidebarItems.js +96 -85
  49. package/lib/client/composables/useUpdateDeviceStatus.d.ts +1 -1
  50. package/lib/client/composables/useUpdateDeviceStatus.js +10 -5
  51. package/lib/client/config.d.ts +3 -2
  52. package/lib/client/config.js +8 -23
  53. package/lib/client/index.d.ts +1 -0
  54. package/lib/client/layouts/Layout.vue +126 -56
  55. package/lib/client/layouts/NotFound.vue +59 -12
  56. package/lib/client/shim.d.ts +6 -5
  57. package/lib/client/styles/_mixins.scss +8 -4
  58. package/lib/client/styles/_variables.module.scss +1 -1
  59. package/lib/client/styles/_variables.scss +1 -0
  60. package/lib/client/styles/arrow.scss +24 -22
  61. package/lib/client/styles/code-group.scss +34 -30
  62. package/lib/client/styles/content/code.scss +43 -0
  63. package/lib/client/styles/content/index.scss +3 -0
  64. package/lib/client/styles/content/normalize.scss +39 -0
  65. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  66. package/lib/client/styles/external-link-icon.scss +36 -0
  67. package/lib/client/styles/index.scss +3 -13
  68. package/lib/client/styles/layout.scss +5 -197
  69. package/lib/client/styles/normalize.scss +1 -194
  70. package/lib/client/styles/plugins.scss +28 -0
  71. package/lib/client/styles/vars-dark.scss +20 -58
  72. package/lib/client/styles/vars.scss +54 -156
  73. package/lib/client/typings.d.ts +13 -0
  74. package/lib/client/typings.js +1 -0
  75. package/lib/client/utils/index.d.ts +2 -1
  76. package/lib/client/utils/index.js +2 -1
  77. package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
  78. package/lib/client/utils/isActiveSidebarItem.js +1 -1
  79. package/lib/client/utils/resolveAutoLink.d.ts +9 -0
  80. package/lib/client/utils/{getNavLink.js → resolveAutoLink.js} +3 -3
  81. package/lib/client/utils/resolveEditLink.d.ts +3 -3
  82. package/lib/client/utils/resolveEditLink.js +3 -3
  83. package/lib/client/utils/resolvePrefix.d.ts +1 -0
  84. package/lib/client/utils/resolvePrefix.js +4 -0
  85. package/lib/client/utils/resolveRepoType.d.ts +1 -1
  86. package/lib/client/utils/resolveRepoType.js +4 -4
  87. package/lib/node/defaultTheme.d.ts +2 -1
  88. package/lib/node/defaultTheme.js +57 -64
  89. package/lib/node/index.d.ts +1 -3
  90. package/lib/node/index.js +0 -3
  91. package/lib/node/typings.d.ts +59 -0
  92. package/lib/node/typings.js +1 -0
  93. package/lib/node/utils/assignDefaultLocaleOptions.js +3 -8
  94. package/lib/node/utils/index.d.ts +1 -1
  95. package/lib/node/utils/index.js +1 -1
  96. package/lib/node/utils/resolveMarkdownHintLocales.d.ts +9 -0
  97. package/lib/node/utils/resolveMarkdownHintLocales.js +19 -0
  98. package/lib/shared/index.d.ts +5 -3
  99. package/lib/shared/index.js +1 -3
  100. package/lib/shared/nav.d.ts +19 -30
  101. package/lib/shared/navbar.d.ts +21 -0
  102. package/lib/shared/navbar.js +1 -0
  103. package/lib/shared/options.d.ts +36 -66
  104. package/lib/shared/page.d.ts +9 -6
  105. package/lib/shared/sidebar.d.ts +26 -0
  106. package/lib/shared/sidebar.js +1 -0
  107. package/package.json +34 -27
  108. package/templates/build.html +16 -10
  109. package/lib/client/components/AutoLink.vue +0 -113
  110. package/lib/client/components/DropdownTransition.vue +0 -25
  111. package/lib/client/components/Home.vue +0 -15
  112. package/lib/client/components/HomeContent.vue +0 -5
  113. package/lib/client/components/HomeFeatures.vue +0 -22
  114. package/lib/client/components/HomeFooter.vue +0 -17
  115. package/lib/client/components/HomeHero.vue +0 -97
  116. package/lib/client/components/Navbar.vue +0 -79
  117. package/lib/client/components/NavbarDropdown.vue +0 -126
  118. package/lib/client/components/NavbarItems.vue +0 -194
  119. package/lib/client/components/Page.vue +0 -31
  120. package/lib/client/components/PageMeta.vue +0 -124
  121. package/lib/client/components/PageNav.vue +0 -122
  122. package/lib/client/components/Sidebar.vue +0 -18
  123. package/lib/client/components/SidebarItem.vue +0 -87
  124. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  125. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  126. package/lib/client/components/global/CodeGroup.d.ts +0 -6
  127. package/lib/client/components/global/CodeGroup.js +0 -120
  128. package/lib/client/components/global/CodeGroupItem.vue +0 -27
  129. package/lib/client/composables/useThemeData.d.ts +0 -4
  130. package/lib/client/composables/useThemeData.js +0 -3
  131. package/lib/client/styles/badge.scss +0 -36
  132. package/lib/client/styles/code.scss +0 -263
  133. package/lib/client/styles/custom-container.scss +0 -142
  134. package/lib/client/styles/home.scss +0 -168
  135. package/lib/client/styles/navbar-dropdown.scss +0 -183
  136. package/lib/client/styles/navbar.scss +0 -197
  137. package/lib/client/styles/page.scss +0 -87
  138. package/lib/client/styles/sidebar.scss +0 -134
  139. package/lib/client/styles/transitions.scss +0 -22
  140. package/lib/client/utils/getNavLink.d.ts +0 -9
  141. package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
  142. package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
@@ -0,0 +1,123 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import { useData } from '@theme/useData'
4
+ import { useNavigate } from '@theme/useNavigate'
5
+ import { useRelatedLinks } from '@theme/useRelatedLinks'
6
+ import { useEventListener } from '@vueuse/core'
7
+ import { computed } from 'vue'
8
+
9
+ const { themeLocale } = useData()
10
+ const navigate = useNavigate()
11
+
12
+ const { prevLink, nextLink } = useRelatedLinks()
13
+
14
+ const navbarLabel = computed(
15
+ () => themeLocale.value.pageNavbarLabel ?? 'page navigation',
16
+ )
17
+
18
+ useEventListener('keydown', (event): void => {
19
+ if (event.altKey) {
20
+ if (event.key === 'ArrowRight') {
21
+ if (nextLink.value) {
22
+ navigate(nextLink.value.link)
23
+ event.preventDefault()
24
+ }
25
+ } else if (event.key === 'ArrowLeft') {
26
+ if (prevLink.value) {
27
+ navigate(prevLink.value.link)
28
+ event.preventDefault()
29
+ }
30
+ }
31
+ }
32
+ })
33
+ </script>
34
+
35
+ <template>
36
+ <nav
37
+ v-if="prevLink || nextLink"
38
+ class="vp-page-nav"
39
+ :aria-label="navbarLabel"
40
+ >
41
+ <VPAutoLink v-if="prevLink" class="prev" :config="prevLink">
42
+ <div class="hint">
43
+ <span class="arrow left" />
44
+ {{ themeLocale.prev ?? 'Prev' }}
45
+ </div>
46
+ <div class="link">
47
+ <span class="external-link">{{ prevLink.text }}</span>
48
+ </div>
49
+ </VPAutoLink>
50
+
51
+ <VPAutoLink v-if="nextLink" class="next" :config="nextLink">
52
+ <div class="hint">
53
+ {{ themeLocale.next ?? 'Next' }}
54
+ <span class="arrow right" />
55
+ </div>
56
+ <div class="link">
57
+ <span class="external-link">{{ nextLink.text }}</span>
58
+ </div>
59
+ </VPAutoLink>
60
+ </nav>
61
+ </template>
62
+
63
+ <style lang="scss">
64
+ @use '../styles/variables' as *;
65
+
66
+ .vp-page-nav {
67
+ display: flex;
68
+ flex-wrap: wrap;
69
+
70
+ max-width: var(--content-width, 740px);
71
+ min-height: 2rem;
72
+ margin-inline: auto;
73
+ margin-top: 0;
74
+ padding: 1rem 2rem 0;
75
+ border-top: 1px solid var(--vp-c-divider);
76
+
77
+ transition: border-top var(--vp-t-color);
78
+
79
+ @media (max-width: $MQNarrow) {
80
+ padding-inline: 1rem;
81
+ }
82
+
83
+ @media print {
84
+ display: none;
85
+ }
86
+
87
+ .auto-link {
88
+ display: inline-block;
89
+ flex-grow: 1;
90
+
91
+ margin: 0.25rem;
92
+ padding: 0.25rem 0.5rem;
93
+ border: 1px solid var(--vp-c-divider);
94
+ border-radius: 0.25rem;
95
+
96
+ &:hover {
97
+ background: var(--vp-c-control);
98
+ }
99
+
100
+ &.external-link::after {
101
+ display: none;
102
+ }
103
+
104
+ &:not(.external-link) .external-link::after {
105
+ display: none;
106
+ }
107
+
108
+ .hint {
109
+ color: var(--vp-c-text-mute);
110
+ font-size: 0.875rem;
111
+ line-height: 2;
112
+ }
113
+ }
114
+
115
+ .prev {
116
+ text-align: start;
117
+ }
118
+
119
+ .next {
120
+ text-align: end;
121
+ }
122
+ }
123
+ </style>
@@ -0,0 +1,120 @@
1
+ <script setup lang="ts">
2
+ import VPNavbarItems from '@theme/VPNavbarItems.vue'
3
+ import VPSidebarItems from '@theme/VPSidebarItems.vue'
4
+ import type { Slot } from '@vuepress/helper/client'
5
+
6
+ defineSlots<{
7
+ top?: Slot
8
+ bottom?: Slot
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <aside class="vp-sidebar" vp-sidebar>
14
+ <VPNavbarItems />
15
+ <slot name="top" />
16
+ <VPSidebarItems />
17
+ <slot name="bottom" />
18
+ </aside>
19
+ </template>
20
+
21
+ <style lang="scss">
22
+ @use '../styles/variables' as *;
23
+
24
+ .vp-sidebar {
25
+ position: fixed;
26
+ inset-inline-start: 0;
27
+
28
+ // leave space for navbar
29
+ top: var(--navbar-height);
30
+ bottom: 0;
31
+ z-index: 10;
32
+
33
+ overflow-y: auto;
34
+
35
+ box-sizing: border-box;
36
+ width: var(--sidebar-width);
37
+ margin: 0;
38
+ border-inline-end: 1px solid var(--vp-c-border);
39
+
40
+ background-color: var(--vp-sidebar-c-bg);
41
+
42
+ font-size: 1rem;
43
+
44
+ transition:
45
+ transform var(--vp-t-transform),
46
+ background-color var(--vp-t-color),
47
+ border-color var(--vp-t-color);
48
+
49
+ scrollbar-color: var(--vp-c-accent-bg) var(--vp-c-divider);
50
+ scrollbar-width: thin;
51
+
52
+ // narrow desktop / iPad
53
+ @media (max-width: $MQNarrow) {
54
+ width: var(--sidebar-width-mobile);
55
+ font-size: 0.9rem;
56
+ }
57
+
58
+ // wide mobile
59
+ @media (max-width: $MQMobile) {
60
+ top: 0;
61
+
62
+ // leave space for navbar
63
+ padding-top: var(--navbar-height);
64
+ transform: translateX(-100%);
65
+
66
+ [dir='rtl'] & {
67
+ transform: translateX(100%);
68
+ }
69
+ }
70
+
71
+ &::-webkit-scrollbar {
72
+ width: 7px;
73
+ }
74
+
75
+ &::-webkit-scrollbar-track {
76
+ background-color: var(--vp-c-divider);
77
+ }
78
+
79
+ &::-webkit-scrollbar-thumb {
80
+ background-color: var(--vp-c-accent-bg);
81
+ }
82
+
83
+ // override styles
84
+ .vp-navbar-items {
85
+ display: none;
86
+ padding: 0.5rem 0 0.75rem;
87
+ border-bottom: 1px solid var(--vp-c-divider);
88
+ transition: border-color var(--vp-t-color);
89
+
90
+ @media (max-width: $MQMobile) {
91
+ display: block;
92
+
93
+ .vp-navbar-dropdown-item .route-link-active::after {
94
+ top: calc(1rem - 2px);
95
+ }
96
+ }
97
+
98
+ ul {
99
+ margin: 0;
100
+ padding: 0;
101
+ list-style-type: none;
102
+ }
103
+
104
+ .auto-link {
105
+ font-weight: 600;
106
+ }
107
+ }
108
+
109
+ // override styles
110
+ .vp-navbar-item {
111
+ display: block;
112
+
113
+ padding-block: 0.5rem;
114
+ padding-inline: 1.5rem 0;
115
+
116
+ font-size: 1.1em;
117
+ line-height: 1.25rem;
118
+ }
119
+ }
120
+ </style>
@@ -0,0 +1,185 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
4
+ import { isActiveSidebarItem } from '@theme/isActiveSidebarItem'
5
+ import { useToggle } from '@vueuse/core'
6
+ import { computed, nextTick, onBeforeUnmount } from 'vue'
7
+ import { useRoute, useRouter } from 'vuepress/client'
8
+ import type { SidebarGroupItem, SidebarItem } from '../typings.js'
9
+
10
+ const { item, depth = 0 } = defineProps<{
11
+ /**
12
+ * The sidebar item to be rendered
13
+ */
14
+ item: SidebarItem
15
+ /**
16
+ * The depth of the current sidebar item
17
+ */
18
+ depth?: number
19
+ }>()
20
+
21
+ const route = useRoute()
22
+ const router = useRouter()
23
+
24
+ const collapsible = computed(() => (item as SidebarGroupItem).collapsible)
25
+ const isActive = computed(() => isActiveSidebarItem(item, route))
26
+ const itemClass = computed(() => ({
27
+ 'vp-sidebar-item': true,
28
+ 'vp-sidebar-heading': depth === 0,
29
+ 'active': isActive.value,
30
+ 'collapsible': collapsible.value,
31
+ }))
32
+
33
+ const isOpenDefault = computed(() =>
34
+ collapsible.value ? isActive.value : true,
35
+ )
36
+ // eslint-disable-next-line vue/no-ref-object-reactivity-loss
37
+ const [isOpen, toggleIsOpen] = useToggle(isOpenDefault.value)
38
+ const onClick = (e: Event): void => {
39
+ if (collapsible.value) {
40
+ e.preventDefault()
41
+ // toggle open status on click
42
+ toggleIsOpen()
43
+ }
44
+ }
45
+
46
+ // reset open status after navigation
47
+ const unregisterRouterHook = router.afterEach(() => {
48
+ void nextTick(() => {
49
+ isOpen.value = isOpenDefault.value
50
+ })
51
+ })
52
+ onBeforeUnmount(() => {
53
+ unregisterRouterHook()
54
+ })
55
+ </script>
56
+
57
+ <template>
58
+ <li>
59
+ <VPAutoLink v-if="item.link" :class="itemClass" :config="item">
60
+ <template #after>
61
+ <span
62
+ v-if="collapsible"
63
+ class="arrow"
64
+ :class="isOpen ? 'down' : 'right'"
65
+ />
66
+ </template>
67
+ </VPAutoLink>
68
+ <p
69
+ v-else
70
+ tabindex="0"
71
+ :class="itemClass"
72
+ @click="onClick"
73
+ @keydown.enter="onClick"
74
+ >
75
+ {{ item.text }}
76
+ <span
77
+ v-if="collapsible"
78
+ class="arrow"
79
+ :class="isOpen ? 'down' : 'right'"
80
+ />
81
+ </p>
82
+
83
+ <VPDropdownTransition v-if="'children' in item && item.children.length">
84
+ <ul v-show="isOpen" class="vp-sidebar-children">
85
+ <VPSidebarItem
86
+ v-for="child in item.children"
87
+ :key="`${depth}${child.text}${child.link}`"
88
+ :item="child"
89
+ :depth="depth + 1"
90
+ />
91
+ </ul>
92
+ </VPDropdownTransition>
93
+ </li>
94
+ </template>
95
+
96
+ <style lang="scss">
97
+ @use '../styles/mixins';
98
+ @use '../styles/variables' as *;
99
+
100
+ .vp-sidebar-item {
101
+ border-inline-start: 0.25rem solid transparent;
102
+ color: var(--vp-c-text);
103
+ cursor: default;
104
+
105
+ &:focus-visible {
106
+ outline-width: 1px;
107
+ outline-offset: -1px;
108
+ }
109
+
110
+ &.vp-sidebar-heading {
111
+ box-sizing: border-box;
112
+ width: 100%;
113
+ margin: 0;
114
+ padding-block: 0.35rem;
115
+ padding-inline: 1.25rem 1.5rem;
116
+
117
+ font-weight: bold;
118
+ font-size: 1.1em;
119
+
120
+ transition: color 0.15s ease;
121
+
122
+ + .vp-sidebar-children {
123
+ @include mixins.dropdown-wrapper;
124
+
125
+ margin-bottom: 0.75rem;
126
+ }
127
+ }
128
+
129
+ &.collapsible {
130
+ cursor: pointer;
131
+ }
132
+
133
+ &:not(.vp-sidebar-heading) {
134
+ display: inline-block;
135
+
136
+ box-sizing: border-box;
137
+ width: 100%;
138
+ margin: 0;
139
+ padding-block: 0.35rem;
140
+ padding-inline: 2rem 1rem;
141
+
142
+ font-weight: 400;
143
+ font-size: 1em;
144
+ line-height: 1.4;
145
+
146
+ + .vp-sidebar-children {
147
+ padding-inline-start: 1rem;
148
+ font-size: 0.95em;
149
+ }
150
+
151
+ .vp-sidebar-children .vp-sidebar-children & {
152
+ padding-block: 0.25rem;
153
+ padding-inline: 1.75rem 1rem;
154
+
155
+ &.active {
156
+ border-inline-start-color: transparent;
157
+ font-weight: 500;
158
+ }
159
+ }
160
+
161
+ a.vp-sidebar-heading + .vp-sidebar-children &.active {
162
+ border-inline-start-color: transparent;
163
+ }
164
+ }
165
+
166
+ &.active:not(p.vp-sidebar-heading) {
167
+ border-inline-start-color: var(--vp-c-accent);
168
+ color: var(--vp-c-accent);
169
+ font-weight: 600;
170
+ }
171
+
172
+ .auto-link {
173
+ display: block;
174
+ }
175
+
176
+ &.auto-link {
177
+ display: block;
178
+ cursor: pointer;
179
+
180
+ &:hover {
181
+ color: var(--vp-c-accent);
182
+ }
183
+ }
184
+ }
185
+ </style>
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import SidebarItem from '@theme/SidebarItem.vue'
2
+ import VPSidebarItem from '@theme/VPSidebarItem.vue'
3
+ import { useSidebarItems } from '@theme/useSidebarItems'
3
4
  import { onMounted, watch } from 'vue'
4
- import { useRoute } from 'vue-router'
5
- import { useSidebarItems } from '../composables/index.js'
5
+ import { useRoute } from 'vuepress/client'
6
6
 
7
7
  const route = useRoute()
8
8
  const sidebarItems = useSidebarItems()
@@ -12,12 +12,12 @@ onMounted(() => {
12
12
  () => route.hash,
13
13
  (hash) => {
14
14
  // get the sidebar DOM
15
- const sidebar = document.querySelector('.sidebar')
15
+ const sidebar = document.querySelector('.vp-sidebar')
16
16
  if (!sidebar) return
17
17
 
18
18
  // get the active sidebar item DOM, whose href equals to the current route
19
19
  const activeSidebarItem = document.querySelector(
20
- `.sidebar a.sidebar-item[href="${route.path}${hash}"]`,
20
+ `.vp-sidebar .vp-sidebar-item.auto-link[href="${route.path}${hash}"]`,
21
21
  )
22
22
  if (!activeSidebarItem) return
23
23
 
@@ -47,11 +47,31 @@ onMounted(() => {
47
47
  </script>
48
48
 
49
49
  <template>
50
- <ul v-if="sidebarItems.length" class="sidebar-items">
51
- <SidebarItem
50
+ <ul v-if="sidebarItems.length" class="vp-sidebar-items">
51
+ <VPSidebarItem
52
52
  v-for="item in sidebarItems"
53
53
  :key="`${item.text}${item.link}`"
54
54
  :item="item"
55
55
  />
56
56
  </ul>
57
57
  </template>
58
+
59
+ <style lang="scss">
60
+ @use '../styles/variables' as *;
61
+
62
+ .vp-sidebar-items {
63
+ margin: 0;
64
+ padding: 1.5rem 0;
65
+ list-style-type: none;
66
+
67
+ @media (max-width: $MQMobile) {
68
+ padding: 1rem 0;
69
+ }
70
+
71
+ ul {
72
+ margin: 0;
73
+ padding: 0;
74
+ list-style-type: none;
75
+ }
76
+ }
77
+ </style>
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import VPDarkIcon from '@theme/VPDarkIcon.vue'
3
+ import VPLightIcon from '@theme/VPLightIcon.vue'
4
+ import { useDarkMode } from '@theme/useDarkMode'
5
+ import { useData } from '@theme/useData'
6
+
7
+ const { themeLocale } = useData()
8
+ const isDarkMode = useDarkMode()
9
+
10
+ const toggleColorMode = (): void => {
11
+ isDarkMode.value = !isDarkMode.value
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <button
17
+ type="button"
18
+ class="vp-toggle-color-mode-button"
19
+ :title="themeLocale.toggleColorMode"
20
+ @click="toggleColorMode"
21
+ >
22
+ <VPLightIcon v-show="!isDarkMode" />
23
+ <VPDarkIcon v-show="isDarkMode" />
24
+ </button>
25
+ </template>
26
+
27
+ <style lang="scss">
28
+ .vp-toggle-color-mode-button {
29
+ display: flex;
30
+
31
+ margin: auto;
32
+ margin-inline-start: 1rem;
33
+ border: 0;
34
+
35
+ background: none;
36
+ color: var(--vp-c-text);
37
+
38
+ opacity: 0.8;
39
+ cursor: pointer;
40
+
41
+ @media print {
42
+ display: none;
43
+ }
44
+
45
+ &:hover {
46
+ opacity: 1;
47
+ }
48
+
49
+ .light-icon,
50
+ .dark-icon {
51
+ width: 1.25rem;
52
+ height: 1.25rem;
53
+ }
54
+ }
55
+ </style>
@@ -0,0 +1,92 @@
1
+ <script setup lang="ts">
2
+ import { useData } from '@theme/useData'
3
+
4
+ defineEmits<{ toggle: [] }>()
5
+
6
+ const { themeLocale } = useData()
7
+ </script>
8
+
9
+ <template>
10
+ <div
11
+ class="vp-toggle-sidebar-button"
12
+ :title="themeLocale.toggleSidebar"
13
+ aria-expanded="false"
14
+ role="button"
15
+ tabindex="0"
16
+ @click="$emit('toggle')"
17
+ >
18
+ <div class="icon" aria-hidden="true">
19
+ <span></span>
20
+ <span></span>
21
+ <span></span>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <style lang="scss">
27
+ /* stylelint-disable max-nesting-depth */
28
+ @use '../styles/variables' as *;
29
+
30
+ .vp-toggle-sidebar-button {
31
+ position: absolute;
32
+ inset-inline-start: 1rem;
33
+ top: 0.6rem;
34
+
35
+ display: none;
36
+
37
+ padding: 0.6rem;
38
+
39
+ cursor: pointer;
40
+
41
+ @media screen and (max-width: $MQMobile) {
42
+ display: block;
43
+ }
44
+
45
+ .icon {
46
+ display: flex;
47
+ flex-flow: column;
48
+ align-items: center;
49
+ justify-content: center;
50
+
51
+ width: 1.25rem;
52
+ height: 1.25rem;
53
+
54
+ cursor: inherit;
55
+
56
+ span {
57
+ display: inline-block;
58
+
59
+ width: 100%;
60
+ height: 2px;
61
+ border-radius: 2px;
62
+
63
+ background-color: var(--vp-c-text);
64
+
65
+ transition: transform var(--vp-t-transform);
66
+
67
+ &:nth-child(2) {
68
+ margin: 6px 0;
69
+ }
70
+
71
+ .vp-theme-container.sidebar-open & {
72
+ &:nth-child(1) {
73
+ transform: rotate(45deg) translate3d(5.5px, 5.5px, 0);
74
+ }
75
+
76
+ &:nth-child(2) {
77
+ transform: scale3d(0, 1, 1);
78
+ }
79
+
80
+ &:nth-child(3) {
81
+ transform: rotate(-45deg) translate3d(6px, -6px, 0);
82
+ }
83
+
84
+ &:nth-child(1),
85
+ &:nth-child(3) {
86
+ transform-origin: center;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ </style>