@mattilsynet/design 3.2.7 → 3.2.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.
@@ -1,16 +1,16 @@
1
1
  import d from "../styles.module.css.js";
2
2
  import { onHotReload as w, isBrowser as g, tag as b, on as y, QUICK_EVENT as _, attr as s } from "../utils.js";
3
- const S = `[data-command="toggle-app-expanded"],.${d.app.split(" ")[0]} > [command="show-modal"]`, k = `.${d.breadcrumbs.split(" ")[0]}`, T = `.${d.card.split(" ")[0]}`, u = `.${d.chip.split(" ")[0]}`, v = `.${d.helptext.split(" ")[0]}`, C = `.${d.pagination.split(" ")[0]}`, x = 'summary,u-summary,a,button,[role="tab"],[role="button"]', p = "mattilsynet.matomo.cloud", $ = ["setCustomUrl", "setDocumentTitle", "setReferrerUrl"], i = "mtds-analytics-banner", q = "https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler";
4
- function A(o, a = {}) {
3
+ const S = `[data-command="toggle-app-expanded"],.${d.app.split(" ")[0]} > [command="show-modal"]`, k = `.${d.breadcrumbs.split(" ")[0]}`, T = `.${d.card.split(" ")[0]}`, u = `.${d.chip.split(" ")[0]}`, v = `.${d.helptext.split(" ")[0]}`, C = `.${d.pagination.split(" ")[0]}`, x = 'summary,u-summary,a,button,[role="tab"],[role="button"]', p = "mattilsynet.matomo.cloud", $ = ["setCustomUrl", "setDocumentTitle", "setReferrerUrl"], i = "mtds-analytics-banner", A = "https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler";
4
+ function q(t, a = {}) {
5
5
  if (g()) {
6
- if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${p}/matomo.php`])), window._mtm || (window._mtm = window._mtm || [], window._mtm.push({ "mtm.startTime": Date.now(), event: "mtm.Start" })), o === "init") {
6
+ if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${p}/matomo.php`])), window._mtm || (window._mtm = window._mtm || [], window._mtm.push({ "mtm.startTime": Date.now(), event: "mtm.Start" })), t === "init") {
7
7
  window._mtdsTracking = {
8
8
  enabled: window.location.hostname !== "localhost",
9
9
  ...window._mtdsTracking,
10
10
  ...a
11
11
  };
12
- const { consent: e, enabled: t, matomoId: n, matomoTagManagerId: r } = window._mtdsTracking;
13
- if (n && window._paq.push(["setSiteId", n]), t) {
12
+ const { consent: e, enabled: o, matomoId: n, matomoTagManagerId: r } = window._mtdsTracking;
13
+ if (n && window._paq.push(["setSiteId", n]), o) {
14
14
  e !== "custom" && E();
15
15
  const l = r ? `https://cdn.matomo.cloud/${p}/container_${r}.js` : `https://cdn.matomo.cloud/${p}/matomo.js`;
16
16
  document.querySelector(`script[src="${l}"]`) || document.head.append(b("script", { async: "", src: l }));
@@ -18,26 +18,26 @@ function A(o, a = {}) {
18
18
  }
19
19
  if (window._mtdsTracking?.enabled !== !1) {
20
20
  if (window._mtdsTracking?.enabled === "debug")
21
- return console.info(`analytics ${o}:`, a);
22
- if (o === "pageview") {
23
- const { url: e, title: t } = a;
24
- window._paq.push(["setCustomUrl", e || location.href]), window._paq.push(["setDocumentTitle", t || document.title]), window._paq.push(["trackPageView"]);
25
- } else if (o === "event") {
26
- const { category: e, action: t, name: n, value: r } = a, l = ["trackEvent", e, t, n, r];
21
+ return console.info(`analytics ${t}:`, a);
22
+ if (t === "pageview") {
23
+ const { url: e, title: o } = a;
24
+ window._paq.push(["setCustomUrl", e || location.href]), window._paq.push(["setDocumentTitle", o || document.title]), window._paq.push(["trackPageView"]);
25
+ } else if (t === "event") {
26
+ const { category: e, action: o, name: n, value: r } = a, l = ["trackEvent", e, o, n, r];
27
27
  let c = location.href;
28
28
  window._paq.push([
29
29
  function() {
30
30
  c = this.getCurrentUrl();
31
31
  }
32
32
  ]), window._paq.push(["setCustomUrl", c.split("#")[0]]), window._paq.push(l.filter((h) => h !== void 0)), window._paq.push(["setCustomUrl", c]);
33
- } else if (o === "search") {
33
+ } else if (t === "search") {
34
34
  const {
35
35
  query: e,
36
- category: t = !1,
36
+ category: o = !1,
37
37
  results: n = !1
38
38
  } = a;
39
- window._paq.push(["trackSiteSearch", e, t, n]);
40
- } else if (o === "matomo") {
39
+ window._paq.push(["trackSiteSearch", e, o, n]);
40
+ } else if (t === "matomo") {
41
41
  const e = a;
42
42
  $.includes(e?.[0]) && typeof e[1] != "string" && (e[1] = `${e[1] ?? ""}`), window._paq.push(e);
43
43
  }
@@ -56,70 +56,70 @@ function E() {
56
56
  #${i} button:active { background: #054449; scale: .9 }
57
57
  #${i} p { margin: 0 .25em }
58
58
  </style>
59
- <p>Vi bruker <a href="${q}" target="_blank">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>
59
+ <p>Vi bruker <a href="${A}" target="_blank">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>
60
60
  <form method="dialog" data-analytics="ignore"><button type="submit" aria-label="OK">&times;</button></form>
61
61
  </dialog>`
62
62
  );
63
63
  const a = document.getElementById(i), e = () => window.localStorage.setItem(i, "seen");
64
64
  a.addEventListener("close", e, { once: !0 }), a.show();
65
65
  }
66
- function I(o) {
67
- window._mtdsTracking?.enabled && setTimeout(M, 0, o);
66
+ function I(t) {
67
+ window._mtdsTracking?.enabled && setTimeout(M, 0, t);
68
68
  }
69
- function M({ type: o, target: a }) {
70
- const e = o === "click" ? a?.closest?.(x) : a;
69
+ function M({ type: t, target: a }) {
70
+ const e = t === "click" ? a?.closest?.(x) : a;
71
71
  if (!(e instanceof Element) || e.closest('[data-analytics="ignore"]'))
72
72
  return;
73
- let t = "click", n = "Button", r = f(e) || R(e) || s(e, "data-tooltip") || "";
74
- if (o === "submit")
75
- n = "Form", t = "submit", r = r || document.title;
76
- else if (o === "toggle") {
73
+ let o = "click", n = "Button", r = f(e) || R(e) || s(e, "data-tooltip") || "";
74
+ if (t === "submit")
75
+ n = "Form", o = "submit", r = r || document.title;
76
+ else if (t === "toggle") {
77
77
  if (!e.matches("dialog:modal")) return;
78
- n = "Dialog", t = "open";
79
- } else if (o === "change") {
78
+ n = "Dialog", o = "open";
79
+ } else if (t === "change") {
80
80
  const l = s(e, "type"), c = l === "checkbox" || l === "radio" ? e.closest("fieldset") : null;
81
- n = e.closest(u) ? "Chip" : "Form", t = "change", r = f(c || e) || m(c?.querySelector("legend")) || m(e?.labels?.[0]);
81
+ n = e.closest(u) ? "Chip" : "Form", o = "change", r = f(c || e) || m(c?.querySelector("legend")) || m(e?.labels?.[0]);
82
82
  } else if (s(e, "role") === "tab")
83
- n = "Tab", t = "navigate";
83
+ n = "Tab", o = "navigate";
84
84
  else if (s(e, "popovertarget")) {
85
85
  if (!B(e)?.matches(":popover-open")) return;
86
- n = e.closest(v) ? "HelpText" : "Popover", t = "open";
86
+ n = e.closest(v) ? "HelpText" : "Popover", o = "open";
87
87
  } else if (e.nodeName.endsWith("SUMMARY")) {
88
88
  if (!e.parentElement.open) return;
89
- n = "Details", t = "open";
89
+ n = "Details", o = "open";
90
90
  } else if (e.matches(S)) {
91
91
  const l = L(e, "--mtds-tooltip-position") === "none";
92
- n = "Sidebar", t = l ? "expand" : "minimize", r = l && s(e, "data-tooltip") || m(e);
92
+ n = "Sidebar", o = l ? "expand" : "minimize", r = l && s(e, "data-tooltip") || m(e);
93
93
  } else if (e.closest(k))
94
- n = "Breadcrumbs", t = "navigate";
94
+ n = "Breadcrumbs", o = "navigate";
95
95
  else if (e.closest(C))
96
- n = "Pagination", t = "navigate";
96
+ n = "Pagination", o = "navigate";
97
97
  else if (e.closest(T))
98
- n = "Card", t = e instanceof HTMLAnchorElement ? "navigate" : "click";
98
+ n = "Card", o = e instanceof HTMLAnchorElement ? "navigate" : "click";
99
99
  else if (e.closest(u))
100
- n = "Chip", t = e.hasAttribute("data-removable") ? "remove" : "click";
100
+ n = "Chip", o = e.hasAttribute("data-removable") ? "remove" : "click";
101
101
  else if (e.closest("th[aria-sort]"))
102
- n = "Table", t = "sort";
102
+ n = "Table", o = "sort";
103
103
  else if (e instanceof HTMLAnchorElement)
104
- n = "Link", t = e.protocol === "mailto:" ? "email" : "navigate", e.hasAttribute("download") ? t = "download" : e.hash && e.href.startsWith(location.href.split("#")[0]) && (t = "anchor");
104
+ n = "Link", o = e.protocol === "mailto:" ? "email" : "navigate", e.hasAttribute("download") ? o = "download" : e.hash && e.href.startsWith(location.href.split("#")[0]) && (o = "anchor");
105
105
  else if (e.hasAttribute("aria-expanded")) {
106
106
  if (s(e, "aria-expanded") !== "true") return;
107
- n = "Expand", t = "open";
108
- } else e.nodeName.startsWith("MTDS-ATLAS-") && (n = "Map Marker", t = "open");
109
- A("event", {
107
+ n = "Expand", o = "open";
108
+ } else e.nodeName.startsWith("MTDS-ATLAS-") && (n = "Map Marker", o = "open");
109
+ (t === "change" || t === "submit") && (n = e.closest("form")?.getAttribute("data-analytics-category") || n), q("event", {
110
110
  category: s(e, "data-analytics-category") ?? n,
111
- action: s(e, "data-analytics-action") ?? t,
111
+ action: s(e, "data-analytics-action") ?? o,
112
112
  name: s(e, "data-analytics-name") ?? r
113
113
  });
114
114
  }
115
- const m = (o) => o?.textContent?.trim() || "", f = (o) => o && s(o, "aria-label") || "", B = (o) => document.getElementById(s(o, "popovertarget") || ""), L = (o, a) => window.getComputedStyle(o).getPropertyValue(a)?.trim(), R = (o) => {
116
- const a = m(o), e = m(o.querySelector("h1,h2,h3,h4,h5,h6"));
115
+ const m = (t) => t?.textContent?.trim() || "", f = (t) => t && s(t, "aria-label") || "", B = (t) => document.getElementById(s(t, "popovertarget") || ""), L = (t, a) => window.getComputedStyle(t).getPropertyValue(a)?.trim(), R = (t) => {
116
+ const a = m(t), e = m(t.querySelector("h1,h2,h3,h4,h5,h6"));
117
117
  return a.startsWith(e) && e || a.slice(0, 100).trim();
118
118
  };
119
119
  w("analytics", () => [
120
120
  y(document, "click toggle submit change", I, _)
121
121
  ]);
122
122
  export {
123
- A as analytics
123
+ q as analytics
124
124
  };
125
125
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { attr, isBrowser, on, onHotReload, QUICK_EVENT, tag } from \"../utils\";\n\n/*\n * IMPORTANT: [data-command=\"toggle-app-expanded\"] is deprecated but kept for backward compatibility.\n * Please use [command=\"show-modal\"] instead.\n */\nconst CSS_APP_TOGGLE = `[data-command=\"toggle-app-expanded\"],.${styles.app.split(\" \")[0]} > [command=\"show-modal\"]`;\nconst CSS_BREADCRUMBS = `.${styles.breadcrumbs.split(\" \")[0]}`;\nconst CSS_CARD = `.${styles.card.split(\" \")[0]}`;\nconst CSS_CHIP = `.${styles.chip.split(\" \")[0]}`;\nconst CSS_HELPTEXT = `.${styles.helptext.split(\" \")[0]}`;\nconst CSS_PAGINATION = `.${styles.pagination.split(\" \")[0]}`;\nconst CLICKS = `summary,u-summary,a,button,[role=\"tab\"],[role=\"button\"]`;\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nconst MATOMO_STRINGS = [\"setCustomUrl\", \"setDocumentTitle\", \"setReferrerUrl\"];\nconst BANNER = \"mtds-analytics-banner\"; // Dialog to show Matomo script loading\nconst BANNER_URL =\n\t\"https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler\";\n\ntype Matomo = (\n\t| string\n\t| number\n\t| boolean\n\t| Document\n\t| Element\n\t| ((this: Record<string, <T>() => T>) => void)\n)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t\t_mtdsTracking?: AnalyticsActions[\"init\"];\n\t\t_mtdsUntrack?: () => void;\n\t}\n}\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tenabled?: boolean | \"debug\";\n\t\tconsent?: \"custom\" | true;\n\t} & (\n\t\t| {\n\t\t\t\tmatomoId: number | string;\n\t\t\t\tmatomoTagManagerId?: never;\n\t\t }\n\t\t| {\n\t\t\t\tmatomoId?: number | string;\n\t\t\t\tmatomoTagManagerId: string;\n\t\t }\n\t);\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!isBrowser()) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t}\n\tif (!window._mtm) {\n\t\twindow._mtm = window._mtm || []; // Prepare Matomo Tag Manager\n\t\twindow._mtm.push({ \"mtm.startTime\": Date.now(), event: \"mtm.Start\" });\n\t}\n\n\tif (action === \"init\") {\n\t\twindow._mtdsTracking = {\n\t\t\tenabled: window.location.hostname !== \"localhost\",\n\t\t\t...window._mtdsTracking,\n\t\t\t...args,\n\t\t} as AnalyticsActions[\"init\"];\n\t\tconst { consent, enabled, matomoId, matomoTagManagerId } =\n\t\t\twindow._mtdsTracking;\n\n\t\tif (matomoId) window._paq.push([\"setSiteId\", matomoId]);\n\t\tif (enabled) {\n\t\t\tif (consent !== \"custom\") renderBanner();\n\t\t\tconst src = matomoTagManagerId\n\t\t\t\t? `https://cdn.matomo.cloud/${MATOMO}/container_${matomoTagManagerId}.js`\n\t\t\t\t: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`;\n\n\t\t\tdocument.querySelector(`script[src=\"${src}\"]`) ||\n\t\t\t\tdocument.head.append(tag(\"script\", { async: \"\", src }));\n\t\t}\n\t}\n\n\tif (window._mtdsTracking?.enabled === false) return;\n\tif (window._mtdsTracking?.enabled === \"debug\")\n\t\treturn console.info(`analytics ${action}:`, args);\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\n\t\t// We do not want to track events with hash in URL as this causes hard-to-read data,\n\t\t// so temporarily remove the hash part, and add it back after the event is pushed\n\t\tlet url = location.href;\n\t\twindow._paq.push([\n\t\t\tfunction () {\n\t\t\t\turl = this.getCurrentUrl<string>();\n\t\t\t},\n\t\t]);\n\t\twindow._paq.push([\"setCustomUrl\", url.split(\"#\")[0]]); // Skip hash part of URL\n\t\twindow._paq.push(event.filter((v) => v !== undefined)); // Push event\n\t\twindow._paq.push([\"setCustomUrl\", url]); // Reverrt to original URL with hash\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\tconst props = args as AnalyticsActions[\"matomo\"];\n\t\tconst needStr = MATOMO_STRINGS.includes(props?.[0] as string);\n\t\tif (needStr && typeof props[1] !== \"string\") props[1] = `${props[1] ?? \"\"}`; // Matomo dies if not string\n\t\twindow._paq.push(props);\n\t}\n}\n\nfunction renderBanner() {\n\tconst hasSeenBanner =\n\t\tdocument.getElementById(BANNER) || window.localStorage.getItem(BANNER);\n\n\tif (hasSeenBanner) return;\n\n\tdocument.body.insertAdjacentHTML(\n\t\t\"afterbegin\",\n\t\t`<dialog id=\"${BANNER}\" data-analytics=\"ignore\"><style>\n\t\t\t\t#${BANNER}[open] { box-sizing: border-box; display: flex; align-items: center; background: #116e6b; border-radius: .5em; border: 0; box-shadow: 0 .25em .5em rgba(0,0,0,.3); color: #fff; font-size: .875em; inset: auto auto 1em 1em; max-width: calc(100vw - 2em); outline: 0; padding: .5em; position: fixed; z-index: 99999 }\n\t\t\t\t#${BANNER} button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; width: 1.5em; height: 1.5em; font: 300 1.5em/1.35 sans-serif; border-radius: .25em; place-content: center; transition: .2s; transition-property: background, scale }\n\t\t\t\t#${BANNER} button:focus-visible { outline: 2px solid }\n\t\t\t\t#${BANNER} button:hover { background: #0a4e4f }\n\t\t\t\t#${BANNER} button:active { background: #054449; scale: .9 }\n\t\t\t\t#${BANNER} p { margin: 0 .25em }\n\t\t\t</style>\n\t\t\t<p>Vi bruker <a href=\"${BANNER_URL}\" target=\"_blank\">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>\n\t\t\t<form method=\"dialog\" data-analytics=\"ignore\"><button type=\"submit\" aria-label=\"OK\">&times;</button></form>\n\t\t</dialog>`,\n\t);\n\tconst banner = document.getElementById(BANNER) as HTMLDialogElement;\n\tconst onClose = () => window.localStorage.setItem(BANNER, \"seen\");\n\tbanner.addEventListener(\"close\", onClose, { once: true });\n\tbanner.show();\n}\n\nfunction handleAnalyticsTrack(event: Event) {\n\tif (window._mtdsTracking?.enabled) setTimeout(processTrack, 0, event); // Let other events process first\n}\n\nfunction processTrack({ type, target }: Event) {\n\tconst el = type === \"click\" ? (target as Element)?.closest?.(CLICKS) : target;\n\tif (!(el instanceof Element) || el.closest('[data-analytics=\"ignore\"]'))\n\t\treturn;\n\n\tlet action = \"click\";\n\tlet category = \"Button\";\n\tlet name = label(el) || heading(el) || attr(el, \"data-tooltip\") || \"\";\n\n\tif (type === \"submit\") {\n\t\tcategory = \"Form\";\n\t\taction = \"submit\";\n\t\tname = name || document.title;\n\t} else if (type === \"toggle\") {\n\t\tif (!el.matches(\"dialog:modal\")) return; // Skip non-modal dialogs\n\t\tcategory = \"Dialog\";\n\t\taction = \"open\";\n\t} else if (type === \"change\") {\n\t\tconst type = attr(el, \"type\");\n\t\tconst group =\n\t\t\ttype === \"checkbox\" || type === \"radio\" ? el.closest(\"fieldset\") : null;\n\n\t\tcategory = el.closest(CSS_CHIP) ? \"Chip\" : \"Form\";\n\t\taction = \"change\";\n\t\tname =\n\t\t\tlabel(group || el) ||\n\t\t\ttext(group?.querySelector(\"legend\")) ||\n\t\t\ttext((el as HTMLInputElement)?.labels?.[0]);\n\t} else if (attr(el, \"role\") === \"tab\") {\n\t\tcategory = \"Tab\";\n\t\taction = \"navigate\";\n\t} else if (attr(el, \"popovertarget\")) {\n\t\tif (!popover(el)?.matches(\":popover-open\")) return; // Skip if not open\n\t\tcategory = el.closest(CSS_HELPTEXT) ? \"HelpText\" : \"Popover\";\n\t\taction = \"open\";\n\t} else if (el.nodeName.endsWith(\"SUMMARY\")) {\n\t\tif (!(el.parentElement as HTMLDetailsElement).open) return; // Skip if not open\n\t\tcategory = \"Details\";\n\t\taction = \"open\";\n\t} else if (el.matches(CSS_APP_TOGGLE)) {\n\t\tconst open = style(el, \"--mtds-tooltip-position\") === \"none\";\n\t\tcategory = \"Sidebar\";\n\t\taction = open ? \"expand\" : \"minimize\";\n\t\tname = (open && attr(el, \"data-tooltip\")) || text(el);\n\t} else if (el.closest(CSS_BREADCRUMBS)) {\n\t\tcategory = \"Breadcrumbs\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_PAGINATION)) {\n\t\tcategory = \"Pagination\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_CARD)) {\n\t\tcategory = \"Card\";\n\t\taction = el instanceof HTMLAnchorElement ? \"navigate\" : \"click\";\n\t} else if (el.closest(CSS_CHIP)) {\n\t\tcategory = \"Chip\";\n\t\taction = el.hasAttribute(\"data-removable\") ? \"remove\" : \"click\";\n\t} else if (el.closest(\"th[aria-sort]\")) {\n\t\tcategory = \"Table\";\n\t\taction = \"sort\";\n\t} else if (el instanceof HTMLAnchorElement) {\n\t\tcategory = \"Link\";\n\t\taction = el.protocol === \"mailto:\" ? \"email\" : \"navigate\";\n\t\tif (el.hasAttribute(\"download\")) action = \"download\";\n\t\telse if (el.hash && el.href.startsWith(location.href.split(\"#\")[0]))\n\t\t\taction = \"anchor\"; // Only track as anchor if same page\n\t} else if (el.hasAttribute(\"aria-expanded\")) {\n\t\tif (attr(el, \"aria-expanded\") !== \"true\") return; // Skip if not open\n\t\tcategory = \"Expand\";\n\t\taction = \"open\";\n\t} else if (el.nodeName.startsWith(\"MTDS-ATLAS-\")) {\n\t\tcategory = \"Map Marker\";\n\t\taction = \"open\";\n\t}\n\n\t// Respect attributes and send\n\tanalytics(\"event\", {\n\t\tcategory: attr(el, \"data-analytics-category\") ?? category,\n\t\taction: attr(el, \"data-analytics-action\") ?? action,\n\t\tname: attr(el, \"data-analytics-name\") ?? name,\n\t});\n}\n\n// Utilities\nconst text = (el?: Element | null) => el?.textContent?.trim() || \"\";\nconst label = (el?: Element | null) => (el && attr(el, \"aria-label\")) || \"\";\nconst popover = (el: Element) =>\n\tdocument.getElementById(attr(el, \"popovertarget\") || \"\");\nconst style = (el: Element, key: string) =>\n\twindow.getComputedStyle(el).getPropertyValue(key)?.trim();\nconst heading = (el: Element) => {\n\tconst body = text(el);\n\tconst head = text(el.querySelector(\"h1,h2,h3,h4,h5,h6\")); // Note: head might be empty string ''\n\treturn (body.startsWith(head) && head) || body.slice(0, 100).trim(); // Limit to 100 characters\n};\n\nonHotReload(\"analytics\", () => [\n\ton(document, \"click toggle submit change\", handleAnalyticsTrack, QUICK_EVENT),\n]);\n"],"names":["CSS_APP_TOGGLE","styles","CSS_BREADCRUMBS","CSS_CARD","CSS_CHIP","CSS_HELPTEXT","CSS_PAGINATION","CLICKS","MATOMO","MATOMO_STRINGS","BANNER","BANNER_URL","analytics","action","args","isBrowser","consent","enabled","matomoId","matomoTagManagerId","renderBanner","src","tag","url","title","category","name","value","event","v","query","results","props","banner","onClose","handleAnalyticsTrack","processTrack","type","target","el","label","heading","attr","group","text","popover","open","style","key","body","head","onHotReload","on","QUICK_EVENT"],"mappings":";;AAOA,MAAMA,IAAiB,yCAAyCC,EAAO,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,6BAClFC,IAAkB,IAAID,EAAO,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,IACtDE,IAAW,IAAIF,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCG,IAAW,IAAIH,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCI,IAAe,IAAIJ,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,IAChDK,IAAiB,IAAIL,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,CAAC,IACpDM,IAAS,2DACTC,IAAS,4BACTC,IAAiB,CAAC,gBAAgB,oBAAoB,gBAAgB,GACtEC,IAAS,yBACTC,IACL;AAmDM,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,KAYL;AAAA,QAXK,OAAO,SACX,OAAO,OAAO,CAAA,GACd,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWP,CAAM,aAAa,CAAC,IAE9D,OAAO,SACX,OAAO,OAAO,OAAO,QAAQ,CAAA,GAC7B,OAAO,KAAK,KAAK,EAAE,iBAAiB,KAAK,IAAA,GAAO,OAAO,aAAa,IAGjEK,MAAW,QAAQ;AACtB,aAAO,gBAAgB;AAAA,QACtB,SAAS,OAAO,SAAS,aAAa;AAAA,QACtC,GAAG,OAAO;AAAA,QACV,GAAGC;AAAA,MAAA;AAEJ,YAAM,EAAE,SAAAE,GAAS,SAAAC,GAAS,UAAAC,GAAU,oBAAAC,EAAA,IACnC,OAAO;AAGR,UADID,KAAU,OAAO,KAAK,KAAK,CAAC,aAAaA,CAAQ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,EAAK,WAAWC,CAAI,KAAKA,KAASD,EAAK,MAAM,GAAG,GAAG,EAAE,KAAA;AAC9D;AAEAE,EAAY,aAAa,MAAM;AAAA,EAC9BC,EAAG,UAAU,8BAA8BjB,GAAsBkB,CAAW;AAC7E,CAAC;"}
1
+ {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import styles from \"../styles.module.css\";\nimport { attr, isBrowser, on, onHotReload, QUICK_EVENT, tag } from \"../utils\";\n\n/*\n * IMPORTANT: [data-command=\"toggle-app-expanded\"] is deprecated but kept for backward compatibility.\n * Please use [command=\"show-modal\"] instead.\n */\nconst CSS_APP_TOGGLE = `[data-command=\"toggle-app-expanded\"],.${styles.app.split(\" \")[0]} > [command=\"show-modal\"]`;\nconst CSS_BREADCRUMBS = `.${styles.breadcrumbs.split(\" \")[0]}`;\nconst CSS_CARD = `.${styles.card.split(\" \")[0]}`;\nconst CSS_CHIP = `.${styles.chip.split(\" \")[0]}`;\nconst CSS_HELPTEXT = `.${styles.helptext.split(\" \")[0]}`;\nconst CSS_PAGINATION = `.${styles.pagination.split(\" \")[0]}`;\nconst CLICKS = `summary,u-summary,a,button,[role=\"tab\"],[role=\"button\"]`;\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nconst MATOMO_STRINGS = [\"setCustomUrl\", \"setDocumentTitle\", \"setReferrerUrl\"];\nconst BANNER = \"mtds-analytics-banner\"; // Dialog to show Matomo script loading\nconst BANNER_URL =\n\t\"https://www.mattilsynet.no/om-mattilsynet/personvernerklaering/informasjonskapsler\";\n\ntype Matomo = (\n\t| string\n\t| number\n\t| boolean\n\t| Document\n\t| Element\n\t| ((this: Record<string, <T>() => T>) => void)\n)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t\t_mtm?: Record<string, string | number>[];\n\t\t_mtdsTracking?: AnalyticsActions[\"init\"];\n\t\t_mtdsUntrack?: () => void;\n\t}\n}\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tenabled?: boolean | \"debug\";\n\t\tconsent?: \"custom\" | true;\n\t} & (\n\t\t| {\n\t\t\t\tmatomoId: number | string;\n\t\t\t\tmatomoTagManagerId?: never;\n\t\t }\n\t\t| {\n\t\t\t\tmatomoId?: number | string;\n\t\t\t\tmatomoTagManagerId: string;\n\t\t }\n\t);\n\tpageview: {\n\t\turl?: string;\n\t\ttitle?: string;\n\t};\n\tevent: {\n\t\tcategory: string;\n\t\taction: string;\n\t\tname?: string;\n\t\tvalue?: number;\n\t};\n\tsearch: {\n\t\tquery: string;\n\t\tcategory?: string;\n\t\tresults?: number;\n\t};\n\tmatomo: Matomo;\n};\n\nexport function analytics<Action extends keyof AnalyticsActions>(\n\taction: Action,\n\targs = {} as AnalyticsActions[Action],\n) {\n\tif (!isBrowser()) return;\n\tif (!window._paq) {\n\t\twindow._paq = [];\n\t\twindow._paq.push([\"HeatmapSessionRecording::disable\"]); // Disable heatmaps by default as this require cookies\n\t\twindow._paq.push([\"enableLinkTracking\"]);\n\t\twindow._paq.push([\"setTrackerUrl\", `https://${MATOMO}/matomo.php`]);\n\t}\n\tif (!window._mtm) {\n\t\twindow._mtm = window._mtm || []; // Prepare Matomo Tag Manager\n\t\twindow._mtm.push({ \"mtm.startTime\": Date.now(), event: \"mtm.Start\" });\n\t}\n\n\tif (action === \"init\") {\n\t\twindow._mtdsTracking = {\n\t\t\tenabled: window.location.hostname !== \"localhost\",\n\t\t\t...window._mtdsTracking,\n\t\t\t...args,\n\t\t} as AnalyticsActions[\"init\"];\n\t\tconst { consent, enabled, matomoId, matomoTagManagerId } =\n\t\t\twindow._mtdsTracking;\n\n\t\tif (matomoId) window._paq.push([\"setSiteId\", matomoId]);\n\t\tif (enabled) {\n\t\t\tif (consent !== \"custom\") renderBanner();\n\t\t\tconst src = matomoTagManagerId\n\t\t\t\t? `https://cdn.matomo.cloud/${MATOMO}/container_${matomoTagManagerId}.js`\n\t\t\t\t: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`;\n\n\t\t\tdocument.querySelector(`script[src=\"${src}\"]`) ||\n\t\t\t\tdocument.head.append(tag(\"script\", { async: \"\", src }));\n\t\t}\n\t}\n\n\tif (window._mtdsTracking?.enabled === false) return;\n\tif (window._mtdsTracking?.enabled === \"debug\")\n\t\treturn console.info(`analytics ${action}:`, args);\n\n\tif (action === \"pageview\") {\n\t\tconst { url, title } = args as AnalyticsActions[\"pageview\"];\n\t\twindow._paq.push([\"setCustomUrl\", url || location.href]);\n\t\twindow._paq.push([\"setDocumentTitle\", title || document.title]);\n\t\twindow._paq.push([\"trackPageView\"]);\n\t} else if (action === \"event\") {\n\t\tconst { category, action, name, value } = args as AnalyticsActions[\"event\"];\n\t\tconst event = [\"trackEvent\", category, action, name, value];\n\n\t\t// We do not want to track events with hash in URL as this causes hard-to-read data,\n\t\t// so temporarily remove the hash part, and add it back after the event is pushed\n\t\tlet url = location.href;\n\t\twindow._paq.push([\n\t\t\tfunction () {\n\t\t\t\turl = this.getCurrentUrl<string>();\n\t\t\t},\n\t\t]);\n\t\twindow._paq.push([\"setCustomUrl\", url.split(\"#\")[0]]); // Skip hash part of URL\n\t\twindow._paq.push(event.filter((v) => v !== undefined)); // Push event\n\t\twindow._paq.push([\"setCustomUrl\", url]); // Reverrt to original URL with hash\n\t} else if (action === \"search\") {\n\t\tconst {\n\t\t\tquery,\n\t\t\tcategory = false,\n\t\t\tresults = false,\n\t\t} = args as AnalyticsActions[\"search\"];\n\t\twindow._paq.push([\"trackSiteSearch\", query, category, results]);\n\t} else if (action === \"matomo\") {\n\t\tconst props = args as AnalyticsActions[\"matomo\"];\n\t\tconst needStr = MATOMO_STRINGS.includes(props?.[0] as string);\n\t\tif (needStr && typeof props[1] !== \"string\") props[1] = `${props[1] ?? \"\"}`; // Matomo dies if not string\n\t\twindow._paq.push(props);\n\t}\n}\n\nfunction renderBanner() {\n\tconst hasSeenBanner =\n\t\tdocument.getElementById(BANNER) || window.localStorage.getItem(BANNER);\n\n\tif (hasSeenBanner) return;\n\n\tdocument.body.insertAdjacentHTML(\n\t\t\"afterbegin\",\n\t\t`<dialog id=\"${BANNER}\" data-analytics=\"ignore\"><style>\n\t\t\t\t#${BANNER}[open] { box-sizing: border-box; display: flex; align-items: center; background: #116e6b; border-radius: .5em; border: 0; box-shadow: 0 .25em .5em rgba(0,0,0,.3); color: #fff; font-size: .875em; inset: auto auto 1em 1em; max-width: calc(100vw - 2em); outline: 0; padding: .5em; position: fixed; z-index: 99999 }\n\t\t\t\t#${BANNER} button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; width: 1.5em; height: 1.5em; font: 300 1.5em/1.35 sans-serif; border-radius: .25em; place-content: center; transition: .2s; transition-property: background, scale }\n\t\t\t\t#${BANNER} button:focus-visible { outline: 2px solid }\n\t\t\t\t#${BANNER} button:hover { background: #0a4e4f }\n\t\t\t\t#${BANNER} button:active { background: #054449; scale: .9 }\n\t\t\t\t#${BANNER} p { margin: 0 .25em }\n\t\t\t</style>\n\t\t\t<p>Vi bruker <a href=\"${BANNER_URL}\" target=\"_blank\">informasjonskapsler</a> for å forbedre brukeropplevelsen.</p>\n\t\t\t<form method=\"dialog\" data-analytics=\"ignore\"><button type=\"submit\" aria-label=\"OK\">&times;</button></form>\n\t\t</dialog>`,\n\t);\n\tconst banner = document.getElementById(BANNER) as HTMLDialogElement;\n\tconst onClose = () => window.localStorage.setItem(BANNER, \"seen\");\n\tbanner.addEventListener(\"close\", onClose, { once: true });\n\tbanner.show();\n}\n\nfunction handleAnalyticsTrack(event: Event) {\n\tif (window._mtdsTracking?.enabled) setTimeout(processTrack, 0, event); // Let other events process first\n}\n\nfunction processTrack({ type, target }: Event) {\n\tconst el = type === \"click\" ? (target as Element)?.closest?.(CLICKS) : target;\n\tif (!(el instanceof Element) || el.closest('[data-analytics=\"ignore\"]'))\n\t\treturn;\n\n\tlet action = \"click\";\n\tlet category = \"Button\";\n\tlet name = label(el) || heading(el) || attr(el, \"data-tooltip\") || \"\";\n\n\tif (type === \"submit\") {\n\t\tcategory = \"Form\";\n\t\taction = \"submit\";\n\t\tname = name || document.title;\n\t} else if (type === \"toggle\") {\n\t\tif (!el.matches(\"dialog:modal\")) return; // Skip non-modal dialogs\n\t\tcategory = \"Dialog\";\n\t\taction = \"open\";\n\t} else if (type === \"change\") {\n\t\tconst type = attr(el, \"type\");\n\t\tconst group =\n\t\t\ttype === \"checkbox\" || type === \"radio\" ? el.closest(\"fieldset\") : null;\n\n\t\tcategory = el.closest(CSS_CHIP) ? \"Chip\" : \"Form\";\n\t\taction = \"change\";\n\t\tname =\n\t\t\tlabel(group || el) ||\n\t\t\ttext(group?.querySelector(\"legend\")) ||\n\t\t\ttext((el as HTMLInputElement)?.labels?.[0]);\n\t} else if (attr(el, \"role\") === \"tab\") {\n\t\tcategory = \"Tab\";\n\t\taction = \"navigate\";\n\t} else if (attr(el, \"popovertarget\")) {\n\t\tif (!popover(el)?.matches(\":popover-open\")) return; // Skip if not open\n\t\tcategory = el.closest(CSS_HELPTEXT) ? \"HelpText\" : \"Popover\";\n\t\taction = \"open\";\n\t} else if (el.nodeName.endsWith(\"SUMMARY\")) {\n\t\tif (!(el.parentElement as HTMLDetailsElement).open) return; // Skip if not open\n\t\tcategory = \"Details\";\n\t\taction = \"open\";\n\t} else if (el.matches(CSS_APP_TOGGLE)) {\n\t\tconst open = style(el, \"--mtds-tooltip-position\") === \"none\";\n\t\tcategory = \"Sidebar\";\n\t\taction = open ? \"expand\" : \"minimize\";\n\t\tname = (open && attr(el, \"data-tooltip\")) || text(el);\n\t} else if (el.closest(CSS_BREADCRUMBS)) {\n\t\tcategory = \"Breadcrumbs\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_PAGINATION)) {\n\t\tcategory = \"Pagination\";\n\t\taction = \"navigate\";\n\t} else if (el.closest(CSS_CARD)) {\n\t\tcategory = \"Card\";\n\t\taction = el instanceof HTMLAnchorElement ? \"navigate\" : \"click\";\n\t} else if (el.closest(CSS_CHIP)) {\n\t\tcategory = \"Chip\";\n\t\taction = el.hasAttribute(\"data-removable\") ? \"remove\" : \"click\";\n\t} else if (el.closest(\"th[aria-sort]\")) {\n\t\tcategory = \"Table\";\n\t\taction = \"sort\";\n\t} else if (el instanceof HTMLAnchorElement) {\n\t\tcategory = \"Link\";\n\t\taction = el.protocol === \"mailto:\" ? \"email\" : \"navigate\";\n\t\tif (el.hasAttribute(\"download\")) action = \"download\";\n\t\telse if (el.hash && el.href.startsWith(location.href.split(\"#\")[0]))\n\t\t\taction = \"anchor\"; // Only track as anchor if same page\n\t} else if (el.hasAttribute(\"aria-expanded\")) {\n\t\tif (attr(el, \"aria-expanded\") !== \"true\") return; // Skip if not open\n\t\tcategory = \"Expand\";\n\t\taction = \"open\";\n\t} else if (el.nodeName.startsWith(\"MTDS-ATLAS-\")) {\n\t\tcategory = \"Map Marker\";\n\t\taction = \"open\";\n\t}\n\n\t// If event is form event, inherit form category\n\tif (type === \"change\" || type === \"submit\")\n\t\tcategory =\n\t\t\tel.closest(\"form\")?.getAttribute(\"data-analytics-category\") || category;\n\n\t// Respect attributes and send\n\tanalytics(\"event\", {\n\t\tcategory: attr(el, \"data-analytics-category\") ?? category,\n\t\taction: attr(el, \"data-analytics-action\") ?? action,\n\t\tname: attr(el, \"data-analytics-name\") ?? name,\n\t});\n}\n\n// Utilities\nconst text = (el?: Element | null) => el?.textContent?.trim() || \"\";\nconst label = (el?: Element | null) => (el && attr(el, \"aria-label\")) || \"\";\nconst popover = (el: Element) =>\n\tdocument.getElementById(attr(el, \"popovertarget\") || \"\");\nconst style = (el: Element, key: string) =>\n\twindow.getComputedStyle(el).getPropertyValue(key)?.trim();\nconst heading = (el: Element) => {\n\tconst body = text(el);\n\tconst head = text(el.querySelector(\"h1,h2,h3,h4,h5,h6\")); // Note: head might be empty string ''\n\treturn (body.startsWith(head) && head) || body.slice(0, 100).trim(); // Limit to 100 characters\n};\n\nonHotReload(\"analytics\", () => [\n\ton(document, \"click toggle submit change\", handleAnalyticsTrack, QUICK_EVENT),\n]);\n"],"names":["CSS_APP_TOGGLE","styles","CSS_BREADCRUMBS","CSS_CARD","CSS_CHIP","CSS_HELPTEXT","CSS_PAGINATION","CLICKS","MATOMO","MATOMO_STRINGS","BANNER","BANNER_URL","analytics","action","args","isBrowser","consent","enabled","matomoId","matomoTagManagerId","renderBanner","src","tag","url","title","category","name","value","event","v","query","results","props","banner","onClose","handleAnalyticsTrack","processTrack","type","target","el","label","heading","attr","group","text","popover","open","style","key","body","head","onHotReload","on","QUICK_EVENT"],"mappings":";;AAOA,MAAMA,IAAiB,yCAAyCC,EAAO,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,6BAClFC,IAAkB,IAAID,EAAO,YAAY,MAAM,GAAG,EAAE,CAAC,CAAC,IACtDE,IAAW,IAAIF,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCG,IAAW,IAAIH,EAAO,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,IACxCI,IAAe,IAAIJ,EAAO,SAAS,MAAM,GAAG,EAAE,CAAC,CAAC,IAChDK,IAAiB,IAAIL,EAAO,WAAW,MAAM,GAAG,EAAE,CAAC,CAAC,IACpDM,IAAS,2DACTC,IAAS,4BACTC,IAAiB,CAAC,gBAAgB,oBAAoB,gBAAgB,GACtEC,IAAS,yBACTC,IACL;AAmDM,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,KAYL;AAAA,QAXK,OAAO,SACX,OAAO,OAAO,CAAA,GACd,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWP,CAAM,aAAa,CAAC,IAE9D,OAAO,SACX,OAAO,OAAO,OAAO,QAAQ,CAAA,GAC7B,OAAO,KAAK,KAAK,EAAE,iBAAiB,KAAK,IAAA,GAAO,OAAO,aAAa,IAGjEK,MAAW,QAAQ;AACtB,aAAO,gBAAgB;AAAA,QACtB,SAAS,OA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,GAAI,YAAY,KAAM,IACnEM,IAAU,CAACN,MAChB,SAAS,eAAeG,EAAKH,GAAI,eAAe,KAAK,EAAE,GAClDQ,IAAQ,CAACR,GAAaS,MAC3B,OAAO,iBAAiBT,CAAE,EAAE,iBAAiBS,CAAG,GAAG,KAAA,GAC9CP,IAAU,CAACF,MAAgB;AAChC,QAAMU,IAAOL,EAAKL,CAAE,GACdW,IAAON,EAAKL,EAAG,cAAc,mBAAmB,CAAC;AACvD,SAAQU,EAAK,WAAWC,CAAI,KAAKA,KAASD,EAAK,MAAM,GAAG,GAAG,EAAE,KAAA;AAC9D;AAEAE,EAAY,aAAa,MAAM;AAAA,EAC9BC,EAAG,UAAU,8BAA8BjB,GAAsBkB,CAAW;AAC7E,CAAC;"}
@@ -1,6 +1,6 @@
1
1
  import P from "../styles.module.css.js";
2
2
  import { getByCSSModule as _, onHotReload as h, on as r, QUICK_EVENT as m, debounce as E } from "../utils.js";
3
- import "./app-toggle2.js";
3
+ import "./app-toggle.js";
4
4
  const y = P.app.split(" ")[0], I = `[data-command="toggle-app-expanded"],.${y} > [command="show-modal"]`, u = `.${y} > dialog,.${y} dialog ~ main`, S = _("sticky"), w = (t) => {
5
5
  document.startViewTransition ? document.startViewTransition(t) : t();
6
6
  }, x = (t) => (
@@ -1,27 +1,11 @@
1
- const t = `if (
2
- typeof window !== "undefined" &&
3
- window.CSSStyleSheet &&
4
- document.adoptedStyleSheets
5
- )
6
- (() => {
7
- const key = "--mtds-app-expanded";
8
- const sheet = new CSSStyleSheet();
9
- const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
-
11
- document.adoptedStyleSheets.push(sheet);
12
- window.mtdsToggleAppExpanded = (force) => {
13
- try {
14
- const next = force ?? !prev();
15
- sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
- window.localStorage.setItem(key, next);
17
- } catch (_err) {} // localStorage is full or replaceSync is not supported
18
- };
19
-
20
- // Set and store initial state
21
- window.mtdsToggleAppExpanded(prev());
22
- })();
23
- `;
24
- export {
25
- t as default
26
- };
1
+ typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
+ const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
+ document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
+ try {
5
+ const t = n ?? !o();
6
+ d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
+ } catch {
8
+ }
9
+ }, window.mtdsToggleAppExpanded(o());
10
+ })();
27
11
  //# sourceMappingURL=app-toggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAa,GACzBC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAI;AAC3B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACtC,QAAe;AAAA,IAAC;AAAA,EACjB,GAGA,OAAO,sBAAsBF,GAAM;AACpC,GAAC;"}
@@ -1,11 +1,27 @@
1
- typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
- const e = "--mtds-app-expanded", d = new CSSStyleSheet(), o = () => !window.localStorage.getItem(e)?.includes("false");
3
- document.adoptedStyleSheets.push(d), window.mtdsToggleAppExpanded = (n) => {
4
- try {
5
- const t = n ?? !o();
6
- d.replaceSync?.(`:root { ${e}: var(${e}--${t})}`), window.localStorage.setItem(e, t);
7
- } catch {
8
- }
9
- }, window.mtdsToggleAppExpanded(o());
10
- })();
1
+ const t = `if (
2
+ typeof window !== "undefined" &&
3
+ window.CSSStyleSheet &&
4
+ document.adoptedStyleSheets
5
+ )
6
+ (() => {
7
+ const key = "--mtds-app-expanded";
8
+ const sheet = new CSSStyleSheet();
9
+ const prev = () => !window.localStorage.getItem(key)?.includes("false");
10
+
11
+ document.adoptedStyleSheets.push(sheet);
12
+ window.mtdsToggleAppExpanded = (force) => {
13
+ try {
14
+ const next = force ?? !prev();
15
+ sheet.replaceSync?.(\`:root { \${key}: var(\${key}--\${next})}\`);
16
+ window.localStorage.setItem(key, next);
17
+ } catch (_err) {} // localStorage is full or replaceSync is not supported
18
+ };
19
+
20
+ // Set and store initial state
21
+ window.mtdsToggleAppExpanded(prev());
22
+ })();
23
+ `;
24
+ export {
25
+ t as default
26
+ };
11
27
  //# sourceMappingURL=app-toggle2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (\n\ttypeof window !== \"undefined\" &&\n\twindow.CSSStyleSheet &&\n\tdocument.adoptedStyleSheets\n)\n\t(() => {\n\t\tconst key = \"--mtds-app-expanded\";\n\t\tconst sheet = new CSSStyleSheet();\n\t\tconst prev = () => !window.localStorage.getItem(key)?.includes(\"false\");\n\n\t\tdocument.adoptedStyleSheets.push(sheet);\n\t\twindow.mtdsToggleAppExpanded = (force) => {\n\t\t\ttry {\n\t\t\t\tconst next = force ?? !prev();\n\t\t\t\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\n\t\t\t\twindow.localStorage.setItem(key, next);\n\t\t\t} catch (_err) {} // localStorage is full or replaceSync is not supported\n\t\t};\n\n\t\t// Set and store initial state\n\t\twindow.mtdsToggleAppExpanded(prev());\n\t})();\n"],"names":["key","sheet","prev","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAa,GACzBC,IAAO,MAAM,CAAC,OAAO,aAAa,QAAQF,CAAG,GAAG,SAAS,OAAO;AAEtE,WAAS,mBAAmB,KAAKC,CAAK,GACtC,OAAO,wBAAwB,CAACE,MAAU;AACzC,QAAI;AACH,YAAMC,IAAOD,KAAS,CAACD,EAAI;AAC3B,MAAAD,EAAM,cAAc,WAAWD,CAAG,SAASA,CAAG,KAAKI,CAAI,IAAI,GAC3D,OAAO,aAAa,QAAQJ,GAAKI,CAAI;AAAA,IACtC,QAAe;AAAA,IAAC;AAAA,EACjB,GAGA,OAAO,sBAAsBF,GAAM;AACpC,GAAC;"}
