@vuepress/theme-default 2.0.0-beta.5 → 2.0.0-beta.50

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