@vuepress/theme-default 2.0.0-beta.50-pre → 2.0.0-beta.51

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 (93) 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/client/components/NavbarItems.vue +163 -0
  12. package/lib/client/components/Page.vue +24 -0
  13. package/lib/client/components/PageMeta.vue +124 -0
  14. package/lib/client/components/PageNav.vue +103 -0
  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/client/components/global/CodeGroup.d.ts +4 -0
  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/client/composables/useNavLink.d.ts +14 -0
  31. package/lib/client/composables/useNavLink.js +18 -0
  32. package/lib/client/composables/useResolveRouteWithRedirect.d.ts +5 -0
  33. package/lib/client/composables/useResolveRouteWithRedirect.js +24 -0
  34. package/lib/client/composables/useScrollPromise.d.ts +6 -0
  35. package/lib/client/composables/useScrollPromise.js +14 -0
  36. package/lib/client/composables/useSidebarItems.d.ts +36 -0
  37. package/lib/client/composables/useSidebarItems.js +118 -0
  38. package/lib/client/composables/useThemeData.d.ts +4 -0
  39. package/lib/client/composables/useThemeData.js +3 -0
  40. package/lib/client/config.d.ts +3 -0
  41. package/lib/client/config.js +44 -0
  42. package/lib/client/index.d.ts +3 -0
  43. package/lib/client/index.js +3 -0
  44. package/lib/client/layouts/Layout.vue +134 -0
  45. package/lib/client/layouts/NotFound.vue +27 -0
  46. package/lib/client/shim.d.ts +5 -0
  47. package/lib/client/styles/_mixins.scss +20 -0
  48. package/lib/client/styles/_variables.scss +11 -0
  49. package/lib/client/styles/arrow.scss +37 -0
  50. package/lib/client/styles/badge.scss +31 -0
  51. package/lib/client/styles/code-group.scss +69 -0
  52. package/lib/client/styles/code.scss +266 -0
  53. package/lib/client/styles/custom-container.scss +88 -0
  54. package/lib/client/styles/home.scss +168 -0
  55. package/lib/client/styles/index.scss +19 -0
  56. package/lib/client/styles/layout.scss +198 -0
  57. package/lib/client/styles/navbar-dropdown.scss +187 -0
  58. package/lib/client/styles/navbar.scss +177 -0
  59. package/lib/client/styles/normalize.scss +177 -0
  60. package/lib/client/styles/page.scss +83 -0
  61. package/lib/client/styles/sidebar.scss +134 -0
  62. package/lib/client/styles/toc.scss +5 -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/client/utils/resolveEditLink.d.ts +9 -0
  71. package/lib/client/utils/resolveEditLink.js +29 -0
  72. package/lib/client/utils/resolveRepoType.d.ts +2 -0
  73. package/lib/client/utils/resolveRepoType.js +12 -0
  74. package/lib/node/defaultTheme.d.ts +10 -0
  75. package/lib/node/defaultTheme.js +119 -0
  76. package/lib/node/index.d.ts +5 -0
  77. package/lib/node/index.js +5 -0
  78. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +7 -0
  79. package/lib/node/utils/assignDefaultLocaleOptions.js +56 -0
  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/shared/nav.d.ts +43 -0
  87. package/lib/shared/nav.js +1 -0
  88. package/lib/shared/options.d.ts +243 -0
  89. package/lib/shared/options.js +1 -0
  90. package/lib/shared/page.d.ts +40 -0
  91. package/lib/shared/page.js +1 -0
  92. package/package.json +22 -20
  93. package/templates/build.html +33 -0
