vitepress 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (286) hide show
  1. package/README.md +34 -2
  2. package/THIRD-PARTY-NOTICES.md +1736 -0
  3. package/bin/vitepress.js +14 -0
  4. package/client.d.ts +9 -0
  5. package/dist/client/app/components/ClientOnly.d.ts +5 -0
  6. package/dist/client/app/components/ClientOnly.js +11 -10
  7. package/dist/client/app/components/Content.d.ts +17 -0
  8. package/dist/client/app/components/Content.js +25 -22
  9. package/dist/client/app/composables/codeGroups.d.ts +3 -0
  10. package/dist/client/app/composables/codeGroups.js +36 -39
  11. package/dist/client/app/composables/copyCode.d.ts +3 -0
  12. package/dist/client/app/composables/copyCode.js +59 -70
  13. package/dist/client/app/composables/head.d.ts +5 -0
  14. package/dist/client/app/composables/head.js +56 -74
  15. package/dist/client/app/composables/icon.d.ts +12 -0
  16. package/dist/client/app/composables/icon.js +56 -0
  17. package/dist/client/app/composables/preFetch.d.ts +3 -0
  18. package/dist/client/app/composables/preFetch.js +64 -96
  19. package/dist/client/app/data.d.ts +9 -0
  20. package/dist/client/app/data.js +34 -59
  21. package/dist/client/app/devtools.d.ts +7 -0
  22. package/dist/client/app/devtools.js +29 -28
  23. package/dist/client/app/index.d.ts +11 -0
  24. package/dist/client/app/index.js +106 -131
  25. package/dist/client/app/router.d.ts +49 -0
  26. package/dist/client/app/router.js +198 -239
  27. package/dist/client/app/ssr.d.ts +4 -0
  28. package/dist/client/app/ssr.js +14 -9
  29. package/dist/client/app/theme.d.ts +24 -0
  30. package/dist/client/app/theme.js +0 -1
  31. package/dist/client/app/utils.d.ts +35 -0
  32. package/dist/client/app/utils.js +77 -110
  33. package/dist/client/index.d.ts +21 -137
  34. package/dist/client/index.js +8 -9
  35. package/dist/client/shared.d.ts +88 -0
  36. package/dist/client/shared.js +265 -141
  37. package/dist/client/theme-default/Layout.d.vue.ts +79 -0
  38. package/dist/client/theme-default/Layout.vue +33 -36
  39. package/dist/client/theme-default/NotFound.d.vue.ts +3 -0
  40. package/dist/client/theme-default/NotFound.vue +33 -35
  41. package/dist/client/theme-default/components/VPAlgoliaSearchBox.d.vue.ts +11 -0
  42. package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +202 -70
  43. package/dist/client/theme-default/components/VPBackdrop.d.vue.ts +6 -0
  44. package/dist/client/theme-default/components/VPBackdrop.vue +8 -12
  45. package/dist/client/theme-default/components/VPBadge.d.vue.ts +19 -0
  46. package/dist/client/theme-default/components/VPBadge.vue +49 -26
  47. package/dist/client/theme-default/components/VPButton.d.vue.ts +25 -0
  48. package/dist/client/theme-default/components/VPButton.vue +53 -36
  49. package/dist/client/theme-default/components/VPCarbonAds.d.vue.ts +7 -0
  50. package/dist/client/theme-default/components/VPCarbonAds.vue +51 -52
  51. package/dist/client/theme-default/components/VPContent.d.vue.ts +59 -0
  52. package/dist/client/theme-default/components/VPContent.vue +27 -26
  53. package/dist/client/theme-default/components/VPDoc.d.vue.ts +33 -0
  54. package/dist/client/theme-default/components/VPDoc.vue +52 -48
  55. package/dist/client/theme-default/components/VPDocAside.d.vue.ts +23 -0
  56. package/dist/client/theme-default/components/VPDocAside.vue +7 -8
  57. package/dist/client/theme-default/components/VPDocAsideCarbonAds.d.vue.ts +7 -0
  58. package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +7 -11
  59. package/dist/client/theme-default/components/VPDocAsideOutline.d.vue.ts +3 -0
  60. package/dist/client/theme-default/components/VPDocAsideOutline.vue +22 -38
  61. package/dist/client/theme-default/components/VPDocAsideSponsors.d.vue.ts +10 -0
  62. package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -11
  63. package/dist/client/theme-default/components/VPDocFooter.d.vue.ts +13 -0
  64. package/dist/client/theme-default/components/VPDocFooter.vue +38 -45
  65. package/dist/client/theme-default/components/VPDocFooterLastUpdated.d.vue.ts +3 -0
  66. package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +30 -29
  67. package/dist/client/theme-default/components/VPDocOutlineItem.d.vue.ts +8 -0
  68. package/dist/client/theme-default/components/VPDocOutlineItem.vue +20 -19
  69. package/dist/client/theme-default/components/VPFeature.d.vue.ts +13 -0
  70. package/dist/client/theme-default/components/VPFeature.vue +62 -36
  71. package/dist/client/theme-default/components/VPFeatures.d.vue.ts +16 -0
  72. package/dist/client/theme-default/components/VPFeatures.vue +35 -48
  73. package/dist/client/theme-default/components/VPFlyout.d.vue.ts +26 -0
  74. package/dist/client/theme-default/components/VPFlyout.vue +111 -47
  75. package/dist/client/theme-default/components/VPFooter.d.vue.ts +3 -0
  76. package/dist/client/theme-default/components/VPFooter.vue +22 -15
  77. package/dist/client/theme-default/components/VPHero.d.vue.ts +38 -0
  78. package/dist/client/theme-default/components/VPHero.vue +109 -99
  79. package/dist/client/theme-default/components/VPHome.d.vue.ts +31 -0
  80. package/dist/client/theme-default/components/VPHome.vue +15 -15
  81. package/dist/client/theme-default/components/VPHomeContent.d.vue.ts +13 -0
  82. package/dist/client/theme-default/components/VPHomeContent.vue +9 -27
  83. package/dist/client/theme-default/components/VPHomeFeatures.d.vue.ts +3 -0
  84. package/dist/client/theme-default/components/VPHomeFeatures.vue +4 -5
  85. package/dist/client/theme-default/components/VPHomeHero.d.vue.ts +23 -0
  86. package/dist/client/theme-default/components/VPHomeHero.vue +5 -5
  87. package/dist/client/theme-default/components/VPHomeSponsors.d.vue.ts +21 -0
  88. package/dist/client/theme-default/components/VPHomeSponsors.vue +42 -43
  89. package/dist/client/theme-default/components/VPIcon.d.vue.ts +8 -0
  90. package/dist/client/theme-default/components/VPIcon.vue +29 -0
  91. package/dist/client/theme-default/components/VPImage.d.vue.ts +8 -0
  92. package/dist/client/theme-default/components/VPImage.vue +20 -14
  93. package/dist/client/theme-default/components/VPLink.d.vue.ts +23 -0
  94. package/dist/client/theme-default/components/VPLink.vue +42 -23
  95. package/dist/client/theme-default/components/VPLocalNav.d.vue.ts +10 -0
  96. package/dist/client/theme-default/components/VPLocalNav.vue +69 -86
  97. package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.d.vue.ts +8 -0
  98. package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +98 -96
  99. package/dist/client/theme-default/components/VPLocalSearchBox.d.vue.ts +7 -0
  100. package/dist/client/theme-default/components/VPLocalSearchBox.vue +391 -454
  101. package/dist/client/theme-default/components/VPMenu.d.vue.ts +23 -0
  102. package/dist/client/theme-default/components/VPMenu.vue +19 -31
  103. package/dist/client/theme-default/components/VPMenuGroup.d.vue.ts +22 -0
  104. package/dist/client/theme-default/components/VPMenuGroup.vue +72 -18
  105. package/dist/client/theme-default/components/VPMenuLink.d.vue.ts +22 -0
  106. package/dist/client/theme-default/components/VPMenuLink.vue +65 -31
  107. package/dist/client/theme-default/components/VPNav.d.vue.ts +23 -0
  108. package/dist/client/theme-default/components/VPNav.vue +18 -24
  109. package/dist/client/theme-default/components/VPNavAppearance.d.vue.ts +9 -0
  110. package/dist/client/theme-default/components/VPNavAppearance.vue +88 -0
  111. package/dist/client/theme-default/components/VPNavBar.d.vue.ts +26 -0
  112. package/dist/client/theme-default/components/VPNavBar.vue +170 -142
  113. package/dist/client/theme-default/components/VPNavBarAskAiButton.d.vue.ts +3 -0
  114. package/dist/client/theme-default/components/VPNavBarAskAiButton.vue +31 -0
  115. package/dist/client/theme-default/components/VPNavBarExtra.d.vue.ts +3 -0
  116. package/dist/client/theme-default/components/VPNavBarExtra.vue +51 -73
  117. package/dist/client/theme-default/components/VPNavBarHamburger.d.vue.ts +10 -0
  118. package/dist/client/theme-default/components/VPNavBarHamburger.vue +38 -28
  119. package/dist/client/theme-default/components/VPNavBarSearch.d.vue.ts +3 -0
  120. package/dist/client/theme-default/components/VPNavBarSearch.vue +129 -160
  121. package/dist/client/theme-default/components/VPNavBarSearchButton.d.vue.ts +6 -0
  122. package/dist/client/theme-default/components/VPNavBarSearchButton.vue +48 -182
  123. package/dist/client/theme-default/components/VPNavBarTitle.d.vue.ts +15 -0
  124. package/dist/client/theme-default/components/VPNavBarTitle.vue +39 -38
  125. package/dist/client/theme-default/components/VPNavMenu.d.vue.ts +6 -0
  126. package/dist/client/theme-default/components/VPNavMenu.vue +76 -0
  127. package/dist/client/theme-default/components/VPNavMenuGroup.d.vue.ts +11 -0
  128. package/dist/client/theme-default/components/VPNavMenuGroup.vue +140 -0
  129. package/dist/client/theme-default/components/VPNavMenuLink.d.vue.ts +8 -0
  130. package/dist/client/theme-default/components/VPNavMenuLink.vue +69 -0
  131. package/dist/client/theme-default/components/VPNavScreen.d.vue.ts +18 -0
  132. package/dist/client/theme-default/components/VPNavScreen.vue +36 -34
  133. package/dist/client/theme-default/components/VPNavSocialLinks.d.vue.ts +6 -0
  134. package/dist/client/theme-default/components/VPNavSocialLinks.vue +36 -0
  135. package/dist/client/theme-default/components/VPNavTranslations.d.vue.ts +9 -0
  136. package/dist/client/theme-default/components/VPNavTranslations.vue +170 -0
  137. package/dist/client/theme-default/components/VPPage.d.vue.ts +15 -0
  138. package/dist/client/theme-default/components/VPSidebar.d.vue.ts +18 -0
  139. package/dist/client/theme-default/components/VPSidebar.vue +40 -53
  140. package/dist/client/theme-default/components/VPSidebarGroup.d.vue.ts +7 -0
  141. package/dist/client/theme-default/components/VPSidebarGroup.vue +24 -29
  142. package/dist/client/theme-default/components/VPSidebarItem.d.vue.ts +8 -0
  143. package/dist/client/theme-default/components/VPSidebarItem.vue +60 -93
  144. package/dist/client/theme-default/components/VPSkipLink.d.vue.ts +6 -0
  145. package/dist/client/theme-default/components/VPSkipLink.vue +23 -42
  146. package/dist/client/theme-default/components/VPSocialLink.d.vue.ts +11 -0
  147. package/dist/client/theme-default/components/VPSocialLink.vue +42 -49
  148. package/dist/client/theme-default/components/VPSocialLinks.d.vue.ts +10 -0
  149. package/dist/client/theme-default/components/VPSocialLinks.vue +26 -16
  150. package/dist/client/theme-default/components/VPSponsors.d.vue.ts +18 -0
  151. package/dist/client/theme-default/components/VPSponsors.vue +34 -33
  152. package/dist/client/theme-default/components/VPSponsorsGrid.d.vue.ts +15 -0
  153. package/dist/client/theme-default/components/VPSponsorsGrid.vue +23 -26
  154. package/dist/client/theme-default/components/VPSwitch.d.vue.ts +13 -0
  155. package/dist/client/theme-default/components/VPSwitch.vue +12 -13
  156. package/dist/client/theme-default/components/VPSwitchAppearance.d.vue.ts +3 -0
  157. package/dist/client/theme-default/components/VPSwitchAppearance.vue +16 -21
  158. package/dist/client/theme-default/components/VPTeamMembers.d.vue.ts +10 -0
  159. package/dist/client/theme-default/components/VPTeamMembers.vue +59 -32
  160. package/dist/client/theme-default/components/VPTeamMembersItem.d.vue.ts +10 -0
  161. package/dist/client/theme-default/components/VPTeamMembersItem.vue +62 -58
  162. package/dist/client/theme-default/components/VPTeamPage.d.vue.ts +13 -0
  163. package/dist/client/theme-default/components/VPTeamPage.vue +14 -14
  164. package/dist/client/theme-default/components/VPTeamPageSection.d.vue.ts +17 -0
  165. package/dist/client/theme-default/components/VPTeamPageSection.vue +20 -19
  166. package/dist/client/theme-default/components/VPTeamPageTitle.d.vue.ts +15 -0
  167. package/dist/client/theme-default/components/VPTeamPageTitle.vue +22 -22
  168. package/dist/client/theme-default/composables/data.d.ts +5 -0
  169. package/dist/client/theme-default/composables/data.js +5 -2
  170. package/dist/client/theme-default/composables/edit-link.d.ts +6 -0
  171. package/dist/client/theme-default/composables/edit-link.js +17 -15
  172. package/dist/client/theme-default/composables/flyout.d.ts +10 -0
  173. package/dist/client/theme-default/composables/flyout.js +33 -32
  174. package/dist/client/theme-default/composables/langs.d.ts +44 -0
  175. package/dist/client/theme-default/composables/langs.js +48 -24
  176. package/dist/client/theme-default/composables/layout.d.ts +13 -0
  177. package/dist/client/theme-default/composables/layout.js +68 -0
  178. package/dist/client/theme-default/composables/nav-overflow.d.ts +54 -0
  179. package/dist/client/theme-default/composables/nav-overflow.js +179 -0
  180. package/dist/client/theme-default/composables/nav.d.ts +25 -0
  181. package/dist/client/theme-default/composables/nav.js +58 -29
  182. package/dist/client/theme-default/composables/outline.d.ts +8 -0
  183. package/dist/client/theme-default/composables/outline.js +144 -166
  184. package/dist/client/theme-default/composables/prev-next.d.ts +16 -0
  185. package/dist/client/theme-default/composables/prev-next.js +34 -56
  186. package/dist/client/theme-default/composables/scroll-lock.d.ts +4 -0
  187. package/dist/client/theme-default/composables/scroll-lock.js +95 -0
  188. package/dist/client/theme-default/composables/sidebar.d.ts +25 -0
  189. package/dist/client/theme-default/composables/sidebar.js +96 -133
  190. package/dist/client/theme-default/composables/sponsor-grid.d.ts +10 -0
  191. package/dist/client/theme-default/composables/sponsor-grid.js +69 -76
  192. package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
  193. package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
  194. package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
  195. package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
  196. package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
  197. package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
  198. package/dist/client/theme-default/fonts/inter-italic-symbols.woff2 +0 -0
  199. package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
  200. package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
  201. package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
  202. package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
  203. package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
  204. package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
  205. package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
  206. package/dist/client/theme-default/fonts/inter-roman-symbols.woff2 +0 -0
  207. package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
  208. package/dist/client/theme-default/index.d.ts +3 -0
  209. package/dist/client/theme-default/index.js +4 -3
  210. package/dist/client/theme-default/styles/base.css +279 -211
  211. package/dist/client/theme-default/styles/components/custom-block.css +12 -7
  212. package/dist/client/theme-default/styles/components/vp-code-group.css +13 -16
  213. package/dist/client/theme-default/styles/components/vp-code.css +10 -2
  214. package/dist/client/theme-default/styles/components/vp-doc.css +188 -142
  215. package/dist/client/theme-default/styles/components/vp-sponsor.css +48 -37
  216. package/dist/client/theme-default/styles/docsearch.css +138 -0
  217. package/dist/client/theme-default/styles/fonts.css +216 -55
  218. package/dist/client/theme-default/styles/icons.css +42 -22
  219. package/dist/client/theme-default/styles/vars.css +111 -46
  220. package/dist/client/theme-default/support/docsearch.d.ts +57 -0
  221. package/dist/client/theme-default/support/docsearch.js +145 -0
  222. package/dist/client/theme-default/support/local-search.d.ts +9 -0
  223. package/dist/client/theme-default/support/local-search.js +31 -0
  224. package/dist/client/theme-default/support/lru.d.ts +11 -0
  225. package/dist/client/theme-default/support/lru.js +30 -33
  226. package/dist/client/theme-default/support/reactivity.d.ts +4 -0
  227. package/dist/client/theme-default/support/reactivity.js +10 -0
  228. package/dist/client/theme-default/support/sidebar.d.ts +27 -0
  229. package/dist/client/theme-default/support/sidebar.js +69 -80
  230. package/dist/client/theme-default/support/translation.d.ts +6 -0
  231. package/dist/client/theme-default/support/translation.js +33 -47
  232. package/dist/client/theme-default/support/utils.d.ts +7 -0
  233. package/dist/client/theme-default/support/utils.js +39 -30
  234. package/dist/client/theme-default/without-fonts.d.ts +25 -0
  235. package/dist/client/theme-default/without-fonts.js +37 -36
  236. package/dist/node/chunk-BjrVv9r8.js +28627 -0
  237. package/dist/node/cli.d.ts +1 -0
  238. package/dist/node/cli.js +160 -423
  239. package/dist/node/index.d.ts +1761 -2476
  240. package/dist/node/index.js +1 -121
  241. package/dist/web-types.json +75 -0
  242. package/package.json +89 -98
  243. package/template/.vitepress/config.js +3 -1
  244. package/template/.vitepress/theme/style.css +3 -11
  245. package/theme.d.ts +30 -23
  246. package/types/default-theme.d.ts +109 -113
  247. package/types/docsearch.d.ts +61 -142
  248. package/types/shared.d.ts +469 -50
  249. package/dist/client/theme-default/components/VPNavBarAppearance.vue +0 -32
  250. package/dist/client/theme-default/components/VPNavBarMenu.vue +0 -40
  251. package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +0 -42
  252. package/dist/client/theme-default/components/VPNavBarMenuLink.vue +0 -53
  253. package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +0 -27
  254. package/dist/client/theme-default/components/VPNavBarTranslations.vue +0 -47
  255. package/dist/client/theme-default/components/VPNavScreenAppearance.vue +0 -40
  256. package/dist/client/theme-default/components/VPNavScreenMenu.vue +0 -26
  257. package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +0 -112
  258. package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +0 -40
  259. package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +0 -34
  260. package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +0 -43
  261. package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +0 -14
  262. package/dist/client/theme-default/components/VPNavScreenTranslations.vue +0 -73
  263. package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +0 -8
  264. package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +0 -8
  265. package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +0 -8
  266. package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +0 -7
  267. package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +0 -7
  268. package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +0 -5
  269. package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +0 -5
  270. package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +0 -5
  271. package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +0 -5
  272. package/dist/client/theme-default/components/icons/VPIconEdit.vue +0 -6
  273. package/dist/client/theme-default/components/icons/VPIconHeart.vue +0 -5
  274. package/dist/client/theme-default/components/icons/VPIconLanguages.vue +0 -9
  275. package/dist/client/theme-default/components/icons/VPIconMinus.vue +0 -5
  276. package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +0 -6
  277. package/dist/client/theme-default/components/icons/VPIconMoon.vue +0 -5
  278. package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +0 -7
  279. package/dist/client/theme-default/components/icons/VPIconPlus.vue +0 -5
  280. package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +0 -6
  281. package/dist/client/theme-default/components/icons/VPIconSun.vue +0 -13
  282. package/dist/client/theme-default/composables/aside.js +0 -17
  283. package/dist/client/theme-default/composables/local-nav.js +0 -18
  284. package/dist/node/chunk-C-d2RJOW.js +0 -470
  285. package/dist/node/chunk-CxQfvv8o.js +0 -49065
  286. package/dist/node/worker_shikiResolveLang.js +0 -13
