@vuepress/theme-default 2.0.0-rc.10 → 2.0.0-rc.101

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 +330 -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 +139 -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 +189 -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 +7 -1
  27. package/lib/client/composables/index.js +7 -1
  28. package/lib/client/composables/useDarkMode.d.ts +0 -1
  29. package/lib/client/composables/useDarkMode.js +19 -16
  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 +55 -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 +128 -56
  55. package/lib/client/layouts/NotFound.vue +24 -10
  56. package/lib/client/shim.d.ts +6 -5
  57. package/lib/client/styles/_mixins.scss +4 -4
  58. package/lib/client/styles/_variables.module.scss +1 -1
  59. package/lib/client/styles/_variables.scss +2 -1
  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 +23 -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 -139
  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 +29 -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,330 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import { FadeInExpandTransition } from '@vuepress/helper/client'
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
+ import '@vuepress/helper/transition/fade-in-height-expand.css'
10
+
11
+ const props = defineProps<{
12
+ /** dropdown config */
13
+ config: NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>
14
+ }>()
15
+
16
+ const { config } = toRefs(props)
17
+
18
+ const [open, toggleOpen] = useToggle()
19
+
20
+ const dropdownAriaLabel = computed(
21
+ () => config.value.ariaLabel || config.value.text,
22
+ )
23
+
24
+ const isLastItemOfArray = (arrayItem: unknown, array: unknown[]): boolean =>
25
+ array[array.length - 1] === arrayItem
26
+
27
+ /**
28
+ * Open the dropdown when user tab and click from keyboard.
29
+ *
30
+ * Use event.detail to detect tab and click from keyboard.
31
+ * The Tab + Click is UIEvent > KeyboardEvent, so the detail is 0.
32
+ *
33
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail
34
+ */
35
+ const handleDropdown = (e: UIEvent): void => {
36
+ if (e.detail === 0) toggleOpen()
37
+ else toggleOpen(false)
38
+ }
39
+
40
+ onContentUpdated(() => {
41
+ toggleOpen(false)
42
+ })
43
+ </script>
44
+
45
+ <template>
46
+ <div class="vp-navbar-dropdown-wrapper" :class="{ open }">
47
+ <button
48
+ class="vp-navbar-dropdown-title"
49
+ type="button"
50
+ :aria-label="dropdownAriaLabel"
51
+ @click="handleDropdown"
52
+ >
53
+ <span class="title">{{ config.text }}</span>
54
+ <span class="arrow down" />
55
+ </button>
56
+
57
+ <button
58
+ class="vp-navbar-dropdown-title-mobile"
59
+ type="button"
60
+ :aria-label="dropdownAriaLabel"
61
+ @click="() => toggleOpen()"
62
+ >
63
+ <span class="title">{{ config.text }}</span>
64
+ <span class="arrow" :class="open ? 'down' : 'right'" />
65
+ </button>
66
+
67
+ <FadeInExpandTransition>
68
+ <ul v-show="open" class="vp-navbar-dropdown">
69
+ <li
70
+ v-for="child in config.children"
71
+ :key="child.text"
72
+ class="vp-navbar-dropdown-item"
73
+ >
74
+ <template v-if="'children' in child">
75
+ <h4 class="vp-navbar-dropdown-subtitle">
76
+ <VPAutoLink
77
+ v-if="child.link"
78
+ :config="child"
79
+ @focusout="
80
+ () => {
81
+ if (
82
+ isLastItemOfArray(child, config.children) &&
83
+ child.children.length === 0
84
+ ) {
85
+ open = false
86
+ }
87
+ }
88
+ "
89
+ />
90
+
91
+ <span v-else>{{ child.text }}</span>
92
+ </h4>
93
+
94
+ <ul class="vp-navbar-dropdown-subitem-wrapper">
95
+ <li
96
+ v-for="grandchild in child.children"
97
+ :key="grandchild.link"
98
+ class="vp-navbar-dropdown-subitem"
99
+ >
100
+ <VPAutoLink
101
+ :config="grandchild"
102
+ @focusout="
103
+ () => {
104
+ if (
105
+ isLastItemOfArray(grandchild, child.children) &&
106
+ isLastItemOfArray(child, config.children)
107
+ ) {
108
+ toggleOpen(false)
109
+ }
110
+ }
111
+ "
112
+ />
113
+ </li>
114
+ </ul>
115
+ </template>
116
+
117
+ <template v-else>
118
+ <VPAutoLink
119
+ :config="child"
120
+ @focusout="
121
+ () => {
122
+ if (isLastItemOfArray(child, config.children)) {
123
+ toggleOpen(false)
124
+ }
125
+ }
126
+ "
127
+ />
128
+ </template>
129
+ </li>
130
+ </ul>
131
+ </FadeInExpandTransition>
132
+ </div>
133
+ </template>
134
+
135
+ <style lang="scss">
136
+ @use '../styles/mixins';
137
+ @use '../styles/variables' as *;
138
+
139
+ .vp-navbar-dropdown-wrapper {
140
+ cursor: pointer;
141
+
142
+ &:not(.mobile) {
143
+ height: 1.8rem;
144
+
145
+ &:hover,
146
+ &.open {
147
+ .vp-navbar-dropdown {
148
+ // override the inline style.
149
+ display: block !important;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ .vp-navbar-dropdown {
156
+ .vp-navbar-dropdown-wrapper.mobile & {
157
+ @include mixins.dropdown-wrapper;
158
+
159
+ padding-top: 0.5rem;
160
+ }
161
+
162
+ .vp-navbar-dropdown-wrapper:not(.mobile) & {
163
+ position: absolute;
164
+ inset-inline-end: 0;
165
+ top: 100%;
166
+
167
+ display: none;
168
+
169
+ overflow-y: auto;
170
+
171
+ box-sizing: border-box;
172
+
173
+ // Avoid height shake by clicking
174
+ height: auto !important;
175
+ max-height: calc(100vh - 2.7rem);
176
+ margin: 0;
177
+ padding: 0.6rem 0;
178
+ border: 1px solid var(--vp-c-gutter);
179
+ border-radius: 0.5rem;
180
+
181
+ background-color: var(--vp-c-bg-elv);
182
+
183
+ text-align: start;
184
+ white-space: nowrap;
185
+ }
186
+ }
187
+
188
+ .vp-navbar-dropdown-title {
189
+ display: block;
190
+
191
+ padding: inherit;
192
+ border: none;
193
+
194
+ background: transparent;
195
+ color: var(--vp-c-text);
196
+
197
+ font-weight: 500;
198
+ font-size: 0.9rem;
199
+ font-family: inherit;
200
+ line-height: 1.4rem;
201
+
202
+ cursor: inherit;
203
+
204
+ .vp-navbar-dropdown-wrapper.mobile & {
205
+ display: none;
206
+ }
207
+
208
+ &:hover {
209
+ border-color: transparent;
210
+ }
211
+ }
212
+
213
+ .vp-navbar-dropdown-title-mobile {
214
+ display: none;
215
+
216
+ padding: inherit;
217
+ border: none;
218
+
219
+ background: transparent;
220
+ color: var(--vp-c-text);
221
+
222
+ font-weight: 600;
223
+ font-size: inherit;
224
+ font-family: inherit;
225
+ line-height: 1.4rem;
226
+
227
+ cursor: inherit;
228
+
229
+ .vp-navbar-dropdown-wrapper.mobile & {
230
+ display: block;
231
+ }
232
+
233
+ &:hover {
234
+ color: var(--vp-c-accent);
235
+ }
236
+ }
237
+
238
+ .vp-navbar-dropdown-item {
239
+ color: inherit;
240
+ line-height: 1.7rem;
241
+
242
+ .auto-link {
243
+ position: relative;
244
+
245
+ display: block;
246
+
247
+ margin-bottom: 0;
248
+ padding: 0 1.25rem;
249
+ border-bottom: none;
250
+
251
+ font-weight: 400;
252
+ line-height: 1.7rem;
253
+
254
+ &:hover {
255
+ color: var(--vp-c-accent);
256
+ }
257
+
258
+ &.route-link-active {
259
+ color: var(--vp-c-accent);
260
+
261
+ &::after {
262
+ content: '';
263
+
264
+ position: absolute;
265
+ inset-inline-start: 9px;
266
+ top: calc(50% - 2px);
267
+
268
+ width: 0;
269
+ height: 0;
270
+ border-top: 3px solid transparent;
271
+ border-bottom: 3px solid transparent;
272
+ border-inline-start: 5px solid var(--vp-c-accent);
273
+ }
274
+ }
275
+ }
276
+
277
+ .vp-navbar-dropdown-wrapper.mobile & > a {
278
+ line-height: 2rem;
279
+ }
280
+ }
281
+
282
+ .vp-navbar-dropdown-subtitle {
283
+ margin: 0.45rem 0 0;
284
+ padding: 1rem 0 0.45rem;
285
+ border-top: 1px solid var(--vp-c-gutter);
286
+ font-size: 0.9rem;
287
+
288
+ .vp-navbar-dropdown-wrapper.mobile & {
289
+ margin-top: 0;
290
+ padding-top: 0;
291
+ padding-bottom: 0;
292
+ border-top: 0;
293
+
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-inline: 1.25rem 1.5rem;
305
+ }
306
+
307
+ > .auto-link {
308
+ font-weight: inherit;
309
+
310
+ &.route-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-inline-start: 1rem;
328
+ }
329
+ }
330
+ </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
+ &.route-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-inline-start: 1.5rem;
79
+ line-height: var(--navbar-line-height);
80
+
81
+ @media (max-width: $MQMobile) {
82
+ margin-inline-start: 0;
83
+ }
84
+
85
+ &:first-child {
86
+ margin-inline-start: 0;
87
+ }
88
+
89
+ .auto-link {
90
+ &:hover,
91
+ &.route-link-active {
92
+ color: var(--vp-c-accent);
93
+ }
94
+ }
95
+
96
+ > .auto-link {
97
+ display: inline-block;
98
+
99
+ &:hover,
100
+ &.route-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-inline-start: var(--sidebar-width);
48
+
49
+ // narrow desktop / iPad
50
+ @media (max-width: $MQNarrow) {
51
+ // leave space for sidebar
52
+ padding-inline-start: var(--sidebar-width-mobile);
53
+ }
54
+
55
+ // wide mobile
56
+ @media (max-width: $MQMobile) {
57
+ // sidebar is collapsed
58
+ padding-inline-start: 0;
59
+ }
60
+
61
+ [vp-content] {
62
+ @include mixins.content-wrapper;
63
+
64
+ & {
65
+ padding-top: 0;
66
+ }
67
+ }
68
+ }
69
+ </style>
@@ -0,0 +1,139 @@
1
+ <script setup lang="ts">
2
+ import VPAutoLink from '@theme/VPAutoLink.vue'
3
+ import VPEditIcon from '@theme/VPEditIcon.vue'
4
+ import { useData } from '@theme/useData'
5
+ import { useEditLink } from '@theme/useEditLink'
6
+ import { useContributors, useLastUpdated } from '@vuepress/plugin-git/client'
7
+
8
+ const { frontmatter, themeLocale } = useData()
9
+ const contributors = useContributors(
10
+ () =>
11
+ frontmatter.value.contributors ?? themeLocale.value.contributors ?? true,
12
+ )
13
+ const editLink = useEditLink()
14
+ const lastUpdated = useLastUpdated(
15
+ () => frontmatter.value.lastUpdated ?? themeLocale.value.lastUpdated ?? true,
16
+ )
17
+ </script>
18
+
19
+ <template>
20
+ <footer class="vp-page-meta">
21
+ <div v-if="editLink" class="vp-meta-item edit-link">
22
+ <VPAutoLink class="label" :config="editLink">
23
+ <template #before>
24
+ <VPEditIcon />
25
+ </template>
26
+ </VPAutoLink>
27
+ </div>
28
+
29
+ <div class="vp-meta-item git-info">
30
+ <div v-if="lastUpdated" class="vp-meta-item last-updated">
31
+ <span class="meta-item-label"
32
+ >{{ themeLocale.lastUpdatedText ?? lastUpdated.locale }}:
33
+ </span>
34
+ <time
35
+ class="meta-item-info"
36
+ :datetime="lastUpdated.iso"
37
+ data-allow-mismatch
38
+ >{{ lastUpdated.text }}</time
39
+ >
40
+ </div>
41
+
42
+ <div v-if="contributors.length" class="vp-meta-item contributors">
43
+ <span class="meta-item-label"
44
+ >{{ themeLocale.contributorsText }}:
45
+ </span>
46
+ <span class="meta-item-info">
47
+ <template v-for="(contributor, index) in contributors" :key="index">
48
+ <span class="contributor" :title="`email: ${contributor.email}`">
49
+ {{ contributor.name }}
50
+ </span>
51
+ <template v-if="index !== contributors.length - 1">, </template>
52
+ </template>
53
+ </span>
54
+ </div>
55
+ </div>
56
+ </footer>
57
+ </template>
58
+
59
+ <style lang="scss">
60
+ @use '../styles/mixins';
61
+ @use '../styles/variables' as *;
62
+
63
+ .vp-page-meta {
64
+ @include mixins.content-wrapper;
65
+
66
+ & {
67
+ display: flex;
68
+ flex-wrap: wrap;
69
+ justify-content: space-between;
70
+
71
+ overflow: auto;
72
+
73
+ padding-top: 0.75rem;
74
+ padding-bottom: 0.75rem;
75
+ }
76
+
77
+ @media print {
78
+ margin: 0 !important;
79
+ padding-inline: 0 !important;
80
+ }
81
+
82
+ @media (max-width: $MQMobile) {
83
+ display: block;
84
+ }
85
+
86
+ .vp-meta-item {
87
+ flex-grow: 1;
88
+
89
+ .vp-meta-label {
90
+ font-weight: 500;
91
+
92
+ &:not(a) {
93
+ color: var(--vp-c-text-mute);
94
+ }
95
+ }
96
+
97
+ .vp-meta-info {
98
+ color: var(--vp-c-text-mute);
99
+ font-weight: 400;
100
+ }
101
+ }
102
+
103
+ .git-info {
104
+ text-align: end;
105
+ }
106
+
107
+ .edit-link {
108
+ margin-top: 0.25rem;
109
+ margin-bottom: 0.25rem;
110
+ margin-inline-end: 0.5rem;
111
+ font-size: 0.875em;
112
+
113
+ @media print {
114
+ display: none;
115
+ }
116
+
117
+ .edit-icon {
118
+ position: relative;
119
+ bottom: -0.125em;
120
+
121
+ width: 1em;
122
+ height: 1em;
123
+ margin-inline-end: 0.25em;
124
+ }
125
+ }
126
+
127
+ .last-updated,
128
+ .contributors {
129
+ margin-top: 0.25rem;
130
+ margin-bottom: 0.25rem;
131
+ font-size: 0.875em;
132
+
133
+ @media (max-width: $MQMobile) {
134
+ font-size: 0.825em;
135
+ text-align: start;
136
+ }
137
+ }
138
+ }
139
+ </style>