@vuepress/theme-default 2.0.0-rc.122 → 2.0.0-rc.124

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 (105) hide show
  1. package/lib/client/components/VPHomeHero.vue +9 -14
  2. package/lib/client/components/VPNavbar.vue +8 -11
  3. package/lib/client/components/VPNavbarBrand.vue +4 -5
  4. package/lib/client/components/VPNavbarDropdown.vue +4 -2
  5. package/lib/client/components/VPNavbarItems.vue +3 -3
  6. package/lib/client/components/VPPageNav.vue +3 -5
  7. package/lib/client/components/VPSidebarItem.vue +3 -3
  8. package/lib/client/composables/index.d.ts +12 -11
  9. package/lib/client/composables/index.js +1 -11
  10. package/lib/client/composables/useDarkMode.d.ts +13 -4
  11. package/lib/client/composables/useDarkMode.js +2 -60
  12. package/lib/client/composables/useDarkMode.js.map +1 -0
  13. package/lib/client/composables/useData.d.ts +12 -7
  14. package/lib/client/composables/useData.js +2 -7
  15. package/lib/client/composables/useData.js.map +1 -0
  16. package/lib/client/composables/useEditLink.d.ts +8 -3
  17. package/lib/client/composables/useEditLink.js +2 -28
  18. package/lib/client/composables/useEditLink.js.map +1 -0
  19. package/lib/client/composables/useHeaders.d.ts +15 -6
  20. package/lib/client/composables/useHeaders.js +2 -38
  21. package/lib/client/composables/useHeaders.js.map +1 -0
  22. package/lib/client/composables/useNavbarConfig.d.ts +8 -3
  23. package/lib/client/composables/useNavbarConfig.js +2 -29
  24. package/lib/client/composables/useNavbarConfig.js.map +1 -0
  25. package/lib/client/composables/useNavbarRepo.d.ts +11 -4
  26. package/lib/client/composables/useNavbarRepo.js +2 -38
  27. package/lib/client/composables/useNavbarRepo.js.map +1 -0
  28. package/lib/client/composables/useNavbarSelectLanguage.d.ts +10 -3
  29. package/lib/client/composables/useNavbarSelectLanguage.js +2 -59
  30. package/lib/client/composables/useNavbarSelectLanguage.js.map +1 -0
  31. package/lib/client/composables/useNavigate.d.ts +5 -1
  32. package/lib/client/composables/useNavigate.js +2 -22
  33. package/lib/client/composables/useNavigate.js.map +1 -0
  34. package/lib/client/composables/useRelatedLinks.d.ts +10 -6
  35. package/lib/client/composables/useRelatedLinks.js +2 -90
  36. package/lib/client/composables/useRelatedLinks.js.map +1 -0
  37. package/lib/client/composables/useScrollPromise.d.ts +9 -5
  38. package/lib/client/composables/useScrollPromise.js +2 -16
  39. package/lib/client/composables/useScrollPromise.js.map +1 -0
  40. package/lib/client/composables/useSidebarItems.d.ts +57 -14
  41. package/lib/client/composables/useSidebarItems.js +2 -127
  42. package/lib/client/composables/useSidebarItems.js.map +1 -0
  43. package/lib/client/composables/useUpdateDeviceStatus.d.ts +10 -3
  44. package/lib/client/composables/useUpdateDeviceStatus.js +2 -30
  45. package/lib/client/composables/useUpdateDeviceStatus.js.map +1 -0
  46. package/lib/client/config.d.ts +10 -5
  47. package/lib/client/config.js +2 -33
  48. package/lib/client/config.js.map +1 -0
  49. package/lib/client/index.d.ts +21 -4
  50. package/lib/client/index.js +1 -2
  51. package/lib/client/layouts/Layout.vue +9 -12
  52. package/lib/client/layouts/NotFound.vue +1 -2
  53. package/lib/client/styles/arrow.scss +1 -2
  54. package/lib/client/styles/vars.scss +1 -2
  55. package/lib/client/utils/index.d.ts +6 -5
  56. package/lib/client/utils/index.js +1 -5
  57. package/lib/client/utils/isActiveSidebarItem.d.ts +8 -3
  58. package/lib/client/utils/isActiveSidebarItem.js +2 -20
  59. package/lib/client/utils/isActiveSidebarItem.js.map +1 -0
  60. package/lib/client/utils/resolveAutoLink.d.ts +13 -2
  61. package/lib/client/utils/resolveAutoLink.js +2 -17
  62. package/lib/client/utils/resolveAutoLink.js.map +1 -0
  63. package/lib/client/utils/resolveEditLink.d.ts +19 -8
  64. package/lib/client/utils/resolveEditLink.js +2 -29
  65. package/lib/client/utils/resolveEditLink.js.map +1 -0
  66. package/lib/client/utils/resolvePrefix.d.ts +5 -1
  67. package/lib/client/utils/resolvePrefix.js +2 -4
  68. package/lib/client/utils/resolvePrefix.js.map +1 -0
  69. package/lib/client/utils/resolveRepoType.d.ts +6 -2
  70. package/lib/client/utils/resolveRepoType.js +2 -12
  71. package/lib/client/utils/resolveRepoType.js.map +1 -0
  72. package/lib/nav-DikslSJ_.d.ts +36 -0
  73. package/lib/node/index.d.ts +106 -4
  74. package/lib/node/index.js +2 -2
  75. package/lib/node/index.js.map +1 -0
  76. package/lib/page-F2gyvsdE.d.ts +292 -0
  77. package/lib/sidebar-FqrQ3PGy.d.ts +53 -0
  78. package/lib/typings-jKn48KwS.d.ts +19 -0
  79. package/package.json +47 -38
  80. package/lib/client/components/global/index.d.ts +0 -2
  81. package/lib/client/components/global/index.js +0 -2
  82. package/lib/client/typings.d.ts +0 -13
  83. package/lib/client/typings.js +0 -1
  84. package/lib/node/defaultTheme.d.ts +0 -15
  85. package/lib/node/defaultTheme.js +0 -140
  86. package/lib/node/typings.d.ts +0 -59
  87. package/lib/node/typings.js +0 -1
  88. package/lib/node/utils/assignDefaultLocaleOptions.d.ts +0 -7
  89. package/lib/node/utils/assignDefaultLocaleOptions.js +0 -51
  90. package/lib/node/utils/index.d.ts +0 -2
  91. package/lib/node/utils/index.js +0 -2
  92. package/lib/node/utils/resolveMarkdownHintLocales.d.ts +0 -9
  93. package/lib/node/utils/resolveMarkdownHintLocales.js +0 -19
  94. package/lib/shared/index.d.ts +0 -5
  95. package/lib/shared/index.js +0 -1
  96. package/lib/shared/nav.d.ts +0 -32
  97. package/lib/shared/nav.js +0 -1
  98. package/lib/shared/navbar.d.ts +0 -21
  99. package/lib/shared/navbar.js +0 -1
  100. package/lib/shared/options.d.ts +0 -244
  101. package/lib/shared/options.js +0 -1
  102. package/lib/shared/page.d.ts +0 -44
  103. package/lib/shared/page.js +0 -1
  104. package/lib/shared/sidebar.d.ts +0 -26
  105. package/lib/shared/sidebar.js +0 -1
