@vuepress/theme-default 2.0.0-beta.33 → 2.0.0-beta.36

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.
@@ -3,16 +3,12 @@ import { h } from 'vue';
3
3
  import Badge from './components/global/Badge.vue';
4
4
  import CodeGroup from './components/global/CodeGroup';
5
5
  import CodeGroupItem from './components/global/CodeGroupItem.vue';
6
- import ExternalLinkIcon from './components/global/ExternalLinkIcon.vue';
7
6
  import { useScrollPromise } from './composables';
8
7
  import './styles/index.scss';
9
8
  export default defineClientAppEnhance(({ app, router }) => {
10
9
  app.component('Badge', Badge);
11
10
  app.component('CodeGroup', CodeGroup);
12
11
  app.component('CodeGroupItem', CodeGroupItem);
13
- // override the `<ExternalLinkIcon>` provided by @vuepress/plugin-external-link-icon
14
- delete app._context.components.ExternalLinkIcon;
15
- app.component('ExternalLinkIcon', ExternalLinkIcon);
16
12
  // compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
17
13
  app.component('NavbarSearch', () => {
18
14
  const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
@@ -68,7 +68,7 @@ const HomeHeroImage: FunctionalComponent = () => {
68
68
  }
69
69
  // wrap hero image with <ClientOnly> to avoid ssr-mismatch
70
70
  // when using a different hero image in dark mode
71
- return h(ClientOnly, img)
71
+ return h(ClientOnly, () => img)
72
72
  }
73
73
  </script>
74
74
 
@@ -36,7 +36,7 @@ const NavbarBrandLogo: FunctionalComponent = () => {
36
36
  }
37
37
  // wrap brand logo with <ClientOnly> to avoid ssr-mismatch
38
38
  // when using a different brand logo in dark mode
39
- return h(ClientOnly, img)
39
+ return h(ClientOnly, () => img)
40
40
  }
41
41
  </script>
42
42
 
@@ -51,7 +51,13 @@ if (item.value.collapsible) {
51
51
  <template>
52
52
  <li>
53
53
  <AutoLink v-if="item.link" :class="itemClass" :item="item" />
54
- <p v-else :class="itemClass" @click="onClick">
54
+ <p
55
+ v-else
56
+ tabindex="0"
57
+ :class="itemClass"
58
+ @click="onClick"
59
+ @keydown.enter="onClick"
60
+ >
55
61
  {{ item.text }}
56
62
  <span
57
63
  v-if="item.collapsible"
@@ -1,5 +1,5 @@
1
1
  import type { VNode } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
3
  [key: string]: any;
4
- }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {} & {}>, {}>;
4
+ }> | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
5
5
  export default _default;
@@ -1,4 +1,9 @@
1
1
  import type { NavLink } from '../../shared';
2
+ declare module 'vue-router' {
3
+ interface RouteMeta {
4
+ title?: string;
5
+ }
6
+ }
2
7
  /**
3
8
  * Resolve NavLink props from string
4
9
  *
@@ -4,7 +4,9 @@
4
4
 
5
5
  .custom-container-title {
6
6
  font-weight: 600;
7
- margin-bottom: -0.4rem;
7
+ &:not(:only-child) {
8
+ margin-bottom: -0.4rem;
9
+ }
8
10
  }
9
11
 
10
12
  &.tip,
@@ -13,7 +13,6 @@
13
13
  @use 'navbar-dropdown';
14
14
  @use 'page';
15
15
  @use 'sidebar';
16
- @use 'sr-only';
17
16
  @use 'toc';
18
17
  @use 'transitions';
19
18
 
@@ -171,3 +171,7 @@
171
171
  height: 1.25rem;
172
172
  }
173
173
  }
174
+
175
+ .DocSearch {
176
+ transition: background-color var(--t-color);
177
+ }
@@ -49,7 +49,7 @@ code {
49
49
  background-color: var(--c-bg-light);
50
50
  border-radius: 3px;
51
51
  overflow-wrap: break-word;
52
- transition: background-color var(--t-color), color var(--t-color);
52
+ transition: background-color var(--t-color);
53
53
  }
54
54
 
55
55
  blockquote {
@@ -151,18 +151,22 @@ table {
151
151
  margin: 1rem 0;
152
152
  display: block;
153
153
  overflow-x: auto;
154
+ transition: border-color var(--t-color);
154
155
  }
155
156
 
156
157
  tr {
157
158
  border-top: 1px solid var(--c-border-dark);
159
+ transition: border-color var(--t-color);
158
160
 
159
161
  &:nth-child(2n) {
160
162
  background-color: var(--c-bg-light);
163
+ transition: background-color var(--t-color);
161
164
  }
162
165
  }
163
166
 
164
167
  th,
165
168
  td {
166
- border: 1px solid var(--c-border-dark);
167
169
  padding: 0.6em 1em;
170
+ border: 1px solid var(--c-border-dark);
171
+ transition: border-color var(--t-color);
168
172
  }
@@ -56,9 +56,21 @@
56
56
 
57
57
  .sidebar-item {
58
58
  cursor: default;
59
+ border-left: 0.25rem solid transparent;
60
+ color: var(--c-text);
61
+
62
+ &:focus-visible {
63
+ outline-width: 1px;
64
+ outline-offset: -1px;
65
+ }
66
+
67
+ &.active:not(p.sidebar-heading) {
68
+ font-weight: 600;
69
+ color: var(--c-text-accent);
70
+ border-left-color: var(--c-text-accent);
71
+ }
59
72
 
60
73
  &.sidebar-heading {
61
- color: var(--c-text);
62
74
  transition: color 0.15s ease;
63
75
  font-size: 1.1em;
64
76
  font-weight: bold;
@@ -66,7 +78,6 @@
66
78
  width: 100%;
67
79
  box-sizing: border-box;
68
80
  margin: 0;
69
- border-left: 0.25rem solid transparent;
70
81
 
71
82
  &.collapsible {
72
83
  cursor: pointer;
@@ -88,20 +99,12 @@
88
99
  font-size: 1em;
89
100
  font-weight: 400;
90
101
  display: inline-block;
91
- color: var(--c-text);
92
- border-left: 0.25rem solid transparent;
93
102
  margin: 0;
94
103
  padding: 0.35rem 1rem 0.35rem 2rem;
95
104
  line-height: 1.4;
96
105
  width: 100%;
97
106
  box-sizing: border-box;
98
107
 
99
- &.active {
100
- font-weight: 600;
101
- color: var(--c-text-accent);
102
- border-left-color: var(--c-text-accent);
103
- }
104
-
105
108
  & + .sidebar-item-children {
106
109
  padding-left: 1rem;
107
110
  font-size: 0.95em;
@@ -115,6 +118,10 @@
115
118
  border-left-color: transparent;
116
119
  }
117
120
  }
121
+
122
+ a.sidebar-heading + .sidebar-item-children &.active {
123
+ border-left-color: transparent;
124
+ }
118
125
  }
119
126
  }
120
127
 
@@ -10,10 +10,10 @@
10
10
  * fade-slide-y
11
11
  */
12
12
  .fade-slide-y-enter-active {
13
- transition: all 0.3s ease;
13
+ transition: all 0.2s ease;
14
14
  }
15
15
  .fade-slide-y-leave-active {
16
- transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
16
+ transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
17
17
  }
18
18
  .fade-slide-y-enter-from,
19
19
  .fade-slide-y-leave-to {
@@ -65,7 +65,10 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions }, app) => {
65
65
  '@vuepress/container',
66
66
  (0, utils_2.resolveContainerPluginOptionsForCodeGroupItem)(themePlugins),
67
67
  ],
