@vuepress/theme-default 2.0.0-rc.0 → 2.0.0-rc.10

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 (44) hide show
  1. package/LICENSE +1 -1
  2. package/lib/client/components/AutoLink.vue +13 -19
  3. package/lib/client/components/HomeFeatures.vue +2 -3
  4. package/lib/client/components/HomeFooter.vue +1 -1
  5. package/lib/client/components/HomeHero.vue +4 -5
  6. package/lib/client/components/NavbarBrand.vue +16 -6
  7. package/lib/client/components/NavbarItems.vue +25 -20
  8. package/lib/client/components/PageMeta.vue +1 -1
  9. package/lib/client/components/PageNav.vue +27 -8
  10. package/lib/client/components/global/CodeGroup.d.ts +1 -1
  11. package/lib/client/components/global/CodeGroup.js +6 -6
  12. package/lib/client/components/global/CodeGroupItem.vue +3 -7
  13. package/lib/client/composables/index.d.ts +0 -2
  14. package/lib/client/composables/index.js +0 -2
  15. package/lib/client/composables/useSidebarItems.d.ts +5 -5
  16. package/lib/client/composables/useSidebarItems.js +24 -25
  17. package/lib/client/config.d.ts +2 -1
  18. package/lib/client/config.js +8 -4
  19. package/lib/client/index.d.ts +1 -1
  20. package/lib/client/index.js +0 -1
  21. package/lib/client/layouts/Layout.vue +1 -1
  22. package/lib/client/layouts/NotFound.vue +2 -2
  23. package/lib/client/styles/code-group.scss +4 -11
  24. package/lib/client/styles/code.scss +1 -1
  25. package/lib/client/styles/layout.scss +1 -1
  26. package/lib/client/styles/normalize.scss +24 -24
  27. package/lib/client/styles/vars.scss +17 -1
  28. package/lib/client/{composables/useNavLink.d.ts → utils/getNavLink.d.ts} +1 -6
  29. package/lib/client/utils/getNavLink.js +17 -0
  30. package/lib/client/utils/index.d.ts +1 -0
  31. package/lib/client/utils/index.js +1 -0
  32. package/lib/client/utils/resolveEditLink.js +1 -1
  33. package/lib/client/utils/resolveRepoType.js +1 -1
  34. package/lib/node/defaultTheme.d.ts +6 -2
  35. package/lib/node/defaultTheme.js +33 -3
  36. package/lib/node/index.d.ts +2 -1
  37. package/lib/node/index.js +1 -1
  38. package/lib/shared/nav.d.ts +2 -1
  39. package/lib/shared/options.d.ts +33 -2
  40. package/package.json +32 -29
  41. package/templates/build.html +13 -10
  42. package/lib/client/composables/useNavLink.js +0 -18
  43. package/lib/client/composables/useResolveRouteWithRedirect.d.ts +0 -5
  44. package/lib/client/composables/useResolveRouteWithRedirect.js +0 -24
@@ -3,9 +3,9 @@ import Home from '@theme/Home.vue'
3
3
  import Navbar from '@theme/Navbar.vue'
4
4
  import Page from '@theme/Page.vue'
5
5
  import Sidebar from '@theme/Sidebar.vue'
6
- import { usePageData, usePageFrontmatter } from '@vuepress/client'
7
6
  import { computed, onMounted, onUnmounted, ref } from 'vue'
8
7
  import { useRouter } from 'vue-router'
8
+ import { usePageData, usePageFrontmatter } from 'vuepress/client'
9
9
  import type { DefaultThemePageFrontmatter } from '../../shared/index.js'
10
10
  import {
11
11
  useScrollPromise,
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useRouteLocale } from '@vuepress/client'
2
+ import { RouteLink, useRouteLocale } from 'vuepress/client'
3
3
  import { useThemeLocaleData } from '../composables/index.js'
4
4
 
5
5
  const routeLocale = useRouteLocale()
@@ -20,7 +20,7 @@ const homeText = themeLocale.value.backToHome ?? 'Back to home'
20
20
 
21
21
  <blockquote>{{ getMsg() }}</blockquote>
22
22
 
23
- <RouterLink :to="homeLink">{{ homeText }}</RouterLink>
23
+ <RouteLink :to="homeLink">{{ homeText }}</RouteLink>
24
24
  </div>
25
25
  </main>
26
26
  </div>
@@ -12,14 +12,7 @@
12
12
  padding-top: 10px;
