From 5de60d4d6e7fa83ebbdd2127df7e4cbd0bfe269b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 19 Oct 2022 02:30:20 +0800 Subject: [PATCH] feat(theme): plume-theme next devloping ! add plugin-auto-frontmatter | add plugin-blog-data | devloping new theme --- .gitignore | 2 + .vscode/settings.json | 1 + docs/.vuepress/config.ts | 2 +- docs/1.前端/1.基础/BFC 块级格式化上下文.md | 6 +- docs/1.前端/1.基础/CSS at-rule.md | 6 +- docs/1.前端/1.基础/CSS media媒体查询.md | 4 +- docs/1.前端/1.基础/CSS选择器.md | 6 +- docs/1.前端/1.基础/DOCTYPE 文档类型声明.md | 6 +- docs/1.前端/1.基础/HTML5新特性.md | 6 +- docs/1.前端/1.基础/WebComponent-template.md | 4 +- docs/1.前端/1.基础/WebComponent自定义元素.md | 4 +- docs/1.前端/1.基础/meta 标签说明.md | 6 +- docs/1.前端/1.基础/原型链与继承.md | 4 +- docs/1.前端/1.基础/正则表达式使用手册.md | 4 +- docs/1.前端/1.基础/浏览器端的事件循环.md | 3 +- docs/1.前端/1.基础/详解Promise.md | 2 +- docs/1.前端/10.开发/1px解决方案.md | 4 +- docs/1.前端/10.开发/lerna使用.md | 4 +- docs/1.前端/10.开发/移动端适配方案.md | 6 +- docs/1.前端/2.工具/Jenkinss使用.md | 4 +- docs/1.前端/2.工具/caniuse.md | 4 +- docs/1.前端/2.工具/vsCode插件推荐.md | 4 +- docs/1.前端/3.Vue/Vue组件间通信.md | 4 +- docs/10.面试/面试2.md | 2 +- docs/10.面试/面试题-JS篇.md | 4 +- docs/10.面试/面试题—css篇.md | 4 +- docs/README.md | 3 + docs/notes/README.md | 3 +- docs/notes/vuepress-plugin/caniuse/README.md | 2 +- .../vuepress-plugin/netlify-functions/API.md | 2 +- .../netlify-functions/README.md | 2 +- .../netlify-functions/functions开发指南.md | 2 +- .../vuepress-plugin/netlify-functions/介绍.md | 2 +- .../vuepress-plugin/netlify-functions/使用.md | 2 +- .../vuepress-plugin/netlify-functions/功能.md | 2 +- docs/notes/vuepress-theme-plume/README.md | 2 +- .../vuepress-theme-plume/markdown增强.md | 2 +- docs/notes/vuepress-theme-plume/notes配置.md | 2 +- .../vuepress-theme-plume/主题插件配置.md | 2 +- docs/notes/vuepress-theme-plume/主题配置.md | 2 +- docs/notes/vuepress-theme-plume/基础功能.md | 2 +- docs/notes/vuepress-theme-plume/快速开始.md | 2 +- docs/notes/vuepress-theme-plume/编写文章.md | 2 +- docs/notes/vuepress-theme-plume/页面配置.md | 2 +- .../LICENSE | 0 packages/plugin-auto-frontmatter/README.md | 115 ++++++ packages/plugin-auto-frontmatter/package.json | 48 +++ .../plugin-auto-frontmatter/src/node/env.d.ts | 16 + .../plugin-auto-frontmatter/src/node/index.ts | 8 + .../src/node/plugin.ts | 83 +++++ .../src/node/readFiles.ts | 33 ++ .../src/shared/index.ts | 36 ++ .../tsconfig.build.json | 9 + packages/plugin-blog-data/LICENSE | 21 ++ packages/plugin-blog-data/package.json | 51 +++ .../src/client/blogPostData.d.ts | 7 + .../src/client/composables/index.ts | 1 + .../src/client/composables/useBlogPostData.ts | 20 ++ .../plugin-blog-data/src/client/config.ts | 36 ++ packages/plugin-blog-data/src/client/index.ts | 4 + packages/plugin-blog-data/src/node/env.d.ts | 16 + packages/plugin-blog-data/src/node/index.ts | 6 + packages/plugin-blog-data/src/node/plugin.ts | 63 ++++ .../src/node/prepareBlogData.ts | 79 +++++ packages/plugin-blog-data/src/shared/index.ts | 16 + packages/plugin-blog-data/tsconfig.build.json | 13 + packages/theme/CHANGELOG.md | 229 ------------ packages/theme/package.json | 33 +- .../theme/src/client/components/Archive.vue | 171 --------- .../src/client/components/AsideNavbar.vue | 47 --- .../theme/src/client/components/AutoLink.vue | 105 ------ .../theme/src/client/components/BackToTop.vue | 65 ---- .../theme/src/client/components/BlogInfo.vue | 32 -- .../src/client/components/BloggerInfo.vue | 195 ---------- .../theme/src/client/components/Category.vue | 43 --- .../src/client/components/CategoryGroup.vue | 98 ----- .../src/client/components/DarkModeButton.vue | 76 ---- .../client/components/DropdownTransition.vue | 59 ---- packages/theme/src/client/components/Home.vue | 27 +- .../src/client/components/HomeBigBanner.vue | 166 --------- .../theme/src/client/components/Navbar.vue | 160 --------- .../src/client/components/NavbarBrand.vue | 84 ----- .../src/client/components/NavbarDropdown.vue | 334 ------------------ .../src/client/components/NavbarItems.vue | 79 ----- packages/theme/src/client/components/Page.vue | 110 ------ .../src/client/components/PageFooter.vue | 49 --- .../src/client/components/Pagination.vue | 203 ----------- .../theme/src/client/components/PostItem.vue | 59 ---- .../theme/src/client/components/PostList.vue | 195 ---------- .../theme/src/client/components/PostMeta.vue | 126 ------- .../theme/src/client/components/Sidebar.vue | 94 ----- .../src/client/components/SidebarItems.vue | 157 -------- packages/theme/src/client/components/Tag.vue | 100 ------ packages/theme/src/client/components/Toc.ts | 148 -------- .../client/components/ToggleSidebarButton.vue | 65 ---- .../src/client/components/global/Badge.vue | 57 --- .../src/client/components/icons/IconBase.ts | 39 -- .../theme/src/client/components/icons/icon.ts | 109 ------ .../src/client/components/icons/index.ts | 3 - .../src/client/components/icons/socialIcon.ts | 126 ------- .../theme/src/client/composables/archive.ts | 42 --- .../src/client/composables/asideNavbar.ts | 23 -- .../theme/src/client/composables/blogger.ts | 0 .../theme/src/client/composables/category.ts | 89 ----- .../theme/src/client/composables/darkMode.ts | 56 --- .../theme/src/client/composables/index.ts | 16 - .../theme/src/client/composables/navLink.ts | 16 - .../theme/src/client/composables/navbar.ts | 128 ------- .../theme/src/client/composables/postIndex.ts | 47 --- .../theme/src/client/composables/postList.ts | 45 --- .../theme/src/client/composables/postStat.ts | 31 -- .../composables/resolveRouteWithRedirect.ts | 26 -- .../src/client/composables/scrollPromise.ts | 21 -- .../src/client/composables/sidebarIndex.ts | 49 --- packages/theme/src/client/composables/tag.ts | 25 -- .../theme/src/client/composables/themeData.ts | 15 - packages/theme/src/client/config.ts | 38 +- packages/theme/src/client/index.ts | 1 - packages/theme/src/client/layouts/404.vue | 33 -- packages/theme/src/client/layouts/Layout.vue | 69 +--- .../theme/src/client/layouts/NotFound.vue | 3 + packages/theme/src/client/shim.d.ts | 16 - packages/theme/src/client/styles/_mixins.scss | 38 -- .../theme/src/client/styles/_variables.scss | 11 - packages/theme/src/client/styles/arrow.scss | 37 -- packages/theme/src/client/styles/code.scss | 282 --------------- packages/theme/src/client/styles/icons.scss | 4 - packages/theme/src/client/styles/index.scss | 13 - packages/theme/src/client/styles/layout.scss | 13 - .../theme/src/client/styles/normalize.scss | 187 ---------- packages/theme/src/client/styles/toc.scss | 63 ---- .../theme/src/client/styles/transition.scss | 30 -- .../theme/src/client/styles/vars-dark.scss | 46 --- packages/theme/src/client/styles/vars.scss | 129 ------- packages/theme/src/client/utils/animate.ts | 14 - packages/theme/src/client/utils/check.ts | 3 - packages/theme/src/client/utils/color.ts | 24 -- packages/theme/src/client/utils/dom.ts | 65 ---- packages/theme/src/client/utils/index.ts | 5 - packages/theme/src/client/utils/path.ts | 3 - .../theme/src/client/utils/resolveRepoType.ts | 11 - packages/theme/src/node/alias.ts | 14 - packages/theme/src/node/autoFrontmatter.ts | 36 ++ packages/theme/src/node/createPage/archive.ts | 18 - .../theme/src/node/createPage/category.ts | 18 - packages/theme/src/node/createPage/index.ts | 14 - packages/theme/src/node/createPage/note.ts | 0 packages/theme/src/node/createPage/tag.ts | 18 - .../theme/src/node/defaultLocaleOption.ts | 11 - .../src/node/{define.ts => defineConfig.ts} | 0 packages/theme/src/node/extendsPage.ts | 60 ---- .../theme/src/node/generateFrontmatter.ts | 143 -------- packages/theme/src/node/index.ts | 22 +- packages/theme/src/node/plugins.ts | 146 ++++++++ .../src/node/plugins/activeHeaderLink.ts | 11 - .../theme/src/node/plugins/baiduTongji.ts | 12 - packages/theme/src/node/plugins/caniuse.ts | 12 - packages/theme/src/node/plugins/comment.ts | 9 - packages/theme/src/node/plugins/copyCode.ts | 18 - .../src/node/plugins/externalLinkIcon.ts | 25 -- packages/theme/src/node/plugins/git.ts | 14 - packages/theme/src/node/plugins/index.ts | 46 --- .../theme/src/node/plugins/markdownEnhance.ts | 24 -- packages/theme/src/node/plugins/mediumZoom.ts | 12 - packages/theme/src/node/plugins/nprogress.ts | 8 - packages/theme/src/node/plugins/palette.ts | 6 - packages/theme/src/node/plugins/prismjs.ts | 8 - packages/theme/src/node/plugins/search.ts | 14 - packages/theme/src/node/plugins/seo.ts | 20 -- packages/theme/src/node/plugins/sitemap.ts | 19 - packages/theme/src/node/plugins/themeData.ts | 8 - packages/theme/src/node/prepared/index.ts | 21 -- packages/theme/src/node/prepared/postIndex.ts | 87 ----- .../theme/src/node/prepared/sidebarIndex.ts | 177 ---------- packages/theme/src/node/shims.d.ts | 5 - packages/theme/src/node/theme.ts | 63 ++-- packages/theme/src/node/utils/date.ts | 12 - packages/theme/src/node/utils/index.ts | 3 - packages/theme/src/node/utils/path.ts | 15 - packages/theme/src/node/utils/readFileList.ts | 44 --- .../{frontmatter/post.ts => frontmatter.ts} | 9 +- packages/theme/src/shared/frontmatter/home.ts | 18 - .../theme/src/shared/frontmatter/index.ts | 3 - .../theme/src/shared/frontmatter/normal.ts | 3 - packages/theme/src/shared/index.ts | 6 +- packages/theme/src/shared/layout/index.ts | 3 - packages/theme/src/shared/layout/navbar.ts | 22 -- packages/theme/src/shared/layout/sidebar.ts | 7 - .../src/shared/{options/notes.ts => note.ts} | 0 packages/theme/src/shared/options/index.ts | 19 +- packages/theme/src/shared/options/locale.ts | 9 +- packages/theme/src/shared/options/options.ts | 14 - .../shared/options/{plugin.ts => plugins.ts} | 3 + packages/theme/src/shared/page.ts | 3 - packages/theme/src/shared/post.ts | 22 -- .../index.build.html => templates/build.html} | 14 +- pnpm-lock.yaml | 185 +++++++++- tsconfig.json | 3 + 198 files changed, 1213 insertions(+), 6558 deletions(-) rename packages/{theme => plugin-auto-frontmatter}/LICENSE (100%) create mode 100644 packages/plugin-auto-frontmatter/README.md create mode 100644 packages/plugin-auto-frontmatter/package.json create mode 100644 packages/plugin-auto-frontmatter/src/node/env.d.ts create mode 100644 packages/plugin-auto-frontmatter/src/node/index.ts create mode 100644 packages/plugin-auto-frontmatter/src/node/plugin.ts create mode 100644 packages/plugin-auto-frontmatter/src/node/readFiles.ts create mode 100644 packages/plugin-auto-frontmatter/src/shared/index.ts create mode 100644 packages/plugin-auto-frontmatter/tsconfig.build.json create mode 100644 packages/plugin-blog-data/LICENSE create mode 100644 packages/plugin-blog-data/package.json create mode 100644 packages/plugin-blog-data/src/client/blogPostData.d.ts create mode 100644 packages/plugin-blog-data/src/client/composables/index.ts create mode 100644 packages/plugin-blog-data/src/client/composables/useBlogPostData.ts create mode 100644 packages/plugin-blog-data/src/client/config.ts create mode 100644 packages/plugin-blog-data/src/client/index.ts create mode 100644 packages/plugin-blog-data/src/node/env.d.ts create mode 100644 packages/plugin-blog-data/src/node/index.ts create mode 100644 packages/plugin-blog-data/src/node/plugin.ts create mode 100644 packages/plugin-blog-data/src/node/prepareBlogData.ts create mode 100644 packages/plugin-blog-data/src/shared/index.ts create mode 100644 packages/plugin-blog-data/tsconfig.build.json delete mode 100644 packages/theme/CHANGELOG.md delete mode 100644 packages/theme/src/client/components/Archive.vue delete mode 100644 packages/theme/src/client/components/AsideNavbar.vue delete mode 100644 packages/theme/src/client/components/AutoLink.vue delete mode 100644 packages/theme/src/client/components/BackToTop.vue delete mode 100644 packages/theme/src/client/components/BlogInfo.vue delete mode 100644 packages/theme/src/client/components/BloggerInfo.vue delete mode 100644 packages/theme/src/client/components/Category.vue delete mode 100644 packages/theme/src/client/components/CategoryGroup.vue delete mode 100644 packages/theme/src/client/components/DarkModeButton.vue delete mode 100644 packages/theme/src/client/components/DropdownTransition.vue delete mode 100644 packages/theme/src/client/components/HomeBigBanner.vue delete mode 100644 packages/theme/src/client/components/Navbar.vue delete mode 100644 packages/theme/src/client/components/NavbarBrand.vue delete mode 100644 packages/theme/src/client/components/NavbarDropdown.vue delete mode 100644 packages/theme/src/client/components/NavbarItems.vue delete mode 100644 packages/theme/src/client/components/Page.vue delete mode 100644 packages/theme/src/client/components/PageFooter.vue delete mode 100644 packages/theme/src/client/components/Pagination.vue delete mode 100644 packages/theme/src/client/components/PostItem.vue delete mode 100644 packages/theme/src/client/components/PostList.vue delete mode 100644 packages/theme/src/client/components/PostMeta.vue delete mode 100644 packages/theme/src/client/components/Sidebar.vue delete mode 100644 packages/theme/src/client/components/SidebarItems.vue delete mode 100644 packages/theme/src/client/components/Tag.vue delete mode 100644 packages/theme/src/client/components/Toc.ts delete mode 100644 packages/theme/src/client/components/ToggleSidebarButton.vue delete mode 100644 packages/theme/src/client/components/global/Badge.vue delete mode 100644 packages/theme/src/client/components/icons/IconBase.ts delete mode 100644 packages/theme/src/client/components/icons/icon.ts delete mode 100644 packages/theme/src/client/components/icons/index.ts delete mode 100644 packages/theme/src/client/components/icons/socialIcon.ts delete mode 100644 packages/theme/src/client/composables/archive.ts delete mode 100644 packages/theme/src/client/composables/asideNavbar.ts delete mode 100644 packages/theme/src/client/composables/blogger.ts delete mode 100644 packages/theme/src/client/composables/category.ts delete mode 100644 packages/theme/src/client/composables/darkMode.ts delete mode 100644 packages/theme/src/client/composables/index.ts delete mode 100644 packages/theme/src/client/composables/navLink.ts delete mode 100644 packages/theme/src/client/composables/navbar.ts delete mode 100644 packages/theme/src/client/composables/postIndex.ts delete mode 100644 packages/theme/src/client/composables/postList.ts delete mode 100644 packages/theme/src/client/composables/postStat.ts delete mode 100644 packages/theme/src/client/composables/resolveRouteWithRedirect.ts delete mode 100644 packages/theme/src/client/composables/scrollPromise.ts delete mode 100644 packages/theme/src/client/composables/sidebarIndex.ts delete mode 100644 packages/theme/src/client/composables/tag.ts delete mode 100644 packages/theme/src/client/composables/themeData.ts delete mode 100644 packages/theme/src/client/layouts/404.vue create mode 100644 packages/theme/src/client/layouts/NotFound.vue delete mode 100644 packages/theme/src/client/styles/_mixins.scss delete mode 100644 packages/theme/src/client/styles/_variables.scss delete mode 100644 packages/theme/src/client/styles/arrow.scss delete mode 100644 packages/theme/src/client/styles/code.scss delete mode 100644 packages/theme/src/client/styles/icons.scss delete mode 100644 packages/theme/src/client/styles/index.scss delete mode 100644 packages/theme/src/client/styles/layout.scss delete mode 100644 packages/theme/src/client/styles/normalize.scss delete mode 100644 packages/theme/src/client/styles/toc.scss delete mode 100644 packages/theme/src/client/styles/transition.scss delete mode 100644 packages/theme/src/client/styles/vars-dark.scss delete mode 100644 packages/theme/src/client/styles/vars.scss delete mode 100644 packages/theme/src/client/utils/animate.ts delete mode 100644 packages/theme/src/client/utils/check.ts delete mode 100644 packages/theme/src/client/utils/color.ts delete mode 100644 packages/theme/src/client/utils/dom.ts delete mode 100644 packages/theme/src/client/utils/index.ts delete mode 100644 packages/theme/src/client/utils/path.ts delete mode 100644 packages/theme/src/client/utils/resolveRepoType.ts delete mode 100644 packages/theme/src/node/alias.ts create mode 100644 packages/theme/src/node/autoFrontmatter.ts delete mode 100644 packages/theme/src/node/createPage/archive.ts delete mode 100644 packages/theme/src/node/createPage/category.ts delete mode 100644 packages/theme/src/node/createPage/index.ts delete mode 100644 packages/theme/src/node/createPage/note.ts delete mode 100644 packages/theme/src/node/createPage/tag.ts delete mode 100644 packages/theme/src/node/defaultLocaleOption.ts rename packages/theme/src/node/{define.ts => defineConfig.ts} (100%) delete mode 100644 packages/theme/src/node/extendsPage.ts delete mode 100644 packages/theme/src/node/generateFrontmatter.ts create mode 100644 packages/theme/src/node/plugins.ts delete mode 100644 packages/theme/src/node/plugins/activeHeaderLink.ts delete mode 100644 packages/theme/src/node/plugins/baiduTongji.ts delete mode 100644 packages/theme/src/node/plugins/caniuse.ts delete mode 100644 packages/theme/src/node/plugins/comment.ts delete mode 100644 packages/theme/src/node/plugins/copyCode.ts delete mode 100644 packages/theme/src/node/plugins/externalLinkIcon.ts delete mode 100644 packages/theme/src/node/plugins/git.ts delete mode 100644 packages/theme/src/node/plugins/index.ts delete mode 100644 packages/theme/src/node/plugins/markdownEnhance.ts delete mode 100644 packages/theme/src/node/plugins/mediumZoom.ts delete mode 100644 packages/theme/src/node/plugins/nprogress.ts delete mode 100644 packages/theme/src/node/plugins/palette.ts delete mode 100644 packages/theme/src/node/plugins/prismjs.ts delete mode 100644 packages/theme/src/node/plugins/search.ts delete mode 100644 packages/theme/src/node/plugins/seo.ts delete mode 100644 packages/theme/src/node/plugins/sitemap.ts delete mode 100644 packages/theme/src/node/plugins/themeData.ts delete mode 100644 packages/theme/src/node/prepared/index.ts delete mode 100644 packages/theme/src/node/prepared/postIndex.ts delete mode 100644 packages/theme/src/node/prepared/sidebarIndex.ts delete mode 100644 packages/theme/src/node/shims.d.ts delete mode 100644 packages/theme/src/node/utils/date.ts delete mode 100644 packages/theme/src/node/utils/index.ts delete mode 100644 packages/theme/src/node/utils/path.ts delete mode 100644 packages/theme/src/node/utils/readFileList.ts rename packages/theme/src/shared/{frontmatter/post.ts => frontmatter.ts} (59%) delete mode 100644 packages/theme/src/shared/frontmatter/home.ts delete mode 100644 packages/theme/src/shared/frontmatter/index.ts delete mode 100644 packages/theme/src/shared/frontmatter/normal.ts delete mode 100644 packages/theme/src/shared/layout/index.ts delete mode 100644 packages/theme/src/shared/layout/navbar.ts delete mode 100644 packages/theme/src/shared/layout/sidebar.ts rename packages/theme/src/shared/{options/notes.ts => note.ts} (100%) delete mode 100644 packages/theme/src/shared/options/options.ts rename packages/theme/src/shared/options/{plugin.ts => plugins.ts} (98%) delete mode 100644 packages/theme/src/shared/page.ts delete mode 100644 packages/theme/src/shared/post.ts rename packages/theme/{template/index.build.html => templates/build.html} (53%) diff --git a/.gitignore b/.gitignore index aaf239c5..93fb9036 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ dist/ *.log *.tsbuildinfo .mind + +packages/theme-back diff --git a/.vscode/settings.json b/.vscode/settings.json index d5ec9547..3db9580f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,6 +24,7 @@ "composables", "Docsearch", "esbuild", + "frontmatter", "gsap", "iarna", "leancloud", diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 262f6920..fc75ef62 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -1,5 +1,5 @@ import * as path from 'path' -import { themePlume } from '@vuepress-plume/vuepress-theme-plume' +import themePlume from '@vuepress-plume/vuepress-theme-plume' import { viteBundler } from '@vuepress/bundler-vite' import { webpackBundler } from '@vuepress/bundler-webpack' import { defineUserConfig } from '@vuepress/cli' diff --git a/docs/1.前端/1.基础/BFC 块级格式化上下文.md b/docs/1.前端/1.基础/BFC 块级格式化上下文.md index e30eb547..56313fa1 100644 --- a/docs/1.前端/1.基础/BFC 块级格式化上下文.md +++ b/docs/1.前端/1.基础/BFC 块级格式化上下文.md @@ -1,10 +1,10 @@ --- title: BFC 块级格式化上下文 -createTime: 2018/05/17 12:28:33 +createTime: 2022-03-26T11:46:50.024Z permalink: /article/o5g7ggvf author: pengzhanbo top: false -tags: +tags: - html type: null --- @@ -35,4 +35,4 @@ BFC, Block Formating Context。是 W3C CSS2.1规范中的一个概念。 是页 1. 同一个BFC的外边距会发生折叠(合并), 通过将其放在不同的BFC中规避折叠。 2. BFC可以包含浮动元素,即清除浮动。 -3. BFC可以阻止元素被浮动元素覆盖。 \ No newline at end of file +3. BFC可以阻止元素被浮动元素覆盖。 diff --git a/docs/1.前端/1.基础/CSS at-rule.md b/docs/1.前端/1.基础/CSS at-rule.md index 6d7bbbc0..02c6be7b 100644 --- a/docs/1.前端/1.基础/CSS at-rule.md +++ b/docs/1.前端/1.基础/CSS at-rule.md @@ -1,9 +1,9 @@ --- title: CSS At-Rules -createTime: 2018/10/06 08:16:38 +createTime: 2022-03-26T11:46:50.024Z permalink: /article/btkqop1a author: pengzhanbo -tags: +tags: - css top: false type: null @@ -160,4 +160,4 @@ type: null ## @media -媒体查询,详见 [CSS @media 媒体查询](/post/fe5ruia1/) \ No newline at end of file +媒体查询,详见 [CSS @media 媒体查询](/post/fe5ruia1/) diff --git a/docs/1.前端/1.基础/CSS media媒体查询.md b/docs/1.前端/1.基础/CSS media媒体查询.md index eb4c18fd..55eb4e63 100644 --- a/docs/1.前端/1.基础/CSS media媒体查询.md +++ b/docs/1.前端/1.基础/CSS media媒体查询.md @@ -1,9 +1,9 @@ --- title: CSS 媒体查询 -createTime: 2018/08/18 08:43:02 +createTime: 2022-03-26T11:46:50.024Z permalink: /article/fe5ruia1 author: pengzhanbo -tags: +tags: - css top: false type: null diff --git a/docs/1.前端/1.基础/CSS选择器.md b/docs/1.前端/1.基础/CSS选择器.md index c1ef7350..1eb5d687 100644 --- a/docs/1.前端/1.基础/CSS选择器.md +++ b/docs/1.前端/1.基础/CSS选择器.md @@ -1,9 +1,9 @@ --- title: CSS选择器 -createTime: 2018/09/20 03:29:20 +createTime: 2022-03-26T11:46:50.024Z permalink: /article/8vev8ixl author: pengzhanbo -tags: +tags: - css top: false type: null @@ -644,4 +644,4 @@ type: null } ... -``` \ No newline at end of file +``` diff --git a/docs/1.前端/1.基础/DOCTYPE 文档类型声明.md b/docs/1.前端/1.基础/DOCTYPE 文档类型声明.md index 331d0e65..282a12ea 100644 --- a/docs/1.前端/1.基础/DOCTYPE 文档类型声明.md +++ b/docs/1.前端/1.基础/DOCTYPE 文档类型声明.md @@ -1,9 +1,9 @@ --- title: 文档类型声明 -createTime: 2018/03/14 01:06:52 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/s8udp6vp author: pengzhanbo -tags: +tags: - html top: false type: null @@ -105,4 +105,4 @@ http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ``` html -``` \ No newline at end of file +``` diff --git a/docs/1.前端/1.基础/HTML5新特性.md b/docs/1.前端/1.基础/HTML5新特性.md index 4f2791af..7d2b1be1 100644 --- a/docs/1.前端/1.基础/HTML5新特性.md +++ b/docs/1.前端/1.基础/HTML5新特性.md @@ -1,9 +1,9 @@ --- title: HTML5新特性 -createTime: 2018/02/17 12:49:58 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/8rv45yuy author: pengzhanbo -tags: +tags: - html top: false type: null @@ -272,4 +272,4 @@ history.replaceState({}, 'bar', 'bar.html') }) ``` -[History API - Web API 接口参考 | MDN](https://developer.mozilla.org/zh-CN/docs/Web/API/History_API) \ No newline at end of file +[History API - Web API 接口参考 | MDN](https://developer.mozilla.org/zh-CN/docs/Web/API/History_API) diff --git a/docs/1.前端/1.基础/WebComponent-template.md b/docs/1.前端/1.基础/WebComponent-template.md index c941a8b2..29fff30f 100644 --- a/docs/1.前端/1.基础/WebComponent-template.md +++ b/docs/1.前端/1.基础/WebComponent-template.md @@ -1,10 +1,10 @@ --- title: WebComponent——template lang: zh-CN -tags: +tags: - html - javascript -createTime: 2018/8/2 11:15:27 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/5fmy4kla author: pengzhanbo top: false diff --git a/docs/1.前端/1.基础/WebComponent自定义元素.md b/docs/1.前端/1.基础/WebComponent自定义元素.md index 2012d504..e122af64 100644 --- a/docs/1.前端/1.基础/WebComponent自定义元素.md +++ b/docs/1.前端/1.基础/WebComponent自定义元素.md @@ -1,9 +1,9 @@ --- title: WebComponent——custom elements -tags: +tags: - html - javascript -createTime: 2018/08/01 11:15:27 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/m63fd7lf author: pengzhanbo top: false diff --git a/docs/1.前端/1.基础/meta 标签说明.md b/docs/1.前端/1.基础/meta 标签说明.md index a918dfea..eb14ea54 100644 --- a/docs/1.前端/1.基础/meta 标签说明.md +++ b/docs/1.前端/1.基础/meta 标签说明.md @@ -1,9 +1,9 @@ --- title: meta 标签说明 -createTime: 2018/03/15 01:21:48 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/bp1nxjs6 author: pengzhanbo -tags: +tags: - html top: false type: null @@ -216,4 +216,4 @@ content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT"> -``` \ No newline at end of file +``` diff --git a/docs/1.前端/1.基础/原型链与继承.md b/docs/1.前端/1.基础/原型链与继承.md index 250080fa..a89dcaf8 100644 --- a/docs/1.前端/1.基础/原型链与继承.md +++ b/docs/1.前端/1.基础/原型链与继承.md @@ -1,9 +1,9 @@ --- title: 继承与原型链 -createTime: 2018/07/06 09:40:54 +createTime: 2022-03-26T13:40:54.727Z permalink: /article/extends-prototype author: pengzhanbo -tags: +tags: - javascript top: false type: null diff --git a/docs/1.前端/1.基础/正则表达式使用手册.md b/docs/1.前端/1.基础/正则表达式使用手册.md index 05b2e8de..3fb9556b 100644 --- a/docs/1.前端/1.基础/正则表达式使用手册.md +++ b/docs/1.前端/1.基础/正则表达式使用手册.md @@ -1,10 +1,10 @@ --- title: 正则表达式 lang: zh-CN -createTime: 2018/11/26 11:15:27 +createTime: 2022-03-26T11:46:50.025Z permalink: /article/e8qbp0dh author: pengzhanbo -tags: +tags: - javascript top: false type: null diff --git a/docs/1.前端/1.基础/浏览器端的事件循环.md b/docs/1.前端/1.基础/浏览器端的事件循环.md index 40300585..8cc786e5 100644 --- a/docs/1.前端/1.基础/浏览器端的事件循环.md +++ b/docs/1.前端/1.基础/浏览器端的事件循环.md @@ -1,8 +1,9 @@ --- title: Event Loop 浏览器端的事件循环 -createTime: 2021/06/03 01:53:17 +createTime: 2022-03-26T11:46:50.000Z permalink: /article/browser-event-loop author: pengzhanbo top: false type: null --- + diff --git a/docs/1.前端/1.基础/详解Promise.md b/docs/1.前端/1.基础/详解Promise.md index 91aba9b0..cf8b94ed 100644 --- a/docs/1.前端/1.基础/详解Promise.md +++ b/docs/1.前端/1.基础/详解Promise.md @@ -1,6 +1,6 @@ --- title: 详解 Promise -createTime: 2020/11/22 12:58:28 +createTime: 2022-03-26T11:46:50.026Z permalink: /article/q40nq4hv author: pengzhanbo sticky: true diff --git a/docs/1.前端/10.开发/1px解决方案.md b/docs/1.前端/10.开发/1px解决方案.md index 786cf2cc..668648aa 100644 --- a/docs/1.前端/10.开发/1px解决方案.md +++ b/docs/1.前端/10.开发/1px解决方案.md @@ -1,9 +1,9 @@ --- title: 1px解决方案 -createTime: 2019/05/15 10:41:32 +createTime: 2022-03-26T11:46:50.026Z permalink: /article/tz7ncicn author: pengzhanbo -tags: +tags: - html - css - develop diff --git a/docs/1.前端/10.开发/lerna使用.md b/docs/1.前端/10.开发/lerna使用.md index c95ad70b..60c7ec73 100644 --- a/docs/1.前端/10.开发/lerna使用.md +++ b/docs/1.前端/10.开发/lerna使用.md @@ -1,6 +1,6 @@ --- title: lerna使用 -createTime: 2021/11/26 06:28:37 +createTime: 2022-03-26T11:46:50.027Z permalink: /article/i1wc1uld author: pengzhanbo top: false @@ -118,4 +118,4 @@ lerna run build # 相当于在 package1、package2 中执行 npm run build ``` ### lerna clean - 删除所有包的node_modules \ No newline at end of file + 删除所有包的node_modules diff --git a/docs/1.前端/10.开发/移动端适配方案.md b/docs/1.前端/10.开发/移动端适配方案.md index 057db3f8..2e51ef4e 100644 --- a/docs/1.前端/10.开发/移动端适配方案.md +++ b/docs/1.前端/10.开发/移动端适配方案.md @@ -1,9 +1,9 @@ --- title: 移动端适配方案 -createTime: 2020/08/14 01:54:29 +createTime: 2022-03-26T11:46:50.027Z permalink: /article/vhpmovsm author: pengzhanbo -tags: +tags: - develop top: false type: null @@ -108,4 +108,4 @@ css像素是一个抽象单位,主要用在浏览器上,用来精确的度 1. 容器适配 2. 文本适配 3. 大于1px的边框、圆角、阴影 -4. 内边距和外边距 \ No newline at end of file +4. 内边距和外边距 diff --git a/docs/1.前端/2.工具/Jenkinss使用.md b/docs/1.前端/2.工具/Jenkinss使用.md index dad69fdb..477a7864 100644 --- a/docs/1.前端/2.工具/Jenkinss使用.md +++ b/docs/1.前端/2.工具/Jenkinss使用.md @@ -1,10 +1,10 @@ --- title: Jenkins 使用 lang: zh-CN -createTime: 2018/09/16 11:15:27 +createTime: 2022-03-26T11:46:50.027Z permalink: /article/bmtl5ah4 author: pengzhanbo -tags: +tags: - 工具 top: false type: null diff --git a/docs/1.前端/2.工具/caniuse.md b/docs/1.前端/2.工具/caniuse.md index 17a17fad..92f103e5 100644 --- a/docs/1.前端/2.工具/caniuse.md +++ b/docs/1.前端/2.工具/caniuse.md @@ -1,6 +1,6 @@ --- title: caniuse -createTime: 2021/02/07 06:41:12 +createTime: 2022-03-26T11:46:50.027Z permalink: /article/h4z91gyz author: pengzhanbo top: false @@ -10,4 +10,4 @@ type: null ### 工具 将caniuse 的feature 结果,以图片或者iframe的形式,嵌入到站点。 -[https://caniuse.bitsofco.de/](https://caniuse.bitsofco.de/) \ No newline at end of file +[https://caniuse.bitsofco.de/](https://caniuse.bitsofco.de/) diff --git a/docs/1.前端/2.工具/vsCode插件推荐.md b/docs/1.前端/2.工具/vsCode插件推荐.md index 37900877..9dd50a33 100644 --- a/docs/1.前端/2.工具/vsCode插件推荐.md +++ b/docs/1.前端/2.工具/vsCode插件推荐.md @@ -1,10 +1,10 @@ --- title: VSCode 常用插件推荐 lang: zh-CN -createTime: 2018/12/29 11:15:27 +createTime: 2022-03-26T11:46:50.027Z permalink: /article/ofp08jd8 author: pengzhanbo -tags: +tags: - VSCode top: false type: null diff --git a/docs/1.前端/3.Vue/Vue组件间通信.md b/docs/1.前端/3.Vue/Vue组件间通信.md index 9203fdc4..990a45a7 100644 --- a/docs/1.前端/3.Vue/Vue组件间通信.md +++ b/docs/1.前端/3.Vue/Vue组件间通信.md @@ -1,9 +1,9 @@ --- title: Vue组件间通信 lang: zh-CN -tags: +tags: - vue -createTime: 2018/07/20 11:15:27 +createTime: 2022-03-26T11:46:50.028Z permalink: /article/iezlvhvg author: pengzhanbo top: false diff --git a/docs/10.面试/面试2.md b/docs/10.面试/面试2.md index d5f34b0a..9d88785a 100644 --- a/docs/10.面试/面试2.md +++ b/docs/10.面试/面试2.md @@ -1,6 +1,6 @@ --- title: 面试2 -createTime: 2022/04/04 01:48:00 +createTime: 2022-04-03T17:48:00.400Z author: pengzhanbo permalink: /article/exavsmm1 --- diff --git a/docs/10.面试/面试题-JS篇.md b/docs/10.面试/面试题-JS篇.md index a849db66..7f208078 100644 --- a/docs/10.面试/面试题-JS篇.md +++ b/docs/10.面试/面试题-JS篇.md @@ -1,8 +1,8 @@ --- title: 面试题以及个人答案 JS篇 -tags: +tags: - 面试 -createTime: 2018/08/23 11:15:27 +createTime: 2022-03-26T11:46:50.028Z permalink: /article/4ml7z17g author: pengzhanbo top: false diff --git a/docs/10.面试/面试题—css篇.md b/docs/10.面试/面试题—css篇.md index 1a506875..fcbdc997 100644 --- a/docs/10.面试/面试题—css篇.md +++ b/docs/10.面试/面试题—css篇.md @@ -1,8 +1,8 @@ --- title: 面试题以及个人答案 CSS篇 -tags: +tags: - 面试 -createTime: 2018/08/22 11:15:27 +createTime: 2022-03-26T11:46:50.028Z permalink: /article/565o1wn0 author: pengzhanbo top: false diff --git a/docs/README.md b/docs/README.md index 219152e7..45bbc3fd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,4 +2,7 @@ home: true banner: /images/big-banner.jpg motto: 世间的美好总是不期而遇,恬静而自然。 +author: pengzhanbo +createTime: '2022/03/26 07:46:50' --- + diff --git a/docs/notes/README.md b/docs/notes/README.md index f8c8781d..111b5538 100644 --- a/docs/notes/README.md +++ b/docs/notes/README.md @@ -1,6 +1,7 @@ --- title: README -createTime: 2022/04/04 11:13:30 +createTime: '2022/04/04 11:13:30' author: pengzhanbo permalink: /note/ --- + diff --git a/docs/notes/vuepress-plugin/caniuse/README.md b/docs/notes/vuepress-plugin/caniuse/README.md index 8efb2716..fa7666ae 100644 --- a/docs/notes/vuepress-plugin/caniuse/README.md +++ b/docs/notes/vuepress-plugin/caniuse/README.md @@ -1,6 +1,6 @@ --- title: plugin-caniuse -createTime: 2022/05/13 01:02:51 +createTime: '2022/05/13 01:02:51' author: pengzhanbo permalink: /note/vuepress-plugin/caniuse/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/API.md b/docs/notes/vuepress-plugin/netlify-functions/API.md index 59198b1a..86c3a54d 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/API.md +++ b/docs/notes/vuepress-plugin/netlify-functions/API.md @@ -1,6 +1,6 @@ --- title: API -createTime: 2022/05/13 05:49:14 +createTime: 2022-05-14T10:43:53.200Z author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/api/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/README.md b/docs/notes/vuepress-plugin/netlify-functions/README.md index ea7df1bb..3f5052d0 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/README.md +++ b/docs/notes/vuepress-plugin/netlify-functions/README.md @@ -1,6 +1,6 @@ --- title: 指南 -createTime: 2022/05/13 01:28:38 +createTime: '2022/05/13 01:28:38' author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/functions开发指南.md b/docs/notes/vuepress-plugin/netlify-functions/functions开发指南.md index 6e8cbde5..87d4a4fa 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/functions开发指南.md +++ b/docs/notes/vuepress-plugin/netlify-functions/functions开发指南.md @@ -1,6 +1,6 @@ --- title: functions开发指南 -createTime: 2022/05/13 05:45:24 +createTime: 2022-05-14T10:43:53.201Z author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/develop-functions/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/介绍.md b/docs/notes/vuepress-plugin/netlify-functions/介绍.md index 758be541..9de4ad9c 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/介绍.md +++ b/docs/notes/vuepress-plugin/netlify-functions/介绍.md @@ -1,6 +1,6 @@ --- title: 介绍 -createTime: 2022/05/13 05:47:06 +createTime: 2022-05-14T10:43:53.202Z author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/intro/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/使用.md b/docs/notes/vuepress-plugin/netlify-functions/使用.md index cd193237..158e05d0 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/使用.md +++ b/docs/notes/vuepress-plugin/netlify-functions/使用.md @@ -1,6 +1,6 @@ --- title: 使用 -createTime: 2022/05/13 05:45:01 +createTime: 2022-05-14T10:43:53.203Z author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/usage/ --- diff --git a/docs/notes/vuepress-plugin/netlify-functions/功能.md b/docs/notes/vuepress-plugin/netlify-functions/功能.md index 9f6ec622..fbd035cc 100644 --- a/docs/notes/vuepress-plugin/netlify-functions/功能.md +++ b/docs/notes/vuepress-plugin/netlify-functions/功能.md @@ -1,6 +1,6 @@ --- title: 功能 -createTime: 2022/05/13 05:45:11 +createTime: 2022-05-14T10:43:53.204Z author: pengzhanbo permalink: /note/vuepress-plugin/netlify-functions/feature/ --- diff --git a/docs/notes/vuepress-theme-plume/README.md b/docs/notes/vuepress-theme-plume/README.md index e1727a2c..0dfb6a9d 100644 --- a/docs/notes/vuepress-theme-plume/README.md +++ b/docs/notes/vuepress-theme-plume/README.md @@ -1,6 +1,6 @@ --- title: vuepress-theme-plume -createTime: 2022/04/08 08:52:12 +createTime: '2022/04/08 08:52:12' author: pengzhanbo permalink: /note/vuepress-theme-plume/ article: true diff --git a/docs/notes/vuepress-theme-plume/markdown增强.md b/docs/notes/vuepress-theme-plume/markdown增强.md index 789f80dd..e56591d7 100644 --- a/docs/notes/vuepress-theme-plume/markdown增强.md +++ b/docs/notes/vuepress-theme-plume/markdown增强.md @@ -1,6 +1,6 @@ --- title: markdown增强 -createTime: 2022/04/09 06:43:32 +createTime: 2022-05-14T10:43:53.216Z author: pengzhanbo permalink: /note/vuepress-theme-plume/markdown-enhance/ --- diff --git a/docs/notes/vuepress-theme-plume/notes配置.md b/docs/notes/vuepress-theme-plume/notes配置.md index fce08199..f0dd24ff 100644 --- a/docs/notes/vuepress-theme-plume/notes配置.md +++ b/docs/notes/vuepress-theme-plume/notes配置.md @@ -1,6 +1,6 @@ --- title: notes配置 -createTime: 2022/04/09 02:48:41 +createTime: 2022-05-14T10:43:53.218Z author: pengzhanbo permalink: /note/vuepress-theme-plume/notes-config/ --- diff --git a/docs/notes/vuepress-theme-plume/主题插件配置.md b/docs/notes/vuepress-theme-plume/主题插件配置.md index 7eb84cdd..f5b92eca 100644 --- a/docs/notes/vuepress-theme-plume/主题插件配置.md +++ b/docs/notes/vuepress-theme-plume/主题插件配置.md @@ -1,6 +1,6 @@ --- title: 主题插件配置 -createTime: 2022/04/09 02:48:30 +createTime: 2022-05-14T10:43:53.219Z author: pengzhanbo permalink: /note/vuepress-theme-plume/plugins-config/ --- diff --git a/docs/notes/vuepress-theme-plume/主题配置.md b/docs/notes/vuepress-theme-plume/主题配置.md index a685236c..5f1f701a 100644 --- a/docs/notes/vuepress-theme-plume/主题配置.md +++ b/docs/notes/vuepress-theme-plume/主题配置.md @@ -1,6 +1,6 @@ --- title: 主题配置 -createTime: 2022/04/09 12:18:12 +createTime: 2022-05-14T10:43:53.219Z author: pengzhanbo permalink: /note/vuepress-theme-plume/theme-config/ --- diff --git a/docs/notes/vuepress-theme-plume/基础功能.md b/docs/notes/vuepress-theme-plume/基础功能.md index 208c1201..3dc9e537 100644 --- a/docs/notes/vuepress-theme-plume/基础功能.md +++ b/docs/notes/vuepress-theme-plume/基础功能.md @@ -1,6 +1,6 @@ --- title: 基础功能 -createTime: 2022/04/09 06:43:20 +createTime: 2022-05-14T10:43:53.220Z author: pengzhanbo permalink: /note/vuepress-theme-plume/basis-power/ --- diff --git a/docs/notes/vuepress-theme-plume/快速开始.md b/docs/notes/vuepress-theme-plume/快速开始.md index 0ca87d31..f9d08c91 100644 --- a/docs/notes/vuepress-theme-plume/快速开始.md +++ b/docs/notes/vuepress-theme-plume/快速开始.md @@ -1,6 +1,6 @@ --- title: 快速开始 -createTime: 2022/04/08 09:43:20 +createTime: 2022-05-14T10:43:53.221Z author: pengzhanbo permalink: /note/vuepress-theme-plume/quick-start/ --- diff --git a/docs/notes/vuepress-theme-plume/编写文章.md b/docs/notes/vuepress-theme-plume/编写文章.md index c5a1df40..b4e11e0d 100644 --- a/docs/notes/vuepress-theme-plume/编写文章.md +++ b/docs/notes/vuepress-theme-plume/编写文章.md @@ -1,6 +1,6 @@ --- title: 编写文章 -createTime: 2022/04/09 12:13:56 +createTime: 2022-05-14T10:43:53.221Z author: pengzhanbo permalink: /note/vuepress-theme-plume/write-article/ --- diff --git a/docs/notes/vuepress-theme-plume/页面配置.md b/docs/notes/vuepress-theme-plume/页面配置.md index 2ee0c7b8..0cd85e8c 100644 --- a/docs/notes/vuepress-theme-plume/页面配置.md +++ b/docs/notes/vuepress-theme-plume/页面配置.md @@ -1,6 +1,6 @@ --- title: 页面配置 -createTime: 2022/04/09 01:24:17 +createTime: 2022-05-14T10:43:53.222Z author: pengzhanbo permalink: /note/vuepress-theme-plume/page-config/ --- diff --git a/packages/theme/LICENSE b/packages/plugin-auto-frontmatter/LICENSE similarity index 100% rename from packages/theme/LICENSE rename to packages/plugin-auto-frontmatter/LICENSE diff --git a/packages/plugin-auto-frontmatter/README.md b/packages/plugin-auto-frontmatter/README.md new file mode 100644 index 00000000..89b1925c --- /dev/null +++ b/packages/plugin-auto-frontmatter/README.md @@ -0,0 +1,115 @@ +# `@vuepress-plume/vuepress-plugin-auto-frontmatter` + +自动生成 `*.md` 文件的 `frontmatter` 配置。 + +## Install +``` +yarn add @vuepress-plume/vuepress-plugin-auto-frontmatter +``` +## Usage +``` js +// .vuepress/config.js +import { autoFrontmatterPlugin } from '@vuepress-plume/vuepress-plugin-auto-frontmatter' +export default { + //... + plugins: [ + autoFrontmatterPlugin({ + formatter: { + createTime(formatTime, matter, file) { + if (formatTime) return formatTime + return file.createTime + } + } + }) + ] + // ... +} +``` + +## `autoFrontmatterPlugin([options])` + +### options + +`{ glob?: string | string[]; formatter: Formatter }` + +- `glob` + glob 匹配字符串或数组,匹配需要自动生成 `frontmatter` 的 md文件。 + 默认预设为 `['**/*.md', '!.vuepress/', '!node_modules/']`。 + 自定义匹配将被合并到预设配置中 + example: `['blog/**']` + +- `formatter` + 配置`frontmatter`每个字段的生成规则。 + ```ts + interface MarkdownFile { + filepath: string + relativePath: string + content: string + createTime: Date + } + + interface FormatterFn { + (value: T, data: K, file: MarkdownFile): T + } + + type FormatterObject = Record< + string, + FormatterFn + > + + type FormatterArray = { + glob: string + formatter: FormatterObject + }[] + + type Formatter = FormatterObject | FormatterArray + + /** + * formatterObj 对象中的 key 即为 frontmatter 配置中的key + * 其方法返回的值将作为 frontmatter[key] 的值 + * *.md + * --- + * createTime: 2022-03-26T11:46:50.000Z + * --- + */ + const formatterObj: Formatter = { + createTime(formatTime, matter, file) { + if (formatTime) return formatTime + return file.createTime + } + } + + const formatterArr: Formatter = [ + { + // 更精细化的匹配某个 md文件,支持glob 匹配字符串 + glob: '**/{README,index}.md', + // formatter 仅对 glob命中的文件有效 + formatter: { + home(value, matter, file) { + return value + } + }, + { + // 通配,如果文件没有被其他精细glob命中, + // 则使用 通配 formatter + // 如果是数组,必须有且用一个 glob为 * 的 项 + glob: '*', + formatter: { + title(title) { + return title || '默认标题' + } + } + } + } + ] + + ``` + +## Why ? + +- **为什么需要这个插件?** + + 有时候在开发一些主题时,期望使用户更专注于内容的编写,尽可能减少配置性的工作,可以将一些重复性的必要的配置 + 直接通过本插件自动生成。 + + 以及,我确实想在写新文章的时候,更少的做配置工作,于是便有了这个插件 diff --git a/packages/plugin-auto-frontmatter/package.json b/packages/plugin-auto-frontmatter/package.json new file mode 100644 index 00000000..701b3553 --- /dev/null +++ b/packages/plugin-auto-frontmatter/package.json @@ -0,0 +1,48 @@ +{ + "name": "@vuepress-plume/vuepress-plugin-auto-frontmatter", + "version": "1.0.0-beta.45", + "description": "The Plugin for VuePres 2", + "homepage": "https://github.com/pengzhanbo/vuepress-theme-plume#readme", + "bugs": { + "url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git" + }, + "license": "MIT", + "author": "pengzhanbo ", + "type": "module", + "exports": { + ".": "./lib/node/index.js", + "./package.json": "./package.json" + }, + "main": "lib/node/index.js", + "types": "./lib/node/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "pnpm run clean && pnpm run copy && pnpm run ts", + "clean": "rimraf lib *.tsbuildinfo", + "copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib", + "ts": "tsc -b tsconfig.build.json" + }, + "dependencies": { + "@vuepress/core": "2.0.0-beta.51", + "@vuepress/shared": "2.0.0-beta.51", + "@vuepress/utils": "2.0.0-beta.51", + "chokidar": "^3.5.3", + "glob-to-regexp": "^0.4.1", + "gray-matter": "^4.0.3" + }, + "publishConfig": { + "access": "public" + }, + "keyword": [ + "VuePress", + "vuepress plugin", + "autoFrontmatter", + "vuepress-plugin-plugin-auto-frontmatter" + ] +} diff --git a/packages/plugin-auto-frontmatter/src/node/env.d.ts b/packages/plugin-auto-frontmatter/src/node/env.d.ts new file mode 100644 index 00000000..643357e3 --- /dev/null +++ b/packages/plugin-auto-frontmatter/src/node/env.d.ts @@ -0,0 +1,16 @@ +declare module 'glob-to-regexp' { + interface GlobToRegexp { + ( + glob: string, + options?: { + globstar?: boolean + extended?: boolean + flags?: string + } + ): RegExp + } + + const globToRegexp: GlobToRegexp + + export default globToRegexp +} diff --git a/packages/plugin-auto-frontmatter/src/node/index.ts b/packages/plugin-auto-frontmatter/src/node/index.ts new file mode 100644 index 00000000..9031d476 --- /dev/null +++ b/packages/plugin-auto-frontmatter/src/node/index.ts @@ -0,0 +1,8 @@ +import type { AutoFrontmatterOptions } from '../shared/index.js' +import { autoFrontmatterPlugin } from './plugin.js' + +export * from './plugin.js' + +export { AutoFrontmatterOptions } + +export default autoFrontmatterPlugin diff --git a/packages/plugin-auto-frontmatter/src/node/plugin.ts b/packages/plugin-auto-frontmatter/src/node/plugin.ts new file mode 100644 index 00000000..a00e9058 --- /dev/null +++ b/packages/plugin-auto-frontmatter/src/node/plugin.ts @@ -0,0 +1,83 @@ +import type { Plugin } from '@vuepress/core' +import { fs } from '@vuepress/utils' +import chokidar from 'chokidar' +import globToRegexp from 'glob-to-regexp' +import grayMatter from 'gray-matter' +import type { + AutoFrontmatterOptions, + FormatterArray, + FormatterObject, + MarkdownFile, +} from '../shared/index.js' +import { readMarkdown, readMarkdownList } from './readFiles.js' + +export const autoFrontmatterPlugin = ({ + glob = '', + formatter = {}, +}: AutoFrontmatterOptions = {}): Plugin => { + glob = glob ? (Array.isArray(glob) ? glob : [glob]) : [] + glob = ['**/*.{md,MD}', '!.vuepress/', '!node_modules/', ...glob] + + const matterFormatter: FormatterArray = Array.isArray(formatter) + ? formatter + : [{ glob: '*', formatter }] + + const globFormatter: FormatterObject = + matterFormatter.find(({ glob }) => glob === '*')?.formatter || {} + + const otherFormatters = matterFormatter + .filter(({ glob }) => glob !== '*') + .map(({ glob, formatter }) => { + return { + glob, + regexp: globToRegexp(glob, { + globstar: true, + extended: true, + }), + formatter, + } + }) + + function formatMarkdown(file: MarkdownFile): void { + const { filepath, relativePath } = file + + const formatter = + otherFormatters.find(({ regexp }) => regexp.test(relativePath)) + ?.formatter || globFormatter + const { data, content } = grayMatter(file.content) + + Object.keys(formatter).forEach((key) => { + const value = formatter[key](data[key], data, file) + data[key] = value ?? data[key] + }) + const newContent = grayMatter.stringify({ content }, data) + + fs.writeFileSync(filepath, newContent) + } + + return { + name: '@vuepress-plume/vuepress-plugin-auto-frontmatter', + onInitialized: async (app) => { + const markdownList = await readMarkdownList( + app.dir.source(), + glob as string[] + ) + markdownList.forEach((file) => formatMarkdown(file)) + }, + onWatched: async (app, watchers) => { + const watcher = chokidar.watch('**/*.md', { + cwd: app.dir.source(), + ignoreInitial: true, + ignored: /(node_modules|\.vuepress)\//, + }) + + watcher.on('add', (relativePath) => { + if ((glob as string[]).some((_) => !globToRegexp(_).test(relativePath))) + return + formatMarkdown(readMarkdown(app.dir.source(), relativePath)) + }) + + watchers.push(watcher) + }, + } +} diff --git a/packages/plugin-auto-frontmatter/src/node/readFiles.ts b/packages/plugin-auto-frontmatter/src/node/readFiles.ts new file mode 100644 index 00000000..48c17505 --- /dev/null +++ b/packages/plugin-auto-frontmatter/src/node/readFiles.ts @@ -0,0 +1,33 @@ +import { fs, globby, path } from '@vuepress/utils' +import type { MarkdownFile } from '../shared/index.js' + +type MarkdownFileList = MarkdownFile[] + +export const readMarkdownList = async ( + sourceDir: string, + glob: string[] +): Promise => { + const files: string[] = await globby(glob, { + cwd: sourceDir, + gitignore: true, + }) + + return files.map((file) => readMarkdown(sourceDir, file)) +} + +export const readMarkdown = ( + sourceDir: string, + relativePath: string +): MarkdownFile => { + const filepath = path.join(sourceDir, relativePath) + return { + filepath, + relativePath, + content: fs.readFileSync(filepath, 'utf-8'), + createTime: getFileCreateTime(fs.statSync(filepath)), + } +} + +export const getFileCreateTime = (stat: fs.Stats): Date => { + return stat.birthtime.getFullYear() !== 1970 ? stat.birthtime : stat.atime +} diff --git a/packages/plugin-auto-frontmatter/src/shared/index.ts b/packages/plugin-auto-frontmatter/src/shared/index.ts new file mode 100644 index 00000000..a99a7560 --- /dev/null +++ b/packages/plugin-auto-frontmatter/src/shared/index.ts @@ -0,0 +1,36 @@ +export interface MarkdownFile { + filepath: string + relativePath: string + content: string + createTime: Date +} + +export interface FormatterFn { + (value: T, data: K, file: MarkdownFile): T +} + +export type FormatterObject = Record< + string, + FormatterFn +> + +export type FormatterArray = { + glob: string + formatter: FormatterObject +}[] + +export interface AutoFrontmatterOptions { + /** + * glob string + */ + glob?: string | string[] + + /** + * { + * key(value, data, file) { + * return value + * } + * } + */ + formatter?: FormatterObject | FormatterArray +} diff --git a/packages/plugin-auto-frontmatter/tsconfig.build.json b/packages/plugin-auto-frontmatter/tsconfig.build.json new file mode 100644 index 00000000..e4e8ce38 --- /dev/null +++ b/packages/plugin-auto-frontmatter/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig.build.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "files": [] +} diff --git a/packages/plugin-blog-data/LICENSE b/packages/plugin-blog-data/LICENSE new file mode 100644 index 00000000..9f677c90 --- /dev/null +++ b/packages/plugin-blog-data/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2021 - PRESENT by pengzhanbo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/packages/plugin-blog-data/package.json b/packages/plugin-blog-data/package.json new file mode 100644 index 00000000..23b34a3d --- /dev/null +++ b/packages/plugin-blog-data/package.json @@ -0,0 +1,51 @@ +{ + "name": "@vuepress-plume/vuepress-plugin-blog-data", + "version": "1.0.0-beta.45", + "description": "The Plugin for VuePres 2", + "homepage": "https://github.com/pengzhanbo/vuepress-theme-plume#readme", + "bugs": { + "url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git" + }, + "license": "MIT", + "author": "pengzhanbo ", + "type": "module", + "exports": { + ".": "./lib/node/index.js", + "./client": "./lib/client/index.js", + "./package.json": "./package.json" + }, + "main": "lib/node/index.js", + "types": "./lib/node/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "pnpm run clean && pnpm run copy && pnpm run ts", + "clean": "rimraf lib *.tsbuildinfo", + "copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib", + "ts": "tsc -b tsconfig.build.json" + }, + "dependencies": { + "@vue/devtools-api": "^6.4.5", + "@vuepress/client": "2.0.0-beta.51", + "@vuepress/core": "2.0.0-beta.51", + "@vuepress/shared": "2.0.0-beta.51", + "@vuepress/utils": "2.0.0-beta.51", + "chokidar": "^3.5.3", + "glob-to-regexp": "^0.4.1", + "vue": "^3.2.41" + }, + "publishConfig": { + "access": "public" + }, + "keyword": [ + "VuePress", + "vuepress plugin", + "blogData", + "vuepress-plugin-plugin-blog-data" + ] +} diff --git a/packages/plugin-blog-data/src/client/blogPostData.d.ts b/packages/plugin-blog-data/src/client/blogPostData.d.ts new file mode 100644 index 00000000..52fa5598 --- /dev/null +++ b/packages/plugin-blog-data/src/client/blogPostData.d.ts @@ -0,0 +1,7 @@ +import type { BlogPostData } from '../shared/index.js' + +declare module '@internal/blogData' { + const blogPostData: BlogPostData + + export { blogPostData } +} diff --git a/packages/plugin-blog-data/src/client/composables/index.ts b/packages/plugin-blog-data/src/client/composables/index.ts new file mode 100644 index 00000000..43aec1ef --- /dev/null +++ b/packages/plugin-blog-data/src/client/composables/index.ts @@ -0,0 +1 @@ +export * from './useBlogPostData.js' diff --git a/packages/plugin-blog-data/src/client/composables/useBlogPostData.ts b/packages/plugin-blog-data/src/client/composables/useBlogPostData.ts new file mode 100644 index 00000000..6e8290d0 --- /dev/null +++ b/packages/plugin-blog-data/src/client/composables/useBlogPostData.ts @@ -0,0 +1,20 @@ +import { blogPostData as blogPostDataRaw } from '@internal/blogData' +import { ref } from 'vue' +import type { Ref } from 'vue' +import type { BlogPostData } from '../../shared/index.js' + +declare const __VUE_HMR_RUNTIME__: Record + +export type ThemeDataRef = Ref + +export const blogPostData: ThemeDataRef = ref(blogPostDataRaw) + +export const useBlogPostData = < + T extends BlogPostData = BlogPostData +>(): ThemeDataRef => blogPostData as ThemeDataRef + +if (import.meta.webpackHot || import.meta.hot) { + __VUE_HMR_RUNTIME__.updateBlogData = (data: BlogPostData) => { + blogPostData.value = data + } +} diff --git a/packages/plugin-blog-data/src/client/config.ts b/packages/plugin-blog-data/src/client/config.ts new file mode 100644 index 00000000..27063fc9 --- /dev/null +++ b/packages/plugin-blog-data/src/client/config.ts @@ -0,0 +1,36 @@ +import { setupDevtoolsPlugin } from '@vue/devtools-api' +import { defineClientConfig } from '@vuepress/client' +import { useBlogPostData } from './composables/index.js' + +export default defineClientConfig({ + enhance({ app }) { + // provide theme data & theme locale data + const blogPostData = useBlogPostData() + + // setup devtools in dev mode + if (__VUEPRESS_DEV__ || __VUE_PROD_DEVTOOLS__) { + setupDevtoolsPlugin( + { + // fix recursive reference + app: app as any, + id: 'org.vuepress-plume.plugin-blog-data', + label: 'VuePress Blog Data Plugin', + packageName: '@vuepress/plugin-blog-data', + homepage: 'https://pengzhanbo.cn', + logo: 'https://v2.vuepress.vuejs.org/images/hero.png', + componentStateTypes: ['VuePress'], + }, + (api) => { + api.on.inspectComponent((payload) => { + payload.instanceData.state.push({ + type: 'VuePress', + key: 'blogPostData', + editable: false, + value: blogPostData.value, + }) + }) + } + ) + } + }, +}) diff --git a/packages/plugin-blog-data/src/client/index.ts b/packages/plugin-blog-data/src/client/index.ts new file mode 100644 index 00000000..b9acdbce --- /dev/null +++ b/packages/plugin-blog-data/src/client/index.ts @@ -0,0 +1,4 @@ +import type { BlogPostData, BlogPostDataItem } from '../shared/index.js' +export * from './composables/index.js' + +export { BlogPostData, BlogPostDataItem } diff --git a/packages/plugin-blog-data/src/node/env.d.ts b/packages/plugin-blog-data/src/node/env.d.ts new file mode 100644 index 00000000..643357e3 --- /dev/null +++ b/packages/plugin-blog-data/src/node/env.d.ts @@ -0,0 +1,16 @@ +declare module 'glob-to-regexp' { + interface GlobToRegexp { + ( + glob: string, + options?: { + globstar?: boolean + extended?: boolean + flags?: string + } + ): RegExp + } + + const globToRegexp: GlobToRegexp + + export default globToRegexp +} diff --git a/packages/plugin-blog-data/src/node/index.ts b/packages/plugin-blog-data/src/node/index.ts new file mode 100644 index 00000000..312eda7b --- /dev/null +++ b/packages/plugin-blog-data/src/node/index.ts @@ -0,0 +1,6 @@ +import { blogDataPlugin } from './plugin.js' + +export * from '../shared/index.js' +export * from './plugin.js' + +export default blogDataPlugin diff --git a/packages/plugin-blog-data/src/node/plugin.ts b/packages/plugin-blog-data/src/node/plugin.ts new file mode 100644 index 00000000..8348d0b8 --- /dev/null +++ b/packages/plugin-blog-data/src/node/plugin.ts @@ -0,0 +1,63 @@ +import type { Plugin } from '@vuepress/core' +import { getDirname, path } from '@vuepress/utils' +import chokidar from 'chokidar' +import globToRegexp from 'glob-to-regexp' +import { preparedBlogData } from './prepareBlogData.js' +import type { BlogDataPluginOptions } from './index.js' + +const __dirname = getDirname(import.meta.url) + +export interface PluginOption + extends Omit { + include: { + (filepath: string): boolean + }[] + exclude: { + (filepath: string): boolean + }[] +} + +const globOptions = { + globstar: true, + extended: true, +} + +export const blogDataPlugin = ({ + include, + exclude, + ...pluginOptions +}: BlogDataPluginOptions = {}): Plugin => { + const options: PluginOption = { + include: toArray(include) + .map((str) => globToRegexp(str, globOptions)) + .map((regexp) => (filepath: string) => regexp.test(filepath)), + + exclude: toArray(exclude) + .map((str) => globToRegexp(str, globOptions)) + .map((regexp) => (filepath: string) => !regexp.test(filepath)), + ...pluginOptions, + } + + return { + name: '@vuepress-plume/vuepress-plugin-blog-data', + clientConfigFile: path.resolve(__dirname, '../client/config.js'), + onPrepared: async (app) => await preparedBlogData(app, options), + onWatched(app, watchers) { + const watcher = chokidar.watch('pages/**/*', { + cwd: app.dir.temp(), + ignoreInitial: true, + }) + + watcher.on('add', async () => await preparedBlogData(app, options)) + watcher.on('change', async () => await preparedBlogData(app, options)) + watcher.on('unlink', async () => await preparedBlogData(app, options)) + + watchers.push(watcher) + }, + } +} + +function toArray(likeArr: string | string[] | undefined): string[] { + if (Array.isArray(likeArr)) return likeArr + return likeArr ? [likeArr] : [] +} diff --git a/packages/plugin-blog-data/src/node/prepareBlogData.ts b/packages/plugin-blog-data/src/node/prepareBlogData.ts new file mode 100644 index 00000000..57d332ec --- /dev/null +++ b/packages/plugin-blog-data/src/node/prepareBlogData.ts @@ -0,0 +1,79 @@ +import type { App } from '@vuepress/core' +import type { BlogPostData, BlogPostDataItem } from '../shared/index.js' +import type { PluginOption } from './plugin.js' + +const HMR_CODE = ` +if (import.meta.webpackHot) { + import.meta.webpackHot.accept() + if (__VUE_HMR_RUNTIME__.updateBlogData) { + __VUE_HMR_RUNTIME__.updateBlogData(blogPostData) + } +} + +if (import.meta.hot) { + import.meta.hot.accept(({ blogPostData }) => { + __VUE_HMR_RUNTIME__.updateBlogData(blogPostData) + }) +} +` + +const getTimestamp = (time: Date): number => { + return new Date(time).getTime() +} + +export const preparedBlogData = async ( + app: App, + options: PluginOption +): Promise => { + let pages = app.pages.filter((page) => { + return ( + page.filePathRelative && + options.exclude.every((filter) => filter(page.filePathRelative!)) && + options.include.some((filter) => filter(page.filePathRelative!)) + ) + }) + if (options.sortBy) { + pages = pages.sort((prev, next) => { + if (options.sortBy === 'createTime') { + return getTimestamp(prev.frontmatter.createTime as Date) < + getTimestamp(next.frontmatter.createTime as Date) + ? 1 + : -1 + } else { + return typeof options.sortBy === 'function' && + options.sortBy(prev, next) + ? 1 + : -1 + } + }) + } + + const blogData: BlogPostData = pages.map((page) => { + let extended: Partial = {} + if (typeof options.extendBlogData === 'function') { + extended = options.extendBlogData(page) + } + const data = { + path: page.path, + title: page.title, + ...extended, + } + + if (options.excerpt) data.excerpt = page.excerpt + + return data as BlogPostDataItem + }) + + let content = `\ +export const blogPostData = JSON.parse(${JSON.stringify( + JSON.stringify(blogData) + )}) +` + + // inject HMR code + if (app.env.isDev) { + content += HMR_CODE + } + + await app.writeTemp('internal/blogData.js', content) +} diff --git a/packages/plugin-blog-data/src/shared/index.ts b/packages/plugin-blog-data/src/shared/index.ts new file mode 100644 index 00000000..a8bae2cd --- /dev/null +++ b/packages/plugin-blog-data/src/shared/index.ts @@ -0,0 +1,16 @@ +export interface BlogDataPluginOptions { + include?: string | string[] + exclude?: string | string[] + sortBy?: 'createTime' | false | ((prev: T, next: T) => boolean) + excerpt?: boolean + extendBlogData?: (page: T) => Partial +} + +export type BlogPostData = BlogPostDataItem[] + +export type BlogPostDataItem = { + path: string + title: string + excerpt: string + [x: string]: any +} & T diff --git a/packages/plugin-blog-data/tsconfig.build.json b/packages/plugin-blog-data/tsconfig.build.json new file mode 100644 index 00000000..2f53b066 --- /dev/null +++ b/packages/plugin-blog-data/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.build.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + "baseUrl": ".", + "paths": { + "@internal/blogData": ["./src/client/blogPostData.d.ts"] + }, + "types": ["@vuepress/client/types", "vite/client", "webpack-env"] + }, + "include": ["./src"] +} diff --git a/packages/theme/CHANGELOG.md b/packages/theme/CHANGELOG.md deleted file mode 100644 index 1339fd8f..00000000 --- a/packages/theme/CHANGELOG.md +++ /dev/null @@ -1,229 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.0.0-beta.26](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2022-04-25) - - -### Features - -* support sitemap and seo ([a57af59](https://github.com/pengzhanbo/vuepress-theme-plume/commit/a57af599e649d1f7ce357f704a222c7babc77b06)) - - - - - -# [1.0.0-beta.25](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2022-04-25) - - -### Bug Fixes - -* fix define config ([00bca40](https://github.com/pengzhanbo/vuepress-theme-plume/commit/00bca40d895499017308359bfce682cec055f42b)) - - - - - -# [1.0.0-beta.24](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.23...v1.0.0-beta.24) (2022-04-25) - - -### Features - -* 主题配置函数 ([844feea](https://github.com/pengzhanbo/vuepress-theme-plume/commit/844feeae7406f5aee8edef35bce4a08e808f692e)) - - - - - -# [1.0.0-beta.23](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.22...v1.0.0-beta.23) (2022-04-23) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.22](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.21...v1.0.0-beta.22) (2022-04-18) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.21](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.20...v1.0.0-beta.21) (2022-04-18) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.20](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.19...v1.0.0-beta.20) (2022-04-18) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.19](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.18...v1.0.0-beta.19) (2022-04-18) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.18](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2022-04-14) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.17](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2022-04-12) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.16](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2022-04-12) - - -### Bug Fixes - -* sidebar ([a2794d7](https://github.com/pengzhanbo/vuepress-theme-plume/commit/a2794d72ea7a276d8fd876475f5e9c77c33f5e90)) - - - - - -# [1.0.0-beta.15](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2022-04-12) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.14](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2022-04-12) - - -### Bug Fixes - -* 修复sidebar问题 ([420ec9f](https://github.com/pengzhanbo/vuepress-theme-plume/commit/420ec9fb663793fe2d4fd7e9e61f12ca0d05217e)) - - - - - -# [1.0.0-beta.13](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2022-04-12) - - -### Bug Fixes - -* 修复note生成sidebar时目录嵌套时未正确识别路径 ([7b3a6e2](https://github.com/pengzhanbo/vuepress-theme-plume/commit/7b3a6e2252582a19bdbf42c1ddf85dfab199d57b)) - - - - - -# [1.0.0-beta.12](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2022-04-08) - - -### Bug Fixes - -* 修复page页toc问题 ([2d44799](https://github.com/pengzhanbo/vuepress-theme-plume/commit/2d4479909f4c84a8d71c8a97c93f21bde3b8208c)) - - - - - -# [1.0.0-beta.11](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2022-04-08) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.10](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2022-04-08) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.9](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2022-04-06) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.8](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2022-04-06) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.7](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.6](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.5](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.4](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.3](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# [1.0.0-beta.2](https://github.com/pengzhanbo/vuepress-theme-plume/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume - - - - - -# 1.0.0-beta.1 (2022-04-05) - -**Note:** Version bump only for package @vuepress-plume/vuepress-theme-plume diff --git a/packages/theme/package.json b/packages/theme/package.json index 993db5ec..23348b79 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,15 +1,6 @@ { "name": "@vuepress-plume/vuepress-theme-plume", - "version": "1.0.0-beta.45", - "description": "A Blog Theme for VuePress 2.0", - "keywords": [ - "VuePress", - "Theme", - "plume", - "vuepress-theme", - "vuepress-theme-plume", - "theme-plume" - ], + "version": "0.0.0", "homepage": "https://pengzhanbo.cn/note/vuepress-theme-plume", "bugs": { "url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues" @@ -19,7 +10,7 @@ "url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git" }, "license": "MIT", - "author": "pengzhanbo ", + "author": "pengzhanbo (https://github.com/pengzhanbo/)", "type": "module", "exports": { ".": "./lib/node/index.js", @@ -43,7 +34,9 @@ }, "dependencies": { "@types/lodash.merge": "^4.6.7", + "@vuepress-plume/vuepress-plugin-auto-frontmatter": "workspace:*", "@vuepress-plume/vuepress-plugin-baidu-tongji": "workspace:*", + "@vuepress-plume/vuepress-plugin-blog-data": "workspace:*", "@vuepress-plume/vuepress-plugin-caniuse": "workspace:*", "@vuepress-plume/vuepress-plugin-copy-code": "workspace:*", "@vuepress/client": "2.0.0-beta.51", @@ -62,15 +55,8 @@ "@vuepress/plugin-toc": "2.0.0-beta.51", "@vuepress/shared": "2.0.0-beta.51", "@vuepress/utils": "2.0.0-beta.51", - "@vueuse/core": "^9.3.0", - "chokidar": "^3.5.3", "date-fns": "^2.29.3", - "gray-matter": "^4.0.3", - "json2yaml": "^1.1.0", - "lodash.merge": "^4.6.2", "nanoid": "^4.0.0", - "sass": "^1.55.0", - "sass-loader": "^13.1.0", "ts-debounce": "^4.0.0", "vue": "^3.2.41", "vue-router": "4.1.5", @@ -78,16 +64,5 @@ "vuepress-plugin-md-enhance": "2.0.0-beta.110", "vuepress-plugin-seo2": "2.0.0-beta.110", "vuepress-plugin-sitemap2": "2.0.0-beta.110" - }, - "peerDependencies": { - "sass-loader": "^13.0.2" - }, - "peerDependenciesMeta": { - "sass-loader": { - "optional": true - } - }, - "publishConfig": { - "access": "public" } } diff --git a/packages/theme/src/client/components/Archive.vue b/packages/theme/src/client/components/Archive.vue deleted file mode 100644 index abf9f2b7..00000000 --- a/packages/theme/src/client/components/Archive.vue +++ /dev/null @@ -1,171 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/AsideNavbar.vue b/packages/theme/src/client/components/AsideNavbar.vue deleted file mode 100644 index 5861cc2b..00000000 --- a/packages/theme/src/client/components/AsideNavbar.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/AutoLink.vue b/packages/theme/src/client/components/AutoLink.vue deleted file mode 100644 index 94bd8995..00000000 --- a/packages/theme/src/client/components/AutoLink.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - - - diff --git a/packages/theme/src/client/components/BackToTop.vue b/packages/theme/src/client/components/BackToTop.vue deleted file mode 100644 index b1ee97ac..00000000 --- a/packages/theme/src/client/components/BackToTop.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/BlogInfo.vue b/packages/theme/src/client/components/BlogInfo.vue deleted file mode 100644 index 6beb2a6a..00000000 --- a/packages/theme/src/client/components/BlogInfo.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/BloggerInfo.vue b/packages/theme/src/client/components/BloggerInfo.vue deleted file mode 100644 index da0cb09e..00000000 --- a/packages/theme/src/client/components/BloggerInfo.vue +++ /dev/null @@ -1,195 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Category.vue b/packages/theme/src/client/components/Category.vue deleted file mode 100644 index 1f09e4b7..00000000 --- a/packages/theme/src/client/components/Category.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/CategoryGroup.vue b/packages/theme/src/client/components/CategoryGroup.vue deleted file mode 100644 index e510b54f..00000000 --- a/packages/theme/src/client/components/CategoryGroup.vue +++ /dev/null @@ -1,98 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/DarkModeButton.vue b/packages/theme/src/client/components/DarkModeButton.vue deleted file mode 100644 index 3d7abcc5..00000000 --- a/packages/theme/src/client/components/DarkModeButton.vue +++ /dev/null @@ -1,76 +0,0 @@ - - - - - diff --git a/packages/theme/src/client/components/DropdownTransition.vue b/packages/theme/src/client/components/DropdownTransition.vue deleted file mode 100644 index 0b4bb50d..00000000 --- a/packages/theme/src/client/components/DropdownTransition.vue +++ /dev/null @@ -1,59 +0,0 @@ - - diff --git a/packages/theme/src/client/components/Home.vue b/packages/theme/src/client/components/Home.vue index 5a2b00bb..db49aad6 100644 --- a/packages/theme/src/client/components/Home.vue +++ b/packages/theme/src/client/components/Home.vue @@ -1,28 +1,3 @@ - - diff --git a/packages/theme/src/client/components/HomeBigBanner.vue b/packages/theme/src/client/components/HomeBigBanner.vue deleted file mode 100644 index f6dd81c1..00000000 --- a/packages/theme/src/client/components/HomeBigBanner.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Navbar.vue b/packages/theme/src/client/components/Navbar.vue deleted file mode 100644 index d8f3da8f..00000000 --- a/packages/theme/src/client/components/Navbar.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/NavbarBrand.vue b/packages/theme/src/client/components/NavbarBrand.vue deleted file mode 100644 index cb3901c7..00000000 --- a/packages/theme/src/client/components/NavbarBrand.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - diff --git a/packages/theme/src/client/components/NavbarDropdown.vue b/packages/theme/src/client/components/NavbarDropdown.vue deleted file mode 100644 index be1e4dfe..00000000 --- a/packages/theme/src/client/components/NavbarDropdown.vue +++ /dev/null @@ -1,334 +0,0 @@ - - - - - diff --git a/packages/theme/src/client/components/NavbarItems.vue b/packages/theme/src/client/components/NavbarItems.vue deleted file mode 100644 index e55e837e..00000000 --- a/packages/theme/src/client/components/NavbarItems.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - diff --git a/packages/theme/src/client/components/Page.vue b/packages/theme/src/client/components/Page.vue deleted file mode 100644 index b7ed818d..00000000 --- a/packages/theme/src/client/components/Page.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/PageFooter.vue b/packages/theme/src/client/components/PageFooter.vue deleted file mode 100644 index 840be680..00000000 --- a/packages/theme/src/client/components/PageFooter.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Pagination.vue b/packages/theme/src/client/components/Pagination.vue deleted file mode 100644 index 1504f353..00000000 --- a/packages/theme/src/client/components/Pagination.vue +++ /dev/null @@ -1,203 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/PostItem.vue b/packages/theme/src/client/components/PostItem.vue deleted file mode 100644 index a37781d2..00000000 --- a/packages/theme/src/client/components/PostItem.vue +++ /dev/null @@ -1,59 +0,0 @@ - - diff --git a/packages/theme/src/client/components/PostList.vue b/packages/theme/src/client/components/PostList.vue deleted file mode 100644 index 3af4988e..00000000 --- a/packages/theme/src/client/components/PostList.vue +++ /dev/null @@ -1,195 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/PostMeta.vue b/packages/theme/src/client/components/PostMeta.vue deleted file mode 100644 index 075ca41c..00000000 --- a/packages/theme/src/client/components/PostMeta.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Sidebar.vue b/packages/theme/src/client/components/Sidebar.vue deleted file mode 100644 index c7c3e40c..00000000 --- a/packages/theme/src/client/components/Sidebar.vue +++ /dev/null @@ -1,94 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/SidebarItems.vue b/packages/theme/src/client/components/SidebarItems.vue deleted file mode 100644 index 3310fa92..00000000 --- a/packages/theme/src/client/components/SidebarItems.vue +++ /dev/null @@ -1,157 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Tag.vue b/packages/theme/src/client/components/Tag.vue deleted file mode 100644 index 8845cc91..00000000 --- a/packages/theme/src/client/components/Tag.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/Toc.ts b/packages/theme/src/client/components/Toc.ts deleted file mode 100644 index 56c64365..00000000 --- a/packages/theme/src/client/components/Toc.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { usePageData } from '@vuepress/client' -import type { PageHeader } from '@vuepress/client' -import type { PropType, VNode } from 'vue' -import { computed, defineComponent, h, toRefs } from 'vue' -import type { RouteLocationNormalizedLoaded } from 'vue-router' -import { useRoute } from 'vue-router' -import { scrollTo } from '../utils/index.js' - -export type TocPropsHeaders = PageHeader[] - -export interface TocPropsOptions { - containerTag: string - containerClass: string - listClass: string - itemClass: string - linkClass: string - linkActiveClass: string - linkChildrenActiveClass: string -} - -export interface TocProps { - headers: TocPropsHeaders - options: TocPropsOptions -} - -const renderLink = ( - header: PageHeader, - options: TocPropsOptions, - route: RouteLocationNormalizedLoaded -): VNode => { - const hash = `#${header.slug}` - const linkClass = [options.linkClass] - - if (options.linkActiveClass && route.hash === hash) { - linkClass.push(options.linkActiveClass) - } - - if ( - options.linkChildrenActiveClass && - header.children.some((item) => `#${item.slug}` === route.hash) - ) { - linkClass.push(options.linkChildrenActiveClass) - } - - const setActiveRouteHash = (): void => { - const headerAnchors: HTMLAnchorElement[] = Array.from( - document.querySelectorAll('.header-anchor') - ) - const anchor = headerAnchors.find( - (anchor) => decodeURI(anchor.hash) === hash - ) - if (!anchor) return - const el = document.documentElement - const top = anchor.getBoundingClientRect().top - 80 + el.scrollTop - scrollTo(document, top) - } - - return h( - 'a', - { - href: hash, - class: linkClass, - ariaLabel: header.title, - onClick: (e: MouseEvent) => { - e.preventDefault() - setActiveRouteHash() - }, - }, - header.title - ) -} - -const renderHeaders = ( - headers: PageHeader[], - options: TocPropsOptions, - route: RouteLocationNormalizedLoaded -): VNode[] => { - if (headers.length === 0) { - return [] - } - return [ - h( - 'ul', - { class: options.listClass }, - headers.map((header) => - h('li', { class: options.itemClass }, [ - renderLink(header, options, route), - renderHeaders(header.children, options, route), - ]) - ) - ), - ] -} - -const Toc = defineComponent({ - name: 'Toc', - props: { - headers: { - type: Array as PropType, - required: false, - default: null, - }, - options: { - type: Object as PropType, - required: false, - default: () => ({}), - }, - }, - setup(props) { - const { headers: propsHeaders, options: propsOptions } = toRefs(props) - - const defaultOptions: TocPropsOptions = { - containerTag: 'nav', - containerClass: 'theme-plume-toc', - listClass: 'theme-plume-toc-list', - itemClass: 'theme-plume-toc-item', - linkClass: 'theme-plume-toc-link', - linkActiveClass: 'active', - linkChildrenActiveClass: 'active', - } - - const route = useRoute() - const page = usePageData() - const headers = computed(() => { - const headerToUse = propsHeaders.value || page.value.headers - - return headerToUse[0]?.level === 1 ? headerToUse[0].children : headerToUse - }) - const options = computed(() => ({ - ...defaultOptions, - ...propsOptions.value, - })) - - return () => { - const renderedHeaders = renderHeaders(headers.value, options.value, route) - if (options.value.containerTag) { - return h( - options.value.containerTag, - { class: options.value.containerClass }, - renderedHeaders - ) - } - return renderedHeaders - } - }, -}) - -export default Toc diff --git a/packages/theme/src/client/components/ToggleSidebarButton.vue b/packages/theme/src/client/components/ToggleSidebarButton.vue deleted file mode 100644 index 32756a2d..00000000 --- a/packages/theme/src/client/components/ToggleSidebarButton.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - - diff --git a/packages/theme/src/client/components/global/Badge.vue b/packages/theme/src/client/components/global/Badge.vue deleted file mode 100644 index 8266c5d3..00000000 --- a/packages/theme/src/client/components/global/Badge.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - diff --git a/packages/theme/src/client/components/icons/IconBase.ts b/packages/theme/src/client/components/icons/IconBase.ts deleted file mode 100644 index 29dfb55f..00000000 --- a/packages/theme/src/client/components/icons/IconBase.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { defineComponent, h } from 'vue' -import type { VNode } from 'vue' - -export const IconBase = defineComponent({ - name: 'IconBase', - props: { - name: { - type: String, - required: false, - default: '', - }, - color: { - type: String, - required: false, - default: 'currentColor', - }, - viewBox: { - type: String, - required: false, - default: '0 0 20 20', - }, - }, - setup: - (props, { slots }) => - (): VNode => - h( - 'svg', - { - xmlns: 'http://www.w3.org/2000/svg', - class: ['icon', `${props.name}-icon`], - viewBox: props.viewBox, - ariaLabelledby: props.name, - }, - [ - h('title', { id: props.name, lang: 'en' }, `${props.name}`), - h('g', { fill: props.color }, slots.default?.()), - ] - ), -}) diff --git a/packages/theme/src/client/components/icons/icon.ts b/packages/theme/src/client/components/icons/icon.ts deleted file mode 100644 index f49dfa72..00000000 --- a/packages/theme/src/client/components/icons/icon.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { h } from 'vue' -import type { FunctionalComponent } from 'vue' -import { IconBase } from './IconBase.js' - -export const UserIcon: FunctionalComponent = () => - h(IconBase, { name: 'user' }, () => - h('path', { - 'fill-rule': 'evenodd', - 'clip-rule': 'evenodd', - 'd': 'M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z', - }) - ) -UserIcon.displayName = 'UserIcon' - -export const FolderIcon: FunctionalComponent = () => - h(IconBase, { name: 'folder' }, () => - h('path', { - d: 'M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z', - }) - ) -FolderIcon.displayName = 'FolderIcon' - -export const ClockIcon: FunctionalComponent = () => - h(IconBase, { name: 'clock' }, () => - h('path', { - 'fill-rule': 'evenodd', - 'clip-rule': 'evenodd', - 'd': 'M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z', - }) - ) -ClockIcon.displayName = 'ClockIcon' - -export const TagIcon: FunctionalComponent = () => - h(IconBase, { name: 'tag' }, () => - h('path', { - 'fill-rule': 'evenodd', - 'clip-rule': 'evenodd', - 'd': 'M17.707 9.293a1 1 0 010 1.414l-7 7a1 1 0 01-1.414 0l-7-7A.997.997 0 012 10V5a3 3 0 013-3h5c.256 0 .512.098.707.293l7 7zM5 6a1 1 0 100-2 1 1 0 000 2z', - }) - ) -TagIcon.displayName = 'TagIcon' - -export const TopIcon: FunctionalComponent = () => - h(IconBase, { name: 'top', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M80.96 449.194667l37.696-37.717334 19.626667 19.605334-37.717334 37.717333zM197.205333 541.44l116.16-116.138667 13.568 13.568-116.16 116.16zM220.565333 565.162667l116.16-116.16 13.568 13.589333-116.16 116.138667zM173.845333 517.738667l116.16-116.16 13.568 13.589333-116.16 116.138667zM245.354667 587.477333l116.202666-116.096 13.568 13.589334-116.202666 116.096z', - // fill: '#FA8D14', - }), - h('path', { - d: 'M339.2 0L0 345.6V1024L1024 0H339.2z m-115.2 283.733333l46.933333 46.933334-14.933333 12.8-4.266667-4.266667-140.8 140.8 4.266667 4.266667-14.933333 14.933333-46.933334-46.933333 170.666667-168.533334z m2.133333 375.466667l-12.8-12.8 29.866667-29.866667L149.333333 520.533333l64-64-12.8-12.8L108.8 533.333333l-10.666667-10.666666 89.6-89.6-10.666666-10.666667 14.933333-14.933333 10.666667 10.666666 91.733333-91.733333 10.666667 10.666667-91.733334 91.733333 12.8 12.8 68.266667-68.266667 96 96 27.733333-27.733333 12.8 12.8-204.8 204.8z m232.533334-236.8l-17.066667 17.066667c-6.4-6.4-14.933333-10.666667-21.333333-14.933334 8.533333-4.266667 14.933333-10.666667 21.333333-17.066666 6.4-6.4 6.4-12.8 0-19.2l-136.533333-136.533334-34.133334 34.133334-14.933333-17.066667L332.8 192l14.933333 14.933333-25.6 27.733334 138.666667 138.666666c14.933333 14.933333 14.933333 32-2.133333 49.066667z m-81.066667-200.533333l38.4-38.4-21.333333-34.133334-46.933334 46.933334-14.933333-14.933334 123.733333-123.733333 12.8 17.066667-59.733333 59.733333 21.333333 34.133333 57.6-57.6 98.133334 98.133334-14.933334 14.933333-83.2-83.2-78.933333 78.933333 85.333333 85.333334-14.933333 14.933333-102.4-98.133333z m138.666667 162.133333c-6.4-2.133333-14.933333-4.266667-25.6-4.266667 19.2-34.133333 25.6-61.866667 23.466666-85.333333-2.133333-21.333333-17.066667-44.8-42.666666-70.4L448 200.533333l14.933333-14.933333 23.466667 23.466667c17.066667 17.066667 29.866667 34.133333 38.4 49.066666 38.4-8.533333 74.666667-14.933333 106.666667-19.2l2.133333 25.6c-34.133333 2.133333-68.266667 8.533333-100.266667 14.933334 2.133333 4.266667 2.133333 8.533333 2.133334 12.8 6.4 23.466667 0 55.466667-19.2 91.733333z', - // fill: '#FA8D14', - }), - h('path', { - d: 'M183.765333 346.965333l37.696-37.717333 19.626667 19.584-37.696 37.738667zM132.288 398.037333l37.76-37.674666 19.584 19.626666-37.738667 37.674667z', - // fill: '#FA8D14', - }), - ]) -TopIcon.displayName = 'TopIcon' - -export const ArrowRightIcon: FunctionalComponent = () => - h(IconBase, { name: 'arrow-right', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M709.546667 560.256c-2.389333 2.474667-11.52 13.056-19.968 21.76-49.706667 54.741333-179.370667 144.341333-247.253334 171.690667-10.325333 4.394667-36.394667 13.696-50.304 14.293333-13.354667 0-26.026667-3.072-38.186666-9.301333a79.957333 79.957333 0 0 1-33.92-38.570667c-4.266667-11.221333-10.922667-44.8-10.922667-45.397333-6.656-36.736-10.325333-96.426667-10.325333-162.389334 0-62.848 3.669333-120.106667 9.088-157.397333 0.64-0.597333 7.253333-42.325333 14.549333-56.618667A76.16 76.16 0 0 1 389.632 256h2.389333c18.176 0.64 56.362667 16.853333 56.362667 17.450667 64.213333 27.392 190.890667 112.597333 241.834667 169.216 0 0 14.336 14.549333 20.565333 23.637333 9.728 13.056 14.549333 29.226667 14.549333 45.397333 0 18.048-5.461333 34.858667-15.786666 48.554667z', - }) - ) -ArrowRightIcon.displayName = 'ArrowRightIcon' - -export const ArrowBottomIcon: FunctionalComponent = () => - h(IconBase, { name: 'arrow-bottom', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M150.001 502.111a22.487 22.487 0 0 1 13.185 4.245l348.86 250.152 348.858-250.152a22.577 22.577 0 0 1 26.28 36.665L525.14 802.656a22.577 22.577 0 0 1-26.28 0L136.816 543.02a22.577 22.577 0 0 1 13.185-40.91z m737.183-257.196L525.14 504.55a22.577 22.577 0 0 1-26.28 0L136.816 244.915a22.577 22.577 0 1 1 26.28-36.665l348.859 250.152L860.814 208.25a22.577 22.577 0 1 1 26.28 36.665z', - }) - ) -ArrowBottomIcon.displayName = 'ArrowBottomIcon' - -export const BackTopIcon: FunctionalComponent = () => - h(IconBase, { name: 'back-top', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M725.902 498.916c18.205-251.45-93.298-410.738-205.369-475.592l-6.257-3.982-6.258 3.414c-111.502 64.853-224.711 224.142-204.8 475.59-55.751 53.476-80.214 116.623-80.214 204.8v15.36l179.2-35.27c11.378 40.39 58.596 69.973 113.21 69.973 54.613 0 101.262-29.582 112.64-68.836l180.337 36.41v-15.36c-0.569-89.885-25.031-153.6-82.489-206.507zM571.733 392.533c-33.564 31.29-87.04 28.445-118.329-5.12s-28.444-87.04 5.12-117.76c33.565-31.289 87.04-28.444 118.33 5.12s28.444 86.471-5.12 117.76z m-56.32 368.64c-35.84 0-64.284 29.014-64.284 64.285 0 35.84 54.044 182.613 64.284 182.613s64.285-146.773 64.285-182.613c0-35.271-29.014-64.285-64.285-64.285z', - }) - ) -BackTopIcon.displayName = 'BackTopIcon' - -export const PostIcon: FunctionalComponent = () => - h(IconBase, { name: 'post', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M805.376 81.0496 188.7232 81.0496c-52.6336 0-94.8736 42.3936-94.8736 94.6176l0 664.576c0 52.2752 42.496 94.6176 94.8736 94.6176L805.376 934.8608c52.6336 0 94.8736-42.3936 94.8736-94.6176L900.2496 175.7184C900.2496 123.392 857.8048 81.0496 805.376 81.0496zM288.768 204.8c39.3216 0 71.168 31.5904 71.168 71.168 0 39.3216-31.5904 71.168-71.168 71.168-39.3216 0-71.168-31.5904-71.168-71.168C217.6 236.6464 249.1904 204.8 288.768 204.8zM506.368 741.0176 217.6 741.0176l0-47.4112L506.368 693.6064 506.368 741.0176zM671.3344 617.2672 217.6 617.2672 217.6 569.856l453.7344 0L671.3344 617.2672zM671.3344 493.568 217.6 493.568 217.6 446.1056l453.7344 0L671.3344 493.568z', - }) - ) -PostIcon.displayName = 'PostIcon' - -export const ArrowDoubleRightIcon: FunctionalComponent = () => - h(IconBase, { name: 'arrow-double-right', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M160.117 212.026v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L173.448 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.338-11.93L487.814 512 165.456 223.957a16 16 0 0 1-5.339-11.931z m272.057 0v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L445.505 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.339-11.93L759.87 512 437.514 223.957a16 16 0 0 1-5.34-11.931z', - }) - ) -ArrowDoubleRightIcon.displayName = 'ArrowDoubleRightIcon' - -export const ArrowDoubleLeftIcon: FunctionalComponent = () => - h(IconBase, { name: 'arrow-double-left', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M495.976 476.195c19.777 17.656 21.494 48 3.837 67.774a48.003 48.003 0 0 1-3.837 3.836L536.082 512l-40.106-35.805zM864 212.083v-82.217a8 8 0 0 0-13.328-5.967L442.69 488.13c-0.9 0.804-1.754 1.657-2.558 2.557-11.772 13.184-10.626 33.412 2.558 45.183l407.983 364.231A8 8 0 0 0 864 894.134v-82.217a16 16 0 0 0-5.344-11.936L536.082 512l322.574-287.981A16 16 0 0 0 864 212.083zM495.976 476.195c19.777 17.656 21.494 48 3.837 67.774a48.003 48.003 0 0 1-3.837 3.836L536.082 512l-40.106-35.805zM864 212.083v-82.217a8 8 0 0 0-13.328-5.967L442.69 488.13c-0.9 0.804-1.754 1.657-2.558 2.557-11.772 13.184-10.626 33.412 2.558 45.183l407.983 364.231A8 8 0 0 0 864 894.134v-82.217a16 16 0 0 0-5.344-11.936L536.082 512l322.574-287.981A16 16 0 0 0 864 212.083z', - }), - h('path', { - d: 'M223.976 476.195c19.777 17.656 21.494 48 3.837 67.774a48.003 48.003 0 0 1-3.837 3.836L264.082 512l-40.106-35.805zM592 212.083v-82.217a8 8 0 0 0-13.328-5.967L170.69 488.13c-0.9 0.804-1.754 1.657-2.558 2.557-11.772 13.184-10.626 33.412 2.558 45.183l407.983 364.231A8 8 0 0 0 592 894.134v-82.217a16 16 0 0 0-5.344-11.936L264.082 512l322.574-287.981A16 16 0 0 0 592 212.083zM223.976 476.195c19.777 17.656 21.494 48 3.837 67.774a48.003 48.003 0 0 1-3.837 3.836L264.082 512l-40.106-35.805zM592 212.083v-82.217a8 8 0 0 0-13.328-5.967L170.69 488.13c-0.9 0.804-1.754 1.657-2.558 2.557-11.772 13.184-10.626 33.412 2.558 45.183l407.983 364.231A8 8 0 0 0 592 894.134v-82.217a16 16 0 0 0-5.344-11.936L264.082 512l322.574-287.981A16 16 0 0 0 592 212.083z', - }), - ]) -ArrowDoubleLeftIcon.displayName = 'ArrowDoubleLeftIcon' diff --git a/packages/theme/src/client/components/icons/index.ts b/packages/theme/src/client/components/icons/index.ts deleted file mode 100644 index dba30023..00000000 --- a/packages/theme/src/client/components/icons/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './IconBase.js' -export * from './icon.js' -export * from './socialIcon.js' diff --git a/packages/theme/src/client/components/icons/socialIcon.ts b/packages/theme/src/client/components/icons/socialIcon.ts deleted file mode 100644 index 910d7119..00000000 --- a/packages/theme/src/client/components/icons/socialIcon.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { h } from 'vue' -import type { FunctionalComponent } from 'vue' -import { IconBase } from './IconBase.js' - -export const GithubIcon: FunctionalComponent = () => - h(IconBase, { name: 'github', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M512 0C229.283787 0 0.142041 234.942803 0.142041 524.867683c0 231.829001 146.647305 428.553077 350.068189 497.952484 25.592898 4.819996 34.976961-11.38884 34.976961-25.294314 0-12.45521-0.469203-45.470049-0.725133-89.276559-142.381822 31.735193-172.453477-70.380469-172.453477-70.380469-23.246882-60.569859-56.816233-76.693384-56.816234-76.693385-46.493765-32.58829 3.540351-31.948468 3.540351-31.948467 51.356415 3.71097 78.356923 54.086324 78.356923 54.086324 45.683323 80.19108 119.817417 57.072162 148.993321 43.593236 4.649376-33.91059 17.915029-57.029508 32.50298-70.167195-113.675122-13.222997-233.151301-58.223843-233.1513-259.341366 0-57.285437 19.919806-104.163095 52.678715-140.846248-5.246544-13.265652-22.820334-66.626844 4.990615-138.884127 0 0 42.996069-14.076094 140.760939 53.787741 40.863327-11.644769 84.627183-17.445825 128.177764-17.6591 43.465272 0.213274 87.271782 6.014331 128.135109 17.6591 97.679561-67.906489 140.59032-53.787741 140.59032-53.787741 27.938914 72.257282 10.407779 125.618474 5.118579 138.884127 32.844219 36.683154 52.593405 83.560812 52.593405 140.846248 0 201.586726-119.646798 245.990404-233.663158 258.957473 18.341577 16.208835 34.721032 48.199958 34.721032 97.210357 0 70.167195-0.639822 126.7275-0.639823 143.960051 0 14.033439 9.213443 30.370239 35.190235 25.209005 203.250265-69.527373 349.769606-266.123484 349.769605-497.867175C1023.857959 234.942803 794.673558 0 512 0', - fill: '#3E75C3', - }) - ) -GithubIcon.displayName = 'GithubIcon' - -export const EmailIcon: FunctionalComponent = () => - h(IconBase, { name: 'email', viewBox: '0 0 1024 1024' }, () => [ - [ - h('path', { - d: 'M848.76288 333.62432H164.99712C99.32288 333.62432 46.08 386.87232 46.08 452.54144v297.28768c0 65.67424 53.24288 118.92224 118.91712 118.92224h683.77088c65.66912 0 118.91712-53.24288 118.91712-118.92224V452.54144c-0.00512-65.66912-53.248-118.91712-118.92224-118.91712z', - fill: '#96383D', - }), - h('path', { - d: 'M639.8208 51.2h-474.8288a44.58496 44.58496 0 0 0-44.59008 44.59008v609.44896a44.57984 44.57984 0 0 0 44.59008 44.59008h683.776a44.58496 44.58496 0 0 0 44.59008-44.59008V304.73728L639.8208 51.2z', - fill: '#EBE2CE', - }), - h('path', { - d: 'M551.4752 229.57568H209.59232v44.59008h341.88288v-44.59008zM209.59232 794.42432h594.58048v-44.5952H209.59232v44.5952z m0-89.18528h594.58048v-44.5952H209.59232v44.5952z m0-178.37568h594.58048v-44.5952H209.59232v44.5952z m0 89.18528h594.58048v-44.59008H209.59232v44.59008z m0-222.96576v44.59008h594.58048v-44.59008H209.59232z', - fill: '#C9C1B1', - }), - h('path', { - d: 'M941.83936 393.31328L75.60704 955.02848c12.89216 10.93632 29.29664 17.77152 47.44192 17.77152H893.5936c40.91904 0 74.09152-33.4592 74.09152-74.74688V449.60768c-0.00512-22.58432-10.14784-42.58816-25.84576-56.2944z', - fill: '#D54D54', - }), - h('path', { - d: 'M71.99232 396.5696C56.25344 410.18368 46.08 430.08512 46.08 452.54144v445.93152C46.08 939.53024 79.34976 972.8 120.40192 972.8h772.95104c18.20672 0 34.65216-6.79424 47.56992-17.664L71.99232 396.5696z', - fill: '#EA5455', - }), - h('path', { - d: 'M655.52384 66.90816v236.8l237.82912 74.89024V304.73728z', - fill: '', - }), - h('path', { - d: 'M640.66048 52.0448v207.2576a44.58496 44.58496 0 0 0 44.5952 44.5952h207.2576l-251.8528-251.8528z', - fill: '#FFFBF2', - }), - ], - ]) -EmailIcon.displayName = 'EmailIcon' - -export const ZhiHuIcon: FunctionalComponent = () => - h(IconBase, { name: 'zhiHu', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M512 73.28A438.72 438.72 0 1 0 950.72 512 438.72 438.72 0 0 0 512 73.28z m-98.56 458.88l-16.8 66.88 23.68-20.8s53.92 61.28 64 76.48 1.44 68.96 1.44 68.96l-92.48-113.12s-29.12 101.12-68.48 124.16a97.6 97.6 0 0 1-80 6.56 342.08 342.08 0 0 0 85.44-89.76 382.88 382.88 0 0 0 39.52-119.36h-115.04s8.8-40.48 24.16-41.6 90.88 0 90.88 0l-1.76-124.8-43.2 2.24a96 96 0 0 1-32 48c-24.16 17.44-38.4 10.88-38.4 10.88s42.72-118.24 55.84-141.28 50.4-25.12 50.4-25.12l-23.04 66.72h147.84c17.6 0 18.56 40.64 18.56 40.64h-90.56v122.56s61.28-2.24 81.12 0 19.68 41.6 19.68 41.6z m329.44 160h-91.52l-65.12 46.24-13.6-46.24h-36.96v-368h208z', - fill: '#49C0FB', - }), - h('path', { - d: 'M602.88 691.68l54.88-41.44h43.04V364.64h-121.12v285.6h11.2l12 41.44z', - fill: '#49C0FB', - }), - ]) -ZhiHuIcon.displayName = 'ZhiHuIcon' - -export const WeiBoIcon: FunctionalComponent = () => - h(IconBase, { name: 'weiBo', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M448.698182 482.210909c-96.814545 4.654545-175.010909 56.785455-175.010909 121.949091s78.196364 114.501818 175.010909 109.847273S623.709091 647.912727 623.709091 582.749091c-0.930909-64.232727-79.127273-105.192727-175.010909-100.538182z m65.163636 164.770909c-29.789091 39.098182-88.436364 57.716364-145.221818 26.065455-26.996364-14.894545-26.065455-43.752727-26.065455-43.752728s-11.170909-92.16 85.643637-103.330909c97.745455-12.101818 115.432727 81.92 85.643636 121.018182z', - fill: '#EA5D5C', - }), - h('path', { - d: 'M448.698182 584.610909c-6.516364 4.654545-7.447273 13.032727-3.723637 18.618182 2.792727 5.585455 11.170909 6.516364 16.756364 1.861818 5.585455-4.654545 8.378182-13.032727 4.654546-18.618182-2.792727-5.585455-10.24-6.516364-17.687273-1.861818zM403.083636 597.643636c-18.618182 1.861818-30.72 17.687273-30.72 33.512728 0 14.894545 14.894545 26.065455 32.581819 24.203636 17.687273-1.861818 32.581818-15.825455 32.581818-31.650909s-13.963636-27.927273-34.443637-26.065455z', - fill: '#EA5D5C', - }), - h('path', { - d: 'M512 0C229.003636 0 0 229.003636 0 512s229.003636 512 512 512 512-229.003636 512-512S794.996364 0 512 0z m197.352727 626.501818C669.323636 712.145455 538.065455 754.036364 441.250909 746.589091c-92.16-7.447273-211.316364-38.167273-223.418182-151.738182 0 0-6.516364-51.2 42.821818-117.294545 0 0 70.749091-99.607273 152.669091-128.465455 82.850909-27.927273 92.16 19.549091 92.16 48.407273-4.654545 24.203636-12.101818 38.167273 18.618182 28.858182 0 0 80.989091-38.167273 114.501818-4.654546 26.996364 26.996364 4.654545 65.163636 4.654546 65.163637s-11.170909 12.101818 12.101818 16.756363c21.410909 3.723636 94.021818 37.236364 53.992727 122.88z m-80.058182-236.450909c-8.378182 0-15.825455-7.447273-15.825454-15.825454 0-9.309091 7.447273-15.825455 15.825454-15.825455 0 0 99.607273-18.618182 87.505455 89.367273v1.861818c-0.930909 7.447273-7.447273 13.963636-15.825455 13.963636-9.309091 0-15.825455-7.447273-15.825454-15.825454 0-1.861818 15.825455-73.541818-55.854546-57.716364zM797.789091 493.381818c-2.792727 18.618182-12.101818 11.170909-22.341818 11.170909-13.032727 0-23.272727-16.756364-23.272728-29.789091 0-11.170909 4.654545-22.341818 4.654546-22.341818 0.930909-4.654545 12.101818-34.443636-7.447273-78.196363-35.374545-60.509091-106.123636-60.509091-114.501818-57.716364-8.378182 3.723636-21.410909 5.585455-21.410909 5.585454-13.032727 0-23.272727-10.24-23.272727-23.272727 0-11.170909 7.447273-19.549091 16.756363-22.341818 0 0 0 0.930909 0.930909 0.930909s1.861818 0.930909 1.861819 0.930909c10.24-1.861818 45.614545-4.654545 79.127272 3.723637 62.370909 14.894545 146.152727 83.781818 108.916364 211.316363z', - fill: '#EA5D5C', - }), - ]) -WeiBoIcon.displayName = 'WeiBoIcon' - -// -export const QQIcon: FunctionalComponent = () => - h(IconBase, { name: 'qq', viewBox: '0 0 1024 1024' }, () => - h('path', { - d: 'M512.268258 64.433103c-247.183323 0-447.569968 200.380501-447.569968 447.563825 0 247.189467 200.385621 447.570992 447.569968 447.570992s447.569968-200.380501 447.569968-447.569968c0-247.184347-200.386645-447.564849-447.569968-447.564849z m252.85872 584.692787c-18.997168 16.287968-43.668709-53.628042-47.2134-42.875198-8.642616 26.161294-12.695154 43.646184-38.148944 72.127602-1.35972 1.521494 29.43056 12.647032 38.148944 36.396051 8.346713 22.756875 24.596797 58.811973-81.725503 70.125906-62.389428 6.635801-107.471099-33.244533-111.964932-32.85648-8.325212 0.734126-4.618747 0-13.568528 0-7.321804 0-7.807126 0.534468-14.69685 0-1.899307-0.140272-22.632985 32.85648-115.364231 32.85648-71.878798 0-90.48177-45.243445-76.032701-70.125906 14.464428-24.877342 38.579999-32.122354 35.176604-36.06636-16.73643-19.39546-28.287904-40.1404-35.176604-58.882621-1.705793-4.666869-3.135137-9.209848-4.262434-13.574672-2.611931-10.008479-22.627866 58.76385-44.111028 42.875198-21.483162-15.883533-19.567472-56.309597-5.659014-95.003248 14.033372-39.006959 49.37687-76.562049 49.771065-84.854496 1.412962-30.849665-3.044011-35.975235 0-44.078263 6.780169-18.149391 15.034732-11.190043 15.034733-20.609788 0-118.64476 88.172909-214.829571 196.933079-214.829571 108.755051 0 196.928984 96.184811 196.928984 214.829571 0 4.554242 11.815637 0 17.474651 20.609788 1.165181 4.256291 1.968931 20.684531 0.58771 44.078263-0.658358 11.238165 29.954789 24.914202 45.777913 84.854496 15.845649 59.945414 0 88.215912-7.909514 95.003248z', - fill: '#68A5E1', - }) - ) -QQIcon.displayName = 'QQIcon' - -export const TwitterIcon: FunctionalComponent = () => - h(IconBase, { name: 'twitter', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M512.274401 959.556658c247.17718 0 447.556658-200.366167 447.556658-447.556658 0-247.16387-200.379477-447.556658-447.556658-447.556658-247.188443 0-447.569968 200.392788-447.569968 447.556658 0 247.190491 200.382549 447.556658 447.569968 447.556658', - fill: '#78CBEF', - }), - h('path', { - d: 'M736.810405 394.754891c-16.48353 7.310541-34.227463 12.256931-52.82122 14.478763 19.004336-11.383557 33.588558-29.396772 40.435279-50.868671-17.780793 10.536804-37.440415 18.183179-58.42392 22.294079-16.741549-17.872942-40.666677-29.038412-67.134113-29.038412-50.766282 0-91.948998 41.192954-91.948998 91.972548 0 7.220439 0.784296 14.222791 2.366199 20.943574-76.439183-3.841618-144.191723-40.421969-189.587726-96.109044-7.915657 13.630985-12.452493 29.422369-12.452493 46.282688 0 31.877646 16.241893 60.042683 40.924696 76.552835-15.072616-0.460748-29.26981-4.637177-41.682371-11.485946v1.131393c0 44.585086 31.698466 81.757243 73.804725 90.185867-7.723167 2.160398-15.841554 3.239573-24.246628 3.239574a91.24866 91.24866 0 0 1-17.294447-1.63105c11.691747 36.527109 45.654023 63.139936 85.90705 63.845394-31.477307 24.682804-71.144672 39.382725-114.227718 39.382725-7.42624 0-14.762379-0.410578-21.946982-1.270642 40.706609 26.070168 89.057546 41.308653 140.992081 41.308653 169.209337 0 261.697922-140.132017 261.697922-261.695874 0-3.997248-0.078839-7.979138-0.244709-11.899595a186.466924 186.466924 0 0 0 45.883373-47.618859', - fill: '#FFFFFF', - }), - ]) -TwitterIcon.displayName = 'TwitterIcon' - -export const FacebookIcon: FunctionalComponent = () => - h(IconBase, { name: 'facebook', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M512.262115 959.556658c247.175132 0 447.569968-200.366167 447.569968-447.556658 0-247.16387-200.394836-447.556658-447.569968-447.556658-247.17718 0-447.556658 200.392788-447.556658 447.556658-0.001024 247.190491 200.378454 447.556658 447.556658 447.556658', - fill: '#537BBC', - }), - h('path', { - d: 'M404.292383 436.216104h46.269378v-44.969044c0-19.828563 0.499656-50.408946 14.904699-69.347753 15.172957-20.05689 36.000832-33.690947 71.826579-33.690946 58.371702 0 82.952117 8.326235 82.952118 8.326235l-11.564785 68.550147s-19.285904-5.576079-37.275569-5.57608c-17.99888 0-34.111763 6.449454-34.111764 24.438095v52.269346h73.791416l-5.152191 66.958004h-68.639225v232.604221h-86.731278V503.174108h-46.269378v-66.958004z', - fill: '#FFFFFF', - }), - ]) -FacebookIcon.displayName = 'FacebookIcon' - -export const LinkedinIcon: FunctionalComponent = () => - h(IconBase, { name: 'linkedin', viewBox: '0 0 1024 1024' }, () => [ - h('path', { - d: 'M512.267234 959.569968c247.223255 0 447.572016-200.400979 447.572016-447.582255 0-247.171037-200.347737-447.558705-447.572016-447.558705-247.194586 0-447.568944 200.387669-447.568944 447.558705 0 247.1823 200.373334 447.582255 447.568944 447.582255', - fill: '#1284C7', - }), - h('path', { - d: 'M387.013295 699.188763h-87.249365V419.999808h87.249365v279.188955z m-45.860848-314.114707h-0.628666c-31.57048 0-52.042043-21.341866-52.042043-48.378582 0-27.573232 21.086918-48.478922 53.286064-48.478922 32.175596 0 51.975491 20.852449 52.607228 48.402131 0.001024 27.046955-20.430608 48.455373-53.222583 48.455373z m394.899259 314.114707H637.125954V554.711376c0-37.815157-15.457597-63.618091-49.496664-63.61809-26.03126 0-40.488521 17.410146-47.233878 34.204937-2.518758 6.013279-2.133777 14.405043-2.133777 22.820356v151.06916h-98.001184s1.273713-255.921161 0-279.188955h98.001184v43.815125c5.794167-19.157918 37.097413-46.5018 87.093733-46.5018 61.986018 0 110.696338 40.168045 110.696338 126.630041v155.246613z', - fill: '#FFFFFF', - }), - ]) -LinkedinIcon.displayName = 'LinkedinIcon' diff --git a/packages/theme/src/client/composables/archive.ts b/packages/theme/src/client/composables/archive.ts deleted file mode 100644 index 28d657eb..00000000 --- a/packages/theme/src/client/composables/archive.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { ref } from 'vue' -import type { Ref } from 'vue' -import { usePostAllIndex } from './postIndex.js' - -export interface ArchiveItem { - year: string - children: ArchiveChild[] -} - -export interface ArchiveChild { - date: string - text: string - link: string -} - -export type ArchiveData = ArchiveItem[] - -export type ArchiveListRef = Ref - -export const useArchive = (): ArchiveListRef => { - let archiveList: ArchiveData = [] - const postList = usePostAllIndex().value - postList.forEach((post) => { - const [year, month, day] = post.createTime.split('-') - let current = archiveList.find((arch) => arch.year === year) - if (!current) { - current = { year, children: [] } - archiveList.push(current) - } - current.children.push({ - date: `${month}-${day}`, - text: post.title, - link: post.path, - }) - }) - - archiveList = archiveList.sort((left, right) => { - return left.year > right.year ? -1 : 1 - }) - - return ref(archiveList) -} diff --git a/packages/theme/src/client/composables/asideNavbar.ts b/packages/theme/src/client/composables/asideNavbar.ts deleted file mode 100644 index 368e9d65..00000000 --- a/packages/theme/src/client/composables/asideNavbar.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { Ref } from 'vue' -import { ref } from 'vue' - -const asideNavbarShow = ref(false) - -const triggerAsideNavbar = (show?: boolean): void => { - if (typeof show === 'boolean') { - asideNavbarShow.value = show - } else { - asideNavbarShow.value = !asideNavbarShow.value - } -} - -interface UseAsideNavbar { - asideNavbarShow: Ref - triggerAsideNavbar: (show?: boolean) => void -} -export const useAsideNavbar = (): UseAsideNavbar => { - return { - asideNavbarShow, - triggerAsideNavbar, - } -} diff --git a/packages/theme/src/client/composables/blogger.ts b/packages/theme/src/client/composables/blogger.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/theme/src/client/composables/category.ts b/packages/theme/src/client/composables/category.ts deleted file mode 100644 index bc5e3fa4..00000000 --- a/packages/theme/src/client/composables/category.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { ref } from 'vue' -import type { Ref } from 'vue' -import type { PostItem } from '../../shared/index.js' -import { usePostIndex } from './postIndex.js' - -export interface CategoryItem { - label: string - type: string | number - children: CategoryList - postList: PostItem[] -} - -export type CategoryList = CategoryItem[] - -export type CategoryListRef = Ref - -export const useCategoryList = (): CategoryListRef => { - let categoryListRaw: CategoryList = [] - usePostIndex().value.forEach((post: PostItem) => { - if (post.category.length === 0) return - const category = post.category.map((cate, index) => { - if (index > 0) { - return { - type: post.category - .slice(0, index + 1) - .map((c) => c.type) - .join('-'), - name: cate.name, - } - } else { - return cate - } - }) - let index = 1 - let cate = category[0] - let first = categoryListRaw.find((c) => c.type === cate.type) - if (!first) { - first = { - label: cate.name, - type: cate.type, - children: [], - postList: [], - } - categoryListRaw.push(first) - } - - if (category.length === 1) { - first.postList.push(post) - } - let children = first.children - while ((cate = category[index])) { - let current = children.find((c) => c.type === cate.type) - if (!current) { - current = { - label: cate.name, - type: cate.type, - children: [], - postList: [], - } - children.push(current) - } - children = current.children - if (index === category.length - 1) { - current.postList.push(post) - } - index++ - } - }) - categoryListRaw = categorySort(categoryListRaw) - sortChildren(categoryListRaw, 1) - function sortChildren(list: CategoryList, deep: number): void { - list.forEach((category) => { - if (category.children.length > 0) { - category.children = categorySort(category.children, deep) - sortChildren(category.children, deep + 1) - } - }) - } - - return ref(categoryListRaw) -} - -function categorySort(children: CategoryList, deep = 0): CategoryList { - return children.sort((left, right) => { - const leftType = Number((left.type + '').split('-')[deep]) - const rightType = Number((right.type + '').split('-')[deep]) - return leftType > rightType ? 1 : -1 - }) -} diff --git a/packages/theme/src/client/composables/darkMode.ts b/packages/theme/src/client/composables/darkMode.ts deleted file mode 100644 index 789c03aa..00000000 --- a/packages/theme/src/client/composables/darkMode.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { usePreferredDark, useStorage } from '@vueuse/core' -import { computed, inject, onMounted, onUnmounted, provide, watch } from 'vue' -import type { InjectionKey, WritableComputedRef } from 'vue' -import { useThemeLocaleData } from './themeData.js' - -export type DarkModeRef = WritableComputedRef - -export const darkModeSymbol: InjectionKey = Symbol( - __VUEPRESS_DEV__ ? 'darkMode' : '' -) - -export const useDarkMode = (): DarkModeRef => { - const isDarkMode = inject(darkModeSymbol) - if (!isDarkMode) { - throw new Error('useDarkMode() is called without provider') - } - return isDarkMode -} - -export const setupDarkMode = (): void => { - const themeLocale = useThemeLocaleData() - const isDarkPreferred = usePreferredDark() - const darkStorage = useStorage('vuepress-color-scheme', 'auto') - - const isDarkMode = computed({ - get() { - if (!themeLocale.value.darkMode) { - return false - } - if (darkStorage.value === 'auto') { - return isDarkPreferred.value - } - return darkStorage.value === 'dark' - }, - set(val) { - if (val === isDarkPreferred.value) { - darkStorage.value = 'auto' - } else { - darkStorage.value = val ? 'dark' : 'light' - } - }, - }) - provide(darkModeSymbol, isDarkMode) - updateHtmlDarkClass(isDarkMode) -} - -export const updateHtmlDarkClass = (isDarkMode: DarkModeRef): void => { - const update = (value = isDarkMode.value): void => { - const htmlEl = window?.document.querySelector('html') - htmlEl?.classList.toggle('dark', value) - } - onMounted(() => { - watch(isDarkMode, update, { immediate: true }) - }) - onUnmounted(() => update()) -} diff --git a/packages/theme/src/client/composables/index.ts b/packages/theme/src/client/composables/index.ts deleted file mode 100644 index e831b794..00000000 --- a/packages/theme/src/client/composables/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -export * from './themeData.js' -export * from './darkMode.js' -export * from './navbar.js' -export * from './navLink.js' -export * from './resolveRouteWithRedirect.js' - -export * from './postIndex.js' -export * from './sidebarIndex.js' -export * from './postList.js' -export * from './scrollPromise.js' -export * from './asideNavbar.js' -export * from './postStat.js' - -export * from './tag.js' -export * from './category.js' -export * from './archive.js' diff --git a/packages/theme/src/client/composables/navLink.ts b/packages/theme/src/client/composables/navLink.ts deleted file mode 100644 index b467fe9c..00000000 --- a/packages/theme/src/client/composables/navLink.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { NavLink } from '../../shared/index.js' -import { useResolveRouteWithRedirect } from './resolveRouteWithRedirect.js' - -declare module 'vue-router' { - interface RouteMeta { - title?: string - } -} - -export const useNavLink = (item: string): NavLink => { - const resolved = useResolveRouteWithRedirect(item) - return { - text: resolved.meta.title || item, - link: resolved.name === '404' ? item : resolved.fullPath, - } -} diff --git a/packages/theme/src/client/composables/navbar.ts b/packages/theme/src/client/composables/navbar.ts deleted file mode 100644 index 8fbc0d8d..00000000 --- a/packages/theme/src/client/composables/navbar.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { useRouteLocale, useSiteLocaleData } from '@vuepress/client' -import { isLinkHttp, isString } from '@vuepress/shared' -import type { ComputedRef } from 'vue' -import { computed } from 'vue' -import { useRouter } from 'vue-router' -import type { - NavbarGroup, - NavbarItem, - NavLink, - ResolveNavbarItem, -} from '../../shared/index.js' -import { resolveRepoType } from '../utils/index.js' -import { useNavLink } from './navLink.js' -import { useThemeLocaleData } from './themeData.js' - -export const useNavbarSelectLanguage = (): ComputedRef => { - const router = useRouter() - const routeLocale = useRouteLocale() - const siteLocale = useSiteLocaleData() - const themeLocale = useThemeLocaleData() - - return computed(() => { - const localePaths = Object.keys(siteLocale.value.locales) - if (localePaths.length < 2) { - return [] - } - - const currentPath = router.currentRoute.value.path - const currentFullPath = router.currentRoute.value.fullPath - - const languageDropdown: ResolveNavbarItem = { - text: themeLocale.value.selectLanguageText ?? 'unknown language', - ariaLabel: - themeLocale.value.selectLanguageAriaLabel ?? 'unknown language', - children: localePaths.map((targetLocalPath) => { - const targetSiteLocale = - siteLocale.value.locales?.[targetLocalPath] ?? {} - const targetThemeLocale = - themeLocale.value.locales?.[targetLocalPath] ?? {} - const targetLang = `${targetSiteLocale.lang}` - - const text = targetThemeLocale.selectLanguageName ?? targetLang - let link: string - - if (targetLang === siteLocale.value.lang) { - link = currentFullPath - } else { - const targetLocalePage = currentPath.replace( - routeLocale.value, - targetLocalPath - ) - if ( - router.getRoutes().some((item) => item.path === targetLocalPath) - ) { - link = targetLocalePage - } else { - link = (targetThemeLocale.home as NavLink)?.link ?? targetLocalPath - } - } - return { text, link } - }), - } - return [languageDropdown] - }) -} - -export const useNavbarRepo = (): ComputedRef => { - const themeLocale = useThemeLocaleData() - - const repo = computed(() => themeLocale.value.repo) - const repoType = computed(() => { - return repo.value ? resolveRepoType(repo.value) : null - }) - - const repoLink = computed(() => { - if (repo.value && !isLinkHttp(repo.value)) { - return `https://github.com/${repo.value}` - } - return repo.value - }) - - const repoLabel = computed(() => { - if (!repoLink.value) return null - if (themeLocale.value.repoLabel) return themeLocale.value.repoLabel - if (repoType.value === null) return 'Source' - return repoType.value - }) - - return computed(() => { - if (!repoLink.value || !repoLabel.value) { - return [] - } - return [ - { - text: repoLabel.value, - link: repoLink.value, - }, - ] - }) -} - -const resolveNavbarItem = ( - item: NavbarItem | NavbarGroup | string -): ResolveNavbarItem => { - if (isString(item)) { - return useNavLink(item) - } - if ((item as NavbarGroup).children) { - return { - ...item, - children: (item as NavbarGroup).children.map(resolveNavbarItem), - } - } - return item as ResolveNavbarItem -} - -export const useNavbarConfig = (): ComputedRef => { - const themeLocale = useThemeLocaleData() - const { navbar, home, category, archive, tag } = themeLocale.value - const config: NavbarItem[] = [ - home as NavbarItem, - ...((navbar || []) as unknown as NavbarItem[]), - category as NavbarItem, - tag as NavbarItem, - archive as NavbarItem, - ].filter((nav) => nav) - return computed(() => config.map(resolveNavbarItem)) -} diff --git a/packages/theme/src/client/composables/postIndex.ts b/packages/theme/src/client/composables/postIndex.ts deleted file mode 100644 index de48b271..00000000 --- a/packages/theme/src/client/composables/postIndex.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { postIndex as postIndexRaw } from '@internal/postIndex' -import { ref } from 'vue' -import type { Ref } from 'vue' -import type { PostIndex } from '../../shared/index.js' - -const isBoolean = (arg: unknown): boolean => { - return typeof arg === 'boolean' -} - -export type PostIndexRef = Ref - -export const postIndex: PostIndexRef = ref(postIndexRaw) - -export const usePostAllIndex = (): PostIndexRef => postIndex - -// 在首页文章列表的,默认排除掉 note中的文章,除非显示声明 article -export const usePostIndex = (): PostIndexRef => { - const postIndexData = [ - ...postIndex.value - .filter((post) => post.sticky) - .sort((left, right) => { - const leftSticky = isBoolean(left.sticky) ? 1 : (left.sticky as number) - const rightSticky = isBoolean(right.sticky) - ? 1 - : (right.sticky as number) - return leftSticky < rightSticky ? 1 : -1 - }), - ...postIndex.value.filter((post) => !post.sticky), - ] - const postList = postIndexData.filter((post) => { - if (post.isNote) { - return post.article === true - } else { - return post.article !== false - } - }) - return ref(postList) -} - -export type PostTotalRef = Ref -export const postTotal: PostTotalRef = ref(0) - -if (import.meta.hot) { - __VUE_HMR_RUNTIME__.updatePostIndex = (data: PostIndex) => { - postIndex.value = data - } -} diff --git a/packages/theme/src/client/composables/postList.ts b/packages/theme/src/client/composables/postList.ts deleted file mode 100644 index 7bc8c4d0..00000000 --- a/packages/theme/src/client/composables/postList.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type { Ref } from 'vue' -import { ref } from 'vue' -import type { PostItem } from '../../shared/index.js' -import { usePostIndex } from './postIndex.js' - -export type PostListData = PostItem[] -export type PostListRef = Ref - -interface UsePostList { - postList: PostListRef - total: Ref - page: Ref - setPostListPage: (page: number) => void - resetPostIndex: (postIndex: PostListData) => void -} - -export const usePostList = (): UsePostList => { - const postIndex = ref(usePostIndex().value) - const pageNum = 10 - const total = ref(postIndex.value.length) - let totalPage = Math.ceil(postIndex.value.length / pageNum) - const postList = ref([]) - const page = ref(1) - - const setPostListPage = (_page = 1): void => { - _page = _page - 1 - if (_page < 0) _page = 0 - if (_page > totalPage) _page = totalPage - 1 - const start = _page * pageNum - const end = start + pageNum - postList.value = postIndex.value.filter((_: PostItem, index: number) => { - return start <= index && index < end - }) - page.value = _page + 1 - } - const resetPostIndex = (_postIndex: PostListData): void => { - postIndex.value = _postIndex - totalPage = Math.ceil(postIndex.value.length / pageNum) - total.value = postIndex.value.length - setPostListPage(1) - } - setPostListPage(1) - - return { postList, setPostListPage, page, total, resetPostIndex } -} diff --git a/packages/theme/src/client/composables/postStat.ts b/packages/theme/src/client/composables/postStat.ts deleted file mode 100644 index 888c87db..00000000 --- a/packages/theme/src/client/composables/postStat.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { reactive } from 'vue' -import { usePostAllIndex } from './postIndex.js' -import { useTagList } from './tag.js' - -export interface PostStatData { - postTotal: number - tagTotal: number - categoryTotal: number -} - -export const usePostStat = (): PostStatData => { - const data: PostStatData = Object.create(null) - - const postIndex = usePostAllIndex() - const tagList = useTagList() - - data.postTotal = postIndex.value.length - data.tagTotal = tagList.value.length - - const categorySet = new Set() - - postIndex.value.forEach((post) => { - const category = post.category || [] - category.forEach((cate) => categorySet.add(cate.name)) - }) - - data.categoryTotal = categorySet.size - - const stat = reactive(data) - return stat -} diff --git a/packages/theme/src/client/composables/resolveRouteWithRedirect.ts b/packages/theme/src/client/composables/resolveRouteWithRedirect.ts deleted file mode 100644 index b807a9c4..00000000 --- a/packages/theme/src/client/composables/resolveRouteWithRedirect.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { isFunction, isString } from '@vuepress/shared' -import type { Router } from 'vue-router' -import { useRouter } from 'vue-router' - -export const useResolveRouteWithRedirect = ( - ...args: Parameters -): ReturnType => { - const router = useRouter() - const route = router.resolve(...args) - const lastMatched = route.matched[route.matched.length - 1] - if (!lastMatched?.redirect) { - return route - } - const { redirect } = lastMatched - const resolveRedirect = isFunction(redirect) ? redirect(route) : redirect - const resolveRedirectObj = isString(resolveRedirect) - ? { path: resolveRedirect } - : resolveRedirect - - return useResolveRouteWithRedirect({ - hash: route.hash, - query: route.query, - params: route.params, - ...resolveRedirectObj, - }) -} diff --git a/packages/theme/src/client/composables/scrollPromise.ts b/packages/theme/src/client/composables/scrollPromise.ts deleted file mode 100644 index aecad269..00000000 --- a/packages/theme/src/client/composables/scrollPromise.ts +++ /dev/null @@ -1,21 +0,0 @@ -export interface ScrollPromise { - wait(): Promise | null - pending: () => void - resolve: () => void -} -let promise: Promise | null = null -let promiseResolve: (() => void) | null = null - -const scrollPromise: ScrollPromise = { - wait: () => promise, - pending: () => { - promise = new Promise((resolve) => (promiseResolve = resolve)) - }, - resolve: () => { - promiseResolve?.() - promise = null - promiseResolve = null - }, -} - -export const useScrollPromise = (): ScrollPromise => scrollPromise diff --git a/packages/theme/src/client/composables/sidebarIndex.ts b/packages/theme/src/client/composables/sidebarIndex.ts deleted file mode 100644 index 172157fb..00000000 --- a/packages/theme/src/client/composables/sidebarIndex.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { sidebarIndex as sidebarIndexRaw } from '@internal/sidebarIndex' -import { usePageFrontmatter } from '@vuepress/client' -import { computed, ref } from 'vue' -import type { ComputedRef, Ref } from 'vue' -import { useRoute } from 'vue-router' -import type { SidebarOptions } from '../../shared/index.js' -import { useThemeLocaleData } from './themeData.js' - -export type SidebarIndexRef = Ref> - -export type SidebarRef = ComputedRef - -export const sidebarIndex: SidebarIndexRef = ref(sidebarIndexRaw) - -interface UseSidebarIndex { - sidebarList: SidebarRef - hasSidebar: ComputedRef -} - -export const useSidebarIndex = (): UseSidebarIndex => { - // const sidebarList: SidebarRef = ref([]) - const themeLocale = useThemeLocaleData() - const route = useRoute() - const frontmatter = usePageFrontmatter() - const sidebarList = computed(() => { - const notes = themeLocale.value.notes - if (!notes) return [] - const prefix = notes.link?.replace(/^\/|\/$/g, '') - if (route.path.startsWith(`/${prefix}`)) { - const key = Object.keys(sidebarIndex.value).find((key) => - route.path.startsWith(key) - ) - if (key) return sidebarIndex.value[key] - } - return [] - }) - const hasSidebar = computed(() => { - return !frontmatter.value.home && sidebarList.value.length > 0 - }) - return { sidebarList, hasSidebar } -} - -if (import.meta.hot) { - __VUE_HMR_RUNTIME__.updateSidebarIndex = ( - data: Record - ) => { - sidebarIndex.value = data - } -} diff --git a/packages/theme/src/client/composables/tag.ts b/packages/theme/src/client/composables/tag.ts deleted file mode 100644 index 53c4457e..00000000 --- a/packages/theme/src/client/composables/tag.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Ref } from 'vue' -import { ref } from 'vue' -import { getColor } from '../utils/index.js' -import { usePostAllIndex } from './postIndex.js' - -export interface TagItem { - tag: string - color: string -} -export type TagRaw = TagItem[] - -export type TagRef = Ref - -export const tagList: TagRef = ref([]) - -export const useTagList = (): TagRef => { - const postList = usePostAllIndex().value - let list: string[] = [] - postList.forEach((post) => { - list.push(...post.tags) - }) - list = Array.from(new Set(list)) - tagList.value = list.map((tag) => ({ tag, color: getColor() })) - return tagList -} diff --git a/packages/theme/src/client/composables/themeData.ts b/packages/theme/src/client/composables/themeData.ts deleted file mode 100644 index 829d968b..00000000 --- a/packages/theme/src/client/composables/themeData.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - useThemeData as _useThemeData, - useThemeLocaleData as _useThemeLocaleData, -} from '@vuepress/plugin-theme-data/client' -import type { - ThemeDataRef, - ThemeLocaleDataRef, -} from '@vuepress/plugin-theme-data/client' -import type { PlumeThemeData } from '../../shared/index.js' - -export const useThemeData = (): ThemeDataRef => - _useThemeData() - -export const useThemeLocaleData = (): ThemeLocaleDataRef => - _useThemeLocaleData() diff --git a/packages/theme/src/client/config.ts b/packages/theme/src/client/config.ts index bcfd07eb..dc4e4d21 100644 --- a/packages/theme/src/client/config.ts +++ b/packages/theme/src/client/config.ts @@ -1,44 +1,8 @@ import { defineClientConfig } from '@vuepress/client' -import { h } from 'vue' -import Badge from './components/global/Badge.vue' -import { setupDarkMode, useScrollPromise } from './composables/index.js' -import NotFound from './layouts/404.vue' import Layout from './layouts/Layout.vue' - -import './styles/index.scss' +import NotFound from './layouts/NotFound.vue' export default defineClientConfig({ - enhance({ app, router }) { - // eslint-disable-next-line vue/match-component-file-name - app.component('Badge', Badge) - - // eslint-disable-next-line vue/match-component-file-name - app.component('NavbarSearch', () => { - const SearchComponent = - app.component('Docsearch') || app.component('SearchBox') - if (SearchComponent) { - return h(SearchComponent) - } - return null - }) - // eslint-disable-next-line vue/match-component-file-name - app.component('Comment', (props) => { - const CommentService = app.component('CommentService') - if (CommentService) { - return h(CommentService, props) - } - return null - }) - - const scrollBehavior = router.options.scrollBehavior! - router.options.scrollBehavior = async (...args) => { - await useScrollPromise().wait() - return scrollBehavior(...args) - } - }, - setup() { - setupDarkMode() - }, layouts: { Layout, NotFound, diff --git a/packages/theme/src/client/index.ts b/packages/theme/src/client/index.ts index 72593733..e69de29b 100644 --- a/packages/theme/src/client/index.ts +++ b/packages/theme/src/client/index.ts @@ -1 +0,0 @@ -export * from '../shared/index.js' diff --git a/packages/theme/src/client/layouts/404.vue b/packages/theme/src/client/layouts/404.vue deleted file mode 100644 index 1224c780..00000000 --- a/packages/theme/src/client/layouts/404.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/packages/theme/src/client/layouts/Layout.vue b/packages/theme/src/client/layouts/Layout.vue index 43fd14a8..167e2c32 100644 --- a/packages/theme/src/client/layouts/Layout.vue +++ b/packages/theme/src/client/layouts/Layout.vue @@ -1,70 +1,3 @@ - diff --git a/packages/theme/src/client/layouts/NotFound.vue b/packages/theme/src/client/layouts/NotFound.vue new file mode 100644 index 00000000..071571d2 --- /dev/null +++ b/packages/theme/src/client/layouts/NotFound.vue @@ -0,0 +1,3 @@ + diff --git a/packages/theme/src/client/shim.d.ts b/packages/theme/src/client/shim.d.ts index 390043ae..bf554924 100644 --- a/packages/theme/src/client/shim.d.ts +++ b/packages/theme/src/client/shim.d.ts @@ -3,19 +3,3 @@ declare module '*.vue' { const comp: ComponentOptions export default comp } - -declare const __VUEPRESS_DEV__: boolean -declare const __VUEPRESS_SSR__: boolean -declare const __VUE_HMR_RUNTIME__: Record - -declare module '@internal/postIndex' { - import type { PostIndex } from '../shared' - const postIndex: PostIndex - export { postIndex } -} - -declare module '@internal/sidebarIndex' { - import type { SidebarOptions } from '../shared' - const sidebarIndex: Record - export { sidebarIndex } -} diff --git a/packages/theme/src/client/styles/_mixins.scss b/packages/theme/src/client/styles/_mixins.scss deleted file mode 100644 index 1d245dea..00000000 --- a/packages/theme/src/client/styles/_mixins.scss +++ /dev/null @@ -1,38 +0,0 @@ -@import '_variables'; - -@mixin content_wrapper { - max-width: var(--content-width); - margin: 0 auto; - padding: 2rem 2.5rem; - - @media (max-width: $MQNarrow) { - padding: 2rem; - } - - @media (max-width: $MQMobileNarrow) { - padding: 1.5rem; - } -} - -@mixin dropdown_wrapper { - transition: height 0.1s ease-out; - overflow: hidden; -} - -@mixin wrapper { - width: 100%; - padding-top: var(--navbar-height); -} - -@mixin container_wrapper { - width: 100%; - max-width: $containerWith; - margin: auto; -} - -@mixin content { - padding: 1.25rem; - background-color: var(--c-bg-container); - // border-radius: var(--p-around); - // box-shadow: var(--shadow); -} diff --git a/packages/theme/src/client/styles/_variables.scss b/packages/theme/src/client/styles/_variables.scss deleted file mode 100644 index 948203a9..00000000 --- a/packages/theme/src/client/styles/_variables.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import '@vuepress/plugin-palette/palette'; - -$MQNarrow: 959px !default; -$MQMobile: 719px !default; -$MQMobileNarrow: 419px !default; - -$containerWith: 1200px !default; - -$codeLang: 'c' 'cpp' 'cs' 'dart' 'docker' 'fs' 'go' 'java' 'kt' 'makefile' 'css' - 'less' 'sass' 'scss' 'styl' 'html' 'js' 'json' 'ts' 'vue' 'jsx' 'md' 'php' - 'py' 'rb' 'rs' 'sh' 'toml' 'yml' !default; diff --git a/packages/theme/src/client/styles/arrow.scss b/packages/theme/src/client/styles/arrow.scss deleted file mode 100644 index 94a4f796..00000000 --- a/packages/theme/src/client/styles/arrow.scss +++ /dev/null @@ -1,37 +0,0 @@ -.arrow { - display: inline-block; - width: 0; - height: 0; - - &.up { - border: { - left: 4px solid transparent; - right: 4px solid transparent; - bottom: 6px solid var(--c-bg-arrow); - } - } - - &.down { - border: { - left: 4px solid transparent; - right: 4px solid transparent; - top: 6px solid var(--c-bg-arrow); - } - } - - &.right { - border: { - top: 4px solid transparent; - bottom: 4px solid transparent; - left: 6px solid var(--c-bg-arrow); - } - } - - &.left { - border: { - top: 4px solid transparent; - bottom: 4px solid transparent; - right: 6px solid var(--c-bg-arrow); - } - } -} diff --git a/packages/theme/src/client/styles/code.scss b/packages/theme/src/client/styles/code.scss deleted file mode 100644 index 3478ccf9..00000000 --- a/packages/theme/src/client/styles/code.scss +++ /dev/null @@ -1,282 +0,0 @@ -@import '_variables'; - -// =============================== -// Forked and modified from prismjs/themes/prism-tomorrow.css - -code[class*='language-'], -pre[class*='language-'] { - color: #ccc; - background: none; - font-family: var(--font-family-code); - font-size: 1em; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Code blocks */ -pre[class*='language-'] { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*='language-'], -pre[class*='language-'] { - background: #2d2d2d; -} - -/* Inline code */ -:not(pre) > code[class*='language-'] { - padding: 0.1em; - border-radius: 0.3em; - white-space: normal; -} - -.token.comment, -.token.block-comment, -.token.prolog, -.token.doctype, -.token.cdata { - color: #999; -} - -.token.punctuation { - color: #ccc; -} - -.token.tag, -.token.attr-name, -.token.namespace, -.token.deleted { - color: #ec5975; -} - -.token.function-name { - color: #6196cc; -} - -.token.boolean, -.token.number, -.token.function { - color: #f08d49; -} - -.token.property, -.token.class-name, -.token.constant, -.token.symbol { - color: #f8c555; -} - -.token.selector, -.token.important, -.token.atrule, -.token.keyword, -.token.builtin { - color: #cc99cd; -} - -.token.string, -.token.char, -.token.attr-value, -.token.regex, -.token.variable { - color: #7ec699; -} - -.token.operator, -.token.entity, -.token.url { - color: #67cdcc; -} - -.token.important, -.token.bold { - font-weight: bold; -} -.token.italic { - font-style: italic; -} - -.token.entity { - cursor: help; -} - -.token.inserted { - color: #3eaf7c; -} - -// =============================== - -.plume-theme-content { - pre, - pre[class*='language-'] { - line-height: 1.4; - padding: 1.3rem 1.5rem; - margin: 0.85rem 0; - border-radius: 6px; - overflow: auto; - scrollbar-width: thin; - scrollbar-color: var(--c-brand) var(--c-border); - - &::-webkit-scrollbar { - width: 7px; - height: 7px; - } - - &::-webkit-scrollbar-track { - background-color: var(--code-bg-color); - } - - &::-webkit-scrollbar-thumb { - background-color: rgba(220, 220, 220, 0.35); - border-radius: 3px; - } - - code { - color: #fff; - padding: 0; - background-color: transparent; - border-radius: 0; - overflow-wrap: unset; - -webkit-font-smoothing: auto; - -moz-osx-font-smoothing: auto; - } - } - - .line-number { - font-family: var(--font-family-code); - } -} - -div[class*='language-'] { - position: relative; - background-color: var(--code-bg-color); - border-radius: 6px; - - &::before { - position: absolute; - z-index: 3; - top: 0.8em; - right: 1em; - font-size: 0.75rem; - color: var(--code-ln-color); - } - - pre, - pre[class*='language-'] { - // force override the background color to be compatible with shiki - background: transparent !important; - position: relative; - z-index: 1; - } - - .highlight-lines { - user-select: none; - padding-top: 1.3rem; - position: absolute; - top: 0; - left: 0; - width: 100%; - line-height: 1.4; - - .highlight-line { - background-color: var(--code-hl-bg-color); - } - } - - &:not(.line-numbers-mode) { - .line-numbers { - display: none; - } - } - - &.line-numbers-mode { - .highlight-lines .highlight-line { - position: relative; - - &::before { - content: ' '; - position: absolute; - z-index: 2; - left: 0; - top: 0; - display: block; - width: var(--code-ln-wrapper-width); - height: 100%; - } - } - - pre { - margin-left: var(--code-ln-wrapper-width); - padding-left: 1rem; - vertical-align: middle; - } - - .line-numbers { - position: absolute; - top: 0; - width: var(--code-ln-wrapper-width); - text-align: center; - color: var(--code-ln-color); - padding-top: 1.25rem; - line-height: 1.4; - counter-reset: line-number; - - .line-number { - position: relative; - z-index: 3; - user-select: none; - height: 1.4em; - - &::before { - counter-increment: line-number; - content: counter(line-number); - font-size: 0.85em; - } - } - } - - &::after { - content: ''; - position: absolute; - top: 0; - left: 0; - width: var(--code-ln-wrapper-width); - height: 100%; - border-radius: 6px 0 0 6px; - border-right: 1px solid var(--code-hl-bg-color); - } - } -} - -@each $lang in $codeLang { - div[class*='language-'].ext-#{$lang} { - &:before { - content: '' + $lang; - } - } -} - -// narrow mobile -@media (max-width: $MQMobileNarrow) { - .plume-theme-content { - div[class*='language-'] { - margin: 0.85rem -1.5rem; - border-radius: 0; - } - } -} diff --git a/packages/theme/src/client/styles/icons.scss b/packages/theme/src/client/styles/icons.scss deleted file mode 100644 index baaad858..00000000 --- a/packages/theme/src/client/styles/icons.scss +++ /dev/null @@ -1,4 +0,0 @@ -.icon { - width: 20px; - height: 20px; -} diff --git a/packages/theme/src/client/styles/index.scss b/packages/theme/src/client/styles/index.scss deleted file mode 100644 index 4eb29e20..00000000 --- a/packages/theme/src/client/styles/index.scss +++ /dev/null @@ -1,13 +0,0 @@ -@use 'vars'; -@use 'vars-dark'; - -@use 'normalize'; -@use 'arrow'; -@use 'transition'; -@use 'icons'; - -@use 'layout'; -@use 'code'; -@use 'toc'; - -@use'@vuepress/plugin-palette/style'; diff --git a/packages/theme/src/client/styles/layout.scss b/packages/theme/src/client/styles/layout.scss deleted file mode 100644 index 04d950af..00000000 --- a/packages/theme/src/client/styles/layout.scss +++ /dev/null @@ -1,13 +0,0 @@ -.plume-theme { - position: relative; - min-height: 100vh; - padding-bottom: 2rem; - - &.bottom { - padding-bottom: 6rem; - } -} - -.task-list-container { - list-style: none; -} diff --git a/packages/theme/src/client/styles/normalize.scss b/packages/theme/src/client/styles/normalize.scss deleted file mode 100644 index 8fd91a1b..00000000 --- a/packages/theme/src/client/styles/normalize.scss +++ /dev/null @@ -1,187 +0,0 @@ -html, -body { - padding: 0; - margin: 0; - background-color: var(--c-bg); - transition: background-color var(--t-color); -} - -*, -*::after, -*::before { - box-sizing: border-box; -} - -:root { - scroll-behavior: smooth; -} - -html.dark { - color-scheme: dark; -} - -body { - font-family: var(--font-family); - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: grayscale; - font-size: 16px; - color: var(--c-text); -} - -a { - font-weight: 500; - color: var(--c-text-accent); - text-decoration: none; - overflow-wrap: break-word; - transition: color var(--t-color); -} - -p a code { - font-weight: 400; - color: var(--c-text-accent); -} - -kbd { - font-family: var(--font-family-code); - color: var(--c-text); - background: var(--c-bg-lighter); - border: solid 0.15rem var(--c-border-dark); - border-bottom: solid 0.25rem var(--c-border-dark); - padding: 0 0.15em; -} - -code { - font-family: var(--font-family-code); - color: var(--c-text-lighter); - padding: 0.25rem 0.5rem; - margin: 0; - font-size: 0.85rem; - background-color: var(--c-bg-light); - border-radius: 3px; - overflow-wrap: break-word; -} - -blockquote { - font-size: 1rem; - color: var(--c-text-quote); - border-left: 0.2rem solid var(--c-border-dark); - margin: 1rem 0; - padding: 0.25rem 0 0.25rem 1rem; - - & > p { - margin: 0; - } -} - -ul, -ol { - padding-left: 1.2em; -} - -strong { - font-weight: 600; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-weight: 600; - line-height: 1.25; - transition: color var(--t-color); - - &:focus-visible { - outline: none; - } - - &:hover .header-anchor { - opacity: 1; - } -} - -h1 { - font-size: 2.2rem; -} - -h2 { - font-size: 1.65rem; - padding-bottom: 0.5rem; - border-bottom: solid 1px var(--c-border); - transition: border-color var(--t-color); - margin-top: 2.75rem; -} - -h3 { - font-size: 1.35rem; -} - -h4 { - font-size: 1.15rem; -} - -h5 { - font-size: 1.05rem; -} - -h6 { - font-size: 1rem; -} - -a.header-anchor { - font-size: 0.85rem; - float: left; - margin-left: -0.87rem; - padding-right: 0.23rem; - margin-top: 0.125rem; - opacity: 0; - - &:hover { - text-decoration: none; - - &:focus-visible { - opacity: 1; - } - } -} - -p, -ul, -ol { - line-height: 1.7; -} - -hr { - border: 0; - border-top: solid 1px var(--c-border); -} - -table { - border-collapse: collapse; - margin: 1rem 0; - display: block; - overflow-x: auto; - transition: border-color var(--t-color); -} - -tr { - border-top: solid 1px var(--c-border-dark); - transition: border-color var(--t-color); - - &:nth-child(2n) { - background-color: var(--c-bg-light); - transition: background-color var(--t-color); - - code { - background-color: var(--c-bg-lighter); - } - } -} - -th, -td { - padding: 0.6em 1em; - border: 1px solid var(--c-border-dark); - transition: border-color var(--t-color); -} diff --git a/packages/theme/src/client/styles/toc.scss b/packages/theme/src/client/styles/toc.scss deleted file mode 100644 index 27ddd3c6..00000000 --- a/packages/theme/src/client/styles/toc.scss +++ /dev/null @@ -1,63 +0,0 @@ -.theme-plume-toc { - border-left: solid 1px var(--c-border); - max-height: calc(100vh - var(--navbar-height) - (1.25rem * 3)); - overflow-y: auto; - - &::-webkit-scrollbar { - width: 0; - opacity: 0; - } - > .theme-plume-toc-list { - padding-left: 0; - } -} - -.theme-plume-toc-list { - list-style: none; - - .theme-plume-toc-link { - width: 100%; - display: inline-block; - color: var(--c-text-light); - border-left: solid 3px transparent; - padding-left: 1rem; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - transition: color var(--t-color), border-color var(--t-color); - - &.active { - color: var(--c-text-accent); - border-color: var((--c-text-accent)); - } - } - - .theme-plume-toc-list { - .theme-plume-toc-link { - border: none; - font-size: 14px; - color: var(--c-text-lighter); - - &.active { - color: var(--c-text-accent); - } - } - } -} - -.plume-theme-page-toc { - width: 12.5rem; - margin-left: 1.25rem; - - .theme-plume-toc { - position: sticky; - top: calc(var(--navbar-height) + 1.25rem); - } -} - -.archive-toc { - width: 4rem; - margin-left: 0; - position: sticky; - top: calc(var(--navbar-height) + 1.25rem); -} diff --git a/packages/theme/src/client/styles/transition.scss b/packages/theme/src/client/styles/transition.scss deleted file mode 100644 index 3c816cd2..00000000 --- a/packages/theme/src/client/styles/transition.scss +++ /dev/null @@ -1,30 +0,0 @@ -.fade-slide-y { - &-enter-active { - transition: all 0.3s ease; - } - - &-leave-active { - transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1); - } - - &-enter-from, - &-leave-to { - transform: translateY(10px); - opacity: 0; - } -} - -.fade { - &-enter-active { - transition: all 0.3s ease; - } - - &-leave-active { - transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1); - } - - &-enter-from, - &-leave-to { - opacity: 0; - } -} diff --git a/packages/theme/src/client/styles/vars-dark.scss b/packages/theme/src/client/styles/vars-dark.scss deleted file mode 100644 index 33104026..00000000 --- a/packages/theme/src/client/styles/vars-dark.scss +++ /dev/null @@ -1,46 +0,0 @@ -html.dark { - --c-brand: #0094c8; - --c-brand-light: #007bbb; - - --c-bg: #22272e; - --c-bg-light: #2b313a; - --c-bg-lighter: #262c34; - --c-bg-container: #22272e; - --c-bg-navbar: rgba(34, 39, 46, 0.75); - --c-bg-sticky: var(--c-bg-light); - - --c-text: #adbac7; - --c-text-light: #96a7b7; - --c-text-lighter: #8b94a8; - --c-text-lightest: #8094a8; - - --c-sidebar-text: rgba(195, 195, 195, 0.7); - - --c-border: #3e4c5a; - --c-border-dark: #34404c; - - --c-tip: #318a62; - --c-warning: #ceab00; - --c-warning-bg: #7e755b; - --c-warning-title: #ceac03; - --c-warning-text: #362e00; - --c-danger: #940000; - --c-danger-bg: #806161; - --c-danger-title: #610000; - --c-danger-text: #3a0000; - --c-details-bg: #323843; - - --c-hl-bg-color: #363b46; - - --c-home-arrow-bottom: rgba(196, 205, 216, 0.75); -} - -html.dark .DocSearch { - --docsearch-logo-color: var(--c-text); - --docsearch-modal-shadow: inset 1px 1px 0 0 #2c2e40, 0 3px 8px 0 #000309; - --docsearch-key-shadow: inset 0 -2px 0 0 #282d55, inset 0 0 1px 1px #51577d, - 0 2px 2px 0 rgba(3, 4, 9, 0.3); - --docsearch-key-gradient: linear-gradient(-225deg, #444950, #1c1e21); - --docsearch-footer-shadow: inset 0 1px 0 0 rgba(73, 76, 106, 0.5), - 0 -4px 8px 0 rgba(0, 0, 0, 0.2); -} diff --git a/packages/theme/src/client/styles/vars.scss b/packages/theme/src/client/styles/vars.scss deleted file mode 100644 index ebc33cae..00000000 --- a/packages/theme/src/client/styles/vars.scss +++ /dev/null @@ -1,129 +0,0 @@ -:root { - // brand color - --c-brand: #0095d9; - --c-brand-light: #2ca9e1; - - // background color - --c-bg: #fff; - --c-bg-light: #e5e7eb; - --c-bg-lighter: #d1d5db; - --c-bg-container: #fff; - --c-bg-navbar: rgba(255, 255, 255, 0.7); - --c-bg-sidebar: var(--c-bg-container); - --c-bg-arrow: #ccc; - --c-bg-sticky: #f1f2f3; - - // text color-scheme - --c-text: #2c3e50; - --c-text-accent: var(--c-brand); - --c-text-light: #3a5169; - --c-text-lighter: #4e6e8e; - --c-text-lightest: #6a8bad; - --c-text-quote: #999; - - --c-sidebar-text: rgba(60, 60, 60, 0.7); - - // border colors - --c-border: #eaecef; - --c-border-dark: #dfe2e5; - - // container color - --c-tip: #60a5fa; - --c-tip-bg: var(--c-bg-light); - --c-tip-title: var(--c-text); - --c-tip-text: var(--c-text); - --c-tip-text-accent: var(--c-text-accent); - --c-warning: #e7c000; - --c-warning-bg: #fffae3; - --c-warning-title: #ad9000; - --c-warning-text: #746000; - --c-warning-text-accent: var(--c-text); - --c-danger: #cc0000; - --c-danger-bg: #ffe0e0; - --c-danger-title: #990000; - --c-danger-text: #600; - --c-danger-text-accent: var(--c-text); - --c-detail-bg: #eee; - - // badge component colors - --c-badge-tip: var(--c-tip); - --c-badge-warning: var(--c-warning); - --c-badge-danger: var(--c-danger); - - --c-home-arrow-bottom: rgba(255, 255, 255, 0.75); - - // transition - --t-color: 0.3s ease; - --t-transform: 0.3s ease; - - // box-shadow - --shadow-sm: 0 0 #0000, 0 0 #0000, 0 1px 2px 0 rgba(0, 0, 0, 0.05); - --shadow: 0 0 #0000, 0 0 #0000, 0 1px 3px 0 rgba(0, 0, 0, 0.1), - 0 1px 2px 0 rgba(0, 0, 0, 0.06); - --shadow-md: 0 0 #0000, 0 0 #0000, 0 4px 6px -1px rgba(0, 0, 0, 0.1), - 0 2px 4px -1px rgba(0, 0, 0, 0.06); - --shadow-lg: 0 0 #0000, 0 0 #0000, 0 6px 8px -1px rgba(0, 0, 0, 0.1), - 0 3px 6px -1px rgba(0, 0, 0, 0.06); - - --shadow-footer: 0 -1px 3px 0px rgba(0, 0, 0, 0.1), 0 0 #0000, 0 0 #0000, - 0 -1px 2px 0px rgba(0, 0, 0, 0.06); - - // border-radius - --p-around: 4px; - - // code block - --code-bg-color: #282c34; - --code-hl-bg-color: rgba(0, 0, 0, 0.66); - --code-ln-color: #9e9e9e; - --code-ln-wrapper-width: 3.5rem; - - // font vars - --font-family: -apple-system, BlinkMackSystemFont, 'Segoe UI', Roboto, Oxygen, - Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; - --font-family-code: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - - --navbar-height: 3.6rem; - --navbar-padding-v: 0.7rem; - --navbar-padding-h: 1.5rem; - --sidebar-width: 20rem; - --sidebar-width-mobile: calc(var(--sidebar-width) * 0.82); - --content-width: 850px; - --content-note-width: 1000px; - - // search box vars - --search-bg-color: var(--c-bg-container); - --search-accent-color: var(--c-text-accent); - --search-text-color: var(--c-text); - --search-border-color: var(--c-border); - - --search-item-text-color: var(--c-brand); - --search-item-focus-bg-color: var(--c-bg-light); - - --search-input-width: 8rem; - --search-result-width: 20rem; -} - -.DocSearch { - --docsearch-primary-color: var(--c-brand); - --docsearch-text-color: var(--c-text); - --docsearch-highlight-color: var(--c-brand); - --docsearch-muted-color: var(--c-text-quote); - --docsearch-container-background: rgba(9, 10, 17, 0.8); - --docsearch-modal-background: var(--c-bg-light); - --docsearch-searchbox-background: var(--c-bg-lighter); - --docsearch-searchbox-focus-background: var(--c-bg); - --docsearch-searchbox-shadow: var(--shadow); - --docsearch-hit-color: var(--c-text-light); - --docsearch-hit-active-color: var(--c-bg); - --docsearch-hit-background: var(--c-bg); - --docsearch-hit-shadow: 0 1px 3px 0 var(--c-border-dark); - --docsearch-footer-background: var(--c-bg); -} - -.external-link-icon { - --external-link-icon-color: var(--c-text-quote); -} - -.medium-zoom-overlay { - --medium-zoom-bg-color: var(--c-bg); -} diff --git a/packages/theme/src/client/utils/animate.ts b/packages/theme/src/client/utils/animate.ts deleted file mode 100644 index bdbaad6b..00000000 --- a/packages/theme/src/client/utils/animate.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @method 缓动算法 - * t: current time(当前时间); - * b: beginning value(初始值); - * c: change in value(变化量); - * d: duration(持续时间)。 - */ -export const tween = (t: number, b: number, c: number, d: number): number => { - return c * (t /= d) * t * t + b -} - -export const linear = (t: number, b: number, c: number, d: number): number => { - return (c * t) / d + b -} diff --git a/packages/theme/src/client/utils/check.ts b/packages/theme/src/client/utils/check.ts deleted file mode 100644 index eb70b2dc..00000000 --- a/packages/theme/src/client/utils/check.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const hasOwn = (val: object, key: string): key is never => { - return Object.prototype.hasOwnProperty.call(val, key) -} diff --git a/packages/theme/src/client/utils/color.ts b/packages/theme/src/client/utils/color.ts deleted file mode 100644 index d6fdcef9..00000000 --- a/packages/theme/src/client/utils/color.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const colorList = [ - '#CC9999', - '#FF9900', - '#0099CC', - '#FF6666', - '#009966', - '#CC0066', - '#666699', - '#99CC33', - '#336699', - '#33CC99', - '#FF99CC', - '#FF6666', - '#CC6699', -] - -let uuid = 0 -export const getColor = (): string => { - const len = colorList.length - if (uuid > len - 1) { - uuid = 0 - } - return colorList[uuid++] -} diff --git a/packages/theme/src/client/utils/dom.ts b/packages/theme/src/client/utils/dom.ts deleted file mode 100644 index 491adb80..00000000 --- a/packages/theme/src/client/utils/dom.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { tween } from './animate.js' - -export function getCssValue(el: HTMLElement | null, property: string): number { - const val = el?.ownerDocument?.defaultView?.getComputedStyle(el, null)?.[ - property as any - ] - const num = Number.parseInt(val as string, 10) - return Number.isNaN(num) ? 0 : num -} - -export function getScrollTop( - target: Document | HTMLElement = document -): number { - if (target === document || !target) { - return ( - window.pageYOffset || - document.documentElement.scrollTop || - document.body.scrollTop || - 0 - ) - } else { - return (target as HTMLElement).scrollTop - } -} - -export function setScrollTop( - target: Document | HTMLElement = document, - scrollTop = 0 -): void { - if (typeof target === 'number') { - scrollTop = target - target = document - document.documentElement.scrollTop = scrollTop - document.body.scrollTop = scrollTop - } else { - if (target === document) { - document.body.scrollTop = scrollTop || 0 - document.documentElement.scrollTop = scrollTop || 0 - } else { - ;(target as HTMLElement).scrollTop = scrollTop || 0 - } - } -} - -export function scrollTo( - target: Document | HTMLElement, - top: number, - time = 300 -): void { - if (target !== document) { - const currentTop = getScrollTop(target) - const step = Math.ceil(time / 16) - let currentStep = 0 - const change = top - currentTop - const timer = setInterval(() => { - currentStep++ - if (currentStep >= step) { - timer && clearInterval(timer) - } - setScrollTop(target, tween(currentStep, currentTop, change, step)) - }, 1000 / 60) - } else { - window.scrollTo({ top, behavior: 'smooth' }) - } -} diff --git a/packages/theme/src/client/utils/index.ts b/packages/theme/src/client/utils/index.ts deleted file mode 100644 index a5cf5864..00000000 --- a/packages/theme/src/client/utils/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './dom.js' -export * from './resolveRepoType.js' -export * from './path.js' -export * from './color.js' -export * from './check.js' diff --git a/packages/theme/src/client/utils/path.ts b/packages/theme/src/client/utils/path.ts deleted file mode 100644 index bcd47129..00000000 --- a/packages/theme/src/client/utils/path.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const normalizePath = (url: string): string => { - return url.trim().replace(/\s+/g, '-') -} diff --git a/packages/theme/src/client/utils/resolveRepoType.ts b/packages/theme/src/client/utils/resolveRepoType.ts deleted file mode 100644 index a5497760..00000000 --- a/packages/theme/src/client/utils/resolveRepoType.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { isLinkHttp } from '@vuepress/shared' - -export type RepoType = 'Github' | 'GitLab' | 'Gitee' | 'Bitbucket' | null - -export const resolveRepoType = (repo: string): RepoType => { - if (isLinkHttp(repo) || /github\.com/.test(repo)) return 'Github' - if (/bitbucket\.org/.test(repo)) return 'Bitbucket' - if (/gitlab\.com/.test(repo)) return 'GitLab' - if (/gitee\.com/.test(repo)) return 'Gitee' - return null -} diff --git a/packages/theme/src/node/alias.ts b/packages/theme/src/node/alias.ts deleted file mode 100644 index 5a036df2..00000000 --- a/packages/theme/src/node/alias.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { fs } from '@vuepress/utils' -import { resolveClient } from './utils/index.js' - -export const getAlias = (): Record => { - return Object.fromEntries( - fs - .readdirSync(resolveClient('components')) - .filter((file) => file.endsWith('.vue')) - .map((file) => [ - `@theme-plume/${file}`, - resolveClient('components', file), - ]) - ) -} diff --git a/packages/theme/src/node/autoFrontmatter.ts b/packages/theme/src/node/autoFrontmatter.ts new file mode 100644 index 00000000..dd8dc3d0 --- /dev/null +++ b/packages/theme/src/node/autoFrontmatter.ts @@ -0,0 +1,36 @@ +import { createRequire } from 'node:module' +import type { AutoFrontmatterOptions } from '@vuepress-plume/vuepress-plugin-auto-frontmatter' +import type { App } from '@vuepress/core' +import type { PlumeThemeLocaleOptions } from '../shared/index.js' + +export default function ( + app: App, + localeOption: PlumeThemeLocaleOptions +): AutoFrontmatterOptions { + // const sourceDir = app.dir.source() + const require = createRequire(process.cwd()) + const pkg = require('./package.json') || {} + + return { + glob: [], + formatter: [ + { + glob: '**/{readme,README,index}.md', + formatter: {}, + }, + { + glob: '*', + formatter: { + author(author: string) { + if (author) return author + return pkg.author || '' + }, + createTime(formatTime: string, data, { createTime }) { + if (formatTime) return formatTime + return createTime + }, + }, + }, + ], + } +} diff --git a/packages/theme/src/node/createPage/archive.ts b/packages/theme/src/node/createPage/archive.ts deleted file mode 100644 index 27816a0e..00000000 --- a/packages/theme/src/node/createPage/archive.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { App } from '@vuepress/core' -import { createPage } from '@vuepress/core' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' - -export const createArchivePage = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - const { archive } = localeOption - if (!archive) return - const archivePage = await createPage(app, { - path: archive.link, - frontmatter: { - pageType: 'archive', - }, - }) - app.pages.push(archivePage) -} diff --git a/packages/theme/src/node/createPage/category.ts b/packages/theme/src/node/createPage/category.ts deleted file mode 100644 index c884a662..00000000 --- a/packages/theme/src/node/createPage/category.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { App } from '@vuepress/core' -import { createPage } from '@vuepress/core' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' - -export const createCategoryPage = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - const { category } = localeOption - if (!category) return - const categoryPage = await createPage(app, { - path: category.link, - frontmatter: { - pageType: 'category', - }, - }) - app.pages.push(categoryPage) -} diff --git a/packages/theme/src/node/createPage/index.ts b/packages/theme/src/node/createPage/index.ts deleted file mode 100644 index d0a88024..00000000 --- a/packages/theme/src/node/createPage/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { App } from '@vuepress/core' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' -import { createArchivePage } from './archive.js' -import { createCategoryPage } from './category.js' -import { createTagPage } from './tag.js' - -export const createPage = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - await createCategoryPage(app, localeOption) - await createArchivePage(app, localeOption) - await createTagPage(app, localeOption) -} diff --git a/packages/theme/src/node/createPage/note.ts b/packages/theme/src/node/createPage/note.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/theme/src/node/createPage/tag.ts b/packages/theme/src/node/createPage/tag.ts deleted file mode 100644 index 7a98a812..00000000 --- a/packages/theme/src/node/createPage/tag.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { App } from '@vuepress/core' -import { createPage } from '@vuepress/core' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' - -export const createTagPage = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - const { tag } = localeOption - if (!tag) return - const tagPage = await createPage(app, { - path: tag.link, - frontmatter: { - pageType: 'tag', - }, - }) - app.pages.push(tagPage) -} diff --git a/packages/theme/src/node/defaultLocaleOption.ts b/packages/theme/src/node/defaultLocaleOption.ts deleted file mode 100644 index 4ee9cb48..00000000 --- a/packages/theme/src/node/defaultLocaleOption.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { PlumeThemeLocaleOptions } from '../shared/index.js' - -export const defaultLocaleOption: Partial = { - darkMode: true, - home: { text: '首页', link: '/' }, - article: '/article', - tag: { text: '标签', link: '/tag' }, - category: { text: '分类', link: '/category' }, - notes: { link: '/note', dir: 'notes', notes: [] }, - archive: { link: '/timeline', text: '归档' }, -} diff --git a/packages/theme/src/node/define.ts b/packages/theme/src/node/defineConfig.ts similarity index 100% rename from packages/theme/src/node/define.ts rename to packages/theme/src/node/defineConfig.ts diff --git a/packages/theme/src/node/extendsPage.ts b/packages/theme/src/node/extendsPage.ts deleted file mode 100644 index ff527520..00000000 --- a/packages/theme/src/node/extendsPage.ts +++ /dev/null @@ -1,60 +0,0 @@ -import type { Page } from '@vuepress/core' -import { path } from '@vuepress/utils' -import type { - CategoryData, - PlumeThemeLocaleOptions, - PlumeThemePageData, - PlumeThemePostFrontmatter, -} from '../shared/index.js' -import { formatDate } from './utils/index.js' - -function normalizePath(filepath: string): string { - return filepath.replace(/^\//, '') -} - -let uuid = 10000 -const cache: Record = {} -export const extendsPage = ( - page: Page>, - localeOption: PlumeThemeLocaleOptions -): void => { - const pagePath = page.filePathRelative || '' - if (page.frontmatter.pageType) return - const { notes } = localeOption - const frontmatter = page.frontmatter as PlumeThemePostFrontmatter - let category: CategoryData = [] - if (notes && notes.dir && pagePath.startsWith(normalizePath(notes.dir))) { - page.data.isNote = true - const filepath = path.relative(notes.dir, pagePath) - if (filepath) { - const note = filepath.split('/')[0] - const currentNote = notes.notes.find(({ link }) => - normalizePath(link).startsWith(note) - ) - if (currentNote) { - !cache[currentNote.text] && (cache[currentNote.text] = uuid++) - category.push({ - type: cache[currentNote.text], - name: currentNote.text, - }) - } - } - } else { - category = pagePath - .split('/') - .slice(0, -1) - .map((category) => { - const match = category.match(/^(\d+)?(?:\.?)([^]+)$/) || [] - !cache[match[2]] && !match[1] && (cache[match[2]] = uuid++) - return { - type: Number(match[1] || cache[match[2]]), - name: match[2], - } - }) - } - page.data.category = category || [] - page.data.createTime = formatDate(frontmatter.createTime) - page.data.tags = frontmatter.tags || [] - page.data.path = page.path - page.data.author = frontmatter.author || '' -} diff --git a/packages/theme/src/node/generateFrontmatter.ts b/packages/theme/src/node/generateFrontmatter.ts deleted file mode 100644 index 5ef70ee5..00000000 --- a/packages/theme/src/node/generateFrontmatter.ts +++ /dev/null @@ -1,143 +0,0 @@ -import type { App } from '@vuepress/core' -import { fs, path } from '@vuepress/utils' -import chokidar from 'chokidar' -import { format } from 'date-fns' -import matter from 'gray-matter' -import jsonToYaml from 'json2yaml' -import { customAlphabet } from 'nanoid' -import type { - PlumeThemeLocaleOptions, - PlumeThemeNotesItem, - PlumeThemeNotesOptions, -} from '../shared/index.js' -import type { MarkdownFile } from './utils/index.js' -import { readFile, readFileList } from './utils/index.js' - -export interface GenerateFrontmatter { - formatFrontmatter: () => void - watchNewMarkDown: (app: App, watchers: unknown) => void -} - -const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8) - -const isReadme = function (filepath: string): boolean { - return /((readme)|(index))\.md$/i.test(filepath) -} - -export const generateFrontmatter = ( - sourceDir: string, - localeOption: PlumeThemeLocaleOptions -): GenerateFrontmatter => { - const { article, notes } = localeOption - const { - notes: noteList, - link: notesLink, - dir: notesDir, - } = notes as PlumeThemeNotesOptions - const matterTask: Record = { - title: ({ filepath }: MarkdownFile, title: string): string => { - if (title) return title - const file = path.relative(sourceDir, filepath) - let currentNote: PlumeThemeNotesItem | undefined - if ( - notesDir && - file.startsWith(notesDir.replace(/^\//, '')) && - isReadme(filepath) && - (currentNote = noteList.find((note) => - file.startsWith(path.join(notesDir.replace(/^\//, ''), note.dir)) - )) - ) { - return currentNote.text || currentNote.dir - } - const basename = path.basename(filepath) - if (isReadme(basename)) { - return path.dirname(filepath).split('/').slice(-1)[0] - } - return basename.replace(/^\d+\./, '').replace(path.extname(filepath), '') - }, - createTime: ({ createTime }: MarkdownFile, formatTime: string): string => { - if (formatTime) return formatTime - return format(new Date(createTime), 'yyyy/MM/dd hh:mm:ss') - }, - author: (_: any, author: string): string => { - if (author) return author - const pkg = require(path.join(process.cwd(), 'package.json')) - return pkg.author - }, - // 自动生成永久链接 - permalink: ({ filepath }: MarkdownFile, permalink: string): string => { - const file = path.relative(sourceDir, filepath) - if (permalink) { - if (notes && notesDir && file.startsWith(notesDir.replace(/^\//, ''))) { - return permalink - } else { - if ( - article && - permalink.startsWith('/' + article.replace(/^\//, '')) - ) { - return permalink - } else { - const per = permalink.split('/') - return path.join(article, per[per.length - 1]) - } - } - } - let prefix = '' - if (notes) { - // 表示是以笔记开头的 - if (notesDir && file.startsWith(notesDir.replace(/^\//, ''))) { - prefix = notesLink || '' - const currentNote = noteList.find((note) => - file.startsWith(path.join(notesDir.replace(/^\//, ''), note.dir)) - ) - currentNote && (prefix = path.join(prefix, currentNote.link)) - } else { - prefix = article as string - } - } else { - prefix = article as string - } - return path.join(prefix, isReadme(filepath) ? '' : nanoid(), '/') - }, - } - - const formatMarkdown = (file: MarkdownFile): string => { - const { data, content } = matter(file.content) - Object.keys(matterTask).forEach((key) => { - const value = matterTask[key](file, data[key]) - data[key] = value ?? data[key] - }) - const yaml = jsonToYaml - .stringify(data) - .replace(/\n\s{2}/g, '\n') - .replace(/"/g, '') - return `${yaml}---\n${content}` - } - - const formatFrontmatter = (): void => { - const files = readFileList(sourceDir) - files.forEach((file) => { - const relativePath = path.relative(sourceDir, file.filepath) - if (isReadme(relativePath)) return - fs.writeFileSync(file.filepath, formatMarkdown(file), 'utf-8') - }) - } - - const watchNewMarkDown = (app: App, watchers: any): void => { - const watcher = chokidar.watch('**/*.md', { - ignored: /node_modules/, - cwd: app.options.source, - ignoreInitial: true, - }) - watcher.on('add', (file, stat) => { - const filepath = path.join(app.options.source, file) - stat = stat || fs.statSync(filepath) - const newFile = readFile(filepath, stat) - const content = formatMarkdown(newFile) - fs.writeFileSync(filepath, content, 'utf-8') - }) - watchers.push(watcher) - } - - return { formatFrontmatter, watchNewMarkDown } -} diff --git a/packages/theme/src/node/index.ts b/packages/theme/src/node/index.ts index 6cb4b71c..a89a69bb 100644 --- a/packages/theme/src/node/index.ts +++ b/packages/theme/src/node/index.ts @@ -1,18 +1,8 @@ -import type { - PlumeThemeNotesItem, - PlumeThemeNotesOptions, - PlumeThemeOptions, - PlumeThemeSidebarConfigOptions, -} from '../shared/index.js' -import { themePlume } from './theme.js' -export * from './theme.js' -export * from './define.js' +import { plumeTheme } from './theme.js' -export { - PlumeThemeOptions, - PlumeThemeNotesOptions, - PlumeThemeNotesItem, - PlumeThemeSidebarConfigOptions, -} +export * from './defineConfig.js' +export * from '../shared/index.js' -export default themePlume +export { plumeTheme } + +export default plumeTheme diff --git a/packages/theme/src/node/plugins.ts b/packages/theme/src/node/plugins.ts new file mode 100644 index 00000000..4ce3adb9 --- /dev/null +++ b/packages/theme/src/node/plugins.ts @@ -0,0 +1,146 @@ +import { autoFrontmatterPlugin } from '@vuepress-plume/vuepress-plugin-auto-frontmatter' +import { baiduTongjiPlugin } from '@vuepress-plume/vuepress-plugin-baidu-tongji' +import { blogDataPlugin } from '@vuepress-plume/vuepress-plugin-blog-data' +import { caniusePlugin } from '@vuepress-plume/vuepress-plugin-caniuse' +import { copyCodePlugin } from '@vuepress-plume/vuepress-plugin-copy-code' +import type { App, PluginConfig } from '@vuepress/core' +import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links' +import { docsearchPlugin } from '@vuepress/plugin-docsearch' +import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon' +import { gitPlugin } from '@vuepress/plugin-git' +import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom' +import { nprogressPlugin } from '@vuepress/plugin-nprogress' +import { palettePlugin } from '@vuepress/plugin-palette' +import { prismjsPlugin } from '@vuepress/plugin-prismjs' +import { searchPlugin } from '@vuepress/plugin-search' +import { themeDataPlugin } from '@vuepress/plugin-theme-data' +import { commentPlugin } from 'vuepress-plugin-comment2' +import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance' +import { seoPlugin } from 'vuepress-plugin-seo2' +import { sitemapPlugin } from 'vuepress-plugin-sitemap2' +import type { + PlumeThemeLocaleOptions, + PlumeThemePluginOptions, +} from '../shared/index.js' +import autoFrontmatter from './autoFrontmatter.js' + +export const setupPlugins = ( + app: App, + options: PlumeThemePluginOptions, + localeOptions: PlumeThemeLocaleOptions +): PluginConfig => { + const isProd = !app.env.isDev + + return [ + palettePlugin({ preset: 'sass' }), + themeDataPlugin({ themeData: localeOptions }), + autoFrontmatterPlugin(autoFrontmatter(app, localeOptions)), + blogDataPlugin({ + include: ['**/*.md'], + exclude: ['**/{README,index}.md', 'notes/**'], + }), + activeHeaderLinksPlugin({ + headerLinkSelector: 'a.theme-plume-toc-link', + headerAnchorSelector: '.header-anchor', + delay: 200, + offset: 20, + }), + + options.nprogress !== false ? nprogressPlugin() : [], + + options.git !== false + ? gitPlugin({ + createdTime: true, + updatedTime: true, + contributors: false, + }) + : [], + + options.mediumZoom !== false + ? mediumZoomPlugin({ + selector: '.page-content > img, .page-content :not(a) > img', + zoomOptions: { + background: 'var(--c-bg)', + }, + delay: 300, + }) + : [], + + options.caniuse !== false + ? caniusePlugin( + options.caniuse || { + mode: 'embed', + } + ) + : [], + + options.externalLinkIcon !== false + ? externalLinkIconPlugin({ + locales: Object.entries(localeOptions.locales || {}).reduce( + (result: Record, [key, value]) => { + result[key] = { + openInNewWindow: + value.openInNewWindow ?? localeOptions.openInNewWindow, + } + return result + }, + {} + ), + }) + : [], + + options.search !== false ? searchPlugin(options.search) : [], + options.docsearch !== false && !options.search + ? docsearchPlugin(options.docsearch!) + : [], + options.prismjs !== false ? prismjsPlugin() : [], + options.copyCode !== false + ? copyCodePlugin({ + selector: '.page-content div[class*="language-"] pre', + locales: { + '/': { + copy: '复制成功', + hint: '复制代码', + }, + }, + ...options.copyCode, + }) + : [], + + options.markdownEnhance !== false + ? mdEnhancePlugin( + Object.assign( + { + container: true, // info note tip warning danger details + codetabs: true, + tabs: true, + align: true, + mark: true, + tasklist: true, + demo: true, + attrs: true, + }, + options.markdownEnhance || {} + ) + ) + : [], + + options.comment !== false ? commentPlugin(options.comment || {}) : [], + + options.baiduTongji !== false && options.baiduTongji?.key + ? baiduTongjiPlugin(options.baiduTongji) + : [], + + options.sitemap !== false && localeOptions.hostname && isProd + ? sitemapPlugin({ + hostname: localeOptions.hostname, + }) + : [], + options.seo !== false && localeOptions.hostname && isProd + ? seoPlugin({ + hostname: localeOptions.hostname || '', + author: localeOptions.avatar?.name, + }) + : [], + ] +} diff --git a/packages/theme/src/node/plugins/activeHeaderLink.ts b/packages/theme/src/node/plugins/activeHeaderLink.ts deleted file mode 100644 index fc9dcda8..00000000 --- a/packages/theme/src/node/plugins/activeHeaderLink.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { PluginObject } from '@vuepress/core' -import { activeHeaderLinksPlugin } from '@vuepress/plugin-active-header-links' - -export const resolveActiveHeaderLink = (): PluginObject => { - return activeHeaderLinksPlugin({ - headerLinkSelector: 'a.theme-plume-toc-link', - headerAnchorSelector: '.header-anchor', - delay: 200, - offset: 20, - }) -} diff --git a/packages/theme/src/node/plugins/baiduTongji.ts b/packages/theme/src/node/plugins/baiduTongji.ts deleted file mode 100644 index 446aa47b..00000000 --- a/packages/theme/src/node/plugins/baiduTongji.ts +++ /dev/null @@ -1,12 +0,0 @@ -// 8a4e65dd3f2d30e64c828481295e09d1 -import type { BaiduTongjiOptions } from '@vuepress-plume/vuepress-plugin-baidu-tongji' -import { baiduTongjiPlugin } from '@vuepress-plume/vuepress-plugin-baidu-tongji' -import type { Plugin } from '@vuepress/core' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveBaiduTongji = ({ - baiduTongji, -}: PlumeThemePluginOptions): Plugin => { - if (baiduTongji === false || !baiduTongji?.key) return [] as unknown as Plugin - return baiduTongjiPlugin(baiduTongji as BaiduTongjiOptions) -} diff --git a/packages/theme/src/node/plugins/caniuse.ts b/packages/theme/src/node/plugins/caniuse.ts deleted file mode 100644 index 44834a34..00000000 --- a/packages/theme/src/node/plugins/caniuse.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { caniusePlugin } from '@vuepress-plume/vuepress-plugin-caniuse' -import type { Plugin } from '@vuepress/core' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveCanIUse = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.caniuse === false) return [] as unknown as Plugin - return caniusePlugin( - plugins.caniuse || { - mode: 'embed', - } - ) -} diff --git a/packages/theme/src/node/plugins/comment.ts b/packages/theme/src/node/plugins/comment.ts deleted file mode 100644 index 30c5c899..00000000 --- a/packages/theme/src/node/plugins/comment.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { commentPlugin } from 'vuepress-plugin-comment2' -import type { CommentOptions } from 'vuepress-plugin-comment2' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveComment = (plugins: PlumeThemePluginOptions): Plugin => { - if (!plugins.comment) return [] as unknown as Plugin - return commentPlugin(plugins.comment as CommentOptions) -} diff --git a/packages/theme/src/node/plugins/copyCode.ts b/packages/theme/src/node/plugins/copyCode.ts deleted file mode 100644 index f75f7361..00000000 --- a/packages/theme/src/node/plugins/copyCode.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { copyCodePlugin } from '@vuepress-plume/vuepress-plugin-copy-code' -import type { Plugin } from '@vuepress/core' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveCopyCode = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.copyCode === false) return [] as unknown as Plugin - return copyCodePlugin( - plugins.copyCode || { - selector: '.page-content div[class*="language-"] pre', - locales: { - '/': { - copy: '复制成功', - hint: '复制代码', - }, - }, - } - ) -} diff --git a/packages/theme/src/node/plugins/externalLinkIcon.ts b/packages/theme/src/node/plugins/externalLinkIcon.ts deleted file mode 100644 index 1e7100be..00000000 --- a/packages/theme/src/node/plugins/externalLinkIcon.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { externalLinkIconPlugin } from '@vuepress/plugin-external-link-icon' -import type { - PlumeThemeLocaleOptions, - PlumeThemePluginOptions, -} from '../../shared/index.js' - -export const resolveExternalLinkIconPlugin = ( - plugins: PlumeThemePluginOptions, - localeOptions: PlumeThemeLocaleOptions -): Plugin => { - if (plugins.externalLinkIcon === false) return [] as unknown as Plugin - return externalLinkIconPlugin({ - locales: Object.entries(localeOptions.locales || {}).reduce( - (result: Record, [key, value]) => { - result[key] = { - openInNewWindow: - value.openInNewWindow ?? localeOptions.openInNewWindow, - } - return result - }, - {} - ), - }) -} diff --git a/packages/theme/src/node/plugins/git.ts b/packages/theme/src/node/plugins/git.ts deleted file mode 100644 index 71b9dfb6..00000000 --- a/packages/theme/src/node/plugins/git.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { gitPlugin } from '@vuepress/plugin-git' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -const isProd = process.env.NODE_ENV === 'production' - -export const resolveGit = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.git === false || !isProd) return [] as unknown as Plugin - return gitPlugin({ - createdTime: true, - updatedTime: true, - contributors: false, - }) -} diff --git a/packages/theme/src/node/plugins/index.ts b/packages/theme/src/node/plugins/index.ts deleted file mode 100644 index 2db321d2..00000000 --- a/packages/theme/src/node/plugins/index.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { PluginConfig } from '@vuepress/core' -import type { - PlumeThemeLocaleOptions, - PlumeThemePluginOptions, -} from '../../shared/index.js' -import { resolveActiveHeaderLink } from './activeHeaderLink.js' -import { resolveBaiduTongji } from './baiduTongji.js' -import { resolveCanIUse } from './caniuse.js' -import { resolveComment } from './comment.js' -import { resolveCopyCode } from './copyCode.js' -import { resolveExternalLinkIconPlugin } from './externalLinkIcon.js' -import { resolveGit } from './git.js' -import { resolveMarkdownEnhance } from './markdownEnhance.js' -import { resolveMediumZoom } from './mediumZoom.js' -import { resolveNprogress } from './nprogress.js' -import { resolvePalette } from './palette.js' -import { resolvePrismjs } from './prismjs.js' -import { resolveSearch } from './search.js' -import { resolveSeo } from './seo.js' -import { resolveSitemap } from './sitemap.js' -import { resolveThemeData } from './themeData.js' - -export const getPlugins = ( - plugins: PlumeThemePluginOptions, - localeOptions: PlumeThemeLocaleOptions -): PluginConfig => { - const resolvePlugins: PluginConfig = [ - resolvePalette(), - resolveActiveHeaderLink(), - resolveNprogress(plugins), - resolveMediumZoom(plugins), - resolveCanIUse(plugins), - resolveExternalLinkIconPlugin(plugins, localeOptions), - resolveSearch(plugins), - resolvePrismjs(plugins), - resolveGit(plugins), - resolveCopyCode(plugins), - resolveMarkdownEnhance(plugins), - resolveComment(plugins), - resolveSitemap(plugins, localeOptions), - resolveSeo(plugins, localeOptions), - resolveThemeData(localeOptions), - resolveBaiduTongji(plugins), - ] - return resolvePlugins -} diff --git a/packages/theme/src/node/plugins/markdownEnhance.ts b/packages/theme/src/node/plugins/markdownEnhance.ts deleted file mode 100644 index ec17c30a..00000000 --- a/packages/theme/src/node/plugins/markdownEnhance.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveMarkdownEnhance = ( - plugins: PlumeThemePluginOptions -): Plugin => { - if (plugins.markdownEnhance === false) return [] as unknown as Plugin - return mdEnhancePlugin( - Object.assign( - { - container: true, // info note tip warning danger details - codetabs: true, - tabs: true, - align: true, - mark: true, - tasklist: true, - demo: true, - attrs: true, - }, - plugins.markdownEnhance || {} - ) - ) -} diff --git a/packages/theme/src/node/plugins/mediumZoom.ts b/packages/theme/src/node/plugins/mediumZoom.ts deleted file mode 100644 index bd27d968..00000000 --- a/packages/theme/src/node/plugins/mediumZoom.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { mediumZoomPlugin } from '@vuepress/plugin-medium-zoom' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveMediumZoom = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.mediumZoom === false) return [] as unknown as Plugin - return mediumZoomPlugin({ - selector: '.page-content > img, .page-content :not(a) > img', - zoomOptions: {}, - delay: 300, - }) -} diff --git a/packages/theme/src/node/plugins/nprogress.ts b/packages/theme/src/node/plugins/nprogress.ts deleted file mode 100644 index f24b8820..00000000 --- a/packages/theme/src/node/plugins/nprogress.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { nprogressPlugin } from '@vuepress/plugin-nprogress' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveNprogress = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.nprogress === false) return [] as unknown as Plugin - return nprogressPlugin() -} diff --git a/packages/theme/src/node/plugins/palette.ts b/packages/theme/src/node/plugins/palette.ts deleted file mode 100644 index a1e2cd94..00000000 --- a/packages/theme/src/node/plugins/palette.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { palettePlugin } from '@vuepress/plugin-palette' - -export const resolvePalette = (): Plugin => { - return palettePlugin({ preset: 'sass' }) -} diff --git a/packages/theme/src/node/plugins/prismjs.ts b/packages/theme/src/node/plugins/prismjs.ts deleted file mode 100644 index ca6a3ff2..00000000 --- a/packages/theme/src/node/plugins/prismjs.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { prismjsPlugin } from '@vuepress/plugin-prismjs' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolvePrismjs = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.prismjs === false) return [] as unknown as Plugin - return prismjsPlugin() -} diff --git a/packages/theme/src/node/plugins/search.ts b/packages/theme/src/node/plugins/search.ts deleted file mode 100644 index f39765fb..00000000 --- a/packages/theme/src/node/plugins/search.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { docsearchPlugin } from '@vuepress/plugin-docsearch' -import { searchPlugin } from '@vuepress/plugin-search' -import type { PlumeThemePluginOptions } from '../../shared/index.js' - -export const resolveSearch = (plugins: PlumeThemePluginOptions): Plugin => { - if (plugins.search) { - return searchPlugin(plugins.search) - } - if (plugins.docsearch) { - return docsearchPlugin(plugins.docsearch) - } - return [] as unknown as Plugin -} diff --git a/packages/theme/src/node/plugins/seo.ts b/packages/theme/src/node/plugins/seo.ts deleted file mode 100644 index 3329f9e1..00000000 --- a/packages/theme/src/node/plugins/seo.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { seoPlugin } from 'vuepress-plugin-seo2' -import type { - PlumeThemeLocaleOptions, - PlumeThemePluginOptions, -} from '../../shared/index.js' - -const isProd = process.env.NODE_ENV === 'production' - -export const resolveSeo = ( - plugins: PlumeThemePluginOptions, - localeOptions: PlumeThemeLocaleOptions -): Plugin => { - if (plugins.sitemap === false || !localeOptions.hostname || !isProd) - return [] as unknown as Plugin - return seoPlugin({ - hostname: localeOptions.hostname || '', - author: localeOptions.avatar?.name, - }) -} diff --git a/packages/theme/src/node/plugins/sitemap.ts b/packages/theme/src/node/plugins/sitemap.ts deleted file mode 100644 index b13e52bf..00000000 --- a/packages/theme/src/node/plugins/sitemap.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { Plugin } from '@vuepress/core' -import { sitemapPlugin } from 'vuepress-plugin-sitemap2' -import type { - PlumeThemeLocaleOptions, - PlumeThemePluginOptions, -} from '../../shared/index.js' - -const isProd = process.env.NODE_ENV === 'production' - -export const resolveSitemap = ( - plugins: PlumeThemePluginOptions, - localeOptions: PlumeThemeLocaleOptions -): Plugin => { - if (plugins.sitemap === false || !localeOptions.hostname || !isProd) - return [] as unknown as Plugin - return sitemapPlugin({ - hostname: localeOptions.hostname, - }) -} diff --git a/packages/theme/src/node/plugins/themeData.ts b/packages/theme/src/node/plugins/themeData.ts deleted file mode 100644 index c6ddc929..00000000 --- a/packages/theme/src/node/plugins/themeData.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { PluginObject } from '@vuepress/core' -import { themeDataPlugin } from '@vuepress/plugin-theme-data' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' -export const resolveThemeData = ( - localeOptions: PlumeThemeLocaleOptions -): PluginObject => { - return themeDataPlugin({ themeData: localeOptions }) -} diff --git a/packages/theme/src/node/prepared/index.ts b/packages/theme/src/node/prepared/index.ts deleted file mode 100644 index 0718e219..00000000 --- a/packages/theme/src/node/prepared/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { App } from '@vuepress/core' -import type { PlumeThemeLocaleOptions } from '../../shared/index.js' -import { preparedPostIndex, watchPostIndex } from './postIndex.js' -import { preparedSidebarIndex, watchSidebarIndex } from './sidebarIndex.js' - -export const onPrepared = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - await preparedPostIndex(app, localeOption) - await preparedSidebarIndex(app, localeOption) -} - -export const preparedWatch = ( - app: App, - watchers: any[], - localeOption: PlumeThemeLocaleOptions -): void => { - watchPostIndex(app, watchers, localeOption) - watchSidebarIndex(app, watchers, localeOption) -} diff --git a/packages/theme/src/node/prepared/postIndex.ts b/packages/theme/src/node/prepared/postIndex.ts deleted file mode 100644 index 98af43e8..00000000 --- a/packages/theme/src/node/prepared/postIndex.ts +++ /dev/null @@ -1,87 +0,0 @@ -import type { App, Page } from '@vuepress/core' -import * as chokidar from 'chokidar' -import type { - PlumeThemeLocaleOptions, - PlumeThemePageData, - PlumeThemePostFrontmatter, - PostIndex, - PostItem, -} from '../../shared/index.js' -import { getCreateTime } from '../utils/index.js' - -const HMR_CODE = ` -if (import.meta.webpackHot) { - import.meta.webpackHot.accept() - if (__VUE_HMR_RUNTIME__.updatePostIndex) { - __VUE_HMR_RUNTIME__.updatePostIndex(postIndex) - } -} - -if (import.meta.hot) { - import.meta.hot.accept(({ postIndex }) => { - __VUE_HMR_RUNTIME__.updatePostIndex(postIndex) - }) -} -` - -export const preparedPostIndex = async ( - app: App, - localeOption: PlumeThemeLocaleOptions -): Promise => { - const postIndex: PostIndex = (app.pages as Page[]) - .filter((page) => { - return ( - !!page.pathInferred && - !!page.filePath && - page.path !== '/' && - page.path !== '/404.html' - ) - }) - .sort((left, right) => { - const leftMatter = left.frontmatter as PlumeThemePostFrontmatter - const rightMatter = right.frontmatter as PlumeThemePostFrontmatter - const leftTime = getCreateTime(leftMatter.createTime || '') - const rightTime = getCreateTime(rightMatter.createTime || '') - return leftTime < rightTime ? 1 : -1 - }) - .map((page: Page) => { - const frontmatter = page.frontmatter as PlumeThemePostFrontmatter - return { - title: page.title, - path: page.path, - excerpt: page.excerpt, - tags: frontmatter.tags || [], - createTime: page.data.createTime, - author: frontmatter.author, - sticky: frontmatter.sticky, - article: frontmatter.article, - category: page.data.category, - isNote: page.data.isNote, - banner: frontmatter.banner, - } as PostItem - }) - - let content = ` -export const postIndex = ${JSON.stringify(postIndex, null, 2)} -` - if (app.env.isDev) { - content += HMR_CODE - } - - await app.writeTemp('internal/postIndex.js', content) -} - -export const watchPostIndex = ( - app: App, - watchers: any[], - localeOption: PlumeThemeLocaleOptions -): void => { - const watcher = chokidar.watch('pages/**/*', { - cwd: app.dir.temp(), - ignoreInitial: true, - }) - watcher.on('add', () => preparedPostIndex(app, localeOption)) - watcher.on('change', () => preparedPostIndex(app, localeOption)) - watcher.on('unlink', () => preparedPostIndex(app, localeOption)) - watchers.push(watcher) -} diff --git a/packages/theme/src/node/prepared/sidebarIndex.ts b/packages/theme/src/node/prepared/sidebarIndex.ts deleted file mode 100644 index 5fe77fec..00000000 --- a/packages/theme/src/node/prepared/sidebarIndex.ts +++ /dev/null @@ -1,177 +0,0 @@ -import type { App, Page } from '@vuepress/core' -import { path } from '@vuepress/utils' -import * as chokidar from 'chokidar' -import type { - PlumeThemeLocaleOptions, - PlumeThemeNotesItem, - PlumeThemeNotesOptions, - PlumeThemePageData, - PlumeThemeSidebarConfigOptions, - SidebarItem, - SidebarOptions, -} from '../../shared/index.js' - -const HMR_CODE = ` -if (import.meta.webpackHot) { - import.meta.webpackHot.accept() - if (__VUE_HMR_RUNTIME__.updateSidebarIndex) { - __VUE_HMR_RUNTIME__.updatePostIndex(sidebarIndex) - } -} - -if (import.meta.hot) { - import.meta.hot.accept(({ sidebarIndex }) => { - __VUE_HMR_RUNTIME__.updateSidebarIndex(sidebarIndex) - }) -} -` - -interface NotePage { - relativePath: string[] - title: string - link: string -} - -export const preparedSidebarIndex = async ( - app: App, - { notes }: PlumeThemeLocaleOptions -): Promise => { - const pages = app.pages as Page[] - if (notes === false) return - const { - notes: noteList, - dir: rootDir, - link: rootLink, - } = notes as PlumeThemeNotesOptions - const notePageList: NotePage[] = pages - .filter((page) => page.filePathRelative?.startsWith(rootDir as string)) - .map((page) => { - return { - relativePath: page.filePathRelative?.split('/').slice(1) || [], - title: page.title, - link: page.path, - } - }) - - const sidebarMap: Record = {} - noteList.forEach((note) => { - sidebarMap[path.join('/', rootLink, note.link)] = noteSidebar( - note, - notePageList.filter( - (page) => - page.relativePath?.[0] === note.dir.trim().replace(/^\/|\/$/g, '') - ) - ) - }) - - let content = ` -export const sidebarIndex = ${JSON.stringify(sidebarMap, null, 2)} -` - if (app.env.isDev) { - content += HMR_CODE - } - - await app.writeTemp('internal/sidebarIndex.js', content) -} - -function noteSidebar( - note: PlumeThemeNotesItem, - notePageList: NotePage[] -): SidebarOptions { - if (note.sidebar === undefined) return [] - if (note.sidebar === 'auto') { - return autoSidebar(note, notePageList) - } - return sidebarByConfig( - note.text, - note.link, - note.dir, - note.sidebar, - notePageList - ) -} - -function autoSidebar( - note: PlumeThemeNotesItem, - notePageList: NotePage[] -): SidebarOptions { - return [] -} - -function sidebarByConfig( - text: string, - link: string | undefined, - dir: string, - sidebarConfig: PlumeThemeSidebarConfigOptions, - notePageList: NotePage[] -): SidebarOptions { - return sidebarConfig.map((sidebar) => { - if (typeof sidebar === 'string') { - const current = findNotePage(sidebar, dir, notePageList) - return { - text: current ? current.title : text, - link: current ? current.link : '', - children: [], - } as SidebarItem - } else { - link = path.join(link || '', sidebar.link || '') - const current = sidebar.link - ? findNotePage(sidebar.link, dir, notePageList) - : undefined - return { - text: sidebar.text || sidebar.dir || '', - link: current?.link, - children: sidebarByConfig( - sidebar.text, - sidebar.link, - path.join(dir, sidebar.dir || ''), - sidebar.children, - notePageList - ), - } - } - }) -} - -function findNotePage( - sidebar: string, - dir: string, - notePageList: NotePage[] -): NotePage | undefined { - if (sidebar === '' || sidebar === 'README.md' || sidebar === 'index.md') { - return notePageList.find((page) => { - const relative = page.relativePath.join('/') - return ( - relative === path.join(dir, 'README.md') || - relative === path.join(dir, 'index.md') - ) - }) - } else { - return notePageList.find((page) => { - const relative = page.relativePath.join('/') - return ( - relative === path.join(dir, sidebar) || - relative === path.join(dir, sidebar + '.md') || - page.link === sidebar - ) - }) - } -} - -export const watchSidebarIndex = ( - app: App, - watchers: any[], - localeOption: PlumeThemeLocaleOptions -): void => { - if (!localeOption.notes || !localeOption.notes.dir) return - const dir = path.join('pages', localeOption.notes.dir, '**/*') - const watcher = chokidar.watch(dir, { - cwd: app.dir.temp(), - ignoreInitial: true, - }) - - watcher.on('add', () => preparedSidebarIndex(app, localeOption)) - watcher.on('change', () => preparedSidebarIndex(app, localeOption)) - watcher.on('unlink', () => preparedSidebarIndex(app, localeOption)) - watchers.push(watcher) -} diff --git a/packages/theme/src/node/shims.d.ts b/packages/theme/src/node/shims.d.ts deleted file mode 100644 index 5591cb30..00000000 --- a/packages/theme/src/node/shims.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module 'json2yaml' { - const result: any - - export default result -} diff --git a/packages/theme/src/node/theme.ts b/packages/theme/src/node/theme.ts index 84c214b8..f11f11f9 100644 --- a/packages/theme/src/node/theme.ts +++ b/packages/theme/src/node/theme.ts @@ -1,42 +1,31 @@ -import type { App, Page, Theme } from '@vuepress/core' -import merge from 'lodash.merge' -import type { PlumeThemeOptions, PlumeThemePageData } from '../shared/index.js' -import { getAlias } from './alias.js' -import { createPage } from './createPage/index.js' -import { defaultLocaleOption } from './defaultLocaleOption.js' -import { extendsPage } from './extendsPage.js' -import { generateFrontmatter } from './generateFrontmatter.js' -import { getPlugins } from './plugins/index.js' -import { onPrepared, preparedWatch } from './prepared/index.js' -import { resolveClient, resolveTemplate } from './utils/index.js' +import type { App, Theme } from '@vuepress/core' +import { fs, getDirname, path } from '@vuepress/utils' +import type { PlumeThemeOptions } from '../shared/index.js' +import { setupPlugins } from './plugins.js' -export const themePlume = ({ +const __dirname = getDirname(import.meta.url) + +export const plumeTheme = ({ themePlugins = {}, - ...localeOption + ...localeOptions }: PlumeThemeOptions = {}): Theme => { - localeOption = merge(defaultLocaleOption, localeOption) - let watchMarkdown: null | ((app: App, watchers: unknown) => void) = null - return { - name: '@vuepress-plume/vuepress-theme-plume', - templateBuild: resolveTemplate('index.build.html'), - alias: getAlias(), - clientConfigFile: resolveClient('config.js'), - onInitialized: async (app) => { - const { formatFrontmatter, watchNewMarkDown } = generateFrontmatter( - app.options.source, - localeOption - ) - watchMarkdown = watchNewMarkDown - formatFrontmatter() - await createPage(app, localeOption) - }, - onPrepared: async (app) => await onPrepared(app, localeOption), - extendsPage: (page: Page>) => - extendsPage(page, localeOption), - onWatched: (app, watchers) => { - preparedWatch(app, watchers, localeOption) - watchMarkdown && watchMarkdown(app, watchers) - }, - plugins: getPlugins(themePlugins, localeOption), + return (app: App) => { + return { + name: '@vuepress-plume/theme-plume', + templateBuild: path.resolve(__dirname, '../../templates/build.html'), + alias: { + ...Object.fromEntries( + fs + .readdirSync(path.resolve(__dirname, '../client/components')) + .filter((file) => file.endsWith('.vue')) + .map((file) => [ + `@theme/${file}`, + path.resolve(__dirname, '../client/components', file), + ]) + ), + }, + clientConfigFile: path.resolve(__dirname, '../client/config.js'), + plugins: setupPlugins(app, themePlugins, localeOptions), + } } } diff --git a/packages/theme/src/node/utils/date.ts b/packages/theme/src/node/utils/date.ts deleted file mode 100644 index ce55d2a6..00000000 --- a/packages/theme/src/node/utils/date.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { format, getTime, parse } from 'date-fns' - -export const getCreateTime = (date: string): number => { - const d = parse(date, 'yyyy/MM/dd HH:mm:ss', new Date()) - return getTime(d) -} - -export const formatDate = (date: string | undefined): string => { - if (!date) return '' - const d = parse(date, 'yyyy/MM/dd HH:mm:ss', new Date()) - return format(d, 'yyyy-MM-dd') -} diff --git a/packages/theme/src/node/utils/index.ts b/packages/theme/src/node/utils/index.ts deleted file mode 100644 index 0f359eb3..00000000 --- a/packages/theme/src/node/utils/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './path.js' -export * from './date.js' -export * from './readFileList.js' diff --git a/packages/theme/src/node/utils/path.ts b/packages/theme/src/node/utils/path.ts deleted file mode 100644 index 65be7e04..00000000 --- a/packages/theme/src/node/utils/path.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { getDirname, path } from '@vuepress/utils' - -const __dirname = getDirname(import.meta.url) - -export const resolvePath = (...args: string[]): string => { - return path.resolve(__dirname, '../../', ...args) -} - -export const resolveClient = (...args: string[]): string => { - return resolvePath('client', ...args) -} - -export const resolveTemplate = (...args: string[]): string => { - return resolvePath('../', 'template', ...args) -} diff --git a/packages/theme/src/node/utils/readFileList.ts b/packages/theme/src/node/utils/readFileList.ts deleted file mode 100644 index 32216ce0..00000000 --- a/packages/theme/src/node/utils/readFileList.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fs, path } from '@vuepress/utils' - -export interface MarkdownFile { - filepath: string - content: string - createTime: Date -} - -export const readFileList = ( - sourceDir: string, - fileList: MarkdownFile[] = [] -): MarkdownFile[] => { - const files = fs.readdirSync(sourceDir) - files.forEach((file) => { - const filepath = path.join(sourceDir, file) - const stat = fs.statSync(filepath) - if (stat.isDirectory()) { - if (file !== '.vuepress' && file !== 'node_modules') - readFileList(filepath, fileList) - } else { - const extname = path.extname(file) - const basename = path.basename(file) - if ( - (extname === '.md' || extname === '.MD') && - basename !== 'CHANGELOG' - ) { - fileList.push(readFile(filepath, stat)) - } - } - }) - return fileList.filter((file) => file.filepath.endsWith('.md')) -} - -export const readFile = (filepath: string, stat: fs.Stats): MarkdownFile => { - return { - filepath, - content: fs.readFileSync(filepath, 'utf-8'), - createTime: getFileCreateTime(stat), - } -} - -export const getFileCreateTime = (stat: fs.Stats): Date => { - return stat.birthtime.getFullYear() !== 1970 ? stat.birthtime : stat.atime -} diff --git a/packages/theme/src/shared/frontmatter/post.ts b/packages/theme/src/shared/frontmatter.ts similarity index 59% rename from packages/theme/src/shared/frontmatter/post.ts rename to packages/theme/src/shared/frontmatter.ts index c96f0f20..097b72b4 100644 --- a/packages/theme/src/shared/frontmatter/post.ts +++ b/packages/theme/src/shared/frontmatter.ts @@ -1,5 +1,8 @@ +export interface PlumeThemeHomeFrontmatter { + home?: true +} + export interface PlumeThemePostFrontmatter { - title?: string createTime?: string author?: string tags?: string[] @@ -8,3 +11,7 @@ export interface PlumeThemePostFrontmatter { banner?: string bgBanner?: string } + +export interface PlumeThemeNoteFrontmatter { + createTime?: string +} diff --git a/packages/theme/src/shared/frontmatter/home.ts b/packages/theme/src/shared/frontmatter/home.ts deleted file mode 100644 index d2e2a9f1..00000000 --- a/packages/theme/src/shared/frontmatter/home.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { PlumeThemeNormalFrontmatter } from './normal.js' - -export interface PlumeThemeProductItem { - link?: string - text: string - description?: string - logo?: string -} - -export type PlumeThemeProductList = PlumeThemeProductItem[] - -export interface PlumeThemeHomeFrontmatter extends PlumeThemeNormalFrontmatter { - home?: true - banner?: string - mobileBanner?: string - productList?: PlumeThemeProductList - motto?: string -} diff --git a/packages/theme/src/shared/frontmatter/index.ts b/packages/theme/src/shared/frontmatter/index.ts deleted file mode 100644 index 3cea147c..00000000 --- a/packages/theme/src/shared/frontmatter/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './normal.js' -export * from './post.js' -export * from './home.js' diff --git a/packages/theme/src/shared/frontmatter/normal.ts b/packages/theme/src/shared/frontmatter/normal.ts deleted file mode 100644 index 97db9ddb..00000000 --- a/packages/theme/src/shared/frontmatter/normal.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface PlumeThemeNormalFrontmatter { - home?: boolean -} diff --git a/packages/theme/src/shared/index.ts b/packages/theme/src/shared/index.ts index 93b78889..f15365c2 100644 --- a/packages/theme/src/shared/index.ts +++ b/packages/theme/src/shared/index.ts @@ -1,5 +1,3 @@ +export * from './frontmatter.js' +export * from './note.js' export * from './options/index.js' -export * from './layout/index.js' -export * from './post.js' -export * from './frontmatter/index.js' -export * from './page.js' diff --git a/packages/theme/src/shared/layout/index.ts b/packages/theme/src/shared/layout/index.ts deleted file mode 100644 index 1082a2ad..00000000 --- a/packages/theme/src/shared/layout/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './navbar.js' - -export * from './sidebar.js' diff --git a/packages/theme/src/shared/layout/navbar.ts b/packages/theme/src/shared/layout/navbar.ts deleted file mode 100644 index 58ae7487..00000000 --- a/packages/theme/src/shared/layout/navbar.ts +++ /dev/null @@ -1,22 +0,0 @@ -export interface NavItem { - text: string - ariaLabel?: string -} - -export interface NavGroup extends NavItem { - children: T[] -} - -export interface NavLink extends NavItem { - link: string - rel?: string - target?: string - activeMatch?: string -} - -export type NavbarItem = NavLink - -export type NavbarGroup = NavGroup - -export type NavbarConfig = (NavbarItem | NavbarGroup | string)[] -export type ResolveNavbarItem = NavbarItem | NavGroup diff --git a/packages/theme/src/shared/layout/sidebar.ts b/packages/theme/src/shared/layout/sidebar.ts deleted file mode 100644 index 72460ebb..00000000 --- a/packages/theme/src/shared/layout/sidebar.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface SidebarItem { - text: string - link?: string - children: SidebarOptions -} - -export type SidebarOptions = SidebarItem[] diff --git a/packages/theme/src/shared/options/notes.ts b/packages/theme/src/shared/note.ts similarity index 100% rename from packages/theme/src/shared/options/notes.ts rename to packages/theme/src/shared/note.ts diff --git a/packages/theme/src/shared/options/index.ts b/packages/theme/src/shared/options/index.ts index 62470d6c..940940d0 100644 --- a/packages/theme/src/shared/options/index.ts +++ b/packages/theme/src/shared/options/index.ts @@ -1,4 +1,17 @@ -export * from './plugin.js' +import type { ThemeData } from '@vuepress/plugin-theme-data' +import type { PlumeThemeLocaleData } from './locale.js' +import type { PlumeThemePluginOptions } from './plugins.js' + +export interface PlumeThemeOptions extends PlumeThemeLocaleOptions { + /** + * 对主题内部使用的插件进行配置 + */ + themePlugins?: PlumeThemePluginOptions +} + +export type PlumeThemeLocaleOptions = PlumeThemeData + +export type PlumeThemeData = ThemeData + export * from './locale.js' -export * from './options.js' -export * from './notes.js' +export * from './plugins.js' diff --git a/packages/theme/src/shared/options/locale.ts b/packages/theme/src/shared/options/locale.ts index e2970e6c..2132ecfb 100644 --- a/packages/theme/src/shared/options/locale.ts +++ b/packages/theme/src/shared/options/locale.ts @@ -1,6 +1,11 @@ import type { LocaleData } from '@vuepress/core' -import type { NavbarConfig, NavLink } from '../layout/index.js' -import type { PlumeThemeNotesOptions } from './notes.js' +// import type { NavbarConfig, NavLink } from '../layout/index.js' +// import type { PlumeThemeNotesOptions } from './notes.js' + +// todo type +type NavbarConfig = any +type NavLink = any +type PlumeThemeNotesOptions = any export interface PlumeThemeAvatar { /** diff --git a/packages/theme/src/shared/options/options.ts b/packages/theme/src/shared/options/options.ts deleted file mode 100644 index 49e2160d..00000000 --- a/packages/theme/src/shared/options/options.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ThemeData } from '@vuepress/plugin-theme-data' -import type { PlumeThemeLocaleData } from './locale.js' -import type { PlumeThemePluginOptions } from './plugin.js' - -export interface PlumeThemeOptions extends PlumeThemeLocaleOptions { - /** - * 对主题内部使用的插件进行配置 - */ - themePlugins?: PlumeThemePluginOptions -} - -export type PlumeThemeLocaleOptions = PlumeThemeData - -export type PlumeThemeData = ThemeData diff --git a/packages/theme/src/shared/options/plugin.ts b/packages/theme/src/shared/options/plugins.ts similarity index 98% rename from packages/theme/src/shared/options/plugin.ts rename to packages/theme/src/shared/options/plugins.ts index 38057636..2e860bae 100644 --- a/packages/theme/src/shared/options/plugin.ts +++ b/packages/theme/src/shared/options/plugins.ts @@ -5,6 +5,7 @@ import type { DocsearchOptions } from '@vuepress/plugin-docsearch' import type { SearchPluginOptions } from '@vuepress/plugin-search' import type { CommentOptions } from 'vuepress-plugin-comment2' import type { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance' + export interface PlumeThemePluginOptions { /** * 是否启用 can-i-use 插件 @@ -42,5 +43,7 @@ export interface PlumeThemePluginOptions { sitemap?: false + seo?: false + baiduTongji?: false | BaiduTongjiOptions } diff --git a/packages/theme/src/shared/page.ts b/packages/theme/src/shared/page.ts deleted file mode 100644 index 83ec492c..00000000 --- a/packages/theme/src/shared/page.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { PostItem } from './post.js' - -export type PlumeThemePageData = PostItem diff --git a/packages/theme/src/shared/post.ts b/packages/theme/src/shared/post.ts deleted file mode 100644 index 939139a8..00000000 --- a/packages/theme/src/shared/post.ts +++ /dev/null @@ -1,22 +0,0 @@ -export interface CategoryItem { - type: number | string - name: string -} - -export type CategoryData = CategoryItem[] - -export interface PostItem { - title: string - path: string - excerpt: string - tags: string[] - createTime: string - author: string - sticky?: boolean | number - article?: boolean - category: CategoryData - isNote?: boolean - banner?: string -} - -export type PostIndex = PostItem[] diff --git a/packages/theme/template/index.build.html b/packages/theme/templates/build.html similarity index 53% rename from packages/theme/template/index.build.html rename to packages/theme/templates/build.html index dbf2e687..eb399e3d 100644 --- a/packages/theme/template/index.build.html +++ b/packages/theme/templates/build.html @@ -1,9 +1,8 @@ - - - + + + - +
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc6f9cf3..58a1d7e4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,6 +94,22 @@ importers: sass-loader: 13.1.0_sass@1.55.0 vue: 3.2.41 + packages/plugin-auto-frontmatter: + specifiers: + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + chokidar: ^3.5.3 + glob-to-regexp: ^0.4.1 + gray-matter: ^4.0.3 + dependencies: + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + chokidar: 3.5.3 + glob-to-regexp: 0.4.1 + gray-matter: 4.0.3 + packages/plugin-baidu-tongji: specifiers: '@vuepress/client': 2.0.0-beta.51 @@ -106,6 +122,26 @@ importers: '@vuepress/shared': 2.0.0-beta.51 '@vuepress/utils': 2.0.0-beta.51 + packages/plugin-blog-data: + specifiers: + '@vue/devtools-api': ^6.4.5 + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + chokidar: ^3.5.3 + glob-to-regexp: ^0.4.1 + vue: ^3.2.41 + dependencies: + '@vue/devtools-api': 6.4.5 + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + chokidar: 3.5.3 + glob-to-regexp: 0.4.1 + vue: 3.2.41 + packages/plugin-caniuse: specifiers: '@types/markdown-it': ^12.2.3 @@ -212,6 +248,72 @@ importers: windicss-webpack-plugin: 1.7.6 packages/theme: + specifiers: + '@types/lodash.merge': ^4.6.7 + '@vuepress-plume/vuepress-plugin-auto-frontmatter': workspace:* + '@vuepress-plume/vuepress-plugin-baidu-tongji': workspace:* + '@vuepress-plume/vuepress-plugin-blog-data': workspace:* + '@vuepress-plume/vuepress-plugin-caniuse': workspace:* + '@vuepress-plume/vuepress-plugin-copy-code': workspace:* + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/plugin-active-header-links': 2.0.0-beta.51 + '@vuepress/plugin-container': 2.0.0-beta.51 + '@vuepress/plugin-docsearch': 2.0.0-beta.51 + '@vuepress/plugin-external-link-icon': 2.0.0-beta.51 + '@vuepress/plugin-git': 2.0.0-beta.51 + '@vuepress/plugin-medium-zoom': 2.0.0-beta.51 + '@vuepress/plugin-nprogress': 2.0.0-beta.51 + '@vuepress/plugin-palette': 2.0.0-beta.51 + '@vuepress/plugin-prismjs': 2.0.0-beta.51 + '@vuepress/plugin-search': 2.0.0-beta.51 + '@vuepress/plugin-theme-data': 2.0.0-beta.51 + '@vuepress/plugin-toc': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + date-fns: ^2.29.3 + nanoid: ^4.0.0 + ts-debounce: ^4.0.0 + vue: ^3.2.41 + vue-router: 4.1.5 + vuepress-plugin-comment2: 2.0.0-beta.110 + vuepress-plugin-md-enhance: 2.0.0-beta.110 + vuepress-plugin-seo2: 2.0.0-beta.110 + vuepress-plugin-sitemap2: 2.0.0-beta.110 + dependencies: + '@types/lodash.merge': 4.6.7 + '@vuepress-plume/vuepress-plugin-auto-frontmatter': link:../plugin-auto-frontmatter + '@vuepress-plume/vuepress-plugin-baidu-tongji': link:../plugin-baidu-tongji + '@vuepress-plume/vuepress-plugin-blog-data': link:../plugin-blog-data + '@vuepress-plume/vuepress-plugin-caniuse': link:../plugin-caniuse + '@vuepress-plume/vuepress-plugin-copy-code': link:../plugin-copy-code + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/core': 2.0.0-beta.51 + '@vuepress/plugin-active-header-links': 2.0.0-beta.51 + '@vuepress/plugin-container': 2.0.0-beta.51 + '@vuepress/plugin-docsearch': 2.0.0-beta.51 + '@vuepress/plugin-external-link-icon': 2.0.0-beta.51 + '@vuepress/plugin-git': 2.0.0-beta.51 + '@vuepress/plugin-medium-zoom': 2.0.0-beta.51 + '@vuepress/plugin-nprogress': 2.0.0-beta.51 + '@vuepress/plugin-palette': 2.0.0-beta.51 + '@vuepress/plugin-prismjs': 2.0.0-beta.51 + '@vuepress/plugin-search': 2.0.0-beta.51 + '@vuepress/plugin-theme-data': 2.0.0-beta.51 + '@vuepress/plugin-toc': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + date-fns: 2.29.3 + nanoid: 4.0.0 + ts-debounce: 4.0.0 + vue: 3.2.41 + vue-router: 4.1.5_vue@3.2.41 + vuepress-plugin-comment2: 2.0.0-beta.110 + vuepress-plugin-md-enhance: 2.0.0-beta.110 + vuepress-plugin-seo2: 2.0.0-beta.110 + vuepress-plugin-sitemap2: 2.0.0-beta.110 + + packages/theme-back: specifiers: '@types/lodash.merge': ^4.6.7 '@vuepress-plume/vuepress-plugin-baidu-tongji': workspace:* @@ -2718,6 +2820,10 @@ packages: resolution: {integrity: sha512-OEgAMeQXvCoJ+1x8WyQuVZzFo0wcyCmUR3baRVLmKBo1LmYZWMlRiXlux5jd0fqVJu6PfDbOrZItVqUEzLobeQ==} dev: false + /@vue/devtools-api/6.4.5: + resolution: {integrity: sha512-JD5fcdIuFxU4fQyXUu3w2KpAJHzTVdN+p4iOX2lMWSHMOoQdMAcpFLZzm9Z/2nmsoZ1a96QEhZ26e50xLBsgOQ==} + dev: false + /@vue/reactivity-transform/3.2.41: resolution: {integrity: sha512-mK5+BNMsL4hHi+IR3Ft/ho6Za+L3FA5j8WvreJ7XzHrqkPq8jtF/SMo7tuc9gHjLDwKZX1nP1JQOKo9IEAn54A==} dependencies: @@ -2851,7 +2957,7 @@ packages: /@vuepress/client/2.0.0-beta.51: resolution: {integrity: sha512-5iQV765kwR6/eIZPMlV5O34DUvHCMjF7zpr91x5i8BEAg7A0jfHvdrwNavAKWiQEU77f4dIBXtWy6nwX+lgmbw==} dependencies: - '@vue/devtools-api': 6.2.1 + '@vue/devtools-api': 6.4.5 '@vuepress/shared': 2.0.0-beta.51 vue: 3.2.41 vue-router: 4.1.5_vue@3.2.41 @@ -14668,7 +14774,7 @@ packages: peerDependencies: vue: ^3.2.0 dependencies: - '@vue/devtools-api': 6.2.1 + '@vue/devtools-api': 6.4.5 vue: 3.2.41 dev: false @@ -14682,6 +14788,28 @@ packages: '@vue/shared': 3.2.41 dev: false + /vuepress-plugin-comment2/2.0.0-beta.110: + resolution: {integrity: sha512-P9WqGjoKfssFm1JodDahryzCPg94+9qamfrK2xnhe9X9uOaQsgtnH90eb6BsSXyu+apkTV8gPwEfrg3dbPhR4A==} + peerDependencies: + sass-loader: ^13.0.0 + peerDependenciesMeta: + sass-loader: + optional: true + dependencies: + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + '@waline/client': 2.13.0 + giscus: 1.2.0 + twikoo: 1.6.7 + vue: 3.2.41 + vue-router: 4.1.5_vue@3.2.41 + vuepress-plugin-sass-palette: 2.0.0-beta.110 + vuepress-shared: 2.0.0-beta.110 + transitivePeerDependencies: + - '@vue/composition-api' + - supports-color + dev: false + /vuepress-plugin-comment2/2.0.0-beta.110_sass-loader@13.1.0: resolution: {integrity: sha512-P9WqGjoKfssFm1JodDahryzCPg94+9qamfrK2xnhe9X9uOaQsgtnH90eb6BsSXyu+apkTV8gPwEfrg3dbPhR4A==} peerDependencies: @@ -14705,6 +14833,43 @@ packages: - supports-color dev: false + /vuepress-plugin-md-enhance/2.0.0-beta.110: + resolution: {integrity: sha512-e1AQQeyERo5SiZiEsPqtkjZ0e9Fy8kWdYx+VOUGUBoFGqIaokC/YWOtiUn4ItM+iC2l4e/VFbrJJjeye73UWHw==} + peerDependencies: + sass-loader: ^13.0.0 + peerDependenciesMeta: + sass-loader: + optional: true + dependencies: + '@babel/core': 7.18.10 + '@types/katex': 0.14.0 + '@types/markdown-it': 12.2.3 + '@types/mermaid': 9.1.0 + '@vue/repl': 1.3.2_vue@3.2.41 + '@vuepress/client': 2.0.0-beta.51 + '@vuepress/shared': 2.0.0-beta.51 + '@vuepress/utils': 2.0.0-beta.51 + '@vueuse/core': 9.3.0_vue@3.2.41 + balloon-css: 1.2.0 + chart.js: 3.9.1 + echarts: 5.4.0 + flowchart.js: 1.17.1 + juice: 8.1.0 + katex: 0.16.2 + markdown-it: 13.0.1 + mathjax-full: 3.2.2 + mermaid: 9.1.7 + reveal.js: 4.3.1 + vue: 3.2.41 + vue-router: 4.1.5_vue@3.2.41 + vuepress-plugin-sass-palette: 2.0.0-beta.110 + vuepress-shared: 2.0.0-beta.110 + transitivePeerDependencies: + - '@vue/composition-api' + - encoding + - supports-color + dev: false + /vuepress-plugin-md-enhance/2.0.0-beta.110_sass-loader@13.1.0: resolution: {integrity: sha512-e1AQQeyERo5SiZiEsPqtkjZ0e9Fy8kWdYx+VOUGUBoFGqIaokC/YWOtiUn4ItM+iC2l4e/VFbrJJjeye73UWHw==} peerDependencies: @@ -14743,6 +14908,22 @@ packages: - supports-color dev: false + /vuepress-plugin-sass-palette/2.0.0-beta.110: + resolution: {integrity: sha512-GKBdDQ4vo4NvUrf0+SKkcnUcAFZ9i0u4PGBpmsW+moVcSRZLHHS2uC+Am27X9r05em9XYmtd+0q62Zg1xXZznA==} + peerDependencies: + sass-loader: ^13.0.0 + peerDependenciesMeta: + sass-loader: + optional: true + dependencies: + '@vuepress/utils': 2.0.0-beta.51 + chokidar: 3.5.3 + sass: 1.55.0 + vuepress-shared: 2.0.0-beta.110 + transitivePeerDependencies: + - supports-color + dev: false + /vuepress-plugin-sass-palette/2.0.0-beta.110_sass-loader@13.1.0: resolution: {integrity: sha512-GKBdDQ4vo4NvUrf0+SKkcnUcAFZ9i0u4PGBpmsW+moVcSRZLHHS2uC+Am27X9r05em9XYmtd+0q62Zg1xXZznA==} peerDependencies: diff --git a/tsconfig.json b/tsconfig.json index b1cb9e06..ef8ff890 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,9 @@ "jsx": "preserve", "paths": { "@theme-plume/*": ["./packages/theme/src/client/components/*"], + "@internal/blogData": [ + "./packages/plugin-blog-data/src/client/blogPostData.d.ts" + ], "@internal/*": ["./docs/.vuepress/.temp/internal/*"], "@vuepress-plume/vuepress-*": ["./packages/*/src/node/index.ts"], "@vuepress-plume/vuepress-theme-plume": [