@vuepress/theme-default 2.0.0-rc.33 → 2.0.0-rc.35

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.
Files changed (107) hide show
  1. package/lib/client/components/VPDarkIcon.vue +8 -0
  2. package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
  3. package/lib/client/components/VPEditIcon.vue +12 -0
  4. package/lib/client/components/VPHome.vue +38 -0
  5. package/lib/client/components/VPHomeFeatures.vue +68 -0
  6. package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
  7. package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +107 -5
  8. package/lib/client/components/VPLightIcon.vue +28 -0
  9. package/lib/client/components/VPNavbar.vue +127 -0
  10. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +36 -4
  11. package/lib/client/components/VPNavbarDropdown.vue +319 -0
  12. package/lib/client/components/VPNavbarItems.vue +110 -0
  13. package/lib/client/components/VPPage.vue +66 -0
  14. package/lib/client/components/VPPageMeta.vue +132 -0
  15. package/lib/client/components/VPPageNav.vue +118 -0
  16. package/lib/client/components/VPSidebar.vue +112 -0
  17. package/lib/client/components/VPSidebarItem.vue +169 -0
  18. package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +30 -6
  19. package/lib/client/components/VPToggleColorModeButton.vue +54 -0
  20. package/lib/client/components/VPToggleSidebarButton.vue +92 -0
  21. package/lib/client/components/global/Badge.vue +60 -18
  22. package/lib/client/components/global/CodeGroup.d.ts +1 -0
  23. package/lib/client/components/global/CodeGroup.js +4 -3
  24. package/lib/client/components/global/CodeGroupItem.vue +5 -16
  25. package/lib/client/composables/index.d.ts +4 -0
  26. package/lib/client/composables/index.js +4 -0
  27. package/lib/client/composables/useContributors.d.ts +3 -0
  28. package/lib/client/composables/useContributors.js +14 -0
  29. package/lib/client/composables/useDarkMode.js +1 -1
  30. package/lib/client/composables/useEditLink.d.ts +3 -0
  31. package/lib/client/composables/useEditLink.js +31 -0
  32. package/lib/client/composables/useLastUpdated.d.ts +2 -0
  33. package/lib/client/composables/useLastUpdated.js +17 -0
  34. package/lib/client/composables/useNavbarConfig.d.ts +2 -2
  35. package/lib/client/composables/useNavbarConfig.js +1 -1
  36. package/lib/client/composables/useNavbarRepo.d.ts +2 -2
  37. package/lib/client/composables/useNavbarRepo.js +1 -1
  38. package/lib/client/composables/useNavbarSelectLanguage.d.ts +2 -2
  39. package/lib/client/composables/useNavbarSelectLanguage.js +2 -2
  40. package/lib/client/composables/useNavigate.js +4 -7
  41. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  42. package/lib/client/composables/useRelatedLinks.js +91 -0
  43. package/lib/client/composables/useSidebarItems.d.ts +10 -9
  44. package/lib/client/composables/useSidebarItems.js +14 -14
  45. package/lib/client/config.js +4 -2
  46. package/lib/client/index.d.ts +1 -0
  47. package/lib/client/index.js +1 -0
  48. package/lib/client/layouts/Layout.vue +111 -18
  49. package/lib/client/layouts/NotFound.vue +1 -1
  50. package/lib/client/styles/_mixins.scss +4 -4
  51. package/lib/client/styles/_variables.module.scss +1 -1
  52. package/lib/client/styles/_variables.scss +1 -0
  53. package/lib/client/styles/code-group.scss +32 -29
  54. package/lib/client/styles/{code.scss → content/code.scss} +55 -31
  55. package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +9 -5
  56. package/lib/client/styles/content/index.scss +4 -0
  57. package/lib/client/styles/content/normalize.scss +39 -0
  58. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  59. package/lib/client/styles/external-link-icon.scss +7 -3
  60. package/lib/client/styles/index.scss +2 -13
  61. package/lib/client/styles/layout.scss +3 -203
  62. package/lib/client/styles/normalize.scss +4 -3
  63. package/lib/client/styles/plugins.scss +20 -0
  64. package/lib/client/styles/vars-dark.scss +17 -16
  65. package/lib/client/styles/vars.scss +19 -23
  66. package/lib/client/typings.d.ts +13 -0
  67. package/lib/client/typings.js +1 -0
  68. package/lib/client/utils/getAutoLink.d.ts +9 -0
  69. package/lib/client/utils/{getNavLink.js → getAutoLink.js} +2 -2
  70. package/lib/client/utils/index.d.ts +1 -1
  71. package/lib/client/utils/index.js +1 -1
  72. package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
  73. package/lib/client/utils/isActiveSidebarItem.js +3 -3
  74. package/lib/node/defaultTheme.js +9 -1
  75. package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
  76. package/lib/shared/index.d.ts +2 -0
  77. package/lib/shared/index.js +2 -0
  78. package/lib/shared/nav.d.ts +21 -30
  79. package/lib/shared/navbar.d.ts +21 -0
  80. package/lib/shared/navbar.js +1 -0
  81. package/lib/shared/options.d.ts +6 -5
  82. package/lib/shared/page.d.ts +2 -2
  83. package/lib/shared/sidebar.d.ts +26 -0
  84. package/lib/shared/sidebar.js +1 -0
  85. package/package.json +18 -18
  86. package/templates/build.html +2 -0
  87. package/lib/client/components/Home.vue +0 -15
  88. package/lib/client/components/HomeContent.vue +0 -5
  89. package/lib/client/components/HomeFeatures.vue +0 -22
  90. package/lib/client/components/Navbar.vue +0 -80
  91. package/lib/client/components/NavbarDropdown.vue +0 -125
  92. package/lib/client/components/NavbarItems.vue +0 -51
  93. package/lib/client/components/Page.vue +0 -31
  94. package/lib/client/components/PageMeta.vue +0 -220
  95. package/lib/client/components/PageNav.vue +0 -228
  96. package/lib/client/components/Sidebar.vue +0 -18
  97. package/lib/client/components/SidebarItem.vue +0 -86
  98. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  99. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  100. package/lib/client/styles/badge.scss +0 -36
  101. package/lib/client/styles/home.scss +0 -168
  102. package/lib/client/styles/navbar-dropdown.scss +0 -177
  103. package/lib/client/styles/navbar.scss +0 -197
  104. package/lib/client/styles/page.scss +0 -11
  105. package/lib/client/styles/sidebar.scss +0 -128
  106. package/lib/client/styles/transitions.scss +0 -22
  107. package/lib/client/utils/getNavLink.d.ts +0 -9
