Merge pull request #52 from pengzhanbo/vp-rc.7

perf: upgrade vuepress to rc.7
This commit is contained in:
pengzhanbo 2024-02-17 00:27:29 +08:00 committed by GitHub
commit 5f2234ea3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 1245 additions and 978 deletions

View File

@ -9,15 +9,15 @@
"docs:serve": "anywhere -s -h localhost -d .vuepress/dist"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@vuepress/bundler-vite": "2.0.0-rc.2",
"@vuepress/bundler-webpack": "2.0.0-rc.2",
"@vuepress/bundler-vite": "2.0.0-rc.7",
"@vuepress/bundler-webpack": "2.0.0-rc.7",
"anywhere": "^1.6.0",
"sass": "^1.70.0",
"sass-loader": "^14.0.0",
"vue": "^3.4.15",
"sass-loader": "^14.1.0",
"vue": "^3.4.19",
"vuepress-theme-plume": "workspace:*"
}
}

View File

@ -3,7 +3,7 @@
"type": "module",
"version": "1.0.0-rc.32",
"private": true,
"packageManager": "pnpm@8.15.1",
"packageManager": "pnpm@8.15.3",
"author": "pengzhanbo <q942450674@outlook.com> (https://github.com/pengzhanbo/)",
"license": "MIT",
"keywords": [
@ -38,8 +38,8 @@
"release:version": "bumpp package.json plugins/*/package.json theme/package.json --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all --tag --push"
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@pengzhanbo/eslint-config-vue": "^1.5.4",
"@pengzhanbo/stylelint-config": "^1.5.4",
"@types/lodash.merge": "^4.6.9",
@ -52,17 +52,17 @@
"cpx2": "^7.0.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.56.0",
"husky": "^9.0.6",
"lint-staged": "^15.2.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"rimraf": "^5.0.5",
"stylelint": "^16.2.0",
"stylelint": "^16.2.1",
"tsconfig-vuepress": "^4.5.0",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"vite": "^5.1.3"
},
"pnpm": {
"patchedDependencies": {
"@vuepress/markdown@2.0.0-rc.2": "patches/@vuepress__markdown@2.0.0-rc.2.patch"
"@vuepress/markdown@2.0.0-rc.7": "patches/@vuepress__markdown@2.0.0-rc.7.patch"
}
},
"lint-staged": {

View File

@ -1,5 +1,5 @@
diff --git a/dist/index.js b/dist/index.js
index de136bbd25d01677b7b86b6654b780765b9b7cec..b0ff18b8888fe4e691e8c8c2ee3db6ba9fd35ed2 100644
index 057c2897fdb1a01960724b83707a9c9d28205988..169e64c5e1d4b40aa48cdf07d0fb807e404f000e 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -267,7 +267,7 @@ var codePlugin = (md, {

View File

@ -28,15 +28,15 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"create-filter": "^1.0.1",
"fast-glob": "^3.3.2",
"gray-matter": "^4.0.3",

View File

@ -28,12 +28,12 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"publishConfig": {
"access": "public"

View File

@ -0,0 +1,29 @@
import { watch } from 'vue'
import { usePageData } from 'vuepress/client'
declare global {
interface Window {
_hmt?: [name: string, options: any][]
}
}
/**
* Add baidu analytics to the site
*
* @see https://tongji.baidu.com/
* @see https://tongji.baidu.com/holmes/Analytics/%E7%99%BE%E5%BA%A6%E7%BB%9F%E8%AE%A1%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C
* @see https://tongji.baidu.com/holmes/Analytics/%E6%8A%80%E6%9C%AF%E6%8E%A5%E5%85%A5%E6%8C%87%E5%8D%97/JS%20API/JS%20API%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/_trackPageview
*/
export function useBaiduTongji(): void {
if (!window._hmt)
return
const page = usePageData()
watch(
() => page.value.path,
(newLocation) => {
window._hmt?.push(['_trackPageview', newLocation])
},
)
}

View File

@ -0,0 +1,14 @@
import { defineClientConfig } from 'vuepress/client'
import type { ClientConfig } from 'vuepress/client'
import { useBaiduTongji } from './composables/index.js'
declare const __VUEPRESS_SSR__: boolean
export default defineClientConfig({
enhance() {
if (__VUEPRESS_SSR__)
return
useBaiduTongji()
},
}) as ClientConfig

View File

@ -1,23 +1,36 @@
import type { Plugin } from 'vuepress/core'
import type { Plugin, PluginObject } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'
export interface BaiduTongjiOptions {
key?: string
}
const __dirname = getDirname(import.meta.url)
export function baiduTongjiPlugin({ key = '' }: BaiduTongjiOptions): Plugin {
return {
name: '@vuepress-plume/plugin-baidu-tongji',
extendsPage: (page) => {
page.frontmatter.head ??= []
page.frontmatter.head?.push([
'script',
{ type: 'text/javascript' },
'var _hmt = _hmt || []',
])
page.frontmatter.head?.push([
'script',
{ src: `https://hm.baidu.com/hm.js?${key}` },
])
},
return (app) => {
const plugin: PluginObject = {
name: '@vuepress-plume/plugin-baidu-tongji',
}
if (app.env.isDev)
return plugin
return {
...plugin,
clientConfigFile: path.resolve(__dirname, '../client/config.js'),
extendsPage: (page) => {
page.frontmatter.head ??= []
page.frontmatter.head?.push([
'script',
{ type: 'text/javascript' },
'window._hmt = window._hmt || []',
])
page.frontmatter.head?.push([
'script',
{ src: `https://hm.baidu.com/hm.js?${key}`, async: true },
])
},
}
}
}

View File

@ -32,18 +32,18 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@vue/devtools-api": "6.5.1",
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"create-filter": "^1.0.1",
"vue": "^3.4.15"
"vue": "^3.4.19"
},
"publishConfig": {
"access": "public"

View File

@ -39,11 +39,11 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"markdown-it-container": "^4.0.0"

View File

@ -32,16 +32,15 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"vue": "^3.4.15",
"vue-router": "4.2.5"
"vue": "^3.4.19"
},
"publishConfig": {
"access": "public"

View File

@ -1,10 +1,7 @@
import { pagesComponents } from '@internal/pagesComponents'
import { computed, defineComponent, h } from 'vue'
import { usePageData } from 'vuepress/client'
import { computed, defineAsyncComponent, defineComponent, h } from 'vue'
import { resolveRoute, usePageComponent } from 'vuepress/client'
import { runCallbacks } from '../composables/index.js'
declare const __VUEPRESS_DEV__: boolean
/**
* Markdown rendered content
*/
@ -13,7 +10,7 @@ export const Content = defineComponent({
name: 'Content',
props: {
pageKey: {
path: {
type: String,
required: false,
default: '',
@ -21,22 +18,18 @@ export const Content = defineComponent({
},
setup(props) {
const page = usePageData()
const pageComponent = computed(
() => pagesComponents[props.pageKey || page.value.key],
)
return () =>
pageComponent.value
? h(pageComponent.value, {
onVnodeMounted: () => runCallbacks({ mounted: true }),
onVnodeUpdated: () => runCallbacks({ updated: true }),
onVnodeBeforeUnmount: () => runCallbacks({ beforeUnmount: true }),
})
: h(
'div',
__VUEPRESS_DEV__
? 'Page does not exist. This is a fallback content.'
: '404 Not Found',
)
const pageComponent = usePageComponent()
const ContentComponent = computed(() => {
if (!props.path)
return pageComponent.value
const route = resolveRoute(props.path)
return defineAsyncComponent(() => route.loader().then(({ comp }) => comp))
})
return () => h(ContentComponent.value, {
onVnodeMounted: () => runCallbacks({ mounted: true }),
onVnodeUpdated: () => runCallbacks({ updated: true }),
onVnodeBeforeUnmount: () => runCallbacks({ beforeUnmount: true }),
})
},
})

View File

@ -1,4 +0,0 @@
declare module '@internal/pagesComponents' {
const pagesComponents: Record<string, any>
export { pagesComponents }
}

View File

@ -32,16 +32,16 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@vuepress-plume/plugin-content-update": "workspace:*",
"vue": "^3.4.15"
"vue": "^3.4.19"
},
"publishConfig": {
"access": "public"

View File

@ -32,16 +32,16 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@iconify/vue": "^4.1.1",
"vue": "^3.4.15"
"vue": "^3.4.19"
},
"publishConfig": {
"access": "public"

View File

@ -36,27 +36,27 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"@netlify/functions": "^2.5.1",
"@netlify/functions": "^2.6.0",
"chalk": "^5.3.0",
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"cpx2": "^7.0.1",
"dotenv": "^16.4.1",
"esbuild": "^0.19.12",
"dotenv": "^16.4.4",
"esbuild": "^0.20.0",
"execa": "^8.0.1",
"netlify-cli": "^17.15.3",
"netlify-cli": "^17.16.2",
"portfinder": "^1.0.32"
},
"devDependencies": {
"@types/node": "^20.11.7"
"@types/node": "^20.11.19"
},
"publishConfig": {
"access": "public"

View File

@ -32,18 +32,18 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@vue/devtools-api": "6.5.1",
"chokidar": "^3.5.3",
"chokidar": "^3.6.0",
"create-filter": "^1.0.1",
"vue": "^3.4.15"
"vue": "^3.4.19"
},
"publishConfig": {
"access": "public"

View File

@ -26,17 +26,17 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@netlify/functions": "^2.5.1",
"@netlify/functions": "^2.6.0",
"leancloud-storage": "^4.15.2",
"vue": "^3.4.15",
"vue": "^3.4.19",
"vue-router": "4.2.5",
"vuepress-plugin-netlify-functions": "workspace:*"
},

View File

@ -28,19 +28,18 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
"ts": "tsc -b tsconfig.build.json"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@shikijs/transformers": "^1.1.2",
"@shikijs/twoslash": "^1.1.2",
"@shikijs/transformers": "^1.1.3",
"@shikijs/twoslash": "^1.1.3",
"nanoid": "^5.0.5",
"picocolors": "^1.0.0",
"shiki": "^1.1.2"
"shiki": "^1.1.3"
},
"publishConfig": {
"access": "public"

View File

@ -1,6 +1,5 @@
import { logger } from 'vuepress/utils'
import { colors as c, logger } from 'vuepress/utils'
import { customAlphabet } from 'nanoid'
import c from 'picocolors'
import type { ShikiTransformer } from 'shiki'
import {
addClassToHast,

1893
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,9 @@
<h2 align="center">vuepress-theme-plume</h2>
[![npm version](https://img.shields.io/npm/v/vuepress-theme-plume?color=32A9C3&labelColor=1B3C4A&label=npm)](https://www.npmjs.com/package/vuepress-theme-plume)
[![npm beta download](https://img.shields.io/npm/dt/@vuepress-plume/vuepress-theme-plume?color=32A9C3&labelColor=1B3C4A&label=beta%20downloads)](https://www.npmjs.com/package/vuepress-theme-plume)
[![npm download](https://img.shields.io/npm/dy/vuepress-theme-plume?color=32A9C3&labelColor=1B3C4A&label=downloads)](https://www.npmjs.com/package/vuepress-theme-plume)
![GitHub License](https://img.shields.io/github/license/pengzhanbo/vuepress-theme-plume?color=32A9C3&labelColor=1B3C4A)
<!-- [![npm beta download](https://img.shields.io/npm/dt/@vuepress-plume/vuepress-theme-plume?color=32A9C3&labelColor=1B3C4A&label=beta%20downloads)](https://www.npmjs.com/package/vuepress-theme-plume) -->
一个简约的,干净的,容易上手的 vuepress 主题,适用于博客和文档。

View File

@ -44,7 +44,7 @@
],
"scripts": {
"build": "pnpm run clean && pnpm run copy && pnpm run ts",
"clean": "rimraf lib *.tsbuildinfo",
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib",
"copy:watch": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png,woff2}\" lib -w",
"dev": "concurrently \"pnpm copy:watch\" \"pnpm ts:watch\"",
@ -52,7 +52,7 @@
"ts:watch": "tsc -b tsconfig.build.json --watch"
},
"peerDependencies": {
"vuepress": "2.0.0-rc.2"
"vuepress": "2.0.0-rc.7"
},
"dependencies": {
"@pengzhanbo/utils": "^1.1.1",
@ -65,28 +65,28 @@
"@vuepress-plume/plugin-iconify": "workspace:*",
"@vuepress-plume/plugin-notes-data": "workspace:*",
"@vuepress-plume/plugin-shikiji": "workspace:*",
"@vuepress/plugin-active-header-links": "2.0.0-rc.7",
"@vuepress/plugin-container": "2.0.0-rc.7",
"@vuepress/plugin-docsearch": "2.0.0-rc.7",
"@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-reading-time": "2.0.0-rc.9",
"@vuepress/plugin-search": "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/plugin-toc": "2.0.0-rc.7",
"@vuepress/plugin-active-header-links": "2.0.0-rc.14",
"@vuepress/plugin-container": "2.0.0-rc.12",
"@vuepress/plugin-docsearch": "2.0.0-rc.14",
"@vuepress/plugin-external-link-icon": "2.0.0-rc.14",
"@vuepress/plugin-git": "2.0.0-rc.12",
"@vuepress/plugin-medium-zoom": "2.0.0-rc.14",
"@vuepress/plugin-nprogress": "2.0.0-rc.14",
"@vuepress/plugin-palette": "2.0.0-rc.14",
"@vuepress/plugin-reading-time": "2.0.0-rc.14",
"@vuepress/plugin-search": "2.0.0-rc.14",
"@vuepress/plugin-seo": "2.0.0-rc.14",
"@vuepress/plugin-sitemap": "2.0.0-rc.14",
"@vuepress/plugin-theme-data": "2.0.0-rc.14",
"@vuepress/plugin-toc": "2.0.0-rc.14",
"@vueuse/core": "^10.7.2",
"date-fns": "^3.3.1",
"katex": "^0.16.9",
"lodash.merge": "^4.6.2",
"nanoid": "^5.0.4",
"vue": "^3.4.15",
"nanoid": "^5.0.5",
"vue": "^3.4.19",
"vue-router": "4.2.5",
"vuepress-plugin-comment2": "2.0.0-rc.20",
"vuepress-plugin-md-enhance": "2.0.0-rc.20"
"vuepress-plugin-comment2": "2.0.0-rc.23",
"vuepress-plugin-md-enhance": "2.0.0-rc.23"
}
}

View File

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useRouter } from 'vuepress/client'
import { EXTERNAL_URL_RE, normalizeLink } from '../utils/index.js'
import IconExternalLink from './icons/IconExternalLink.vue'

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { useScrollLock } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute } from 'vuepress/client'
import { useBlogExtract, useThemeLocaleData } from '../composables/index.js'
import { inBrowser } from '../utils/index.js'
import AutoLink from './AutoLink.vue'

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useRoute } from 'vue-router'
import { useRoute } from 'vuepress/client'
import { useBlogExtract } from '../composables/index.js'
import AutoLink from './AutoLink.vue'
import IconArchive from './icons/IconArchive.vue'

View File

@ -8,7 +8,7 @@ const theme = useThemeLocaleData()
<template>
<div v-if="theme.appearance" class="nav-screen-appearance">
<p class="text">
Appearance
{{ theme.appearanceText ?? 'Appearance' }}
</p>
<SwitchAppearance />
</div>

View File

@ -1,6 +1,6 @@
<script lang="ts" setup>
import { ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute } from 'vuepress/client'
const route = useRoute()
const backToTop = ref()

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { useRouter } from 'vuepress/client'
import { EXTERNAL_URL_RE } from '../utils/index.js'
interface Props {

View File

@ -1,6 +1,6 @@
import type { Ref } from 'vue'
import { ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute } from 'vuepress/client'
export interface UseNavReturn {
isScreenOpen: Ref<boolean>

View File

@ -1,10 +1,9 @@
import { usePageData, usePageFrontmatter, usePageLang } from 'vuepress/client'
import { usePageData, usePageFrontmatter, usePageLang, useRoute } from 'vuepress/client'
import { isPlainObject, isString } from 'vuepress/shared'
import { useBlogPostData } from '@vuepress-plume/plugin-blog-data/client'
import type { NotesSidebarItem } from '@vuepress-plume/plugin-notes-data'
import { computed } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import { useRoute } from 'vue-router'
import type {
NavItemWithLink,
PlumeThemeBlogPostItem,

View File

@ -1,5 +1,5 @@
import type { PageData } from 'vuepress/client'
import { usePageData, usePageFrontmatter, withBase } from 'vuepress/client'
import { usePageData, usePageFrontmatter, useRoute, withBase } from 'vuepress/client'
import type {
NotesData,
NotesSidebarItem,
@ -8,7 +8,6 @@ import { useNotesData } from '@vuepress-plume/plugin-notes-data/client'
import { useMediaQuery } from '@vueuse/core'
import type { ComputedRef, Ref } from 'vue'
import { computed, onMounted, onUnmounted, ref, watchEffect } from 'vue'
import { useRoute } from 'vue-router'
import type { PlumeThemePageData } from '../../shared/index.js'
import { isActive } from '../utils/index.js'
import { useThemeLocaleData } from './themeData.js'

View File

@ -1,14 +1,8 @@
import { isFunction, isString } from 'vuepress/shared'
import { useRouter } from 'vue-router'
import type { Router } from 'vue-router'
import { useRouter } from 'vuepress/client'
import type { Router } from 'vuepress/client'
import type { NavItemWithLink } from '../../shared/index.js'
declare module 'vue-router' {
interface RouteMeta {
title?: string
}
}
/**
* Resolve a route with redirection
*/
@ -45,7 +39,7 @@ export function useNavLink(item: string): NavItemWithLink {
// resolve the route correctly
const resolved = useResolveRouteWithRedirect(encodeURI(item))
return {
text: resolved.meta.title || item,
text: (resolved.meta as any).title || item,
link: resolved.name === '404' ? item : resolved.fullPath,
}
}

View File

@ -1,6 +1,6 @@
import { customRef, nextTick, toValue, watch } from 'vue'
import type { MaybeRef, MaybeRefOrGetter, Ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useRoute, useRouter } from 'vuepress/client'
import type { RouteParamValueRaw, Router } from 'vue-router'
import { tryOnScopeDispose } from '@vueuse/core'

View File

@ -1,7 +1,6 @@
<script setup lang="ts">
import { usePageData } from 'vuepress/client'
import { usePageData, useRoute } from 'vuepress/client'
import { computed, provide, watch } from 'vue'
import { useRoute } from 'vue-router'
import type { PlumeThemePageData } from '../../shared/index.js'
import Backdrop from '../components/Backdrop.vue'
import Blog from '../components/Blog.vue'

View File

@ -11,6 +11,7 @@ const defaultLocales: NonNullable<PlumeThemeLocaleOptions['locales']> = {
editLinkText: 'Edit this page',
lastUpdatedText: 'Last Updated',
contributorsText: 'Contributors',
appearanceText: 'Appearance',
},
'zh-CN': {
selectLanguageName: '简体中文',
@ -23,6 +24,7 @@ const defaultLocales: NonNullable<PlumeThemeLocaleOptions['locales']> = {
editLinkText: '编辑此页',
contributorsText: '贡献者',
lastUpdatedText: '上次更新',
appearanceText: '外观',
prevPageLabel: '上一页',
nextPageLabel: '下一页',

View File

@ -116,6 +116,11 @@ export interface PlumeThemeLocaleData extends LocaleData {
*/
appearance?: boolean | 'dark'
/**
*
*/
appearanceText?: string
/**
*
* sitemap seo等