1
+ {"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js?raw"],"sourcesContent":["export default \"if (\\n\\ttypeof window !== \\\"undefined\\\" &&\\n\\twindow.CSSStyleSheet &&\\n\\tdocument.adoptedStyleSheets\\n)\\n\\t(() => {\\n\\t\\tconst key = \\\"--mtds-app-expanded\\\";\\n\\t\\tconst sheet = new CSSStyleSheet();\\n\\t\\tconst prev = () => !window.localStorage.getItem(key)?.includes(\\\"false\\\");\\n\\n\\t\\tdocument.adoptedStyleSheets.push(sheet);\\n\\t\\twindow.mtdsToggleAppExpanded = (force) => {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tconst next = force ?? !prev();\\n\\t\\t\\t\\tsheet.replaceSync?.(`:root { ${key}: var(${key}--${next})}`);\\n\\t\\t\\t\\twindow.localStorage.setItem(key, next);\\n\\t\\t\\t} catch (_err) {} // localStorage is full or replaceSync is not supported\\n\\t\\t};\\n\\n\\t\\t// Set and store initial state\\n\\t\\twindow.mtdsToggleAppExpanded(prev());\\n\\t})();\\n\""],"names":["script"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
package/mtds/app/app.js CHANGED
@@ -3,7 +3,7 @@ import a from "clsx";
3
3
  import { forwardRef as n } from "react";
4
4
  import { Button as m } from "../button/button.js";
5
5
  import s from "../styles.module.css.js";
6
- import d from "./app-toggle.js";
6
+ import d from "./app-toggle2.js";
7
7
  const u = n(function({ as: r, className: t, ...p }, e) {
8
8
  return /* @__PURE__ */ o(r || "div", { className: a(s.app, t), ref: e, ...p });
9
9
  }), f = n(function({ as: r, className: t, ...p }, e) {
@@ -19,7 +19,7 @@ class r extends g {
19
19
  }
20
20
  constructor() {
21
21
  super(), this.attachShadow({ mode: "open" }).append(m("figure")), C(this, `@layer leaflet{${h}}
22
- @layer mt.v3-2-7design{${b}`);
22
+ @layer mt.v3-2-8design{${b}`);
23
23
  }
24
24
  connectedCallback() {
25
25
  const t = this.shadowRoot?.lastElementChild, e = a(this, "data-cluster") ?? "false", o = new i.TileLayer(k, {
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="290" height="290" fill="none" viewBox="0 0 290 290"><path fill="#fff" d="M145 0c80.08 0 145 64.92 145 145s-64.92 145-145 145S0 225.08 0 145 64.92 0 145 0"/><path fill="#c8102e" d="M145 0c9.93 0 19.63 1 29 2.9V116h113.1A146 146 0 0 1 290 145c0 9.93-1 19.62-2.9 28.99H174v113.1q-13.34 2.73-27.44 2.9h-3.12q-14.1-.17-27.44-2.9V174H2.9C1 164.62 0 154.93 0 145s1-19.64 2.9-29.01H116V2.9C125.37 1 135.07 0 145 0m48.32 193.34c10.73.04 21.47-.08 32.2.06a9101 9101 0 0 1 43.83 26.22 145 145 0 0 1-11.07 15.9l-64.96-38.98zm-166.45.07c12.51-.17 25.05-.03 37.57-.07l-43.8 26.27a145 145 0 0 1-8.85-17.24q7.5-4.54 15.07-8.97zm4.84-138.92A33624 33624 0 0 0 96.6 93.35c.07 1.1.12 2.21.07 3.32-10.73-.04-21.47.08-32.19-.06a13105 13105 0 0 1-43.83-26.22 145 145 0 0 1 11.07-15.9m237.64 15.9a145 145 0 0 1 8.85 17.24q-7.5 4.51-15.06 8.96c-12.52.17-25.05.03-37.58.07z"/><path fill="#012169" d="M251.9 242.97a145 145 0 0 1-58.57 38.78v-73.93zM96.66 281.75a145 145 0 0 1-58.56-38.78l58.56-35.13zm96.67-273.5c22.63 8 42.68 21.45 58.57 38.79l-58.57 35.14zM96.66 82.16 38.1 47.03A145 145 0 0 1 96.66 8.25z"/></svg>
@@ -744,6 +744,10 @@
744
744
  "categories": ["Flagg"],
745
745
  "tags": ["flagg", "Sverige"]
746
746
  },
747
+ "flagg-uk.svg": {
748
+ "categories": ["Flagg"],
749
+ "tags": ["flagg", "England", "Storbritannia", "UK", "Engelsk"]
750
+ },
747
751
  "forstorrelsesglass.svg": {
748
752
  "categories": ["Utstyr"],
749
753
  "tags": ["forstørrelsesglass", "lupe"]