diff --git a/lerna.json b/lerna.json index 9861d41..2821146 100644 --- a/lerna.json +++ b/lerna.json @@ -2,7 +2,7 @@ "packages": [ "packages/*" ], - "version": "1.5.2", + "version": "1.5.3", "npmClient": "yarn", "useWorkspaces": true } diff --git a/packages/vuepress-theme-reco/components/Mode/modeOptions.js b/packages/vuepress-theme-reco/components/Mode/modeOptions.js index 03f4827..bb30b0f 100644 --- a/packages/vuepress-theme-reco/components/Mode/modeOptions.js +++ b/packages/vuepress-theme-reco/components/Mode/modeOptions.js @@ -31,8 +31,8 @@ const modeOptions = { '--default-color-2': 'rgba(0, 0, 0, .2)', '--default-color-1': 'rgba(0, 0, 0, .1)', '--background-color': '#181818', - '--box-shadow': '0 1px 6px 0 rgba(0, 0, 0, .9)', - '--box-shadow-hover': '0 2px 26px 0 rgba(0, 0, 0, .9)', + '--box-shadow': '0 1px 8px 0 rgba(0, 0, 0, .6)', + '--box-shadow-hover': '0 2px 16px 0 rgba(0, 0, 0, .7)', '--text-color': 'rgba(255, 255, 255, .8)', '--text-color-sub': '#8B8B8B', '--border-color': 'rgba(0, 0, 0, .3)', diff --git a/packages/vuepress-theme-reco/components/PersonalInfo.vue b/packages/vuepress-theme-reco/components/PersonalInfo.vue index 82b81ae..26b48d3 100644 --- a/packages/vuepress-theme-reco/components/PersonalInfo.vue +++ b/packages/vuepress-theme-reco/components/PersonalInfo.vue @@ -41,8 +41,8 @@ export default { .personal-img { display block margin 2rem auto 1rem - width 5rem - height 5rem + width 6rem + height 6rem border-radius 50% } .name { @@ -56,7 +56,7 @@ export default { width 80% > div { text-align center - flex auto + flex 0 0 50% &:first-child { border-right 1px solid #333 } diff --git a/packages/vuepress-theme-reco/components/Sidebar.vue b/packages/vuepress-theme-reco/components/Sidebar.vue index 2d8e6d4..a57b1c3 100644 --- a/packages/vuepress-theme-reco/components/Sidebar.vue +++ b/packages/vuepress-theme-reco/components/Sidebar.vue @@ -31,8 +31,9 @@ export default { padding 0 margin 0 list-style-type none - > li - background $accentColor + &.sidebar-links + > li + background $accentColor a display inline-block .nav-links diff --git a/packages/vuepress-theme-reco/components/SidebarGroup.vue b/packages/vuepress-theme-reco/components/SidebarGroup.vue index cbe9376..d82d809 100644 --- a/packages/vuepress-theme-reco/components/SidebarGroup.vue +++ b/packages/vuepress-theme-reco/components/SidebarGroup.vue @@ -114,7 +114,7 @@ export default { position absolute top 0 bottom 0 - right 0.5em + right 1em margin auto &.clickable &.active diff --git a/packages/vuepress-theme-reco/enhanceApp.js b/packages/vuepress-theme-reco/enhanceApp.js index c6a61c5..cd60d30 100644 --- a/packages/vuepress-theme-reco/enhanceApp.js +++ b/packages/vuepress-theme-reco/enhanceApp.js @@ -2,8 +2,23 @@ import postMixin from '@theme/mixins/posts' import localMixin from '@theme/mixins/locales' export default ({ - Vue + Vue, + siteData, + isServer }) => { Vue.mixin(postMixin) Vue.mixin(localMixin) + if (!isServer) { + _registerCodeThemeCss(siteData.themeConfig.codeTheme) + } +} + +function _registerCodeThemeCss (theme = 'tomorrow') { + const themeArr = ['tomorrow', 'funky', 'okaidia', 'solarizedlight', 'default'] + + const link = document.createElement('link') + link.rel = 'stylesheet' + link.href = `//prismjs.com/themes/prism${themeArr.indexOf(theme) > -1 ? `-${theme}` : ''}.css` + + document.head.append(link) } diff --git a/packages/vuepress-theme-reco/layouts/Category.vue b/packages/vuepress-theme-reco/layouts/Category.vue index 81a2ba9..74e825e 100644 --- a/packages/vuepress-theme-reco/layouts/Category.vue +++ b/packages/vuepress-theme-reco/layouts/Category.vue @@ -45,10 +45,9 @@ import pagination from '@theme/mixins/pagination' import { sortPostsByStickyAndDate, filterPosts } from '@theme/helpers/postData' import { getOneColor } from '@theme/helpers/other' import moduleTransitonMixin from '@theme/mixins/moduleTransiton' -import codeTheme from '@theme/mixins/codeTheme' export default { - mixins: [pagination, moduleTransitonMixin, codeTheme], + mixins: [pagination, moduleTransitonMixin], components: { Common, NoteAbstract, ModuleTransition }, data () { diff --git a/packages/vuepress-theme-reco/layouts/Layout.vue b/packages/vuepress-theme-reco/layouts/Layout.vue index e8a9c4d..95b1f0d 100644 --- a/packages/vuepress-theme-reco/layouts/Layout.vue +++ b/packages/vuepress-theme-reco/layouts/Layout.vue @@ -13,11 +13,9 @@ import Page from '@theme/components/Page' import Footer from '@theme/components/Footer' import Common from '@theme/components/Common' import { resolveSidebarItems } from '@theme/helpers/utils' -import codeTheme from '@theme/mixins/codeTheme' export default { components: { HomeBlog, Home, Page, Common, Footer }, - mixins: [codeTheme], computed: { sidebarItems () { return resolveSidebarItems( diff --git a/packages/vuepress-theme-reco/layouts/Tag.vue b/packages/vuepress-theme-reco/layouts/Tag.vue index 7e14fea..90f1c58 100644 --- a/packages/vuepress-theme-reco/layouts/Tag.vue +++ b/packages/vuepress-theme-reco/layouts/Tag.vue @@ -39,10 +39,9 @@ import pagination from '@theme/mixins/pagination' import ModuleTransition from '@theme/components/ModuleTransition' import { sortPostsByStickyAndDate, filterPosts } from '@theme/helpers/postData' import moduleTransitonMixin from '@theme/mixins/moduleTransiton' -import codeTheme from '@theme/mixins/codeTheme' export default { - mixins: [pagination, moduleTransitonMixin, codeTheme], + mixins: [pagination, moduleTransitonMixin], components: { Common, NoteAbstract, TagList, ModuleTransition }, data () { diff --git a/packages/vuepress-theme-reco/mixins/codeTheme.js b/packages/vuepress-theme-reco/mixins/codeTheme.js deleted file mode 100644 index 2e40963..0000000 --- a/packages/vuepress-theme-reco/mixins/codeTheme.js +++ /dev/null @@ -1,31 +0,0 @@ -export default { - created () { - const { codeTheme = 'tomorrow' } = this.$themeConfig - switch (codeTheme) { - case 'coy': - import('prismjs/themes/prism-coy.css') - break - case 'dark': - import('prismjs/themes/prism-dark.css') - break - case 'funky': - import('prismjs/themes/prism-funky.css') - break - case 'okaidia': - import('prismjs/themes/prism-okaidia.css') - break - case 'solarizedlight': - import('prismjs/themes/prism-solarizedlight.css') - break - case 'tomorrow': - import('prismjs/themes/prism-tomorrow.css') - break - case 'twilight': - import('prismjs/themes/prism-twilight.css') - break - default: - import('prismjs/themes/prism.css') - break - } - } -} diff --git a/packages/vuepress-theme-reco/package.json b/packages/vuepress-theme-reco/package.json index 295031b..a7ec03c 100644 --- a/packages/vuepress-theme-reco/package.json +++ b/packages/vuepress-theme-reco/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-theme-reco", - "version": "1.5.2", + "version": "1.5.3", "description": "A simple and beautiful vuepress Blog & Doc theme.", "keywords": [ "vuepress", diff --git a/packages/vuepress-theme-reco/styles/code.styl b/packages/vuepress-theme-reco/styles/code.styl index d647120..b8551c3 100644 --- a/packages/vuepress-theme-reco/styles/code.styl +++ b/packages/vuepress-theme-reco/styles/code.styl @@ -1,135 +1,135 @@ -//.content__default -// code -// color lighten($textColor, 20%) -// padding 0.25rem 0.5rem -// margin 0 -// font-size 0.85em -// background-color var(--code-color) -// border-radius 3px -// .token -// &.deleted -// color #EC5975 -// &.inserted -// color $accentColor -// -//.content__default -// pre, pre[class*="language-"] -// line-height 1.4 -// padding 1.25rem 1.5rem -// margin 0.85rem 0 -// background-color $codeBgColor -// border-radius 6px -// overflow auto -// code -// color #fff -// padding 0 -// background-color transparent -// border-radius 0 -// -//div[class*="language-"] -// position relative -// background-color $codeBgColor -// border-radius 6px -// .highlight-lines -// user-select none -// padding-top 1.3rem -// position absolute -// top 0 -// left 0 -// width 100% -// line-height 1.4 -// .highlighted -// background-color rgba(0, 0, 0, 66%) -// pre, pre[class*="language-"] -// background transparent -// position relative -// z-index 1 -// &::before -// position absolute -// z-index 3 -// top 0.8em -// right 1em -// font-size 0.75rem -// color rgba(255, 255, 255, 0.4) -// &:not(.line-numbers-mode) -// .line-numbers-wrapper -// display none -// &.line-numbers-mode -// .highlight-lines .highlighted -// position relative -// &:before -// content ' ' -// position absolute -// z-index 3 -// left 0 -// top 0 -// display block -// width $lineNumbersWrapperWidth -// height 100% -// background-color rgba(0, 0, 0, 66%) -// pre -// padding-left $lineNumbersWrapperWidth + 1 rem -// vertical-align middle -// .line-numbers-wrapper -// position absolute -// top 0 -// width $lineNumbersWrapperWidth -// text-align center -// color rgba(255, 255, 255, 0.3) -// padding 1.25rem 0 -// line-height 1.4 -// br -// user-select none -// .line-number -// position relative -// z-index 4 -// user-select none -// font-size 0.85em -// &::after -// content '' -// position absolute -// z-index 2 -// top 0 -// left 0 -// width $lineNumbersWrapperWidth -// height 100% -// border-radius 6px 0 0 6px -// border-right 1px solid rgba(0, 0, 0, 66%) -// background-color $codeBgColor -// -// -//for lang in $codeLang -// div{'[class~="language-' + lang + '"]'} -// &:before -// content ('' + lang) -// -//div[class~="language-javascript"] -// &:before -// content "js" -// -//div[class~="language-typescript"] -// &:before -// content "ts" -// -//div[class~="language-markup"] -// &:before -// content "html" -// -//div[class~="language-markdown"] -// &:before -// content "md" -// -//div[class~="language-json"]:before -// content "json" -// -//div[class~="language-ruby"]:before -// content "rb" -// -//div[class~="language-python"]:before -// content "py" -// -//div[class~="language-bash"]:before -// content "sh" -// -//div[class~="language-php"]:before -// content "php" +.content__default + code + color lighten($textColor, 20%) + padding 0.25rem 0.5rem + margin 0 + font-size 0.85em + background-color var(--code-color) + border-radius 3px + .token + &.deleted + color #EC5975 + &.inserted + color $accentColor + +.content__default + pre, pre[class*="language-"] + line-height 1.4 + padding 1.25rem 1.5rem + margin 0.85rem 0 + background-color $codeBgColor + border-radius 6px + overflow auto + code + color #fff + padding 0 + background-color transparent + border-radius 0 + +div[class*="language-"] + position relative + background-color $codeBgColor + border-radius 6px + .highlight-lines + user-select none + padding-top 1.3rem + position absolute + top 0 + left 0 + width 100% + line-height 1.4 + .highlighted + background-color rgba(0, 0, 0, 66%) + pre, pre[class*="language-"] + background transparent + position relative + z-index 1 + &::before + position absolute + z-index 3 + top 0.8em + right 1em + font-size 0.75rem + color rgba(255, 255, 255, 0.4) + &:not(.line-numbers-mode) + .line-numbers-wrapper + display none + &.line-numbers-mode + .highlight-lines .highlighted + position relative + &:before + content ' ' + position absolute + z-index 3 + left 0 + top 0 + display block + width $lineNumbersWrapperWidth + height 100% + background-color rgba(0, 0, 0, 66%) + pre + padding-left $lineNumbersWrapperWidth + 1 rem + vertical-align middle + .line-numbers-wrapper + position absolute + top 0 + width $lineNumbersWrapperWidth + text-align center + color rgba(255, 255, 255, 0.3) + padding 1.25rem 0 + line-height 1.4 + br + user-select none + .line-number + position relative + z-index 4 + user-select none + font-size 0.85em + &::after + content '' + position absolute + z-index 2 + top 0 + left 0 + width $lineNumbersWrapperWidth + height 100% + border-radius 6px 0 0 6px + border-right 1px solid rgba(0, 0, 0, 66%) + background-color $codeBgColor + + +for lang in $codeLang + div{'[class~="language-' + lang + '"]'} + &:before + content ('' + lang) + +div[class~="language-javascript"] + &:before + content "js" + +div[class~="language-typescript"] + &:before + content "ts" + +div[class~="language-markup"] + &:before + content "html" + +div[class~="language-markdown"] + &:before + content "md" + +div[class~="language-json"]:before + content "json" + +div[class~="language-ruby"]:before + content "rb" + +div[class~="language-python"]:before + content "py" + +div[class~="language-bash"]:before + content "sh" + +div[class~="language-php"]:before + content "php" diff --git a/packages/vuepress-theme-reco/styles/palette.styl b/packages/vuepress-theme-reco/styles/palette.styl index 779aea7..21b758e 100644 --- a/packages/vuepress-theme-reco/styles/palette.styl +++ b/packages/vuepress-theme-reco/styles/palette.styl @@ -28,9 +28,9 @@ $backgroundColor ?= #fff $backgroundColorDark ?= #181818 $boxShadow = 0 1px 8px 0 $darkColor1 -$boxShadowHover = 0 2px 16px 0 $darkColor1 -$boxShadowDark = 0 1px 6px 0 $darkColor6 -$boxShadowHoverDark = 0 2px 16px 0 $darkColor6 +$boxShadowHover = 0 2px 16px 0 $darkColor2 +$boxShadowDark = 0 1px 8px 0 $darkColor6 +$boxShadowHoverDark = 0 2px 16px 0 $darkColor7 $textColor ?= #242424 $textColorDark ?= $lightColor8