clean-jsdoc-theme 4.1.9 → 4.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -21
- package/jsdoc-config.json +1 -0
- package/package.json +3 -2
- package/publish.js +39 -15
- package/static/scripts/core.min.js +22 -22
- package/tmpl/container.tmpl +5 -0
- package/tmpl/type.tmpl +5 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# clean-jsdoc-theme
|
|
2
2
|
|
|
3
|
-
[](https://github.com/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork) ](https://github.com/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/fork)  [](https://github.com/ankitskvmdam/clean-jsdoc-theme/issues) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/graphs/contributors) [](https://travis-ci.org/ankitskvmdam/clean-jsdoc-theme) [](https://github.com/ankitskvmdam/clean-jsdoc-theme/blob/master/LICENSE)
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
6
|
`clean-jsdoc-theme` is a beautifully crafted theme for JSDoc 3. It is a clean and fully responsive theme with loads of
|
|
@@ -424,26 +424,27 @@ This will remove all symbols (members, methods ...) that come from inherited par
|
|
|
424
424
|
|
|
425
425
|
## Cheat sheet
|
|
426
426
|
|
|
427
|
-
| name
|
|
428
|
-
|
|
|
429
|
-
| `default_theme`
|
|
430
|
-
| `homepageTitle`
|
|
431
|
-
| `title`
|
|
432
|
-
| `base_url`
|
|
433
|
-
| `menu`
|
|
434
|
-
| `meta`
|
|
435
|
-
| `search`
|
|
436
|
-
| `codepen`
|
|
437
|
-
| `static_dir`
|
|
438
|
-
| `create_style`
|
|
439
|
-
| `add_style_path`
|
|
440
|
-
| `include_css`
|
|
441
|
-
| `add_scripts`
|
|
442
|
-
| `add_script_path`
|
|
443
|
-
| `include_js`
|
|
444
|
-
| `footer`
|
|
445
|
-
| `exclude_inherited`
|
|
446
|
-
| `sections`
|
|
427
|
+
| name | default | use case | expected value(s) |
|
|
428
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- | --------------------- |
|
|
429
|
+
| `default_theme` | `"dark"` | To set the default theme | `"light" or "dark"` |
|
|
430
|
+
| `homepageTitle` | "Home" | To set the title of homepage | `string` |
|
|
431
|
+
| `title` | `null` | To set the title | `HTML` or `string` |
|
|
432
|
+
| `base_url` | `/` | To set the base URL | `string` |
|
|
433
|
+
| `menu` | `null` | To render extra link in navbar | Array of Object(s) |
|
|
434
|
+
| `meta` | `null` | Meta tag attributes | Array of Object(s) |
|
|
435
|
+
| `search` | `true` | To render search or not | `true` or `false` |
|
|
436
|
+
| `codepen` | `{}` | To open code in codepen | `Object` |
|
|
437
|
+
| `static_dir` | `null` | To include static dir | Array of string |
|
|
438
|
+
| `create_style` | `null` | To create custom style rules | `string` |
|
|
439
|
+
| `add_style_path` | `null` | To add external css libraries/files | Array of Object(s) |
|
|
440
|
+
| `include_css` | `null` | To include css files | Array of string |
|
|
441
|
+
| `add_scripts` | `null` | To create custom script | `string` |
|
|
442
|
+
| `add_script_path` | `null` | To add external js libraries/files | Array of Object(s) |
|
|
443
|
+
| `include_js` | `null` | To include js files | `string` |
|
|
444
|
+
| `footer` | `null` | To render footer | `HTML` or `string` |
|
|
445
|
+
| `exclude_inherited` | `false` | To exclude inherited symbols | `boolean` |
|
|
446
|
+
| `sections` | `["Modules", "Classes", "Externals", "Events", "Namespaces", "Mixins", "Tutorials", "Interfaces", "Global"]` | To order navbar/sidebar sections or to hide/remove navbar/sidebar sections | `Array<SECTION_TYPE>` |
|
|
447
|
+
| `displayModuleHeader` | `false` | If you want the module name to appear on its page | `boolean` |
|
|
447
448
|
|
|
448
449
|
Don't forget to add the following in your jsdoc config file, otherwise toc will not work on some pages.
|
|
449
450
|
|
package/jsdoc-config.json
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"search": true,
|
|
17
17
|
"homepageTitle": "Clean JSDoc Theme",
|
|
18
18
|
"default_theme": "dark",
|
|
19
|
+
"displayModuleHeader": true,
|
|
19
20
|
"title": "clean-jsdoc-theme",
|
|
20
21
|
"footer": "<div style='margin-bottom: 0.5rem;'>clean-jsdoc-theme</div> Fork: <a href='https://github.com/ankitskvmdam/clean-jsdoc-theme'>https://github.com/ankitskvmdam/clean-jsdoc-theme</a>",
|
|
21
22
|
"meta": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clean-jsdoc-theme",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.10",
|
|
4
4
|
"description": "A beautifully crafted theme/template for JSDoc 3. This theme/template looks and feels like a premium theme/template. This is a fully mobile responsive theme and also fully customizable theme.",
|
|
5
5
|
"main": "publish.js",
|
|
6
6
|
"scripts": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"fs-extra": "^10.1.0",
|
|
49
49
|
"html-minifier": "^4.0.0",
|
|
50
|
-
"nanoid": "^3.3.4"
|
|
50
|
+
"nanoid": "^3.3.4",
|
|
51
|
+
"showdown": "^2.1.0"
|
|
51
52
|
}
|
|
52
53
|
}
|
package/publish.js
CHANGED
|
@@ -11,12 +11,15 @@ var util = require('util');
|
|
|
11
11
|
var fse = require('fs-extra');
|
|
12
12
|
var nanoid = require('nanoid').nanoid;
|
|
13
13
|
var htmlMinify = require('html-minifier');
|
|
14
|
+
var showdown = require('showdown');
|
|
14
15
|
|
|
16
|
+
var mdToHTMLConverter = new showdown.Converter()
|
|
15
17
|
var htmlsafe = helper.htmlsafe;
|
|
16
18
|
var linkto = helper.linkto;
|
|
17
19
|
var resolveAuthorLinks = helper.resolveAuthorLinks;
|
|
18
20
|
var hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
21
|
|
|
22
|
+
|
|
20
23
|
/* prettier-ignore-start */
|
|
21
24
|
// eslint-disable-next-line
|
|
22
25
|
var themeOpts = (env && env.opts && env.opts['theme_opts']) || {};
|
|
@@ -232,18 +235,19 @@ function addSignatureParams(f) {
|
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
function addSignatureReturns(f) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
const attribs = [];
|
|
239
|
+
let attribsString = '';
|
|
240
|
+
let returnTypes = [];
|
|
241
|
+
let returnTypesString = '';
|
|
242
|
+
const source = f.yields || f.returns;
|
|
239
243
|
|
|
240
244
|
// jam all the return-type attributes into an array. this could create odd results (for example,
|
|
241
245
|
// if there are both nullable and non-nullable return types), but let's assume that most people
|
|
242
246
|
// who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
|
|
243
|
-
if (
|
|
244
|
-
|
|
245
|
-
helper.getAttribs(item).forEach(
|
|
246
|
-
if (attribs.
|
|
247
|
+
if (source) {
|
|
248
|
+
source.forEach((item) => {
|
|
249
|
+
helper.getAttribs(item).forEach((attrib) => {
|
|
250
|
+
if (!attribs.includes(attrib)) {
|
|
247
251
|
attribs.push(attrib);
|
|
248
252
|
}
|
|
249
253
|
});
|
|
@@ -252,15 +256,11 @@ function addSignatureReturns(f) {
|
|
|
252
256
|
attribsString = buildAttribsString(attribs);
|
|
253
257
|
}
|
|
254
258
|
|
|
255
|
-
if (
|
|
256
|
-
returnTypes = addNonParamAttributes(
|
|
259
|
+
if (source) {
|
|
260
|
+
returnTypes = addNonParamAttributes(source);
|
|
257
261
|
}
|
|
258
262
|
if (returnTypes.length) {
|
|
259
|
-
returnTypesString =
|
|
260
|
-
' → %s{%s}',
|
|
261
|
-
attribsString,
|
|
262
|
-
returnTypes.join('|')
|
|
263
|
-
);
|
|
263
|
+
returnTypesString = ` → ${attribsString}{${returnTypes.join('|')}}`;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
var signatureOutput = ""
|
|
@@ -430,6 +430,12 @@ function buildFooter() {
|
|
|
430
430
|
return footer;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
+
function moduleHeader() {
|
|
434
|
+
var displayModuleHeader = themeOpts.displayModuleHeader || false;
|
|
435
|
+
|
|
436
|
+
return displayModuleHeader;
|
|
437
|
+
}
|
|
438
|
+
|
|
433
439
|
function getFavicon() {
|
|
434
440
|
var favicon = themeOpts.favicon || undefined;
|
|
435
441
|
|
|
@@ -740,6 +746,18 @@ function buildSidebar(members) {
|
|
|
740
746
|
return nav;
|
|
741
747
|
}
|
|
742
748
|
|
|
749
|
+
/**
|
|
750
|
+
* Currently for some reason yields markdown is
|
|
751
|
+
* not processed by jsdoc. So, we are processing it here
|
|
752
|
+
*
|
|
753
|
+
* @param {Array<{type: string, description: string}>} yields
|
|
754
|
+
*/
|
|
755
|
+
function getProcessedYield(yields) {
|
|
756
|
+
if (!Array.isArray(yields)) return []
|
|
757
|
+
|
|
758
|
+
return yields.map((y) => ({ ...y, description: mdToHTMLConverter.makeHtml(y.description) }))
|
|
759
|
+
}
|
|
760
|
+
|
|
743
761
|
|
|
744
762
|
/**
|
|
745
763
|
@param {TAFFY} taffyData See <http://taffydb.com/>.
|
|
@@ -779,6 +797,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
779
797
|
helper.setTutorials(tutorials);
|
|
780
798
|
|
|
781
799
|
data = helper.prune(data);
|
|
800
|
+
|
|
782
801
|
data.sort('longname, version, since');
|
|
783
802
|
helper.addEventListeners(data);
|
|
784
803
|
|
|
@@ -833,6 +852,10 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
833
852
|
sourceFilePaths.push(sourcePath);
|
|
834
853
|
}
|
|
835
854
|
}
|
|
855
|
+
|
|
856
|
+
if (doclet.yields) {
|
|
857
|
+
doclet.yields = getProcessedYield(doclet.yields)
|
|
858
|
+
}
|
|
836
859
|
});
|
|
837
860
|
|
|
838
861
|
// update outdir if necessary, then create outdir
|
|
@@ -960,6 +983,7 @@ exports.publish = function (taffyData, opts, tutorials) {
|
|
|
960
983
|
view.htmlsafe = htmlsafe;
|
|
961
984
|
view.outputSourceFiles = outputSourceFiles;
|
|
962
985
|
view.footer = buildFooter();
|
|
986
|
+
view.displayModuleHeader = moduleHeader();
|
|
963
987
|
view.favicon = getFavicon();
|
|
964
988
|
view.dynamicStyle = createDynamicStyleSheet();
|
|
965
989
|
view.dynamicStyleSrc = returnPathOfStyleSrc();
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSizeLocalStorageKey="font-size",html=document.querySelector("html"),MAX_FONT_SIZE=30,MIN_FONT_SIZE=10,localStorage=window.localStorage;function getTheme(){return document.body.getAttribute("data-theme")}function updateTheme(e){var t=document.body,o=document.querySelectorAll(".theme-svg-use"),n="dark"===e?"#light-theme-icon":"#dark-theme-icon";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href",n)}),localStorage.setItem(themeLocalStorageKey,e)}function toggleTheme(){updateTheme("dark"===document.body.getAttribute("data-theme")?"light":"dark")}function setAccordionIdToLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));t[e]=e,localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function removeAccordionIdFromLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));delete t[e],localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function getAccordionIdsFromLocalStorage(){return JSON.parse(localStorage.getItem(accordionLocalStorageKey))||{}}function toggleAccordion(e){"false"===e.getAttribute("data-isopen")?(e.setAttribute("data-isopen","true"),setAccordionIdToLocalStorage(e.id)):(e.setAttribute("data-isopen","false"),removeAccordionIdFromLocalStorage(e.id))}function initAccordion(){void 0!==localStorage.getItem(accordionLocalStorageKey)&&null!==localStorage.getItem(accordionLocalStorageKey)||localStorage.setItem(accordionLocalStorageKey,"{}");var e=document.querySelectorAll(".sidebar-section-title"),t=getAccordionIdsFromLocalStorage();e.forEach(function(e){e.addEventListener("click",function(){toggleAccordion(e)}),e.id in t&&toggleAccordion(e)})}function isSourcePage(){return Boolean(document.querySelector("#source-page"))}function bringElementIntoView(e,t=!0){var o,n,i,c;e&&(tocbotInstance&&setTimeout(()=>tocbotInstance.updateTocListActiveElement(e),60),o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id))}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!1))}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){console.log(e);const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText.trim().replace(/(^\t)/gm,"")),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='<button aria-label="copy code" class="icon-button copy-code" onclick="copyFunction(\''+e+'\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>'+('<div class="tooltip" id="tooltip-'+e+'">Copied!</div>')+"</button>";return'<div class="pre-top-bar-container">'+('<div class="code-lang-name-container"><div class="code-lang-name">'+t.toLocaleUpperCase()+"</div></div>")+e+"</div>"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.appendChild(e))})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function updateFontSize(e){html.style.fontSize=e+"px",localStorage.setItem(fontSizeLocalStorageKey,e);var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function incrementFont(e){var t=getFontSize();t<MAX_FONT_SIZE&&updateFontSize(t+1)}function decrementFont(e){var t=getFontSize();MIN_FONT_SIZE<t&&updateFontSize(t-1)}function fontSizeTooltip(){var e=getFontSize();return`
|
|
2
|
-
<div class="font-size-tooltip">
|
|
3
|
-
<button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
4
|
-
<svg>
|
|
5
|
-
<use xlink:href="#minus-icon"></use>
|
|
6
|
-
</svg>
|
|
7
|
-
</button>
|
|
8
|
-
<div class="font-size-text" id="b77a68a492f343baabea06fad81f651e">
|
|
9
|
-
${e}
|
|
10
|
-
</div>
|
|
11
|
-
<button aria-label="increase-font-size" class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
12
|
-
<svg>
|
|
13
|
-
<use xlink:href="#add-icon"></use>
|
|
14
|
-
</svg>
|
|
15
|
-
</button>
|
|
16
|
-
<button class="icon-button" onclick="updateFontSize(16)">
|
|
17
|
-
<svg>
|
|
18
|
-
<use xlink:href="#reset-icon"></use>
|
|
19
|
-
</svg>
|
|
20
|
-
</button>
|
|
21
|
-
</div>
|
|
22
|
-
|
|
1
|
+
var accordionLocalStorageKey="accordion-id",themeLocalStorageKey="theme",fontSizeLocalStorageKey="font-size",html=document.querySelector("html"),MAX_FONT_SIZE=30,MIN_FONT_SIZE=10,localStorage=window.localStorage;function getTheme(){return document.body.getAttribute("data-theme")}function updateTheme(e){var t=document.body,o=document.querySelectorAll(".theme-svg-use"),n="dark"===e?"#light-theme-icon":"#dark-theme-icon";t.setAttribute("data-theme",e),t.classList.remove("dark","light"),t.classList.add(e),o.forEach(function(e){e.setAttribute("xlink:href",n)}),localStorage.setItem(themeLocalStorageKey,e)}function toggleTheme(){updateTheme("dark"===document.body.getAttribute("data-theme")?"light":"dark")}function setAccordionIdToLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));t[e]=e,localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function removeAccordionIdFromLocalStorage(e){var t=JSON.parse(localStorage.getItem(accordionLocalStorageKey));delete t[e],localStorage.setItem(accordionLocalStorageKey,JSON.stringify(t))}function getAccordionIdsFromLocalStorage(){return JSON.parse(localStorage.getItem(accordionLocalStorageKey))||{}}function toggleAccordion(e){"false"===e.getAttribute("data-isopen")?(e.setAttribute("data-isopen","true"),setAccordionIdToLocalStorage(e.id)):(e.setAttribute("data-isopen","false"),removeAccordionIdFromLocalStorage(e.id))}function initAccordion(){void 0!==localStorage.getItem(accordionLocalStorageKey)&&null!==localStorage.getItem(accordionLocalStorageKey)||localStorage.setItem(accordionLocalStorageKey,"{}");var e=document.querySelectorAll(".sidebar-section-title"),t=getAccordionIdsFromLocalStorage();e.forEach(function(e){e.addEventListener("click",function(){toggleAccordion(e)}),e.id in t&&toggleAccordion(e)})}function isSourcePage(){return Boolean(document.querySelector("#source-page"))}function bringElementIntoView(e,t=!0){var o,n,i,c;e&&(tocbotInstance&&setTimeout(()=>tocbotInstance.updateTocListActiveElement(e),60),o=document.querySelector(".navbar-container"),n=document.querySelector(".main-content"),i=e.getBoundingClientRect().top,c=16,o&&(c+=o.scrollHeight),n&&n.scrollBy(0,i-c),t&&history.pushState(null,null,"#"+e.id))}function bringLinkToView(e){e.preventDefault(),e.stopPropagation();var e=e.currentTarget.getAttribute("href");!e||(e=document.getElementById(e.slice(1)))&&bringElementIntoView(e)}function bringIdToViewOnMount(){var e,t;isSourcePage()||""!==(e=window.location.hash)&&((t=document.getElementById(e.slice(1)))||(e=decodeURI(e),t=document.getElementById(e.slice(1))),t&&bringElementIntoView(t,!1))}function createAnchorElement(e){var t=document.createElement("a");return t.textContent="#",t.href="#"+e,t.classList.add("link-anchor"),t.onclick=bringLinkToView,t}function addAnchor(){var e=document.querySelector(".main-content").querySelector("section");[e.querySelectorAll("h1"),e.querySelectorAll("h2"),e.querySelectorAll("h3"),e.querySelectorAll("h4")].forEach(function(e){e.forEach(function(e){var t=createAnchorElement(e.id);e.classList.add("has-anchor"),e.append(t)})})}function copy(e){console.log(e);const t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}function showTooltip(e){var t=document.getElementById(e);t.classList.add("show-tooltip"),setTimeout(function(){t.classList.remove("show-tooltip")},3e3)}function copyFunction(e){var t=document.getElementById(e);copy((t.querySelector(".linenums")||t.querySelector("code")).innerText.trim().replace(/(^\t)/gm,"")),showTooltip("tooltip-"+e)}function hideTocOnSourcePage(){isSourcePage()&&(document.querySelector(".toc-container").style.display="none")}function getPreTopBar(e,t=""){e='<button aria-label="copy code" class="icon-button copy-code" onclick="copyFunction(\''+e+'\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>'+('<div class="tooltip" id="tooltip-'+e+'">Copied!</div>')+"</button>";return'<div class="pre-top-bar-container">'+('<div class="code-lang-name-container"><div class="code-lang-name">'+t.toLocaleUpperCase()+"</div></div>")+e+"</div>"}function getPreDiv(){var e=document.createElement("div");return e.classList.add("pre-div"),e}function processAllPre(){var e=document.querySelectorAll("pre"),t=document.querySelector("#PeOAagUepe"),o=document.querySelector("#VuAckcnZhf"),n=0,i=0,c=(t&&(i=t.getBoundingClientRect().height),o&&(n=o.getBoundingClientRect().height),window.innerHeight-n-i-250);e.forEach(function(e,t){var o,n=e.parentNode;n&&"true"===n.getAttribute("data-skip-pre-process")||(n=getPreDiv(),o=getPreTopBar(t="ScDloZOMdL"+t,e.getAttribute("data-lang")||"code"),n.innerHTML=o,e.style.maxHeight=c+"px",e.id=t,e.classList.add("prettyprint"),e.parentNode.insertBefore(n,e),n.appendChild(e))})}function highlightAndBringLineIntoView(){var e=window.location.hash.replace("#line","");try{var t='[data-line-number="'+e+'"',o=document.querySelector(t);o.scrollIntoView(),o.parentNode.classList.add("selected")}catch(e){console.error(e)}}function getFontSize(){var e=16;try{e=Number.parseInt(html.style.fontSize.split("px")[0],10)}catch(e){console.log(e)}return e}function updateFontSize(e){html.style.fontSize=e+"px",localStorage.setItem(fontSizeLocalStorageKey,e);var t=document.querySelector("#b77a68a492f343baabea06fad81f651e");t&&(t.innerHTML=e)}function incrementFont(e){var t=getFontSize();t<MAX_FONT_SIZE&&updateFontSize(t+1)}function decrementFont(e){var t=getFontSize();MIN_FONT_SIZE<t&&updateFontSize(t-1)}function fontSizeTooltip(){var e=getFontSize();return`
|
|
2
|
+
<div class="font-size-tooltip">
|
|
3
|
+
<button aria-label="decrease-font-size" class="icon-button ${MAX_FONT_SIZE<=e?"disabled":""}" onclick="decrementFont(event)">
|
|
4
|
+
<svg>
|
|
5
|
+
<use xlink:href="#minus-icon"></use>
|
|
6
|
+
</svg>
|
|
7
|
+
</button>
|
|
8
|
+
<div class="font-size-text" id="b77a68a492f343baabea06fad81f651e">
|
|
9
|
+
${e}
|
|
10
|
+
</div>
|
|
11
|
+
<button aria-label="increase-font-size" class="icon-button ${e<=MIN_FONT_SIZE?"disabled":""}" onclick="incrementFont(event)">
|
|
12
|
+
<svg>
|
|
13
|
+
<use xlink:href="#add-icon"></use>
|
|
14
|
+
</svg>
|
|
15
|
+
</button>
|
|
16
|
+
<button class="icon-button" onclick="updateFontSize(16)">
|
|
17
|
+
<svg>
|
|
18
|
+
<use xlink:href="#reset-icon"></use>
|
|
19
|
+
</svg>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
23
|
`}function initTooltip(){tippy(".theme-toggle",{content:"Toggle Theme",delay:500}),tippy(".search-button",{content:"Search",delay:500}),tippy(".font-size",{content:"Change font size",delay:500}),tippy(".codepen-button",{content:"Open code in CodePen",placement:"left"}),tippy(".copy-code",{content:"Copy this code",placement:"left"}),tippy(".font-size",{content:fontSizeTooltip(),trigger:"click",interactive:!0,allowHTML:!0,placement:"left"})}function fixTable(){var e,t=document.querySelectorAll("table");if(!(900<window.innerWidth))for(e of t){if(e.classList.contains("hljs-ln"))return;var o=document.createElement("div");o.classList.add("table-div"),e.parentNode.insertBefore(o,e),o.appendChild(e)}}function hideMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.remove("show"),t&&t.setAttribute("data-isopen","false"),o&&o.setAttribute("xlink:href","#menu-icon")}function showMobileMenu(){var e=document.querySelector("#mobile-sidebar"),t=document.querySelector("#mobile-menu"),o=t.querySelector("use");e&&e.classList.add("show"),t&&t.setAttribute("data-isopen","true"),o&&o.setAttribute("xlink:href","#close-icon")}function onMobileMenuClick(){("true"===document.querySelector("#mobile-menu").getAttribute("data-isopen")?hideMobileMenu:showMobileMenu)()}function initMobileMenu(){var e=document.querySelector("#mobile-menu");e&&e.addEventListener("click",onMobileMenuClick)}function addHrefToSidebarTitle(){document.querySelectorAll(".sidebar-title-anchor").forEach(function(e){e.setAttribute("href",baseURL)})}function onDomContentLoaded(){var e=document.querySelectorAll(".theme-toggle");initMobileMenu(),e&&e.forEach(function(e){e.addEventListener("click",toggleTheme)}),hljs.addPlugin({"after:highlightElement":function(e){e.el.parentNode.setAttribute("data-lang","code")}}),hljs.highlightAll(),hljs.initLineNumbersOnLoad({singleLine:!0}),initAccordion(),addAnchor(),processAllPre(),hideTocOnSourcePage(),setTimeout(function(){bringIdToViewOnMount(),isSourcePage()&&highlightAndBringLineIntoView()},1e3),initTooltip(),fixTable(),addHrefToSidebarTitle()}!function(){var e=getTheme(),t=localStorage.getItem(themeLocalStorageKey);t?e!==t&&updateTheme(t):localStorage.setItem(themeLocalStorageKey,e)}(),function(){var e=getFontSize(),t=localStorage.getItem(fontSizeLocalStorageKey);t?(t=Number.parseInt(t,10))!==e&&updateFontSize(t):updateFontSize(e)}(),window.addEventListener("DOMContentLoaded",onDomContentLoaded),window.addEventListener("hashchange",e=>{e=new URL(e.newURL);""!==e.hash&&bringIdToViewOnMount(e.hash)});
|
package/tmpl/container.tmpl
CHANGED
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
<?js } ?>
|
|
40
40
|
<?js } else if (doc.kind === 'module' && doc.modules) { ?>
|
|
41
41
|
<?js doc.modules.forEach(function(module) { ?>
|
|
42
|
+
<?js if (module.name && self.displayModuleHeader) { ?>
|
|
43
|
+
<h1 id="<?js= module.name ?>-title" class="has-anchor">
|
|
44
|
+
<?js= module.name ?>
|
|
45
|
+
</h1>
|
|
46
|
+
<?js } ?>
|
|
42
47
|
<?js if (module.classdesc) { ?>
|
|
43
48
|
<div class="class-description"><?js= module.classdesc ?></div>
|
|
44
49
|
<?js } ?>
|
package/tmpl/type.tmpl
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
var self = this;
|
|
4
4
|
data.forEach(function(name, i) { ?>
|
|
5
5
|
<?js
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var text = self.htmlsafe(name)
|
|
7
|
+
text = text.replace(/\|/g,'|<wbr>')
|
|
8
|
+
text = text.replace(/\./g,'.<wbr>')
|
|
9
|
+
var linkto = self.linkto(name, text)
|
|
9
10
|
?>
|
|
10
11
|
<span class="param-type"><?js= linkto ?></span>
|
|
11
12
|
<?js if (i < data.length-1) { ?>|<wbr><?js } ?>
|
|
12
|
-
<?js }); ?>
|
|
13
|
+
<?js }); ?>
|