@vuepress/theme-default 2.0.0-rc.123 → 2.0.0-rc.125
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 → dist}/client/components/VPHomeHero.vue +7 -14
- package/{lib → dist}/client/components/VPNavbar.vue +8 -11
- package/{lib → dist}/client/components/VPNavbarBrand.vue +4 -5
- package/dist/client/composables/index.d.ts +12 -0
- package/dist/client/composables/index.js +1 -0
- package/dist/client/composables/useDarkMode.d.ts +2 -0
- package/dist/client/composables/useDarkMode.js +2 -0
- package/dist/client/composables/useDarkMode.js.map +1 -0
- package/dist/client/composables/useData.d.ts +2 -0
- package/dist/client/composables/useData.js +2 -0
- package/dist/client/composables/useData.js.map +1 -0
- package/dist/client/composables/useEditLink.d.ts +2 -0
- package/dist/client/composables/useEditLink.js +2 -0
- package/dist/client/composables/useEditLink.js.map +1 -0
- package/dist/client/composables/useHeaders.d.ts +18 -0
- package/dist/client/composables/useHeaders.js +2 -0
- package/dist/client/composables/useHeaders.js.map +1 -0
- package/dist/client/composables/useNavbarConfig.d.ts +2 -0
- package/dist/client/composables/useNavbarConfig.js +2 -0
- package/dist/client/composables/useNavbarConfig.js.map +1 -0
- package/dist/client/composables/useNavbarRepo.d.ts +2 -0
- package/dist/client/composables/useNavbarRepo.js +2 -0
- package/dist/client/composables/useNavbarRepo.js.map +1 -0
- package/dist/client/composables/useNavbarSelectLanguage.d.ts +2 -0
- package/dist/client/composables/useNavbarSelectLanguage.js +2 -0
- package/dist/client/composables/useNavbarSelectLanguage.js.map +1 -0
- package/dist/client/composables/useNavigate.d.ts +2 -0
- package/dist/client/composables/useNavigate.js +2 -0
- package/dist/client/composables/useNavigate.js.map +1 -0
- package/dist/client/composables/useRelatedLinks.d.ts +2 -0
- package/dist/client/composables/useRelatedLinks.js +2 -0
- package/dist/client/composables/useRelatedLinks.js.map +1 -0
- package/dist/client/composables/useScrollPromise.d.ts +2 -0
- package/dist/client/composables/useScrollPromise.js +2 -0
- package/dist/client/composables/useScrollPromise.js.map +1 -0
- package/dist/client/composables/useSidebarItems.d.ts +2 -0
- package/dist/client/composables/useSidebarItems.js +2 -0
- package/dist/client/composables/useSidebarItems.js.map +1 -0
- package/dist/client/composables/useUpdateDeviceStatus.d.ts +2 -0
- package/dist/client/composables/useUpdateDeviceStatus.js +2 -0
- package/dist/client/composables/useUpdateDeviceStatus.js.map +1 -0
- package/dist/client/config.d.ts +6 -0
- package/dist/client/config.js +2 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/index.d.ts +21 -0
- package/dist/client/index.js +1 -0
- package/{lib → dist}/client/layouts/Layout.vue +2 -5
- package/{lib → dist}/client/layouts/NotFound.vue +1 -2
- package/{lib → dist}/client/styles/arrow.scss +1 -2
- package/{lib → dist}/client/styles/vars.scss +1 -2
- package/dist/client/utils/index.d.ts +6 -0
- package/dist/client/utils/index.js +1 -0
- package/dist/client/utils/isActiveSidebarItem.d.ts +2 -0
- package/dist/client/utils/isActiveSidebarItem.js +2 -0
- package/dist/client/utils/isActiveSidebarItem.js.map +1 -0
- package/dist/client/utils/resolveAutoLink.d.ts +2 -0
- package/dist/client/utils/resolveAutoLink.js +2 -0
- package/dist/client/utils/resolveAutoLink.js.map +1 -0
- package/dist/client/utils/resolveEditLink.d.ts +2 -0
- package/dist/client/utils/resolveEditLink.js +2 -0
- package/dist/client/utils/resolveEditLink.js.map +1 -0
- package/dist/client/utils/resolvePrefix.d.ts +2 -0
- package/dist/client/utils/resolvePrefix.js +2 -0
- package/dist/client/utils/resolvePrefix.js.map +1 -0
- package/dist/client/utils/resolveRepoType.d.ts +2 -0
- package/dist/client/utils/resolveRepoType.js +2 -0
- package/dist/client/utils/resolveRepoType.js.map +1 -0
- package/dist/isActiveSidebarItem-aythFTeC.d.ts +8 -0
- package/dist/nav-DikslSJ_.d.ts +36 -0
- package/dist/node/index.d.ts +108 -0
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -0
- package/dist/page-FWcDnzJp.d.ts +292 -0
- package/{lib/client/utils/resolveAutoLink.d.ts → dist/resolveAutoLink-BR2Z05MD.d.ts} +7 -2
- package/dist/resolveEditLink-DazcWeGf.d.ts +20 -0
- package/dist/resolvePrefix-BN9K9RA5.d.ts +5 -0
- package/dist/resolveRepoType-Wcj35_rs.d.ts +6 -0
- package/dist/sidebar-CF1YPYLN.d.ts +53 -0
- package/dist/typings-NbQSzbOn.d.ts +19 -0
- package/dist/useDarkMode-DLor2cV7.d.ts +19 -0
- package/dist/useData-JDen_Bxm.d.ts +13 -0
- package/dist/useEditLink-DPCTvXmM.d.ts +8 -0
- package/dist/useNavbarConfig-C19TGFg7.d.ts +8 -0
- package/dist/useNavbarRepo-DxhSIAFq.d.ts +13 -0
- package/dist/useNavbarSelectLanguage-4GkrPvc2.d.ts +13 -0
- package/dist/useNavigate-lH4xyHOV.d.ts +5 -0
- package/dist/useRelatedLinks-ChTW2RRU.d.ts +12 -0
- package/dist/useScrollPromise-BAl732Uv.d.ts +10 -0
- package/dist/useSidebarItems-CdpB96Ta.d.ts +80 -0
- package/dist/useUpdateDeviceStatus-SBnOZx8J.d.ts +14 -0
- package/package.json +39 -30
- package/lib/client/components/global/index.d.ts +0 -2
- package/lib/client/components/global/index.js +0 -2
- package/lib/client/composables/index.d.ts +0 -11
- package/lib/client/composables/index.js +0 -11
- package/lib/client/composables/useDarkMode.d.ts +0 -14
- package/lib/client/composables/useDarkMode.js +0 -64
- package/lib/client/composables/useData.d.ts +0 -8
- package/lib/client/composables/useData.js +0 -7
- package/lib/client/composables/useEditLink.d.ts +0 -3
- package/lib/client/composables/useEditLink.js +0 -28
- package/lib/client/composables/useHeaders.d.ts +0 -13
- package/lib/client/composables/useHeaders.js +0 -42
- package/lib/client/composables/useNavbarConfig.d.ts +0 -3
- package/lib/client/composables/useNavbarConfig.js +0 -27
- package/lib/client/composables/useNavbarRepo.d.ts +0 -8
- package/lib/client/composables/useNavbarRepo.js +0 -40
- package/lib/client/composables/useNavbarSelectLanguage.d.ts +0 -8
- package/lib/client/composables/useNavbarSelectLanguage.js +0 -60
- package/lib/client/composables/useNavigate.d.ts +0 -1
- package/lib/client/composables/useNavigate.js +0 -22
- package/lib/client/composables/useRelatedLinks.d.ts +0 -8
- package/lib/client/composables/useRelatedLinks.js +0 -95
- package/lib/client/composables/useScrollPromise.d.ts +0 -6
- package/lib/client/composables/useScrollPromise.js +0 -16
- package/lib/client/composables/useSidebarItems.d.ts +0 -75
- package/lib/client/composables/useSidebarItems.js +0 -164
- package/lib/client/composables/useUpdateDeviceStatus.d.ts +0 -10
- package/lib/client/composables/useUpdateDeviceStatus.js +0 -34
- package/lib/client/config.d.ts +0 -5
- package/lib/client/config.js +0 -35
- package/lib/client/index.d.ts +0 -4
- package/lib/client/index.js +0 -2
- package/lib/client/typings.d.ts +0 -13
- package/lib/client/typings.js +0 -1
- package/lib/client/utils/index.d.ts +0 -5
- package/lib/client/utils/index.js +0 -5
- package/lib/client/utils/isActiveSidebarItem.d.ts +0 -3
- package/lib/client/utils/isActiveSidebarItem.js +0 -20
- package/lib/client/utils/resolveAutoLink.js +0 -23
- package/lib/client/utils/resolveEditLink.d.ts +0 -9
- package/lib/client/utils/resolveEditLink.js +0 -29
- package/lib/client/utils/resolvePrefix.d.ts +0 -1
- package/lib/client/utils/resolvePrefix.js +0 -4
- package/lib/client/utils/resolveRepoType.d.ts +0 -2
- package/lib/client/utils/resolveRepoType.js +0 -12
- package/lib/node/defaultTheme.d.ts +0 -15
- package/lib/node/defaultTheme.js +0 -140
- package/lib/node/index.d.ts +0 -4
- package/lib/node/index.js +0 -2
- package/lib/node/typings.d.ts +0 -59
- package/lib/node/typings.js +0 -1
- package/lib/node/utils/assignDefaultLocaleOptions.d.ts +0 -7
- package/lib/node/utils/assignDefaultLocaleOptions.js +0 -51
- package/lib/node/utils/index.d.ts +0 -2
- package/lib/node/utils/index.js +0 -2
- package/lib/node/utils/resolveMarkdownHintLocales.d.ts +0 -12
- package/lib/node/utils/resolveMarkdownHintLocales.js +0 -22
- package/lib/shared/index.d.ts +0 -5
- package/lib/shared/index.js +0 -1
- package/lib/shared/nav.d.ts +0 -32
- package/lib/shared/nav.js +0 -1
- package/lib/shared/navbar.d.ts +0 -21
- package/lib/shared/navbar.js +0 -1
- package/lib/shared/options.d.ts +0 -244
- package/lib/shared/options.js +0 -1
- package/lib/shared/page.d.ts +0 -44
- package/lib/shared/page.js +0 -1
- package/lib/shared/sidebar.d.ts +0 -26
- package/lib/shared/sidebar.js +0 -1
- /package/{lib → dist}/client/components/VPAutoLink.vue +0 -0
- /package/{lib → dist}/client/components/VPDarkIcon.vue +0 -0
- /package/{lib → dist}/client/components/VPDropdownTransition.vue +0 -0
- /package/{lib → dist}/client/components/VPEditIcon.vue +0 -0
- /package/{lib → dist}/client/components/VPFadeSlideYTransition.vue +0 -0
- /package/{lib → dist}/client/components/VPHome.vue +0 -0
- /package/{lib → dist}/client/components/VPHomeFeatures.vue +0 -0
- /package/{lib → dist}/client/components/VPHomeFooter.vue +0 -0
- /package/{lib → dist}/client/components/VPLightIcon.vue +0 -0
- /package/{lib → dist}/client/components/VPNavbarDropdown.vue +0 -0
- /package/{lib → dist}/client/components/VPNavbarItems.vue +0 -0
- /package/{lib → dist}/client/components/VPPage.vue +0 -0
- /package/{lib → dist}/client/components/VPPageMeta.vue +0 -0
- /package/{lib → dist}/client/components/VPPageNav.vue +0 -0
- /package/{lib → dist}/client/components/VPSidebar.vue +0 -0
- /package/{lib → dist}/client/components/VPSidebarItem.vue +0 -0
- /package/{lib → dist}/client/components/VPSidebarItems.vue +0 -0
- /package/{lib → dist}/client/components/VPToggleColorModeButton.vue +0 -0
- /package/{lib → dist}/client/components/VPToggleSidebarButton.vue +0 -0
- /package/{lib → dist}/client/components/global/Badge.vue +0 -0
- /package/{lib → dist}/client/shim.d.ts +0 -0
- /package/{lib → dist}/client/styles/_mixins.scss +0 -0
- /package/{lib → dist}/client/styles/_variables.module.scss +0 -0
- /package/{lib → dist}/client/styles/_variables.scss +0 -0
- /package/{lib → dist}/client/styles/code-group.scss +0 -0
- /package/{lib → dist}/client/styles/content/code.scss +0 -0
- /package/{lib → dist}/client/styles/content/index.scss +0 -0
- /package/{lib → dist}/client/styles/content/normalize.scss +0 -0
- /package/{lib → dist}/client/styles/content/toc.scss +0 -0
- /package/{lib → dist}/client/styles/external-link-icon.scss +0 -0
- /package/{lib → dist}/client/styles/index.scss +0 -0
- /package/{lib → dist}/client/styles/layout.scss +0 -0
- /package/{lib → dist}/client/styles/normalize.scss +0 -0
- /package/{lib → dist}/client/styles/plugins.scss +0 -0
- /package/{lib → dist}/client/styles/vars-dark.scss +0 -0
|
@@ -12,16 +12,13 @@ const isDarkMode = useDarkMode()
|
|
|
12
12
|
|
|
13
13
|
const heroText = computed(() => {
|
|
14
14
|
// oxlint-disable-next-line eqeqeq
|
|
15
|
-
if (frontmatter.value.heroText === null)
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
if (frontmatter.value.heroText === null) return null
|
|
16
|
+
|
|
18
17
|
return frontmatter.value.heroText || siteLocale.value.title || 'Hello'
|
|
19
18
|
})
|
|
20
19
|
const tagline = computed(() => {
|
|
21
20
|
// oxlint-disable-next-line eqeqeq
|
|
22
|
-
if (frontmatter.value.tagline === null)
|
|
23
|
-
return null
|
|
24
|
-
}
|
|
21
|
+
if (frontmatter.value.tagline === null) return null
|
|
25
22
|
|
|
26
23
|
return (
|
|
27
24
|
frontmatter.value.tagline ||
|
|
@@ -30,9 +27,9 @@ const tagline = computed(() => {
|
|
|
30
27
|
)
|
|
31
28
|
})
|
|
32
29
|
const heroImage = computed(() => {
|
|
33
|
-
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined)
|
|
30
|
+
if (isDarkMode.value && frontmatter.value.heroImageDark !== undefined)
|
|
34
31
|
return frontmatter.value.heroImageDark
|
|
35
|
-
|
|
32
|
+
|
|
36
33
|
return frontmatter.value.heroImage
|
|
37
34
|
})
|
|
38
35
|
const heroAlt = computed(
|
|
@@ -41,9 +38,7 @@ const heroAlt = computed(
|
|
|
41
38
|
const heroHeight = computed(() => frontmatter.value.heroHeight ?? 280)
|
|
42
39
|
|
|
43
40
|
const actions = computed(() => {
|
|
44
|
-
if (!Array.isArray(frontmatter.value.actions))
|
|
45
|
-
return []
|
|
46
|
-
}
|
|
41
|
+
if (!Array.isArray(frontmatter.value.actions)) return []
|
|
47
42
|
|
|
48
43
|
return frontmatter.value.actions.map(({ type = 'primary', ...rest }) => ({
|
|
49
44
|
type,
|
|
@@ -61,9 +56,7 @@ const HomeHeroImage: FunctionalComponent = () => {
|
|
|
61
56
|
height: heroHeight.value,
|
|
62
57
|
})
|
|
63
58
|
|
|
64
|
-
if (frontmatter.value.heroImageDark === undefined)
|
|
65
|
-
return img
|
|
66
|
-
}
|
|
59
|
+
if (frontmatter.value.heroImageDark === undefined) return img
|
|
67
60
|
|
|
68
61
|
// wrap hero image with <ClientOnly> to avoid ssr-mismatch
|
|
69
62
|
// when using a different hero image in dark mode
|
|
@@ -29,9 +29,8 @@ const navbarBrand = useTemplateRef<HTMLElement | null>('navbar-brand')
|
|
|
29
29
|
|
|
30
30
|
const linksWrapperMaxWidth = ref(0)
|
|
31
31
|
const linksWrapperStyle = computed(() => {
|
|
32
|
-
if (!linksWrapperMaxWidth.value) {
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
if (!linksWrapperMaxWidth.value) return {}
|
|
33
|
+
|
|
35
34
|
return {
|
|
36
35
|
maxWidth: `${linksWrapperMaxWidth.value}px`,
|
|
37
36
|
}
|
|
@@ -55,14 +54,12 @@ useUpdateDeviceStatus(
|
|
|
55
54
|
const navbarHorizontalPadding =
|
|
56
55
|
getCssValue(navbar.value, 'paddingLeft') +
|
|
57
56
|
getCssValue(navbar.value, 'paddingRight')
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
(navbarBrand.value?.offsetWidth ?? 0)
|
|
65
|
-
}
|
|
57
|
+
linksWrapperMaxWidth.value =
|
|
58
|
+
window.innerWidth < mobileDesktopBreakpoint
|
|
59
|
+
? 0
|
|
60
|
+
: navbar.value!.offsetWidth -
|
|
61
|
+
navbarHorizontalPadding -
|
|
62
|
+
(navbarBrand.value?.offsetWidth ?? 0)
|
|
66
63
|
},
|
|
67
64
|
)
|
|
68
65
|
</script>
|
|
@@ -13,9 +13,9 @@ const navbarBrandLink = computed(
|
|
|
13
13
|
)
|
|
14
14
|
const navbarBrandTitle = computed(() => siteLocale.value.title)
|
|
15
15
|
const navbarBrandLogo = computed(() => {
|
|
16
|
-
if (isDarkMode.value && themeLocale.value.logoDark !== undefined)
|
|
16
|
+
if (isDarkMode.value && themeLocale.value.logoDark !== undefined)
|
|
17
17
|
return themeLocale.value.logoDark
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
return themeLocale.value.logo
|
|
20
20
|
})
|
|
21
21
|
const navbarBrandLogoAlt = computed(
|
|
@@ -33,9 +33,8 @@ const NavbarBrandLogo: FunctionalComponent = () => {
|
|
|
33
33
|
src: withBase(navbarBrandLogo.value),
|
|
34
34
|
alt: navbarBrandLogoAlt.value,
|
|
35
35
|
})
|
|
36
|
-
if (themeLocale.value.logoDark === undefined)
|
|
37
|
-
|
|
38
|
-
}
|
|
36
|
+
if (themeLocale.value.logoDark === undefined) return img
|
|
37
|
+
|
|
39
38
|
// wrap brand logo with <ClientOnly> to avoid ssr-mismatch
|
|
40
39
|
// when using a different brand logo in dark mode
|
|
41
40
|
return h(ClientOnly, () => img)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { n as setupDarkMode, r as useDarkMode, t as DarkModeRef } from "../../useDarkMode-DLor2cV7.js";
|
|
2
|
+
import { n as useData, t as Data } from "../../useData-JDen_Bxm.js";
|
|
3
|
+
import { t as useEditLink } from "../../useEditLink-DPCTvXmM.js";
|
|
4
|
+
import { t as useNavigate } from "../../useNavigate-lH4xyHOV.js";
|
|
5
|
+
import { t as useNavbarConfig } from "../../useNavbarConfig-C19TGFg7.js";
|
|
6
|
+
import { t as useNavbarRepo } from "../../useNavbarRepo-DxhSIAFq.js";
|
|
7
|
+
import { t as useNavbarSelectLanguage } from "../../useNavbarSelectLanguage-4GkrPvc2.js";
|
|
8
|
+
import { t as useRelatedLinks } from "../../useRelatedLinks-ChTW2RRU.js";
|
|
9
|
+
import { n as useScrollPromise, t as ScrollPromise } from "../../useScrollPromise-BAl732Uv.js";
|
|
10
|
+
import { a as resolveSidebarItems, c as setupSidebarItems, i as resolveSidebarHeadingItem, l as sidebarItemsSymbol, n as resolveArraySidebarItems, o as resolveSidebarPageHeader, r as resolveMultiSidebarItems, s as resolveSidebarPageHeaders, t as SidebarItemsRef, u as useSidebarItems } from "../../useSidebarItems-CdpB96Ta.js";
|
|
11
|
+
import { n as useUpdateDeviceStatus, t as DeviceType } from "../../useUpdateDeviceStatus-SBnOZx8J.js";
|
|
12
|
+
export { DarkModeRef, Data, DeviceType, ScrollPromise, SidebarItemsRef, resolveArraySidebarItems, resolveMultiSidebarItems, resolveSidebarHeadingItem, resolveSidebarItems, resolveSidebarPageHeader, resolveSidebarPageHeaders, setupDarkMode, setupSidebarItems, sidebarItemsSymbol, useDarkMode, useData, useEditLink, useNavbarConfig, useNavbarRepo, useNavbarSelectLanguage, useNavigate, useRelatedLinks, useScrollPromise, useSidebarItems, useUpdateDeviceStatus };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{setupDarkMode as e,useDarkMode as t}from"./useDarkMode.js";import{useData as n}from"./useData.js";import{useEditLink as r}from"./useEditLink.js";import{useNavigate as i}from"./useNavigate.js";import{useNavbarConfig as a}from"./useNavbarConfig.js";import{useNavbarRepo as o}from"./useNavbarRepo.js";import{useNavbarSelectLanguage as s}from"./useNavbarSelectLanguage.js";import{useRelatedLinks as c}from"./useRelatedLinks.js";import{useScrollPromise as l}from"./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"./useSidebarItems.js";import{DeviceType as y,useUpdateDeviceStatus as b}from"./useUpdateDeviceStatus.js";export{y as DeviceType,u as resolveArraySidebarItems,d as resolveMultiSidebarItems,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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{darkModeSymbol as e}from"@vuepress/helper/client";import{useData as t}from"@theme/useData";import{usePreferredDark as n,useStorage as r,watchImmediate as i}from"@vueuse/core";import{computed as a,inject as o,onMounted as s,onUnmounted as c,provide as l}from"vue";const u=e=>{let t=globalThis.document.documentElement;t.dataset.theme=e?`dark`:`light`},d=e=>{s(()=>{i(e,u)}),c(()=>{u(e.value)})},f=()=>{let t=o(e);if(!t)throw Error(`useDarkMode() is called without provider.`);return t},p=()=>{let{themeLocale:i}=t(),o=n(),s=r(`vuepress-color-scheme`,i.value.colorMode),c=a({get(){return i.value.colorModeSwitch?s.value===`auto`?o.value:s.value===`dark`:i.value.colorMode===`dark`},set(e){e===o.value?s.value=`auto`:s.value=e?`dark`:`light`}});l(e,c),d(c)};export{p as setupDarkMode,f as useDarkMode};
|
|
2
|
+
//# sourceMappingURL=useDarkMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDarkMode.js","names":[],"sources":["../../../src/client/composables/useDarkMode.ts"],"sourcesContent":["import { useData } from '@theme/useData'\nimport { darkModeSymbol } from '@vuepress/helper/client'\nimport { usePreferredDark, useStorage, watchImmediate } from '@vueuse/core'\nimport type { WritableComputedRef } from 'vue'\nimport { computed, inject, onMounted, onUnmounted, provide } from 'vue'\n\nexport type DarkModeRef = WritableComputedRef<boolean>\n\nconst update = (value: boolean): void => {\n // set `class=\"dark\"` on `<html>` element\n const el = globalThis.document.documentElement\n\n // set `data-theme=\"light|dark\"` on `<html>` element\n el.dataset.theme = value ? 'dark' : 'light'\n}\n\nconst applyDarkModeToHTML = (isDarkMode: DarkModeRef): void => {\n onMounted(() => {\n watchImmediate(isDarkMode, update)\n })\n\n onUnmounted(() => {\n update(isDarkMode.value)\n })\n}\n\n/**\n * Inject dark mode global computed\n *\n * 注入暗色模式全局计算属性\n *\n * @returns Dark mode ref / 暗色模式引用\n */\nexport const useDarkMode = (): DarkModeRef => {\n const isDarkMode = inject<WritableComputedRef<boolean>>(darkModeSymbol)\n if (!isDarkMode) throw new Error('useDarkMode() is called without provider.')\n\n return isDarkMode\n}\n\n/**\n * Create dark mode ref and provide as global computed in setup\n */\nexport const setupDarkMode = (): void => {\n const { themeLocale } = useData()\n const isDarkPreferred = usePreferredDark()\n const darkStorage = useStorage(\n 'vuepress-color-scheme',\n themeLocale.value.colorMode,\n )\n\n const isDarkMode = computed<boolean>({\n get() {\n // disable color mode switching\n if (!themeLocale.value.colorModeSwitch)\n return themeLocale.value.colorMode === 'dark'\n\n // auto detected from prefers-color-scheme\n if (darkStorage.value === 'auto') return isDarkPreferred.value\n\n // storage value\n return darkStorage.value === 'dark'\n },\n set(val) {\n if (val === isDarkPreferred.value) darkStorage.value = 'auto'\n else darkStorage.value = val ? 'dark' : 'light'\n },\n })\n provide(darkModeSymbol, isDarkMode)\n\n applyDarkModeToHTML(isDarkMode)\n}\n"],"mappings":"8QAQA,MAAM,EAAU,GAAyB,CAEvC,IAAM,EAAK,WAAW,SAAS,gBAG/B,EAAG,QAAQ,MAAQ,EAAQ,OAAS,SAGhC,EAAuB,GAAkC,CAC7D,MAAgB,CACd,EAAe,EAAY,EAAO,EAClC,CAEF,MAAkB,CAChB,EAAO,EAAW,MAAM,EACxB,EAUS,MAAiC,CAC5C,IAAM,EAAa,EAAqC,EAAe,CACvE,GAAI,CAAC,EAAY,MAAU,MAAM,4CAA4C,CAE7E,OAAO,GAMI,MAA4B,CACvC,GAAM,CAAE,eAAgB,GAAS,CAC3B,EAAkB,GAAkB,CACpC,EAAc,EAClB,wBACA,EAAY,MAAM,UACnB,CAEK,EAAa,EAAkB,CACnC,KAAM,CASJ,OAPK,EAAY,MAAM,gBAInB,EAAY,QAAU,OAAe,EAAgB,MAGlD,EAAY,QAAU,OANpB,EAAY,MAAM,YAAc,QAQ3C,IAAI,EAAK,CACH,IAAQ,EAAgB,MAAO,EAAY,MAAQ,OAClD,EAAY,MAAQ,EAAM,OAAS,SAE3C,CAAC,CACF,EAAQ,EAAgB,EAAW,CAEnC,EAAoB,EAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useData.js","names":["_useData"],"sources":["../../../src/client/composables/useData.ts"],"sourcesContent":["import type {\n ThemeDataRef,\n ThemeLocaleDataRef,\n} from '@vuepress/plugin-theme-data/client'\nimport {\n useThemeData,\n useThemeLocaleData,\n} from '@vuepress/plugin-theme-data/client'\nimport type { ClientData } from 'vuepress/client'\nimport { useData as _useData } from 'vuepress/client'\nimport type {\n DefaultThemeData,\n DefaultThemeNormalPageFrontmatter,\n DefaultThemePageData,\n} from '../../shared/index.js'\n\nexport interface Data<\n PageFrontmatter extends Record<string, unknown> =\n DefaultThemeNormalPageFrontmatter,\n PageData extends Record<string, unknown> = DefaultThemePageData,\n> extends Pick<\n ClientData<PageFrontmatter, PageData>,\n | 'frontmatter'\n | 'head'\n | 'headTitle'\n | 'lang'\n | 'layouts'\n | 'page'\n | 'pageComponent'\n | 'pageLayout'\n | 'redirects'\n | 'routeLocale'\n | 'routePath'\n | 'routes'\n | 'site'\n | 'siteLocale'\n> {\n theme: ThemeDataRef<DefaultThemeData>\n themeLocale: ThemeLocaleDataRef<DefaultThemeData>\n}\n\nexport const useData = <\n PageFrontmatter extends Record<string, unknown> =\n DefaultThemeNormalPageFrontmatter,\n PageData extends Record<string, unknown> = DefaultThemePageData,\n>(): Data<PageFrontmatter, PageData> => ({\n ..._useData<PageFrontmatter, PageData>(),\n theme: useThemeData<DefaultThemeData>(),\n themeLocale: useThemeLocaleData<DefaultThemeData>(),\n})\n"],"mappings":"oIAyCA,MAAa,OAI4B,CACvC,GAAGA,GAAqC,CACxC,MAAO,GAAgC,CACvC,YAAa,GAAsC,CACpD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useData as e}from"@theme/useData";import{computed as t}from"vue";import{resolveEditLink as n}from"@theme/resolveEditLink";const r=()=>{let{frontmatter:r,page:i,themeLocale:a}=e();return t(()=>{if(!(r.value.editLink??a.value.editLink??!0))return null;let{repo:e,docsRepo:t=e,docsBranch:o=`main`,docsDir:s=``,editLinkText:c}=a.value;if(!t)return null;let l=n({docsRepo:t,docsBranch:o,docsDir:s,filePathRelative:i.value.filePathRelative,editLinkPattern:r.value.editLinkPattern??a.value.editLinkPattern});return l?{text:c??`Edit this page`,link:l}:null})};export{r as useEditLink};
|
|
2
|
+
//# sourceMappingURL=useEditLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditLink.js","names":[],"sources":["../../../src/client/composables/useEditLink.ts"],"sourcesContent":["import { resolveEditLink } from '@theme/resolveEditLink'\nimport { useData } from '@theme/useData'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport type { AutoLinkConfig } from 'vuepress/client'\n\nexport const useEditLink = (): ComputedRef<AutoLinkConfig | null> => {\n const { frontmatter, page, themeLocale } = useData()\n\n return computed(() => {\n const showEditLink =\n frontmatter.value.editLink ?? themeLocale.value.editLink ?? true\n if (!showEditLink) return null\n\n const {\n repo,\n docsRepo = repo,\n docsBranch = 'main',\n docsDir = '',\n editLinkText,\n } = themeLocale.value\n\n if (!docsRepo) return null\n\n const editLink = resolveEditLink({\n docsRepo,\n docsBranch,\n docsDir,\n filePathRelative: page.value.filePathRelative,\n editLinkPattern:\n frontmatter.value.editLinkPattern ?? themeLocale.value.editLinkPattern,\n })\n\n if (!editLink) return null\n\n return {\n text: editLinkText ?? 'Edit this page',\n link: editLink,\n }\n })\n}\n"],"mappings":"iIAMA,MAAa,MAAwD,CACnE,GAAM,CAAE,cAAa,OAAM,eAAgB,GAAS,CAEpD,OAAO,MAAe,CAGpB,GAAI,EADF,EAAY,MAAM,UAAY,EAAY,MAAM,UAAY,IAC3C,OAAO,KAE1B,GAAM,CACJ,OACA,WAAW,EACX,aAAa,OACb,UAAU,GACV,gBACE,EAAY,MAEhB,GAAI,CAAC,EAAU,OAAO,KAEtB,IAAM,EAAW,EAAgB,CAC/B,WACA,aACA,UACA,iBAAkB,EAAK,MAAM,iBAC7B,gBACE,EAAY,MAAM,iBAAmB,EAAY,MAAM,gBAC1D,CAAC,CAIF,OAFK,EAEE,CACL,KAAM,GAAgB,iBACtB,KAAM,EACP,CALqB,MAMtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HeaderItem } from "@vuepress/helper/client";
|
|
2
|
+
import { InjectionKey, Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/client/composables/useHeaders.d.ts
|
|
5
|
+
type HeadersRef = Ref<HeaderItem[]>;
|
|
6
|
+
declare const headersSymbol: InjectionKey<HeadersRef>;
|
|
7
|
+
/**
|
|
8
|
+
* Inject headers
|
|
9
|
+
*
|
|
10
|
+
* 注入标题
|
|
11
|
+
*
|
|
12
|
+
* @returns Headers ref / 标题引用
|
|
13
|
+
*/
|
|
14
|
+
declare const useHeaders: () => HeadersRef;
|
|
15
|
+
declare const setupHeaders: () => void;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { HeadersRef, headersSymbol, setupHeaders, useHeaders };
|
|
18
|
+
//# sourceMappingURL=useHeaders.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getHeaders as e}from"@vuepress/helper/client";import{onContentUpdated as t}from"vuepress/client";import{useData as n}from"@theme/useData";import{injectLocal as r,provideLocal as i}from"@vueuse/core";import{computed as a,ref as o}from"vue";const s=Symbol(`headers`),c=()=>{let e=r(s);if(!e)throw Error(`useHeaders() is called without provider.`);return e},l=()=>{let{frontmatter:r,themeLocale:c}=n(),l=o([]),u=a(()=>r.value.sidebarDepth??c.value.sidebarDepth??2),d=()=>{if(u.value<=0){l.value=[];return}l.value=e({levels:[2,u.value+1],ignore:[`.vp-badge`]})};i(s,l),t(e=>{e===`beforeUnmount`?l.value=[]:d()})};export{s as headersSymbol,l as setupHeaders,c as useHeaders};
|
|
2
|
+
//# sourceMappingURL=useHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeaders.js","names":["useData"],"sources":["../../../src/client/composables/useHeaders.ts"],"sourcesContent":["import { useData } from '@theme/useData'\nimport type { HeaderItem } from '@vuepress/helper/client'\nimport { getHeaders } from '@vuepress/helper/client'\nimport { injectLocal, provideLocal } from '@vueuse/core'\nimport type { InjectionKey, Ref } from 'vue'\nimport { computed, ref } from 'vue'\nimport { onContentUpdated } from 'vuepress/client'\n\nexport type HeadersRef = Ref<HeaderItem[]>\n\nexport const headersSymbol: InjectionKey<HeadersRef> = Symbol('headers')\n\n/**\n * Inject headers\n *\n * 注入标题\n *\n * @returns Headers ref / 标题引用\n */\nexport const useHeaders = (): HeadersRef => {\n const headers = injectLocal(headersSymbol)\n\n if (!headers) throw new Error('useHeaders() is called without provider.')\n\n return headers\n}\n\nexport const setupHeaders = (): void => {\n const { frontmatter, themeLocale } = useData()\n\n const headersRef: HeadersRef = ref([])\n const levels = computed(\n () => frontmatter.value.sidebarDepth ?? themeLocale.value.sidebarDepth ?? 2,\n )\n\n const updateHeaders = (): void => {\n if (levels.value <= 0) {\n headersRef.value = []\n return\n }\n\n headersRef.value = getHeaders({\n levels: [2, levels.value + 1],\n ignore: ['.vp-badge'],\n })\n }\n\n provideLocal(headersSymbol, headersRef)\n\n onContentUpdated((reason) => {\n if (reason === 'beforeUnmount') headersRef.value = []\n else updateHeaders()\n })\n}\n"],"mappings":"sPAUA,MAAa,EAA0C,OAAO,UAAU,CAS3D,MAA+B,CAC1C,IAAM,EAAU,EAAY,EAAc,CAE1C,GAAI,CAAC,EAAS,MAAU,MAAM,2CAA2C,CAEzE,OAAO,GAGI,MAA2B,CACtC,GAAM,CAAE,cAAa,eAAgBA,GAAS,CAExC,EAAyB,EAAI,EAAE,CAAC,CAChC,EAAS,MACP,EAAY,MAAM,cAAgB,EAAY,MAAM,cAAgB,EAC3E,CAEK,MAA4B,CAChC,GAAI,EAAO,OAAS,EAAG,CACrB,EAAW,MAAQ,EAAE,CACrB,OAGF,EAAW,MAAQ,EAAW,CAC5B,OAAQ,CAAC,EAAG,EAAO,MAAQ,EAAE,CAC7B,OAAQ,CAAC,YAAY,CACtB,CAAC,EAGJ,EAAa,EAAe,EAAW,CAEvC,EAAkB,GAAW,CACvB,IAAW,gBAAiB,EAAW,MAAQ,EAAE,CAChD,GAAe,EACpB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isString as e}from"vuepress/shared";import{isLinkRelative as t}from"@vuepress/helper/client";import{useData as n}from"@theme/useData";import{computed as r}from"vue";import{resolveAutoLink as i}from"@theme/resolveAutoLink";import{resolvePrefix as a}from"@theme/resolvePrefix";const o=(n,r=``)=>e(n)?i(a(r,n)):`children`in n?{...n,children:n.children.map(e=>o(e,a(r,n.prefix)))}:{...n,link:t(n.link)?i(a(r,n.link)).link:n.link},s=()=>{let{themeLocale:e}=n();return r(()=>(e.value.navbar||[]).map(e=>o(e)))};export{s as useNavbarConfig};
|
|
2
|
+
//# sourceMappingURL=useNavbarConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavbarConfig.js","names":[],"sources":["../../../src/client/composables/useNavbarConfig.ts"],"sourcesContent":["import { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { resolvePrefix } from '@theme/resolvePrefix'\nimport { useData } from '@theme/useData'\nimport { isLinkRelative } from '@vuepress/helper/client'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { isString } from 'vuepress/shared'\nimport type {\n NavbarGroupOptions,\n NavbarLinkOptions,\n} from '../../shared/navbar.js'\nimport type { NavbarItem } from '../typings.js'\n\nconst resolveNavbarItem = (\n item: NavbarGroupOptions | NavbarLinkOptions,\n prefix = '',\n): NavbarItem => {\n if (isString(item)) return resolveAutoLink(resolvePrefix(prefix, item))\n\n if ('children' in item) {\n return {\n ...item,\n children: item.children.map((child) =>\n resolveNavbarItem(child, resolvePrefix(prefix, item.prefix)),\n ),\n }\n }\n\n return {\n ...item,\n link: isLinkRelative(item.link)\n ? resolveAutoLink(resolvePrefix(prefix, item.link)).link\n : item.link,\n }\n}\n\nexport const useNavbarConfig = (): ComputedRef<NavbarItem[]> => {\n const { themeLocale } = useData()\n\n return computed(() =>\n (themeLocale.value.navbar || []).map((item) => resolveNavbarItem(item)),\n )\n}\n"],"mappings":"0RAaA,MAAM,GACJ,EACA,EAAS,KAEL,EAAS,EAAK,CAAS,EAAgB,EAAc,EAAQ,EAAK,CAAC,CAEnE,aAAc,EACT,CACL,GAAG,EACH,SAAU,EAAK,SAAS,IAAK,GAC3B,EAAkB,EAAO,EAAc,EAAQ,EAAK,OAAO,CAAC,CAC7D,CACF,CAGI,CACL,GAAG,EACH,KAAM,EAAe,EAAK,KAAK,CAC3B,EAAgB,EAAc,EAAQ,EAAK,KAAK,CAAC,CAAC,KAClD,EAAK,KACV,CAGU,MAAmD,CAC9D,GAAM,CAAE,eAAgB,GAAS,CAEjC,OAAO,OACJ,EAAY,MAAM,QAAU,EAAE,EAAE,IAAK,GAAS,EAAkB,EAAK,CAAC,CACxE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isLinkHttp as e}from"vuepress/shared";import{useData as t}from"@theme/useData";import{computed as n}from"vue";import{resolveRepoType as r}from"@theme/resolveRepoType";const i=()=>{let{themeLocale:i}=t(),a=n(()=>i.value.repo),o=n(()=>a.value?r(a.value):null),s=n(()=>a.value&&!e(a.value)?`https://github.com/${a.value}`:a.value),c=n(()=>s.value?i.value.repoLabel?i.value.repoLabel:o.value==null?`Source`:o.value:null);return n(()=>!s.value||!c.value?[]:[{text:c.value,link:s.value}])};export{i as useNavbarRepo};
|
|
2
|
+
//# sourceMappingURL=useNavbarRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavbarRepo.js","names":[],"sources":["../../../src/client/composables/useNavbarRepo.ts"],"sourcesContent":["import { resolveRepoType } from '@theme/resolveRepoType'\nimport { useData } from '@theme/useData'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { isLinkHttp } from 'vuepress/shared'\nimport type { NavbarItem } from '../typings.js'\n\n/**\n * Repository link in navbar\n *\n * @returns Navbar config of repository link / 仓库链接的导航栏配置\n */\nexport const useNavbarRepo = (): ComputedRef<NavbarItem[]> => {\n const { themeLocale } = useData()\n\n const repo = computed(() => themeLocale.value.repo)\n const repoType = computed(() =>\n repo.value ? resolveRepoType(repo.value) : null,\n )\n\n const repoLink = computed(() => {\n if (repo.value && !isLinkHttp(repo.value))\n return `https://github.com/${repo.value}`\n\n return repo.value\n })\n\n const repoLabel = computed(() => {\n if (!repoLink.value) return null\n if (themeLocale.value.repoLabel) return themeLocale.value.repoLabel\n if (repoType.value == null) return 'Source'\n return repoType.value\n })\n\n return computed(() => {\n if (!repoLink.value || !repoLabel.value) return []\n\n return [\n {\n text: repoLabel.value,\n link: repoLink.value,\n },\n ]\n })\n}\n"],"mappings":"8KAYA,MAAa,MAAiD,CAC5D,GAAM,CAAE,eAAgB,GAAS,CAE3B,EAAO,MAAe,EAAY,MAAM,KAAK,CAC7C,EAAW,MACf,EAAK,MAAQ,EAAgB,EAAK,MAAM,CAAG,KAC5C,CAEK,EAAW,MACX,EAAK,OAAS,CAAC,EAAW,EAAK,MAAM,CAChC,sBAAsB,EAAK,QAE7B,EAAK,MACZ,CAEI,EAAY,MACX,EAAS,MACV,EAAY,MAAM,UAAkB,EAAY,MAAM,UACtD,EAAS,OAAS,KAAa,SAC5B,EAAS,MAHY,KAI5B,CAEF,OAAO,MACD,CAAC,EAAS,OAAS,CAAC,EAAU,MAAc,EAAE,CAE3C,CACL,CACE,KAAM,EAAU,MAChB,KAAM,EAAS,MAChB,CACF,CACD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useRoutePaths as e}from"@vuepress/helper/client";import{useRoute as t}from"vuepress/client";import{useData as n}from"@theme/useData";import{useMounted as r}from"@vueuse/core";import{computed as i}from"vue";const a=()=>{let a=t(),o=e(),{routeLocale:s,site:c,siteLocale:l,theme:u,themeLocale:d}=n(),f=r();return i(()=>{let e=Object.keys(c.value.locales);if(e.length<2)return[];let t=a.path,n=a.fullPath;return[{text:`${d.value.selectLanguageText}`,ariaLabel:`${d.value.selectLanguageAriaLabel??d.value.selectLanguageText}`,children:e.map(e=>{let r=c.value.locales?.[e]??{},i=u.value.locales?.[e]??{},a=`${r.lang}`,d=i.selectLanguageName??a;if(a===l.value.lang)return{text:d,activeMatch:`.`,link:f.value?n:t};let p=t.replace(s.value,e);return{text:d,link:o.value.some(e=>e===p)?f.value?n.replace(t,p):p:i.home??e}})}]})};export{a as useNavbarSelectLanguage};
|
|
2
|
+
//# sourceMappingURL=useNavbarSelectLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavbarSelectLanguage.js","names":["useData"],"sources":["../../../src/client/composables/useNavbarSelectLanguage.ts"],"sourcesContent":["import { useData } from '@theme/useData'\nimport { useRoutePaths } from '@vuepress/helper/client'\nimport { useMounted } from '@vueuse/core'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { useRoute } from 'vuepress/client'\nimport type { NavbarItem } from '../typings.js'\n\n/**\n * Get navbar config of select language dropdown\n *\n * @returns Navbar config of select language dropdown\n */\nexport const useNavbarSelectLanguage = (): ComputedRef<NavbarItem[]> => {\n const route = useRoute()\n const routePaths = useRoutePaths()\n const { routeLocale, site, siteLocale, theme, themeLocale } = useData()\n\n const isMounted = useMounted()\n\n return computed<NavbarItem[]>(() => {\n const localePaths = Object.keys(site.value.locales)\n // do not display language selection dropdown if there is only one language\n if (localePaths.length < 2) return []\n\n const currentPath = route.path\n const currentFullPath = route.fullPath\n\n const languageDropdown: NavbarItem = {\n text: `${themeLocale.value.selectLanguageText}`,\n ariaLabel: `${\n themeLocale.value.selectLanguageAriaLabel ??\n themeLocale.value.selectLanguageText\n }`,\n children: localePaths.map((targetLocalePath) => {\n // target locale config of this language link\n const targetSiteLocale = site.value.locales?.[targetLocalePath] ?? {}\n const targetThemeLocale = theme.value.locales?.[targetLocalePath] ?? {}\n const targetLang = `${targetSiteLocale.lang}`\n\n const text = targetThemeLocale.selectLanguageName ?? targetLang\n\n // if the target language is current language\n // stay at current link\n if (targetLang === siteLocale.value.lang) {\n return {\n text,\n activeMatch: '.',\n link: isMounted.value ? currentFullPath : currentPath,\n }\n }\n\n // if the target language is not current language\n // try to link to the corresponding page of current page\n // or fallback to homepage\n const targetLocalePage = currentPath.replace(\n routeLocale.value,\n targetLocalePath,\n )\n\n return {\n text,\n // try to keep current hash and params across languages\n link: routePaths.value.some((item) => item === targetLocalePage)\n ? isMounted.value\n ? currentFullPath.replace(currentPath, targetLocalePage)\n : targetLocalePage\n : (targetThemeLocale.home ?? targetLocalePath),\n }\n }),\n }\n\n return [languageDropdown]\n })\n}\n"],"mappings":"qNAaA,MAAa,MAA2D,CACtE,IAAM,EAAQ,GAAU,CAClB,EAAa,GAAe,CAC5B,CAAE,cAAa,OAAM,aAAY,QAAO,eAAgBA,GAAS,CAEjE,EAAY,GAAY,CAE9B,OAAO,MAA6B,CAClC,IAAM,EAAc,OAAO,KAAK,EAAK,MAAM,QAAQ,CAEnD,GAAI,EAAY,OAAS,EAAG,MAAO,EAAE,CAErC,IAAM,EAAc,EAAM,KACpB,EAAkB,EAAM,SA8C9B,MAAO,CA5C8B,CACnC,KAAM,GAAG,EAAY,MAAM,qBAC3B,UAAW,GACT,EAAY,MAAM,yBAClB,EAAY,MAAM,qBAEpB,SAAU,EAAY,IAAK,GAAqB,CAE9C,IAAM,EAAmB,EAAK,MAAM,UAAU,IAAqB,EAAE,CAC/D,EAAoB,EAAM,MAAM,UAAU,IAAqB,EAAE,CACjE,EAAa,GAAG,EAAiB,OAEjC,EAAO,EAAkB,oBAAsB,EAIrD,GAAI,IAAe,EAAW,MAAM,KAClC,MAAO,CACL,OACA,YAAa,IACb,KAAM,EAAU,MAAQ,EAAkB,EAC3C,CAMH,IAAM,EAAmB,EAAY,QACnC,EAAY,MACZ,EACD,CAED,MAAO,CACL,OAEA,KAAM,EAAW,MAAM,KAAM,GAAS,IAAS,EAAiB,CAC5D,EAAU,MACR,EAAgB,QAAQ,EAAa,EAAiB,CACtD,EACD,EAAkB,MAAQ,EAChC,EACD,CACH,CAEwB,EACzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isLinkAbsolute as e,isLinkWithProtocol as t}from"@vuepress/helper/client";import{useRoute as n,useRouter as r}from"vuepress/client";const i=()=>{let i=r(),a=n();return n=>{n&&(e(n)?a.fullPath!==n&&i.push(n):t(n)?window.open(n):i.push(encodeURI(n)))}};export{i as useNavigate};
|
|
2
|
+
//# sourceMappingURL=useNavigate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigate.js","names":[],"sources":["../../../src/client/composables/useNavigate.ts"],"sourcesContent":["import { isLinkAbsolute, isLinkWithProtocol } from '@vuepress/helper/client'\nimport { useRoute, useRouter } from 'vuepress/client'\n\nexport const useNavigate = (): ((url: string) => void) => {\n const router = useRouter()\n const route = useRoute()\n\n return (url) => {\n if (url) {\n if (isLinkAbsolute(url)) {\n // Inner absolute path\n if (route.fullPath !== url) void router.push(url)\n } else if (isLinkWithProtocol(url)) {\n // external url\n window.open(url)\n } else {\n // relative url\n void router.push(encodeURI(url))\n }\n }\n }\n}\n"],"mappings":"2IAGA,MAAa,MAA6C,CACxD,IAAM,EAAS,GAAW,CACpB,EAAQ,GAAU,CAExB,MAAQ,IAAQ,CACV,IACE,EAAe,EAAI,CAEjB,EAAM,WAAa,GAAU,EAAO,KAAK,EAAI,CACxC,EAAmB,EAAI,CAEhC,OAAO,KAAK,EAAI,CAGX,EAAO,KAAK,UAAU,EAAI,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isPlainObject as e,isString as t}from"vuepress/shared";import{useSidebarItems as n}from"@theme/useSidebarItems";import{resolveRoute as r,useRoutePath as i}from"vuepress/client";import{useData as a}from"@theme/useData";import{computed as o}from"vue";import{resolveAutoLink as s}from"@theme/resolveAutoLink";const c=(n,r)=>n===!1?!1:t(n)?s(n,r):e(n)?{...n,link:s(n.link,r).link}:null,l=(e,t,n)=>{let i=e.findIndex(e=>e.link===t);if(i!==-1){let t=e[i+n];return t?t.link?t:`prefix`in t&&!r(t.prefix).notFound?{...t,link:t.prefix}:null:null}for(let r of e)if(`children`in r){let e=l(r.children,t,n);if(e)return e}let a=e.findIndex(e=>`prefix`in e&&e.prefix===t);if(a!==-1){let t=e[a+n];return t?t.link?t:`prefix`in t&&!r(t.prefix).notFound?{...t,link:t.prefix}:null:null}return null},u=()=>{let{frontmatter:e,themeLocale:t}=a(),r=n(),s=i();return{prevLink:o(()=>{let n=c(e.value.prev,s.value);return n===!1?null:n??(t.value.prev===!1?null:l(r.value,s.value,-1))}),nextLink:o(()=>{let n=c(e.value.next,s.value);return n===!1?null:n??(t.value.next===!1?null:l(r.value,s.value,1))})}};export{u as useRelatedLinks};
|
|
2
|
+
//# sourceMappingURL=useRelatedLinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRelatedLinks.js","names":["useData"],"sources":["../../../src/client/composables/useRelatedLinks.ts"],"sourcesContent":["import { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { useData } from '@theme/useData'\nimport { useSidebarItems } from '@theme/useSidebarItems'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { resolveRoute, useRoutePath } from 'vuepress/client'\nimport { isPlainObject, isString } from 'vuepress/shared'\nimport type { AutoLinkOptions } from '../../shared/index.js'\nimport type { SidebarItem } from '../typings.js'\n\nconst resolveFromFrontmatterConfig = (\n config: AutoLinkOptions | string | false | undefined,\n currentPath: string,\n): AutoLinkOptions | false | null => {\n if (config === false) return false\n\n if (isString(config)) return resolveAutoLink(config, currentPath)\n\n if (isPlainObject(config)) {\n return {\n ...config,\n link: resolveAutoLink(config.link, currentPath).link,\n }\n }\n\n return null\n}\n/**\n * Resolve `prev` or `next` config from sidebar items\n *\n * @param sidebarItems - Sidebar items / 侧边栏配置项\n * @param currentPath - Current route path / 当前路由路径\n * @param offset - The offset to find the target link, -1 for `prev` and 1 for `next` / 查找目标链接的偏移量,-1 表示查找 `prev`,1 表示查找 `next`\n * @returns Resolved link or null if not found\n */\nconst resolveFromSidebarItems = (\n sidebarItems: SidebarItem[],\n currentPath: string,\n offset: number,\n): AutoLinkOptions | null => {\n const linkIndex = sidebarItems.findIndex((item) => item.link === currentPath)\n\n if (linkIndex !== -1) {\n const targetItem = sidebarItems[linkIndex + offset] as\n | SidebarItem\n | undefined\n\n if (!targetItem) return null\n\n if (targetItem.link) return targetItem as AutoLinkOptions\n\n if ('prefix' in targetItem && !resolveRoute(targetItem.prefix!).notFound) {\n return {\n ...targetItem,\n link: targetItem.prefix!,\n }\n }\n\n return null\n }\n\n for (const item of sidebarItems) {\n if ('children' in item) {\n const childResult = resolveFromSidebarItems(\n item.children,\n currentPath,\n offset,\n )\n\n if (childResult) return childResult\n }\n }\n\n const prefixIndex = sidebarItems.findIndex(\n (item) => 'prefix' in item && item.prefix === currentPath,\n )\n\n if (prefixIndex !== -1) {\n const targetItem = sidebarItems[prefixIndex + offset] as\n | SidebarItem\n | undefined\n\n if (!targetItem) return null\n\n if (targetItem.link) return targetItem as AutoLinkOptions\n\n if ('prefix' in targetItem && !resolveRoute(targetItem.prefix!).notFound) {\n return {\n ...targetItem,\n link: targetItem.prefix!,\n }\n }\n\n return null\n }\n\n return null\n}\n\ninterface RelatedLinks {\n prevLink: ComputedRef<AutoLinkOptions | null>\n nextLink: ComputedRef<AutoLinkOptions | null>\n}\n\nexport const useRelatedLinks = (): RelatedLinks => {\n const { frontmatter, themeLocale } = useData()\n const sidebarItems = useSidebarItems()\n const routePath = useRoutePath()\n\n const prevLink = computed(() => {\n const prevConfig = resolveFromFrontmatterConfig(\n frontmatter.value.prev,\n routePath.value,\n )\n\n return prevConfig === false\n ? null\n : (prevConfig ??\n (themeLocale.value.prev === false\n ? null\n : resolveFromSidebarItems(sidebarItems.value, routePath.value, -1)))\n })\n\n const nextLink = computed(() => {\n const nextConfig = resolveFromFrontmatterConfig(\n frontmatter.value.next,\n routePath.value,\n )\n\n return nextConfig === false\n ? null\n : (nextConfig ??\n (themeLocale.value.next === false\n ? null\n : resolveFromSidebarItems(sidebarItems.value, routePath.value, 1)))\n })\n\n return {\n prevLink,\n nextLink,\n }\n}\n"],"mappings":"yTAUA,MAAM,GACJ,EACA,IAEI,IAAW,GAAc,GAEzB,EAAS,EAAO,CAAS,EAAgB,EAAQ,EAAY,CAE7D,EAAc,EAAO,CAChB,CACL,GAAG,EACH,KAAM,EAAgB,EAAO,KAAM,EAAY,CAAC,KACjD,CAGI,KAUH,GACJ,EACA,EACA,IAC2B,CAC3B,IAAM,EAAY,EAAa,UAAW,GAAS,EAAK,OAAS,EAAY,CAE7E,GAAI,IAAc,GAAI,CACpB,IAAM,EAAa,EAAa,EAAY,GAe5C,OAXK,EAED,EAAW,KAAa,EAExB,WAAY,GAAc,CAAC,EAAa,EAAW,OAAQ,CAAC,SACvD,CACL,GAAG,EACH,KAAM,EAAW,OAClB,CAGI,KAXiB,KAc1B,IAAK,IAAM,KAAQ,EACjB,GAAI,aAAc,EAAM,CACtB,IAAM,EAAc,EAClB,EAAK,SACL,EACA,EACD,CAED,GAAI,EAAa,OAAO,EAI5B,IAAM,EAAc,EAAa,UAC9B,GAAS,WAAY,GAAQ,EAAK,SAAW,EAC/C,CAED,GAAI,IAAgB,GAAI,CACtB,IAAM,EAAa,EAAa,EAAc,GAe9C,OAXK,EAED,EAAW,KAAa,EAExB,WAAY,GAAc,CAAC,EAAa,EAAW,OAAQ,CAAC,SACvD,CACL,GAAG,EACH,KAAM,EAAW,OAClB,CAGI,KAXiB,KAc1B,OAAO,MAQI,MAAsC,CACjD,GAAM,CAAE,cAAa,eAAgBA,GAAS,CACxC,EAAe,GAAiB,CAChC,EAAY,GAAc,CA8BhC,MAAO,CACL,SA7Be,MAAe,CAC9B,IAAM,EAAa,EACjB,EAAY,MAAM,KAClB,EAAU,MACX,CAED,OAAO,IAAe,GAClB,KACC,IACE,EAAY,MAAM,OAAS,GACxB,KACA,EAAwB,EAAa,MAAO,EAAU,MAAO,GAAG,GAC1E,CAkBA,SAhBe,MAAe,CAC9B,IAAM,EAAa,EACjB,EAAY,MAAM,KAClB,EAAU,MACX,CAED,OAAO,IAAe,GAClB,KACC,IACE,EAAY,MAAM,OAAS,GACxB,KACA,EAAwB,EAAa,MAAO,EAAU,MAAO,EAAE,GACzE,CAKD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollPromise.js","names":[],"sources":["../../../src/client/composables/useScrollPromise.ts"],"sourcesContent":["export interface ScrollPromise {\n wait(): Promise<void> | null\n pending: () => void\n resolve: () => void\n}\n\nlet promise: Promise<void> | null = null\nlet promiseResolve: (() => void) | null = null\n\nconst scrollPromise: ScrollPromise = {\n wait: () => promise,\n pending: () => {\n promise = new Promise((resolve) => {\n promiseResolve = resolve\n })\n },\n resolve: () => {\n promiseResolve?.()\n promise = null\n promiseResolve = null\n },\n}\n\nexport const useScrollPromise = (): ScrollPromise => scrollPromise\n"],"mappings":"AAMA,IAAI,EAAgC,KAChC,EAAsC,KAE1C,MAAM,EAA+B,CACnC,SAAY,EACZ,YAAe,CACb,EAAU,IAAI,QAAS,GAAY,CACjC,EAAiB,GACjB,EAEJ,YAAe,CACb,KAAkB,CAClB,EAAU,KACV,EAAiB,MAEpB,CAEY,MAAwC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as resolveSidebarItems, c as setupSidebarItems, i as resolveSidebarHeadingItem, l as sidebarItemsSymbol, n as resolveArraySidebarItems, o as resolveSidebarPageHeader, r as resolveMultiSidebarItems, s as resolveSidebarPageHeaders, t as SidebarItemsRef, u as useSidebarItems } from "../../useSidebarItems-CdpB96Ta.js";
|
|
2
|
+
export { SidebarItemsRef, resolveArraySidebarItems, resolveMultiSidebarItems, resolveSidebarHeadingItem, resolveSidebarItems, resolveSidebarPageHeader, resolveSidebarPageHeaders, setupSidebarItems, sidebarItemsSymbol, useSidebarItems };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{isPlainObject as e,isString as t}from"vuepress/shared";import{useHeaders as n}from"@theme/useHeaders";import{isLinkRelative as r,keys as i,startsWith as a}from"@vuepress/helper/client";import{useRoutePath as o}from"vuepress/client";import{useData as s}from"@theme/useData";import{computed as c,inject as l,provide as u}from"vue";import{resolveAutoLink as d}from"@theme/resolveAutoLink";import{resolvePrefix as f}from"@theme/resolvePrefix";const p=e=>({text:e.title,link:e.link,children:m(e.children)}),m=e=>e?e.map(e=>p(e)):[],h=(e,t)=>[{text:e.title,children:m(t)}],g=(e,n,i,a=``)=>{let o=(e,a)=>{let s=t(e)?d(f(a,e)):t(e.link)?{...e,link:r(e.link)?d(f(a,e.link)).link:e.link}:e;if(`children`in s)return{...s,children:s.children.map(e=>o(e,f(a,s.prefix)))};if(s.link===i){let e=n[0]?.level===1?n[0].children:n;return{...s,children:m(e)}}return s};return e.map(e=>o(e,a))},_=(e,t,n,r)=>{let o=i(e).sort((e,t)=>t.length-e.length);for(let i of o)if(a(decodeURI(r),i)){let a=e[i];return a===!1?[]:a===`heading`?h(t,n):g(a,n,r,i)}return console.warn(`${decodeURI(r)} is missing sidebar config.`),[]},v=Symbol(`sidebarItems`),y=()=>{let e=l(v);if(!e)throw Error(`useSidebarItems() is called without provider.`);return e},b=(t,n,r,i,a)=>t===!1?[]:t===`heading`?h(n,a):Array.isArray(t)?g(t,a,r,i):e(t)?_(t,n,a,r):[],x=()=>{let{frontmatter:e,page:t,routeLocale:r,themeLocale:i}=s(),a=n(),l=o(),d=c(()=>!e.value.home&&(e.value.sidebar??i.value.sidebar??`heading`));u(v,c(()=>b(d.value,t.value,l.value,r.value,a.value)))};export{g as resolveArraySidebarItems,_ as resolveMultiSidebarItems,h as resolveSidebarHeadingItem,b as resolveSidebarItems,p as resolveSidebarPageHeader,m as resolveSidebarPageHeaders,x as setupSidebarItems,v as sidebarItemsSymbol,y as useSidebarItems};
|
|
2
|
+
//# sourceMappingURL=useSidebarItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSidebarItems.js","names":["useData"],"sources":["../../../src/client/composables/useSidebarItems.ts"],"sourcesContent":["import { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { resolvePrefix } from '@theme/resolvePrefix'\nimport { useData } from '@theme/useData'\nimport { useHeaders } from '@theme/useHeaders'\nimport { isLinkRelative, keys, startsWith } from '@vuepress/helper/client'\nimport type { ComputedRef, InjectionKey } from 'vue'\nimport { computed, inject, provide } from 'vue'\nimport type { PageData, PageHeader } from 'vuepress/client'\nimport { useRoutePath } from 'vuepress/client'\nimport { isPlainObject, isString } from 'vuepress/shared'\nimport type {\n DefaultThemeHomePageFrontmatter,\n DefaultThemeNormalPageFrontmatter,\n SidebarArrayOptions,\n SidebarItemOptions,\n SidebarObjectOptions,\n SidebarOptions,\n} from '../../shared/index.js'\nimport type { SidebarHeaderItem, SidebarItem } from '../typings.js'\n\n/**\n * Util to transform page header to sidebar item\n *\n * @param header page header\n * @returns sidebar item from header\n */\nexport const resolveSidebarPageHeader = (\n header: PageHeader,\n): SidebarHeaderItem => ({\n text: header.title,\n link: header.link,\n // oxlint-disable-next-line no-use-before-define\n children: resolveSidebarPageHeaders(header.children),\n})\n\n/**\n * get sidebar header items from page headers\n *\n * @param headers page headers\n * @returns sidebar header items\n */\nexport const resolveSidebarPageHeaders = (\n headers?: PageHeader[],\n): SidebarHeaderItem[] =>\n headers ? headers.map((header) => resolveSidebarPageHeader(header)) : []\n\n/**\n * Resolve current page and its header to sidebar items if the config is `heading`\n *\n * @param page current page data\n * @param headers current page headers\n *\n * @returns sidebar items\n */\nexport const resolveSidebarHeadingItem = (\n page: PageData,\n headers: PageHeader[],\n): SidebarItem[] => [\n {\n text: page.title,\n children: resolveSidebarPageHeaders(headers),\n },\n]\n\n/**\n * Resolve sidebar items if the config is an array\n *\n * @param sidebarConfig sidebar config array\n * @param headers current page headers\n * @param path current page path\n * @param prefix path prefix\n *\n * @returns resolved sidebar items\n */\nexport const resolveArraySidebarItems = (\n sidebarConfig: SidebarArrayOptions,\n headers: PageHeader[],\n path: string,\n prefix = '',\n): SidebarItem[] => {\n const handleChildItem = (\n item: SidebarItemOptions,\n pathPrefix: string,\n ): SidebarItem => {\n const childItem: SidebarItemOptions = isString(item)\n ? resolveAutoLink(resolvePrefix(pathPrefix, item))\n : isString(item.link)\n ? {\n ...item,\n link: isLinkRelative(item.link)\n ? resolveAutoLink(resolvePrefix(pathPrefix, item.link)).link\n : item.link,\n }\n : item\n\n if ('children' in childItem) {\n return {\n ...childItem,\n children: childItem.children.map((child) =>\n handleChildItem(child, resolvePrefix(pathPrefix, childItem.prefix)),\n ),\n }\n }\n\n // if the sidebar item is current page and children is not set\n // use headers of current page as children\n if (childItem.link === path) {\n // skip h1 header\n const currentHeaders =\n headers[0]?.level === 1 ? headers[0].children : headers\n\n return {\n ...childItem,\n children: resolveSidebarPageHeaders(currentHeaders),\n }\n }\n\n return childItem\n }\n\n return sidebarConfig.map((item) => handleChildItem(item, prefix))\n}\n\n/**\n * Resolve sidebar items if the config is a key -> value (path-prefix -> array) object\n *\n * @param sidebarConfig sidebar config object\n * @param page current page data\n * @param headers current page headers\n * @param path current page path\n *\n * @returns resolved sidebar items\n */\nexport const resolveMultiSidebarItems = (\n sidebarConfig: SidebarObjectOptions,\n page: PageData,\n headers: PageHeader[],\n path: string,\n): SidebarItem[] => {\n const sidebarRoutes = keys(sidebarConfig).sort((a, b) => b.length - a.length)\n\n // Find matching config\n for (const base of sidebarRoutes) {\n if (startsWith(decodeURI(path), base)) {\n const matched = sidebarConfig[base]\n\n return matched === false\n ? []\n : matched === 'heading'\n ? resolveSidebarHeadingItem(page, headers)\n : resolveArraySidebarItems(matched, headers, path, base)\n }\n }\n\n // eslint-disable-next-line no-console\n console.warn(`${decodeURI(path)} is missing sidebar config.`)\n\n return []\n}\n\nexport type SidebarItemsRef = ComputedRef<SidebarItem[]>\n\nexport const sidebarItemsSymbol: InjectionKey<SidebarItemsRef> =\n Symbol('sidebarItems')\n\n/**\n * Inject sidebar items global computed\n *\n * @returns sidebar items global computed\n */\nexport const useSidebarItems = (): SidebarItemsRef => {\n const sidebarItems = inject(sidebarItemsSymbol)\n if (!sidebarItems)\n throw new Error('useSidebarItems() is called without provider.')\n\n return sidebarItems\n}\n\n/**\n * Resolve sidebar items global computed\n *\n * It should only be resolved and provided once\n *\n * @param sidebarConfig sidebar config\n * @param page current page data\n * @param path current page path\n * @param routeLocale current route locale\n * @param headers current page headers\n *\n * @returns resolved sidebar items\n */\n\nexport const resolveSidebarItems = (\n sidebarConfig: SidebarOptions | false,\n page: PageData,\n path: string,\n routeLocale: string,\n headers: PageHeader[],\n): SidebarItem[] => {\n // resolve sidebar items according to the config\n if (sidebarConfig === false) return []\n\n if (sidebarConfig === 'heading')\n return resolveSidebarHeadingItem(page, headers)\n\n if (Array.isArray(sidebarConfig))\n return resolveArraySidebarItems(sidebarConfig, headers, path, routeLocale)\n\n if (isPlainObject(sidebarConfig))\n return resolveMultiSidebarItems(sidebarConfig, page, headers, path)\n\n return []\n}\n\n/**\n * Create sidebar items ref and provide as global computed in setup\n */\nexport const setupSidebarItems = (): void => {\n const { frontmatter, page, routeLocale, themeLocale } = useData<\n DefaultThemeHomePageFrontmatter | DefaultThemeNormalPageFrontmatter\n >()\n const headers = useHeaders()\n const routePath = useRoutePath()\n\n const sidebarConfig = computed<SidebarOptions | false>(\n () =>\n !frontmatter.value.home &&\n ((frontmatter.value as DefaultThemeNormalPageFrontmatter).sidebar ??\n themeLocale.value.sidebar ??\n 'heading'),\n )\n\n const sidebarItems = computed(() =>\n resolveSidebarItems(\n sidebarConfig.value,\n page.value,\n routePath.value,\n routeLocale.value,\n headers.value,\n ),\n )\n provide(sidebarItemsSymbol, sidebarItems)\n}\n"],"mappings":"8bA0BA,MAAa,EACX,IACuB,CACvB,KAAM,EAAO,MACb,KAAM,EAAO,KAEb,SAAU,EAA0B,EAAO,SAAS,CACrD,EAQY,EACX,GAEA,EAAU,EAAQ,IAAK,GAAW,EAAyB,EAAO,CAAC,CAAG,EAAE,CAU7D,GACX,EACA,IACkB,CAClB,CACE,KAAM,EAAK,MACX,SAAU,EAA0B,EAAQ,CAC7C,CACF,CAYY,GACX,EACA,EACA,EACA,EAAS,KACS,CAClB,IAAM,GACJ,EACA,IACgB,CAChB,IAAM,EAAgC,EAAS,EAAK,CAChD,EAAgB,EAAc,EAAY,EAAK,CAAC,CAChD,EAAS,EAAK,KAAK,CACjB,CACE,GAAG,EACH,KAAM,EAAe,EAAK,KAAK,CAC3B,EAAgB,EAAc,EAAY,EAAK,KAAK,CAAC,CAAC,KACtD,EAAK,KACV,CACD,EAEN,GAAI,aAAc,EAChB,MAAO,CACL,GAAG,EACH,SAAU,EAAU,SAAS,IAAK,GAChC,EAAgB,EAAO,EAAc,EAAY,EAAU,OAAO,CAAC,CACpE,CACF,CAKH,GAAI,EAAU,OAAS,EAAM,CAE3B,IAAM,EACJ,EAAQ,IAAI,QAAU,EAAI,EAAQ,GAAG,SAAW,EAElD,MAAO,CACL,GAAG,EACH,SAAU,EAA0B,EAAe,CACpD,CAGH,OAAO,GAGT,OAAO,EAAc,IAAK,GAAS,EAAgB,EAAM,EAAO,CAAC,EAatD,GACX,EACA,EACA,EACA,IACkB,CAClB,IAAM,EAAgB,EAAK,EAAc,CAAC,MAAM,EAAG,IAAM,EAAE,OAAS,EAAE,OAAO,CAG7E,IAAK,IAAM,KAAQ,EACjB,GAAI,EAAW,UAAU,EAAK,CAAE,EAAK,CAAE,CACrC,IAAM,EAAU,EAAc,GAE9B,OAAO,IAAY,GACf,EAAE,CACF,IAAY,UACV,EAA0B,EAAM,EAAQ,CACxC,EAAyB,EAAS,EAAS,EAAM,EAAK,CAOhE,OAFA,QAAQ,KAAK,GAAG,UAAU,EAAK,CAAC,6BAA6B,CAEtD,EAAE,EAKE,EACX,OAAO,eAAe,CAOX,MAAyC,CACpD,IAAM,EAAe,EAAO,EAAmB,CAC/C,GAAI,CAAC,EACH,MAAU,MAAM,gDAAgD,CAElE,OAAO,GAiBI,GACX,EACA,EACA,EACA,EACA,IAGI,IAAkB,GAAc,EAAE,CAElC,IAAkB,UACb,EAA0B,EAAM,EAAQ,CAE7C,MAAM,QAAQ,EAAc,CACvB,EAAyB,EAAe,EAAS,EAAM,EAAY,CAExE,EAAc,EAAc,CACvB,EAAyB,EAAe,EAAM,EAAS,EAAK,CAE9D,EAAE,CAME,MAAgC,CAC3C,GAAM,CAAE,cAAa,OAAM,cAAa,eAAgBA,GAErD,CACG,EAAU,GAAY,CACtB,EAAY,GAAc,CAE1B,EAAgB,MAElB,CAAC,EAAY,MAAM,OACjB,EAAY,MAA4C,SACxD,EAAY,MAAM,SAClB,WACL,CAWD,EAAQ,EATa,MACnB,EACE,EAAc,MACd,EAAK,MACL,EAAU,MACV,EAAY,MACZ,EAAQ,MACT,CACF,CACwC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEventListener as e}from"@vueuse/core";import{onMounted as t}from"vue";import n from"../styles/_variables.module.scss";let r=function(e){return e.Mobile=`mobile`,e}({});const i={[r.Mobile]:Number.parseInt(n.mobile.replace(`px`,``),10)},a=(n,r)=>{let a=i[n];if(!Number.isInteger(a)){if(__VUEPRESS_DEV__)throw Error(`device width must be a integer`);return}e(`orientationchange`,()=>{r(a)}),e(`resize`,()=>{r(a)}),t(()=>{r(a)})};export{r as DeviceType,a as useUpdateDeviceStatus};
|
|
2
|
+
//# sourceMappingURL=useUpdateDeviceStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUpdateDeviceStatus.js","names":[],"sources":["../../../src/client/composables/useUpdateDeviceStatus.ts"],"sourcesContent":["// oxlint-disable promise/prefer-await-to-callbacks\nimport { useEventListener } from '@vueuse/core'\nimport { onMounted } from 'vue'\nimport cssVariables from '../styles/_variables.module.scss'\n\nexport enum DeviceType {\n Mobile = 'mobile',\n}\n\nconst DeviceTypeMap = {\n [DeviceType.Mobile]: Number.parseInt(\n cssVariables.mobile.replace('px', ''),\n 10,\n ),\n}\n\n/**\n * add listener to detect screen though device type\n *\n * @param deviceType - Device type to detect / 要检测的设备类型\n * @param callback - Callback function to call when device status changes / 设备状态改变时调用的回调函数\n */\nexport const useUpdateDeviceStatus = (\n deviceType: DeviceType,\n callback: (width: number) => void,\n): void => {\n const width = DeviceTypeMap[deviceType]\n if (!Number.isInteger(width)) {\n if (__VUEPRESS_DEV__) throw new Error('device width must be a integer')\n return\n }\n\n useEventListener('orientationchange', () => {\n callback(width)\n })\n useEventListener('resize', () => {\n callback(width)\n })\n\n onMounted(() => {\n callback(width)\n })\n}\n"],"mappings":"gIAKA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,OAAA,eACD,CAED,MAAM,EAAgB,EACnB,EAAW,QAAS,OAAO,SAC1B,EAAa,OAAO,QAAQ,KAAM,GAAG,CACrC,GACD,CACF,CAQY,GACX,EACA,IACS,CACT,IAAM,EAAQ,EAAc,GAC5B,GAAI,CAAC,OAAO,UAAU,EAAM,CAAE,CAC5B,GAAI,iBAAkB,MAAU,MAAM,iCAAiC,CACvE,OAGF,EAAiB,wBAA2B,CAC1C,EAAS,EAAM,EACf,CACF,EAAiB,aAAgB,CAC/B,EAAS,EAAM,EACf,CAEF,MAAgB,CACd,EAAS,EAAM,EACf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { n as setupDarkMode, r as useDarkMode, t as DarkModeRef } from "../useDarkMode-DLor2cV7.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-CF1YPYLN.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-FWcDnzJp.js";
|
|
5
|
+
import { n as useData, t as Data } from "../useData-JDen_Bxm.js";
|
|
6
|
+
import { t as useEditLink } from "../useEditLink-DPCTvXmM.js";
|
|
7
|
+
import { t as useNavigate } from "../useNavigate-lH4xyHOV.js";
|
|
8
|
+
import { a as SidebarLinkItem, i as SidebarItem, n as SidebarGroupItem, r as SidebarHeaderItem, t as NavbarItem } from "../typings-NbQSzbOn.js";
|
|
9
|
+
import { t as useNavbarConfig } from "../useNavbarConfig-C19TGFg7.js";
|
|
10
|
+
import { t as useNavbarRepo } from "../useNavbarRepo-DxhSIAFq.js";
|
|
11
|
+
import { t as useNavbarSelectLanguage } from "../useNavbarSelectLanguage-4GkrPvc2.js";
|
|
12
|
+
import { t as useRelatedLinks } from "../useRelatedLinks-ChTW2RRU.js";
|
|
13
|
+
import { n as useScrollPromise, t as ScrollPromise } from "../useScrollPromise-BAl732Uv.js";
|
|
14
|
+
import { a as resolveSidebarItems, c as setupSidebarItems, i as resolveSidebarHeadingItem, l as sidebarItemsSymbol, n as resolveArraySidebarItems, o as resolveSidebarPageHeader, r as resolveMultiSidebarItems, s as resolveSidebarPageHeaders, t as SidebarItemsRef, u as useSidebarItems } from "../useSidebarItems-CdpB96Ta.js";
|
|
15
|
+
import { n as useUpdateDeviceStatus, t as DeviceType } from "../useUpdateDeviceStatus-SBnOZx8J.js";
|
|
16
|
+
import { t as isActiveSidebarItem } from "../isActiveSidebarItem-aythFTeC.js";
|
|
17
|
+
import { t as resolveAutoLink } from "../resolveAutoLink-BR2Z05MD.js";
|
|
18
|
+
import { n as resolveEditLink, t as EDIT_LINK_PATTERNS } from "../resolveEditLink-DazcWeGf.js";
|
|
19
|
+
import { t as resolvePrefix } from "../resolvePrefix-BN9K9RA5.js";
|
|
20
|
+
import { n as resolveRepoType, t as RepoType } from "../resolveRepoType-Wcj35_rs.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 };
|
|
@@ -0,0 +1 @@
|
|
|
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"./composables/index.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";import"./utils/index.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};
|
|
@@ -47,11 +47,8 @@ const onTouchEnd = ({ changedTouches }: TouchEvent): void => {
|
|
|
47
47
|
const dx = changedTouches[0].clientX - touchStart.x
|
|
48
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
|
-
|
|
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
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { t as isActiveSidebarItem } from "../../isActiveSidebarItem-aythFTeC.js";
|
|
2
|
+
import { t as resolveAutoLink } from "../../resolveAutoLink-BR2Z05MD.js";
|
|
3
|
+
import { n as resolveEditLink, t as EDIT_LINK_PATTERNS } from "../../resolveEditLink-DazcWeGf.js";
|
|
4
|
+
import { t as resolvePrefix } from "../../resolvePrefix-BN9K9RA5.js";
|
|
5
|
+
import { n as resolveRepoType, t as RepoType } from "../../resolveRepoType-Wcj35_rs.js";
|
|
6
|
+
export { EDIT_LINK_PATTERNS, RepoType, isActiveSidebarItem, resolveAutoLink, resolveEditLink, resolvePrefix, resolveRepoType };
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,2 @@
|
|
|
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"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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,8 @@
|
|
|
1
|
+
import { i as SidebarItem } from "./typings-NbQSzbOn.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 as t };
|
|
8
|
+
//# sourceMappingURL=isActiveSidebarItem-aythFTeC.d.ts.map
|