@epa-wg/custom-element-dist 0.0.26 → 0.0.27

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 (137) hide show
  1. package/.idea/custom-element-dist.iml +1 -5
  2. package/.storybook/preview.ts +1 -1
  3. package/README.md +4 -4
  4. package/bin/vitest/vitest-browser-importmaps.mjs +20 -20
  5. package/coverage/coverage-final.json +9 -9
  6. package/coverage/index.html +25 -25
  7. package/coverage/src/custom-element/coverage.svg +1 -1
  8. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  9. package/coverage/src/custom-element/custom-element.js.html +467 -308
  10. package/coverage/src/custom-element/demo/index.html +1 -1
  11. package/coverage/src/custom-element/demo/z.js.html +1 -1
  12. package/coverage/src/custom-element/http-request.js.html +12 -12
  13. package/coverage/src/custom-element/index.html +20 -20
  14. package/coverage/src/custom-element/local-storage.js.html +56 -41
  15. package/coverage/src/custom-element/location-element.js.html +4 -4
  16. package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
  17. package/coverage/src/custom-element/module-url.js.html +16 -10
  18. package/coverage/src/index.html +1 -1
  19. package/coverage/src/mocks/handlers.ts.html +1 -1
  20. package/coverage/src/mocks/index.html +1 -1
  21. package/coverage/src/stories/attributes.test.stories.ts.html +9 -12
  22. package/coverage/src/stories/coverage.svg +1 -1
  23. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  24. package/coverage/src/stories/dom-merge.test.stories.ts.html +15 -9
  25. package/coverage/src/stories/external-template.test.stories.ts.html +8 -11
  26. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  27. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  28. package/coverage/src/stories/index.html +26 -26
  29. package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
  30. package/coverage/src/stories/local-storage.test.stories.ts.html +87 -63
  31. package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
  32. package/coverage/src/stories/module-url.test.stories.ts.html +1 -1
  33. package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
  34. package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
  35. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  36. package/coverage/src/stories/testStoryBook.ts.html +1 -1
  37. package/coverage/src/stories/version-select.test.stories.ts.html +1 -1
  38. package/coverage/src/sum.ts.html +1 -1
  39. package/dist/{custom-element-b7c_7Kz4.js → custom-element-BMMsP1Dy.js} +204 -156
  40. package/dist/custom-element-CPSk7s0j.cjs +87 -0
  41. package/dist/custom-element-bundle.cjs +1 -1
  42. package/dist/custom-element-bundle.js +28 -25
  43. package/dist/demo/a.svg +27 -0
  44. package/dist/demo/demo.css +6 -7
  45. package/dist/demo/external-template.html +3 -3
  46. package/dist/demo/npm-versions-demo.html +21 -8
  47. package/dist/demo/npm-versions.html +54 -25
  48. package/dist/demo/s.xml +3 -28
  49. package/dist/demo/s.xslt +51 -92
  50. package/dist/demo/z.html +32 -61
  51. package/dist/demo/z1.html +34 -0
  52. package/dist/local-storage-78EivJ_B.cjs +1 -0
  53. package/dist/local-storage-DzmNKzgN.js +66 -0
  54. package/dist/mockServiceWorker.js +1 -1
  55. package/package.json +27 -25
  56. package/public/demo/a.svg +27 -0
  57. package/public/demo/demo.css +6 -7
  58. package/public/demo/external-template.html +3 -3
  59. package/public/demo/npm-versions-demo.html +21 -8
  60. package/public/demo/npm-versions.html +54 -25
  61. package/public/demo/s.xml +3 -28
  62. package/public/demo/s.xslt +51 -92
  63. package/public/demo/z.html +32 -61
  64. package/public/demo/z1.html +34 -0
  65. package/public/mockServiceWorker.js +1 -1
  66. package/src/custom-element/custom-element.js +67 -14
  67. package/src/custom-element/demo/a.svg +27 -0
  68. package/src/custom-element/demo/demo.css +6 -7
  69. package/src/custom-element/demo/external-template.html +3 -3
  70. package/src/custom-element/demo/npm-versions-demo.html +21 -8
  71. package/src/custom-element/demo/npm-versions.html +54 -25
  72. package/src/custom-element/demo/s.xml +3 -28
  73. package/src/custom-element/demo/s.xslt +51 -92
  74. package/src/custom-element/demo/z.html +32 -61
  75. package/src/custom-element/demo/z1.html +34 -0
  76. package/src/custom-element/ide/web-types-dce.json +1 -1
  77. package/src/custom-element/ide/web-types-xsl.json +1 -1
  78. package/src/custom-element/index.html +19 -2
  79. package/src/custom-element/local-storage.js +19 -14
  80. package/src/custom-element/module-url.js +3 -2
  81. package/src/mocks/versions.mock.ts +8 -8
  82. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  83. package/src/stories/attributes.test.stories.ts +3 -4
  84. package/src/stories/dom-merge.test.stories.ts +9 -7
  85. package/src/stories/external-template.test.stories.ts +2 -3
  86. package/src/stories/local-storage.test.stories.ts +61 -53
  87. package/src/sum.test.ts +5 -5
  88. package/src/sum.ts +3 -3
  89. package/storybook-static/assets/{Color-KGDBMAHA-CH-YyWYq.js → Color-KGDBMAHA-CJo5gHY3.js} +1 -1
  90. package/storybook-static/assets/{Configure-DFL_bm2M.js → Configure-DdXbGKhY.js} +1 -1
  91. package/storybook-static/assets/{DocsRenderer-PKQXORMH-Bz-_1hmS.js → DocsRenderer-PKQXORMH-DLnpL5hE.js} +2 -2
  92. package/storybook-static/assets/{attributes.test.stories-DIQXccHc.js → attributes.test.stories-Bt5V18qO.js} +10 -11
  93. package/storybook-static/assets/{css.test.stories-BV2hi4CY.js → css.test.stories-CGYy2daE.js} +1 -1
  94. package/storybook-static/assets/{custom-element-wn23PUwN.js → custom-element-D8hcDZHh.js} +116 -82
  95. package/storybook-static/assets/{dom-merge.test.stories-Dws0C2-g.js → dom-merge.test.stories-XlsZ0UvX.js} +22 -20
  96. package/storybook-static/assets/{external-template.test.stories-BHO48b0j.js → external-template.test.stories-Bt_Pflu8.js} +7 -8
  97. package/storybook-static/assets/{form.test.stories-dv9mwp24.js → form.test.stories-B0NoI8wm.js} +1 -1
  98. package/storybook-static/assets/{handlers-CaCq2ZPF.js → handlers-B5969HUu.js} +13 -13
  99. package/storybook-static/assets/{http-request.stories-B2ke7LtS.js → http-request.stories-B2skuTFV.js} +1 -1
  100. package/storybook-static/assets/iframe-Dfrt81rk.js +2 -0
  101. package/storybook-static/assets/{index-BnXBQqj9.js → index-Ay195x2L.js} +4 -4
  102. package/storybook-static/assets/{index-sm7QlJZE.js → index-C3ChPTMh.js} +1 -1
  103. package/storybook-static/assets/{index-Dz4OaB2k.js → index-C7lvoJNv.js} +1 -1
  104. package/storybook-static/assets/{index-Cpxqn5iQ.js → index-Gpdhz4ab.js} +1 -1
  105. package/storybook-static/assets/local-storage.test.stories-DfY6feqG.js +420 -0
  106. package/storybook-static/assets/{location-element.test.stories-BiFvBop7.js → location-element.test.stories-944AotIJ.js} +1 -1
  107. package/storybook-static/assets/{module-url.test.stories-BXoM34tX.js → module-url.test.stories-DSKcwApl.js} +1 -1
  108. package/storybook-static/assets/preview-AJR7rVPD.js +52 -0
  109. package/storybook-static/assets/{preview-Cg7hXPRq.js → preview-CadgX-4y.js} +2 -2
  110. package/storybook-static/assets/{set-url.test.stories-Cg5Z0r7x.js → set-url.test.stories-DjLHKkEh.js} +1 -1
  111. package/storybook-static/assets/{slice-events.test.stories-D_ttGp3g.js → slice-events.test.stories-8I_BrHd6.js} +1 -1
  112. package/storybook-static/assets/{slots.test.stories-DBNXOm0T.js → slots.test.stories-CvZz4jyP.js} +1 -1
  113. package/storybook-static/assets/{version-select.test.stories-CgV3UCim.js → version-select.test.stories-DSxmJylI.js} +1 -1
  114. package/storybook-static/demo/a.svg +27 -0
  115. package/storybook-static/demo/demo.css +6 -7
  116. package/storybook-static/demo/external-template.html +3 -3
  117. package/storybook-static/demo/npm-versions-demo.html +21 -8
  118. package/storybook-static/demo/npm-versions.html +54 -25
  119. package/storybook-static/demo/s.xml +3 -28
  120. package/storybook-static/demo/s.xslt +51 -92
  121. package/storybook-static/demo/z.html +32 -61
  122. package/storybook-static/demo/z1.html +34 -0
  123. package/storybook-static/iframe.html +1 -1
  124. package/storybook-static/mockServiceWorker.js +1 -1
  125. package/storybook-static/project.json +1 -1
  126. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +39 -36
  127. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +38 -1
  128. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  129. package/.idea/compiler.xml +0 -6
  130. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  131. package/.vscode/settings.json +0 -24
  132. package/dist/custom-element-CckoVsvO.cjs +0 -53
  133. package/dist/local-storage-Boafngui.cjs +0 -1
  134. package/dist/local-storage-BqDEu2kF.js +0 -59
  135. package/storybook-static/assets/iframe-D4Sos1HO.js +0 -2
  136. package/storybook-static/assets/local-storage.test.stories-BpogLNq-.js +0 -419
  137. package/storybook-static/assets/preview-oHxXRSIu.js +0 -48
