@mattilsynet/design 1.2.2 → 1.3.0

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.
@@ -0,0 +1,30 @@
1
+ type Matomo = (string | number | boolean)[];
2
+ declare global {
3
+ interface Window {
4
+ _paq?: Matomo[];
5
+ }
6
+ }
7
+ export type AnalyticsActions = {
8
+ init: {
9
+ matomoId: number | string;
10
+ enabled?: boolean | "debug";
11
+ };
12
+ pageview: {
13
+ url?: string;
14
+ title?: string;
15
+ };
16
+ event: {
17
+ category: string;
18
+ action: string;
19
+ name?: string;
20
+ value?: number;
21
+ };
22
+ search: {
23
+ query: string;
24
+ category?: string;
25
+ results?: number;
26
+ };
27
+ matomo: Matomo;
28
+ };
29
+ export declare function analytics<Action extends keyof AnalyticsActions>(action: Action, args?: AnalyticsActions[Action]): void;
30
+ export {};
@@ -0,0 +1,36 @@
1
+ import { IS_BROWSER as r } from "../utils.js";
2
+ const a = "mattilsynet.matomo.cloud";
3
+ let s = !0;
4
+ function d(o, n = {}) {
5
+ if (r) {
6
+ if (window._paq || (window._paq = [], window._paq.push(["HeatmapSessionRecording::disable"]), window._paq.push(["enableLinkTracking"]), window._paq.push(["setTrackerUrl", `https://${a}/matomo.php`]), document.querySelector('script[src*="matomo.js"]') || document.documentElement.append(
7
+ Object.assign(document.createElement("script"), {
8
+ async: !0,
9
+ src: `https://cdn.matomo.cloud/${a}/matomo.js`
10
+ })
11
+ )), o === "init") {
12
+ const { matomoId: e, enabled: t = !0 } = n;
13
+ s = t, window._paq.push(["setSiteId", e]);
14
+ }
15
+ if (s === "debug") return console.info(`Analytics: "${o}"`, n);
16
+ if (!(s === !1 || window.location.hostname === "localhost"))
17
+ if (o === "pageview") {
18
+ const { url: e, title: t } = n;
19
+ window._paq.push(["setCustomUrl", e || location.href]), window._paq.push(["setDocumentTitle", t || document.title]), window._paq.push(["trackPageView"]);
20
+ } else if (o === "event") {
21
+ const { category: e, action: t, name: i, value: c } = n, p = ["trackEvent", e, t, i, c];
22
+ window._paq.push(p.filter((l) => l !== void 0));
23
+ } else if (o === "search") {
24
+ const {
25
+ query: e,
26
+ category: t = !1,
27
+ results: i = !1
28
+ } = n;
29
+ window._paq.push(["trackSiteSearch", e, t, i]);
30
+ } else o === "matomo" && window._paq.push(n);
31
+ }
32
+ }
33
+ export {
34
+ d as analytics
35
+ };
36
+ //# sourceMappingURL=analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.js","sources":["../../designsystem/analytics/analytics.ts"],"sourcesContent":["import { IS_BROWSER } from \"../utils\";\n\nconst MATOMO = \"mattilsynet.matomo.cloud\";\nlet ENABLED: AnalyticsActions[\"init\"][\"enabled\"] = true;\n\ntype Matomo = (string | number | boolean)[];\ndeclare global {\n\tinterface Window {\n\t\t_paq?: Matomo[];\n\t}\n}\n\nexport type AnalyticsActions = {\n\tinit: {\n\t\tmatomoId: number | string;\n\t\tenabled?: boolean | \"debug\";\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 (!IS_BROWSER) 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\tdocument.querySelector('script[src*=\"matomo.js\"]') ||\n\t\t\tdocument.documentElement.append(\n\t\t\t\tObject.assign(document.createElement(\"script\"), {\n\t\t\t\t\tasync: true,\n\t\t\t\t\tsrc: `https://cdn.matomo.cloud/${MATOMO}/matomo.js`,\n\t\t\t\t}),\n\t\t\t);\n\t}\n\tif (action === \"init\") {\n\t\tconst { matomoId, enabled = true } = args as AnalyticsActions[\"init\"];\n\t\tENABLED = enabled;\n\t\twindow._paq.push([\"setSiteId\", matomoId]);\n\t}\n\n\tif (ENABLED === \"debug\") return console.info(`Analytics: \"${action}\"`, args);\n\tif (ENABLED === false || window.location.hostname === \"localhost\") return;\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\t\twindow._paq.push(event.filter((v) => v !== undefined));\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\twindow._paq.push(args as AnalyticsActions[\"matomo\"]);\n\t}\n}\n"],"names":["MATOMO","ENABLED","analytics","action","args","IS_BROWSER","matomoId","enabled","url","title","category","name","value","event","v","query","results"],"mappings":";AAEA,MAAMA,IAAS;AACf,IAAIC,IAA+C;AAgC5C,SAASC,EACfC,GACAC,IAAO,IACN;AACD,MAAKC,GAcL;AAAA,QAbK,OAAO,SACX,OAAO,OAAO,CAAC,GACf,OAAO,KAAK,KAAK,CAAC,kCAAkC,CAAC,GACrD,OAAO,KAAK,KAAK,CAAC,oBAAoB,CAAC,GACvC,OAAO,KAAK,KAAK,CAAC,iBAAiB,WAAWL,CAAM,aAAa,CAAC,GAClE,SAAS,cAAc,0BAA0B,KAChD,SAAS,gBAAgB;AAAA,MACxB,OAAO,OAAO,SAAS,cAAc,QAAQ,GAAG;AAAA,QAC/C,OAAO;AAAA,QACP,KAAK,4BAA4BA,CAAM;AAAA,MACvC,CAAA;AAAA,IACF,IAEEG,MAAW,QAAQ;AACtB,YAAM,EAAE,UAAAG,GAAU,SAAAC,IAAU,GAAS,IAAAH;AAC3B,MAAAH,IAAAM,GACV,OAAO,KAAK,KAAK,CAAC,aAAaD,CAAQ,CAAC;AAAA,IAAA;AAGrC,QAAAL,MAAY,QAAgB,QAAA,QAAQ,KAAK,eAAeE,CAAM,KAAKC,CAAI;AAC3E,QAAI,EAAAH,MAAY,MAAS,OAAO,SAAS,aAAa;AAEtD,UAAIE,MAAW,YAAY;AACpB,cAAA,EAAE,KAAAK,GAAK,OAAAC,EAAA,IAAUL;AACvB,eAAO,KAAK,KAAK,CAAC,gBAAgBI,KAAO,SAAS,IAAI,CAAC,GACvD,OAAO,KAAK,KAAK,CAAC,oBAAoBC,KAAS,SAAS,KAAK,CAAC,GAC9D,OAAO,KAAK,KAAK,CAAC,eAAe,CAAC;AAAA,MAAA,WACxBN,MAAW,SAAS;AAC9B,cAAM,EAAE,UAAAO,GAAU,QAAAP,GAAQ,MAAAQ,GAAM,OAAAC,MAAUR,GACpCS,IAAQ,CAAC,cAAcH,GAAUP,GAAQQ,GAAMC,CAAK;AACnD,eAAA,KAAK,KAAKC,EAAM,OAAO,CAACC,MAAMA,MAAM,MAAS,CAAC;AAAA,MAAA,WAC3CX,MAAW,UAAU;AACzB,cAAA;AAAA,UACL,OAAAY;AAAA,UACA,UAAAL,IAAW;AAAA,UACX,SAAAM,IAAU;AAAA,QAAA,IACPZ;AACJ,eAAO,KAAK,KAAK,CAAC,mBAAmBW,GAAOL,GAAUM,CAAO,CAAC;AAAA,MAAA,MAC/D,CAAWb,MAAW,YACd,OAAA,KAAK,KAAKC,CAAkC;AAAA;AAErD;"}
@@ -1,6 +1,6 @@
1
1
  import m from "../styles.module.css.js";
