@vuepress/theme-default 2.0.0-beta.26 → 2.0.0-beta.30

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 (41) hide show
  1. package/lib/client/clientAppEnhance.js +4 -5
  2. package/lib/client/components/DropdownLink.vue +51 -51
  3. package/lib/client/components/DropdownTransition.vue +11 -11
  4. package/lib/client/components/Home.vue +12 -107
  5. package/lib/client/components/HomeContent.vue +5 -0
  6. package/lib/client/components/HomeFeatures.vue +23 -0
  7. package/lib/client/components/HomeFooter.vue +17 -0
  8. package/lib/client/components/HomeHero.vue +97 -0
  9. package/lib/client/components/NavLink.vue +33 -33
  10. package/lib/client/components/Navbar.vue +23 -54
  11. package/lib/client/components/NavbarBrand.vue +55 -0
  12. package/lib/client/components/NavbarLinks.vue +16 -11
  13. package/lib/client/components/Page.vue +5 -5
  14. package/lib/client/components/PageMeta.vue +34 -31
  15. package/lib/client/components/PageNav.vue +14 -16
  16. package/lib/client/components/Sidebar.vue +8 -8
  17. package/lib/client/components/ToggleDarkModeButton.vue +11 -11
  18. package/lib/client/components/ToggleSidebarButton.vue +8 -8
  19. package/lib/client/components/global/Badge.vue +12 -12
  20. package/lib/client/components/global/CodeGroup.d.ts +1 -1
  21. package/lib/client/components/global/CodeGroupItem.vue +10 -10
  22. package/lib/client/components/global/{OutboundLink.vue → ExternalLinkIcon.vue} +7 -10
  23. package/lib/client/composables/useSidebarItems.d.ts +1 -1
  24. package/lib/client/index.d.ts +1 -1
  25. package/lib/client/layouts/404.vue +12 -12
  26. package/lib/client/layouts/Layout.vue +54 -54
  27. package/lib/client/styles/code.scss +1 -0
  28. package/lib/client/styles/home.scss +7 -4
  29. package/lib/client/styles/normalize.scss +1 -0
  30. package/lib/client/styles/page.scss +8 -0
  31. package/lib/client/styles/vars.scss +5 -0
  32. package/lib/client/utils/resolveEditLink.d.ts +1 -1
  33. package/lib/client/utils/resolveEditLink.js +12 -7
  34. package/lib/node/defaultTheme.js +28 -13
  35. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +3 -1
  36. package/lib/node/utils/assignDefaultLocaleOptions.js +5 -5
  37. package/lib/node/utils/resolveContainerPluginOptions.d.ts +1 -1
  38. package/lib/node/utils/resolveGitPluginOptions.d.ts +1 -1
  39. package/lib/shared/options.d.ts +5 -1
  40. package/lib/shared/page.d.ts +3 -1
  41. package/package.json +21 -20
@@ -3,47 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultTheme = void 0;
4
4
  const utils_1 = require("@vuepress/utils");
5
5
  const utils_2 = require("./utils");