package/types/shared.d.ts CHANGED
@@ -1,71 +1,130 @@
1
1
  // types shared between server and client
2
2
  import type { UseDarkOptions } from '@vueuse/core'
3
+ import type { Component, Ref } from 'vue'
3
4
  import type { SSRContext } from 'vue/server-renderer'
4
5
  export type { DefaultTheme } from './default-theme.js'
5
6
 
7
+ /**
8
+ * A value of type `T`, or a promise resolving to it.
9
+ */
6
10
  export type Awaitable<T> = T | PromiseLike<T>
7
11
 
12
+ /**
13
+ * Recursively makes all properties of `T` optional, leaving non-plain
14
+ * objects (dates, regexps, functions, collections) as-is.
15
+ */
16
+ export type DeepPartial<T> =
17
+ T extends Record<string, any>
18
+ ? T extends
19
+ | Date
20
+ | RegExp
21
+ | Function
22
+ | ReadonlyMap<any, any>
23
+ | ReadonlySet<any>
24
+ | ReadonlyArray<any>
25
+ ? T
26
+ : { [P in keyof T]?: DeepPartial<T[P]> }
27
+ : T
28
+
29
+ /**
30
+ * The data of a page, available on both server and client.
31
+ */
8
32
  export interface PageData {
33
+ /**
34
+ * The path of the page relative to the source directory, with rewrites
35
+ * applied. Determines the URL of the page.
36
+ */
9
37
  relativePath: string
10
38
  /**
11
- * differs from relativePath in case of path rewrites
12
- * empty string if the page is virtual (e.g. 404 page)
39
+ * The path of the actual source file relative to the source directory:
40
+ * differs from `relativePath` when rewrites are in use, points to the
41
+ * route template for dynamic routes, and is empty for virtual pages
42
+ * (e.g. the 404 page).
13
43
  */
14
44
  filePath: string
45
+ /**
46
+ * The title of the page, from its frontmatter or its first level-1
47
+ * heading.
48
+ */
15
49
  title: string
50
+ /**
51
+ * The suffix appended to the title (`title | suffix`), or a template
52
+ * containing the `:title` token. Set to `false` to use the title as-is.
53
+ */
16
54
  titleTemplate?: string | boolean
55
+ /**
56
+ * The description of the page, from its frontmatter.
57
+ */
17
58
  description: string
59
+ /**
60
+ * The section headers extracted from the page.
61
+ */
18
62
  headers: Header[]
63
+ /**
64
+ * The frontmatter of the page.
65
+ */
19
66
  frontmatter: Record<string, any>
67
+ /**
68
+ * The route params of the page, if it belongs to a dynamic route.
69
+ */
20
70
  params?: Record<string, any>
71
+ /**
72
+ * Whether the page is the not-found (404) page.
73
+ */
21
74
  isNotFound?: boolean
75
+ /**
76
+ * The timestamp (in milliseconds) of the last update, from the page's
77
+ * frontmatter or its last git commit.
78
+ */
22
79
  lastUpdated?: number
23
80
  }