13
13
  border-top-left-radius: 6px;
14
14
  border-top-right-radius: 6px;
15
- background-color: var(--code-bg-color);
16
- }
17
-
18
- .code-group__ul {
19
- margin: auto 0;
20
- padding-left: 0;
21
- display: inline-flex;
22
- list-style: none;
15
+ background-color: var(--c-code-group-tab-bg);
23
16
  }
24
17
 
25
18
  .code-group__nav-tab {
@@ -29,7 +22,7 @@
29
22
  background-color: transparent;
30
23
  font-size: 0.85em;
31
24
  line-height: 1.4;
32
- color: rgba(255, 255, 255, 0.9);
25
+ color: var(--c-code-group-tab-title);
33
26
  font-weight: 600;
34
27
  }
35
28
 
@@ -38,11 +31,11 @@
38
31
  }
39
32
 
40
33
  .code-group__nav-tab:focus-visible {
41
- outline: 1px solid rgba(255, 255, 255, 0.9);
34
+ outline: 1px solid var(--c-code-group-tab-outline);
42
35
  }
43
36
 
44
37
  .code-group__nav-tab-active {
45
- border-bottom: var(--c-brand) 1px solid;
38
+ border-bottom: var(--c-code-group-tab-active-border) 1px solid;
46
39
  }
47
40
 
