@vuepress/theme-default 2.0.0-beta.49 → 2.0.0-beta.50-pre.1
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/AutoLink.vue +1 -1
- package/lib/client/components/HomeFeatures.vue +1 -1
- package/lib/client/components/HomeFooter.vue +1 -1
- package/lib/client/components/HomeHero.vue +2 -2
- package/lib/client/components/Navbar.vue +1 -1
- package/lib/client/components/NavbarBrand.vue +1 -1
- package/lib/client/components/NavbarDropdown.vue +1 -1
- package/lib/client/components/NavbarItems.vue +7 -3
- package/lib/client/components/PageMeta.vue +3 -3
- package/lib/client/components/PageNav.vue +2 -2
- package/lib/client/components/SidebarItem.vue +7 -4
- package/lib/client/components/SidebarItems.vue +1 -1
- package/lib/client/components/ToggleColorModeButton.vue +1 -1
- package/lib/client/components/ToggleSidebarButton.vue +1 -1
- package/lib/client/components/global/index.d.ts +1 -1
- package/lib/client/components/global/index.js +1 -1
- package/lib/client/composables/index.d.ts +6 -6
- package/lib/client/composables/index.js +6 -6
- package/lib/client/composables/useDarkMode.js +1 -1
- package/lib/client/composables/useNavLink.d.ts +1 -1
- package/lib/client/composables/useNavLink.js +1 -1
- package/lib/client/composables/useSidebarItems.d.ts +1 -1
- package/lib/client/composables/useSidebarItems.js +2 -1
- package/lib/client/composables/useThemeData.d.ts +2 -2
- package/lib/client/composables/useThemeData.js +1 -1
- package/lib/client/config.js +2 -2
- package/lib/client/index.d.ts +3 -4
- package/lib/client/index.js +3 -2
- package/lib/client/layouts/404.vue +1 -1
- package/lib/client/layouts/Layout.vue +2 -2
- package/lib/client/utils/index.d.ts +3 -3
- package/lib/client/utils/index.js +3 -3
- package/lib/client/utils/isActiveSidebarItem.d.ts +1 -1
- package/lib/client/utils/resolveEditLink.d.ts +1 -1
- package/lib/client/utils/resolveEditLink.js +1 -1
- package/lib/node/defaultTheme.d.ts +1 -1
- package/lib/node/defaultTheme.js +36 -39
- package/lib/node/index.d.ts +4 -4
- package/lib/node/index.js +5 -21
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +1 -1
- package/lib/node/utils/assignDefaultLocaleOptions.js +5 -9
- package/lib/node/utils/index.d.ts +2 -2
- package/lib/node/utils/index.js +2 -18
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +1 -1
- package/lib/node/utils/resolveContainerPluginOptions.js +1 -5
- package/lib/shared/index.d.ts +3 -3
- package/lib/shared/index.js +3 -19
- package/lib/shared/nav.js +1 -2
- package/lib/shared/options.d.ts +1 -1
- package/lib/shared/options.js +1 -2
- package/lib/shared/page.d.ts +1 -1
- package/lib/shared/page.js +1 -2
- package/package.json +27 -20
|
@@ -14,7 +14,7 @@ import { isLinkHttp, isLinkMailto, isLinkTel } from '@vuepress/shared'
|
|
|
14
14
|
import { computed, toRefs } from 'vue'
|
|
15
15
|
import type { PropType } from 'vue'
|
|
16
16
|
import { useRoute } from 'vue-router'
|
|
17
|
-
import type { NavLink } from '../../shared'
|
|
17
|
+
import type { NavLink } from '../../shared/index.js'
|
|
18
18
|
|
|
19
19
|
const props = defineProps({
|
|
20
20
|
item: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { usePageFrontmatter } from '@vuepress/client'
|
|
3
3
|
import { isArray } from '@vuepress/shared'
|
|
4
4
|
import { computed } from 'vue'
|
|
5
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
5
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
6
6
|
|
|
7
7
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
8
8
|
const features = computed(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { usePageFrontmatter } from '@vuepress/client'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
4
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
5
5
|
|
|
6
6
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
7
7
|
const footer = computed(() => frontmatter.value.footer)
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
import { isArray } from '@vuepress/shared'
|
|
10
10
|
import type { FunctionalComponent } from 'vue'
|
|
11
11
|
import { computed, h } from 'vue'
|
|
12
|
-
import type { DefaultThemeHomePageFrontmatter } from '../../shared'
|
|
13
|
-
import { useDarkMode } from '../composables'
|
|
12
|
+
import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
|
|
13
|
+
import { useDarkMode } from '../composables/index.js'
|
|
14
14
|
|
|
15
15
|
const frontmatter = usePageFrontmatter<DefaultThemeHomePageFrontmatter>()
|
|
16
16
|
const siteLocale = useSiteLocaleData()
|
|
@@ -4,7 +4,7 @@ import NavbarItems from '@theme/NavbarItems.vue'
|
|
|
4
4
|
import ToggleColorModeButton from '@theme/ToggleColorModeButton.vue'
|
|
5
5
|
import ToggleSidebarButton from '@theme/ToggleSidebarButton.vue'
|
|
6
6
|
import { computed, onMounted, ref } from 'vue'
|
|
7
|
-
import { useThemeLocaleData } from '../composables'
|
|
7
|
+
import { useThemeLocaleData } from '../composables/index.js'
|
|
8
8
|
|
|
9
9
|
defineEmits(['toggle-sidebar'])
|
|
10
10
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@vuepress/client'
|
|
8
8
|
import { computed, h } from 'vue'
|
|
9
9
|
import type { FunctionalComponent } from 'vue'
|
|
10
|
-
import { useDarkMode, useThemeLocaleData } from '../composables'
|
|
10
|
+
import { useDarkMode, useThemeLocaleData } from '../composables/index.js'
|
|
11
11
|
|
|
12
12
|
const routeLocale = useRouteLocale()
|
|
13
13
|
const siteLocale = useSiteLocaleData()
|
|
@@ -4,7 +4,7 @@ import DropdownTransition from '@theme/DropdownTransition.vue'
|
|
|
4
4
|
import { computed, ref, toRefs, watch } from 'vue'
|
|
5
5
|
import type { PropType } from 'vue'
|
|
6
6
|
import { useRoute } from 'vue-router'
|
|
7
|
-
import type { NavbarItem, ResolvedNavbarItem } from '../../shared'
|
|
7
|
+
import type { NavbarItem, ResolvedNavbarItem } from '../../shared/index.js'
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
item: {
|
|
@@ -6,9 +6,13 @@ import { isLinkHttp, isString } from '@vuepress/shared'
|
|
|
6
6
|
import { computed } from 'vue'
|
|
7
7
|
import type { ComputedRef } from 'vue'
|
|
8
8
|
import { useRouter } from 'vue-router'
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import type {
|
|
10
|
+
NavbarGroup,
|
|
11
|
+
NavbarItem,
|
|
12
|
+
ResolvedNavbarItem,
|
|
13
|
+
} from '../../shared/index.js'
|
|
14
|
+
import { useNavLink, useThemeLocaleData } from '../composables/index.js'
|
|
15
|
+
import { resolveRepoType } from '../utils/index.js'
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Get navbar config of select language dropdown
|
|
@@ -7,9 +7,9 @@ import type {
|
|
|
7
7
|
DefaultThemeNormalPageFrontmatter,
|
|
8
8
|
DefaultThemePageData,
|
|
9
9
|
NavLink,
|
|
10
|
-
} from '../../shared'
|
|
11
|
-
import { useThemeLocaleData } from '../composables'
|
|
12
|
-
import { resolveEditLink } from '../utils'
|
|
10
|
+
} from '../../shared/index.js'
|
|
11
|
+
import { useThemeLocaleData } from '../composables/index.js'
|
|
12
|
+
import { resolveEditLink } from '../utils/index.js'
|
|
13
13
|
|
|
14
14
|
const useEditNavLink = (): ComputedRef<null | NavLink> => {
|
|
15
15
|
const themeLocale = useThemeLocaleData()
|
|
@@ -8,8 +8,8 @@ import type {
|
|
|
8
8
|
DefaultThemeNormalPageFrontmatter,
|
|
9
9
|
NavLink,
|
|
10
10
|
ResolvedSidebarItem,
|
|
11
|
-
} from '../../shared'
|
|
12
|
-
import { useNavLink, useSidebarItems } from '../composables'
|
|
11
|
+
} from '../../shared/index.js'
|
|
12
|
+
import { useNavLink, useSidebarItems } from '../composables/index.js'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Resolve `prev` or `next` config from frontmatter
|
|
@@ -5,8 +5,8 @@ import { useToggle } from '@vueuse/core'
|
|
|
5
5
|
import { computed, nextTick, onBeforeUnmount, toRefs } from 'vue'
|
|
6
6
|
import type { PropType } from 'vue'
|
|
7
7
|
import { useRoute, useRouter } from 'vue-router'
|
|
8
|
-
import type { ResolvedSidebarItem } from '../../shared'
|
|
9
|
-
import { isActiveSidebarItem } from '../utils'
|
|
8
|
+
import type { ResolvedSidebarItem } from '../../shared/index.js'
|
|
9
|
+
import { isActiveSidebarItem } from '../utils/index.js'
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
12
|
item: {
|
|
@@ -32,7 +32,10 @@ const itemClass = computed(() => ({
|
|
|
32
32
|
'collapsible': item.value.collapsible,
|
|
33
33
|
}))
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const isOpenDefault = computed(() =>
|
|
36
|
+
item.value.collapsible ? isActive.value : true
|
|
37
|
+
)
|
|
38
|
+
const [isOpen, toggleIsOpen] = useToggle(isOpenDefault.value)
|
|
36
39
|
const onClick = (e: Event): void => {
|
|
37
40
|
if (item.value.collapsible) {
|
|
38
41
|
e.preventDefault()
|
|
@@ -44,7 +47,7 @@ const onClick = (e: Event): void => {
|
|
|
44
47
|
// reset open status after navigation
|
|
45
48
|
const unregisterRouterHook = router.afterEach((to) => {
|
|
46
49
|
nextTick(() => {
|
|
47
|
-
isOpen.value =
|
|
50
|
+
isOpen.value = isOpenDefault.value
|
|
48
51
|
})
|
|
49
52
|
})
|
|
50
53
|
onBeforeUnmount(() => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import SidebarItem from '@theme/SidebarItem.vue'
|
|
3
3
|
import { onMounted, watch } from 'vue'
|
|
4
4
|
import { useRoute } from 'vue-router'
|
|
5
|
-
import { useSidebarItems } from '../composables'
|
|
5
|
+
import { useSidebarItems } from '../composables/index.js'
|
|
6
6
|
|
|
7
7
|
const route = useRoute()
|
|
8
8
|
const sidebarItems = useSidebarItems()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './useDarkMode';
|
|
2
|
-
export * from './useNavLink';
|
|
3
|
-
export * from './useResolveRouteWithRedirect';
|
|
4
|
-
export * from './useScrollPromise';
|
|
5
|
-
export * from './useSidebarItems';
|
|
6
|
-
export * from './useThemeData';
|
|
1
|
+
export * from './useDarkMode.js';
|
|
2
|
+
export * from './useNavLink.js';
|
|
3
|
+
export * from './useResolveRouteWithRedirect.js';
|
|
4
|
+
export * from './useScrollPromise.js';
|
|
5
|
+
export * from './useSidebarItems.js';
|
|
6
|
+
export * from './useThemeData.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './useDarkMode';
|
|
2
|
-
export * from './useNavLink';
|
|
3
|
-
export * from './useResolveRouteWithRedirect';
|
|
4
|
-
export * from './useScrollPromise';
|
|
5
|
-
export * from './useSidebarItems';
|
|
6
|
-
export * from './useThemeData';
|
|
1
|
+
export * from './useDarkMode.js';
|
|
2
|
+
export * from './useNavLink.js';
|
|
3
|
+
export * from './useResolveRouteWithRedirect.js';
|
|
4
|
+
export * from './useScrollPromise.js';
|
|
5
|
+
export * from './useSidebarItems.js';
|
|
6
|
+
export * from './useThemeData.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { usePreferredDark, useStorage } from '@vueuse/core';
|
|
2
2
|
import { computed, inject, onMounted, onUnmounted, provide, watch } from 'vue';
|
|
3
|
-
import { useThemeLocaleData } from '.';
|
|
3
|
+
import { useThemeLocaleData } from './useThemeData.js';
|
|
4
4
|
export const darkModeSymbol = Symbol(__VUEPRESS_DEV__ ? 'darkMode' : '');
|
|
5
5
|
/**
|
|
6
6
|
* Inject dark mode global computed
|
|
@@ -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, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared';
|
|
3
|
+
import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared/index.js';
|
|
4
4
|
export declare type SidebarItemsRef = ComputedRef<ResolvedSidebarItem[]>;
|
|
5
5
|
export declare const sidebarItemsSymbol: InjectionKey<SidebarItemsRef>;
|
|
6
6
|
/**
|
|
@@ -2,7 +2,8 @@ import { usePageData, usePageFrontmatter } from '@vuepress/client';
|
|
|
2
2
|
import { isArray, isPlainObject, isString, resolveLocalePath, } from '@vuepress/shared';
|
|
3
3
|
import { computed, inject, provide } from 'vue';
|
|
4
4
|
import { useRoute } from 'vue-router';
|
|
5
|
-
import { useNavLink
|
|
5
|
+
import { useNavLink } from './useNavLink.js';
|
|
6
|
+
import { useThemeLocaleData } from './useThemeData.js';
|
|
6
7
|
export const sidebarItemsSymbol = Symbol('sidebarItems');
|
|
7
8
|
/**
|
|
8
9
|
* Inject sidebar items global computed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ThemeDataRef, ThemeLocaleDataRef } from '@vuepress/plugin-theme-data/
|
|
2
|
-
import type { DefaultThemeData } from '../../shared';
|
|
1
|
+
import type { ThemeDataRef, ThemeLocaleDataRef } from '@vuepress/plugin-theme-data/client';
|
|
2
|
+
import type { DefaultThemeData } from '../../shared/index.js';
|
|
3
3
|
export declare const useThemeData: () => ThemeDataRef<DefaultThemeData>;
|
|
4
4
|
export declare const useThemeLocaleData: () => ThemeLocaleDataRef<DefaultThemeData>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { useThemeData as _useThemeData, useThemeLocaleData as _useThemeLocaleData, } from '@vuepress/plugin-theme-data/
|
|
1
|
+
import { useThemeData as _useThemeData, useThemeLocaleData as _useThemeLocaleData, } from '@vuepress/plugin-theme-data/client';
|
|
2
2
|
export const useThemeData = () => _useThemeData();
|
|
3
3
|
export const useThemeLocaleData = () => _useThemeLocaleData();
|
package/lib/client/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineClientConfig } from '@vuepress/client';
|
|
2
2
|
import { h } from 'vue';
|
|
3
|
-
import { Badge, CodeGroup, CodeGroupItem } from './components/global';
|
|
4
|
-
import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables';
|
|
3
|
+
import { Badge, CodeGroup, CodeGroupItem } from './components/global/index.js';
|
|
4
|
+
import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables/index.js';
|
|
5
5
|
import './styles/index.scss';
|
|
6
6
|
export default defineClientConfig({
|
|
7
7
|
enhance({ app, router }) {
|
package/lib/client/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './utils';
|
|
1
|
+
export * from '../shared/index.js';
|
|
2
|
+
export * from './composables/index.js';
|
|
3
|
+
export * from './utils/index.js';
|
package/lib/client/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from './
|
|
1
|
+
export * from '../shared/index.js';
|
|
2
|
+
export * from './composables/index.js';
|
|
3
|
+
export * from './utils/index.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useRouteLocale } from '@vuepress/client'
|
|
3
|
-
import { useThemeLocaleData } from '../composables'
|
|
3
|
+
import { useThemeLocaleData } from '../composables/index.js'
|
|
4
4
|
|
|
5
5
|
const routeLocale = useRouteLocale()
|
|
6
6
|
const themeLocale = useThemeLocaleData()
|
|
@@ -6,12 +6,12 @@ import Sidebar from '@theme/Sidebar.vue'
|
|
|
6
6
|
import { usePageData, usePageFrontmatter } from '@vuepress/client'
|
|
7
7
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|
8
8
|
import { useRouter } from 'vue-router'
|
|
9
|
-
import type { DefaultThemePageFrontmatter } from '../../shared'
|
|
9
|
+
import type { DefaultThemePageFrontmatter } from '../../shared/index.js'
|
|
10
10
|
import {
|
|
11
11
|
useScrollPromise,
|
|
12
12
|
useSidebarItems,
|
|
13
13
|
useThemeLocaleData,
|
|
14
|
-
} from '../composables'
|
|
14
|
+
} from '../composables/index.js'
|
|
15
15
|
|
|
16
16
|
const page = usePageData()
|
|
17
17
|
const frontmatter = usePageFrontmatter<DefaultThemePageFrontmatter>()
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './isActiveSidebarItem';
|
|
2
|
-
export * from './resolveEditLink';
|
|
3
|
-
export * from './resolveRepoType';
|
|
1
|
+
export * from './isActiveSidebarItem.js';
|
|
2
|
+
export * from './resolveEditLink.js';
|
|
3
|
+
export * from './resolveRepoType.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './isActiveSidebarItem';
|
|
2
|
-
export * from './resolveEditLink';
|
|
3
|
-
export * from './resolveRepoType';
|
|
1
|
+
export * from './isActiveSidebarItem.js';
|
|
2
|
+
export * from './resolveEditLink.js';
|
|
3
|
+
export * from './resolveRepoType.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
2
|
-
import type { ResolvedSidebarItem } from '../../shared';
|
|
2
|
+
import type { ResolvedSidebarItem } from '../../shared/index.js';
|
|
3
3
|
export declare const isActiveSidebarItem: (item: ResolvedSidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RepoType } from './resolveRepoType';
|
|
1
|
+
import type { RepoType } from './resolveRepoType.js';
|
|
2
2
|
export declare const editLinkPatterns: Record<Exclude<RepoType, null>, string>;
|
|
3
3
|
export declare const resolveEditLink: ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }: {
|
|
4
4
|
docsRepo: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from '@vuepress/shared';
|
|
2
|
-
import { resolveRepoType } from './resolveRepoType';
|
|
2
|
+
import { resolveRepoType } from './resolveRepoType.js';
|
|
3
3
|
export const editLinkPatterns = {
|
|
4
4
|
GitHub: ':repo/edit/:branch/:path',
|
|
5
5
|
GitLab: ':repo/-/edit/:branch/:path',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Theme } from '@vuepress/core';
|
|
2
|
-
import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared';
|
|
2
|
+
import type { DefaultThemeLocaleOptions, DefaultThemePluginsOptions } from '../shared/index.js';
|
|
3
3
|
export interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
|
|
4
4
|
/**
|
|
5
5
|
* To avoid confusion with the root `plugins` option,
|
package/lib/node/defaultTheme.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
17
|
-
(0, utils_2.assignDefaultLocaleOptions)(localeOptions);
|
|
1
|
+
import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links';
|
|
2
|
+
import { backToTopPlugin } from '@vuepress/plugin-back-to-top';
|
|
3
|
+
import { containerPlugin } from '@vuepress/plugin-container';
|
|
4
|
+
import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon';
|
|
5
|
+
import { gitPlugin } from '@vuepress/plugin-git';
|
|
6
|
+
import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom';
|
|
7
|
+
import { nprogressPlugin } from '@vuepress/plugin-nprogress';
|
|
8
|
+
import { palettePlugin } from '@vuepress/plugin-palette';
|
|
9
|
+
import { prismjsPlugin } from '@vuepress/plugin-prismjs';
|
|
10
|
+
import { themeDataPlugin } from '@vuepress/plugin-theme-data';
|
|
11
|
+
import { fs, getDirname, path } from '@vuepress/utils';
|
|
12
|
+
import { assignDefaultLocaleOptions, resolveContainerPluginOptions, } from './utils/index.js';
|
|
13
|
+
const __dirname = getDirname(import.meta.url);
|
|
14
|
+
export const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
15
|
+
assignDefaultLocaleOptions(localeOptions);
|
|
18
16
|
return {
|
|
19
17
|
name: '@vuepress/theme-default',
|
|
20
|
-
layouts:
|
|
21
|
-
templateBuild:
|
|
18
|
+
layouts: path.resolve(__dirname, '../client/layouts'),
|
|
19
|
+
templateBuild: path.resolve(__dirname, '../../templates/build.html'),
|
|
22
20
|
// use alias to make all components replaceable
|
|
23
|
-
alias: Object.fromEntries(
|
|
24
|
-
.readdirSync(
|
|
21
|
+
alias: Object.fromEntries(fs
|
|
22
|
+
.readdirSync(path.resolve(__dirname, '../client/components'))
|
|
25
23
|
.filter((file) => file.endsWith('.vue'))
|
|
26
24
|
.map((file) => [
|
|
27
25
|
`@theme/${file}`,
|
|
28
|
-
|
|
26
|
+
path.resolve(__dirname, '../client/components', file),
|
|
29
27
|
])),
|
|
30
|
-
clientConfigFile:
|
|
28
|
+
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
|
|
31
29
|
extendsPage: (page) => {
|
|
32
30
|
// save relative file path into page data to generate edit link
|
|
33
31
|
page.data.filePathRelative = page.filePathRelative;
|
|
@@ -37,7 +35,7 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
37
35
|
plugins: [
|
|
38
36
|
// @vuepress/plugin-active-header-link
|
|
39
37
|
themePlugins.activeHeaderLinks !== false
|
|
40
|
-
?
|
|
38
|
+
? activeHeaderLinksPlugin({
|
|
41
39
|
headerLinkSelector: 'a.sidebar-item',
|
|
42
40
|
headerAnchorSelector: '.header-anchor',
|
|
43
41
|
// should greater than page transition duration
|
|
@@ -45,33 +43,33 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
45
43
|
})
|
|
46
44
|
: [],
|
|
47
45
|
// @vuepress/plugin-back-to-top
|
|
48
|
-
themePlugins.backToTop !== false ?
|
|
46
|
+
themePlugins.backToTop !== false ? backToTopPlugin() : [],
|
|
49
47
|
// @vuepress/plugin-container
|
|
50
48
|
themePlugins.container?.tip !== false
|
|
51
|
-
?
|
|
49
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
|
|
52
50
|
: [],
|
|
53
51
|
themePlugins.container?.warning !== false
|
|
54
|
-
?
|
|
52
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
|
|
55
53
|
: [],
|
|
56
54
|
themePlugins.container?.danger !== false
|
|
57
|
-
?
|
|
55
|
+
? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
|
|
58
56
|
: [],
|
|
59
57
|
themePlugins.container?.details !== false
|
|
60
|
-
?
|
|
58
|
+
? containerPlugin({
|
|
61
59
|
type: 'details',
|
|
62
60
|
before: (info) => `<details class="custom-container details">${info ? `<summary>${info}</summary>` : ''}\n`,
|
|
63
61
|
after: () => '</details>\n',
|
|
64
62
|
})
|
|
65
63
|
: [],
|
|
66
64
|
themePlugins.container?.codeGroup !== false
|
|
67
|
-
?
|
|
65
|
+
? containerPlugin({
|
|
68
66
|
type: 'code-group',
|
|
69
67
|
before: () => `<CodeGroup>\n`,
|
|
70
68
|
after: () => '</CodeGroup>\n',
|
|
71
69
|
})
|
|
72
70
|
: [],
|
|
73
71
|
themePlugins.container?.codeGroupItem !== false
|
|
74
|
-
?
|
|
72
|
+
? containerPlugin({
|
|
75
73
|
type: 'code-group-item',
|
|
76
74
|
before: (info) => `<CodeGroupItem title="${info}">\n`,
|
|
77
75
|
after: () => '</CodeGroupItem>\n',
|
|
@@ -79,7 +77,7 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
79
77
|
: [],
|
|
80
78
|
// @vuepress/plugin-external-link-icon
|
|
81
79
|
themePlugins.externalLinkIcon !== false
|
|
82
|
-
?
|
|
80
|
+
? externalLinkIconPlugin({
|
|
83
81
|
locales: Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
84
82
|
result[key] = {
|
|
85
83
|
openInNewWindow: value.openInNewWindow ?? localeOptions.openInNewWindow,
|
|
@@ -90,7 +88,7 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
90
88
|
: [],
|
|
91
89
|
// @vuepress/plugin-git
|
|
92
90
|
themePlugins.git !== false
|
|
93
|
-
?
|
|
91
|
+
? gitPlugin({
|
|
94
92
|
createdTime: false,
|
|
95
93
|
updatedTime: localeOptions.lastUpdated !== false,
|
|
96
94
|
contributors: localeOptions.contributors !== false,
|
|
@@ -98,7 +96,7 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
98
96
|
: [],
|
|
99
97
|
// @vuepress/plugin-medium-zoom
|
|
100
98
|
themePlugins.mediumZoom !== false
|
|
101
|
-
?
|
|
99
|
+
? mediumZoomPlugin({
|
|
102
100
|
selector: '.theme-default-content > img, .theme-default-content :not(a) > img',
|
|
103
101
|
zoomOptions: {},
|
|
104
102
|
// should greater than page transition duration
|
|
@@ -106,14 +104,13 @@ const defaultTheme = ({ themePlugins = {}, ...localeOptions } = {}) => {
|
|
|
106
104
|
})
|
|
107
105
|
: [],
|
|
108
106
|
// @vuepress/plugin-nprogress
|
|
109
|
-
themePlugins.nprogress !== false ?
|
|
107
|
+
themePlugins.nprogress !== false ? nprogressPlugin() : [],
|
|
110
108
|
// @vuepress/plugin-palette
|
|
111
|
-
|
|
109
|
+
palettePlugin({ preset: 'sass' }),
|
|
112
110
|
// @vuepress/plugin-prismjs
|
|
113
|
-
themePlugins.prismjs !== false ?
|
|
111
|
+
themePlugins.prismjs !== false ? prismjsPlugin() : [],
|
|
114
112
|
// @vuepress/plugin-theme-data
|
|
115
|
-
|
|
113
|
+
themeDataPlugin({ themeData: localeOptions }),
|
|
116
114
|
],
|
|
117
115
|
};
|
|
118
116
|
};
|
|
119
|
-
exports.defaultTheme = defaultTheme;
|
package/lib/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultTheme } from './defaultTheme';
|
|
2
|
-
export * from '../shared';
|
|
3
|
-
export * from './defaultTheme';
|
|
4
|
-
export * from './utils';
|
|
1
|
+
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
+
export * from '../shared/index.js';
|
|
3
|
+
export * from './defaultTheme.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
5
|
export default defaultTheme;
|
package/lib/node/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const defaultTheme_1 = require("./defaultTheme");
|
|
18
|
-
__exportStar(require("../shared"), exports);
|
|
19
|
-
__exportStar(require("./defaultTheme"), exports);
|
|
20
|
-
__exportStar(require("./utils"), exports);
|
|
21
|
-
exports.default = defaultTheme_1.defaultTheme;
|
|
1
|
+
import { defaultTheme } from './defaultTheme.js';
|
|
2
|
+
export * from '../shared/index.js';
|
|
3
|
+
export * from './defaultTheme.js';
|
|
4
|
+
export * from './utils/index.js';
|
|
5
|
+
export default defaultTheme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultThemeLocaleData, DefaultThemeLocaleOptions } from '../../shared';
|
|
1
|
+
import type { DefaultThemeLocaleData, DefaultThemeLocaleOptions } from '../../shared/index.js';
|
|
2
2
|
export declare const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions;
|
|
3
3
|
export declare const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData;
|
|
4
4
|
/**
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assignDefaultLocaleOptions = exports.DEFAULT_LOCALE_DATA = exports.DEFAULT_LOCALE_OPTIONS = void 0;
|
|
4
|
-
exports.DEFAULT_LOCALE_OPTIONS = {
|
|
1
|
+
export const DEFAULT_LOCALE_OPTIONS = {
|
|
5
2
|
// color mode
|
|
6
3
|
colorMode: 'auto',
|
|
7
4
|
colorModeSwitch: true,
|
|
@@ -34,14 +31,14 @@ exports.DEFAULT_LOCALE_OPTIONS = {
|
|
|
34
31
|
toggleColorMode: 'toggle color mode',
|
|
35
32
|
toggleSidebar: 'toggle sidebar',
|
|
36
33
|
};
|
|
37
|
-
|
|
34
|
+
export const DEFAULT_LOCALE_DATA = {
|
|
38
35
|
// navbar
|
|
39
36
|
selectLanguageName: 'English',
|
|
40
37
|
};
|
|
41
38
|
/**
|
|
42
39
|
* Assign default options
|
|
43
40
|
*/
|
|
44
|
-
const assignDefaultLocaleOptions = (localeOptions) => {
|
|
41
|
+
export const assignDefaultLocaleOptions = (localeOptions) => {
|
|
45
42
|
if (!localeOptions.locales) {
|
|
46
43
|
localeOptions.locales = {};
|
|
47
44
|
}
|
|
@@ -49,12 +46,11 @@ const assignDefaultLocaleOptions = (localeOptions) => {
|
|
|
49
46
|
localeOptions.locales['/'] = {};
|
|
50
47
|
}
|
|
51
48
|
Object.assign(localeOptions, {
|
|
52
|
-
...
|
|
49
|
+
...DEFAULT_LOCALE_OPTIONS,
|
|
53
50
|
...localeOptions,
|
|
54
51
|
});
|
|
55
52
|
Object.assign(localeOptions.locales['/'], {
|
|
56
|
-
...
|
|
53
|
+
...DEFAULT_LOCALE_DATA,
|
|
57
54
|
...localeOptions.locales['/'],
|
|
58
55
|
});
|
|
59
56
|
};
|
|
60
|
-
exports.assignDefaultLocaleOptions = assignDefaultLocaleOptions;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './assignDefaultLocaleOptions';
|
|
2
|
-
export * from './resolveContainerPluginOptions';
|
|
1
|
+
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
+
export * from './resolveContainerPluginOptions.js';
|
package/lib/node/utils/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./assignDefaultLocaleOptions"), exports);
|
|
18
|
-
__exportStar(require("./resolveContainerPluginOptions"), exports);
|
|
1
|
+
export * from './assignDefaultLocaleOptions.js';
|
|
2
|
+
export * from './resolveContainerPluginOptions.js';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveContainerPluginOptions = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Resolve options for @vuepress/plugin-container
|
|
6
3
|
*
|
|
7
4
|
* For custom containers default title
|
|
8
5
|
*/
|
|
9
|
-
const resolveContainerPluginOptions = (localeOptions, type) => {
|
|
6
|
+
export const resolveContainerPluginOptions = (localeOptions, type) => {
|
|
10
7
|
const locales = Object.entries(localeOptions.locales || {}).reduce((result, [key, value]) => {
|
|
11
8
|
result[key] = {
|
|
12
9
|
defaultInfo: value?.[type] ?? localeOptions[type],
|
|
@@ -18,4 +15,3 @@ const resolveContainerPluginOptions = (localeOptions, type) => {
|
|
|
18
15
|
locales,
|
|
19
16
|
};
|
|
20
17
|
};
|
|
21
|
-
exports.resolveContainerPluginOptions = resolveContainerPluginOptions;
|
package/lib/shared/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './nav';
|
|
2
|
-
export * from './options';
|
|
3
|
-
export * from './page';
|
|
1
|
+
export * from './nav.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './page.js';
|
package/lib/shared/index.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./nav"), exports);
|
|
18
|
-
__exportStar(require("./options"), exports);
|
|
19
|
-
__exportStar(require("./page"), exports);
|
|
1
|
+
export * from './nav.js';
|
|
2
|
+
export * from './options.js';
|
|
3
|
+
export * from './page.js';
|
package/lib/shared/nav.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/shared/options.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ThemeData } from '@vuepress/plugin-theme-data';
|
|
2
2
|
import type { LocaleData } from '@vuepress/shared';
|
|
3
|
-
import type { NavbarConfig, SidebarConfig } from './nav';
|
|
3
|
+
import type { NavbarConfig, SidebarConfig } from './nav.js';
|
|
4
4
|
export interface DefaultThemePluginsOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Enable @vuepress/plugin-active-header-links or not
|
package/lib/shared/options.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/lib/shared/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GitPluginPageData } from '@vuepress/plugin-git';
|
|
2
|
-
import type { NavLink, SidebarConfig } from './nav';
|
|
2
|
+
import type { NavLink, SidebarConfig } from './nav.js';
|
|
3
3
|
export interface DefaultThemePageData extends GitPluginPageData {
|
|
4
4
|
filePathRelative: string | null;
|
|
5
5
|
}
|
package/lib/shared/page.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
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.50-pre.1",
|
|
4
4
|
"description": "Default theme of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress-theme",
|
|
@@ -18,31 +18,38 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"author": "meteorlxy",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./lib/node/index.js",
|
|
24
|
+
"./client": "./lib/client/index.js",
|
|
25
|
+
"./templates/*": "./templates/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"main": "./lib/node/index.js",
|
|
29
|
+
"types": "./lib/node/index.d.ts",
|
|
23
30
|
"files": [
|
|
24
31
|
"lib",
|
|
25
32
|
"templates"
|
|
26
33
|
],
|
|
27
34
|
"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": "^
|
|
43
|
-
"sass": "^1.
|
|
35
|
+
"@vuepress/client": "2.0.0-beta.50-pre.1",
|
|
36
|
+
"@vuepress/core": "2.0.0-beta.50-pre.1",
|
|
37
|
+
"@vuepress/plugin-active-header-links": "2.0.0-beta.50-pre.1",
|
|
38
|
+
"@vuepress/plugin-back-to-top": "2.0.0-beta.50-pre.1",
|
|
39
|
+
"@vuepress/plugin-container": "2.0.0-beta.50-pre.1",
|
|
40
|
+
"@vuepress/plugin-external-link-icon": "2.0.0-beta.50-pre.1",
|
|
41
|
+
"@vuepress/plugin-git": "2.0.0-beta.50-pre.1",
|
|
42
|
+
"@vuepress/plugin-medium-zoom": "2.0.0-beta.50-pre.1",
|
|
43
|
+
"@vuepress/plugin-nprogress": "2.0.0-beta.50-pre.1",
|
|
44
|
+
"@vuepress/plugin-palette": "2.0.0-beta.50-pre.1",
|
|
45
|
+
"@vuepress/plugin-prismjs": "2.0.0-beta.50-pre.1",
|
|
46
|
+
"@vuepress/plugin-theme-data": "2.0.0-beta.50-pre.1",
|
|
47
|
+
"@vuepress/shared": "2.0.0-beta.50-pre.1",
|
|
48
|
+
"@vuepress/utils": "2.0.0-beta.50-pre.1",
|
|
49
|
+
"@vueuse/core": "^9.1.0",
|
|
50
|
+
"sass": "^1.54.4",
|
|
44
51
|
"vue": "^3.2.37",
|
|
45
|
-
"vue-router": "^4.1.
|
|
52
|
+
"vue-router": "^4.1.3"
|
|
46
53
|
},
|
|
47
54
|
"peerDependencies": {
|
|
48
55
|
"sass-loader": "^13.0.0"
|