24
81
 
25
82
  /**
26
- * SFC block extracted from markdown
83
+ * A block of the Vue SFC generated from a markdown source file.
27
84
  */
28
85
  export interface SfcBlock {
29
86
  /**
30
- * The type of the block
87
+ * The type of the block.
31
88
  */
32
89
  type: string
33
90
  /**
34
- * The content, including open-tag and close-tag
91
+ * The content of the block, including its open and close tags.
35
92
  */
36
93
  content: string
37
94
  /**
38
- * The content that stripped open-tag and close-tag off
95
+ * The content of the block, with its open and close tags stripped.
39
96
  */
40
97
  contentStripped: string
41
98
  /**
42
- * The open-tag
99
+ * The open tag of the block.
43
100
  */
44
101
  tagOpen: string
45
102
  /**
46
- * The close-tag
103
+ * The close tag of the block.
47
104
  */
48
105
  tagClose: string
49
106
  }
50
107
 
108
+ /**
109
+ * The SFC blocks extracted from a markdown source file.
110
+ */
51
111
  export interface MarkdownSfcBlocks {
52
112
  /**
53
- * The `<template>` block
113
+ * The `<template>` block.
54
114
  */
55
115
  template: SfcBlock | null
56
116
  /**
57
- * The common `<script>` block
117
+ * The common `<script>` block.
58
118
  */
59
119
  script: SfcBlock | null
60
120
  /**
61
- * The `<script setup>` block
121
+ * The `<script setup>` block.
62
122
  */
63
123
  scriptSetup: SfcBlock | null
64
124
  /**
65
- * All `<script>` blocks.
66
- *
67
- * By default, SFC only allows one `<script>` block and one `<script setup>` block.
68
- * However, some tools may support different types of `<script>`s, so we keep all of them here.
125
+ * All `<script>` blocks. An SFC normally allows a single `<script>` block
126
+ * and a single `<script setup>` block, but some tools may support more,
127
+ * so all of them are kept here.
69
128
  */
70
129
  scripts: SfcBlock[]
71
130
  /**
@@ -78,130 +137,490 @@ export interface MarkdownSfcBlocks {
78
137
  customBlocks: SfcBlock[]
79
138
  }
80
139
 
140
+ /**
141
+ * A section header extracted from a page.
142
+ */
81
143
  export interface Header {
82
144
  /**
83
- * The level of the header
84
- *
85
- * `1` to `6` for `<h1>` to `<h6>`
145
+ * The level of the header, `1` to `6` for `<h1>` to `<h6>`.
86
146
  */
87
147
  level: number
88
148
  /**
89
- * The title of the header
149
+ * The title of the header.
90
150
  */
91
151
  title: string
92
152
  /**
93
- * The slug of the header
94
- *
95
- * Typically the `id` attr of the header anchor
153
+ * The slug of the header, typically the `id` attribute of its anchor.
96
154
  */
97
155
  slug: string
98
156
  /**
99
- * Link of the header
100
- *
101
- * Typically using `#${slug}` as the anchor hash
157
+ * The link of the header, typically `#${slug}`.
102
158
  */
103
159
  link: string
104
160
  /**
105
- * The children of the header
161
+ * The nested child headers.
106
162
  */
107
163
  children: Header[]
108
164
  }
109
165
 
166
+ /**
167
+ * Site-level data, resolved from the user config for the active locale.
168
+ */
110
169
  export interface SiteData<ThemeConfig = any> {
170
+ /**
171
+ * The base URL the site is deployed at, or `'./'` when each page
172
+ * references the site relative to its own depth.
173
+ * @default '/'
174
+ */
111
175
  base: string
176
+ /**
177
+ * Whether VitePress generates URLs without a trailing `.html`.
178
+ * @default false
179
+ */
112
180
  cleanUrls?: boolean
181
+ /**
182
+ * The `lang` attribute of the site.
183
+ * @default 'en-US'
184
+ */
113
185
  lang: string
114
- dir: string
186
+ /**
187
+ * The text direction (`dir` attribute) of the site.
188
+ * @default 'ltr'
189
+ */
190
+ dir: 'ltr' | 'rtl' | 'auto'
191
+ /**
192
+ * The title of the site.
193
+ * @default 'VitePress'
194
+ */
115
195
  title: string
196
+ /**
197
+ * The suffix appended to page titles (`title | suffix`), or a template
198
+ * containing the `:title` token. Set to `false` to use page titles as-is.
199
+ */
116
200
  titleTemplate?: string | boolean
201
+ /**
202
+ * The description of the site.
203
+ * @default 'A VitePress site'
204
+ */
117
205
  description: string
206
+ /**
207
+ * Additional elements to render in the `<head>` tag of every page.
208
+ */
118
209
  head: HeadConfig[]
210
+ /**
211
+ * The dark mode behavior: `true` for a toggleable dark mode, `'dark'` to
212
+ * default to it, `'force-dark'`/`'force-auto'` to force the mode, or
213
+ * options for `useDark` from `@vueuse/core`. `false` disables it.
214
+ * @default true
215
+ */
119
216
  appearance:
120
217
  | boolean
121
218
  | 'dark'
122
219
  | 'force-dark'
123
220
  | 'force-auto'
124
221
  | (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' })
222
+ /**
223
+ * The config of the active theme.
224
+ */
125
225
  themeConfig: ThemeConfig
126
- scrollOffset:
127
- | number
128
- | string
129
- | string[]
130
- | { selector: string | string[]; padding: number }
226
+ /**
227
+ * The config overrides of each locale, keyed by its directory
228
+ * (`'root'` for the default locale).
229
+ */
131
230
  locales: LocaleConfig<ThemeConfig>
231
+ /**
232
+ * The key of the active locale in `locales`.
233
+ */
132
234
  localeIndex?: string
235
+ /**
236
+ * Props passed to the wrapper element rendered by the `Content` component.
237
+ */
133
238
  contentProps?: Record<string, any>
239
+ /**
240
+ * Client router options.
241
+ */
134
242
  router: {
243
+ /**
244
+ * Whether links are prefetched when they enter the viewport.
245
+ * @default true
246
+ */
135
247
  prefetchLinks: boolean
136
248
  }
249
+ /**
250
+ * Config overrides applied to pages by source directory (before
251
+ * rewrites): a dict mapping a directory (e.g. `/guide/`) to overrides,
252
+ * deeper directories taking precedence, or a function returning the
253
+ * overrides for a page.
254
+ */
255
+ additionalConfig?:
256
+ AdditionalConfigDict<ThemeConfig> | AdditionalConfigLoader<ThemeConfig>
257
+ }
258
+
259
+ /**
260
+ * Reactive data exposed by the `useData` composable.
261
+ */
262
+ export interface VitePressData<T = any> {
263
+ /**
264
+ * The site-level data for the active locale.
265
+ */
266
+ site: Ref<SiteData<T>>
267
+ /**
268
+ * The config of the active theme.
269
+ */
270
+ theme: Ref<T>
271
+ /**
272
+ * The data of the current page.
273
+ */
274
+ page: Ref<PageData>
275
+ /**
276
+ * The frontmatter of the current page.
277
+ */
278
+ frontmatter: Ref<PageData['frontmatter']>
279
+ /**
280
+ * The route params of the current page.
281
+ */
282
+ params: Ref<PageData['params']>
283
+ /**
284
+ * The resolved title of the current page.
285
+ */
286
+ title: Ref<string>
287
+ /**
288
+ * The resolved description of the current page.
289
+ */
290
+ description: Ref<string>
291
+ /**
292
+ * The `lang` attribute of the active locale.
293
+ */
294
+ lang: Ref<string>
295
+ /**
296
+ * The text direction of the active locale.
297
+ */
298
+ dir: Ref<'ltr' | 'rtl' | 'auto'>
299
+ /**
300
+ * The key of the active locale.
301
+ */
302
+ localeIndex: Ref<string>
303
+ /**
304
+ * Whether dark mode is currently active.
305
+ */
306
+ isDark: Ref<boolean>
307
+ }
308
+
309
+ /**
310
+ * The currently matched route.
311
+ */
312
+ export interface Route {
313
+ /**
314
+ * The pathname of the current URL.
315
+ */
316
+ path: string
317
+ /**
318
+ * The hash of the current URL, including the leading `#`.
319
+ */
320
+ hash: string
321
+ /**
322
+ * The query string of the current URL, including the leading `?`.
323
+ */
324
+ query: string
325
+ /**
326
+ * The data of the matched page.
327
+ */
328
+ data: PageData
329
+ /**
330
+ * The component of the matched page, once resolved.
331
+ */
332
+ component: Component | null
137
333
  }
138
334
 
335
+ /**
336
+ * A head entry as `[tag, attrs]` or `[tag, attrs, innerHTML]`, e.g.
337
+ * `['link', { rel: 'icon', href: '/favicon.ico' }]`.
338
+ */
139
339
  export type HeadConfig =
140
- | [string, Record<string, string>]
141
- | [string, Record<string, string>, string]
340
+ [string, Record<string, string>] | [string, Record<string, string>, string]
142
341
 
342
+ /**
343
+ * The payload sent to the client when page data is hot-updated.
344
+ */
143
345
  export interface PageDataPayload {
346
+ /**
347
+ * The path of the updated page relative to the source directory, with
348
+ * rewrites applied and a leading slash.
349
+ */
144
350
  path: string
351
+ /**
352
+ * The new data of the updated page.
353
+ */
145
354
  pageData: PageData
146
355
  }
147
356
 
357
+ /**
358
+ * The SSR context used when rendering a page to static HTML.
359
+ */
148
360
  export interface SSGContext extends SSRContext {
361
+ /**
362
+ * The rendered HTML content of the page.
363
+ */
149
364
  content: string
150
- /** @experimental */
151
- vpSocialIcons: Set<string>
365
+ /**
366
+ * The icons used on the page, registered during SSR (via `useIcon`) so
367
+ * that only their styles are emitted. Names are fully qualified as
368
+ * `collection:name`.
369
+ */
370
+ vpIcons: Set<string>
152
371
  }
153
372
 
373
+ /**
374
+ * The site config options that can be overridden per locale.
375
+ */
154
376
  export interface LocaleSpecificConfig<ThemeConfig = any> {
377
+ /**
378
+ * The `lang` attribute of the locale.
379
+ */
155
380
  lang?: string
156
- dir?: string
381
+ /**
382
+ * The text direction of the locale.
383
+ */
384
+ dir?: 'ltr' | 'rtl' | 'auto'
385
+ /**
386
+ * The title of the site in the locale.
387
+ */
157
388
  title?: string
389
+ /**
390
+ * The suffix appended to page titles (`title | suffix`), or a template
391
+ * containing the `:title` token. Set to `false` to use page titles as-is.
392
+ */
158
393
  titleTemplate?: string | boolean
394
+ /**
395
+ * The description of the site in the locale.
396
+ */
159
397
  description?: string
398
+ /**
399
+ * Additional head entries for the locale, merged with the root ones.
400
+ */
160
401
  head?: HeadConfig[]
161
- themeConfig?: ThemeConfig
402
+ /**
403
+ * Theme config overrides for the locale, merged with the root theme
404
+ * config.
405
+ */
406
+ themeConfig?: DeepPartial<ThemeConfig>
407
+ }
408
+
409
+ /**
410
+ * The labels of custom containers and GitHub-style alerts.
411
+ */
412
+ export interface ContainerOptions {
413
+ /**
414
+ * The label of `::: info` containers.
415
+ * @default 'INFO'
416
+ */
417
+ infoLabel?: string
418
+ /**
419
+ * The label of `> [!NOTE]` alerts.
420
+ * @default 'NOTE'
421
+ */
422
+ noteLabel?: string
423
+ /**
424
+ * The label of `::: tip` containers.
425
+ * @default 'TIP'
426
+ */
427
+ tipLabel?: string
428
+ /**
429
+ * The label of `::: warning` containers.
430
+ * @default 'WARNING'
431
+ */
432
+ warningLabel?: string
433
+ /**
434
+ * The label of `::: danger` containers.
435
+ * @default 'DANGER'
436
+ */
437
+ dangerLabel?: string
438
+ /**
439
+ * The label of `::: details` containers.
440
+ * @default 'Details'
441
+ */
442
+ detailsLabel?: string
443
+ /**
444
+ * The label of `> [!IMPORTANT]` alerts.
445
+ * @default 'IMPORTANT'
446
+ */
447
+ importantLabel?: string
448
+ /**
449
+ * The label of `> [!CAUTION]` alerts.
450
+ * @default 'CAUTION'
451
+ */
452
+ cautionLabel?: string
453
+ /**
454
+ * Additional containers to register, mapping the container name to its
455
+ * default title. Names must be lowercase (letters, numbers, hyphens,
456
+ * underscores), work as both `::: name` blocks and `> [!NAME]` alerts,
457
+ * and are styleable via `.custom-block.name`. Locale overrides may only
458
+ * change the titles of root-registered names.
459
+ */
460
+ customContainers?: Record<string, string>
461
+ }
462
+
463
+ /**
464
+ * The strings used by the copy button in code blocks.
465
+ */
466
+ export interface CodeCopyButtonOptions {
467
+ /**
468
+ * The tooltip (`title` attribute) of the copy button in code blocks.
469
+ * @default 'Copy code'
470
+ */
471
+ tooltipText?: string
472
+ /**
473
+ * The text shown next to the copy button after copying.
474
+ * @default 'Copied'
475
+ */
476
+ copiedText?: string
477
+ }
478
+
479
+ /**
480
+ * Markdown strings overridable per locale via `locales.<index>.markdown`,
481
+ * falling back to the root `markdown` options when unset.
482
+ */
483
+ export interface MarkdownLocaleOptions {
484
+ /**
485
+ * Locale-specific labels for containers (`::: tip` etc.) and
486
+ * GitHub-flavored alerts.
487
+ */
488
+ container?: ContainerOptions
489
+ /**
490
+ * Locale-specific strings for the copy button in code blocks.
491
+ */
492
+ codeCopyButton?: CodeCopyButtonOptions
162
493
  }
163
494
 
495
+ /**
496
+ * The locale configs of the site, keyed by locale directory
497
+ * (`'root'` for the default locale).
498
+ */
164
499
  export type LocaleConfig<ThemeConfig = any> = Record<
165
500
  string,
166
- LocaleSpecificConfig<ThemeConfig> & { label: string; link?: string }
501
+ LocaleSpecificConfig<ThemeConfig> & {
502
+ /**
503
+ * The label of the locale in the locale menu.
504
+ */
505
+ label: string
506
+ /**
507
+ * The link of the locale menu item. Defaults to the locale directory.
508
+ */
509
+ link?: string
510
+ /**
511
+ * The markdown strings of the locale.
512
+ */
513
+ markdown?: MarkdownLocaleOptions
514
+ }
167
515
  >
168
516
 
169
- // Manually declaring all properties as rollup-plugin-dts
170
- // is unable to merge augmented module declarations
517
+ /**
518
+ * Config overrides applied to a page on top of its locale config.
519
+ */
520
+ export type AdditionalConfig<ThemeConfig = any> =
521
+ LocaleSpecificConfig<ThemeConfig>
522
+
523
+ /**
524
+ * Additional configs keyed by the source directory they apply to
525
+ * (e.g. `/guide/`).
526
+ */
527
+ export type AdditionalConfigDict<ThemeConfig = any> = Record<
528
+ string,
529
+ AdditionalConfig<ThemeConfig>
530
+ >
531
+
532
+ /**
533
+ * Resolves the additional configs of a page from its source path, ordered
534
+ * from highest to lowest priority.
535
+ */
536
+ export type AdditionalConfigLoader<ThemeConfig = any> = (
537
+ filePath: string
538
+ ) => AdditionalConfig<ThemeConfig>[] | void
171
539
 
540
+ // all properties are declared manually as rollup-plugin-dts cannot merge
541
+ // augmented module declarations
542
+ /**
543
+ * The environment object passed to `markdown-it` when rendering a page.
544
+ */
172
545
  export interface MarkdownEnv {
173
546
  /**
174
- * The raw Markdown content without frontmatter
547
+ * The raw markdown content, with the frontmatter stripped.
175
548
  */
176
549
  content?: string
177
550
  /**
178
- * The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
179
- *
180
- * - Would be the rendered HTML when `renderExcerpt` is enabled
181
- * - Would be the raw Markdown when `renderExcerpt` is disabled
551
+ * The excerpt extracted by `@mdit-vue/plugin-frontmatter`, rendered as
552
+ * HTML when excerpt rendering is enabled and kept as raw markdown
553
+ * otherwise.
182
554
  */
183
555
  excerpt?: string
184
556
  /**
185
- * The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
557
+ * The frontmatter extracted by `@mdit-vue/plugin-frontmatter`.
186
558
  */
187
559
  frontmatter?: Record<string, unknown>
188
560
  /**
189
- * The headers that extracted by `@mdit-vue/plugin-headers`
561
+ * The headers extracted by `@mdit-vue/plugin-headers`.
190
562
  */
191
563
  headers?: Header[]
192
564
  /**
193
- * SFC blocks that extracted by `@mdit-vue/plugin-sfc`
565
+ * The SFC blocks extracted by `@mdit-vue/plugin-sfc`.
194
566
  */
195
567
  sfcBlocks?: MarkdownSfcBlocks
196
568
  /**
197
- * The title that extracted by `@mdit-vue/plugin-title`
569
+ * The title extracted by `@mdit-vue/plugin-title`.
198
570
  */
199
571
  title?: string
572
+ /**
573
+ * The absolute path of the page, with rewrites applied.
574
+ */
200
575
  path: string
576
+ /**
577
+ * The path of the page relative to the source directory, with rewrites
578
+ * applied.
579
+ */
201
580
  relativePath: string
581
+ /**
582
+ * Whether clean URLs are enabled.
583
+ */
202
584
  cleanUrls: boolean
585
+ /**
586
+ * Whether the rendered HTML is emitted at `relativePath`, so site-absolute
587
+ * links may be rewritten relative to it. Content loaders must not set it:
588
+ * their HTML is embedded in other pages.
589
+ * @internal
590
+ */
591
+ relativizeUrls?: boolean
592
+ /**
593
+ * The URLs of the links collected from the page for the dead link check.
594
+ */
203
595
  links?: string[]
596
+ /**
597
+ * The line numbers at which each of `links` appears in the source.
598
+ */
599
+ linkLines?: number[]
600
+ /**
601
+ * The absolute paths of the files inlined via `<!--@include-->` and
602
+ * imported via `<<<` code snippets, used for watch invalidation.
603
+ */
204
604
  includes?: string[]
605
+ /**
606
+ * The markdown source with includes expanded, set during rendering when
607
+ * include processing is enabled.
608
+ */
609
+ src?: string
610
+ /**
611
+ * The absolute path of the actual source file on disk: the route template
612
+ * for dynamic routes, or the original file when rewrites are in use.
613
+ */
205
614
  realPath?: string
615
+ /**
616
+ * The key of the locale the page belongs to.
617
+ */
206
618
  localeIndex?: string
619
+ /**
620
+ * The expressions inlined by eager frontmatter interpolation while
621
+ * rendering, with the value each resolved to - used to detect values that
622
+ * `transformPageData` changes after the fact.
623
+ * @internal
624
+ */
625
+ eagerInterpolations?: { expression: string; value: string }[]
207
626
  }
@@ -1,32 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useData } from '../composables/data'
3
- import VPSwitchAppearance from './VPSwitchAppearance.vue'
4
-
5
- const { site } = useData()
6
- </script>
7
-
8
- <template>
9
- <div
10
- v-if="
11
- site.appearance &&
12
- site.appearance !== 'force-dark' &&
13
- site.appearance !== 'force-auto'
14
- "
15
- class="VPNavBarAppearance"
16
- >
17
- <VPSwitchAppearance />
18
- </div>
19
- </template>
20
-
21
- <style scoped>
22
- .VPNavBarAppearance {
23
- display: none;
24
- }
25
-
26
- @media (min-width: 1280px) {
27
- .VPNavBarAppearance {
28
- display: flex;
29
- align-items: center;
30
- }
31
- }
32
- </style>