@vuepress/theme-default 2.0.0-beta.42 → 2.0.0-beta.45
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/composables/useNavLink.js +4 -1
- package/lib/client/config.d.ts +3 -0
- package/lib/client/config.js +40 -0
- package/lib/client/styles/code.scss +8 -6
- package/lib/client/styles/normalize.scss +5 -1
- package/lib/node/defaultTheme.js +1 -2
- package/package.json +18 -18
- package/lib/client/clientAppEnhance.d.ts +0 -3
- package/lib/client/clientAppEnhance.js +0 -34
- package/lib/client/clientAppSetup.d.ts +0 -2
- package/lib/client/clientAppSetup.js +0 -6
|
@@ -7,7 +7,10 @@ import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect';
|
|
|
7
7
|
* - Output: { text: 'Home', link: '/' }
|
|
8
8
|
*/
|
|
9
9
|
export const useNavLink = (item) => {
|
|
10
|
-
|
|
10
|
+
// the route path of vue-router is url-encoded, and we expect users are using
|
|
11
|
+
// non-url-encoded string in theme config, so we need to url-encode it first to
|
|
12
|
+
// resolve the route correctly
|
|
13
|
+
const resolved = useResolveRouteWithRedirect(encodeURI(item));
|
|
11
14
|
return {
|
|
12
15
|
text: resolved.meta.title || item,
|
|
13
16
|
link: resolved.name === '404' ? item : resolved.fullPath,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineClientConfig } from '@vuepress/client';
|
|
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';
|
|
6
|
+
import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables';
|
|
7
|
+
import './styles/index.scss';
|
|
8
|
+
export default defineClientConfig({
|
|
9
|
+
enhance({ app, router }) {
|
|
10
|
+
app.component('Badge', Badge);
|
|
11
|
+
app.component('CodeGroup', CodeGroup);
|
|
12
|
+
app.component('CodeGroupItem', CodeGroupItem);
|
|
13
|
+
// compat with @vuepress/plugin-external-link-icon
|
|
14
|
+
app.component('AutoLinkExternalIcon', () => {
|
|
15
|
+
const ExternalLinkIcon = app.component('ExternalLinkIcon');
|
|
16
|
+
if (ExternalLinkIcon) {
|
|
17
|
+
return h(ExternalLinkIcon);
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
});
|
|
21
|
+
// compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
|
|
22
|
+
app.component('NavbarSearch', () => {
|
|
23
|
+
const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
|
|
24
|
+
if (SearchComponent) {
|
|
25
|
+
return h(SearchComponent);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
});
|
|
29
|
+
// handle scrollBehavior with transition
|
|
30
|
+
const scrollBehavior = router.options.scrollBehavior;
|
|
31
|
+
router.options.scrollBehavior = async (...args) => {
|
|
32
|
+
await useScrollPromise().wait();
|
|
33
|
+
return scrollBehavior(...args);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
setup() {
|
|
37
|
+
setupDarkMode();
|
|
38
|
+
setupSidebarItems();
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -218,17 +218,19 @@ div[class*='language-'] {
|
|
|
218
218
|
color: var(--code-ln-color);
|
|
219
219
|
padding-top: 1.25rem;
|
|
220
220
|
line-height: 1.4;
|
|
221
|
-
|
|
222
|
-
br {
|
|
223
|
-
user-select: none;
|
|
224
|
-
}
|
|
221
|
+
counter-reset: line-number;
|
|
225
222
|
|
|
226
223
|
.line-number {
|
|
227
224
|
position: relative;
|
|
228
225
|
z-index: 3;
|
|
229
226
|
user-select: none;
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
height: 1.4em;
|
|
228
|
+
|
|
229
|
+
&::before {
|
|
230
|
+
counter-increment: line-number;
|
|
231
|
+
content: counter(line-number);
|
|
232
|
+
font-size: 0.85em;
|
|
233
|
+
}
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
|
|
@@ -10,11 +10,15 @@ html.dark {
|
|
|
10
10
|
color-scheme: dark;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
html {
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
body {
|
|
14
18
|
font-family: var(--font-family);
|
|
15
19
|
-webkit-font-smoothing: antialiased;
|
|
16
20
|
-moz-osx-font-smoothing: grayscale;
|
|
17
|
-
font-size:
|
|
21
|
+
font-size: 1rem;
|
|
18
22
|
color: var(--c-text);
|
|
19
23
|
}
|
|
20
24
|
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -27,8 +27,7 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
27
27
|
`@theme/${file}`,
|
|
28
28
|
utils_1.path.resolve(__dirname, '../client/components', file),
|
|
29
29
|
])),
|
|
30
|
-
|
|
31
|
-
clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
|
|
30
|
+
clientConfigFile: utils_1.path.resolve(__dirname, '../client/config.js'),
|
|
32
31
|
extendsPage: (page) => {
|
|
33
32
|
// save relative file path into page data to generate edit link
|
|
34
33
|
page.data.filePathRelative = page.filePathRelative;
|
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.45",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"templates"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@vuepress/client": "2.0.0-beta.
|
|
29
|
-
"@vuepress/core": "2.0.0-beta.
|
|
30
|
-
"@vuepress/plugin-active-header-links": "2.0.0-beta.
|
|
31
|
-
"@vuepress/plugin-back-to-top": "2.0.0-beta.
|
|
32
|
-
"@vuepress/plugin-container": "2.0.0-beta.
|
|
33
|
-
"@vuepress/plugin-external-link-icon": "2.0.0-beta.
|
|
34
|
-
"@vuepress/plugin-git": "2.0.0-beta.
|
|
35
|
-
"@vuepress/plugin-medium-zoom": "2.0.0-beta.
|
|
36
|
-
"@vuepress/plugin-nprogress": "2.0.0-beta.
|
|
37
|
-
"@vuepress/plugin-palette": "2.0.0-beta.
|
|
38
|
-
"@vuepress/plugin-prismjs": "2.0.0-beta.
|
|
39
|
-
"@vuepress/plugin-theme-data": "2.0.0-beta.
|
|
40
|
-
"@vuepress/shared": "2.0.0-beta.
|
|
41
|
-
"@vuepress/utils": "2.0.0-beta.
|
|
42
|
-
"@vueuse/core": "^8.2
|
|
43
|
-
"sass": "^1.
|
|
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",
|
|
42
|
+
"@vueuse/core": "^8.4.2",
|
|
43
|
+
"sass": "^1.51.0",
|
|
44
44
|
"vue": "^3.2.33",
|
|
45
|
-
"vue-router": "^4.0.
|
|
45
|
+
"vue-router": "^4.0.15"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"sass-loader": "^12.6.0"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineClientAppEnhance } from '@vuepress/client';
|
|
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';
|
|
6
|
-
import { useScrollPromise } from './composables';
|
|
7
|
-
import './styles/index.scss';
|
|
8
|
-
export default defineClientAppEnhance(({ app, router }) => {
|
|
9
|
-
app.component('Badge', Badge);
|
|
10
|
-
app.component('CodeGroup', CodeGroup);
|
|
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
|
-
});
|
|
20
|
-
// compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
|
|
21
|
-
app.component('NavbarSearch', () => {
|
|
22
|
-
const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
|
|
23
|
-
if (SearchComponent) {
|
|
24
|
-
return h(SearchComponent);
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
});
|
|
28
|
-
// handle scrollBehavior with transition
|
|
29
|
-
const scrollBehavior = router.options.scrollBehavior;
|
|
30
|
-
router.options.scrollBehavior = async (...args) => {
|
|
31
|
-
await useScrollPromise().wait();
|
|
32
|
-
return scrollBehavior(...args);
|
|
33
|
-
};
|
|
34
|
-
});
|