@epa-wg/custom-element-dist 0.0.24 → 0.0.25

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.
Files changed (86) hide show
  1. package/.storybook/main.ts +21 -21
  2. package/README.md +4 -4
  3. package/coverage/coverage-final.json +6 -4
  4. package/coverage/index.html +27 -27
  5. package/coverage/src/custom-element/coverage.svg +1 -1
  6. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  7. package/coverage/src/custom-element/custom-element.js.html +391 -355
  8. package/coverage/src/custom-element/http-request.js.html +12 -12
  9. package/coverage/src/custom-element/index.html +23 -23
  10. package/coverage/src/custom-element/local-storage.js.html +1 -1
  11. package/coverage/src/custom-element/location-element.js/coverage.svg +1 -1
  12. package/coverage/src/custom-element/location-element.js.html +116 -47
  13. package/coverage/src/index.html +1 -1
  14. package/coverage/src/mocks/handlers.ts.html +1 -1
  15. package/coverage/src/mocks/index.html +1 -1
  16. package/coverage/src/stories/attributes.test.stories.ts.html +1 -1
  17. package/coverage/src/stories/coverage.svg +1 -1
  18. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  19. package/coverage/src/stories/dom-merge.test.stories.ts.html +1 -1
  20. package/coverage/src/stories/external-template.test.stories.ts.html +1 -1
  21. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  22. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  23. package/coverage/src/stories/index.html +38 -8
  24. package/coverage/src/stories/local-storage.test.stories.ts.html +1 -1
  25. package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
  26. package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +10 -0
  27. package/coverage/src/stories/set-url.test.stories.ts.html +427 -0
  28. package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
  29. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  30. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  31. package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +10 -0
  32. package/coverage/src/stories/version-select.test.stories.ts.html +313 -0
  33. package/coverage/src/sum.ts.html +1 -1
  34. package/dist/{custom-element-DqtzLkTG.js → custom-element-DAe7uvIt.js} +163 -157
  35. package/dist/custom-element-DZvvhscI.cjs +53 -0
  36. package/dist/custom-element-bundle.cjs +1 -1
  37. package/dist/custom-element-bundle.js +3 -3
  38. package/dist/location-element-DRB7hCwA.cjs +1 -0
  39. package/dist/location-element-FJlONi2n.js +65 -0
  40. package/package.json +2 -2
  41. package/src/custom-element/custom-element.js +16 -4
  42. package/src/custom-element/demo/location-element.html +17 -4
  43. package/src/custom-element/demo/s.xml +31 -6
  44. package/src/custom-element/demo/s.xslt +59 -22
  45. package/src/custom-element/demo/set-url.html +141 -0
  46. package/src/custom-element/ide/customData-dce.json +56 -0
  47. package/src/custom-element/ide/web-types-dce.json +153 -110
  48. package/src/custom-element/ide/web-types-xsl.json +1 -1
  49. package/src/custom-element/index.html +1 -0
  50. package/src/custom-element/location-element.js +25 -2
  51. package/src/custom-element.test.ts +26 -26
  52. package/src/stories/set-url.test.stories.ts +114 -0
  53. package/src/stories/version-select.test.stories.ts +76 -0
  54. package/storybook-static/assets/{Color-PRSJMWNM-y4ZsI1hY.js → Color-PRSJMWNM-CRSv4C7i.js} +1 -1
  55. package/storybook-static/assets/{Configure-CyLVkwlf.js → Configure-D0qG3gR9.js} +1 -1
  56. package/storybook-static/assets/{DocsRenderer-K4EAMTCU-VRGUwRrq.js → DocsRenderer-K4EAMTCU-CG_P5zRZ.js} +2 -2
  57. package/storybook-static/assets/{WithTooltip-KJL26V4Q-xdXH9Ztt.js → WithTooltip-KJL26V4Q-CUqUi5E8.js} +1 -1
  58. package/storybook-static/assets/{attributes.test.stories-BckCcyrF.js → attributes.test.stories-W34tZdUt.js} +1 -1
  59. package/storybook-static/assets/{css.test.stories-B-QcObCF.js → css.test.stories-BZFYx1TQ.js} +1 -1
  60. package/storybook-static/assets/{custom-element-BIxkVg7K.js → custom-element-DpIq8E2p.js} +79 -79
  61. package/storybook-static/assets/{dom-merge.test.stories-CjXhjTQY.js → dom-merge.test.stories-S-7U5N3h.js} +1 -1
  62. package/storybook-static/assets/{external-template.test.stories-BBqyi0az.js → external-template.test.stories-QIO3lAFz.js} +1 -1
  63. package/storybook-static/assets/{form.test.stories-DsIo1B4n.js → form.test.stories-ClYhj9F1.js} +1 -1
  64. package/storybook-static/assets/{formatter-2WMMO6ZP-CThVcQxM.js → formatter-2WMMO6ZP-C-UiBIma.js} +1 -1
  65. package/storybook-static/assets/http-request-DNq59pnj.js +1 -0
  66. package/storybook-static/assets/{http-request.stories-sXA_Y-VM.js → http-request.stories-DCqY5s2i.js} +9 -9
  67. package/storybook-static/assets/iframe-CURpvmVV.js +2 -0
  68. package/storybook-static/assets/{index-VWixWKZ7.js → index-CKw1EbdP.js} +1 -1
  69. package/storybook-static/assets/{index-CUFHd5VD.js → index-DYpTqTNu.js} +1 -1
  70. package/storybook-static/assets/{index-DPPi9iZu.js → index-DsWii_Ep.js} +5 -5
  71. package/storybook-static/assets/{local-storage.test.stories-Cs2v3QTS.js → local-storage.test.stories-BqgYwqr-.js} +1 -1
  72. package/storybook-static/assets/location-element-hKpcXCdn.js +1 -0
  73. package/storybook-static/assets/{location-element.test.stories-WkrQDzJJ.js → location-element.test.stories-DvH1TWK4.js} +9 -9
  74. package/storybook-static/assets/{preview-p-Bwze-K.js → preview-DjDbQHPa.js} +2 -2
  75. package/storybook-static/assets/set-url.test.stories-GlJOh31I.js +81 -0
  76. package/storybook-static/assets/{slice-events.test.stories-BRBBc0JT.js → slice-events.test.stories-VoNjuPCX.js} +1 -1
  77. package/storybook-static/assets/{slots.test.stories-r-i91k3y.js → slots.test.stories-Da2j9YuO.js} +1 -1
  78. package/storybook-static/assets/{syntaxhighlighter-BP7B2CQK-OnioRcs9.js → syntaxhighlighter-BP7B2CQK-CDpEe51g.js} +1 -1
  79. package/storybook-static/assets/version-select.test.stories-DLwf-TPB.js +60 -0
  80. package/storybook-static/iframe.html +1 -1
  81. package/storybook-static/index.json +1 -1
  82. package/storybook-static/project.json +1 -1
  83. package/dist/custom-element-BDK7dcJN.cjs +0 -53
  84. package/dist/location-element-2m0gWq_d.cjs +0 -1
  85. package/dist/location-element-nA_wsqBt.js +0 -49
  86. package/storybook-static/assets/iframe-DcDTQOmA.js +0 -2
