@vuepress/theme-default 2.0.0-beta.45 → 2.0.0-beta.46

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.
@@ -8,7 +8,11 @@ import PageNav from '@theme/PageNav.vue'
8
8
  <slot name="top" />
9
9
 
10
10
  <div class="theme-default-content">
11
+ <slot name="content-top" />
12
+
11
13
  <Content />
14
+
15
+ <slot name="content-bottom" />
12
16
  </div>
13
17
 
14
18
  <PageMeta />
@@ -1,46 +1,49 @@
1
1
  <script setup lang="ts">
2
2
  import SidebarItem from '@theme/SidebarItem.vue'
3
- import { watch } from 'vue'
3
+ import { onMounted, watch } from 'vue'
4
4
  import { useRoute } from 'vue-router'
5
5
  import { useSidebarItems } from '../composables'
6
6
 
7
7
  const route = useRoute()
8
8
  const sidebarItems = useSidebarItems()
9
9
 
10
- watch(
11
- () => route.hash,
12
- (hash) => {
13
- // get the sidebar DOM
14
- const sidebar = document.querySelector('.sidebar')
15
- if (!sidebar) return
10
+ onMounted(() => {
11
+ watch(
12
+ () => route.hash,
13
+ (hash) => {
14
+ // get the sidebar DOM
15
+ const sidebar = document.querySelector('.sidebar')
16
+ if (!sidebar) return
16
17
 
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
18
+ // get the active sidebar item DOM, whose href equals to the current route
19
+ const activeSidebarItem = document.querySelector(
20
+ `.sidebar a.sidebar-item[href="${route.path}${hash}"]`
21
+ )
22
+ if (!activeSidebarItem) return
22
23
 
23
- // get the top and height of the sidebar
24
- const sidebarTop = sidebar.getBoundingClientRect().top
25
- const sidebarHeight = sidebar.getBoundingClientRect().height
24
+ // get the top and height of the sidebar
25
+ const { top: sidebarTop, height: sidebarHeight } =
26
+ sidebar.getBoundingClientRect()
27
+ // get the top and height of the active sidebar item
28
+ const { top: activeSidebarItemTop, height: activeSidebarItemHeight } =
29
+ activeSidebarItem.getBoundingClientRect()
26
30
 
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)
31
+ // when the active sidebar item overflows the top edge of sidebar
32
+ if (activeSidebarItemTop < sidebarTop) {
33
+ // scroll to the top edge of sidebar
34
+ activeSidebarItem.scrollIntoView(true)
35
+ }
36
+ // when the active sidebar item overflows the bottom edge of sidebar
37
+ else if (
38
+ activeSidebarItemTop + activeSidebarItemHeight >
39
+ sidebarTop + sidebarHeight
40
+ ) {
41
+ // scroll to the bottom edge of sidebar
42
+ activeSidebarItem.scrollIntoView(false)
43
+ }
41
44
  }
42
- }
43
- )
45
+ )
46
+ })
44
47
  </script>
45
48
 
46
49
  <template>
@@ -1,5 +1,4 @@
1
1
  import type { VNode } from 'vue';
2
- declare const _default: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ export declare const CodeGroup: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
3
  [key: string]: any;
