@trimble-oss/modus-docs-hugo-theme 1.0.0-alpha14 → 1.0.0-alpha15

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,8 @@
17
17
  @import "news";
18
18
  @import "posts";
19
19
  @import "print";
20
- @import "scroll-to-top-btn";
20
+
21
+ // @import "scroll-to-top-btn";
21
22
  @import "skippy"; // skip to content accessibility
22
23
  @import "tables";
23
24
  @import "footer";
@@ -1 +1 @@
1
- var autoComplete=function(){function e(e){function t(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function o(e,t,o){e.attachEvent?e.attachEvent("on"+t,o):e.addEventListener(t,o)}function s(e,t,o){e.detachEvent?e.detachEvent("on"+t,o):e.removeEventListener(t,o)}function n(e,s,n,l){o(l||document,s,function(o){for(var s,l=o.target||o.srcElement;l&&!(s=t(l,e));)l=l.parentElement;s&&n.call(l,o)})}if(document.querySelector){var l={selector:0,source:0,minChars:3,delay:150,offsetLeft:0,offsetTop:1,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" data-val="'+e+'">'+e.replace(o,"<b>$1</b>")+"</div>"},onSelect:function(){}};for(var c in e)e.hasOwnProperty(c)&&(l[c]=e[c]);for(var a="object"==typeof l.selector?[l.selector]:document.querySelectorAll(l.selector),u=0;u<a.length;u++){var i=a[u];i.sc=document.createElement("div"),i.sc.className="autocomplete-suggestions "+l.menuClass,i.autocompleteAttr=i.getAttribute("autocomplete"),i.setAttribute("autocomplete","off"),i.cache={},i.last_val="",i.updateSC=function(e,t){var o=i.getBoundingClientRect();if(i.sc.style.left=Math.round(o.left+(window.pageXOffset||document.documentElement.scrollLeft)+l.offsetLeft)+"px",i.sc.style.top=Math.round(o.bottom+(window.pageYOffset||document.documentElement.scrollTop)+l.offsetTop)+"px",i.sc.style.width=Math.round(o.right-o.left)+"px",!e&&(i.sc.style.display="block",i.sc.maxHeight||(i.sc.maxHeight=parseInt((window.getComputedStyle?getComputedStyle(i.sc,null):i.sc.currentStyle).maxHeight)),i.sc.suggestionHeight||(i.sc.suggestionHeight=i.sc.querySelector(".autocomplete-suggestion").offsetHeight),i.sc.suggestionHeight))if(t){var s=i.sc.scrollTop,n=t.getBoundingClientRect().top-i.sc.getBoundingClientRect().top;n+i.sc.suggestionHeight-i.sc.maxHeight>0?i.sc.scrollTop=n+i.sc.suggestionHeight+s-i.sc.maxHeight:0>n&&(i.sc.scrollTop=n+s)}else i.sc.scrollTop=0},o(window,"resize",i.updateSC),document.body.appendChild(i.sc),n("autocomplete-suggestion","mouseleave",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&setTimeout(function(){e.className=e.className.replace("selected","")},20)},i.sc),n("autocomplete-suggestion","mouseover",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&(e.className=e.className.replace("selected","")),this.className+=" selected"},i.sc),n("autocomplete-suggestion","mousedown",function(e){if(t(this,"autocomplete-suggestion")){var o=this.getAttribute("data-val");i.value=o,l.onSelect(e,o,this),i.sc.style.display="none"}},i.sc),i.blurHandler=function(){try{var e=document.querySelector(".autocomplete-suggestions:hover")}catch(t){var e=0}e?i!==document.activeElement&&setTimeout(function(){i.focus()},20):(i.last_val=i.value,i.sc.style.display="none",setTimeout(function(){i.sc.style.display="none"},350))},o(i,"blur",i.blurHandler);var r=function(e){var t=i.value;if(i.cache[t]=e,e.length&&t.length>=l.minChars){for(var o="",s=0;s<e.length;s++)o+=l.renderItem(e[s],t);i.sc.innerHTML=o,i.updateSC(0)}else i.sc.style.display="none"};i.keydownHandler=function(e){var t=window.event?e.keyCode:e.which;if((40==t||38==t)&&i.sc.innerHTML){var o,s=i.sc.querySelector(".autocomplete-suggestion.selected");return s?(o=40==t?s.nextSibling:s.previousSibling,o?(s.className=s.className.replace("selected",""),o.className+=" selected",i.value=o.getAttribute("data-val")):(s.className=s.className.replace("selected",""),i.value=i.last_val,o=0)):(o=40==t?i.sc.querySelector(".autocomplete-suggestion"):i.sc.childNodes[i.sc.childNodes.length-1],o.className+=" selected",console.log(o),i.value=o.getAttribute("data-val")),i.updateSC(0,o),!1}if(27==t)i.value=i.last_val,i.sc.style.display="none";else if(13==t||9==t){var s=i.sc.querySelector(".autocomplete-suggestion.selected");s&&"none"!=i.sc.style.display&&(l.onSelect(e,s.getAttribute("data-val"),s),setTimeout(function(){i.sc.style.display="none"},20))}},o(i,"keydown",i.keydownHandler),i.keyupHandler=function(e){var t=window.event?e.keyCode:e.which;if(!t||(35>t||t>40)&&13!=t&&27!=t){var o=i.value;if(o.length>=l.minChars){if(o!=i.last_val){if(i.last_val=o,clearTimeout(i.timer),l.cache){if(o in i.cache)return void r(i.cache[o]);for(var s=1;s<o.length-l.minChars;s++){var n=o.slice(0,o.length-s);if(n in i.cache&&!i.cache[n].length)return void r([])}}i.timer=setTimeout(function(){l.source(o,r)},l.delay)}}else i.last_val=o,i.sc.style.display="none"}},o(i,"keyup",i.keyupHandler),i.focusHandler=function(e){i.last_val="\n",i.keyupHandler(e)},l.minChars||o(i,"focus",i.focusHandler)}this.destroy=function(){for(var e=0;e<a.length;e++){var t=a[e];s(window,"resize",t.updateSC),s(t,"blur",t.blurHandler),s(t,"focus",t.focusHandler),s(t,"keydown",t.keydownHandler),s(t,"keyup",t.keyupHandler),t.autocompleteAttr?t.setAttribute("autocomplete",t.autocompleteAttr):t.removeAttribute("autocomplete"),document.body.removeChild(t.sc),t=null}}}}return e}();!function(){"function"==typeof define&&define.amd?define("autoComplete",function(){return autoComplete}):"undefined"!=typeof module&&module.exports?module.exports=autoComplete:window.autoComplete=autoComplete}();
1
+ var autoComplete=function(){function e(e){function t(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function o(e,t,o){e.attachEvent?e.attachEvent("on"+t,o):e.addEventListener(t,o)}function s(e,t,o){e.detachEvent?e.detachEvent("on"+t,o):e.removeEventListener(t,o)}function n(e,s,n,l){o(l||document,s,function(o){for(var s,l=o.target||o.srcElement;l&&!(s=t(l,e));)l=l.parentElement;s&&n.call(l,o)})}if(document.querySelector){var l={selector:0,source:0,minChars:3,delay:150,offsetLeft:0,offsetTop:1,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" role="link" data-val="'+e+'">'+e.replace(o,"<b>$1</b>")+"</div>"},onSelect:function(){}};for(var c in e)e.hasOwnProperty(c)&&(l[c]=e[c]);for(var a="object"==typeof l.selector?[l.selector]:document.querySelectorAll(l.selector),u=0;u<a.length;u++){var i=a[u];i.sc=document.createElement("div"),i.sc.className="autocomplete-suggestions"+l.menuClass,i.autocompleteAttr=i.getAttribute("autocomplete"),i.setAttribute("autocomplete","off"),i.cache={},i.last_val="",i.updateSC=function(e,t){var o=i.getBoundingClientRect();if(i.sc.style.left=Math.round(o.left+(window.pageXOffset||document.documentElement.scrollLeft)+l.offsetLeft)+"px",i.sc.style.top=Math.round(o.bottom+(window.pageYOffset||document.documentElement.scrollTop)+l.offsetTop)+"px",i.sc.style.width=Math.round(o.right-o.left)+"px",!e&&(i.sc.style.display="block",i.sc.maxHeight||(i.sc.maxHeight=parseInt((window.getComputedStyle?getComputedStyle(i.sc,null):i.sc.currentStyle).maxHeight)),i.sc.suggestionHeight||(i.sc.suggestionHeight=i.sc.querySelector(".autocomplete-suggestion").offsetHeight),i.sc.suggestionHeight))if(t){var s=i.sc.scrollTop,n=t.getBoundingClientRect().top-i.sc.getBoundingClientRect().top;n+i.sc.suggestionHeight-i.sc.maxHeight>0?i.sc.scrollTop=n+i.sc.suggestionHeight+s-i.sc.maxHeight:0>n&&(i.sc.scrollTop=n+s)}else i.sc.scrollTop=0},o(window,"resize",i.updateSC),document.body.appendChild(i.sc),n("autocomplete-suggestion","mouseleave",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&setTimeout(function(){e.className=e.className.replace("selected","")},20)},i.sc),n("autocomplete-suggestion","mouseover",function(){var e=i.sc.querySelector(".autocomplete-suggestion.selected");e&&(e.className=e.className.replace("selected","")),this.className+=" selected"},i.sc),n("autocomplete-suggestion","mousedown",function(e){if(t(this,"autocomplete-suggestion")){var o=this.getAttribute("data-val");i.value=o,l.onSelect(e,o,this),i.sc.style.display="none"}},i.sc),i.blurHandler=function(){try{var e=document.querySelector(".autocomplete-suggestions:hover")}catch(t){var e=0}e?i!==document.activeElement&&setTimeout(function(){i.focus()},20):(i.last_val=i.value,i.sc.style.display="none",setTimeout(function(){i.sc.style.display="none"},350))},o(i,"blur",i.blurHandler);var r=function(e){var t=i.value;if(i.cache[t]=e,e.length&&t.length>=l.minChars){for(var o="",s=0;s<e.length;s++)o+=l.renderItem(e[s],t);i.sc.innerHTML=o,i.updateSC(0)}else i.sc.style.display="none"};i.keydownHandler=function(e){var t=window.event?e.keyCode:e.which;if((40==t||38==t)&&i.sc.innerHTML){var o,s=i.sc.querySelector(".autocomplete-suggestion.selected");return s?(o=40==t?s.nextSibling:s.previousSibling,o?(s.className=s.className.replace("selected",""),o.className+=" selected",i.value=o.getAttribute("data-val")):(s.className=s.className.replace("selected",""),i.value=i.last_val,o=0)):(o=40==t?i.sc.querySelector(".autocomplete-suggestion"):i.sc.childNodes[i.sc.childNodes.length-1],o.className+=" selected",console.log(o),i.value=o.getAttribute("data-val")),i.updateSC(0,o),!1}if(27==t)i.value=i.last_val,i.sc.style.display="none";else if(13==t||9==t){var s=i.sc.querySelector(".autocomplete-suggestion.selected");s&&"none"!=i.sc.style.display&&(l.onSelect(e,s.getAttribute("data-val"),s),setTimeout(function(){i.sc.style.display="none"},20))}},o(i,"keydown",i.keydownHandler),i.keyupHandler=function(e){var t=window.event?e.keyCode:e.which;if(!t||(35>t||t>40)&&13!=t&&27!=t){var o=i.value;if(o.length>=l.minChars){if(o!=i.last_val){if(i.last_val=o,clearTimeout(i.timer),l.cache){if(o in i.cache)return void r(i.cache[o]);for(var s=1;s<o.length-l.minChars;s++){var n=o.slice(0,o.length-s);if(n in i.cache&&!i.cache[n].length)return void r([])}}i.timer=setTimeout(function(){l.source(o,r)},l.delay)}}else i.last_val=o,i.sc.style.display="none"}},o(i,"keyup",i.keyupHandler),i.focusHandler=function(e){i.last_val="\n",i.keyupHandler(e)},l.minChars||o(i,"focus",i.focusHandler)}this.destroy=function(){for(var e=0;e<a.length;e++){var t=a[e];s(window,"resize",t.updateSC),s(t,"blur",t.blurHandler),s(t,"focus",t.focusHandler),s(t,"keydown",t.keydownHandler),s(t,"keyup",t.keyupHandler),t.autocompleteAttr?t.setAttribute("autocomplete",t.autocompleteAttr):t.removeAttribute("autocomplete"),document.body.removeChild(t.sc),t=null}}}}return e}();!function(){"function"==typeof define&&define.amd?define("autoComplete",function(){return autoComplete}):"undefined"!=typeof module&&module.exports?module.exports=autoComplete:window.autoComplete=autoComplete}();
@@ -1 +1 @@
1
- var lunrIndex,pagesIndex;function endsWith(a,b){return-1!==a.indexOf(b,a.length-b.length)}function initLunr(){endsWith(baseurl,"/")||(baseurl+="/");jQuery.getJSON(baseurl+"index.json").done(function(a){pagesIndex=a,lunrIndex=lunr(function(){this.ref("uri"),this.field("title",{boost:15}),this.field("tags",{boost:10}),this.field("content",{boost:5}),this.pipeline.remove(lunr.stemmer),this.searchPipeline.remove(lunr.stemmer),pagesIndex.forEach(function(a){this.add(a)},this)})}).fail(function(a,b,c){console.error("Error getting Hugo index file:",b+", "+c)})}function search(a){return lunrIndex.search(a+"^100 "+a+"*^10 *"+a+"^10 "+a+"~2^1").map(function(a){return pagesIndex.filter(function(b){return b.uri===a.ref})[0]})}initLunr(),jQuery(document).ready(function(){new autoComplete({selector:jQuery("#search-by").get(0),source:function(a,b){b(search(a))},renderItem:function(a,b){var c=a.content.match("(?:\\s?(?:[\\w]+)\\s?){0,2}"+b+"(?:\\s?(?:[\\w]+)\\s?){0,"+2+"}");return a.context=c,"<div class=\"autocomplete-suggestion\" data-term=\""+b+"\" data-title=\""+a.title+"\" data-uri=\""+a.uri+"?q="+b+"#"+b+"\" data-context=\""+a.context+"\">\xBB "+a.title+"<div class=\"context\">"+(a.context||"")+"</div></div>"},onSelect:function(a,b,c){location.href=c.getAttribute("data-uri")}})});
1
+ var lunrIndex,pagesIndex;function endsWith(a,b){return-1!==a.indexOf(b,a.length-b.length)}function initLunr(){endsWith(baseurl,"/")||(baseurl+="/");jQuery.getJSON(baseurl+"index.json").done(function(a){pagesIndex=a,lunrIndex=lunr(function(){this.ref("uri"),this.field("title",{boost:15}),this.field("tags",{boost:10}),this.field("content",{boost:5}),this.pipeline.remove(lunr.stemmer),this.searchPipeline.remove(lunr.stemmer),pagesIndex.forEach(function(a){this.add(a)},this)})}).fail(function(a,b,c){console.error("Error getting Hugo index file:",b+", "+c)})}function search(a){return lunrIndex.search(a+"^100 "+a+"*^10 *"+a+"^10 "+a+"~2^1").map(function(a){return pagesIndex.filter(function(b){return b.uri===a.ref})[0]})}initLunr(),jQuery(document).ready(function(){new autoComplete({selector:jQuery("#search-by").get(0),source:function(a,b){b(search(a))},renderItem:function(a,b){var c=a.content.match("(?:\\s?(?:[\\w]+)\\s?){0,2}"+b+"(?:\\s?(?:[\\w]+)\\s?){0,"+2+"}");return a.context=c,"<div class=\"autocomplete-suggestion\" role=\"link\" data-term=\""+b+"\" aria-label=\""+a.title+"\" data-title=\""+a.title+"\" data-uri=\""+a.uri+"?q="+b+"#"+b+"\" data-context=\""+a.context+"\">\xBB "+a.title+"<div aria-hidden=\"true\" class=\"context\">"+(a.context||"")+"</div></div>"},onSelect:function(a,b,c){location.href=c.getAttribute("data-uri")}})});
@@ -1,4 +1,4 @@
1
- <h{{ .Level }} id="{{ .Anchor | safeURL }}"
1
+ <h{{ .Level }} id="{{- .Anchor | safeURL -}}"
2
2
  class="{{- if (eq .Level 2 ) }}
3
3
  h1 mt-5 {{- end -}}
4
4
  {{- if (eq .Level 3 ) }}
@@ -20,4 +20,4 @@
20
20
  {{ if and (ne .Anchor "use-when") (ne .Anchor "dont-use-when") }}
21
21
  <a class="header-link text-light text-decoration-none fw-normal" href="#{{- .Anchor | safeURL -}}"
22
22
  aria-label="anchor"></a>{{ end }}
23
- </h{{ .Level }}>
23
+ </h{{ .Level }}>
@@ -1,4 +1,4 @@
1
- <a href="{{ .Destination | safeURL }}" {{ with .Title}} title="{{- . -}}"
1
+ <a href="{{- .Destination | safeURL -}}" {{ with .Title}} title="{{- . -}}"
2
2
  {{- end -}}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener" {{- end -}}>
3
3
  {{- .Text | safeHTML -}}
4
4
  </a>
@@ -28,7 +28,10 @@
28
28
  if (event.which === 27) {
29
29
  const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
30
30
  tooltipTriggerList.forEach(function (tooltipTriggerEl) {
31
- $(tooltipTriggerEl).tooltip('hide');
31
+ var bootstrapTooltip = bootstrap.Tooltip.getInstance(tooltipTriggerEl);
32
+ if (bootstrapTooltip) {
33
+ bootstrapTooltip.hide();
34
+ }
32
35
  });
33
36
  }
34
37
  });
@@ -10,7 +10,7 @@
10
10
  window.addEventListener('load', _calculateScrollbarWidth);
11
11
  </script>
12
12
  <header class="pt-5 bg-secondary-subtle bg-opacity-10 border-bottom" {{- if (or (.Params.blog) (.Params.image)) -}}
13
- style="background-image: url({{- .Params.Image | relURL -}});{{- with .Params.headerBgColor -}}background-color:{{- . -}} !important;{{- end -}};"
13
+ style="background-image: url({{- .Params.Image | relURL -}});{{- with .Params.headerBgColor -}}background-color: {{- . -}} !important; {{- end -}};"
14
14
  {{ end }}>
15
15
  <div class="container pt-xl-3" style="max-width: 1090px">
16
16
  {{ if not .Params.blog }}
@@ -13,7 +13,7 @@
13
13
  <!-- Compiles and minifies the sites Sass files from /assets/css/ -->
14
14
  {{- $sassOptions := (dict "enableSourceMap" true) -}}
15
15
  {{ $styles := resources.Get "css/modus-docs.scss" | toCSS $sassOptions | postCSS | minify }}
16
- <link rel="stylesheet" href="{{ $styles.RelPermalink }}?v{{ hugo.Version }}">
16
+ <link rel="stylesheet" href="{{ $styles.RelPermalink }}?v{{- hugo.Version -}}">
17
17
 
18
18
  <!-- Load jQuery from CDN with fallback -->
19
19
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trimble-oss/modus-docs-hugo-theme",
3
- "version": "1.0.0-alpha14",
3
+ "version": "1.0.0-alpha15",
4
4
  "description": "A Documentation theme for Hugo built by Trimble",
5
5
  "homepage": "https://github.com/trimble-oss/modus-docs-hugo-theme",
6
6
  "bugs": {
@@ -31,15 +31,15 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "autoprefixer": "10.4.16",
34
- "eslint": "8.55.0",
34
+ "eslint": "8.56.0",
35
35
  "eslint-config-prettier": "9.1.0",
36
36
  "htmlhint": "1.1.4",
37
- "hugo-bin": "0.116.4",
38
- "postcss": "8.4.32",
37
+ "hugo-bin": "0.117.1",
38
+ "postcss": "8.4.33",
39
39
  "postcss-cli": "11.0.0",
40
40
  "prettier": "3.1.1",
41
- "stylelint": "16.0.2",
42
- "stylelint-config-standard-scss": "12.0.0",
41
+ "stylelint": "16.1.0",
42
+ "stylelint-config-standard-scss": "13.0.0",
43
43
  "stylelint-order": "6.0.4"
44
44
  },
45
45
  "hugo-bin": {
@@ -1,33 +0,0 @@
1
- /*
2
- * Scroll to top widget
3
- * Copyright (C) 2022 Trimble Inc.
4
- * Licensed under MIT
5
- */
6
-
7
- const ScrollToTop = (() => {
8
- const target = document.querySelector('footer');
9
- const scrollToTopBtn = document.querySelector('.btn-to-top');
10
- const rootElement = document.documentElement;
11
-
12
- function callback(entries, observer) {
13
- entries.forEach((entry) => {
14
- if (entry.isIntersecting) {
15
- scrollToTopBtn.classList.add('btn-to-top-show');
16
- } else {
17
- scrollToTopBtn.classList.remove('btn-to-top-show');
18
- }
19
- });
20
- }
21
-
22
- function scrollToTop() {
23
- rootElement.scrollTo({
24
- top: 0,
25
- behavior: 'smooth',
26
- });
27
- }
28
-
29
- scrollToTopBtn.addEventListener('click', scrollToTop);
30
-
31
- const observer = new IntersectionObserver(callback);
32
- observer.observe(target);
33
- })();