@@ -1,207 +1,7 @@
1
- @import '_mixins';
2
- @import '_variables';
1
+ @import 'variables';
3
2
 
4
- .page {
5
- padding-top: var(--navbar-height);
6
- padding-left: var(--sidebar-width);
7
- }
8
-
9
- .navbar {
10
- position: fixed;
11
- z-index: 20;
12
- top: 0;
13
- left: 0;
14
- right: 0;
15
- height: var(--navbar-height);
16
- box-sizing: border-box;
17
- border-bottom: 1px solid var(--c-border);
18
- background-color: var(--c-bg-navbar);
19
- transition:
20
- background-color var(--t-color),
21
- border-color var(--t-color);
22
- }
23
-
24
- .sidebar {
25
- font-size: 16px;
26
- width: var(--sidebar-width);
27
- position: fixed;
28
- z-index: 10;
29
- margin: 0;
30
- top: var(--navbar-height);
31
- left: 0;
32
- bottom: 0;
33
- box-sizing: border-box;
34
- border-right: 1px solid var(--c-border);
35
- overflow-y: auto;
36
- scrollbar-width: thin;
37
- scrollbar-color: var(--c-brand) var(--c-border);
38
- background-color: var(--c-bg-sidebar);
39
- transition:
40
- transform var(--t-transform),
41
- background-color var(--t-color),
42
- border-color var(--t-color);
43
- &::-webkit-scrollbar {
44
- width: 7px;
45
- }
46
- &::-webkit-scrollbar-track {
47
- background-color: var(--c-border);
48
- }
49
- &::-webkit-scrollbar-thumb {
50
- background-color: var(--c-brand);
51
- }
52
- }
53
-
54
- .sidebar-mask {
55
- position: fixed;
56
- z-index: 9;
57
- top: 0;
58
- left: 0;
59
- width: 100vw;
60
- height: 100vh;
61
- display: none;
62
- }
63
-
64
- .theme-container {
65
- &.sidebar-open {
66
- .sidebar-mask {
67
- display: block;
68
- }
69
-
70
- .navbar > .toggle-sidebar-button .icon {
71
- span {
72
- &:nth-child(1) {
73
- transform: rotate(45deg) translate3d(5.5px, 5.5px, 0);
74
- }
75
-
76
- &:nth-child(2) {
77
- transform: scale3d(0, 1, 1);
78
- }
79
-
80
- &:nth-child(3) {
81
- transform: rotate(-45deg) translate3d(6px, -6px, 0);
82
- }
83
-
84
- &:nth-child(1),
85
- &:nth-child(3) {
86
- transform-origin: center;
87
- }
88
- }
89
- }
90
- }
91
-
92
- &.no-navbar {
93
- .theme-default-content {
94
- h1,
95
- h2,
96
- h3,
97
- h4,
98
- h5,
99
- h6 {
100
- margin-top: 1.5rem;
101
- padding-top: 0;
102
- }
103
- }
104
-
105
- .page {
106
- padding-top: 0;
107
- }
108
-
109
- .sidebar {
110
- top: 0;
111
- }
112
- }
113
- }
114
- .theme-container.no-sidebar {
115
- .sidebar {
3
+ .vp-hide-mobile {
4
+ @media screen and (max-width: $MQMobile) {
116
5
  display: none;
117
-
118
- @media (max-width: $MQMobile) {
119
- display: block;
120
- }
121
- }
122
-
123
- .page {
124
- padding-left: 0;
125
6
  }
126
7
  }
127
-
128
- .theme-default-content {
129
- a:not(.header-anchor):hover {
130
- text-decoration: underline;
131
- }
132
-
133
- img {
134
- max-width: 100%;
135
- }
136
-
137
- h1,
138
- h2,
139
- h3,
140
- h4,
141
- h5,
142
- h6 {
143
- margin-top: calc(0.5rem - var(--navbar-height));
144
- padding-top: calc(1rem + var(--navbar-height));
145
- margin-bottom: 0;
146
-
147
- &:first-child {
148
- margin-bottom: 1rem;
149
-
150
- + p,
151
- + pre,
152
- + .custom-container {
153
- margin-top: 2rem;
154
- }
155
- }
156
- }
157
- }
158
-
159
- // narrow desktop / iPad
160
- @media (max-width: $MQNarrow) {
161
- .sidebar {
162
- font-size: 15px;
163
- width: var(--sidebar-width-mobile);
164
- }
165
-
166
- .page {
167
- padding-left: var(--sidebar-width-mobile);
168
- }
169
- }
170
-
171
- // wide mobile
172
- @media (max-width: $MQMobile) {
173
- .sidebar {
174
- top: 0;
175
- padding-top: var(--navbar-height);
176
- transform: translateX(-100%);
177
- }
178
-
179
- .page {
180
- padding-left: 0;
181
- }
182
-
183
- .theme-container {
184
- &.sidebar-open {
185
- .sidebar {
186
- transform: translateX(0);
187
- }
188
- }
189
-
190
- &.no-navbar {
191
- .sidebar {
192
- padding-top: 0;
193
- }
194
- }
195
- }
196
- }
197
-
198
- // narrow mobile
199
- @media (max-width: $MQMobileNarrow) {
200
- h1 {
201
- font-size: 1.9rem;
202
- }
203
- }
204
-
205
- #vp-comment {
206
- @include content_wrapper;
207
- }
@@ -16,6 +16,7 @@ body {
16
16
 
17
17
  h2 {
18
18
  border-color: var(--c-border);
19
+ transition: border-color var(--t-color);
19
20
  }
20
21
 
21
22
  a {
@@ -23,9 +24,9 @@ a {
23
24
  }
24
25
 
25
26
  code {
26
- font-family: var(--font-family-code);
27
- color: var(--c-text-lighter);
28
27
  background-color: var(--c-bg-light);
28
+ color: var(--c-text-lighter);
29
+ font-family: var(--font-family-code);
29
30
  transition: background-color var(--t-color);
30
31
 
31
32
  p a & {
@@ -38,8 +39,8 @@ kbd {
38
39
  }
39
40
 
40
41
  blockquote {
41
- color: var(--c-text-quote);
42
42
  border-color: var(--c-border-dark);
43
+ color: var(--c-text-quote);
43
44
  }
44
45
 
45
46
  hr {
@@ -0,0 +1,20 @@
1
+ @use 'mixins';
2
+
3
+ // plugin-comment
4
+ #vp-comment {
5
+ @include mixins.content-wrapper;
6
+ }
7
+
8
+ .vp-navbar {
9
+ // plugin-docsearch
10
+ /* stylelint-disable-next-line selector-class-pattern */
11
+ .DocSearch {
12
+ transition: background-color var(--t-color);
13
+ }
14
+
15
+ // plugin-search
16
+ .search-box {
17
+ vertical-align: top;
18
+ flex: 0 0 auto;
19
+ }
20
+ }
@@ -54,22 +54,23 @@ html.dark {
54
54
 
55
55
  // code blocks vars
56
56
  --code-hl-bg-color: #363b46;
57
- }
58
57
 
59
- // plugin-docsearch
60
- html.dark .DocSearch {
61
- --docsearch-logo-color: var(--c-text);
62
- --docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
63
- --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d,
64
- 0 2px 2px 0 rgba(3, 4, 9, 0.3);
65
- --docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21);
66
- --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5),
67
- 0 -4px 8px 0 rgba(0, 0, 0, 0.2);
68
- }
58
+ // plugin-docsearch
59
+ /* stylelint-disable-next-line selector-class-pattern */
60
+ .DocSearch {
61
+ --docsearch-logo-color: var(--c-text);
62
+ --docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309;
63
+ --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d,
64
+ 0 2px 2px 0 rgb(3 4 9 / 30%);
65
+ --docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21);
66
+ --docsearch-footer-shadow: inset 0 1px 0 0 rgb(73 76 106 / 50%),
67
+ 0 -4px 8px 0 rgb(0 0 0 / 20%);
68
+ }
69
69
 
70
- // plugin-pwa
71
- html.dark body {
72
- --pwa-shadow-color: rgb(0 0 0 / 30%);
73
- --pwa-content-color: #ccc;
74
- --pwa-content-light-color: #999;
70
+ // plugin-pwa
71
+ body {
72
+ --pwa-shadow-color: rgb(0 0 0 / 30%);
73
+ --pwa-content-color: #ccc;
74
+ --pwa-content-light-color: #999;
75
+ }
75
76
  }
@@ -4,14 +4,14 @@
4
4
  --c-brand-light: #4abf8a;
5
5
 
6
6
  // background colors
7
- --c-bg: #ffffff;
7
+ --c-bg: #fff;
8
8
  --c-bg-light: #f3f4f5;
9
- --c-bg-lighter: #eeeeee;
9
+ --c-bg-lighter: #eee;
10
10
  --c-bg-dark: #ebebec;
11
11
  --c-bg-darker: #e6e6e6;
12
12
  --c-bg-navbar: var(--c-bg);
13
13
  --c-bg-sidebar: var(--c-bg);
14
- --c-bg-arrow: #cccccc;
14
+ --c-bg-arrow: #ccc;
15
15
 
16
16
  // text colors
17
17
  --c-text: #2c3e50;
@@ -19,7 +19,7 @@
19
19
  --c-text-light: #3a5169;
20
20
  --c-text-lighter: #4e6e8e;
21
21
  --c-text-lightest: #6a8bad;
22
- --c-text-quote: #999999;
22
+ --c-text-quote: #999;
23
23
 
24
24
  // border colors
25
25
  --c-border: #eaecef;
@@ -49,11 +49,11 @@
49
49
  --c-danger-border-dark: #f1abab;
50
50
  --c-danger-details-bg: #ffd4d4;
51
51
  --c-danger-title: #ed1e2c;
52
- --c-danger-text: #660000;
52
+ --c-danger-text: #600;
53
53
  --c-danger-text-accent: #bd1a1a;
54
54
  --c-danger-text-light: #b5474d;
55
55
  --c-danger-text-quote: #c15b5b;
56
- --c-details-bg: #eeeeee;
56
+ --c-details-bg: #eee;
57
57
 
58
58
  // badge component colors
59
59
  --c-badge-tip: var(--c-tip);
@@ -63,7 +63,7 @@
63
63
  --c-badge-danger-text: var(--c-bg);
64
64
 
65
65
  // code group colors
66
- --c-code-group-tab-title: rgba(255, 255, 255, 0.9);
66
+ --c-code-group-tab-title: rgb(255 255 255 / 90%);
67
67
  --c-code-group-tab-bg: var(--code-bg-color);
68
68
  --c-code-group-tab-outline: var(var(--c-code-group-tab-title));
69
69
  --c-code-group-tab-active-border: var(--c-brand);
@@ -74,20 +74,20 @@
74
74
 
75
75
  // code blocks vars
76
76
  --code-bg-color: #282c34;
77
- --code-hl-bg-color: rgba(0, 0, 0, 0.66);
78
- --code-hl-error-bg-color: rgba(244, 63, 94, 0.16);
79
- --code-hl-warning-bg-color: rgba(255, 193, 7, 0.16);
80
- --code-line-diff-remove-color: rgba(244, 63, 94, 0.16);
77
+ --code-hl-bg-color: rgb(0 0 0 / 66%);
78
+ --code-hl-error-bg-color: rgb(244 63 94 / 16%);
79
+ --code-hl-warning-bg-color: rgb(255 193 7 / 16%);
80
+ --code-line-diff-remove-color: rgb(244 63 94 / 16%);
81
81
  --code-line-diff-remove-symbol-color: #e0575b;
82
- --code-line-diff-add-color: rgba(16, 185, 129, 0.16);
82
+ --code-line-diff-add-color: rgb(16 185 129 / 16%);
83
83
  --code-line-diff-add-symbol-color: #298459;
84
84
  --code-ln-color: #9e9e9e;
85
85
  --code-ln-wrapper-width: 3.5rem;
86
86
 
87
87
  // font vars
88
- --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
89
- Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
90
- --font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
88
+ --font-family: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', roboto, oxygen,
89
+ ubuntu, cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
90
+ --font-family-code: consolas, monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
91
91
 
92
92
  // layout vars
93
93
  --navbar-height: 3.6rem;
@@ -131,12 +131,13 @@
131
131
  }
132
132
 
133
133
  // plugin-docsearch
134
+ /* stylelint-disable-next-line selector-class-pattern */
134
135
  .DocSearch {
135
136
  --docsearch-primary-color: var(--c-brand);
136
137
  --docsearch-text-color: var(--c-text);
137
138
  --docsearch-highlight-color: var(--c-brand);
138
139
  --docsearch-muted-color: var(--c-text-quote);
139
- --docsearch-container-background: rgba(9, 10, 17, 0.8);
140
+ --docsearch-container-background: rgb(9 10 17 / 80%);
140
141
  --docsearch-modal-background: var(--c-bg-light);
141
142
  --docsearch-searchbox-background: var(--c-bg-lighter);
142
143
  --docsearch-searchbox-focus-background: var(--c-bg);
@@ -157,11 +158,9 @@
157
158
  .vp-notice-wrapper {
158
159
  --notice-color: var(--c-text);
159
160
  --notice-bg-color: var(--c-bg);
160
-
161
161
  --notice-primary-color: var(--c-brand);
162
162
  --notice-primary-text-color: var(--c-bg);
163
163
  --notice-primary-hover-color: var(--c-brand-light);
164
-
165
164
  --notice-button-color: var(--c-bg-light);
166
165
  --notice-button-hover-color: var(--c-bg-lighter);
167
166
  }
@@ -171,14 +170,12 @@
171
170
  --nprogress-color: var(--c-brand);
172
171
  }
173
172
 
174
- // plugin-photo-swipe
175
173
  body {
174
+ // plugin-photo-swipe
176
175
  --photo-swipe-bullet: var(--c-bg);
177
176
  --photo-swipe-bullet-active: var(--c-brand);
178
- }
179
177
 
180
- // plugin-pwa-popup
181
- body {
178
+ // plugin-pwa-popup
182
179
  --pwa-text-color: var(--c-text);
183
180
  --pwa-bg-color: var(--c-bg);
184
181
  --pwa-border-color: var(--c-brand);
@@ -204,7 +201,6 @@ body {
204
201
  --search-accent-color: var(--c-brand);
205
202
  --search-text-color: var(--c-text);
206
203
  --search-border-color: var(--c-border);
207
-
208
204
  --search-item-text-color: var(--c-text-lighter);
209
205
  --search-item-focus-bg-color: var(--c-bg-light);
210
206
  }
@@ -0,0 +1,13 @@
1
+ import type { AutoLinkOptions, NavbarLinkOptions, NavGroup, SidebarGroupOptions, SidebarLinkOptions } from '../shared/index.js';
2
+ export type NavbarItem = NavbarLinkOptions | NavGroup<AutoLinkOptions | NavGroup<AutoLinkOptions>>;
3
+ export type SidebarLinkItem = SidebarLinkOptions;
4
+ export interface SidebarHeaderItem {
5
+ text: string;
6
+ link: string;
7
+ children?: SidebarHeaderItem[];
8
+ }
9
+ export interface SidebarGroupItem extends SidebarGroupOptions {
10
+ prefix?: string;
11
+ children: (SidebarItem | SidebarHeaderItem)[];
12
+ }
13
+ export type SidebarItem = SidebarLinkItem | SidebarGroupItem;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { AutoLinkOptions } from '../../shared';
2
+ /**
3
+ * Resolve AutoLink props from string
4
+ *
5
+ * @example
6
+ * - Input: '/README.md'
7
+ * - Output: { text: 'Home', link: '/' }
8
+ */
9
+ export declare const getAutoLink: (config: string, currentPath?: string) => AutoLinkOptions;
@@ -6,8 +6,8 @@ import { resolveRoute } from 'vuepress/client';
6
6
  * - Input: '/README.md'
7
7
  * - Output: { text: 'Home', link: '/' }
8
8
  */
9
- export const getAutoLink = (config) => {
10
- const { notFound, meta, path } = resolveRoute(config);
9
+ export const getAutoLink = (config, currentPath) => {
10
+ const { notFound, meta, path } = resolveRoute(config, currentPath);
11
11
  return notFound
12
12
  ? { text: path, link: path }
13
13
  : {
@@ -1,4 +1,4 @@
1
- export * from './getNavLink.js';
1
+ export * from './getAutoLink.js';
2
2
  export * from './isActiveSidebarItem.js';
3
3
  export * from './isLinkInternal.js';
4
4
  export * from './resolveEditLink.js';
@@ -1,4 +1,4 @@
1
- export * from './getNavLink.js';
1
+ export * from './getAutoLink.js';
2
2
  export * from './isActiveSidebarItem.js';
3
3
  export * from './isLinkInternal.js';
4
4
  export * from './resolveEditLink.js';
@@ -1,3 +1,3 @@
1
1
  import type { RouteLocationNormalizedLoaded } from 'vuepress/client';
2
- import type { ResolvedSidebarItem } from '../../shared/index.js';
3
- export declare const isActiveSidebarItem: (item: ResolvedSidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
2
+ import type { SidebarItem } from '../typings.js';
3
+ export declare const isActiveLinkItem: (item: SidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
@@ -9,12 +9,12 @@ const isActiveLink = (link, route) => {
9
9
  const targetPath = normalizePath(link);
10
10
  return currentPath === targetPath;
11
11
  };
12
- export const isActiveSidebarItem = (item, route) => {
12
+ export const isActiveLinkItem = (item, route) => {
13
13
  if (item.link && isActiveLink(item.link, route)) {
14
14
  return true;
15
15
  }
16
- if (item.children) {
17
- return item.children.some((child) => isActiveSidebarItem(child, route));
16
+ if ('children' in item) {
17
+ return item.children.some((child) => isActiveLinkItem(child, route));
18
18
  }
19
19
  return false;
20
20
  };
@@ -29,6 +29,14 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
29
29
  `@theme/${file}`,
30
30
  path.resolve(__dirname, '../client/components', file),
31
31
  ])),
32
+ // use alias to make all composables replaceable
33
+ ...Object.fromEntries(fs
34
+ .readdirSync(path.resolve(__dirname, '../client/composables'))
35
+ .filter((file) => file.endsWith('.js'))
36
+ .map((file) => [
37
+ `@theme/${file.substring(0, file.length - 3)}`,
38
+ path.resolve(__dirname, '../client/composables', file),
39
+ ])),
32
40
  },
33
41
  clientConfigFile: path.resolve(__dirname, '../client/config.js'),
34
42
  extendsPage: (page) => {
@@ -41,7 +49,7 @@ export const defaultTheme = ({ hostname, themePlugins = {}, ...localeOptions } =
41
49
  // @vuepress/plugin-active-header-link
42
50
  themePlugins.activeHeaderLinks !== false
43
51
  ? activeHeaderLinksPlugin({
44
- headerLinkSelector: 'a.sidebar-item',
52
+ headerLinkSelector: 'a.vp-sidebar-item',
45
53
  headerAnchorSelector: '.header-anchor',
46
54
  // should greater than page transition duration
47
55
  delay: 300,
@@ -9,7 +9,7 @@ export const DEFAULT_LOCALE_OPTIONS = {
9
9
  selectLanguageText: 'Languages',
10
10
  selectLanguageAriaLabel: 'Select language',
11
11
  // sidebar
12
- sidebar: 'auto',
12
+ sidebar: 'heading',
13
13
  sidebarDepth: 2,
14
14
  // page meta
15
15
  editLink: true,
@@ -1,3 +1,5 @@
1
1
  export * from './nav.js';
2
+ export * from './navbar.js';
2
3
  export * from './options.js';
3
4
  export * from './page.js';
5
+ export * from './sidebar.js';
@@ -1,3 +1,5 @@
1
1
  export * from './nav.js';
2
+ export * from './navbar.js';
2
3
  export * from './options.js';
3
4
  export * from './page.js';
5
+ export * from './sidebar.js';
@@ -1,41 +1,32 @@
1
- import type { AutoLinkConfig } from 'vuepress/client';
2
1
  /**
3
2
  * Base nav item, displayed as text
4
3
  */
5
- export interface NavItem {
4
+ export interface NavItemOptions {
6
5
  text: string;
7
6
  ariaLabel?: string;
8
7
  }
9
8
  /**
10
- * Base nav group, has nav items children
9
+ * Options for `<AutoLink>`
11
10
  */
12
- export interface NavGroup<T> extends NavItem {
11
+ export interface AutoLinkOptions extends NavItemOptions {
13
12
  /**
14
- * Link prefix of current group
15
- *
16
- * 当前分组的页面前缀
13
+ * Link of item
17
14
  */
18
- prefix?: string;
19
- children: T[];
15
+ link: string;
16
+ /**
17
+ * Rel of `<a>` tag
18
+ */
19
+ rel?: string;
20
+ /**
21
+ * Target of `<a>` tag
22
+ */
23
+ target?: string;
24
+ /**
25
+ * Regexp mode to be active
26
+ */
27
+ activeMatch?: string;
28
+ /**
29
+ * Whether it's active only when exact match
30
+ */
31
+ exact?: boolean;
20
32
  }
21
- /**
22
- * Navbar types
23
- */
24
- export type NavbarItem = AutoLinkConfig;
25
- export type NavbarGroup = NavGroup<NavbarGroup | NavbarItem | string>;
26
- export type NavbarConfig = (NavbarItem | NavbarGroup | string)[];
27
- export type ResolvedNavbarItem = NavbarItem | NavGroup<ResolvedNavbarItem>;
28
- /**
29
- * Sidebar types
30
- */
31
- export type SidebarItem = NavItem & Partial<AutoLinkConfig>;
32
- export type SidebarGroup = SidebarItem & NavGroup<SidebarItem | SidebarGroup | string> & {
33
- collapsible?: boolean;
34
- };
35
- export type SidebarConfigArray = (SidebarItem | SidebarGroup | string)[];
36
- export type SidebarConfigObjectItem = SidebarConfigArray | 'heading';
37
- export type SidebarConfigObject = Record<string, SidebarConfigObjectItem>;
38
- export type SidebarConfig = SidebarConfigArray | SidebarConfigObject;
39
- export type ResolvedSidebarItem = SidebarItem & Partial<NavGroup<ResolvedSidebarItem>> & {
40
- collapsible?: boolean;
41
- };
@@ -0,0 +1,21 @@
1
+ import type { AutoLinkOptions, NavItemOptions } from './nav.js';
2
+ /**
3
+ * Base nav group, has nav items children
4
+ */
5
+ export interface NavGroup<T> extends NavItemOptions {
6
+ /**
7
+ * Link prefix of current group
8
+ */
9
+ prefix?: string;
10
+ /**
11
+ * Link of current group
12
+ */
13
+ link?: string;
14
+ /**
15
+ * Children of current group
16
+ */
17
+ children: T[];
18
+ }
19
+ export type NavbarLinkOptions = AutoLinkOptions;
20
+ export type NavbarGroupOptions = NavGroup<NavbarLinkOptions | NavGroup<NavbarLinkOptions> | string>;
21
+ export type NavbarOptions = (NavbarLinkOptions | NavbarGroupOptions | string)[] | false;
@@ -0,0 +1 @@
1
+ export {};