@vuepress/theme-default 2.0.0-rc.4 → 2.0.0-rc.40

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 (127) hide show
  1. package/lib/client/components/VPDarkIcon.vue +8 -0
  2. package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
  3. package/lib/client/components/VPEditIcon.vue +12 -0
  4. package/lib/client/components/VPHome.vue +38 -0
  5. package/lib/client/components/VPHomeFeatures.vue +68 -0
  6. package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
  7. package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +108 -7
  8. package/lib/client/components/VPLightIcon.vue +28 -0
  9. package/lib/client/components/VPNavbar.vue +125 -0
  10. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +39 -6
  11. package/lib/client/components/VPNavbarDropdown.vue +320 -0
  12. package/lib/client/components/VPNavbarItems.vue +110 -0
  13. package/lib/client/components/VPPage.vue +69 -0
  14. package/lib/client/components/VPPageMeta.vue +132 -0
  15. package/lib/client/components/VPPageNav.vue +118 -0
  16. package/lib/client/components/VPSidebar.vue +112 -0
  17. package/lib/client/components/VPSidebarItem.vue +167 -0
  18. package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +31 -7
  19. package/lib/client/components/VPToggleColorModeButton.vue +54 -0
  20. package/lib/client/components/VPToggleSidebarButton.vue +92 -0
  21. package/lib/client/components/global/Badge.vue +60 -18
  22. package/lib/client/components/global/CodeGroup.d.ts +1 -0
  23. package/lib/client/components/global/CodeGroup.js +4 -3
  24. package/lib/client/components/global/CodeGroupItem.vue +5 -16
  25. package/lib/client/composables/index.d.ts +8 -0
  26. package/lib/client/composables/index.js +8 -0
  27. package/lib/client/composables/useContributors.d.ts +3 -0
  28. package/lib/client/composables/useContributors.js +14 -0
  29. package/lib/client/composables/useDarkMode.d.ts +0 -1
  30. package/lib/client/composables/useDarkMode.js +14 -13
  31. package/lib/client/composables/useEditLink.d.ts +3 -0
  32. package/lib/client/composables/useEditLink.js +31 -0
  33. package/lib/client/composables/useLastUpdated.d.ts +2 -0
  34. package/lib/client/composables/useLastUpdated.js +17 -0
  35. package/lib/client/composables/useNavbarConfig.d.ts +3 -0
  36. package/lib/client/composables/useNavbarConfig.js +25 -0
  37. package/lib/client/composables/useNavbarRepo.d.ts +6 -0
  38. package/lib/client/composables/useNavbarRepo.js +38 -0
  39. package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
  40. package/lib/client/composables/useNavbarSelectLanguage.js +58 -0
  41. package/lib/client/composables/useNavigate.d.ts +1 -0
  42. package/lib/client/composables/useNavigate.js +22 -0
  43. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  44. package/lib/client/composables/useRelatedLinks.js +91 -0
  45. package/lib/client/composables/useSidebarItems.d.ts +17 -12
  46. package/lib/client/composables/useSidebarItems.js +87 -52
  47. package/lib/client/composables/useUpdateDeviceStatus.js +5 -4
  48. package/lib/client/config.d.ts +2 -2
  49. package/lib/client/config.js +12 -13
  50. package/lib/client/index.d.ts +2 -1
  51. package/lib/client/index.js +1 -1
  52. package/lib/client/layouts/Layout.vue +121 -20
  53. package/lib/client/layouts/NotFound.vue +18 -4
  54. package/lib/client/shim.d.ts +3 -3
  55. package/lib/client/styles/_mixins.scss +4 -4
  56. package/lib/client/styles/_variables.module.scss +1 -1
  57. package/lib/client/styles/_variables.scss +1 -0
  58. package/lib/client/styles/arrow.scss +18 -24
  59. package/lib/client/styles/code-group.scss +32 -29
  60. package/lib/client/styles/content/code.scss +23 -0
  61. package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +13 -13
  62. package/lib/client/styles/content/index.scss +4 -0
  63. package/lib/client/styles/content/normalize.scss +39 -0
  64. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  65. package/lib/client/styles/external-link-icon.scss +37 -0
  66. package/lib/client/styles/index.scss +3 -13
  67. package/lib/client/styles/layout.scss +3 -199
  68. package/lib/client/styles/normalize.scss +20 -148
  69. package/lib/client/styles/plugins.scss +20 -0
  70. package/lib/client/styles/vars-dark.scss +17 -12
  71. package/lib/client/styles/vars.scss +71 -33
  72. package/lib/client/typings.d.ts +13 -0
  73. package/lib/client/typings.js +1 -0
  74. package/lib/client/utils/getAutoLink.d.ts +9 -0
  75. package/lib/client/utils/getAutoLink.js +17 -0
  76. package/lib/client/utils/index.d.ts +3 -2
  77. package/lib/client/utils/index.js +3 -2
  78. package/lib/client/utils/isActiveSidebarItem.d.ts +3 -3
  79. package/lib/client/utils/isActiveSidebarItem.js +3 -3
  80. package/lib/client/utils/isLinkInternal.d.ts +1 -0
  81. package/lib/client/utils/isLinkInternal.js +2 -0
  82. package/lib/client/utils/resolveEditLink.d.ts +1 -1
  83. package/lib/client/utils/resolvePrefix.d.ts +1 -0
  84. package/lib/client/utils/resolvePrefix.js +4 -0
  85. package/lib/node/defaultTheme.js +83 -24
  86. package/lib/node/index.d.ts +2 -1
  87. package/lib/node/index.js +1 -1
  88. package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
  89. package/lib/node/utils/resolveContainerPluginOptions.d.ts +3 -3
  90. package/lib/node/utils/resolveContainerPluginOptions.js +2 -2
  91. package/lib/shared/index.d.ts +2 -0
  92. package/lib/shared/index.js +2 -0
  93. package/lib/shared/nav.d.ts +19 -30
  94. package/lib/shared/navbar.d.ts +21 -0
  95. package/lib/shared/navbar.js +1 -0
  96. package/lib/shared/options.d.ts +31 -8
  97. package/lib/shared/page.d.ts +6 -4
  98. package/lib/shared/sidebar.d.ts +26 -0
  99. package/lib/shared/sidebar.js +1 -0
  100. package/package.json +22 -26
  101. package/templates/build.html +19 -10
  102. package/lib/client/components/AutoLink.vue +0 -113
  103. package/lib/client/components/Home.vue +0 -15
  104. package/lib/client/components/HomeContent.vue +0 -5
  105. package/lib/client/components/HomeFeatures.vue +0 -22
  106. package/lib/client/components/Navbar.vue +0 -79
  107. package/lib/client/components/NavbarDropdown.vue +0 -126
  108. package/lib/client/components/NavbarItems.vue +0 -199
  109. package/lib/client/components/Page.vue +0 -31
  110. package/lib/client/components/PageMeta.vue +0 -124
  111. package/lib/client/components/PageNav.vue +0 -122
  112. package/lib/client/components/Sidebar.vue +0 -18
  113. package/lib/client/components/SidebarItem.vue +0 -87
  114. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  115. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  116. package/lib/client/styles/badge.scss +0 -36
  117. package/lib/client/styles/code.scss +0 -263
  118. package/lib/client/styles/home.scss +0 -168
  119. package/lib/client/styles/navbar-dropdown.scss +0 -183
  120. package/lib/client/styles/navbar.scss +0 -197
  121. package/lib/client/styles/page.scss +0 -87
  122. package/lib/client/styles/sidebar.scss +0 -134
  123. package/lib/client/styles/transitions.scss +0 -22
  124. package/lib/client/utils/getNavLink.d.ts +0 -15
  125. package/lib/client/utils/getNavLink.js +0 -18
  126. package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
  127. package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
