@forsakringskassan/docs-generator 1.30.0 → 1.30.1
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/dist/index.js +17 -9
- package/dist/runtime.js +13 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +1 -1
- package/templates/base.template.html +1 -1
- package/templates/macro/menu.html +9 -1
- package/templates/partials/search-toolbar.html +1 -1
- package/templates/partials/theme-render-blocker.html +11 -0
- package/templates/partials/theme-select.html +10 -29
package/dist/index.js
CHANGED
|
@@ -1240,6 +1240,11 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
1240
1240
|
site: options.site,
|
|
1241
1241
|
doc,
|
|
1242
1242
|
topnav,
|
|
1243
|
+
rootUrl(doc2) {
|
|
1244
|
+
const { fileInfo: fileInfo2 } = doc2;
|
|
1245
|
+
const relative = path$1.relative(fileInfo2.path, ".");
|
|
1246
|
+
return relative !== "" ? relative : ".";
|
|
1247
|
+
},
|
|
1243
1248
|
sidenav,
|
|
1244
1249
|
vendors
|
|
1245
1250
|
};
|
|
@@ -2063,8 +2068,18 @@ function themeSelectProcessor() {
|
|
|
2063
2068
|
name: "theme-select-processor",
|
|
2064
2069
|
after: "generate-docs",
|
|
2065
2070
|
handler(context) {
|
|
2071
|
+
const sessionKey = "fkds-theme";
|
|
2072
|
+
const data = {
|
|
2073
|
+
defaultTheme: "exp",
|
|
2074
|
+
sessionKey
|
|
2075
|
+
};
|
|
2076
|
+
context.addTemplateBlock("head", "theme-render-blocker", {
|
|
2077
|
+
filename: "partials/theme-render-blocker.html",
|
|
2078
|
+
data
|
|
2079
|
+
});
|
|
2066
2080
|
context.addTemplateBlock("toolbar", "theme-select", {
|
|
2067
|
-
filename: "partials/theme-select.html"
|
|
2081
|
+
filename: "partials/theme-select.html",
|
|
2082
|
+
data
|
|
2068
2083
|
});
|
|
2069
2084
|
}
|
|
2070
2085
|
};
|
|
@@ -2277,14 +2292,7 @@ function searchProcessor() {
|
|
|
2277
2292
|
}
|
|
2278
2293
|
});
|
|
2279
2294
|
context.addTemplateBlock("toolbar", "search-toolbar", {
|
|
2280
|
-
filename: "partials/search-toolbar.html"
|
|
2281
|
-
data: {
|
|
2282
|
-
rootUrl(doc) {
|
|
2283
|
-
const { fileInfo } = doc;
|
|
2284
|
-
const relative = path$1.relative(fileInfo.path, ".");
|
|
2285
|
-
return relative !== "" ? relative : ".";
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2295
|
+
filename: "partials/search-toolbar.html"
|
|
2288
2296
|
});
|
|
2289
2297
|
context.addTemplateBlock("body:end", "search-dialog", {
|
|
2290
2298
|
filename: "partials/search-dialog.html"
|
package/dist/runtime.js
CHANGED
|
@@ -203810,6 +203810,7 @@ async function replaceContent(href) {
|
|
|
203810
203810
|
const body = await response.text();
|
|
203811
203811
|
const doc = parser20.parseFromString(body, "text/html");
|
|
203812
203812
|
const sidenav = doc.querySelector("#sidenav");
|
|
203813
|
+
const rootUrl = doc.documentElement.dataset.rootUrl;
|
|
203813
203814
|
const selector = response.ok && sidenav ? "main" : "body";
|
|
203814
203815
|
const header2 = doc.querySelector("header");
|
|
203815
203816
|
const headerTarget = document.querySelector("header");
|
|
@@ -203822,6 +203823,17 @@ async function replaceContent(href) {
|
|
|
203822
203823
|
cloneScripts(importedHeader, href);
|
|
203823
203824
|
headerTarget.replaceWith(importedHeader);
|
|
203824
203825
|
}
|
|
203826
|
+
const anchorSelector = "#sidenav li.link a";
|
|
203827
|
+
const anchorLinks = document.querySelectorAll(anchorSelector);
|
|
203828
|
+
for (const link2 of anchorLinks) {
|
|
203829
|
+
const { rel: rel2 } = link2;
|
|
203830
|
+
if (rel2 !== "external") {
|
|
203831
|
+
continue;
|
|
203832
|
+
}
|
|
203833
|
+
const path4 = link2.dataset.path ?? ".";
|
|
203834
|
+
link2.setAttribute("href", [rootUrl, path4].join("/"));
|
|
203835
|
+
}
|
|
203836
|
+
document.documentElement.dataset.rootUrl = rootUrl;
|
|
203825
203837
|
document.title = doc.title;
|
|
203826
203838
|
target.replaceWith(element2);
|
|
203827
203839
|
}
|
|
@@ -204678,7 +204690,6 @@ var results = document.querySelector("#search-results");
|
|
|
204678
204690
|
var index2 = null;
|
|
204679
204691
|
var searchTerm = "";
|
|
204680
204692
|
var active = 0;
|
|
204681
|
-
var rootUrl = button.dataset.rootUrl;
|
|
204682
204693
|
var uf = new uFuzzy({
|
|
204683
204694
|
intraIns: Infinity
|
|
204684
204695
|
});
|
|
@@ -204695,6 +204706,7 @@ function updateResults() {
|
|
|
204695
204706
|
const info3 = uf.info(idxs, index2.terms, searchTerm);
|
|
204696
204707
|
const order2 = uf.sort(info3, index2.terms, searchTerm);
|
|
204697
204708
|
active = 0;
|
|
204709
|
+
const rootUrl = document.documentElement.dataset.rootUrl ?? ".";
|
|
204698
204710
|
const ul = document.createElement("ul");
|
|
204699
204711
|
ul.classList.add("list");
|
|
204700
204712
|
for (let i2 = 0; i2 < order2.length; i2++) {
|
package/dist/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="{{ site.lang }}" class="layout--{{ doc.template }}">
|
|
2
|
+
<html lang="{{ site.lang }}" class="layout--{{ doc.template }}" data-root-url="{{ rootUrl(doc) }}">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
@@ -21,7 +21,15 @@
|
|
|
21
21
|
{# leaf node #}
|
|
22
22
|
{%- if not item.children -%}
|
|
23
23
|
<li class="link {% if item.active %}active{% endif %}">
|
|
24
|
-
|
|
24
|
+
<!-- prettier-ignore -->
|
|
25
|
+
<a
|
|
26
|
+
href="{{ item.path | relative(doc) }}"
|
|
27
|
+
{% if item.external %}
|
|
28
|
+
target="_blank"
|
|
29
|
+
rel="external"
|
|
30
|
+
data-path="{{ item.path.startsWith('/') and item.path.slice(1) or item.path }}"
|
|
31
|
+
{% endif %}
|
|
32
|
+
>
|
|
25
33
|
{{ item.title }}
|
|
26
34
|
</a>
|
|
27
35
|
</li>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="toolbar__item">
|
|
2
|
-
<form id="search" role="search"
|
|
2
|
+
<form id="search" role="search">
|
|
3
3
|
<button class="text-field__input" type="submit">
|
|
4
4
|
<svg focusable="false" class="icon button__icon">
|
|
5
5
|
<use xlink:href="#docs-icon-search"></use></svg
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
function themeRenderBlocker() {
|
|
3
|
+
const theme = window.localStorage.getItem("{{ sessionKey }}") ?? "{{ defaultTheme }}";
|
|
4
|
+
const style = Array.from(document.querySelectorAll("[data-theme]"));
|
|
5
|
+
for (const el of style) {
|
|
6
|
+
el.disabled = el.dataset.theme !== theme;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
themeRenderBlocker();
|
|
11
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="toolbar__item">
|
|
2
|
-
<div class="select-field" hidden>
|
|
2
|
+
<div class="select-field" style="visibility: hidden">
|
|
3
3
|
<label for="fkds-theme-select" class="label sr-only"> Tema </label>
|
|
4
4
|
<div class="select-field__icon-wrapper">
|
|
5
5
|
<select id="fkds-theme-select" class="select-field__select">
|
|
@@ -14,20 +14,12 @@
|
|
|
14
14
|
|
|
15
15
|
<script>
|
|
16
16
|
function themeSelector() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function getCookie(key) {
|
|
20
|
-
const cookie = document.cookie.split("; ").find((item) => item.trim().startsWith(`${key}=`));
|
|
21
|
-
if (cookie) {
|
|
22
|
-
const [, value] = cookie.split("=", 2);
|
|
23
|
-
return value;
|
|
24
|
-
} else {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
17
|
+
function getSelectedTheme(key) {
|
|
18
|
+
return window.localStorage.getItem(key) ?? "{{ defaultTheme }}";
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
function
|
|
30
|
-
|
|
21
|
+
function saveSelectedTheme(key, value) {
|
|
22
|
+
window.localStorage.setItem(key, value);
|
|
31
23
|
}
|
|
32
24
|
|
|
33
25
|
function enableTheme(theme) {
|
|
@@ -38,31 +30,20 @@
|
|
|
38
30
|
}
|
|
39
31
|
|
|
40
32
|
const el = document.querySelector("#fkds-theme-select");
|
|
41
|
-
const wrapper = el.closest(".select-field");
|
|
33
|
+
const wrapper = /** @type {HTMLElement} */ (el.closest(".select-field"));
|
|
42
34
|
el.addEventListener("change", () => {
|
|
43
35
|
const theme = el.value;
|
|
44
|
-
|
|
36
|
+
saveSelectedTheme("{{ sessionKey }}", theme);
|
|
45
37
|
enableTheme(theme);
|
|
46
38
|
});
|
|
47
39
|
|
|
48
|
-
const selected =
|
|
40
|
+
const selected = getSelectedTheme("{{ sessionKey }}");
|
|
49
41
|
enableTheme(selected);
|
|
50
42
|
el.value = selected;
|
|
51
43
|
|
|
52
|
-
wrapper.
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* technical debt, this entire script should be moved to src/runtime and
|
|
56
|
-
* import this function instead */
|
|
57
|
-
function onContentReady(callback) {
|
|
58
|
-
const { readyState } = document;
|
|
59
|
-
if (readyState === "complete" || readyState === "interactive") {
|
|
60
|
-
setTimeout(callback, 0);
|
|
61
|
-
} else {
|
|
62
|
-
document.addEventListener("DOMContentLoaded", callback);
|
|
63
|
-
}
|
|
44
|
+
wrapper.style.visibility = null;
|
|
64
45
|
}
|
|
65
46
|
|
|
66
|
-
|
|
47
|
+
themeSelector();
|
|
67
48
|
</script>
|
|
68
49
|
</div>
|