@vuepress/theme-default 2.0.0-beta.30 → 2.0.0-beta.34
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 +0 -4
- package/lib/client/components/{NavLink.vue → AutoLink.vue} +1 -2
- package/lib/client/components/Home.vue +4 -4
- package/lib/client/components/HomeHero.vue +2 -2
- package/lib/client/components/Navbar.vue +6 -6
- package/lib/client/components/{DropdownLink.vue → NavbarDropdown.vue} +17 -17
- package/lib/client/components/{NavbarLinks.vue → NavbarItems.vue} +8 -14
- package/lib/client/components/Page.vue +2 -2
- package/lib/client/components/PageMeta.vue +4 -5
- package/lib/client/components/PageNav.vue +8 -8
- package/lib/client/components/Sidebar.vue +4 -16
- package/lib/client/components/SidebarItem.vue +80 -0
- package/lib/client/components/SidebarItems.vue +16 -0
- package/lib/client/index.d.ts +2 -2
- package/lib/client/layouts/Layout.vue +4 -4
- package/lib/client/styles/{_wrapper.scss → _mixins.scss} +6 -1
- package/lib/client/styles/code.scss +2 -1
- package/lib/client/styles/index.scss +1 -2
- package/lib/client/styles/layout.scss +2 -2
- package/lib/client/styles/{dropdown.scss → navbar-dropdown.scss} +25 -33
- package/lib/client/styles/navbar.scss +12 -8
- package/lib/client/styles/normalize.scss +10 -2
- package/lib/client/styles/page.scss +3 -3
- package/lib/client/styles/sidebar.scss +70 -66
- package/lib/client/styles/transitions.scss +11 -2
- package/lib/client/utils/index.d.ts +1 -0
- package/lib/client/utils/index.js +1 -0
- package/lib/client/utils/isActiveSidebarItem.d.ts +3 -0
- package/lib/client/utils/isActiveSidebarItem.js +20 -0
- package/lib/node/defaultTheme.js +13 -1
- package/lib/node/utils/index.d.ts +1 -0
- package/lib/node/utils/index.js +1 -0
- package/lib/node/utils/resolveExternalLinkIconPluginOptions.d.ts +6 -0
- package/lib/node/utils/resolveExternalLinkIconPluginOptions.js +21 -0
- package/lib/shared/nav.d.ts +10 -4
- package/package.json +21 -20
- package/templates/index.build.html +33 -0
- package/lib/client/components/SidebarChild.d.ts +0 -6
- package/lib/client/components/SidebarChild.js +0 -76
- package/lib/client/components/global/ExternalLinkIcon.vue +0 -12
- package/lib/client/styles/sr-only.scss +0 -12
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
@import '_mixins';
|
|
1
2
|
@import '_variables';
|
|
2
3
|
|
|
3
|
-
.dropdown-wrapper {
|
|
4
|
+
.navbar-dropdown-wrapper {
|
|
4
5
|
cursor: pointer;
|
|
5
6
|
|
|
6
|
-
.dropdown-title {
|
|
7
|
+
.navbar-dropdown-title {
|
|
7
8
|
display: block;
|
|
8
9
|
font-size: 0.9rem;
|
|
9
10
|
font-family: inherit;
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
.
|
|
30
|
-
@extend .dropdown-title;
|
|
30
|
+
.navbar-dropdown-title-mobile {
|
|
31
|
+
@extend .navbar-dropdown-title;
|
|
31
32
|
display: none;
|
|
32
33
|
font-weight: 600;
|
|
33
34
|
font-size: inherit;
|
|
@@ -36,12 +37,12 @@
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
.
|
|
40
|
-
.dropdown-item {
|
|
40
|
+
.navbar-dropdown {
|
|
41
|
+
.navbar-dropdown-item {
|
|
41
42
|
color: inherit;
|
|
42
43
|
line-height: 1.7rem;
|
|
43
44
|
|
|
44
|
-
.dropdown-subtitle {
|
|
45
|
+
.navbar-dropdown-subtitle {
|
|
45
46
|
margin: 0.45rem 0 0;
|
|
46
47
|
border-top: 1px solid var(--c-border);
|
|
47
48
|
padding: 1rem 0 0.45rem 0;
|
|
@@ -61,11 +62,11 @@
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
.dropdown-subitem-wrapper {
|
|
65
|
+
.navbar-dropdown-subitem-wrapper {
|
|
65
66
|
padding: 0;
|
|
66
67
|
list-style: none;
|
|
67
68
|
|
|
68
|
-
.dropdown-subitem {
|
|
69
|
+
.navbar-dropdown-subitem {
|
|
69
70
|
font-size: 0.9em;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
&:first-child .dropdown-subtitle {
|
|
104
|
+
&:first-child .navbar-dropdown-subtitle {
|
|
104
105
|
margin-top: 0;
|
|
105
106
|
padding-top: 0;
|
|
106
107
|
border-top: 0;
|
|
@@ -110,38 +111,37 @@
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
@media (max-width: $MQMobile) {
|
|
113
|
-
.dropdown-wrapper {
|
|
114
|
-
&.open .dropdown-title {
|
|
114
|
+
.navbar-dropdown-wrapper {
|
|
115
|
+
&.open .navbar-dropdown-title {
|
|
115
116
|
margin-bottom: 0.5rem;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
.dropdown-title {
|
|
119
|
+
.navbar-dropdown-title {
|
|
119
120
|
display: none;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
.
|
|
123
|
+
.navbar-dropdown-title-mobile {
|
|
123
124
|
display: block;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
overflow: hidden;
|
|
127
|
+
.navbar-dropdown {
|
|
128
|
+
@include dropdown_wrapper;
|
|
129
129
|
|
|
130
|
-
.dropdown-item {
|
|
131
|
-
.dropdown-subtitle {
|
|
130
|
+
.navbar-dropdown-item {
|
|
131
|
+
.navbar-dropdown-subtitle {
|
|
132
132
|
border-top: 0;
|
|
133
133
|
margin-top: 0;
|
|
134
134
|
padding-top: 0;
|
|
135
135
|
padding-bottom: 0;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.dropdown-subtitle,
|
|
138
|
+
.navbar-dropdown-subtitle,
|
|
139
139
|
& > a {
|
|
140
140
|
font-size: 15px;
|
|
141
141
|
line-height: 2rem;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
.dropdown-subitem {
|
|
144
|
+
.navbar-dropdown-subitem {
|
|
145
145
|
font-size: 14px;
|
|
146
146
|
padding-left: 1rem;
|
|
147
147
|
}
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
@media (min-width: ($MQMobile + 1)) {
|
|
154
|
-
.dropdown-wrapper {
|
|
154
|
+
.navbar-dropdown-wrapper {
|
|
155
155
|
height: 1.8rem;
|
|
156
156
|
|
|
157
|
-
&:hover .
|
|
158
|
-
&.open .
|
|
157
|
+
&:hover .navbar-dropdown,
|
|
158
|
+
&.open .navbar-dropdown {
|
|
159
159
|
// override the inline style.
|
|
160
160
|
display: block !important;
|
|
161
161
|
}
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
display: none;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
.
|
|
167
|
+
.navbar-dropdown {
|
|
168
168
|
display: none;
|
|
169
169
|
// Avoid height shaked by clicking
|
|
170
170
|
height: auto !important;
|
|
@@ -185,11 +185,3 @@
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* transition
|
|
191
|
-
*/
|
|
192
|
-
.dropdown-enter-from,
|
|
193
|
-
.dropdown-leave-to {
|
|
194
|
-
height: 0 !important;
|
|
195
|
-
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
position: relative;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.navbar-
|
|
24
|
+
.navbar-items-wrapper {
|
|
25
25
|
display: flex;
|
|
26
26
|
position: absolute;
|
|
27
27
|
box-sizing: border-box;
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* navbar-
|
|
60
|
+
* navbar-items
|
|
61
61
|
*/
|
|
62
|
-
.navbar-
|
|
62
|
+
.navbar-items {
|
|
63
63
|
display: inline-block;
|
|
64
64
|
|
|
65
65
|
a {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.navbar-
|
|
76
|
+
.navbar-item {
|
|
77
77
|
position: relative;
|
|
78
78
|
display: inline-block;
|
|
79
79
|
margin-left: 1.5rem;
|
|
@@ -86,22 +86,22 @@
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
@media (max-width: $MQMobile) {
|
|
89
|
-
.navbar-
|
|
90
|
-
.navbar-
|
|
89
|
+
.navbar-items {
|
|
90
|
+
.navbar-item {
|
|
91
91
|
margin-left: 0;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
@media (min-width: $MQMobile) {
|
|
97
|
-
.navbar-
|
|
97
|
+
.navbar-items a {
|
|
98
98
|
&:hover,
|
|
99
99
|
&.router-link-active {
|
|
100
100
|
color: var(--c-text);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.navbar-
|
|
104
|
+
.navbar-item > a {
|
|
105
105
|
&:hover,
|
|
106
106
|
&.router-link-active {
|
|
107
107
|
margin-bottom: -2px;
|
|
@@ -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)
|
|
52
|
+
transition: background-color var(--t-color);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
blockquote {
|
|
@@ -82,6 +82,10 @@ h6 {
|
|
|
82
82
|
font-weight: 600;
|
|
83
83
|
line-height: 1.25;
|
|
84
84
|
|
|
85
|
+
&:focus-visible {
|
|
86
|
+
outline: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
&:hover .header-anchor {
|
|
86
90
|
opacity: 1;
|
|
87
91
|
}
|
|
@@ -147,18 +151,22 @@ table {
|
|
|
147
151
|
margin: 1rem 0;
|
|
148
152
|
display: block;
|
|
149
153
|
overflow-x: auto;
|
|
154
|
+
transition: border-color var(--t-color);
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
tr {
|
|
153
158
|
border-top: 1px solid var(--c-border-dark);
|
|
159
|
+
transition: border-color var(--t-color);
|
|
154
160
|
|
|
155
161
|
&:nth-child(2n) {
|
|
156
162
|
background-color: var(--c-bg-light);
|
|
163
|
+
transition: background-color var(--t-color);
|
|
157
164
|
}
|
|
158
165
|
}
|
|
159
166
|
|
|
160
167
|
th,
|
|
161
168
|
td {
|
|
162
|
-
border: 1px solid var(--c-border-dark);
|
|
163
169
|
padding: 0.6em 1em;
|
|
170
|
+
border: 1px solid var(--c-border-dark);
|
|
171
|
+
transition: border-color var(--t-color);
|
|
164
172
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
@import '_mixins';
|
|
1
2
|
@import '_variables';
|
|
2
|
-
@import '_wrapper';
|
|
3
3
|
|
|
4
4
|
.page {
|
|
5
5
|
padding-bottom: 2rem;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.page-meta {
|
|
10
|
-
@
|
|
10
|
+
@include content_wrapper;
|
|
11
11
|
padding-top: 1rem;
|
|
12
12
|
padding-bottom: 1rem;
|
|
13
13
|
overflow: auto;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
.page-nav {
|
|
54
|
-
@
|
|
54
|
+
@include content_wrapper;
|
|
55
55
|
padding-top: 1rem;
|
|
56
56
|
padding-bottom: 0;
|
|
57
57
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@import '_mixins';
|
|
1
2
|
@import '_variables';
|
|
2
3
|
|
|
3
4
|
.sidebar {
|
|
@@ -11,7 +12,7 @@
|
|
|
11
12
|
display: inline-block;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
.navbar-
|
|
15
|
+
.navbar-items {
|
|
15
16
|
display: none;
|
|
16
17
|
border-bottom: 1px solid var(--c-border);
|
|
17
18
|
transition: border-color var(--t-color);
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
font-weight: 600;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.navbar-
|
|
25
|
+
.navbar-item {
|
|
25
26
|
display: block;
|
|
26
27
|
line-height: 1.25rem;
|
|
27
28
|
font-size: 1.1em;
|
|
@@ -29,80 +30,99 @@
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
.sidebar-
|
|
33
|
+
.sidebar-items {
|
|
33
34
|
padding: 1.5rem 0;
|
|
34
|
-
|
|
35
|
-
> li:not(:first-child) {
|
|
36
|
-
margin-top: 0.75rem;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.sidebar-sub-items {
|
|
40
|
-
padding-left: 1rem;
|
|
41
|
-
font-size: 0.95em;
|
|
42
|
-
}
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
37
|
|
|
46
38
|
@media (max-width: $MQMobile) {
|
|
47
39
|
.sidebar {
|
|
48
|
-
.navbar-
|
|
40
|
+
.navbar-items {
|
|
49
41
|
display: block;
|
|
50
42
|
|
|
51
|
-
.dropdown-wrapper
|
|
52
|
-
.
|
|
53
|
-
.dropdown-item
|
|
43
|
+
.navbar-dropdown-wrapper
|
|
44
|
+
.navbar-dropdown
|
|
45
|
+
.navbar-dropdown-item
|
|
54
46
|
a.router-link-active::after {
|
|
55
47
|
top: calc(1rem - 2px);
|
|
56
48
|
}
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
.sidebar-
|
|
51
|
+
.sidebar-items {
|
|
60
52
|
padding: 1rem 0;
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
|
|
65
|
-
.sidebar-
|
|
66
|
-
|
|
67
|
-
transition: color 0.15s ease;
|
|
68
|
-
font-size: 1.1em;
|
|
69
|
-
font-weight: bold;
|
|
70
|
-
padding: 0.35rem 1.5rem 0.35rem 1.25rem;
|
|
71
|
-
width: 100%;
|
|
72
|
-
box-sizing: border-box;
|
|
73
|
-
margin: 0;
|
|
57
|
+
.sidebar-item {
|
|
58
|
+
cursor: default;
|
|
74
59
|
border-left: 0.25rem solid transparent;
|
|
60
|
+
color: var(--c-text);
|
|
75
61
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
left: 0.5em;
|
|
62
|
+
&:focus-visible {
|
|
63
|
+
outline-width: 1px;
|
|
64
|
+
outline-offset: -1px;
|
|
80
65
|
}
|
|
81
|
-
}
|
|
82
66
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
color: var(--c-text);
|
|
88
|
-
border-left: 0.25rem solid transparent;
|
|
89
|
-
margin: 0;
|
|
90
|
-
padding: 0.35rem 1rem 0.35rem 2rem;
|
|
91
|
-
line-height: 1.4;
|
|
92
|
-
width: 100%;
|
|
93
|
-
box-sizing: border-box;
|
|
94
|
-
|
|
95
|
-
.sidebar-links > &:not(:first-child) {
|
|
96
|
-
margin-top: 0.75rem;
|
|
67
|
+
&.active:not(p.sidebar-heading) {
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
color: var(--c-text-accent);
|
|
70
|
+
border-left-color: var(--c-text-accent);
|
|
97
71
|
}
|
|
98
72
|
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
&.sidebar-heading {
|
|
74
|
+
transition: color 0.15s ease;
|
|
75
|
+
font-size: 1.1em;
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
padding: 0.35rem 1.5rem 0.35rem 1.25rem;
|
|
78
|
+
width: 100%;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
margin: 0;
|
|
81
|
+
|
|
82
|
+
&.collapsible {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
|
|
85
|
+
& + .sidebar-item-children {
|
|
86
|
+
@include dropdown_wrapper;
|
|
87
|
+
margin-bottom: 0.75rem;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.arrow {
|
|
92
|
+
position: relative;
|
|
93
|
+
top: -0.12em;
|
|
94
|
+
left: 0.5em;
|
|
95
|
+
}
|
|
101
96
|
}
|
|
102
|
-
}
|
|
103
97
|
|
|
104
|
-
.sidebar-
|
|
105
|
-
|
|
98
|
+
&:not(.sidebar-heading) {
|
|
99
|
+
font-size: 1em;
|
|
100
|
+
font-weight: 400;
|
|
101
|
+
display: inline-block;
|
|
102
|
+
margin: 0;
|
|
103
|
+
padding: 0.35rem 1rem 0.35rem 2rem;
|
|
104
|
+
line-height: 1.4;
|
|
105
|
+
width: 100%;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
|
|
108
|
+
& + .sidebar-item-children {
|
|
109
|
+
padding-left: 1rem;
|
|
110
|
+
font-size: 0.95em;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.sidebar-item-children .sidebar-item-children & {
|
|
114
|
+
padding: 0.25rem 1rem 0.25rem 1.75rem;
|
|
115
|
+
|
|
116
|
+
&.active {
|
|
117
|
+
font-weight: 500;
|
|
118
|
+
border-left-color: transparent;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
a.sidebar-heading + .sidebar-item-children &.active {
|
|
123
|
+
border-left-color: transparent;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
106
126
|
}
|
|
107
127
|
|
|
108
128
|
a.sidebar-item {
|
|
@@ -111,20 +131,4 @@ a.sidebar-item {
|
|
|
111
131
|
&:hover {
|
|
112
132
|
color: var(--c-text-accent);
|
|
113
133
|
}
|
|
114
|
-
|
|
115
|
-
&.active {
|
|
116
|
-
font-weight: 600;
|
|
117
|
-
color: var(--c-text-accent);
|
|
118
|
-
border-left-color: var(--c-text-accent);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
&.sidebar-heading.active {
|
|
122
|
-
font-weight: bold;
|
|
123
|
-
border-left-color: transparent;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.sidebar-sub-items &.active {
|
|
127
|
-
font-weight: 500;
|
|
128
|
-
border-left-color: transparent;
|
|
129
|
-
}
|
|
130
134
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dropdown
|
|
3
|
+
*/
|
|
4
|
+
.dropdown-enter-from,
|
|
5
|
+
.dropdown-leave-to {
|
|
6
|
+
height: 0 !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* fade-slide-y
|
|
11
|
+
*/
|
|
1
12
|
.fade-slide-y-enter-active {
|
|
2
13
|
transition: all 0.3s ease;
|
|
3
14
|
}
|
|
4
|
-
|
|
5
15
|
.fade-slide-y-leave-active {
|
|
6
16
|
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
|
|
7
17
|
}
|
|
8
|
-
|
|
9
18
|
.fade-slide-y-enter-from,
|
|
10
19
|
.fade-slide-y-leave-to {
|
|
11
20
|
transform: translateY(10px);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const normalizePath = (path) => decodeURI(path)
|
|
2
|
+
.replace(/#.*$/, '')
|
|
3
|
+
.replace(/(index)?\.(md|html)$/, '');
|
|
4
|
+
const isActiveLink = (link, route) => {
|
|
5
|
+
if (route.hash === link) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
const currentPath = normalizePath(route.path);
|
|
9
|
+
const targetPath = normalizePath(link);
|
|
10
|
+
return currentPath === targetPath;
|
|
11
|
+
};
|
|
12
|
+
export const isActiveSidebarItem = (item, route) => {
|
|
13
|
+
if (item.link && isActiveLink(item.link, route)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (item.children) {
|
|
17
|
+
return item.children.some((child) => isActiveSidebarItem(child, route));
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
};
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -18,6 +18,15 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions }, app) => {
|
|
|
18
18
|
return {
|
|
19
19
|
name: '@vuepress/theme-default',
|
|
20
20
|
layouts: utils_1.path.resolve(__dirname, '../client/layouts'),
|
|
21
|
+
templateBuild: utils_1.path.resolve(__dirname, '../../templates/index.build.html'),
|
|
22
|
+
// use alias to make all components replaceable
|
|
23
|
+
alias: Object.fromEntries(utils_1.fs
|
|
24
|
+
.readdirSync(utils_1.path.resolve(__dirname, '../client/components'))
|
|
25
|
+
.filter((file) => file.endsWith('.vue'))
|
|
26
|
+
.map((file) => [
|
|
27
|
+
`@theme/${file}`,
|
|
28
|
+
utils_1.path.resolve(__dirname, '../client/components', file),
|
|
29
|
+
])),
|
|
21
30
|
clientAppEnhanceFiles: utils_1.path.resolve(__dirname, '../client/clientAppEnhance.js'),
|
|
22
31
|
clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
|
|
23
32
|
extendsPage: (page) => {
|
|
@@ -56,7 +65,10 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions }, app) => {
|
|
|
56
65
|
'@vuepress/container',
|
|
57
66
|
(0, utils_2.resolveContainerPluginOptionsForCodeGroupItem)(themePlugins),
|
|
58
67
|
],
|
|
59
|
-
[
|
|
68
|
+
[
|
|
69
|
+
'@vuepress/external-link-icon',
|
|
70
|
+
(0, utils_2.resolveExternalLinkIconPluginOptions)(themePlugins, localeOptions),
|
|
71
|
+
],
|
|
60
72
|
['@vuepress/git', (0, utils_2.resolveGitPluginOptions)(themePlugins, localeOptions)],
|
|
61
73
|
['@vuepress/medium-zoom', (0, utils_2.resolveMediumZoomPluginOptions)(themePlugins)],
|
|
62
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';
|
package/lib/node/utils/index.js
CHANGED
|
@@ -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);
|
|
@@ -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;
|
package/lib/shared/nav.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface NavGroup<T> extends NavItem {
|
|
|
12
12
|
children: T[];
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Props for `<
|
|
15
|
+
* Props for `<AutoLink>`
|
|
16
16
|
*/
|
|
17
17
|
export interface NavLink extends NavItem {
|
|
18
18
|
link: string;
|
|
@@ -30,8 +30,14 @@ export declare type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarIte
|
|
|
30
30
|
/**
|
|
31
31
|
* Sidebar types
|
|
32
32
|
*/
|
|
33
|
-
export declare type SidebarItem = NavItem & Partial<NavLink
|
|
34
|
-
export declare type
|
|
33
|
+
export declare type SidebarItem = NavItem & Partial<NavLink>;
|
|
34
|
+
export declare type SidebarGroup = SidebarItem & NavGroup<SidebarItem | SidebarGroup | string>;
|
|
35
|
+
export declare type SidebarGroupCollapsible = SidebarGroup & {
|
|
36
|
+
collapsible?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare type SidebarConfigArray = (SidebarItem | SidebarGroupCollapsible | string)[];
|
|
35
39
|
export declare type SidebarConfigObject = Record<string, SidebarConfigArray>;
|
|
36
40
|
export declare type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
|
|
37
|
-
export declare type ResolvedSidebarItem =
|
|
41
|
+
export declare type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
|
|
42
|
+
collapsible?: boolean;
|
|
43
|
+
};
|