@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.
Files changed (53) hide show
  1. package/lib/client/components/AutoLink.vue +1 -1
  2. package/lib/client/components/HomeFeatures.vue +1 -1
  3. package/lib/client/components/HomeFooter.vue +1 -1
  4. package/lib/client/components/HomeHero.vue +2 -2
  5. package/lib/client/components/Navbar.vue +1 -1
  6. package/lib/client/components/NavbarBrand.vue +1 -1
  7. package/lib/client/components/NavbarDropdown.vue +1 -1
  8. package/lib/client/components/NavbarItems.vue +7 -3
  9. package/lib/client/components/PageMeta.vue +3 -3
  10. package/lib/client/components/PageNav.vue +2 -2
  11. package/lib/client/components/SidebarItem.vue +7 -4
  12. package/lib/client/components/SidebarItems.vue +1 -1
  13. package/lib/client/components/ToggleColorModeButton.vue +1 -1
  14. package/lib/client/components/ToggleSidebarButton.vue +1 -1
  15. package/lib/client/components/global/index.d.ts +1 -1
  16. package/lib/client/components/global/index.js +1 -1
  17. package/lib/client/composables/index.d.ts +6 -6
  18. package/lib/client/composables/index.js +6 -6
  19. package/lib/client/composables/useDarkMode.js +1 -1
  20. package/lib/client/composables/useNavLink.d.ts +1 -1
  21. package/lib/client/composables/useNavLink.js +1 -1
  22. package/lib/client/composables/useSidebarItems.d.ts +1 -1
  23. package/lib/client/composables/useSidebarItems.js +2 -1
  24. package/lib/client/composables/useThemeData.d.ts +2 -2
  25. package/lib/client/composables/useThemeData.js +1 -1
  26. package/lib/client/config.js +2 -2
  27. package/lib/client/index.d.ts +3 -4
  28. package/lib/client/index.js +3 -2
  29. package/lib/client/layouts/404.vue +1 -1
  30. package/lib/client/layouts/Layout.vue +2 -2
  31. package/lib/client/utils/index.d.ts +3 -3
  32. package/lib/client/utils/index.js +3 -3
  33. package/lib/client/utils/isActiveSidebarItem.d.ts +1 -1
  34. package/lib/client/utils/resolveEditLink.d.ts +1 -1
  35. package/lib/client/utils/resolveEditLink.js +1 -1
  36. package/lib/node/defaultTheme.d.ts +1 -1
  37. package/lib/node/defaultTheme.js +36 -39
  38. package/lib/node/index.d.ts +4 -4
  39. package/lib/node/index.js +5 -21
  40. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +1 -1
  41. package/lib/node/utils/assignDefaultLocaleOptions.js +5 -9
  42. package/lib/node/utils/index.d.ts +2 -2
  43. package/lib/node/utils/index.js +2 -18
  44. package/lib/node/utils/resolveContainerPluginOptions.d.ts +1 -1
  45. package/lib/node/utils/resolveContainerPluginOptions.js +1 -5
  46. package/lib/shared/index.d.ts +3 -3
  47. package/lib/shared/index.js +3 -19
  48. package/lib/shared/nav.js +1 -2
  49. package/lib/shared/options.d.ts +1 -1
  50. package/lib/shared/options.js +1 -2
  51. package/lib/shared/page.d.ts +1 -1
  52. package/lib/shared/page.js +1 -2
  53. 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 { NavbarGroup, NavbarItem, ResolvedNavbarItem } from '../../shared'
10
- import { useNavLink, useThemeLocaleData } from '../composables'
11
- import { resolveRepoType } from '../utils'
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 [isOpen, toggleIsOpen] = useToggle(isActive.value)
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 = item.value.collapsible ? isActive.value : true
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,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useDarkMode, useThemeLocaleData } from '../composables'
2
+ import { useDarkMode, useThemeLocaleData } from '../composables/index.js'
3
3
 
4
4
  const themeLocale = useThemeLocaleData()
5
5
  const isDarkMode = useDarkMode()
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useThemeLocaleData } from '../composables'
2
+ import { useThemeLocaleData } from '../composables/index.js'
3
3
 
4
4
  defineEmits(['toggle'])
5
5
 
@@ -1,4 +1,4 @@
1
1
  import Badge from './Badge.vue';