@@ -1,8 +1,8 @@
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, oe = (e) => typeof e == "string", re = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
1
+ const B = "http://www.w3.org/1999/XSL/Transform", U = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", b = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, oe = (e) => typeof e == "string", re = (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)), 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), N = (e, l = "", t = document) => {
5
- const s = (n) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(n));
4
+ }, H = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", U), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), N = (e, l = "", t = document) => {
5
+ const s = (i) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(i));
6
6
  if (te(e))
7
7
  return s(e);
8
8
  const a = s("dce-object");
@@ -15,14 +15,14 @@ const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xh
15
15
  t.append(e.firstChild);
16
16
  return t;
17
17
  };
18
- function M(e) {
18
+ function P(e) {
19
19
  return new DOMParser().parseFromString(e, "application/xml");
20
20
  }
21
- function H(e) {
21
+ function M(e) {
22
22
  return new XMLSerializer().serializeToString(e);
23
23
  }
24
- function X(e, l, t, s) {
25
- const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, u) => (p.append(u = a(h)), u))(l, e);
24
+ function q(e, l, t, s) {
25
+ const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, d) => (p.append(d = a(h)), d))(l, e);
26
26
  return [...t].forEach((h) => r.append(s(h))), r;
27
27
  }
28
28
  function ce(e) {
@@ -36,30 +36,30 @@ function $(e, l, t) {
36
36
  if (s === "number")
37
37
  return N(l, "" + e, t);
38
38
  if (e instanceof Array) {
39
- const n = N("array", "", t);
40
- return e.map((r) => n.append($(r, l, t))), n;
39
+ const i = N("array", "", t);
40
+ return e.map((r) => i.append($(r, l, t))), i;
41
41
  }
42
42
  if (e instanceof FormData) {
43
- const n = N("form-data", "", t);
43
+ const i = N("form-data", "", t);
44
44
  for (const r of e)
45
- n.append($(r[1], r[0], t));
46
- return n;
45
+ i.append($(r[1], r[0], t));
46
+ return i;
47
47
  }
48
48
  const a = N(l, "", t);
49
- for (let n in e)
50
- re(e[n]) || typeof e[n] == "function" || e[n] instanceof Window || (typeof e[n] != "object" && te(n) ? a.setAttribute(n, e[n]) : a.append($(e[n], n, t)));
49
+ for (let i in e)
50
+ re(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" && te(i) ? a.setAttribute(i, e[i]) : a.append($(e[i], i, t)));
51
51
  return a;
52
52
  }
53
53
  function Z(e) {
54
54
  if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
55
55
  const s = t.data, a = s.matchAll(/{([^}]*)}/g);
56
56
  if (a) {
57
- let n = 0, r = (p) => S(t, p), h = [];
57
+ let i = 0, r = (p) => S(t, p), h = [];
58
58
  if ([...a].forEach((p) => {
59
- p.index > n && h.push(r(p.input.substring(n, p.index)));
60
- const u = e.querySelector("value-of").cloneNode();
61
- u.setAttribute("select", p[1]), h.push(u), n = p.index + p[0].length;
62
- }), n < s.length && h.push(r(s.substring(n, s.length))), h.length) {
59
+ p.index > i && h.push(r(p.input.substring(i, p.index)));
60
+ const d = e.querySelector("value-of").cloneNode();
61
+ d.setAttribute("select", p[1]), h.push(d), i = p.index + p[0].length;
62
+ }), i < s.length && h.push(r(s.substring(i, s.length))), h.length) {
63
63
  for (let p of h)
64
64
  l.insertBefore(p, t);
65
65
  l.removeChild(t);
@@ -75,36 +75,72 @@ function Z(e) {
75
75
  function me(e, l = "xsl:stylesheet") {
76
76
  if (e.tagName === l || e.documentElement?.tagName === l)
77
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" >
79
- <xsl:output method="xml" />
80
- <xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
81
- <xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
82
- <xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
83
- <xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
84
- <xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]"><xsl:copy><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:copy></xsl:template>
85
- <xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:element></xsl:template>
86
- <xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
87
- <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
88
- <xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
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>
90
- <xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
91
- </xsl:stylesheet>`), s = new XSLTProcessor(), a = ((i) => {
92
- C(i, "script", (y) => y.remove());
93
- const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
94
- ve.forEach((y) => C(c, y, (v) => ge(v, c)));
95
- const E = i.firstElementChild?.content || i.content, g = (y) => {
96
- const v = M("<xhtml/>"), D = v.importNode(y, !0);
97
- return v.replaceChild(D, v.documentElement), ee(D);
78
+ const t = P(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${U}" xmlns:exsl="${ie}" exclude-result-prefixes="exsl" >
79
+ <xsl:output method="xml"/>
80
+ <xsl:template match="/"><dce-root xmlns="${U}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
81
+ <xsl:template match="*[name()='template']">
82
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
83
+ </xsl:template>
84
+ <xsl:template match="*">
85
+ <xsl:apply-templates mode="sanitize" select="*|text()"/>
86
+ </xsl:template>
87
+ <xsl:template match="*[name()='svg']|*[name()='math']">
88
+ <xsl:apply-templates mode="sanitize" select="."/>
89
+ </xsl:template>
90
+ <xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
91
+ <xsl:copy>
92
+ <xsl:apply-templates mode="sanitize" select="@*"/>
93
+ <xsl:value-of select="text()"></xsl:value-of>
94
+ </xsl:copy>
95
+ </xsl:template>
96
+ <xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
97
+ <xsl:element name="{local-name()}">
98
+ <xsl:apply-templates mode="sanitize" select="@*"/>
99
+ <xsl:value-of select="text()"></xsl:value-of>
100
+ </xsl:element>
101
+ </xsl:template>
102
+ <xsl:template mode="sanitize" match="*|@*">
103
+ <xsl:copy>
104
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
105
+ </xsl:copy>
106
+ </xsl:template>
107
+ <xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
108
+ <xsl:template mode="sanitize" match="text()">
109
+ <dce-text>
110
+ <xsl:copy/>
111
+ </dce-text>
112
+ </xsl:template>
113
+ <xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
114
+ <dce-text>
115
+ <xsl:copy>
116
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
117
+ </xsl:copy>
118
+ </dce-text>
119
+ </xsl:template>
120
+ <xsl:template mode="sanitize" match="xhtml:*">
121
+ <xsl:element name="{local-name()}">
122
+ <xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
123
+ </xsl:element>
124
+ </xsl:template>
125
+ </xsl:stylesheet>`), s = new XSLTProcessor(), a = ((n) => {
126
+ C(n, "custom-element", (x) => {
127
+ x.firstElementChild.localName === "template" && ([...x.firstElementChild.content.childNodes].forEach((y) => x.append(y)), x.firstElementChild.remove());
128
+ }), C(n, "script", (x) => x.remove());
129
+ const c = n.content ?? n.firstElementChild?.content ?? n.body ?? n;
130
+ ve.forEach((x) => C(c, x, (y) => ge(y, c)));
131
+ const E = n.firstElementChild?.content || n.content, g = (x) => {
132
+ const y = P("<xhtml/>"), L = y.importNode(x, !0);
133
+ return y.replaceChild(L, y.documentElement), ee(L);
98
134
  };
99
135
  if (E) {
100
- const y = N("div");
101
- return [...E.childNodes].map((v) => y.append(v.cloneNode(!0))), g(y);
136
+ const x = N("div");
137
+ return [...E.childNodes].map((y) => x.append(y.cloneNode(!0))), g(x);
102
138
  }
103
- return g(i.documentElement || i.body || i);
104
- })(e), n = M(
139
+ return g(n.documentElement || n.body || n);
140
+ })(e), i = P(
105
141
  `<xsl:stylesheet version="1.0"
106
142
  xmlns:xsl="${B}"
107
- xmlns:xhtml="${q}"
143
+ xmlns:xhtml="${U}"
108
144
  xmlns:dce="urn:schemas-epa-wg:dce"
109
145
  xmlns:exsl="http://exslt.org/common"
110
146
  exclude-result-prefixes="exsl"
@@ -139,82 +175,86 @@ function me(e, l = "xsl:stylesheet") {
139
175
  </xsl:stylesheet>`
140
176
  );
141
177
  s.importStylesheet(t);
142
- const r = s.transformToFragment(a, document), h = (i, c) => i.querySelector(c), p = h(n, 'template[mode="payload"]');
178
+ const r = s.transformToFragment(a, document), h = (n, c) => n.querySelector(c), p = h(i, 'template[mode="payload"]');
143
179
  if (!r)
144
- return console.error("transformation error", { xml: a.outerHTML, xsl: H(t) });
145
- const u = [];
146
- [...r.querySelectorAll("dce-root>attribute")].forEach((i) => {
147
- const c = G(i, "xsl:param"), E = x(i, "name");
180
+ return console.error("transformation error", { xml: a.outerHTML, xsl: M(t) });
181
+ if (r.firstElementChild.localName !== "dce-root") {
182
+ const n = r.ownerDocument.createElement("dce-root");
183
+ [...r.childNodes].forEach((c) => n.append(c)), r.append(n);
184
+ }
185
+ const d = [];
186
+ [...r.querySelectorAll("dce-root>attribute")].forEach((n) => {
187
+ const c = G(n, "xsl:param"), E = b(n, "name");
148
188
  p.append(c);
149
- let g = x(c, "select")?.split("??");
150
- g || (g = ["//" + E, `'${c.textContent}'`], U(c), c.setAttribute("name", E));
151
- let y;
189
+ let g = b(c, "select")?.split("??");
190
+ g || (g = ["//" + E, `'${c.textContent}'`], H(c), c.setAttribute("name", E));
191
+ let x;
152
192
  if (g?.length > 1) {
153
193
  c.removeAttribute("select");
154
- const v = h(n, '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), y = v.cloneNode(!0);
194
+ const y = h(i, 'template[match="ignore"]>choose').cloneNode(!0);
195
+ H(y.firstElementChild).append(S(y, "{" + g[0] + "}")), H(y.lastElementChild).append(S(y, "{" + g[1] + "}")), y.firstElementChild.setAttribute("test", g[0]), c.append(y), x = y.cloneNode(!0);
156
196
  } else
157
- y = G(i, "xsl:value-of");
158
- y.removeAttribute("name"), i.append(y), i.removeAttribute("select"), u.push(c);
159
- }), [...r.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
160
- const c = x(i, "value");
161
- c && i.setAttribute("value", ye(c));
197
+ x = G(n, "xsl:value-of");
198
+ x.removeAttribute("name"), n.append(x), n.removeAttribute("select"), d.push(c);
199
+ }), [...r.querySelectorAll("[value]")].filter((n) => n.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((n) => {
200
+ const c = b(n, "value");
201
+ c && n.setAttribute("value", ye(c));
162
202
  });
163
- for (const i of r.childNodes)
164
- p.append(n.importNode(i, !0));
165
- [...p.getElementsByTagName("xsl:template")].forEach((i) => p.ownerDocument.documentElement.append(i));
166
- const P = h(n, 'call-template[name="slot"]'), d = (i) => {
167
- const c = P.cloneNode(!0), E = x(i, "name");
203
+ for (const n of r.childNodes)
204
+ p.append(i.importNode(n, !0));
205
+ [...p.getElementsByTagName("xsl:template")].forEach((n) => p.ownerDocument.documentElement.append(n));
206
+ const R = h(i, 'call-template[name="slot"]'), u = (n) => {
207
+ const c = R.cloneNode(!0), E = b(n, "name");
168
208
  E && c.firstElementChild.setAttribute("select", `'${E}'`);
169
- for (let g of i.childNodes)
209
+ for (let g of n.childNodes)
170
210
  c.lastElementChild.append(g);
171
211
  return c;
172
212
  };
173
- C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
174
- const m = Z(n);
175
- return m.params = u, m;
213
+ C(p, "slot", (n) => n.parentNode.replaceChild(u(n), n));
214
+ const m = Z(i);
215
+ return m.params = d, m;
176
216
  }
177
- async function ue(e) {
217
+ async function de(e) {
178
218
  return await new Promise((t, s) => {
179
219
  const a = new XMLHttpRequest();
180
220
  a.open("GET", e), a.responseType = "document", a.onload = () => {
181
221
  a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
182
- }, a.addEventListener("error", (n) => s(n)), a.send();
222
+ }, a.addEventListener("error", (i) => s(i)), a.send();
183
223
  });
184
224
  }
185
- function de(e, l, t = !1) {
225
+ function ue(e, l, t = !1) {
186
226
  if (e === l)
187
227
  return !0;
188
228
  if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
189
229
  return t;
190
230
  for (let s in e)
191
- if (!(s in l) || !de(e[s], l[s]))
231
+ if (!(s in l) || !ue(e[s], l[s]))
192
232
  return t;
193
233
  return !0;
194
234
  }
195
235
  const se = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), pe = (e, l) => se(l).map((t) => {
196
- let s = e.ownerDocument, a = (n) => (e.append(n), n);
236
+ let s = e.ownerDocument, a = (i) => (e.append(i), i);
197
237
  if (t.includes("/")) {
198
- const n = [], r = s.evaluate(t, e);
238
+ const i = [], r = s.evaluate(t, e);
199
239
  for (let h; h = r.iterateNext(); )
200
- n.push(h);
201
- return n;
240
+ i.push(h);
241
+ return i;
202
242
  }
203
- return [...e.childNodes].find((n) => n.localName === t) || a(N(t, "", s));
243
+ return [...e.childNodes].find((i) => i.localName === t) || a(N(t, "", s));
204
244
  }).flat();
205
245
  function J(e, l, t, s) {
206
246
  if (!t.sliceProcessed)
207
247
  return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
208
- const n = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
209
- if (r.getAttributeNames().map((u) => a.setAttribute(u, x(r, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append($(t, "event", n)), h.hasAttribute("slice-value")) {
248
+ const i = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((d) => d.nodeType === 3 || d.localName === "value" || d.localName === "form-data").map((d) => d.remove());
249
+ if (r.getAttributeNames().map((d) => a.setAttribute(d, b(r, d))), [...a.childNodes].filter((d) => d.localName === "event").map((d) => d.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append($(t, "event", i)), h.hasAttribute("slice-value")) {
210
250
  r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
211
- const u = L(x(h, "slice-value"), a);
212
- p(), a.append(S(n, u));
251
+ const d = D(b(h, "slice-value"), a);
252
+ p(), a.append(S(i, d));
213
253
  } else {
214
254
  if ("elements" in r)
215
255
  return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
216
- const u = r.value ?? x(r, "value");
217
- p(), u == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(u) ? a.append(S(n, u)) : a.append($(u, "value", a.ownerDocument));
256
+ const d = r.value ?? b(r, "value");
257
+ p(), d == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(d) ? a.append(S(i, d)) : a.append($(d, "value", a.ownerDocument));
218
258
  }
219
259
  return a;
220
260
  });
@@ -237,13 +277,13 @@ const fe = async (e, l) => {
237
277
  else
238
278
  try {
239
279
  e = import.meta.resolve(t), s && (e += "#" + s);
240
- } catch (n) {
241
- console.error(n.message);
280
+ } catch (i) {
281
+ console.error(i.message);
242
282
  }
243
- const a = await ue(e);
283
+ const a = await de(e);
244
284
  if (l.setAttributeNS("xml", "base", e), s) {
245
- const n = a.querySelectorAll("#" + s);
246
- return n.length ? [...n] : [l];
285
+ const i = a.querySelectorAll("#" + s);
286
+ return i.length ? [...i] : [l];
247
287
  }
248
288
  return [a];
249
289
  } catch {
@@ -257,12 +297,12 @@ function he(e, l) {
257
297
  function le(e, l = 0) {
258
298
  const t = {};
259
299
  for (const s of e.childNodes) {
260
- const a = x(s, "data-dce-id") || s.dceId || 0;
300
+ const a = b(s, "data-dce-id") || s.dceId || 0;
261
301
  if (!t[a])
262
302
  a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
263
303
  else {
264
- const n = s.dceId = a + "-" + t[a]++;
265
- s.setAttribute && s.setAttribute("data-dce-id", n);
304
+ const i = s.dceId = a + "-" + t[a]++;
305
+ s.setAttribute && s.setAttribute("data-dce-id", i);
266
306
  }
267
307
  s.childNodes.length && le(s);
268
308
  }
@@ -281,10 +321,10 @@ function ae(e, l) {
281
321
  return e.firstElementChild?.localName !== "dce-root" && K(e);
282
322
  const t = {};
283
323
  for (let s of e.childNodes)
284
- t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
324
+ t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[b(s, "data-dce-id") || 0] = s;
285
325
  for (let s of [...l]) {
286
- const a = x(s, "data-dce-id") || s.dceId, n = t[a];
287
- n ? (Y(s) ? n.nodeValue !== s.nodeValue && (n.nodeValue = s.nodeValue) : (he(s, n), (n.childNodes.length || s.childNodes.length) && ae(n, s.childNodes)), delete t[a]) : xe(e, s, a);
326
+ const a = b(s, "data-dce-id") || s.dceId, i = t[a];
327
+ i ? (Y(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (he(s, i), (i.childNodes.length || s.childNodes.length) && ae(i, s.childNodes)), delete t[a]) : xe(e, s, a);
288
328
  }
289
329
  for (let s of Object.values(t))
290
330
  s.localName !== "dce-root" && s.remove();
@@ -297,10 +337,10 @@ const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
297
337
  return e;
298
338
  const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
299
339
  return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
300
- }, L = (e, l) => {
340
+ }, D = (e, l) => {
301
341
  const t = e.split("??");
302
342
  if (t.length > 1)
303
- return L(t[0], l) || L(t[1], l);
343
+ return D(t[0], l) || D(t[1], l);
304
344
  e = F(e);
305
345
  const s = l.ownerDocument.evaluate(e, l);
306
346
  switch (s.resultType) {
@@ -312,8 +352,8 @@ const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
312
352
  return s.booleanValue;
313
353
  }
314
354
  let a = "";
315
- for (let n; n = s.iterateNext(); )
316
- a += n.textContent;
355
+ for (let i; i = s.iterateNext(); )
356
+ a += i.textContent;
317
357
  return a;
318
358
  }, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,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) => {
319
359
  const t = N("xsl:" + e.localName);
@@ -325,27 +365,35 @@ const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
325
365
  e.parentElement.replaceChild(t, e);
326
366
  else {
327
367
  const s = e.parentElement || l, a = [...s.childNodes];
328
- a.forEach((n, r) => {
329
- n === e && (a[r] = t);
368
+ a.forEach((i, r) => {
369
+ i === e && (a[r] = t);
330
370
  }), s.replaceChildren(...a);
331
371
  }
332
372
  };
333
373
  class Ee extends HTMLElement {
334
374
  static observedAttributes = ["src", "tag", "hidden"];
335
375
  async connectedCallback() {
336
- const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
337
- for (const d of l)
338
- C(d.templateNode || d.content || d, "style", (m) => {
339
- const i = m.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
376
+ const l = await fe(b(this, "src"), this), t = b(this, "tag"), s = t || "dce-" + crypto.randomUUID();
377
+ for (const u of l)
378
+ C(u.templateNode || u.content || u, "style", (m) => {
379
+ const n = m.closest("slot"), c = n ? `slot[name="${n.name}"]` : "";
340
380
  m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
341
381
  });
342
- const a = l.map((d) => me(d)), n = a.map((d, m) => (m = new XSLTProcessor(), m.importStylesheet(d), m));
343
- Object.defineProperty(this, "xsltString", { get: () => a.map((d) => H(d)).join(`
382
+ const a = l.map((u) => me(u)), i = a.map((u, m) => {
383
+ m = new XSLTProcessor();
384
+ try {
385
+ m.importStylesheet(u);
386
+ } catch (n) {
387
+ console.error(n, M(u));
388
+ }
389
+ return m;
390
+ });
391
+ Object.defineProperty(this, "xsltString", { get: () => a.map((u) => M(u)).join(`
344
392
  `) });
345
- const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, i) => i.indexOf(d) === m).map(se).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
393
+ const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((u) => b(u, "slice")).filter((u) => !u.includes("/")).filter((u, m, n) => n.indexOf(u) === m).map(se).flat(), d = a.reduce((u, m) => (m.params && u.push(...m.params), u), []);
346
394
  class w extends HTMLElement {
347
395
  static get observedAttributes() {
348
- return u.map((m) => x(m, "name"));
396
+ return d.map((m) => b(m, "name"));
349
397
  }
350
398
  #e = 0;
351
399
  connectedCallback() {
@@ -356,98 +404,98 @@ class Ee extends HTMLElement {
356
404
  f.remove(), m = f.content.childNodes;
357
405
  for (const o of [...f.content.childNodes])
358
406
  if (o.localName === "style") {
359
- const b = be(this, "data-dce-style");
360
- o.innerHTML = `${s}[data-dce-style="${b}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
407
+ const v = be(this, "data-dce-style");
408
+ o.innerHTML = `${s}[data-dce-style="${v}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
361
409
  } else
362
410
  o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
363
411
  }
364
- const i = M("<datadom/>").documentElement, c = (f, o = "") => ((b) => (o && b.append(S(i, o)), b))(i.ownerDocument.createElement(f)), E = X(i, "payload", m, ce);
412
+ const n = P("<datadom/>").documentElement, c = (f, o = "") => ((v) => (o && v.append(S(n, o)), v))(n.ownerDocument.createElement(f)), E = q(n, "payload", m, ce);
365
413
  Q(E), ee(E), this.innerHTML = "";
366
- const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
367
- X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
368
- const y = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, y);
369
- this.xml = i;
370
- const D = [], W = () => {
414
+ const g = q(n, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
415
+ q(n, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
416
+ const x = q(n, "slice", p, (f) => c(f, "")), y = (f) => D(f, x);
417
+ this.xml = n;
418
+ const L = [], W = () => {
371
419
  const f = {};
372
- for (let o; o = D.pop(); ) {
373
- const b = x(o.sliceElement, "slice");
374
- f[b] || (J(y, b, o), f[b] = o);
420
+ for (let o; o = L.pop(); ) {
421
+ const v = b(o.sliceElement, "slice");
422
+ f[v] || (J(x, v, o), f[v] = o);
375
423
  }
376
- Object.keys(f).length !== 0 && R();
424
+ Object.keys(f).length !== 0 && I();
377
425
  };
378
426
  let V;
379
427
  this.onSlice = (f) => {
380
- D.push(f), V || (V = setTimeout(() => {
428
+ L.push(f), V || (V = setTimeout(() => {
381
429
  W(), V = 0;
382
430
  }, 1));
383
431
  };
384
- const R = this.transform = () => {
432
+ const I = this.transform = () => {
385
433
  if (this.#e)
386
434
  debugger;
387
- this.#e = 1, n.map((o, b) => {
388
- const I = o.transformToFragment(i.ownerDocument, document);
389
- return I || console.error(`XSLT transformation error. xsl:
390
- `, H(a[b]), `
435
+ this.#e = 1, i.map((o, v) => {
436
+ const X = o.transformToFragment(n.ownerDocument, document);
437
+ return X || console.error(`XSLT transformation error. xsl:
438
+ `, M(a[v]), `
391
439
  xml:
392
- `, H(i)), I;
440
+ `, M(n)), X;
393
441
  }).map((o) => {
394
442
  o && (le(o), ae(this, o.childNodes));
395
443
  }), w.observedAttributes.map((o) => {
396
- let b = x(this.firstElementChild, o);
397
- b !== x(this, o) && (this.setAttribute(o, b), this.#t(o, b));
444
+ let v = b(this.firstElementChild, o);
445
+ v !== b(this, o) && (this.setAttribute(o, v), this.#t(o, v));
398
446
  }), C(this, "[slice],[slice-event]", (o) => {
399
447
  if (!o.dceInitialized) {
400
448
  o.dceInitialized = 1;
401
- let b = x(o, "slice-event");
402
- o.hasAttribute("custom-validity") && (b += " change submit"), [...new Set((b || "change").split(" "))].forEach((I) => (o.localName === "slice" ? o.parentElement : o).addEventListener(I, (A) => {
449
+ let v = b(o, "slice-event");
450
+ o.hasAttribute("custom-validity") && (v += " change submit"), [...new Set((v || "change").split(" "))].forEach((X) => (o.localName === "slice" ? o.parentElement : o).addEventListener(X, (A) => {
403
451
  A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
404
- const ne = J(y, x(A.sliceElement, "slice"), A);
452
+ const ne = J(x, b(A.sliceElement, "slice"), A);
405
453
  C(this, "[custom-validity]", (z) => {
406
454
  if (!z.setCustomValidity)
407
455
  return;
408
- const _ = x(z, "custom-validity");
456
+ const _ = b(z, "custom-validity");
409
457
  try {
410
- const j = _ && L(_, g);
458
+ const j = _ && D(_, g);
411
459
  z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
412
460
  } catch (j) {
413
461
  console.error(j, "xPath", _);
414
462
  }
415
463
  });
416
- const k = x(o, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
464
+ const k = b(o, "custom-validity"), T = k && D(k, g), O = T === !0 ? "" : T;
417
465
  if (k) {
418
466
  if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
419
- return T === !0 ? void 0 : (setTimeout(R, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
420
- setTimeout(R, 1);
467
+ return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
468
+ setTimeout(I, 1);
421
469
  }
422
470
  this.onSlice(A);
423
- })), (!b || b.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = v(x(o, "slice")));
471
+ })), (!v || v.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = y(b(o, "slice")));
424
472
  }
425
473
  }), this.#e = 0;
426
474
  };
427
- R(), W();
475
+ I(), W();
428
476
  }
429
- #t(m, i) {
430
- m === "value" && (this.value = i);
477
+ #t(m, n) {
478
+ m === "value" && (this.value = n);
431
479
  let c = this.xml.querySelector(`attributes>${m}`);
432
- c ? U(c).append(S(c, i)) : (c = N(m, i, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: i } }));
480
+ c ? H(c).append(S(c, n)) : (c = N(m, n, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: n } }));
433
481
  }
434
- attributeChangedCallback(m, i, c) {
482
+ attributeChangedCallback(m, n, c) {
435
483
  !this.xml || this.#e || (this.#t(m, c), this.transform());
436
484
  }
437
485
  get dce() {
438
486
  return r;
439
487
  }
440
488
  }
441
- const P = (d) => {
442
- window.customElements.get(d) !== w && window.customElements.define(d, w);
489
+ const R = (u) => {
490
+ window.customElements.get(u) !== w && window.customElements.define(u, w);
443
491
  };
444
492
  if (t)
445
- P(t);
493
+ R(t);
446
494
  else {
447
- const d = s;
448
- this.setAttribute("tag", d), P(d);
449
- const m = document.createElement(d);
450
- this.getAttributeNames().forEach((i) => m.setAttribute(i, this.getAttribute(i))), m.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(m);
495
+ const u = s;
496
+ this.setAttribute("tag", u), R(u);
497
+ const m = document.createElement(u);
498
+ this.getAttributeNames().forEach((n) => m.setAttribute(n, this.getAttribute(n))), m.append(...[...this.childNodes].filter((n) => n.localName !== "style")), this.append(m);
451
499
  }
452
500
  }
453
501
  get templateNode() {
@@ -457,16 +505,16 @@ xml:
457
505
  return this;
458
506
  }
459
507
  get xslt() {
460
- return M(this.xsltString);
508
+ return P(this.xsltString);
461
509
  }
462
510
  }
463
511
  window.customElements.define("custom-element", Ee);
464
512
  export {
465
513
  Ee as C,
466
- H as a,
467
- ue as b,
514
+ M as a,
515
+ de as b,
468
516
  me as c,
469
- de as d,
517
+ ue as d,
470
518
  pe as e,
471
519
  J as f,
472
520
  le as g,
@@ -476,10 +524,10 @@ export {
476
524
  ye as k,
477
525
  F as l,
478
526
  he as m,
479
- L as n,
527
+ D as n,
480
528
  $ as o,
481
529
  ve as p,
482
530
  ge as q,
483
531
  Z as t,
484
- M as x
532
+ P as x
485
533
  };