@@ -1,8 +1,10 @@
1
+ import { addViteConfig, addViteOptimizeDepsExclude, chainWebpack, } 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 { containerPlugin } from '@vuepress/plugin-container';
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 { markdownContainerPlugin } from '@vuepress/plugin-markdown-container';
6
8
  import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
7
9
  import { nprogressPlugin } from '@vuepress/plugin-nprogress';
8
10
  import { palettePlugin } from '@vuepress/plugin-palette';
@@ -12,7 +14,7 @@ import { sitemapPlugin } from '@vuepress/plugin-sitemap';
12
14
  import { themeDataPlugin } from '@vuepress/plugin-theme-data';
13
15
  import { isPlainObject } from 'vuepress/shared';
14
16
  import { fs, getDirname, path } from 'vuepress/utils';
15
- import { assignDefaultLocaleOptions, resolveContainerPluginOptions, } from './utils/index.js';
17
+ import { assignDefaultLocaleOptions, resolveMarkdownContainerPluginOptions, } from './utils/index.js';
16
18
  const __dirname = getDirname(import.meta.url);
17
19
  export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } = {}) => {
18
20
  assignDefaultLocaleOptions(localeOptions);
@@ -28,8 +30,58 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
28
30
  `@theme/${file}`,
29
31
  path.resolve(__dirname, '../client/components', file),
30
32
  ])),
