From 689b749ce730120615dbe72d9b2f84c3b5fe32f4 Mon Sep 17 00:00:00 2001 From: Jongseob Jeon Date: Mon, 23 May 2022 23:49:23 +0900 Subject: [PATCH] update theme version v0.4.0 to v0.4.3 (#110) Signed-off-by: Jongseob Jeon Co-authored-by: Jongseob Jeon --- LICENSE | 2 +- archetypes/blog.md | 2 - archetypes/docs.md | 2 - archetypes/docs/_index.md | 10 + archetypes/docs/lorem/_index.md | 10 + archetypes/docs/lorem/ipsum/index.md | 15 + assets/js/app.js | 14 - assets/js/index.js | 13 +- assets/js/scroll-lock.js | 14 + assets/scss/common/_dark.scss | 19 +- assets/scss/components/_buttons.scss | 6 + assets/scss/components/_details.scss | 2 +- assets/scss/layouts/_pages.scss | 1 - layouts/partials/footer/script-footer.html | 5 +- layouts/partials/header/header.html | 2 +- .../sidebar/auto-collapsible-menu.html | 2 +- .../partials/sidebar/auto-default-menu.html | 10 +- package-lock.json | 4155 ++++++----------- package.json | 17 +- 19 files changed, 1437 insertions(+), 2864 deletions(-) create mode 100644 archetypes/docs/_index.md create mode 100644 archetypes/docs/lorem/_index.md create mode 100644 archetypes/docs/lorem/ipsum/index.md create mode 100644 assets/js/scroll-lock.js diff --git a/LICENSE b/LICENSE index a6f08e38..a9431aad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ MIT License Copyright (c) 2018-present, Gridsome -Copyright 2021-presetn MLOps for ALL +Copyright (c) 2020-present, Henk Verlinde Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/archetypes/blog.md b/archetypes/blog.md index 78733514..b4ad21a4 100644 --- a/archetypes/blog.md +++ b/archetypes/blog.md @@ -9,5 +9,3 @@ weight: 50 images: ["{{ .Name | urlize }}.jpg"] contributors: [] --- - -{{< img src="{{ .Name | urlize }}.jpg" alt="{{ replace .Name "-" " " | title }}" caption="{{ replace .Name "-" " " | title }}" class="wide" >}} diff --git a/archetypes/docs.md b/archetypes/docs.md index d2a6282b..436bd086 100644 --- a/archetypes/docs.md +++ b/archetypes/docs.md @@ -12,5 +12,3 @@ menu: weight: 999 toc: true --- - -{{< img src="{{ .Name | urlize }}.jpg" alt="{{ replace .Name "-" " " | title }}" caption="{{ replace .Name "-" " " | title }}" >}} diff --git a/archetypes/docs/_index.md b/archetypes/docs/_index.md new file mode 100644 index 00000000..3ed05403 --- /dev/null +++ b/archetypes/docs/_index.md @@ -0,0 +1,10 @@ +--- +title: "Docs" +description: "" +lead: "" +date: 2022-01-25T14:40:56+01:00 +lastmod: 2022-01-25T14:40:56+01:00 +draft: false +images: [] +type: docs +--- diff --git a/archetypes/docs/lorem/_index.md b/archetypes/docs/lorem/_index.md new file mode 100644 index 00000000..c1b50ae6 --- /dev/null +++ b/archetypes/docs/lorem/_index.md @@ -0,0 +1,10 @@ +--- +title: "Lorem" +description: "" +lead: "" +date: 2022-01-25T14:41:21+01:00 +lastmod: 2022-01-25T14:41:21+01:00 +draft: false +images: [] +type: docs +--- diff --git a/archetypes/docs/lorem/ipsum/index.md b/archetypes/docs/lorem/ipsum/index.md new file mode 100644 index 00000000..2cc63950 --- /dev/null +++ b/archetypes/docs/lorem/ipsum/index.md @@ -0,0 +1,15 @@ +--- +title: "Ipsum" +description: "" +lead: "" +date: 2022-01-25T14:41:39+01:00 +lastmod: 2022-01-25T14:41:39+01:00 +draft: false +images: [] +type: docs +menu: + {{ .Section }}: + parent: "lorem" +weight: 100 +toc: true +--- diff --git a/assets/js/app.js b/assets/js/app.js index 069b8c2e..e69de29b 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1,14 +0,0 @@ -// Adds scroll position lock for default docs sidebar - -if (document.querySelector('#sidebar-default') !== null) { - let sidebar = document.getElementById('sidebar-default'); - - let pos = sessionStorage.getItem('sidebar-scroll'); - if (pos !== null) { - sidebar.scrollTop = parseInt(pos, 10); - } - - window.addEventListener('beforeunload', () => { - sessionStorage.setItem('sidebar-scroll', sidebar.scrollTop); - }); -} diff --git a/assets/js/index.js b/assets/js/index.js index b99ab905..f3d8da18 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -97,8 +97,8 @@ Source: {{ $list := (where .Site.Pages "Section" "docs") -}} {{ $len := (len $list) -}} - index.add( - {{ range $index, $element := $list -}} + {{ range $index, $element := $list -}} + index.add( { id: {{ $index }}, href: "{{ .RelPermalink }}", @@ -109,12 +109,9 @@ Source: description: {{ .Summary | plainify | jsonify }}, {{ end -}} content: {{ .Plain | jsonify }} - }) - {{ if ne (add $index 1) $len -}} - .add( - {{ end -}} - {{ end -}} - ; + } + ); + {{ end -}} search.addEventListener('input', show_results, true); diff --git a/assets/js/scroll-lock.js b/assets/js/scroll-lock.js new file mode 100644 index 00000000..069b8c2e --- /dev/null +++ b/assets/js/scroll-lock.js @@ -0,0 +1,14 @@ +// Adds scroll position lock for default docs sidebar + +if (document.querySelector('#sidebar-default') !== null) { + let sidebar = document.getElementById('sidebar-default'); + + let pos = sessionStorage.getItem('sidebar-scroll'); + if (pos !== null) { + sidebar.scrollTop = parseInt(pos, 10); + } + + window.addEventListener('beforeunload', () => { + sessionStorage.setItem('sidebar-scroll', sidebar.scrollTop); + }); +} diff --git a/assets/scss/common/_dark.scss b/assets/scss/common/_dark.scss index 7608aa49..4694fd54 100644 --- a/assets/scss/common/_dark.scss +++ b/assets/scss/common/_dark.scss @@ -528,20 +528,31 @@ $navbar-dark-active-color: $link-color-dark; } } -[data-dark-mode] .dropdown-menu.dropdown-menu-main { +[data-dark-mode] .dropdown-menu { background: $body-overlay-dark; } -[data-dark-mode] .dropdown-menu-main .dropdown-item { +[data-dark-mode] .dropdown-menu .dropdown-item { color: $body-color-dark; } -[data-dark-mode] .dropdown-menu-main .dropdown-item:hover { +[data-dark-mode] .dropdown-menu .dropdown-item:hover { color: $link-color-dark; + background: $body-bg-dark; } -[data-dark-mode] .dropdown-menu-main .dropdown-item.active { +[data-dark-mode] .dropdown-menu .dropdown-item.active, +[data-dark-mode] .dropdown-menu .dropdown-item:focus { color: $link-color-dark; + background: $body-bg-dark; +} + +[data-dark-mode] .doks-navbar .dropdown-item.current, +[data-dark-mode] .doks-subnavbar .dropdown-item.current { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23dee2e6' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); + background-repeat: no-repeat; + background-position: right 1rem top 0.6rem; + background-size: 0.75rem 0.75rem; } [data-dark-mode] details { diff --git a/assets/scss/components/_buttons.scss b/assets/scss/components/_buttons.scss index 9cb51e5d..235d6ea1 100644 --- a/assets/scss/components/_buttons.scss +++ b/assets/scss/components/_buttons.scss @@ -223,6 +223,12 @@ pre { width: 100%; } +@include media-breakpoint-up(md) { + .dropdown-menu.dropdown-menu-main { + width: auto; + } +} + .dropdown-menu-main .dropdown-item { color: inherit; font-size: $font-size-base; diff --git a/assets/scss/components/_details.scss b/assets/scss/components/_details.scss index f3877dcc..fb719d36 100644 --- a/assets/scss/components/_details.scss +++ b/assets/scss/components/_details.scss @@ -16,7 +16,7 @@ details summary { summary { list-style: none; - display: inline; + display: inline-block; width: calc(100% + 2rem); margin: -0.5rem -1rem 0; padding: 0.5rem 0.75rem; diff --git a/assets/scss/layouts/_pages.scss b/assets/scss/layouts/_pages.scss index 23b7b5d0..405ede95 100644 --- a/assets/scss/layouts/_pages.scss +++ b/assets/scss/layouts/_pages.scss @@ -9,7 +9,6 @@ .anchor { visibility: hidden; - padding-left: 0.5rem; } h1:hover a, diff --git a/layouts/partials/footer/script-footer.html b/layouts/partials/footer/script-footer.html index d997cfa5..c3be2f2b 100644 --- a/layouts/partials/footer/script-footer.html +++ b/layouts/partials/footer/script-footer.html @@ -57,6 +57,9 @@ {{ $slice = $slice | append $katexConfig -}} {{ end -}} +{{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}} +{{ $slice = $slice | append $scrollLock -}} + {{ $js := $slice | resources.Concat "main.js" -}} {{ if eq (hugo.Environment) "development" -}} @@ -102,4 +105,4 @@ {{ if and (.Site.Params.options.flexSearch) (eq .Section "docs") -}} {{ end -}} -{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index fa1d51f1..3c676116 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -18,7 +18,7 @@ -
+

{{ .Site.Params.Title }}

diff --git a/layouts/partials/sidebar/auto-collapsible-menu.html b/layouts/partials/sidebar/auto-collapsible-menu.html index 09f2f6c0..3eaa2f69 100644 --- a/layouts/partials/sidebar/auto-collapsible-menu.html +++ b/layouts/partials/sidebar/auto-collapsible-menu.html @@ -3,7 +3,7 @@ {{ $currentPage := . -}} {{ $section := $currentPage.Section -}} {{ range (where .Site.Sections "Section" "in" $section) }} - {{ range .Sections.Reverse }} + {{ range .Sections.ByWeight.Reverse }} {{ $active := in $currentPage.RelPermalink .RelPermalink }}