@vuepress/theme-default 2.0.0-beta.34 → 2.0.0-beta.37

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.
@@ -9,6 +9,14 @@ export default defineClientAppEnhance(({ app, router }) => {
9
9
  app.component('Badge', Badge);
10
10
  app.component('CodeGroup', CodeGroup);
11
11
  app.component('CodeGroupItem', CodeGroupItem);
12
+ // compat with @vuepress/plugin-external-link-icon
13
+ app.component('AutoLinkExternalIcon', () => {
14
+ const ExternalLinkIcon = app.component('ExternalLinkIcon');
15
+ if (ExternalLinkIcon) {
16
+ return h(ExternalLinkIcon);
17
+ }
18
+ return null;
19
+ });
12
20
  // compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
13
21
  app.component('NavbarSearch', () => {
14
22
  const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
@@ -107,7 +107,7 @@ const isActive = computed(() => {
107
107
  >
108
108
  <slot name="before" />
109
109
  {{ item.text }}
110
- <ExternalLinkIcon v-if="isBlankTarget" />
110
+ <AutoLinkExternalIcon v-if="isBlankTarget" />
111
111
  <slot name="after" />
112
112
  </a>
113
113
  </template>
@@ -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
 
@@ -1,8 +1,46 @@
1
1
  <script setup lang="ts">
2
2
  import SidebarItem from '@theme/SidebarItem.vue'
3
+ import { watch } from 'vue'
4
+ import { useRoute } from 'vue-router'
3
5
  import { useSidebarItems } from '../composables'
4
6
 
7
+ const route = useRoute()
5
8
  const sidebarItems = useSidebarItems()
9
+
10
+ watch(
11
+ () => route.hash,
12
+ (hash) => {
13
+ // get the sidebar DOM
14
+ const sidebar = document.querySelector('.sidebar')
15
+ if (!sidebar) return
16
+
17
+ // get the active sidebar item DOM, whose href equals to the current route
18
+ const activeSidebarItem = document.querySelector(
19
+ `.sidebar a.sidebar-item[href="${route.path}${hash}"]`
20
+ )
21
+ if (!activeSidebarItem) return
22
+
23
+ // get the top and height of the sidebar
24
+ const sidebarTop = sidebar.getBoundingClientRect().top
25
+ const sidebarHeight = sidebar.getBoundingClientRect().height
26
+
27
+ // get the top and height of the active sidebar item
28
+ const activeSidebarItemTop = activeSidebarItem.getBoundingClientRect().top
29
+ const activeSidebarItemHeight =
30
+ activeSidebarItem.getBoundingClientRect().height
31
+
32
+ if (activeSidebarItemTop < sidebarTop) {
33
+ // scroll to the top edge of sidebar when the active sidebar item overflows the top edge of sidebar
34
+ activeSidebarItem.scrollIntoView(true)
35
+ } else if (
36
+ activeSidebarItemTop + activeSidebarItemHeight >
37
+ sidebarTop + sidebarHeight
38
+ ) {
39
+ // scroll to the bottom edge of sidebar when the active sidebar item overflows the bottom edge of sidebar
40
+ activeSidebarItem.scrollIntoView(false)
41
+ }
42
+ }
43
+ )
6
44
  </script>
7
45
 
8
46
  <template>
@@ -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,
@@ -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 {
package/lib/node/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -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;
@@ -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;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-beta.34",
3
+ "version": "2.0.0-beta.37",
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.34",
34
- "@vuepress/core": "2.0.0-beta.34",
35
- "@vuepress/plugin-active-header-links": "2.0.0-beta.34",
36
- "@vuepress/plugin-back-to-top": "2.0.0-beta.34",
37
- "@vuepress/plugin-container": "2.0.0-beta.34",
38
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.34",
39
- "@vuepress/plugin-git": "2.0.0-beta.34",
40
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.34",
41
- "@vuepress/plugin-nprogress": "2.0.0-beta.34",
42
- "@vuepress/plugin-palette": "2.0.0-beta.34",
43
- "@vuepress/plugin-prismjs": "2.0.0-beta.34",
44
- "@vuepress/plugin-theme-data": "2.0.0-beta.34",
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",
49
- "sass-loader": "^12.4.0",
50
- "vue": "^3.2.26",
51
- "vue-router": "^4.0.12"
33
+ "@vuepress/client": "2.0.0-beta.37",
34
+ "@vuepress/core": "2.0.0-beta.37",
35
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.37",
36
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.37",
37
+ "@vuepress/plugin-container": "2.0.0-beta.37",
38
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.37",
39
+ "@vuepress/plugin-git": "2.0.0-beta.37",
40
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.37",
41
+ "@vuepress/plugin-nprogress": "2.0.0-beta.37",
42
+ "@vuepress/plugin-palette": "2.0.0-beta.37",
43
+ "@vuepress/plugin-prismjs": "2.0.0-beta.37",
44
+ "@vuepress/plugin-theme-data": "2.0.0-beta.37",
45
+ "@vuepress/shared": "2.0.0-beta.37",
46
+ "@vuepress/utils": "2.0.0-beta.37",
47
+ "@vueuse/core": "^8.2.1",
48
+ "sass": "^1.49.10",
49
+ "sass-loader": "^12.6.0",
50
+ "vue": "^3.2.31",
51
+ "vue-router": "^4.0.14"
52
52
  },
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "aba907994697f4d0a691f2e3668dad4bea388f20"
56
+ "gitHead": "6600a8c1a293b948be977c348eb9907178bb3263"
57
57
  }