2
- import { CodeGroup } from './CodeGroup';
2
+ import { CodeGroup } from './CodeGroup.js';
3
3
  import CodeGroupItem from './CodeGroupItem.vue';
4
4
  export { Badge, CodeGroup, CodeGroupItem };
@@ -1,4 +1,4 @@
1
1
  import Badge from './Badge.vue';
2
- import { CodeGroup } from './CodeGroup';
2
+ import { CodeGroup } from './CodeGroup.js';
3
3
  import CodeGroupItem from './CodeGroupItem.vue';
4
4
  export { Badge, CodeGroup, CodeGroupItem };
@@ -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,4 +1,4 @@
1
- import type { NavLink } from '../../shared';
1
+ import type { NavLink } from '../../shared/index.js';
2
2
  declare module 'vue-router' {
3
3
  interface RouteMeta {
4
4
  title?: string;
@@ -1,4 +1,4 @@
1
- import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect';
1
+ import { useResolveRouteWithRedirect } from './useResolveRouteWithRedirect.js';
2
2
  /**
3
3
  * Resolve NavLink props from string
4
4
  *
@@ -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, useThemeLocaleData } from '.';
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/lib/client';
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/lib/client';
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();
@@ -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 }) {
@@ -1,4 +1,3 @@
1
- import type { DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavbarConfig, NavbarGroup, NavbarItem, NavGroup, NavItem, NavLink, ResolvedNavbarItem, ResolvedSidebarItem, SidebarConfig, SidebarConfigArray, SidebarConfigObject, SidebarGroup, SidebarGroupCollapsible, SidebarItem } from '../shared';
2
- export type { DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavbarConfig, NavbarGroup, NavbarItem, NavGroup, NavItem, NavLink, ResolvedNavbarItem, ResolvedSidebarItem, SidebarConfig, SidebarConfigArray, SidebarConfigObject, SidebarGroup, SidebarGroupCollapsible, SidebarItem, };
3
- export * from './composables';
4
- export * from './utils';
1
+ export * from '../shared/index.js';
2
+ export * from './composables/index.js';
3
+ export * from './utils/index.js';
@@ -1,2 +1,3 @@
1
- export * from './composables';
2
- export * from './utils';
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,
@@ -1,33 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultTheme = void 0;
4
- const plugin_active_header_links_1 = require("@vuepress/plugin-active-header-links");
5
- const plugin_back_to_top_1 = require("@vuepress/plugin-back-to-top");
6
- const plugin_container_1 = require("@vuepress/plugin-container");
7
- const plugin_external_link_icon_1 = require("@vuepress/plugin-external-link-icon");
8
- const plugin_git_1 = require("@vuepress/plugin-git");
9
- const plugin_medium_zoom_1 = require("@vuepress/plugin-medium-zoom");
10
- const plugin_nprogress_1 = require("@vuepress/plugin-nprogress");
11
- const plugin_palette_1 = require("@vuepress/plugin-palette");
12
- const plugin_prismjs_1 = require("@vuepress/plugin-prismjs");
13
- const plugin_theme_data_1 = require("@vuepress/plugin-theme-data");
14
- const utils_1 = require("@vuepress/utils");
15
- const utils_2 = require("./utils");
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: utils_1.path.resolve(__dirname, '../client/layouts'),
21
- templateBuild: utils_1.path.resolve(__dirname, '../../templates/build.html'),
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(utils_1.fs
24
- .readdirSync(utils_1.path.resolve(__dirname, '../client/components'))
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
- utils_1.path.resolve(__dirname, '../client/components', file),
26
+ path.resolve(__dirname, '../client/components', file),
29
27
  ])),
30
- clientConfigFile: utils_1.path.resolve(__dirname, '../client/config.js'),
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
- ? (0, plugin_active_header_links_1.activeHeaderLinksPlugin)({
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 ? (0, plugin_back_to_top_1.backToTopPlugin)() : [],
46
+ themePlugins.backToTop !== false ? backToTopPlugin() : [],
49
47
  // @vuepress/plugin-container
50
48
  themePlugins.container?.tip !== false
51
- ? (0, plugin_container_1.containerPlugin)((0, utils_2.resolveContainerPluginOptions)(localeOptions, 'tip'))
49
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'tip'))
52
50
  : [],
53
51
  themePlugins.container?.warning !== false
54
- ? (0, plugin_container_1.containerPlugin)((0, utils_2.resolveContainerPluginOptions)(localeOptions, 'warning'))
52
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'warning'))
55
53
  : [],
56
54
  themePlugins.container?.danger !== false
57
- ? (0, plugin_container_1.containerPlugin)((0, utils_2.resolveContainerPluginOptions)(localeOptions, 'danger'))
55
+ ? containerPlugin(resolveContainerPluginOptions(localeOptions, 'danger'))
58
56
  : [],
59
57
  themePlugins.container?.details !== false
60
- ? (0, plugin_container_1.containerPlugin)({
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
- ? (0, plugin_container_1.containerPlugin)({
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
- ? (0, plugin_container_1.containerPlugin)({
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
- ? (0, plugin_external_link_icon_1.externalLinkIconPlugin)({
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
- ? (0, plugin_git_1.gitPlugin)({
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
- ? (0, plugin_medium_zoom_1.mediumZoomPlugin)({
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 ? (0, plugin_nprogress_1.nprogressPlugin)() : [],
107
+ themePlugins.nprogress !== false ? nprogressPlugin() : [],
110
108
  // @vuepress/plugin-palette
111
- (0, plugin_palette_1.palettePlugin)({ preset: 'sass' }),
109
+ palettePlugin({ preset: 'sass' }),
112
110
  // @vuepress/plugin-prismjs
113
- themePlugins.prismjs !== false ? (0, plugin_prismjs_1.prismjsPlugin)() : [],
111
+ themePlugins.prismjs !== false ? prismjsPlugin() : [],
114
112
  // @vuepress/plugin-theme-data
115
- (0, plugin_theme_data_1.themeDataPlugin)({ themeData: localeOptions }),
113
+ themeDataPlugin({ themeData: localeOptions }),
116
114
  ],
117
115
  };
118
116
  };
119
- exports.defaultTheme = defaultTheme;
@@ -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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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
- 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
- "use strict";
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
- exports.DEFAULT_LOCALE_DATA = {
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
- ...exports.DEFAULT_LOCALE_OPTIONS,
49
+ ...DEFAULT_LOCALE_OPTIONS,
53
50
  ...localeOptions,
54
51
  });
55
52
  Object.assign(localeOptions.locales['/'], {
56
- ...exports.DEFAULT_LOCALE_DATA,
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';
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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,5 +1,5 @@
1
1
  import type { ContainerPluginOptions } from '@vuepress/plugin-container';
2
- import type { DefaultThemeData } from '../../shared';
2
+ import type { DefaultThemeData } from '../../shared/index.js';
3
3
  /**
4
4
  * Resolve options for @vuepress/plugin-container
5
5
  *
@@ -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;
@@ -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';
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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("./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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -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
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -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
  }
@@ -1,2 +1 @@
1
- "use strict";
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.49",
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
- "main": "lib/node/index.js",
22
- "types": "lib/node/index.d.ts",
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.49",
29
- "@vuepress/core": "2.0.0-beta.49",
30
- "@vuepress/plugin-active-header-links": "2.0.0-beta.49",
31
- "@vuepress/plugin-back-to-top": "2.0.0-beta.49",
32
- "@vuepress/plugin-container": "2.0.0-beta.49",
33
- "@vuepress/plugin-external-link-icon": "2.0.0-beta.49",
34
- "@vuepress/plugin-git": "2.0.0-beta.49",
35
- "@vuepress/plugin-medium-zoom": "2.0.0-beta.49",
36
- "@vuepress/plugin-nprogress": "2.0.0-beta.49",
37
- "@vuepress/plugin-palette": "2.0.0-beta.49",
38
- "@vuepress/plugin-prismjs": "2.0.0-beta.49",
39
- "@vuepress/plugin-theme-data": "2.0.0-beta.49",
40
- "@vuepress/shared": "2.0.0-beta.49",
41
- "@vuepress/utils": "2.0.0-beta.49",
42
- "@vueuse/core": "^8.7.5",
43
- "sass": "^1.53.0",
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.2"
52
+ "vue-router": "^4.1.3"
46
53
  },
47
54
  "peerDependencies": {
48
55
  "sass-loader": "^13.0.0"