@vuepress/theme-default 2.0.0-beta.9 → 2.0.0-rc.1
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/LICENSE +1 -1
- package/lib/client/components/AutoLink.vue +113 -0
- package/lib/client/components/DropdownTransition.vue +15 -24
- package/lib/client/components/Home.vue +12 -130
- package/lib/client/components/HomeContent.vue +5 -0
- package/lib/client/components/HomeFeatures.vue +22 -0
- package/lib/client/components/HomeFooter.vue +17 -0
- package/lib/client/components/HomeHero.vue +97 -0
- package/lib/client/components/Navbar.vue +60 -95
- package/lib/client/components/NavbarBrand.vue +55 -0
- package/lib/client/components/NavbarDropdown.vue +126 -0
- package/lib/client/components/{NavbarLinks.vue → NavbarItems.vue} +81 -61
- package/lib/client/components/Page.vue +16 -15
- package/lib/client/components/PageMeta.vue +51 -66
- package/lib/client/components/PageNav.vue +61 -64
- package/lib/client/components/Sidebar.vue +12 -32
- 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 +21 -24
- package/lib/client/components/global/Badge.vue +24 -26
- package/lib/client/components/global/CodeGroup.d.ts +5 -4
- package/lib/client/components/global/CodeGroup.js +85 -17
- package/lib/client/components/global/CodeGroupItem.vue +22 -20
- 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 +5 -5
- package/lib/client/composables/index.js +5 -5
- package/lib/client/composables/useDarkMode.d.ts +12 -0
- package/lib/client/composables/useDarkMode.js +57 -0
- package/lib/client/composables/useScrollPromise.js +1 -1
- package/lib/client/composables/useSidebarItems.d.ts +14 -8
- package/lib/client/composables/useSidebarItems.js +49 -48
- package/lib/client/composables/useThemeData.d.ts +2 -2
- package/lib/client/composables/useThemeData.js +1 -1
- package/lib/client/composables/useUpdateDeviceStatus.d.ts +7 -0
- package/lib/client/composables/useUpdateDeviceStatus.js +25 -0
- package/lib/client/config.d.ts +4 -0
- package/lib/client/config.js +44 -0
- package/lib/client/index.d.ts +3 -4
- package/lib/client/index.js +3 -2
- package/lib/client/layouts/Layout.vue +133 -136
- package/lib/client/layouts/NotFound.vue +27 -0
- package/lib/client/shim.d.ts +5 -0
- package/lib/client/styles/{_wrapper.scss → _mixins.scss} +7 -2
- package/lib/client/styles/_variables.module.scss +5 -0
- package/lib/client/styles/_variables.scss +0 -34
- package/lib/client/styles/arrow.scss +4 -6
- package/lib/client/styles/badge.scss +14 -11
- package/lib/client/styles/code-group.scss +10 -10
- package/lib/client/styles/code.scss +33 -46
- package/lib/client/styles/custom-container.scss +82 -18
- package/lib/client/styles/home.scss +32 -24
- package/lib/client/styles/index.scss +4 -4
- package/lib/client/styles/layout.scss +82 -73
- package/lib/client/styles/{dropdown.scss → navbar-dropdown.scss} +36 -50
- package/lib/client/styles/navbar.scss +106 -50
- package/lib/client/styles/normalize.scss +199 -0
- package/lib/client/styles/page.scss +24 -8
- package/lib/client/styles/sidebar.scss +69 -87
- package/lib/client/styles/transitions.scss +13 -4
- package/lib/client/styles/vars-dark.scss +68 -0
- package/lib/client/styles/vars.scss +155 -0
- package/lib/client/utils/getNavLink.d.ts +15 -0
- package/lib/client/utils/getNavLink.js +18 -0
- package/lib/client/utils/getResolveRouteWithRedirect.d.ts +5 -0
- package/lib/client/{composables/useResolveRouteWithRedirect.js → utils/getResolveRouteWithRedirect.js} +4 -6
- package/lib/client/utils/index.d.ts +5 -2
- package/lib/client/utils/index.js +5 -2
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -0
- package/lib/client/utils/isActiveSidebarItem.js +20 -0
- package/lib/client/utils/resolveEditLink.d.ts +2 -2
- package/lib/client/utils/resolveEditLink.js +15 -9
- package/lib/client/utils/resolveRepoType.d.ts +1 -1
- package/lib/client/utils/resolveRepoType.js +4 -2
- package/lib/node/defaultTheme.d.ts +4 -4
- package/lib/node/defaultTheme.js +111 -48
- package/lib/node/index.d.ts +4 -4
- package/lib/node/index.js +5 -17
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +4 -2
- package/lib/node/utils/assignDefaultLocaleOptions.js +13 -13
- package/lib/node/utils/index.d.ts +2 -5
- package/lib/node/utils/index.js +2 -17
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +2 -20
- package/lib/node/utils/resolveContainerPluginOptions.js +4 -66
- package/lib/shared/index.d.ts +3 -3
- package/lib/shared/index.js +3 -15
- package/lib/shared/nav.d.ts +16 -18
- package/lib/shared/nav.js +1 -2
- package/lib/shared/options.d.ts +51 -6
- package/lib/shared/options.js +1 -2
- package/lib/shared/page.d.ts +15 -6
- package/lib/shared/page.js +1 -2
- package/package.json +43 -25
- package/templates/build.html +34 -0
- package/CHANGELOG.md +0 -419
- package/lib/client/clientAppEnhance.d.ts +0 -3
- package/lib/client/clientAppEnhance.js +0 -28
- package/lib/client/clientAppSetup.d.ts +0 -2
- package/lib/client/clientAppSetup.js +0 -11
- package/lib/client/components/DropdownLink.vue +0 -141
- package/lib/client/components/NavLink.vue +0 -115
- package/lib/client/components/SidebarChild.d.ts +0 -6
- package/lib/client/components/SidebarChild.js +0 -91
- package/lib/client/components/global/OutboundLink.vue +0 -30
- package/lib/client/composables/useNavLink.d.ts +0 -9
- package/lib/client/composables/useNavLink.js +0 -15
- package/lib/client/composables/useResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/layouts/404.vue +0 -38
- package/lib/client/styles/_normalize.scss +0 -148
- package/lib/client/styles/plugins.scss +0 -18
- package/lib/client/styles/sr-only.scss +0 -12
- package/lib/node/utils/resolveActiveHeaderLinksPluginOptions.d.ts +0 -6
- package/lib/node/utils/resolveActiveHeaderLinksPluginOptions.js +0 -16
- package/lib/node/utils/resolveGitPluginOptions.d.ts +0 -6
- package/lib/node/utils/resolveGitPluginOptions.js +0 -22
- package/lib/node/utils/resolveMediumZoomPluginOptions.d.ts +0 -6
- package/lib/node/utils/resolveMediumZoomPluginOptions.js +0 -17
package/lib/node/defaultTheme.js
CHANGED
|
@@ -1,54 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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);
|
|
8
16
|
return {
|
|
9
17
|
name: '@vuepress/theme-default',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
},
|
|
15
36
|
plugins: [
|
|
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
|
-
|
|
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 }),
|
|
51
115
|
],
|
|
52
116
|
};
|
|
53
117
|
};
|
|
54
|
-
exports.defaultTheme = defaultTheme;
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultTheme } from './defaultTheme';
|
|
2
|
-
export * from '../shared';
|
|
3
|
-
export * from './defaultTheme';
|
|
4
|
-
export * from './utils';
|
|
1
|
+
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
+
export * from '../shared/index.js';
|
|
3
|
+
export * from './defaultTheme.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
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
|
-
const defaultTheme_1 = require("./defaultTheme");
|
|
14
|
-
__exportStar(require("../shared"), exports);
|
|
15
|
-
__exportStar(require("./defaultTheme"), exports);
|
|
16
|
-
__exportStar(require("./utils"), exports);
|
|
17
|
-
exports.default = defaultTheme_1.defaultTheme;
|
|
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;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { DefaultThemeLocaleOptions } from '../../shared';
|
|
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;
|
|
2
4
|
/**
|
|
3
|
-
* Assign default options
|
|
5
|
+
* Assign default options
|
|
4
6
|
*/
|
|
5
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;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export * from './assignDefaultLocaleOptions';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './resolveContainerPluginOptions';
|
|
4
|
-
export * from './resolveGitPluginOptions';
|
|
5
|
-
export * from './resolveMediumZoomPluginOptions';
|
|
1
|
+
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
+
export * from './resolveContainerPluginOptions.js';
|
package/lib/node/utils/index.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
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
|
+
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
+
export * from './resolveContainerPluginOptions.js';
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
import type { ContainerPluginOptions } from '@vuepress/plugin-container';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultThemeData } from '../../shared/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve options for @vuepress/plugin-container
|
|
5
5
|
*
|
|
6
6
|
* For custom containers default title
|
|
7
7
|
*/
|
|
8
|
-
export declare const resolveContainerPluginOptions: (
|
|
9
|
-
/**
|
|
10
|
-
* Resolve options for @vuepress/plugin-container
|
|
11
|
-
*
|
|
12
|
-
* For details container
|
|
13
|
-
*/
|
|
14
|
-
export declare const resolveContainerPluginOptionsForDetails: (themePlugins: DefaultThemePluginsOptions) => ContainerPluginOptions | boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Resolve options for @vuepress/plugin-container
|
|
17
|
-
*
|
|
18
|
-
* For code-group container
|
|
19
|
-
*/
|
|
20
|
-
export declare const resolveContainerPluginOptionsForCodeGroup: (themePlugins: DefaultThemePluginsOptions) => ContainerPluginOptions | boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Resolve options for @vuepress/plugin-container
|
|
23
|
-
*
|
|
24
|
-
* For code-group-item block
|
|
25
|
-
*/
|
|
26
|
-
export declare const resolveContainerPluginOptionsForCodeGroupItem: (themePlugins: DefaultThemePluginsOptions) => ContainerPluginOptions | boolean;
|
|
8
|
+
export declare const resolveContainerPluginOptions: (localeOptions: DefaultThemeData, type: 'tip' | 'warning' | 'danger') => ContainerPluginOptions;
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveContainerPluginOptionsForCodeGroupItem = exports.resolveContainerPluginOptionsForCodeGroup = exports.resolveContainerPluginOptionsForDetails = exports.resolveContainerPluginOptions = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Resolve options for @vuepress/plugin-container
|
|
6
3
|
*
|
|
7
4
|
* For custom containers default title
|
|
8
5
|
*/
|
|
9
|
-
const resolveContainerPluginOptions = (
|
|
10
|
-
var _a;
|
|
11
|
-
if (((_a = themePlugins === null || themePlugins === void 0 ? void 0 : themePlugins.container) === null || _a === void 0 ? void 0 : _a[type]) === false) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
6
|
+
export const resolveContainerPluginOptions = (localeOptions, type) => {
|
|
14
7
|
const locales = Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
defaultInfo,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
8
|
+
result[key] = {
|
|
9
|
+
defaultInfo: value?.[type] ?? localeOptions[type],
|
|
10
|
+
};
|
|
21
11
|
return result;
|
|
22
12
|
}, {});
|
|
23
13
|
return {
|
|
@@ -25,55 +15,3 @@ const resolveContainerPluginOptions = (themePlugins, localeOptions, type) => {
|
|
|
25
15
|
locales,
|
|
26
16
|
};
|
|
27
17
|
};
|
|
28
|
-
exports.resolveContainerPluginOptions = resolveContainerPluginOptions;
|
|
29
|
-
/**
|
|
30
|
-
* Resolve options for @vuepress/plugin-container
|
|
31
|
-
*
|
|
32
|
-
* For details container
|
|
33
|
-
*/
|
|
34
|
-
const resolveContainerPluginOptionsForDetails = (themePlugins) => {
|
|
35
|
-
var _a;
|
|
36
|
-
if (((_a = themePlugins === null || themePlugins === void 0 ? void 0 : themePlugins.container) === null || _a === void 0 ? void 0 : _a.details) === false) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
type: 'details',
|
|
41
|
-
before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
|
|
42
|
-
after: () => '</details>\n',
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
exports.resolveContainerPluginOptionsForDetails = resolveContainerPluginOptionsForDetails;
|
|
46
|
-
/**
|
|
47
|
-
* Resolve options for @vuepress/plugin-container
|
|
48
|
-
*
|
|
49
|
-
* For code-group container
|
|
50
|
-
*/
|
|
51
|
-
const resolveContainerPluginOptionsForCodeGroup = (themePlugins) => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (((_a = themePlugins === null || themePlugins === void 0 ? void 0 : themePlugins.container) === null || _a === void 0 ? void 0 : _a.codeGroup) === false) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
type: 'code-group',
|
|
58
|
-
before: () => `<CodeGroup>\n`,
|
|
59
|
-
after: () => '</CodeGroup>\n',
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
exports.resolveContainerPluginOptionsForCodeGroup = resolveContainerPluginOptionsForCodeGroup;
|
|
63
|
-
/**
|
|
64
|
-
* Resolve options for @vuepress/plugin-container
|
|
65
|
-
*
|
|
66
|
-
* For code-group-item block
|
|
67
|
-
*/
|
|
68
|
-
const resolveContainerPluginOptionsForCodeGroupItem = (themePlugins) => {
|
|
69
|
-
var _a;
|
|
70
|
-
if (((_a = themePlugins === null || themePlugins === void 0 ? void 0 : themePlugins.container) === null || _a === void 0 ? void 0 : _a.codeGroupItem) === false) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
type: 'code-group-item',
|
|
75
|
-
before: (info) => `<CodeGroupItem title="${info}">\n`,
|
|
76
|
-
after: () => '</CodeGroupItem>\n',
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
exports.resolveContainerPluginOptionsForCodeGroupItem = resolveContainerPluginOptionsForCodeGroupItem;
|
package/lib/shared/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './nav';
|
|
2
|
-
export * from './options';
|
|
3
|
-
export * from './page';
|
|
1
|
+
export * from './nav.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './page.js';
|
package/lib/shared/index.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
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("./nav"), exports);
|
|
14
|
-
__exportStar(require("./options"), exports);
|
|
15
|
-
__exportStar(require("./page"), exports);
|
|
1
|
+
export * from './nav.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './page.js';
|
package/lib/shared/nav.d.ts
CHANGED
|
@@ -12,33 +12,31 @@ export interface NavGroup<T> extends NavItem {
|
|
|
12
12
|
children: T[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Props for `<
|
|
15
|
+
* Props for `<AutoLink>`
|
|
16
16
|
*/
|
|
17
17
|
export interface NavLink extends NavItem {
|
|
18
18
|
link: string;
|
|
19
19
|
rel?: string;
|
|
20
20
|
target?: string;
|
|
21
|
+
activeMatch?: string;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Navbar types
|
|
24
25
|
*/
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
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>;
|
|
29
30
|
/**
|
|
30
31
|
* Sidebar types
|
|
31
32
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
isGroup?: boolean;
|
|
43
|
-
children?: ResolvedSidebarItem[];
|
|
44
|
-
}
|
|
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
|
+
};
|
package/lib/shared/nav.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { LocaleData } from '@vuepress/shared';
|
|
2
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
3
|
-
import type {
|
|
2
|
+
import type { LocaleData } from 'vuepress/shared';
|
|
3
|
+
import type { NavbarConfig, SidebarConfig } from './nav.js';
|
|
4
4
|
export interface DefaultThemePluginsOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Enable @vuepress/plugin-active-header-links or not
|
|
@@ -21,6 +21,10 @@ export interface DefaultThemePluginsOptions {
|
|
|
21
21
|
codeGroup?: boolean;
|
|
22
22
|
codeGroupItem?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Enable @vuepress/plugin-external-link-icon or not
|
|
26
|
+
*/
|
|
27
|
+
externalLinkIcon?: boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Enable @vuepress/plugin-git or not
|
|
26
30
|
*/
|
|
@@ -38,9 +42,21 @@ export interface DefaultThemePluginsOptions {
|
|
|
38
42
|
*/
|
|
39
43
|
prismjs?: boolean;
|
|
40
44
|
}
|
|
41
|
-
export
|
|
42
|
-
export
|
|
45
|
+
export type DefaultThemeLocaleOptions = DefaultThemeData;
|
|
46
|
+
export type DefaultThemeData = ThemeData<DefaultThemeLocaleData>;
|
|
43
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;
|
|
44
60
|
/**
|
|
45
61
|
* Home path of current locale
|
|
46
62
|
*
|
|
@@ -59,6 +75,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
59
75
|
* Logo to display in navbar
|
|
60
76
|
*/
|
|
61
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;
|
|
62
84
|
/**
|
|
63
85
|
* Navbar repository config
|
|
64
86
|
*
|
|
@@ -97,6 +119,21 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
97
119
|
* Set to `false` to disable sidebar in current locale
|
|
98
120
|
*/
|
|
99
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;
|
|
100
137
|
/**
|
|
101
138
|
* Page meta - edit link config
|
|
102
139
|
*
|
|
@@ -128,7 +165,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
128
165
|
/**
|
|
129
166
|
* Page meta - edit link config
|
|
130
167
|
*
|
|
131
|
-
* Set this config if the branch of your docs is not '
|
|
168
|
+
* Set this config if the branch of your docs is not 'main'
|
|
132
169
|
*/
|
|
133
170
|
docsBranch?: string;
|
|
134
171
|
/**
|
|
@@ -192,7 +229,15 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
192
229
|
*/
|
|
193
230
|
backToHome?: string;
|
|
194
231
|
/**
|
|
195
|
-
*
|
|
232
|
+
* A11y text for external link icon
|
|
196
233
|
*/
|
|
197
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;
|
|
198
243
|
}
|
package/lib/shared/options.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -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
|
}
|
package/lib/shared/page.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|