@vuepress/theme-default 2.0.0-beta.19 → 2.0.0-beta.22
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/components/Navbar.vue +3 -3
- package/lib/client/components/SidebarChild.js +4 -21
- package/lib/client/components/global/CodeGroup.d.ts +1 -1
- package/lib/client/composables/useSidebarItems.js +0 -1
- package/lib/client/index.d.ts +2 -2
- package/lib/client/styles/dropdown.scss +1 -1
- package/lib/client/styles/normalize.scss +1 -0
- package/lib/client/styles/sidebar.scss +30 -53
- package/lib/node/utils/resolveActiveHeaderLinksPluginOptions.js +1 -1
- package/lib/shared/nav.d.ts +3 -11
- package/package.json +18 -18
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
</template>
|
|
37
37
|
|
|
38
38
|
<script setup lang="ts">
|
|
39
|
-
import { computed,
|
|
39
|
+
import { computed, onMounted, ref } from 'vue'
|
|
40
40
|
import { useRouteLocale, useSiteLocaleData, withBase } from '@vuepress/client'
|
|
41
41
|
import { useThemeLocaleData } from '../composables'
|
|
42
42
|
import NavbarLinks from './NavbarLinks.vue'
|
|
43
43
|
import ToggleDarkModeButton from './ToggleDarkModeButton.vue'
|
|
44
44
|
import ToggleSidebarButton from './ToggleSidebarButton.vue'
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
defineEmits(['toggle-sidebar'])
|
|
47
47
|
|
|
48
48
|
const routeLocale = useRouteLocale()
|
|
49
49
|
const siteLocale = useSiteLocaleData()
|
|
@@ -76,7 +76,7 @@ onMounted(() => {
|
|
|
76
76
|
getCssValue(navbar.value, 'paddingLeft') +
|
|
77
77
|
getCssValue(navbar.value, 'paddingRight')
|
|
78
78
|
const handleLinksWrapWidth = (): void => {
|
|
79
|
-
if (window.innerWidth
|
|
79
|
+
if (window.innerWidth <= MOBILE_DESKTOP_BREAKPOINT) {
|
|
80
80
|
linksWrapperMaxWidth.value = 0
|
|
81
81
|
} else {
|
|
82
82
|
linksWrapperMaxWidth.value =
|
|
@@ -42,38 +42,21 @@ const renderChildren = (item, depth) => {
|
|
|
42
42
|
}
|
|
43
43
|
return h('ul', {
|
|
44
44
|
class: {
|
|
45
|
-
'sidebar-sub-
|
|
45
|
+
'sidebar-sub-items': depth > 0,
|
|
46
46
|
},
|
|
47
47
|
}, item.children.map((child) => h('li', h(SidebarChild, {
|
|
48
48
|
item: child,
|
|
49
49
|
depth: depth + 1,
|
|
50
50
|
}))));
|
|
51
51
|
};
|
|
52
|
-
export const SidebarChild = ({ item,
|
|
53
|
-
// group depth should start from 0
|
|
54
|
-
// otherwise start from 1
|
|
55
|
-
depth = item.isGroup ? 0 : 1, }) => {
|
|
52
|
+
export const SidebarChild = ({ item, depth = 0 }) => {
|
|
56
53
|
const route = useRoute();
|
|
57
54
|
const active = isActiveItem(route, item);
|
|
58
|
-
if (item.isGroup) {
|
|
59
|
-
return [
|
|
60
|
-
h('section', {
|
|
61
|
-
class: 'sidebar-group',
|
|
62
|
-
}, [
|
|
63
|
-
renderItem(item, {
|
|
64
|
-
class: {
|
|
65
|
-
'sidebar-heading': true,
|
|
66
|
-
active,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
renderChildren(item, depth),
|
|
70
|
-
]),
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
55
|
return [
|
|
74
56
|
renderItem(item, {
|
|
75
57
|
class: {
|
|
76
|
-
'sidebar-
|
|
58
|
+
'sidebar-heading': depth === 0,
|
|
59
|
+
'sidebar-item': true,
|
|
77
60
|
active,
|
|
78
61
|
},
|
|
79
62
|
}),
|
|
@@ -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<{} & {} & {}>, {}>;
|
|
5
5
|
export default _default;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NavItem, NavGroup, NavLink, NavbarItem, NavbarGroup, NavbarConfig, ResolvedNavbarItem, SidebarItem,
|
|
2
|
-
export type { NavItem, NavGroup, NavLink, NavbarItem, NavbarGroup, NavbarConfig, ResolvedNavbarItem, SidebarItem,
|
|
1
|
+
import type { NavItem, NavGroup, NavLink, NavbarItem, NavbarGroup, NavbarConfig, ResolvedNavbarItem, SidebarItem, SidebarConfigArray, SidebarConfigObject, SidebarConfig, ResolvedSidebarItem, DefaultThemePluginsOptions, DefaultThemeLocaleOptions, DefaultThemeData, DefaultThemeLocaleData, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemeHomePageFrontmatter, DefaultThemeNormalPageFrontmatter } from '../shared';
|
|
2
|
+
export type { NavItem, NavGroup, NavLink, NavbarItem, NavbarGroup, NavbarConfig, ResolvedNavbarItem, SidebarItem, SidebarConfigArray, SidebarConfigObject, SidebarConfig, ResolvedSidebarItem, DefaultThemePluginsOptions, DefaultThemeLocaleOptions, DefaultThemeData, DefaultThemeLocaleData, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemeHomePageFrontmatter, DefaultThemeNormalPageFrontmatter, };
|
|
3
3
|
export * from './composables';
|
|
4
4
|
export * from './utils';
|
|
@@ -28,17 +28,16 @@
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
.sidebar-links {
|
|
32
32
|
padding: 1.5rem 0;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
line-height: 1.7;
|
|
37
|
-
font-weight: bold;
|
|
34
|
+
> li:not(:first-child) {
|
|
35
|
+
margin-top: 0.75rem;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
.sidebar-sub-items {
|
|
39
|
+
padding-left: 1rem;
|
|
40
|
+
font-size: 0.95em;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
}
|
|
@@ -56,34 +55,15 @@
|
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
.sidebar-links {
|
|
60
59
|
padding: 1rem 0;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
* sidebar child
|
|
67
|
-
*/
|
|
68
|
-
.sidebar-group {
|
|
69
|
-
.sidebar-links > &:not(:first-child) {
|
|
70
|
-
margin-top: 0.75rem;
|
|
71
|
-
}
|
|
72
|
-
.sidebar-group {
|
|
73
|
-
& > .sidebar-heading {
|
|
74
|
-
opacity: 0.5;
|
|
75
|
-
font-size: 0.95em;
|
|
76
|
-
line-height: 1.4;
|
|
77
|
-
font-weight: normal;
|
|
78
|
-
padding-left: 2rem;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
64
|
.sidebar-heading {
|
|
84
65
|
color: var(--c-text);
|
|
85
66
|
transition: color 0.15s ease;
|
|
86
|
-
cursor: default;
|
|
87
67
|
font-size: 1.1em;
|
|
88
68
|
font-weight: bold;
|
|
89
69
|
padding: 0.35rem 1.5rem 0.35rem 1.25rem;
|
|
@@ -92,11 +72,6 @@
|
|
|
92
72
|
margin: 0;
|
|
93
73
|
border-left: 0.25rem solid transparent;
|
|
94
74
|
|
|
95
|
-
&.open,
|
|
96
|
-
&:hover {
|
|
97
|
-
color: inherit;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
75
|
.arrow {
|
|
101
76
|
position: relative;
|
|
102
77
|
top: -0.12em;
|
|
@@ -104,49 +79,51 @@
|
|
|
104
79
|
}
|
|
105
80
|
}
|
|
106
81
|
|
|
107
|
-
.sidebar
|
|
108
|
-
padding-left: 1rem;
|
|
109
|
-
font-size: 0.95em;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.sidebar-link {
|
|
82
|
+
.sidebar-item:not(.sidebar-heading) {
|
|
113
83
|
font-size: 1em;
|
|
114
84
|
font-weight: 400;
|
|
115
85
|
display: inline-block;
|
|
116
86
|
color: var(--c-text);
|
|
117
87
|
border-left: 0.25rem solid transparent;
|
|
118
88
|
margin: 0;
|
|
119
|
-
padding: 0.35rem 1rem 0.35rem
|
|
89
|
+
padding: 0.35rem 1rem 0.35rem 2rem;
|
|
120
90
|
line-height: 1.4;
|
|
121
91
|
width: 100%;
|
|
122
92
|
box-sizing: border-box;
|
|
123
93
|
|
|
124
|
-
.sidebar-
|
|
125
|
-
|
|
94
|
+
.sidebar-links > &:not(:first-child) {
|
|
95
|
+
margin-top: 0.75rem;
|
|
126
96
|
}
|
|
127
97
|
|
|
128
|
-
.sidebar-sub-
|
|
129
|
-
padding
|
|
130
|
-
padding-bottom: 0.25rem;
|
|
131
|
-
border-left: none;
|
|
132
|
-
|
|
133
|
-
&.active {
|
|
134
|
-
font-weight: 500;
|
|
135
|
-
}
|
|
98
|
+
.sidebar-sub-items & {
|
|
99
|
+
padding: 0.25rem 1rem 0.25rem 1.75rem;
|
|
136
100
|
}
|
|
137
101
|
}
|
|
138
102
|
|
|
139
|
-
|
|
140
|
-
|
|
103
|
+
.sidebar-item {
|
|
104
|
+
cursor: default;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
a.sidebar-item {
|
|
141
108
|
cursor: pointer;
|
|
142
109
|
|
|
110
|
+
&:hover {
|
|
111
|
+
color: var(--c-text-accent);
|
|
112
|
+
}
|
|
113
|
+
|
|
143
114
|
&.active {
|
|
144
115
|
font-weight: 600;
|
|
145
116
|
color: var(--c-text-accent);
|
|
146
117
|
border-left-color: var(--c-text-accent);
|
|
147
118
|
}
|
|
148
119
|
|
|
149
|
-
|
|
150
|
-
|
|
120
|
+
&.sidebar-heading.active {
|
|
121
|
+
font-weight: bold;
|
|
122
|
+
border-left-color: transparent;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.sidebar-sub-items &.active {
|
|
126
|
+
font-weight: 500;
|
|
127
|
+
border-left-color: transparent;
|
|
151
128
|
}
|
|
152
129
|
}
|
package/lib/shared/nav.d.ts
CHANGED
|
@@ -30,16 +30,8 @@ export declare type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarIte
|
|
|
30
30
|
/**
|
|
31
31
|
* Sidebar types
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
export interface SidebarGroup extends NavGroup<SidebarGroup | NavLink | SidebarItem | string> {
|
|
37
|
-
isGroup: true;
|
|
38
|
-
}
|
|
39
|
-
export declare type SidebarConfigArray = (SidebarGroup | SidebarItem | string)[];
|
|
33
|
+
export declare type SidebarItem = NavItem & Partial<NavLink> & Partial<Pick<NavGroup<NavLink | SidebarItem | string>, 'children'>>;
|
|
34
|
+
export declare type SidebarConfigArray = (SidebarItem | string)[];
|
|
40
35
|
export declare type SidebarConfigObject = Record<string, SidebarConfigArray>;
|
|
41
36
|
export declare type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
|
|
42
|
-
export
|
|
43
|
-
isGroup?: boolean;
|
|
44
|
-
children?: ResolvedSidebarItem[];
|
|
45
|
-
}
|
|
37
|
+
export declare type ResolvedSidebarItem = NavItem & Partial<NavLink> & Partial<Pick<NavGroup<ResolvedSidebarItem>, 'children'>>;
|
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.22",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -29,26 +29,26 @@
|
|
|
29
29
|
"copy": "cpx \"src/**/*.{d.ts,vue,scss}\" lib"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@vuepress/client": "2.0.0-beta.
|
|
33
|
-
"@vuepress/core": "2.0.0-beta.
|
|
34
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
35
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
36
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
37
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
38
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
40
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
41
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
42
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
43
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
44
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
45
|
-
"sass": "^1.
|
|
32
|
+
"@vuepress/client": "2.0.0-beta.21",
|
|
33
|
+
"@vuepress/core": "2.0.0-beta.22",
|
|
34
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.22",
|
|
35
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.22",
|
|
36
|
+
"@vuepress/plugin-container": "2.0.0-beta.22",
|
|
37
|
+
"@vuepress/plugin-git": "2.0.0-beta.22",
|
|
38
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.22",
|
|
39
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.22",
|
|
40
|
+
"@vuepress/plugin-palette": "2.0.0-beta.22",
|
|
41
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.22",
|
|
42
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.22",
|
|
43
|
+
"@vuepress/shared": "2.0.0-beta.21",
|
|
44
|
+
"@vuepress/utils": "2.0.0-beta.21",
|
|
45
|
+
"sass": "^1.35.1",
|
|
46
46
|
"sass-loader": "^12.1.0",
|
|
47
|
-
"vue": "^3.1.
|
|
48
|
-
"vue-router": "^4.0.
|
|
47
|
+
"vue": "^3.1.4",
|
|
48
|
+
"vue-router": "^4.0.10"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "8db8d235df8914c70c864ae3f3f66f93cfd1a457"
|
|
54
54
|
}
|