@vuepress/theme-default 2.0.0-rc.8 → 2.0.0-rc.80

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 (149) 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 +43 -0
  6. package/lib/client/components/VPHome.vue +38 -0
  7. package/lib/client/components/VPHomeFeatures.vue +65 -0
  8. package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -3
  9. package/lib/client/components/VPHomeHero.vue +185 -0
  10. package/lib/client/components/VPLightIcon.vue +28 -0
  11. package/lib/client/components/VPNavbar.vue +134 -0
  12. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +41 -16
  13. package/lib/client/components/VPNavbarDropdown.vue +331 -0
  14. package/lib/client/components/VPNavbarItems.vue +111 -0
  15. package/lib/client/components/VPPage.vue +69 -0
  16. package/lib/client/components/VPPageMeta.vue +134 -0
  17. package/lib/client/components/VPPageNav.vue +125 -0
  18. package/lib/client/components/VPSidebar.vue +113 -0
  19. package/lib/client/components/VPSidebarItem.vue +186 -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 +84 -18
  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 +9 -1
  27. package/lib/client/composables/index.js +9 -1
  28. package/lib/client/composables/useContributors.d.ts +3 -0
  29. package/lib/client/composables/useContributors.js +11 -0
  30. package/lib/client/composables/useDarkMode.d.ts +0 -1
  31. package/lib/client/composables/useDarkMode.js +19 -16
  32. package/lib/client/composables/useData.d.ts +13 -0
  33. package/lib/client/composables/useData.js +15 -0
  34. package/lib/client/composables/useEditLink.d.ts +3 -0
  35. package/lib/client/composables/useEditLink.js +28 -0
  36. package/lib/client/composables/useHeaders.d.ts +9 -0
  37. package/lib/client/composables/useHeaders.js +38 -0
  38. package/lib/client/composables/useLastUpdated.d.ts +2 -0
  39. package/lib/client/composables/useLastUpdated.js +14 -0
  40. package/lib/client/composables/useNavbarConfig.d.ts +3 -0
  41. package/lib/client/composables/useNavbarConfig.js +29 -0
  42. package/lib/client/composables/useNavbarRepo.d.ts +6 -0
  43. package/lib/client/composables/useNavbarRepo.js +38 -0
  44. package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
  45. package/lib/client/composables/useNavbarSelectLanguage.js +55 -0
  46. package/lib/client/composables/useNavigate.d.ts +1 -0
  47. package/lib/client/composables/useNavigate.js +22 -0
  48. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  49. package/lib/client/composables/useRelatedLinks.js +90 -0
  50. package/lib/client/composables/useScrollPromise.js +3 -1
  51. package/lib/client/composables/useSidebarItems.d.ts +21 -21
  52. package/lib/client/composables/useSidebarItems.js +96 -86
  53. package/lib/client/composables/useUpdateDeviceStatus.d.ts +1 -1
  54. package/lib/client/composables/useUpdateDeviceStatus.js +10 -5
  55. package/lib/client/config.d.ts +3 -2
  56. package/lib/client/config.js +8 -23
  57. package/lib/client/index.d.ts +2 -1
  58. package/lib/client/index.js +0 -1
  59. package/lib/client/layouts/Layout.vue +127 -54
  60. package/lib/client/layouts/NotFound.vue +25 -11
  61. package/lib/client/shim.d.ts +6 -5
  62. package/lib/client/styles/_mixins.scss +4 -4
  63. package/lib/client/styles/_variables.module.scss +1 -1
  64. package/lib/client/styles/_variables.scss +2 -1
  65. package/lib/client/styles/arrow.scss +18 -24
  66. package/lib/client/styles/code-group.scss +35 -30
  67. package/lib/client/styles/content/code.scss +23 -0
  68. package/lib/client/styles/content/index.scss +3 -0
  69. package/lib/client/styles/content/normalize.scss +39 -0
  70. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  71. package/lib/client/styles/external-link-icon.scss +36 -0
  72. package/lib/client/styles/index.scss +3 -13
  73. package/lib/client/styles/layout.scss +5 -197
  74. package/lib/client/styles/normalize.scss +1 -194
  75. package/lib/client/styles/plugins.scss +28 -0
  76. package/lib/client/styles/vars-dark.scss +20 -58
  77. package/lib/client/styles/vars.scss +54 -129
  78. package/lib/client/typings.d.ts +13 -0
  79. package/lib/client/typings.js +1 -0
  80. package/lib/client/utils/index.d.ts +2 -2
  81. package/lib/client/utils/index.js +2 -2
  82. package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
  83. package/lib/client/utils/isActiveSidebarItem.js +1 -1
  84. package/lib/client/utils/resolveAutoLink.d.ts +9 -0
  85. package/lib/client/utils/resolveAutoLink.js +17 -0
  86. package/lib/client/utils/resolveEditLink.d.ts +3 -3
  87. package/lib/client/utils/resolveEditLink.js +3 -3
  88. package/lib/client/utils/resolvePrefix.d.ts +1 -0
  89. package/lib/client/utils/resolvePrefix.js +4 -0
  90. package/lib/client/utils/resolveRepoType.d.ts +1 -1
  91. package/lib/client/utils/resolveRepoType.js +4 -4
  92. package/lib/node/defaultTheme.d.ts +2 -1
  93. package/lib/node/defaultTheme.js +50 -56
  94. package/lib/node/index.d.ts +2 -3
  95. package/lib/node/index.js +0 -3
  96. package/lib/node/typings.d.ts +58 -0
  97. package/lib/node/typings.js +1 -0
  98. package/lib/node/utils/assignDefaultLocaleOptions.js +3 -7
  99. package/lib/node/utils/index.d.ts +1 -1
  100. package/lib/node/utils/index.js +1 -1
  101. package/lib/node/utils/resolveMarkdownHintLocales.d.ts +9 -0
  102. package/lib/node/utils/resolveMarkdownHintLocales.js +19 -0
  103. package/lib/shared/index.d.ts +5 -3
  104. package/lib/shared/index.js +1 -3
  105. package/lib/shared/nav.d.ts +19 -30
  106. package/lib/shared/navbar.d.ts +21 -0
  107. package/lib/shared/navbar.js +1 -0
  108. package/lib/shared/options.d.ts +36 -65
  109. package/lib/shared/page.d.ts +9 -6
  110. package/lib/shared/sidebar.d.ts +26 -0
  111. package/lib/shared/sidebar.js +1 -0
  112. package/package.json +29 -27
  113. package/templates/build.html +16 -10
  114. package/lib/client/components/AutoLink.vue +0 -113
  115. package/lib/client/components/DropdownTransition.vue +0 -25
  116. package/lib/client/components/Home.vue +0 -15
  117. package/lib/client/components/HomeContent.vue +0 -5
  118. package/lib/client/components/HomeFeatures.vue +0 -22
  119. package/lib/client/components/HomeHero.vue +0 -97
  120. package/lib/client/components/Navbar.vue +0 -79
  121. package/lib/client/components/NavbarDropdown.vue +0 -126
  122. package/lib/client/components/NavbarItems.vue +0 -199
  123. package/lib/client/components/Page.vue +0 -31
  124. package/lib/client/components/PageMeta.vue +0 -124
  125. package/lib/client/components/PageNav.vue +0 -122
  126. package/lib/client/components/Sidebar.vue +0 -18
  127. package/lib/client/components/SidebarItem.vue +0 -87
  128. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  129. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  130. package/lib/client/components/global/CodeGroup.d.ts +0 -6
  131. package/lib/client/components/global/CodeGroup.js +0 -120
  132. package/lib/client/components/global/CodeGroupItem.vue +0 -27
  133. package/lib/client/composables/useThemeData.d.ts +0 -4
  134. package/lib/client/composables/useThemeData.js +0 -3
  135. package/lib/client/styles/badge.scss +0 -36
  136. package/lib/client/styles/code.scss +0 -263
  137. package/lib/client/styles/custom-container.scss +0 -142
  138. package/lib/client/styles/home.scss +0 -168
  139. package/lib/client/styles/navbar-dropdown.scss +0 -183
  140. package/lib/client/styles/navbar.scss +0 -197
  141. package/lib/client/styles/page.scss +0 -87
  142. package/lib/client/styles/sidebar.scss +0 -134
  143. package/lib/client/styles/transitions.scss +0 -22
  144. package/lib/client/utils/getNavLink.d.ts +0 -15
  145. package/lib/client/utils/getNavLink.js +0 -18
  146. package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
  147. package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
  148. package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
  149. package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
