@forsakringskassan/devindex-menu 2.3.6 → 2.3.8
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 +16 -15
- package/dist/esm/menu.js +16 -15
- package/dist/types/menu.d.ts +1 -1
- package/package.json +17 -16
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
|
|
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 : {};
|
|
@@ -1129,13 +1129,14 @@ var ElementIdServiceImpl = class {
|
|
|
1129
1129
|
var ElementIdService = /* @__PURE__ */ new ElementIdServiceImpl();
|
|
1130
1130
|
var wrapper;
|
|
1131
1131
|
function createScreenReaderWrapper(options) {
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1134
|
-
wrapper.id = "fkui-alert-screen-reader";
|
|
1135
|
-
wrapper.className = "sr-only";
|
|
1136
|
-
updateProperties(options);
|
|
1137
|
-
document.body.append(wrapper);
|
|
1132
|
+
if (getWrapper()) {
|
|
1133
|
+
return;
|
|
1138
1134
|
}
|
|
1135
|
+
wrapper = document.createElement("div");
|
|
1136
|
+
wrapper.id = "fkui-alert-screen-reader";
|
|
1137
|
+
wrapper.className = "sr-only";
|
|
1138
|
+
updateProperties(options);
|
|
1139
|
+
document.body.append(wrapper);
|
|
1139
1140
|
}
|
|
1140
1141
|
function updateProperties(options) {
|
|
1141
1142
|
const wrapper2 = getWrapper();
|
|
@@ -1334,9 +1335,8 @@ function evaluateMock(mock) {
|
|
|
1334
1335
|
if (typeof mock === "function") {
|
|
1335
1336
|
const req = {};
|
|
1336
1337
|
return mock(req);
|
|
1337
|
-
} else {
|
|
1338
|
-
return mock;
|
|
1339
1338
|
}
|
|
1339
|
+
return mock;
|
|
1340
1340
|
}
|
|
1341
1341
|
function generateOptionMarkupForSelect(setting) {
|
|
1342
1342
|
const reload = setting.reloadOnChange ?? true;
|
|
@@ -1348,7 +1348,7 @@ function generateOptionMarkupForSelect(setting) {
|
|
|
1348
1348
|
const optionValue = setting.sessionStorage ? btoa(stateJson) : option.value;
|
|
1349
1349
|
markup += `<option value="${optionValue}">${option.title}</option>`;
|
|
1350
1350
|
}
|
|
1351
|
-
markup
|
|
1351
|
+
markup += `</select>`;
|
|
1352
1352
|
return markup;
|
|
1353
1353
|
}
|
|
1354
1354
|
function generateOptionMarkupForLink(setting) {
|
|
@@ -1357,7 +1357,7 @@ function generateOptionMarkupForLink(setting) {
|
|
|
1357
1357
|
for (const option of setting.options) {
|
|
1358
1358
|
markup += `<li><a href="${option.href}" tabindex="-1">${option.title}</a></li>`;
|
|
1359
1359
|
}
|
|
1360
|
-
markup
|
|
1360
|
+
markup += `</ul>`;
|
|
1361
1361
|
return markup;
|
|
1362
1362
|
}
|
|
1363
1363
|
function generateOptionMarkup(setting) {
|
|
@@ -1427,11 +1427,12 @@ var menu_default = (userSettingsAndMocks, menuOptions) => {
|
|
|
1427
1427
|
`
|
|
1428
1428
|
);
|
|
1429
1429
|
let settingsMarkup = "";
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
)
|
|
1430
|
+
const userSettings = userSettingsAndMocks.map((userSettingOrMock) => {
|
|
1431
|
+
return isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock;
|
|
1432
|
+
});
|
|
1433
|
+
for (const userSetting of userSettings) {
|
|
1433
1434
|
const setting = { ...defaultSetting, ...userSetting };
|
|
1434
|
-
settingsMarkup
|
|
1435
|
+
settingsMarkup += generateOptionMarkup(setting);
|
|
1435
1436
|
}
|
|
1436
1437
|
document.body.insertAdjacentHTML(
|
|
1437
1438
|
"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
|
|
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 : {};
|
|
@@ -1104,13 +1104,14 @@ var ElementIdServiceImpl = class {
|
|
|
1104
1104
|
var ElementIdService = /* @__PURE__ */ new ElementIdServiceImpl();
|
|
1105
1105
|
var wrapper;
|
|
1106
1106
|
function createScreenReaderWrapper(options) {
|
|
1107
|
-
if (
|
|
1108
|
-
|
|
1109
|
-
wrapper.id = "fkui-alert-screen-reader";
|
|
1110
|
-
wrapper.className = "sr-only";
|
|
1111
|
-
updateProperties(options);
|
|
1112
|
-
document.body.append(wrapper);
|
|
1107
|
+
if (getWrapper()) {
|
|
1108
|
+
return;
|
|
1113
1109
|
}
|
|
1110
|
+
wrapper = document.createElement("div");
|
|
1111
|
+
wrapper.id = "fkui-alert-screen-reader";
|
|
1112
|
+
wrapper.className = "sr-only";
|
|
1113
|
+
updateProperties(options);
|
|
1114
|
+
document.body.append(wrapper);
|
|
1114
1115
|
}
|
|
1115
1116
|
function updateProperties(options) {
|
|
1116
1117
|
const wrapper2 = getWrapper();
|
|
@@ -1309,9 +1310,8 @@ function evaluateMock(mock) {
|
|
|
1309
1310
|
if (typeof mock === "function") {
|
|
1310
1311
|
const req = {};
|
|
1311
1312
|
return mock(req);
|
|
1312
|
-
} else {
|
|
1313
|
-
return mock;
|
|
1314
1313
|
}
|
|
1314
|
+
return mock;
|
|
1315
1315
|
}
|
|
1316
1316
|
function generateOptionMarkupForSelect(setting) {
|
|
1317
1317
|
const reload = setting.reloadOnChange ?? true;
|
|
@@ -1323,7 +1323,7 @@ function generateOptionMarkupForSelect(setting) {
|
|
|
1323
1323
|
const optionValue = setting.sessionStorage ? btoa(stateJson) : option.value;
|
|
1324
1324
|
markup += `<option value="${optionValue}">${option.title}</option>`;
|
|
1325
1325
|
}
|
|
1326
|
-
markup
|
|
1326
|
+
markup += `</select>`;
|
|
1327
1327
|
return markup;
|
|
1328
1328
|
}
|
|
1329
1329
|
function generateOptionMarkupForLink(setting) {
|
|
@@ -1332,7 +1332,7 @@ function generateOptionMarkupForLink(setting) {
|
|
|
1332
1332
|
for (const option of setting.options) {
|
|
1333
1333
|
markup += `<li><a href="${option.href}" tabindex="-1">${option.title}</a></li>`;
|
|
1334
1334
|
}
|
|
1335
|
-
markup
|
|
1335
|
+
markup += `</ul>`;
|
|
1336
1336
|
return markup;
|
|
1337
1337
|
}
|
|
1338
1338
|
function generateOptionMarkup(setting) {
|
|
@@ -1402,11 +1402,12 @@ var menu_default = (userSettingsAndMocks, menuOptions) => {
|
|
|
1402
1402
|
`
|
|
1403
1403
|
);
|
|
1404
1404
|
let settingsMarkup = "";
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
)
|
|
1405
|
+
const userSettings = userSettingsAndMocks.map((userSettingOrMock) => {
|
|
1406
|
+
return isMock(userSettingOrMock) ? entryFromMock(userSettingOrMock) : userSettingOrMock;
|
|
1407
|
+
});
|
|
1408
|
+
for (const userSetting of userSettings) {
|
|
1408
1409
|
const setting = { ...defaultSetting, ...userSetting };
|
|
1409
|
-
settingsMarkup
|
|
1410
|
+
settingsMarkup += generateOptionMarkup(setting);
|
|
1410
1411
|
}
|
|
1411
1412
|
document.body.insertAdjacentHTML(
|
|
1412
1413
|
"beforeend",
|
package/dist/types/menu.d.ts
CHANGED
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "2.3.8",
|
|
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.52.
|
|
56
|
+
"@fkui/logic": "6.52.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/core": "8.0.1",
|
|
60
60
|
"@babel/preset-env": "8.0.2",
|
|
61
61
|
"@fkui/tsconfig": "6.52.0",
|
|
62
62
|
"@forsakringskassan/apimock-express": "3.0.0",
|
|
63
|
-
"@forsakringskassan/commitlint-config": "4.
|
|
64
|
-
"@forsakringskassan/eslint-config": "15.
|
|
65
|
-
"@forsakringskassan/eslint-config-cli": "15.
|
|
66
|
-
"@forsakringskassan/eslint-config-cypress": "15.
|
|
67
|
-
"@forsakringskassan/eslint-config-jest": "15.
|
|
68
|
-
"@forsakringskassan/eslint-config-typescript": "15.
|
|
69
|
-
"@forsakringskassan/eslint-config-typescript-typeinfo": "15.
|
|
70
|
-
"@forsakringskassan/prettier-config": "3.7.
|
|
63
|
+
"@forsakringskassan/commitlint-config": "4.2.7",
|
|
64
|
+
"@forsakringskassan/eslint-config": "15.8.0",
|
|
65
|
+
"@forsakringskassan/eslint-config-cli": "15.8.1",
|
|
66
|
+
"@forsakringskassan/eslint-config-cypress": "15.8.0",
|
|
67
|
+
"@forsakringskassan/eslint-config-jest": "15.8.0",
|
|
68
|
+
"@forsakringskassan/eslint-config-typescript": "15.8.0",
|
|
69
|
+
"@forsakringskassan/eslint-config-typescript-typeinfo": "15.8.0",
|
|
70
|
+
"@forsakringskassan/prettier-config": "3.7.8",
|
|
71
71
|
"@tsconfig/node22": "22.0.5",
|
|
72
|
-
"@types/node": "22.20.
|
|
73
|
-
"
|
|
72
|
+
"@types/node": "22.20.1",
|
|
73
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
74
|
+
"cypress": "15.20.1",
|
|
74
75
|
"cypress-html-validate": "9.0.0",
|
|
75
76
|
"dts-bundle-generator": "9.5.1",
|
|
76
|
-
"esbuild": "0.28.
|
|
77
|
+
"esbuild": "0.28.2",
|
|
77
78
|
"esbuild-sass-plugin": "3.7.0",
|
|
78
|
-
"npm-pkg-lint": "5.
|
|
79
|
-
"sass": "1.
|
|
80
|
-
"typescript": "6.0.
|
|
79
|
+
"npm-pkg-lint": "5.2.2",
|
|
80
|
+
"sass": "1.102.0",
|
|
81
|
+
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
81
82
|
},
|
|
82
83
|
"engines": {
|
|
83
84
|
"node": "^22.16 || >= 24"
|