@vuepress/theme-default 2.0.0-rc.9 → 2.0.0-rc.90
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 +43 -0
- package/lib/client/components/VPHome.vue +37 -0
- package/lib/client/components/VPHomeFeatures.vue +65 -0
- package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -3
- package/lib/client/components/VPHomeHero.vue +185 -0
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +134 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +41 -16
- package/lib/client/components/VPNavbarDropdown.vue +328 -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 +13 -0
- package/lib/client/composables/useData.js +15 -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 +96 -86
- 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 +8 -23
- 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 -194
- package/lib/client/styles/plugins.scss +28 -0
- package/lib/client/styles/vars-dark.scss +20 -58
- package/lib/client/styles/vars.scss +54 -130
- 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 +2 -1
- package/lib/node/defaultTheme.js +57 -64
- 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 -30
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +36 -66
- 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 +29 -27
- package/templates/build.html +16 -10
- 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/HomeHero.vue +0 -97
- package/lib/client/components/Navbar.vue +0 -79
- package/lib/client/components/NavbarDropdown.vue +0 -126
- package/lib/client/components/NavbarItems.vue +0 -199
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -124
- package/lib/client/components/PageNav.vue +0 -122
- 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
|
@@ -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,43 +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 SidebarConfigObjectItem = SidebarConfigArray | 'heading';
|
|
39
|
-
export type SidebarConfigObject = Record<string, SidebarConfigObjectItem>;
|
|
40
|
-
export type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
|
|
41
|
-
export type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
|
|
42
|
-
collapsible?: boolean;
|
|
43
|
-
};
|
|
@@ -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,63 +1,7 @@
|
|
|
1
|
-
import type { BackToTopPluginOptions } from '@vuepress/plugin-back-to-top';
|
|
2
|
-
import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
|
|
3
|
-
import type { SeoPluginOptions } from '@vuepress/plugin-seo';
|
|
4
|
-
import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
|
|
5
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
6
2
|
import type { LocaleData } from 'vuepress/shared';
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Enable @vuepress/plugin-active-header-links or not
|
|
11
|
-
*/
|
|
12
|
-
activeHeaderLinks?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Enable @vuepress/plugin-back-to-top or not
|
|
15
|
-
*/
|
|
16
|
-
backToTop?: BackToTopPluginOptions | boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Enable @vuepress/plugin-container or not
|
|
19
|
-
*/
|
|
20
|
-
container?: {
|
|
21
|
-
tip?: boolean;
|
|
22
|
-
warning?: boolean;
|
|
23
|
-
danger?: boolean;
|
|
24
|
-
details?: boolean;
|
|
25
|
-
codeGroup?: boolean;
|
|
26
|
-
codeGroupItem?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Enable @vuepress/plugin-copy-code or not
|
|
30
|
-
*/
|
|
31
|
-
copyCode?: CopyCodePluginOptions | boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Enable @vuepress/plugin-external-link-icon or not
|
|
34
|
-
*/
|
|
35
|
-
externalLinkIcon?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Enable @vuepress/plugin-git or not
|
|
38
|
-
*/
|
|
39
|
-
git?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Enable @vuepress/plugin-medium-zoom or not
|
|
42
|
-
*/
|
|
43
|
-
mediumZoom?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Enable @vuepress/plugin-nprogress or not
|
|
46
|
-
*/
|
|
47
|
-
nprogress?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Enable @vuepress/plugin-prismjs or not
|
|
50
|
-
*/
|
|
51
|
-
prismjs?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Enable @vuepress/plugin-seo or not
|
|
54
|
-
*/
|
|
55
|
-
seo?: Partial<SeoPluginOptions> | boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Enable @vuepress/plugin-sitemap or not
|
|
58
|
-
*/
|
|
59
|
-
sitemap?: Partial<SitemapPluginOptions> | boolean;
|
|
60
|
-
}
|
|
3
|
+
import type { NavbarOptions } from './navbar.js';
|
|
4
|
+
import type { SidebarOptions } from './sidebar.js';
|
|
61
5
|
export type DefaultThemeLocaleOptions = DefaultThemeData;
|
|
62
6
|
export type DefaultThemeData = ThemeData<DefaultThemeLocaleData>;
|
|
63
7
|
export interface DefaultThemeLocaleData extends LocaleData {
|
|
@@ -73,6 +17,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
73
17
|
* @default true
|
|
74
18
|
*/
|
|
75
19
|
colorModeSwitch?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether show external link icon
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
externalLinkIcon?: boolean;
|
|
76
26
|
/**
|
|
77
27
|
* Home path of current locale
|
|
78
28
|
*
|
|
@@ -84,40 +34,40 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
84
34
|
*
|
|
85
35
|
* Set to `false` to disable navbar in current locale
|
|
86
36
|
*/
|
|
87
|
-
navbar?:
|
|
37
|
+
navbar?: NavbarOptions | false;
|
|
88
38
|
/**
|
|
89
39
|
* Navbar label used for screen readers using the `aria-label` attribute
|
|
90
40
|
*/
|
|
91
|
-
navbarLabel?:
|
|
41
|
+
navbarLabel?: string | null;
|
|
92
42
|
/**
|
|
93
43
|
* Page navbar label used for screen readers using the `aria-label` attribute
|
|
94
44
|
*/
|
|
95
|
-
pageNavbarLabel?:
|
|
45
|
+
pageNavbarLabel?: string | null;
|
|
96
46
|
/**
|
|
97
47
|
* Navbar logo config
|
|
98
48
|
*
|
|
99
49
|
* Logo to display in navbar
|
|
100
50
|
*/
|
|
101
|
-
logo?:
|
|
51
|
+
logo?: string | null;
|
|
102
52
|
/**
|
|
103
53
|
* Navbar logo config for dark mode
|
|
104
54
|
*
|
|
105
55
|
* Logo to display in navbar in dark mode
|
|
106
56
|
*/
|
|
107
|
-
logoDark?:
|
|
57
|
+
logoDark?: string | null;
|
|
108
58
|
/**
|
|
109
59
|
* The alt text of navbar logo.
|
|
110
60
|
* Defaults to the site title if not specified.
|
|
111
61
|
* If the value is the same as the site title, the site title rendered in the navbar will be
|
|
112
62
|
* hidden from screen readers to avoid duplication.
|
|
113
63
|
*/
|
|
114
|
-
logoAlt?:
|
|
64
|
+
logoAlt?: string | null;
|
|
115
65
|
/**
|
|
116
66
|
* Navbar repository config
|
|
117
67
|
*
|
|
118
68
|
* Used for the repository link of navbar
|
|
119
69
|
*/
|
|
120
|
-
repo?:
|
|
70
|
+
repo?: string | null;
|
|
121
71
|
/**
|
|
122
72
|
* Navbar repository config
|
|
123
73
|
*
|
|
@@ -149,7 +99,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
149
99
|
*
|
|
150
100
|
* Set to `false` to disable sidebar in current locale
|
|
151
101
|
*/
|
|
152
|
-
sidebar?:
|
|
102
|
+
sidebar?: SidebarOptions | false;
|
|
153
103
|
/**
|
|
154
104
|
* Sidebar depth
|
|
155
105
|
*
|
|
@@ -247,6 +197,18 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
247
197
|
* Default title of DANGER custom block
|
|
248
198
|
*/
|
|
249
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;
|
|
250
212
|
/**
|
|
251
213
|
* 404 page config
|
|
252
214
|
*
|
|
@@ -271,4 +233,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
271
233
|
* A11y text for sidebar toggle button
|
|
272
234
|
*/
|
|
273
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;
|
|
274
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
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AutoLinkOptions, NavItemOptions } from './nav.js';
|
|
2
|
+
export type SidebarLinkOptions = AutoLinkOptions;
|
|
3
|
+
export interface SidebarGroupOptions extends NavItemOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Link prefix of current group
|
|
6
|
+
*/
|
|
7
|
+
prefix?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Link of current group
|
|
10
|
+
*/
|
|
11
|
+
link?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether current group is collapsible
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
collapsible?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Children of current group
|
|
20
|
+
*/
|
|
21
|
+
children: SidebarItemOptions[];
|
|
22
|
+
}
|
|
23
|
+
export type SidebarItemOptions = SidebarGroupOptions | SidebarLinkOptions | string;
|
|
24
|
+
export type SidebarArrayOptions = SidebarItemOptions[];
|
|
25
|
+
export type SidebarObjectOptions = Record<string, SidebarArrayOptions | 'heading' | false>;
|
|
26
|
+
export type SidebarOptions = SidebarArrayOptions | SidebarObjectOptions | 'heading';
|
|
@@ -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-rc.
|
|
3
|
+
"version": "2.0.0-rc.90",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -36,36 +36,38 @@
|
|
|
36
36
|
"lib",
|
|
37
37
|
"templates"
|
|
38
38
|
],
|
|
39
|
-
"scripts": {
|
|
40
|
-
"build": "tsc -b tsconfig.build.json",
|
|
41
|
-
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
|
42
|
-
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
43
|
-
},
|
|
44
39
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
46
|
-
"@vuepress/plugin-active-header-links": "2.0.0-rc.
|
|
47
|
-
"@vuepress/plugin-back-to-top": "2.0.0-rc.
|
|
48
|
-
"@vuepress/plugin-
|
|
49
|
-
"@vuepress/plugin-
|
|
50
|
-
"@vuepress/plugin-
|
|
51
|
-
"@vuepress/plugin-
|
|
52
|
-
"@vuepress/plugin-
|
|
53
|
-
"@vuepress/plugin-
|
|
54
|
-
"@vuepress/plugin-
|
|
55
|
-
"@vuepress/plugin-
|
|
56
|
-
"@vuepress/plugin-
|
|
57
|
-
"@vuepress/plugin-
|
|
58
|
-
"@vuepress/plugin-
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"vue": "^3.
|
|
62
|
-
"vue-router": "^4.2.5"
|
|
40
|
+
"@vuepress/helper": "2.0.0-rc.90",
|
|
41
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.86",
|
|
42
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.90",
|
|
43
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.90",
|
|
44
|
+
"@vuepress/plugin-git": "2.0.0-rc.90",
|
|
45
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.90",
|
|
46
|
+
"@vuepress/plugin-markdown-hint": "2.0.0-rc.90",
|
|
47
|
+
"@vuepress/plugin-markdown-tab": "2.0.0-rc.90",
|
|
48
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.90",
|
|
49
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.90",
|
|
50
|
+
"@vuepress/plugin-palette": "2.0.0-rc.90",
|
|
51
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.90",
|
|
52
|
+
"@vuepress/plugin-seo": "2.0.0-rc.90",
|
|
53
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.90",
|
|
54
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.86",
|
|
55
|
+
"@vueuse/core": "^13.0.0",
|
|
56
|
+
"vue": "^3.5.13"
|
|
63
57
|
},
|
|
64
58
|
"peerDependencies": {
|
|
65
|
-
"sass
|
|
66
|
-
"
|
|
59
|
+
"sass": "^1.86.0",
|
|
60
|
+
"sass-embedded": "^1.86.0",
|
|
61
|
+
"sass-loader": "^16.0.5",
|
|
62
|
+
"vuepress": "2.0.0-rc.20"
|
|
67
63
|
},
|
|
68
64
|
"peerDependenciesMeta": {
|
|
65
|
+
"sass": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"sass-embedded": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
69
71
|
"sass-loader": {
|
|
70
72
|
"optional": true
|
|
71
73
|
}
|
|
@@ -73,5 +75,5 @@
|
|
|
73
75
|
"publishConfig": {
|
|
74
76
|
"access": "public"
|
|
75
77
|
},
|
|
76
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "3e99edabb613d73cee8bc02d600809a514837306"
|
|
77
79
|
}
|
package/templates/build.html
CHANGED
|
@@ -6,23 +6,29 @@
|
|
|
6
6
|
<meta name="generator" content="VuePress {{ version }}" />
|
|
7
7
|
<style>
|
|
8
8
|
:root {
|
|
9
|
-
--c-bg: #fff;
|
|
9
|
+
--vp-c-bg: #fff;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
[data-theme='dark'] {
|
|
13
|
+
--vp-c-bg: #1b1b1f;
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
html,
|
|
15
17
|
body {
|
|
16
|
-
background-color: var(--c-bg);
|
|
18
|
+
background-color: var(--vp-c-bg);
|
|
17
19
|
}
|
|
18
20
|
</style>
|
|
19
21
|
<script>
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const useChoice = localStorage.getItem('vuepress-color-scheme')
|
|
23
|
+
const systemStatus =
|
|
24
|
+
'matchMedia' in window
|
|
25
|
+
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
26
|
+
: false
|
|
27
|
+
|
|
28
|
+
if (useChoice === 'light') {
|
|
29
|
+
document.documentElement.dataset.theme = 'light'
|
|
30
|
+
} else if (useChoice === 'dark' || systemStatus) {
|
|
31
|
+
document.documentElement.dataset.theme = 'dark'
|
|
26
32
|
}
|
|
27
33
|
</script>
|
|
28
34
|
<!--vuepress-ssr-head-->
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, toRefs } from 'vue'
|
|
3
|
-
import type { PropType } from 'vue'
|
|
4
|
-
import { useRoute } from 'vue-router'
|
|
5
|
-
import { useSiteData } from 'vuepress/client'
|
|
6
|
-
import { isLinkHttp, isLinkWithProtocol } from 'vuepress/shared'
|
|
7
|
-
import type { NavLink } from '../../shared/index.js'
|
|
8
|
-
|
|
9
|
-
defineOptions({
|
|
10
|
-
inheritAttrs: false,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const props = defineProps({
|
|
14
|
-
item: {
|
|
15
|
-
type: Object as PropType<NavLink>,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
defineSlots<{
|
|
21
|
-
before?: (props: Record<never, never>) => any
|
|
22
|
-
after?: (props: Record<never, never>) => any
|
|
23
|
-
}>()
|
|
24
|
-
|
|
25
|
-
const route = useRoute()
|
|
26
|
-
const site = useSiteData()
|
|
27
|
-
const { item } = toRefs(props)
|
|
28
|
-
|
|
29
|
-
// if the link has http protocol
|
|
30
|
-
const hasHttpProtocol = computed(() => isLinkHttp(item.value.link))
|
|
31
|
-
// if the link has non-http protocol
|
|
32
|
-
const hasNonHttpProtocol = computed(
|
|
33
|
-
() => !hasHttpProtocol.value && isLinkWithProtocol(item.value.link),
|
|
34
|
-
)
|
|
35
|
-
// resolve the `target` attr
|
|
36
|
-
const linkTarget = computed(() => {
|
|
37
|
-
if (hasNonHttpProtocol.value) return undefined
|
|
38
|
-
if (item.value.target) return item.value.target
|
|
39
|
-
if (hasHttpProtocol.value) return '_blank'
|
|
40
|
-
return undefined
|
|
41
|
-
})
|
|
42
|
-
// if the `target` attr is '_blank'
|
|
43
|
-
const isBlankTarget = computed(() => linkTarget.value === '_blank')
|
|
44
|
-
// is `<RouterLink>` or not
|
|
45
|
-
const isRouterLink = computed(
|
|
46
|
-
() =>
|
|
47
|
-
!hasHttpProtocol.value && !hasNonHttpProtocol.value && !isBlankTarget.value,
|
|
48
|
-
)
|
|
49
|
-
// resolve the `rel` attr
|
|
50
|
-
const linkRel = computed(() => {
|
|
51
|
-
if (hasNonHttpProtocol.value) return undefined
|
|
52
|
-
if (item.value.rel) return item.value.rel
|
|
53
|
-
if (isBlankTarget.value) return 'noopener noreferrer'
|
|
54
|
-
return undefined
|
|
55
|
-
})
|
|
56
|
-
// resolve the `aria-label` attr
|
|
57
|
-
const linkAriaLabel = computed(() => item.value.ariaLabel || item.value.text)
|
|
58
|
-
|
|
59
|
-
// should be active when current route is a subpath of this link
|
|
60
|
-
const shouldBeActiveInSubpath = computed(() => {
|
|
61
|
-
const localeKeys = Object.keys(site.value.locales)
|
|
62
|
-
if (localeKeys.length) {
|
|
63
|
-
return !localeKeys.some((key) => key === item.value.link)
|
|
64
|
-
}
|
|
65
|
-
return item.value.link !== '/'
|
|
66
|
-
})
|
|
67
|
-
// if this link is active in subpath
|
|
68
|
-
const isActiveInSubpath = computed(() => {
|
|
69
|
-
if (!shouldBeActiveInSubpath.value) {
|
|
70
|
-
return false
|
|
71
|
-
}
|
|
72
|
-
return route.path.startsWith(item.value.link)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
// if this link is active
|
|
76
|
-
const isActive = computed(() => {
|
|
77
|
-
if (!isRouterLink.value) {
|
|
78
|
-
return false
|
|
79
|
-
}
|
|
80
|
-
if (item.value.activeMatch) {
|
|
81
|
-
return new RegExp(item.value.activeMatch).test(route.path)
|
|
82
|
-
}
|
|
83
|
-
return isActiveInSubpath.value
|
|
84
|
-
})
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<template>
|
|
88
|
-
<RouterLink
|
|
89
|
-
v-if="isRouterLink"
|
|
90
|
-
:class="{ 'router-link-active': isActive }"
|
|
91
|
-
:to="item.link"
|
|
92
|
-
:aria-label="linkAriaLabel"
|
|
93
|
-
v-bind="$attrs"
|
|
94
|
-
>
|
|
95
|
-
<slot name="before" />
|
|
96
|
-
{{ item.text }}
|
|
97
|
-
<slot name="after" />
|
|
98
|
-
</RouterLink>
|
|
99
|
-
<a
|
|
100
|
-
v-else
|
|
101
|
-
class="external-link"
|
|
102
|
-
:href="item.link"
|
|
103
|
-
:rel="linkRel"
|
|
104
|
-
:target="linkTarget"
|
|
105
|
-
:aria-label="linkAriaLabel"
|
|
106
|
-
v-bind="$attrs"
|
|
107
|
-
>
|
|
108
|
-
<slot name="before" />
|
|
109
|
-
{{ item.text }}
|
|
110
|
-
<AutoLinkExternalIcon v-if="isBlankTarget" />
|
|
111
|
-
<slot name="after" />
|
|
112
|
-
</a>
|
|
113
|
-
</template>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineSlots<{
|
|
3
|
-
default?: (props: Record<never, never>) => any
|
|
4
|
-
}>()
|
|
5
|
-
|
|
6
|
-
const setHeight = (items): void => {
|
|
7
|
-
// explicitly set height so that it can be transitioned
|
|
8
|
-
items.style.height = items.scrollHeight + 'px'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const unsetHeight = (items): void => {
|
|
12
|
-
items.style.height = ''
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<template>
|
|
17
|
-
<Transition
|
|
18
|
-
name="dropdown"
|
|
19
|
-
@enter="setHeight"
|
|
20
|
-
@after-enter="unsetHeight"
|
|
21
|
-
@before-leave="setHeight"
|
|
22
|
-
>
|
|
23
|
-
<slot />
|
|
24
|
-
</Transition>
|
|
25
|
-
</template>
|