@@ -1,7 +1,13 @@
1
- const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", se = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), W = (e) => e.nodeType === 3, le = (e) => typeof e == "string", ne = (e) => e && typeof e.nodeType == "number", N = (e, l = "", t = document) => ((s) => (l && s.append(S(t.ownerDocument || t, l)), s))((t.ownerDocument || t).createElement(e)), S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
1
+ const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, re = (e) => typeof e == "string", oe = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
2
2
  for (; e.firstChild; ) e.firstChild.remove();
3
3
  return e;
4
- }, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), ae = (e) => (e?.setAttribute("xmlns:xsl", B), e), ie = (e) => (e?.setAttribute("xmlns:xhtml", q), ae(e)), Y = (e, l) => {
4
+ }, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", q), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), A = (e, l = "", t = document) => {
5
+ const s = (a) => ((o) => (l && o.append(S(t.ownerDocument || t, l)), o))((t.ownerDocument || t).createElement(a));
6
+ if (te(e))
7
+ return s(e);
8
+ const n = s("dce-object");
9
+ return n.setAttribute("dce-object-name", e), n;
10
+ }, G = (e, l) => {
5
11
  const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
6
12
  for (let s of e.attributes)
7
13
  t.setAttribute(s.name, s.value);
@@ -16,44 +22,44 @@ function H(e) {
16
22
  return new XMLSerializer().serializeToString(e);
17
23
  }
18
24
  function X(e, l, t, s) {
19
- const n = (h) => e.ownerDocument.createElement(h), c = ((h, p, m) => (p.append(m = n(h)), m))(l, e);
20
- return [...t].forEach((h) => c.append(s(h))), c;
25
+ const n = (h) => e.ownerDocument.createElement(h), o = ((h, p, m) => (p.append(m = n(h)), m))(l, e);
26
+ return [...t].forEach((h) => o.append(s(h))), o;
21
27
  }
22
- function re(e) {
23
- return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
28
+ function ce(e) {
29
+ return e.slot || (e.setAttribute || (e = A("span", e.textContent.replaceAll(`
24
30
  `, ""))), e.setAttribute("slot", "")), e;
25
31
  }
26
32
  function D(e, l, t) {
27
33
  const s = typeof e;
28
34
  if (s === "string")
29
- return N(l, e, t);
35
+ return A(l, e, t);
30
36
  if (s === "number")
31
- return N(l, "" + e, t);
37
+ return A(l, "" + e, t);
32
38
  if (e instanceof Array) {
33
- const i = N("array", "", t);
34
- return e.map((c) => i.append(D(c, l, t))), i;
39
+ const a = A("array", "", t);
40
+ return e.map((o) => a.append(D(o, l, t))), a;
35
41
  }
36
42
  if (e instanceof FormData) {
37
- const i = N("form-data", "", t);
38
- for (const c of e)
39
- i.append(D(c[1], c[0], t));
40
- return i;
43
+ const a = A("form-data", "", t);
44
+ for (const o of e)
45
+ a.append(D(o[1], o[0], t));
46
+ return a;
41
47
  }
42
- const n = N(l, "", t);
43
- for (let i in e)
44
- ne(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" ? n.setAttribute(i, e[i]) : n.append(D(e[i], i, t)));
48
+ const n = A(l, "", t);
49
+ for (let a in e)
50
+ oe(e[a]) || typeof e[a] == "function" || e[a] instanceof Window || (typeof e[a] != "object" && te(a) ? n.setAttribute(a, e[a]) : n.append(D(e[a], a, t)));
45
51
  return n;
46
52
  }
47
- function G(e) {
53
+ function Z(e) {
48
54
  if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
49
55
  const s = t.data, n = s.matchAll(/{([^}]*)}/g);
50
56
  if (n) {
51
- let i = 0, c = (p) => S(t, p), h = [];
57
+ let a = 0, o = (p) => S(t, p), h = [];
52
58
  if ([...n].forEach((p) => {
53
- p.index > i && h.push(c(p.input.substring(i, p.index)));
59
+ p.index > a && h.push(o(p.input.substring(a, p.index)));
54
60
  const m = e.querySelector("value-of").cloneNode();
55
- m.setAttribute("select", p[1]), h.push(m), i = p.index + p[0].length;
56
- }), i < s.length && h.push(c(s.substring(i, s.length))), h.length) {
61
+ m.setAttribute("select", p[1]), h.push(m), a = p.index + p[0].length;
62
+ }), a < s.length && h.push(o(s.substring(a, s.length))), h.length) {
57
63
  for (let p of h)
58
64
  l.insertBefore(p, t);
59
65
  l.removeChild(t);
@@ -66,10 +72,10 @@ function G(e) {
66
72
  }
67
73
  return e;
68
74
  }
69
- function oe(e, l = "xsl:stylesheet") {
75
+ function me(e, l = "xsl:stylesheet") {
70
76
  if (e.tagName === l || e.documentElement?.tagName === l)
71
- return G(e);
72
- const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${q}" xmlns:exsl="${se}" exclude-result-prefixes="exsl" >
77
+ return Z(e);
78
+ const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${q}" xmlns:exsl="${ie}" exclude-result-prefixes="exsl" >
73
79
  <xsl:output method="xml" />
74
80
  <xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
75
81
  <xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
@@ -82,20 +88,20 @@ function oe(e, l = "xsl:stylesheet") {
82
88
  <xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
83
89
  <xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']"><dce-text><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></dce-text></xsl:template>
84
90
  <xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
85
- </xsl:stylesheet>`), s = new XSLTProcessor(), n = ((a) => {
86
- C(a, "script", (v) => v.remove());
87
- const o = a.content ?? a.firstElementChild?.content ?? a.body ?? a;
88
- ye.forEach((v) => C(o, v, (b) => be(b, o)));
89
- const E = a.firstElementChild?.content || a.content, g = (v) => {
90
- const b = M("<xhtml/>"), $ = b.importNode(v, !0);
91
- return b.replaceChild($, b.documentElement), ie($);
91
+ </xsl:stylesheet>`), s = new XSLTProcessor(), n = ((i) => {
92
+ C(i, "script", (b) => b.remove());
93
+ const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
94
+ ve.forEach((b) => C(c, b, (v) => ge(v, c)));
95
+ const E = i.firstElementChild?.content || i.content, g = (b) => {
96
+ const v = M("<xhtml/>"), $ = v.importNode(b, !0);
97
+ return v.replaceChild($, v.documentElement), ee($);
92
98
  };
93
99
  if (E) {
94
- const v = N("div");
95
- return [...E.childNodes].map((b) => v.append(b.cloneNode(!0))), g(v);
100
+ const b = A("div");
101
+ return [...E.childNodes].map((v) => b.append(v.cloneNode(!0))), g(b);
96
102
  }
97
- return g(a.documentElement || a.body || a);
98
- })(e), i = M(
103
+ return g(i.documentElement || i.body || i);
104
+ })(e), a = M(
99
105
  `<xsl:stylesheet version="1.0"
100
106
  xmlns:xsl="${B}"
101
107
  xmlns:xhtml="${q}"
@@ -133,82 +139,82 @@ function oe(e, l = "xsl:stylesheet") {
133
139
  </xsl:stylesheet>`
134
140
  );
135
141
  s.importStylesheet(t);
136
- const c = s.transformToFragment(n, document), h = (a, o) => a.querySelector(o), p = h(i, 'template[mode="payload"]');
137
- if (!c)
142
+ const o = s.transformToFragment(n, document), h = (i, c) => i.querySelector(c), p = h(a, 'template[mode="payload"]');
143
+ if (!o)
138
144
  return console.error("transformation error", { xml: n.outerHTML, xsl: H(t) });
139
145
  const m = [];
140
- [...c.querySelectorAll("dce-root>attribute")].forEach((a) => {
141
- const o = Y(a, "xsl:param"), E = x(a, "name");
142
- p.append(o);
143
- let g = x(o, "select")?.split("??");
144
- g || (g = ["//" + E, `'${o.textContent}'`], U(o), o.setAttribute("name", E));
145
- let v;
146
+ [...o.querySelectorAll("dce-root>attribute")].forEach((i) => {
147
+ const c = G(i, "xsl:param"), E = x(i, "name");
148
+ p.append(c);
149
+ let g = x(c, "select")?.split("??");
150
+ g || (g = ["//" + E, `'${c.textContent}'`], U(c), c.setAttribute("name", E));
151
+ let b;
146
152
  if (g?.length > 1) {
147
- o.removeAttribute("select");
148
- const b = h(i, 'template[match="ignore"]>choose').cloneNode(!0);
149
- U(b.firstElementChild).append(S(b, "{" + g[0] + "}")), U(b.lastElementChild).append(S(b, "{" + g[1] + "}")), b.firstElementChild.setAttribute("test", g[0]), o.append(b), v = b.cloneNode(!0);
153
+ c.removeAttribute("select");
154
+ const v = h(a, 'template[match="ignore"]>choose').cloneNode(!0);
155
+ U(v.firstElementChild).append(S(v, "{" + g[0] + "}")), U(v.lastElementChild).append(S(v, "{" + g[1] + "}")), v.firstElementChild.setAttribute("test", g[0]), c.append(v), b = v.cloneNode(!0);
150
156
  } else
151
- v = Y(a, "xsl:value-of");
152
- v.removeAttribute("name"), a.append(v), a.removeAttribute("select"), m.push(o);
153
- }), [...c.querySelectorAll("[value]")].filter((a) => a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((a) => {
154
- const o = x(a, "value");
155
- o && a.setAttribute("value", xe(o));
157
+ b = G(i, "xsl:value-of");
158
+ b.removeAttribute("name"), i.append(b), i.removeAttribute("select"), m.push(c);
159
+ }), [...o.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
160
+ const c = x(i, "value");
161
+ c && i.setAttribute("value", be(c));
156
162
  });
157
- for (const a of c.childNodes)
158
- p.append(i.importNode(a, !0));
159
- [...p.querySelectorAll("template")].forEach((a) => p.ownerDocument.documentElement.append(a));
160
- const P = h(i, 'call-template[name="slot"]'), d = (a) => {
161
- const o = P.cloneNode(!0), E = x(a, "name");
162
- E && o.firstElementChild.setAttribute("select", `'${E}'`);
163
- for (let g of a.childNodes)
164
- o.lastElementChild.append(g);
165
- return o;
163
+ for (const i of o.childNodes)
164
+ p.append(a.importNode(i, !0));
165
+ [...p.querySelectorAll("template")].forEach((i) => p.ownerDocument.documentElement.append(i));
166
+ const P = h(a, 'call-template[name="slot"]'), d = (i) => {
167
+ const c = P.cloneNode(!0), E = x(i, "name");
168
+ E && c.firstElementChild.setAttribute("select", `'${E}'`);
169
+ for (let g of i.childNodes)
170
+ c.lastElementChild.append(g);
171
+ return c;
166
172
  };
167
- C(p, "slot", (a) => a.parentNode.replaceChild(d(a), a));
168
- const u = G(i);
173
+ C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
174
+ const u = Z(a);
169
175
  return u.params = m, u;
170
176
  }
171
- async function ce(e) {
177
+ async function ue(e) {
172
178
  return await new Promise((t, s) => {
173
179
  const n = new XMLHttpRequest();
174
180
  n.open("GET", e), n.responseType = "document", n.onload = () => {
175
- n.readyState === n.DONE && n.status === 200 && t(n.responseXML || N("div", n.responseText)), s(n.statusText);
176
- }, n.addEventListener("error", (i) => s(i)), n.send();
181
+ n.readyState === n.DONE && n.status === 200 && t(n.responseXML || A("div", n.responseText)), s(n.statusText);
182
+ }, n.addEventListener("error", (a) => s(a)), n.send();
177
183
  });
178
184
  }
179
- function me(e, l, t = !1) {
185
+ function de(e, l, t = !1) {
180
186
  if (e === l)
181
187
  return !0;
182
188
  if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
183
189
  return t;
184
190
  for (let s in e)
185
- if (!(s in l) || !me(e[s], l[s]))
191
+ if (!(s in l) || !de(e[s], l[s]))
186
192
  return t;
187
193
  return !0;
188
194
  }
189
- const Q = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), ue = (e, l) => Q(l).map((t) => {
190
- let s = e.ownerDocument, n = (i) => (e.append(i), i);
195
+ const se = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), pe = (e, l) => se(l).map((t) => {
196
+ let s = e.ownerDocument, n = (a) => (e.append(a), a);
191
197
  if (t.includes("/")) {
192
- const i = [], c = s.evaluate(t, e);
193
- for (let h; h = c.iterateNext(); )
194
- i.push(h);
195
- return i;
198
+ const a = [], o = s.evaluate(t, e);
199
+ for (let h; h = o.iterateNext(); )
200
+ a.push(h);
201
+ return a;
196
202
  }
197
- return [...e.childNodes].find((i) => i.localName === t) || n(N(t, "", s));
203
+ return [...e.childNodes].find((a) => a.localName === t) || n(A(t, "", s));
198
204
  }).flat();
199
205
  function J(e, l, t, s) {
200
206
  if (!t.sliceProcessed)
201
- return t.sliceProcessed = 1, ue(e, l ?? "").map((n) => {
202
- const i = e.ownerDocument, c = t.sliceEventSource, h = t.sliceElement, p = () => [...n.childNodes].filter((m) => m.nodeType === 3 || m.localName === "value" || m.localName === "form-data").map((m) => m.remove());
203
- if (c.getAttributeNames().map((m) => n.setAttribute(m, x(c, m))), [...n.childNodes].filter((m) => m.localName === "event").map((m) => m.remove()), "validationMessage" in c && n.setAttribute("validation-message", c.validationMessage), t.type === "init" && p(), n.append(D(t, "event", i)), h.hasAttribute("slice-value")) {
204
- c.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", c.value);
207
+ return t.sliceProcessed = 1, pe(e, l ?? "").map((n) => {
208
+ const a = e.ownerDocument, o = t.sliceEventSource, h = t.sliceElement, p = () => [...n.childNodes].filter((m) => m.nodeType === 3 || m.localName === "value" || m.localName === "form-data").map((m) => m.remove());
209
+ if (o.getAttributeNames().map((m) => n.setAttribute(m, x(o, m))), [...n.childNodes].filter((m) => m.localName === "event").map((m) => m.remove()), "validationMessage" in o && n.setAttribute("validation-message", o.validationMessage), t.type === "init" && p(), n.append(D(t, "event", a)), h.hasAttribute("slice-value")) {
210
+ o.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", o.value);
205
211
  const m = L(x(h, "slice-value"), n);
206
- p(), n.append(S(i, m));
212
+ p(), n.append(S(a, m));
207
213
  } else {
208
- if ("elements" in c)
209
- return p(), n.append(D(new FormData(c), "value", n.ownerDocument)), n;
210
- const m = c.value ?? x(h, "value");
211
- p(), m == null ? [...n.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : le(m) ? n.append(S(i, m)) : n.append(D(m, "value", n.ownerDocument));
214
+ if ("elements" in o)
215
+ return p(), n.append(D(new FormData(o), "value", n.ownerDocument)), n;
216
+ const m = o.value ?? x(h, "value");
217
+ p(), m == null ? [...n.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : re(m) ? n.append(S(a, m)) : n.append(D(m, "value", n.ownerDocument));
212
218
  }
213
219
  return n;
214
220
  });
@@ -216,7 +222,7 @@ function J(e, l, t, s) {
216
222
  function C(e, l, t) {
217
223
  e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
218
224
  }
219
- const de = async (e, l) => {
225
+ const fe = async (e, l) => {
220
226
  if (!e || !e.trim())
221
227
  return [l];
222
228
  if (e.startsWith("#"))
@@ -229,7 +235,7 @@ const de = async (e, l) => {
229
235
  return n === t ? [] : getByHashId(n);
230
236
  })(l.parentElement);
231
237
  try {
232
- const t = await ce(e), s = new URL(e, location).hash;
238
+ const t = await ue(e), s = new URL(e, location).hash;
233
239
  if (s) {
234
240
  const n = t.querySelectorAll(s);
235
241
  return n.length ? [...n] : [l];
@@ -239,47 +245,47 @@ const de = async (e, l) => {
239
245
  return [l];
240
246
  }
241
247
  };
242
- function pe(e, l) {
248
+ function he(e, l) {
243
249
  for (let t of e.attributes)
244
250
  t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
245
251
  }
246
- function Z(e, l = 0) {
252
+ function le(e, l = 0) {
247
253
  const t = {};
248
254
  for (const s of e.childNodes) {
249
255
  const n = x(s, "data-dce-id") || s.dceId || 0;
250
256
  if (!t[n])
251
257
  n ? t[n] = 1 : (t[n] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
252
258
  else {
253
- const i = s.dceId = n + "-" + t[n]++;
254
- s.setAttribute && s.setAttribute("data-dce-id", i);
259
+ const a = s.dceId = n + "-" + t[n]++;
260
+ s.setAttribute && s.setAttribute("data-dce-id", a);
255
261
  }
256
- s.childNodes.length && Z(s);
262
+ s.childNodes.length && le(s);
257
263
  }
258
264
  }
259
- function fe(e, l, t) {
265
+ function xe(e, l, t) {
260
266
  t = 1 * t;
261
267
  for (let s of e.childNodes)
262
268
  if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
263
269
  return e.insertBefore(l, s);
264
270
  e.append(l);
265
271
  }
266
- function ee(e, l) {
272
+ function ne(e, l) {
267
273
  if (!l.length)
268
274
  return K(e);
269
275
  const t = {};
270
276
  for (let s of e.childNodes)
271
- t[s.dceId], W(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
277
+ t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
272
278
  for (let s of [...l]) {
273
- const n = x(s, "data-dce-id") || s.dceId, i = t[n];
274
- i ? (W(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (pe(s, i), (i.childNodes.length || s.childNodes.length) && ee(i, s.childNodes)), delete t[n]) : fe(e, s, n);
279
+ const n = x(s, "data-dce-id") || s.dceId, a = t[n];
280
+ a ? (Y(s) ? a.nodeValue !== s.nodeValue && (a.nodeValue = s.nodeValue) : (he(s, a), (a.childNodes.length || s.childNodes.length) && ne(a, s.childNodes)), delete t[n]) : xe(e, s, n);
275
281
  }
276
282
  for (let s of Object.values(t))
277
283
  s.remove();
278
284
  }
279
- function he(e, l) {
285
+ function ye(e, l) {
280
286
  return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
281
287
  }
282
- const xe = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
288
+ const be = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
283
289
  if (!e.trim())
284
290
  return e;
285
291
  const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
@@ -299,11 +305,11 @@ const xe = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
299
305
  return s.booleanValue;
300
306
  }
301
307
  let n = "";
302
- for (let i; i = s.iterateNext(); )
303
- n += i.textContent;
308
+ for (let a; a = s.iterateNext(); )
309
+ n += a.textContent;
304
310
  return n;
305
- }, ye = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,template,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), be = (e, l) => {
306
- const t = N("xsl:" + e.localName);
311
+ }, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,template,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), ge = (e, l) => {
312
+ const t = A("xsl:" + e.localName);
307
313
  for (let s of e.attributes)
308
314
  t.setAttribute(s.name, s.value);
309
315
  for (; e.firstChild; )
@@ -312,24 +318,24 @@ const xe = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
312
318
  e.parentElement.replaceChild(t, e);
313
319
  else {
314
320
  const s = e.parentElement || l, n = [...s.childNodes];
315
- n.forEach((i, c) => {
316
- i === e && (n[c] = t);
321
+ n.forEach((a, o) => {
322
+ a === e && (n[o] = t);
317
323
  }), s.replaceChildren(...n);
318
324
  }
319
325
  };
320
- class ge extends HTMLElement {
326
+ class Ee extends HTMLElement {
321
327
  static observedAttributes = ["src", "tag", "hidden"];
322
328
  async connectedCallback() {
323
- const l = await de(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
329
+ const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
324
330
  for (const d of l)
325
331
  C(d.templateNode || d.content || d, "style", (u) => {
326
- const a = u.closest("slot"), o = a ? `slot[name="${a.name}"]` : "";
327
- u.innerHTML = `${s} ${o}{${u.innerHTML}}`, this.append(u);
332
+ const i = u.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
333
+ u.innerHTML = `${s} ${c}{${u.innerHTML}}`, this.append(u);
328
334
  });
329
- const n = l.map((d) => oe(d)), i = n.map((d, u) => (u = new XSLTProcessor(), u.importStylesheet(d), u));
335
+ const n = l.map((d) => me(d)), a = n.map((d, u) => (u = new XSLTProcessor(), u.importStylesheet(d), u));
330
336
  Object.defineProperty(this, "xsltString", { get: () => n.map((d) => H(d)).join(`
331
337
  `) });
332
- const c = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, u, a) => a.indexOf(d) === u).map(Q).flat(), m = n.reduce((d, u) => (u.params && d.push(...u.params), d), []);
338
+ const o = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, u, i) => i.indexOf(d) === u).map(se).flat(), m = n.reduce((d, u) => (u.params && d.push(...u.params), d), []);
333
339
  class w extends HTMLElement {
334
340
  static get observedAttributes() {
335
341
  return m.map((u) => x(u, "name"));
@@ -343,42 +349,42 @@ class ge extends HTMLElement {
343
349
  f.remove(), u = f.content.childNodes;
344
350
  for (const r of [...f.content.childNodes])
345
351
  if (r.localName === "style") {
346
- const y = he(this, "data-dce-style");
352
+ const y = ye(this, "data-dce-style");
347
353
  r.innerHTML = `${s}[data-dce-style="${y}"]{${r.innerHTML}}`, f.insertAdjacentElement("beforebegin", r);
348
354
  } else
349
355
  r.nodeType === 1 ? f.insertAdjacentElement("beforebegin", r) : r.nodeType === 3 && f.insertAdjacentText("beforebegin", r.data);
350
356
  }
351
- const a = M("<datadom/>").documentElement, o = (f, r = "") => ((y) => (r && y.append(S(a, r)), y))(a.ownerDocument.createElement(f));
352
- X(a, "payload", u, re), this.innerHTML = "";
353
- const E = X(a, "attributes", this.attributes, (f) => o(f.nodeName, f.value));
354
- X(a, "dataset", Object.keys(this.dataset), (f) => o(f, this.dataset[f]));
355
- const g = X(a, "slice", p, (f) => o(f, "")), v = (f) => L(f, g);
356
- this.xml = a;
357
- const b = [], $ = () => {
357
+ const i = M("<datadom/>").documentElement, c = (f, r = "") => ((y) => (r && y.append(S(i, r)), y))(i.ownerDocument.createElement(f)), E = X(i, "payload", u, ce);
358
+ Q(E), ee(E), this.innerHTML = "";
359
+ const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
360
+ X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
361
+ const b = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, b);
362
+ this.xml = i;
363
+ const $ = [], W = () => {
358
364
  const f = {};
359
- for (let r; r = b.pop(); ) {
365
+ for (let r; r = $.pop(); ) {
360
366
  const y = x(r.sliceElement, "slice");
361
- f[y] || (J(g, y, r), f[y] = r);
367
+ f[y] || (J(b, y, r), f[y] = r);
362
368
  }
363
369
  Object.keys(f).length !== 0 && I();
364
370
  };
365
371
  let V;
366
372
  this.onSlice = (f) => {
367
- b.push(f), V || (V = setTimeout(() => {
368
- $(), V = 0;
373
+ $.push(f), V || (V = setTimeout(() => {
374
+ W(), V = 0;
369
375
  }, 1));
370
376
  };
371
377
  const I = this.transform = () => {
372
378
  if (this.#e)
373
379
  debugger;
374
- this.#e = 1, i.map((r, y) => {
375
- const R = r.transformToFragment(a.ownerDocument, document);
380
+ this.#e = 1, a.map((r, y) => {
381
+ const R = r.transformToFragment(i.ownerDocument, document);
376
382
  return R || console.error(`XSLT transformation error. xsl:
377
383
  `, H(n[y]), `
378
384
  xml:
379
- `, H(a)), R;
385
+ `, H(i)), R;
380
386
  }).map((r) => {
381
- r && (Z(r), ee(this, r.childNodes));
387
+ r && (le(r), ne(this, r.childNodes));
382
388
  }), w.observedAttributes.map((r) => {
383
389
  let y = x(this.firstElementChild, r);
384
390
  y !== x(this, r) && (this.setAttribute(r, y), this.#t(r, y));
@@ -386,42 +392,42 @@ xml:
386
392
  if (!r.dceInitialized) {
387
393
  r.dceInitialized = 1;
388
394
  let y = x(r, "slice-event");
389
- x(r, "custom-validity") && (y += " change submit"), [...new Set((y || "change").split(" "))].forEach((R) => (r.localName === "slice" ? r.parentElement : r).addEventListener(R, (A) => {
390
- A.sliceElement = r, A.sliceEventSource = A.currentTarget || A.target;
391
- const te = J(g, x(A.sliceElement, "slice"), A);
395
+ r.hasAttribute("custom-validity") && (y += " change submit"), [...new Set((y || "change").split(" "))].forEach((R) => (r.localName === "slice" ? r.parentElement : r).addEventListener(R, (N) => {
396
+ N.sliceElement = r, N.sliceEventSource = N.currentTarget || N.target;
397
+ const ae = J(b, x(N.sliceElement, "slice"), N);
392
398
  C(this, "[custom-validity]", (z) => {
393
399
  if (!z.setCustomValidity)
394
400
  return;
395
401
  const _ = x(z, "custom-validity");
396
402
  try {
397
- const j = _ && L(_, E);
403
+ const j = _ && L(_, g);
398
404
  z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
399
405
  } catch (j) {
400
406
  console.error(j, "xPath", _);
401
407
  }
402
408
  });
403
- const k = x(r, "custom-validity"), T = k && L(k, E), O = T === !0 ? "" : T;
409
+ const k = x(r, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
404
410
  if (k) {
405
- if (r.setCustomValidity ? r.setCustomValidity(O) : r.validationMessage = O, te.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
406
- return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
411
+ if (r.setCustomValidity ? r.setCustomValidity(O) : r.validationMessage = O, ae.map((z) => z.setAttribute("validation-message", O)), N.type === "submit")
412
+ return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || N.preventDefault(), T) : T ? (N.preventDefault(), !1) : void 0);
407
413
  setTimeout(I, 1);
408
414
  }
409
- this.onSlice(A);
415
+ this.onSlice(N);
410
416
  })), (!y || y.includes("init")) && (r.hasAttribute("slice-value") || r.hasAttribute("value") || r.value ? this.onSlice({ type: "init", target: r, sliceElement: r, sliceEventSource: r }) : r.value = v(x(r, "slice")));
411
417
  }
412
418
  }), this.#e = 0;
413
419
  };
414
- I(), $();
420
+ I(), W();
415
421
  }
416
- #t(u, a) {
417
- let o = this.xml.querySelector(`attributes>${u}`);
418
- o ? U(o).append(S(o, a)) : (o = N(u, a, this.xml), this.xml.querySelector("attributes").append(o));
422
+ #t(u, i) {
423
+ let c = this.xml.querySelector(`attributes>${u}`);
424
+ c ? U(c).append(S(c, i)) : (c = A(u, i, this.xml), this.xml.querySelector("attributes").append(c));
419
425
  }
420
- attributeChangedCallback(u, a, o) {
421
- !this.xml || this.#e || (this.#t(u, o), this.transform());
426
+ attributeChangedCallback(u, i, c) {
427
+ !this.xml || this.#e || (this.#t(u, c), this.transform());
422
428
  }
423
429
  get dce() {
424
- return c;
430
+ return o;
425
431
  }
426
432
  }
427
433
  const P = (d) => {
@@ -433,7 +439,7 @@ xml:
433
439
  const d = s;
434
440
  this.setAttribute("tag", d), P(d);
435
441
  const u = document.createElement(d);
436
- this.getAttributeNames().forEach((a) => u.setAttribute(a, this.getAttribute(a))), u.append(...[...this.childNodes].filter((a) => a.localName !== "style")), this.append(u);
442
+ this.getAttributeNames().forEach((i) => u.setAttribute(i, this.getAttribute(i))), u.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(u);
437
443
  }
438
444
  }
439
445
  get templateNode() {
@@ -446,26 +452,26 @@ xml:
446
452
  return M(this.xsltString);
447
453
  }
448
454
  }
449
- window.customElements.define("custom-element", ge);
455
+ window.customElements.define("custom-element", Ee);
450
456
  export {
451
- ge as C,
457
+ Ee as C,
452
458
  H as a,
453
- ce as b,
454
- oe as c,
455
- me as d,
456
- ue as e,
459
+ ue as b,
460
+ me as c,
461
+ de as d,
462
+ pe as e,
457
463
  J as f,
458
- Z as g,
459
- fe as h,
460
- ee as i,
461
- he as j,
462
- xe as k,
464
+ le as g,
465
+ xe as h,
466
+ ne as i,
467
+ ye as j,
468
+ be as k,
463
469
  F as l,
464
- pe as m,
470
+ he as m,
465
471
  L as n,
466
472
  D as o,
467
- ye as p,
468
- be as q,
469
- G as t,
473
+ ve as p,
474
+ ge as q,
475
+ Z as t,
470
476
  M as x
471
477
  };