33
+ // use alias to make all composables replaceable
34
+ ...Object.fromEntries(fs
35
+ .readdirSync(path.resolve(__dirname, '../client/composables'))
36
+ .filter((file) => file.endsWith('.js'))
37
+ .map((file) => [
38
+ `@theme/${file.substring(0, file.length - 3)}`,
39
+ path.resolve(__dirname, '../client/composables', file),
40
+ ])),
31
41
  },
32
42
  clientConfigFile: path.resolve(__dirname, '../client/config.js'),
43
+ extendsBundlerOptions: (bundlerOptions, app) => {
44
+ // FIXME: hide sass deprecation warning for mixed-decls
45
+ addViteConfig(bundlerOptions, app, {
46
+ css: {
47
+ preprocessorOptions: {
48
+ sass: {
49
+ logger: {
50
+ warn: (message, { deprecation, deprecationType }) => {
51
+ if (deprecation && deprecationType.id === 'mixed-decls')
52
+ return;
53
+ console.warn(message);
54
+ },
55
+ },
56
+ },
57
+ scss: {
58
+ logger: {
59
+ warn: (message, { deprecation, deprecationType }) => {
60
+ if (deprecation && deprecationType.id === 'mixed-decls')
61
+ return;
62
+ console.warn(message);
63
+ },
64
+ },
65
+ },
66
+ },
67
+ },
68
+ });
69
+ chainWebpack(bundlerOptions, app, (config) => {
70
+ config.module
71
+ .rule('scss')
72
+ .use('sass-loader')
73
+ .tap((options) => ({
74
+ api: 'modern-compiler',
75
+ ...options,
76
+ sassOptions: {
77
+ silenceDeprecations: ['mixed-decls'],
78
+ ...options.sassOptions,
79
+ },
80
+ }));
81
+ });
82
+ // ensure theme alias is not optimized by Vite
83
+ addViteOptimizeDepsExclude(bundlerOptions, app, '@theme');
84
+ },
33
85
  extendsPage: (page) => {
34
86
  // save relative file path into page data to generate edit link
35
87
  page.data.filePathRelative = page.filePathRelative;
@@ -40,56 +92,55 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
40
92
  // @vuepress/plugin-active-header-link
41
93
  themePlugins.activeHeaderLinks !== false
42
94
  ? activeHeaderLinksPlugin({
43
- headerLinkSelector: 'a.sidebar-item',
95
+ headerLinkSelector: 'a.vp-sidebar-item',
44
96
  headerAnchorSelector: '.header-anchor',
45
97
  // should greater than page transition duration
46
98
  delay: 300,
47
99
  })
48
100
  : [],
49
101
  // @vuepress/plugin-back-to-top
50
- themePlugins.backToTop !== false ? backToTopPlugin() : [],
51
- // @vuepress/plugin-container
102
+ themePlugins.backToTop !== false
103
+ ? backToTopPlugin(isPlainObject(themePlugins.backToTop) ? themePlugins.backToTop : {})
104
+ : [],
105
+ // @vuepress/plugin-copy-code
106
+ themePlugins.copyCode !== false
107
+ ? copyCodePlugin({
108
+ ...(isPlainObject(themePlugins.copyCode)
109
+ ? themePlugins.copyCode
110
+ : {}),
111
+ })
112
+ : [],
113
+ // @vuepress/plugin-markdown-container
52
114
  themePlugins.container?.tip !== false
53
- ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
115
+ ? markdownContainerPlugin(resolveMarkdownContainerPluginOptions(localeOptions, 'tip'))
54
116
  : [],
55
117
  themePlugins.container?.warning !== false
56
- ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
118
+ ? markdownContainerPlugin(resolveMarkdownContainerPluginOptions(localeOptions, 'warning'))
57
119
  : [],
58
120
  themePlugins.container?.danger !== false
59
- ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
121
+ ? markdownContainerPlugin(resolveMarkdownContainerPluginOptions(localeOptions, 'danger'))
60
122
  : [],
61
123
  themePlugins.container?.details !== false
62
- ? containerPlugin({
124
+ ? markdownContainerPlugin({
63
125
  type: 'details',
64
126
  before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
65
127
  after: () => '</details>\n',
66
128
  })
67
129
  : [],
68
130
  themePlugins.container?.codeGroup !== false
69
- ? containerPlugin({
131
+ ? markdownContainerPlugin({
70
132
  type: 'code-group',
71
133
  before: () => `<CodeGroup>\n`,
72
134
  after: () => '</CodeGroup>\n',
73
135
  })
74
136
  : [],
75
137
  themePlugins.container?.codeGroupItem !== false
76
- ? containerPlugin({
138
+ ? markdownContainerPlugin({
77
139
  type: 'code-group-item',
78
140
  before: (info) => `<CodeGroupItem title="${info}">\n`,
79
141
  after: () => '</CodeGroupItem>\n',
80
142
  })
81
143
  : [],
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
144
  // @vuepress/plugin-git
94
145
  themePlugins.git !== false
95
146
  ? gitPlugin({
@@ -98,6 +149,12 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
98
149
  contributors: localeOptions.contributors !== false,
99
150
  })
100
151
  : [],
152
+ // @vuepress/plugin-links-check
153
+ themePlugins.linksCheck !== false
154
+ ? linksCheckPlugin(isPlainObject(themePlugins.linksCheck)
155
+ ? themePlugins.linksCheck
156
+ : {})
157
+ : [],
101
158
  // @vuepress/plugin-medium-zoom
102
159
  themePlugins.mediumZoom !== false
103
160
  ? mediumZoomPlugin({
@@ -112,7 +169,9 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
112
169
  // @vuepress/plugin-palette
113
170
  palettePlugin({ preset: 'sass' }),
114
171
  // @vuepress/plugin-prismjs
115
- themePlugins.prismjs !== false ? prismjsPlugin() : [],
172
+ themePlugins.prismjs !== false
173
+ ? prismjsPlugin(isPlainObject(themePlugins.prismjs) ? themePlugins.prismjs : {})
174
+ : [],
116
175
  // @vuepress/plugin-seo
117
176
  hostname && themePlugins.seo !== false
118
177
  ? seoPlugin({
@@ -1,5 +1,6 @@
1
1
  import { defaultTheme } from './defaultTheme.js';
2
- export * from '../shared/index.js';
3
2
  export * from './defaultTheme.js';
4
3
  export * from './utils/index.js';
4
+ export type * from '../shared/index.js';
5
+ /** @deprecated Use named export instead */
5
6
  export default defaultTheme;
package/lib/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defaultTheme } from './defaultTheme.js';
2
- export * from '../shared/index.js';
3
2
  export * from './defaultTheme.js';
4
3
  export * from './utils/index.js';
4
+ /** @deprecated Use named export instead */
5
5
  export default defaultTheme;
@@ -9,7 +9,7 @@ export const DEFAULT_LOCALE_OPTIONS = {
9
9
  selectLanguageText: 'Languages',
10
10
  selectLanguageAriaLabel: 'Select language',
11
11
  // sidebar
12
- sidebar: 'auto',
12
+ sidebar: 'heading',
13
13
  sidebarDepth: 2,
14
14
  // page meta
15
15
  editLink: true,
@@ -1,8 +1,8 @@
1
- import type { ContainerPluginOptions } from '@vuepress/plugin-container';
1
+ import type { MarkdownContainerPluginOptions } from '@vuepress/plugin-markdown-container';
2
2
  import type { DefaultThemeData } from '../../shared/index.js';
3
3
  /**
4
- * Resolve options for @vuepress/plugin-container
4
+ * Resolve options for @vuepress/plugin-markdown-container
5
5
  *
6
6
  * For custom containers default title
7
7
  */
8
- export declare const resolveContainerPluginOptions: (localeOptions: DefaultThemeData, type: 'tip' | 'warning' | 'danger') => ContainerPluginOptions;
8
+ export declare const resolveMarkdownContainerPluginOptions: (localeOptions: DefaultThemeData, type: "tip" | "warning" | "danger") => MarkdownContainerPluginOptions;
@@ -1,9 +1,9 @@
1
1
  /**
2
- * Resolve options for @vuepress/plugin-container
2
+ * Resolve options for @vuepress/plugin-markdown-container
3
3
  *
4
4
  * For custom containers default title
5
5
  */
6
- export const resolveContainerPluginOptions = (localeOptions, type) => {
6
+ export const resolveMarkdownContainerPluginOptions = (localeOptions, type) => {
7
7
  const locales = Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
8
8
  result[key] = {
9
9
  defaultInfo: value?.[type] ?? localeOptions[type],
@@ -1,3 +1,5 @@
1
1
  export * from './nav.js';
2
+ export * from './navbar.js';
2
3
  export * from './options.js';
3
4
  export * from './page.js';
5
+ export * from './sidebar.js';
@@ -1,3 +1,5 @@
1
1
  export * from './nav.js';
2
+ export * from './navbar.js';
2
3
  export * from './options.js';
3
4
  export * from './page.js';
5
+ export * from './sidebar.js';
@@ -1,43 +1,32 @@
1
1
  /**
2
2
  * Base nav item, displayed as text
3
3
  */
4
- export interface NavItem {
4
+ export interface NavItemOptions {
5
5
  text: string;
6
6
  ariaLabel?: string;
7
7
  }
8
8
  /**
9
- * Base nav group, has nav items children
9
+ * Options for `<AutoLink>`
10
10
  */
11
- export interface NavGroup<T> extends NavItem {
12
- children: T[];
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;
20
+ export type NavbarGroupOptions = NavGroup<NavbarLinkOptions | NavGroup<NavbarLinkOptions> | string>;
21
+ export type NavbarOptions = (NavbarLinkOptions | NavbarGroupOptions | string)[] | false;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,13 @@
1
+ import type { BackToTopPluginOptions } from '@vuepress/plugin-back-to-top';
2
+ import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
3
+ import type { LinksCheckPluginOptions } from '@vuepress/plugin-links-check';
4
+ import type { PrismjsPluginOptions } from '@vuepress/plugin-prismjs';
1
5
  import type { SeoPluginOptions } from '@vuepress/plugin-seo';
2
6
  import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
3
7
  import type { ThemeData } from '@vuepress/plugin-theme-data';
4
8
  import type { LocaleData } from 'vuepress/shared';
5
- import type { NavbarConfig, SidebarConfig } from './nav.js';
9
+ import type { NavbarOptions } from './navbar.js';
10
+ import type { SidebarOptions } from './sidebar.js';
6
11
  export interface DefaultThemePluginsOptions {
7
12
  /**
8
13
  * Enable @vuepress/plugin-active-header-links or not
@@ -11,9 +16,9 @@ export interface DefaultThemePluginsOptions {
11
16
  /**
12
17
  * Enable @vuepress/plugin-back-to-top or not
13
18
  */
14
- backToTop?: boolean;
19
+ backToTop?: BackToTopPluginOptions | boolean;
15
20
  /**
16
- * Enable @vuepress/plugin-container or not
21
+ * Enable @vuepress/plugin-markdown-container or not
17
22
  */
18
23
  container?: {
19
24
  tip?: boolean;
@@ -24,13 +29,17 @@ export interface DefaultThemePluginsOptions {
24
29
  codeGroupItem?: boolean;
25
30
  };
26
31
  /**
27
- * Enable @vuepress/plugin-external-link-icon or not
32
+ * Enable @vuepress/plugin-copy-code or not
28
33
  */
29
- externalLinkIcon?: boolean;
34
+ copyCode?: CopyCodePluginOptions | boolean;
30
35
  /**
31
36
  * Enable @vuepress/plugin-git or not
32
37
  */
33
38
  git?: boolean;
39
+ /**
40
+ * Enable @vuepress/plugin-links-check or not
41
+ */
42
+ linksCheck?: LinksCheckPluginOptions | boolean;
34
43
  /**
35
44
  * Enable @vuepress/plugin-medium-zoom or not
36
45
  */
@@ -42,7 +51,7 @@ export interface DefaultThemePluginsOptions {
42
51
  /**
43
52
  * Enable @vuepress/plugin-prismjs or not
44
53
  */
45
- prismjs?: boolean;
54
+ prismjs?: boolean | PrismjsPluginOptions;
46
55
  /**
47
56
  * Enable @vuepress/plugin-seo or not
48
57
  */
@@ -67,6 +76,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
67
76
  * @default true
68
77
  */
69
78
  colorModeSwitch?: boolean;
79
+ /**
80
+ * Whether show external link icon
81
+ *
82
+ * @default true
83
+ */
84
+ externalLinkIcon?: boolean;
70
85
  /**
71
86
  * Home path of current locale
72
87
  *
@@ -78,7 +93,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
78
93
  *
79
94
  * Set to `false` to disable navbar in current locale
80
95
  */
81
- navbar?: false | NavbarConfig;
96
+ navbar?: false | NavbarOptions;
82
97
  /**
83
98
  * Navbar label used for screen readers using the `aria-label` attribute
84
99
  */
@@ -143,7 +158,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
143
158
  *
144
159
  * Set to `false` to disable sidebar in current locale
145
160
  */
146
- sidebar?: 'auto' | false | SidebarConfig;
161
+ sidebar?: false | SidebarOptions;
147
162
  /**
148
163
  * Sidebar depth
149
164
  *
@@ -265,4 +280,12 @@ export interface DefaultThemeLocaleData extends LocaleData {
265
280
  * A11y text for sidebar toggle button
266
281
  */
267
282
  toggleSidebar?: string;
283
+ /**
284
+ * text for prev link
285
+ */
286
+ prev?: string | false;
287
+ /**
288
+ * text for next link
289
+ */
290
+ next?: string | false;
268
291
  }
@@ -1,5 +1,6 @@
1
1
  import type { GitPluginPageData } from '@vuepress/plugin-git';
2
- import type { NavLink, SidebarConfig } from './nav.js';
2
+ import type { AutoLinkConfig } from 'vuepress/client';
3
+ import type { SidebarArrayOptions } from './sidebar.js';
3
4
  export interface DefaultThemePageData extends GitPluginPageData {
4
5
  filePathRelative: string | null;
5
6
  }
@@ -7,6 +8,7 @@ export interface DefaultThemePageFrontmatter {
7
8
  home?: boolean;
8
9
  navbar?: boolean;
9
10
  pageClass?: string;
11
+ externalLinkIcon?: boolean;
10
12
  }
11
13
  export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontmatter {
12
14
  home: true;
@@ -34,8 +36,8 @@ export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFront
34
36
  editLinkPattern?: string;
35
37
  lastUpdated?: boolean;
36
38
  contributors?: boolean;
37
- sidebar?: 'auto' | false | SidebarConfig;
39
+ sidebar?: false | 'heading' | SidebarArrayOptions;
38
40
  sidebarDepth?: number;
39
- prev?: string | NavLink;
40
- next?: string | NavLink;
41
+ prev?: string | AutoLinkConfig;
42
+ next?: string | AutoLinkConfig;
41
43
  }
@@ -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.4",
3
+ "version": "2.0.0-rc.40",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -8,7 +8,7 @@
8
8
  "theme",
9
9
  "default"
10
10
  ],
11
- "homepage": "https://github.com/vuepress",
11
+ "homepage": "https://ecosystem.vuejs.press/themes/default/",
12
12
  "bugs": {
13
13
  "url": "https://github.com/vuepress/ecosystem/issues"
14
14
  },
@@ -36,32 +36,28 @@
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/plugin-active-header-links": "2.0.0-rc.3",
46
- "@vuepress/plugin-back-to-top": "2.0.0-rc.3",
47
- "@vuepress/plugin-container": "2.0.0-rc.3",
48
- "@vuepress/plugin-external-link-icon": "2.0.0-rc.3",
49
- "@vuepress/plugin-git": "2.0.0-rc.3",
50
- "@vuepress/plugin-medium-zoom": "2.0.0-rc.3",
51
- "@vuepress/plugin-nprogress": "2.0.0-rc.3",
52
- "@vuepress/plugin-palette": "2.0.0-rc.3",
53
- "@vuepress/plugin-prismjs": "2.0.0-rc.3",
54
- "@vuepress/plugin-seo": "2.0.0-rc.4",
55
- "@vuepress/plugin-sitemap": "2.0.0-rc.4",
56
- "@vuepress/plugin-theme-data": "2.0.0-rc.3",
57
- "@vueuse/core": "^10.7.2",
58
- "sass": "^1.70.0",
59
- "vue": "^3.4.15",
60
- "vue-router": "^4.2.5"
40
+ "@vuepress/helper": "2.0.0-rc.40",
41
+ "@vuepress/plugin-active-header-links": "2.0.0-rc.40",
42
+ "@vuepress/plugin-back-to-top": "2.0.0-rc.40",
43
+ "@vuepress/plugin-copy-code": "2.0.0-rc.40",
44
+ "@vuepress/plugin-git": "2.0.0-rc.38",
45
+ "@vuepress/plugin-links-check": "2.0.0-rc.40",
46
+ "@vuepress/plugin-markdown-container": "2.0.0-rc.37",
47
+ "@vuepress/plugin-medium-zoom": "2.0.0-rc.40",
48
+ "@vuepress/plugin-nprogress": "2.0.0-rc.40",
49
+ "@vuepress/plugin-palette": "2.0.0-rc.37",
50
+ "@vuepress/plugin-prismjs": "2.0.0-rc.40",
51
+ "@vuepress/plugin-seo": "2.0.0-rc.40",
52
+ "@vuepress/plugin-sitemap": "2.0.0-rc.40",
53
+ "@vuepress/plugin-theme-data": "2.0.0-rc.40",
54
+ "@vueuse/core": "^10.11.0",
55
+ "sass": "^1.77.8",
56
+ "vue": "^3.4.34"
61
57
  },
62
58
  "peerDependencies": {
63
- "sass-loader": "^14.0.0",
64
- "vuepress": "2.0.0-rc.2"
59
+ "sass-loader": "^15.0.0",
60
+ "vuepress": "2.0.0-rc.14"
65
61
  },
66
62
  "peerDependenciesMeta": {
67
63
  "sass-loader": {
@@ -71,5 +67,5 @@
71
67
  "publishConfig": {
72
68
  "access": "public"
73
69
  },
74
- "gitHead": "cc51ca75d33137950b3e179e4d95b9e03101f7d1"
70
+ "gitHead": "942849e4983555f1a7cf03a96579110a505492cb"
75
71
  }
@@ -1,26 +1,35 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="{{ lang }}">
3
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 }}">
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <meta name="generator" content="VuePress {{ version }}" />
7
7
  <style>
8
8
  :root {
9
9
  --c-bg: #fff;
10
10
  }
11
+
11
12
  html.dark {
12
13
  --c-bg: #22272e;
13
14
  }
14
- html, body {
15
+
16
+ html,
17
+ body {
15
18
  background-color: var(--c-bg);
16
19
  }
17
20
  </style>
18
21
  <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
- }
22
+ const userMode = localStorage.getItem('vuepress-color-scheme')
23
+ const systemDarkMode =
24
+ window.matchMedia &&
25
+ window.matchMedia('(prefers-color-scheme: dark)').matches
26
+
27
+ if (userMode === 'light') {
28
+ document.documentElement.dataset.theme = 'light'
29
+ } else if (userMode === 'dark' || systemDarkMode) {
30
+ document.documentElement.classList.toggle('dark', true)
31
+ document.documentElement.dataset.theme = 'dark'
32
+ }
24
33
  </script>
25
34
  <!--vuepress-ssr-head-->
26
35
  <!--vuepress-ssr-styles-->