2
2
  import { onLoaded as C, onMutation as T, on as r, QUICK_EVENT as p, debounce as P } from "../utils.js";
3
- import "./app-toggle2.js";
3
+ import "./app-toggle.js";
4
4
  const f = m.app.split(" ")[0], _ = m.sticky.split(" ")[0], h = '[data-command="toggle-app-expanded"]', g = `.${f} > dialog,.${f} dialog ~ main`, S = (t) => {
5
5
  document.startViewTransition ? document.startViewTransition(t) : t();
6
6
  }, E = (t) => (
@@ -1,27 +1,15 @@
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", t = new CSSStyleSheet(), n = () => {
3
+ var d;
4
+ return !((d = window.localStorage.getItem(e)) != null && d.includes("false"));
5
+ };
6
+ document.adoptedStyleSheets.push(t), window.mtdsToggleAppExpanded = (d) => {
7
+ var p;
8
+ try {
9
+ const o = d ?? !n();
10
+ (p = t.replaceSync) == null || p.call(t, `:root { ${e}: var(${e}--${o})}`), window.localStorage.setItem(e, o);
11
+ } catch {
12
+ }
13
+ }, window.mtdsToggleAppExpanded(n());
14
+ })();
27
15
  //# 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,MAAeA,IAAA;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","_a","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM;AARrB,QAAAC;AAQqB,cAACA,IAAA,OAAO,aAAa,QAAQH,CAAG,MAA/B,QAAAG,EAAkC,SAAS;AAAA;AAE/D,WAAS,mBAAmB,KAAKF,CAAK,GACtC,OAAO,wBAAwB,CAACG,MAAU;AAX5C,QAAAD;AAYG,QAAI;AACH,YAAME,IAAOD,KAAS,CAACF,EAAM;AAC7B,OAAAC,IAAAF,EAAM,gBAAN,QAAAE,EAAA,KAAAF,GAAoB,WAAWD,CAAG,SAASA,CAAG,KAAKK,CAAI,OACvD,OAAO,aAAa,QAAQL,GAAKK,CAAI;AAAA,IACzC,QAAiB;AAAA,IAAE;AAAA,EAChB,GAGD,OAAO,sBAAsBH,GAAM;AACrC,GAAK;"}