48
41
  @media (max-width: $MQMobileNarrow) {
@@ -156,7 +156,7 @@ div[class*='language-'] {
156
156
  border-radius: 6px;
157
157
 
158
158
  &::before {
159
- content: attr(data-ext);
159
+ content: attr(data-title);
160
160
  position: absolute;
161
161
  z-index: 3;
162
162
  top: 0.8em;
@@ -126,7 +126,7 @@
126
126
  }
127
127
 
128
128
  .theme-default-content {
129
- a:hover {
129
+ a:not(.header-anchor):hover {
130
130
  text-decoration: underline;
131
131
  }
132
132
 
@@ -92,8 +92,30 @@ h6 {
92
92
  outline: none;
93
93
  }
94
94
 
95
- &:hover .header-anchor {
96
- opacity: 1;
95
+ .header-anchor {
96
+ color: inherit;
97
+ text-decoration: none;
98
+ position: relative;
99
+
100
+ &:hover::before {
101
+ font-size: 0.8em;
102
+ content: '¶';
103
+ position: absolute;
104
+ left: -0.75em;
105
+ color: var(--c-brand);
106
+ }
107
+
108
+ &:focus-visible {
109
+ outline: none;
110
+
111
+ &::before {
112
+ content: '¶';
113
+ position: absolute;
114
+ left: -0.75em;
115
+ color: var(--c-brand);
116
+ outline: auto;
117
+ }
118
+ }
97
119
  }
98
120
  }
99
121
 
@@ -125,28 +147,6 @@ h6 {
125
147
  }
126
148
 
127
149
  a {
128
- &.header-anchor {
129
- font-size: 0.85em;
130
- float: left;
131
- margin-left: -0.87em;
132
- padding-right: 0.23em;
133
- margin-top: 0.125em;
134
- opacity: 0;
135
- user-select: none;
136
-
137
- @media print {
138
- display: none;
139
- }
140
-
141
- &:hover {
142
- text-decoration: none;
143
- }
144
-
145
- &:focus-visible {
146
- opacity: 1;
147
- }
148
- }
149
-
150
150
  @media print {
151
151
  &[href^="http://"],
152
152
  &[href^="https://"]
@@ -62,6 +62,12 @@
62
62
  --c-badge-danger: #dc2626;
63
63
  --c-badge-danger-text: var(--c-bg);
64
64
 
65
+ // code group colors
66
+ --c-code-group-tab-title: rgba(255, 255, 255, 0.9);
67
+ --c-code-group-tab-bg: var(--code-bg-color);
68
+ --c-code-group-tab-outline: var(var(--c-code-group-tab-title));
69
+ --c-code-group-tab-active-border: var(--c-brand);
70
+
65
71
  // transition vars
66
72
  --t-color: 0.3s ease;
67
73
  --t-transform: 0.3s ease;
@@ -88,9 +94,19 @@
88
94
  }
89
95
 
90
96
  // plugin-back-to-top
91
- .back-to-top {
97
+ .vp-back-to-top-button {
92
98
  --back-to-top-color: var(--c-brand);
93
99
  --back-to-top-color-hover: var(--c-brand-light);
100
+ --back-to-top-bg-color: var(--c-bg);
101
+ }
102
+
103
+ // catalog
104
+ .vp-catalog-wrapper {
105
+ --catalog-bg-color: var(--c-bg);
106
+ --catalog-bg-secondary-color: var(--c-bg-dark);
107
+ --catalog-border-color: var(--c-border);
108
+ --catalog-active-color: var(--c-brand);
109
+ --catalog-hover-color: var(--c-brand-light);
94
110
  }
95
111
 
96
112
  // plugin-docsearch
@@ -1,9 +1,4 @@
1
1
  import type { NavLink } from '../../shared/index.js';
2
- declare module 'vue-router' {
3
- interface RouteMeta {
4
- title?: string;
5
- }
6
- }
7
2
  /**
8
3
  * Resolve NavLink props from string
9
4
  *
@@ -11,4 +6,4 @@ declare module 'vue-router' {
11
6
  * - Input: '/README.md'
12
7
  * - Output: { text: 'Home', link: '/' }
13
8
  */
14
- export declare const useNavLink: (item: string) => NavLink;
9
+ export declare const getNavLink: (config: string) => NavLink;
@@ -0,0 +1,17 @@
1
+ import { resolveRoute } from 'vuepress/client';
2
+ /**
3
+ * Resolve NavLink props from string
4
+ *
5
+ * @example
6
+ * - Input: '/README.md'
7
+ * - Output: { text: 'Home', link: '/' }
8
+ */
9
+ export const getNavLink = (config) => {
10
+ const { notFound, meta, path } = resolveRoute(config);
11
+ return notFound
12
+ ? { text: path, link: path }
13
+ : {
14
+ text: meta.title || path,
15
+ link: path,
16
+ };
17
+ };
@@ -1,3 +1,4 @@
1
+ export * from './getNavLink.js';
1
2
  export * from './isActiveSidebarItem.js';
2
3
  export * from './resolveEditLink.js';
3
4
  export * from './resolveRepoType.js';
@@ -1,3 +1,4 @@
1
+ export * from './getNavLink.js';
1
2
  export * from './isActiveSidebarItem.js';
2
3
  export * from './resolveEditLink.js';
3
4
  export * from './resolveRepoType.js';
@@ -1,4 +1,4 @@
1
- import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
1
+ import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from 'vuepress/shared';
2
2
  import { resolveRepoType } from './resolveRepoType.js';
3
3
  export const editLinkPatterns = {
4
4
  GitHub: ':repo/edit/:branch/:path',
@@ -1,4 +1,4 @@
1
- import { isLinkHttp } from '@vuepress/shared';
1
+ import { isLinkHttp } from 'vuepress/shared';
2
2
  export const resolveRepoType = (repo) => {
3
3
  if (!isLinkHttp(repo) || /github\.com/.test(repo))
4
4
  return 'GitHub';
@@ -1,10 +1,14 @@
1
- import type { Theme } from '@vuepress/core';
1
+ import type { Theme } from 'vuepress/core';
2
2
  import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared/index.js';
3
3
  export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
4
+ /**
5
+ * deployed hostname
6
+ */
7
+ hostname?: string;
4
8
  /**
5
9
  * To avoid confusion with the root `plugins` option,
6
10
  * we use `themePlugins`
7
11
  */
8
12
  themePlugins?: DefaultThemePluginsOptions;
9
13
  }
10
- export declare const defaultTheme: ({ themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
14
+ export declare const defaultTheme: ({ hostname, themePlugins, ...localeOptions }?: DefaultThemeOptions) => Theme;
@@ -1,17 +1,21 @@
1
1
  import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
2
2
  import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
3
3
  import { containerPlugin } from '@vuepress/plugin-container';
4
+ import { copyCodePlugin } from '@vuepress/plugin-copy-code';
4
5
  import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon';
5
6
  import { gitPlugin } from '@vuepress/plugin-git';
6
7
  import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
7
8
  import { nprogressPlugin } from '@vuepress/plugin-nprogress';
8
9
  import { palettePlugin } from '@vuepress/plugin-palette';
9
10
  import { prismjsPlugin } from '@vuepress/plugin-prismjs';
11
+ import { seoPlugin } from '@vuepress/plugin-seo';
12
+ import { sitemapPlugin } from '@vuepress/plugin-sitemap';
10
13
  import { themeDataPlugin } from '@vuepress/plugin-theme-data';
11
- import { fs, getDirname, path } from '@vuepress/utils';
14
+ import { isPlainObject } from 'vuepress/shared';
15
+ import { fs, getDirname, path } from 'vuepress/utils';
12
16
  import { assignDefaultLocaleOptions, resolveContainerPluginOptions, } from './utils/index.js';
13
17
  const __dirname = getDirname(import.meta.url);
14
- export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
18
+ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } = {}) => {
15
19
  assignDefaultLocaleOptions(localeOptions);
16
20
  return {
17
21
  name: '@vuepress/theme-default',
@@ -44,7 +48,17 @@ export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
44
48
  })
45
49
  : [],
46
50
  // @vuepress/plugin-back-to-top
47
- themePlugins.backToTop !== false ? backToTopPlugin() : [],
51
+ themePlugins.backToTop !== false
52
+ ? backToTopPlugin(isPlainObject(themePlugins.backToTop) ? themePlugins.backToTop : {})
53
+ : [],
54
+ // @vuepress/plugin-copy-code
55
+ themePlugins.copyCode !== false
56
+ ? copyCodePlugin({
57
+ ...(isPlainObject(themePlugins.copyCode)
58
+ ? themePlugins.copyCode
59
+ : {}),
60
+ })
61
+ : [],
48
62
  // @vuepress/plugin-container
49
63
  themePlugins.container?.tip !== false
50
64
  ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
@@ -110,6 +124,22 @@ export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
110
124
  palettePlugin({ preset: 'sass' }),
111
125
  // @vuepress/plugin-prismjs
112
126
  themePlugins.prismjs !== false ? prismjsPlugin() : [],
127
+ // @vuepress/plugin-seo
128
+ hostname && themePlugins.seo !== false
129
+ ? seoPlugin({
130
+ hostname,
131
+ ...(isPlainObject(themePlugins.seo) ? themePlugins.seo : {}),
132
+ })
133
+ : [],
134
+ // @vuepress/plugin-sitemap
135
+ hostname && themePlugins.sitemap !== false
136
+ ? sitemapPlugin({
137
+ hostname,
138
+ ...(isPlainObject(themePlugins.sitemap)
139
+ ? themePlugins.sitemap
140
+ : {}),
141
+ })
142
+ : [],
113
143
  // @vuepress/plugin-theme-data
114
144
  themeDataPlugin({ themeData: localeOptions }),
115
145
  ],
@@ -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;
@@ -35,7 +35,8 @@ export type SidebarGroup = SidebarItem & NavGroup<SidebarItem | SidebarGroup | s
35
35
  collapsible?: boolean;
36
36
  };
37
37
  export type SidebarConfigArray = (SidebarItem | SidebarGroup | string)[];
38
- export type SidebarConfigObject = Record<string, SidebarConfigArray>;
38
+ export type SidebarConfigObjectItem = SidebarConfigArray | 'heading';
39
+ export type SidebarConfigObject = Record<string, SidebarConfigObjectItem>;
39
40
  export type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
40
41
  export type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
41
42
  collapsible?: boolean;
@@ -1,5 +1,9 @@
1
+ import type { BackToTopPluginOptions } from '@vuepress/plugin-back-to-top';
2
+ import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
3
+ import type { SeoPluginOptions } from '@vuepress/plugin-seo';
4
+ import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
1
5
  import type { ThemeData } from '@vuepress/plugin-theme-data';
2
- import type { LocaleData } from '@vuepress/shared';
6
+ import type { LocaleData } from 'vuepress/shared';
3
7
  import type { NavbarConfig, SidebarConfig } from './nav.js';
4
8
  export interface DefaultThemePluginsOptions {
5
9
  /**
@@ -9,7 +13,7 @@ export interface DefaultThemePluginsOptions {
9
13
  /**
10
14
  * Enable @vuepress/plugin-back-to-top or not
11
15
  */
12
- backToTop?: boolean;
16
+ backToTop?: BackToTopPluginOptions | boolean;
13
17
  /**
14
18
  * Enable @vuepress/plugin-container or not
15
19
  */
@@ -21,6 +25,10 @@ export interface DefaultThemePluginsOptions {
21
25
  codeGroup?: boolean;
22
26
  codeGroupItem?: boolean;
23
27
  };
28
+ /**
29
+ * Enable @vuepress/plugin-copy-code or not
30
+ */
31
+ copyCode?: CopyCodePluginOptions | boolean;
24
32
  /**
25
33
  * Enable @vuepress/plugin-external-link-icon or not
26
34
  */
@@ -41,6 +49,14 @@ export interface DefaultThemePluginsOptions {
41
49
  * Enable @vuepress/plugin-prismjs or not
42
50
  */
43
51
  prismjs?: boolean;
52
+ /**
53
+ * Enable @vuepress/plugin-seo or not
54
+ */
55
+ seo?: Partial<SeoPluginOptions> | boolean;
56
+ /**
57
+ * Enable @vuepress/plugin-sitemap or not
58
+ */
59
+ sitemap?: Partial<SitemapPluginOptions> | boolean;
44
60
  }
45
61
  export type DefaultThemeLocaleOptions = DefaultThemeData;
46
62
  export type DefaultThemeData = ThemeData<DefaultThemeLocaleData>;
@@ -69,6 +85,14 @@ export interface DefaultThemeLocaleData extends LocaleData {
69
85
  * Set to `false` to disable navbar in current locale
70
86
  */
71
87
  navbar?: false | NavbarConfig;
88
+ /**
89
+ * Navbar label used for screen readers using the `aria-label` attribute
90
+ */
91
+ navbarLabel?: null | string;
92
+ /**
93
+ * Page navbar label used for screen readers using the `aria-label` attribute
94
+ */
95
+ pageNavbarLabel?: null | string;
72
96
  /**
73
97
  * Navbar logo config
74
98
  *
@@ -81,6 +105,13 @@ export interface DefaultThemeLocaleData extends LocaleData {
81
105
  * Logo to display in navbar in dark mode
82
106
  */
83
107
  logoDark?: null | string;
108
+ /**
109
+ * The alt text of navbar logo.
110
+ * Defaults to the site title if not specified.
111
+ * If the value is the same as the site title, the site title rendered in the navbar will be
112
+ * hidden from screen readers to avoid duplication.
113
+ */
114
+ logoAlt?: null | string;
84
115
  /**
85
116
  * Navbar repository config
86
117
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.10",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -8,13 +8,14 @@
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
- "url": "https://github.com/vuepress/vuepress-next/issues"
13
+ "url": "https://github.com/vuepress/ecosystem/issues"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+https://github.com/vuepress/vuepress-next.git"
17
+ "url": "git+https://github.com/vuepress/ecosystem.git",
18
+ "directory": "themes/theme-default"
18
19
  },
19
20
  "license": "MIT",
20
21
  "author": "meteorlxy",
@@ -35,28 +36,34 @@
35
36
  "lib",
36
37
  "templates"
37
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
+ },
38
44
  "dependencies": {
39
- "@vueuse/core": "^10.6.1",
40
- "sass": "^1.69.5",
41
- "vue": "^3.3.8",
42
- "vue-router": "^4.2.5",
43
- "@vuepress/core": "2.0.0-rc.0",
44
- "@vuepress/client": "2.0.0-rc.0",
45
- "@vuepress/plugin-active-header-links": "2.0.0-rc.0",
46
- "@vuepress/plugin-container": "2.0.0-rc.0",
47
- "@vuepress/plugin-external-link-icon": "2.0.0-rc.0",
48
- "@vuepress/plugin-nprogress": "2.0.0-rc.0",
49
- "@vuepress/plugin-back-to-top": "2.0.0-rc.0",
50
- "@vuepress/plugin-medium-zoom": "2.0.0-rc.0",
51
- "@vuepress/plugin-theme-data": "2.0.0-rc.0",
52
- "@vuepress/plugin-git": "2.0.0-rc.0",
53
- "@vuepress/plugin-palette": "2.0.0-rc.0",
54
- "@vuepress/utils": "2.0.0-rc.0",
55
- "@vuepress/shared": "2.0.0-rc.0",
56
- "@vuepress/plugin-prismjs": "2.0.0-rc.0"
45
+ "@vuepress/helper": "~2.0.0-rc.10",
46
+ "@vuepress/plugin-active-header-links": "2.0.0-rc.10",
47
+ "@vuepress/plugin-back-to-top": "2.0.0-rc.10",
48
+ "@vuepress/plugin-container": "2.0.0-rc.10",
49
+ "@vuepress/plugin-copy-code": "2.0.0-rc.10",
50
+ "@vuepress/plugin-external-link-icon": "2.0.0-rc.10",
51
+ "@vuepress/plugin-git": "2.0.0-rc.10",
52
+ "@vuepress/plugin-medium-zoom": "2.0.0-rc.10",
53
+ "@vuepress/plugin-nprogress": "2.0.0-rc.10",
54
+ "@vuepress/plugin-palette": "2.0.0-rc.10",
55
+ "@vuepress/plugin-prismjs": "2.0.0-rc.10",
56
+ "@vuepress/plugin-seo": "2.0.0-rc.10",
57
+ "@vuepress/plugin-sitemap": "2.0.0-rc.10",
58
+ "@vuepress/plugin-theme-data": "2.0.0-rc.10",
59
+ "@vueuse/core": "^10.7.2",
60
+ "sass": "^1.70.0",
61
+ "vue": "^3.4.15",
62
+ "vue-router": "^4.2.5"
57
63
  },
58
64
  "peerDependencies": {
59
- "sass-loader": "^13.3.2"
65
+ "sass-loader": "^14.0.0",
66
+ "vuepress": "2.0.0-rc.5"
60
67
  },
61
68
  "peerDependenciesMeta": {
62
69
  "sass-loader": {
@@ -66,9 +73,5 @@
66
73
  "publishConfig": {
67
74
  "access": "public"
68
75
  },
69
- "scripts": {
70
- "build": "tsc -b tsconfig.build.json",
71
- "clean": "rimraf lib *.tsbuildinfo",
72
- "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
73
- }
74
- }
76
+ "gitHead": "2e4d75617b030b584fb59346087790c982dbf411"
77
+ }
@@ -1,9 +1,9 @@
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;
@@ -11,16 +11,19 @@
11
11
  html.dark {
12
12
  --c-bg: #22272e;
13
13
  }
14
- html, body {
14
+ html,
15
+ body {
15
16
  background-color: var(--c-bg);
16
17
  }
17
18
  </style>
18
19
  <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
- }
20
+ const userMode = localStorage.getItem('vuepress-color-scheme')
21
+ const systemDarkMode =
22
+ window.matchMedia &&
23
+ window.matchMedia('(prefers-color-scheme: dark)').matches
24
+ if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
25
+ document.documentElement.classList.toggle('dark', true)
26
+ }
24
27
  </script>
25
28
  <!--vuepress-ssr-head-->
26
29
  <!--vuepress-ssr-styles-->
@@ -1,18 +0,0 @@
1
- import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect.js';
2
- /**
3
- * Resolve NavLink props from string
4
- *
5
- * @example
6
- * - Input: '/README.md'
7
- * - Output: { text: 'Home', link: '/' }
8
- */
9
- export const useNavLink = (item) => {
10
- // the route path of vue-router is url-encoded, and we expect users are using
11
- // non-url-encoded string in theme config, so we need to url-encode it first to
12
- // resolve the route correctly
13
- const resolved = useResolveRouteWithRedirect(encodeURI(item));
14
- return {
15
- text: resolved.meta.title || item,
16
- link: resolved.name === '404' ? item : resolved.fullPath,
17
- };
18
- };
@@ -1,5 +0,0 @@
1
- import type { Router } from 'vue-router';
2
- /**
3
- * Resolve a route with redirection
4
- */
5
- export declare const useResolveRouteWithRedirect: (to: import("vue-router").RouteLocationRaw, currentLocation?: import("vue-router").RouteLocationNormalizedLoaded | undefined) => ReturnType<Router['resolve']>;
@@ -1,24 +0,0 @@
1
- import { isFunction, isString } from '@vuepress/shared';
2
- import { useRouter } from 'vue-router';
3
- /**
4
- * Resolve a route with redirection
5
- */
6
- export const useResolveRouteWithRedirect = (...args) => {
7
- const router = useRouter();
8
- const route = router.resolve(...args);
9
- const lastMatched = route.matched[route.matched.length - 1];
10
- if (!lastMatched?.redirect) {
11
- return route;
12
- }
13
- const { redirect } = lastMatched;
14
- const resolvedRedirect = isFunction(redirect) ? redirect(route) : redirect;
15
- const resolvedRedirectObj = isString(resolvedRedirect)
16
- ? { path: resolvedRedirect }
17
- : resolvedRedirect;
18
- return useResolveRouteWithRedirect({
19
- hash: route.hash,
20
- query: route.query,
21
- params: route.params,
22
- ...resolvedRedirectObj,
23
- });
24
- };