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
@@ -1,152 +1,276 @@
1
- export const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i;
2
- export const APPEARANCE_KEY = 'vitepress-theme-appearance';
3
- const HASH_RE = /#.*$/;
1
+ //#region src/client/shared.ts
2
+ const EXTERNAL_URL_RE = /^(?:[a-z]+:|\/\/)/i;
3
+ const APPEARANCE_KEY = "vitepress-theme-appearance";
4
+ const iconNameRE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
5
+ /**
6
+ * Parses a fully qualified `collection:name` icon name, corresponding to
7
+ * the `vpi-<collection>-<name>` class. Returns null for anything else,
8
+ * keeping malformed input out of generated selectors and class attributes.
9
+ */
10
+ function parseIconName(name) {
11
+ const colon = name.indexOf(":");
12
+ if (colon === -1) return null;
13
+ const collection = name.slice(0, colon);
14
+ const icon = name.slice(colon + 1);
15
+ if (!iconNameRE.test(collection) || !iconNameRE.test(icon)) return null;
16
+ return {
17
+ collection,
18
+ icon
19
+ };
20
+ }
21
+ /**
22
+ * Placeholder prepended to SSR-emitted URLs when base is relative, later
23
+ * replaced with each page's `../` prefix back to the site root.
24
+ */
25
+ const RELATIVE_BASE_SENTINEL = "/__VP_BASE__/";
26
+ function isRelativeBase(base) {
27
+ return base === "./";
28
+ }
29
+ /**
30
+ * The ../-prefix that leads from `relativePath`'s directory back to the
31
+ * site root ('./' for root-level pages).
32
+ */
33
+ function relativePathToRoot(relativePath) {
34
+ const depth = relativePath.split("/").length - 1;
35
+ return depth ? "../".repeat(depth) : "./";
36
+ }
37
+ /**
38
+ * Join two paths, collapsing slash collisions but keeping the `//` that
39
+ * follows a protocol.
40
+ */
41
+ function joinPath(base, path) {
42
+ const protocol = /^(?:[a-z]+:)?\/\//i.exec(base)?.[0] ?? "";
43
+ return protocol + `${base.slice(protocol.length)}${path}`.replace(/\/+/g, "/");
44
+ }
45
+ const VP_SOURCE_KEY = "[VP_SOURCE]";
46
+ const UnpackStackView = Symbol("stack-view:unpack");
47
+ const HASH_WITHOUT_FRAGMENT_RE = /#.*?(?=:~:|$)/;
4
48
  const HASH_OR_QUERY_RE = /[?#].*$/;
5
- const INDEX_OR_EXT_RE = /(?:(^|\/)index)?\.(?:md|html)$/;
6
- export const inBrowser = typeof document !== 'undefined';
7
- export const notFoundPageData = {
8
- relativePath: '404.md',
9
- filePath: '',
10
- title: '404',
11
- description: 'Not Found',
12
- headers: [],
13
- frontmatter: { sidebar: false, layout: 'page' },
14
- lastUpdated: 0,
15
- isNotFound: true
49
+ const INDEX_OR_EXT_RE = /(?:(^|\/)index)?(?:\.(?:md|html))?$/;
50
+ const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g;
51
+ const DRIVE_LETTER_REGEX = /^[a-z]:/i;
52
+ const KNOWN_EXTENSIONS = /* @__PURE__ */ new Set();
53
+ const shellLangs = [
54
+ "shellscript",
55
+ "shell",
56
+ "bash",
57
+ "sh",
58
+ "zsh"
59
+ ];
60
+ const inBrowser = typeof document !== "undefined";
61
+ const notFoundPageData = {
62
+ relativePath: "404.md",
63
+ filePath: "",
64
+ title: "404",
65
+ description: "Not Found",
66
+ headers: [],
67
+ frontmatter: {
68
+ sidebar: false,
69
+ layout: "page"
70
+ },
71
+ lastUpdated: 0,
72
+ isNotFound: true
16
73
  };
17
- export function isActive(currentPath, matchPath, asRegex = false) {
18
- if (matchPath === undefined) {
19
- return false;
20
- }
21
- currentPath = normalize(`/${currentPath}`);
22
- if (asRegex) {
23
- return new RegExp(matchPath).test(currentPath);
24
- }
25
- if (normalize(matchPath) !== currentPath) {
26
- return false;
27
- }
28
- const hashMatch = matchPath.match(HASH_RE);
29
- if (hashMatch) {
30
- return (inBrowser ? location.hash : '') === hashMatch[0];
31
- }
32
- return true;
33
- }
34
- export function normalize(path) {
35
- return decodeURI(path)
36
- .replace(HASH_OR_QUERY_RE, '')
37
- .replace(INDEX_OR_EXT_RE, '$1');
38
- }
39
- export function isExternal(path) {
40
- return EXTERNAL_URL_RE.test(path);
41
- }
42
- export function getLocaleForPath(siteData, relativePath) {
43
- return (Object.keys(siteData?.locales || {}).find((key) => key !== 'root' &&
44
- !isExternal(key) &&
45
- isActive(relativePath, `/${key}/`, true)) || 'root');
74
+ function isActive(currentPath, currentHash, matchPath, asRegex = false, skipHashCheck = false) {
75
+ currentPath = normalize(`/${currentPath}`);
76
+ if (asRegex) return new RegExp(matchPath).test(currentPath);
77
+ if (normalize(matchPath) !== currentPath) return false;
78
+ if (skipHashCheck) return true;
79
+ const hashMatch = matchPath.match(HASH_WITHOUT_FRAGMENT_RE);
80
+ if (hashMatch) return currentHash === hashMatch[0];
81
+ return true;
82
+ }
83
+ function normalize(path) {
84
+ return decodeURI(path).replace(HASH_OR_QUERY_RE, "").replace(INDEX_OR_EXT_RE, "$1");
85
+ }
86
+ function isExternal(path) {
87
+ return EXTERNAL_URL_RE.test(path);
88
+ }
89
+ function getLocaleForPath(siteData, relativePath) {
90
+ return Object.keys(siteData?.locales || {}).find((key) => key !== "root" && !isExternal(key) && isActive(relativePath, "", `^/${key}/`, true)) || "root";
46
91
  }
47
92
  /**
48
- * this merges the locales data to the main data by the route
49
- */
50
- export function resolveSiteDataByRoute(siteData, relativePath) {
51
- const localeIndex = getLocaleForPath(siteData, relativePath);
52
- return Object.assign({}, siteData, {
53
- localeIndex,
54
- lang: siteData.locales[localeIndex]?.lang ?? siteData.lang,
55
- dir: siteData.locales[localeIndex]?.dir ?? siteData.dir,
56
- title: siteData.locales[localeIndex]?.title ?? siteData.title,
57
- titleTemplate: siteData.locales[localeIndex]?.titleTemplate ?? siteData.titleTemplate,
58
- description: siteData.locales[localeIndex]?.description ?? siteData.description,
59
- head: mergeHead(siteData.head, siteData.locales[localeIndex]?.head ?? []),
60
- themeConfig: {
61
- ...siteData.themeConfig,
62
- ...siteData.locales[localeIndex]?.themeConfig
63
- }
64
- });
93
+ * Resolves the site data for a route, layering the matched locale and
94
+ * additional configs over the root config.
95
+ */
96
+ function resolveSiteDataByRoute(siteData, relativePath, filePath) {
97
+ const localeIndex = getLocaleForPath(siteData, relativePath);
98
+ const { label, link, markdown, ...localeConfig } = siteData.locales[localeIndex] ?? {};
99
+ Object.assign(localeConfig, { localeIndex });
100
+ const additionalConfigs = resolveAdditionalConfig(siteData, filePath || relativePath);
101
+ if (inBrowser && import.meta.env?.DEV) {
102
+ localeConfig[VP_SOURCE_KEY] = `locale config (${localeIndex})`;
103
+ reportConfigLayers(relativePath, [
104
+ ...additionalConfigs,
105
+ localeConfig,
106
+ siteData
107
+ ]);
108
+ }
109
+ return stackView({ head: mergeHead(siteData.head ?? [], localeConfig.head ?? [], ...additionalConfigs.map((data) => data.head ?? []).reverse()) }, ...additionalConfigs, localeConfig, siteData);
65
110
  }
66
111
  /**
67
- * Create the page title string based on config.
68
- */
69
- export function createTitle(siteData, pageData) {
70
- const title = pageData.title || siteData.title;
71
- const template = pageData.titleTemplate ?? siteData.titleTemplate;
72
- if (typeof template === 'string' && template.includes(':title')) {
73
- return template.replace(/:title/g, title);
74
- }
75
- const templateString = createTitleTemplate(siteData.title, template);
76
- if (title === templateString.slice(3)) {
77
- return title;
78
- }
79
- return `${title}${templateString}`;
112
+ * Create the page title string based on config.
113
+ */
114
+ function createTitle(siteData, pageData) {
115
+ const title = pageData.title || siteData.title;
116
+ const template = pageData.titleTemplate ?? siteData.titleTemplate;
117
+ if (typeof template === "string" && template.includes(":title")) return template.replace(/:title/g, () => title);
118
+ const templateString = createTitleTemplate(siteData.title, template);
119
+ if (title === templateString.slice(3)) return title;
120
+ return `${title}${templateString}`;
80
121
  }
81
122
  function createTitleTemplate(siteTitle, template) {
82
- if (template === false) {
83
- return '';
84
- }
85
- if (template === true || template === undefined) {
86
- return ` | ${siteTitle}`;
87
- }
88
- if (siteTitle === template) {
89
- return '';
90
- }
91
- return ` | ${template}`;
92
- }
93
- function hasTag(head, tag) {
94
- const [tagType, tagAttrs] = tag;
95
- if (tagType !== 'meta')
96
- return false;
97
- const keyAttr = Object.entries(tagAttrs)[0]; // First key
98
- if (keyAttr == null)
99
- return false;
100
- return head.some(([type, attrs]) => type === tagType && attrs[keyAttr[0]] === keyAttr[1]);
101
- }
102
- export function mergeHead(prev, curr) {
103
- return [...prev.filter((tagAttrs) => !hasTag(curr, tagAttrs)), ...curr];
104
- }
105
- // https://github.com/rollup/rollup/blob/fec513270c6ac350072425cc045db367656c623b/src/utils/sanitizeFileName.ts
106
- const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$&*+,:;<=>?[\]^`{|}\u007F]/g;
107
- const DRIVE_LETTER_REGEX = /^[a-z]:/i;
108
- export function sanitizeFileName(name) {
109
- const match = DRIVE_LETTER_REGEX.exec(name);
110
- const driveLetter = match ? match[0] : '';
111
- return (driveLetter +
112
- name
113
- .slice(driveLetter.length)
114
- .replace(INVALID_CHAR_REGEX, '_')
115
- .replace(/(^|\/)_+(?=[^/]*$)/, '$1'));
116
- }
117
- export function slash(p) {
118
- return p.replace(/\\/g, '/');
119
- }
120
- const KNOWN_EXTENSIONS = new Set();
121
- export function treatAsHtml(filename) {
122
- if (KNOWN_EXTENSIONS.size === 0) {
123
- const extraExts = (typeof process === 'object' && process.env?.VITE_EXTRA_EXTENSIONS) ||
124
- import.meta.env?.VITE_EXTRA_EXTENSIONS ||
125
- '';
126
- ('3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,' +
127
- 'doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,' +
128
- 'man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,' +
129
- 'opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,' +
130
- 'tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,' +
131
- 'yaml,yml,zip' +
132
- (extraExts && typeof extraExts === 'string' ? ',' + extraExts : ''))
133
- .split(',')
134
- .forEach((ext) => KNOWN_EXTENSIONS.add(ext));
135
- }
136
- const ext = filename.split('.').pop();
137
- return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase());
138
- }
139
- // https://github.com/sindresorhus/escape-string-regexp/blob/ba9a4473850cb367936417e97f1f2191b7cc67dd/index.js
140
- export function escapeRegExp(str) {
141
- return str.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
123
+ if (template === false) return "";
124
+ if (template === true || template === void 0) return ` | ${siteTitle}`;
125
+ if (siteTitle === template) return "";
126
+ return ` | ${template}`;
127
+ }
128
+ function mergeHead(...headArrays) {
129
+ const merged = [];
130
+ const keyMap = /* @__PURE__ */ new Map();
131
+ for (const current of headArrays) for (const tag of current) {
132
+ const key = getHeadKey(tag);
133
+ if (key == null) {
134
+ merged.push(tag);
135
+ continue;
136
+ }
137
+ const existingIndex = keyMap.get(key);
138
+ if (existingIndex != null) merged[existingIndex] = tag;
139
+ else {
140
+ keyMap.set(key, merged.length);
141
+ merged.push(tag);
142
+ }
143
+ }
144
+ return merged;
145
+ }
146
+ function getHeadKey([type, attrs]) {
147
+ if (attrs.id) return `id=${attrs.id}`;
148
+ if (type !== "meta") return;
149
+ for (const name in attrs) if (name !== "content") return `${name}=${attrs[name]}`;
150
+ }
151
+ function sanitizeFileName(name) {
152
+ const match = DRIVE_LETTER_REGEX.exec(name);
153
+ const driveLetter = match ? match[0] : "";
154
+ return driveLetter + name.slice(driveLetter.length).replace(INVALID_CHAR_REGEX, "_").replace(/(^|\/)_+(?=[^/]*$)/, "$1");
155
+ }
156
+ /**
157
+ * Output path of a page's client chunk relative to `assetsDir`, from its hash
158
+ * map entry. The entry is the chunk's hash, prefixed with the subdirectory the
159
+ * build put the chunk in when `assetsShards` is set (`<shard>/<hash>`), so the
160
+ * client never has to guess the layout.
161
+ */
162
+ function pageChunkPath(pageName, hashEntry, ext = ".js") {
163
+ const dir = hashEntry.lastIndexOf("/") + 1;
164
+ return `${hashEntry.slice(0, dir)}${pageName}.${hashEntry.slice(dir)}${ext}`;
165
+ }
166
+ function slash(p) {
167
+ return p.replace(/\\/g, "/");
168
+ }
169
+ function treatAsHtml(filename) {
170
+ if (KNOWN_EXTENSIONS.size === 0) {
171
+ const extraExts = globalThis.process?.env?.VITE_EXTRA_EXTENSIONS || import.meta.env?.VITE_EXTRA_EXTENSIONS || "";
172
+ ("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip" + (extraExts && typeof extraExts === "string" ? "," + extraExts : "")).split(",").forEach((ext) => KNOWN_EXTENSIONS.add(ext));
173
+ }
174
+ const ext = filename.split(".").pop();
175
+ return ext == null || !KNOWN_EXTENSIONS.has(ext.toLowerCase());
176
+ }
177
+ const SPACE_OR_PUNCTUATION_RE = /[\n\r\p{Z}\p{P}]+/u;
178
+ const UNSPACED_RUN_RE = /[\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}]+|[^\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}]+/gu;
179
+ const UNSPACED_START_RE = /^[\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}]/u;
180
+ let segmenter;
181
+ /**
182
+ * Default `tokenize` of the local search. It splits on spaces and punctuation
183
+ * like MiniSearch does, and additionally segments the runs of Chinese or
184
+ * Japanese characters inside those words, as they are not separated by spaces.
185
+ * Everything else is kept as MiniSearch would.
186
+ *
187
+ * It is used both when building the index and when searching in the browser.
188
+ * A browser without `Intl.Segmenter` (e.g. Firefox < 125) falls back to the
189
+ * plain split, which can't match multi-word queries against an index that was
190
+ * built with segmentation.
191
+ *
192
+ * @internal
193
+ */
194
+ function tokenizeSearchText(text) {
195
+ const terms = text.split(SPACE_OR_PUNCTUATION_RE);
196
+ if (typeof Intl.Segmenter !== "function") return terms;
197
+ segmenter ??= new Intl.Segmenter(void 0, { granularity: "word" });
198
+ return terms.flatMap((term) => term.match(UNSPACED_RUN_RE)?.flatMap((run) => UNSPACED_START_RE.test(run) ? Array.from(segmenter.segment(run), (part) => part.segment) : run) ?? term);
199
+ }
200
+ function escapeRegExp(str) {
201
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
202
+ }
203
+ /**
204
+ * @internal
205
+ */
206
+ function escapeHtml(str) {
207
+ return str.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/&(?![\w#]+;)/g, "&amp;");
208
+ }
209
+ function resolveAdditionalConfig({ additionalConfig }, path) {
210
+ if (additionalConfig === void 0) return [];
211
+ if (typeof additionalConfig === "function") return additionalConfig(path) ?? [];
212
+ const configs = [];
213
+ const segments = path.split("/").slice(0, -1);
214
+ while (segments.length) {
215
+ const key = `/${segments.join("/")}/`;
216
+ configs.push(additionalConfig[key]);
217
+ segments.pop();
218
+ }
219
+ configs.push(additionalConfig["/"]);
220
+ return configs.filter((config) => config !== void 0);
221
+ }
222
+ function reportConfigLayers(path, layers) {
223
+ const summaryTitle = `Config Layers for ${path}:`;
224
+ const summary = layers.map((c, i, arr) => {
225
+ const n = i + 1;
226
+ if (n === arr.length) return `${n}. .vitepress/config (root)`;
227
+ return `${n}. ${c?.["[VP_SOURCE]"] ?? "(Unknown Source)"}`;
228
+ });
229
+ console.debug([
230
+ summaryTitle,
231
+ "".padEnd(summaryTitle.length, "="),
232
+ ...summary
233
+ ].join("\n"));
142
234
  }
143
235
  /**
144
- * @internal
145
- */
146
- export function escapeHtml(str) {
147
- return str
148
- .replace(/</g, '&lt;')
149
- .replace(/>/g, '&gt;')
150
- .replace(/"/g, '&quot;')
151
- .replace(/&(?![\w#]+;)/g, '&amp;');
236
+ * Creates a readonly proxy behaving like a deep merge of the given layers,
237
+ * without mutating them. Earlier layers take precedence.
238
+ */
239
+ function stackView(..._layers) {
240
+ const layers = _layers.filter((layer) => isObject(layer));
241
+ if (layers.length <= 1) return _layers[0];
242
+ const allKeys = new Set(layers.flatMap((layer) => Reflect.ownKeys(layer)));
243
+ const allKeysArray = [...allKeys];
244
+ return new Proxy({}, {
245
+ get(_, prop) {
246
+ if (prop === UnpackStackView) return layers;
247
+ return stackView(...layers.map((layer) => layer[prop]).filter((v) => v !== void 0));
248
+ },
249
+ set() {
250
+ throw new Error("StackView is read-only and cannot be mutated.");
251
+ },
252
+ has(_, prop) {
253
+ return allKeys.has(prop);
254
+ },
255
+ ownKeys() {
256
+ return allKeysArray;
257
+ },
258
+ getOwnPropertyDescriptor(_, prop) {
259
+ for (const layer of layers) {
260
+ const descriptor = Object.getOwnPropertyDescriptor(layer, prop);
261
+ if (descriptor) return descriptor;
262
+ }
263
+ }
264
+ });
265
+ }
266
+ stackView.unpack = function(obj) {
267
+ return obj?.[UnpackStackView];
268
+ };
269
+ function isObject(value) {
270
+ return Object.prototype.toString.call(value) === "[object Object]";
271
+ }
272
+ function isShell(lang) {
273
+ return shellLangs.includes(lang);
152
274
  }
275
+ //#endregion
276
+ export { APPEARANCE_KEY, EXTERNAL_URL_RE, RELATIVE_BASE_SENTINEL, VP_SOURCE_KEY, createTitle, escapeHtml, escapeRegExp, getLocaleForPath, inBrowser, isActive, isExternal, isObject, isRelativeBase, isShell, joinPath, mergeHead, normalize, notFoundPageData, pageChunkPath, parseIconName, relativePathToRoot, resolveSiteDataByRoute, sanitizeFileName, slash, stackView, tokenizeSearchText, treatAsHtml };
@@ -0,0 +1,79 @@
1
+ declare var __VLS_1: {}, __VLS_22: {}, __VLS_25: {}, __VLS_28: {}, __VLS_31: {}, __VLS_34: {}, __VLS_37: {}, __VLS_53: {}, __VLS_56: {}, __VLS_65: {}, __VLS_68: {}, __VLS_71: {}, __VLS_74: {}, __VLS_77: {}, __VLS_80: {}, __VLS_83: {}, __VLS_86: {}, __VLS_89: {}, __VLS_92: {}, __VLS_95: {}, __VLS_98: {}, __VLS_101: {}, __VLS_104: {}, __VLS_107: {}, __VLS_110: {}, __VLS_113: {}, __VLS_116: {}, __VLS_119: {}, __VLS_122: {}, __VLS_125: {}, __VLS_128: {}, __VLS_131: {}, __VLS_134: {}, __VLS_141: {};
2
+ type __VLS_Slots = {} & {
3
+ 'layout-top'?: (props: typeof __VLS_1) => any;
4
+ } & {
5
+ 'nav-bar-title-before'?: (props: typeof __VLS_22) => any;
6
+ } & {
7
+ 'nav-bar-title-after'?: (props: typeof __VLS_25) => any;
8
+ } & {
9
+ 'nav-bar-content-before'?: (props: typeof __VLS_28) => any;
10
+ } & {
11
+ 'nav-bar-content-after'?: (props: typeof __VLS_31) => any;
12
+ } & {
13
+ 'nav-screen-content-before'?: (props: typeof __VLS_34) => any;
14
+ } & {
15
+ 'nav-screen-content-after'?: (props: typeof __VLS_37) => any;
16
+ } & {
17
+ 'sidebar-nav-before'?: (props: typeof __VLS_53) => any;
18
+ } & {
19
+ 'sidebar-nav-after'?: (props: typeof __VLS_56) => any;
20
+ } & {
21
+ 'page-top'?: (props: typeof __VLS_65) => any;
22
+ } & {
23
+ 'page-bottom'?: (props: typeof __VLS_68) => any;
24
+ } & {
25
+ 'not-found'?: (props: typeof __VLS_71) => any;
26
+ } & {
27
+ 'home-hero-before'?: (props: typeof __VLS_74) => any;
28
+ } & {
29
+ 'home-hero-info-before'?: (props: typeof __VLS_77) => any;
30
+ } & {
31
+ 'home-hero-info'?: (props: typeof __VLS_80) => any;
32
+ } & {
33
+ 'home-hero-info-after'?: (props: typeof __VLS_83) => any;
34
+ } & {
35
+ 'home-hero-actions-after'?: (props: typeof __VLS_86) => any;
36
+ } & {
37
+ 'home-hero-actions-before-actions'?: (props: typeof __VLS_89) => any;
38
+ } & {
39
+ 'home-hero-image'?: (props: typeof __VLS_92) => any;
40
+ } & {
41
+ 'home-hero-after'?: (props: typeof __VLS_95) => any;
42
+ } & {
43
+ 'home-features-before'?: (props: typeof __VLS_98) => any;
44
+ } & {
45
+ 'home-features-after'?: (props: typeof __VLS_101) => any;
46
+ } & {
47
+ 'doc-footer-before'?: (props: typeof __VLS_104) => any;
48
+ } & {
49
+ 'doc-before'?: (props: typeof __VLS_107) => any;
50
+ } & {
51
+ 'doc-after'?: (props: typeof __VLS_110) => any;
52
+ } & {
53
+ 'doc-top'?: (props: typeof __VLS_113) => any;
54
+ } & {
55
+ 'doc-bottom'?: (props: typeof __VLS_116) => any;
56
+ } & {
57
+ 'aside-top'?: (props: typeof __VLS_119) => any;
58
+ } & {
59
+ 'aside-bottom'?: (props: typeof __VLS_122) => any;
60
+ } & {
61
+ 'aside-outline-before'?: (props: typeof __VLS_125) => any;
62
+ } & {
63
+ 'aside-outline-after'?: (props: typeof __VLS_128) => any;
64
+ } & {
65
+ 'aside-ads-before'?: (props: typeof __VLS_131) => any;
66
+ } & {
67
+ 'aside-ads-after'?: (props: typeof __VLS_134) => any;
68
+ } & {
69
+ 'layout-bottom'?: (props: typeof __VLS_141) => any;
70
+ };
71
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
73
+ declare const _default: typeof __VLS_export;
74
+ export default _default;
75
+ type __VLS_WithSlots<T, S> = T & {
76
+ new (): {
77
+ $slots: S;
78
+ };
79
+ };
@@ -1,39 +1,35 @@
1
- <script setup lang="ts">
2
- import { useRoute } from 'vitepress'
3
- import { computed, provide, useSlots, watch } from 'vue'
4
- import VPBackdrop from './components/VPBackdrop.vue'
5
- import VPContent from './components/VPContent.vue'
6
- import VPFooter from './components/VPFooter.vue'
7
- import VPLocalNav from './components/VPLocalNav.vue'
8
- import VPNav from './components/VPNav.vue'
9
- import VPSidebar from './components/VPSidebar.vue'
10
- import VPSkipLink from './components/VPSkipLink.vue'
11
- import { useData } from './composables/data'
12
- import { useCloseSidebarOnEscape, useSidebar } from './composables/sidebar'
13
-
14
- const {
15
- isOpen: isSidebarOpen,
16
- open: openSidebar,
17
- close: closeSidebar
18
- } = useSidebar()
19
-
20
- const route = useRoute()
21
- watch(() => route.path, closeSidebar)
22
-
23
- useCloseSidebarOnEscape(isSidebarOpen, closeSidebar)
24
-
25
- const { frontmatter } = useData()
26
-
27
- const slots = useSlots()
28
- const heroImageSlotExists = computed(() => !!slots['home-hero-image'])
29
-
30
- provide('hero-image-slot-exists', heroImageSlotExists)
1
+ <script setup>
2
+ import { computed, provide, useSlots } from "vue";
3
+ import VPBackdrop from "./components/VPBackdrop.vue";
4
+ import VPContent from "./components/VPContent.vue";
5
+ import VPFooter from "./components/VPFooter.vue";
6
+ import VPLocalNav from "./components/VPLocalNav.vue";
7
+ import VPNav from "./components/VPNav.vue";
8
+ import VPSidebar from "./components/VPSidebar.vue";
9
+ import VPSkipLink from "./components/VPSkipLink.vue";
10
+ import { useData } from "./composables/data";
11
+ import { layoutInfoInjectionKey, registerWatchers } from "./composables/layout";
12
+ import { useNav } from "./composables/nav";
13
+ import { useSidebarControl } from "./composables/sidebar";
14
+ const { isOpen: isSidebarOpen, open: openSidebar, close: closeSidebar } = useSidebarControl();
15
+ // everything behind the open nav screen is inert so keyboard and screen
16
+ // reader users can't reach the covered page content
17
+ const { isScreenOpen } = useNav();
18
+ registerWatchers({ closeSidebar });
19
+ const { frontmatter, theme } = useData();
20
+ const slots = useSlots();
21
+ const heroImageSlotExists = computed(() => !!slots["home-hero-image"]);
22
+ provide(layoutInfoInjectionKey, { heroImageSlotExists });
31
23
  </script>
32
24
 
33
25
  <template>
34
- <div v-if="frontmatter.layout !== false" class="Layout" :class="frontmatter.pageClass" >
26
+ <div
27
+ v-if="frontmatter.layout !== false"
28
+ class="Layout"
29
+ :class="[frontmatter.pageClass, theme.gradedContainers && 'vp-graded-containers']"
30
+ >
35
31
  <slot name="layout-top" />
36
- <VPSkipLink />
32
+ <VPSkipLink :inert="isScreenOpen" />
37
33
  <VPBackdrop class="backdrop" :show="isSidebarOpen" @click="closeSidebar" />
38
34
  <VPNav>
39
35
  <template #nav-bar-title-before><slot name="nav-bar-title-before" /></template>
@@ -43,14 +39,14 @@ provide('hero-image-slot-exists', heroImageSlotExists)
43
39
  <template #nav-screen-content-before><slot name="nav-screen-content-before" /></template>
44
40
  <template #nav-screen-content-after><slot name="nav-screen-content-after" /></template>
45
41
  </VPNav>
46
- <VPLocalNav :open="isSidebarOpen" @open-menu="openSidebar" />
42
+ <VPLocalNav :open="isSidebarOpen" @open-menu="openSidebar" :inert="isScreenOpen" />
47
43
 
48
- <VPSidebar :open="isSidebarOpen">
44
+ <VPSidebar :open="isSidebarOpen" :inert="isScreenOpen">
49
45
  <template #sidebar-nav-before><slot name="sidebar-nav-before" /></template>
50
46
  <template #sidebar-nav-after><slot name="sidebar-nav-after" /></template>
51
47
  </VPSidebar>
52
48
 
53
- <VPContent>
49
+ <VPContent :inert="isScreenOpen">
54
50
  <template #page-top><slot name="page-top" /></template>
55
51
  <template #page-bottom><slot name="page-bottom" /></template>
56
52
 
@@ -60,6 +56,7 @@ provide('hero-image-slot-exists', heroImageSlotExists)
60
56
  <template #home-hero-info><slot name="home-hero-info" /></template>
61
57
  <template #home-hero-info-after><slot name="home-hero-info-after" /></template>
62
58
  <template #home-hero-actions-after><slot name="home-hero-actions-after" /></template>
59
+ <template #home-hero-actions-before-actions><slot name="home-hero-actions-before-actions" /></template>
63
60
  <template #home-hero-image><slot name="home-hero-image" /></template>
64
61
  <template #home-hero-after><slot name="home-hero-after" /></template>
65
62
  <template #home-features-before><slot name="home-features-before" /></template>
@@ -79,7 +76,7 @@ provide('hero-image-slot-exists', heroImageSlotExists)
79
76
  <template #aside-ads-after><slot name="aside-ads-after" /></template>
80
77
  </VPContent>
81
78
 
82
- <VPFooter />
79
+ <VPFooter :inert="isScreenOpen" />
83
80
  <slot name="layout-bottom" />
84
81
  </div>
85
82
  <Content v-else />
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;