@@ -1,33 +1,2 @@
1
- import { setupDarkMode } from '@theme/useDarkMode';
2
- import { setupHeaders } from '@theme/useHeaders';
3
- import { useScrollPromise } from '@theme/useScrollPromise';
4
- import { setupSidebarItems } from '@theme/useSidebarItems';
5
- import { hasGlobalComponent } from '@vuepress/helper/client';
6
- import { defineClientConfig } from 'vuepress/client';
7
- import { Badge } from './components/global/index.js';
8
- import Layout from './layouts/Layout.vue';
9
- import NotFound from './layouts/NotFound.vue';
10
- import '@vuepress/helper/colors.css';
11
- import '@vuepress/helper/normalize.css';
12
- import './styles/index.scss';
13
- export default defineClientConfig({
14
- enhance({ app, router }) {
15
- if (!hasGlobalComponent('Badge'))
16
- app.component('Badge', Badge);
17
- // handle scrollBehavior with transition
18
- const scrollBehavior = router.options.scrollBehavior;
19
- router.options.scrollBehavior = async (...args) => {
20
- await useScrollPromise().wait();
21
- return scrollBehavior(...args);
22
- };
23
- },
24
- setup() {
25
- setupDarkMode();
26
- setupHeaders();
27
- setupSidebarItems();
28
- },
29
- layouts: {
30
- Layout,
31
- NotFound,
32
- },
33
- });
1
+ import{setupDarkMode as e}from"@theme/useDarkMode";import{setupHeaders as t}from"@theme/useHeaders";import{useScrollPromise as n}from"@theme/useScrollPromise";import{setupSidebarItems as r}from"@theme/useSidebarItems";import{hasGlobalComponent as i}from"@vuepress/helper/client";import{defineClientConfig as a}from"vuepress/client";import o from"./components/global/Badge.vue";import s from"./layouts/Layout.vue";import c from"./layouts/NotFound.vue";import"@vuepress/helper/colors.css";import"@vuepress/helper/normalize.css";import"./styles/index.scss";var l=a({enhance({app:e,router:t}){i(`Badge`)||e.component(`Badge`,o);let r=t.options.scrollBehavior;t.options.scrollBehavior=async(...e)=>(await n().wait(),r(...e))},setup(){e(),t(),r()},layouts:{Layout:s,NotFound:c}});export{l as default};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","names":[],"sources":["../../src/client/config.ts"],"sourcesContent":["import { setupDarkMode } from '@theme/useDarkMode'\nimport { setupHeaders } from '@theme/useHeaders'\nimport { useScrollPromise } from '@theme/useScrollPromise'\nimport { setupSidebarItems } from '@theme/useSidebarItems'\nimport { hasGlobalComponent } from '@vuepress/helper/client'\nimport { defineClientConfig } from 'vuepress/client'\nimport { Badge } from './components/global/index.js'\nimport Layout from './layouts/Layout.vue'\nimport NotFound from './layouts/NotFound.vue'\n\nimport '@vuepress/helper/colors.css'\nimport '@vuepress/helper/normalize.css'\nimport './styles/index.scss'\n\nexport default defineClientConfig({\n enhance({ app, router }) {\n if (!hasGlobalComponent('Badge')) app.component('Badge', Badge)\n\n // handle scrollBehavior with transition\n const scrollBehavior = router.options.scrollBehavior!\n\n // scrollBehavior is a bit hard to typed here\n // oxlint-disable-next-line typescript/explicit-function-return-type\n router.options.scrollBehavior = async (...args) => {\n await useScrollPromise().wait()\n return scrollBehavior(...args)\n }\n },\n\n setup() {\n setupDarkMode()\n setupHeaders()\n setupSidebarItems()\n },\n\n layouts: {\n Layout,\n NotFound,\n },\n})\n"],"mappings":"0iBAcA,IAAA,EAAe,EAAmB,CAChC,QAAQ,CAAE,MAAK,UAAU,CAClB,EAAmB,QAAQ,EAAE,EAAI,UAAU,QAAS,EAAM,CAG/D,IAAM,EAAiB,EAAO,QAAQ,eAItC,EAAO,QAAQ,eAAiB,MAAO,GAAG,KACxC,MAAM,GAAkB,CAAC,MAAM,CACxB,EAAe,GAAG,EAAK,GAIlC,OAAQ,CACN,GAAe,CACf,GAAc,CACd,GAAmB,EAGrB,QAAS,CACP,SACA,WACD,CACF,CAAC"}
@@ -1,4 +1,21 @@
1
- export * from './composables/index.js';
2
- export type * from './typings.js';
3
- export * from './utils/index.js';
4
- export type * from '../shared/index.js';
1
+ import { DarkModeRef, setupDarkMode, useDarkMode } from "./composables/useDarkMode.js";
2
+ import { n as NavItemOptions, t as AutoLinkOptions } from "../nav-DikslSJ_.js";
3
+ import { a as SidebarObjectOptions, c as NavbarGroupOptions, i as SidebarLinkOptions, l as NavbarLinkOptions, n as SidebarGroupOptions, o as SidebarOptions, r as SidebarItemOptions, s as NavGroup, t as SidebarArrayOptions, u as NavbarOptions } from "../sidebar-FqrQ3PGy.js";
4
+ import { a as DefaultThemeData, i as DefaultThemePageFrontmatter, n as DefaultThemeNormalPageFrontmatter, o as DefaultThemeLocaleData, r as DefaultThemePageData, s as DefaultThemeLocaleOptions, t as DefaultThemeHomePageFrontmatter } from "../page-F2gyvsdE.js";
5
+ import { Data, useData } from "./composables/useData.js";
6
+ import { useEditLink } from "./composables/useEditLink.js";
7
+ import { useNavigate } from "./composables/useNavigate.js";
8
+ import { a as SidebarLinkItem, i as SidebarItem, n as SidebarGroupItem, r as SidebarHeaderItem, t as NavbarItem } from "../typings-jKn48KwS.js";
9
+ import { useNavbarConfig } from "./composables/useNavbarConfig.js";
10
+ import { useNavbarRepo } from "./composables/useNavbarRepo.js";
11
+ import { useNavbarSelectLanguage } from "./composables/useNavbarSelectLanguage.js";
12
+ import { useRelatedLinks } from "./composables/useRelatedLinks.js";
13
+ import { ScrollPromise, useScrollPromise } from "./composables/useScrollPromise.js";
14
+ import { SidebarItemsRef, resolveArraySidebarItems, resolveMultiSidebarItems, resolveSidebarHeadingItem, resolveSidebarItems, resolveSidebarPageHeader, resolveSidebarPageHeaders, setupSidebarItems, sidebarItemsSymbol, useSidebarItems } from "./composables/useSidebarItems.js";
15
+ import { DeviceType, useUpdateDeviceStatus } from "./composables/useUpdateDeviceStatus.js";
16
+ import { isActiveSidebarItem } from "./utils/isActiveSidebarItem.js";
17
+ import { resolveAutoLink } from "./utils/resolveAutoLink.js";
18
+ import { EDIT_LINK_PATTERNS, resolveEditLink } from "./utils/resolveEditLink.js";
19
+ import { resolvePrefix } from "./utils/resolvePrefix.js";
20
+ import { RepoType, resolveRepoType } from "./utils/resolveRepoType.js";
21
+ export { AutoLinkOptions, DarkModeRef, Data, DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemePageData, DefaultThemePageFrontmatter, DeviceType, EDIT_LINK_PATTERNS, NavGroup, NavItemOptions, NavbarGroupOptions, NavbarItem, NavbarLinkOptions, NavbarOptions, RepoType, ScrollPromise, SidebarArrayOptions, SidebarGroupItem, SidebarGroupOptions, SidebarHeaderItem, SidebarItem, SidebarItemOptions, SidebarItemsRef, SidebarLinkItem, SidebarLinkOptions, SidebarObjectOptions, SidebarOptions, isActiveSidebarItem, resolveArraySidebarItems, resolveAutoLink, resolveEditLink, resolveMultiSidebarItems, resolvePrefix, resolveRepoType, resolveSidebarHeadingItem, resolveSidebarItems, resolveSidebarPageHeader, resolveSidebarPageHeaders, setupDarkMode, setupSidebarItems, sidebarItemsSymbol, useDarkMode, useData, useEditLink, useNavbarConfig, useNavbarRepo, useNavbarSelectLanguage, useNavigate, useRelatedLinks, useScrollPromise, useSidebarItems, useUpdateDeviceStatus };
@@ -1,2 +1 @@
1
- export * from './composables/index.js';
2
- export * from './utils/index.js';
1
+ import{setupDarkMode as e,useDarkMode as t}from"./composables/useDarkMode.js";import{useData as n}from"./composables/useData.js";import{useEditLink as r}from"./composables/useEditLink.js";import{useNavigate as i}from"./composables/useNavigate.js";import{useNavbarConfig as a}from"./composables/useNavbarConfig.js";import{useNavbarRepo as o}from"./composables/useNavbarRepo.js";import{useNavbarSelectLanguage as s}from"./composables/useNavbarSelectLanguage.js";import{useRelatedLinks as c}from"./composables/useRelatedLinks.js";import{useScrollPromise as l}from"./composables/useScrollPromise.js";import{resolveArraySidebarItems as u,resolveMultiSidebarItems as d,resolveSidebarHeadingItem as f,resolveSidebarItems as p,resolveSidebarPageHeader as m,resolveSidebarPageHeaders as h,setupSidebarItems as g,sidebarItemsSymbol as _,useSidebarItems as v}from"./composables/useSidebarItems.js";import{DeviceType as y,useUpdateDeviceStatus as b}from"./composables/useUpdateDeviceStatus.js";import{isActiveSidebarItem as x}from"./utils/isActiveSidebarItem.js";import{resolveAutoLink as S}from"./utils/resolveAutoLink.js";import{EDIT_LINK_PATTERNS as C,resolveEditLink as w}from"./utils/resolveEditLink.js";import{resolvePrefix as T}from"./utils/resolvePrefix.js";import{resolveRepoType as E}from"./utils/resolveRepoType.js";export{y as DeviceType,C as EDIT_LINK_PATTERNS,x as isActiveSidebarItem,u as resolveArraySidebarItems,S as resolveAutoLink,w as resolveEditLink,d as resolveMultiSidebarItems,T as resolvePrefix,E as resolveRepoType,f as resolveSidebarHeadingItem,p as resolveSidebarItems,m as resolveSidebarPageHeader,h as resolveSidebarPageHeaders,e as setupDarkMode,g as setupSidebarItems,_ as sidebarItemsSymbol,t as useDarkMode,n as useData,r as useEditLink,a as useNavbarConfig,o as useNavbarRepo,s as useNavbarSelectLanguage,i as useNavigate,c as useRelatedLinks,l as useScrollPromise,v as useSidebarItems,b as useUpdateDeviceStatus};
@@ -39,19 +39,16 @@ const toggleSidebar = (to?: boolean): void => {
39
39
  isSidebarOpen.value = typeof to === 'boolean' ? to : !isSidebarOpen.value
40
40
  }
41
41
  const touchStart = { x: 0, y: 0 }
42
- const onTouchStart = (e: TouchEvent): void => {
43
- touchStart.x = e.changedTouches[0].clientX
44
- touchStart.y = e.changedTouches[0].clientY
42
+ const onTouchStart = ({ changedTouches }: TouchEvent): void => {
43
+ touchStart.x = changedTouches[0].clientX
44
+ touchStart.y = changedTouches[0].clientY
45
45
  }
46
- const onTouchEnd = (e: TouchEvent): void => {
47
- const dx = e.changedTouches[0].clientX - touchStart.x
48
- const dy = e.changedTouches[0].clientY - touchStart.y
46
+ const onTouchEnd = ({ changedTouches }: TouchEvent): void => {
47
+ const dx = changedTouches[0].clientX - touchStart.x
48
+ const dy = changedTouches[0].clientY - touchStart.y
49
49
  if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 40) {
50
- if (dx > 0 && touchStart.x <= 80) {
51
- toggleSidebar(true)
52
- } else {
53
- toggleSidebar(false)
54
- }
50
+ if (dx > 0 && touchStart.x <= 80) toggleSidebar(true)
51
+ else toggleSidebar(false)
55
52
  }
56
53
  }
57
54
 
@@ -67,7 +64,7 @@ const enableExternalLinkIcon = computed(
67
64
  const containerClass = computed(() => [
68
65
  {
69
66
  'no-navbar': !shouldShowNavbar.value,
70
- 'no-sidebar': !sidebarItems.value.length,
67
+ 'no-sidebar': sidebarItems.value.length === 0,
71
68
  'sidebar-open': isSidebarOpen.value,
72
69
  'external-link-icon': enableExternalLinkIcon.value,
73
70
  },
@@ -39,9 +39,8 @@ const messages = computed(
39
39
  )
40
40
 
41
41
  const notFoundMsg = computed(() => {
42
- if (isMounted.value) {
42
+ if (isMounted.value)
43
43
  return messages.value[Math.floor(Math.random() * messages.value.length)]
44
- }
45
44
 
46
45
  return messages.value[0]
47
46
  })
@@ -1,5 +1,4 @@
1
- /* stylelint-disable-next-line scss/load-partial-extension */
2
- @use '@vuepress/helper/scss/svg.scss';
1
+ @use '@vuepress/helper/scss/svg';
3
2
 
4
3
  $arrow-icon: '<svg viewBox="0 0 24 24"><path fill="rgba(0,0,0,0.5)" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/></svg>';
5
4
  $dark-arrow-icon: '<svg viewBox="0 0 24 24"><path fill="rgba(255,255,255,0.5)" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/></svg>';
@@ -1,5 +1,4 @@
1
- /* stylelint-disable-next-line scss/load-partial-extension */
2
- @use '@vuepress/helper/scss/svg.scss';
1
+ @use '@vuepress/helper/scss/svg';
3
2
 
4
3
  $external-link-icon: '<svg viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"/></svg>';
5
4
 
@@ -1,5 +1,6 @@
1
- export * from './isActiveSidebarItem.js';
2
- export * from './resolveAutoLink.js';
3
- export * from './resolveEditLink.js';
4
- export * from './resolvePrefix.js';
5
- export * from './resolveRepoType.js';
1
+ import { isActiveSidebarItem } from "./isActiveSidebarItem.js";
2
+ import { resolveAutoLink } from "./resolveAutoLink.js";
3
+ import { EDIT_LINK_PATTERNS, resolveEditLink } from "./resolveEditLink.js";
4
+ import { resolvePrefix } from "./resolvePrefix.js";
5
+ import { RepoType, resolveRepoType } from "./resolveRepoType.js";
6
+ export { EDIT_LINK_PATTERNS, RepoType, isActiveSidebarItem, resolveAutoLink, resolveEditLink, resolvePrefix, resolveRepoType };
@@ -1,5 +1 @@
1
- export * from './isActiveSidebarItem.js';
2
- export * from './resolveAutoLink.js';
3
- export * from './resolveEditLink.js';
4
- export * from './resolvePrefix.js';
5
- export * from './resolveRepoType.js';
1
+ import{isActiveSidebarItem as e}from"./isActiveSidebarItem.js";import{resolveAutoLink as t}from"./resolveAutoLink.js";import{EDIT_LINK_PATTERNS as n,resolveEditLink as r}from"./resolveEditLink.js";import{resolvePrefix as i}from"./resolvePrefix.js";import{resolveRepoType as a}from"./resolveRepoType.js";export{n as EDIT_LINK_PATTERNS,e as isActiveSidebarItem,t as resolveAutoLink,r as resolveEditLink,i as resolvePrefix,a as resolveRepoType};
@@ -1,3 +1,8 @@
1
- import type { RouteLocationNormalizedLoaded } from 'vuepress/client';
2
- import type { SidebarItem } from '../typings.js';
3
- export declare const isActiveSidebarItem: (item: SidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
1
+ import { i as SidebarItem } from "../../typings-jKn48KwS.js";
2
+ import { RouteLocationNormalizedLoaded } from "vuepress/client";
3
+
4
+ //#region src/client/utils/isActiveSidebarItem.d.ts
5
+ declare const isActiveSidebarItem: (item: SidebarItem, route: RouteLocationNormalizedLoaded) => boolean;
6
+ //#endregion
7
+ export { isActiveSidebarItem };
8
+ //# sourceMappingURL=isActiveSidebarItem.d.ts.map
@@ -1,20 +1,2 @@
1
- const normalizePath = (path) => decodeURI(path)
2
- .replace(/#.*$/, '')
3
- .replace(/(index)?\.(md|html)$/, '');
4
- const isActiveLink = (link, route) => {
5
- if (route.hash === link) {
6
- return true;
7
- }
8
- const currentPath = normalizePath(route.path);
9
- const targetPath = normalizePath(link);
10
- return currentPath === targetPath;
11
- };
12
- export const isActiveSidebarItem = (item, route) => {
13
- if (item.link && isActiveLink(item.link, route)) {
14
- return true;
15
- }
16
- if ('children' in item) {
17
- return item.children.some((child) => isActiveSidebarItem(child, route));
18
- }
19
- return false;
20
- };
1
+ const e=e=>decodeURI(e).replace(/#.*$/,``).replace(/(index)?\.(md|html)$/,``),t=(t,n)=>n.hash===t?!0:e(n.path)===e(t),n=(e,r)=>e.link&&t(e.link,r)?!0:`children`in e?e.children.some(e=>n(e,r)):!1;export{n as isActiveSidebarItem};
2
+ //# sourceMappingURL=isActiveSidebarItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isActiveSidebarItem.js","names":[],"sources":["../../../src/client/utils/isActiveSidebarItem.ts"],"sourcesContent":["import type { RouteLocationNormalizedLoaded } from 'vuepress/client'\nimport type { SidebarItem } from '../typings.js'\n\nconst normalizePath = (path: string): string =>\n decodeURI(path)\n .replace(/#.*$/, '')\n .replace(/(index)?\\.(md|html)$/, '')\n\nconst isActiveLink = (\n link: string,\n route: RouteLocationNormalizedLoaded,\n): boolean => {\n if (route.hash === link) return true\n\n const currentPath = normalizePath(route.path)\n const targetPath = normalizePath(link)\n return currentPath === targetPath\n}\n\nexport const isActiveSidebarItem = (\n item: SidebarItem,\n route: RouteLocationNormalizedLoaded,\n): boolean => {\n if (item.link && isActiveLink(item.link, route)) return true\n\n if ('children' in item)\n return item.children.some((child) => isActiveSidebarItem(child, route))\n\n return false\n}\n"],"mappings":"AAGA,MAAM,EAAiB,GACrB,UAAU,EAAK,CACZ,QAAQ,OAAQ,GAAG,CACnB,QAAQ,uBAAwB,GAAG,CAElC,GACJ,EACA,IAEI,EAAM,OAAS,EAAa,GAEZ,EAAc,EAAM,KAAK,GAC1B,EAAc,EAAK,CAI3B,GACX,EACA,IAEI,EAAK,MAAQ,EAAa,EAAK,KAAM,EAAM,CAAS,GAEpD,aAAc,EACT,EAAK,SAAS,KAAM,GAAU,EAAoB,EAAO,EAAM,CAAC,CAElE"}
@@ -1,9 +1,20 @@
1
- import type { AutoLinkOptions } from '../../shared/index.js';
1
+ import { t as AutoLinkOptions } from "../../nav-DikslSJ_.js";
2
+
3
+ //#region src/client/utils/resolveAutoLink.d.ts
2
4
  /**
3
5
  * Resolve AutoLink props from string
4
6
  *
7
+ * 从字符串解析 AutoLink 属性
8
+ *
9
+ * @param config - The string to resolve / 要解析的字符串
10
+ * @param currentPath - The current route path / 当前路由路径
11
+ * @returns Resolved AutoLink options / 解析后的 AutoLink 选项
12
+ *
5
13
  * @example
6
14
  * - Input: '/README.md'
7
15
  * - Output: { text: 'Home', link: '/' }
8
16
  */
9
- export declare const resolveAutoLink: (config: string, currentPath?: string) => AutoLinkOptions;
17
+ declare const resolveAutoLink: (config: string, currentPath?: string) => AutoLinkOptions;
18
+ //#endregion
19
+ export { resolveAutoLink };
20
+ //# sourceMappingURL=resolveAutoLink.d.ts.map
@@ -1,17 +1,2 @@
1
- import { resolveRoute } from 'vuepress/client';
2
- /**
3
- * Resolve AutoLink props from string
4
- *
5
- * @example
6
- * - Input: '/README.md'
7
- * - Output: { text: 'Home', link: '/' }
8
- */
9
- export const resolveAutoLink = (config, currentPath) => {
10
- const { notFound, meta, path } = resolveRoute(config, currentPath);
11
- return notFound
12
- ? { text: path, link: path }
13
- : {
14
- text: meta.title || path,
15
- link: path,
16
- };
17
- };
1
+ import{resolveRoute as e}from"vuepress/client";const t=(t,n)=>{let{notFound:r,meta:i,path:a}=e(t,n);return r?{text:a,link:a}:{text:i.title||a,link:a}};export{t as resolveAutoLink};
2
+ //# sourceMappingURL=resolveAutoLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAutoLink.js","names":[],"sources":["../../../src/client/utils/resolveAutoLink.ts"],"sourcesContent":["import { resolveRoute } from 'vuepress/client'\nimport type { AutoLinkOptions } from '../../shared/index.js'\n\n/**\n * Resolve AutoLink props from string\n *\n * 从字符串解析 AutoLink 属性\n *\n * @param config - The string to resolve / 要解析的字符串\n * @param currentPath - The current route path / 当前路由路径\n * @returns Resolved AutoLink options / 解析后的 AutoLink 选项\n *\n * @example\n * - Input: '/README.md'\n * - Output: { text: 'Home', link: '/' }\n */\nexport const resolveAutoLink = (\n config: string,\n currentPath?: string,\n): AutoLinkOptions => {\n const { notFound, meta, path } = resolveRoute<{\n title?: string\n }>(config, currentPath)\n\n return notFound\n ? { text: path, link: path }\n : {\n text: meta.title || path,\n link: path,\n }\n}\n"],"mappings":"+CAgBA,MAAa,GACX,EACA,IACoB,CACpB,GAAM,CAAE,WAAU,OAAM,QAAS,EAE9B,EAAQ,EAAY,CAEvB,OAAO,EACH,CAAE,KAAM,EAAM,KAAM,EAAM,CAC1B,CACE,KAAM,EAAK,OAAS,EACpB,KAAM,EACP"}
@@ -1,9 +1,20 @@
1
- import type { RepoType } from '@theme/resolveRepoType';
2
- export declare const EDIT_LINK_PATTERNS: Record<Exclude<RepoType, null>, string>;
3
- export declare const resolveEditLink: ({ docsRepo, docsBranch, docsDir, filePathRelative, editLinkPattern, }: {
4
- docsRepo: string;
5
- docsBranch: string;
6
- docsDir: string;
7
- filePathRelative: string | null;
8
- editLinkPattern?: string;
1
+ import { RepoType } from "@theme/resolveRepoType";
2
+
3
+ //#region src/client/utils/resolveEditLink.d.ts
4
+ declare const EDIT_LINK_PATTERNS: Record<Exclude<RepoType, null>, string>;
5
+ declare const resolveEditLink: ({
6
+ docsRepo,
7
+ docsBranch,
8
+ docsDir,
9
+ filePathRelative,
10
+ editLinkPattern
11
+ }: {
12
+ docsRepo: string;
13
+ docsBranch: string;
14
+ docsDir: string;
15
+ filePathRelative: string | null;
16
+ editLinkPattern?: string;
9
17
  }) => string | null;
18
+ //#endregion
19
+ export { EDIT_LINK_PATTERNS, resolveEditLink };
20
+ //# sourceMappingURL=resolveEditLink.d.ts.map
@@ -1,29 +1,2 @@
1
- import { resolveRepoType } from '@theme/resolveRepoType';
2
- import { isLinkHttp, removeEndingSlash, removeLeadingSlash, } from 'vuepress/shared';
3
- export const EDIT_LINK_PATTERNS = {
4
- GitHub: ':repo/edit/:branch/:path',
5
- GitLab: ':repo/-/edit/:branch/:path',
6
- Gitee: ':repo/edit/:branch/:path',
7
- Bitbucket: ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',
8
- };
9
- const resolveEditLinkPatterns = ({ docsRepo, editLinkPattern, }) => {
10
- if (editLinkPattern) {
11
- return editLinkPattern;
12
- }
13
- const repoType = resolveRepoType(docsRepo);
14
- if (repoType !== null) {
15
- return EDIT_LINK_PATTERNS[repoType];
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 });
23
- if (!pattern)
24
- return null;
25
- return pattern
26
- .replace(/:repo/, isLinkHttp(docsRepo) ? docsRepo : `https://github.com/${docsRepo}`)
27
- .replace(/:branch/, docsBranch)
28
- .replace(/:path/, removeLeadingSlash(`${removeEndingSlash(docsDir)}/${filePathRelative}`));
29
- };
1
+ import{isLinkHttp as e,removeEndingSlash as t,removeLeadingSlash as n}from"vuepress/shared";import{resolveRepoType as r}from"@theme/resolveRepoType";const i={GitHub:`:repo/edit/:branch/:path`,GitLab:`:repo/-/edit/:branch/:path`,Gitee:`:repo/edit/:branch/:path`,Bitbucket:`:repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default`},a=({docsRepo:e,editLinkPattern:t})=>{if(t)return t;let n=r(e);return n==null?null:i[n]},o=({docsRepo:r,docsBranch:i,docsDir:o,filePathRelative:s,editLinkPattern:c})=>{if(!s)return null;let l=a({docsRepo:r,editLinkPattern:c});return l?l.replace(/:repo/,e(r)?r:`https://github.com/${r}`).replace(/:branch/,i).replace(/:path/,n(`${t(o)}/${s}`)):null};export{i as EDIT_LINK_PATTERNS,o as resolveEditLink};
2
+ //# sourceMappingURL=resolveEditLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveEditLink.js","names":[],"sources":["../../../src/client/utils/resolveEditLink.ts"],"sourcesContent":["import type { RepoType } from '@theme/resolveRepoType'\nimport { resolveRepoType } from '@theme/resolveRepoType'\nimport {\n isLinkHttp,\n removeEndingSlash,\n removeLeadingSlash,\n} from 'vuepress/shared'\n\nexport const EDIT_LINK_PATTERNS: Record<Exclude<RepoType, null>, string> = {\n GitHub: ':repo/edit/:branch/:path',\n GitLab: ':repo/-/edit/:branch/:path',\n Gitee: ':repo/edit/:branch/:path',\n Bitbucket:\n ':repo/src/:branch/:path?mode=edit&spa=0&at=:branch&fileviewer=file-view-default',\n}\n\nconst resolveEditLinkPatterns = ({\n docsRepo,\n editLinkPattern,\n}: {\n docsRepo: string\n editLinkPattern?: string\n}): string | null => {\n if (editLinkPattern) return editLinkPattern\n\n const repoType = resolveRepoType(docsRepo)\n if (repoType != null) return EDIT_LINK_PATTERNS[repoType]\n\n return null\n}\n\nexport const resolveEditLink = ({\n docsRepo,\n docsBranch,\n docsDir,\n filePathRelative,\n editLinkPattern,\n}: {\n docsRepo: string\n docsBranch: string\n docsDir: string\n filePathRelative: string | null\n editLinkPattern?: string\n}): string | null => {\n if (!filePathRelative) return null\n\n const pattern = resolveEditLinkPatterns({ docsRepo, editLinkPattern })\n if (!pattern) return null\n\n return pattern\n .replace(\n /:repo/,\n isLinkHttp(docsRepo) ? docsRepo : `https://github.com/${docsRepo}`,\n )\n .replace(/:branch/, docsBranch)\n .replace(\n /:path/,\n removeLeadingSlash(`${removeEndingSlash(docsDir)}/${filePathRelative}`),\n )\n}\n"],"mappings":"qJAQA,MAAa,EAA8D,CACzE,OAAQ,2BACR,OAAQ,6BACR,MAAO,2BACP,UACE,kFACH,CAEK,GAA2B,CAC/B,WACA,qBAImB,CACnB,GAAI,EAAiB,OAAO,EAE5B,IAAM,EAAW,EAAgB,EAAS,CAG1C,OAFI,GAAY,KAET,KAFsB,EAAmB,IAKrC,GAAmB,CAC9B,WACA,aACA,UACA,mBACA,qBAOmB,CACnB,GAAI,CAAC,EAAkB,OAAO,KAE9B,IAAM,EAAU,EAAwB,CAAE,WAAU,kBAAiB,CAAC,CAGtE,OAFK,EAEE,EACJ,QACC,QACA,EAAW,EAAS,CAAG,EAAW,sBAAsB,IACzD,CACA,QAAQ,UAAW,EAAW,CAC9B,QACC,QACA,EAAmB,GAAG,EAAkB,EAAQ,CAAC,GAAG,IAAmB,CACxE,CAXkB"}
@@ -1 +1,5 @@
1
- export declare const resolvePrefix: (prefix?: string, path?: string) => string;
1
+ //#region src/client/utils/resolvePrefix.d.ts
2
+ declare const resolvePrefix: (prefix?: string, path?: string) => string;
3
+ //#endregion
4
+ export { resolvePrefix };
5
+ //# sourceMappingURL=resolvePrefix.d.ts.map
@@ -1,4 +1,2 @@
1
- import { ensureEndingSlash, isLinkAbsolute, isLinkWithProtocol, } from '@vuepress/helper/client';
2
- export const resolvePrefix = (prefix = '', path = '') => isLinkAbsolute(path) || isLinkWithProtocol(path)
3
- ? path
4
- : `${ensureEndingSlash(prefix)}${path}`;
1
+ import{ensureEndingSlash as e,isLinkAbsolute as t,isLinkWithProtocol as n}from"@vuepress/helper/client";const r=(r=``,i=``)=>t(i)||n(i)?i:`${e(r)}${i}`;export{r as resolvePrefix};
2
+ //# sourceMappingURL=resolvePrefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePrefix.js","names":[],"sources":["../../../src/client/utils/resolvePrefix.ts"],"sourcesContent":["import {\n ensureEndingSlash,\n isLinkAbsolute,\n isLinkWithProtocol,\n} from '@vuepress/helper/client'\n\nexport const resolvePrefix = (prefix = '', path = ''): string =>\n isLinkAbsolute(path) || isLinkWithProtocol(path)\n ? path\n : `${ensureEndingSlash(prefix)}${path}`\n"],"mappings":"wGAMA,MAAa,GAAiB,EAAS,GAAI,EAAO,KAChD,EAAe,EAAK,EAAI,EAAmB,EAAK,CAC5C,EACA,GAAG,EAAkB,EAAO,GAAG"}
@@ -1,2 +1,6 @@
1
- export type RepoType = 'Bitbucket' | 'Gitee' | 'GitHub' | 'GitLab' | null;
2
- export declare const resolveRepoType: (repo: string) => RepoType;
1
+ //#region src/client/utils/resolveRepoType.d.ts
2
+ type RepoType = 'Bitbucket' | 'Gitee' | 'GitHub' | 'GitLab' | null;
3
+ declare const resolveRepoType: (repo: string) => RepoType;
4
+ //#endregion
5
+ export { RepoType, resolveRepoType };
6
+ //# sourceMappingURL=resolveRepoType.d.ts.map
@@ -1,12 +1,2 @@
1
- import { isLinkHttp } from 'vuepress/shared';
2
- export const resolveRepoType = (repo) => {
3
- if (!isLinkHttp(repo) || repo.includes('github.com'))
4
- return 'GitHub';
5
- if (repo.includes('bitbucket.org'))
6
- return 'Bitbucket';
7
- if (repo.includes('gitlab.com'))
8
- return 'GitLab';
9
- if (repo.includes('gitee.com'))
10
- return 'Gitee';
11
- return null;
12
- };
1
+ import{isLinkHttp as e}from"vuepress/shared";const t=t=>!e(t)||t.includes(`github.com`)?`GitHub`:t.includes(`bitbucket.org`)?`Bitbucket`:t.includes(`gitlab.com`)?`GitLab`:t.includes(`gitee.com`)?`Gitee`:null;export{t as resolveRepoType};
2
+ //# sourceMappingURL=resolveRepoType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveRepoType.js","names":[],"sources":["../../../src/client/utils/resolveRepoType.ts"],"sourcesContent":["import { isLinkHttp } from 'vuepress/shared'\n\nexport type RepoType = 'Bitbucket' | 'Gitee' | 'GitHub' | 'GitLab' | null\n\nexport const resolveRepoType = (repo: string): RepoType => {\n if (!isLinkHttp(repo) || repo.includes('github.com')) return 'GitHub'\n if (repo.includes('bitbucket.org')) return 'Bitbucket'\n if (repo.includes('gitlab.com')) return 'GitLab'\n if (repo.includes('gitee.com')) return 'Gitee'\n return null\n}\n"],"mappings":"6CAIA,MAAa,EAAmB,GAC1B,CAAC,EAAW,EAAK,EAAI,EAAK,SAAS,aAAa,CAAS,SACzD,EAAK,SAAS,gBAAgB,CAAS,YACvC,EAAK,SAAS,aAAa,CAAS,SACpC,EAAK,SAAS,YAAY,CAAS,QAChC"}
@@ -0,0 +1,36 @@
1
+ //#region src/shared/nav.d.ts
2
+ /**
3
+ * Base nav item, displayed as text
4
+ */
5
+ interface NavItemOptions {
6
+ text: string;
7
+ ariaLabel?: string;
8
+ }
9
+ /**
10
+ * Options for `<AutoLink>`
11
+ */
12
+ interface AutoLinkOptions extends NavItemOptions {
13
+ /**
14
+ * Link of item
15
+ */
16
+ link: string;
17
+ /**
18
+ * Rel of `<a>` tag
19
+ */
20
+ rel?: string;
21
+ /**
22
+ * Target of `<a>` tag
23
+ */
24
+ target?: string;
25
+ /**
26
+ * Regexp mode to be active
27
+ */
28
+ activeMatch?: string;
29
+ /**
30
+ * Whether it's active only when exact match
31
+ */
32
+ exact?: boolean;
33
+ }
34
+ //#endregion
35
+ export { NavItemOptions as n, AutoLinkOptions as t };
36
+ //# sourceMappingURL=nav-DikslSJ_.d.ts.map
@@ -1,4 +1,106 @@
1
- export * from './defaultTheme.js';
2
- export type * from './typings.js';
3
- export * from './utils/index.js';
4
- export type * from '../shared/index.js';
1
+ import { n as NavItemOptions, t as AutoLinkOptions } from "../nav-DikslSJ_.js";
2
+ import { a as SidebarObjectOptions, c as NavbarGroupOptions, i as SidebarLinkOptions, l as NavbarLinkOptions, n as SidebarGroupOptions, o as SidebarOptions, r as SidebarItemOptions, s as NavGroup, t as SidebarArrayOptions, u as NavbarOptions } from "../sidebar-FqrQ3PGy.js";
3
+ import { a as DefaultThemeData, i as DefaultThemePageFrontmatter, n as DefaultThemeNormalPageFrontmatter, o as DefaultThemeLocaleData, r as DefaultThemePageData, s as DefaultThemeLocaleOptions, t as DefaultThemeHomePageFrontmatter } from "../page-F2gyvsdE.js";
4
+ import { BackToTopPluginOptions } from "@vuepress/plugin-back-to-top";
5
+ import { CopyCodePluginOptions } from "@vuepress/plugin-copy-code";
6
+ import { GitPluginOptions } from "@vuepress/plugin-git";
7
+ import { LinksCheckPluginOptions } from "@vuepress/plugin-links-check";
8
+ import { MarkdownHintPluginLocaleData, MarkdownHintPluginOptions } from "@vuepress/plugin-markdown-hint";
9
+ import { MarkdownTabPluginOptions } from "@vuepress/plugin-markdown-tab";
10
+ import { PrismjsPluginOptions } from "@vuepress/plugin-prismjs";
11
+ import { SeoPluginOptions } from "@vuepress/plugin-seo";
12
+ import { SitemapPluginOptions } from "@vuepress/plugin-sitemap";
13
+ import { LocaleConfig } from "vuepress/shared";
14
+ import { Theme } from "vuepress/core";
15
+
16
+ //#region src/node/typings.d.ts
17
+ interface DefaultThemePluginsOptions {
18
+ /**
19
+ * Enable `@vuepress/plugin-active-header-links` or not
20
+ */
21
+ activeHeaderLinks?: boolean;
22
+ /**
23
+ * Enable `@vuepress/plugin-back-to-top` or not
24
+ */
25
+ backToTop?: BackToTopPluginOptions | boolean;
26
+ /**
27
+ * Enable `@vuepress/plugin-copy-code` or not
28
+ */
29
+ copyCode?: CopyCodePluginOptions | boolean;
30
+ /**
31
+ * Enable `@vuepress/plugin-git` or not
32
+ */
33
+ git?: GitPluginOptions | boolean;
34
+ /**
35
+ * Enable `@vuepress/plugin-markdown-hint` or not
36
+ */
37
+ hint?: MarkdownHintPluginOptions | boolean;
38
+ /**
39
+ * Enable `@vuepress/plugin-links-check` or not
40
+ */
41
+ linksCheck?: LinksCheckPluginOptions | boolean;
42
+ /**
43
+ * Enable `@vuepress/plugin-medium-zoom` or not
44
+ */
45
+ mediumZoom?: boolean;
46
+ /**
47
+ * Enable `@vuepress/plugin-nprogress` or not
48
+ */
49
+ nprogress?: boolean;
50
+ /**
51
+ * Enable `@vuepress/plugin-prismjs` or not
52
+ */
53
+ prismjs?: PrismjsPluginOptions | boolean;
54
+ /**
55
+ * Enable `@vuepress/plugin-seo` or not
56
+ */
57
+ seo?: Partial<SeoPluginOptions> | boolean;
58
+ /**
59
+ * Enable `@vuepress/plugin-sitemap` or not
60
+ */
61
+ sitemap?: Partial<SitemapPluginOptions> | boolean;
62
+ /**
63
+ * Enable `@vuepress/plugin-markdown-tab` or not
64
+ */
65
+ tab?: MarkdownTabPluginOptions | boolean;
66
+ }
67
+ //#endregion
68
+ //#region src/node/defaultTheme.d.ts
69
+ interface DefaultThemeOptions extends DefaultThemeLocaleOptions {
70
+ /**
71
+ * deployed hostname
72
+ */
73
+ hostname?: string;
74
+ /**
75
+ * To avoid confusion with the root `plugins` option,
76
+ * we use `themePlugins`
77
+ */
78
+ themePlugins?: DefaultThemePluginsOptions;
79
+ }
80
+ declare const defaultTheme: ({
81
+ hostname,
82
+ themePlugins,
83
+ ...localeOptions
84
+ }?: DefaultThemeOptions) => Theme;
85
+ //#endregion
86
+ //#region src/node/utils/assignDefaultLocaleOptions.d.ts
87
+ declare const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions;
88
+ declare const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData;
89
+ /**
90
+ * Assign default options
91
+ */
92
+ declare const assignDefaultLocaleOptions: (localeOptions: DefaultThemeLocaleOptions) => void;
93
+ //#endregion
94
+ //#region src/node/utils/resolveMarkdownHintLocales.d.ts
95
+ /**
96
+ * Resolve options for `@vuepress/plugin-markdown-container`
97
+ *
98
+ * For custom containers default title
99
+ *
100
+ * @param localeOptions - Locales config from theme options
101
+ * @returns Locales config for `@vuepress/plugin-markdown-container`
102
+ */
103
+ declare const resolveMarkdownHintLocales: (localeOptions: DefaultThemeData) => LocaleConfig<MarkdownHintPluginLocaleData>;
104
+ //#endregion
105
+ export { AutoLinkOptions, DEFAULT_LOCALE_DATA, DEFAULT_LOCALE_OPTIONS, DefaultThemeData, DefaultThemeHomePageFrontmatter, DefaultThemeLocaleData, DefaultThemeLocaleOptions, DefaultThemeNormalPageFrontmatter, DefaultThemeOptions, DefaultThemePageData, DefaultThemePageFrontmatter, DefaultThemePluginsOptions, NavGroup, NavItemOptions, NavbarGroupOptions, NavbarLinkOptions, NavbarOptions, SidebarArrayOptions, SidebarGroupOptions, SidebarItemOptions, SidebarLinkOptions, SidebarObjectOptions, SidebarOptions, assignDefaultLocaleOptions, defaultTheme, resolveMarkdownHintLocales };
106
+ //# sourceMappingURL=index.d.ts.map
package/lib/node/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from './defaultTheme.js';
2
- export * from './utils/index.js';
1
+ import{addViteOptimizeDepsExclude as e}from"@vuepress/helper";import{activeHeaderLinksPlugin as t}from"@vuepress/plugin-active-header-links";import{backToTopPlugin as n}from"@vuepress/plugin-back-to-top";import{copyCodePlugin as r}from"@vuepress/plugin-copy-code";import{gitPlugin as i}from"@vuepress/plugin-git";import{linksCheckPlugin as a}from"@vuepress/plugin-links-check";import{markdownHintPlugin as o}from"@vuepress/plugin-markdown-hint";import{markdownTabPlugin as s}from"@vuepress/plugin-markdown-tab";import{mediumZoomPlugin as c}from"@vuepress/plugin-medium-zoom";import{nprogressPlugin as l}from"@vuepress/plugin-nprogress";import{palettePlugin as u}from"@vuepress/plugin-palette";import{prismjsPlugin as d}from"@vuepress/plugin-prismjs";import{seoPlugin as f}from"@vuepress/plugin-seo";import{sitemapPlugin as p}from"@vuepress/plugin-sitemap";import{themeDataPlugin as m}from"@vuepress/plugin-theme-data";import{isPlainObject as h}from"vuepress/shared";import{fs as g,getDirname as _,path as v}from"vuepress/utils";const y={colorMode:`auto`,colorModeSwitch:!0,navbar:[],logo:null,repo:null,selectLanguageText:`Languages`,selectLanguageAriaLabel:`Select language`,sidebar:`heading`,sidebarDepth:2,editLink:!0,editLinkText:`Edit this page`,lastUpdated:!0,contributors:!0,contributorsText:`Contributors`,notFound:[`There's nothing here.`,`How did we get here?`,`That's a Four-Oh-Four.`,`Looks like we've got some broken links.`],backToHome:`Take me home`,openInNewWindow:`open in new window`,toggleColorMode:`toggle color mode`,toggleSidebar:`toggle sidebar`},b={selectLanguageName:`English`},x=e=>{e.locales??={},Object.assign(e,{...y,...e}),e.locales[`/`]??={},Object.assign(e.locales[`/`],{...b,...e.locales[`/`]})},S=e=>Object.entries(e.locales??{}).reduce((e,[t,n])=>(e[t]={},n.tip&&(e[t].tip=n.tip),n.warning&&(e[t].warning=n.warning),n.danger&&(e[t].caution=n.danger),n.important&&(e[t].important=n.important),n.note&&(e[t].note=n.note),e),{}),C=import.meta.dirname||_(import.meta.url),w=({hostname:_,themePlugins:y={},...b}={})=>(x(b),{name:`@vuepress/theme-default`,templateBuild:v.resolve(C,`../../templates/build.html`),alias:{...Object.fromEntries(g.readdirSync(v.resolve(C,`../client/components`)).filter(e=>e.endsWith(`.vue`)).map(e=>[`@theme/${e}`,v.resolve(C,`../client/components`,e)])),...Object.fromEntries(g.readdirSync(v.resolve(C,`../client/composables`)).filter(e=>e.endsWith(`.js`)).map(e=>[`@theme/${e.slice(0,-3)}`,v.resolve(C,`../client/composables`,e)])),...Object.fromEntries(g.readdirSync(v.resolve(C,`../client/utils`)).filter(e=>e.endsWith(`.js`)).map(e=>[`@theme/${e.slice(0,-3)}`,v.resolve(C,`../client/utils`,e)]))},clientConfigFile:v.resolve(C,`../client/config.js`),extendsBundlerOptions:(t,n)=>{e(t,n,`@theme`)},extendsPage:e=>{e.data.filePathRelative=e.filePathRelative,e.routeMeta.title=e.title},plugins:[y.activeHeaderLinks??!0?t({delay:300}):[],y.backToTop??!0?n(h(y.backToTop)?y.backToTop:{}):[],y.copyCode??!0?r({...h(y.copyCode)?y.copyCode:{}}):[],y.hint??!0?o({locales:S(b),...h(y.hint)?y.hint:{}}):[],y.git??!0?i({createdTime:!1,updatedTime:b.lastUpdated??!0,changelog:{repoUrl:b.repo||``},...h(y.git)?y.git:{}}):[],y.linksCheck??!0?a(h(y.linksCheck)?y.linksCheck:{}):[],y.mediumZoom??!0?c():[],y.nprogress??!0?l():[],u({preset:`sass`}),y.prismjs??!0?d(h(y.prismjs)?y.prismjs:{}):[],_&&(y.seo??!0)?f({hostname:_,...h(y.seo)?y.seo:{}}):[],_&&(y.sitemap??!0)?p({hostname:_,...h(y.sitemap)?y.sitemap:{}}):[],y.tab??!0?s(h(y.tab)?y.tab:{codeTabs:!0,tabs:!0}):[],m({themeData:b})]});export{b as DEFAULT_LOCALE_DATA,y as DEFAULT_LOCALE_OPTIONS,x as assignDefaultLocaleOptions,w as defaultTheme,S as resolveMarkdownHintLocales};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/node/utils/assignDefaultLocaleOptions.ts","../../src/node/utils/resolveMarkdownHintLocales.ts","../../src/node/defaultTheme.ts"],"sourcesContent":["import type {\n DefaultThemeLocaleData,\n DefaultThemeLocaleOptions,\n} from '../../shared/index.js'\n\nexport const DEFAULT_LOCALE_OPTIONS: DefaultThemeLocaleOptions = {\n // color mode\n colorMode: 'auto',\n colorModeSwitch: true,\n\n // navbar\n navbar: [],\n logo: null,\n repo: null,\n selectLanguageText: 'Languages',\n selectLanguageAriaLabel: 'Select language',\n\n // sidebar\n sidebar: 'heading',\n sidebarDepth: 2,\n\n // page meta\n editLink: true,\n editLinkText: 'Edit this page',\n lastUpdated: true,\n contributors: true,\n contributorsText: 'Contributors',\n\n // 404 page messages\n notFound: [\n `There's nothing here.`,\n `How did we get here?`,\n `That's a Four-Oh-Four.`,\n `Looks like we've got some broken links.`,\n ],\n backToHome: 'Take me home',\n\n // a11y\n openInNewWindow: 'open in new window',\n toggleColorMode: 'toggle color mode',\n toggleSidebar: 'toggle sidebar',\n}\n\nexport const DEFAULT_LOCALE_DATA: DefaultThemeLocaleData = {\n // navbar\n selectLanguageName: 'English',\n}\n\n/**\n * Assign default options\n */\nexport const assignDefaultLocaleOptions = (\n localeOptions: DefaultThemeLocaleOptions,\n): void => {\n localeOptions.locales ??= {}\n Object.assign(localeOptions, {\n ...DEFAULT_LOCALE_OPTIONS,\n ...localeOptions,\n })\n localeOptions.locales['/'] ??= {}\n Object.assign(localeOptions.locales['/'], {\n ...DEFAULT_LOCALE_DATA,\n ...localeOptions.locales['/'],\n })\n}\n","import type { MarkdownHintPluginLocaleData } from '@vuepress/plugin-markdown-hint'\nimport type { LocaleConfig } from 'vuepress/shared'\nimport type { DefaultThemeData } from '../../shared/index.js'\n\n/**\n * Resolve options for `@vuepress/plugin-markdown-container`\n *\n * For custom containers default title\n *\n * @param localeOptions - Locales config from theme options\n * @returns Locales config for `@vuepress/plugin-markdown-container`\n */\nexport const resolveMarkdownHintLocales = (\n localeOptions: DefaultThemeData,\n): LocaleConfig<MarkdownHintPluginLocaleData> =>\n Object.entries(localeOptions.locales ?? {}).reduce<\n LocaleConfig<MarkdownHintPluginLocaleData>\n >((result, [key, value]) => {\n result[key] = {}\n\n if (value.tip) result[key].tip = value.tip\n if (value.warning) result[key].warning = value.warning\n if (value.danger) result[key].caution = value.danger\n if (value.important) result[key].important = value.important\n if (value.note) result[key].note = value.note\n\n return result\n }, {})\n","import { addViteOptimizeDepsExclude } from '@vuepress/helper'\nimport { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links'\nimport { backToTopPlugin } from '@vuepress/plugin-back-to-top'\nimport { copyCodePlugin } from '@vuepress/plugin-copy-code'\nimport { gitPlugin } from '@vuepress/plugin-git'\nimport { linksCheckPlugin } from '@vuepress/plugin-links-check'\nimport { markdownHintPlugin } from '@vuepress/plugin-markdown-hint'\nimport { markdownTabPlugin } from '@vuepress/plugin-markdown-tab'\nimport { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom'\nimport { nprogressPlugin } from '@vuepress/plugin-nprogress'\nimport { palettePlugin } from '@vuepress/plugin-palette'\nimport { prismjsPlugin } from '@vuepress/plugin-prismjs'\nimport { seoPlugin } from '@vuepress/plugin-seo'\nimport { sitemapPlugin } from '@vuepress/plugin-sitemap'\nimport { themeDataPlugin } from '@vuepress/plugin-theme-data'\nimport type { Page, Theme } from 'vuepress/core'\nimport { isPlainObject } from 'vuepress/shared'\nimport { fs, getDirname, path } from 'vuepress/utils'\nimport type {\n DefaultThemeLocaleOptions,\n DefaultThemePageData,\n} from '../shared/index.js'\nimport type { DefaultThemePluginsOptions } from './typings.js'\nimport {\n assignDefaultLocaleOptions,\n resolveMarkdownHintLocales,\n} from './utils/index.js'\n\nconst __dirname = import.meta.dirname || getDirname(import.meta.url)\n\nexport interface DefaultThemeOptions extends DefaultThemeLocaleOptions {\n /**\n * deployed hostname\n */\n hostname?: string\n\n /**\n * To avoid confusion with the root `plugins` option,\n * we use `themePlugins`\n */\n themePlugins?: DefaultThemePluginsOptions\n}\n\nexport const defaultTheme = ({\n hostname,\n themePlugins = {},\n ...localeOptions\n}: DefaultThemeOptions = {}): Theme => {\n assignDefaultLocaleOptions(localeOptions)\n\n return {\n name: '@vuepress/theme-default',\n\n templateBuild: path.resolve(__dirname, '../../templates/build.html'),\n\n alias: {\n // use alias to make all components replaceable\n ...Object.fromEntries(\n fs\n .readdirSync(path.resolve(__dirname, '../client/components'))\n .filter((file) => file.endsWith('.vue'))\n .map((file) => [\n `@theme/${file}`,\n path.resolve(__dirname, '../client/components', file),\n ]),\n ),\n // use alias to make all composables replaceable\n ...Object.fromEntries(\n fs\n .readdirSync(path.resolve(__dirname, '../client/composables'))\n .filter((file) => file.endsWith('.js'))\n .map((file) => [\n `@theme/${file.slice(0, -3)}`,\n path.resolve(__dirname, '../client/composables', file),\n ]),\n ),\n // use alias to make all utils replaceable\n ...Object.fromEntries(\n fs\n .readdirSync(path.resolve(__dirname, '../client/utils'))\n .filter((file) => file.endsWith('.js'))\n .map((file) => [\n `@theme/${file.slice(0, -3)}`,\n path.resolve(__dirname, '../client/utils', file),\n ]),\n ),\n },\n\n clientConfigFile: path.resolve(__dirname, '../client/config.js'),\n\n extendsBundlerOptions: (bundlerOptions, app) => {\n // ensure theme alias is not optimized by Vite\n addViteOptimizeDepsExclude(bundlerOptions, app, '@theme')\n },\n\n extendsPage: (page: Page<Partial<DefaultThemePageData>>) => {\n // save relative file path into page data to generate edit link\n page.data.filePathRelative = page.filePathRelative\n // save title into route meta to generate navbar and sidebar\n page.routeMeta.title = page.title\n },\n\n plugins: [\n // @vuepress/plugin-active-header-link\n (themePlugins.activeHeaderLinks ?? true)\n ? activeHeaderLinksPlugin({\n // should greater than page transition duration\n delay: 300,\n })\n : [],\n\n // @vuepress/plugin-back-to-top\n (themePlugins.backToTop ?? true)\n ? backToTopPlugin(\n isPlainObject(themePlugins.backToTop) ? themePlugins.backToTop : {},\n )\n : [],\n\n // @vuepress/plugin-copy-code\n (themePlugins.copyCode ?? true)\n ? copyCodePlugin({\n ...(isPlainObject(themePlugins.copyCode)\n ? themePlugins.copyCode\n : {}),\n })\n : [],\n\n // @vuepress/plugin-markdown-container\n (themePlugins.hint ?? true)\n ? markdownHintPlugin({\n locales: resolveMarkdownHintLocales(localeOptions),\n ...(isPlainObject(themePlugins.hint) ? themePlugins.hint : {}),\n })\n : [],\n\n // @vuepress/plugin-git\n (themePlugins.git ?? true)\n ? gitPlugin({\n createdTime: false,\n updatedTime: localeOptions.lastUpdated ?? true,\n changelog: { repoUrl: localeOptions.repo || '' },\n ...(isPlainObject(themePlugins.git) ? themePlugins.git : {}),\n })\n : [],\n\n // @vuepress/plugin-links-check\n (themePlugins.linksCheck ?? true)\n ? linksCheckPlugin(\n isPlainObject(themePlugins.linksCheck)\n ? themePlugins.linksCheck\n : {},\n )\n : [],\n\n // @vuepress/plugin-medium-zoom\n (themePlugins.mediumZoom ?? true) ? mediumZoomPlugin() : [],\n\n // @vuepress/plugin-nprogress\n (themePlugins.nprogress ?? true) ? nprogressPlugin() : [],\n\n // @vuepress/plugin-palette\n palettePlugin({ preset: 'sass' }),\n\n // @vuepress/plugin-prismjs\n (themePlugins.prismjs ?? true)\n ? prismjsPlugin(\n isPlainObject(themePlugins.prismjs) ? themePlugins.prismjs : {},\n )\n : [],\n\n // @vuepress/plugin-seo\n hostname && (themePlugins.seo ?? true)\n ? seoPlugin({\n hostname,\n ...(isPlainObject(themePlugins.seo) ? themePlugins.seo : {}),\n })\n : [],\n\n // @vuepress/plugin-sitemap\n hostname && (themePlugins.sitemap ?? true)\n ? sitemapPlugin({\n hostname,\n ...(isPlainObject(themePlugins.sitemap)\n ? themePlugins.sitemap\n : {}),\n })\n : [],\n\n // @vuepress/plugin-markdown-tab\n (themePlugins.tab ?? true)\n ? markdownTabPlugin(\n isPlainObject(themePlugins.tab)\n ? themePlugins.tab\n : { codeTabs: true, tabs: true },\n )\n : [],\n\n // @vuepress/plugin-theme-data\n themeDataPlugin({ themeData: localeOptions }),\n ],\n }\n}\n"],"mappings":"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"}