diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index a443cc29d..8e590fac8 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,18 +1,18 @@ // .vuepress/config.js module.exports = { - title: "Pomerium", + // title: "Pomerium", description: "Pomerium is a beyond-corp inspired, zero trust, open source identity-aware access proxy.", plugins: { sitemap: { - hostname: "https://www.pomerium.io" + hostname: "https://www.pomerium.io", }, "@vuepress/google-analytics": { - ga: "UA-129872447-2" - } + ga: "UA-129872447-2", + }, }, markdown: { - externalLinkSymbol: false + externalLinkSymbol: false, }, themeConfig: { logo: "/logo-long-civez.png", @@ -38,13 +38,13 @@ module.exports = { { text: "v0.4.x", link: "https://0-4-0.docs.pomerium.io/docs" }, { text: "v0.3.x", link: "https://0-3-0.docs.pomerium.io/docs" }, { text: "v0.2.x", link: "https://0-2-0.docs.pomerium.io/docs" }, - { text: "v0.1.x", link: "https://0-1-0.docs.pomerium.io/docs" } - ] - } + { text: "v0.1.x", link: "https://0-1-0.docs.pomerium.io/docs" }, + ], + }, ], algolia: { apiKey: "1653e881f3a6c17d3ad37f4d4c428e20", - indexName: "pomerium" + indexName: "pomerium", }, sidebar: { "/docs/": [ @@ -59,8 +59,8 @@ module.exports = { "releases", "upgrading", "CHANGELOG", - "FAQ" - ] + "FAQ", + ], }, { title: "Quick Start", @@ -74,8 +74,8 @@ module.exports = { "quick-start/helm", "quick-start/kubernetes", "quick-start/synology", - "quick-start/from-source" - ] + "quick-start/from-source", + ], }, { title: "Identity Providers", @@ -90,8 +90,8 @@ module.exports = { "identity-providers/gitlab", "identity-providers/google", "identity-providers/okta", - "identity-providers/one-login" - ] + "identity-providers/one-login", + ], }, { title: "Community", @@ -103,8 +103,8 @@ module.exports = { "community/", "community/contributing", "community/code-of-conduct", - "community/security" - ] + "community/security", + ], }, { title: "Reference", @@ -118,9 +118,9 @@ module.exports = { "reference/impersonation", "reference/programmatic-access", "reference/getting-users-identity", - "reference/production-deployment" - ] - } + "reference/production-deployment", + ], + }, ], "/recipes/": [ { @@ -129,8 +129,8 @@ module.exports = { collapsable: false, sidebarDepth: 1, - children: ["", "ad-guard", "vs-code-server", "kubernetes"] - } + children: ["", "ad-guard", "vs-code-server", "kubernetes"], + }, ], "/enterprise/": [ { @@ -138,8 +138,8 @@ module.exports = { type: "group", collapsable: false, sidebarDepth: 1, - children: [""] - } + children: [""], + }, ], "/configuration/": [ { @@ -147,9 +147,9 @@ module.exports = { type: "group", collapsable: false, sidebarDepth: 1, - children: ["", "examples"] - } - ] - } - } + children: ["", "examples"], + }, + ], + }, + }, }; diff --git a/docs/.vuepress/styles/palette.styl b/docs/.vuepress/styles/palette.styl new file mode 100644 index 000000000..4e060af11 --- /dev/null +++ b/docs/.vuepress/styles/palette.styl @@ -0,0 +1,74 @@ +// colors +$mainColor= #6E43E8 + + +$sidebarColor=#FAFAFC +$accentColor = #6E43E8 +$textColor =rgb(51, 51, 51) +$headerColor=rgb(17, 17, 17) +$borderColor = #e8e8fb +$codeBgColor = #282c34 +$arrowBgColor = #ccc +$section-color=#f7f7f7; +$fontSize = 16px + +// navbar +// $navbarHeight = 5.2rem +$navbar-vertical-padding = 1.4rem; +$navbar-horizontal-padding = 1.4rem; +$navbar-background = #6E43E8; +$navbar-text-color = #ffffff; + +$sidebarWidth = 16rem +$contentWidth = 960px + +// // responsive breakpoints +$MQNarrow = 959px +$MQMobile = 719px +$MQMobileNarrow = 419px + +.icon.outbound + display none !important + +.navbar + background-color: $navbar-background !important + border-bottom 1px solid $navbar-background !important + .logo + height $navbarHeight - 3.2rem + min-width $navbarHeight - 3.2rem + margin-right 0.8rem + vertical-align top + .links + background-color: $navbar-background !important + color: $navbar-text-color !important + padding-left 0rem + +.nav-links + a + &:hover, &.router-link-active + color lighten($textColor, 8%) !important + +@media (min-width: $MQMobile) + .nav-links a + &:hover, &.router-link-active + color lighten($navbar-text-color, 8%) !important + .nav-item > a:not(.external) + &:hover, &.router-link-active + margin-bottom -2px + border-bottom 2px solid lighten($navbar-text-color, 8%) !important + + + +.dropdown-wrapper + .dropdown-title + color $navbar-text-color !important + +@media (max-width: $MQMobile) + .dropdown-wrapper + .dropdown-title + color $textColor !important + +@media (min-width: $MQMobile) + .dropdown-wrapper + .dropdown-title + color $navbar-text-color !important diff --git a/docs/.vuepress/theme/components/AlgoliaSearchBox.vue b/docs/.vuepress/theme/components/AlgoliaSearchBox.vue deleted file mode 100644 index ef26763fe..000000000 --- a/docs/.vuepress/theme/components/AlgoliaSearchBox.vue +++ /dev/null @@ -1,213 +0,0 @@ - - - - - \ No newline at end of file diff --git a/docs/.vuepress/theme/components/DropdownLink.vue b/docs/.vuepress/theme/components/DropdownLink.vue deleted file mode 100644 index 3ad8f1043..000000000 --- a/docs/.vuepress/theme/components/DropdownLink.vue +++ /dev/null @@ -1,208 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/DropdownTransition.vue b/docs/.vuepress/theme/components/DropdownTransition.vue deleted file mode 100644 index 8c711a155..000000000 --- a/docs/.vuepress/theme/components/DropdownTransition.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/Home.vue b/docs/.vuepress/theme/components/Home.vue index 139cfd950..b580cc4cf 100644 --- a/docs/.vuepress/theme/components/Home.vue +++ b/docs/.vuepress/theme/components/Home.vue @@ -109,7 +109,7 @@ diff --git a/docs/.vuepress/theme/components/NavLink.vue b/docs/.vuepress/theme/components/NavLink.vue deleted file mode 100644 index 033182291..000000000 --- a/docs/.vuepress/theme/components/NavLink.vue +++ /dev/null @@ -1,46 +0,0 @@ - - - diff --git a/docs/.vuepress/theme/components/NavLinks.vue b/docs/.vuepress/theme/components/NavLinks.vue deleted file mode 100644 index 2ab72c924..000000000 --- a/docs/.vuepress/theme/components/NavLinks.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/Navbar.vue b/docs/.vuepress/theme/components/Navbar.vue deleted file mode 100644 index f606d04ac..000000000 --- a/docs/.vuepress/theme/components/Navbar.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/Page.vue b/docs/.vuepress/theme/components/Page.vue deleted file mode 100644 index dc7f23fba..000000000 --- a/docs/.vuepress/theme/components/Page.vue +++ /dev/null @@ -1,241 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/Sidebar.vue b/docs/.vuepress/theme/components/Sidebar.vue deleted file mode 100644 index deed78c0e..000000000 --- a/docs/.vuepress/theme/components/Sidebar.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/SidebarButton.vue b/docs/.vuepress/theme/components/SidebarButton.vue deleted file mode 100644 index a43ad2172..000000000 --- a/docs/.vuepress/theme/components/SidebarButton.vue +++ /dev/null @@ -1,42 +0,0 @@ - - - diff --git a/docs/.vuepress/theme/components/SidebarGroup.vue b/docs/.vuepress/theme/components/SidebarGroup.vue deleted file mode 100644 index f38e734b6..000000000 --- a/docs/.vuepress/theme/components/SidebarGroup.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - - diff --git a/docs/.vuepress/theme/components/SidebarLink.vue b/docs/.vuepress/theme/components/SidebarLink.vue deleted file mode 100644 index ad28e5fd9..000000000 --- a/docs/.vuepress/theme/components/SidebarLink.vue +++ /dev/null @@ -1,153 +0,0 @@ - - - diff --git a/docs/.vuepress/theme/components/SidebarLinks.vue b/docs/.vuepress/theme/components/SidebarLinks.vue deleted file mode 100644 index f805aa771..000000000 --- a/docs/.vuepress/theme/components/SidebarLinks.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - diff --git a/docs/.vuepress/theme/global-components/Badge.vue b/docs/.vuepress/theme/global-components/Badge.vue deleted file mode 100644 index f56ae3eda..000000000 --- a/docs/.vuepress/theme/global-components/Badge.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - diff --git a/docs/.vuepress/theme/index.js b/docs/.vuepress/theme/index.js index bd1ad342d..b91b8a576 100644 --- a/docs/.vuepress/theme/index.js +++ b/docs/.vuepress/theme/index.js @@ -1,52 +1,3 @@ -const path = require("path"); - -// Theme API. -module.exports = (options, ctx) => ({ - alias() { - const { themeConfig, siteConfig } = ctx; - // resolve algolia - const isAlgoliaSearch = - themeConfig.algolia || - Object.keys((siteConfig.locales && themeConfig.locales) || {}).some( - base => themeConfig.locales[base].algolia - ); - 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: { - "/zh/": "提示" - } - } - ], - [ - "container", - { - type: "warning", - defaultTitle: { - "/zh/": "注意" - } - } - ], - [ - "container", - { - type: "danger", - defaultTitle: { - "/zh/": "警告" - } - } - ] - ] -}); +module.exports = { + extend: '@vuepress/theme-default' +} diff --git a/docs/.vuepress/theme/layouts/404.vue b/docs/.vuepress/theme/layouts/404.vue deleted file mode 100644 index b91e468d9..000000000 --- a/docs/.vuepress/theme/layouts/404.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - \ No newline at end of file diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index 49530c982..12af2c5db 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -15,7 +15,6 @@ - @@ -25,9 +24,9 @@ diff --git a/docs/.vuepress/theme/noopModule.js b/docs/.vuepress/theme/noopModule.js deleted file mode 100644 index b1c6ea436..000000000 --- a/docs/.vuepress/theme/noopModule.js +++ /dev/null @@ -1 +0,0 @@ -export default {} diff --git a/docs/.vuepress/theme/package.json b/docs/.vuepress/theme/package.json deleted file mode 100644 index 6a79dd95e..000000000 --- a/docs/.vuepress/theme/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@vuepress/theme-default", - "version": "1.0.2", - "description": "Default theme for VuePress", - "main": "index.js", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/vuejs/vuepress.git", - "directory": "packages/@vuepress/theme-default" - }, - "keywords": [ - "documentation", - "vue", - "vuepress", - "generator" - ], - "author": "Evan You", - "maintainers": [ - { - "name": "ULIVZ", - "email": "chl814@foxmail.com" - } - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/vuejs/vuepress/issues" - }, - "homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/theme-default#readme", - "dependencies": { - "@vuepress/plugin-active-header-links": "^1.0.2", - "@vuepress/plugin-nprogress": "^1.0.2", - "@vuepress/plugin-search": "^1.0.2", - "docsearch.js": "^2.5.2", - "stylus": "^0.54.5", - "stylus-loader": "^3.0.2", - "vuepress-plugin-container": "^2.0.0" - } -} diff --git a/docs/.vuepress/theme/styles/arrow.styl b/docs/.vuepress/theme/styles/arrow.styl deleted file mode 100644 index 20bffc0dc..000000000 --- a/docs/.vuepress/theme/styles/arrow.styl +++ /dev/null @@ -1,22 +0,0 @@ -@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/theme/styles/code.styl b/docs/.vuepress/theme/styles/code.styl deleted file mode 100644 index 31aa97ddb..000000000 --- a/docs/.vuepress/theme/styles/code.styl +++ /dev/null @@ -1,140 +0,0 @@ -{$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-sh"]:before - content "sh" - -div[class~="language-php"]:before - content "php" - -@import '~prismjs/themes/prism-tomorrow.css' diff --git a/docs/.vuepress/theme/styles/config.styl b/docs/.vuepress/theme/styles/config.styl deleted file mode 100644 index 9e403210f..000000000 --- a/docs/.vuepress/theme/styles/config.styl +++ /dev/null @@ -1 +0,0 @@ -$contentClass = '.theme-default-content' diff --git a/docs/.vuepress/theme/styles/custom-blocks.styl b/docs/.vuepress/theme/styles/custom-blocks.styl deleted file mode 100644 index 276b9bbdb..000000000 --- a/docs/.vuepress/theme/styles/custom-blocks.styl +++ /dev/null @@ -1,31 +0,0 @@ -.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 - - - \ No newline at end of file diff --git a/docs/.vuepress/theme/styles/index.styl b/docs/.vuepress/theme/styles/index.styl deleted file mode 100644 index 2ffb25bd5..000000000 --- a/docs/.vuepress/theme/styles/index.styl +++ /dev/null @@ -1,203 +0,0 @@ -@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 $fontSize - color $textColor - -.page - padding-left $sidebarWidth - -.navbar - position fixed - z-index 20 - top 0 - left 0 - right 0 - height $navbarHeight - background-color $navbar-background - box-sizing border-box - border-bottom 1px solid $accentColor - -.sidebar-mask - position fixed - z-index 9 - top 0 - left 0 - width 100vw - height 100vh - display none - -.sidebar - font-size 16px - background-color $sidebarColor - 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 - display: block; - margin: 0 auto; - max-width 92% - -{$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 - - &: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 - - &: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/theme/styles/mobile.styl b/docs/.vuepress/theme/styles/mobile.styl deleted file mode 100644 index f5bd32739..000000000 --- a/docs/.vuepress/theme/styles/mobile.styl +++ /dev/null @@ -1,37 +0,0 @@ -@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/theme/styles/palette.styl b/docs/.vuepress/theme/styles/palette.styl deleted file mode 100644 index b1bd6b726..000000000 --- a/docs/.vuepress/theme/styles/palette.styl +++ /dev/null @@ -1,32 +0,0 @@ -// colors -$mainColor= #6E43E8 - - -$sidebarColor=#FAFAFC -$accentColor = #6E43E8 -$textColor =rgb(51, 51, 51) -$headerColor=rgb(17, 17, 17) -$borderColor = #e8e8fb -$codeBgColor = #282c34 -$arrowBgColor = #ccc -$navbar-background = #6E43E8; -$navbar-text-color = #ffffff; -$section-color=#f7f7f7; -$fontSize = 16px - -// layout -$navbarHeight = 5.2rem -$navbar-vertical-padding = 1.4rem; -$navbar-horizontal-padding = 1.4rem; - -$sidebarWidth = 16rem -$contentWidth = 960px - -// // responsive breakpoints -$MQNarrow = 959px -$MQMobile = 719px -$MQMobileNarrow = 419px - -.icon.outbound - display none !important - \ No newline at end of file diff --git a/docs/.vuepress/theme/styles/toc.styl b/docs/.vuepress/theme/styles/toc.styl deleted file mode 100644 index d3e71069b..000000000 --- a/docs/.vuepress/theme/styles/toc.styl +++ /dev/null @@ -1,3 +0,0 @@ -.table-of-contents - .badge - vertical-align middle diff --git a/docs/.vuepress/theme/styles/wrapper.styl b/docs/.vuepress/theme/styles/wrapper.styl deleted file mode 100644 index a99262c71..000000000 --- a/docs/.vuepress/theme/styles/wrapper.styl +++ /dev/null @@ -1,9 +0,0 @@ -$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/theme/util/index.js b/docs/.vuepress/theme/util/index.js index fbf9a7d63..23e78f83c 100644 --- a/docs/.vuepress/theme/util/index.js +++ b/docs/.vuepress/theme/util/index.js @@ -1,119 +1,117 @@ -export const hashRE = /#.*$/; -export const extRE = /\.(md|html)$/; -export const endingSlashRE = /\/$/; -export const outboundRE = /^(https?:|mailto:|tel:|[a-zA-Z]{4,}:)/; +export const hashRE = /#.*$/ +export const extRE = /\.(md|html)$/ +export const endingSlashRE = /\/$/ +export const outboundRE = /^[a-z]+:/i -export function normalize(path) { +export function normalize (path) { return decodeURI(path) - .replace(hashRE, "") - .replace(extRE, ""); + .replace(hashRE, '') + .replace(extRE, '') } -export function getHash(path) { - const match = path.match(hashRE); +export function getHash (path) { + const match = path.match(hashRE) if (match) { - return match[0]; + return match[0] } } -export function isExternal(path) { - return outboundRE.test(path); +export function isExternal (path) { + return outboundRE.test(path) } -export function isMailto(path) { - return /^mailto:/.test(path); +export function isMailto (path) { + return /^mailto:/.test(path) } -export function isTel(path) { - return /^tel:/.test(path); +export function isTel (path) { + return /^tel:/.test(path) } -export function ensureExt(path) { +export function ensureExt (path) { if (isExternal(path)) { - return path; + return path } - const hashMatch = path.match(hashRE); - const hash = hashMatch ? hashMatch[0] : ""; - const normalized = normalize(path); + const hashMatch = path.match(hashRE) + const hash = hashMatch ? hashMatch[0] : '' + const normalized = normalize(path) if (endingSlashRE.test(normalized)) { - return path; + return path } - return normalized + ".html" + hash; + return normalized + '.html' + hash } -export function isActive(route, path) { - const routeHash = route.hash; - const linkHash = getHash(path); +export function isActive (route, path) { + const routeHash = decodeURIComponent(route.hash) + const linkHash = getHash(path) if (linkHash && routeHash !== linkHash) { - return false; + return false } - const routePath = normalize(route.path); - const pagePath = normalize(path); - return routePath === pagePath; + const routePath = normalize(route.path) + const pagePath = normalize(path) + return routePath === pagePath } -export function resolvePage(pages, rawPath, base) { +export function resolvePage (pages, rawPath, base) { if (isExternal(rawPath)) { return { - type: "external", + type: 'external', path: rawPath - }; + } } if (base) { - rawPath = resolvePath(rawPath, base); + rawPath = resolvePath(rawPath, base) } - const path = normalize(rawPath); + 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", + type: 'page', path: ensureExt(pages[i].path) - }); + }) } } - console.error( - `[vuepress] No matching page found for sidebar item "${rawPath}"` - ); - return {}; + 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; +function resolvePath (relative, base, append) { + const firstChar = relative.charAt(0) + if (firstChar === '/') { + return relative } - if (firstChar === "?" || firstChar === "#") { - return base + relative; + if (firstChar === '?' || firstChar === '#') { + return base + relative } - const stack = base.split("/"); + 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(); + stack.pop() } // resolve relative path - const segments = relative.replace(/^\//, "").split("/"); + 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); + const segment = segments[i] + if (segment === '..') { + stack.pop() + } else if (segment !== '.') { + stack.push(segment) } } // ensure leading slash - if (stack[0] !== "") { - stack.unshift(""); + if (stack[0] !== '') { + stack.unshift('') } - return stack.join("/"); + return stack.join('/') } /** @@ -123,26 +121,26 @@ function resolvePath(relative, base, append) { * @param { string } localePath * @returns { SidebarGroup } */ -export function resolveSidebarItems(page, regularPath, site, localePath) { - const { pages, themeConfig } = site; +export function resolveSidebarItems (page, regularPath, site, localePath) { + const { pages, themeConfig } = site - const localeConfig = - localePath && themeConfig.locales - ? themeConfig.locales[localePath] || themeConfig - : themeConfig; + 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 pageSidebarConfig = page.frontmatter.sidebar || localeConfig.sidebar || themeConfig.sidebar + if (pageSidebarConfig === 'auto') { + return resolveHeaders(page) } - const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar; + const sidebarConfig = localeConfig.sidebar || themeConfig.sidebar if (!sidebarConfig) { - return []; + return [] } else { - const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig); - return config ? config.map(item => resolveItem(item, pages, base)) : []; + const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig) + return config + ? config.map(item => resolveItem(item, pages, base)) + : [] } } @@ -150,43 +148,41 @@ export function resolveSidebarItems(page, regularPath, site, localePath) { * @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 || [] - })) - } - ]; +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) { +export function groupHeaders (headers) { // group h3s under h2 - headers = headers.map(h => Object.assign({}, h)); - let lastH2; + headers = headers.map(h => Object.assign({}, h)) + let lastH2 headers.forEach(h => { if (h.level === 2) { - lastH2 = h; + lastH2 = h } else if (lastH2) { - (lastH2.children || (lastH2.children = [])).push(h); + (lastH2.children || (lastH2.children = [])).push(h) } - }); - return headers.filter(h => h.level === 2); + }) + return headers.filter(h => h.level === 2) } -export function resolveNavLinkItem(linkItem) { +export function resolveNavLinkItem (linkItem) { return Object.assign(linkItem, { - type: linkItem.items && linkItem.items.length ? "links" : "link" - }); + type: linkItem.items && linkItem.items.length ? 'links' : 'link' + }) } /** @@ -194,54 +190,51 @@ export function resolveNavLinkItem(linkItem) { * @param { Array | Array | [link: string]: SidebarConfig } config * @returns { base: string, config: SidebarConfig } */ -export function resolveMatchingConfig(regularPath, config) { +export function resolveMatchingConfig (regularPath, config) { if (Array.isArray(config)) { return { - base: "/", + base: '/', config: config - }; + } } for (const base in config) { if (ensureEndingSlash(regularPath).indexOf(encodeURI(base)) === 0) { return { base, config: config[base] - }; + } } } - return {}; + return {} } -function ensureEndingSlash(path) { - return /(\.html|\/)$/.test(path) ? path : path + "/"; +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); +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 { - if (groupDepth > 3) { - console.error("[vuepress] detected a too deep nested sidebar group."); - } - const children = item.children || []; + const children = item.children || [] if (children.length === 0 && item.path) { return Object.assign(resolvePage(pages, item.path, base), { title: item.title - }); + }) } return { - type: "group", + type: 'group', path: item.path, title: item.title, sidebarDepth: item.sidebarDepth, - children: children.map(child => - resolveItem(child, pages, base, groupDepth + 1) - ), + children: children.map(child => resolveItem(child, pages, base, groupDepth + 1)), collapsable: item.collapsable !== false - }; + } } }