From 65de175195e2317fa2f0a3838c27605c0b9100d3 Mon Sep 17 00:00:00 2001 From: layyback <18511759309@163.com> Date: Wed, 2 Mar 2022 18:39:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=88=9B=E5=BB=BAgitcode=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.js | 2 + docs/.vuepress/themes/theme-gitcode/LICENSE | 21 ++ docs/.vuepress/themes/theme-gitcode/README.md | 11 + .../components/AlgoliaSearchBox.vue | 172 ++++++++++++ .../theme-gitcode/components/DropdownLink.vue | 252 ++++++++++++++++++ .../components/DropdownTransition.vue | 33 +++ .../themes/theme-gitcode/components/Home.vue | 181 +++++++++++++ .../theme-gitcode/components/NavLink.vue | 90 +++++++ .../theme-gitcode/components/NavLinks.vue | 156 +++++++++++ .../theme-gitcode/components/Navbar.vue | 140 ++++++++++ .../themes/theme-gitcode/components/Page.vue | 31 +++ .../theme-gitcode/components/PageEdit.vue | 167 ++++++++++++ .../theme-gitcode/components/PageNav.vue | 163 +++++++++++ .../theme-gitcode/components/Sidebar.vue | 64 +++++ .../components/SidebarButton.vue | 40 +++ .../theme-gitcode/components/SidebarGroup.vue | 141 ++++++++++ .../theme-gitcode/components/SidebarLink.vue | 133 +++++++++ .../theme-gitcode/components/SidebarLinks.vue | 106 ++++++++ .../theme-gitcode/global-components/Badge.vue | 44 +++ .../global-components/CodeBlock.vue | 41 +++ .../global-components/CodeGroup.vue | 120 +++++++++ docs/.vuepress/themes/theme-gitcode/index.js | 61 +++++ .../themes/theme-gitcode/layouts/404.vue | 30 +++ .../themes/theme-gitcode/layouts/Layout.vue | 151 +++++++++++ .../themes/theme-gitcode/noopModule.js | 1 + .../themes/theme-gitcode/package.json | 45 ++++ .../themes/theme-gitcode/styles/arrow.styl | 22 ++ .../themes/theme-gitcode/styles/code.styl | 137 ++++++++++ .../themes/theme-gitcode/styles/config.styl | 1 + .../theme-gitcode/styles/custom-blocks.styl | 44 +++ .../themes/theme-gitcode/styles/index.styl | 202 ++++++++++++++ .../themes/theme-gitcode/styles/mobile.styl | 37 +++ .../themes/theme-gitcode/styles/toc.styl | 3 + .../themes/theme-gitcode/styles/wrapper.styl | 9 + .../themes/theme-gitcode/util/index.js | 244 +++++++++++++++++ 35 files changed, 3095 insertions(+) create mode 100644 docs/.vuepress/themes/theme-gitcode/LICENSE create mode 100644 docs/.vuepress/themes/theme-gitcode/README.md create mode 100644 docs/.vuepress/themes/theme-gitcode/components/AlgoliaSearchBox.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/DropdownLink.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/DropdownTransition.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/Home.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/NavLink.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/NavLinks.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/Navbar.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/Page.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/PageEdit.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/PageNav.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/Sidebar.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/SidebarButton.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/SidebarGroup.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/SidebarLink.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/components/SidebarLinks.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/global-components/Badge.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/global-components/CodeBlock.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/global-components/CodeGroup.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/index.js create mode 100644 docs/.vuepress/themes/theme-gitcode/layouts/404.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/layouts/Layout.vue create mode 100644 docs/.vuepress/themes/theme-gitcode/noopModule.js create mode 100644 docs/.vuepress/themes/theme-gitcode/package.json create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/arrow.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/code.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/config.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/custom-blocks.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/index.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/mobile.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/toc.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/styles/wrapper.styl create mode 100644 docs/.vuepress/themes/theme-gitcode/util/index.js diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index ec21a40..c604da7 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,4 +1,5 @@ // .vuepress/config.js +const path = require('path'); const autometa_options = { site: { name: 'Spring 中文文档社区' @@ -76,6 +77,7 @@ module.exports = { plugins: [ ['autometa', autometa_options] ], + theme: path.resolve(__dirname,'./themes/theme-gitcode/index.js'), themeConfig: { repo: "https://gitcode.net/dev-cloud/spring", repoLabel: "GitCode", diff --git a/docs/.vuepress/themes/theme-gitcode/LICENSE b/docs/.vuepress/themes/theme-gitcode/LICENSE new file mode 100644 index 0000000..15f1f7e --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018-present, Yuxi (Evan) You + +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/docs/.vuepress/themes/theme-gitcode/README.md b/docs/.vuepress/themes/theme-gitcode/README.md new file mode 100644 index 0000000..fc49626 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/README.md @@ -0,0 +1,11 @@ +# @vuepress/theme-default + +> theme-default for VuePress + +## Plugins + +The default theme has the following plugin built in: + +- [@vuepress/plugin-active-header-links](https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/plugin-active-header-links) +- [@vuepress/plugin-google-analytics](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-google-analytics) +- [@vuepress/plugin-search](https://github.com/vuejs/vuepress/tree/master/packages/%40vuepress/plugin-search) diff --git a/docs/.vuepress/themes/theme-gitcode/components/AlgoliaSearchBox.vue b/docs/.vuepress/themes/theme-gitcode/components/AlgoliaSearchBox.vue new file mode 100644 index 0000000..7071fb8 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/AlgoliaSearchBox.vue @@ -0,0 +1,172 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/DropdownLink.vue b/docs/.vuepress/themes/theme-gitcode/components/DropdownLink.vue new file mode 100644 index 0000000..be6563f --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/DropdownLink.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/DropdownTransition.vue b/docs/.vuepress/themes/theme-gitcode/components/DropdownTransition.vue new file mode 100644 index 0000000..eeaf12b --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/DropdownTransition.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/Home.vue b/docs/.vuepress/themes/theme-gitcode/components/Home.vue new file mode 100644 index 0000000..a7d26ac --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/Home.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/NavLink.vue b/docs/.vuepress/themes/theme-gitcode/components/NavLink.vue new file mode 100644 index 0000000..f7e65a4 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/NavLink.vue @@ -0,0 +1,90 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/NavLinks.vue b/docs/.vuepress/themes/theme-gitcode/components/NavLinks.vue new file mode 100644 index 0000000..2656ae2 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/NavLinks.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/Navbar.vue b/docs/.vuepress/themes/theme-gitcode/components/Navbar.vue new file mode 100644 index 0000000..f8dd49c --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/Navbar.vue @@ -0,0 +1,140 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/Page.vue b/docs/.vuepress/themes/theme-gitcode/components/Page.vue new file mode 100644 index 0000000..04ec7cb --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/Page.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/PageEdit.vue b/docs/.vuepress/themes/theme-gitcode/components/PageEdit.vue new file mode 100644 index 0000000..076356c --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/PageEdit.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/PageNav.vue b/docs/.vuepress/themes/theme-gitcode/components/PageNav.vue new file mode 100644 index 0000000..4c19aae --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/PageNav.vue @@ -0,0 +1,163 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/Sidebar.vue b/docs/.vuepress/themes/theme-gitcode/components/Sidebar.vue new file mode 100644 index 0000000..e70e333 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/Sidebar.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/SidebarButton.vue b/docs/.vuepress/themes/theme-gitcode/components/SidebarButton.vue new file mode 100644 index 0000000..3f54afd --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/SidebarButton.vue @@ -0,0 +1,40 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/SidebarGroup.vue b/docs/.vuepress/themes/theme-gitcode/components/SidebarGroup.vue new file mode 100644 index 0000000..d7f1929 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/SidebarGroup.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/SidebarLink.vue b/docs/.vuepress/themes/theme-gitcode/components/SidebarLink.vue new file mode 100644 index 0000000..4cd7665 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/SidebarLink.vue @@ -0,0 +1,133 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/components/SidebarLinks.vue b/docs/.vuepress/themes/theme-gitcode/components/SidebarLinks.vue new file mode 100644 index 0000000..55e6288 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/components/SidebarLinks.vue @@ -0,0 +1,106 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/global-components/Badge.vue b/docs/.vuepress/themes/theme-gitcode/global-components/Badge.vue new file mode 100644 index 0000000..53951f9 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/global-components/Badge.vue @@ -0,0 +1,44 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/global-components/CodeBlock.vue b/docs/.vuepress/themes/theme-gitcode/global-components/CodeBlock.vue new file mode 100644 index 0000000..d59d85b --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/global-components/CodeBlock.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/global-components/CodeGroup.vue b/docs/.vuepress/themes/theme-gitcode/global-components/CodeGroup.vue new file mode 100644 index 0000000..ac6ec55 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/global-components/CodeGroup.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/docs/.vuepress/themes/theme-gitcode/index.js b/docs/.vuepress/themes/theme-gitcode/index.js new file mode 100644 index 0000000..d4388ab --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/index.js @@ -0,0 +1,61 @@ +const path = require('path') + +/** + * @type {import('@vuepress/types').Theme} + */ +module.exports = (options, ctx) => { + const { themeConfig, siteConfig } = ctx + + // resolve algolia + const isAlgoliaSearch = ( + themeConfig.algolia + || Object + .keys(siteConfig.locales && themeConfig.locales || {}) + .some(base => themeConfig.locales[base].algolia) + ) + + const enableSmoothScroll = themeConfig.smoothScroll === true + + return { + alias () { + return { + '@AlgoliaSearchBox': isAlgoliaSearch + ? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue') + : path.resolve(__dirname, 'noopModule.js') + } + }, + + plugins: [ + ['@vuepress/active-header-links', options.activeHeaderLinks], + '@vuepress/search', + '@vuepress/plugin-nprogress', + ['container', { + type: 'tip', + defaultTitle: { + '/': 'TIP', + '/zh/': '提示' + } + }], + ['container', { + type: 'warning', + defaultTitle: { + '/': 'WARNING', + '/zh/': '注意' + } + }], + ['container', { + type: 'danger', + defaultTitle: { + '/': 'DANGER', + '/zh/': '警告' + } + }], + ['container', { + type: 'details', + before: info => `
${info ? `${info}` : ''}\n`, + after: () => '
\n' + }], + ['smooth-scroll', enableSmoothScroll] + ] + } +} diff --git a/docs/.vuepress/themes/theme-gitcode/layouts/404.vue b/docs/.vuepress/themes/theme-gitcode/layouts/404.vue new file mode 100644 index 0000000..2cbfa0f --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/layouts/404.vue @@ -0,0 +1,30 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/layouts/Layout.vue b/docs/.vuepress/themes/theme-gitcode/layouts/Layout.vue new file mode 100644 index 0000000..3298070 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/layouts/Layout.vue @@ -0,0 +1,151 @@ + + + diff --git a/docs/.vuepress/themes/theme-gitcode/noopModule.js b/docs/.vuepress/themes/theme-gitcode/noopModule.js new file mode 100644 index 0000000..b1c6ea4 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/noopModule.js @@ -0,0 +1 @@ +export default {} diff --git a/docs/.vuepress/themes/theme-gitcode/package.json b/docs/.vuepress/themes/theme-gitcode/package.json new file mode 100644 index 0000000..fb3d03d --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/package.json @@ -0,0 +1,45 @@ +{ + "name": "@vuepress/theme-default", + "version": "1.9.7", + "description": "Default theme for VuePress", + "keywords": [ + "documentation", + "generator", + "vue", + "vuepress" + ], + "homepage": "https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/theme-default#readme", + "bugs": { + "url": "https://github.com/vuejs/vuepress/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vuejs/vuepress.git", + "directory": "packages/@vuepress/theme-default" + }, + "license": "MIT", + "author": "Evan You", + "maintainers": [ + { + "name": "ULIVZ", + "email": "chl814@foxmail.com" + } + ], + "main": "index.js", + "dependencies": { + "@vuepress/plugin-active-header-links": "1.9.7", + "@vuepress/plugin-nprogress": "1.9.7", + "@vuepress/plugin-search": "1.9.7", + "@vuepress/types": "1.9.7", + "docsearch.js": "^2.5.2", + "lodash": "^4.17.15", + "stylus": "^0.54.8", + "stylus-loader": "^3.0.2", + "vuepress-plugin-container": "^2.0.2", + "vuepress-plugin-smooth-scroll": "^0.0.3" + }, + "publishConfig": { + "access": "public" + }, + "gitHead": "2f2357acce09eab875325c05f26d6bd26d41a861" +} diff --git a/docs/.vuepress/themes/theme-gitcode/styles/arrow.styl b/docs/.vuepress/themes/theme-gitcode/styles/arrow.styl new file mode 100644 index 0000000..20bffc0 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/arrow.styl @@ -0,0 +1,22 @@ +@require './config' + +.arrow + display inline-block + width 0 + height 0 + &.up + border-left 4px solid transparent + border-right 4px solid transparent + border-bottom 6px solid $arrowBgColor + &.down + border-left 4px solid transparent + border-right 4px solid transparent + border-top 6px solid $arrowBgColor + &.right + border-top 4px solid transparent + border-bottom 4px solid transparent + border-left 6px solid $arrowBgColor + &.left + border-top 4px solid transparent + border-bottom 4px solid transparent + border-right 6px solid $arrowBgColor diff --git a/docs/.vuepress/themes/theme-gitcode/styles/code.styl b/docs/.vuepress/themes/theme-gitcode/styles/code.styl new file mode 100644 index 0000000..9d3aa9a --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/code.styl @@ -0,0 +1,137 @@ +{$contentClass} + code + color lighten($textColor, 20%) + padding 0.25rem 0.5rem + margin 0 + font-size 0.85em + background-color rgba(27,31,35,0.05) + border-radius 3px + .token + &.deleted + color #EC5975 + &.inserted + color $accentColor + +{$contentClass} + 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" + +@import '~prismjs/themes/prism-tomorrow.css' diff --git a/docs/.vuepress/themes/theme-gitcode/styles/config.styl b/docs/.vuepress/themes/theme-gitcode/styles/config.styl new file mode 100644 index 0000000..9e40321 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/config.styl @@ -0,0 +1 @@ +$contentClass = '.theme-default-content' diff --git a/docs/.vuepress/themes/theme-gitcode/styles/custom-blocks.styl b/docs/.vuepress/themes/theme-gitcode/styles/custom-blocks.styl new file mode 100644 index 0000000..5b86816 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/custom-blocks.styl @@ -0,0 +1,44 @@ +.custom-block + .custom-block-title + font-weight 600 + margin-bottom -0.4rem + &.tip, &.warning, &.danger + padding .1rem 1.5rem + border-left-width .5rem + border-left-style solid + margin 1rem 0 + &.tip + background-color #f3f5f7 + border-color #42b983 + &.warning + background-color rgba(255,229,100,.3) + border-color darken(#ffe564, 35%) + color darken(#ffe564, 70%) + .custom-block-title + color darken(#ffe564, 50%) + a + color $textColor + &.danger + background-color #ffe6e6 + border-color darken(red, 20%) + color darken(red, 70%) + .custom-block-title + color darken(red, 40%) + a + color $textColor + &.details + display block + position relative + border-radius 2px + margin 1.6em 0 + padding 1.6em + background-color #eee + h4 + margin-top 0 + figure, p + &:last-child + margin-bottom 0 + padding-bottom 0 + summary + outline none + cursor pointer diff --git a/docs/.vuepress/themes/theme-gitcode/styles/index.styl b/docs/.vuepress/themes/theme-gitcode/styles/index.styl new file mode 100644 index 0000000..1b34f60 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/index.styl @@ -0,0 +1,202 @@ +@require './config' +@require './code' +@require './custom-blocks' +@require './arrow' +@require './wrapper' +@require './toc' + +html, body + padding 0 + margin 0 + background-color #fff + +body + font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif + -webkit-font-smoothing antialiased + -moz-osx-font-smoothing grayscale + font-size 16px + color $textColor + +.page + padding-left $sidebarWidth + +.navbar + position fixed + z-index 20 + top 0 + left 0 + right 0 + height $navbarHeight + background-color #fff + box-sizing border-box + border-bottom 1px solid $borderColor + +.sidebar-mask + position fixed + z-index 9 + top 0 + left 0 + width 100vw + height 100vh + display none + +.sidebar + font-size 16px + background-color #fff + width $sidebarWidth + position fixed + z-index 10 + margin 0 + top $navbarHeight + left 0 + bottom 0 + box-sizing border-box + border-right 1px solid $borderColor + overflow-y auto + +{$contentClass}:not(.custom) + @extend $wrapper + > *:first-child + margin-top $navbarHeight + + a:hover + text-decoration underline + + p.demo + padding 1rem 1.5rem + border 1px solid #ddd + border-radius 4px + + img + max-width 100% + +{$contentClass}.custom + padding 0 + margin 0 + + img + max-width 100% + +a + font-weight 500 + color $accentColor + text-decoration none + +p a code + font-weight 400 + color $accentColor + +kbd + background #eee + border solid 0.15rem #ddd + border-bottom solid 0.25rem #ddd + border-radius 0.15rem + padding 0 0.15em + +blockquote + font-size 1rem + color #999; + border-left .2rem solid #dfe2e5 + margin 1rem 0 + padding .25rem 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 + + {$contentClass}:not(.custom) > & + margin-top (0.5rem - $navbarHeight) + padding-top ($navbarHeight + 1rem) + margin-bottom 0 + + &:first-child + margin-top -1.5rem + margin-bottom 1rem + + + p, + pre, + .custom-block + margin-top 2rem + + &:focus .header-anchor, + &:hover .header-anchor + opacity: 1 + +h1 + font-size 2.2rem + +h2 + font-size 1.65rem + padding-bottom .3rem + border-bottom 1px solid $borderColor + +h3 + font-size 1.35rem + +a.header-anchor + font-size 0.85em + float left + margin-left -0.87em + padding-right 0.23em + margin-top 0.125em + opacity 0 + + &:focus, + &:hover + text-decoration none + +code, kbd, .line-number + font-family source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace + +p, ul, ol + line-height 1.7 + +hr + border 0 + border-top 1px solid $borderColor + +table + border-collapse collapse + margin 1rem 0 + display: block + overflow-x: auto + +tr + border-top 1px solid #dfe2e5 + + &:nth-child(2n) + background-color #f6f8fa + +th, td + border 1px solid #dfe2e5 + padding .6em 1em + +.theme-container + &.sidebar-open + .sidebar-mask + display: block + + &.no-navbar + {$contentClass}:not(.custom) > h1, h2, h3, h4, h5, h6 + margin-top 1.5rem + padding-top 0 + + .sidebar + top 0 + +@media (min-width: ($MQMobile + 1px)) + .theme-container.no-sidebar + .sidebar + display none + + .page + padding-left 0 + +@require 'mobile.styl' diff --git a/docs/.vuepress/themes/theme-gitcode/styles/mobile.styl b/docs/.vuepress/themes/theme-gitcode/styles/mobile.styl new file mode 100644 index 0000000..f5bd327 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/mobile.styl @@ -0,0 +1,37 @@ +@require './config' + +$mobileSidebarWidth = $sidebarWidth * 0.82 + +// narrow desktop / iPad +@media (max-width: $MQNarrow) + .sidebar + font-size 15px + width $mobileSidebarWidth + .page + padding-left $mobileSidebarWidth + +// wide mobile +@media (max-width: $MQMobile) + .sidebar + top 0 + padding-top $navbarHeight + transform translateX(-100%) + transition transform .2s ease + .page + padding-left 0 + .theme-container + &.sidebar-open + .sidebar + transform translateX(0) + &.no-navbar + .sidebar + padding-top: 0 + +// narrow mobile +@media (max-width: $MQMobileNarrow) + h1 + font-size 1.9rem + {$contentClass} + div[class*="language-"] + margin 0.85rem -1.5rem + border-radius 0 diff --git a/docs/.vuepress/themes/theme-gitcode/styles/toc.styl b/docs/.vuepress/themes/theme-gitcode/styles/toc.styl new file mode 100644 index 0000000..d3e7106 --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/toc.styl @@ -0,0 +1,3 @@ +.table-of-contents + .badge + vertical-align middle diff --git a/docs/.vuepress/themes/theme-gitcode/styles/wrapper.styl b/docs/.vuepress/themes/theme-gitcode/styles/wrapper.styl new file mode 100644 index 0000000..a99262c --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/styles/wrapper.styl @@ -0,0 +1,9 @@ +$wrapper + max-width $contentWidth + margin 0 auto + padding 2rem 2.5rem + @media (max-width: $MQNarrow) + padding 2rem + @media (max-width: $MQMobileNarrow) + padding 1.5rem + diff --git a/docs/.vuepress/themes/theme-gitcode/util/index.js b/docs/.vuepress/themes/theme-gitcode/util/index.js new file mode 100644 index 0000000..92fcd3b --- /dev/null +++ b/docs/.vuepress/themes/theme-gitcode/util/index.js @@ -0,0 +1,244 @@ +export const hashRE = /#.*$/ +export const extRE = /\.(md|html)$/ +export const endingSlashRE = /\/$/ +export const outboundRE = /^[a-z]+:/i + +export function normalize (path) { + return decodeURI(path) + .replace(hashRE, '') + .replace(extRE, '') +} + +export function getHash (path) { + const match = path.match(hashRE) + if (match) { + return match[0] + } +} + +export function isExternal (path) { + return outboundRE.test(path) +} + +export function isMailto (path) { + return /^mailto:/.test(path) +} + +export function isTel (path) { + return /^tel:/.test(path) +} + +export function ensureExt (path) { + if (isExternal(path)) { + return path + } + const hashMatch = path.match(hashRE) + const hash = hashMatch ? hashMatch[0] : '' + const normalized = normalize(path) + + if (endingSlashRE.test(normalized)) { + return path + } + return normalized + '.html' + hash +} + +export function isActive (route, path) { + const routeHash = decodeURIComponent(route.hash) + const linkHash = getHash(path) + if (linkHash && routeHash !== linkHash) { + return false + } + const routePath = normalize(route.path) + const pagePath = normalize(path) + return routePath === pagePath +} + +export function resolvePage (pages, rawPath, base) { + if (isExternal(rawPath)) { + return { + type: 'external', + path: rawPath + } + } + if (base) { + rawPath = resolvePath(rawPath, base) + } + const path = normalize(rawPath) + for (let i = 0; i < pages.length; i++) { + if (normalize(pages[i].regularPath) === path) { + return Object.assign({}, pages[i], { + type: 'page', + path: ensureExt(pages[i].path) + }) + } + } + console.error(`[vuepress] No matching page found for sidebar item "${rawPath}"`) + return {} +} + +function resolvePath (relative, base, append) { + const firstChar = relative.charAt(0) + if (firstChar === '/') { + return relative + } + + if (firstChar === '?' || firstChar === '#') { + return base + relative + } + + const stack = base.split('/') + + // remove trailing segment if: + // - not appending + // - appending to trailing slash (last segment is empty) + if (!append || !stack[stack.length - 1]) { + stack.pop() + } + + // resolve relative path + const segments = relative.replace(/^\//, '').split('/') + for (let i = 0; i < segments.length; i++) { + const segment = segments[i] + if (segment === '..') { + stack.pop() + } else if (segment !== '.') { + stack.push(segment) + } + } + + // ensure leading slash + if (stack[0] !== '') { + stack.unshift('') + } + + return stack.join('/') +} + +/** + * @param { Page } page + * @param { string } regularPath + * @param { SiteData } site + * @param { string } localePath + * @returns { SidebarGroup } + */ +export function resolveSidebarItems (page, regularPath, site, localePath) { + const { pages, themeConfig } = site + + const localeConfig = localePath && themeConfig.locales + ? themeConfig.locales[localePath] || themeConfig + : themeConfig + + const pageSidebarConfig = page.frontmatter.sidebar || localeConfig.sidebar || themeConfig.sidebar + if (pageSidebarConfig === 'auto') { + return resolveHeaders(page) + } + + const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar + if (!sidebarConfig) { + return [] + } else { + const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig) + if (config === 'auto') { + return resolveHeaders(page) + } + return config + ? config.map(item => resolveItem(item, pages, base)) + : [] + } +} + +/** + * @param { Page } page + * @returns { SidebarGroup } + */ +function resolveHeaders (page) { + const headers = groupHeaders(page.headers || []) + return [{ + type: 'group', + collapsable: false, + title: page.title, + path: null, + children: headers.map(h => ({ + type: 'auto', + title: h.title, + basePath: page.path, + path: page.path + '#' + h.slug, + children: h.children || [] + })) + }] +} + +export function groupHeaders (headers) { + // group h3s under h2 + headers = headers.map(h => Object.assign({}, h)) + let lastH2 + headers.forEach(h => { + if (h.level === 2) { + lastH2 = h + } else if (lastH2) { + (lastH2.children || (lastH2.children = [])).push(h) + } + }) + return headers.filter(h => h.level === 2) +} + +export function resolveNavLinkItem (linkItem) { + return Object.assign(linkItem, { + type: linkItem.items && linkItem.items.length ? 'links' : 'link' + }) +} + +/** + * @param { Route } route + * @param { Array | Array | [link: string]: SidebarConfig } config + * @returns { base: string, config: SidebarConfig } + */ +export function resolveMatchingConfig (regularPath, config) { + if (Array.isArray(config)) { + return { + base: '/', + config: config + } + } + for (const base in config) { + if (ensureEndingSlash(regularPath).indexOf(encodeURI(base)) === 0) { + return { + base, + config: config[base] + } + } + } + return {} +} + +function ensureEndingSlash (path) { + return /(\.html|\/)$/.test(path) + ? path + : path + '/' +} + +function resolveItem (item, pages, base, groupDepth = 1) { + if (typeof item === 'string') { + return resolvePage(pages, item, base) + } else if (Array.isArray(item)) { + return Object.assign(resolvePage(pages, item[0], base), { + title: item[1] + }) + } else { + const children = item.children || [] + if (children.length === 0 && item.path) { + return Object.assign(resolvePage(pages, item.path, base), { + title: item.title + }) + } + return { + type: 'group', + path: item.path, + title: item.title, + sidebarDepth: item.sidebarDepth, + initialOpenGroupIndex: item.initialOpenGroupIndex, + children: children.map(child => resolveItem(child, pages, base, groupDepth + 1)), + collapsable: item.collapsable !== false + } + } +} -- GitLab