@@ -1,15 +1,27 @@
1
- typeof window < "u" && window.CSSStyleSheet && document.adoptedStyleSheets && (() => {
2
- const e = "--mtds-app-expanded", t = new CSSStyleSheet(), n = () => {
3
- var d;
4
- return !((d = window.localStorage.getItem(e)) != null && d.includes("false"));
5
- };
6
- document.adoptedStyleSheets.push(t), window.mtdsToggleAppExpanded = (d) => {
7
- var p;
8
- try {
9
- const o = d ?? !n();
10
- (p = t.replaceSync) == null || p.call(t, `:root { ${e}: var(${e}--${o})}`), window.localStorage.setItem(e, o);
11
- } catch {
12
- }
13
- }, window.mtdsToggleAppExpanded(n());
14
- })();
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
+ };
15
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","_a","force","next"],"mappings":"AACC,OAAO,SAAW,OAClB,OAAO,iBACP,SAAS,uBAER,MAAM;AACN,QAAMA,IAAM,uBACNC,IAAQ,IAAI,cAAe,GAC3BC,IAAO,MAAM;AARrB,QAAAC;AAQqB,cAACA,IAAA,OAAO,aAAa,QAAQH,CAAG,MAA/B,QAAAG,EAAkC,SAAS;AAAA;AAE/D,WAAS,mBAAmB,KAAKF,CAAK,GACtC,OAAO,wBAAwB,CAACG,MAAU;AAX5C,QAAAD;AAYG,QAAI;AACH,YAAME,IAAOD,KAAS,CAACF,EAAM;AAC7B,OAAAC,IAAAF,EAAM,gBAAN,QAAAE,EAAA,KAAAF,GAAoB,WAAWD,CAAG,SAASA,CAAG,KAAKK,CAAI,OACvD,OAAO,aAAa,QAAQL,GAAKK,CAAI;AAAA,IACzC,QAAiB;AAAA,IAAE;AAAA,EAChB,GAGD,OAAO,sBAAsBH,GAAM;AACrC,GAAK;"}
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,MAAeA,IAAA;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
@@ -2,7 +2,7 @@ import { jsx as o } from "react/jsx-runtime";
2
2
  import { clsx as a } from "../external/clsx/dist/clsx.js";
3
3
  import { forwardRef as p } from "react";
4
4
  import c from "../styles.module.css.js";
