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.
- package/README.md +34 -2
- package/THIRD-PARTY-NOTICES.md +1736 -0
- package/bin/vitepress.js +14 -0
- package/client.d.ts +9 -0
- package/dist/client/app/components/ClientOnly.d.ts +5 -0
- package/dist/client/app/components/ClientOnly.js +11 -10
- package/dist/client/app/components/Content.d.ts +17 -0
- package/dist/client/app/components/Content.js +25 -22
- package/dist/client/app/composables/codeGroups.d.ts +3 -0
- package/dist/client/app/composables/codeGroups.js +36 -39
- package/dist/client/app/composables/copyCode.d.ts +3 -0
- package/dist/client/app/composables/copyCode.js +59 -70
- package/dist/client/app/composables/head.d.ts +5 -0
- package/dist/client/app/composables/head.js +56 -74
- package/dist/client/app/composables/icon.d.ts +12 -0
- package/dist/client/app/composables/icon.js +56 -0
- package/dist/client/app/composables/preFetch.d.ts +3 -0
- package/dist/client/app/composables/preFetch.js +64 -96
- package/dist/client/app/data.d.ts +9 -0
- package/dist/client/app/data.js +34 -59
- package/dist/client/app/devtools.d.ts +7 -0
- package/dist/client/app/devtools.js +29 -28
- package/dist/client/app/index.d.ts +11 -0
- package/dist/client/app/index.js +106 -131
- package/dist/client/app/router.d.ts +49 -0
- package/dist/client/app/router.js +198 -239
- package/dist/client/app/ssr.d.ts +4 -0
- package/dist/client/app/ssr.js +14 -9
- package/dist/client/app/theme.d.ts +24 -0
- package/dist/client/app/theme.js +0 -1
- package/dist/client/app/utils.d.ts +35 -0
- package/dist/client/app/utils.js +77 -110
- package/dist/client/index.d.ts +21 -137
- package/dist/client/index.js +8 -9
- package/dist/client/shared.d.ts +88 -0
- package/dist/client/shared.js +265 -141
- package/dist/client/theme-default/Layout.d.vue.ts +79 -0
- package/dist/client/theme-default/Layout.vue +33 -36
- package/dist/client/theme-default/NotFound.d.vue.ts +3 -0
- package/dist/client/theme-default/NotFound.vue +33 -35
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.d.vue.ts +11 -0
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +202 -70
- package/dist/client/theme-default/components/VPBackdrop.d.vue.ts +6 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +8 -12
- package/dist/client/theme-default/components/VPBadge.d.vue.ts +19 -0
- package/dist/client/theme-default/components/VPBadge.vue +49 -26
- package/dist/client/theme-default/components/VPButton.d.vue.ts +25 -0
- package/dist/client/theme-default/components/VPButton.vue +53 -36
- package/dist/client/theme-default/components/VPCarbonAds.d.vue.ts +7 -0
- package/dist/client/theme-default/components/VPCarbonAds.vue +51 -52
- package/dist/client/theme-default/components/VPContent.d.vue.ts +59 -0
- package/dist/client/theme-default/components/VPContent.vue +27 -26
- package/dist/client/theme-default/components/VPDoc.d.vue.ts +33 -0
- package/dist/client/theme-default/components/VPDoc.vue +52 -48
- package/dist/client/theme-default/components/VPDocAside.d.vue.ts +23 -0
- package/dist/client/theme-default/components/VPDocAside.vue +7 -8
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.d.vue.ts +7 -0
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +7 -11
- package/dist/client/theme-default/components/VPDocAsideOutline.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPDocAsideOutline.vue +22 -38
- package/dist/client/theme-default/components/VPDocAsideSponsors.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPDocAsideSponsors.vue +17 -11
- package/dist/client/theme-default/components/VPDocFooter.d.vue.ts +13 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +38 -45
- package/dist/client/theme-default/components/VPDocFooterLastUpdated.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPDocFooterLastUpdated.vue +30 -29
- package/dist/client/theme-default/components/VPDocOutlineItem.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPDocOutlineItem.vue +20 -19
- package/dist/client/theme-default/components/VPFeature.d.vue.ts +13 -0
- package/dist/client/theme-default/components/VPFeature.vue +62 -36
- package/dist/client/theme-default/components/VPFeatures.d.vue.ts +16 -0
- package/dist/client/theme-default/components/VPFeatures.vue +35 -48
- package/dist/client/theme-default/components/VPFlyout.d.vue.ts +26 -0
- package/dist/client/theme-default/components/VPFlyout.vue +111 -47
- package/dist/client/theme-default/components/VPFooter.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPFooter.vue +22 -15
- package/dist/client/theme-default/components/VPHero.d.vue.ts +38 -0
- package/dist/client/theme-default/components/VPHero.vue +109 -99
- package/dist/client/theme-default/components/VPHome.d.vue.ts +31 -0
- package/dist/client/theme-default/components/VPHome.vue +15 -15
- package/dist/client/theme-default/components/VPHomeContent.d.vue.ts +13 -0
- package/dist/client/theme-default/components/VPHomeContent.vue +9 -27
- package/dist/client/theme-default/components/VPHomeFeatures.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPHomeFeatures.vue +4 -5
- package/dist/client/theme-default/components/VPHomeHero.d.vue.ts +23 -0
- package/dist/client/theme-default/components/VPHomeHero.vue +5 -5
- package/dist/client/theme-default/components/VPHomeSponsors.d.vue.ts +21 -0
- package/dist/client/theme-default/components/VPHomeSponsors.vue +42 -43
- package/dist/client/theme-default/components/VPIcon.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPIcon.vue +29 -0
- package/dist/client/theme-default/components/VPImage.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPImage.vue +20 -14
- package/dist/client/theme-default/components/VPLink.d.vue.ts +23 -0
- package/dist/client/theme-default/components/VPLink.vue +42 -23
- package/dist/client/theme-default/components/VPLocalNav.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +69 -86
- package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPLocalNavOutlineDropdown.vue +98 -96
- package/dist/client/theme-default/components/VPLocalSearchBox.d.vue.ts +7 -0
- package/dist/client/theme-default/components/VPLocalSearchBox.vue +391 -454
- package/dist/client/theme-default/components/VPMenu.d.vue.ts +23 -0
- package/dist/client/theme-default/components/VPMenu.vue +19 -31
- package/dist/client/theme-default/components/VPMenuGroup.d.vue.ts +22 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +72 -18
- package/dist/client/theme-default/components/VPMenuLink.d.vue.ts +22 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +65 -31
- package/dist/client/theme-default/components/VPNav.d.vue.ts +23 -0
- package/dist/client/theme-default/components/VPNav.vue +18 -24
- package/dist/client/theme-default/components/VPNavAppearance.d.vue.ts +9 -0
- package/dist/client/theme-default/components/VPNavAppearance.vue +88 -0
- package/dist/client/theme-default/components/VPNavBar.d.vue.ts +26 -0
- package/dist/client/theme-default/components/VPNavBar.vue +170 -142
- package/dist/client/theme-default/components/VPNavBarAskAiButton.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPNavBarAskAiButton.vue +31 -0
- package/dist/client/theme-default/components/VPNavBarExtra.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +51 -73
- package/dist/client/theme-default/components/VPNavBarHamburger.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +38 -28
- package/dist/client/theme-default/components/VPNavBarSearch.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +129 -160
- package/dist/client/theme-default/components/VPNavBarSearchButton.d.vue.ts +6 -0
- package/dist/client/theme-default/components/VPNavBarSearchButton.vue +48 -182
- package/dist/client/theme-default/components/VPNavBarTitle.d.vue.ts +15 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +39 -38
- package/dist/client/theme-default/components/VPNavMenu.d.vue.ts +6 -0
- package/dist/client/theme-default/components/VPNavMenu.vue +76 -0
- package/dist/client/theme-default/components/VPNavMenuGroup.d.vue.ts +11 -0
- package/dist/client/theme-default/components/VPNavMenuGroup.vue +140 -0
- package/dist/client/theme-default/components/VPNavMenuLink.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPNavMenuLink.vue +69 -0
- package/dist/client/theme-default/components/VPNavScreen.d.vue.ts +18 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +36 -34
- package/dist/client/theme-default/components/VPNavSocialLinks.d.vue.ts +6 -0
- package/dist/client/theme-default/components/VPNavSocialLinks.vue +36 -0
- package/dist/client/theme-default/components/VPNavTranslations.d.vue.ts +9 -0
- package/dist/client/theme-default/components/VPNavTranslations.vue +170 -0
- package/dist/client/theme-default/components/VPPage.d.vue.ts +15 -0
- package/dist/client/theme-default/components/VPSidebar.d.vue.ts +18 -0
- package/dist/client/theme-default/components/VPSidebar.vue +40 -53
- package/dist/client/theme-default/components/VPSidebarGroup.d.vue.ts +7 -0
- package/dist/client/theme-default/components/VPSidebarGroup.vue +24 -29
- package/dist/client/theme-default/components/VPSidebarItem.d.vue.ts +8 -0
- package/dist/client/theme-default/components/VPSidebarItem.vue +60 -93
- package/dist/client/theme-default/components/VPSkipLink.d.vue.ts +6 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +23 -42
- package/dist/client/theme-default/components/VPSocialLink.d.vue.ts +11 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +42 -49
- package/dist/client/theme-default/components/VPSocialLinks.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +26 -16
- package/dist/client/theme-default/components/VPSponsors.d.vue.ts +18 -0
- package/dist/client/theme-default/components/VPSponsors.vue +34 -33
- package/dist/client/theme-default/components/VPSponsorsGrid.d.vue.ts +15 -0
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +23 -26
- package/dist/client/theme-default/components/VPSwitch.d.vue.ts +13 -0
- package/dist/client/theme-default/components/VPSwitch.vue +12 -13
- package/dist/client/theme-default/components/VPSwitchAppearance.d.vue.ts +3 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +16 -21
- package/dist/client/theme-default/components/VPTeamMembers.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPTeamMembers.vue +59 -32
- package/dist/client/theme-default/components/VPTeamMembersItem.d.vue.ts +10 -0
- package/dist/client/theme-default/components/VPTeamMembersItem.vue +62 -58
- package/dist/client/theme-default/components/VPTeamPage.d.vue.ts +13 -0
- package/dist/client/theme-default/components/VPTeamPage.vue +14 -14
- package/dist/client/theme-default/components/VPTeamPageSection.d.vue.ts +17 -0
- package/dist/client/theme-default/components/VPTeamPageSection.vue +20 -19
- package/dist/client/theme-default/components/VPTeamPageTitle.d.vue.ts +15 -0
- package/dist/client/theme-default/components/VPTeamPageTitle.vue +22 -22
- package/dist/client/theme-default/composables/data.d.ts +5 -0
- package/dist/client/theme-default/composables/data.js +5 -2
- package/dist/client/theme-default/composables/edit-link.d.ts +6 -0
- package/dist/client/theme-default/composables/edit-link.js +17 -15
- package/dist/client/theme-default/composables/flyout.d.ts +10 -0
- package/dist/client/theme-default/composables/flyout.js +33 -32
- package/dist/client/theme-default/composables/langs.d.ts +44 -0
- package/dist/client/theme-default/composables/langs.js +48 -24
- package/dist/client/theme-default/composables/layout.d.ts +13 -0
- package/dist/client/theme-default/composables/layout.js +68 -0
- package/dist/client/theme-default/composables/nav-overflow.d.ts +54 -0
- package/dist/client/theme-default/composables/nav-overflow.js +179 -0
- package/dist/client/theme-default/composables/nav.d.ts +25 -0
- package/dist/client/theme-default/composables/nav.js +58 -29
- package/dist/client/theme-default/composables/outline.d.ts +8 -0
- package/dist/client/theme-default/composables/outline.js +144 -166
- package/dist/client/theme-default/composables/prev-next.d.ts +16 -0
- package/dist/client/theme-default/composables/prev-next.js +34 -56
- package/dist/client/theme-default/composables/scroll-lock.d.ts +4 -0
- package/dist/client/theme-default/composables/scroll-lock.js +95 -0
- package/dist/client/theme-default/composables/sidebar.d.ts +25 -0
- package/dist/client/theme-default/composables/sidebar.js +96 -133
- package/dist/client/theme-default/composables/sponsor-grid.d.ts +10 -0
- package/dist/client/theme-default/composables/sponsor-grid.js +69 -76
- package/dist/client/theme-default/fonts/inter-italic-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-symbols.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-italic-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-symbols.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-roman-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.d.ts +3 -0
- package/dist/client/theme-default/index.js +4 -3
- package/dist/client/theme-default/styles/base.css +279 -211
- package/dist/client/theme-default/styles/components/custom-block.css +12 -7
- package/dist/client/theme-default/styles/components/vp-code-group.css +13 -16
- package/dist/client/theme-default/styles/components/vp-code.css +10 -2
- package/dist/client/theme-default/styles/components/vp-doc.css +188 -142
- package/dist/client/theme-default/styles/components/vp-sponsor.css +48 -37
- package/dist/client/theme-default/styles/docsearch.css +138 -0
- package/dist/client/theme-default/styles/fonts.css +216 -55
- package/dist/client/theme-default/styles/icons.css +42 -22
- package/dist/client/theme-default/styles/vars.css +111 -46
- package/dist/client/theme-default/support/docsearch.d.ts +57 -0
- package/dist/client/theme-default/support/docsearch.js +145 -0
- package/dist/client/theme-default/support/local-search.d.ts +9 -0
- package/dist/client/theme-default/support/local-search.js +31 -0
- package/dist/client/theme-default/support/lru.d.ts +11 -0
- package/dist/client/theme-default/support/lru.js +30 -33
- package/dist/client/theme-default/support/reactivity.d.ts +4 -0
- package/dist/client/theme-default/support/reactivity.js +10 -0
- package/dist/client/theme-default/support/sidebar.d.ts +27 -0
- package/dist/client/theme-default/support/sidebar.js +69 -80
- package/dist/client/theme-default/support/translation.d.ts +6 -0
- package/dist/client/theme-default/support/translation.js +33 -47
- package/dist/client/theme-default/support/utils.d.ts +7 -0
- package/dist/client/theme-default/support/utils.js +39 -30
- package/dist/client/theme-default/without-fonts.d.ts +25 -0
- package/dist/client/theme-default/without-fonts.js +37 -36
- package/dist/node/chunk-BjrVv9r8.js +28627 -0
- package/dist/node/cli.d.ts +1 -0
- package/dist/node/cli.js +160 -423
- package/dist/node/index.d.ts +1761 -2476
- package/dist/node/index.js +1 -121
- package/dist/web-types.json +75 -0
- package/package.json +89 -98
- package/template/.vitepress/config.js +3 -1
- package/template/.vitepress/theme/style.css +3 -11
- package/theme.d.ts +30 -23
- package/types/default-theme.d.ts +109 -113
- package/types/docsearch.d.ts +61 -142
- package/types/shared.d.ts +469 -50
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +0 -32
- package/dist/client/theme-default/components/VPNavBarMenu.vue +0 -40
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +0 -42
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +0 -53
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +0 -27
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +0 -47
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +0 -40
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +0 -26
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +0 -112
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +0 -40
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +0 -34
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +0 -43
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +0 -14
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +0 -73
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +0 -8
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +0 -8
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +0 -8
- package/dist/client/theme-default/components/icons/VPIconArrowLeft.vue +0 -7
- package/dist/client/theme-default/components/icons/VPIconArrowRight.vue +0 -7
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +0 -6
- package/dist/client/theme-default/components/icons/VPIconHeart.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +0 -9
- package/dist/client/theme-default/components/icons/VPIconMinus.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +0 -6
- package/dist/client/theme-default/components/icons/VPIconMoon.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +0 -7
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +0 -5
- package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +0 -6
- package/dist/client/theme-default/components/icons/VPIconSun.vue +0 -13
- package/dist/client/theme-default/composables/aside.js +0 -17
- package/dist/client/theme-default/composables/local-nav.js +0 -18
- package/dist/node/chunk-C-d2RJOW.js +0 -470
- package/dist/node/chunk-CxQfvv8o.js +0 -49065
- package/dist/node/worker_shikiResolveLang.js +0 -13
package/dist/client/shared.js
CHANGED
|
@@ -1,152 +1,276 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
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)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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, "<").replace(/>/g, ">").replace(/"/g, """).replace(/&(?![\w#]+;)/g, "&");
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
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
|
|
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;
|