vitepress 1.0.0-draft.2 → 1.0.0-draft.5
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 +3 -1
- package/bin/vitepress.js +1 -1
- package/dist/client/app/composables/head.js +2 -2
- package/dist/client/app/data.js +2 -4
- package/dist/client/app/index.js +1 -5
- package/dist/client/index.d.ts +123 -134
- package/dist/client/index.js +1 -2
- package/dist/client/shared.js +21 -0
- package/dist/client/theme-default/Layout.vue +7 -0
- package/dist/client/theme-default/NotFound.vue +74 -14
- package/dist/client/theme-default/components/VPBox.vue +1 -5
- package/dist/client/theme-default/components/VPCarbonAds.vue +90 -0
- package/dist/client/theme-default/components/VPContent.vue +14 -10
- package/dist/client/theme-default/components/VPDoc.vue +73 -58
- package/dist/client/theme-default/components/VPDocAside.vue +34 -0
- package/dist/client/theme-default/components/VPDocAsideCarbonAds.vue +13 -0
- package/dist/client/theme-default/components/{VPDocOutline.vue → VPDocAsideOutline.vue} +14 -3
- package/dist/client/theme-default/components/VPDocAsideSponsors.vue +32 -0
- package/dist/client/theme-default/components/VPDocFooter.vue +1 -1
- package/dist/client/theme-default/components/VPFlyout.vue +2 -3
- package/dist/client/theme-default/components/VPFooter.vue +1 -1
- package/dist/client/theme-default/components/VPHero.vue +3 -3
- package/dist/client/theme-default/components/VPHomeSponsors.vue +3 -7
- package/dist/client/theme-default/components/VPLink.vue +2 -1
- package/dist/client/theme-default/components/VPLocalNav.vue +1 -1
- package/dist/client/theme-default/components/VPMenu.vue +8 -13
- package/dist/client/theme-default/components/VPMenuLink.vue +10 -4
- package/dist/client/theme-default/components/VPNav.vue +18 -1
- package/dist/client/theme-default/components/VPNavBar.vue +20 -8
- package/dist/client/theme-default/components/VPNavBarExtra.vue +20 -41
- package/dist/client/theme-default/components/VPNavBarMenuGroup.vue +2 -8
- package/dist/client/theme-default/components/VPNavBarMenuLink.vue +3 -3
- package/dist/client/theme-default/components/VPNavBarSearch.vue +6 -6
- package/dist/client/theme-default/components/VPNavBarTitle.vue +4 -2
- package/dist/client/theme-default/components/VPNavBarTranslations.vue +10 -39
- package/dist/client/theme-default/components/VPNavScreenMenuGroup.vue +1 -2
- package/dist/client/theme-default/components/VPNavScreenMenuGroupSection.vue +1 -1
- package/dist/client/theme-default/components/VPSidebar.vue +12 -6
- package/dist/client/theme-default/components/VPSidebarGroup.vue +80 -17
- package/dist/client/theme-default/components/VPSidebarLink.vue +2 -9
- package/dist/client/theme-default/components/VPSocialLink.vue +2 -2
- package/dist/client/theme-default/components/VPSocialLinks.vue +1 -1
- package/dist/client/theme-default/components/VPSponsors.vue +15 -40
- package/dist/client/theme-default/components/VPSponsorsGrid.vue +2 -2
- package/dist/client/theme-default/components/icons/VPIconMinus.vue +5 -0
- package/dist/client/theme-default/components/icons/VPIconMinusSquare.vue +6 -0
- package/dist/client/theme-default/components/icons/VPIconPlusSquare.vue +6 -0
- package/dist/client/theme-default/composables/aside.js +17 -0
- package/dist/client/theme-default/composables/copy-code.js +33 -0
- package/dist/client/theme-default/composables/outline.js +14 -4
- package/dist/client/theme-default/composables/sponsor-grid.js +8 -6
- package/dist/client/theme-default/index.js +4 -2
- package/dist/client/theme-default/styles/base.css +9 -1
- package/dist/client/theme-default/styles/components/custom-block.css +90 -0
- package/dist/client/theme-default/styles/{vp-doc.css → components/vp-doc.css} +152 -115
- package/dist/client/theme-default/styles/{vp-sponsor.css → components/vp-sponsor.css} +51 -7
- package/dist/client/theme-default/styles/vars.css +109 -58
- package/dist/node/cli.js +295 -37
- package/dist/node/index.d.ts +371 -361
- package/dist/node/index.js +22 -22
- package/dist/node/serve-f7c10936.js +64795 -0
- package/dist/node-cjs/cli.cjs +304 -0
- package/dist/node-cjs/index.cjs +38 -0
- package/dist/{node/serve-b5dc02b2.js → node-cjs/serve-c220f0a8.cjs} +27511 -28708
- package/package.json +47 -40
- package/theme.d.ts +7 -2
- package/types/default-theme.d.ts +15 -2
- package/types/shared.d.ts +3 -0
- package/dist/client/theme-default/composables/sponsor.js +0 -87
- package/dist/node/alias.js +0 -60
- package/dist/node/alias.js.map +0 -1
- package/dist/node/build/build.js +0 -57
- package/dist/node/build/build.js.map +0 -1
- package/dist/node/build/buildMPAClient.js +0 -44
- package/dist/node/build/buildMPAClient.js.map +0 -1
- package/dist/node/build/bundle.js +0 -163
- package/dist/node/build/bundle.js.map +0 -1
- package/dist/node/build/render.js +0 -185
- package/dist/node/build/render.js.map +0 -1
- package/dist/node/cli.js.map +0 -1
- package/dist/node/config.js +0 -176
- package/dist/node/config.js.map +0 -1
- package/dist/node/index.js.map +0 -1
- package/dist/node/markdown/markdown.js +0 -75
- package/dist/node/markdown/markdown.js.map +0 -1
- package/dist/node/markdown/plugins/component.js +0 -86
- package/dist/node/markdown/plugins/component.js.map +0 -1
- package/dist/node/markdown/plugins/containers.js +0 -41
- package/dist/node/markdown/plugins/containers.js.map +0 -1
- package/dist/node/markdown/plugins/headings.js +0 -25
- package/dist/node/markdown/plugins/headings.js.map +0 -1
- package/dist/node/markdown/plugins/highlight.js +0 -53
- package/dist/node/markdown/plugins/highlight.js.map +0 -1
- package/dist/node/markdown/plugins/highlightLines.js +0 -48
- package/dist/node/markdown/plugins/highlightLines.js.map +0 -1
- package/dist/node/markdown/plugins/hoist.js +0 -22
- package/dist/node/markdown/plugins/hoist.js.map +0 -1
- package/dist/node/markdown/plugins/image.js +0 -17
- package/dist/node/markdown/plugins/image.js.map +0 -1
- package/dist/node/markdown/plugins/lineNumbers.js +0 -23
- package/dist/node/markdown/plugins/lineNumbers.js.map +0 -1
- package/dist/node/markdown/plugins/link.js +0 -85
- package/dist/node/markdown/plugins/link.js.map +0 -1
- package/dist/node/markdown/plugins/preWrapper.js +0 -22
- package/dist/node/markdown/plugins/preWrapper.js.map +0 -1
- package/dist/node/markdown/plugins/slugify.js +0 -26
- package/dist/node/markdown/plugins/slugify.js.map +0 -1
- package/dist/node/markdown/plugins/snippet.js +0 -146
- package/dist/node/markdown/plugins/snippet.js.map +0 -1
- package/dist/node/markdownToVue.js +0 -166
- package/dist/node/markdownToVue.js.map +0 -1
- package/dist/node/plugin.js +0 -227
- package/dist/node/plugin.js.map +0 -1
- package/dist/node/serve/serve.js +0 -59
- package/dist/node/serve/serve.js.map +0 -1
- package/dist/node/server.js +0 -18
- package/dist/node/server.js.map +0 -1
- package/dist/node/shared.js +0 -72
- package/dist/node/shared.js.map +0 -1
- package/dist/node/staticDataPlugin.js +0 -99
- package/dist/node/staticDataPlugin.js.map +0 -1
- package/dist/node/utils/getGitTimestamp.js +0 -17
- package/dist/node/utils/getGitTimestamp.js.map +0 -1
- package/dist/node/utils/parseHeader.js +0 -57
- package/dist/node/utils/parseHeader.js.map +0 -1
- package/dist/node/utils/slash.js +0 -8
- package/dist/node/utils/slash.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# (
|
|
1
|
+
# VitePress (alpha) 📝💨
|
|
2
2
|
|
|
3
3
|
[](https://github.com/vuejs/vitepress/actions)
|
|
4
4
|
[](https://www.npmjs.com/package/vitepress)
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
VitePress is [VuePress](https://vuepress.vuejs.org)' spiritual successor, built on top of [vite](https://github.com/vitejs/vite).
|
|
9
9
|
|
|
10
|
+
Currently, it's in the `alpha` stage. It is already suitable for out-of-the-box documentation use, but the config and theming API may still change between minor releases.
|
|
11
|
+
|
|
10
12
|
## Documentation
|
|
11
13
|
|
|
12
14
|
To check out docs, visit [vitepress.vuejs.org](https://vitepress.vuejs.org).
|
package/bin/vitepress.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import('../dist/node/cli.js')
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { watchEffect } from 'vue';
|
|
2
|
+
import { createTitle } from '../../shared';
|
|
2
3
|
export function useUpdateHead(route, siteDataByRouteRef) {
|
|
3
4
|
let managedHeadTags = [];
|
|
4
5
|
let isFirstUpdate = true;
|
|
@@ -50,11 +51,10 @@ export function useUpdateHead(route, siteDataByRouteRef) {
|
|
|
50
51
|
watchEffect(() => {
|
|
51
52
|
const pageData = route.data;
|
|
52
53
|
const siteData = siteDataByRouteRef.value;
|
|
53
|
-
const pageTitle = pageData && pageData.title;
|
|
54
54
|
const pageDescription = pageData && pageData.description;
|
|
55
55
|
const frontmatterHead = pageData && pageData.frontmatter.head;
|
|
56
56
|
// update title and description
|
|
57
|
-
document.title = (
|
|
57
|
+
document.title = createTitle(siteData, pageData);
|
|
58
58
|
document
|
|
59
59
|
.querySelector(`meta[name=description]`)
|
|
60
60
|
.setAttribute('content', pageDescription || siteData.description);
|
package/dist/client/app/data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shallowRef, readonly, computed, inject } from 'vue';
|
|
2
2
|
import serializedSiteData from '@siteData';
|
|
3
|
-
import { resolveSiteDataByRoute } from '../shared';
|
|
3
|
+
import { resolveSiteDataByRoute, createTitle } from '../shared';
|
|
4
4
|
import { withBase } from './utils';
|
|
5
5
|
export const dataSymbol = Symbol();
|
|
6
6
|
export const siteDataRef = shallowRef(parse(serializedSiteData));
|
|
@@ -29,9 +29,7 @@ export function initData(route) {
|
|
|
29
29
|
return withBase(path || '/');
|
|
30
30
|
}),
|
|
31
31
|
title: computed(() => {
|
|
32
|
-
return route.data
|
|
33
|
-
? route.data.title + ' | ' + site.value.title
|
|
34
|
-
: site.value.title;
|
|
32
|
+
return createTitle(site.value, route.data);
|
|
35
33
|
}),
|
|
36
34
|
description: computed(() => {
|
|
37
35
|
return route.data.description || site.value.description;
|
package/dist/client/app/index.js
CHANGED
|
@@ -73,14 +73,10 @@ function newRouter() {
|
|
|
73
73
|
if (isInitialPageLoad || initialPath === pageFilePath) {
|
|
74
74
|
pageFilePath = pageFilePath.replace(/\.js$/, '.lean.js');
|
|
75
75
|
}
|
|
76
|
-
// in browser: native dynamic import
|
|
77
76
|
if (inBrowser) {
|
|
78
77
|
isInitialPageLoad = false;
|
|
79
|
-
return import(/*@vite-ignore*/ pageFilePath);
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
return require(pageFilePath);
|
|
79
|
+
return import(/*@vite-ignore*/ pageFilePath);
|
|
84
80
|
}, NotFound);
|
|
85
81
|
}
|
|
86
82
|
function handleHMR(router) {
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,134 +1,123 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { App } from 'vue';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
Layout: Component;
|
|
111
|
-
NotFound?: Component;
|
|
112
|
-
enhanceApp?: (ctx: EnhanceAppContext) => void;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
theme: Ref<T>;
|
|
125
|
-
frontmatter: Ref<PageData['frontmatter']>;
|
|
126
|
-
title: Ref<string>;
|
|
127
|
-
description: Ref<string>;
|
|
128
|
-
lang: Ref<string>;
|
|
129
|
-
localePath: Ref<string>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export declare function withBase(path: string): string;
|
|
133
|
-
|
|
134
|
-
export { }
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { Component, Ref, App } from 'vue';
|
|
3
|
+
|
|
4
|
+
// types shared between server and client
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
interface PageData {
|
|
8
|
+
relativePath: string
|
|
9
|
+
title: string
|
|
10
|
+
titleTemplate?: string | boolean
|
|
11
|
+
description: string
|
|
12
|
+
headers: Header[]
|
|
13
|
+
frontmatter: Record<string, any>
|
|
14
|
+
lastUpdated?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface Header {
|
|
18
|
+
level: number
|
|
19
|
+
title: string
|
|
20
|
+
slug: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface SiteData<ThemeConfig = any> {
|
|
24
|
+
base: string
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Language of the site as it should be set on the `html` element.
|
|
28
|
+
*
|
|
29
|
+
* @example `en-US`, `zh-CN`
|
|
30
|
+
*/
|
|
31
|
+
lang: string
|
|
32
|
+
|
|
33
|
+
title: string
|
|
34
|
+
titleTemplate?: string | boolean
|
|
35
|
+
description: string
|
|
36
|
+
head: HeadConfig[]
|
|
37
|
+
appearance: boolean
|
|
38
|
+
themeConfig: ThemeConfig
|
|
39
|
+
scrollOffset: number | string
|
|
40
|
+
locales: Record<string, LocaleConfig>
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Available locales for the site when it has defined `locales` in its
|
|
44
|
+
* `themeConfig`. This object is otherwise empty. Keys are paths like `/` or
|
|
45
|
+
* `/zh/`.
|
|
46
|
+
*/
|
|
47
|
+
langs: Record<
|
|
48
|
+
string,
|
|
49
|
+
{
|
|
50
|
+
/**
|
|
51
|
+
* Lang attribute as set on the `<html>` element.
|
|
52
|
+
* @example `en-US`, `zh-CN`
|
|
53
|
+
*/
|
|
54
|
+
lang: string
|
|
55
|
+
/**
|
|
56
|
+
* Label to display in the language menu.
|
|
57
|
+
* @example `English`, `简体中文`
|
|
58
|
+
*/
|
|
59
|
+
label: string
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type HeadConfig =
|
|
65
|
+
| [string, Record<string, string>]
|
|
66
|
+
| [string, Record<string, string>, string]
|
|
67
|
+
|
|
68
|
+
interface LocaleConfig {
|
|
69
|
+
lang: string
|
|
70
|
+
title?: string
|
|
71
|
+
titleTemplate?: string | boolean
|
|
72
|
+
description?: string
|
|
73
|
+
head?: HeadConfig[]
|
|
74
|
+
label?: string
|
|
75
|
+
selectText?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare const inBrowser: boolean;
|
|
79
|
+
|
|
80
|
+
interface Route {
|
|
81
|
+
path: string;
|
|
82
|
+
data: PageData;
|
|
83
|
+
component: Component | null;
|
|
84
|
+
}
|
|
85
|
+
interface Router {
|
|
86
|
+
route: Route;
|
|
87
|
+
go: (href?: string) => Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
declare function useRouter(): Router;
|
|
90
|
+
declare function useRoute(): Route;
|
|
91
|
+
|
|
92
|
+
interface VitePressData<T = any> {
|
|
93
|
+
site: Ref<SiteData<T>>;
|
|
94
|
+
page: Ref<PageData>;
|
|
95
|
+
theme: Ref<T>;
|
|
96
|
+
frontmatter: Ref<PageData['frontmatter']>;
|
|
97
|
+
title: Ref<string>;
|
|
98
|
+
description: Ref<string>;
|
|
99
|
+
lang: Ref<string>;
|
|
100
|
+
localePath: Ref<string>;
|
|
101
|
+
}
|
|
102
|
+
declare function useData<T = any>(): VitePressData<T>;
|
|
103
|
+
|
|
104
|
+
interface EnhanceAppContext {
|
|
105
|
+
app: App;
|
|
106
|
+
router: Router;
|
|
107
|
+
siteData: Ref<SiteData>;
|
|
108
|
+
}
|
|
109
|
+
interface Theme {
|
|
110
|
+
Layout: Component;
|
|
111
|
+
NotFound?: Component;
|
|
112
|
+
enhanceApp?: (ctx: EnhanceAppContext) => void;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare function withBase(path: string): string;
|
|
116
|
+
|
|
117
|
+
declare const Content: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}>;
|
|
120
|
+
|
|
121
|
+
declare const Debug: vue.ComponentOptions<{}, any, any, any, any, any, any, any>;
|
|
122
|
+
|
|
123
|
+
export { Content, Debug, EnhanceAppContext, HeadConfig, Header, LocaleConfig, PageData, Route, Router, SiteData, Theme, VitePressData, inBrowser, useData, useRoute, useRouter, withBase };
|
package/dist/client/index.js
CHANGED
package/dist/client/shared.js
CHANGED
|
@@ -53,6 +53,27 @@ export function resolveSiteDataByRoute(siteData, route) {
|
|
|
53
53
|
langs: createLangDictionary(siteData)
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Create the page title string based on configs.
|
|
58
|
+
*/
|
|
59
|
+
export function createTitle(siteData, pageData) {
|
|
60
|
+
const title = pageData.title || siteData.title;
|
|
61
|
+
const template = pageData.titleTemplate ?? siteData.titleTemplate;
|
|
62
|
+
const templateString = createTitleTemplate(siteData.title, template);
|
|
63
|
+
return `${title}${templateString}`;
|
|
64
|
+
}
|
|
65
|
+
function createTitleTemplate(siteTitle, template) {
|
|
66
|
+
if (template === false) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
if (template === true || template === undefined) {
|
|
70
|
+
return ` | ${siteTitle}`;
|
|
71
|
+
}
|
|
72
|
+
if (siteTitle === template) {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
return ` | ${template}`;
|
|
76
|
+
}
|
|
56
77
|
/**
|
|
57
78
|
* Clean up the route by removing the `base` path if it's set in config.
|
|
58
79
|
*/
|
|
@@ -33,6 +33,13 @@ provide('close-sidebar', closeSidebar)
|
|
|
33
33
|
<template #home-hero-after><slot name="home-hero-after" /></template>
|
|
34
34
|
<template #home-features-before><slot name="home-features-before" /></template>
|
|
35
35
|
<template #home-features-after><slot name="home-features-after" /></template>
|
|
36
|
+
|
|
37
|
+
<template #aside-top><slot name="aside-top" /></template>
|
|
38
|
+
<template #aside-bottom><slot name="aside-bottom" /></template>
|
|
39
|
+
<template #aside-outline-before><slot name="aside-outline-before" /></template>
|
|
40
|
+
<template #aside-outline-after><slot name="aside-outline-after" /></template>
|
|
41
|
+
<template #aside-ads-before><slot name="aside-ads-before" /></template>
|
|
42
|
+
<template #aside-ads-after><slot name="aside-ads-after" /></template>
|
|
36
43
|
</VPContent>
|
|
37
44
|
|
|
38
45
|
<VPFooter />
|
|
@@ -2,23 +2,83 @@
|
|
|
2
2
|
import { useData } from 'vitepress'
|
|
3
3
|
|
|
4
4
|
const { site } = useData()
|
|
5
|
-
|
|
6
|
-
const msgs = [
|
|
7
|
-
`There's nothing here.`,
|
|
8
|
-
`How did we get here?`,
|
|
9
|
-
`That's a Four-Oh-Four.`,
|
|
10
|
-
`Looks like we've got some broken links.`
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
function getMsg() {
|
|
14
|
-
return msgs[Math.floor(Math.random() * msgs.length)]
|
|
15
|
-
}
|
|
16
5
|
</script>
|
|
17
6
|
|
|
18
7
|
<template>
|
|
19
8
|
<div class="NotFound">
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
9
|
+
<p class="code">404</p>
|
|
10
|
+
<h1 class="title">PAGE NOT FOUND</h1>
|
|
11
|
+
<div class="divider" />
|
|
12
|
+
<blockquote class="quote">
|
|
13
|
+
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
|
|
14
|
+
</blockquote>
|
|
15
|
+
|
|
16
|
+
<div class="action">
|
|
17
|
+
<a class="link" :href="site.base" aria-label="go to home">
|
|
18
|
+
Take me home
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
23
21
|
</div>
|
|
24
22
|
</template>
|
|
23
|
+
|
|
24
|
+
<style scoped>
|
|
25
|
+
.NotFound {
|
|
26
|
+
padding: 64px 24px 96px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (min-width: 768px) {
|
|
31
|
+
.NotFound {
|
|
32
|
+
padding: 96px 32px 168px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.code {
|
|
37
|
+
line-height: 64px;
|
|
38
|
+
font-size: 64px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.title {
|
|
43
|
+
padding-top: 12px;
|
|
44
|
+
letter-spacing: 2px;
|
|
45
|
+
line-height: 20px;
|
|
46
|
+
font-size: 20px;
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.divider {
|
|
51
|
+
margin: 24px auto 18px;
|
|
52
|
+
width: 64px;
|
|
53
|
+
height: 1px;
|
|
54
|
+
background-color: var(--vp-c-divider)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.quote {
|
|
58
|
+
margin: 0 auto;
|
|
59
|
+
max-width: 256px;
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
color: var(--vp-c-text-2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.action {
|
|
66
|
+
padding-top: 20px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.link {
|
|
70
|
+
display: inline-block;
|
|
71
|
+
border: 1px solid var(--vp-c-brand);
|
|
72
|
+
border-radius: 16px;
|
|
73
|
+
padding: 3px 16px;
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
color: var(--vp-c-brand);
|
|
77
|
+
transition: border-color 0.25s, color .25s;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.link:hover {
|
|
81
|
+
border-color: var(--vp-c-brand-dark);
|
|
82
|
+
color: var(--vp-c-brand-dark);
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -23,10 +23,6 @@ defineProps<{
|
|
|
23
23
|
background-color: var(--vp-c-bg-soft);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.dark .VPBox {
|
|
27
|
-
background-color: var(--vp-c-bg-mute);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
26
|
.icon {
|
|
31
27
|
display: flex;
|
|
32
28
|
justify-content: center;
|
|
@@ -40,7 +36,7 @@ defineProps<{
|
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
.dark .icon {
|
|
43
|
-
background-color: var(--vp-c-bg
|
|
39
|
+
background-color: var(--vp-c-bg);
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
.title {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch, onMounted } from 'vue'
|
|
3
|
+
import { useData } from 'vitepress'
|
|
4
|
+
import { useAside } from '../composables/aside'
|
|
5
|
+
|
|
6
|
+
const { theme } = useData()
|
|
7
|
+
const carbonOptions = theme.value.carbonAds
|
|
8
|
+
const { isAsideEnabled } = useAside()
|
|
9
|
+
const container = ref()
|
|
10
|
+
|
|
11
|
+
let hasInitalized = false
|
|
12
|
+
|
|
13
|
+
function init() {
|
|
14
|
+
if (!hasInitalized) {
|
|
15
|
+
hasInitalized = true
|
|
16
|
+
const s = document.createElement('script')
|
|
17
|
+
s.id = '_carbonads_js'
|
|
18
|
+
s.src = `//cdn.carbonads.com/carbon.js?serve=${carbonOptions.code}&placement=${carbonOptions.placement}`
|
|
19
|
+
s.async = true
|
|
20
|
+
container.value.appendChild(s)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// no need to account for option changes during dev, we can just
|
|
25
|
+
// refresh the page
|
|
26
|
+
if (carbonOptions) {
|
|
27
|
+
onMounted(() => {
|
|
28
|
+
// if the page is loaded when aside is active, load carbon directly.
|
|
29
|
+
// otherwise, only load it if the page resizes to wide enough. this avoids
|
|
30
|
+
// loading carbon at all on mobile where it's never shown
|
|
31
|
+
if (isAsideEnabled.value) {
|
|
32
|
+
init()
|
|
33
|
+
} else {
|
|
34
|
+
watch(isAsideEnabled, (wide) => wide && init())
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="VPCarbonAds" ref="container" />
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
.VPCarbonAds {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
padding: 24px;
|
|
50
|
+
border-radius: 12px;
|
|
51
|
+
min-height: 240px;
|
|
52
|
+
text-align: center;
|
|
53
|
+
line-height: 18px;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
background-color: var(--vp-c-bg-soft);
|
|
57
|
+
transition: color 0.5s, background-color 0.5s;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.VPCarbonAds img {
|
|
61
|
+
margin: 0 auto;
|
|
62
|
+
border-radius: 6px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.VPCarbonAds .carbon-text {
|
|
66
|
+
display: block;
|
|
67
|
+
margin: 0 auto;
|
|
68
|
+
padding-top: 12px;
|
|
69
|
+
color: var(--vp-c-text-1);
|
|
70
|
+
transition: color 0.25s;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.VPCarbonAds .carbon-text:hover {
|
|
74
|
+
color: var(--vp-c-brand);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.VPCarbonAds .carbon-poweredby {
|
|
78
|
+
display: block;
|
|
79
|
+
padding-top: 6px;
|
|
80
|
+
font-size: 11px;
|
|
81
|
+
font-weight: 500;
|
|
82
|
+
color: var(--vp-c-text-2);
|
|
83
|
+
text-transform: uppercase;
|
|
84
|
+
transition: color 0.25s;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.VPCarbonAds .carbon-poweredby:hover {
|
|
88
|
+
color: var(--vp-c-text-1);
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useRoute, useData } from 'vitepress'
|
|
3
|
+
import { useCopyCode } from '../composables/copy-code'
|
|
3
4
|
import { useSidebar } from '../composables/sidebar'
|
|
4
5
|
import NotFound from '../NotFound.vue'
|
|
5
6
|
import VPPage from './VPPage.vue'
|
|
@@ -9,6 +10,8 @@ import VPDoc from './VPDoc.vue'
|
|
|
9
10
|
const route = useRoute()
|
|
10
11
|
const { frontmatter } = useData()
|
|
11
12
|
const { hasSidebar } = useSidebar()
|
|
13
|
+
|
|
14
|
+
useCopyCode()
|
|
12
15
|
</script>
|
|
13
16
|
|
|
14
17
|
<template>
|
|
@@ -31,15 +34,23 @@ const { hasSidebar } = useSidebar()
|
|
|
31
34
|
<template #home-features-after><slot name="home-features-after" /></template>
|
|
32
35
|
</VPHome>
|
|
33
36
|
|
|
34
|
-
<VPDoc v-else
|
|
37
|
+
<VPDoc v-else>
|
|
38
|
+
<template #aside-top><slot name="aside-top" /></template>
|
|
39
|
+
<template #aside-outline-before><slot name="aside-outline-before" /></template>
|
|
40
|
+
<template #aside-outline-after><slot name="aside-outline-after" /></template>
|
|
41
|
+
<template #aside-ads-before><slot name="aside-ads-before" /></template>
|
|
42
|
+
<template #aside-ads-after><slot name="aside-ads-after" /></template>
|
|
43
|
+
<template #aside-bottom><slot name="aside-bottom" /></template>
|
|
44
|
+
</VPDoc>
|
|
35
45
|
</div>
|
|
36
46
|
</template>
|
|
37
47
|
|
|
38
48
|
<style scoped>
|
|
39
49
|
.VPContent {
|
|
40
50
|
flex-grow: 1;
|
|
51
|
+
flex-shrink: 0;
|
|
41
52
|
margin: 0 auto;
|
|
42
|
-
|
|
53
|
+
width: 100%;
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
.VPContent.is-home {
|
|
@@ -47,12 +58,6 @@ const { hasSidebar } = useSidebar()
|
|
|
47
58
|
max-width: 100%;
|
|
48
59
|
}
|
|
49
60
|
|
|
50
|
-
@media (max-width: 768px) {
|
|
51
|
-
.VPContent {
|
|
52
|
-
overflow-x: hidden;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
61
|
@media (min-width: 960px) {
|
|
57
62
|
.VPContent {
|
|
58
63
|
padding-top: var(--vp-nav-height);
|
|
@@ -61,14 +66,13 @@ const { hasSidebar } = useSidebar()
|
|
|
61
66
|
.VPContent.has-sidebar {
|
|
62
67
|
margin: 0;
|
|
63
68
|
padding-left: var(--vp-sidebar-width);
|
|
64
|
-
max-width: 100%;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
@media (min-width: 1440px) {
|
|
69
73
|
.VPContent.has-sidebar {
|
|
70
74
|
padding-right: calc((100vw - var(--vp-layout-max-width)) / 2);
|
|
71
|
-
padding-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width)
|
|
75
|
+
padding-left: calc((100vw - var(--vp-layout-max-width)) / 2 + var(--vp-sidebar-width));
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
</style>
|