vitepress 0.22.3 → 1.0.0-draft.2

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 (208) hide show
  1. package/client.d.ts +2 -3
  2. package/dist/client/app/components/ClientOnly.js +1 -1
  3. package/dist/client/app/index.js +5 -7
  4. package/dist/client/index.d.ts +5 -0
  5. package/dist/client/shared.js +1 -0
  6. package/dist/client/theme-default/Layout.vue +39 -180
  7. package/dist/client/theme-default/NotFound.vue +9 -8
  8. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
  9. package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
  10. package/dist/client/theme-default/components/VPBox.vue +59 -0
  11. package/dist/client/theme-default/components/VPButton.vue +123 -0
  12. package/dist/client/theme-default/components/VPContent.vue +74 -0
  13. package/dist/client/theme-default/components/VPDoc.vue +173 -0
  14. package/dist/client/theme-default/components/VPDocFooter.vue +141 -0
  15. package/dist/client/theme-default/components/VPDocOutline.vue +108 -0
  16. package/dist/client/theme-default/components/VPFlyout.vue +149 -0
  17. package/dist/client/theme-default/components/VPFooter.vue +53 -0
  18. package/dist/client/theme-default/components/VPHero.vue +144 -0
  19. package/dist/client/theme-default/components/VPHome.vue +33 -0
  20. package/dist/client/theme-default/components/VPHomeFeatures.vue +96 -0
  21. package/dist/client/theme-default/components/VPHomeHero.vue +17 -0
  22. package/dist/client/theme-default/components/VPHomeSponsors.vue +97 -0
  23. package/dist/client/theme-default/components/VPLink.vue +37 -0
  24. package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
  25. package/dist/client/theme-default/components/VPMenu.vue +79 -0
  26. package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
  27. package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
  28. package/dist/client/theme-default/components/VPNav.vue +33 -0
  29. package/dist/client/theme-default/components/VPNavBar.vue +110 -0
  30. package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
  31. package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
  32. package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
  33. package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
  34. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
  35. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
  36. package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
  37. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
  38. package/dist/client/theme-default/components/VPNavBarTitle.vue +57 -0
  39. package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
  40. package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
  41. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
  42. package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
  43. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
  44. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
  45. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
  46. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
  47. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
  48. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
  49. package/dist/client/theme-default/components/VPPage.vue +5 -0
  50. package/dist/client/theme-default/components/VPSidebar.vue +118 -0
  51. package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
  52. package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
  53. package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
  54. package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
  55. package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
  56. package/dist/client/theme-default/components/VPSponsors.vue +77 -0
  57. package/dist/client/theme-default/components/VPSponsorsGrid.vue +32 -0
  58. package/dist/client/theme-default/components/VPSwitch.vue +66 -0
  59. package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
  60. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
  61. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
  62. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
  63. package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
  64. package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
  65. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
  66. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
  67. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
  68. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
  69. package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
  70. package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
  71. package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
  72. package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
  73. package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
  74. package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
  75. package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
  76. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
  77. package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
  78. package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
  79. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
  80. package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
  81. package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
  82. package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
  83. package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
  84. package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
  85. package/dist/client/theme-default/composables/edit-link.js +22 -0
  86. package/dist/client/theme-default/composables/flyout.js +40 -0
  87. package/dist/client/theme-default/composables/nav.js +27 -1
  88. package/dist/client/theme-default/composables/outline.js +112 -0
  89. package/dist/client/theme-default/composables/prev-next.js +18 -0
  90. package/dist/client/theme-default/composables/sidebar.js +57 -0
  91. package/dist/client/theme-default/composables/sponsor-grid.js +92 -0
  92. package/dist/client/theme-default/composables/sponsor.js +87 -0
  93. package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
  94. package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
  95. package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
  96. package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
  97. package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
  98. package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
  99. package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
  100. package/dist/client/theme-default/index.js +8 -4
  101. package/dist/client/theme-default/styles/base.css +203 -0
  102. package/dist/client/theme-default/styles/fonts.css +67 -0
  103. package/dist/client/theme-default/styles/utils.css +9 -0
  104. package/dist/client/theme-default/styles/vars.css +291 -66
  105. package/dist/client/theme-default/styles/vp-doc.css +425 -0
  106. package/dist/client/theme-default/styles/vp-sponsor.css +86 -0
  107. package/dist/client/theme-default/support/sidebar.js +29 -0
  108. package/dist/client/theme-default/support/utils.js +62 -0
  109. package/dist/node/alias.js +60 -0
  110. package/dist/node/alias.js.map +1 -0
  111. package/dist/node/build/build.js +57 -0
  112. package/dist/node/build/build.js.map +1 -0
  113. package/dist/node/build/buildMPAClient.js +44 -0
  114. package/dist/node/build/buildMPAClient.js.map +1 -0
  115. package/dist/node/build/bundle.js +163 -0
  116. package/dist/node/build/bundle.js.map +1 -0
  117. package/dist/node/build/render.js +185 -0
  118. package/dist/node/build/render.js.map +1 -0
  119. package/dist/node/cli.js +37 -294
  120. package/dist/node/cli.js.map +1 -0
  121. package/dist/node/config.js +176 -0
  122. package/dist/node/config.js.map +1 -0
  123. package/dist/node/index.d.ts +122 -79
  124. package/dist/node/index.js +22 -37
  125. package/dist/node/index.js.map +1 -0
  126. package/dist/node/markdown/markdown.js +75 -0
  127. package/dist/node/markdown/markdown.js.map +1 -0
  128. package/dist/node/markdown/plugins/component.js +86 -0
  129. package/dist/node/markdown/plugins/component.js.map +1 -0
  130. package/dist/node/markdown/plugins/containers.js +41 -0
  131. package/dist/node/markdown/plugins/containers.js.map +1 -0
  132. package/dist/node/markdown/plugins/headings.js +25 -0
  133. package/dist/node/markdown/plugins/headings.js.map +1 -0
  134. package/dist/node/markdown/plugins/highlight.js +53 -0
  135. package/dist/node/markdown/plugins/highlight.js.map +1 -0
  136. package/dist/node/markdown/plugins/highlightLines.js +48 -0
  137. package/dist/node/markdown/plugins/highlightLines.js.map +1 -0
  138. package/dist/node/markdown/plugins/hoist.js +22 -0
  139. package/dist/node/markdown/plugins/hoist.js.map +1 -0
  140. package/dist/node/markdown/plugins/image.js +17 -0
  141. package/dist/node/markdown/plugins/image.js.map +1 -0
  142. package/dist/node/markdown/plugins/lineNumbers.js +23 -0
  143. package/dist/node/markdown/plugins/lineNumbers.js.map +1 -0
  144. package/dist/node/markdown/plugins/link.js +85 -0
  145. package/dist/node/markdown/plugins/link.js.map +1 -0
  146. package/dist/node/markdown/plugins/preWrapper.js +22 -0
  147. package/dist/node/markdown/plugins/preWrapper.js.map +1 -0
  148. package/dist/node/markdown/plugins/slugify.js +26 -0
  149. package/dist/node/markdown/plugins/slugify.js.map +1 -0
  150. package/dist/node/markdown/plugins/snippet.js +146 -0
  151. package/dist/node/markdown/plugins/snippet.js.map +1 -0
  152. package/dist/node/markdownToVue.js +166 -0
  153. package/dist/node/markdownToVue.js.map +1 -0
  154. package/dist/node/plugin.js +227 -0
  155. package/dist/node/plugin.js.map +1 -0
  156. package/dist/node/serve/serve.js +59 -0
  157. package/dist/node/serve/serve.js.map +1 -0
  158. package/dist/node/{serve-777539c0.js → serve-b5dc02b2.js} +27 -2
  159. package/dist/node/server.js +18 -0
  160. package/dist/node/server.js.map +1 -0
  161. package/dist/node/shared.js +72 -0
  162. package/dist/node/shared.js.map +1 -0
  163. package/dist/node/staticDataPlugin.js +99 -0
  164. package/dist/node/staticDataPlugin.js.map +1 -0
  165. package/dist/node/utils/getGitTimestamp.js +17 -0
  166. package/dist/node/utils/getGitTimestamp.js.map +1 -0
  167. package/dist/node/utils/parseHeader.js +57 -0
  168. package/dist/node/utils/parseHeader.js.map +1 -0
  169. package/dist/node/utils/slash.js +8 -0
  170. package/dist/node/utils/slash.js.map +1 -0
  171. package/package.json +31 -25
  172. package/types/default-theme.d.ts +115 -78
  173. package/types/shared.d.ts +11 -6
  174. package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -188
  175. package/dist/client/theme-default/components/BuySellAds.vue +0 -152
  176. package/dist/client/theme-default/components/CarbonAds.vue +0 -99
  177. package/dist/client/theme-default/components/EditLink.vue +0 -38
  178. package/dist/client/theme-default/components/Home.vue +0 -31
  179. package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
  180. package/dist/client/theme-default/components/HomeFooter.vue +0 -50
  181. package/dist/client/theme-default/components/HomeHero.vue +0 -161
  182. package/dist/client/theme-default/components/LastUpdated.vue +0 -60
  183. package/dist/client/theme-default/components/NavBar.vue +0 -60
  184. package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
  185. package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
  186. package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
  187. package/dist/client/theme-default/components/NavLink.vue +0 -61
  188. package/dist/client/theme-default/components/NavLinks.vue +0 -52
  189. package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
  190. package/dist/client/theme-default/components/Page.vue +0 -53
  191. package/dist/client/theme-default/components/PageFooter.vue +0 -44
  192. package/dist/client/theme-default/components/SideBar.vue +0 -60
  193. package/dist/client/theme-default/components/SideBarLink.js +0 -68
  194. package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
  195. package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
  196. package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
  197. package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
  198. package/dist/client/theme-default/composables/editLink.js +0 -49
  199. package/dist/client/theme-default/composables/navLink.js +0 -42
  200. package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
  201. package/dist/client/theme-default/composables/repo.js +0 -38
  202. package/dist/client/theme-default/composables/sideBar.js +0 -57
  203. package/dist/client/theme-default/styles/code.css +0 -299
  204. package/dist/client/theme-default/styles/custom-blocks.css +0 -76
  205. package/dist/client/theme-default/styles/layout.css +0 -236
  206. package/dist/client/theme-default/styles/sidebar-links.css +0 -107
  207. package/dist/client/theme-default/support/sideBar.js +0 -46
  208. package/dist/client/theme-default/utils.js +0 -63