68
- ['@vuepress/external-link-icon', themePlugins.externalLinkIcon !== false],
68
+ [
69
+ '@vuepress/external-link-icon',
70
+ (0, utils_2.resolveExternalLinkIconPluginOptions)(themePlugins, localeOptions),
71
+ ],
69
72
  ['@vuepress/git', (0, utils_2.resolveGitPluginOptions)(themePlugins, localeOptions)],
70
73
  ['@vuepress/medium-zoom', (0, utils_2.resolveMediumZoomPluginOptions)(themePlugins)],
71
74
  ['@vuepress/nprogress', themePlugins.nprogress !== false],
@@ -1,5 +1,6 @@
1
1
  export * from './assignDefaultLocaleOptions';
2
2
  export * from './resolveActiveHeaderLinksPluginOptions';
3
3
  export * from './resolveContainerPluginOptions';
4
+ export * from './resolveExternalLinkIconPluginOptions';
4
5
  export * from './resolveGitPluginOptions';
5
6
  export * from './resolveMediumZoomPluginOptions';
@@ -13,5 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./assignDefaultLocaleOptions"), exports);
14
14
  __exportStar(require("./resolveActiveHeaderLinksPluginOptions"), exports);
15
15
  __exportStar(require("./resolveContainerPluginOptions"), exports);
16
+ __exportStar(require("./resolveExternalLinkIconPluginOptions"), exports);
16
17
  __exportStar(require("./resolveGitPluginOptions"), exports);
17
18
  __exportStar(require("./resolveMediumZoomPluginOptions"), exports);
@@ -11,6 +11,8 @@ const resolveActiveHeaderLinksPluginOptions = (themePlugins) => {
11
11
  return {
12
12
  headerLinkSelector: 'a.sidebar-item',
13
13
  headerAnchorSelector: '.header-anchor',
14
+ // should greater than page transition duration
15
+ delay: 300,
14
16
  };
15
17
  };
16
18
  exports.resolveActiveHeaderLinksPluginOptions = resolveActiveHeaderLinksPluginOptions;
