@forsakringskassan/docs-generator 1.29.2 → 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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var require$$0 = require('@vue/compiler-sfc');
4
- require('./vendor-D7cNMveZ.js');
4
+ require('./vendor-xbC24N4h.js');
5
5
 
6
6
  var __create = Object.create;
7
7
  var __defProp = Object.defineProperty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/docs-generator",
3
- "version": "1.29.2",
3
+ "version": "1.30.1",
4
4
  "description": "Documentation generator",
5
5
  "keywords": [
6
6
  "documentation"
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "livereload-js": "4.0.2",
55
55
  "nunjucks": "3.2.4",
56
- "piscina": "4.5.0",
56
+ "piscina": "4.5.1",
57
57
  "vue-docgen-api": "4.78.0"
58
58
  },
59
59
  "peerDependencies": {
@@ -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
- <a href="{{ item.path | relative(doc) }}" {% if item.external %} target="_blank" rel="external" {% endif %}>
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" data-root-url="{{ rootUrl(doc) }}">
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,10 +1,10 @@
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">
6
- <option value="exp">Externportal</option>
7
- <option value="int">Intern</option>
6
+ <option value="exp">Försäkringskassan</option>
7
+ <option value="int">FK Hapo</option>
8
8
  </select>
9
9
  <svg focusable="false" class="icon select-field__icon">
10
10
  <use xlink:href="#docs-icon-arrow-down"></use>
@@ -14,20 +14,12 @@
14
14
 
15
15
  <script>
16
16
  function themeSelector() {
17
- const cookieName = "fkds-theme";
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 setCookie(key, value) {
30
- document.cookie = `${key}=${value}; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=strict`;
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
- setCookie(cookieName, theme);
36
+ saveSelectedTheme("{{ sessionKey }}", theme);
45
37
  enableTheme(theme);
46
38
  });
47
39
 
48
- const selected = getCookie(cookieName) || "exp";
40
+ const selected = getSelectedTheme("{{ sessionKey }}");
49
41
  enableTheme(selected);
50
42
  el.value = selected;
51
43
 
52
- wrapper.hidden = false;
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
- onContentReady(themeSelector);
47
+ themeSelector();
67
48
  </script>
68
49
  </div>