@vuepress/theme-default 2.0.0-rc.125 → 2.0.0-rc.126

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 (46) hide show
  1. package/dist/client/components/VPFadeSlideYTransition.vue +1 -0
  2. package/dist/client/components/VPHome.vue +2 -1
  3. package/dist/client/components/VPHomeFeatures.vue +3 -1
  4. package/dist/client/components/VPHomeFooter.vue +1 -0
  5. package/dist/client/components/VPHomeHero.vue +5 -3
  6. package/dist/client/components/VPNavbar.vue +6 -5
  7. package/dist/client/components/VPNavbarBrand.vue +3 -2
  8. package/dist/client/components/VPNavbarDropdown.vue +3 -1
  9. package/dist/client/components/VPNavbarItems.vue +4 -3
  10. package/dist/client/components/VPPage.vue +3 -2
  11. package/dist/client/components/VPPageMeta.vue +4 -3
  12. package/dist/client/components/VPPageNav.vue +4 -3
  13. package/dist/client/components/VPSidebar.vue +2 -1
  14. package/dist/client/components/VPSidebarItem.vue +5 -3
  15. package/dist/client/components/VPSidebarItems.vue +3 -2
  16. package/dist/client/components/VPToggleColorModeButton.vue +2 -2
  17. package/dist/client/composables/useDarkMode.js +1 -1
  18. package/dist/client/composables/useDarkMode.js.map +1 -1
  19. package/dist/client/composables/useData.js.map +1 -1
  20. package/dist/client/composables/useEditLink.js +1 -1
  21. package/dist/client/composables/useEditLink.js.map +1 -1
  22. package/dist/client/composables/useHeaders.js +1 -1
  23. package/dist/client/composables/useHeaders.js.map +1 -1
  24. package/dist/client/composables/useNavbarConfig.js +1 -1
  25. package/dist/client/composables/useNavbarConfig.js.map +1 -1
  26. package/dist/client/composables/useNavbarRepo.js +1 -1
  27. package/dist/client/composables/useNavbarRepo.js.map +1 -1
  28. package/dist/client/composables/useNavbarSelectLanguage.js +1 -1
  29. package/dist/client/composables/useNavbarSelectLanguage.js.map +1 -1
  30. package/dist/client/composables/useRelatedLinks.js +1 -1
  31. package/dist/client/composables/useRelatedLinks.js.map +1 -1
  32. package/dist/client/composables/useSidebarItems.js +1 -1
  33. package/dist/client/composables/useSidebarItems.js.map +1 -1
  34. package/dist/client/composables/useUpdateDeviceStatus.js.map +1 -1
  35. package/dist/client/config.js +1 -1
  36. package/dist/client/config.js.map +1 -1
  37. package/dist/client/layouts/Layout.vue +7 -6
  38. package/dist/client/layouts/NotFound.vue +2 -1
  39. package/dist/client/styles/arrow.scss +3 -3
  40. package/dist/client/styles/vars.scss +2 -2
  41. package/dist/client/utils/isActiveSidebarItem.js.map +1 -1
  42. package/dist/client/utils/resolveAutoLink.js.map +1 -1
  43. package/dist/client/utils/resolveEditLink.js.map +1 -1
  44. package/dist/node/index.js.map +1 -1
  45. package/package.json +21 -21
  46. package/dist/client/shim.d.ts +0 -11
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { SingleSlot } from '@vuepress/helper/client'
3
+
3
4
  import '@vuepress/helper/transition/fade-in-down.css'
4
5
 
