@vuepress/theme-default 2.0.0-beta.25 → 2.0.0-beta.29
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 +4 -5
- package/lib/client/components/Home.vue +8 -5
- package/lib/client/components/NavLink.vue +5 -5
- package/lib/client/components/Navbar.vue +9 -6
- package/lib/client/components/NavbarLinks.vue +1 -1
- package/lib/client/components/PageMeta.vue +7 -4
- package/lib/client/components/PageNav.vue +0 -2
- package/lib/client/components/global/CodeGroup.d.ts +1 -1
- package/lib/client/components/global/{OutboundLink.vue → ExternalLinkIcon.vue} +3 -6
- package/lib/client/composables/useSidebarItems.d.ts +1 -1
- package/lib/client/index.d.ts +1 -1
- package/lib/client/layouts/Layout.vue +20 -16
- package/lib/client/styles/code.scss +1 -0
- package/lib/client/styles/home.scss +7 -4
- package/lib/client/styles/normalize.scss +1 -0
- package/lib/client/styles/page.scss +8 -0
- package/lib/client/styles/vars.scss +5 -0
- package/lib/client/utils/resolveEditLink.d.ts +1 -1
- package/lib/client/utils/resolveEditLink.js +12 -7
- package/lib/node/defaultTheme.js +28 -13
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +3 -1
- package/lib/node/utils/assignDefaultLocaleOptions.js +5 -5
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +1 -1
- package/lib/node/utils/resolveGitPluginOptions.d.ts +1 -1
- package/lib/shared/options.d.ts +5 -1
- package/lib/shared/page.d.ts +3 -1
- package/package.json +21 -20
|
@@ -3,17 +3,16 @@ import { h } from 'vue';
|
|
|
3
3
|
import Badge from './components/global/Badge.vue';
|
|
4
4
|
import CodeGroup from './components/global/CodeGroup';
|
|
5
5
|
import CodeGroupItem from './components/global/CodeGroupItem.vue';
|
|
6
|
-
import
|
|
6
|
+
import ExternalLinkIcon from './components/global/ExternalLinkIcon.vue';
|
|
7
7
|
import { useScrollPromise } from './composables';
|
|
8
8
|
import './styles/index.scss';
|
|
9
9
|
export default defineClientAppEnhance(({ app, router }) => {
|
|
10
10
|
app.component('Badge', Badge);
|
|
11
11
|
app.component('CodeGroup', CodeGroup);
|
|
12
12
|
app.component('CodeGroupItem', CodeGroupItem);
|
|
13
|
-
//
|
|
14
|
-
delete app._context.components.
|
|
15
|
-
|
|
16
|
-
app.component('OutboundLink', OutboundLink);
|
|
13
|
+
// override the `<ExternalLinkIcon>` provided by @vuepress/plugin-external-link-icon
|
|
14
|
+
delete app._context.components.ExternalLinkIcon;
|
|
15
|
+
app.component('ExternalLinkIcon', ExternalLinkIcon);
|
|
17
16
|
// compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
|
|
18
17
|
app.component('NavbarSearch', () => {
|
|
19
18
|
const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<main class="home" :aria-labelledby="heroText ? 'main-title' : undefined">
|
|
3
3
|
<header class="hero">
|
|
4
|
-
<
|
|
4
|
+
<ClientOnly>
|
|
5
|
+
<img v-if="heroImage" :src="withBase(heroImage)" :alt="heroAlt" />
|
|
6
|
+
</ClientOnly>
|
|
5
7
|
|
|
6
8
|
<h1 v-if="heroText" id="main-title">
|
|
7
9
|
{{ heroText }}
|
|
@@ -50,18 +52,19 @@ import {
|
|
|
50
52
|
import { isArray } from '@vuepress/shared'
|
|
51
53
|
import { computed } from 'vue'
|
|
52
54
|
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
55
|
+
import { useDarkMode } from '../composables'
|
|
53
56
|
import NavLink from './NavLink.vue'
|
|
54
57
|
|
|
55
58
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
56
59
|
const siteLocale = useSiteLocaleData()
|
|
60
|
+
const isDarkMode = useDarkMode()
|
|
57
61
|
|
|
58
62
|
// hero image and title
|
|
59
63
|
const heroImage = computed(() => {
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
64
|
+
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined) {
|
|
65
|
+
return frontmatter.value.heroImageDark
|
|
62
66
|
}
|
|
63
|
-
|
|
64
|
-
return withBase(frontmatter.value.heroImage)
|
|
67
|
+
return frontmatter.value.heroImage
|
|
65
68
|
})
|
|
66
69
|
const heroText = computed(() => {
|
|
67
70
|
if (frontmatter.value.heroText === null) {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
>
|
|
23
23
|
<slot name="before" />
|
|
24
24
|
{{ item.text }}
|
|
25
|
-
<
|
|
25
|
+
<ExternalLinkIcon v-if="isBlankTarget" />
|
|
26
26
|
<slot name="after" />
|
|
27
27
|
</a>
|
|
28
28
|
</template>
|
|
@@ -58,12 +58,12 @@ const { item } = toRefs(props)
|
|
|
58
58
|
// if the link has http protocol
|
|
59
59
|
const hasHttpProtocol = computed(() => isLinkHttp(item.value.link))
|
|
60
60
|
// if the link has non-http protocol
|
|
61
|
-
const
|
|
61
|
+
const hasNonHttpProtocol = computed(
|
|
62
62
|
() => isLinkMailto(item.value.link) || isLinkTel(item.value.link)
|
|
63
63
|
)
|
|
64
64
|
// resolve the `target` attr
|
|
65
65
|
const linkTarget = computed(() => {
|
|
66
|
-
if (
|
|
66
|
+
if (hasNonHttpProtocol.value) return undefined
|
|
67
67
|
if (item.value.target) return item.value.target
|
|
68
68
|
if (hasHttpProtocol.value) return '_blank'
|
|
69
69
|
return undefined
|
|
@@ -73,11 +73,11 @@ const isBlankTarget = computed(() => linkTarget.value === '_blank')
|
|
|
73
73
|
// is `<RouterLink>` or not
|
|
74
74
|
const isRouterLink = computed(
|
|
75
75
|
() =>
|
|
76
|
-
!hasHttpProtocol.value && !
|
|
76
|
+
!hasHttpProtocol.value && !hasNonHttpProtocol.value && !isBlankTarget.value
|
|
77
77
|
)
|
|
78
78
|
// resolve the `rel` attr
|
|
79
79
|
const linkRel = computed(() => {
|
|
80
|
-
if (
|
|
80
|
+
if (hasNonHttpProtocol.value) return undefined
|
|
81
81
|
if (item.value.rel) return item.value.rel
|
|
82
82
|
if (isBlankTarget.value) return 'noopener noreferrer'
|
|
83
83
|
return undefined
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
<span ref="siteBrand">
|
|
6
6
|
<RouterLink :to="siteBrandLink">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
<!-- logo could be different in dark mode, so we make it client-only to avoid ssr-mismatch -->
|
|
8
|
+
<ClientOnly>
|
|
9
|
+
<img
|
|
10
|
+
v-if="siteBrandLogo"
|
|
11
|
+
class="logo"
|
|
12
|
+
:src="withBase(siteBrandLogo)"
|
|
13
|
+
:alt="siteBrandTitle"
|
|
14
|
+
/>
|
|
15
|
+
</ClientOnly>
|
|
13
16
|
|
|
14
17
|
<span
|
|
15
18
|
v-if="siteBrandTitle"
|
|
@@ -14,7 +14,7 @@ import { isLinkHttp, isString } from '@vuepress/shared'
|
|
|
14
14
|
import { computed } from 'vue'
|
|
15
15
|
import type { ComputedRef } from 'vue'
|
|
16
16
|
import { useRouter } from 'vue-router'
|
|
17
|
-
import type {
|
|
17
|
+
import type { NavbarGroup, NavbarItem, ResolvedNavbarItem } from '../../shared'
|
|
18
18
|
import { useNavLink, useThemeLocaleData } from '../composables'
|
|
19
19
|
import { resolveRepoType } from '../utils'
|
|
20
20
|
import DropdownLink from './DropdownLink.vue'
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<div v-if="lastUpdated" class="meta-item last-updated">
|
|
8
8
|
<span class="meta-item-label">{{ themeLocale.lastUpdatedText }}: </span>
|
|
9
|
-
<
|
|
9
|
+
<ClientOnly>
|
|
10
|
+
<span class="meta-item-info">{{ lastUpdated }}</span>
|
|
11
|
+
</ClientOnly>
|
|
10
12
|
</div>
|
|
11
13
|
|
|
12
14
|
<div
|
|
@@ -35,8 +37,8 @@ import {
|
|
|
35
37
|
import { computed } from 'vue'
|
|
36
38
|
import type { ComputedRef } from 'vue'
|
|
37
39
|
import type {
|
|
38
|
-
DefaultThemePageData,
|
|
39
40
|
DefaultThemeNormalPageFrontmatter,
|
|
41
|
+
DefaultThemePageData,
|
|
40
42
|
NavLink as NavLinkType,
|
|
41
43
|
} from '../../shared'
|
|
42
44
|
import { useThemeLocaleData } from '../composables'
|
|
@@ -70,7 +72,8 @@ const useEditNavLink = (): ComputedRef<null | NavLinkType> => {
|
|
|
70
72
|
docsBranch,
|
|
71
73
|
docsDir,
|
|
72
74
|
filePathRelative: page.value.filePathRelative,
|
|
73
|
-
editLinkPattern:
|
|
75
|
+
editLinkPattern:
|
|
76
|
+
frontmatter.value.editLinkPattern ?? themeLocale.value.editLinkPattern,
|
|
74
77
|
})
|
|
75
78
|
|
|
76
79
|
if (!editLink) return null
|
|
@@ -98,7 +101,7 @@ const useLastUpdated = (): ComputedRef<null | string> => {
|
|
|
98
101
|
|
|
99
102
|
const updatedDate = new Date(page.value.git?.updatedTime)
|
|
100
103
|
|
|
101
|
-
return updatedDate.toLocaleString(
|
|
104
|
+
return updatedDate.toLocaleString()
|
|
102
105
|
})
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
<nav v-if="prevNavLink || nextNavLink" class="page-nav">
|
|
3
3
|
<p class="inner">
|
|
4
4
|
<span v-if="prevNavLink" class="prev">
|
|
5
|
-
←
|
|
6
5
|
<NavLink :item="prevNavLink" />
|
|
7
6
|
</span>
|
|
8
7
|
|
|
9
8
|
<span v-if="nextNavLink" class="next">
|
|
10
9
|
<NavLink :item="nextNavLink" />
|
|
11
|
-
→
|
|
12
10
|
</span>
|
|
13
11
|
</p>
|
|
14
12
|
</nav>
|
|
@@ -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;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<RawExternalLinkIcon>
|
|
3
3
|
<span class="sr-only">{{ themeLocale.openInNewWindow }}</span>
|
|
4
|
-
</
|
|
4
|
+
</RawExternalLinkIcon>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script setup lang="ts">
|
|
8
|
-
|
|
9
|
-
* Override the built-in `<OutboundLink>` for a11y
|
|
10
|
-
*/
|
|
11
|
-
import { OutboundLink as RawOutboundLink } from '@vuepress/client'
|
|
8
|
+
import { ExternalLinkIcon as RawExternalLinkIcon } from '@vuepress/plugin-external-link-icon/lib/client'
|
|
12
9
|
import { useThemeLocaleData } from '../../composables'
|
|
13
10
|
|
|
14
11
|
const themeLocale = useThemeLocaleData()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PageHeader } from '@vuepress/client';
|
|
2
2
|
import type { ComputedRef, InjectionKey } from 'vue';
|
|
3
|
-
import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, SidebarConfigArray, SidebarConfigObject
|
|
3
|
+
import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared';
|
|
4
4
|
export declare type SidebarItemsRef = ComputedRef<ResolvedSidebarItem[]>;
|
|
5
5
|
export declare const sidebarItemsSymbol: InjectionKey<SidebarItemsRef>;
|
|
6
6
|
/**
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavbarConfig, NavbarGroup, NavbarItem, NavGroup, NavItem, NavLink, ResolvedNavbarItem, ResolvedSidebarItem, SidebarConfig, SidebarConfigArray, SidebarConfigObject, SidebarItem } from '../shared';
|
|
2
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';
|
|
@@ -5,25 +5,29 @@
|
|
|
5
5
|
@touchstart="onTouchStart"
|
|
6
6
|
@touchend="onTouchEnd"
|
|
7
7
|
>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
<slot name="navbar">
|
|
9
|
+
<Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
|
|
10
|
+
<template #before>
|
|
11
|
+
<slot name="navbar-before" />
|
|
12
|
+
</template>
|
|
13
|
+
<template #after>
|
|
14
|
+
<slot name="navbar-after" />
|
|
15
|
+
</template>
|
|
16
|
+
</Navbar>
|
|
17
|
+
</slot>
|
|
16
18
|
|
|
17
19
|
<div class="sidebar-mask" @click="toggleSidebar(false)" />
|
|
18
20
|
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
<slot name="sidebar">
|
|
22
|
+
<Sidebar>
|
|
23
|
+
<template #top>
|
|
24
|
+
<slot name="sidebar-top" />
|
|
25
|
+
</template>
|
|
26
|
+
<template #bottom>
|
|
27
|
+
<slot name="sidebar-bottom" />
|
|
28
|
+
</template>
|
|
29
|
+
</Sidebar>
|
|
30
|
+
</slot>
|
|
27
31
|
|
|
28
32
|
<slot name="page">
|
|
29
33
|
<Home v-if="frontmatter.home" />
|
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
margin: 1.8rem auto;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
.actions {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
gap: 1rem;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
.description {
|
|
30
37
|
max-width: 35rem;
|
|
31
38
|
font-size: 1.6rem;
|
|
@@ -43,10 +50,6 @@
|
|
|
43
50
|
transition: background-color var(--t-color);
|
|
44
51
|
box-sizing: border-box;
|
|
45
52
|
|
|
46
|
-
&:not(:first-child) {
|
|
47
|
-
margin-left: 1.5rem;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
53
|
&.primary {
|
|
51
54
|
color: var(--c-bg);
|
|
52
55
|
background-color: var(--c-brand);
|
|
@@ -95,6 +95,11 @@
|
|
|
95
95
|
--docsearch-footer-background: var(--c-bg);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// plugin-external-link-icon
|
|
99
|
+
.external-link-icon {
|
|
100
|
+
--external-link-icon-color: var(--c-text-quote);
|
|
101
|
+
}
|
|
102
|
+
|
|
98
103
|
// plugin-medium-zoom
|
|
99
104
|
.medium-zoom-overlay {
|
|
100
105
|
--medium-zoom-bg-color: var(--c-bg);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isLinkHttp,
|
|
1
|
+
import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
|
|
2
2
|
import { resolveRepoType } from './resolveRepoType';
|
|
3
3
|
export const editLinkPatterns = {
|
|
4
4
|
GitHub: ':repo/edit/:branch/:path',
|
|
@@ -6,15 +6,20 @@ export const editLinkPatterns = {
|
|
|
6
6
|
Gitee: ':repo/edit/:branch/:path',
|
|
7
7
|
Bitbucket: ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
const repoType = resolveRepoType(docsRepo);
|
|
11
|
-
let pattern;
|
|
9
|
+
const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
|
|
12
10
|
if (editLinkPattern) {
|
|
13
|
-
|
|
11
|
+
return editLinkPattern;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const repoType = resolveRepoType(docsRepo);
|
|
14
|
+
if (repoType !== null) {
|
|
15
|
+
return editLinkPatterns[repoType];
|
|
17
16
|
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
export const resolveEditLink = ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }) => {
|
|
20
|
+
if (!filePathRelative)
|
|
21
|
+
return null;
|
|
22
|
+
const pattern = resolveEditLinkPatterns({ docsRepo, editLinkPattern });
|
|
18
23
|
if (!pattern)
|
|
19
24
|
return null;
|
|
20
25
|
return pattern
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -3,47 +3,62 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defaultTheme = void 0;
|
|
4
4
|
const utils_1 = require("@vuepress/utils");
|
|
5
5
|
const utils_2 = require("./utils");
|
|
6
|
-
const defaultTheme = ({ themePlugins = {}, ...localeOptions }) => {
|
|
7
|
-
|
|
6
|
+
const defaultTheme = ({ themePlugins = {}, ...localeOptions }, app) => {
|
|
7
|
+
if (app.options.bundler.endsWith('vite')) {
|
|
8
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
9
|
+
app.options.bundlerConfig.viteOptions = require('vite').mergeConfig(app.options.bundlerConfig.viteOptions, {
|
|
10
|
+
css: {
|
|
11
|
+
preprocessorOptions: {
|
|
12
|
+
scss: { charset: false },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
(0, utils_2.assignDefaultLocaleOptions)(localeOptions);
|
|
8
18
|
return {
|
|
9
19
|
name: '@vuepress/theme-default',
|
|
10
20
|
layouts: utils_1.path.resolve(__dirname, '../client/layouts'),
|
|
11
21
|
clientAppEnhanceFiles: utils_1.path.resolve(__dirname, '../client/clientAppEnhance.js'),
|
|
12
22
|
clientAppSetupFiles: utils_1.path.resolve(__dirname, '../client/clientAppSetup.js'),
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
extendsPage: (page) => {
|
|
24
|
+
// save relative file path into page data to generate edit link
|
|
25
|
+
page.data.filePathRelative = page.filePathRelative;
|
|
26
|
+
// save title into route meta to generate navbar and sidebar
|
|
27
|
+
page.routeMeta.title = page.title;
|
|
28
|
+
},
|
|
15
29
|
plugins: [
|
|
16
30
|
[
|
|
17
31
|
'@vuepress/active-header-links',
|
|
18
|
-
utils_2.resolveActiveHeaderLinksPluginOptions(themePlugins),
|
|
32
|
+
(0, utils_2.resolveActiveHeaderLinksPluginOptions)(themePlugins),
|
|
19
33
|
],
|
|
20
34
|
['@vuepress/back-to-top', themePlugins.backToTop !== false],
|
|
21
35
|
[
|
|
22
36
|
'@vuepress/container',
|
|
23
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'tip'),
|
|
37
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'tip'),
|
|
24
38
|
],
|
|
25
39
|
[
|
|
26
40
|
'@vuepress/container',
|
|
27
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'warning'),
|
|
41
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'warning'),
|
|
28
42
|
],
|
|
29
43
|
[
|
|
30
44
|
'@vuepress/container',
|
|
31
|
-
utils_2.resolveContainerPluginOptions(themePlugins, localeOptions, 'danger'),
|
|
45
|
+
(0, utils_2.resolveContainerPluginOptions)(themePlugins, localeOptions, 'danger'),
|
|
32
46
|
],
|
|
33
47
|
[
|
|
34
48
|
'@vuepress/container',
|
|
35
|
-
utils_2.resolveContainerPluginOptionsForDetails(themePlugins),
|
|
49
|
+
(0, utils_2.resolveContainerPluginOptionsForDetails)(themePlugins),
|
|
36
50
|
],
|
|
37
51
|
[
|
|
38
52
|
'@vuepress/container',
|
|
39
|
-
utils_2.resolveContainerPluginOptionsForCodeGroup(themePlugins),
|
|
53
|
+
(0, utils_2.resolveContainerPluginOptionsForCodeGroup)(themePlugins),
|
|
40
54
|
],
|
|
41
55
|
[
|
|
42
56
|
'@vuepress/container',
|
|
43
|
-
utils_2.resolveContainerPluginOptionsForCodeGroupItem(themePlugins),
|
|
57
|
+
(0, utils_2.resolveContainerPluginOptionsForCodeGroupItem)(themePlugins),
|
|
44
58
|
],
|
|
45
|
-
['@vuepress/
|
|
46
|
-
['@vuepress/
|
|
59
|
+
['@vuepress/external-link-icon', themePlugins.externalLinkIcon !== false],
|
|
60
|
+
['@vuepress/git', (0, utils_2.resolveGitPluginOptions)(themePlugins, localeOptions)],
|
|
61
|
+
['@vuepress/medium-zoom', (0, utils_2.resolveMediumZoomPluginOptions)(themePlugins)],
|
|
47
62
|
['@vuepress/nprogress', themePlugins.nprogress !== false],
|
|
48
63
|
['@vuepress/palette', { preset: 'sass' }],
|
|
49
64
|
['@vuepress/prismjs', themePlugins.prismjs !== false],
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { DefaultThemeLocaleOptions } from '../../shared';
|
|
1
|
+
import type { DefaultThemeLocaleData, DefaultThemeLocaleOptions } from '../../shared';
|
|
2
|
+
export declare const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions;
|
|
3
|
+
export declare const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData;
|
|
2
4
|
/**
|
|
3
5
|
* Assign default options to `themeConfig`
|
|
4
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assignDefaultLocaleOptions = void 0;
|
|
4
|
-
|
|
3
|
+
exports.assignDefaultLocaleOptions = exports.DEFAULT_LOCALE_DATA = exports.DEFAULT_LOCALE_OPTIONS = void 0;
|
|
4
|
+
exports.DEFAULT_LOCALE_OPTIONS = {
|
|
5
5
|
// navbar
|
|
6
6
|
navbar: [],
|
|
7
7
|
logo: null,
|
|
@@ -32,7 +32,7 @@ const defaultLocaleOptions = {
|
|
|
32
32
|
toggleDarkMode: 'toggle dark mode',
|
|
33
33
|
toggleSidebar: 'toggle sidebar',
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
exports.DEFAULT_LOCALE_DATA = {
|
|
36
36
|
// navbar
|
|
37
37
|
selectLanguageName: 'English',
|
|
38
38
|
};
|
|
@@ -47,11 +47,11 @@ const assignDefaultLocaleOptions = (localeOptions) => {
|
|
|
47
47
|
localeOptions.locales['/'] = {};
|
|
48
48
|
}
|
|
49
49
|
Object.assign(localeOptions, {
|
|
50
|
-
...
|
|
50
|
+
...exports.DEFAULT_LOCALE_OPTIONS,
|
|
51
51
|
...localeOptions,
|
|
52
52
|
});
|
|
53
53
|
Object.assign(localeOptions.locales['/'], {
|
|
54
|
-
...
|
|
54
|
+
...exports.DEFAULT_LOCALE_DATA,
|
|
55
55
|
...localeOptions.locales['/'],
|
|
56
56
|
});
|
|
57
57
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContainerPluginOptions } from '@vuepress/plugin-container';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultThemeData, DefaultThemePluginsOptions } from '../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve options for @vuepress/plugin-container
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitPluginOptions } from '@vuepress/plugin-git';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Resolve options for @vuepress/plugin-git
|
|
5
5
|
*/
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export interface DefaultThemePluginsOptions {
|
|
|
21
21
|
codeGroup?: boolean;
|
|
22
22
|
codeGroupItem?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Enable @vuepress/plugin-external-link-icon or not
|
|
26
|
+
*/
|
|
27
|
+
externalLinkIcon?: boolean;
|
|
24
28
|
/**
|
|
25
29
|
* Enable @vuepress/plugin-git or not
|
|
26
30
|
*/
|
|
@@ -219,7 +223,7 @@ export interface DefaultThemeLocaleData extends LocaleData {
|
|
|
219
223
|
*/
|
|
220
224
|
backToHome?: string;
|
|
221
225
|
/**
|
|
222
|
-
* A11y text for
|
|
226
|
+
* A11y text for external link icon
|
|
223
227
|
*/
|
|
224
228
|
openInNewWindow?: string;
|
|
225
229
|
/**
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
2
|
import type { NavLink, SidebarConfig } from './nav';
|
|
3
3
|
export interface DefaultThemePageData extends GitPluginPageData {
|
|
4
|
-
filePathRelative: string;
|
|
4
|
+
filePathRelative: string | null;
|
|
5
5
|
}
|
|
6
6
|
export interface DefaultThemePageFrontmatter {
|
|
7
7
|
home?: boolean;
|
|
@@ -11,6 +11,7 @@ export interface DefaultThemePageFrontmatter {
|
|
|
11
11
|
export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontmatter {
|
|
12
12
|
home: true;
|
|
13
13
|
heroImage?: string;
|
|
14
|
+
heroImageDark?: string;
|
|
14
15
|
heroAlt?: string;
|
|
15
16
|
heroText?: string | null;
|
|
16
17
|
tagline?: string | null;
|
|
@@ -29,6 +30,7 @@ export interface DefaultThemeHomePageFrontmatter extends DefaultThemePageFrontma
|
|
|
29
30
|
export interface DefaultThemeNormalPageFrontmatter extends DefaultThemePageFrontmatter {
|
|
30
31
|
home?: false;
|
|
31
32
|
editLink?: boolean;
|
|
33
|
+
editLinkPattern?: string;
|
|
32
34
|
lastUpdated?: boolean;
|
|
33
35
|
contributors?: boolean;
|
|
34
36
|
sidebar?: 'auto' | false | SidebarConfig;
|
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.29",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -29,27 +29,28 @@
|
|
|
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-
|
|
38
|
-
"@vuepress/plugin-
|
|
39
|
-
"@vuepress/plugin-
|
|
40
|
-
"@vuepress/plugin-
|
|
41
|
-
"@vuepress/plugin-
|
|
42
|
-
"@vuepress/plugin-
|
|
43
|
-
"@vuepress/
|
|
44
|
-
"@vuepress/
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"sass
|
|
48
|
-
"
|
|
49
|
-
"vue
|
|
32
|
+
"@vuepress/client": "2.0.0-beta.29",
|
|
33
|
+
"@vuepress/core": "2.0.0-beta.29",
|
|
34
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.29",
|
|
35
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.29",
|
|
36
|
+
"@vuepress/plugin-container": "2.0.0-beta.29",
|
|
37
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.29",
|
|
38
|
+
"@vuepress/plugin-git": "2.0.0-beta.29",
|
|
39
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.29",
|
|
40
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.29",
|
|
41
|
+
"@vuepress/plugin-palette": "2.0.0-beta.29",
|
|
42
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.29",
|
|
43
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.29",
|
|
44
|
+
"@vuepress/shared": "2.0.0-beta.28",
|
|
45
|
+
"@vuepress/utils": "2.0.0-beta.28",
|
|
46
|
+
"@vueuse/core": "^7.1.2",
|
|
47
|
+
"sass": "^1.44.0",
|
|
48
|
+
"sass-loader": "^12.4.0",
|
|
49
|
+
"vue": "^3.2.24",
|
|
50
|
+
"vue-router": "^4.0.12"
|
|
50
51
|
},
|
|
51
52
|
"publishConfig": {
|
|
52
53
|
"access": "public"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "2c6eb4270f96b6351cd1f565798bed1f662a6bb2"
|
|
55
56
|
}
|