vitepress 0.22.3 → 1.0.0-draft.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +2 -3
- package/dist/client/app/components/ClientOnly.js +1 -1
- package/dist/client/app/index.js +5 -7
- package/dist/client/index.d.ts +5 -0
- package/dist/client/shared.js +1 -0
- package/dist/client/theme-default/Layout.vue +39 -180
- package/dist/client/theme-default/NotFound.vue +9 -8
- package/dist/client/theme-default/components/VPAlgoliaSearchBox.vue +127 -0
- package/dist/client/theme-default/components/VPBackdrop.vue +39 -0
- package/dist/client/theme-default/components/VPBox.vue +59 -0
- package/dist/client/theme-default/components/VPButton.vue +123 -0
- package/dist/client/theme-default/components/VPContent.vue +74 -0
- package/dist/client/theme-default/components/VPDoc.vue +173 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +141 -0
- package/dist/client/theme-default/components/VPDocOutline.vue +108 -0
- package/dist/client/theme-default/components/VPFlyout.vue +149 -0
- package/dist/client/theme-default/components/VPFooter.vue +53 -0
- package/dist/client/theme-default/components/VPHero.vue +144 -0
- package/dist/client/theme-default/components/VPHome.vue +33 -0
- package/dist/client/theme-default/components/VPHomeFeatures.vue +96 -0
- package/dist/client/theme-default/components/VPHomeHero.vue +17 -0
- package/dist/client/theme-default/components/VPHomeSponsors.vue +97 -0
- package/dist/client/theme-default/components/VPLink.vue +37 -0
- package/dist/client/theme-default/components/VPLocalNav.vue +106 -0
- package/dist/client/theme-default/components/VPMenu.vue +79 -0
- package/dist/client/theme-default/components/VPMenuGroup.vue +35 -0
- package/dist/client/theme-default/components/VPMenuLink.vue +30 -0
- package/dist/client/theme-default/components/VPNav.vue +33 -0
- package/dist/client/theme-default/components/VPNavBar.vue +110 -0
- package/dist/client/theme-default/components/VPNavBarAppearance.vue +25 -0
- package/dist/client/theme-default/components/VPNavBarExtra.vue +107 -0
- package/dist/client/theme-default/components/VPNavBarHamburger.vue +79 -0
- package/dist/client/theme-default/components/VPNavBarMenu.vue +29 -0
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +18 -0
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +56 -0
- package/dist/client/theme-default/components/VPNavBarSearch.vue +269 -0
- package/dist/client/theme-default/components/VPNavBarSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPNavBarTitle.vue +57 -0
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +74 -0
- package/dist/client/theme-default/components/VPNavScreen.vue +100 -0
- package/dist/client/theme-default/components/VPNavScreenAppearance.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenu.vue +24 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +118 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupLink.vue +33 -0
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +35 -0
- package/dist/client/theme-default/components/VPNavScreenMenuLink.vue +34 -0
- package/dist/client/theme-default/components/VPNavScreenSocialLinks.vue +14 -0
- package/dist/client/theme-default/components/VPNavScreenTranslations.vue +73 -0
- package/dist/client/theme-default/components/VPPage.vue +5 -0
- package/dist/client/theme-default/components/VPSidebar.vue +118 -0
- package/dist/client/theme-default/components/VPSidebarGroup.vue +44 -0
- package/dist/client/theme-default/components/VPSidebarLink.vue +57 -0
- package/dist/client/theme-default/components/VPSkipLink.vue +72 -0
- package/dist/client/theme-default/components/VPSocialLink.vue +63 -0
- package/dist/client/theme-default/components/VPSocialLinks.vue +27 -0
- package/dist/client/theme-default/components/VPSponsors.vue +77 -0
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +32 -0
- package/dist/client/theme-default/components/VPSwitch.vue +66 -0
- package/dist/client/theme-default/components/VPSwitchAppearance.vue +74 -0
- package/dist/client/theme-default/components/icons/VPIconAlignJustify.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignLeft.vue +8 -0
- package/dist/client/theme-default/components/icons/VPIconAlignRight.vue +8 -0
- package/dist/client/theme-default/components/icons/{ArrowLeft.vue → VPIconArrowLeft.vue} +0 -0
- package/dist/client/theme-default/components/icons/{ArrowRight.vue → VPIconArrowRight.vue} +0 -0
- package/dist/client/theme-default/components/icons/VPIconChevronDown.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronLeft.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronRight.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconChevronUp.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconDiscord.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconEdit.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconExternalLink.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconFacebook.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconGitHub.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconHeart.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconInstagram.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconLanguages.vue +9 -0
- package/dist/client/theme-default/components/icons/VPIconLinkedIn.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoon.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMoreHorizontal.vue +7 -0
- package/dist/client/theme-default/components/icons/VPIconPlus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSlack.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconSun.vue +13 -0
- package/dist/client/theme-default/components/icons/VPIconTwitter.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconYouTube.vue +5 -0
- package/dist/client/theme-default/composables/edit-link.js +22 -0
- package/dist/client/theme-default/composables/flyout.js +40 -0
- package/dist/client/theme-default/composables/nav.js +27 -1
- package/dist/client/theme-default/composables/outline.js +112 -0
- package/dist/client/theme-default/composables/prev-next.js +18 -0
- package/dist/client/theme-default/composables/sidebar.js +57 -0
- package/dist/client/theme-default/composables/sponsor-grid.js +92 -0
- package/dist/client/theme-default/composables/sponsor.js +87 -0
- package/dist/client/theme-default/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-cyrillic.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-greek.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-latin.woff2 +0 -0
- package/dist/client/theme-default/fonts/inter-vietnamese.woff2 +0 -0
- package/dist/client/theme-default/index.js +8 -4
- package/dist/client/theme-default/styles/base.css +203 -0
- package/dist/client/theme-default/styles/fonts.css +67 -0
- package/dist/client/theme-default/styles/utils.css +9 -0
- package/dist/client/theme-default/styles/vars.css +291 -66
- package/dist/client/theme-default/styles/vp-doc.css +425 -0
- package/dist/client/theme-default/styles/vp-sponsor.css +86 -0
- package/dist/client/theme-default/support/sidebar.js +29 -0
- package/dist/client/theme-default/support/utils.js +62 -0
- package/dist/node/alias.js +60 -0
- package/dist/node/alias.js.map +1 -0
- package/dist/node/build/build.js +57 -0
- package/dist/node/build/build.js.map +1 -0
- package/dist/node/build/buildMPAClient.js +44 -0
- package/dist/node/build/buildMPAClient.js.map +1 -0
- package/dist/node/build/bundle.js +163 -0
- package/dist/node/build/bundle.js.map +1 -0
- package/dist/node/build/render.js +185 -0
- package/dist/node/build/render.js.map +1 -0
- package/dist/node/cli.js +37 -294
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config.js +176 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/index.d.ts +122 -79
- package/dist/node/index.js +22 -37
- package/dist/node/index.js.map +1 -0
- package/dist/node/markdown/markdown.js +75 -0
- package/dist/node/markdown/markdown.js.map +1 -0
- package/dist/node/markdown/plugins/component.js +86 -0
- package/dist/node/markdown/plugins/component.js.map +1 -0
- package/dist/node/markdown/plugins/containers.js +41 -0
- package/dist/node/markdown/plugins/containers.js.map +1 -0
- package/dist/node/markdown/plugins/headings.js +25 -0
- package/dist/node/markdown/plugins/headings.js.map +1 -0
- package/dist/node/markdown/plugins/highlight.js +53 -0
- package/dist/node/markdown/plugins/highlight.js.map +1 -0
- package/dist/node/markdown/plugins/highlightLines.js +48 -0
- package/dist/node/markdown/plugins/highlightLines.js.map +1 -0
- package/dist/node/markdown/plugins/hoist.js +22 -0
- package/dist/node/markdown/plugins/hoist.js.map +1 -0
- package/dist/node/markdown/plugins/image.js +17 -0
- package/dist/node/markdown/plugins/image.js.map +1 -0
- package/dist/node/markdown/plugins/lineNumbers.js +23 -0
- package/dist/node/markdown/plugins/lineNumbers.js.map +1 -0
- package/dist/node/markdown/plugins/link.js +85 -0
- package/dist/node/markdown/plugins/link.js.map +1 -0
- package/dist/node/markdown/plugins/preWrapper.js +22 -0
- package/dist/node/markdown/plugins/preWrapper.js.map +1 -0
- package/dist/node/markdown/plugins/slugify.js +26 -0
- package/dist/node/markdown/plugins/slugify.js.map +1 -0
- package/dist/node/markdown/plugins/snippet.js +146 -0
- package/dist/node/markdown/plugins/snippet.js.map +1 -0
- package/dist/node/markdownToVue.js +166 -0
- package/dist/node/markdownToVue.js.map +1 -0
- package/dist/node/plugin.js +227 -0
- package/dist/node/plugin.js.map +1 -0
- package/dist/node/serve/serve.js +59 -0
- package/dist/node/serve/serve.js.map +1 -0
- package/dist/node/{serve-777539c0.js → serve-b5dc02b2.js} +27 -2
- package/dist/node/server.js +18 -0
- package/dist/node/server.js.map +1 -0
- package/dist/node/shared.js +72 -0
- package/dist/node/shared.js.map +1 -0
- package/dist/node/staticDataPlugin.js +99 -0
- package/dist/node/staticDataPlugin.js.map +1 -0
- package/dist/node/utils/getGitTimestamp.js +17 -0
- package/dist/node/utils/getGitTimestamp.js.map +1 -0
- package/dist/node/utils/parseHeader.js +57 -0
- package/dist/node/utils/parseHeader.js.map +1 -0
- package/dist/node/utils/slash.js +8 -0
- package/dist/node/utils/slash.js.map +1 -0
- package/package.json +31 -25
- package/types/default-theme.d.ts +115 -78
- package/types/shared.d.ts +11 -6
- package/dist/client/theme-default/components/AlgoliaSearchBox.vue +0 -188
- package/dist/client/theme-default/components/BuySellAds.vue +0 -152
- package/dist/client/theme-default/components/CarbonAds.vue +0 -99
- package/dist/client/theme-default/components/EditLink.vue +0 -38
- package/dist/client/theme-default/components/Home.vue +0 -31
- package/dist/client/theme-default/components/HomeFeatures.vue +0 -143
- package/dist/client/theme-default/components/HomeFooter.vue +0 -50
- package/dist/client/theme-default/components/HomeHero.vue +0 -161
- package/dist/client/theme-default/components/LastUpdated.vue +0 -60
- package/dist/client/theme-default/components/NavBar.vue +0 -60
- package/dist/client/theme-default/components/NavBarTitle.vue +0 -41
- package/dist/client/theme-default/components/NavDropdownLink.vue +0 -135
- package/dist/client/theme-default/components/NavDropdownLinkItem.vue +0 -76
- package/dist/client/theme-default/components/NavLink.vue +0 -61
- package/dist/client/theme-default/components/NavLinks.vue +0 -52
- package/dist/client/theme-default/components/NextAndPrevLinks.vue +0 -88
- package/dist/client/theme-default/components/Page.vue +0 -53
- package/dist/client/theme-default/components/PageFooter.vue +0 -44
- package/dist/client/theme-default/components/SideBar.vue +0 -60
- package/dist/client/theme-default/components/SideBarLink.js +0 -68
- package/dist/client/theme-default/components/SideBarLinks.vue +0 -12
- package/dist/client/theme-default/components/ToggleSideBarButton.vue +0 -46
- package/dist/client/theme-default/components/icons/OutboundLink.vue +0 -31
- package/dist/client/theme-default/composables/activeSidebarLink.js +0 -99
- package/dist/client/theme-default/composables/editLink.js +0 -49
- package/dist/client/theme-default/composables/navLink.js +0 -42
- package/dist/client/theme-default/composables/nextAndPrevLinks.js +0 -37
- package/dist/client/theme-default/composables/repo.js +0 -38
- package/dist/client/theme-default/composables/sideBar.js +0 -57
- package/dist/client/theme-default/styles/code.css +0 -299
- package/dist/client/theme-default/styles/custom-blocks.css +0 -76
- package/dist/client/theme-default/styles/layout.css +0 -236
- package/dist/client/theme-default/styles/sidebar-links.css +0 -107
- package/dist/client/theme-default/support/sideBar.js +0 -46
- package/dist/client/theme-default/utils.js +0 -63
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M20.222 0c1.406 0 2.54 1.137 2.607 2.475V24l-2.677-2.273-1.47-1.338-1.604-1.398.67 2.205H3.71c-1.402 0-2.54-1.065-2.54-2.476V2.48C1.17 1.142 2.31.003 3.715.003h16.5L20.222 0zm-6.118 5.683h-.03l-.202.2c2.073.6 3.076 1.537 3.076 1.537-1.336-.668-2.54-1.002-3.744-1.137-.87-.135-1.74-.064-2.475 0h-.2c-.47 0-1.47.2-2.81.735-.467.203-.735.336-.735.336s1.002-1.002 3.21-1.537l-.135-.135s-1.672-.064-3.477 1.27c0 0-1.805 3.144-1.805 7.02 0 0 1 1.74 3.743 1.806 0 0 .4-.533.805-1.002-1.54-.468-2.14-1.404-2.14-1.404s.134.066.335.2h.06c.03 0 .044.015.06.03v.006c.016.016.03.03.06.03.33.136.66.27.93.4.466.202 1.065.403 1.8.536.93.135 1.996.2 3.21 0 .6-.135 1.2-.267 1.8-.535.39-.2.87-.4 1.397-.737 0 0-.6.936-2.205 1.404.33.466.795 1 .795 1 2.744-.06 3.81-1.8 3.87-1.726 0-3.87-1.815-7.02-1.815-7.02-1.635-1.214-3.165-1.26-3.435-1.26l.056-.02zm.168 4.413c.703 0 1.27.6 1.27 1.335 0 .74-.57 1.34-1.27 1.34-.7 0-1.27-.6-1.27-1.334.002-.74.573-1.338 1.27-1.338zm-4.543 0c.7 0 1.266.6 1.266 1.335 0 .74-.57 1.34-1.27 1.34-.7 0-1.27-.6-1.27-1.334 0-.74.57-1.338 1.27-1.338z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M18,23H4c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h7c0.6,0,1,0.4,1,1s-0.4,1-1,1H4C3.4,5,3,5.4,3,6v14c0,0.6,0.4,1,1,1h14c0.6,0,1-0.4,1-1v-7c0-0.6,0.4-1,1-1s1,0.4,1,1v7C21,21.7,19.7,23,18,23z" />
|
|
4
|
+
<path d="M8,17c-0.3,0-0.5-0.1-0.7-0.3C7,16.5,6.9,16.1,7,15.8l1-4c0-0.2,0.1-0.3,0.3-0.5l9.5-9.5c1.2-1.2,3.2-1.2,4.4,0c1.2,1.2,1.2,3.2,0,4.4l-9.5,9.5c-0.1,0.1-0.3,0.2-0.5,0.3l-4,1C8.2,17,8.1,17,8,17zM9.9,12.5l-0.5,2.1l2.1-0.5l9.3-9.3c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.2-0.4-1.6,0l0,0L9.9,12.5z M18.5,2.5L18.5,2.5L18.5,2.5z" />
|
|
5
|
+
</svg>
|
|
6
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
focusable="false"
|
|
6
|
+
height="24px"
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
width="24px"
|
|
9
|
+
>
|
|
10
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
11
|
+
<path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z" />
|
|
12
|
+
</svg>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M12,22.2c-0.3,0-0.5-0.1-0.7-0.3l-8.8-8.8c-2.5-2.5-2.5-6.7,0-9.2c2.5-2.5,6.7-2.5,9.2,0L12,4.3l0.4-0.4c0,0,0,0,0,0C13.6,2.7,15.2,2,16.9,2c0,0,0,0,0,0c1.7,0,3.4,0.7,4.6,1.9l0,0c1.2,1.2,1.9,2.9,1.9,4.6c0,1.7-0.7,3.4-1.9,4.6l-8.8,8.8C12.5,22.1,12.3,22.2,12,22.2zM7,4C5.9,4,4.7,4.4,3.9,5.3c-1.8,1.8-1.8,4.6,0,6.4l8.1,8.1l8.1-8.1c0.9-0.9,1.3-2,1.3-3.2c0-1.2-0.5-2.3-1.3-3.2l0,0C19.3,4.5,18.2,4,17,4c0,0,0,0,0,0c-1.2,0-2.3,0.5-3.2,1.3c0,0,0,0,0,0l-1.1,1.1c-0.4,0.4-1,0.4-1.4,0l-1.1-1.1C9.4,4.4,8.2,4,7,4z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M0 0h24v24H0z" fill="none"></path>
|
|
4
|
+
<path
|
|
5
|
+
d=" M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z "
|
|
6
|
+
class="css-c4d79v"
|
|
7
|
+
></path>
|
|
8
|
+
</svg>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M18.9,10.9h-6v-6c0-0.6-0.4-1-1-1s-1,0.4-1,1v6h-6c-0.6,0-1,0.4-1,1s0.4,1,1,1h6v6c0,0.6,0.4,1,1,1s1-0.4,1-1v-6h6c0.6,0,1-0.4,1-1S19.5,10.9,18.9,10.9z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z" />
|
|
4
|
+
<path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z" />
|
|
5
|
+
<path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z" />
|
|
6
|
+
<path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z" />
|
|
7
|
+
<path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z" />
|
|
8
|
+
<path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z" />
|
|
9
|
+
<path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z" />
|
|
10
|
+
<path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z" />
|
|
11
|
+
<path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z" />
|
|
12
|
+
</svg>
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24">
|
|
3
|
+
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
|
|
4
|
+
</svg>
|
|
5
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useData } from 'vitepress';
|
|
3
|
+
export function useEditLink() {
|
|
4
|
+
const { theme, page } = useData();
|
|
5
|
+
return computed(() => {
|
|
6
|
+
const url = [
|
|
7
|
+
'https://github.com',
|
|
8
|
+
theme.value.editLink?.repo || '???',
|
|
9
|
+
'edit',
|
|
10
|
+
theme.value.editLink?.branch || 'main',
|
|
11
|
+
theme.value.editLink?.dir || null,
|
|
12
|
+
page.value.relativePath
|
|
13
|
+
]
|
|
14
|
+
.filter((v) => v)
|
|
15
|
+
.join('/');
|
|
16
|
+
const text = theme.value.editLink?.text ?? 'Edit this page';
|
|
17
|
+
return {
|
|
18
|
+
url,
|
|
19
|
+
text
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ref, watch, readonly, onUnmounted } from 'vue';
|
|
2
|
+
export const focusedElement = ref();
|
|
3
|
+
let active = false;
|
|
4
|
+
let listeners = 0;
|
|
5
|
+
export function useFlyout(options) {
|
|
6
|
+
const focus = ref(false);
|
|
7
|
+
if (typeof window !== 'undefined') {
|
|
8
|
+
!active && activateFocusTracking();
|
|
9
|
+
listeners++;
|
|
10
|
+
const unwatch = watch(focusedElement, (el) => {
|
|
11
|
+
if (el === options.el.value || options.el.value?.contains(el)) {
|
|
12
|
+
focus.value = true;
|
|
13
|
+
options.onFocus?.();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
focus.value = false;
|
|
17
|
+
options.onBlur?.();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
onUnmounted(() => {
|
|
21
|
+
unwatch();
|
|
22
|
+
listeners--;
|
|
23
|
+
if (!listeners) {
|
|
24
|
+
deactivateFocusTracking();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return readonly(focus);
|
|
29
|
+
}
|
|
30
|
+
function activateFocusTracking() {
|
|
31
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
32
|
+
active = true;
|
|
33
|
+
focusedElement.value = document.activeElement;
|
|
34
|
+
}
|
|
35
|
+
function deactivateFocusTracking() {
|
|
36
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
37
|
+
}
|
|
38
|
+
function handleFocusIn() {
|
|
39
|
+
focusedElement.value = document.activeElement;
|
|
40
|
+
}
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
1
|
+
import { ref, computed } from 'vue';
|
|
2
2
|
import { useData, useRoute } from 'vitepress';
|
|
3
|
+
export function useNav() {
|
|
4
|
+
const isScreenOpen = ref(false);
|
|
5
|
+
function openScreen() {
|
|
6
|
+
isScreenOpen.value = true;
|
|
7
|
+
window.addEventListener('resize', closeScreenOnTabletWindow);
|
|
8
|
+
}
|
|
9
|
+
function closeScreen() {
|
|
10
|
+
isScreenOpen.value = false;
|
|
11
|
+
window.removeEventListener('resize', closeScreenOnTabletWindow);
|
|
12
|
+
}
|
|
13
|
+
function toggleScreen() {
|
|
14
|
+
isScreenOpen.value ? closeScreen() : openScreen();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Close screen when the user resizes the window wider than tablet size.
|
|
18
|
+
*/
|
|
19
|
+
function closeScreenOnTabletWindow() {
|
|
20
|
+
window.outerWidth >= 768 && closeScreen();
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
isScreenOpen,
|
|
24
|
+
openScreen,
|
|
25
|
+
closeScreen,
|
|
26
|
+
toggleScreen
|
|
27
|
+
};
|
|
28
|
+
}
|
|
3
29
|
export function useLanguageLinks() {
|
|
4
30
|
const { site, localePath, theme } = useData();
|
|
5
31
|
return computed(() => {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { onMounted, onUpdated, onUnmounted } from 'vue';
|
|
2
|
+
import { useMediaQuery } from '@vueuse/core';
|
|
3
|
+
import { throttleAndDebounce } from '../support/utils';
|
|
4
|
+
// magic number to avoid repeated retrieval
|
|
5
|
+
const PAGE_OFFSET = 56;
|
|
6
|
+
export function resolveHeaders(headers) {
|
|
7
|
+
return mapHeaders(groupHeaders(headers));
|
|
8
|
+
}
|
|
9
|
+
function groupHeaders(headers) {
|
|
10
|
+
headers = headers.map((h) => Object.assign({}, h));
|
|
11
|
+
let lastH2;
|
|
12
|
+
for (const h of headers) {
|
|
13
|
+
if (h.level === 2) {
|
|
14
|
+
lastH2 = h;
|
|
15
|
+
}
|
|
16
|
+
else if (lastH2 && h.level <= 3) {
|
|
17
|
+
;
|
|
18
|
+
(lastH2.children || (lastH2.children = [])).push(h);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return headers.filter((h) => h.level === 2);
|
|
22
|
+
}
|
|
23
|
+
function mapHeaders(headers) {
|
|
24
|
+
return headers.map((header) => ({
|
|
25
|
+
text: header.title,
|
|
26
|
+
link: `#${header.slug}`,
|
|
27
|
+
children: header.children ? mapHeaders(header.children) : undefined,
|
|
28
|
+
hidden: header.hidden
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
export function useActiveAnchor(container, marker) {
|
|
32
|
+
const isOutlineEnabled = useMediaQuery('(min-width: 1280px)');
|
|
33
|
+
const onScroll = throttleAndDebounce(setActiveLink, 100);
|
|
34
|
+
let prevActiveLink = null;
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
requestAnimationFrame(setActiveLink);
|
|
37
|
+
window.addEventListener('scroll', onScroll);
|
|
38
|
+
});
|
|
39
|
+
onUpdated(() => {
|
|
40
|
+
// sidebar update means a route change
|
|
41
|
+
activateLink(location.hash);
|
|
42
|
+
});
|
|
43
|
+
onUnmounted(() => {
|
|
44
|
+
window.removeEventListener('scroll', onScroll);
|
|
45
|
+
});
|
|
46
|
+
function setActiveLink() {
|
|
47
|
+
if (!isOutlineEnabled.value) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const links = [].slice.call(container.value.querySelectorAll('.outline-link'));
|
|
51
|
+
const anchors = [].slice
|
|
52
|
+
.call(document.querySelectorAll('.content .header-anchor'))
|
|
53
|
+
.filter((anchor) => {
|
|
54
|
+
return links.some((link) => {
|
|
55
|
+
return link.hash === anchor.hash && anchor.offsetParent !== null;
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
const scrollY = window.scrollY;
|
|
59
|
+
const innerHeight = window.innerHeight;
|
|
60
|
+
const offsetHeight = document.body.offsetHeight;
|
|
61
|
+
const isBottom = scrollY + innerHeight === offsetHeight;
|
|
62
|
+
// page bottom - highlight last one
|
|
63
|
+
if (anchors.length && isBottom) {
|
|
64
|
+
activateLink(anchors[anchors.length - 1].hash);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
for (let i = 0; i < anchors.length; i++) {
|
|
68
|
+
const anchor = anchors[i];
|
|
69
|
+
const nextAnchor = anchors[i + 1];
|
|
70
|
+
const [isActive, hash] = isAnchorActive(i, anchor, nextAnchor);
|
|
71
|
+
if (isActive) {
|
|
72
|
+
history.replaceState(null, document.title, hash ? hash : ' ');
|
|
73
|
+
activateLink(hash);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function activateLink(hash) {
|
|
79
|
+
if (prevActiveLink) {
|
|
80
|
+
prevActiveLink.classList.remove('active');
|
|
81
|
+
}
|
|
82
|
+
if (hash !== null) {
|
|
83
|
+
prevActiveLink = container.value.querySelector(`a[href="${decodeURIComponent(hash)}"]`);
|
|
84
|
+
}
|
|
85
|
+
const activeLink = prevActiveLink;
|
|
86
|
+
if (activeLink) {
|
|
87
|
+
activeLink.classList.add('active');
|
|
88
|
+
marker.value.style.top = activeLink.offsetTop + 33 + 'px';
|
|
89
|
+
marker.value.style.opacity = '1';
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
marker.value.style.top = '33px';
|
|
93
|
+
marker.value.style.opacity = '0';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function getAnchorTop(anchor) {
|
|
98
|
+
return anchor.parentElement.offsetTop - PAGE_OFFSET - 15;
|
|
99
|
+
}
|
|
100
|
+
function isAnchorActive(index, anchor, nextAnchor) {
|
|
101
|
+
const scrollTop = window.scrollY;
|
|
102
|
+
if (index === 0 && scrollTop === 0) {
|
|
103
|
+
return [true, null];
|
|
104
|
+
}
|
|
105
|
+
if (scrollTop < getAnchorTop(anchor)) {
|
|
106
|
+
return [false, null];
|
|
107
|
+
}
|
|
108
|
+
if (!nextAnchor || scrollTop < getAnchorTop(nextAnchor)) {
|
|
109
|
+
return [true, anchor.hash];
|
|
110
|
+
}
|
|
111
|
+
return [false, null];
|
|
112
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useData } from 'vitepress';
|
|
3
|
+
import { isActive } from '../support/utils';
|
|
4
|
+
import { getSidebar, getFlatSideBarLinks } from '../support/sidebar';
|
|
5
|
+
export function usePrevNext() {
|
|
6
|
+
const { page, theme } = useData();
|
|
7
|
+
return computed(() => {
|
|
8
|
+
const sidebar = getSidebar(theme.value.sidebar, page.value.relativePath);
|
|
9
|
+
const candidates = getFlatSideBarLinks(sidebar);
|
|
10
|
+
const index = candidates.findIndex((link) => {
|
|
11
|
+
return isActive(page.value.relativePath, link.link);
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
prev: candidates[index - 1],
|
|
15
|
+
next: candidates[index + 1]
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ref, computed, watchEffect, onMounted, onUnmounted } from 'vue';
|
|
2
|
+
import { useRoute, useData } from 'vitepress';
|
|
3
|
+
import { getSidebar } from '../support/sidebar';
|
|
4
|
+
export function useSidebar() {
|
|
5
|
+
const route = useRoute();
|
|
6
|
+
const { theme, frontmatter } = useData();
|
|
7
|
+
const isOpen = ref(false);
|
|
8
|
+
const sidebar = computed(() => {
|
|
9
|
+
const sidebarConfig = theme.value.sidebar;
|
|
10
|
+
const relativePath = route.data.relativePath;
|
|
11
|
+
return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [];
|
|
12
|
+
});
|
|
13
|
+
const hasSidebar = computed(() => {
|
|
14
|
+
return frontmatter.value.sidebar !== false && sidebar.value.length > 0;
|
|
15
|
+
});
|
|
16
|
+
function open() {
|
|
17
|
+
isOpen.value = true;
|
|
18
|
+
}
|
|
19
|
+
function close() {
|
|
20
|
+
isOpen.value = false;
|
|
21
|
+
}
|
|
22
|
+
function toggle() {
|
|
23
|
+
isOpen.value ? close() : open();
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
isOpen,
|
|
27
|
+
sidebar,
|
|
28
|
+
hasSidebar,
|
|
29
|
+
open,
|
|
30
|
+
close,
|
|
31
|
+
toggle
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* a11y: cache the element that opened the Sidebar (the menu button) then
|
|
36
|
+
* focus that button again when Menu is closed with Escape key.
|
|
37
|
+
*/
|
|
38
|
+
export function useCloseSidebarOnEscape(isOpen, close) {
|
|
39
|
+
let triggerElement;
|
|
40
|
+
watchEffect(() => {
|
|
41
|
+
triggerElement = isOpen.value
|
|
42
|
+
? document.activeElement
|
|
43
|
+
: undefined;
|
|
44
|
+
});
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
window.addEventListener('keyup', onEscape);
|
|
47
|
+
});
|
|
48
|
+
onUnmounted(() => {
|
|
49
|
+
window.removeEventListener('keyup', onEscape);
|
|
50
|
+
});
|
|
51
|
+
function onEscape(e) {
|
|
52
|
+
if (e.key === 'Escape' && isOpen.value) {
|
|
53
|
+
close();
|
|
54
|
+
triggerElement?.focus();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
2
|
+
import { throttleAndDebounce } from '../support/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Defines grid configuration for each sponsor size in touple.
|
|
5
|
+
*
|
|
6
|
+
* [Screen widh, Column size]
|
|
7
|
+
*
|
|
8
|
+
* It sets grid size on matching screen size. For example, `[768, 5]` will set
|
|
9
|
+
* 5 columns when screen size is bigger or equal to 768px.
|
|
10
|
+
*
|
|
11
|
+
* Column will set only when item size is bigger than the column size. For
|
|
12
|
+
* example, even we want 5 columns, if we only have 1 sponsor yet, we would
|
|
13
|
+
* like to show it in 1 column.
|
|
14
|
+
*/
|
|
15
|
+
const GridSettings = {
|
|
16
|
+
small: [
|
|
17
|
+
[920, 6],
|
|
18
|
+
[768, 5],
|
|
19
|
+
[640, 4],
|
|
20
|
+
[480, 3],
|
|
21
|
+
[0, 2]
|
|
22
|
+
],
|
|
23
|
+
medium: [
|
|
24
|
+
[960, 5],
|
|
25
|
+
[832, 4],
|
|
26
|
+
[640, 3],
|
|
27
|
+
[480, 2]
|
|
28
|
+
],
|
|
29
|
+
big: [
|
|
30
|
+
[832, 3],
|
|
31
|
+
[640, 2]
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
export function useSponsorsGrid(options) {
|
|
35
|
+
const onResize = throttleAndDebounce(manage, 100);
|
|
36
|
+
onMounted(() => {
|
|
37
|
+
manage();
|
|
38
|
+
window.addEventListener('resize', onResize);
|
|
39
|
+
});
|
|
40
|
+
onUnmounted(() => {
|
|
41
|
+
window.removeEventListener('resize', onResize);
|
|
42
|
+
});
|
|
43
|
+
function manage() {
|
|
44
|
+
adjustSlots(options.el.value, options.size);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function adjustSlots(el, size) {
|
|
48
|
+
const tsize = el.children.length;
|
|
49
|
+
const asize = el.querySelectorAll('.vp-sponsor-grid-item:not(.empty)').length;
|
|
50
|
+
const grid = setGrid(el, size, asize);
|
|
51
|
+
manageSlots(el, grid, tsize, asize);
|
|
52
|
+
}
|
|
53
|
+
function setGrid(el, size, items) {
|
|
54
|
+
const settings = GridSettings[size];
|
|
55
|
+
const screen = window.innerWidth;
|
|
56
|
+
let grid = 1;
|
|
57
|
+
settings.some(([breakpoint, value]) => {
|
|
58
|
+
if (screen >= breakpoint) {
|
|
59
|
+
grid = items < value ? items : value;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
setGridData(el, grid);
|
|
64
|
+
return grid;
|
|
65
|
+
}
|
|
66
|
+
function setGridData(el, value) {
|
|
67
|
+
el.dataset.vpGrid = String(value);
|
|
68
|
+
}
|
|
69
|
+
function manageSlots(el, grid, tsize, asize) {
|
|
70
|
+
const diff = tsize - asize;
|
|
71
|
+
const rem = asize % grid;
|
|
72
|
+
const drem = rem === 0 ? rem : grid - rem;
|
|
73
|
+
neutralizeSlots(el, drem - diff);
|
|
74
|
+
}
|
|
75
|
+
function neutralizeSlots(el, count) {
|
|
76
|
+
if (count === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
count > 0 ? addSlots(el, count) : removeSlots(el, count * -1);
|
|
80
|
+
}
|
|
81
|
+
function addSlots(el, count) {
|
|
82
|
+
for (let i = 0; i < count; i++) {
|
|
83
|
+
const slot = document.createElement('div');
|
|
84
|
+
slot.classList.add('vp-sponsor-grid-item', 'empty');
|
|
85
|
+
el.append(slot);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function removeSlots(el, count) {
|
|
89
|
+
for (let i = 0; i < count; i++) {
|
|
90
|
+
el.removeChild(el.lastElementChild);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
2
|
+
import { throttleAndDebounce } from '../support/utils';
|
|
3
|
+
const GridSettings = {
|
|
4
|
+
small: [
|
|
5
|
+
[920, 6, 2],
|
|
6
|
+
[768, 5, 2],
|
|
7
|
+
[640, 4, 2],
|
|
8
|
+
[480, 3, 2],
|
|
9
|
+
[0, 2, 2]
|
|
10
|
+
],
|
|
11
|
+
medium: [
|
|
12
|
+
[832, 4, 3],
|
|
13
|
+
[640, 3, 3],
|
|
14
|
+
[480, 2, 2]
|
|
15
|
+
],
|
|
16
|
+
big: [
|
|
17
|
+
[832, 3, 3],
|
|
18
|
+
[640, 2, 2]
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
export function useSponsorsGrid(options) {
|
|
22
|
+
const onResize = throttleAndDebounce(manage, 100);
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
manage();
|
|
25
|
+
window.addEventListener('resize', onResize);
|
|
26
|
+
});
|
|
27
|
+
onUnmounted(() => {
|
|
28
|
+
window.removeEventListener('resize', onResize);
|
|
29
|
+
});
|
|
30
|
+
function manage() {
|
|
31
|
+
adjustSlots(options.el.value, options.size);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function adjustSlots(el, size) {
|
|
35
|
+
const tsize = el.children.length;
|
|
36
|
+
const asize = el.querySelectorAll('.vp-sponsor-grid-item:not(.empty)').length;
|
|
37
|
+
const grid = setGrid(el, size, asize);
|
|
38
|
+
manageSlots(el, grid, tsize, asize);
|
|
39
|
+
}
|
|
40
|
+
function setGrid(el, size, items) {
|
|
41
|
+
const settings = GridSettings[size];
|
|
42
|
+
const screen = window.innerWidth;
|
|
43
|
+
let grid = 1;
|
|
44
|
+
const match = settings.some(([breakpoint, value, min]) => {
|
|
45
|
+
if (screen < breakpoint) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if (items < min) {
|
|
49
|
+
setGridData(el, items);
|
|
50
|
+
grid = items;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setGridData(el, value);
|
|
54
|
+
grid = value;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
match || setGridData(el, 1);
|
|
59
|
+
return grid;
|
|
60
|
+
}
|
|
61
|
+
function setGridData(el, value) {
|
|
62
|
+
el.dataset.vpGrid = String(value);
|
|
63
|
+
}
|
|
64
|
+
function manageSlots(el, grid, tsize, asize) {
|
|
65
|
+
const diff = tsize - asize;
|
|
66
|
+
const rem = asize % grid;
|
|
67
|
+
const drem = rem === 0 ? rem : grid - rem;
|
|
68
|
+
neutralizeSlots(el, drem - diff);
|
|
69
|
+
}
|
|
70
|
+
function neutralizeSlots(el, count) {
|
|
71
|
+
if (count === 0) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
count > 0 ? addSlots(el, count) : removeSlots(el, count * -1);
|
|
75
|
+
}
|
|
76
|
+
function addSlots(el, count) {
|
|
77
|
+
for (let i = 0; i < count; i++) {
|
|
78
|
+
const slot = document.createElement('div');
|
|
79
|
+
slot.classList.add('vp-sponsor-grid-item', 'empty');
|
|
80
|
+
el.append(slot);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function removeSlots(el, count) {
|
|
84
|
+
for (let i = 0; i < count; i++) {
|
|
85
|
+
el.removeChild(el.lastElementChild);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import './styles/fonts.css';
|
|
1
2
|
import './styles/vars.css';
|
|
2
|
-
import './styles/
|
|
3
|
-
import './styles/
|
|
4
|
-
import './styles/
|
|
5
|
-
import './styles/
|
|
3
|
+
import './styles/base.css';
|
|
4
|
+
import './styles/utils.css';
|
|
5
|
+
import './styles/vp-doc.css';
|
|
6
|
+
import './styles/vp-sponsor.css';
|
|
6
7
|
import Layout from './Layout.vue';
|
|
7
8
|
import NotFound from './NotFound.vue';
|
|
9
|
+
export { default as VPHomeHero } from './components/VPHomeHero.vue';
|
|
10
|
+
export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue';
|
|
11
|
+
export { default as VPHomeSponsors } from './components/VPHomeSponsors.vue';
|
|
8
12
|
const theme = {
|
|
9
13
|
Layout,
|
|
10
14
|
NotFound
|