5
- import m from "./app-toggle.js";
5
+ import m from "./app-toggle2.js";
6
6
  const f = p(function({ as: r, className: t, ...n }, e) {
7
7
  return /* @__PURE__ */ o(r || "div", { className: a(c.app, t), ref: e, ...n });
8
8
  }), d = p(function({ as: r, className: t, ...n }, e) {
@@ -1,32 +1,32 @@
1
- var J = Object.defineProperty, B = Object.getOwnPropertySymbols, Q = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable, F = (t, e, o) => e in t ? J(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, tt = (t, e) => {
1
+ var J = Object.defineProperty, F = Object.getOwnPropertySymbols, Q = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable, H = (t, e, o) => e in t ? J(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, tt = (t, e) => {
2
2
  for (var o in e || (e = {}))
3
- Q.call(e, o) && F(t, o, e[o]);
4
- if (B)
5
- for (var o of B(e))
6
- Z.call(e, o) && F(t, o, e[o]);
3
+ Q.call(e, o) && H(t, o, e[o]);
4
+ if (F)
5
+ for (var o of F(e))
6
+ Z.call(e, o) && H(t, o, e[o]);
7
7
  return t;
8
- }, T = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", V = T && /android/i.test(navigator.userAgent), et = T && /firefox/i.test(navigator.userAgent), ot = T && /iPad|iPhone|iPod/.test(navigator.userAgent), H;
8
+ }, T = typeof window < "u" && typeof window.document < "u" && typeof window.navigator < "u", j = T && /android/i.test(navigator.userAgent), et = T && /firefox/i.test(navigator.userAgent), ot = T && /iPad|iPhone|iPod/.test(navigator.userAgent), q;
9
9
  T && // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474
10
- /^Mac/i.test(((H = navigator.userAgentData) == null ? void 0 : H.platform) || navigator.platform);
10
+ /^Mac/i.test(((q = navigator.userAgentData) == null ? void 0 : q.platform) || navigator.platform);
11
11
  var it = "outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color", nt = typeof HTMLElement > "u" ? class {
12
12
  } : HTMLElement;
13
13
  function l(t, e, o) {
14
14
  return o === void 0 ? t.getAttribute(e) : (o === null ? t.removeAttribute(e) : t.getAttribute(e) !== o && t.setAttribute(e, o), null);
15
15
  }
16
- var j = (t, e, o) => {
17
- for (const n of o[0].split(","))
18
- o[0] = n, Element.prototype[`${t}EventListener`].apply(e, o);
19
- }, R = (t, ...e) => j("add", t, e), rt = (t, ...e) => j("remove", t, e), k = /* @__PURE__ */ new WeakMap(), D = (t, e) => {
20
- if (e === void 0) return k.get(t);
16
+ var K = (t, e, o) => {
17
+ for (const r of o[0].split(","))
18
+ o[0] = r, Element.prototype[`${t}EventListener`].apply(e, o);
19
+ }, R = (t, ...e) => K("add", t, e), rt = (t, ...e) => K("remove", t, e), S = /* @__PURE__ */ new WeakMap(), M = (t, e) => {
20
+ if (e === void 0) return S.get(t);
21
21
  try {
22
- k.get(t).disconnect(), k.delete(t);
22
+ S.get(t).disconnect(), S.delete(t);
23
23
  } catch {
24
24
  }
25
25
  if (e) {
26
26
  const o = new MutationObserver(
27
- (n) => t.handleEvent({ type: "mutation", detail: n })
27
+ (r) => t.handleEvent({ type: "mutation", detail: r })
28
28
  );
29
- o.observe(t, e), k.set(t, o);
29
+ o.observe(t, e), S.set(t, o);
30
30
  }
31
31
  }, at = (t) => {
32
32
  const e = "key" in t && (t.key === " " || t.key === "Enter");
@@ -35,20 +35,20 @@ var j = (t, e, o) => {
35
35
  var e;
36
36
  const o = ((e = t.getRootNode) == null ? void 0 : e.call(t)) || t.ownerDocument;
37
37
  return o instanceof Document || o instanceof ShadowRoot ? o : document;
38
- }, ut = 0, st = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++ut).toString(32)}`), t.id) : "", C = (t, e, o) => {
39
- const n = document.createElement(t);
40
- if (e && (n.textContent = e), o) for (const [r, a] of Object.entries(o)) l(n, r, a);
41
- return n;
38
+ }, st = 0, ut = (t) => t ? (t.id || (t.id = `:${t.nodeName.toLowerCase()}${(++st).toString(32)}`), t.id) : "", C = (t, e, o) => {
39
+ const r = document.createElement(t);
40
+ if (e && (r.textContent = e), o) for (const [i, a] of Object.entries(o)) l(r, i, a);
41
+ return r;
42
42
  }, dt = {
43
43
  define: (t, e) => !T || window.customElements.get(t) || window.customElements.define(t, e)
44
44
  }, ct = (t) => {
45
45
  const e = C("div");
46
46
  return e.style.cssText = "position:fixed;overflow:hidden;width:1px;white-space:nowrap", l(e, "aria-live", t), e;
47
- }, K = (t, e, o = "") => {
48
- var n, r;
47
+ }, U = (t, e, o = "") => {
48
+ var r, i;
49
49
  const a = { bubbles: !0, composed: !0, data: e, inputType: o }, s = HTMLInputElement.prototype;
50
- t.dispatchEvent(new InputEvent("beforeinput", a)), (r = (n = Object.getOwnPropertyDescriptor(s, "value")) == null ? void 0 : n.set) == null || r.call(t, e), t.dispatchEvent(new InputEvent("input", a)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
51
- }, g, vt = 0, N = !1, q = "beforeinput,blur,focus,click,input,keydown,mousedown,mouseup", U = { once: !0, passive: !0 }, pt = et && !V, ft = V || ot, A = "false", mt = "insertReplacementText", O = {
50
+ t.dispatchEvent(new InputEvent("beforeinput", a)), (i = (r = Object.getOwnPropertyDescriptor(s, "value")) == null ? void 0 : r.set) == null || i.call(t, e), t.dispatchEvent(new InputEvent("input", a)), t.dispatchEvent(new Event("change", { bubbles: !0 }));
51
+ }, y, vt = 0, N = !1, V = "beforeinput,blur,focus,click,input,keydown,mousedown,mouseup", X = { once: !0, passive: !0 }, pt = et && !j, ft = j || ot, A = "false", mt = "insertReplacementText", O = {
52
52
  added: "Added",
53
53
  empty: "No selected",
54
54
  found: "Navigate left to find %d selected",
@@ -80,18 +80,18 @@ var j = (t, e, o) => {
80
80
  return Object.keys(O).map((t) => `data-sr-${t}`);
81
81
  }
82
82
  connectedCallback() {
83
- this._root = lt(this), R(this, q, this, !0), D(this, { childList: !0 }), setTimeout(w, 0, this), setTimeout($, 0, this);
83
+ this._root = lt(this), R(this, V, this, !0), M(this, { childList: !0 }), setTimeout(w, 0, this), setTimeout($, 0, this);
84
84
  }
85
85
  attributeChangedCallback(t, e, o) {
86
- const n = t.split("data-sr-")[1];
87
- O[n] && (this._texts[n] = o || O[n]);
86
+ const r = t.split("data-sr-")[1];
87
+ O[r] && (this._texts[r] = o || O[r]);
88
88
  }
89
89
  disconnectedCallback() {
90
- X(this), D(this, !1), rt(this, q, this, !0), this._root = void 0;
90
+ W(this), M(this, !1), rt(this, V, this, !0), this._root = void 0;
91
91
  }
92
92
  handleEvent(t) {
93
93
  const e = t.target;
94
- t.type === "beforeinput" && (this._value = (e == null ? void 0 : e.value) || ""), t.type === "blur" && _t(this), t.type === "click" && yt(this, t), t.type === "focus" && bt(this, t), t.type === "input" && Et(this, t), t.type === "keydown" && wt(this, t), t.type === "mousedown" && (N = this.contains(e)), t.type === "mouseup" && (N = !1), t.type === "mutation" && w(this, t);
94
+ t.type === "beforeinput" && (this._value = (e == null ? void 0 : e.value) || ""), t.type === "blur" && _t(this), t.type === "click" && gt(this, t), t.type === "focus" && bt(this, t), t.type === "input" && Et(this, t), t.type === "keydown" && wt(this, t), t.type === "mousedown" && (N = this.contains(e)), t.type === "mouseup" && (N = !1), t.type === "mutation" && w(this, t);
95
95
  }
96
96
  get multiple() {
97
97
  var t;
@@ -135,100 +135,105 @@ var j = (t, e, o) => {
135
135
  return ((e = t == null ? void 0 : t.textContent) == null ? void 0 : e.trim()) || "";
136
136
  }, P = (t) => typeof t == "string" ? C("data", t, { value: t }) : t instanceof HTMLDataElement ? t : C("data", t.label || t.value, {
137
137
  value: t.value || t.label || ""
138
- }), X = (t) => {
138
+ }), W = (t) => {
139
139
  t._focus = t._control = t._items = t._list = t._options = void 0;
140
140
  }, w = (t, e) => {
141
- var o, n, r;
142
- let { _focus: a, _speak: s, _texts: u, items: p, control: i, list: d, multiple: c } = t;
143
- const { addedNodes: f, removedNodes: m } = (e == null ? void 0 : e.detail[0]) || {}, b = (e == null ? void 0 : e.detail[1]) || (f == null ? void 0 : f[1]) || (f == null ? void 0 : f[1]) ? null : (f == null ? void 0 : f[0]) || (m == null ? void 0 : m[0]), L = c ? p.length : 1, M = [];
144
- if ((b == null ? void 0 : b.nodeName) === "DATA" && (c ? a : b === a)) {
145
- const v = (i == null ? void 0 : i.inputMode) || null, h = (a == null ? void 0 : a.nodeName) === "DATA" ? i : a;
146
- s = `${u[b.isConnected ? "added" : "removed"]} ${_(b)}, `, (ft || a === i) && (g.textContent = s), i && i !== h && (l(i, "aria-hidden", "true"), i.inputMode = "none", i.focus()), setTimeout(() => {
141
+ var o, r, i;
142
+ let { _focus: a, _speak: s, _texts: u, items: d, control: n, list: c, multiple: v } = t;
143
+ const { addedNodes: f, removedNodes: m } = (e == null ? void 0 : e.detail[0]) || {}, b = (e == null ? void 0 : e.detail[1]) || (f == null ? void 0 : f[1]) || (f == null ? void 0 : f[1]) ? null : (f == null ? void 0 : f[0]) || (m == null ? void 0 : m[0]), L = v ? d.length : 1, D = [];
144
+ let B = `${s}${_((o = n == null ? void 0 : n.labels) == null ? void 0 : o[0])}, ${v ? L ? u.found.replace("%d", `${L}`) : u.empty : ""}`;
145
+ if (n && (b == null ? void 0 : b.nodeName) === "DATA" && // Announce if only one item has changed...
146
+ (v ? a : b === a)) {
147
+ const p = l(n, "inputmode"), h = (a == null ? void 0 : a.nodeName) === "DATA" ? n : a;
148
+ s = `${u[b.isConnected ? "added" : "removed"]} ${_(b)}, `, (ft || a === n) && (y.textContent = s), n !== h && (l(n, "aria-expanded", null), l(n, "inputmode", "none"), B = " ", n.focus()), setTimeout(() => {
147
149
  var x;
148
- i && l(i, "aria-hidden", null), i && l(i, "inputMode", v), (x = h == null ? void 0 : h.focus) == null || x.call(h), t._speak = "", pt ? R(t, "blur", () => w(t), U) : setTimeout(w, 100, t);
150
+ l(n, "aria-expanded", "true"), l(n, "inputmode", p), (x = h == null ? void 0 : h.focus) == null || x.call(h), t._speak = "", pt ? R(t, "blur", () => w(t), X) : setTimeout(w, 100, t);
149
151
  }, 100);
150
152
  }
151
- const Y = b != null && b.isConnected ? b : p[0];
152
- Array.from(p, (v) => {
153
- if (!c && v !== Y) return v.remove();
154
- const h = _(v), x = v.value || h, G = `${s}${h}, ${u.remove}, ${M.push(x)} ${u.of} ${L}`;
155
- l(v, "role", "button"), l(v, "value", x), l(v, "tabindex", "-1"), l(v, "aria-label", G);
153
+ const z = b != null && b.isConnected ? b : d[0];
154
+ Array.from(d, (p) => {
155
+ if (!v && p !== z) return p.remove();
156
+ const h = _(p), x = p.value || h, G = `${s}${h}, ${u.remove}, ${D.push(x)} ${u.of} ${L}`;
157
+ l(p, "role", "button"), l(p, "value", x), l(p, "tabindex", "-1"), l(p, "aria-label", G);
156
158
  });
157
- for (const v of t.options || []) {
158
- const h = (o = l(v, "value")) != null ? o : _(v);
159
- l(v, "aria-label", s ? `${s}${_(v)}` : null), l(v, "selected", M.includes(h) ? "" : null);
160
- }
161
- const z = `${s}${_((n = i == null ? void 0 : i.labels) == null ? void 0 : n[0])}, ${c ? L ? u.found.replace("%d", `${L}`) : u.empty : ""}`;
162
- d && l(d, "aria-multiselectable", `${c}`), i && l(i, "list", st(d)), i && l(i, "aria-label", z), t._value = (i == null ? void 0 : i.value) || "";
163
- const S = t.querySelector("del");
164
- S && l(S, "role", "button"), S && (S.hidden = !(i != null && i.value));
165
- const y = t.querySelector("select");
166
- y && (y.multiple = c), y && (y.textContent = ""), y == null || y.append(...M.map((v) => new Option("", v, !0, !0))), (r = D(t)) == null || r.takeRecords();
159
+ for (const p of t.options || []) {
160
+ const h = (r = l(p, "value")) != null ? r : _(p);
161
+ l(p, "aria-label", s ? `${s}${_(p)}` : null), l(p, "selected", D.includes(h) ? "" : null);
162
+ }
163
+ c && l(c, "aria-multiselectable", `${v}`), n && l(n, "list", ut(c)), n && l(n, "aria-label", B), t._value = (n == null ? void 0 : n.value) || "";
164
+ const k = t.querySelector("del");
165
+ k && l(k, "role", "button"), k && (k.hidden = !(n != null && n.value));
166
+ const g = t.querySelector("select");
167
+ g && (g.multiple = v), g && (g.textContent = ""), g == null || g.append(...D.map((p) => new Option("", p, !0, !0))), (i = M(t)) == null || i.takeRecords();
167
168
  }, $ = (t, e) => {
168
- const { multiple: o, control: n, items: r } = t;
169
- if (!(o || !n || !r[0])) {
170
- if (e) return K(n, _(t.items[0]), "insertText");
171
- n.value = _(t.items[0]);
169
+ const { multiple: o, control: r, items: i } = t;
170
+ if (!(o || !r || !i[0])) {
171
+ if (e) return U(r, _(t.items[0]), "insertText");
172
+ r.value = _(t.items[0]);
172
173
  }
173
- }, W = (t) => {
174
+ }, Y = (t) => {
174
175
  var e;
175
- const { options: o = [], creatable: n, control: r, items: a, multiple: s } = t, u = ((e = r == null ? void 0 : r.value) == null ? void 0 : e.trim()) || "", p = u.toLowerCase() || null;
176
- let i = [...o].find((c) => c.label.trim().toLowerCase() === p);
177
- const d = { bubbles: !0, cancelable: !0, detail: i };
178
- if (t.dispatchEvent(new CustomEvent("beforematch", d)))
179
- for (const c of o) c.selected = c === i;
180
- if (i = [...o].find((c) => c.selected), !i && n && u)
176
+ const { options: o = [], creatable: r, control: i, items: a, multiple: s } = t, u = ((e = i == null ? void 0 : i.value) == null ? void 0 : e.trim()) || "", d = u.toLowerCase() || null;
177
+ let n = [...o].find((v) => v.label.trim().toLowerCase() === d);
178
+ const c = { bubbles: !0, cancelable: !0, detail: n };
179
+ if (t.dispatchEvent(new CustomEvent("beforematch", c)))
180
+ for (const v of o) v.selected = v === n;
181
+ if (n = [...o].find((v) => v.selected), !n && r && u)
181
182
  return E(t, P(u), !1);
182
- if (!i && !s && a[0]) return E(t, a[0]);
183
- if (!i || t.values.includes(i.value)) return w(t);
184
- E(t, i, !1);
183
+ if (!n && !s && a[0]) return E(t, a[0]);
184
+ if (!n || t.values.includes(n.value)) return w(t);
185
+ E(t, n, !1);
185
186
  }, E = (t, e, o = !0) => {
186
- const n = P(e), r = [...t.items].find((s) => s.value === e.value), a = { bubbles: !0, cancelable: !0, detail: r || n };
187
- if (!(r && !o)) {
187
+ const r = P(e), i = [...t.items].find((s) => s.value === e.value), a = { bubbles: !0, cancelable: !0, detail: i || r };
188
+ if (!(i && !o)) {
188
189
  if (!t.dispatchEvent(new CustomEvent("beforechange", a)))
189
190
  return w(t);
190
- r ? r.remove() : t.add(n), t.dispatchEvent(new CustomEvent("afterchange", a));
191
+ i ? i.remove() : t.add(r), t.dispatchEvent(new CustomEvent("afterchange", a));
191
192
  }
192
193
  }, bt = (t, { target: e }) => {
193
- g || (g = ct("assertive")), g.isConnected || document.body.appendChild(g), e instanceof HTMLElement && (t._focus = e), t._items || (t._control = t.control || void 0, t._items = t.items, t._list = t.list || void 0, t._options = t.options || void 0);
194
- }, _t = (t) => N || setTimeout(gt, 0, t), gt = (t) => {
194
+ y || (y = ct("assertive")), y.isConnected || document.body.appendChild(y), e instanceof HTMLElement && (t._focus = e), t._items || (t._control = t.control || void 0, t._items = t.items, t._list = t.list || void 0, t._options = t.options || void 0);
195
+ }, _t = (t) => N || setTimeout(yt, 0, t), yt = (t) => {
195
196
  var e;
196
- !t._focus || t.contains((e = t._root) == null ? void 0 : e.activeElement) || ($(t, !0), X(t));
197
- }, yt = (t, e) => {
198
- var o, n;
199
- const r = (n = (o = e.target) == null ? void 0 : o.closest) == null ? void 0 : n.call(o, "del"), { clientX: a, clientY: s, target: u } = e, { control: p, items: i } = t;
200
- if (r && p)
201
- return e.preventDefault(), K(p, "", "deleteContentBackward"), p.focus();
202
- for (const d of i) {
203
- const { top: c, right: f, bottom: m, left: I } = d.getBoundingClientRect();
204
- if (d.contains(u)) return E(t, d);
205
- if (s >= c && s <= m && a >= I && a <= f) return d.focus();
206
- }
207
- u === t && (p == null || p.focus());
197
+ !t._focus || t.contains((e = t._root) == null ? void 0 : e.activeElement) || ($(t, !0), W(t));
198
+ }, gt = (t, e) => {
199
+ var o, r;
200
+ const i = (r = (o = e.target) == null ? void 0 : o.closest) == null ? void 0 : r.call(o, "del"), { clientX: a, clientY: s, target: u } = e, { control: d, items: n } = t;
201
+ if (i && d)
202
+ return e.preventDefault(), U(d, "", "deleteContentBackward"), d.focus();
203
+ for (const c of n) {
204
+ const { top: v, right: f, bottom: m, left: I } = c.getBoundingClientRect();
205
+ if (c.contains(u)) return E(t, c);
206
+ if (s >= v && s <= m && a >= I && a <= f) return c.focus();
207
+ }
208
+ u === t && (d == null || d.focus());
208
209
  }, Et = (t, e) => {
209
- var o, n;
210
- const { options: r = [], control: a, multiple: s } = t, u = ((o = a == null ? void 0 : a.value) == null ? void 0 : o.trim()) || "", p = e instanceof InputEvent ? !e.inputType || e.inputType === mt : !!u;
211
- if ((n = t.querySelector("del")) == null || n.toggleAttribute("hidden", !u), !p) return s || W(t);
212
- e.stopImmediatePropagation(), a && (a.value = t._value);
213
- for (const i of r)
214
- if (i.value && i.value === u)
215
- return E(t, i, s), setTimeout($, 0, t, !0);
210
+ var o;
211
+ const { options: r = [], control: i, multiple: a } = t, s = ((o = i == null ? void 0 : i.value) == null ? void 0 : o.trim()) || "";
212
+ if (e instanceof InputEvent ? !e.inputType || e.inputType === mt : !!s) {
213
+ e.stopImmediatePropagation(), i && (i.value = t._value);
214
+ for (const d of r)
215
+ if (d.value && d.value === s)
216
+ return E(t, d, a), setTimeout($, 0, t, !0);
217
+ } else {
218
+ const d = t.querySelector("del");
219
+ return d && (d.hidden = !s), a || Y(t);
220
+ }
216
221
  }, wt = (t, e) => {
217
222
  var o;
218
223
  if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
219
- const { _texts: n, control: r, items: a, multiple: s } = t, { key: u, repeat: p, target: i } = e, d = r && r === i, c = d && (r == null ? void 0 : r.selectionEnd), f = d && u === "Tab" && t.querySelector("del");
220
- let m = d ? a.length : [...a].indexOf(i);
221
- if (f && !f.hidden && (e.preventDefault(), f.tabIndex = -1, f.focus(), R(f, "blur", () => l(f, "tabindex", null), U)), !(!d && at(e) || m === -1)) {
222
- if (u === "ArrowRight" && !d) m += 1;
223
- else if (u === "ArrowLeft" && !c) m -= 1;
224
- else if (u === "Enter" && d) {
225
- const I = l(r, "form");
226
- return l(r, "form", "#"), requestAnimationFrame(() => l(r, "form", I)), s ? W(t) : !t.items[0] && g && (g.textContent = `${n.invalid}${++vt % 2 ? " " : ""}`), $(t, !0);
227
- } else if ((u === "Backspace" || u === "Delete") && !c) {
228
- if (e.preventDefault(), !p && a[m]) return E(t, a[m]);
229
- d && (m -= 1);
230
- } else return d || (r == null ? void 0 : r.focus());
231
- e.preventDefault(), (o = a[Math.max(0, m)] || r) == null || o.focus();
224
+ const { _texts: r, control: i, items: a, multiple: s } = t, { key: u, repeat: d, target: n } = e, c = i && i === n, v = c && (i == null ? void 0 : i.selectionEnd), f = c && u === "Tab" && t.querySelector("del");
225
+ let m = c ? a.length : [...a].indexOf(n);
226
+ if (f && !f.hidden && (e.preventDefault(), f.tabIndex = -1, f.focus(), R(f, "blur", () => l(f, "tabindex", null), X)), !(!c && at(e) || m === -1)) {
227
+ if (u === "ArrowRight" && !c) m += 1;
228
+ else if (u === "ArrowLeft" && !v) m -= 1;
229
+ else if (u === "Enter" && c) {
230
+ const I = l(i, "form");
231
+ return l(i, "form", "#"), requestAnimationFrame(() => l(i, "form", I)), s ? Y(t) : !t.items[0] && y && (y.textContent = `${r.invalid}${++vt % 2 ? " " : ""}`), $(t, !0);
232
+ } else if ((u === "Backspace" || u === "Delete") && !v) {
233
+ if (e.preventDefault(), !d && a[m]) return E(t, a[m]);
234
+ c && (m -= 1);
235
+ } else return c || (i == null ? void 0 : i.focus());
236
+ e.preventDefault(), (o = a[Math.max(0, m)] || i) == null || o.focus();
232
237
  }
233
238
  };
234
239
  dt.define("u-combobox", ht);