@vuepress/theme-default 2.0.0-rc.1 → 2.0.0-rc.101
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/VPAutoLink.vue +32 -0
- package/lib/client/components/VPDarkIcon.vue +8 -0
- package/lib/client/components/VPDropdownTransition.vue +43 -0
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPFadeSlideYTransition.vue +23 -0
- package/lib/client/components/VPHome.vue +37 -0
- package/lib/client/components/VPHomeFeatures.vue +65 -0
- package/lib/client/components/VPHomeFooter.vue +30 -0
- package/lib/client/components/VPHomeHero.vue +186 -0
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +138 -0
- package/lib/client/components/VPNavbarBrand.vue +89 -0
- package/lib/client/components/VPNavbarDropdown.vue +330 -0
- package/lib/client/components/VPNavbarItems.vue +111 -0
- package/lib/client/components/VPPage.vue +69 -0
- package/lib/client/components/VPPageMeta.vue +139 -0
- package/lib/client/components/VPPageNav.vue +123 -0
- package/lib/client/components/VPSidebar.vue +120 -0
- package/lib/client/components/VPSidebarItem.vue +189 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +27 -7
- package/lib/client/components/VPToggleColorModeButton.vue +55 -0
- package/lib/client/components/VPToggleSidebarButton.vue +92 -0
- package/lib/client/components/global/Badge.vue +84 -18
- package/lib/client/components/global/index.d.ts +1 -3
- package/lib/client/components/global/index.js +1 -3
- package/lib/client/composables/index.d.ts +7 -1
- package/lib/client/composables/index.js +7 -1
- package/lib/client/composables/useDarkMode.d.ts +0 -1
- package/lib/client/composables/useDarkMode.js +19 -16
- package/lib/client/composables/useData.d.ts +8 -0
- package/lib/client/composables/useData.js +7 -0
- package/lib/client/composables/useEditLink.d.ts +3 -0
- package/lib/client/composables/useEditLink.js +28 -0
- package/lib/client/composables/useHeaders.d.ts +9 -0
- package/lib/client/composables/useHeaders.js +38 -0
- package/lib/client/composables/useNavbarConfig.d.ts +3 -0
- package/lib/client/composables/useNavbarConfig.js +29 -0
- package/lib/client/composables/useNavbarRepo.d.ts +6 -0
- package/lib/client/composables/useNavbarRepo.js +38 -0
- package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
- package/lib/client/composables/useNavbarSelectLanguage.js +55 -0
- package/lib/client/composables/useNavigate.d.ts +1 -0
- package/lib/client/composables/useNavigate.js +22 -0
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +90 -0
- package/lib/client/composables/useScrollPromise.js +3 -1
- package/lib/client/composables/useSidebarItems.d.ts +21 -21
- package/lib/client/composables/useSidebarItems.js +97 -84
- package/lib/client/composables/useUpdateDeviceStatus.d.ts +1 -1
- package/lib/client/composables/useUpdateDeviceStatus.js +10 -5
- package/lib/client/config.d.ts +3 -2
- package/lib/client/config.js +11 -22
- package/lib/client/index.d.ts +2 -1
- package/lib/client/index.js +0 -1
- package/lib/client/layouts/Layout.vue +128 -56
- package/lib/client/layouts/NotFound.vue +25 -11
- package/lib/client/shim.d.ts +6 -5
- package/lib/client/styles/_mixins.scss +4 -4
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +2 -1
- package/lib/client/styles/arrow.scss +24 -22
- package/lib/client/styles/code-group.scss +34 -30
- package/lib/client/styles/content/code.scss +23 -0
- package/lib/client/styles/content/index.scss +3 -0
- package/lib/client/styles/content/normalize.scss +39 -0
- package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
- package/lib/client/styles/external-link-icon.scss +36 -0
- package/lib/client/styles/index.scss +3 -13
- package/lib/client/styles/layout.scss +5 -197
- package/lib/client/styles/normalize.scss +1 -193
- package/lib/client/styles/plugins.scss +28 -0
- package/lib/client/styles/vars-dark.scss +20 -58
- package/lib/client/styles/vars.scss +54 -129
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/index.d.ts +2 -2
- package/lib/client/utils/index.js +2 -2
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
- package/lib/client/utils/isActiveSidebarItem.js +1 -1
- package/lib/client/utils/resolveAutoLink.d.ts +9 -0
- package/lib/client/utils/resolveAutoLink.js +17 -0
- package/lib/client/utils/resolveEditLink.d.ts +3 -3
- package/lib/client/utils/resolveEditLink.js +3 -3
- package/lib/client/utils/resolvePrefix.d.ts +1 -0
- package/lib/client/utils/resolvePrefix.js +4 -0
- package/lib/client/utils/resolveRepoType.d.ts +1 -1
- package/lib/client/utils/resolveRepoType.js +4 -4
- package/lib/node/defaultTheme.d.ts +7 -2
- package/lib/node/defaultTheme.js +82 -59
- package/lib/node/index.d.ts +2 -3
- package/lib/node/index.js +0 -3
- package/lib/node/typings.d.ts +59 -0
- package/lib/node/typings.js +1 -0
- package/lib/node/utils/assignDefaultLocaleOptions.js +3 -8
- package/lib/node/utils/index.d.ts +1 -1
- package/lib/node/utils/index.js +1 -1
- package/lib/node/utils/resolveMarkdownHintLocales.d.ts +9 -0
- package/lib/node/utils/resolveMarkdownHintLocales.js +19 -0
- package/lib/shared/index.d.ts +5 -3
- package/lib/shared/index.js +1 -3
- package/lib/shared/nav.d.ts +19 -29
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +48 -47
- package/lib/shared/page.d.ts +9 -6
- package/lib/shared/sidebar.d.ts +26 -0
- package/lib/shared/sidebar.js +1 -0
- package/package.json +32 -25
- package/templates/build.html +23 -14
- package/lib/client/components/AutoLink.vue +0 -113
- package/lib/client/components/DropdownTransition.vue +0 -25
- package/lib/client/components/Home.vue +0 -15
- package/lib/client/components/HomeContent.vue +0 -5
- package/lib/client/components/HomeFeatures.vue +0 -22
- package/lib/client/components/HomeFooter.vue +0 -17
- package/lib/client/components/HomeHero.vue +0 -97
- package/lib/client/components/Navbar.vue +0 -79
- package/lib/client/components/NavbarBrand.vue +0 -55
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -194
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -124
- package/lib/client/components/PageNav.vue +0 -113
- package/lib/client/components/Sidebar.vue +0 -18
- package/lib/client/components/SidebarItem.vue +0 -87
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/components/global/CodeGroup.d.ts +0 -6
- package/lib/client/components/global/CodeGroup.js +0 -120
- package/lib/client/components/global/CodeGroupItem.vue +0 -27
- package/lib/client/composables/useThemeData.d.ts +0 -4
- package/lib/client/composables/useThemeData.js +0 -3
- package/lib/client/styles/badge.scss +0 -36
- package/lib/client/styles/code.scss +0 -263
- package/lib/client/styles/custom-container.scss +0 -142
- package/lib/client/styles/home.scss +0 -168
- package/lib/client/styles/navbar-dropdown.scss +0 -183
- package/lib/client/styles/navbar.scss +0 -197
- package/lib/client/styles/page.scss +0 -87
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/transitions.scss +0 -22
- package/lib/client/utils/getNavLink.d.ts +0 -15
- package/lib/client/utils/getNavLink.js +0 -18
- package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +0 -8
- package/lib/node/utils/resolveContainerPluginOptions.js +0 -17
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { Theme } from 'vuepress/core';
|
|
2
|
-
import type { DefaultThemeLocaleOptions
|
|
2
|
+
import type { DefaultThemeLocaleOptions } from '../shared/index.js';
|
|
3
|
+
import type { DefaultThemePluginsOptions } from './typings.js';
|
|
3
4
|
export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
|
|
5
|
+
/**
|
|
6
|
+
* deployed hostname
|
|
7
|
+
*/
|
|
8
|
+
hostname?: string;
|
|
4
9
|
/**
|
|
5
10
|
* To avoid confusion with the root `plugins` option,
|
|
6
11
|
* we use `themePlugins`
|
|
7
12
|
*/
|
|
8
13
|
themePlugins?: DefaultThemePluginsOptions;
|
|
9
14
|
}
|
|
10
|
-
export declare const defaultTheme: ({ themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
|
|
15
|
+
export declare const defaultTheme: ({ hostname, themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { addViteOptimizeDepsExclude } from '@vuepress/helper';
|
|
1
2
|
import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
|
|
2
3
|
import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
|
|
3
|
-
import {
|
|
4
|
-
import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon';
|
|
4
|
+
import { copyCodePlugin } from '@vuepress/plugin-copy-code';
|
|
5
5
|
import { gitPlugin } from '@vuepress/plugin-git';
|
|
6
|
+
import { linksCheckPlugin } from '@vuepress/plugin-links-check';
|
|
7
|
+
import { markdownHintPlugin } from '@vuepress/plugin-markdown-hint';
|
|
8
|
+
import { markdownTabPlugin } from '@vuepress/plugin-markdown-tab';
|
|
6
9
|
import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
|
|
7
10
|
import { nprogressPlugin } from '@vuepress/plugin-nprogress';
|
|
8
11
|
import { palettePlugin } from '@vuepress/plugin-palette';
|
|
9
12
|
import { prismjsPlugin } from '@vuepress/plugin-prismjs';
|
|
13
|
+
import { seoPlugin } from '@vuepress/plugin-seo';
|
|
14
|
+
import { sitemapPlugin } from '@vuepress/plugin-sitemap';
|
|
10
15
|
import { themeDataPlugin } from '@vuepress/plugin-theme-data';
|
|
16
|
+
import { isPlainObject } from 'vuepress/shared';
|
|
11
17
|
import { fs, getDirname, path } from 'vuepress/utils';
|
|
12
|
-
import { assignDefaultLocaleOptions,
|
|
13
|
-
const __dirname = getDirname(import.meta.url);
|
|
14
|
-
export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
18
|
+
import { assignDefaultLocaleOptions, resolveMarkdownHintLocales, } from './utils/index.js';
|
|
19
|
+
const __dirname = import.meta.dirname || getDirname(import.meta.url);
|
|
20
|
+
export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } = {}) => {
|
|
15
21
|
assignDefaultLocaleOptions(localeOptions);
|
|
16
22
|
return {
|
|
17
23
|
name: '@vuepress/theme-default',
|
|
@@ -25,8 +31,28 @@ export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
25
31
|
`@theme/${file}`,
|
|
26
32
|
path.resolve(__dirname, '../client/components', file),
|
|
27
33
|
])),
|
|
34
|
+
// use alias to make all composables replaceable
|
|
35
|
+
...Object.fromEntries(fs
|
|
36
|
+
.readdirSync(path.resolve(__dirname, '../client/composables'))
|
|
37
|
+
.filter((file) => file.endsWith('.js'))
|
|
38
|
+
.map((file) => [
|
|
39
|
+
`@theme/${file.substring(0, file.length - 3)}`,
|
|
40
|
+
path.resolve(__dirname, '../client/composables', file),
|
|
41
|
+
])),
|
|
42
|
+
// use alias to make all utils replaceable
|
|
43
|
+
...Object.fromEntries(fs
|
|
44
|
+
.readdirSync(path.resolve(__dirname, '../client/utils'))
|
|
45
|
+
.filter((file) => file.endsWith('.js'))
|
|
46
|
+
.map((file) => [
|
|
47
|
+
`@theme/${file.substring(0, file.length - 3)}`,
|
|
48
|
+
path.resolve(__dirname, '../client/utils', file),
|
|
49
|
+
])),
|
|
28
50
|
},
|
|
29
51
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
52
|
+
extendsBundlerOptions: (bundlerOptions, app) => {
|
|
53
|
+
// ensure theme alias is not optimized by Vite
|
|
54
|
+
addViteOptimizeDepsExclude(bundlerOptions, app, '@theme');
|
|
55
|
+
},
|
|
30
56
|
extendsPage: (page) => {
|
|
31
57
|
// save relative file path into page data to generate edit link
|
|
32
58
|
page.data.filePathRelative = page.filePathRelative;
|
|
@@ -35,81 +61,78 @@ export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
35
61
|
},
|
|
36
62
|
plugins: [
|
|
37
63
|
// @vuepress/plugin-active-header-link
|
|
38
|
-
themePlugins.activeHeaderLinks
|
|
64
|
+
(themePlugins.activeHeaderLinks ?? true)
|
|
39
65
|
? activeHeaderLinksPlugin({
|
|
40
|
-
headerLinkSelector: 'a.sidebar-item',
|
|
41
|
-
headerAnchorSelector: '.header-anchor',
|
|
42
66
|
// should greater than page transition duration
|
|
43
67
|
delay: 300,
|
|
44
68
|
})
|
|
45
69
|
: [],
|
|
46
70
|
// @vuepress/plugin-back-to-top
|
|
47
|
-
themePlugins.backToTop
|
|
48
|
-
|
|
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
|
+
(themePlugins.backToTop ?? true)
|
|
72
|
+
? backToTopPlugin(isPlainObject(themePlugins.backToTop) ? themePlugins.backToTop : {})
|
|
71
73
|
: [],
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
// @vuepress/plugin-copy-code
|
|
75
|
+
(themePlugins.copyCode ?? true)
|
|
76
|
+
? copyCodePlugin({
|
|
77
|
+
...(isPlainObject(themePlugins.copyCode)
|
|
78
|
+
? themePlugins.copyCode
|
|
79
|
+
: {}),
|
|
77
80
|
})
|
|
78
81
|
: [],
|
|
79
|
-
// @vuepress/plugin-
|
|
80
|
-
themePlugins.
|
|
81
|
-
?
|
|
82
|
-
locales:
|
|
83
|
-
|
|
84
|
-
openInNewWindow: value.openInNewWindow ?? localeOptions.openInNewWindow,
|
|
85
|
-
};
|
|
86
|
-
return result;
|
|
87
|
-
}, {}),
|
|
82
|
+
// @vuepress/plugin-markdown-container
|
|
83
|
+
(themePlugins.hint ?? true)
|
|
84
|
+
? markdownHintPlugin({
|
|
85
|
+
locales: resolveMarkdownHintLocales(localeOptions),
|
|
86
|
+
...(isPlainObject(themePlugins.hint) ? themePlugins.hint : {}),
|
|
88
87
|
})
|
|
89
88
|
: [],
|
|
90
89
|
// @vuepress/plugin-git
|
|
91
|
-
themePlugins.git
|
|
90
|
+
(themePlugins.git ?? true)
|
|
92
91
|
? gitPlugin({
|
|
93
92
|
createdTime: false,
|
|
94
|
-
updatedTime: localeOptions.lastUpdated
|
|
95
|
-
|
|
93
|
+
updatedTime: localeOptions.lastUpdated ?? true,
|
|
94
|
+
changelog: { repoUrl: localeOptions.repo || '' },
|
|
95
|
+
...(isPlainObject(themePlugins.git) ? themePlugins.git : {}),
|
|
96
96
|
})
|
|
97
97
|
: [],
|
|
98
|
-
// @vuepress/plugin-
|
|
99
|
-
themePlugins.
|
|
100
|
-
?
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// should greater than page transition duration
|
|
104
|
-
delay: 300,
|
|
105
|
-
})
|
|
98
|
+
// @vuepress/plugin-links-check
|
|
99
|
+
(themePlugins.linksCheck ?? true)
|
|
100
|
+
? linksCheckPlugin(isPlainObject(themePlugins.linksCheck)
|
|
101
|
+
? themePlugins.linksCheck
|
|
102
|
+
: {})
|
|
106
103
|
: [],
|
|
104
|
+
// @vuepress/plugin-medium-zoom
|
|
105
|
+
(themePlugins.mediumZoom ?? true) ? mediumZoomPlugin() : [],
|
|
107
106
|
// @vuepress/plugin-nprogress
|
|
108
|
-
themePlugins.nprogress
|
|
107
|
+
(themePlugins.nprogress ?? true) ? nprogressPlugin() : [],
|
|
109
108
|
// @vuepress/plugin-palette
|
|
110
109
|
palettePlugin({ preset: 'sass' }),
|
|
111
110
|
// @vuepress/plugin-prismjs
|
|
112
|
-
themePlugins.prismjs
|
|
111
|
+
(themePlugins.prismjs ?? true)
|
|
112
|
+
? prismjsPlugin(isPlainObject(themePlugins.prismjs) ? themePlugins.prismjs : {})
|
|
113
|
+
: [],
|
|
114
|
+
// @vuepress/plugin-seo
|
|
115
|
+
hostname && (themePlugins.seo ?? true)
|
|
116
|
+
? seoPlugin({
|
|
117
|
+
hostname,
|
|
118
|
+
...(isPlainObject(themePlugins.seo) ? themePlugins.seo : {}),
|
|
119
|
+
})
|
|
120
|
+
: [],
|
|
121
|
+
// @vuepress/plugin-sitemap
|
|
122
|
+
hostname && (themePlugins.sitemap ?? true)
|
|
123
|
+
? sitemapPlugin({
|
|
124
|
+
hostname,
|
|
125
|
+
...(isPlainObject(themePlugins.sitemap)
|
|
126
|
+
? themePlugins.sitemap
|
|
127
|
+
: {}),
|
|
128
|
+
})
|
|
129
|
+
: [],
|
|
130
|
+
// @vuepress/plugin-markdown-tab
|
|
131
|
+
(themePlugins.tab ?? true)
|
|
132
|
+
? markdownTabPlugin(isPlainObject(themePlugins.tab)
|
|
133
|
+
? themePlugins.tab
|
|
134
|
+
: { codeTabs: true, tabs: true })
|
|
135
|
+
: [],
|
|
113
136
|
// @vuepress/plugin-theme-data
|
|
114
137
|
themeDataPlugin({ themeData: localeOptions }),
|
|
115
138
|
],
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
-
export * from '../shared/index.js';
|
|
3
1
|
export * from './defaultTheme.js';
|
|
2
|
+
export type * from './typings.js';
|
|
4
3
|
export * from './utils/index.js';
|
|
5
|
-
export
|
|
4
|
+
export type * from '../shared/index.js';
|
package/lib/node/index.js
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { BackToTopPluginOptions } from '@vuepress/plugin-back-to-top';
|
|
2
|
+
import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
|
|
3
|
+
import type { GitPluginOptions } from '@vuepress/plugin-git';
|
|
4
|
+
import type { LinksCheckPluginOptions } from '@vuepress/plugin-links-check';
|
|
5
|
+
import type { MarkdownHintPluginOptions } from '@vuepress/plugin-markdown-hint';
|
|
6
|
+
import type { MarkdownTabPluginOptions } from '@vuepress/plugin-markdown-tab';
|
|
7
|
+
import type { PrismjsPluginOptions } from '@vuepress/plugin-prismjs';
|
|
8
|
+
import type { SeoPluginOptions } from '@vuepress/plugin-seo';
|
|
9
|
+
import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
|
|
10
|
+
export interface DefaultThemePluginsOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Enable @vuepress/plugin-active-header-links or not
|
|
13
|
+
*/
|
|
14
|
+
activeHeaderLinks?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Enable @vuepress/plugin-back-to-top or not
|
|
17
|
+
*/
|
|
18
|
+
backToTop?: BackToTopPluginOptions | boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Enable @vuepress/plugin-copy-code or not
|
|
21
|
+
*/
|
|
22
|
+
copyCode?: CopyCodePluginOptions | boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Enable @vuepress/plugin-git or not
|
|
25
|
+
*/
|
|
26
|
+
git?: GitPluginOptions | boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enable @vuepress/plugin-markdown-hint or not
|
|
29
|
+
*/
|
|
30
|
+
hint?: MarkdownHintPluginOptions | boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Enable @vuepress/plugin-links-check or not
|
|
33
|
+
*/
|
|
34
|
+
linksCheck?: LinksCheckPluginOptions | boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Enable @vuepress/plugin-medium-zoom or not
|
|
37
|
+
*/
|
|
38
|
+
mediumZoom?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Enable @vuepress/plugin-nprogress or not
|
|
41
|
+
*/
|
|
42
|
+
nprogress?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Enable @vuepress/plugin-prismjs or not
|
|
45
|
+
*/
|
|
46
|
+
prismjs?: PrismjsPluginOptions | boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Enable @vuepress/plugin-seo or not
|
|
49
|
+
*/
|
|
50
|
+
seo?: Partial<SeoPluginOptions> | boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Enable @vuepress/plugin-sitemap or not
|
|
53
|
+
*/
|
|
54
|
+
sitemap?: Partial<SitemapPluginOptions> | boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Enable @vuepress/plugin-markdown-tab or not
|
|
57
|
+
*/
|
|
58
|
+
tab?: MarkdownTabPluginOptions | boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,13 +9,12 @@ export const DEFAULT_LOCALE_OPTIONS = {
|
|
|
9
9
|
selectLanguageText: 'Languages',
|
|
10
10
|
selectLanguageAriaLabel: 'Select language',
|
|
11
11
|
// sidebar
|
|
12
|
-
sidebar: '
|
|
12
|
+
sidebar: 'heading',
|
|
13
13
|
sidebarDepth: 2,
|
|
14
14
|
// page meta
|
|
15
15
|
editLink: true,
|
|
16
16
|
editLinkText: 'Edit this page',
|
|
17
17
|
lastUpdated: true,
|
|
18
|
-
lastUpdatedText: 'Last Updated',
|
|
19
18
|
contributors: true,
|
|
20
19
|
contributorsText: 'Contributors',
|
|
21
20
|
// 404 page messages
|
|
@@ -39,16 +38,12 @@ export const DEFAULT_LOCALE_DATA = {
|
|
|
39
38
|
* Assign default options
|
|
40
39
|
*/
|
|
41
40
|
export const assignDefaultLocaleOptions = (localeOptions) => {
|
|
42
|
-
|
|
43
|
-
localeOptions.locales = {};
|
|
44
|
-
}
|
|
45
|
-
if (!localeOptions.locales['/']) {
|
|
46
|
-
localeOptions.locales['/'] = {};
|
|
47
|
-
}
|
|
41
|
+
localeOptions.locales ??= {};
|
|
48
42
|
Object.assign(localeOptions, {
|
|
49
43
|
...DEFAULT_LOCALE_OPTIONS,
|
|
50
44
|
...localeOptions,
|
|
51
45
|
});
|
|
46
|
+
localeOptions.locales['/'] ??= {};
|
|
52
47
|
Object.assign(localeOptions.locales['/'], {
|
|
53
48
|
...DEFAULT_LOCALE_DATA,
|
|
54
49
|
...localeOptions.locales['/'],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './resolveMarkdownHintLocales.js';
|
package/lib/node/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './resolveMarkdownHintLocales.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MarkdownHintPluginLocaleData } from '@vuepress/plugin-markdown-hint';
|
|
2
|
+
import type { LocaleConfig } from 'vuepress/shared';
|
|
3
|
+
import type { DefaultThemeData } from '../../shared/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve options for @vuepress/plugin-markdown-container
|
|
6
|
+
*
|
|
7
|
+
* For custom containers default title
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolveMarkdownHintLocales: (localeOptions: DefaultThemeData) => LocaleConfig<MarkdownHintPluginLocaleData>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve options for @vuepress/plugin-markdown-container
|
|
3
|
+
*
|
|
4
|
+
* For custom containers default title
|
|
5
|
+
*/
|
|
6
|
+
export const resolveMarkdownHintLocales = (localeOptions) => Object.entries(localeOptions.locales ?? {}).reduce((result, [key, value]) => {
|
|
7
|
+
result[key] = {};
|
|
8
|
+
if (value.tip)
|
|
9
|
+
result[key].tip = value.tip;
|
|
10
|
+
if (value.warning)
|
|
11
|
+
result[key].warning = value.warning;
|
|
12
|
+
if (value.danger)
|
|
13
|
+
result[key].caution = value.danger;
|
|
14
|
+
if (value.important)
|
|
15
|
+
result[key].important = value.important;
|
|
16
|
+
if (value.note)
|
|
17
|
+
result[key].note = value.note;
|
|
18
|
+
return result;
|
|
19
|
+
}, {});
|
package/lib/shared/index.d.ts
CHANGED
package/lib/shared/index.js
CHANGED
package/lib/shared/nav.d.ts
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base nav item, displayed as text
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface NavItemOptions {
|
|
5
5
|
text: string;
|
|
6
6
|
ariaLabel?: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Options for `<AutoLink>`
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Props for `<AutoLink>`
|
|
16
|
-
*/
|
|
17
|
-
export interface NavLink extends NavItem {
|
|
11
|
+
export interface AutoLinkOptions extends NavItemOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Link of item
|
|
14
|
+
*/
|
|
18
15
|
link: string;
|
|
16
|
+
/**
|
|
17
|
+
* Rel of `<a>` tag
|
|
18
|
+
*/
|
|
19
19
|
rel?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Target of `<a>` tag
|
|
22
|
+
*/
|
|
20
23
|
target?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Regexp mode to be active
|
|
26
|
+
*/
|
|
21
27
|
activeMatch?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether it's active only when exact match
|
|
30
|
+
*/
|
|
31
|
+
exact?: boolean;
|
|
22
32
|
}
|
|
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,21 @@
|
|
|
1
|
+
import type { AutoLinkOptions, NavItemOptions } from './nav.js';
|
|
2
|
+
/**
|
|
3
|
+
* Base nav group, has nav items children
|
|
4
|
+
*/
|
|
5
|
+
export interface NavGroup<T> extends NavItemOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Link prefix of current group
|
|
8
|
+
*/
|
|
9
|
+
prefix?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Link of current group
|
|
12
|
+
*/
|
|
13
|
+
link?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Children of current group
|
|
16
|
+
*/
|
|
17
|
+
children: T[];
|
|
18
|
+
}
|
|
19
|
+
export type NavbarLinkOptions = AutoLinkOptions | string;
|
|
20
|
+
export type NavbarGroupOptions = NavGroup<NavbarLinkOptions | NavGroup<NavbarLinkOptions>>;
|
|
21
|
+
export type NavbarOptions = (NavbarGroupOptions | NavbarLinkOptions)[] | false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -1,47 +1,7 @@
|
|
|
1
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
2
2
|
import type { LocaleData } from 'vuepress/shared';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Enable @vuepress/plugin-active-header-links or not
|
|
7
|
-
*/
|
|
8
|
-
activeHeaderLinks?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Enable @vuepress/plugin-back-to-top or not
|
|
11
|
-
*/
|
|
12
|
-
backToTop?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Enable @vuepress/plugin-container or not
|
|
15
|
-
*/
|
|
16
|
-
container?: {
|
|
17
|
-
tip?: boolean;
|
|
18
|
-
warning?: boolean;
|
|
19
|
-
danger?: boolean;
|
|
20
|
-
details?: boolean;
|
|
21
|
-
codeGroup?: boolean;
|
|
22
|
-
codeGroupItem?: boolean;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Enable @vuepress/plugin-external-link-icon or not
|
|
26
|
-
*/
|
|
27
|
-
externalLinkIcon?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Enable @vuepress/plugin-git or not
|
|
30
|
-
*/
|
|
31
|
-
git?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Enable @vuepress/plugin-medium-zoom or not
|
|
34
|
-
*/
|
|
35
|
-
mediumZoom?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Enable @vuepress/plugin-nprogress or not
|
|
38
|
-
*/
|
|
39
|
-
nprogress?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Enable @vuepress/plugin-prismjs or not
|
|
42
|
-
*/
|
|
43
|
-
prismjs?: boolean;
|
|
44
|
-
}
|
|
3
|
+
import type { NavbarOptions } from './navbar.js';
|
|
4
|
+
import type { SidebarOptions } from './sidebar.js';
|
|
45
5
|
export type DefaultThemeLocaleOptions = DefaultThemeData;
|
|
46
6
|
export type DefaultThemeData = ThemeData<DefaultThemeLocaleData>;
|
|
47
7
|
export interface DefaultThemeLocaleData extends LocaleData {
|
|
@@ -57,6 +17,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
57
17
|
* @default true
|
|
58
18
|
*/
|
|
59
19
|
colorModeSwitch?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether show external link icon
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
externalLinkIcon?: boolean;
|
|
60
26
|
/**
|
|
61
27
|
* Home path of current locale
|
|
62
28
|
*
|
|
@@ -68,25 +34,40 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
68
34
|
*
|
|
69
35
|
* Set to `false` to disable navbar in current locale
|
|
70
36
|
*/
|
|
71
|
-
navbar?:
|
|
37
|
+
navbar?: NavbarOptions | false;
|
|
38
|
+
/**
|
|
39
|
+
* Navbar label used for screen readers using the `aria-label` attribute
|
|
40
|
+
*/
|
|
41
|
+
navbarLabel?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Page navbar label used for screen readers using the `aria-label` attribute
|
|
44
|
+
*/
|
|
45
|
+
pageNavbarLabel?: string | null;
|
|
72
46
|
/**
|
|
73
47
|
* Navbar logo config
|
|
74
48
|
*
|
|
75
49
|
* Logo to display in navbar
|
|
76
50
|
*/
|
|
77
|
-
logo?:
|
|
51
|
+
logo?: string | null;
|
|
78
52
|
/**
|
|
79
53
|
* Navbar logo config for dark mode
|
|
80
54
|
*
|
|
81
55
|
* Logo to display in navbar in dark mode
|
|
82
56
|
*/
|
|
83
|
-
logoDark?:
|
|
57
|
+
logoDark?: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* The alt text of navbar logo.
|
|
60
|
+
* Defaults to the site title if not specified.
|
|
61
|
+
* If the value is the same as the site title, the site title rendered in the navbar will be
|
|
62
|
+
* hidden from screen readers to avoid duplication.
|
|
63
|
+
*/
|
|
64
|
+
logoAlt?: string | null;
|
|
84
65
|
/**
|
|
85
66
|
* Navbar repository config
|
|
86
67
|
*
|
|
87
68
|
* Used for the repository link of navbar
|
|
88
69
|
*/
|
|
89
|
-
repo?:
|
|
70
|
+
repo?: string | null;
|
|
90
71
|
/**
|
|
91
72
|
* Navbar repository config
|
|
92
73
|
*
|
|
@@ -118,7 +99,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
118
99
|
*
|
|
119
100
|
* Set to `false` to disable sidebar in current locale
|
|
120
101
|
*/
|
|
121
|
-
sidebar?:
|
|
102
|
+
sidebar?: SidebarOptions | false;
|
|
122
103
|
/**
|
|
123
104
|
* Sidebar depth
|
|
124
105
|
*
|
|
@@ -216,6 +197,18 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
216
197
|
* Default title of DANGER custom block
|
|
217
198
|
*/
|
|
218
199
|
danger?: string;
|
|
200
|
+
/**
|
|
201
|
+
* Custom block config
|
|
202
|
+
*
|
|
203
|
+
* Default title of IMPORTANT custom block
|
|
204
|
+
*/
|
|
205
|
+
important?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Custom block config
|
|
208
|
+
*
|
|
209
|
+
* Default title of NOTE custom block
|
|
210
|
+
*/
|
|
211
|
+
note?: string;
|
|
219
212
|
/**
|
|
220
213
|
* 404 page config
|
|
221
214
|
*
|
|
@@ -240,4 +233,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
240
233
|
* A11y text for sidebar toggle button
|
|
241
234
|
*/
|
|
242
235
|
toggleSidebar?: string;
|
|
236
|
+
/**
|
|
237
|
+
* text for prev link
|
|
238
|
+
*/
|
|
239
|
+
prev?: string | false;
|
|
240
|
+
/**
|
|
241
|
+
* text for next link
|
|
242
|
+
*/
|
|
243
|
+
next?: string | false;
|
|
243
244
|
}
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { PageFrontmatter } from 'vuepress/shared';
|
|
3
|
+
import type { AutoLinkOptions } from './nav.js';
|
|
4
|
+
import type { SidebarArrayOptions } from './sidebar.js';
|
|
5
|
+
export interface DefaultThemePageData extends Partial<GitPluginPageData> {
|
|
4
6
|
filePathRelative: string | null;
|
|
5
7
|
}
|
|
6
|
-
export interface DefaultThemePageFrontmatter {
|
|
8
|
+
export interface DefaultThemePageFrontmatter extends PageFrontmatter {
|
|
7
9
|
home?: boolean;
|
|
8
10
|
navbar?: boolean;
|
|
9
11
|
pageClass?: string;
|
|
12
|
+
externalLinkIcon?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontmatter {
|
|
12
15
|
home: true;
|
|
@@ -34,8 +37,8 @@ export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFront
|
|
|
34
37
|
editLinkPattern?: string;
|
|
35
38
|
lastUpdated?: boolean;
|
|
36
39
|
contributors?: boolean;
|
|
37
|
-
sidebar?: '
|
|
40
|
+
sidebar?: SidebarArrayOptions | 'heading' | false;
|
|
38
41
|
sidebarDepth?: number;
|
|
39
|
-
prev?:
|
|
40
|
-
next?:
|
|
42
|
+
prev?: AutoLinkOptions | string;
|
|
43
|
+
next?: AutoLinkOptions | string;
|
|
41
44
|
}
|