@vuepress/theme-default 2.0.0-beta.35 → 2.0.0-beta.38
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.
- package/lib/client/clientAppEnhance.js +8 -0
- package/lib/client/components/AutoLink.vue +1 -1
- package/lib/client/components/HomeHero.vue +1 -1
- package/lib/client/components/NavbarBrand.vue +1 -1
- package/lib/client/components/SidebarItems.vue +38 -0
- package/lib/client/styles/custom-container.scss +3 -1
- package/lib/node/index.js +5 -1
- package/lib/node/utils/index.js +5 -1
- package/lib/shared/index.js +5 -1
- package/package.json +21 -21
|
@@ -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');
|
|
@@ -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>
|
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.
|
|
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/lib/node/utils/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.
|
|
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/lib/shared/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.
|
|
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.
|
|
3
|
+
"version": "2.0.0-beta.38",
|
|
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
|
-
"@vuepress/core": "2.0.0-beta.
|
|
35
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
36
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
37
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
38
|
-
"@vuepress/plugin-external-link-icon": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
40
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
41
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
42
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
43
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
44
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
45
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
46
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
47
|
-
"@vueuse/core": "^
|
|
48
|
-
"sass": "^1.49.
|
|
49
|
-
"sass-loader": "^12.
|
|
50
|
-
"vue": "^3.2.
|
|
51
|
-
"vue-router": "^4.0.
|
|
33
|
+
"@vuepress/client": "2.0.0-beta.38",
|
|
34
|
+
"@vuepress/core": "2.0.0-beta.38",
|
|
35
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.38",
|
|
36
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.38",
|
|
37
|
+
"@vuepress/plugin-container": "2.0.0-beta.38",
|
|
38
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.38",
|
|
39
|
+
"@vuepress/plugin-git": "2.0.0-beta.38",
|
|
40
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.38",
|
|
41
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.38",
|
|
42
|
+
"@vuepress/plugin-palette": "2.0.0-beta.38",
|
|
43
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.38",
|
|
44
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.38",
|
|
45
|
+
"@vuepress/shared": "2.0.0-beta.38",
|
|
46
|
+
"@vuepress/utils": "2.0.0-beta.38",
|
|
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": "
|
|
56
|
+
"gitHead": "7cb24eab18628a66371a367090f7c9c33b519136"
|
|
57
57
|
}
|