6
- const defaultTheme = ({ themePlugins = {}, ...localeOptions }) => {
7
- utils_2.assignDefaultLocaleOptions(localeOptions);
6
+ const defaultTheme = ({ themePlugins = {}, ...localeOptions }, app) => {
7
+ if (app.options.bundler.endsWith('vite')) {
8
+ // eslint-disable-next-line import/no-extraneous-dependencies
9
+ app.options.bundlerConfig.viteOptions = require('vite').mergeConfig(app.options.bundlerConfig.viteOptions, {
10
+ css: {
11
+ preprocessorOptions: {
12
+ scss: { charset: false },
13
+ },
14
+ },
15
+ });
16
+ }
17
+ (0, utils_2.assignDefaultLocaleOptions)(localeOptions);
8
18
  return {
9
19
  name: '@vuepress/theme-default',
10
20
  layouts: utils_1.path.resolve(__dirname, '../client/layouts'),
11
21
  clientAppEnhanceFiles: utils_1.path.resolve(__dirname, '../client/clientAppEnhance.js'),
12
22
  clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
13
- // use the relative file path to generate edit link
14
- extendsPageData: ({ filePathRelative }) => ({ filePathRelative }),
23
+ extendsPage: (page) => {
24
+ // save relative file path into page data to generate edit link
25
+ page.data.filePathRelative = page.filePathRelative;
26
+ // save title into route meta to generate navbar and sidebar
27
+ page.routeMeta.title = page.title;
28
+ },
15
29
  plugins: [
16
30
  [
17
31
  '@vuepress/active-header-links',
18
- utils_2.resolveActiveHeaderLinksPluginOptions(themePlugins),
32
+ (0, utils_2.resolveActiveHeaderLinksPluginOptions)(themePlugins),
19
33
  ],
20
34
  ['@vuepress/back-to-top', themePlugins.backToTop !== false],
21
35
  [
22
36
  '@vuepress/container',
23
- utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'tip'),
37
+ (0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'tip'),
24
38
  ],
25
39
  [
26
40
  '@vuepress/container',
27
- utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'warning'),
41
+ (0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'warning'),
28
42
  ],
29
43
  [
30
44
  '@vuepress/container',
31
- utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'danger'),
45
+ (0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'danger'),
32
46
  ],
33
47
  [
34
48
  '@vuepress/container',
35
- utils_2.resolveContainerPluginOptionsForDetails(themePlugins),
49
+ (0, utils_2.resolveContainerPluginOptionsForDetails)(themePlugins),
36
50
  ],
37
51
  [
38
52
  '@vuepress/container',
39
- utils_2.resolveContainerPluginOptionsForCodeGroup(themePlugins),
53
+ (0, utils_2.resolveContainerPluginOptionsForCodeGroup)(themePlugins),
40
54
  ],
41
55
  [
42
56
  '@vuepress/container',
43
- utils_2.resolveContainerPluginOptionsForCodeGroupItem(themePlugins),
57
+ (0, utils_2.resolveContainerPluginOptionsForCodeGroupItem)(themePlugins),
44
58
  ],
45
- ['@vuepress/git', utils_2.resolveGitPluginOptions(themePlugins, localeOptions)],
46
- ['@vuepress/medium-zoom', utils_2.resolveMediumZoomPluginOptions(themePlugins)],
59
+ ['@vuepress/external-link-icon', themePlugins.externalLinkIcon !== false],
60
+ ['@vuepress/git', (0, utils_2.resolveGitPluginOptions)(themePlugins, localeOptions)],
61
+ ['@vuepress/medium-zoom', (0, utils_2.resolveMediumZoomPluginOptions)(themePlugins)],
47
62
  ['@vuepress/nprogress', themePlugins.nprogress !== false],
48
63
  ['@vuepress/palette', { preset: 'sass' }],
49
64
  ['@vuepress/prismjs', themePlugins.prismjs !== false],
@@ -1,4 +1,6 @@
1
- import type { DefaultThemeLocaleOptions } from '../../shared';
1
+ import type { DefaultThemeLocaleData, DefaultThemeLocaleOptions } from '../../shared';
2
+ export declare const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions;
3
+ export declare const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData;
2
4
  /**
3
5
  * Assign default options to `themeConfig`
4
6
  */
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assignDefaultLocaleOptions = void 0;
4
- const defaultLocaleOptions = {
3
+ exports.assignDefaultLocaleOptions = exports.DEFAULT_LOCALE_DATA = exports.DEFAULT_LOCALE_OPTIONS = void 0;
4
+ exports.DEFAULT_LOCALE_OPTIONS = {
5
5
  // navbar
6
6
  navbar: [],
7
7
  logo: null,
@@ -32,7 +32,7 @@ const defaultLocaleOptions = {
32
32
  toggleDarkMode: 'toggle dark mode',
33
33
  toggleSidebar: 'toggle sidebar',
34
34
  };
35
- const defaultLocaleData = {
35
+ exports.DEFAULT_LOCALE_DATA = {
36
36
  // navbar
37
37
  selectLanguageName: 'English',
38
38
  };
@@ -47,11 +47,11 @@ const assignDefaultLocaleOptions = (localeOptions) => {
47
47
  localeOptions.locales['/'] = {};
48
48
  }
49
49
  Object.assign(localeOptions, {
50
- ...defaultLocaleOptions,
50
+ ...exports.DEFAULT_LOCALE_OPTIONS,
51
51
  ...localeOptions,
52
52
  });
53
53
  Object.assign(localeOptions.locales['/'], {
54
- ...defaultLocaleData,
54
+ ...exports.DEFAULT_LOCALE_DATA,
55
55
  ...localeOptions.locales['/'],
56
56
  });
57
57
  };
@@ -1,5 +1,5 @@
1
1
  import type { ContainerPluginOptions } from '@vuepress/plugin-container';
2
- import type { DefaultThemePluginsOptions, DefaultThemeData } from '../../shared';
2
+ import type { DefaultThemeData, DefaultThemePluginsOptions } from '../../shared';
3
3
  /**
4
4
  * Resolve options for @vuepress/plugin-container
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import type { GitPluginOptions } from '@vuepress/plugin-git';
2
- import type { DefaultThemePluginsOptions, DefaultThemeLocaleOptions } from '../../shared';
2
+ import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../../shared';
3
3
  /**
4
4
  * Resolve options for @vuepress/plugin-git
5
5
  */
@@ -21,6 +21,10 @@ export interface DefaultThemePluginsOptions {
21
21
  codeGroup?: boolean;
22
22
  codeGroupItem?: boolean;
23
23
  };
24
+ /**
25
+ * Enable @vuepress/plugin-external-link-icon or not
26
+ */
27
+ externalLinkIcon?: boolean;
24
28
  /**
25
29
  * Enable @vuepress/plugin-git or not
26
30
  */
@@ -219,7 +223,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
219
223
  */
220
224
  backToHome?: string;
221
225
  /**
222
- * A11y text for `<OutboundLink>`
226
+ * A11y text for external link icon
223
227
  */
224
228
  openInNewWindow?: string;
225
229
  /**
@@ -1,7 +1,7 @@
1
1
  import type { GitPluginPageData } from '@vuepress/plugin-git';
2
2
  import type { NavLink, SidebarConfig } from './nav';
3
3
  export interface DefaultThemePageData extends GitPluginPageData {
4
- filePathRelative: string;
4
+ filePathRelative: string | null;
5
5
  }
6
6
  export interface DefaultThemePageFrontmatter {
7
7
  home?: boolean;
@@ -11,6 +11,7 @@ export interface DefaultThemePageFrontmatter {
11
11
  export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontmatter {
12
12
  home: true;
13
13
  heroImage?: string;
14
+ heroImageDark?: string;
14
15
  heroAlt?: string;
15
16
  heroText?: string | null;
16
17
  tagline?: string | null;
@@ -29,6 +30,7 @@ export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontma
29
30
  export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFrontmatter {
30
31
  home?: false;
31
32
  editLink?: boolean;
33
+ editLinkPattern?: string;
32
34
  lastUpdated?: boolean;
33
35
  contributors?: boolean;
34
36
  sidebar?: 'auto' | false | SidebarConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-beta.26",
3
+ "version": "2.0.0-beta.30",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -29,27 +29,28 @@
29
29
  "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
30
30
  },
31
31
  "dependencies": {
32
- "@vuepress/client": "2.0.0-beta.26",
33
- "@vuepress/core": "2.0.0-beta.26",
34
- "@vuepress/plugin-active-header-links": "2.0.0-beta.26",
35
- "@vuepress/plugin-back-to-top": "2.0.0-beta.26",
36
- "@vuepress/plugin-container": "2.0.0-beta.26",
37
- "@vuepress/plugin-git": "2.0.0-beta.26",
38
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.26",
39
- "@vuepress/plugin-nprogress": "2.0.0-beta.26",
40
- "@vuepress/plugin-palette": "2.0.0-beta.26",
41
- "@vuepress/plugin-prismjs": "2.0.0-beta.26",
42
- "@vuepress/plugin-theme-data": "2.0.0-beta.26",
43
- "@vuepress/shared": "2.0.0-beta.25",
44
- "@vuepress/utils": "2.0.0-beta.25",
45
- "@vueuse/core": "^6.0.0",
46
- "sass": "^1.38.0",
47
- "sass-loader": "^12.1.0",
48
- "vue": "^3.2.3",
49
- "vue-router": "^4.0.10"
32
+ "@vuepress/client": "2.0.0-beta.29",
33
+ "@vuepress/core": "2.0.0-beta.29",
34
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.29",
35
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.30",
36
+ "@vuepress/plugin-container": "2.0.0-beta.29",
37
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.29",
38
+ "@vuepress/plugin-git": "2.0.0-beta.29",
39
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.29",
40
+ "@vuepress/plugin-nprogress": "2.0.0-beta.29",
41
+ "@vuepress/plugin-palette": "2.0.0-beta.29",
42
+ "@vuepress/plugin-prismjs": "2.0.0-beta.29",
43
+ "@vuepress/plugin-theme-data": "2.0.0-beta.29",
44
+ "@vuepress/shared": "2.0.0-beta.28",
45
+ "@vuepress/utils": "2.0.0-beta.28",
46
+ "@vueuse/core": "^7.1.2",
47
+ "sass": "^1.44.0",
48
+ "sass-loader": "^12.4.0",
49
+ "vue": "^3.2.24",
50
+ "vue-router": "^4.0.12"
50
51
  },
51
52
  "publishConfig": {
52
53
  "access": "public"
53
54
  },
54
- "gitHead": "6cbf3e07b2871383cebad5180fcbb02d69c79566"
55
+ "gitHead": "b39bb4b791c95d5c40c64198b3931f80005475ef"
55
56
  }