@mattilsynet/design 3.0.1 → 3.0.2
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/mtds/app/app-observer.js +1 -1
- package/mtds/app/app-toggle.js +26 -10
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +10 -26
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +1 -1
- package/mtds/atlas/atlas-element.js +1 -1
- package/mtds/deprecations.js +43 -36
- package/mtds/deprecations.js.map +1 -1
- package/mtds/index.iife.js +11 -11
- package/mtds/package.json.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/togglegroup/togglegroup.js +15 -15
- package/mtds/togglegroup/togglegroup.js.map +1 -1
- package/package.json +1 -1
package/mtds/app/app-observer.js
CHANGED
|
@@ -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-
|
|
3
|
+
import "./app-toggle2.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) => (
|
package/mtds/app/app-toggle.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-toggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle.js","sources":["../../designsystem/app/app-toggle.js"],"sourcesContent":["if (
|
|
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;"}
|
package/mtds/app/app-toggle2.js
CHANGED
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-toggle2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-toggle2.js","sources":["../../designsystem/app/app-toggle.js
|
|
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;"}
|
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-
|
|
6
|
+
import d from "./app-toggle.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) {
|
package/mtds/deprecations.js
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { DSFieldElement as
|
|
2
|
-
import
|
|
3
|
-
import { getByCSSModule as n, isBrowser as i, onHotReload as
|
|
1
|
+
import { DSFieldElement as p } from "@digdir/designsystemet-web";
|
|
2
|
+
import l from "./styles.module.css.js";
|
|
3
|
+
import { getByCSSModule as n, isBrowser as i, onHotReload as g, on as b, onMutation as y, QUICK_EVENT as S, debounce as E, attr as s } from "./utils.js";
|
|
4
4
|
const f = /* @__PURE__ */ new WeakSet(), a = (t) => !f.has(t) && f.add(t), o = (t, e, r) => window.dsWarnings === !1 || console.warn(
|
|
5
5
|
`\x1B[1m@mattilsynet/design:\x1B[m ${t} is deprecated, please use ${e}:`,
|
|
6
6
|
r
|
|
7
|
-
),
|
|
8
|
-
for (const t of
|
|
7
|
+
), D = n("togglegroup"), u = l.button.split(" "), A = () => {
|
|
8
|
+
for (const t of D) {
|
|
9
9
|
a(t) && !t.hasAttribute("data-toggle-group") && (s(t, "data-toggle-group", "Valgknapper"), o(
|
|
10
10
|
'Only setting class="styles.togglegroup"',
|
|
11
11
|
'data-toggle-group="LABEL-HERE" attribute also for better accessibility',
|
|
12
12
|
t
|
|
13
13
|
));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
for (const e of t.getElementsByTagName("label"))
|
|
15
|
+
a(e) && !e.classList.contains(u[0]) && (e.classList.add(...u), o(
|
|
16
|
+
'Only setting class="styles.button"',
|
|
17
|
+
'<label class="styles.button">',
|
|
18
|
+
e
|
|
19
|
+
));
|
|
20
|
+
}
|
|
21
|
+
}, L = n("breadcrumbs"), O = () => {
|
|
22
|
+
for (const t of L)
|
|
23
|
+
a(t) && t.nodeName !== "DS-BREADCRUMBS" && (t.classList.add(...l.breadcrumbs.split(" ")), o(
|
|
17
24
|
'Only setting class="styles.breadcrumbs"',
|
|
18
25
|
'<ds-breadcrumbs class="styles.breadcrumbs">',
|
|
19
26
|
t
|
|
20
27
|
));
|
|
21
|
-
},
|
|
22
|
-
for (const t of
|
|
28
|
+
}, C = n("errorsummary"), N = () => {
|
|
29
|
+
for (const t of C)
|
|
23
30
|
a(t) && t.nodeName !== "DS-ERROR-SUMMARY" && o(
|
|
24
31
|
'Only setting class="styles.errorsummary"',
|
|
25
32
|
'<ds-error-summary class="styles.errorsummary">',
|
|
26
33
|
t
|
|
27
34
|
);
|
|
28
|
-
},
|
|
29
|
-
for (const t of
|
|
35
|
+
}, R = n("dialog"), w = () => {
|
|
36
|
+
for (const t of R)
|
|
30
37
|
if (a(t) && (t.hasAttribute("data-variant") && o(
|
|
31
38
|
'<dialog data-variant="drawer">',
|
|
32
39
|
'<dialog data-placement="center|left|right|top|bottom">',
|
|
@@ -43,17 +50,17 @@ const f = /* @__PURE__ */ new WeakSet(), a = (t) => !f.has(t) && f.add(t), o = (
|
|
|
43
50
|
t
|
|
44
51
|
), s(t, "open", null), t.showModal()) : t.matches(":modal:not([open])") && (s(t, "open", ""), t.close());
|
|
45
52
|
}
|
|
46
|
-
},
|
|
53
|
+
}, B = () => {
|
|
47
54
|
for (const t of document.querySelectorAll("[data-count]"))
|
|
48
55
|
if (a(t)) {
|
|
49
56
|
const e = s(t, "data-count");
|
|
50
|
-
t.classList.add(...
|
|
57
|
+
t.classList.add(...l.validation.split(" ")), s(t, "data-limit", e), o(
|
|
51
58
|
`data-count="${e}"`,
|
|
52
59
|
`class="styles.validation" data-field="counter" data-limit="${e}"`,
|
|
53
60
|
t
|
|
54
61
|
);
|
|
55
62
|
}
|
|
56
|
-
},
|
|
63
|
+
}, T = () => {
|
|
57
64
|
for (const t of document.querySelectorAll("[data-command]"))
|
|
58
65
|
if (a(t)) {
|
|
59
66
|
const e = s(t, "data-command");
|
|
@@ -67,42 +74,42 @@ const f = /* @__PURE__ */ new WeakSet(), a = (t) => !f.has(t) && f.add(t), o = (
|
|
|
67
74
|
t
|
|
68
75
|
);
|
|
69
76
|
}
|
|
70
|
-
},
|
|
71
|
-
for (const t of
|
|
72
|
-
},
|
|
73
|
-
for (const t of T)
|
|
74
|
-
a(t) && (t.classList.add(...l), o("<u-combobox>", '<ds-suggestion class="styles.suggestion">', t));
|
|
77
|
+
}, h = i() ? document.getElementsByTagName("u-tabs") : [], I = () => {
|
|
78
|
+
for (const t of h) a(t) && o("u-tabs", "ds-tabs", t);
|
|
79
|
+
}, d = l.suggestion.split(" "), v = i() ? document.getElementsByTagName("u-combobox") : [], $ = i() ? document.getElementsByTagName("ds-suggestion") : [], M = () => {
|
|
75
80
|
for (const t of v)
|
|
76
|
-
a(t) &&
|
|
81
|
+
a(t) && (t.classList.add(...d), o("<u-combobox>", '<ds-suggestion class="styles.suggestion">', t));
|
|
82
|
+
for (const t of $)
|
|
83
|
+
a(t) && !t.classList.contains(d[0]) && (t.classList.add(...d), o(
|
|
77
84
|
"Only using <ds-suggestion>",
|
|
78
85
|
'<ds-suggestion class="styles.suggestion">',
|
|
79
86
|
t
|
|
80
87
|
));
|
|
81
|
-
},
|
|
88
|
+
}, U = ({ target: t }) => {
|
|
82
89
|
if (!(t instanceof Element)) return;
|
|
83
90
|
const e = t?.closest("tr")?.querySelector('[data-command="row"]');
|
|
84
91
|
e && !t?.closest('a,button,label,input,select,textarea,[role="button"]') && e.click();
|
|
85
92
|
const m = t?.closest("dialog");
|
|
86
93
|
m && t?.closest('[data-command="close"]') && m.close();
|
|
87
|
-
}, k = n("field"), c = /* @__PURE__ */ new Set(),
|
|
94
|
+
}, k = n("field"), c = /* @__PURE__ */ new Set(), F = () => {
|
|
88
95
|
for (const t of k)
|
|
89
96
|
t.nodeName !== "DS-FIELD" && (a(t) || o(
|
|
90
97
|
'Only setting class="styles.field"',
|
|
91
98
|
'<ds-field class="styles.field">',
|
|
92
99
|
t
|
|
93
|
-
), !c.has(t) && c.add(t) &&
|
|
94
|
-
},
|
|
100
|
+
), !c.has(t) && c.add(t) && p.prototype.connectedCallback.call(t));
|
|
101
|
+
}, G = () => {
|
|
95
102
|
for (const t of c)
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
for (const t of document.querySelectorAll(
|
|
103
|
+
p.prototype.disconnectedCallback.call(t), c.delete(t);
|
|
104
|
+
}, x = `[data-description], .${l.field.split(" ")[0]} label + p`, q = () => {
|
|
105
|
+
for (const t of document.querySelectorAll(x))
|
|
99
106
|
a(t) && t.getAttribute("data-field") !== "description" && (s(t, "data-field", "description"), o(
|
|
100
107
|
"Descriptions created by data-description of <p> only",
|
|
101
108
|
'data-field="data-description"',
|
|
102
109
|
t
|
|
103
110
|
));
|
|
104
|
-
},
|
|
105
|
-
for (const t of
|
|
111
|
+
}, P = n("validation"), _ = () => {
|
|
112
|
+
for (const t of P)
|
|
106
113
|
a(t) && !t.hasAttribute("data-field") && (s(t, "data-field", "validation"), o(
|
|
107
114
|
'Only setting class="styles.validation"',
|
|
108
115
|
'class="styles.validation" data-field="validation"',
|
|
@@ -111,14 +118,14 @@ const f = /* @__PURE__ */ new WeakSet(), a = (t) => !f.has(t) && f.add(t), o = (
|
|
|
111
118
|
}, V = () => {
|
|
112
119
|
for (const t of document.querySelectorAll("[popover][data-position]"))
|
|
113
120
|
a(t) && (s(t, "data-placement", s(t, "data-position")), o("data-position", "data-placement", t));
|
|
114
|
-
},
|
|
115
|
-
|
|
121
|
+
}, W = E(() => {
|
|
122
|
+
B(), T(), O(), w(), N(), q(), _(), V(), F(), A(), M(), I();
|
|
116
123
|
}, 200);
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
g("deprecations", () => [
|
|
125
|
+
G,
|
|
119
126
|
// Return as cleanup function
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
b(document, "click", U, S),
|
|
128
|
+
y(document, W, {
|
|
122
129
|
attributeFilter: [
|
|
123
130
|
"class",
|
|
124
131
|
"data-command",
|
package/mtds/deprecations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deprecations.js","sources":["../designsystem/deprecations.ts"],"sourcesContent":["import { DSFieldElement } from \"@digdir/designsystemet-web\";\nimport styles from \"./styles.module.css\";\nimport {\n\tattr,\n\tdebounce,\n\tgetByCSSModule,\n\tisBrowser,\n\ton,\n\tonHotReload,\n\tonMutation,\n\tQUICK_EVENT,\n} from \"./utils\";\n\nconst DEPRECATIONS = new WeakSet<Element>();\nconst deprecate = (el: Element) =>\n\t!DEPRECATIONS.has(el) && DEPRECATIONS.add(el);\n\nconst warn = (from: string, to: string, el: Element) =>\n\twindow.dsWarnings === false ||\n\tconsole.warn(\n\t\t`\\x1B[1m@mattilsynet/design:\\x1B[m ${from} is deprecated, please use ${to}:`,\n\t\tel,\n\t);\n\n// Deprecate togglegroup without data-toggle-group attribute\nconst TOGGLEGROUPS = getByCSSModule(\"togglegroup\");\nconst deprecateToggleGroup = () => {\n\tfor (const el of TOGGLEGROUPS)\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-toggle-group\")) {\n\t\t\tattr(el, \"data-toggle-group\", \"Valgknapper\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.togglegroup\"',\n\t\t\t\t'data-toggle-group=\"LABEL-HERE\" attribute also for better accessibility',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst BREADCRUMBS = getByCSSModule(\"breadcrumbs\");\nconst deprecateBreadcrumbs = () => {\n\tfor (const el of BREADCRUMBS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-BREADCRUMBS\") {\n\t\t\tel.classList.add(...styles.breadcrumbs.split(\" \"));\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.breadcrumbs\"',\n\t\t\t\t'<ds-breadcrumbs class=\"styles.breadcrumbs\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst ERRORSUMMARYS = getByCSSModule(\"errorsummary\");\nconst deprecateErrorSummary = () => {\n\tfor (const el of ERRORSUMMARYS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-ERROR-SUMMARY\") {\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.errorsummary\"',\n\t\t\t\t'<ds-error-summary class=\"styles.errorsummary\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-variant and data-modal and data-closedby on dialogs\nconst DIALOGS = getByCSSModule(\"dialog\") as HTMLCollectionOf<HTMLDialogElement>;\nconst deprecateDialog = () => {\n\tfor (const el of DIALOGS) {\n\t\tif (!deprecate(el)) continue;\n\t\tif (el.hasAttribute(\"data-variant\")) {\n\t\t\twarn(\n\t\t\t\t'<dialog data-variant=\"drawer\">',\n\t\t\t\t'<dialog data-placement=\"center|left|right|top|bottom\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n\t\tif (el.isConnected && el.showModal && el.close) {\n\t\t\tconst closedby = attr(el, \"data-closedby\");\n\t\t\tif (closedby) {\n\t\t\t\tattr(el, \"closedby\", closedby);\n\t\t\t\twarn(\n\t\t\t\t\t`<dialog data-closedby=\"${closedby}\">`,\n\t\t\t\t\t`<dialog closedby=\"${closedby}\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (el.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-modal=\"true\">',\n\t\t\t\t\t'.showModal() or <button command=\"show-modal\" commandfor=\"DIALOG-ID\"></button>',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t\tattr(el, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tel.showModal();\n\t\t\t} else if (el.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(el, \"open\", \"\"); // Set as open\n\t\t\t\tel.close(); // So we correctly can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate data-count in favor of data-limit\nconst deprecateCounter = () => {\n\tfor (const el of document.querySelectorAll(\"[data-count]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst count = attr(el, \"data-count\");\n\t\t\tel.classList.add(...styles.validation.split(\" \"));\n\t\t\tattr(el, \"data-limit\", count);\n\t\t\twarn(\n\t\t\t\t`data-count=\"${count}\"`,\n\t\t\t\t`class=\"styles.validation\" data-field=\"counter\" data-limit=\"${count}\"`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-command on buttons and other elements\nconst deprecateDataCommand = () => {\n\tfor (const el of document.querySelectorAll(\"[data-command]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst command = attr(el, \"data-command\");\n\n\t\t\tif (command === \"row\")\n\t\t\t\twarn(\n\t\t\t\t\t`<${el.nodeName.toLowerCase()} data-command=\"${command}\">`,\n\t\t\t\t\t`<tr data-clickdelegatefor=\"${el.nodeName}-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t`<button data-command=\"${command}\">`,\n\t\t\t\t\t`<button command=\"${command?.replace(\"toggle-app-expanded\", \"show-modal\")}\" commandfor=\"TARGET-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t}\n};\n\n// Deprecate u-tabs\nconst TABS = isBrowser() ? document.getElementsByTagName(\"u-tabs\") : [];\nconst deprecateUTabs = () => {\n\tfor (const el of TABS) if (deprecate(el)) warn(\"u-tabs\", \"ds-tabs\", el);\n};\n\n// Deprecate u-combobox and add class to ds-suggestion\nconst CSS_SUGGESTION = styles.suggestion.split(\" \");\nconst OLD = isBrowser() ? document.getElementsByTagName(\"u-combobox\") : [];\nconst NEW = isBrowser() ? document.getElementsByTagName(\"ds-suggestion\") : [];\nconst deprecateUCombobox = () => {\n\tfor (const el of OLD)\n\t\tif (deprecate(el)) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\"<u-combobox>\", `<ds-suggestion class=\"styles.suggestion\">`, el);\n\t\t}\n\tfor (const el of NEW)\n\t\tif (deprecate(el) && !el.classList.contains(CSS_SUGGESTION[0])) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\n\t\t\t\t\"Only using <ds-suggestion>\",\n\t\t\t\t`<ds-suggestion class=\"styles.suggestion\">`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst handleCommandClick = ({ target: el }: Event) => {\n\tif (el instanceof Element === false) return;\n\tconst row = el?.closest(\"tr\")?.querySelector('[data-command=\"row\"]');\n\tconst click =\n\t\trow && !el?.closest('a,button,label,input,select,textarea,[role=\"button\"]');\n\tif (click) (row as HTMLElement).click(); // Forward click to data-command=\"row\" element\n\n\tconst dialog = el?.closest(\"dialog\");\n\tconst close = dialog && el?.closest('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\n// Deprecate fields without ds-field element\nconst FIELDS = getByCSSModule(\"field\");\nconst FIELD_UNBIND = new Set<Element>();\nconst deprecateField = () => {\n\tfor (const el of FIELDS)\n\t\tif (el.nodeName !== \"DS-FIELD\") {\n\t\t\tif (!deprecate(el))\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.field\"',\n\t\t\t\t\t'<ds-field class=\"styles.field\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\tif (!FIELD_UNBIND.has(el) && FIELD_UNBIND.add(el)) {\n\t\t\t\tDSFieldElement.prototype.connectedCallback.call(el as DSFieldElement);\n\t\t\t}\n\t\t}\n};\nconst unbindFields = () => {\n\tfor (const el of FIELD_UNBIND) {\n\t\tDSFieldElement.prototype.disconnectedCallback.call(el as DSFieldElement);\n\t\tFIELD_UNBIND.delete(el);\n\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst CSS_DESCRIPTIONS = `[data-description], .${styles.field.split(\" \")[0]} label + p`;\nconst deprecateFeildDescription = () => {\n\tfor (const el of document.querySelectorAll(CSS_DESCRIPTIONS))\n\t\tif (deprecate(el) && el.getAttribute(\"data-field\") !== \"description\") {\n\t\t\tattr(el, \"data-field\", \"description\");\n\t\t\twarn(\n\t\t\t\t\"Descriptions created by data-description of <p> only\",\n\t\t\t\t'data-field=\"data-description\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst VALIDATIONS = getByCSSModule(\"validation\");\nconst deprecateFieldValidation = () => {\n\tfor (const el of VALIDATIONS)\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-field\")) {\n\t\t\tattr(el, \"data-field\", \"validation\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.validation\"',\n\t\t\t\t'class=\"styles.validation\" data-field=\"validation\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst deprecatePopoverPosition = () => {\n\tfor (const el of document.querySelectorAll(\"[popover][data-position]\"))\n\t\tif (deprecate(el)) {\n\t\t\tattr(el, \"data-placement\", attr(el, \"data-position\"));\n\t\t\twarn(\"data-position\", \"data-placement\", el);\n\t\t}\n};\n\nconst handleDeprecations = debounce(() => {\n\tdeprecateCounter();\n\tdeprecateDataCommand();\n\tdeprecateBreadcrumbs();\n\tdeprecateDialog();\n\tdeprecateErrorSummary();\n\tdeprecateFeildDescription();\n\tdeprecateFieldValidation();\n\tdeprecatePopoverPosition();\n\tdeprecateField(); // Should run after other field deprecations to access correct data-attributes\n\tdeprecateToggleGroup();\n\tdeprecateUCombobox();\n\tdeprecateUTabs();\n}, 200);\n\nonHotReload(\"deprecations\", () => [\n\tunbindFields, // Return as cleanup function\n\ton(document, \"click\", handleCommandClick, QUICK_EVENT),\n\tonMutation(document, handleDeprecations, {\n\t\tattributeFilter: [\n\t\t\t\"class\",\n\t\t\t\"data-command\",\n\t\t\t\"data-count\",\n\t\t\t\"data-description\",\n\t\t\t\"data-variant\",\n\t\t\t\"open\",\n\t\t],\n\t\tattributes: true,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t}),\n]);\n"],"names":["DEPRECATIONS","deprecate","el","warn","from","to","TOGGLEGROUPS","getByCSSModule","deprecateToggleGroup","attr","BREADCRUMBS","deprecateBreadcrumbs","styles","ERRORSUMMARYS","deprecateErrorSummary","DIALOGS","deprecateDialog","closedby","deprecateCounter","count","deprecateDataCommand","command","TABS","isBrowser","deprecateUTabs","CSS_SUGGESTION","OLD","NEW","deprecateUCombobox","handleCommandClick","row","dialog","FIELDS","FIELD_UNBIND","deprecateField","DSFieldElement","unbindFields","CSS_DESCRIPTIONS","deprecateFeildDescription","VALIDATIONS","deprecateFieldValidation","deprecatePopoverPosition","handleDeprecations","debounce","onHotReload","on","QUICK_EVENT","onMutation"],"mappings":";;;AAaA,MAAMA,wBAAmB,QAAA,GACnBC,IAAY,CAACC,MAClB,CAACF,EAAa,IAAIE,CAAE,KAAKF,EAAa,IAAIE,CAAE,GAEvCC,IAAO,CAACC,GAAcC,GAAYH,MACvC,OAAO,eAAe,MACtB,QAAQ;AAAA,EACP,qCAAqCE,CAAI,8BAA8BC,CAAE;AAAA,EACzEH;AACD,GAGKI,IAAeC,EAAe,aAAa,GAC3CC,IAAuB,MAAM;AAClC,aAAWN,KAAMI;AAChB,IAAIL,EAAUC,CAAE,KAAK,CAACA,EAAG,aAAa,mBAAmB,MACxDO,EAAKP,GAAI,qBAAqB,aAAa,GAC3CC;AAAA,MACC;AAAA,MACA;AAAA,MACAD;AAAA,IAAA;AAGJ,GAGMQ,IAAcH,EAAe,aAAa,GAC1CI,IAAuB,MAAM;AAClC,aAAWT,KAAMQ;AAChB,IAAIT,EAAUC,CAAE,KAAKA,EAAG,aAAa,qBACpCA,EAAG,UAAU,IAAI,GAAGU,EAAO,YAAY,MAAM,GAAG,C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AAKP,GAAI,kBAAkBO,EAAKP,GAAI,eAAe,CAAC,GACpDC,EAAK,iBAAiB,kBAAkBD,CAAE;AAE7C,GAEMwC,IAAqBC,EAAS,MAAM;AACzC,EAAAzB,EAAA,GACAE,EAAA,GACAT,EAAA,GACAK,EAAA,GACAF,EAAA,GACAwB,EAAA,GACAE,EAAA,GACAC,EAAA,GACAP,EAAA,GACA1B,EAAA,GACAoB,EAAA,GACAJ,EAAA;AACD,GAAG,GAAG;AAENoB,EAAY,gBAAgB,MAAM;AAAA,EACjCR;AAAA;AAAA,EACAS,EAAG,UAAU,SAAShB,GAAoBiB,CAAW;AAAA,EACrDC,EAAW,UAAUL,GAAoB;AAAA,IACxC,iBAAiB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,EAAA,CACT;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"deprecations.js","sources":["../designsystem/deprecations.ts"],"sourcesContent":["import { DSFieldElement } from \"@digdir/designsystemet-web\";\nimport styles from \"./styles.module.css\";\nimport {\n\tattr,\n\tdebounce,\n\tgetByCSSModule,\n\tisBrowser,\n\ton,\n\tonHotReload,\n\tonMutation,\n\tQUICK_EVENT,\n} from \"./utils\";\n\nconst DEPRECATIONS = new WeakSet<Element>();\nconst deprecate = (el: Element) =>\n\t!DEPRECATIONS.has(el) && DEPRECATIONS.add(el);\n\nconst warn = (from: string, to: string, el: Element) =>\n\twindow.dsWarnings === false ||\n\tconsole.warn(\n\t\t`\\x1B[1m@mattilsynet/design:\\x1B[m ${from} is deprecated, please use ${to}:`,\n\t\tel,\n\t);\n\n// Deprecate togglegroup without data-toggle-group attribute\nconst TOGGLEGROUPS = getByCSSModule(\"togglegroup\");\nconst CSS_BUTTON = styles.button.split(\" \");\nconst deprecateToggleGroup = () => {\n\tfor (const el of TOGGLEGROUPS) {\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-toggle-group\")) {\n\t\t\tattr(el, \"data-toggle-group\", \"Valgknapper\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.togglegroup\"',\n\t\t\t\t'data-toggle-group=\"LABEL-HERE\" attribute also for better accessibility',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n\t\tfor (const label of el.getElementsByTagName(\"label\")) {\n\t\t\tif (deprecate(label) && !label.classList.contains(CSS_BUTTON[0])) {\n\t\t\t\tlabel.classList.add(...CSS_BUTTON);\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.button\"',\n\t\t\t\t\t`<label class=\"styles.button\">`,\n\t\t\t\t\tlabel,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst BREADCRUMBS = getByCSSModule(\"breadcrumbs\");\nconst deprecateBreadcrumbs = () => {\n\tfor (const el of BREADCRUMBS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-BREADCRUMBS\") {\n\t\t\tel.classList.add(...styles.breadcrumbs.split(\" \"));\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.breadcrumbs\"',\n\t\t\t\t'<ds-breadcrumbs class=\"styles.breadcrumbs\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate errorsummary without ds-error-summary element\nconst ERRORSUMMARYS = getByCSSModule(\"errorsummary\");\nconst deprecateErrorSummary = () => {\n\tfor (const el of ERRORSUMMARYS)\n\t\tif (deprecate(el) && el.nodeName !== \"DS-ERROR-SUMMARY\") {\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.errorsummary\"',\n\t\t\t\t'<ds-error-summary class=\"styles.errorsummary\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-variant and data-modal and data-closedby on dialogs\nconst DIALOGS = getByCSSModule(\"dialog\") as HTMLCollectionOf<HTMLDialogElement>;\nconst deprecateDialog = () => {\n\tfor (const el of DIALOGS) {\n\t\tif (!deprecate(el)) continue;\n\t\tif (el.hasAttribute(\"data-variant\")) {\n\t\t\twarn(\n\t\t\t\t'<dialog data-variant=\"drawer\">',\n\t\t\t\t'<dialog data-placement=\"center|left|right|top|bottom\">',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n\t\tif (el.isConnected && el.showModal && el.close) {\n\t\t\tconst closedby = attr(el, \"data-closedby\");\n\t\t\tif (closedby) {\n\t\t\t\tattr(el, \"closedby\", closedby);\n\t\t\t\twarn(\n\t\t\t\t\t`<dialog data-closedby=\"${closedby}\">`,\n\t\t\t\t\t`<dialog closedby=\"${closedby}\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (el.matches('[open]:not([data-modal=\"false\"]):not(:modal)')) {\n\t\t\t\twarn(\n\t\t\t\t\t'<dialog data-modal=\"true\">',\n\t\t\t\t\t'.showModal() or <button command=\"show-modal\" commandfor=\"DIALOG-ID\"></button>',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\t\tattr(el, \"open\", null); // Using attribute instead of .close to avoid `close` event\n\t\t\t\tel.showModal();\n\t\t\t} else if (el.matches(\":modal:not([open])\")) {\n\t\t\t\tattr(el, \"open\", \"\"); // Set as open\n\t\t\t\tel.close(); // So we correctly can call .close, removing <dialog> from #top-layer\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Deprecate data-count in favor of data-limit\nconst deprecateCounter = () => {\n\tfor (const el of document.querySelectorAll(\"[data-count]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst count = attr(el, \"data-count\");\n\t\t\tel.classList.add(...styles.validation.split(\" \"));\n\t\t\tattr(el, \"data-limit\", count);\n\t\t\twarn(\n\t\t\t\t`data-count=\"${count}\"`,\n\t\t\t\t`class=\"styles.validation\" data-field=\"counter\" data-limit=\"${count}\"`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate data-command on buttons and other elements\nconst deprecateDataCommand = () => {\n\tfor (const el of document.querySelectorAll(\"[data-command]\"))\n\t\tif (deprecate(el)) {\n\t\t\tconst command = attr(el, \"data-command\");\n\n\t\t\tif (command === \"row\")\n\t\t\t\twarn(\n\t\t\t\t\t`<${el.nodeName.toLowerCase()} data-command=\"${command}\">`,\n\t\t\t\t\t`<tr data-clickdelegatefor=\"${el.nodeName}-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\telse\n\t\t\t\twarn(\n\t\t\t\t\t`<button data-command=\"${command}\">`,\n\t\t\t\t\t`<button command=\"${command?.replace(\"toggle-app-expanded\", \"show-modal\")}\" commandfor=\"TARGET-ID\">`,\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t}\n};\n\n// Deprecate u-tabs\nconst TABS = isBrowser() ? document.getElementsByTagName(\"u-tabs\") : [];\nconst deprecateUTabs = () => {\n\tfor (const el of TABS) if (deprecate(el)) warn(\"u-tabs\", \"ds-tabs\", el);\n};\n\n// Deprecate u-combobox and add class to ds-suggestion\nconst CSS_SUGGESTION = styles.suggestion.split(\" \");\nconst OLD = isBrowser() ? document.getElementsByTagName(\"u-combobox\") : [];\nconst NEW = isBrowser() ? document.getElementsByTagName(\"ds-suggestion\") : [];\nconst deprecateUCombobox = () => {\n\tfor (const el of OLD)\n\t\tif (deprecate(el)) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\"<u-combobox>\", `<ds-suggestion class=\"styles.suggestion\">`, el);\n\t\t}\n\tfor (const el of NEW)\n\t\tif (deprecate(el) && !el.classList.contains(CSS_SUGGESTION[0])) {\n\t\t\tel.classList.add(...CSS_SUGGESTION);\n\t\t\twarn(\n\t\t\t\t\"Only using <ds-suggestion>\",\n\t\t\t\t`<ds-suggestion class=\"styles.suggestion\">`,\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst handleCommandClick = ({ target: el }: Event) => {\n\tif (el instanceof Element === false) return;\n\tconst row = el?.closest(\"tr\")?.querySelector('[data-command=\"row\"]');\n\tconst click =\n\t\trow && !el?.closest('a,button,label,input,select,textarea,[role=\"button\"]');\n\tif (click) (row as HTMLElement).click(); // Forward click to data-command=\"row\" element\n\n\tconst dialog = el?.closest(\"dialog\");\n\tconst close = dialog && el?.closest('[data-command=\"close\"]');\n\tif (close) dialog.close();\n};\n\n// Deprecate fields without ds-field element\nconst FIELDS = getByCSSModule(\"field\");\nconst FIELD_UNBIND = new Set<Element>();\nconst deprecateField = () => {\n\tfor (const el of FIELDS)\n\t\tif (el.nodeName !== \"DS-FIELD\") {\n\t\t\tif (!deprecate(el))\n\t\t\t\twarn(\n\t\t\t\t\t'Only setting class=\"styles.field\"',\n\t\t\t\t\t'<ds-field class=\"styles.field\">',\n\t\t\t\t\tel,\n\t\t\t\t);\n\t\t\tif (!FIELD_UNBIND.has(el) && FIELD_UNBIND.add(el)) {\n\t\t\t\tDSFieldElement.prototype.connectedCallback.call(el as DSFieldElement);\n\t\t\t}\n\t\t}\n};\nconst unbindFields = () => {\n\tfor (const el of FIELD_UNBIND) {\n\t\tDSFieldElement.prototype.disconnectedCallback.call(el as DSFieldElement);\n\t\tFIELD_UNBIND.delete(el);\n\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst CSS_DESCRIPTIONS = `[data-description], .${styles.field.split(\" \")[0]} label + p`;\nconst deprecateFeildDescription = () => {\n\tfor (const el of document.querySelectorAll(CSS_DESCRIPTIONS))\n\t\tif (deprecate(el) && el.getAttribute(\"data-field\") !== \"description\") {\n\t\t\tattr(el, \"data-field\", \"description\");\n\t\t\twarn(\n\t\t\t\t\"Descriptions created by data-description of <p> only\",\n\t\t\t\t'data-field=\"data-description\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\n// Deprecate validation without data-field=\"validation\"\nconst VALIDATIONS = getByCSSModule(\"validation\");\nconst deprecateFieldValidation = () => {\n\tfor (const el of VALIDATIONS)\n\t\tif (deprecate(el) && !el.hasAttribute(\"data-field\")) {\n\t\t\tattr(el, \"data-field\", \"validation\");\n\t\t\twarn(\n\t\t\t\t'Only setting class=\"styles.validation\"',\n\t\t\t\t'class=\"styles.validation\" data-field=\"validation\"',\n\t\t\t\tel,\n\t\t\t);\n\t\t}\n};\n\nconst deprecatePopoverPosition = () => {\n\tfor (const el of document.querySelectorAll(\"[popover][data-position]\"))\n\t\tif (deprecate(el)) {\n\t\t\tattr(el, \"data-placement\", attr(el, \"data-position\"));\n\t\t\twarn(\"data-position\", \"data-placement\", el);\n\t\t}\n};\n\nconst handleDeprecations = debounce(() => {\n\tdeprecateCounter();\n\tdeprecateDataCommand();\n\tdeprecateBreadcrumbs();\n\tdeprecateDialog();\n\tdeprecateErrorSummary();\n\tdeprecateFeildDescription();\n\tdeprecateFieldValidation();\n\tdeprecatePopoverPosition();\n\tdeprecateField(); // Should run after other field deprecations to access correct data-attributes\n\tdeprecateToggleGroup();\n\tdeprecateUCombobox();\n\tdeprecateUTabs();\n}, 200);\n\nonHotReload(\"deprecations\", () => [\n\tunbindFields, // Return as cleanup function\n\ton(document, \"click\", handleCommandClick, QUICK_EVENT),\n\tonMutation(document, handleDeprecations, {\n\t\tattributeFilter: [\n\t\t\t\"class\",\n\t\t\t\"data-command\",\n\t\t\t\"data-count\",\n\t\t\t\"data-description\",\n\t\t\t\"data-variant\",\n\t\t\t\"open\",\n\t\t],\n\t\tattributes: true,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t}),\n]);\n"],"names":["DEPRECATIONS","deprecate","el","warn","from","to","TOGGLEGROUPS","getByCSSModule","CSS_BUTTON","styles","deprecateToggleGroup","attr","label","BREADCRUMBS","deprecateBreadcrumbs","ERRORSUMMARYS","deprecateErrorSummary","DIALOGS","deprecateDialog","closedby","deprecateCounter","count","deprecateDataCommand","command","TABS","isBrowser","deprecateUTabs","CSS_SUGGESTION","OLD","NEW","deprecateUCombobox","handleCommandClick","row","dialog","FIELDS","FIELD_UNBIND","deprecateField","DSFieldElement","unbindFields","CSS_DESCRIPTIONS","deprecateFeildDescription","VALIDATIONS","deprecateFieldValidation","deprecatePopoverPosition","handleDeprecations","debounce","onHotReload","on","QUICK_EVENT","onMutation"],"mappings":";;;AAaA,MAAMA,wBAAmB,QAAA,GACnBC,IAAY,CAACC,MAClB,CAACF,EAAa,IAAIE,CAAE,KAAKF,EAAa,IAAIE,CAAE,GAEvCC,IAAO,CAACC,GAAcC,GAAYH,MACvC,OAAO,eAAe,MACtB,QAAQ;AAAA,EACP,qCAAqCE,CAAI,8BAA8BC,CAAE;AAAA,EACzEH;AACD,GAGKI,IAAeC,EAAe,aAAa,GAC3CC,IAAaC,EAAO,OAAO,MAAM,GAAG,GACpCC,IAAuB,MAAM;AAClC,aAAWR,KAAMI,GAAc;AAC9B,IAAIL,EAAUC,CAAE,KAAK,CAACA,EAAG,aAAa,mBAAmB,MACxDS,EAAKT,GAAI,qBAAqB,aAAa,GAC3CC;AAAA,MACC;AAAA,MACA;AAAA,MACAD;AAAA,IAAA;AAGF,eAAWU,KAASV,EAAG,qBAAqB,OAAO;AAClD,MAAID,EAAUW,CAAK,KAAK,CAACA,EAAM,UAAU,SAASJ,EAAW,CAAC,CAAC,MAC9DI,EAAM,UAAU,IAAI,GAAGJ,CAAU,GACjCL;AAAA,QACC;AAAA,QACA;AAAA,QACAS;AAAA,MAAA;AAAA,EAIJ;AACD,GAGMC,IAAcN,EAAe,aAAa,GAC1CO,IAAuB,MAAM;AAClC,aAAWZ,KAAMW;AAChB,IAAIZ,EAAUC,CAAE,KAAKA,EAAG,aAAa,qBACpCA,EAAG,UAAU,IAAI,GAAGO,EAAO,YAAY,MAAM,GAAG,CAAC,GACjDN;AAAA,MACC;AAAA,MACA;AAAA,MACAD;AAAA,IAAA;AAGJ,GAGMa,IAAgBR,EAAe,cAAc,GAC7CS,IAAwB,MAAM;AACnC,aAAWd,KAAMa;AAChB,IAAId,EAAUC,CAAE,KAAKA,EAAG,aAAa,sBACpCC;AAAA,MACC;AAAA,MACA;AAAA,MACAD;AAAA,IAAA;AAGJ,GAGMe,IAAUV,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