@vuepress/theme-default 2.0.0-rc.32 → 2.0.0-rc.34
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/VPDarkIcon.vue +8 -0
- package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
- package/lib/client/components/VPEditIcon.vue +12 -0
- package/lib/client/components/VPHome.vue +38 -0
- package/lib/client/components/VPHomeFeatures.vue +68 -0
- package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
- package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +107 -5
- package/lib/client/components/VPLightIcon.vue +28 -0
- package/lib/client/components/VPNavbar.vue +127 -0
- package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +36 -4
- package/lib/client/components/VPNavbarDropdown.vue +319 -0
- package/lib/client/components/VPNavbarItems.vue +110 -0
- package/lib/client/components/VPPage.vue +66 -0
- package/lib/client/components/VPPageMeta.vue +132 -0
- package/lib/client/components/VPPageNav.vue +118 -0
- package/lib/client/components/VPSidebar.vue +112 -0
- package/lib/client/components/VPSidebarItem.vue +169 -0
- package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +30 -6
- package/lib/client/components/VPToggleColorModeButton.vue +54 -0
- package/lib/client/components/VPToggleSidebarButton.vue +92 -0
- package/lib/client/components/global/Badge.vue +60 -18
- package/lib/client/components/global/CodeGroup.d.ts +1 -0
- package/lib/client/components/global/CodeGroup.js +4 -3
- package/lib/client/components/global/CodeGroupItem.vue +5 -16
- package/lib/client/composables/index.d.ts +7 -0
- package/lib/client/composables/index.js +7 -0
- package/lib/client/composables/useContributors.d.ts +3 -0
- package/lib/client/composables/useContributors.js +14 -0
- package/lib/client/composables/useDarkMode.js +1 -1
- package/lib/client/composables/useEditLink.d.ts +3 -0
- package/lib/client/composables/useEditLink.js +31 -0
- package/lib/client/composables/useLastUpdated.d.ts +2 -0
- package/lib/client/composables/useLastUpdated.js +17 -0
- package/lib/client/composables/useNavbarConfig.d.ts +3 -0
- package/lib/client/composables/useNavbarConfig.js +25 -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 +58 -0
- package/lib/client/composables/useNavigate.js +4 -7
- package/lib/client/composables/useRelatedLinks.d.ts +8 -0
- package/lib/client/composables/useRelatedLinks.js +73 -0
- package/lib/client/composables/useSidebarItems.d.ts +10 -9
- package/lib/client/composables/useSidebarItems.js +58 -47
- package/lib/client/config.d.ts +1 -0
- package/lib/client/config.js +2 -1
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +1 -0
- package/lib/client/layouts/Layout.vue +111 -18
- package/lib/client/layouts/NotFound.vue +1 -1
- package/lib/client/styles/_mixins.scss +4 -4
- package/lib/client/styles/_variables.module.scss +1 -1
- package/lib/client/styles/_variables.scss +1 -0
- package/lib/client/styles/code-group.scss +32 -29
- package/lib/client/styles/{code.scss → content/code.scss} +81 -99
- package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +9 -5
- package/lib/client/styles/content/index.scss +4 -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 +7 -3
- package/lib/client/styles/index.scss +2 -13
- package/lib/client/styles/layout.scss +3 -203
- package/lib/client/styles/normalize.scss +18 -149
- package/lib/client/styles/plugins.scss +20 -0
- package/lib/client/styles/vars-dark.scss +17 -16
- package/lib/client/styles/vars.scss +19 -23
- package/lib/client/typings.d.ts +13 -0
- package/lib/client/typings.js +1 -0
- package/lib/client/utils/{getNavLink.d.ts → getAutoLink.d.ts} +2 -2
- package/lib/client/utils/index.d.ts +3 -1
- package/lib/client/utils/index.js +3 -1
- package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
- package/lib/client/utils/isActiveSidebarItem.js +3 -3
- package/lib/client/utils/isLinkInternal.d.ts +1 -0
- package/lib/client/utils/isLinkInternal.js +2 -0
- package/lib/client/utils/resolvePrefix.d.ts +1 -0
- package/lib/client/utils/resolvePrefix.js +4 -0
- package/lib/node/defaultTheme.js +9 -1
- package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
- package/lib/shared/index.d.ts +2 -0
- package/lib/shared/index.js +2 -0
- package/lib/shared/nav.d.ts +23 -26
- package/lib/shared/navbar.d.ts +21 -0
- package/lib/shared/navbar.js +1 -0
- package/lib/shared/options.d.ts +4 -3
- package/lib/shared/page.d.ts +2 -2
- package/lib/shared/sidebar.d.ts +26 -0
- package/lib/shared/sidebar.js +1 -0
- package/package.json +19 -19
- package/templates/build.html +2 -0
- 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/Navbar.vue +0 -80
- package/lib/client/components/NavbarDropdown.vue +0 -125
- package/lib/client/components/NavbarItems.vue +0 -198
- package/lib/client/components/Page.vue +0 -31
- package/lib/client/components/PageMeta.vue +0 -220
- package/lib/client/components/PageNav.vue +0 -228
- package/lib/client/components/Sidebar.vue +0 -18
- package/lib/client/components/SidebarItem.vue +0 -86
- package/lib/client/components/ToggleColorModeButton.vue +0 -57
- package/lib/client/components/ToggleSidebarButton.vue +0 -24
- package/lib/client/styles/badge.scss +0 -36
- 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 -11
- package/lib/client/styles/sidebar.scss +0 -134
- package/lib/client/styles/transitions.scss +0 -22
- /package/lib/client/utils/{getNavLink.js → getAutoLink.js} +0 -0
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
--c-brand-light: #4abf8a;
|
|
5
5
|
|
|
6
6
|
// background colors
|
|
7
|
-
--c-bg: #
|
|
7
|
+
--c-bg: #fff;
|
|
8
8
|
--c-bg-light: #f3f4f5;
|
|
9
|
-
--c-bg-lighter: #
|
|
9
|
+
--c-bg-lighter: #eee;
|
|
10
10
|
--c-bg-dark: #ebebec;
|
|
11
11
|
--c-bg-darker: #e6e6e6;
|
|
12
12
|
--c-bg-navbar: var(--c-bg);
|
|
13
13
|
--c-bg-sidebar: var(--c-bg);
|
|
14
|
-
--c-bg-arrow: #
|
|
14
|
+
--c-bg-arrow: #ccc;
|
|
15
15
|
|
|
16
16
|
// text colors
|
|
17
17
|
--c-text: #2c3e50;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
--c-text-light: #3a5169;
|
|
20
20
|
--c-text-lighter: #4e6e8e;
|
|
21
21
|
--c-text-lightest: #6a8bad;
|
|
22
|
-
--c-text-quote: #
|
|
22
|
+
--c-text-quote: #999;
|
|
23
23
|
|
|
24
24
|
// border colors
|
|
25
25
|
--c-border: #eaecef;
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
--c-danger-border-dark: #f1abab;
|
|
50
50
|
--c-danger-details-bg: #ffd4d4;
|
|
51
51
|
--c-danger-title: #ed1e2c;
|
|
52
|
-
--c-danger-text: #
|
|
52
|
+
--c-danger-text: #600;
|
|
53
53
|
--c-danger-text-accent: #bd1a1a;
|
|
54
54
|
--c-danger-text-light: #b5474d;
|
|
55
55
|
--c-danger-text-quote: #c15b5b;
|
|
56
|
-
--c-details-bg: #
|
|
56
|
+
--c-details-bg: #eee;
|
|
57
57
|
|
|
58
58
|
// badge component colors
|
|
59
59
|
--c-badge-tip: var(--c-tip);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
--c-badge-danger-text: var(--c-bg);
|
|
64
64
|
|
|
65
65
|
// code group colors
|
|
66
|
-
--c-code-group-tab-title:
|
|
66
|
+
--c-code-group-tab-title: rgb(255 255 255 / 90%);
|
|
67
67
|
--c-code-group-tab-bg: var(--code-bg-color);
|
|
68
68
|
--c-code-group-tab-outline: var(var(--c-code-group-tab-title));
|
|
69
69
|
--c-code-group-tab-active-border: var(--c-brand);
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
|
|
75
75
|
// code blocks vars
|
|
76
76
|
--code-bg-color: #282c34;
|
|
77
|
-
--code-hl-bg-color:
|
|
78
|
-
--code-hl-error-bg-color:
|
|
79
|
-
--code-hl-warning-bg-color:
|
|
80
|
-
--code-line-diff-remove-color:
|
|
77
|
+
--code-hl-bg-color: rgb(0 0 0 / 66%);
|
|
78
|
+
--code-hl-error-bg-color: rgb(244 63 94 / 16%);
|
|
79
|
+
--code-hl-warning-bg-color: rgb(255 193 7 / 16%);
|
|
80
|
+
--code-line-diff-remove-color: rgb(244 63 94 / 16%);
|
|
81
81
|
--code-line-diff-remove-symbol-color: #e0575b;
|
|
82
|
-
--code-line-diff-add-color:
|
|
82
|
+
--code-line-diff-add-color: rgb(16 185 129 / 16%);
|
|
83
83
|
--code-line-diff-add-symbol-color: #298459;
|
|
84
84
|
--code-ln-color: #9e9e9e;
|
|
85
85
|
--code-ln-wrapper-width: 3.5rem;
|
|
86
86
|
|
|
87
87
|
// font vars
|
|
88
|
-
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
|
89
|
-
|
|
90
|
-
--font-family-code:
|
|
88
|
+
--font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', roboto, oxygen,
|
|
89
|
+
ubuntu, cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
90
|
+
--font-family-code: consolas, monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
91
91
|
|
|
92
92
|
// layout vars
|
|
93
93
|
--navbar-height: 3.6rem;
|
|
@@ -131,12 +131,13 @@
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// plugin-docsearch
|
|
134
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
134
135
|
.DocSearch {
|
|
135
136
|
--docsearch-primary-color: var(--c-brand);
|
|
136
137
|
--docsearch-text-color: var(--c-text);
|
|
137
138
|
--docsearch-highlight-color: var(--c-brand);
|
|
138
139
|
--docsearch-muted-color: var(--c-text-quote);
|
|
139
|
-
--docsearch-container-background:
|
|
140
|
+
--docsearch-container-background: rgb(9 10 17 / 80%);
|
|
140
141
|
--docsearch-modal-background: var(--c-bg-light);
|
|
141
142
|
--docsearch-searchbox-background: var(--c-bg-lighter);
|
|
142
143
|
--docsearch-searchbox-focus-background: var(--c-bg);
|
|
@@ -157,11 +158,9 @@
|
|
|
157
158
|
.vp-notice-wrapper {
|
|
158
159
|
--notice-color: var(--c-text);
|
|
159
160
|
--notice-bg-color: var(--c-bg);
|
|
160
|
-
|
|
161
161
|
--notice-primary-color: var(--c-brand);
|
|
162
162
|
--notice-primary-text-color: var(--c-bg);
|
|
163
163
|
--notice-primary-hover-color: var(--c-brand-light);
|
|
164
|
-
|
|
165
164
|
--notice-button-color: var(--c-bg-light);
|
|
166
165
|
--notice-button-hover-color: var(--c-bg-lighter);
|
|
167
166
|
}
|
|
@@ -171,14 +170,12 @@
|
|
|
171
170
|
--nprogress-color: var(--c-brand);
|
|
172
171
|
}
|
|
173
172
|
|
|
174
|
-
// plugin-photo-swipe
|
|
175
173
|
body {
|
|
174
|
+
// plugin-photo-swipe
|
|
176
175
|
--photo-swipe-bullet: var(--c-bg);
|
|
177
176
|
--photo-swipe-bullet-active: var(--c-brand);
|
|
178
|
-
}
|
|
179
177
|
|
|
180
|
-
// plugin-pwa-popup
|
|
181
|
-
body {
|
|
178
|
+
// plugin-pwa-popup
|
|
182
179
|
--pwa-text-color: var(--c-text);
|
|
183
180
|
--pwa-bg-color: var(--c-bg);
|
|
184
181
|
--pwa-border-color: var(--c-brand);
|
|
@@ -204,7 +201,6 @@ body {
|
|
|
204
201
|
--search-accent-color: var(--c-brand);
|
|
205
202
|
--search-text-color: var(--c-text);
|
|
206
203
|
--search-border-color: var(--c-border);
|
|
207
|
-
|
|
208
204
|
--search-item-text-color: var(--c-text-lighter);
|
|
209
205
|
--search-item-focus-bg-color: var(--c-bg-light);
|
|
210
206
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AutoLinkOptions, NavbarLinkOptions, NavGroup, SidebarGroupOptions, SidebarLinkOptions } from '../shared/index.js';
|
|
2
|
+
export type NavbarItem = NavbarLinkOptions | NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>;
|
|
3
|
+
export type SidebarLinkItem = SidebarLinkOptions;
|
|
4
|
+
export interface SidebarHeaderItem {
|
|
5
|
+
text: string;
|
|
6
|
+
link: string;
|
|
7
|
+
children?: SidebarHeaderItem[];
|
|
8
|
+
}
|
|
9
|
+
export interface SidebarGroupItem extends SidebarGroupOptions {
|
|
10
|
+
prefix?: string;
|
|
11
|
+
children: (SidebarItem | SidebarHeaderItem)[];
|
|
12
|
+
}
|
|
13
|
+
export type SidebarItem = SidebarLinkItem | SidebarGroupItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AutoLinkOptions } from '../../shared';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve AutoLink props from string
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { AutoLinkConfig } from 'vuepress/client';
|
|
|
6
6
|
* - Input: '/README.md'
|
|
7
7
|
* - Output: { text: 'Home', link: '/' }
|
|
8
8
|
*/
|
|
9
|
-
export declare const getAutoLink: (config: string) =>
|
|
9
|
+
export declare const getAutoLink: (config: string) => AutoLinkOptions;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './getAutoLink.js';
|
|
2
2
|
export * from './isActiveSidebarItem.js';
|
|
3
|
+
export * from './isLinkInternal.js';
|
|
3
4
|
export * from './resolveEditLink.js';
|
|
5
|
+
export * from './resolvePrefix.js';
|
|
4
6
|
export * from './resolveRepoType.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './getAutoLink.js';
|
|
2
2
|
export * from './isActiveSidebarItem.js';
|
|
3
|
+
export * from './isLinkInternal.js';
|
|
3
4
|
export * from './resolveEditLink.js';
|
|
5
|
+
export * from './resolvePrefix.js';
|
|
4
6
|
export * from './resolveRepoType.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RouteLocationNormalizedLoaded } from 'vuepress/client';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const
|
|
2
|
+
import type { SidebarItem } from '../typings.js';
|
|
3
|
+
export declare const isActiveLinkItem: (item: SidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
|
|
@@ -9,12 +9,12 @@ const isActiveLink = (link, route) => {
|
|
|
9
9
|
const targetPath = normalizePath(link);
|
|
10
10
|
return currentPath === targetPath;
|
|
11
11
|
};
|
|
12
|
-
export const
|
|
12
|
+
export const isActiveLinkItem = (item, route) => {
|
|
13
13
|
if (item.link && isActiveLink(item.link, route)) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
if (item
|
|
17
|
-
return item.children.some((child) =>
|
|
16
|
+
if ('children' in item) {
|
|
17
|
+
return item.children.some((child) => isActiveLinkItem(child, route));
|
|
18
18
|
}
|
|
19
19
|
return false;
|
|
20
20
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isLinkInternal: (link: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolvePrefix: (prefix?: string, path?: string) => string;
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -29,6 +29,14 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
29
29
|
`@theme/${file}`,
|
|
30
30
|
path.resolve(__dirname, '../client/components', file),
|
|
31
31
|
])),
|
|
32
|
+
// use alias to make all composables replaceable
|
|
33
|
+
...Object.fromEntries(fs
|
|
34
|
+
.readdirSync(path.resolve(__dirname, '../client/composables'))
|
|
35
|
+
.filter((file) => file.endsWith('.js'))
|
|
36
|
+
.map((file) => [
|
|
37
|
+
`@theme/${file.substring(0, file.length - 3)}`,
|
|
38
|
+
path.resolve(__dirname, '../client/composables', file),
|
|
39
|
+
])),
|
|
32
40
|
},
|
|
33
41
|
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
34
42
|
extendsPage: (page) => {
|
|
@@ -41,7 +49,7 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
|
|
|
41
49
|
// @vuepress/plugin-active-header-link
|
|
42
50
|
themePlugins.activeHeaderLinks !== false
|
|
43
51
|
? activeHeaderLinksPlugin({
|
|
44
|
-
headerLinkSelector: 'a.sidebar-item',
|
|
52
|
+
headerLinkSelector: 'a.vp-sidebar-item',
|
|
45
53
|
headerAnchorSelector: '.header-anchor',
|
|
46
54
|
// should greater than page transition duration
|
|
47
55
|
delay: 300,
|
package/lib/shared/index.d.ts
CHANGED
package/lib/shared/index.js
CHANGED
package/lib/shared/nav.d.ts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import type { AutoLinkConfig } from 'vuepress/client';
|
|
2
1
|
/**
|
|
3
2
|
* Base nav item, displayed as text
|
|
4
3
|
*/
|
|
5
|
-
export interface
|
|
4
|
+
export interface NavItemOptions {
|
|
6
5
|
text: string;
|
|
7
6
|
ariaLabel?: string;
|
|
8
7
|
}
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* Options for `<AutoLink>`
|
|
11
10
|
*/
|
|
12
|
-
export interface
|
|
13
|
-
|
|
11
|
+
export interface AutoLinkOptions extends NavItemOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Link of item
|
|
14
|
+
*/
|
|
15
|
+
link: string;
|
|
16
|
+
/**
|
|
17
|
+
* Rel of `<a>` tag
|
|
18
|
+
*/
|
|
19
|
+
rel?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Target of `<a>` tag
|
|
22
|
+
*/
|
|
23
|
+
target?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Regexp mode to be active
|
|
26
|
+
*/
|
|
27
|
+
activeMatch?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether it's active only when exact match
|
|
30
|
+
*/
|
|
31
|
+
exact?: boolean;
|
|
14
32
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Navbar types
|
|
17
|
-
*/
|
|
18
|
-
export type NavbarItem = AutoLinkConfig;
|
|
19
|
-
export type NavbarGroup = NavGroup<NavbarGroup | NavbarItem | string>;
|
|
20
|
-
export type NavbarConfig = (NavbarItem | NavbarGroup | string)[];
|
|
21
|
-
export type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarItem>;
|
|
22
|
-
/**
|
|
23
|
-
* Sidebar types
|
|
24
|
-
*/
|
|
25
|
-
export type SidebarItem = NavItem & Partial<AutoLinkConfig>;
|
|
26
|
-
export type SidebarGroup = SidebarItem & NavGroup<SidebarItem | SidebarGroup | string> & {
|
|
27
|
-
collapsible?: boolean;
|
|
28
|
-
};
|
|
29
|
-
export type SidebarConfigArray = (SidebarItem | SidebarGroup | string)[];
|
|
30
|
-
export type SidebarConfigObjectItem = SidebarConfigArray | 'heading';
|
|
31
|
-
export type SidebarConfigObject = Record<string, SidebarConfigObjectItem>;
|
|
32
|
-
export type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
|
|
33
|
-
export type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
|
|
34
|
-
collapsible?: boolean;
|
|
35
|
-
};
|
|
@@ -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;
|
|
20
|
+
export type NavbarGroupOptions = NavGroup<NavbarLinkOptions | NavGroup<NavbarLinkOptions> | string>;
|
|
21
|
+
export type NavbarOptions = (NavbarLinkOptions | NavbarGroupOptions | string)[] | false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type { SeoPluginOptions } from '@vuepress/plugin-seo';
|
|
|
6
6
|
import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
|
|
7
7
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
8
8
|
import type { LocaleData } from 'vuepress/shared';
|
|
9
|
-
import type {
|
|
9
|
+
import type { NavbarOptions } from './navbar.js';
|
|
10
|
+
import type { SidebarOptions } from './sidebar.js';
|
|
10
11
|
export interface DefaultThemePluginsOptions {
|
|
11
12
|
/**
|
|
12
13
|
* Enable @vuepress/plugin-active-header-links or not
|
|
@@ -92,7 +93,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
92
93
|
*
|
|
93
94
|
* Set to `false` to disable navbar in current locale
|
|
94
95
|
*/
|
|
95
|
-
navbar?: false |
|
|
96
|
+
navbar?: false | NavbarOptions;
|
|
96
97
|
/**
|
|
97
98
|
* Navbar label used for screen readers using the `aria-label` attribute
|
|
98
99
|
*/
|
|
@@ -157,7 +158,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
157
158
|
*
|
|
158
159
|
* Set to `false` to disable sidebar in current locale
|
|
159
160
|
*/
|
|
160
|
-
sidebar?:
|
|
161
|
+
sidebar?: false | SidebarOptions;
|
|
161
162
|
/**
|
|
162
163
|
* Sidebar depth
|
|
163
164
|
*
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
2
|
import type { AutoLinkConfig } from 'vuepress/client';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SidebarArrayOptions } from './sidebar.js';
|
|
4
4
|
export interface DefaultThemePageData extends GitPluginPageData {
|
|
5
5
|
filePathRelative: string | null;
|
|
6
6
|
}
|
|
@@ -36,7 +36,7 @@ export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFront
|
|
|
36
36
|
editLinkPattern?: string;
|
|
37
37
|
lastUpdated?: boolean;
|
|
38
38
|
contributors?: boolean;
|
|
39
|
-
sidebar?:
|
|
39
|
+
sidebar?: false | 'heading' | SidebarArrayOptions;
|
|
40
40
|
sidebarDepth?: number;
|
|
41
41
|
prev?: string | AutoLinkConfig;
|
|
42
42
|
next?: string | AutoLinkConfig;
|
|
@@ -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 = SidebarLinkOptions | SidebarGroupOptions | 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.34",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -42,27 +42,27 @@
|
|
|
42
42
|
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@vuepress/helper": "
|
|
46
|
-
"@vuepress/plugin-active-header-links": "
|
|
47
|
-
"@vuepress/plugin-back-to-top": "
|
|
48
|
-
"@vuepress/plugin-copy-code": "
|
|
49
|
-
"@vuepress/plugin-git": "
|
|
50
|
-
"@vuepress/plugin-links-check": "
|
|
51
|
-
"@vuepress/plugin-markdown-container": "
|
|
52
|
-
"@vuepress/plugin-medium-zoom": "
|
|
53
|
-
"@vuepress/plugin-nprogress": "
|
|
54
|
-
"@vuepress/plugin-palette": "
|
|
55
|
-
"@vuepress/plugin-prismjs": "
|
|
56
|
-
"@vuepress/plugin-seo": "
|
|
57
|
-
"@vuepress/plugin-sitemap": "
|
|
58
|
-
"@vuepress/plugin-theme-data": "
|
|
59
|
-
"@vueuse/core": "^10.
|
|
60
|
-
"sass": "^1.77.
|
|
45
|
+
"@vuepress/helper": "2.0.0-rc.34",
|
|
46
|
+
"@vuepress/plugin-active-header-links": "2.0.0-rc.34",
|
|
47
|
+
"@vuepress/plugin-back-to-top": "2.0.0-rc.34",
|
|
48
|
+
"@vuepress/plugin-copy-code": "2.0.0-rc.34",
|
|
49
|
+
"@vuepress/plugin-git": "2.0.0-rc.34",
|
|
50
|
+
"@vuepress/plugin-links-check": "2.0.0-rc.34",
|
|
51
|
+
"@vuepress/plugin-markdown-container": "2.0.0-rc.34",
|
|
52
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-rc.34",
|
|
53
|
+
"@vuepress/plugin-nprogress": "2.0.0-rc.34",
|
|
54
|
+
"@vuepress/plugin-palette": "2.0.0-rc.34",
|
|
55
|
+
"@vuepress/plugin-prismjs": "2.0.0-rc.34",
|
|
56
|
+
"@vuepress/plugin-seo": "2.0.0-rc.34",
|
|
57
|
+
"@vuepress/plugin-sitemap": "2.0.0-rc.34",
|
|
58
|
+
"@vuepress/plugin-theme-data": "2.0.0-rc.34",
|
|
59
|
+
"@vueuse/core": "^10.10.0",
|
|
60
|
+
"sass": "^1.77.4",
|
|
61
61
|
"vue": "^3.4.27"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"sass-loader": "^14.0.0",
|
|
65
|
-
"vuepress": "2.0.0-rc.
|
|
65
|
+
"vuepress": "2.0.0-rc.13"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"sass-loader": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "93df303baa6291f52e3523f136073e79d53274ea"
|
|
76
76
|
}
|
package/templates/build.html
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import HomeContent from '@theme/HomeContent.vue'
|
|
3
|
-
import HomeFeatures from '@theme/HomeFeatures.vue'
|
|
4
|
-
import HomeFooter from '@theme/HomeFooter.vue'
|
|
5
|
-
import HomeHero from '@theme/HomeHero.vue'
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<main class="home">
|
|
10
|
-
<HomeHero />
|
|
11
|
-
<HomeFeatures />
|
|
12
|
-
<HomeContent />
|
|
13
|
-
<HomeFooter />
|
|
14
|
-
</main>
|
|
15
|
-
</template>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { usePageFrontmatter } from 'vuepress/client'
|
|
4
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
5
|
-
|
|
6
|
-
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
7
|
-
const features = computed(() => {
|
|
8
|
-
if (Array.isArray(frontmatter.value.features)) {
|
|
9
|
-
return frontmatter.value.features
|
|
10
|
-
}
|
|
11
|
-
return []
|
|
12
|
-
})
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<template>
|
|
16
|
-
<div v-if="features.length" class="features">
|
|
17
|
-
<div v-for="feature in features" :key="feature.title" class="feature">
|
|
18
|
-
<h2>{{ feature.title }}</h2>
|
|
19
|
-
<p>{{ feature.details }}</p>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import NavbarBrand from '@theme/NavbarBrand.vue'
|
|
3
|
-
import NavbarItems from '@theme/NavbarItems.vue'
|
|
4
|
-
import ToggleColorModeButton from '@theme/ToggleColorModeButton.vue'
|
|
5
|
-
import ToggleSidebarButton from '@theme/ToggleSidebarButton.vue'
|
|
6
|
-
import { computed, ref } from 'vue'
|
|
7
|
-
import {
|
|
8
|
-
DeviceType,
|
|
9
|
-
useThemeLocaleData,
|
|
10
|
-
useUpdateDeviceStatus,
|
|
11
|
-
} from '../composables/index.js'
|
|
12
|
-
|
|
13
|
-
defineEmits<(e: 'toggle-sidebar') => void>()
|
|
14
|
-
|
|
15
|
-
defineSlots<{
|
|
16
|
-
before?: (props: Record<never, never>) => any
|
|
17
|
-
after?: (props: Record<never, never>) => any
|
|
18
|
-
}>()
|
|
19
|
-
|
|
20
|
-
const themeLocale = useThemeLocaleData()
|
|
21
|
-
|
|
22
|
-
const navbar = ref<HTMLElement | null>(null)
|
|
23
|
-
const navbarBrand = ref<HTMLElement | null>(null)
|
|
24
|
-
|
|
25
|
-
const linksWrapperMaxWidth = ref(0)
|
|
26
|
-
const linksWrapperStyle = computed(() => {
|
|
27
|
-
if (!linksWrapperMaxWidth.value) {
|
|
28
|
-
return {}
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
maxWidth: linksWrapperMaxWidth.value + 'px',
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const getCssValue = (el: HTMLElement | null, property: string): number => {
|
|
36
|
-
// NOTE: Known bug, will return 'auto' if style value is 'auto'
|
|
37
|
-
const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[
|
|
38
|
-
property
|
|
39
|
-
]
|
|
40
|
-
const num = Number.parseInt(val, 10)
|
|
41
|
-
|
|
42
|
-
return Number.isNaN(num) ? 0 : num
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
useUpdateDeviceStatus(
|
|
46
|
-
DeviceType.MOBILE,
|
|
47
|
-
(mobileDesktopBreakpoint: number): void => {
|
|
48
|
-
// avoid overlapping of long title and long navbar links
|
|
49
|
-
const navbarHorizontalPadding =
|
|
50
|
-
getCssValue(navbar.value, 'paddingLeft') +
|
|
51
|
-
getCssValue(navbar.value, 'paddingRight')
|
|
52
|
-
if (window.innerWidth < mobileDesktopBreakpoint) {
|
|
53
|
-
linksWrapperMaxWidth.value = 0
|
|
54
|
-
} else {
|
|
55
|
-
linksWrapperMaxWidth.value =
|
|
56
|
-
navbar.value!.offsetWidth -
|
|
57
|
-
navbarHorizontalPadding -
|
|
58
|
-
(navbarBrand.value?.offsetWidth || 0)
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
)
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<header ref="navbar" class="navbar">
|
|
66
|
-
<ToggleSidebarButton @toggle="$emit('toggle-sidebar')" />
|
|
67
|
-
|
|
68
|
-
<span ref="navbarBrand">
|
|
69
|
-
<NavbarBrand />
|
|
70
|
-
</span>
|
|
71
|
-
|
|
72
|
-
<div class="navbar-items-wrapper" :style="linksWrapperStyle">
|
|
73
|
-
<slot name="before" />
|
|
74
|
-
<NavbarItems class="can-hide" />
|
|
75
|
-
<slot name="after" />
|
|
76
|
-
<ToggleColorModeButton v-if="themeLocale.colorModeSwitch" />
|
|
77
|
-
<NavbarSearch />
|
|
78
|
-
</div>
|
|
79
|
-
</header>
|
|
80
|
-
</template>
|