@@ -1,17 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { computed, h } from 'vue'
2
+ import { useDarkMode } from '@theme/useDarkMode'
3
+ import { useData } from '@theme/useData'
3
4
  import type { FunctionalComponent } from 'vue'
4
- import {
5
- ClientOnly,
6
- useRouteLocale,
7
- useSiteLocaleData,
8
- withBase,
9
- } from 'vuepress/client'
10
- import { useDarkMode, useThemeLocaleData } from '../composables/index.js'
5
+ import { computed, h } from 'vue'
6
+ import { ClientOnly, RouteLink, withBase } from 'vuepress/client'
11
7
 
12
- const routeLocale = useRouteLocale()
13
- const siteLocale = useSiteLocaleData()
14
- const themeLocale = useThemeLocaleData()
8
+ const { routeLocale, siteLocale, themeLocale } = useData()
15
9
  const isDarkMode = useDarkMode()
16
10
 
17
11
  const navbarBrandLink = computed(
@@ -35,7 +29,7 @@ const navBarLogoAltMatchesTitle = computed(
35
29
  const NavbarBrandLogo: FunctionalComponent = () => {
36
30
  if (!navbarBrandLogo.value) return null
37
31
  const img = h('img', {
38
- class: 'logo',
32
+ class: 'vp-site-logo',
39
33
  src: withBase(navbarBrandLogo.value),
40
34
  alt: navbarBrandLogoAlt.value,
41
35
  })
@@ -49,16 +43,47 @@ const NavbarBrandLogo: FunctionalComponent = () => {
49
43
  </script>
50
44
 
51
45
  <template>
52
- <RouterLink :to="navbarBrandLink">
46
+ <RouteLink :to="navbarBrandLink">
53
47
  <NavbarBrandLogo />
54
48
 
55
49
  <span
56
50
  v-if="navbarBrandTitle"
57
- class="site-name"
58
- :class="{ 'can-hide': navbarBrandLogo }"
51
+ class="vp-site-name"
52
+ :class="{ 'vp-hide-mobile': navbarBrandLogo }"
59
53
  :aria-hidden="navBarLogoAltMatchesTitle"
60
54
  >
61
55
  {{ navbarBrandTitle }}
62
56
  </span>
63
- </RouterLink>
57
+ </RouteLink>
64
58
  </template>
59
+
60
+ <style lang="scss">
61
+ @use '../styles/variables' as *;
62
+
63
+ .vp-site-logo {
64
+ vertical-align: top;
65
+ height: var(--navbar-line-height);
66
+ margin-right: var(--navbar-padding-v);
67
+ }
68
+
69
+ .vp-site-name {
70
+ position: relative;
71
+ color: var(--vp-c-text);
72
+ font-weight: 600;
73
+ font-size: 1.3rem;
74
+
75
+ @media screen and (max-width: $MQMobile) {
76
+ display: block;
77
+
78
+ overflow: hidden;
79
+
80
+ // 5.5rem for navbar padding-inline
81
+ // 4.5rem for ColorModeSwitch and SearchBox
82
+ // 1rem for gap
83
+ width: calc(100vw - 11rem);
84
+
85
+ text-overflow: ellipsis;
86
+ white-space: nowrap;
87
+ }
88
+ }
89
+ </style>
@@ -0,0 +1,331 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
4
+ import { useToggle } from '@vueuse/core'
5
+ import { computed, toRefs } from 'vue'
6
+ import { onContentUpdated } from 'vuepress/client'
7
+ import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
8
+
9
+ const props = defineProps<{
10
+ /** dropdown config */
11
+ config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
12
+ }>()
13
+
14
+ const { config } = toRefs(props)
15
+
16
+ const [open, toggleOpen] = useToggle(false)
17
+
18
+ const dropdownAriaLabel = computed(
19
+ () => config.value.ariaLabel || config.value.text,
20
+ )
21
+
22
+ const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
23
+ array[array.length - 1] === arrayItem
24
+
25
+ /**
26
+ * Open the dropdown when user tab and click from keyboard.
27
+ *
28
+ * Use event.detail to detect tab and click from keyboard.
29
+ * The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
30
+ *
31
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
32
+ */
33
+ const handleDropdown = (e: UIEvent): void => {
34
+ if (e.detail === 0) toggleOpen()
35
+ else toggleOpen(false)
36
+ }
37
+
38
+ onContentUpdated(() => {
39
+ toggleOpen(false)
40
+ })
41
+ </script>
42
+
43
+ <template>
44
+ <div class="vp-navbar-dropdown-wrapper" :class="{ open }">
45
+ <button
46
+ class="vp-navbar-dropdown-title"
47
+ type="button"
48
+ :aria-label="dropdownAriaLabel"
49
+ @click="handleDropdown"
50
+ >
51
+ <span class="title">{{ config.text }}</span>
52
+ <span class="arrow down" />
53
+ </button>
54
+
55
+ <button
56
+ class="vp-navbar-dropdown-title-mobile"
57
+ type="button"
58
+ :aria-label="dropdownAriaLabel"
59
+ @click="() => toggleOpen()"
60
+ >
61
+ <span class="title">{{ config.text }}</span>
62
+ <span class="arrow" :class="open ? 'down' : 'right'" />
63
+ </button>
64
+
65
+ <VPDropdownTransition>
66
+ <ul v-show="open" class="vp-navbar-dropdown">
67
+ <li
68
+ v-for="child in config.children"
69
+ :key="child.text"
70
+ class="vp-navbar-dropdown-item"
71
+ >
72
+ <template v-if="'children' in child">
73
+ <h4 class="vp-navbar-dropdown-subtitle">
74
+ <VPAutoLink
75
+ v-if="child.link"
76
+ :config="child"
77
+ @focusout="
78
+ () => {
79
+ if (
80
+ isLastItemOfArray(child, config.children) &&
81
+ child.children.length === 0
82
+ ) {
83
+ open = false
84
+ }
85
+ }
86
+ "
87
+ />
88
+
89
+ <span v-else>{{ child.text }}</span>
90
+ </h4>
91
+
92
+ <ul class="vp-navbar-dropdown-subitem-wrapper">
93
+ <li
94
+ v-for="grandchild in child.children"
95
+ :key="grandchild.link"
96
+ class="vp-navbar-dropdown-subitem"
97
+ >
98
+ <VPAutoLink
99
+ :config="grandchild"
100
+ @focusout="
101
+ () => {
102
+ if (
103
+ isLastItemOfArray(grandchild, child.children) &&
104
+ isLastItemOfArray(child, config.children)
105
+ ) {
106
+ toggleOpen(false)
107
+ }
108
+ }
109
+ "
110
+ />
111
+ </li>
112
+ </ul>
113
+ </template>
114
+
115
+ <template v-else>
116
+ <VPAutoLink
117
+ :config="child"
118
+ @focusout="
119
+ () => {
120
+ if (isLastItemOfArray(child, config.children)) {
121
+ toggleOpen(false)
122
+ }
123
+ }
124
+ "
125
+ />
126
+ </template>
127
+ </li>
128
+ </ul>
129
+ </VPDropdownTransition>
130
+ </div>
131
+ </template>
132
+
133
+ <style lang="scss">
134
+ @use '../styles/mixins';
135
+ @use '../styles/variables' as *;
136
+
137
+ .vp-navbar-dropdown-wrapper {
138
+ cursor: pointer;
139
+
140
+ &:not(.mobile) {
141
+ height: 1.8rem;
142
+
143
+ &:hover,
144
+ &.open {
145
+ .vp-navbar-dropdown {
146
+ // override the inline style.
147
+ display: block !important;
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ .vp-navbar-dropdown {
154
+ .vp-navbar-dropdown-wrapper.mobile & {
155
+ @include mixins.dropdown-wrapper;
156
+
157
+ padding-top: 0.5rem;
158
+ }
159
+
160
+ .vp-navbar-dropdown-wrapper:not(.mobile) & {
161
+ position: absolute;
162
+ top: 100%;
163
+ right: 0;
164
+
165
+ display: none;
166
+
167
+ overflow-y: auto;
168
+
169
+ box-sizing: border-box;
170
+
171
+ // Avoid height shake by clicking
172
+ height: auto !important;
173
+ max-height: calc(100vh - 2.7rem);
174
+ margin: 0;
175
+ padding: 0.6rem 0;
176
+ border: 1px solid var(--vp-c-gutter);
177
+ border-radius: 0.5rem;
178
+
179
+ background-color: var(--vp-c-bg-elv);
180
+
181
+ text-align: left;
182
+ white-space: nowrap;
183
+ }
184
+ }
185
+
186
+ .vp-navbar-dropdown-title {
187
+ display: block;
188
+
189
+ padding: inherit;
190
+ border: none;
191
+
192
+ background: transparent;
193
+ color: var(--vp-c-text);
194
+
195
+ font-weight: 500;
196
+ font-size: 0.9rem;
197
+ font-family: inherit;
198
+ line-height: 1.4rem;
199
+
200
+ cursor: inherit;
201
+
202
+ .vp-navbar-dropdown-wrapper.mobile & {
203
+ display: none;
204
+ }
205
+
206
+ &:hover {
207
+ border-color: transparent;
208
+ }
209
+ }
210
+
211
+ .vp-navbar-dropdown-title-mobile {
212
+ display: none;
213
+
214
+ padding: inherit;
215
+ border: none;
216
+
217
+ background: transparent;
218
+ color: var(--vp-c-text);
219
+
220
+ font-weight: 600;
221
+ font-size: inherit;
222
+ font-family: inherit;
223
+ line-height: 1.4rem;
224
+
225
+ cursor: inherit;
226
+
227
+ .vp-navbar-dropdown-wrapper.mobile & {
228
+ display: block;
229
+ }
230
+
231
+ &:hover {
232
+ color: var(--vp-c-accent);
233
+ }
234
+ }
235
+
236
+ .vp-navbar-dropdown-item {
237
+ color: inherit;
238
+ line-height: 1.7rem;
239
+
240
+ .auto-link {
241
+ position: relative;
242
+
243
+ display: block;
244
+
245
+ margin-bottom: 0;
246
+ padding: 0 1.25rem;
247
+ border-bottom: none;
248
+
249
+ font-weight: 400;
250
+ line-height: 1.7rem;
251
+
252
+ &:hover {
253
+ color: var(--vp-c-accent);
254
+ }
255
+
256
+ &.auto-link-active {
257
+ color: var(--vp-c-accent);
258
+
259
+ &::after {
260
+ content: '';
261
+
262
+ position: absolute;
263
+ top: calc(50% - 2px);
264
+ left: 9px;
265
+
266
+ width: 0;
267
+ height: 0;
268
+ border-top: 3px solid transparent;
269
+ border-bottom: 3px solid transparent;
270
+ border-left: 5px solid var(--vp-c-accent);
271
+ }
272
+ }
273
+ }
274
+
275
+ .vp-navbar-dropdown-wrapper.mobile & > a {
276
+ font-size: 15px;
277
+ line-height: 2rem;
278
+ }
279
+ }
280
+
281
+ .vp-navbar-dropdown-subtitle {
282
+ margin: 0.45rem 0 0;
283
+ padding: 1rem 0 0.45rem;
284
+ border-top: 1px solid var(--vp-c-gutter);
285
+ font-size: 0.9rem;
286
+
287
+ .vp-navbar-dropdown-wrapper.mobile & {
288
+ margin-top: 0;
289
+ padding-top: 0;
290
+ padding-bottom: 0;
291
+ border-top: 0;
292
+
293
+ font-size: 15px;
294
+ line-height: 2rem;
295
+ }
296
+
297
+ .vp-navbar-dropdown-item:first-child & {
298
+ margin-top: 0;
299
+ padding-top: 0;
300
+ border-top: 0;
301
+ }
302
+
303
+ > span {
304
+ padding: 0 1.5rem 0 1.25rem;
305
+ }
306
+
307
+ > .auto-link {
308
+ font-weight: inherit;
309
+
310
+ &.auto-link-active {
311
+ &::after {
312
+ display: none;
313
+ }
314
+ }
315
+ }
316
+ }
317
+
318
+ .vp-navbar-dropdown-subitem-wrapper {
319
+ padding: 0;
320
+ list-style: none;
321
+ }
322
+
323
+ .vp-navbar-dropdown-subitem {
324
+ font-size: 0.9em;
325
+
326
+ .vp-navbar-dropdown-wrapper.mobile & {
327
+ padding-left: 1rem;
328
+ font-size: 14px;
329
+ }
330
+ }
331
+ </style>
@@ -0,0 +1,111 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import VPNavbarDropdown from '@theme/VPNavbarDropdown.vue'
4
+ import { useData } from '@theme/useData'
5
+ import { useNavbarConfig } from '@theme/useNavbarConfig'
6
+ import { useNavbarRepo } from '@theme/useNavbarRepo'
7
+ import { useNavbarSelectLanguage } from '@theme/useNavbarSelectLanguage'
8
+ import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
9
+ import { computed, ref } from 'vue'
10
+
11
+ const { themeLocale } = useData()
12
+ const navbarConfig = useNavbarConfig()
13
+ const navbarSelectLanguage = useNavbarSelectLanguage()
14
+ const navbarRepo = useNavbarRepo()
15
+
16
+ const isMobile = ref(false)
17
+
18
+ const navbarLabel = computed(() => {
19
+ return themeLocale.value.navbarLabel ?? 'site navigation'
20
+ })
21
+
22
+ const navbarLinks = computed(() => [
23
+ ...navbarConfig.value,
24
+ ...navbarSelectLanguage.value,
25
+ ...navbarRepo.value,
26
+ ])
27
+
28
+ useUpdateDeviceStatus(
29
+ DeviceType.Mobile,
30
+ (mobileDesktopBreakpoint: number): void => {
31
+ // avoid overlapping of long title and long navbar links
32
+ isMobile.value = window.innerWidth < mobileDesktopBreakpoint
33
+ },
34
+ )
35
+ </script>
36
+
37
+ <template>
38
+ <nav
39
+ v-if="navbarLinks.length"
40
+ class="vp-navbar-items"
41
+ :aria-label="navbarLabel"
42
+ >
43
+ <div v-for="item in navbarLinks" :key="item.text" class="vp-navbar-item">
44
+ <VPNavbarDropdown
45
+ v-if="'children' in item"
46
+ :class="{ mobile: isMobile }"
47
+ :config="item"
48
+ />
49
+ <VPAutoLink v-else :config="item" />
50
+ </div>
51
+ </nav>
52
+ </template>
53
+
54
+ <style lang="scss">
55
+ @use '../styles/variables' as *;
56
+
57
+ .vp-navbar-items {
58
+ display: inline-block;
59
+
60
+ @media print {
61
+ display: none;
62
+ }
63
+
64
+ .auto-link {
65
+ color: inherit;
66
+ line-height: 1.4rem;
67
+
68
+ &:hover,
69
+ &.auto-link-active {
70
+ color: var(--vp-c-text);
71
+ }
72
+ }
73
+ }
74
+
75
+ .vp-navbar-item {
76
+ position: relative;
77
+ display: inline-block;
78
+ margin-left: 1.5rem;
79
+ line-height: var(--navbar-line-height);
80
+
81
+ @media (max-width: $MQMobile) {
82
+ margin-left: 0;
83
+ }
84
+
85
+ &:first-child {
86
+ margin-left: 0;
87
+ }
88
+
89
+ .auto-link {
90
+ &:hover,
91
+ &.auto-link-active {
92
+ color: var(--vp-c-accent);
93
+ }
94
+ }
95
+
96
+ > .auto-link {
97
+ display: inline-block;
98
+
99
+ &:hover,
100
+ &.auto-link-active {
101
+ margin-bottom: -2px;
102
+ border-bottom: 2px solid var(--vp-c-accent);
103
+
104
+ @media (max-width: $MQMobile) {
105
+ margin-bottom: 0;
106
+ border-bottom: none;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ </style>
@@ -0,0 +1,69 @@
1
+ <script setup lang="ts">
2
+ import VPPageMeta from '@theme/VPPageMeta.vue'
3
+ import VPPageNav from '@theme/VPPageNav.vue'
4
+ import type { VNode } from 'vue'
5
+ import { Content } from 'vuepress/client'
6
+
7
+ defineSlots<{
8
+ 'top'?: (props: Record<never, never>) => VNode | VNode[] | null
9
+ 'bottom'?: (props: Record<never, never>) => VNode | VNode[] | null
10
+ 'content-top'?: (props: Record<never, never>) => VNode | VNode[] | null
11
+ 'content-bottom'?: (props: Record<never, never>) => VNode | VNode[] | null
12
+ }>()
13
+ </script>
14
+
15
+ <template>
16
+ <main class="vp-page">
17
+ <slot name="top" />
18
+
19
+ <div vp-content>
20
+ <slot name="content-top" />
21
+
22
+ <Content />
23
+
24
+ <slot name="content-bottom" />
25
+ </div>
26
+
27
+ <VPPageMeta />
28
+
29
+ <VPPageNav />
30
+
31
+ <slot name="bottom" />
32
+ </main>
33
+ </template>
34
+
35
+ <style lang="scss">
36
+ @use '../styles/mixins';
37
+ @use '../styles/variables' as *;
38
+
39
+ .vp-page {
40
+ display: block;
41
+
42
+ // leave space for navbar
43
+ padding-top: var(--navbar-height);
44
+ padding-bottom: 2rem;
45
+
46
+ // leave space for sidebar
47
+ padding-left: var(--sidebar-width);
48
+
49
+ // narrow desktop / iPad
50
+ @media (max-width: $MQNarrow) {
51
+ // leave space for sidebar
52
+ padding-left: var(--sidebar-width-mobile);
53
+ }
54
+
55
+ // wide mobile
56
+ @media (max-width: $MQMobile) {
57
+ // sidebar is collapsed
58
+ padding-left: 0;
59
+ }
60
+
61
+ [vp-content] {
62
+ @include mixins.content-wrapper;
63
+
64
+ & {
65
+ padding-top: 0;
66
+ }
67
+ }
68
+ }
69
+ </style>