5
6
  defineEmits<{
@@ -1,8 +1,9 @@
1
1
  <script setup lang="ts">
2
+ import { Content } from 'vuepress/client'
3
+
2
4
  import VPHomeFeatures from '@theme/VPHomeFeatures.vue'
3
5
  import VPHomeFooter from '@theme/VPHomeFooter.vue'
4
6
  import VPHomeHero from '@theme/VPHomeHero.vue'
5
- import { Content } from 'vuepress/client'
6
7
  </script>
7
8
 
8
9
  <template>
@@ -1,6 +1,8 @@
1
1
  <script setup lang="ts">
2
- import { useData } from '@theme/useData'
3
2
  import { computed } from 'vue'
3
+
4
+ import { useData } from '@theme/useData'
5
+
4
6
  import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
5
7
 
6
8
  const { frontmatter } = useData<DefaultThemeHomePageFrontmatter>()
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
  import { useFrontmatter } from 'vuepress/client'
4
+
4
5
  import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
5
6
 
6
7
  const frontmatter = useFrontmatter<DefaultThemeHomePageFrontmatter>()
@@ -1,10 +1,12 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
3
- import { useDarkMode } from '@theme/useDarkMode'
4
- import { useData } from '@theme/useData'
5
2
  import type { FunctionalComponent } from 'vue'
6
3
  import { computed, h } from 'vue'
7
4
  import { ClientOnly, withBase } from 'vuepress/client'
5
+
6
+ import { useDarkMode } from '@theme/useDarkMode'
7
+ import { useData } from '@theme/useData'
8
+ import VPAutoLink from '@theme/VPAutoLink.vue'
9
+
8
10
  import type { DefaultThemeHomePageFrontmatter } from '../../shared/index.js'
9
11
 
10
12
  const { frontmatter, siteLocale } = useData<DefaultThemeHomePageFrontmatter>()
@@ -1,13 +1,14 @@
1
1
  <script setup lang="ts">
2
+ import type { Slot } from '@vuepress/helper/client'
3
+ import { hasGlobalComponent } from '@vuepress/helper/client'
4
+ import { computed, ref, resolveComponent, useTemplateRef } from 'vue'
5
+
6
+ import { useData } from '@theme/useData'
7
+ import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
2
8
  import VPNavbarBrand from '@theme/VPNavbarBrand.vue'
3
9
  import VPNavbarItems from '@theme/VPNavbarItems.vue'
4
10
  import VPToggleColorModeButton from '@theme/VPToggleColorModeButton.vue'
5
11
  import VPToggleSidebarButton from '@theme/VPToggleSidebarButton.vue'
6
- import { useData } from '@theme/useData'
7
- import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
8
- import type { Slot } from '@vuepress/helper/client'
9
- import { hasGlobalComponent } from '@vuepress/helper/client'
10
- import { computed, ref, resolveComponent, useTemplateRef } from 'vue'
11
12
 
12
13
  defineEmits<{
13
14
  toggleSidebar: []
@@ -1,10 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { useDarkMode } from '@theme/useDarkMode'
3
- import { useData } from '@theme/useData'
4
2
  import type { FunctionalComponent } from 'vue'
5
3
  import { computed, h } from 'vue'
6
4
  import { ClientOnly, RouteLink, withBase } from 'vuepress/client'
7
5
 
6
+ import { useDarkMode } from '@theme/useDarkMode'
7
+ import { useData } from '@theme/useData'
8
+
8
9
  const { routeLocale, siteLocale, themeLocale } = useData()
9
10
  const isDarkMode = useDarkMode()
10
11
 
@@ -1,9 +1,11 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
3
2
  import { FadeInExpandTransition } from '@vuepress/helper/client'
4
3
  import { useToggle } from '@vueuse/core'
5
4
  import { computed } from 'vue'
6
5
  import { onContentUpdated } from 'vuepress/client'
6
+
7
+ import VPAutoLink from '@theme/VPAutoLink.vue'
8
+
7
9
  import type { AutoLinkOptions, NavGroup } from '../../shared/index.js'
8
10
 
9
11
  import '@vuepress/helper/transition/fade-in-height-expand.css'
@@ -1,12 +1,13 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
3
- import VPNavbarDropdown from '@theme/VPNavbarDropdown.vue'
2
+ import { computed, ref } from 'vue'
3
+
4
4
  import { useData } from '@theme/useData'
5
5
  import { useNavbarConfig } from '@theme/useNavbarConfig'
6
6
  import { useNavbarRepo } from '@theme/useNavbarRepo'
7
7
  import { useNavbarSelectLanguage } from '@theme/useNavbarSelectLanguage'
8
8
  import { DeviceType, useUpdateDeviceStatus } from '@theme/useUpdateDeviceStatus'
9
- import { computed, ref } from 'vue'
9
+ import VPAutoLink from '@theme/VPAutoLink.vue'
10
+ import VPNavbarDropdown from '@theme/VPNavbarDropdown.vue'
10
11
 
11
12
  const { themeLocale } = useData()
12
13
  const navbarConfig = useNavbarConfig()
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import VPPageMeta from '@theme/VPPageMeta.vue'
3
- import VPPageNav from '@theme/VPPageNav.vue'
4
2
  import type { Slot } from '@vuepress/helper/client'
5
3
  import { Content } from 'vuepress/client'
6
4
 
5
+ import VPPageMeta from '@theme/VPPageMeta.vue'
6
+ import VPPageNav from '@theme/VPPageNav.vue'
7
+
7
8
  defineSlots<{
8
9
  'top'?: Slot
9
10
  'bottom'?: Slot
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
3
- import VPEditIcon from '@theme/VPEditIcon.vue'
2
+ import { useContributors, useLastUpdated } from '@vuepress/plugin-git/client'
3
+
4
4
  import { useData } from '@theme/useData'
5
5
  import { useEditLink } from '@theme/useEditLink'
6
- import { useContributors, useLastUpdated } from '@vuepress/plugin-git/client'
6
+ import VPAutoLink from '@theme/VPAutoLink.vue'
7
+ import VPEditIcon from '@theme/VPEditIcon.vue'
7
8
 
8
9
  const { frontmatter, themeLocale } = useData()
9
10
  const contributors = useContributors(
@@ -1,10 +1,11 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
2
+ import { useEventListener } from '@vueuse/core'
3
+ import { computed } from 'vue'
4
+
3
5
  import { useData } from '@theme/useData'
4
6
  import { useNavigate } from '@theme/useNavigate'
5
7
  import { useRelatedLinks } from '@theme/useRelatedLinks'
6
- import { useEventListener } from '@vueuse/core'
7
- import { computed } from 'vue'
8
+ import VPAutoLink from '@theme/VPAutoLink.vue'
8
9
 
9
10
  const { themeLocale } = useData()
10
11
  const navigate = useNavigate()
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import type { Slot } from '@vuepress/helper/client'
3
+
2
4
  import VPNavbarItems from '@theme/VPNavbarItems.vue'
3
5
  import VPSidebarItems from '@theme/VPSidebarItems.vue'
4
- import type { Slot } from '@vuepress/helper/client'
5
6
 
6
7
  defineSlots<{
7
8
  top?: Slot
@@ -1,10 +1,12 @@
1
1
  <script setup lang="ts">
2
- import VPAutoLink from '@theme/VPAutoLink.vue'
3
- import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
4
- import { isActiveSidebarItem } from '@theme/isActiveSidebarItem'
5
2
  import { useToggle } from '@vueuse/core'
6
3
  import { computed, nextTick, onBeforeUnmount } from 'vue'
7
4
  import { useRoute, useRouter } from 'vuepress/client'
5
+
6
+ import { isActiveSidebarItem } from '@theme/isActiveSidebarItem'
7
+ import VPAutoLink from '@theme/VPAutoLink.vue'
8
+ import VPDropdownTransition from '@theme/VPDropdownTransition.vue'
9
+
8
10
  import type { SidebarGroupItem, SidebarItem } from '../typings.js'
9
11
 
10
12
  const { item, depth = 0 } = defineProps<{
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import VPSidebarItem from '@theme/VPSidebarItem.vue'
3
- import { useSidebarItems } from '@theme/useSidebarItems'
4
2
  import { onMounted, watch } from 'vue'
5
3
  import { useRoute } from 'vuepress/client'
6
4
 
5
+ import { useSidebarItems } from '@theme/useSidebarItems'
6
+ import VPSidebarItem from '@theme/VPSidebarItem.vue'
7
+
7
8
  const route = useRoute()
8
9
  const sidebarItems = useSidebarItems()
9
10
 
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
- import VPDarkIcon from '@theme/VPDarkIcon.vue'
3
- import VPLightIcon from '@theme/VPLightIcon.vue'
4
2
  import { useDarkMode } from '@theme/useDarkMode'
5
3
  import { useData } from '@theme/useData'
4
+ import VPDarkIcon from '@theme/VPDarkIcon.vue'
5
+ import VPLightIcon from '@theme/VPLightIcon.vue'
6
6
 
7
7
  const { themeLocale } = useData()
8
8
  const isDarkMode = useDarkMode()
@@ -1,2 +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};
1
+ import{darkModeSymbol as e}from"@vuepress/helper/client";import{usePreferredDark as t,useStorage as n,watchImmediate as r}from"@vueuse/core";import{computed as i,inject as a,onMounted as o,onUnmounted as s,provide as c}from"vue";import{useData as l}from"@theme/useData";const u=e=>{let t=globalThis.document.documentElement;t.dataset.theme=e?`dark`:`light`},d=e=>{o(()=>{r(e,u)}),s(()=>{u(e.value)})},f=()=>{let t=a(e);if(!t)throw Error(`useDarkMode() is called without provider.`);return t},p=()=>{let{themeLocale:r}=l(),a=t(),o=n(`vuepress-color-scheme`,r.value.colorMode),s=i({get(){return r.value.colorModeSwitch?o.value===`auto`?a.value:o.value===`dark`:r.value.colorMode===`dark`},set(e){e===a.value?o.value=`auto`:o.value=e?`dark`:`light`}});c(e,s),d(s)};export{p as setupDarkMode,f as useDarkMode};
2
2
  //# sourceMappingURL=useDarkMode.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useDarkMode.js","names":[],"sources":["../../../src/client/composables/useDarkMode.ts"],"sourcesContent":["import { 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\nimport { useData } from '@theme/useData'\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":"8QASA,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"}
@@ -1 +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"}
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'\n\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":"oIA0CA,MAAa,OAI4B,CACvC,GAAGA,GAAqC,CACxC,MAAO,GAAgC,CACvC,YAAa,GAAsC,CACpD"}
@@ -1,2 +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};
1
+ import{computed as e}from"vue";import{useData as t}from"@theme/useData";import{resolveEditLink as n}from"@theme/resolveEditLink";const r=()=>{let{frontmatter:r,page:i,themeLocale:a}=t();return e(()=>{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
2
  //# sourceMappingURL=useEditLink.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useEditLink.js","names":[],"sources":["../../../src/client/composables/useEditLink.ts"],"sourcesContent":["import type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport type { AutoLinkConfig } from 'vuepress/client'\n\nimport { resolveEditLink } from '@theme/resolveEditLink'\nimport { useData } from '@theme/useData'\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":"iIAOA,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"}
@@ -1,2 +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};
1
+ import{getHeaders as e}from"@vuepress/helper/client";import{onContentUpdated as t}from"vuepress/client";import{injectLocal as n,provideLocal as r}from"@vueuse/core";import{computed as i,ref as a}from"vue";import{useData as o}from"@theme/useData";const s=Symbol(`headers`),c=()=>{let e=n(s);if(!e)throw Error(`useHeaders() is called without provider.`);return e},l=()=>{let{frontmatter:n,themeLocale:c}=o(),l=a([]),u=i(()=>n.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`]})};r(s,l),t(e=>{e===`beforeUnmount`?l.value=[]:d()})};export{s as headersSymbol,l as setupHeaders,c as useHeaders};
2
2
  //# sourceMappingURL=useHeaders.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useHeaders.js","names":["useData"],"sources":["../../../src/client/composables/useHeaders.ts"],"sourcesContent":["import 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\nimport { useData } from '@theme/useData'\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":"sPAWA,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"}
@@ -1,2 +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};
1
+ import{isString as e}from"vuepress/shared";import{isLinkRelative as t}from"@vuepress/helper/client";import{computed as n}from"vue";import{useData as r}from"@theme/useData";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}=r();return n(()=>(e.value.navbar||[]).map(e=>o(e)))};export{s as useNavbarConfig};
2
2
  //# sourceMappingURL=useNavbarConfig.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useNavbarConfig.js","names":[],"sources":["../../../src/client/composables/useNavbarConfig.ts"],"sourcesContent":["import { isLinkRelative } from '@vuepress/helper/client'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { isString } from 'vuepress/shared'\n\nimport { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { resolvePrefix } from '@theme/resolvePrefix'\nimport { useData } from '@theme/useData'\n\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":"0RAeA,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"}
@@ -1,2 +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};
1
+ import{isLinkHttp as e}from"vuepress/shared";import{computed as t}from"vue";import{useData as n}from"@theme/useData";import{resolveRepoType as r}from"@theme/resolveRepoType";const i=()=>{let{themeLocale:i}=n(),a=t(()=>i.value.repo),o=t(()=>a.value?r(a.value):null),s=t(()=>a.value&&!e(a.value)?`https://github.com/${a.value}`:a.value),c=t(()=>s.value?i.value.repoLabel?i.value.repoLabel:o.value==null?`Source`:o.value:null);return t(()=>!s.value||!c.value?[]:[{text:c.value,link:s.value}])};export{i as useNavbarRepo};
2
2
  //# sourceMappingURL=useNavbarRepo.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useNavbarRepo.js","names":[],"sources":["../../../src/client/composables/useNavbarRepo.ts"],"sourcesContent":["import type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { isLinkHttp } from 'vuepress/shared'\n\nimport { resolveRepoType } from '@theme/resolveRepoType'\nimport { useData } from '@theme/useData'\n\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":"8KAcA,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"}
@@ -1,2 +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};
1
+ import{useRoutePaths as e}from"@vuepress/helper/client";import{useRoute as t}from"vuepress/client";import{useMounted as n}from"@vueuse/core";import{computed as r}from"vue";import{useData as i}from"@theme/useData";const a=()=>{let a=t(),o=e(),{routeLocale:s,site:c,siteLocale:l,theme:u,themeLocale:d}=i(),f=n();return r(()=>{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
2
  //# sourceMappingURL=useNavbarSelectLanguage.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useNavbarSelectLanguage.js","names":["useData"],"sources":["../../../src/client/composables/useNavbarSelectLanguage.ts"],"sourcesContent":["import { useRoutePaths } from '@vuepress/helper/client'\nimport { useMounted } from '@vueuse/core'\nimport type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { useRoute } from 'vuepress/client'\n\nimport { useData } from '@theme/useData'\n\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":"qNAeA,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"}
@@ -1,2 +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};
1
+ import{isPlainObject as e,isString as t}from"vuepress/shared";import{resolveRoute as n,useRoutePath as r}from"vuepress/client";import{useSidebarItems as i}from"@theme/useSidebarItems";import{computed as a}from"vue";import{useData as o}from"@theme/useData";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,r)=>{let i=e.findIndex(e=>e.link===t);if(i!==-1){let t=e[i+r];return t?t.link?t:`prefix`in t&&!n(t.prefix).notFound?{...t,link:t.prefix}:null:null}for(let n of e)if(`children`in n){let e=l(n.children,t,r);if(e)return e}let a=e.findIndex(e=>`prefix`in e&&e.prefix===t);if(a!==-1){let t=e[a+r];return t?t.link?t:`prefix`in t&&!n(t.prefix).notFound?{...t,link:t.prefix}:null:null}return null},u=()=>{let{frontmatter:e,themeLocale:t}=o(),n=i(),s=r();return{prevLink:a(()=>{let r=c(e.value.prev,s.value);return r===!1?null:r??(t.value.prev===!1?null:l(n.value,s.value,-1))}),nextLink:a(()=>{let r=c(e.value.next,s.value);return r===!1?null:r??(t.value.next===!1?null:l(n.value,s.value,1))})}};export{u as useRelatedLinks};
2
2
  //# sourceMappingURL=useRelatedLinks.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useRelatedLinks.js","names":["useData"],"sources":["../../../src/client/composables/useRelatedLinks.ts"],"sourcesContent":["import type { ComputedRef } from 'vue'\nimport { computed } from 'vue'\nimport { resolveRoute, useRoutePath } from 'vuepress/client'\nimport { isPlainObject, isString } from 'vuepress/shared'\n\nimport { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { useData } from '@theme/useData'\nimport { useSidebarItems } from '@theme/useSidebarItems'\n\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":"yTAYA,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"}
@@ -1,2 +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};
1
+ import{isPlainObject as e,isString as t}from"vuepress/shared";import{isLinkRelative as n,keys as r,startsWith as i}from"@vuepress/helper/client";import{useRoutePath as a}from"vuepress/client";import{useHeaders as o}from"@theme/useHeaders";import{computed as s,inject as c,provide as l}from"vue";import{useData as u}from"@theme/useData";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,r,i,a=``)=>{let o=(e,a)=>{let s=t(e)?d(f(a,e)):t(e.link)?{...e,link:n(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=r[0]?.level===1?r[0].children:r;return{...s,children:m(e)}}return s};return e.map(e=>o(e,a))},_=(e,t,n,a)=>{let o=r(e).sort((e,t)=>t.length-e.length);for(let r of o)if(i(decodeURI(a),r)){let i=e[r];return i===!1?[]:i===`heading`?h(t,n):g(i,n,a,r)}return console.warn(`${decodeURI(a)} is missing sidebar config.`),[]},v=Symbol(`sidebarItems`),y=()=>{let e=c(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:n,themeLocale:r}=u(),i=o(),c=a(),d=s(()=>!e.value.home&&(e.value.sidebar??r.value.sidebar??`heading`));l(v,s(()=>b(d.value,t.value,c.value,n.value,i.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
2
  //# sourceMappingURL=useSidebarItems.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"useSidebarItems.js","names":["useData"],"sources":["../../../src/client/composables/useSidebarItems.ts"],"sourcesContent":["import { 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'\n\nimport { resolveAutoLink } from '@theme/resolveAutoLink'\nimport { resolvePrefix } from '@theme/resolvePrefix'\nimport { useData } from '@theme/useData'\nimport { useHeaders } from '@theme/useHeaders'\n\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":"8bA4BA,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"}
@@ -1 +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"}
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'\n\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":"gIAMA,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"}
@@ -1,2 +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};
1
+ import{hasGlobalComponent as e}from"@vuepress/helper/client";import{defineClientConfig as t}from"vuepress/client";import{setupDarkMode as n}from"@theme/useDarkMode";import{setupHeaders as r}from"@theme/useHeaders";import{useScrollPromise as i}from"@theme/useScrollPromise";import{setupSidebarItems as a}from"@theme/useSidebarItems";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=t({enhance({app:t,router:n}){e(`Badge`)||t.component(`Badge`,o);let r=n.options.scrollBehavior;n.options.scrollBehavior=async(...e)=>(await i().wait(),r(...e))},setup(){n(),r(),a()},layouts:{Layout:s,NotFound:c}});export{l as default};
2
2
  //# sourceMappingURL=config.js.map
@@ -1 +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
+ {"version":3,"file":"config.js","names":[],"sources":["../../src/client/config.ts"],"sourcesContent":["import { hasGlobalComponent } from '@vuepress/helper/client'\nimport { defineClientConfig } from 'vuepress/client'\n\nimport { setupDarkMode } from '@theme/useDarkMode'\nimport { setupHeaders } from '@theme/useHeaders'\nimport { useScrollPromise } from '@theme/useScrollPromise'\nimport { setupSidebarItems } from '@theme/useSidebarItems'\n\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":"0iBAgBA,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,15 +1,16 @@
1
1
  <script setup lang="ts">
2
+ import type { Slot } from '@vuepress/helper/client'
3
+ import { computed, ref } from 'vue'
4
+ import { onContentUpdated } from 'vuepress/client'
5
+
6
+ import { useData } from '@theme/useData'
7
+ import { useScrollPromise } from '@theme/useScrollPromise'
8
+ import { useSidebarItems } from '@theme/useSidebarItems'
2
9
  import VPFadeSlideYTransition from '@theme/VPFadeSlideYTransition.vue'
3
10
  import VPHome from '@theme/VPHome.vue'
4
11
  import VPNavbar from '@theme/VPNavbar.vue'
5
12
  import VPPage from '@theme/VPPage.vue'
6
13
  import VPSidebar from '@theme/VPSidebar.vue'
7
- import { useData } from '@theme/useData'
8
- import { useScrollPromise } from '@theme/useScrollPromise'
9
- import { useSidebarItems } from '@theme/useSidebarItems'
10
- import type { Slot } from '@vuepress/helper/client'
11
- import { computed, ref } from 'vue'
12
- import { onContentUpdated } from 'vuepress/client'
13
14
 
14
15
  defineSlots<{
15
16
  'navbar'?: Slot
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { useData } from '@theme/useData'
3
2
  import { useMounted } from '@vueuse/core'
4
3
  import { computed } from 'vue'
5
4
  import { RouteLink } from 'vuepress/client'
6
5
 
6
+ import { useData } from '@theme/useData'
7
+
7
8
  const { routeLocale, theme, themeLocale } = useData()
8
9
 
9
10
  const isMounted = useMounted()
@@ -1,10 +1,10 @@
1
- @use '@vuepress/helper/scss/svg';
1
+ @use '@vuepress/helper';
2
2
 
3
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>';
4
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>';
5
5
 
6
6
  .arrow {
7
- @include svg.background-svg($arrow-icon);
7
+ @include helper.background-svg($arrow-icon);
8
8
 
9
9
  display: inline-block;
10
10
  vertical-align: middle;
@@ -20,7 +20,7 @@ $dark-arrow-icon: '<svg viewBox="0 0 24 24"><path fill="rgba(255,255,255,0.5)" d
20
20
  transition: all 0.3s;
21
21
 
22
22
  [data-theme='dark'] & {
23
- @include svg.background-svg($dark-arrow-icon);
23
+ @include helper.background-svg($dark-arrow-icon);
24
24
  }
25
25
 
26
26
  &.down {
@@ -1,4 +1,4 @@
1
- @use '@vuepress/helper/scss/svg';
1
+ @use '@vuepress/helper';
2
2
 
3
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>';
4
4
 
@@ -81,6 +81,6 @@ $external-link-icon: '<svg viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="n
81
81
 
82
82
  // external-link-icon
83
83
  /* stylelint-disable-next-line scss/dollar-variable-no-missing-interpolation */
84
- --external-link-icon: #{svg.encode-svg($external-link-icon)};
84
+ --external-link-icon: #{helper.encode-svg($external-link-icon)};
85
85
  --external-link-c-icon: var(--vp-c-text-mute);
86
86
  }
@@ -1 +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
+ {"version":3,"file":"isActiveSidebarItem.js","names":[],"sources":["../../../src/client/utils/isActiveSidebarItem.ts"],"sourcesContent":["import type { RouteLocationNormalizedLoaded } from 'vuepress/client'\n\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":"AAIA,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 +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
+ {"version":3,"file":"resolveAutoLink.js","names":[],"sources":["../../../src/client/utils/resolveAutoLink.ts"],"sourcesContent":["import { resolveRoute } from 'vuepress/client'\n\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":"+CAiBA,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 +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
+ {"version":3,"file":"resolveEditLink.js","names":[],"sources":["../../../src/client/utils/resolveEditLink.ts"],"sourcesContent":["import {\n isLinkHttp,\n removeEndingSlash,\n removeLeadingSlash,\n} from 'vuepress/shared'\n\nimport type { RepoType } from '@theme/resolveRepoType'\nimport { resolveRepoType } from '@theme/resolveRepoType'\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":"qJASA,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 @@
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 *\n * @param localeOptions - Locale options to 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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"}
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 *\n * @param localeOptions - Locale options to 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'\n\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'\n\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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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/theme-default",
3
- "version": "2.0.0-rc.125",
3
+ "version": "2.0.0-rc.126",
4
4
  "description": "Default theme of VuePress",
5
5
  "keywords": [
6
6
  "default",
@@ -54,29 +54,29 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@vuepress/helper": "2.0.0-rc.125",
58
- "@vuepress/plugin-active-header-links": "2.0.0-rc.125",
59
- "@vuepress/plugin-back-to-top": "2.0.0-rc.125",
60
- "@vuepress/plugin-copy-code": "2.0.0-rc.125",
61
- "@vuepress/plugin-git": "2.0.0-rc.125",
62
- "@vuepress/plugin-links-check": "2.0.0-rc.125",
63
- "@vuepress/plugin-markdown-hint": "2.0.0-rc.125",
64
- "@vuepress/plugin-markdown-tab": "2.0.0-rc.125",
65
- "@vuepress/plugin-medium-zoom": "2.0.0-rc.125",
66
- "@vuepress/plugin-nprogress": "2.0.0-rc.125",
67
- "@vuepress/plugin-palette": "2.0.0-rc.125",
68
- "@vuepress/plugin-prismjs": "2.0.0-rc.125",
69
- "@vuepress/plugin-seo": "2.0.0-rc.125",
70
- "@vuepress/plugin-sitemap": "2.0.0-rc.125",
71
- "@vuepress/plugin-theme-data": "2.0.0-rc.125",
57
+ "@vuepress/helper": "2.0.0-rc.126",
58
+ "@vuepress/plugin-active-header-links": "2.0.0-rc.126",
59
+ "@vuepress/plugin-back-to-top": "2.0.0-rc.126",
60
+ "@vuepress/plugin-copy-code": "2.0.0-rc.126",
61
+ "@vuepress/plugin-git": "2.0.0-rc.126",
62
+ "@vuepress/plugin-links-check": "2.0.0-rc.126",
63
+ "@vuepress/plugin-markdown-hint": "2.0.0-rc.126",
64
+ "@vuepress/plugin-markdown-tab": "2.0.0-rc.126",
65
+ "@vuepress/plugin-medium-zoom": "2.0.0-rc.126",
66
+ "@vuepress/plugin-nprogress": "2.0.0-rc.126",
67
+ "@vuepress/plugin-palette": "2.0.0-rc.126",
68
+ "@vuepress/plugin-prismjs": "2.0.0-rc.126",
69
+ "@vuepress/plugin-seo": "2.0.0-rc.126",
70
+ "@vuepress/plugin-sitemap": "2.0.0-rc.126",
71
+ "@vuepress/plugin-theme-data": "2.0.0-rc.126",
72
72
  "@vueuse/core": "^14.2.1",
73
- "vue": "^3.5.29"
73
+ "vue": "^3.5.31"
74
74
  },
75
75
  "peerDependencies": {
76
- "sass": "^1.97.3",
77
- "sass-embedded": "^1.97.3",
76
+ "sass": "^1.98.0",
77
+ "sass-embedded": "^1.98.0",
78
78
  "sass-loader": "^16.0.7",
79
- "vuepress": "2.0.0-rc.26"
79
+ "vuepress": "2.0.0-rc.27"
80
80
  },
81
81
  "peerDependenciesMeta": {
82
82
  "sass": {
@@ -89,5 +89,5 @@
89
89
  "optional": true
90
90
  }
91
91
  },
92
- "gitHead": "58e660bb7138f1883e5440a08903d09cdbabcdc8"
92
+ "gitHead": "3ff37676288f188ca791287db55a55b57ec062d0"
93
93
  }
@@ -1,11 +0,0 @@
1
- declare module '*.vue' {
2
- import type { ComponentOptions } from 'vue'
3
-
4
- const component: ComponentOptions
5
- export default component
6
- }
7
-
8
- declare module '*/styles/_variables.module.scss' {
9
- const cSSVariables: Record<string, string>
10
- export default cSSVariables
11
- }