@forsakringskassan/devindex-menu 2.3.5 → 2.3.7

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/cjs/menu.js CHANGED
@@ -28,7 +28,7 @@ __export(menu_exports, {
28
28
  module.exports = __toCommonJS(menu_exports);
29
29
 
30
30
  // raw-loader:./client.js?raw
31
- var client_default = '/**\n * @param {string} cookieName\n * @param {string} cookieValue\n * @param {number} exdays\n * @returns {void}\n */\nfunction setCookie(cookieName, cookieValue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n /* eslint-disable-next-line unicorn/no-document-cookie -- technical debt, should use CookieStore */\n document.cookie = `${cookieName}=${cookieValue};${expires};path=/`;\n}\n\n/**\n * @param {string} cookieName\n * @returns {string | undefined}\n */\nfunction getCookie(cookieName) {\n const name = `${cookieName}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(";");\n for (let c of ca) {\n while (c.charAt(0) === " ") {\n c = c.slice(1);\n }\n if (c.indexOf(name) === 0) {\n return c.slice(name.length);\n }\n }\n return undefined;\n}\n(function () {\n /** @type {NodeListOf<HTMLSelectElement>} */\n const selections = document.querySelectorAll(".secret-menu select");\n for (const select of selections) {\n select.value = getCookie(select.name) ? getCookie(select.name) : "default";\n if (select.dataset.sessionstorage === "true") {\n const cookieValue = getCookie(select.name);\n if (cookieValue) {\n sessionStorage.setItem(select.name, atob(cookieValue));\n }\n }\n select.addEventListener("change", function (event) {\n const element = event.target;\n setCookie(element.name, element.value, 30);\n if (element.dataset.execOnChange) {\n window[element.dataset.execOnChange]();\n }\n if (element.dataset.reload === "true") {\n location.reload(true);\n }\n if (element.dataset.sessionstorage === "true") {\n const sessionKey = element.id;\n if (element.value) {\n const value = atob(element.value);\n console.log(`Laddar sessionstorage ${sessionKey} med \\n ${value}`);\n sessionStorage.setItem(sessionKey, value);\n } else {\n console.log(`T\xF6mmer sessionstorage`);\n sessionStorage.removeItem(sessionKey);\n }\n location.reload(true);\n }\n });\n }\n\n /* Forcerar att sidan laddas om, \xE4ven n\xE4r l\xE4nken \xE4r av typen: /#/granska/8 */\n /** @type {NodeListOf<HTMLAnchorElement>} */\n const links = document.querySelectorAll(".secret-menu ul li a");\n for (const link of links) {\n if (link.getAttribute("href").startsWith("/#")) {\n /**\n * @param {MouseEvent} event\n */\n link.addEventListener("click", function (event) {\n event.preventDefault();\n window.location.href = event.target.getAttribute("href");\n setTimeout(() => {\n console.log("Reload after click on hash-link.");\n location.reload();\n }, "500");\n });\n }\n }\n})();\nfunction toggleMenu() {\n const menu = document.querySelector(".secret-menu");\n menu.classList.toggle("open");\n}\nwindow.toggleMenu = toggleMenu;';
31
+ var client_default = '/**\n * @param {string} cookieName\n * @param {string} cookieValue\n * @param {number} exdays\n * @returns {void}\n */\nfunction setCookie(cookieName, cookieValue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n /* eslint-disable-next-line unicorn/no-document-cookie -- technical debt, should use CookieStore */\n document.cookie = `${cookieName}=${cookieValue};${expires};path=/`;\n}\n\n/**\n * @param {string} cookieName\n * @returns {string | undefined}\n */\nfunction getCookie(cookieName) {\n const name = `${cookieName}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(";");\n for (let c of ca) {\n while (c.charAt(0) === " ") {\n c = c.slice(1);\n }\n if (c.indexOf(name) === 0) {\n return c.slice(name.length);\n }\n }\n return undefined;\n}\n{\n /** @type {NodeListOf<HTMLSelectElement>} */\n const selections = document.querySelectorAll(".secret-menu select");\n for (const select of selections) {\n select.value = getCookie(select.name) ?? "default";\n if (select.dataset.sessionstorage === "true") {\n const cookieValue = getCookie(select.name);\n if (cookieValue) {\n sessionStorage.setItem(select.name, atob(cookieValue));\n }\n }\n select.addEventListener("change", function (event) {\n const element = event.target;\n setCookie(element.name, element.value, 30);\n if (element.dataset.execOnChange) {\n window[element.dataset.execOnChange]();\n }\n if (element.dataset.reload === "true") {\n location.reload(true);\n }\n if (element.dataset.sessionstorage === "true") {\n const sessionKey = element.id;\n if (element.value) {\n const value = atob(element.value);\n console.log(`Laddar sessionstorage ${sessionKey} med \\n ${value}`);\n sessionStorage.setItem(sessionKey, value);\n } else {\n console.log(`T\xF6mmer sessionstorage`);\n sessionStorage.removeItem(sessionKey);\n }\n location.reload(true);\n }\n });\n }\n\n /* Forcerar att sidan laddas om, \xE4ven n\xE4r l\xE4nken \xE4r av typen: /#/granska/8 */\n /** @type {NodeListOf<HTMLAnchorElement>} */\n const links = document.querySelectorAll(".secret-menu ul li a");\n for (const link of links) {\n if (link.getAttribute("href").startsWith("/#")) {\n /**\n * @param {MouseEvent} event\n */\n link.addEventListener("click", function (event) {\n event.preventDefault();\n window.location.assign(event.target.getAttribute("href"));\n setTimeout(() => {\n console.log("Reload after click on hash-link.");\n location.reload();\n }, "500");\n });\n }\n }\n}\nfunction toggleMenu() {\n const menu = document.querySelector(".secret-menu");\n menu.classList.toggle("open");\n}\n\n/* eslint-disable-next-line unicorn/no-global-object-property-assignment -- technical debt */\nwindow.toggleMenu = toggleMenu;';
32
32
 
33
33
  // node_modules/@fkui/logic/lib/esm/index.js
34
34
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -1334,9 +1334,8 @@ function evaluateMock(mock) {
1334
1334
  if (typeof mock === "function") {
1335
1335
  const req = {};
1336
1336
  return mock(req);
1337
- } else {
1338
- return mock;
1339
1337
  }
1338
+ return mock;
1340
1339
  }
1341
1340
  function generateOptionMarkupForSelect(setting) {
1342
1341
  const reload = setting.reloadOnChange ?? true;
@@ -1348,7 +1347,7 @@ function generateOptionMarkupForSelect(setting) {
1348
1347
  const optionValue = setting.sessionStorage ? btoa(stateJson) : option.value;
1349
1348
  markup += `<option value="${optionValue}">${option.title}</option>`;
1350
1349
  }
1351
- markup = `${markup}</select>`;
1350
+ markup += `</select>`;
1352
1351
  return markup;
1353
1352
  }
1354
1353
  function generateOptionMarkupForLink(setting) {
@@ -1357,7 +1356,7 @@ function generateOptionMarkupForLink(setting) {
1357
1356
  for (const option of setting.options) {
1358
1357
  markup += `<li><a href="${option.href}" tabindex="-1">${option.title}</a></li>`;
1359
1358
  }
1360
- markup = `${markup}</ul>`;
1359
+ markup += `</ul>`;
1361
1360
  return markup;
1362
1361
  }
1363
1362
  function generateOptionMarkup(setting) {
@@ -1427,11 +1426,12 @@ var menu_default = (userSettingsAndMocks, menuOptions) => {
1427
1426
  `
1428
1427
  );
1429
1428
  let settingsMarkup = "";
1430
- for (const userSetting of userSettingsAndMocks.map(
1431
- (userSettingOrMock) => isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock
1432
- )) {
1429
+ const userSettings = userSettingsAndMocks.map((userSettingOrMock) => {
1430
+ return isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock;
1431
+ });
1432
+ for (const userSetting of userSettings) {
1433
1433
  const setting = { ...defaultSetting, ...userSetting };
1434
- settingsMarkup = settingsMarkup + generateOptionMarkup(setting);
1434
+ settingsMarkup += generateOptionMarkup(setting);
1435
1435
  }
1436
1436
  document.body.insertAdjacentHTML(
1437
1437
  "beforeend",
package/dist/esm/menu.js CHANGED
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
 
5
5
  // raw-loader:./client.js?raw
6
- var client_default = '/**\n * @param {string} cookieName\n * @param {string} cookieValue\n * @param {number} exdays\n * @returns {void}\n */\nfunction setCookie(cookieName, cookieValue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n /* eslint-disable-next-line unicorn/no-document-cookie -- technical debt, should use CookieStore */\n document.cookie = `${cookieName}=${cookieValue};${expires};path=/`;\n}\n\n/**\n * @param {string} cookieName\n * @returns {string | undefined}\n */\nfunction getCookie(cookieName) {\n const name = `${cookieName}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(";");\n for (let c of ca) {\n while (c.charAt(0) === " ") {\n c = c.slice(1);\n }\n if (c.indexOf(name) === 0) {\n return c.slice(name.length);\n }\n }\n return undefined;\n}\n(function () {\n /** @type {NodeListOf<HTMLSelectElement>} */\n const selections = document.querySelectorAll(".secret-menu select");\n for (const select of selections) {\n select.value = getCookie(select.name) ? getCookie(select.name) : "default";\n if (select.dataset.sessionstorage === "true") {\n const cookieValue = getCookie(select.name);\n if (cookieValue) {\n sessionStorage.setItem(select.name, atob(cookieValue));\n }\n }\n select.addEventListener("change", function (event) {\n const element = event.target;\n setCookie(element.name, element.value, 30);\n if (element.dataset.execOnChange) {\n window[element.dataset.execOnChange]();\n }\n if (element.dataset.reload === "true") {\n location.reload(true);\n }\n if (element.dataset.sessionstorage === "true") {\n const sessionKey = element.id;\n if (element.value) {\n const value = atob(element.value);\n console.log(`Laddar sessionstorage ${sessionKey} med \\n ${value}`);\n sessionStorage.setItem(sessionKey, value);\n } else {\n console.log(`T\xF6mmer sessionstorage`);\n sessionStorage.removeItem(sessionKey);\n }\n location.reload(true);\n }\n });\n }\n\n /* Forcerar att sidan laddas om, \xE4ven n\xE4r l\xE4nken \xE4r av typen: /#/granska/8 */\n /** @type {NodeListOf<HTMLAnchorElement>} */\n const links = document.querySelectorAll(".secret-menu ul li a");\n for (const link of links) {\n if (link.getAttribute("href").startsWith("/#")) {\n /**\n * @param {MouseEvent} event\n */\n link.addEventListener("click", function (event) {\n event.preventDefault();\n window.location.href = event.target.getAttribute("href");\n setTimeout(() => {\n console.log("Reload after click on hash-link.");\n location.reload();\n }, "500");\n });\n }\n }\n})();\nfunction toggleMenu() {\n const menu = document.querySelector(".secret-menu");\n menu.classList.toggle("open");\n}\nwindow.toggleMenu = toggleMenu;';
6
+ var client_default = '/**\n * @param {string} cookieName\n * @param {string} cookieValue\n * @param {number} exdays\n * @returns {void}\n */\nfunction setCookie(cookieName, cookieValue, exdays) {\n const d = new Date();\n d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);\n const expires = `expires=${d.toUTCString()}`;\n /* eslint-disable-next-line unicorn/no-document-cookie -- technical debt, should use CookieStore */\n document.cookie = `${cookieName}=${cookieValue};${expires};path=/`;\n}\n\n/**\n * @param {string} cookieName\n * @returns {string | undefined}\n */\nfunction getCookie(cookieName) {\n const name = `${cookieName}=`;\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(";");\n for (let c of ca) {\n while (c.charAt(0) === " ") {\n c = c.slice(1);\n }\n if (c.indexOf(name) === 0) {\n return c.slice(name.length);\n }\n }\n return undefined;\n}\n{\n /** @type {NodeListOf<HTMLSelectElement>} */\n const selections = document.querySelectorAll(".secret-menu select");\n for (const select of selections) {\n select.value = getCookie(select.name) ?? "default";\n if (select.dataset.sessionstorage === "true") {\n const cookieValue = getCookie(select.name);\n if (cookieValue) {\n sessionStorage.setItem(select.name, atob(cookieValue));\n }\n }\n select.addEventListener("change", function (event) {\n const element = event.target;\n setCookie(element.name, element.value, 30);\n if (element.dataset.execOnChange) {\n window[element.dataset.execOnChange]();\n }\n if (element.dataset.reload === "true") {\n location.reload(true);\n }\n if (element.dataset.sessionstorage === "true") {\n const sessionKey = element.id;\n if (element.value) {\n const value = atob(element.value);\n console.log(`Laddar sessionstorage ${sessionKey} med \\n ${value}`);\n sessionStorage.setItem(sessionKey, value);\n } else {\n console.log(`T\xF6mmer sessionstorage`);\n sessionStorage.removeItem(sessionKey);\n }\n location.reload(true);\n }\n });\n }\n\n /* Forcerar att sidan laddas om, \xE4ven n\xE4r l\xE4nken \xE4r av typen: /#/granska/8 */\n /** @type {NodeListOf<HTMLAnchorElement>} */\n const links = document.querySelectorAll(".secret-menu ul li a");\n for (const link of links) {\n if (link.getAttribute("href").startsWith("/#")) {\n /**\n * @param {MouseEvent} event\n */\n link.addEventListener("click", function (event) {\n event.preventDefault();\n window.location.assign(event.target.getAttribute("href"));\n setTimeout(() => {\n console.log("Reload after click on hash-link.");\n location.reload();\n }, "500");\n });\n }\n }\n}\nfunction toggleMenu() {\n const menu = document.querySelector(".secret-menu");\n menu.classList.toggle("open");\n}\n\n/* eslint-disable-next-line unicorn/no-global-object-property-assignment -- technical debt */\nwindow.toggleMenu = toggleMenu;';
7
7
 
8
8
  // node_modules/@fkui/logic/lib/esm/index.js
9
9
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -1309,9 +1309,8 @@ function evaluateMock(mock) {
1309
1309
  if (typeof mock === "function") {
1310
1310
  const req = {};
1311
1311
  return mock(req);
1312
- } else {
1313
- return mock;
1314
1312
  }
1313
+ return mock;
1315
1314
  }
1316
1315
  function generateOptionMarkupForSelect(setting) {
1317
1316
  const reload = setting.reloadOnChange ?? true;
@@ -1323,7 +1322,7 @@ function generateOptionMarkupForSelect(setting) {
1323
1322
  const optionValue = setting.sessionStorage ? btoa(stateJson) : option.value;
1324
1323
  markup += `<option value="${optionValue}">${option.title}</option>`;
1325
1324
  }
1326
- markup = `${markup}</select>`;
1325
+ markup += `</select>`;
1327
1326
  return markup;
1328
1327
  }
1329
1328
  function generateOptionMarkupForLink(setting) {
@@ -1332,7 +1331,7 @@ function generateOptionMarkupForLink(setting) {
1332
1331
  for (const option of setting.options) {
1333
1332
  markup += `<li><a href="${option.href}" tabindex="-1">${option.title}</a></li>`;
1334
1333
  }
1335
- markup = `${markup}</ul>`;
1334
+ markup += `</ul>`;
1336
1335
  return markup;
1337
1336
  }
1338
1337
  function generateOptionMarkup(setting) {
@@ -1402,11 +1401,12 @@ var menu_default = (userSettingsAndMocks, menuOptions) => {
1402
1401
  `
1403
1402
  );
1404
1403
  let settingsMarkup = "";
1405
- for (const userSetting of userSettingsAndMocks.map(
1406
- (userSettingOrMock) => isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock
1407
- )) {
1404
+ const userSettings = userSettingsAndMocks.map((userSettingOrMock) => {
1405
+ return isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock;
1406
+ });
1407
+ for (const userSetting of userSettings) {
1408
1408
  const setting = { ...defaultSetting, ...userSetting };
1409
- settingsMarkup = settingsMarkup + generateOptionMarkup(setting);
1409
+ settingsMarkup += generateOptionMarkup(setting);
1410
1410
  }
1411
1411
  document.body.insertAdjacentHTML(
1412
1412
  "beforeend",
@@ -48,7 +48,7 @@ export declare const ONE_MONTH_IN_SECONDS = 2592000;
48
48
  /**
49
49
  * @param userSettingsAndMocks - An array of user settings and/or mocks to generate the menu from.
50
50
  */
51
- declare const _default: (userSettingsAndMocks: Array<Settings | Mock>, menuOptions?: MenuOptions) => void;
51
+ declare function _default(userSettingsAndMocks: Array<Settings | Mock>, menuOptions?: MenuOptions): void;
52
52
 
53
53
  export {
54
54
  _default as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/devindex-menu",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "Menu for local development",
5
5
  "keywords": [
6
6
  "development",
@@ -53,31 +53,32 @@
53
53
  "extends": "@forsakringskassan/semantic-release-config"
54
54
  },
55
55
  "dependencies": {
56
- "@fkui/logic": "6.51.0"
56
+ "@fkui/logic": "6.52.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@babel/core": "8.0.1",
60
60
  "@babel/preset-env": "8.0.2",
61
- "@fkui/tsconfig": "6.51.0",
61
+ "@fkui/tsconfig": "6.52.0",
62
62
  "@forsakringskassan/apimock-express": "3.0.0",
63
- "@forsakringskassan/commitlint-config": "4.1.1",
64
- "@forsakringskassan/eslint-config": "15.1.0",
65
- "@forsakringskassan/eslint-config-cli": "15.1.0",
66
- "@forsakringskassan/eslint-config-cypress": "15.1.0",
67
- "@forsakringskassan/eslint-config-jest": "15.1.0",
68
- "@forsakringskassan/eslint-config-typescript": "15.1.0",
69
- "@forsakringskassan/eslint-config-typescript-typeinfo": "15.1.0",
70
- "@forsakringskassan/prettier-config": "3.7.2",
63
+ "@forsakringskassan/commitlint-config": "4.2.1",
64
+ "@forsakringskassan/eslint-config": "15.3.11",
65
+ "@forsakringskassan/eslint-config-cli": "15.3.0",
66
+ "@forsakringskassan/eslint-config-cypress": "15.3.10",
67
+ "@forsakringskassan/eslint-config-jest": "15.3.2",
68
+ "@forsakringskassan/eslint-config-typescript": "15.3.8",
69
+ "@forsakringskassan/eslint-config-typescript-typeinfo": "15.3.8",
70
+ "@forsakringskassan/prettier-config": "3.7.7",
71
71
  "@tsconfig/node22": "22.0.5",
72
- "@types/node": "22.20.0",
73
- "cypress": "15.17.0",
72
+ "@types/node": "22.20.1",
73
+ "@typescript/native": "npm:typescript@7.0.2",
74
+ "cypress": "15.18.1",
74
75
  "cypress-html-validate": "9.0.0",
75
76
  "dts-bundle-generator": "9.5.1",
76
77
  "esbuild": "0.28.1",
77
78
  "esbuild-sass-plugin": "3.7.0",
78
- "npm-pkg-lint": "5.1.8",
79
+ "npm-pkg-lint": "5.1.11",
79
80
  "sass": "1.101.0",
80
- "typescript": "6.0.3"
81
+ "typescript": "npm:@typescript/typescript6@6.0.2"
81
82
  },
82
83
  "engines": {
83
84
  "node": "^22.16 || >= 24"