@@ -0,0 +1,133 @@
1
+ :root {
2
+ // brand colors
3
+ --c-brand: #3eaf7c;
4
+ --c-brand-light: #4abf8a;
5
+
6
+ // background colors
7
+ --c-bg: #ffffff;
8
+ --c-bg-light: #f3f4f5;
9
+ --c-bg-lighter: #eeeeee;
10
+ --c-bg-navbar: var(--c-bg);
11
+ --c-bg-sidebar: var(--c-bg);
12
+ --c-bg-arrow: #cccccc;
13
+
14
+ // text colors
15
+ --c-text: #2c3e50;
16
+ --c-text-accent: var(--c-brand);
17
+ --c-text-light: #3a5169;
18
+ --c-text-lighter: #4e6e8e;
19
+ --c-text-lightest: #6a8bad;
20
+ --c-text-quote: #999999;
21
+
22
+ // border colors
23
+ --c-border: #eaecef;
24
+ --c-border-dark: #dfe2e5;
25
+
26
+ // custom container colors
27
+ --c-tip: #42b983;
28
+ --c-tip-bg: var(--c-bg-light);
29
+ --c-tip-title: var(--c-text);
30
+ --c-tip-text: var(--c-text);
31
+ --c-tip-text-accent: var(--c-text-accent);
32
+ --c-warning: #e7c000;
33
+ --c-warning-bg: #fffae3;
34
+ --c-warning-title: #ad9000;
35
+ --c-warning-text: #746000;
36
+ --c-warning-text-accent: var(--c-text);
37
+ --c-danger: #cc0000;
38
+ --c-danger-bg: #ffe0e0;
39
+ --c-danger-title: #990000;
40
+ --c-danger-text: #660000;
41
+ --c-danger-text-accent: var(--c-text);
42
+ --c-details-bg: #eeeeee;
43
+
44
+ // badge component colors
45
+ --c-badge-tip: var(--c-tip);
46
+ --c-badge-warning: var(--c-warning);
47
+ --c-badge-danger: var(--c-danger);
48
+
49
+ // transition vars
50
+ --t-color: 0.3s ease;
51
+ --t-transform: 0.3s ease;
52
+
53
+ // code blocks vars
54
+ --code-bg-color: #282c34;
55
+ --code-hl-bg-color: rgba(0, 0, 0, 0.66);
56
+ --code-ln-color: #9e9e9e;
57
+ --code-ln-wrapper-width: 3.5rem;
58
+
59
+ // font vars
60
+ --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
61
+ Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
62
+ --font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
63
+
64
+ // layout vars
65
+ --navbar-height: 3.6rem;
66
+ --navbar-padding-v: 0.7rem;
67
+ --navbar-padding-h: 1.5rem;
68
+ --sidebar-width: 20rem;
69
+ --sidebar-width-mobile: calc(var(--sidebar-width) * 0.82);
70
+ --content-width: 740px;
71
+ --homepage-width: 960px;
72
+ }
73
+
74
+ // plugin-back-to-top
75
+ .back-to-top {
76
+ --back-to-top-color: var(--c-brand);
77
+ --back-to-top-color-hover: var(--c-brand-light);
78
+ }
79
+
80
+ // plugin-docsearch
81
+ .DocSearch {
82
+ --docsearch-primary-color: var(--c-brand);
83
+ --docsearch-text-color: var(--c-text);
84
+ --docsearch-highlight-color: var(--c-brand);
85
+ --docsearch-muted-color: var(--c-text-quote);
86
+ --docsearch-container-background: rgba(9, 10, 17, 0.8);
87
+ --docsearch-modal-background: var(--c-bg-light);
88
+ --docsearch-searchbox-background: var(--c-bg-lighter);
89
+ --docsearch-searchbox-focus-background: var(--c-bg);
90
+ --docsearch-searchbox-shadow: inset 0 0 0 2px var(--c-brand);
91
+ --docsearch-hit-color: var(--c-text-light);
92
+ --docsearch-hit-active-color: var(--c-bg);
93
+ --docsearch-hit-background: var(--c-bg);
94
+ --docsearch-hit-shadow: 0 1px 3px 0 var(--c-border-dark);
95
+ --docsearch-footer-background: var(--c-bg);
96
+ }
97
+
98
+ // plugin-external-link-icon
99
+ .external-link-icon {
100
+ --external-link-icon-color: var(--c-text-quote);
101
+ }
102
+
103
+ // plugin-medium-zoom
104
+ .medium-zoom-overlay {
105
+ --medium-zoom-bg-color: var(--c-bg);
106
+ }
107
+
108
+ // plugin-nprogress
109
+ #nprogress {
110
+ --nprogress-color: var(--c-brand);
111
+ }
112
+
113
+ // plugin-pwa-popup
114
+ .pwa-popup {
115
+ --pwa-popup-text-color: var(--c-text);
116
+ --pwa-popup-bg-color: var(--c-bg);
117
+ --pwa-popup-border-color: var(--c-brand);
118
+ --pwa-popup-shadow: 0 4px 16px var(--c-brand);
119
+ --pwa-popup-btn-text-color: var(--c-bg);
120
+ --pwa-popup-btn-bg-color: var(--c-brand);
121
+ --pwa-popup-btn-hover-bg-color: var(--c-brand-light);
122
+ }
123
+
124
+ // plugin-search
125
+ .search-box {
126
+ --search-bg-color: var(--c-bg);
127
+ --search-accent-color: var(--c-brand);
128
+ --search-text-color: var(--c-text);
129
+ --search-border-color: var(--c-border);
130
+
131
+ --search-item-text-color: var(--c-text-lighter);
132
+ --search-item-focus-bg-color: var(--c-bg-light);
133
+ }
@@ -0,0 +1,3 @@
1
+ export * from './isActiveSidebarItem.js';
2
+ export * from './resolveEditLink.js';
3
+ export * from './resolveRepoType.js';
@@ -0,0 +1,3 @@
1
+ export * from './isActiveSidebarItem.js';
2
+ export * from './resolveEditLink.js';
3
+ export * from './resolveRepoType.js';
@@ -0,0 +1,3 @@
1
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
2
+ import type { ResolvedSidebarItem } from '../../shared/index.js';
3
+ export declare const isActiveSidebarItem: (item: ResolvedSidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
@@ -0,0 +1,20 @@
1
+ const normalizePath = (path) => decodeURI(path)
2
+ .replace(/#.*$/, '')
3
+ .replace(/(index)?\.(md|html)$/, '');
4
+ const isActiveLink = (link, route) => {
5
+ if (route.hash === link) {
6
+ return true;
7
+ }
8
+ const currentPath = normalizePath(route.path);
9
+ const targetPath = normalizePath(link);
10
+ return currentPath === targetPath;
11
+ };
12
+ export const isActiveSidebarItem = (item, route) => {
13
+ if (item.link && isActiveLink(item.link, route)) {
14
+ return true;
15
+ }
16
+ if (item.children) {
17
+ return item.children.some((child) => isActiveSidebarItem(child, route));
18
+ }
19
+ return false;
20
+ };
@@ -0,0 +1,9 @@
1
+ import type { RepoType } from './resolveRepoType.js';
2
+ export declare const editLinkPatterns: Record<Exclude<RepoType, null>, string>;
3
+ export declare const resolveEditLink: ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }: {
4
+ docsRepo: string;
5
+ docsBranch: string;
6
+ docsDir: string;
7
+ filePathRelative: string | null;
8
+ editLinkPattern?: string | undefined;
9
+ }) => string | null;
@@ -0,0 +1,29 @@
1
+ import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
2
+ import { resolveRepoType } from './resolveRepoType.js';
3
+ export const editLinkPatterns = {
4
+ GitHub: ':repo/edit/:branch/:path',
5
+ GitLab: ':repo/-/edit/:branch/:path',
6
+ Gitee: ':repo/edit/:branch/:path',
7
+ Bitbucket: ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',
8
+ };
9
+ const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
10
+ if (editLinkPattern) {
11
+ return editLinkPattern;
12
+ }
13
+ const repoType = resolveRepoType(docsRepo);
14
+ if (repoType !== null) {
15
+ return editLinkPatterns[repoType];
16
+ }
17
+ return null;
18
+ };
19
+ export const resolveEditLink = ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }) => {
20
+ if (!filePathRelative)
21
+ return null;
22
+ const pattern = resolveEditLinkPatterns({ docsRepo, editLinkPattern });
23
+ if (!pattern)
24
+ return null;
25
+ return pattern
26
+ .replace(/:repo/, isLinkHttp(docsRepo) ? docsRepo : `https://github.com/${docsRepo}`)
27
+ .replace(/:branch/, docsBranch)
28
+ .replace(/:path/, removeLeadingSlash(`${removeEndingSlash(docsDir)}/${filePathRelative}`));
29
+ };
@@ -0,0 +1,2 @@
1
+ export declare type RepoType = 'GitHub' | 'GitLab' | 'Gitee' | 'Bitbucket' | null;
2
+ export declare const resolveRepoType: (repo: string) => RepoType;
@@ -0,0 +1,12 @@
1
+ import { isLinkHttp } from '@vuepress/shared';
2
+ export const resolveRepoType = (repo) => {
3
+ if (!isLinkHttp(repo) || /github\.com/.test(repo))
4
+ return 'GitHub';
5
+ if (/bitbucket\.org/.test(repo))
6
+ return 'Bitbucket';
7
+ if (/gitlab\.com/.test(repo))
8
+ return 'GitLab';
9
+ if (/gitee\.com/.test(repo))
10
+ return 'Gitee';
11
+ return null;
12
+ };
@@ -0,0 +1,10 @@
1
+ import type { Theme } from '@vuepress/core';
2
+ import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared/index.js';
3
+ export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
4
+ /**
5
+ * To avoid confusion with the root `plugins` option,
6
+ * we use `themePlugins`
7
+ */
8
+ themePlugins?: DefaultThemePluginsOptions;
9
+ }
10
+ export declare const defaultTheme: ({ themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
@@ -0,0 +1,119 @@
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
+ templateBuild: path.resolve(__dirname, '../../templates/build.html'),
19
+ alias: {
20
+ // use alias to make all components replaceable
21
+ ...Object.fromEntries(fs
22
+ .readdirSync(path.resolve(__dirname, '../client/components'))
23
+ .filter((file) => file.endsWith('.vue'))
24
+ .map((file) => [
25
+ `@theme/${file}`,
26
+ path.resolve(__dirname, '../client/components', file),
27
+ ])),
28
+ // workaround for https://github.com/vitejs/vite/issues/7621
29
+ '@vuepress/theme-default/client': path.resolve(__dirname, '../client/index.js'),
30
+ },
31
+ clientConfigFile: path.resolve(__dirname, '../client/config.js'),
32
+ extendsPage: (page) => {
33
+ // save relative file path into page data to generate edit link
34
+ page.data.filePathRelative = page.filePathRelative;
35
+ // save title into route meta to generate navbar and sidebar
36
+ page.routeMeta.title = page.title;
37
+ },
38
+ plugins: [
39
+ // @vuepress/plugin-active-header-link
40
+ themePlugins.activeHeaderLinks !== false
41
+ ? activeHeaderLinksPlugin({
42
+ headerLinkSelector: 'a.sidebar-item',
43
+ headerAnchorSelector: '.header-anchor',
44
+ // should greater than page transition duration
45
+ delay: 300,
46
+ })
47
+ : [],
48
+ // @vuepress/plugin-back-to-top
49
+ themePlugins.backToTop !== false ? backToTopPlugin() : [],
50
+ // @vuepress/plugin-container
51
+ themePlugins.container?.tip !== false
52
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
53
+ : [],
54
+ themePlugins.container?.warning !== false
55
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
56
+ : [],
57
+ themePlugins.container?.danger !== false
58
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
59
+ : [],
60
+ themePlugins.container?.details !== false
61
+ ? containerPlugin({
62
+ type: 'details',
63
+ before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
64
+ after: () => '</details>\n',
65
+ })
66
+ : [],
67
+ themePlugins.container?.codeGroup !== false
68
+ ? containerPlugin({
69
+ type: 'code-group',
70
+ before: () => `<CodeGroup>\n`,
71
+ after: () => '</CodeGroup>\n',
72
+ })
73
+ : [],
74
+ themePlugins.container?.codeGroupItem !== false
75
+ ? containerPlugin({
76
+ type: 'code-group-item',
77
+ before: (info) => `<CodeGroupItem title="${info}">\n`,
78
+ after: () => '</CodeGroupItem>\n',
79
+ })
80
+ : [],
81
+ // @vuepress/plugin-external-link-icon
82
+ themePlugins.externalLinkIcon !== false
83
+ ? externalLinkIconPlugin({
84
+ locales: Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
85
+ result[key] = {
86
+ openInNewWindow: value.openInNewWindow ?? localeOptions.openInNewWindow,
87
+ };
88
+ return result;
89
+ }, {}),
90
+ })
91
+ : [],
92
+ // @vuepress/plugin-git
93
+ themePlugins.git !== false
94
+ ? gitPlugin({
95
+ createdTime: false,
96
+ updatedTime: localeOptions.lastUpdated !== false,
97
+ contributors: localeOptions.contributors !== false,
98
+ })
99
+ : [],
100
+ // @vuepress/plugin-medium-zoom
101
+ themePlugins.mediumZoom !== false
102
+ ? mediumZoomPlugin({
103
+ selector: '.theme-default-content > img, .theme-default-content :not(a) > img',
104
+ zoomOptions: {},
105
+ // should greater than page transition duration
106
+ delay: 300,
107
+ })
108
+ : [],
109
+ // @vuepress/plugin-nprogress
110
+ themePlugins.nprogress !== false ? nprogressPlugin() : [],
111
+ // @vuepress/plugin-palette
112
+ palettePlugin({ preset: 'sass' }),
113
+ // @vuepress/plugin-prismjs
114
+ themePlugins.prismjs !== false ? prismjsPlugin() : [],
115
+ // @vuepress/plugin-theme-data
116
+ themeDataPlugin({ themeData: localeOptions }),
117
+ ],
118
+ };
119
+ };
@@ -0,0 +1,5 @@
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,5 @@
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;
@@ -0,0 +1,56 @@
1
+ export const DEFAULT_LOCALE_OPTIONS = {
2
+ // color mode
3
+ colorMode: 'auto',
4
+ colorModeSwitch: true,
5
+ // navbar
6
+ navbar: [],
7
+ logo: null,
8
+ repo: null,
9
+ selectLanguageText: 'Languages',
10
+ selectLanguageAriaLabel: 'Select language',
11
+ // sidebar
12
+ sidebar: 'auto',
13
+ sidebarDepth: 2,
14
+ // page meta
15
+ editLink: true,
16
+ editLinkText: 'Edit this page',
17
+ lastUpdated: true,
18
+ lastUpdatedText: 'Last Updated',
19
+ contributors: true,
20
+ contributorsText: 'Contributors',
21
+ // 404 page messages
22
+ notFound: [
23
+ `There's nothing here.`,
24
+ `How did we get here?`,
25
+ `That's a Four-Oh-Four.`,
26
+ `Looks like we've got some broken links.`,
27
+ ],
28
+ backToHome: 'Take me home',
29
+ // a11y
30
+ openInNewWindow: 'open in new window',
31
+ toggleColorMode: 'toggle color mode',
32
+ toggleSidebar: 'toggle sidebar',
33
+ };
34
+ export const DEFAULT_LOCALE_DATA = {
35
+ // navbar
36
+ selectLanguageName: 'English',
37
+ };
38
+ /**
39
+ * Assign default options
40
+ */
41
+ export const assignDefaultLocaleOptions = (localeOptions) => {
42
+ if (!localeOptions.locales) {
43
+ localeOptions.locales = {};
44
+ }
45
+ if (!localeOptions.locales['/']) {
46
+ localeOptions.locales['/'] = {};
47
+ }
48
+ Object.assign(localeOptions, {
49
+ ...DEFAULT_LOCALE_OPTIONS,
50
+ ...localeOptions,
51
+ });
52
+ Object.assign(localeOptions.locales['/'], {
53
+ ...DEFAULT_LOCALE_DATA,
54
+ ...localeOptions.locales['/'],
55
+ });
56
+ };
@@ -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';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Base nav item, displayed as text
3
+ */
4
+ export interface NavItem {
5
+ text: string;
6
+ ariaLabel?: string;
7
+ }
8
+ /**
9
+ * Base nav group, has nav items children
10
+ */
11
+ export interface NavGroup<T> extends NavItem {
12
+ children: T[];
13
+ }
14
+ /**
15
+ * Props for `<AutoLink>`
16
+ */
17
+ export interface NavLink extends NavItem {
18
+ link: string;
19
+ rel?: string;
20
+ target?: string;
21
+ activeMatch?: string;
22
+ }
23
+ /**
24
+ * Navbar types
25
+ */
26
+ export declare type NavbarItem = NavLink;
27
+ export declare type NavbarGroup = NavGroup<NavbarGroup | NavbarItem | string>;
28
+ export declare type NavbarConfig = (NavbarItem | NavbarGroup | string)[];
29
+ export declare type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarItem>;
30
+ /**
31
+ * Sidebar types
32
+ */
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
+ export declare type SidebarConfigObject = Record<string, SidebarConfigArray>;
40
+ export declare type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
41
+ export declare type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
42
+ collapsible?: boolean;
43
+ };
@@ -0,0 +1 @@
1
+ export {};