@vuepress/theme-default 2.0.0-rc.5 → 2.0.0-rc.6

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.
@@ -1,3 +1,4 @@
1
+ import { hasGlobalComponent } from '@vuepress/helper/client';
1
2
  import { h } from 'vue';
2
3
  import { defineClientConfig } from 'vuepress/client';
3
4
  import { Badge, CodeGroup, CodeGroupItem } from './components/global/index.js';
@@ -7,9 +8,12 @@ import NotFound from './layouts/NotFound.vue';
7
8
  import './styles/index.scss';
8
9
  export default defineClientConfig({
9
10
  enhance({ app, router }) {
10
- app.component('Badge', Badge);
11
- app.component('CodeGroup', CodeGroup);
12
- app.component('CodeGroupItem', CodeGroupItem);
11
+ if (!hasGlobalComponent('Badge'))
12
+ app.component('Badge', Badge);
13
+ if (!hasGlobalComponent('CodeGroup'))
14
+ app.component('CodeGroup', CodeGroup);
15
+ if (!hasGlobalComponent('CodeGroupItem'))
16
+ app.component('CodeGroupItem', CodeGroupItem);
13
17
  // compat with @vuepress/plugin-external-link-icon
14
18
  app.component('AutoLinkExternalIcon', () => {
15
19
  const ExternalLinkIcon = app.component('ExternalLinkIcon');
@@ -1,6 +1,7 @@
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';
@@ -48,6 +49,14 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
48
49
  : [],
49
50
  // @vuepress/plugin-back-to-top
50
51
  themePlugins.backToTop !== false ? backToTopPlugin() : [],
52
+ // @vuepress/plugin-copy-code
53
+ themePlugins.copyCode !== false
54
+ ? copyCodePlugin({
55
+ ...(isPlainObject(themePlugins.copyCode)
56
+ ? themePlugins.copyCode
57
+ : {}),
58
+ })
59
+ : [],
51
60
  // @vuepress/plugin-container
52
61
  themePlugins.container?.tip !== false
53
62
  ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
@@ -1,3 +1,4 @@
1
+ import type { CopyCodePluginOptions } from '@vuepress/plugin-copy-code';
1
2
  import type { SeoPluginOptions } from '@vuepress/plugin-seo';
2
3
  import type { SitemapPluginOptions } from '@vuepress/plugin-sitemap';
3
4
  import type { ThemeData } from '@vuepress/plugin-theme-data';
@@ -23,6 +24,10 @@ export interface DefaultThemePluginsOptions {
23
24
  codeGroup?: boolean;
24
25
  codeGroupItem?: boolean;
25
26
  };
27
+ /**
28
+ * Enable @vuepress/plugin-copy-code or not
29
+ */
30
+ copyCode?: CopyCodePluginOptions | boolean;
26
31
  /**
27
32
  * Enable @vuepress/plugin-external-link-icon or not
28
33
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0-rc.6",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -42,17 +42,19 @@
42
42
  "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
43
43
  },
44
44
  "dependencies": {
45
+ "@vuepress/helper": "2.0.0-rc.6",
45
46
  "@vuepress/plugin-active-header-links": "2.0.0-rc.3",
46
47
  "@vuepress/plugin-back-to-top": "2.0.0-rc.3",
47
48
  "@vuepress/plugin-container": "2.0.0-rc.3",
49
+ "@vuepress/plugin-copy-code": "2.0.0-rc.6",
48
50
  "@vuepress/plugin-external-link-icon": "2.0.0-rc.3",
49
51
  "@vuepress/plugin-git": "2.0.0-rc.3",
50
52
  "@vuepress/plugin-medium-zoom": "2.0.0-rc.3",
51
53
  "@vuepress/plugin-nprogress": "2.0.0-rc.3",
52
54
  "@vuepress/plugin-palette": "2.0.0-rc.3",
53
55
  "@vuepress/plugin-prismjs": "2.0.0-rc.3",
54
- "@vuepress/plugin-seo": "2.0.0-rc.5",
55
- "@vuepress/plugin-sitemap": "2.0.0-rc.5",
56
+ "@vuepress/plugin-seo": "2.0.0-rc.6",
57
+ "@vuepress/plugin-sitemap": "2.0.0-rc.6",
56
58
  "@vuepress/plugin-theme-data": "2.0.0-rc.3",
57
59
  "@vueuse/core": "^10.7.2",
58
60
  "sass": "^1.70.0",
@@ -71,5 +73,5 @@
71
73
  "publishConfig": {
72
74
  "access": "public"
73
75
  },
74
- "gitHead": "31bbdb9914c2c068735547a90081466afcf5292f"
76
+ "gitHead": "78aee8972408e8f6cc7b38ad8a0183c4e65f70a2"
75
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-->