themekit-js 1.1.0

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 (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/bin/themekit.js +2 -0
  4. package/client.d.ts +5 -0
  5. package/dist/client/app/components/ClientOnly.js +10 -0
  6. package/dist/client/app/components/Content.js +23 -0
  7. package/dist/client/app/composables/codeGroups.js +40 -0
  8. package/dist/client/app/composables/copyCode.js +73 -0
  9. package/dist/client/app/composables/head.js +81 -0
  10. package/dist/client/app/composables/preFetch.js +99 -0
  11. package/dist/client/app/data.js +59 -0
  12. package/dist/client/app/devtools.js +29 -0
  13. package/dist/client/app/index.js +140 -0
  14. package/dist/client/app/router.js +233 -0
  15. package/dist/client/app/ssr.js +10 -0
  16. package/dist/client/app/theme.js +1 -0
  17. package/dist/client/app/utils.js +119 -0
  18. package/dist/client/index.d.ts +1446 -0
  19. package/dist/client/index.js +9 -0
  20. package/dist/client/shared.js +139 -0
  21. package/dist/client/theme-default/Layout.vue +94 -0
  22. package/dist/client/theme-default/NotFound.vue +109 -0
  23. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +99 -0
  24. package/dist/client/theme-default/components/VPBackdrop.vue +41 -0
  25. package/dist/client/theme-default/components/VPBadge.vue +86 -0
  26. package/dist/client/theme-default/components/VPButton.vue +123 -0
  27. package/dist/client/theme-default/components/VPCarbonAds.vue +109 -0
  28. package/dist/client/theme-default/components/VPContent.vue +98 -0
  29. package/dist/client/theme-default/components/VPDoc.vue +193 -0
  30. package/dist/client/theme-default/components/VPDocAside.vue +46 -0
  31. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +18 -0
  32. package/dist/client/theme-default/components/VPDocAsideOutline.vue +87 -0
  33. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -0
  34. package/dist/client/theme-default/components/VPDocFooter.vue +145 -0
  35. package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +50 -0
  36. package/dist/client/theme-default/components/VPDocOutlineItem.vue +59 -0
  37. package/dist/client/theme-default/components/VPFeature.vue +123 -0
  38. package/dist/client/theme-default/components/VPFeatures.vue +121 -0
  39. package/dist/client/theme-default/components/VPFlyout.vue +136 -0
  40. package/dist/client/theme-default/components/VPFooter.vue +60 -0
  41. package/dist/client/theme-default/components/VPHero.vue +336 -0
  42. package/dist/client/theme-default/components/VPHome.vue +43 -0
  43. package/dist/client/theme-default/components/VPHomeContent.vue +52 -0
  44. package/dist/client/theme-default/components/VPHomeFeatures.vue +14 -0
  45. package/dist/client/theme-default/components/VPHomeHero.vue +24 -0
  46. package/dist/client/theme-default/components/VPHomeSponsors.vue +116 -0
  47. package/dist/client/theme-default/components/VPImage.vue +46 -0
  48. package/dist/client/theme-default/components/VPLink.vue +33 -0
  49. package/dist/client/theme-default/components/VPLocalNav.vue +171 -0
  50. package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +190 -0
  51. package/dist/client/theme-default/components/VPLocalSearchBox.vue +856 -0
  52. package/dist/client/theme-default/components/VPMenu.vue +72 -0
  53. package/dist/client/theme-default/components/VPMenuGroup.vue +47 -0
  54. package/dist/client/theme-default/components/VPMenuLink.vue +54 -0
  55. package/dist/client/theme-default/components/VPNav.vue +57 -0
  56. package/dist/client/theme-default/components/VPNavBar.vue +267 -0
  57. package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
  58. package/dist/client/theme-default/components/VPNavBarExtra.vue +94 -0
  59. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  60. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  61. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +42 -0
  62. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +53 -0
  63. package/dist/client/theme-default/components/VPNavBarSearch.vue +194 -0
  64. package/dist/client/theme-default/components/VPNavBarSearchButton.vue +208 -0
  65. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  66. package/dist/client/theme-default/components/VPNavBarTitle.vue +76 -0
  67. package/dist/client/theme-default/components/VPNavBarTranslations.vue +47 -0
  68. package/dist/client/theme-default/components/VPNavScreen.vue +99 -0
  69. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
  70. package/dist/client/theme-default/components/VPNavScreenMenu.vue +23 -0
  71. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +111 -0
  72. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +39 -0
  73. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +34 -0
  74. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +39 -0
  75. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  76. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  77. package/dist/client/theme-default/components/VPPage.vue +7 -0
  78. package/dist/client/theme-default/components/VPSidebar.vue +137 -0
  79. package/dist/client/theme-default/components/VPSidebarItem.vue +250 -0
  80. package/dist/client/theme-default/components/VPSkipLink.vue +68 -0
  81. package/dist/client/theme-default/components/VPSocialLink.vue +50 -0
  82. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  83. package/dist/client/theme-default/components/VPSponsors.vue +48 -0
  84. package/dist/client/theme-default/components/VPSponsorsGrid.vue +48 -0
  85. package/dist/client/theme-default/components/VPSwitch.vue +63 -0
  86. package/dist/client/theme-default/components/VPSwitchAppearance.vue +52 -0
  87. package/dist/client/theme-default/components/VPTeamMembers.vue +66 -0
  88. package/dist/client/theme-default/components/VPTeamMembersItem.vue +225 -0
  89. package/dist/client/theme-default/components/VPTeamPage.vue +58 -0
  90. package/dist/client/theme-default/components/VPTeamPageSection.vue +77 -0
  91. package/dist/client/theme-default/components/VPTeamPageTitle.vue +63 -0
  92. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  93. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  94. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  95. package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +7 -0
  96. package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +7 -0
  97. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  98. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  99. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  100. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  101. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  102. package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
  103. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  104. package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
  105. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
  106. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  107. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  108. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  109. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
  110. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  111. package/dist/client/theme-default/composables/aside.js +17 -0
  112. package/dist/client/theme-default/composables/data.js +2 -0
  113. package/dist/client/theme-default/composables/edit-link.js +16 -0
  114. package/dist/client/theme-default/composables/flyout.js +41 -0
  115. package/dist/client/theme-default/composables/langs.js +26 -0
  116. package/dist/client/theme-default/composables/local-nav.js +18 -0
  117. package/dist/client/theme-default/composables/nav.js +30 -0
  118. package/dist/client/theme-default/composables/outline.js +178 -0
  119. package/dist/client/theme-default/composables/prev-next.js +57 -0
  120. package/dist/client/theme-default/composables/sidebar.js +136 -0
  121. package/dist/client/theme-default/composables/sponsor-grid.js +94 -0
  122. package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
  123. package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
  124. package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
  125. package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
  126. package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
  127. package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
  128. package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
  129. package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
  130. package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
  131. package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
  132. package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
  133. package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
  134. package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
  135. package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
  136. package/dist/client/theme-default/index.js +3 -0
  137. package/dist/client/theme-default/styles/base.css +252 -0
  138. package/dist/client/theme-default/styles/components/custom-block.css +208 -0
  139. package/dist/client/theme-default/styles/components/vp-code-group.css +85 -0
  140. package/dist/client/theme-default/styles/components/vp-code.css +7 -0
  141. package/dist/client/theme-default/styles/components/vp-doc.css +570 -0
  142. package/dist/client/theme-default/styles/components/vp-sponsor.css +155 -0
  143. package/dist/client/theme-default/styles/fonts.css +157 -0
  144. package/dist/client/theme-default/styles/icons.css +123 -0
  145. package/dist/client/theme-default/styles/utils.css +9 -0
  146. package/dist/client/theme-default/styles/vars.css +563 -0
  147. package/dist/client/theme-default/support/lru.js +33 -0
  148. package/dist/client/theme-default/support/sidebar.js +89 -0
  149. package/dist/client/theme-default/support/translation.js +49 -0
  150. package/dist/client/theme-default/support/utils.js +33 -0
  151. package/dist/client/theme-default/without-fonts.js +32 -0
  152. package/dist/node/cli.js +444 -0
  153. package/dist/node/index.d.ts +4588 -0
  154. package/dist/node/index.js +198 -0
  155. package/dist/node/serve-BjvG349_.js +50301 -0
  156. package/lib/vue-demi.mjs +34 -0
  157. package/package.json +223 -0
  158. package/template/.vitepress/config.js +28 -0
  159. package/template/.vitepress/theme/Layout.vue +21 -0
  160. package/template/.vitepress/theme/index.js +29 -0
  161. package/template/.vitepress/theme/style.css +143 -0
  162. package/template/api-examples.md +49 -0
  163. package/template/index.md +28 -0
  164. package/template/markdown-examples.md +85 -0
  165. package/theme-without-fonts.d.ts +2 -0
  166. package/theme.d.ts +30 -0
  167. package/types/default-theme.d.ts +533 -0
  168. package/types/docsearch.d.ts +144 -0
  169. package/types/index.d.ts +3 -0
  170. package/types/local-search.d.ts +33 -0
  171. package/types/shared.d.ts +199 -0
@@ -0,0 +1,99 @@
1
+ <script setup lang="ts">
2
+ import { useScrollLock } from '@vueuse/core'
3
+ import { inBrowser } from 'vitepress'
4
+ import { ref } from 'vue'
5
+ import VPNavScreenAppearance from './VPNavScreenAppearance.vue'
6
+ import VPNavScreenMenu from './VPNavScreenMenu.vue'
7
+ import VPNavScreenSocialLinks from './VPNavScreenSocialLinks.vue'
8
+ import VPNavScreenTranslations from './VPNavScreenTranslations.vue'
9
+
10
+ defineProps<{
11
+ open: boolean
12
+ }>()
13
+
14
+ const screen = ref<HTMLElement | null>(null)
15
+ const isLocked = useScrollLock(inBrowser ? document.body : null)
16
+ </script>
17
+
18
+ <template>
19
+ <transition
20
+ name="fade"
21
+ @enter="isLocked = true"
22
+ @after-leave="isLocked = false"
23
+ >
24
+ <div v-if="open" class="VPNavScreen" ref="screen" id="VPNavScreen">
25
+ <div class="container">
26
+ <slot name="nav-screen-content-before" />
27
+ <VPNavScreenMenu class="menu" />
28
+ <VPNavScreenTranslations class="translations" />
29
+ <VPNavScreenAppearance class="appearance" />
30
+ <VPNavScreenSocialLinks class="social-links" />
31
+ <slot name="nav-screen-content-after" />
32
+ </div>
33
+ </div>
34
+ </transition>
35
+ </template>
36
+
37
+ <style scoped>
38
+ .VPNavScreen {
39
+ position: fixed;
40
+ top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 1px);
41
+ /*rtl:ignore*/
42
+ right: 0;
43
+ bottom: 0;
44
+ /*rtl:ignore*/
45
+ left: 0;
46
+ padding: 0 32px;
47
+ width: 100%;
48
+ background-color: var(--vp-nav-screen-bg-color);
49
+ overflow-y: auto;
50
+ transition: background-color 0.5s;
51
+ pointer-events: auto;
52
+ }
53
+
54
+ .VPNavScreen.fade-enter-active,
55
+ .VPNavScreen.fade-leave-active {
56
+ transition: opacity 0.25s;
57
+ }
58
+
59
+ .VPNavScreen.fade-enter-active .container,
60
+ .VPNavScreen.fade-leave-active .container {
61
+ transition: transform 0.25s ease;
62
+ }
63
+
64
+ .VPNavScreen.fade-enter-from,
65
+ .VPNavScreen.fade-leave-to {
66
+ opacity: 0;
67
+ }
68
+
69
+ .VPNavScreen.fade-enter-from .container,
70
+ .VPNavScreen.fade-leave-to .container {
71
+ transform: translateY(-8px);
72
+ }
73
+
74
+ @media (min-width: 768px) {
75
+ .VPNavScreen {
76
+ display: none;
77
+ }
78
+ }
79
+
80
+ .container {
81
+ margin: 0 auto;
82
+ padding: 24px 0 96px;
83
+ max-width: 288px;
84
+ }
85
+
86
+ .menu + .translations,
87
+ .menu + .appearance,
88
+ .translations + .appearance {
89
+ margin-top: 24px;
90
+ }
91
+
92
+ .menu + .social-links {
93
+ margin-top: 16px;
94
+ }
95
+
96
+ .appearance + .social-links {
97
+ margin-top: 16px;
98
+ }
99
+ </style>
@@ -0,0 +1,33 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from '../composables/data'
3
+ import VPSwitchAppearance from './VPSwitchAppearance.vue'
4
+
5
+ const { site, theme } = useData()
6
+ </script>
7
+
8
+ <template>
9
+ <div v-if="site.appearance && site.appearance !== 'force-dark'" class="VPNavScreenAppearance">
10
+ <p class="text">
11
+ {{ theme.darkModeSwitchLabel || 'Appearance' }}
12
+ </p>
13
+ <VPSwitchAppearance />
14
+ </div>
15
+ </template>
16
+
17
+ <style scoped>
18
+ .VPNavScreenAppearance {
19
+ display: flex;
20
+ justify-content: space-between;
21
+ align-items: center;
22
+ border-radius: 8px;
23
+ padding: 12px 14px 12px 16px;
24
+ background-color: var(--vp-c-bg-soft);
25
+ }
26
+
27
+ .text {
28
+ line-height: 24px;
29
+ font-size: 12px;
30
+ font-weight: 500;
31
+ color: var(--vp-c-text-2);
32
+ }
33
+ </style>
@@ -0,0 +1,23 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from '../composables/data'
3
+ import VPNavScreenMenuLink from './VPNavScreenMenuLink.vue'
4
+ import VPNavScreenMenuGroup from './VPNavScreenMenuGroup.vue'
5
+
6
+ const { theme } = useData()
7
+ </script>
8
+
9
+ <template>
10
+ <nav v-if="theme.nav" class="VPNavScreenMenu">
11
+ <template v-for="item in theme.nav" :key="item.text">
12
+ <VPNavScreenMenuLink
13
+ v-if="'link' in item"
14
+ :item="item"
15
+ />
16
+ <VPNavScreenMenuGroup
17
+ v-else
18
+ :text="item.text || ''"
19
+ :items="item.items"
20
+ />
21
+ </template>
22
+ </nav>
23
+ </template>
@@ -0,0 +1,111 @@
1
+ <script lang="ts" setup>
2
+ import { computed, ref } from 'vue'
3
+ import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
4
+ import VPNavScreenMenuGroupSection from './VPNavScreenMenuGroupSection.vue'
5
+
6
+ const props = defineProps<{
7
+ text: string
8
+ items: any[]
9
+ }>()
10
+
11
+ const isOpen = ref(false)
12
+
13
+ const groupId = computed(() =>
14
+ `NavScreenGroup-${props.text.replace(' ', '-').toLowerCase()}`
15
+ )
16
+
17
+ function toggle() {
18
+ isOpen.value = !isOpen.value
19
+ }
20
+ </script>
21
+
22
+ <template>
23
+ <div class="VPNavScreenMenuGroup" :class="{ open: isOpen }">
24
+ <button
25
+ class="button"
26
+ :aria-controls="groupId"
27
+ :aria-expanded="isOpen"
28
+ @click="toggle"
29
+ >
30
+ <span class="button-text" v-html="text"></span>
31
+ <span class="vpi-plus button-icon" />
32
+ </button>
33
+
34
+ <div :id="groupId" class="items">
35
+ <template v-for="item in items" :key="item.text">
36
+ <div v-if="'link' in item" :key="item.text" class="item">
37
+ <VPNavScreenMenuGroupLink :item="item" />
38
+ </div>
39
+
40
+ <div v-else class="group">
41
+ <VPNavScreenMenuGroupSection
42
+ :text="item.text"
43
+ :items="item.items"
44
+ />
45
+ </div>
46
+ </template>
47
+ </div>
48
+ </div>
49
+ </template>
50
+
51
+ <style scoped>
52
+ .VPNavScreenMenuGroup {
53
+ border-bottom: 1px solid var(--vp-c-divider);
54
+ height: 48px;
55
+ overflow: hidden;
56
+ transition: border-color 0.5s;
57
+ }
58
+
59
+ .VPNavScreenMenuGroup .items {
60
+ visibility: hidden;
61
+ }
62
+
63
+ .VPNavScreenMenuGroup.open .items {
64
+ visibility: visible;
65
+ }
66
+
67
+ .VPNavScreenMenuGroup.open {
68
+ padding-bottom: 10px;
69
+ height: auto;
70
+ }
71
+
72
+ .VPNavScreenMenuGroup.open .button {
73
+ padding-bottom: 6px;
74
+ color: var(--vp-c-brand-1);
75
+ }
76
+
77
+ .VPNavScreenMenuGroup.open .button-icon {
78
+ /*rtl:ignore*/
79
+ transform: rotate(45deg);
80
+ }
81
+
82
+ .button {
83
+ display: flex;
84
+ justify-content: space-between;
85
+ align-items: center;
86
+ padding: 12px 4px 11px 0;
87
+ width: 100%;
88
+ line-height: 24px;
89
+ font-size: 14px;
90
+ font-weight: 500;
91
+ color: var(--vp-c-text-1);
92
+ transition: color 0.25s;
93
+ }
94
+
95
+ .button:hover {
96
+ color: var(--vp-c-brand-1);
97
+ }
98
+
99
+ .button-icon {
100
+ transition: transform 0.25s;
101
+ }
102
+
103
+ .group:first-child {
104
+ padding-top: 0px;
105
+ }
106
+
107
+ .group + .group,
108
+ .group + .item {
109
+ padding-top: 4px;
110
+ }
111
+ </style>
@@ -0,0 +1,39 @@
1
+ <script lang="ts" setup>
2
+ import type { DefaultTheme } from 'vitepress/theme'
3
+ import { inject } from 'vue'
4
+ import VPLink from './VPLink.vue'
5
+
6
+ defineProps<{
7
+ item: DefaultTheme.NavItemWithLink
8
+ }>()
9
+
10
+ const closeScreen = inject('close-screen') as () => void
11
+ </script>
12
+
13
+ <template>
14
+ <VPLink
15
+ class="VPNavScreenMenuGroupLink"
16
+ :href="item.link"
17
+ :target="item.target"
18
+ :rel="item.rel"
19
+ @click="closeScreen"
20
+ >
21
+ {{ item.text }}
22
+ </VPLink>
23
+ </template>
24
+
25
+ <style scoped>
26
+ .VPNavScreenMenuGroupLink {
27
+ display: block;
28
+ margin-left: 12px;
29
+ line-height: 32px;
30
+ font-size: 14px;
31
+ font-weight: 400;
32
+ color: var(--vp-c-text-1);
33
+ transition: color 0.25s;
34
+ }
35
+
36
+ .VPNavScreenMenuGroupLink:hover {
37
+ color: var(--vp-c-brand-1);
38
+ }
39
+ </style>
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import type { DefaultTheme } from 'vitepress/theme'
3
+ import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
4
+
5
+ defineProps<{
6
+ text?: string
7
+ items: DefaultTheme.NavItemWithLink[]
8
+ }>()
9
+ </script>
10
+
11
+ <template>
12
+ <div class="VPNavScreenMenuGroupSection">
13
+ <p v-if="text" class="title">{{ text }}</p>
14
+ <VPNavScreenMenuGroupLink
15
+ v-for="item in items"
16
+ :key="item.text"
17
+ :item="item"
18
+ />
19
+ </div>
20
+ </template>
21
+
22
+ <style scoped>
23
+ .VPNavScreenMenuGroupSection {
24
+ display: block;
25
+ }
26
+
27
+ .title {
28
+ line-height: 32px;
29
+ font-size: 13px;
30
+ font-weight: 700;
31
+ color: var(--vp-c-text-2);
32
+ transition: color 0.25s;
33
+ }
34
+ </style>
@@ -0,0 +1,39 @@
1
+ <script lang="ts" setup>
2
+ import type { DefaultTheme } from 'vitepress/theme'
3
+ import { inject } from 'vue'
4
+ import VPLink from './VPLink.vue'
5
+
6
+ defineProps<{
7
+ item: DefaultTheme.NavItemWithLink
8
+ }>()
9
+
10
+ const closeScreen = inject('close-screen') as () => void
11
+ </script>
12
+
13
+ <template>
14
+ <VPLink
15
+ class="VPNavScreenMenuLink"
16
+ :href="item.link"
17
+ :target="item.target"
18
+ :rel="item.rel"
19
+ @click="closeScreen"
20
+ v-html="item.text"
21
+ />
22
+ </template>
23
+
24
+ <style scoped>
25
+ .VPNavScreenMenuLink {
26
+ display: block;
27
+ border-bottom: 1px solid var(--vp-c-divider);
28
+ padding: 12px 0 11px;
29
+ line-height: 24px;
30
+ font-size: 14px;
31
+ font-weight: 500;
32
+ color: var(--vp-c-text-1);
33
+ transition: border-color 0.25s, color 0.25s;
34
+ }
35
+
36
+ .VPNavScreenMenuLink:hover {
37
+ color: var(--vp-c-brand-1);
38
+ }
39
+ </style>
@@ -0,0 +1,14 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from '../composables/data'
3
+ import VPSocialLinks from './VPSocialLinks.vue'
4
+
5
+ const { theme } = useData()
6
+ </script>
7
+
8
+ <template>
9
+ <VPSocialLinks
10
+ v-if="theme.socialLinks"
11
+ class="VPNavScreenSocialLinks"
12
+ :links="theme.socialLinks"
13
+ />
14
+ </template>
@@ -0,0 +1,73 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import { useLangs } from '../composables/langs'
4
+ import VPLink from './VPLink.vue'
5
+
6
+ const { localeLinks, currentLang } = useLangs({ correspondingLink: true })
7
+ const isOpen = ref(false)
8
+
9
+ function toggle() {
10
+ isOpen.value = !isOpen.value
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <div
16
+ v-if="localeLinks.length && currentLang.label"
17
+ class="VPNavScreenTranslations"
18
+ :class="{ open: isOpen }"
19
+ >
20
+ <button class="title" @click="toggle">
21
+ <span class="vpi-languages icon lang" />
22
+ {{ currentLang.label }}
23
+ <span class="vpi-chevron-down icon chevron" />
24
+ </button>
25
+
26
+ <ul class="list">
27
+ <li v-for="locale in localeLinks" :key="locale.link" class="item">
28
+ <VPLink class="link" :href="locale.link">{{ locale.text }}</VPLink>
29
+ </li>
30
+ </ul>
31
+ </div>
32
+ </template>
33
+
34
+ <style scoped>
35
+ .VPNavScreenTranslations {
36
+ height: 24px;
37
+ overflow: hidden;
38
+ }
39
+
40
+ .VPNavScreenTranslations.open {
41
+ height: auto;
42
+ }
43
+
44
+ .title {
45
+ display: flex;
46
+ align-items: center;
47
+ font-size: 14px;
48
+ font-weight: 500;
49
+ color: var(--vp-c-text-1);
50
+ }
51
+
52
+ .icon {
53
+ font-size: 16px;
54
+ }
55
+
56
+ .icon.lang {
57
+ margin-right: 8px;
58
+ }
59
+
60
+ .icon.chevron {
61
+ margin-left: 4px;
62
+ }
63
+
64
+ .list {
65
+ padding: 4px 0 0 24px;
66
+ }
67
+
68
+ .link {
69
+ line-height: 32px;
70
+ font-size: 13px;
71
+ color: var(--vp-c-text-1);
72
+ }
73
+ </style>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <div class="VPPage">
3
+ <slot name="page-top" />
4
+ <Content />
5
+ <slot name="page-bottom" />
6
+ </div>
7
+ </template>
@@ -0,0 +1,137 @@
1
+ <script lang="ts" setup>
2
+ import { useScrollLock } from '@vueuse/core'
3
+ import { inBrowser } from 'vitepress'
4
+ import { ref, watch } from 'vue'
5
+ import { useSidebar } from '../composables/sidebar'
6
+ import VPSidebarItem from './VPSidebarItem.vue'
7
+
8
+ const { sidebarGroups, hasSidebar } = useSidebar()
9
+
10
+ const props = defineProps<{
11
+ open: boolean
12
+ }>()
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
+
18
+ watch(
19
+ [props, navEl],
20
+ () => {
21
+ if (props.open) {
22
+ isLocked.value = true
23
+ navEl.value?.focus()
24
+ } else isLocked.value = false
25
+ },
26
+ { immediate: true, flush: 'post' }
27
+ )
28
+ </script>
29
+
30
+ <template>
31
+ <aside
32
+ v-if="hasSidebar"
33
+ class="VPSidebar"
34
+ :class="{ open }"
35
+ ref="navEl"
36
+ @click.stop
37
+ >
38
+ <div class="curtain" />
39
+
40
+ <nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1">
41
+ <span class="visually-hidden" id="sidebar-aria-label">
42
+ Sidebar Navigation
43
+ </span>
44
+
45
+ <slot name="sidebar-nav-before" />
46
+
47
+ <div v-for="item in sidebarGroups" :key="item.text" class="group">
48
+ <VPSidebarItem :item="item" :depth="0" />
49
+ </div>
50
+
51
+ <slot name="sidebar-nav-after" />
52
+ </nav>
53
+ </aside>
54
+ </template>
55
+
56
+ <style scoped>
57
+ .VPSidebar {
58
+ position: fixed;
59
+ top: var(--vp-layout-top-height, 0px);
60
+ bottom: 0;
61
+ left: 0;
62
+ z-index: var(--vp-z-index-sidebar);
63
+ padding: 32px 32px 96px;
64
+ width: calc(100vw - 64px);
65
+ max-width: 320px;
66
+ background-color: var(--vp-sidebar-bg-color);
67
+ opacity: 0;
68
+ box-shadow: var(--vp-c-shadow-3);
69
+ overflow-x: hidden;
70
+ overflow-y: auto;
71
+ transform: translateX(-100%);
72
+ transition: opacity 0.5s, transform 0.25s ease;
73
+ overscroll-behavior: contain;
74
+ }
75
+
76
+ .VPSidebar.open {
77
+ opacity: 1;
78
+ visibility: visible;
79
+ transform: translateX(0);
80
+ transition: opacity 0.25s,
81
+ transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
82
+ }
83
+
84
+ .dark .VPSidebar {
85
+ box-shadow: var(--vp-shadow-1);
86
+ }
87
+
88
+ @media (min-width: 960px) {
89
+ .VPSidebar {
90
+ padding-top: var(--vp-nav-height);
91
+ width: var(--vp-sidebar-width);
92
+ max-width: 100%;
93
+ background-color: var(--vp-sidebar-bg-color);
94
+ opacity: 1;
95
+ visibility: visible;
96
+ box-shadow: none;
97
+ transform: translateX(0);
98
+ }
99
+ }
100
+
101
+ @media (min-width: 1440px) {
102
+ .VPSidebar {
103
+ padding-left: max(32px, calc((100% - (var(--vp-layout-max-width) - 64px)) / 2));
104
+ width: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
105
+ }
106
+ }
107
+
108
+ @media (min-width: 960px) {
109
+ .curtain {
110
+ position: sticky;
111
+ top: -64px;
112
+ left: 0;
113
+ z-index: 1;
114
+ margin-top: calc(var(--vp-nav-height) * -1);
115
+ margin-right: -32px;
116
+ margin-left: -32px;
117
+ height: var(--vp-nav-height);
118
+ background-color: var(--vp-sidebar-bg-color);
119
+ }
120
+ }
121
+
122
+ .nav {
123
+ outline: 0;
124
+ }
125
+
126
+ .group + .group {
127
+ border-top: 1px solid var(--vp-c-divider);
128
+ padding-top: 10px;
129
+ }
130
+
131
+ @media (min-width: 960px) {
132
+ .group {
133
+ padding-top: 10px;
134
+ width: calc(var(--vp-sidebar-width) - 64px);
135
+ }
136
+ }
137
+ </style>