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
package/client.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// re-export vite client types
|
|
2
|
-
//
|
|
3
|
-
// in project root
|
|
1
|
+
// re-export vite client types. with strict installers like pnpm, user won't
|
|
2
|
+
// be able to reference vite/client in project root.
|
|
4
3
|
/// <reference types="vite/client" />
|
package/dist/client/app/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createApp as createClientApp, createSSRApp, defineAsyncComponent, h, onMounted, watch } from 'vue';
|
|
2
|
+
import Theme from '/@theme/index';
|
|
2
3
|
import { inBrowser, pathToFile } from './utils';
|
|
3
4
|
import { RouterSymbol, createRouter } from './router';
|
|
4
5
|
import { siteDataRef, useData } from './data';
|
|
5
6
|
import { useUpdateHead } from './composables/head';
|
|
6
|
-
import Theme from '/@theme/index';
|
|
7
7
|
import { usePrefetch } from './composables/preFetch';
|
|
8
8
|
import { dataSymbol, initData } from './data';
|
|
9
9
|
import { Content } from './components/Content';
|
|
@@ -33,10 +33,6 @@ export function createApp() {
|
|
|
33
33
|
app.provide(RouterSymbol, router);
|
|
34
34
|
const data = initData(router.route);
|
|
35
35
|
app.provide(dataSymbol, data);
|
|
36
|
-
if (inBrowser) {
|
|
37
|
-
// dynamically update head tags
|
|
38
|
-
useUpdateHead(router.route, data.site);
|
|
39
|
-
}
|
|
40
36
|
// install global components
|
|
41
37
|
app.component('Content', Content);
|
|
42
38
|
app.component('ClientOnly', ClientOnly);
|
|
@@ -56,7 +52,7 @@ export function createApp() {
|
|
|
56
52
|
siteData: siteDataRef
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
|
-
return { app, router };
|
|
55
|
+
return { app, router, data };
|
|
60
56
|
}
|
|
61
57
|
function newApp() {
|
|
62
58
|
return import.meta.env.PROD
|
|
@@ -104,9 +100,11 @@ function shouldHotReload(payload) {
|
|
|
104
100
|
return payloadPath === locationPath;
|
|
105
101
|
}
|
|
106
102
|
if (inBrowser) {
|
|
107
|
-
const { app, router } = createApp();
|
|
103
|
+
const { app, router, data } = createApp();
|
|
108
104
|
// wait until page component is fetched before mounting
|
|
109
105
|
router.go().then(() => {
|
|
106
|
+
// dynamically update head tags
|
|
107
|
+
useUpdateHead(router.route, data.site);
|
|
110
108
|
app.mount('#app');
|
|
111
109
|
});
|
|
112
110
|
}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -68,17 +68,22 @@ export declare interface Router {
|
|
|
68
68
|
|
|
69
69
|
export declare interface SiteData<ThemeConfig = any> {
|
|
70
70
|
base: string
|
|
71
|
+
|
|
71
72
|
/**
|
|
72
73
|
* Language of the site as it should be set on the `html` element.
|
|
74
|
+
*
|
|
73
75
|
* @example `en-US`, `zh-CN`
|
|
74
76
|
*/
|
|
75
77
|
lang: string
|
|
78
|
+
|
|
76
79
|
title: string
|
|
77
80
|
description: string
|
|
78
81
|
head: HeadConfig[]
|
|
82
|
+
appearance: boolean
|
|
79
83
|
themeConfig: ThemeConfig
|
|
80
84
|
scrollOffset: number | string
|
|
81
85
|
locales: Record<string, LocaleConfig>
|
|
86
|
+
|
|
82
87
|
/**
|
|
83
88
|
* Available locales for the site when it has defined `locales` in its
|
|
84
89
|
* `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
|
package/dist/client/shared.js
CHANGED
|
@@ -1,189 +1,48 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
? defineAsyncComponent(() => import('./components/AlgoliaSearchBox.vue'))
|
|
22
|
-
: NoopComponent
|
|
23
|
-
|
|
24
|
-
// generic state
|
|
25
|
-
const route = useRoute()
|
|
26
|
-
const { site, page, theme, frontmatter } = useData()
|
|
27
|
-
|
|
28
|
-
// custom layout
|
|
29
|
-
const isCustomLayout = computed(() => !!frontmatter.value.customLayout)
|
|
30
|
-
// home
|
|
31
|
-
const enableHome = computed(() => !!frontmatter.value.home)
|
|
32
|
-
|
|
33
|
-
// automatic multilang check for AlgoliaSearchBox
|
|
34
|
-
const isMultiLang = computed(() => Object.keys(site.value.langs).length > 1)
|
|
35
|
-
|
|
36
|
-
// navbar
|
|
37
|
-
const showNavbar = computed(() => {
|
|
38
|
-
const themeConfig = theme.value
|
|
39
|
-
if (frontmatter.value.navbar === false || themeConfig.navbar === false) {
|
|
40
|
-
return false
|
|
41
|
-
}
|
|
42
|
-
return (
|
|
43
|
-
site.value.title || themeConfig.logo || themeConfig.repo || themeConfig.nav
|
|
44
|
-
)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
// sidebar
|
|
48
|
-
const openSideBar = ref(false)
|
|
49
|
-
|
|
50
|
-
const showSidebar = computed(() => {
|
|
51
|
-
if (frontmatter.value.home || frontmatter.value.sidebar === false) {
|
|
52
|
-
return false
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return !isSideBarEmpty(
|
|
56
|
-
getSideBarConfig(theme.value.sidebar, route.data.relativePath)
|
|
57
|
-
)
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const toggleSidebar = (to?: boolean) => {
|
|
61
|
-
openSideBar.value = typeof to === 'boolean' ? to : !openSideBar.value
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const hideSidebar = toggleSidebar.bind(null, false)
|
|
65
|
-
// close the sidebar when navigating to a different location
|
|
66
|
-
watch(route, hideSidebar)
|
|
67
|
-
// TODO: route only changes when the pathname changes
|
|
68
|
-
// listening to hashchange does nothing because it's prevented in router
|
|
69
|
-
|
|
70
|
-
// page classes
|
|
71
|
-
const pageClasses = computed(() => {
|
|
72
|
-
return [
|
|
73
|
-
{
|
|
74
|
-
'no-navbar': !showNavbar.value,
|
|
75
|
-
'sidebar-open': openSideBar.value,
|
|
76
|
-
'no-sidebar': !showSidebar.value
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
})
|
|
2
|
+
import { provide } from 'vue'
|
|
3
|
+
import { useSidebar, useCloseSidebarOnEscape } from './composables/sidebar'
|
|
4
|
+
import VPSkipLink from './components/VPSkipLink.vue'
|
|
5
|
+
import VPBackdrop from './components/VPBackdrop.vue'
|
|
6
|
+
import VPNav from './components/VPNav.vue'
|
|
7
|
+
import VPLocalNav from './components/VPLocalNav.vue'
|
|
8
|
+
import VPSidebar from './components/VPSidebar.vue'
|
|
9
|
+
import VPContent from './components/VPContent.vue'
|
|
10
|
+
import VPFooter from './components/VPFooter.vue'
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
isOpen: isSidebarOpen,
|
|
14
|
+
open: openSidebar,
|
|
15
|
+
close: closeSidebar
|
|
16
|
+
} = useSidebar()
|
|
17
|
+
|
|
18
|
+
useCloseSidebarOnEscape(isSidebarOpen, closeSidebar)
|
|
19
|
+
|
|
20
|
+
provide('close-sidebar', closeSidebar)
|
|
80
21
|
</script>
|
|
81
22
|
|
|
82
23
|
<template>
|
|
83
|
-
<div class="
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<slot name="sidebar-top" />
|
|
99
|
-
</template>
|
|
100
|
-
<template #sidebar-bottom>
|
|
101
|
-
<slot name="sidebar-bottom" />
|
|
102
|
-
</template>
|
|
103
|
-
</SideBar>
|
|
104
|
-
<!-- TODO: make this button accessible -->
|
|
105
|
-
<div class="sidebar-mask" @click="toggleSidebar(false)" />
|
|
106
|
-
|
|
107
|
-
<Content v-if="isCustomLayout" />
|
|
108
|
-
|
|
109
|
-
<template v-else-if="enableHome">
|
|
110
|
-
<!-- A slot for customizing the entire homepage easily -->
|
|
111
|
-
<slot name="home">
|
|
112
|
-
<Home>
|
|
113
|
-
<template #hero>
|
|
114
|
-
<slot name="home-hero" />
|
|
115
|
-
</template>
|
|
116
|
-
<template #features>
|
|
117
|
-
<slot name="home-features" />
|
|
118
|
-
</template>
|
|
119
|
-
<template #footer>
|
|
120
|
-
<slot name="home-footer" />
|
|
121
|
-
</template>
|
|
122
|
-
</Home>
|
|
123
|
-
</slot>
|
|
124
|
-
</template>
|
|
125
|
-
|
|
126
|
-
<Page v-else>
|
|
127
|
-
<template #top>
|
|
128
|
-
<slot name="page-top-ads">
|
|
129
|
-
<div
|
|
130
|
-
id="ads-container"
|
|
131
|
-
v-if="theme.carbonAds && theme.carbonAds.carbon"
|
|
132
|
-
>
|
|
133
|
-
<CarbonAds
|
|
134
|
-
:key="'carbon' + page.relativePath"
|
|
135
|
-
:code="theme.carbonAds.carbon"
|
|
136
|
-
:placement="theme.carbonAds.placement"
|
|
137
|
-
/>
|
|
138
|
-
</div>
|
|
139
|
-
</slot>
|
|
140
|
-
<slot name="page-top" />
|
|
141
|
-
</template>
|
|
142
|
-
<template #bottom>
|
|
143
|
-
<slot name="page-bottom" />
|
|
144
|
-
<slot name="page-bottom-ads">
|
|
145
|
-
<BuySellAds
|
|
146
|
-
v-if="theme.carbonAds && theme.carbonAds.custom"
|
|
147
|
-
:key="'custom' + page.relativePath"
|
|
148
|
-
:code="theme.carbonAds.custom"
|
|
149
|
-
:placement="theme.carbonAds.placement"
|
|
150
|
-
/>
|
|
151
|
-
</slot>
|
|
152
|
-
</template>
|
|
153
|
-
</Page>
|
|
24
|
+
<div class="Layout">
|
|
25
|
+
<VPSkipLink />
|
|
26
|
+
<VPBackdrop class="backdrop" :show="isSidebarOpen" @click="closeSidebar" />
|
|
27
|
+
<VPNav />
|
|
28
|
+
<VPLocalNav :open="isSidebarOpen" @open-menu="openSidebar" />
|
|
29
|
+
<VPSidebar :open="isSidebarOpen" />
|
|
30
|
+
|
|
31
|
+
<VPContent>
|
|
32
|
+
<template #home-hero-before><slot name="home-hero-before" /></template>
|
|
33
|
+
<template #home-hero-after><slot name="home-hero-after" /></template>
|
|
34
|
+
<template #home-features-before><slot name="home-features-before" /></template>
|
|
35
|
+
<template #home-features-after><slot name="home-features-after" /></template>
|
|
36
|
+
</VPContent>
|
|
37
|
+
|
|
38
|
+
<VPFooter />
|
|
154
39
|
</div>
|
|
155
|
-
|
|
156
|
-
<Debug />
|
|
157
40
|
</template>
|
|
158
41
|
|
|
159
|
-
<style>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
@media (min-width: 420px) {
|
|
165
|
-
#ads-container {
|
|
166
|
-
position: relative;
|
|
167
|
-
right: 0;
|
|
168
|
-
float: right;
|
|
169
|
-
margin: -8px -8px 24px 24px;
|
|
170
|
-
width: 146px;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@media (max-width: 420px) {
|
|
175
|
-
#ads-container {
|
|
176
|
-
/* Avoid layout shift */
|
|
177
|
-
height: 105px;
|
|
178
|
-
margin: 1.75rem 0;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@media (min-width: 1400px) {
|
|
183
|
-
#ads-container {
|
|
184
|
-
position: fixed;
|
|
185
|
-
right: 8px;
|
|
186
|
-
bottom: 8px;
|
|
187
|
-
}
|
|
42
|
+
<style scoped>
|
|
43
|
+
.Layout {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
min-height: 100vh;
|
|
188
47
|
}
|
|
189
48
|
</style>
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="theme">
|
|
3
|
-
<h1>404</h1>
|
|
4
|
-
<blockquote>{{ getMsg() }}</blockquote>
|
|
5
|
-
<a :href="site.base" aria-label="go to home">Take me home.</a>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
1
|
<script setup lang="ts">
|
|
10
2
|
import { useData } from 'vitepress'
|
|
11
3
|
|
|
12
4
|
const { site } = useData()
|
|
5
|
+
|
|
13
6
|
const msgs = [
|
|
14
7
|
`There's nothing here.`,
|
|
15
8
|
`How did we get here?`,
|
|
@@ -21,3 +14,11 @@ function getMsg() {
|
|
|
21
14
|
return msgs[Math.floor(Math.random() * msgs.length)]
|
|
22
15
|
}
|
|
23
16
|
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="NotFound">
|
|
20
|
+
<h1>404</h1>
|
|
21
|
+
<blockquote>{{ getMsg() }}</blockquote>
|
|
22
|
+
<a :href="site.base" aria-label="go to home">Take me home.</a>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import docsearch from '@docsearch/js'
|
|
3
|
+
import { DocSearchHit } from '@docsearch/react/dist/esm/types'
|
|
4
|
+
import { onMounted } from 'vue'
|
|
5
|
+
import { useRouter, useRoute, useData } from 'vitepress'
|
|
6
|
+
import { DefaultTheme } from '../config'
|
|
7
|
+
|
|
8
|
+
const router = useRouter()
|
|
9
|
+
const route = useRoute()
|
|
10
|
+
const { theme } = useData()
|
|
11
|
+
|
|
12
|
+
onMounted(() => {
|
|
13
|
+
initialize(theme.value.algolia)
|
|
14
|
+
setTimeout(poll, 16)
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
function poll() {
|
|
18
|
+
// programmatically open the search box after initialize
|
|
19
|
+
const e = new Event('keydown') as any
|
|
20
|
+
|
|
21
|
+
e.key = 'k'
|
|
22
|
+
e.metaKey = true
|
|
23
|
+
|
|
24
|
+
window.dispatchEvent(e)
|
|
25
|
+
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
if (!document.querySelector('.DocSearch-Modal')) {
|
|
28
|
+
poll()
|
|
29
|
+
}
|
|
30
|
+
}, 16)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
|
|
34
|
+
// note: multi-lang search support is removed since the theme
|
|
35
|
+
// doesn't support multiple locales as of now.
|
|
36
|
+
const options = Object.assign({}, userOptions, {
|
|
37
|
+
container: '#docsearch',
|
|
38
|
+
|
|
39
|
+
navigator: {
|
|
40
|
+
navigate({ itemUrl }: { itemUrl: string }) {
|
|
41
|
+
const { pathname: hitPathname } = new URL(
|
|
42
|
+
window.location.origin + itemUrl
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// router doesn't handle same-page navigation so we use the native
|
|
46
|
+
// browser location API for anchor navigation
|
|
47
|
+
if (route.path === hitPathname) {
|
|
48
|
+
window.location.assign(window.location.origin + itemUrl)
|
|
49
|
+
} else {
|
|
50
|
+
router.go(itemUrl)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
transformItems(items: DocSearchHit[]) {
|
|
56
|
+
return items.map((item) => {
|
|
57
|
+
return Object.assign({}, item, {
|
|
58
|
+
url: getRelativePath(item.url)
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
hitComponent({ hit, children }: { hit: DocSearchHit, children: any }) {
|
|
64
|
+
const relativeHit = hit.url.startsWith('http')
|
|
65
|
+
? getRelativePath(hit.url as string)
|
|
66
|
+
: hit.url
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
__v: null,
|
|
70
|
+
type: 'a',
|
|
71
|
+
ref: undefined,
|
|
72
|
+
constructor: undefined,
|
|
73
|
+
key: undefined,
|
|
74
|
+
|
|
75
|
+
props: {
|
|
76
|
+
href: hit.url,
|
|
77
|
+
|
|
78
|
+
onClick(event: MouseEvent) {
|
|
79
|
+
if (isSpecialClick(event)) {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// we rely on the native link scrolling when user is already on
|
|
84
|
+
// the right anchor because Router doesn't support duplicated
|
|
85
|
+
// history entries.
|
|
86
|
+
if (route.path === relativeHit) {
|
|
87
|
+
return
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// if the hits goes to another page, we prevent the native link
|
|
91
|
+
// behavior to leverage the Router loading feature.
|
|
92
|
+
if (route.path !== relativeHit) {
|
|
93
|
+
event.preventDefault()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
router.go(relativeHit)
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
children
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
docsearch(options)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isSpecialClick(event: MouseEvent) {
|
|
109
|
+
return (
|
|
110
|
+
event.button === 1 ||
|
|
111
|
+
event.altKey ||
|
|
112
|
+
event.ctrlKey ||
|
|
113
|
+
event.metaKey ||
|
|
114
|
+
event.shiftKey
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function getRelativePath(absoluteUrl: string) {
|
|
119
|
+
const { pathname, hash } = new URL(absoluteUrl)
|
|
120
|
+
|
|
121
|
+
return pathname + hash
|
|
122
|
+
}
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<template>
|
|
126
|
+
<div id="docsearch" />
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
show: boolean
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<transition name="fade">
|
|
9
|
+
<div v-if="show" class="VPBackdrop" />
|
|
10
|
+
</transition>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style scoped>
|
|
14
|
+
.VPBackdrop {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
bottom: 0;
|
|
19
|
+
left: 0;
|
|
20
|
+
z-index: var(--vp-z-index-backdrop);
|
|
21
|
+
background: rgba(0, 0, 0, .6);
|
|
22
|
+
transition: opacity 0.5s;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.VPBackdrop.fade-enter-from,
|
|
26
|
+
.VPBackdrop.fade-leave-to {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.VPBackdrop.fade-leave-active {
|
|
31
|
+
transition-duration: .25s;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (min-width: 1280px) {
|
|
35
|
+
.VPBackdrop {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
icon?: string
|
|
4
|
+
title: string
|
|
5
|
+
details: string
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<article class="VPBox">
|
|
11
|
+
<div v-if="icon" class="icon">{{ icon }}</div>
|
|
12
|
+
<h1 class="title">{{ title }}</h1>
|
|
13
|
+
<p class="details">{{ details }}</p>
|
|
14
|
+
</article>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.VPBox {
|
|
19
|
+
border: 1px solid var(--vp-c-divider-light);
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
padding: 24px;
|
|
22
|
+
height: 100%;
|
|
23
|
+
background-color: var(--vp-c-bg-soft);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dark .VPBox {
|
|
27
|
+
background-color: var(--vp-c-bg-mute);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
margin-bottom: 20px;
|
|
35
|
+
border-radius: 6px;
|
|
36
|
+
background-color: var(--vp-c-gray-light-4);
|
|
37
|
+
width: 48px;
|
|
38
|
+
height: 48px;
|
|
39
|
+
font-size: 24px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark .icon {
|
|
43
|
+
background-color: var(--vp-c-bg-soft);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.title {
|
|
47
|
+
line-height: 24px;
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.details {
|
|
53
|
+
padding-top: 8px;
|
|
54
|
+
line-height: 24px;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
color: var(--vp-c-text-2);
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
tag?: string
|
|
6
|
+
size?: 'medium' | 'big'
|
|
7
|
+
theme?: 'brand' | 'alt' | 'sponsor'
|
|
8
|
+
text: string
|
|
9
|
+
href?: string
|
|
10
|
+
}>()
|
|
11
|
+
|
|
12
|
+
const classes = computed(() => [
|
|
13
|
+
props.size ?? 'medium',
|
|
14
|
+
props.theme ?? 'brand'
|
|
15
|
+
])
|
|
16
|
+
|
|
17
|
+
const isExternal = computed(() => props.href && /^[a-z]+:/i.test(props.href))
|
|
18
|
+
|
|
19
|
+
const component = computed(() => {
|
|
20
|
+
if (props.tag) {
|
|
21
|
+
return props.tag
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return props.href ? 'a' : 'button'
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<component
|
|
30
|
+
:is="component"
|
|
31
|
+
class="VPButton"
|
|
32
|
+
:class="classes"
|
|
33
|
+
:href="href"
|
|
34
|
+
:target="isExternal ? '_blank' : undefined"
|
|
35
|
+
:rel="isExternal ? 'noopener noreferrer' : undefined"
|
|
36
|
+
>
|
|
37
|
+
{{ text }}
|
|
38
|
+
</component>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.VPButton {
|
|
43
|
+
display: inline-block;
|
|
44
|
+
border: 1px solid transparent;
|
|
45
|
+
|
|
46
|
+
text-align: center;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
transition: color 0.25s, border-color 0.25s, background-color 0.25s;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.VPButton:active {
|
|
53
|
+
transition: color 0.1s, border-color 0.1s, background-color 0.1s;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.VPButton.medium {
|
|
57
|
+
border-radius: 20px;
|
|
58
|
+
padding: 0 20px;
|
|
59
|
+
line-height: 38px;
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.VPButton.big {
|
|
64
|
+
border-radius: 24px;
|
|
65
|
+
padding: 0 24px;
|
|
66
|
+
line-height: 46px;
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.VPButton.brand {
|
|
71
|
+
border-color: var(--vp-button-brand-border);
|
|
72
|
+
color: var(--vp-button-brand-text);
|
|
73
|
+
background-color: var(--vp-button-brand-bg);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.VPButton.brand:hover {
|
|
77
|
+
border-color: var(--vp-button-brand-hover-border);
|
|
78
|
+
color: var(--vp-button-brand-hover-text);
|
|
79
|
+
background-color: var(--vp-button-brand-hover-bg);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.VPButton.brand:active {
|
|
83
|
+
border-color: var(--vp-button-brand-active-border);
|
|
84
|
+
color: var(--vp-button-brand-active-text);
|
|
85
|
+
background-color: var(--vp-button-brand-active-bg);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.VPButton.alt {
|
|
89
|
+
border-color: var(--vp-button-alt-border);
|
|
90
|
+
color: var(--vp-button-alt-text);
|
|
91
|
+
background-color: var(--vp-button-alt-bg);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.VPButton.alt:hover {
|
|
95
|
+
border-color: var(--vp-button-alt-hover-border);
|
|
96
|
+
color: var(--vp-button-alt-hover-text);
|
|
97
|
+
background-color: var(--vp-button-alt-hover-bg);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.VPButton.alt:active {
|
|
101
|
+
border-color: var(--vp-button-alt-active-border);
|
|
102
|
+
color: var(--vp-button-alt-active-text);
|
|
103
|
+
background-color: var(--vp-button-alt-active-bg);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.VPButton.sponsor {
|
|
107
|
+
border-color: var(--vp-button-sponsor-border);
|
|
108
|
+
color: var(--vp-button-sponsor-text);
|
|
109
|
+
background-color: var(--vp-button-sponsor-bg);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.VPButton.sponsor:hover {
|
|
113
|
+
border-color: var(--vp-button-sponsor-hover-border);
|
|
114
|
+
color: var(--vp-button-sponsor-hover-text);
|
|
115
|
+
background-color: var(--vp-button-sponsor-hover-bg);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.VPButton.sponsor:active {
|
|
119
|
+
border-color: var(--vp-button-sponsor-active-border);
|
|
120
|
+
color: var(--vp-button-sponsor-active-text);
|
|
121
|
+
background-color: var(--vp-button-sponsor-active-bg);
|
|
122
|
+
}
|
|
123
|
+
</style>
|