@@ -0,0 +1,110 @@
1
+ <script lang="ts" setup>
2
+ import VPNavBarTitle from './VPNavBarTitle.vue'
3
+ import VPNavBarSearch from './VPNavBarSearch.vue'
4
+ import VPNavBarMenu from './VPNavBarMenu.vue'
5
+ import VPNavBarTranslations from './VPNavBarTranslations.vue'
6
+ import VPNavBarAppearance from './VPNavBarAppearance.vue'
7
+ import VPNavBarSocialLinks from './VPNavBarSocialLinks.vue'
8
+ import VPNavBarExtra from './VPNavBarExtra.vue'
9
+ import VPNavBarHamburger from './VPNavBarHamburger.vue'
10
+
11
+ defineProps<{
12
+ isScreenOpen: boolean
13
+ }>()
14
+
15
+ defineEmits<{
16
+ (e: 'toggle-screen'): void
17
+ }>()
18
+ </script>
19
+
20
+ <template>
21
+ <div class="VPNavBar">
22
+ <div class="container">
23
+ <VPNavBarTitle />
24
+
25
+ <div class="content">
26
+ <VPNavBarSearch class="search" />
27
+ <VPNavBarMenu class="menu" />
28
+ <VPNavBarTranslations class="translations" />
29
+ <VPNavBarAppearance class="appearance" />
30
+ <VPNavBarSocialLinks class="social-links" />
31
+ <VPNavBarExtra class="extra" />
32
+ <VPNavBarHamburger
33
+ class="hamburger"
34
+ :active="isScreenOpen"
35
+ @click="$emit('toggle-screen')"
36
+ />
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <style scoped>
43
+ .VPNavBar {
44
+ position: relative;
45
+ border-bottom: 1px solid var(--vp-c-divider-light);
46
+ padding: 0 8px 0 24px;
47
+ height: var(--vp-nav-height-mobile);
48
+ background-color: var(--vt-c-bg);
49
+ transition: border-color 0.5s, background-color 0.5s;
50
+ }
51
+
52
+ @media (min-width: 768px) {
53
+ .VPNavBar {
54
+ padding: 0 32px;
55
+ }
56
+ }
57
+
58
+ @media (min-width: 960px) {
59
+ .VPNavBar {
60
+ height: var(--vp-nav-height-desktop);
61
+ border-bottom: 0;
62
+ }
63
+ }
64
+
65
+ .container {
66
+ display: flex;
67
+ justify-content: space-between;
68
+ margin: 0 auto;
69
+ max-width: var(--vp-layout-max-width);
70
+ }
71
+
72
+ .content {
73
+ display: flex;
74
+ justify-content: flex-end;
75
+ align-items: center;
76
+ flex-grow: 1;
77
+ }
78
+
79
+ @media (min-width: 960px) {
80
+ .content {
81
+ backdrop-filter: saturate(50%) blur(8px);
82
+ }
83
+ }
84
+
85
+ .menu + .translations::before,
86
+ .menu + .appearance::before,
87
+ .menu + .social-links::before,
88
+ .translations + .appearance::before,
89
+ .appearance + .social-links::before {
90
+ margin-right: 8px;
91
+ margin-left: 8px;
92
+ width: 1px;
93
+ height: 24px;
94
+ background-color: var(--vp-c-divider-light);
95
+ content: "";
96
+ }
97
+
98
+ .menu + .appearance::before,
99
+ .translations + .appearance::before {
100
+ margin-right: 16px;
101
+ }
102
+
103
+ .appearance + .social-links::before {
104
+ margin-left: 16px;
105
+ }
106
+
107
+ .social-links {
108
+ margin-right: -8px;
109
+ }
110
+ </style>
@@ -0,0 +1,25 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from 'vitepress'
3
+ import VPSwitchAppearance from './VPSwitchAppearance.vue'
4
+
5
+ const { site } = useData()
6
+ </script>
7
+
8
+ <template>
9
+ <div v-if="site.appearance" class="VPNavBarAppearance">
10
+ <VPSwitchAppearance />
11
+ </div>
12
+ </template>
13
+
14
+ <style scoped>
15
+ .VPNavBarAppearance {
16
+ display: none;
17
+ }
18
+
19
+ @media (min-width: 1280px) {
20
+ .VPNavBarAppearance {
21
+ display: flex;
22
+ align-items: center;
23
+ }
24
+ }
25
+ </style>
@@ -0,0 +1,107 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from 'vitepress'
3
+ import VPFlyout from './VPFlyout.vue'
4
+ import VPSwitchAppearance from './VPSwitchAppearance.vue'
5
+ import VPSocialLinks from './VPSocialLinks.vue'
6
+
7
+ const { site, theme } = useData()
8
+ </script>
9
+
10
+ <template>
11
+ <VPFlyout class="VPNavBarExtra" label="extra navigation">
12
+ <div v-if="theme.localeLinks" class="group">
13
+ <div class="trans">
14
+ <p class="trans-title">
15
+ {{ theme.localeLinks.text }}
16
+ </p>
17
+
18
+ <ul class="trans-list">
19
+ <li v-for="locale in theme.localeLinks.items" :key="locale.link" class="trans-item">
20
+ <a class="trans-link" :href="locale.link">{{ locale.text }}</a>
21
+ </li>
22
+ </ul>
23
+ </div>
24
+ </div>
25
+
26
+ <div v-if="site.appearance" class="group">
27
+ <div class="item">
28
+ <p class="label">Appearance</p>
29
+ <div class="appearance-action">
30
+ <VPSwitchAppearance />
31
+ </div>
32
+ </div>
33
+ </div>
34
+
35
+ <div v-if="theme.socialLinks" class="group">
36
+ <div class="item">
37
+ <VPSocialLinks class="social-links" :links="theme.socialLinks" />
38
+ </div>
39
+ </div>
40
+ </VPFlyout>
41
+ </template>
42
+
43
+ <style scoped>
44
+ .VPNavBarExtra {
45
+ display: none;
46
+ margin-right: -12px;
47
+ }
48
+
49
+ @media (min-width: 768px) {
50
+ .VPNavBarExtra {
51
+ display: block;
52
+ }
53
+ }
54
+
55
+ @media (min-width: 1280px) {
56
+ .VPNavBarExtra {
57
+ display: none;
58
+ }
59
+ }
60
+
61
+ .trans {
62
+ padding: 2px 16px 0;
63
+ }
64
+
65
+ .trans-title {
66
+ display: flex;
67
+ align-items: center;
68
+ font-size: 13px;
69
+ font-weight: 600;
70
+ color: var(--vp-c-text-1);
71
+ }
72
+
73
+ .trans-icon {
74
+ margin-right: 12px;
75
+ width: 16px;
76
+ height: 16px;
77
+ fill: currentColor;
78
+ }
79
+
80
+ .trans-list {
81
+ padding: 2px 0 0 0;
82
+ }
83
+
84
+ .trans-link {
85
+ line-height: 28px;
86
+ font-size: 13px;
87
+ color: var(--vp-c-text-1);
88
+ transition: color 0.25s;
89
+ }
90
+
91
+ .trans-link:hover {
92
+ color: var(--vp-c-brand);
93
+ }
94
+
95
+ .item {
96
+ display: flex;
97
+ align-items: center;
98
+ }
99
+
100
+ .appearance-action {
101
+ margin-right: -2px;
102
+ }
103
+
104
+ .social-links {
105
+ margin: -4px -8px;
106
+ }
107
+ </style>
@@ -0,0 +1,79 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ active: boolean
4
+ }>()
5
+
6
+ defineEmits<{
7
+ (e: 'click'): void
8
+ }>()
9
+ </script>
10
+
11
+ <template>
12
+ <button
13
+ type="button"
14
+ class="VPNavBarHamburger"
15
+ :class="{ active }"
16
+ aria-label="mobile navigation"
17
+ :aria-expanded="active"
18
+ aria-controls="VPNavScreen"
19
+ @click="$emit('click')"
20
+ >
21
+ <span class="container">
22
+ <span class="top" />
23
+ <span class="middle" />
24
+ <span class="bottom" />
25
+ </span>
26
+ </button>
27
+ </template>
28
+
29
+ <style scoped>
30
+ .VPNavBarHamburger {
31
+ display: flex;
32
+ justify-content: center;
33
+ align-items: center;
34
+ width: 48px;
35
+ height: var(--vp-nav-height);
36
+ }
37
+
38
+ @media (min-width: 768px) {
39
+ .VPNavBarHamburger {
40
+ display: none;
41
+ }
42
+ }
43
+
44
+ .container {
45
+ position: relative;
46
+ width: 16px;
47
+ height: 14px;
48
+ overflow: hidden;
49
+ }
50
+
51
+ .container:hover .top { top: 0; left: 0; transform: translateX(4px); }
52
+ .container:hover .middle { top: 6; left: 0; transform: translateX(0); }
53
+ .container:hover .bottom { top: 12px; left: 0; transform: translateX(8px); }
54
+
55
+ .container.active .top { top: 6px; transform: translateX(0) rotate(225deg); }
56
+ .container.active .middle { top: 6px; transform: translateX(16px); }
57
+ .container.active .bottom { top: 6px; transform: translateX(0) rotate(135deg); }
58
+
59
+ .container.active:hover .top,
60
+ .container.active:hover .middle,
61
+ .container.active:hover .bottom {
62
+ background-color: var(--vt-c-text-2);
63
+ transition: top .25s, background-color .25s, transform .25s;
64
+ }
65
+
66
+ .top,
67
+ .middle,
68
+ .bottom {
69
+ position: absolute;
70
+ width: 16px;
71
+ height: 2px;
72
+ background-color: var(--vp-c-text-1);
73
+ transition: top .25s, background-color .5s, transform .25s;
74
+ }
75
+
76
+ .top { top: 0; left: 0; transform: translateX(0); }
77
+ .middle { top: 6px; left: 0; transform: translateX(8px); }
78
+ .bottom { top: 12px; left: 0; transform: translateX(4px); }
79
+ </style>
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import { useData } from 'vitepress'
3
+ import VPNavBarMenuLink from './VPNavBarMenuLink.vue'
4
+ import VPNavBarMenuGroup from './VPNavBarMenuGroup.vue'
5
+
6
+ const { theme } = useData()
7
+ </script>
8
+
9
+ <template>
10
+ <nav v-if="theme.nav" aria-labelledby="main-nav-aria-label" class="VPNavBarMenu">
11
+ <span id="main-nav-aria-label" class="visually-hidden">Main Navigation</span>
12
+ <template v-for="item in theme.nav" :key="item.text">
13
+ <VPNavBarMenuLink v-if="'link' in item" :item="item" />
14
+ <VPNavBarMenuGroup v-else :item="item" />
15
+ </template>
16
+ </nav>
17
+ </template>
18
+
19
+ <style scoped>
20
+ .VPNavBarMenu {
21
+ display: none;
22
+ }
23
+
24
+ @media (min-width: 768px) {
25
+ .VPNavBarMenu {
26
+ display: flex;
27
+ }
28
+ }
29
+ </style>
@@ -0,0 +1,18 @@
1
+ <script lang="ts" setup>
2
+ import { DefaultTheme, useData } from 'vitepress'
3
+ import { isActive } from '../support/utils'
4
+ import VPFlyout from './VPFlyout.vue'
5
+
6
+ defineProps<{
7
+ item: DefaultTheme.NavItemWithChildren
8
+ }>()
9
+
10
+ const { page } = useData()
11
+ </script>
12
+
13
+ <template>
14
+ <VPFlyout
15
+ :button="item.text"
16
+ :items="item.items"
17
+ />
18
+ </template>
@@ -0,0 +1,56 @@
1
+ <script lang="ts" setup>
2
+ import { DefaultTheme, useData } from 'vitepress'
3
+ import { isActive } from '../support/utils'
4
+ import { NavItemWithLink } from '../config'
5
+ import VPLink from './VPLink.vue'
6
+
7
+ defineProps<{
8
+ item: DefaultTheme.NavItemWithLink
9
+ }>()
10
+
11
+ const { page } = useData()
12
+ </script>
13
+
14
+ <template>
15
+ <VPLink
16
+ :class="{
17
+ VPNavBarMenuLink: true,
18
+ active: isActive(
19
+ page.relativePath,
20
+ item.activeMatch || item.link,
21
+ !!item.activeMatch
22
+ )
23
+ }"
24
+ :href="item.link"
25
+ :noIcon="true"
26
+ >
27
+ {{ item.text }}
28
+ </VPLink>
29
+ </template>
30
+
31
+ <style scoped>
32
+ .VPNavBarMenuLink {
33
+ display: flex;
34
+ align-items: center;
35
+ padding: 0 12px;
36
+ line-height: var(--vp-nav-height-mobile);
37
+ font-size: 13px;
38
+ font-weight: 500;
39
+ color: var(--vp-c-text-1);
40
+ transition: color 0.25s;
41
+ }
42
+
43
+ .VPNavBarMenuLink.active {
44
+ color: var(--vp-c-brand);
45
+ }
46
+
47
+ .VPNavBarMenuLink:hover {
48
+ color: var(--vp-c-brand);
49
+ }
50
+
51
+ @media (min-width: 1280px) {
52
+ .VPNavBarMenuLink {
53
+ line-height: var(--vp-nav-height-desktop);
54
+ }
55
+ }
56
+ </style>
@@ -0,0 +1,269 @@
1
+ <script lang="ts" setup>
2
+ import '@docsearch/css'
3
+ import { useData } from 'vitepress'
4
+ import { defineAsyncComponent, ref, onMounted, onUnmounted } from 'vue'
5
+
6
+ const VPAlgoliaSearchBox = defineAsyncComponent(() => {
7
+ return import('./VPAlgoliaSearchBox.vue')
8
+ })
9
+
10
+ const { theme } = useData()
11
+
12
+ // to avoid loading the docsearch js upfront (which is more than 1/3 of the
13
+ // payload), we delay initializing it until the user has actually clicked or
14
+ // hit the hotkey to invoke it.
15
+ const loaded = ref(false)
16
+
17
+ const metaKey = ref()
18
+
19
+ onMounted(() => {
20
+ if (!theme.value.algolia) {
21
+ return
22
+ }
23
+
24
+ // meta key detect (same logic as in @docsearch/js)
25
+ metaKey.value.textContent = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)
26
+ ? '⌘'
27
+ : 'Ctrl'
28
+
29
+ const handleSearchHotKey = (e: KeyboardEvent) => {
30
+ if (e.key === 'k' && (e.ctrlKey || e.metaKey)) {
31
+ e.preventDefault()
32
+ load()
33
+ remove()
34
+ }
35
+ }
36
+
37
+ const remove = () => {
38
+ window.removeEventListener('keydown', handleSearchHotKey)
39
+ }
40
+
41
+ window.addEventListener('keydown', handleSearchHotKey)
42
+
43
+ onUnmounted(remove)
44
+ })
45
+
46
+ function load() {
47
+ if (!loaded.value) {
48
+ loaded.value = true
49
+ }
50
+ }
51
+ </script>
52
+
53
+ <template>
54
+ <div v-if="theme.algolia" class="VPNavBarSearch">
55
+ <VPAlgoliaSearchBox v-if="loaded" />
56
+
57
+ <div v-else id="docsearch" @click="load">
58
+ <button
59
+ type="button"
60
+ class="DocSearch DocSearch-Button"
61
+ aria-label="Search"
62
+ >
63
+ <span class="DocSearch-Button-Container">
64
+ <svg
65
+ class="DocSearch-Search-Icon"
66
+ width="20"
67
+ height="20"
68
+ viewBox="0 0 20 20"
69
+ >
70
+ <path
71
+ d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z"
72
+ stroke="currentColor"
73
+ fill="none"
74
+ fill-rule="evenodd"
75
+ stroke-linecap="round"
76
+ stroke-linejoin="round"
77
+ />
78
+ </svg>
79
+ <span class="DocSearch-Button-Placeholder">Search</span>
80
+ </span>
81
+ <span class="DocSearch-Button-Keys">
82
+ <span class="DocSearch-Button-Key" ref="metaKey">Meta</span>
83
+ <span class="DocSearch-Button-Key">K</span>
84
+ </span>
85
+ </button>
86
+ </div>
87
+ </div>
88
+ </template>
89
+
90
+ <style>
91
+ .VPNavBarSearch {
92
+ display: flex;
93
+ align-items: center;
94
+ }
95
+
96
+ @media (min-width: 768px) {
97
+ .VPNavBarSearch {
98
+ flex-grow: 1;
99
+ padding-left: 24px;
100
+ }
101
+ }
102
+
103
+ @media (min-width: 960px) {
104
+ .VPNavBarSearch {
105
+ padding-left: 32px;
106
+ }
107
+ }
108
+
109
+ .DocSearch {
110
+ --docsearch-primary-color: var(--vp-c-brand);
111
+ --docsearch-highlight-color: var(--docsearch-primary-color);
112
+ --docsearch-text-color: var(--vp-c-text-1);
113
+ --docsearch-muted-color: var(--vp-c-text-2);
114
+ --docsearch-searchbox-shadow: none;
115
+ --docsearch-searchbox-focus-background: transparent;
116
+ --docsearch-key-gradient: transparent;
117
+ --docsearch-key-shadow: none;
118
+ --docsearch-modal-background: var(--vp-c-bg-soft);
119
+ --docsearch-footer-background: var(--vp-c-bg);
120
+ }
121
+
122
+ .dark .DocSearch {
123
+ --docsearch-modal-shadow: none;
124
+ --docsearch-footer-shadow: none;
125
+ --docsearch-logo-color: var(--vp-c-text-2);
126
+ --docsearch-hit-background: var(--vp-c-bg-mute);
127
+ --docsearch-hit-color: var(--vp-c-text-2);
128
+ --docsearch-hit-shadow: none;
129
+ }
130
+
131
+ .DocSearch-Button {
132
+ display: flex;
133
+ justify-content: center;
134
+ align-items: center;
135
+ margin: 0;
136
+ padding: 0;
137
+ width: 32px;
138
+ height: 55px;
139
+ background: transparent;
140
+ transition: border-color 0.25s;
141
+ }
142
+
143
+ .DocSearch-Button:hover {
144
+ background: transparent;
145
+ }
146
+
147
+ .DocSearch-Button:focus {
148
+ outline: 1px dotted;
149
+ outline: 5px auto -webkit-focus-ring-color;
150
+ }
151
+
152
+ .DocSearch-Button:focus:not(:focus-visible) {
153
+ outline: none !important;
154
+ }
155
+
156
+ @media (min-width: 768px) {
157
+ .DocSearch-Button {
158
+ justify-content: flex-start;
159
+ border: 1px solid transparent;
160
+ border-radius: 8px;
161
+ padding: 0 10px 0 12px;
162
+ width: 100%;
163
+ height: 40px;
164
+ background-color: var(--vp-c-bg-sidebar);
165
+ }
166
+
167
+ .DocSearch-Button:hover {
168
+ border-color: var(--vp-c-brand);
169
+ background: var(--vp-c-bg-sidebar);
170
+ }
171
+ }
172
+
173
+ .DocSearch-Button .DocSearch-Button-Container {
174
+ display: flex;
175
+ align-items: center;
176
+ }
177
+
178
+ .DocSearch-Button .DocSearch-Search-Icon {
179
+ position: relative;
180
+ width: 16px;
181
+ height: 16px;
182
+ color: var(--vp-c-text-1);
183
+ fill: currentColor;
184
+ transition: color 0.5s;
185
+ }
186
+
187
+ .DocSearch-Button:hover .DocSearch-Search-Icon {
188
+ color: var(--vp-c-text-1);
189
+ }
190
+
191
+ @media (min-width: 768px) {
192
+ .DocSearch-Button .DocSearch-Search-Icon {
193
+ top: 1px;
194
+ margin-right: 8px;
195
+ width: 14px;
196
+ height: 14px;
197
+ color: var(--vp-c-text-2);
198
+ }
199
+ }
200
+
201
+ .DocSearch-Button .DocSearch-Button-Placeholder {
202
+ display: none;
203
+ margin-top: 2px;
204
+ padding: 0 16px 0 0;
205
+ font-size: 13px;
206
+ font-weight: 500;
207
+ color: var(--vp-c-text-2);
208
+ transition: color 0.5s;
209
+ }
210
+
211
+ .DocSearch-Button:hover .DocSearch-Button-Placeholder {
212
+ color: var(--vp-c-text-1);
213
+ }
214
+
215
+ @media (min-width: 768px) {
216
+ .DocSearch-Button .DocSearch-Button-Placeholder {
217
+ display: inline-block;
218
+ }
219
+ }
220
+
221
+ .DocSearch-Button .DocSearch-Button-Keys {
222
+ display: none;
223
+ min-width: auto;
224
+ }
225
+
226
+ @media (min-width: 768px) {
227
+ .DocSearch-Button .DocSearch-Button-Keys {
228
+ display: flex;
229
+ align-items: center;
230
+ }
231
+ }
232
+
233
+ .DocSearch-Button .DocSearch-Button-Key {
234
+ display: block;
235
+ margin: 2px 0 0 0;
236
+ border: 1px solid var(--vp-c-divider);
237
+ border-right: none;
238
+ border-radius: 4px 0 0 4px;
239
+ padding-left: 6px;
240
+ min-width: 0;
241
+ width: auto;
242
+ height: 22px;
243
+ line-height: 22px;
244
+ font-size: 12px;
245
+ font-weight: 500;
246
+ transition: color 0.5s, border-color 0.5s;
247
+ }
248
+
249
+ .DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key {
250
+ border-right: 1px solid var(--vp-c-divider);
251
+ border-left: none;
252
+ border-radius: 0 4px 4px 0;
253
+ padding-left: 2px;
254
+ padding-right: 6px;
255
+ }
256
+
257
+ .dark .DocSearch-Footer {
258
+ border-top: 1px solid var(--vp-c-divider);
259
+ }
260
+
261
+ .DocSearch-Form {
262
+ border: 1px solid var(--vp-c-brand);
263
+ background-color: var(--vp-c-white);
264
+ }
265
+
266
+ .dark .DocSearch-Form {
267
+ background-color: var(--vp-c-bg-mute);
268
+ }
269
+ </style>