@vuepress/theme-default 2.0.0-beta.6 → 2.0.0-beta.60
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/lib/client/components/AutoLink.vue +114 -0
- package/lib/client/components/DropdownTransition.vue +21 -0
- package/lib/client/components/Home.vue +15 -0
- package/lib/client/components/HomeContent.vue +5 -0
- package/lib/client/components/HomeFeatures.vue +23 -0
- package/lib/client/components/HomeFooter.vue +17 -0
- package/lib/client/components/HomeHero.vue +98 -0
- package/lib/client/components/Navbar.vue +75 -0
- package/lib/client/components/NavbarBrand.vue +55 -0
- package/lib/client/components/NavbarDropdown.vue +126 -0
- package/lib/{components/NavbarLinks.vue → client/components/NavbarItems.vue} +61 -50
- package/lib/{components → client/components}/Page.vue +9 -15
- package/lib/{components → client/components}/PageMeta.vue +51 -66
- package/lib/{components → client/components}/PageNav.vue +44 -57
- package/lib/client/components/Sidebar.vue +13 -0
- package/lib/client/components/SidebarItem.vue +87 -0
- package/lib/client/components/SidebarItems.vue +57 -0
- package/lib/client/components/ToggleColorModeButton.vue +57 -0
- package/lib/client/components/ToggleSidebarButton.vue +24 -0
- package/lib/client/components/global/Badge.vue +31 -0
- package/lib/client/components/global/CodeGroup.d.ts +4 -0
- package/lib/client/components/global/CodeGroup.js +106 -0
- package/lib/client/components/global/CodeGroupItem.vue +31 -0
- package/lib/client/components/global/index.d.ts +4 -0
- package/lib/client/components/global/index.js +4 -0
- package/lib/client/composables/index.d.ts +6 -0
- package/lib/client/composables/index.js +6 -0
- package/lib/client/composables/useDarkMode.d.ts +12 -0
- package/lib/client/composables/useDarkMode.js +57 -0
- package/lib/{composables → client/composables}/useNavLink.d.ts +6 -1
- package/lib/{composables → client/composables}/useNavLink.js +5 -2
- package/lib/{composables → client/composables}/useResolveRouteWithRedirect.d.ts +1 -1
- package/lib/{composables → client/composables}/useResolveRouteWithRedirect.js +2 -2
- package/lib/{composables → client/composables}/useScrollPromise.d.ts +0 -0
- package/lib/{composables → client/composables}/useScrollPromise.js +1 -1
- package/lib/client/composables/useSidebarItems.d.ts +36 -0
- package/lib/client/composables/useSidebarItems.js +118 -0
- package/lib/{composables → client/composables}/useThemeData.d.ts +2 -2
- package/lib/{composables → client/composables}/useThemeData.js +1 -1
- package/lib/client/config.d.ts +3 -0
- package/lib/client/config.js +44 -0
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.js +3 -0
- package/lib/client/layouts/Layout.vue +134 -0
- package/lib/client/layouts/NotFound.vue +27 -0
- package/lib/{shim.d.ts → client/shim.d.ts} +0 -0
- package/lib/{styles/_wrapper.scss → client/styles/_mixins.scss} +7 -2
- package/lib/client/styles/_variables.scss +6 -0
- package/lib/{styles → client/styles}/arrow.scss +4 -6
- package/lib/client/styles/badge.scss +34 -0
- package/lib/{styles → client/styles}/code-group.scss +9 -2
- package/lib/{styles → client/styles}/code.scss +35 -49
- package/lib/client/styles/custom-container.scss +140 -0
- package/lib/{styles → client/styles}/home.scss +32 -24
- package/lib/{styles → client/styles}/index.scss +4 -4
- package/lib/client/styles/layout.scss +199 -0
- package/lib/{styles/dropdown.scss → client/styles/navbar-dropdown.scss} +36 -50
- package/lib/client/styles/navbar.scss +193 -0
- package/lib/client/styles/normalize.scss +200 -0
- package/lib/{styles → client/styles}/page.scss +24 -8
- package/lib/client/styles/sidebar.scss +134 -0
- package/lib/{styles → client/styles}/toc.scss +0 -0
- package/lib/client/styles/transitions.scss +22 -0
- package/lib/client/styles/vars-dark.scss +68 -0
- package/lib/client/styles/vars.scss +149 -0
- package/lib/client/utils/index.d.ts +3 -0
- package/lib/client/utils/index.js +3 -0
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -0
- package/lib/client/utils/isActiveSidebarItem.js +20 -0
- package/lib/{utils → client/utils}/resolveEditLink.d.ts +2 -2
- package/lib/{utils → client/utils}/resolveEditLink.js +15 -9
- package/lib/client/utils/resolveRepoType.d.ts +2 -0
- package/lib/{utils → client/utils}/resolveRepoType.js +3 -1
- package/lib/node/defaultTheme.d.ts +10 -0
- package/lib/node/defaultTheme.js +117 -0
- package/lib/node/index.d.ts +5 -5
- package/lib/node/index.js +5 -17
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +7 -0
- package/lib/node/{assignDefaultLocaleOptions.js → utils/assignDefaultLocaleOptions.js} +13 -13
- package/lib/node/utils/index.d.ts +2 -0
- package/lib/node/utils/index.js +2 -0
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +8 -0
- package/lib/node/utils/resolveContainerPluginOptions.js +17 -0
- package/lib/shared/index.d.ts +3 -0
- package/lib/shared/index.js +3 -0
- package/lib/shared/nav.d.ts +42 -0
- package/lib/shared/nav.js +1 -0
- package/lib/{types → shared}/options.d.ts +51 -13
- package/lib/shared/options.js +1 -0
- package/lib/{types → shared}/page.d.ts +15 -6
- package/lib/shared/page.js +1 -0
- package/package.json +49 -29
- package/templates/build.html +33 -0
- package/CHANGELOG.md +0 -376
- package/lib/clientAppEnhance.d.ts +0 -3
- package/lib/clientAppEnhance.js +0 -30
- package/lib/clientAppSetup.d.ts +0 -2
- package/lib/clientAppSetup.js +0 -11
- package/lib/components/DropdownLink.vue +0 -141
- package/lib/components/DropdownTransition.vue +0 -34
- package/lib/components/Home.vue +0 -133
- package/lib/components/NavLink.vue +0 -115
- package/lib/components/Navbar.vue +0 -114
- package/lib/components/Sidebar.vue +0 -38
- package/lib/components/SidebarChild.d.ts +0 -6
- package/lib/components/SidebarChild.js +0 -91
- package/lib/components/ToggleSidebarButton.vue +0 -27
- package/lib/components/global/Badge.vue +0 -37
- package/lib/components/global/CodeGroup.d.ts +0 -5
- package/lib/components/global/CodeGroup.js +0 -52
- package/lib/components/global/CodeGroupItem.vue +0 -25
- package/lib/components/global/OutboundLink.vue +0 -30
- package/lib/composables/index.d.ts +0 -5
- package/lib/composables/index.js +0 -5
- package/lib/composables/useSidebarItems.d.ts +0 -31
- package/lib/composables/useSidebarItems.js +0 -114
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -67
- package/lib/layouts/404.vue +0 -38
- package/lib/layouts/Layout.vue +0 -152
- package/lib/node/assignDefaultLocaleOptions.d.ts +0 -5
- package/lib/node/resolveActiveHeaderLinksPluginOptions.d.ts +0 -6
- package/lib/node/resolveActiveHeaderLinksPluginOptions.js +0 -16
- package/lib/node/resolveContainerPluginOptions.d.ts +0 -26
- package/lib/node/resolveContainerPluginOptions.js +0 -79
- package/lib/node/resolveGitPluginOptions.d.ts +0 -6
- package/lib/node/resolveGitPluginOptions.js +0 -22
- package/lib/node/resolveMediumZoomPluginOptions.d.ts +0 -6
- package/lib/node/resolveMediumZoomPluginOptions.js +0 -17
- package/lib/styles/_normalize.scss +0 -148
- package/lib/styles/_variables.scss +0 -34
- package/lib/styles/badge.scss +0 -33
- package/lib/styles/custom-container.scss +0 -78
- package/lib/styles/layout.scss +0 -194
- package/lib/styles/navbar.scss +0 -141
- package/lib/styles/plugins.scss +0 -18
- package/lib/styles/sidebar.scss +0 -152
- package/lib/styles/sr-only.scss +0 -12
- package/lib/styles/transitions.scss +0 -13
- package/lib/types/index.d.ts +0 -3
- package/lib/types/index.js +0 -15
- package/lib/types/nav.d.ts +0 -44
- package/lib/types/nav.js +0 -2
- package/lib/types/options.js +0 -2
- package/lib/types/page.js +0 -2
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.js +0 -2
- package/lib/utils/resolveRepoType.d.ts +0 -2
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveRepoType } from './resolveRepoType';
|
|
1
|
+
import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
|
|
2
|
+
import { resolveRepoType } from './resolveRepoType.js';
|
|
3
3
|
export const editLinkPatterns = {
|
|
4
4
|
GitHub: ':repo/edit/:branch/:path',
|
|
5
5
|
GitLab: ':repo/-/edit/:branch/:path',
|
|
6
|
+
Gitee: ':repo/edit/:branch/:path',
|
|
6
7
|
Bitbucket: ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
const repoType = resolveRepoType(docsRepo);
|
|
10
|
-
let pattern;
|
|
9
|
+
const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
|
|
11
10
|
if (editLinkPattern) {
|
|
12
|
-
|
|
11
|
+
return editLinkPattern;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const repoType = resolveRepoType(docsRepo);
|
|
14
|
+
if (repoType !== null) {
|
|
15
|
+
return editLinkPatterns[repoType];
|
|
16
16
|
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
export const resolveEditLink = ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }) => {
|
|
20
|
+
if (!filePathRelative)
|
|
21
|
+
return null;
|
|
22
|
+
const pattern = resolveEditLinkPatterns({ docsRepo, editLinkPattern });
|
|
17
23
|
if (!pattern)
|
|
18
24
|
return null;
|
|
19
25
|
return pattern
|
|
20
|
-
.replace(/:repo/,
|
|
26
|
+
.replace(/:repo/, isLinkHttp(docsRepo) ? docsRepo : `https://github.com/${docsRepo}`)
|
|
21
27
|
.replace(/:branch/, docsBranch)
|
|
22
28
|
.replace(/:path/, removeLeadingSlash(`${removeEndingSlash(docsDir)}/${filePathRelative}`));
|
|
23
29
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { isLinkHttp } from '@vuepress/shared';
|
|
2
2
|
export const resolveRepoType = (repo) => {
|
|
3
|
-
if (!isLinkHttp(repo))
|
|
3
|
+
if (!isLinkHttp(repo) || /github\.com/.test(repo))
|
|
4
4
|
return 'GitHub';
|
|
5
5
|
if (/bitbucket\.org/.test(repo))
|
|
6
6
|
return 'Bitbucket';
|
|
7
7
|
if (/gitlab\.com/.test(repo))
|
|
8
8
|
return 'GitLab';
|
|
9
|
+
if (/gitee\.com/.test(repo))
|
|
10
|
+
return 'Gitee';
|
|
9
11
|
return null;
|
|
10
12
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Theme } from '@vuepress/core';
|
|
2
|
+
import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared/index.js';
|
|
3
|
+
export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
|
|
4
|
+
/**
|
|
5
|
+
* To avoid confusion with the root `plugins` option,
|
|
6
|
+
* we use `themePlugins`
|
|
7
|
+
*/
|
|
8
|
+
themePlugins?: DefaultThemePluginsOptions;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultTheme: ({ themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
|
|
2
|
+
import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
|
|
3
|
+
import { containerPlugin } from '@vuepress/plugin-container';
|
|
4
|
+
import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon';
|
|
5
|
+
import { gitPlugin } from '@vuepress/plugin-git';
|
|
6
|
+
import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
|
|
7
|
+
import { nprogressPlugin } from '@vuepress/plugin-nprogress';
|
|
8
|
+
import { palettePlugin } from '@vuepress/plugin-palette';
|
|
9
|
+
import { prismjsPlugin } from '@vuepress/plugin-prismjs';
|
|
10
|
+
import { themeDataPlugin } from '@vuepress/plugin-theme-data';
|
|
11
|
+
import { fs, getDirname, path } from '@vuepress/utils';
|
|
12
|
+
import { assignDefaultLocaleOptions, resolveContainerPluginOptions, } from './utils/index.js';
|
|
13
|
+
const __dirname = getDirname(import.meta.url);
|
|
14
|
+
export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
15
|
+
assignDefaultLocaleOptions(localeOptions);
|
|
16
|
+
return {
|
|
17
|
+
name: '@vuepress/theme-default',
|
|
18
|
+
templateBuild: path.resolve(__dirname, '../../templates/build.html'),
|
|
19
|
+
alias: {
|
|
20
|
+
// use alias to make all components replaceable
|
|
21
|
+
...Object.fromEntries(fs
|
|
22
|
+
.readdirSync(path.resolve(__dirname, '../client/components'))
|
|
23
|
+
.filter((file) => file.endsWith('.vue'))
|
|
24
|
+
.map((file) => [
|
|
25
|
+
`@theme/${file}`,
|
|
26
|
+
path.resolve(__dirname, '../client/components', file),
|
|
27
|
+
])),
|
|
28
|
+
},
|
|
29
|
+
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
30
|
+
extendsPage: (page) => {
|
|
31
|
+
// save relative file path into page data to generate edit link
|
|
32
|
+
page.data.filePathRelative = page.filePathRelative;
|
|
33
|
+
// save title into route meta to generate navbar and sidebar
|
|
34
|
+
page.routeMeta.title = page.title;
|
|
35
|
+
},
|
|
36
|
+
plugins: [
|
|
37
|
+
// @vuepress/plugin-active-header-link
|
|
38
|
+
themePlugins.activeHeaderLinks !== false
|
|
39
|
+
? activeHeaderLinksPlugin({
|
|
40
|
+
headerLinkSelector: 'a.sidebar-item',
|
|
41
|
+
headerAnchorSelector: '.header-anchor',
|
|
42
|
+
// should greater than page transition duration
|
|
43
|
+
delay: 300,
|
|
44
|
+
})
|
|
45
|
+
: [],
|
|
46
|
+
// @vuepress/plugin-back-to-top
|
|
47
|
+
themePlugins.backToTop !== false ? backToTopPlugin() : [],
|
|
48
|
+
// @vuepress/plugin-container
|
|
49
|
+
themePlugins.container?.tip !== false
|
|
50
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
|
|
51
|
+
: [],
|
|
52
|
+
themePlugins.container?.warning !== false
|
|
53
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
|
|
54
|
+
: [],
|
|
55
|
+
themePlugins.container?.danger !== false
|
|
56
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
|
|
57
|
+
: [],
|
|
58
|
+
themePlugins.container?.details !== false
|
|
59
|
+
? containerPlugin({
|
|
60
|
+
type: 'details',
|
|
61
|
+
before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
|
|
62
|
+
after: () => '</details>\n',
|
|
63
|
+
})
|
|
64
|
+
: [],
|
|
65
|
+
themePlugins.container?.codeGroup !== false
|
|
66
|
+
? containerPlugin({
|
|
67
|
+
type: 'code-group',
|
|
68
|
+
before: () => `<CodeGroup>\n`,
|
|
69
|
+
after: () => '</CodeGroup>\n',
|
|
70
|
+
})
|
|
71
|
+
: [],
|
|
72
|
+
themePlugins.container?.codeGroupItem !== false
|
|
73
|
+
? containerPlugin({
|
|
74
|
+
type: 'code-group-item',
|
|
75
|
+
before: (info) => `<CodeGroupItem title="${info}">\n`,
|
|
76
|
+
after: () => '</CodeGroupItem>\n',
|
|
77
|
+
})
|
|
78
|
+
: [],
|
|
79
|
+
// @vuepress/plugin-external-link-icon
|
|
80
|
+
themePlugins.externalLinkIcon !== false
|
|
81
|
+
? externalLinkIconPlugin({
|
|
82
|
+
locales: Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
83
|
+
result[key] = {
|
|
84
|
+
openInNewWindow: value.openInNewWindow ?? localeOptions.openInNewWindow,
|
|
85
|
+
};
|
|
86
|
+
return result;
|
|
87
|
+
}, {}),
|
|
88
|
+
})
|
|
89
|
+
: [],
|
|
90
|
+
// @vuepress/plugin-git
|
|
91
|
+
themePlugins.git !== false
|
|
92
|
+
? gitPlugin({
|
|
93
|
+
createdTime: false,
|
|
94
|
+
updatedTime: localeOptions.lastUpdated !== false,
|
|
95
|
+
contributors: localeOptions.contributors !== false,
|
|
96
|
+
})
|
|
97
|
+
: [],
|
|
98
|
+
// @vuepress/plugin-medium-zoom
|
|
99
|
+
themePlugins.mediumZoom !== false
|
|
100
|
+
? mediumZoomPlugin({
|
|
101
|
+
selector: '.theme-default-content > img, .theme-default-content :not(a) > img',
|
|
102
|
+
zoomOptions: {},
|
|
103
|
+
// should greater than page transition duration
|
|
104
|
+
delay: 300,
|
|
105
|
+
})
|
|
106
|
+
: [],
|
|
107
|
+
// @vuepress/plugin-nprogress
|
|
108
|
+
themePlugins.nprogress !== false ? nprogressPlugin() : [],
|
|
109
|
+
// @vuepress/plugin-palette
|
|
110
|
+
palettePlugin({ preset: 'sass' }),
|
|
111
|
+
// @vuepress/plugin-prismjs
|
|
112
|
+
themePlugins.prismjs !== false ? prismjsPlugin() : [],
|
|
113
|
+
// @vuepress/plugin-theme-data
|
|
114
|
+
themeDataPlugin({ themeData: localeOptions }),
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
};
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export * from '
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export
|
|
1
|
+
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
+
export * from '../shared/index.js';
|
|
3
|
+
export * from './defaultTheme.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
|
+
export default defaultTheme;
|
package/lib/node/index.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./assignDefaultLocaleOptions"), exports);
|
|
14
|
-
__exportStar(require("./resolveActiveHeaderLinksPluginOptions"), exports);
|
|
15
|
-
__exportStar(require("./resolveContainerPluginOptions"), exports);
|
|
16
|
-
__exportStar(require("./resolveGitPluginOptions"), exports);
|
|
17
|
-
__exportStar(require("./resolveMediumZoomPluginOptions"), exports);
|
|
1
|
+
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
+
export * from '../shared/index.js';
|
|
3
|
+
export * from './defaultTheme.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
|
+
export default defaultTheme;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DefaultThemeLocaleData, DefaultThemeLocaleOptions } from '../../shared/index.js';
|
|
2
|
+
export declare const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions;
|
|
3
|
+
export declare const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData;
|
|
4
|
+
/**
|
|
5
|
+
* Assign default options
|
|
6
|
+
*/
|
|
7
|
+
export declare const assignDefaultLocaleOptions: (localeOptions: DefaultThemeLocaleOptions) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const DEFAULT_LOCALE_OPTIONS = {
|
|
2
|
+
// color mode
|
|
3
|
+
colorMode: 'auto',
|
|
4
|
+
colorModeSwitch: true,
|
|
5
5
|
// navbar
|
|
6
6
|
navbar: [],
|
|
7
7
|
logo: null,
|
|
@@ -10,6 +10,7 @@ const defaultLocaleOptions = {
|
|
|
10
10
|
selectLanguageAriaLabel: 'Select language',
|
|
11
11
|
// sidebar
|
|
12
12
|
sidebar: 'auto',
|
|
13
|
+
sidebarDepth: 2,
|
|
13
14
|
// page meta
|
|
14
15
|
editLink: true,
|
|
15
16
|
editLinkText: 'Edit this page',
|
|
@@ -25,19 +26,19 @@ const defaultLocaleOptions = {
|
|
|
25
26
|
`Looks like we've got some broken links.`,
|
|
26
27
|
],
|
|
27
28
|
backToHome: 'Take me home',
|
|
28
|
-
//
|
|
29
|
+
// a11y
|
|
29
30
|
openInNewWindow: 'open in new window',
|
|
31
|
+
toggleColorMode: 'toggle color mode',
|
|
32
|
+
toggleSidebar: 'toggle sidebar',
|
|
30
33
|
};
|
|
31
|
-
const
|
|
34
|
+
export const DEFAULT_LOCALE_DATA = {
|
|
32
35
|
// navbar
|
|
33
36
|
selectLanguageName: 'English',
|
|
34
|
-
// custom block
|
|
35
|
-
danger: 'WARNING',
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
38
|
-
* Assign default options
|
|
39
|
+
* Assign default options
|
|
39
40
|
*/
|
|
40
|
-
const assignDefaultLocaleOptions = (localeOptions) => {
|
|
41
|
+
export const assignDefaultLocaleOptions = (localeOptions) => {
|
|
41
42
|
if (!localeOptions.locales) {
|
|
42
43
|
localeOptions.locales = {};
|
|
43
44
|
}
|
|
@@ -45,12 +46,11 @@ const assignDefaultLocaleOptions = (localeOptions) => {
|
|
|
45
46
|
localeOptions.locales['/'] = {};
|
|
46
47
|
}
|
|
47
48
|
Object.assign(localeOptions, {
|
|
48
|
-
...
|
|
49
|
+
...DEFAULT_LOCALE_OPTIONS,
|
|
49
50
|
...localeOptions,
|
|
50
51
|
});
|
|
51
52
|
Object.assign(localeOptions.locales['/'], {
|
|
52
|
-
...
|
|
53
|
+
...DEFAULT_LOCALE_DATA,
|
|
53
54
|
...localeOptions.locales['/'],
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
|
-
exports.assignDefaultLocaleOptions = assignDefaultLocaleOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContainerPluginOptions } from '@vuepress/plugin-container';
|
|
2
|
+
import type { DefaultThemeData } from '../../shared/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve options for @vuepress/plugin-container
|
|
5
|
+
*
|
|
6
|
+
* For custom containers default title
|
|
7
|
+
*/
|
|
8
|
+
export declare const resolveContainerPluginOptions: (localeOptions: DefaultThemeData, type: 'tip' | 'warning' | 'danger') => ContainerPluginOptions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve options for @vuepress/plugin-container
|
|
3
|
+
*
|
|
4
|
+
* For custom containers default title
|
|
5
|
+
*/
|
|
6
|
+
export const resolveContainerPluginOptions = (localeOptions, type) => {
|
|
7
|
+
const locales = Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
8
|
+
result[key] = {
|
|
9
|
+
defaultInfo: value?.[type] ?? localeOptions[type],
|
|
10
|
+
};
|
|
11
|
+
return result;
|
|
12
|
+
}, {});
|
|
13
|
+
return {
|
|
14
|
+
type,
|
|
15
|
+
locales,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base nav item, displayed as text
|
|
3
|
+
*/
|
|
4
|
+
export interface NavItem {
|
|
5
|
+
text: string;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Base nav group, has nav items children
|
|
10
|
+
*/
|
|
11
|
+
export interface NavGroup<T> extends NavItem {
|
|
12
|
+
children: T[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Props for `<AutoLink>`
|
|
16
|
+
*/
|
|
17
|
+
export interface NavLink extends NavItem {
|
|
18
|
+
link: string;
|
|
19
|
+
rel?: string;
|
|
20
|
+
target?: string;
|
|
21
|
+
activeMatch?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Navbar types
|
|
25
|
+
*/
|
|
26
|
+
export type NavbarItem = NavLink;
|
|
27
|
+
export type NavbarGroup = NavGroup<NavbarGroup | NavbarItem | string>;
|
|
28
|
+
export type NavbarConfig = (NavbarItem | NavbarGroup | string)[];
|
|
29
|
+
export type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarItem>;
|
|
30
|
+
/**
|
|
31
|
+
* Sidebar types
|
|
32
|
+
*/
|
|
33
|
+
export type SidebarItem = NavItem & Partial<NavLink>;
|
|
34
|
+
export type SidebarGroup = SidebarItem & NavGroup<SidebarItem | SidebarGroup | string> & {
|
|
35
|
+
collapsible?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type SidebarConfigArray = (SidebarItem | SidebarGroup | string)[];
|
|
38
|
+
export type SidebarConfigObject = Record<string, SidebarConfigArray>;
|
|
39
|
+
export type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
|
|
40
|
+
export type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
|
|
41
|
+
collapsible?: boolean;
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import type { LocaleData, ThemeConfig } from '@vuepress/core';
|
|
2
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* To avoid confusion with the root `plugins` option,
|
|
7
|
-
* we use `themePlugins`
|
|
8
|
-
*/
|
|
9
|
-
themePlugins?: DefaultThemePluginsOptions;
|
|
10
|
-
}
|
|
2
|
+
import type { LocaleData } from '@vuepress/shared';
|
|
3
|
+
import type { NavbarConfig, SidebarConfig } from './nav.js';
|
|
11
4
|
export interface DefaultThemePluginsOptions {
|
|
12
5
|
/**
|
|
13
6
|
* Enable @vuepress/plugin-active-header-links or not
|
|
@@ -28,6 +21,10 @@ export interface DefaultThemePluginsOptions {
|
|
|
28
21
|
codeGroup?: boolean;
|
|
29
22
|
codeGroupItem?: boolean;
|
|
30
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Enable @vuepress/plugin-external-link-icon or not
|
|
26
|
+
*/
|
|
27
|
+
externalLinkIcon?: boolean;
|
|
31
28
|
/**
|
|
32
29
|
* Enable @vuepress/plugin-git or not
|
|
33
30
|
*/
|
|
@@ -45,9 +42,21 @@ export interface DefaultThemePluginsOptions {
|
|
|
45
42
|
*/
|
|
46
43
|
prismjs?: boolean;
|
|
47
44
|
}
|
|
48
|
-
export
|
|
49
|
-
export
|
|
45
|
+
export type DefaultThemeLocaleOptions = DefaultThemeData;
|
|
46
|
+
export type DefaultThemeData = ThemeData<DefaultThemeLocaleData>;
|
|
50
47
|
export interface DefaultThemeLocaleData extends LocaleData {
|
|
48
|
+
/**
|
|
49
|
+
* Default color mode
|
|
50
|
+
*
|
|
51
|
+
* @default 'auto'
|
|
52
|
+
*/
|
|
53
|
+
colorMode?: 'auto' | 'dark' | 'light';
|
|
54
|
+
/**
|
|
55
|
+
* Enable color mode switching and display a button in navbar or not
|
|
56
|
+
*
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
colorModeSwitch?: boolean;
|
|
51
60
|
/**
|
|
52
61
|
* Home path of current locale
|
|
53
62
|
*
|
|
@@ -66,6 +75,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
66
75
|
* Logo to display in navbar
|
|
67
76
|
*/
|
|
68
77
|
logo?: null | string;
|
|
78
|
+
/**
|
|
79
|
+
* Navbar logo config for dark mode
|
|
80
|
+
*
|
|
81
|
+
* Logo to display in navbar in dark mode
|
|
82
|
+
*/
|
|
83
|
+
logoDark?: null | string;
|
|
69
84
|
/**
|
|
70
85
|
* Navbar repository config
|
|
71
86
|
*
|
|
@@ -104,6 +119,21 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
104
119
|
* Set to `false` to disable sidebar in current locale
|
|
105
120
|
*/
|
|
106
121
|
sidebar?: 'auto' | false | SidebarConfig;
|
|
122
|
+
/**
|
|
123
|
+
* Sidebar depth
|
|
124
|
+
*
|
|
125
|
+
* - Set to `0` to disable all levels
|
|
126
|
+
* - Set to `1` to include `<h2>`
|
|
127
|
+
* - Set to `2` to include `<h2>` and `<h3>`
|
|
128
|
+
* - ...
|
|
129
|
+
*
|
|
130
|
+
* The max value depends on which headers you have extracted
|
|
131
|
+
* via `markdown.headers.level`.
|
|
132
|
+
*
|
|
133
|
+
* The default value of `markdown.headers.level` is `[2, 3]`,
|
|
134
|
+
* so the default max value of `sidebarDepth` is `2`
|
|
135
|
+
*/
|
|
136
|
+
sidebarDepth?: number;
|
|
107
137
|
/**
|
|
108
138
|
* Page meta - edit link config
|
|
109
139
|
*
|
|
@@ -135,7 +165,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
135
165
|
/**
|
|
136
166
|
* Page meta - edit link config
|
|
137
167
|
*
|
|
138
|
-
* Set this config if the branch of your docs is not '
|
|
168
|
+
* Set this config if the branch of your docs is not 'main'
|
|
139
169
|
*/
|
|
140
170
|
docsBranch?: string;
|
|
141
171
|
/**
|
|
@@ -199,7 +229,15 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
199
229
|
*/
|
|
200
230
|
backToHome?: string;
|
|
201
231
|
/**
|
|
202
|
-
*
|
|
232
|
+
* A11y text for external link icon
|
|
203
233
|
*/
|
|
204
234
|
openInNewWindow?: string;
|
|
235
|
+
/**
|
|
236
|
+
* A11y text for color mode toggle button
|
|
237
|
+
*/
|
|
238
|
+
toggleColorMode?: string;
|
|
239
|
+
/**
|
|
240
|
+
* A11y text for sidebar toggle button
|
|
241
|
+
*/
|
|
242
|
+
toggleSidebar?: string;
|
|
205
243
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
|
-
import type { NavLink, SidebarConfig } from './nav';
|
|
2
|
+
import type { NavLink, SidebarConfig } from './nav.js';
|
|
3
3
|
export interface DefaultThemePageData extends GitPluginPageData {
|
|
4
|
-
filePathRelative: string;
|
|
4
|
+
filePathRelative: string | null;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface DefaultThemePageFrontmatter {
|
|
7
|
+
home?: boolean;
|
|
8
|
+
navbar?: boolean;
|
|
9
|
+
pageClass?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontmatter {
|
|
7
12
|
home: true;
|
|
8
13
|
heroImage?: string;
|
|
14
|
+
heroImageDark?: string;
|
|
9
15
|
heroAlt?: string;
|
|
16
|
+
heroHeight?: number;
|
|
10
17
|
heroText?: string | null;
|
|
11
18
|
tagline?: string | null;
|
|
12
19
|
actions?: {
|
|
@@ -21,12 +28,14 @@ export interface DefaultThemeHomePageFrontmatter {
|
|
|
21
28
|
footer?: string;
|
|
22
29
|
footerHtml?: boolean;
|
|
23
30
|
}
|
|
24
|
-
export interface DefaultThemePageFrontmatter {
|
|
25
|
-
home?:
|
|
31
|
+
export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFrontmatter {
|
|
32
|
+
home?: false;
|
|
26
33
|
editLink?: boolean;
|
|
34
|
+
editLinkPattern?: string;
|
|
27
35
|
lastUpdated?: boolean;
|
|
28
36
|
contributors?: boolean;
|
|
37
|
+
sidebar?: 'auto' | false | SidebarConfig;
|
|
38
|
+
sidebarDepth?: number;
|
|
29
39
|
prev?: string | NavLink;
|
|
30
40
|
next?: string | NavLink;
|
|
31
|
-
sidebar?: 'auto' | false | SidebarConfig;
|
|
32
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/theme-default",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.60",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -17,38 +17,58 @@
|
|
|
17
17
|
"url": "git+https://github.com/vuepress/vuepress-next.git"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"author": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
20
|
+
"author": "meteorlxy",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./lib/node/index.js",
|
|
24
|
+
"./client": "./lib/client/index.js",
|
|
25
|
+
"./components/*": "./lib/client/components/*",
|
|
26
|
+
"./layouts/*": "./lib/client/layouts/*",
|
|
27
|
+
"./styles/*": "./lib/client/styles/*",
|
|
28
|
+
"./templates/*": "./templates/*",
|
|
29
|
+
"./lib/*": "./lib/*",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"main": "./lib/node/index.js",
|
|
33
|
+
"types": "./lib/node/index.d.ts",
|
|
23
34
|
"files": [
|
|
24
|
-
"lib"
|
|
35
|
+
"lib",
|
|
36
|
+
"templates"
|
|
25
37
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc -b tsconfig.build.json",
|
|
28
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
29
|
-
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
30
|
-
},
|
|
31
38
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"@vuepress/
|
|
37
|
-
"@vuepress/
|
|
38
|
-
"@vuepress/plugin-
|
|
39
|
-
"@vuepress/plugin-
|
|
40
|
-
"@vuepress/plugin-
|
|
41
|
-
"@vuepress/plugin-
|
|
42
|
-
"@vuepress/plugin-
|
|
43
|
-
"@vuepress/
|
|
44
|
-
"@vuepress/
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
39
|
+
"@vueuse/core": "^9.9.0",
|
|
40
|
+
"sass": "^1.57.1",
|
|
41
|
+
"vue": "^3.2.45",
|
|
42
|
+
"vue-router": "^4.1.6",
|
|
43
|
+
"@vuepress/client": "2.0.0-beta.60",
|
|
44
|
+
"@vuepress/core": "2.0.0-beta.60",
|
|
45
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.60",
|
|
46
|
+
"@vuepress/plugin-container": "2.0.0-beta.60",
|
|
47
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.60",
|
|
48
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.60",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-beta.60",
|
|
50
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.60",
|
|
51
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.60",
|
|
52
|
+
"@vuepress/plugin-palette": "2.0.0-beta.60",
|
|
53
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.60",
|
|
54
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.60",
|
|
55
|
+
"@vuepress/shared": "2.0.0-beta.60",
|
|
56
|
+
"@vuepress/utils": "2.0.0-beta.60"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"sass-loader": "^13.2.0"
|
|
60
|
+
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"sass-loader": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
49
65
|
},
|
|
50
66
|
"publishConfig": {
|
|
51
67
|
"access": "public"
|
|
52
68
|
},
|
|
53
|
-
"
|
|
54
|
-
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "tsc -b tsconfig.build.json",
|
|
71
|
+
"clean": "rimraf lib *.tsbuildinfo",
|
|
72
|
+
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
73
|
+
}
|
|
74
|
+
}
|