@vuepress/client
Advanced tools
Comparing version 2.0.0-alpha.19 to 2.0.0-alpha.20
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.0.0-alpha.20](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2021-02-04) | ||
### Features | ||
* **core:** make language available in page data ([03bb09f](https://github.com/vuepress/vuepress-next/commit/03bb09fd51aeaff56d26820a1401b87ea8bdeb38)) | ||
# [2.0.0-alpha.19](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2021-01-24) | ||
@@ -8,0 +19,0 @@ |
@@ -66,3 +66,3 @@ import { computed, h } from 'vue'; | ||
const pageHead = computed(() => resolvePageHead(pageHeadTitle.value, pageFrontmatter.value, siteLocaleData.value)); | ||
const pageLang = computed(() => resolvePageLang(pageFrontmatter.value, siteLocaleData.value)); | ||
const pageLang = computed(() => resolvePageLang(pageData.value)); | ||
// provide global computed | ||
@@ -69,0 +69,0 @@ app.provide(routeLocaleSymbol, routeLocale); |
@@ -7,2 +7,3 @@ import { ref, readonly } from 'vue'; | ||
title: '', | ||
lang: '', | ||
frontmatter: {}, | ||
@@ -9,0 +10,0 @@ excerpt: '', |
import type { ComputedRef, InjectionKey } from 'vue'; | ||
import type { PageFrontmatter } from './pageFrontmatter'; | ||
import type { SiteLocaleData } from './siteLocaleData'; | ||
import type { PageData } from '@vuepress/shared'; | ||
export declare type PageLang = string; | ||
@@ -8,3 +7,9 @@ export declare type PageLangRef = ComputedRef<PageLang>; | ||
export declare const usePageLang: () => PageLangRef; | ||
export declare const resolvePageLang: (frontmatter: PageFrontmatter, siteLocale: SiteLocaleData) => PageLang; | ||
/** | ||
* Resolve language of current page | ||
* | ||
* It's mainly used for the `lang` attribute of `<html>` tag, | ||
* which should not be empty | ||
*/ | ||
export declare const resolvePageLang: (pageData: PageData) => PageLang; | ||
//# sourceMappingURL=pageLang.d.ts.map |
import { inject } from 'vue'; | ||
import { isString } from '@vuepress/shared'; | ||
export const pageLangSymbol = Symbol(__DEV__ ? 'pageLang' : ''); | ||
@@ -11,8 +10,9 @@ export const usePageLang = () => { | ||
}; | ||
export const resolvePageLang = (frontmatter, siteLocale) => { | ||
if (isString(frontmatter.lang) && frontmatter.lang) { | ||
return frontmatter.lang; | ||
} | ||
return siteLocale.lang || 'en'; | ||
}; | ||
/** | ||
* Resolve language of current page | ||
* | ||
* It's mainly used for the `lang` attribute of `<html>` tag, | ||
* which should not be empty | ||
*/ | ||
export const resolvePageLang = (pageData) => pageData.lang || 'en'; | ||
//# sourceMappingURL=pageLang.js.map |
{ | ||
"name": "@vuepress/client", | ||
"version": "2.0.0-alpha.19", | ||
"version": "2.0.0-alpha.20", | ||
"description": "Client package of VuePress", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@vuepress/shared": "2.0.0-alpha.19", | ||
"@vuepress/shared": "2.0.0-alpha.20", | ||
"vue": "^3.0.5", | ||
@@ -39,3 +39,3 @@ "vue-router": "^4.0.3" | ||
}, | ||
"gitHead": "e552dec8e107b66196515c8245b5385de85e3dc3" | ||
"gitHead": "5c80ff3d24e4303734c87626b862ea04ff441ffa" | ||
} |
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
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
68727
824
+ Added@vuepress/shared@2.0.0-alpha.20(transitive)
- Removed@vuepress/shared@2.0.0-alpha.19(transitive)