@vuepress/theme-default
Advanced tools
Comparing version 2.0.0-rc.9 to 2.0.0-rc.10
import type { ComputedRef, InjectionKey } from 'vue'; | ||
import type { Router } from 'vue-router'; | ||
import type { PageData, PageHeader } from 'vuepress/client'; | ||
@@ -20,3 +19,3 @@ import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared/index.js'; | ||
*/ | ||
export declare const resolveSidebarItems: (frontmatter: DefaultThemeNormalPageFrontmatter, themeLocale: DefaultThemeData, page: PageData, router: Router, path: string) => ResolvedSidebarItem[]; | ||
export declare const resolveSidebarItems: (frontmatter: DefaultThemeNormalPageFrontmatter, themeLocale: DefaultThemeData, page: PageData, path: string) => ResolvedSidebarItem[]; | ||
/** | ||
@@ -34,6 +33,6 @@ * Util to transform page header to sidebar item | ||
*/ | ||
export declare const resolveArraySidebarItems: (page: PageData, router: Router, path: string, sidebarConfig: SidebarConfigArray, sidebarDepth: number) => ResolvedSidebarItem[]; | ||
export declare const resolveArraySidebarItems: (page: PageData, path: string, sidebarConfig: SidebarConfigArray, sidebarDepth: number) => ResolvedSidebarItem[]; | ||
/** | ||
* Resolve sidebar items if the config is a key -> value (path-prefix -> array) object | ||
*/ | ||
export declare const resolveMultiSidebarItems: (page: PageData, router: Router, path: string, sidebarConfig: SidebarConfigObject, sidebarDepth: number) => ResolvedSidebarItem[]; | ||
export declare const resolveMultiSidebarItems: (page: PageData, path: string, sidebarConfig: SidebarConfigObject, sidebarDepth: number) => ResolvedSidebarItem[]; |
import { computed, inject, provide } from 'vue'; | ||
import { useRoute, useRouter } from 'vue-router'; | ||
import { useRoute } from 'vue-router'; | ||
import { usePageData, usePageFrontmatter } from 'vuepress/client'; | ||
@@ -26,4 +26,3 @@ import { isPlainObject, isString, resolveLocalePath } from 'vuepress/shared'; | ||
const route = useRoute(); | ||
const router = useRouter(); | ||
const sidebarItems = computed(() => resolveSidebarItems(frontmatter.value, themeLocale.value, page.value, router, route.path)); | ||
const sidebarItems = computed(() => resolveSidebarItems(frontmatter.value, themeLocale.value, page.value, route.path)); | ||
provide(sidebarItemsSymbol, sidebarItems); | ||
@@ -36,3 +35,3 @@ }; | ||
*/ | ||
export const resolveSidebarItems = (frontmatter, themeLocale, page, router, path) => { | ||
export const resolveSidebarItems = (frontmatter, themeLocale, page, path) => { | ||
// get sidebar config from frontmatter > theme data | ||
@@ -49,6 +48,6 @@ const sidebarConfig = frontmatter.sidebar ?? themeLocale.sidebar ?? 'auto'; | ||
if (Array.isArray(sidebarConfig)) { | ||
return resolveArraySidebarItems(page, router, path, sidebarConfig, sidebarDepth); | ||
return resolveArraySidebarItems(page, path, sidebarConfig, sidebarDepth); | ||
} | ||
if (isPlainObject(sidebarConfig)) { | ||
return resolveMultiSidebarItems(page, router, path, sidebarConfig, sidebarDepth); | ||
return resolveMultiSidebarItems(page, path, sidebarConfig, sidebarDepth); | ||
} | ||
@@ -82,7 +81,7 @@ return []; | ||
*/ | ||
export const resolveArraySidebarItems = (page, router, path, sidebarConfig, sidebarDepth) => { | ||
export const resolveArraySidebarItems = (page, path, sidebarConfig, sidebarDepth) => { | ||
const handleChildItem = (item) => { | ||
let childItem; | ||
if (isString(item)) { | ||
childItem = getNavLink(router, item); | ||
childItem = getNavLink(item); | ||
} | ||
@@ -115,3 +114,3 @@ else { | ||
*/ | ||
export const resolveMultiSidebarItems = (page, router, path, sidebarConfig, sidebarDepth) => { | ||
export const resolveMultiSidebarItems = (page, path, sidebarConfig, sidebarDepth) => { | ||
const sidebarPath = resolveLocalePath(sidebarConfig, path); | ||
@@ -122,3 +121,3 @@ const matchedSidebarConfig = sidebarConfig[sidebarPath] ?? []; | ||
} | ||
return resolveArraySidebarItems(page, router, path, matchedSidebarConfig, sidebarDepth); | ||
return resolveArraySidebarItems(page, path, matchedSidebarConfig, sidebarDepth); | ||
}; |
@@ -1,3 +0,3 @@ | ||
export * from '../shared/index.js'; | ||
export * from './composables/index.js'; | ||
export * from './utils/index.js'; | ||
export type * from '../shared/index.js'; |
@@ -1,3 +0,2 @@ | ||
export * from '../shared/index.js'; | ||
export * from './composables/index.js'; | ||
export * from './utils/index.js'; |
@@ -1,8 +0,2 @@ | ||
import type { Router } from 'vue-router'; | ||
import type { NavLink } from '../../shared/index.js'; | ||
declare module 'vue-router' { | ||
interface RouteMeta { | ||
title?: string; | ||
} | ||
} | ||
/** | ||
@@ -15,2 +9,2 @@ * Resolve NavLink props from string | ||
*/ | ||
export declare const getNavLink: (router: Router, item: string) => NavLink; | ||
export declare const getNavLink: (config: string) => NavLink; |
@@ -1,2 +0,2 @@ | ||
import { getResolveRouteWithRedirect } from './getResolveRouteWithRedirect.js'; | ||
import { resolveRoute } from 'vuepress/client'; | ||
/** | ||
@@ -9,11 +9,10 @@ * Resolve NavLink props from string | ||
*/ | ||
export const getNavLink = (router, item) => { | ||
// the route path of vue-router is url-encoded, and we expect users are using | ||
// non-url-encoded string in theme config, so we need to url-encode it first to | ||
// resolve the route correctly | ||
const resolved = getResolveRouteWithRedirect(router, encodeURI(item)); | ||
return { | ||
text: resolved.meta.title || item, | ||
link: resolved.name === '404' ? item : resolved.fullPath, | ||
}; | ||
export const getNavLink = (config) => { | ||
const { notFound, meta, path } = resolveRoute(config); | ||
return notFound | ||
? { text: path, link: path } | ||
: { | ||
text: meta.title || path, | ||
link: path, | ||
}; | ||
}; |
export * from './getNavLink.js'; | ||
export * from './getResolveRouteWithRedirect.js'; | ||
export * from './isActiveSidebarItem.js'; | ||
export * from './resolveEditLink.js'; | ||
export * from './resolveRepoType.js'; |
export * from './getNavLink.js'; | ||
export * from './getResolveRouteWithRedirect.js'; | ||
export * from './isActiveSidebarItem.js'; | ||
export * from './resolveEditLink.js'; | ||
export * from './resolveRepoType.js'; |
import { defaultTheme } from './defaultTheme.js'; | ||
export * from '../shared/index.js'; | ||
export * from './defaultTheme.js'; | ||
export * from './utils/index.js'; | ||
export type * from '../shared/index.js'; | ||
/** @deprecated Use named export instead */ | ||
export default defaultTheme; |
import { defaultTheme } from './defaultTheme.js'; | ||
export * from '../shared/index.js'; | ||
export * from './defaultTheme.js'; | ||
export * from './utils/index.js'; | ||
/** @deprecated Use named export instead */ | ||
export default defaultTheme; |
{ | ||
"name": "@vuepress/theme-default", | ||
"version": "2.0.0-rc.9", | ||
"version": "2.0.0-rc.10", | ||
"description": "Default theme of VuePress", | ||
@@ -45,16 +45,16 @@ "keywords": [ | ||
"dependencies": { | ||
"@vuepress/helper": "2.0.0-rc.9", | ||
"@vuepress/plugin-active-header-links": "2.0.0-rc.7", | ||
"@vuepress/plugin-back-to-top": "2.0.0-rc.9", | ||
"@vuepress/plugin-container": "2.0.0-rc.7", | ||
"@vuepress/plugin-copy-code": "2.0.0-rc.9", | ||
"@vuepress/plugin-external-link-icon": "2.0.0-rc.7", | ||
"@vuepress/plugin-git": "2.0.0-rc.7", | ||
"@vuepress/plugin-medium-zoom": "2.0.0-rc.7", | ||
"@vuepress/plugin-nprogress": "2.0.0-rc.7", | ||
"@vuepress/plugin-palette": "2.0.0-rc.7", | ||
"@vuepress/plugin-prismjs": "2.0.0-rc.7", | ||
"@vuepress/plugin-seo": "2.0.0-rc.9", | ||
"@vuepress/plugin-sitemap": "2.0.0-rc.9", | ||
"@vuepress/plugin-theme-data": "2.0.0-rc.7", | ||
"@vuepress/helper": "~2.0.0-rc.10", | ||
"@vuepress/plugin-active-header-links": "2.0.0-rc.10", | ||
"@vuepress/plugin-back-to-top": "2.0.0-rc.10", | ||
"@vuepress/plugin-container": "2.0.0-rc.10", | ||
"@vuepress/plugin-copy-code": "2.0.0-rc.10", | ||
"@vuepress/plugin-external-link-icon": "2.0.0-rc.10", | ||
"@vuepress/plugin-git": "2.0.0-rc.10", | ||
"@vuepress/plugin-medium-zoom": "2.0.0-rc.10", | ||
"@vuepress/plugin-nprogress": "2.0.0-rc.10", | ||
"@vuepress/plugin-palette": "2.0.0-rc.10", | ||
"@vuepress/plugin-prismjs": "2.0.0-rc.10", | ||
"@vuepress/plugin-seo": "2.0.0-rc.10", | ||
"@vuepress/plugin-sitemap": "2.0.0-rc.10", | ||
"@vuepress/plugin-theme-data": "2.0.0-rc.10", | ||
"@vueuse/core": "^10.7.2", | ||
@@ -67,3 +67,3 @@ "sass": "^1.70.0", | ||
"sass-loader": "^14.0.0", | ||
"vuepress": "2.0.0-rc.2" | ||
"vuepress": "2.0.0-rc.5" | ||
}, | ||
@@ -78,3 +78,3 @@ "peerDependenciesMeta": { | ||
}, | ||
"gitHead": "12c12dadd0758df4ad5256851fc3cb3c949873e8" | ||
"gitHead": "2e4d75617b030b584fb59346087790c982dbf411" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125581
95
1231
+ Added@vue/compiler-core@3.5.3(transitive)
+ Added@vue/compiler-dom@3.5.3(transitive)
+ Added@vue/compiler-sfc@3.5.3(transitive)
+ Added@vue/compiler-ssr@3.5.3(transitive)
+ Added@vue/devtools-api@6.6.3(transitive)
+ Added@vue/reactivity@3.5.3(transitive)
+ Added@vue/runtime-core@3.5.3(transitive)
+ Added@vue/runtime-dom@3.5.3(transitive)
+ Added@vue/server-renderer@3.5.3(transitive)
+ Added@vue/shared@3.5.3(transitive)
+ Added@vuepress/cli@2.0.0-rc.5(transitive)
+ Added@vuepress/client@2.0.0-rc.5(transitive)
+ Added@vuepress/core@2.0.0-rc.5(transitive)
+ Added@vuepress/helper@2.0.0-rc.42(transitive)
+ Added@vuepress/markdown@2.0.0-rc.5(transitive)
+ Added@vuepress/plugin-active-header-links@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-back-to-top@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-container@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-copy-code@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-external-link-icon@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-git@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-medium-zoom@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-nprogress@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-palette@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-prismjs@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-seo@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-sitemap@2.0.0-rc.10(transitive)
+ Added@vuepress/plugin-theme-data@2.0.0-rc.10(transitive)
+ Added@vuepress/shared@2.0.0-rc.5(transitive)
+ Added@vuepress/utils@2.0.0-rc.5(transitive)
+ Addedansi-regex@6.0.1(transitive)
+ Addedcheerio@1.0.0(transitive)
+ Addedencoding-sniffer@0.2.0(transitive)
+ Addedhtmlparser2@9.1.0(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-unicode-supported@2.0.0(transitive)
+ Addedparse5-parser-stream@7.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedundici@6.19.8(transitive)
+ Addedvue@3.5.3(transitive)
+ Addedvue-router@4.4.3(transitive)
+ Addedvuepress@2.0.0-rc.5(transitive)
+ Addedwhatwg-encoding@3.1.1(transitive)
+ Addedwhatwg-mimetype@4.0.0(transitive)
- Removed@vue/compiler-core@3.5.4(transitive)
- Removed@vue/compiler-dom@3.5.4(transitive)
- Removed@vue/compiler-sfc@3.5.4(transitive)
- Removed@vue/compiler-ssr@3.5.4(transitive)
- Removed@vue/devtools-api@6.6.4(transitive)
- Removed@vue/reactivity@3.5.4(transitive)
- Removed@vue/runtime-core@3.5.4(transitive)
- Removed@vue/runtime-dom@3.5.4(transitive)
- Removed@vue/server-renderer@3.5.4(transitive)
- Removed@vue/shared@3.5.4(transitive)
- Removed@vuepress/cli@2.0.0-rc.2(transitive)
- Removed@vuepress/client@2.0.0-rc.2(transitive)
- Removed@vuepress/core@2.0.0-rc.2(transitive)
- Removed@vuepress/helper@2.0.0-rc.9(transitive)
- Removed@vuepress/markdown@2.0.0-rc.2(transitive)
- Removed@vuepress/plugin-active-header-links@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-back-to-top@2.0.0-rc.9(transitive)
- Removed@vuepress/plugin-container@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-copy-code@2.0.0-rc.9(transitive)
- Removed@vuepress/plugin-external-link-icon@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-git@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-medium-zoom@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-nprogress@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-palette@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-prismjs@2.0.0-rc.7(transitive)
- Removed@vuepress/plugin-seo@2.0.0-rc.9(transitive)
- Removed@vuepress/plugin-sitemap@2.0.0-rc.9(transitive)
- Removed@vuepress/plugin-theme-data@2.0.0-rc.7(transitive)
- Removed@vuepress/shared@2.0.0-rc.2(transitive)
- Removed@vuepress/utils@2.0.0-rc.2(transitive)
- Removedansi-regex@6.1.0(transitive)
- Removedcheerio@1.0.0-rc.12(transitive)
- Removedhtmlparser2@8.0.2(transitive)
- Removedis-unicode-supported@2.1.0(transitive)
- Removedvue@3.5.4(transitive)
- Removedvue-router@4.4.4(transitive)
- Removedvuepress@2.0.0-rc.2(transitive)