4
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
- export default _default;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h, onBeforeUpdate, ref } from 'vue';
2
- export default defineComponent({
2
+ export const CodeGroup = defineComponent({
3
3
  name: 'CodeGroup',
4
4
  setup(_, { slots }) {
5
5
  // index of current active item
@@ -0,0 +1,4 @@
1
+ import Badge from './Badge.vue';
2
+ import { CodeGroup } from './CodeGroup';
3
+ import CodeGroupItem from './CodeGroupItem.vue';
4
+ export { Badge, CodeGroup, CodeGroupItem };
@@ -0,0 +1,4 @@
1
+ import Badge from './Badge.vue';
2
+ import { CodeGroup } from './CodeGroup';
3
+ import CodeGroupItem from './CodeGroupItem.vue';
4
+ export { Badge, CodeGroup, CodeGroupItem };
@@ -1,8 +1,6 @@
1
1
  import { defineClientConfig } from '@vuepress/client';
2
2
  import { h } from 'vue';
3
- import Badge from './components/global/Badge.vue';
4
- import CodeGroup from './components/global/CodeGroup';
5
- import CodeGroupItem from './components/global/CodeGroupItem.vue';
3
+ import { Badge, CodeGroup, CodeGroupItem } from './components/global';
6
4
  import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables';
7
5
  import './styles/index.scss';
8
6
  export default defineClientConfig({
@@ -118,6 +118,12 @@ const onBeforeLeave = scrollPromise.pending
118
118
  <template #top>
119
119
  <slot name="page-top" />
120
120
  </template>
121
+ <template #content-top>
122
+ <slot name="page-content-top" />
123
+ </template>
124
+ <template #content-bottom>
125
+ <slot name="page-content-bottom" />
126
+ </template>
121
127
  <template #bottom>
122
128
  <slot name="page-bottom" />
123
129
  </template>
@@ -50,7 +50,7 @@ code {
50
50
  padding: 0.25rem 0.5rem;
51
51
  margin: 0;
52
52
  font-size: 0.85em;
53
- background-color: var(--c-bg-light);
53
+ background-color: var(--c-bg-lighter);
54
54
  border-radius: 3px;
55
55
  overflow-wrap: break-word;
56
56
  transition: background-color var(--t-color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-beta.45",
3
+ "version": "2.0.0-beta.46",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "vuepress-theme",
@@ -25,27 +25,27 @@
25
25
  "templates"
26
26
  ],
27
27
  "dependencies": {
28
- "@vuepress/client": "2.0.0-beta.45",
29
- "@vuepress/core": "2.0.0-beta.45",
30
- "@vuepress/plugin-active-header-links": "2.0.0-beta.45",
31
- "@vuepress/plugin-back-to-top": "2.0.0-beta.45",
32
- "@vuepress/plugin-container": "2.0.0-beta.45",
33
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.45",
34
- "@vuepress/plugin-git": "2.0.0-beta.45",
35
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.45",
36
- "@vuepress/plugin-nprogress": "2.0.0-beta.45",
37
- "@vuepress/plugin-palette": "2.0.0-beta.45",
38
- "@vuepress/plugin-prismjs": "2.0.0-beta.45",
39
- "@vuepress/plugin-theme-data": "2.0.0-beta.45",
40
- "@vuepress/shared": "2.0.0-beta.45",
41
- "@vuepress/utils": "2.0.0-beta.45",
28
+ "@vuepress/client": "2.0.0-beta.46",
29
+ "@vuepress/core": "2.0.0-beta.46",
30
+ "@vuepress/plugin-active-header-links": "2.0.0-beta.46",
31
+ "@vuepress/plugin-back-to-top": "2.0.0-beta.46",
32
+ "@vuepress/plugin-container": "2.0.0-beta.46",
33
+ "@vuepress/plugin-external-link-icon": "2.0.0-beta.46",
34
+ "@vuepress/plugin-git": "2.0.0-beta.46",
35
+ "@vuepress/plugin-medium-zoom": "2.0.0-beta.46",
36
+ "@vuepress/plugin-nprogress": "2.0.0-beta.46",
37
+ "@vuepress/plugin-palette": "2.0.0-beta.46",
38
+ "@vuepress/plugin-prismjs": "2.0.0-beta.46",
39
+ "@vuepress/plugin-theme-data": "2.0.0-beta.46",
40
+ "@vuepress/shared": "2.0.0-beta.46",
41
+ "@vuepress/utils": "2.0.0-beta.46",
42
42
  "@vueuse/core": "^8.4.2",
43
43
  "sass": "^1.51.0",
44
- "vue": "^3.2.33",
44
+ "vue": "^3.2.35",
45
45
  "vue-router": "^4.0.15"
46
46
  },
47
47
  "peerDependencies": {
48
- "sass-loader": "^12.6.0"
48
+ "sass-loader": "^13.0.0"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "sass-loader": {