@@ -0,0 +1,6 @@
1
+ import type { ExternalLinkIconPluginOptions } from '@vuepress/plugin-external-link-icon';
2
+ import type { DefaultThemeData, DefaultThemePluginsOptions } from '../../shared';
3
+ /**
4
+ * Resolve options for @vuepress/plugin-external-link-icon
5
+ */
6
+ export declare const resolveExternalLinkIconPluginOptions: (themePlugins: DefaultThemePluginsOptions, localeOptions: DefaultThemeData) => ExternalLinkIconPluginOptions | boolean;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveExternalLinkIconPluginOptions = void 0;
4
+ /**
5
+ * Resolve options for @vuepress/plugin-external-link-icon
6
+ */
7
+ const resolveExternalLinkIconPluginOptions = (themePlugins, localeOptions) => {
8
+ if ((themePlugins === null || themePlugins === void 0 ? void 0 : themePlugins.externalLinkIcon) === false) {
9
+ return false;
10
+ }
11
+ return {
12
+ locales: Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
13
+ var _a;
14
+ result[key] = {
15
+ openInNewWindow: (_a = value.openInNewWindow) !== null && _a !== void 0 ? _a : localeOptions.openInNewWindow,
16
+ };
17
+ return result;
18
+ }, {}),
19
+ };
20
+ };
21
+ exports.resolveExternalLinkIconPluginOptions = resolveExternalLinkIconPluginOptions;
@@ -12,7 +12,7 @@ const resolveMediumZoomPluginOptions = (themePlugins) => {
12
12
  selector: '.theme-default-content > img, .theme-default-content :not(a) > img',
13
13
  zoomOptions: {},
14
14
  // should greater than page transition duration
15
- delay: 400,
15
+ delay: 300,
16
16
  };
17
17
  };
18
18
  exports.resolveMediumZoomPluginOptions = resolveMediumZoomPluginOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-beta.33",
3
+ "version": "2.0.0-beta.36",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -30,28 +30,28 @@
30
30
  "copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
31
31
  },
32
32
  "dependencies": {
33
- "@vuepress/client": "2.0.0-beta.33",
34
- "@vuepress/core": "2.0.0-beta.33",
35
- "@vuepress/plugin-active-header-links": "2.0.0-beta.33",
36
- "@vuepress/plugin-back-to-top": "2.0.0-beta.33",
37
- "@vuepress/plugin-container": "2.0.0-beta.33",
38
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.33",
39
- "@vuepress/plugin-git": "2.0.0-beta.33",
40
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.33",
41
- "@vuepress/plugin-nprogress": "2.0.0-beta.33",
42
- "@vuepress/plugin-palette": "2.0.0-beta.33",
43
- "@vuepress/plugin-prismjs": "2.0.0-beta.33",
44
- "@vuepress/plugin-theme-data": "2.0.0-beta.33",
45
- "@vuepress/shared": "2.0.0-beta.33",
46
- "@vuepress/utils": "2.0.0-beta.33",
47
- "@vueuse/core": "^7.5.3",
48
- "sass": "^1.47.0",
33
+ "@vuepress/client": "2.0.0-beta.35",
34
+ "@vuepress/core": "2.0.0-beta.36",
35
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.36",
36
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.36",
37
+ "@vuepress/plugin-container": "2.0.0-beta.36",
38
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.36",
39
+ "@vuepress/plugin-git": "2.0.0-beta.36",
40
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.36",
41
+ "@vuepress/plugin-nprogress": "2.0.0-beta.36",
42
+ "@vuepress/plugin-palette": "2.0.0-beta.36",
43
+ "@vuepress/plugin-prismjs": "2.0.0-beta.36",
44
+ "@vuepress/plugin-theme-data": "2.0.0-beta.36",
45
+ "@vuepress/shared": "2.0.0-beta.35",
46
+ "@vuepress/utils": "2.0.0-beta.35",
47
+ "@vueuse/core": "^7.5.4",
48
+ "sass": "^1.49.0",
49
49
  "sass-loader": "^12.4.0",
50
- "vue": "^3.2.26",
50
+ "vue": "^3.2.28",
51
51
  "vue-router": "^4.0.12"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "0934a5d6685922e0dc6391622b00a3b89140492c"
56
+ "gitHead": "275ac05052de642e698bc0fb7fad61fce702a978"
57
57
  }
@@ -1,12 +0,0 @@
1
- <script setup lang="ts">
2
- import { ExternalLinkIcon as RawExternalLinkIcon } from '@vuepress/plugin-external-link-icon/lib/client'
3
- import { useThemeLocaleData } from '../../composables'
4
-
5
- const themeLocale = useThemeLocaleData()
6
- </script>
7
-
8
- <template>
9
- <RawExternalLinkIcon>
10
- <span class="sr-only">{{ themeLocale.openInNewWindow }}</span>
11
- </RawExternalLinkIcon>
12
- </template>
@@ -1,12 +0,0 @@
1
- .sr-only {
2
- position: absolute;
3
- width: 1px;
4
- height: 1px;
5
- padding: 0;
6
- margin: -1px;
7
- overflow: hidden;
8
- clip: rect(0, 0, 0, 0);
9
- white-space: nowrap;
10
- border-width: 0;
11
- user-select: none;
12
- }