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

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 (176) hide show
  1. package/.storybook/main.ts +2 -2
  2. package/README.md +4 -4
  3. package/coverage/coverage-final.json +22 -22
  4. package/coverage/index.html +18 -18
  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 +490 -367
  8. package/coverage/src/custom-element/demo/index.html +1 -1
  9. package/coverage/src/custom-element/demo/z.js.html +1 -1
  10. package/coverage/src/custom-element/http-request.js.html +12 -12
  11. package/coverage/src/custom-element/index.html +19 -19
  12. package/coverage/src/custom-element/local-storage.js.html +52 -52
  13. package/coverage/src/custom-element/location-element.js.html +4 -4
  14. package/coverage/src/custom-element/module-url.js.html +1 -1
  15. package/coverage/src/index.html +1 -1
  16. package/coverage/src/mocks/handlers.ts.html +1 -1
  17. package/coverage/src/mocks/index.html +1 -1
  18. package/coverage/src/stories/attributes.test.stories.ts.html +11 -2
  19. package/coverage/src/stories/css.test.stories.ts.html +8 -2
  20. package/coverage/src/stories/dom-merge.test.stories.ts.html +3 -3
  21. package/coverage/src/stories/external-template.test.stories.ts.html +8 -2
  22. package/coverage/src/stories/form.test.stories.ts.html +8 -2
  23. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  24. package/coverage/src/stories/index.html +1 -1
  25. package/coverage/src/stories/local-storage.test.stories.ts.html +24 -18
  26. package/coverage/src/stories/location-element.test.stories.ts.html +8 -2
  27. package/coverage/src/stories/module-url.test.stories.ts.html +8 -2
  28. package/coverage/src/stories/set-url.test.stories.ts.html +8 -2
  29. package/coverage/src/stories/slice-events.test.stories.ts.html +8 -2
  30. package/coverage/src/stories/slots.test.stories.ts.html +8 -2
  31. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  32. package/coverage/src/stories/version-select.test.stories.ts.html +8 -2
  33. package/coverage/src/sum.ts.html +1 -1
  34. package/dist/custom-element-BOIPgtxz.js +565 -0
  35. package/dist/custom-element-CUsSENWc.cjs +97 -0
  36. package/dist/custom-element-bundle.cjs +1 -1
  37. package/dist/custom-element-bundle.js +22 -21
  38. package/dist/demo/a.svg +26 -26
  39. package/dist/demo/s.xml +18 -3
  40. package/dist/demo/s.xslt +37 -54
  41. package/dist/demo/s1.xslt +59 -59
  42. package/dist/demo/ss.html +24 -57
  43. package/dist/demo/z.html +33 -33
  44. package/dist/demo/z.xml +59 -59
  45. package/dist/demo/z1.html +34 -34
  46. package/package.json +13 -13
  47. package/public/demo/a.svg +26 -26
  48. package/public/demo/s.xml +18 -3
  49. package/public/demo/s.xslt +37 -54
  50. package/public/demo/s1.xslt +59 -59
  51. package/public/demo/ss.html +24 -57
  52. package/public/demo/z.html +33 -33
  53. package/public/demo/z.xml +59 -59
  54. package/public/demo/z1.html +34 -34
  55. package/src/custom-element/custom-element.js +61 -20
  56. package/src/custom-element/demo/a.svg +26 -26
  57. package/src/custom-element/demo/s.xml +18 -3
  58. package/src/custom-element/demo/s.xslt +37 -54
  59. package/src/custom-element/demo/s1.xslt +59 -59
  60. package/src/custom-element/demo/ss.html +24 -57
  61. package/src/custom-element/demo/z.html +33 -33
  62. package/src/custom-element/demo/z.xml +59 -59
  63. package/src/custom-element/demo/z1.html +34 -34
  64. package/src/custom-element/ide/web-types-dce.json +1 -1
  65. package/src/custom-element/ide/web-types-xsl.json +1 -1
  66. package/src/dce-social-preview.png +0 -0
  67. package/src/material/angular.css +987 -0
  68. package/src/material/components/autocomplete.html +241 -0
  69. package/src/material/components/dropdown.html +115 -0
  70. package/src/material/components/menu.html +235 -0
  71. package/src/material/components.html +109 -0
  72. package/src/material/demo.css +31 -0
  73. package/src/material/index.html +169 -0
  74. package/src/material/material.css +357 -0
  75. package/src/material/theme/README.md +18 -0
  76. package/src/material/theme/semantic.css +112 -0
  77. package/src/mocks/versions.mock.ts +8 -8
  78. package/src/stories/attributes.test.stories.ts +3 -0
  79. package/src/stories/css.test.stories.ts +2 -0
  80. package/src/stories/dom-merge.test.stories.ts +2 -2
  81. package/src/stories/external-template.test.stories.ts +2 -0
  82. package/src/stories/form.test.stories.ts +2 -0
  83. package/src/stories/local-storage.test.stories.ts +2 -0
  84. package/src/stories/location-element.test.stories.ts +2 -0
  85. package/src/stories/module-url.test.stories.ts +2 -0
  86. package/src/stories/set-url.test.stories.ts +2 -0
  87. package/src/stories/slice-events.test.stories.ts +2 -0
  88. package/src/stories/slots.test.stories.ts +2 -0
  89. package/src/stories/version-select.test.stories.ts +2 -0
  90. package/storybook-static/assets/Color-ERTF36HU-ChyYtq0t.js +1 -0
  91. package/storybook-static/assets/Configure-CJVwFVjC.js +165 -0
  92. package/storybook-static/assets/DocsRenderer-CFRXHY34-Bz6q-OqD.js +2 -0
  93. package/storybook-static/assets/{attributes.test.stories-Bt5V18qO.js → attributes.test.stories-BJBuuXgZ.js} +4 -4
  94. package/storybook-static/assets/{css.test.stories-CGYy2daE.js → css.test.stories-pgbBc17d.js} +1 -1
  95. package/storybook-static/assets/custom-element-BDGsYgbP.js +97 -0
  96. package/storybook-static/assets/{dom-merge.test.stories-XlsZ0UvX.js → dom-merge.test.stories-CXcYP_-J.js} +5 -5
  97. package/storybook-static/assets/entry-preview-C313OLrj.js +26 -0
  98. package/storybook-static/assets/{entry-preview-docs-BMKNVQXA.js → entry-preview-docs-B7ORr9w5.js} +2 -2
  99. package/storybook-static/assets/{external-template.test.stories-Bt_Pflu8.js → external-template.test.stories-CpJ68Ghy.js} +13 -13
  100. package/storybook-static/assets/{form.test.stories-B0NoI8wm.js → form.test.stories-D35lyqd8.js} +2 -2
  101. package/storybook-static/assets/{handlers-B5969HUu.js → handlers-B-OZtf2K.js} +6 -6
  102. package/storybook-static/assets/{http-request.stories-B2skuTFV.js → http-request.stories-DccXgHyF.js} +6 -6
  103. package/storybook-static/assets/iframe-Ddc_axoC.js +2 -0
  104. package/storybook-static/assets/index-BSz1w4Gl.js +234 -0
  105. package/storybook-static/assets/index-BdcJ-iJ7.js +8 -0
  106. package/storybook-static/assets/index-CiCdFubk.js +634 -0
  107. package/storybook-static/assets/{index-C7lvoJNv.js → index-f2MAjm2i.js} +1 -1
  108. package/storybook-static/assets/index-lY6s0fkU.js +1 -0
  109. package/storybook-static/assets/index-tfEkrhWr.js +1 -0
  110. package/storybook-static/assets/{local-storage.test.stories-DfY6feqG.js → local-storage.test.stories-BY-PWhuk.js} +5 -5
  111. package/storybook-static/assets/{location-element.test.stories-944AotIJ.js → location-element.test.stories-3auBYEaU.js} +3 -3
  112. package/storybook-static/assets/{module-url.test.stories-DSKcwApl.js → module-url.test.stories-B7L9cL60.js} +6 -6
  113. package/storybook-static/assets/{preview-0Jj89qip.js → preview-BRPR-UXC.js} +1 -1
  114. package/storybook-static/assets/{preview-AJR7rVPD.js → preview-BUQm51_C.js} +1 -1
  115. package/storybook-static/assets/{preview-DB9FwMii.js → preview-BWzBA1C2.js} +1 -1
  116. package/storybook-static/assets/preview-BhhEZcNS.js +1 -0
  117. package/storybook-static/assets/preview-CcS4DQh8.js +1 -0
  118. package/storybook-static/assets/{preview-CadgX-4y.js → preview-CfH4_OzN.js} +2 -2
  119. package/storybook-static/assets/{preview-FpHGYA1q.js → preview-DHPc-V4N.js} +1 -1
  120. package/storybook-static/assets/preview-DYzi3Z2p.js +1 -0
  121. package/storybook-static/assets/{preview-4Up_z4Em.js → preview-caVMbCIR.js} +2 -2
  122. package/storybook-static/assets/preview-ncvtW_hb.js +34 -0
  123. package/storybook-static/assets/{set-url.test.stories-DjLHKkEh.js → set-url.test.stories-CuSuDLIx.js} +3 -3
  124. package/storybook-static/assets/{slice-events.test.stories-8I_BrHd6.js → slice-events.test.stories-BkRKsKem.js} +4 -4
  125. package/storybook-static/assets/{slots.test.stories-CvZz4jyP.js → slots.test.stories-BJCUWFkE.js} +8 -8
  126. package/storybook-static/assets/{version-select.test.stories-DSxmJylI.js → version-select.test.stories-B3ybJn_Z.js} +2 -2
  127. package/storybook-static/demo/a.svg +26 -26
  128. package/storybook-static/demo/s.xml +18 -3
  129. package/storybook-static/demo/s.xslt +37 -54
  130. package/storybook-static/demo/s1.xslt +59 -59
  131. package/storybook-static/demo/ss.html +24 -57
  132. package/storybook-static/demo/z.html +33 -33
  133. package/storybook-static/demo/z.xml +59 -59
  134. package/storybook-static/demo/z1.html +34 -34
  135. package/storybook-static/iframe.html +1 -1
  136. package/storybook-static/index.html +3 -7
  137. package/storybook-static/project.json +1 -1
  138. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  139. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +9 -9
  140. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +76 -94
  141. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  142. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  143. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  144. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  145. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +211 -0
  146. package/storybook-static/sb-addons/interactions-9/manager-bundle.js.LEGAL.txt +0 -0
  147. package/storybook-static/sb-manager/globals-module-info.js +11 -0
  148. package/storybook-static/sb-manager/globals-runtime.js +27803 -26928
  149. package/storybook-static/sb-manager/runtime.js +10341 -10136
  150. package/storybook-static/sb-preview/runtime.js +3841 -3828
  151. package/.idea/custom-element-dist.iml +0 -9
  152. package/.idea/misc.xml +0 -6
  153. package/.idea/modules.xml +0 -8
  154. package/.idea/vcs.xml +0 -6
  155. package/dist/custom-element-BMMsP1Dy.js +0 -533
  156. package/dist/custom-element-CPSk7s0j.cjs +0 -87
  157. package/storybook-static/assets/Color-KGDBMAHA-CJo5gHY3.js +0 -1
  158. package/storybook-static/assets/Configure-DdXbGKhY.js +0 -173
  159. package/storybook-static/assets/DocsRenderer-PKQXORMH-DLnpL5hE.js +0 -2
  160. package/storybook-static/assets/custom-element-D8hcDZHh.js +0 -265
  161. package/storybook-static/assets/entry-preview-BKQ8UCxI.js +0 -8
  162. package/storybook-static/assets/iframe-Dfrt81rk.js +0 -2
  163. package/storybook-static/assets/index-Ay195x2L.js +0 -605
  164. package/storybook-static/assets/index-C3ChPTMh.js +0 -1
  165. package/storybook-static/assets/index-C8k3Z-3Y.js +0 -28
  166. package/storybook-static/assets/index-DGdNYaqV.js +0 -8
  167. package/storybook-static/assets/index-Gpdhz4ab.js +0 -1
  168. package/storybook-static/assets/lit-element-DzhCn-8W.js +0 -19
  169. package/storybook-static/assets/preview-BJPLiuSt.js +0 -1
  170. package/storybook-static/assets/preview-BMWqy4Bi.js +0 -1
  171. package/storybook-static/assets/preview-BnWGZYux.js +0 -1
  172. package/storybook-static/assets/preview-Djh1_Tal.js +0 -20
  173. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +0 -336
  174. package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +0 -77
  175. package/storybook-static/sb-addons/interactions-10/manager-bundle.js +0 -234
  176. /package/{storybook-static/sb-addons/interactions-10/manager-bundle.js.LEGAL.txt → src/material/guide/getting-started/index.html} +0 -0
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/custom-element-dist.iml" filepath="$PROJECT_DIR$/.idea/custom-element-dist.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,533 +0,0 @@
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
- for (; e.firstChild; ) e.firstChild.remove();
3
- return e;
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
- if (te(e))
7
- return s(e);
8
- const a = s("dce-object");
9
- return a.setAttribute("dce-object-name", e), a;
10
- }, G = (e, l) => {
11
- const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
12
- for (let s of e.attributes)
13
- t.setAttribute(s.name, s.value);
14
- for (; e.firstChild; )
15
- t.append(e.firstChild);
16
- return t;
17
- };
18
- function P(e) {
19
- return new DOMParser().parseFromString(e, "application/xml");
20
- }
21
- function M(e) {
22
- return new XMLSerializer().serializeToString(e);
23
- }
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
- return [...t].forEach((h) => r.append(s(h))), r;
27
- }
28
- function ce(e) {
29
- return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
30
- `, ""))), e.setAttribute("slot", "")), e;
31
- }
32
- function $(e, l, t) {
33
- const s = typeof e;
34
- if (s === "string")
35
- return N(l, e, t);
36
- if (s === "number")
37
- return N(l, "" + e, t);
38
- if (e instanceof Array) {
39
- const i = N("array", "", t);
40
- return e.map((r) => i.append($(r, l, t))), i;
41
- }
42
- if (e instanceof FormData) {
43
- const i = N("form-data", "", t);
44
- for (const r of e)
45
- i.append($(r[1], r[0], t));
46
- return i;
47
- }
48
- const a = N(l, "", 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
- return a;
52
- }
53
- function Z(e) {
54
- if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
55
- const s = t.data, a = s.matchAll(/{([^}]*)}/g);
56
- if (a) {
57
- let i = 0, r = (p) => S(t, p), h = [];
58
- if ([...a].forEach((p) => {
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
- for (let p of h)
64
- l.insertBefore(p, t);
65
- l.removeChild(t);
66
- }
67
- }
68
- })), "all" in e) {
69
- let l = 1;
70
- for (let t of e.all)
71
- t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
72
- }
73
- return e;
74
- }
75
- function me(e, l = "xsl:stylesheet") {
76
- if (e.tagName === l || e.documentElement?.tagName === l)
77
- return Z(e);
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);
134
- };
135
- if (E) {
136
- const x = N("div");
137
- return [...E.childNodes].map((y) => x.append(y.cloneNode(!0))), g(x);
138
- }
139
- return g(n.documentElement || n.body || n);
140
- })(e), i = P(
141
- `<xsl:stylesheet version="1.0"
142
- xmlns:xsl="${B}"
143
- xmlns:xhtml="${U}"
144
- xmlns:dce="urn:schemas-epa-wg:dce"
145
- xmlns:exsl="http://exslt.org/common"
146
- exclude-result-prefixes="exsl"
147
- >
148
- <xsl:template match="ignore">
149
- <xsl:choose>
150
- <xsl:when test="//attr">{//attr}</xsl:when>
151
- <xsl:otherwise>{def}</xsl:otherwise>
152
- </xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
153
- <xsl:template mode="payload" match="attributes"></xsl:template>
154
- <xsl:template match="/">
155
- <xsl:apply-templates mode="payload" select="/datadom/attributes"/>
156
- </xsl:template>
157
- <xsl:template name="slot" >
158
- <xsl:param name="slotname" />
159
- <xsl:param name="defaultvalue" />
160
- <xsl:choose>
161
- <xsl:when test="//payload/*[@slot=$slotname]">
162
- <xsl:copy-of select="//payload/*[@slot=$slotname]"/>
163
- </xsl:when>
164
- <xsl:otherwise>
165
- <xsl:copy-of select="$defaultvalue"/>
166
- </xsl:otherwise>
167
- </xsl:choose>
168
- </xsl:template>
169
- <xsl:variable name="js-injected-body">
170
- <xsl:call-template name="slot" >
171
- <xsl:with-param name="slotname" select="''"/>
172
- <xsl:with-param name="defaultvalue"/>
173
- </xsl:call-template>
174
- </xsl:variable>
175
- </xsl:stylesheet>`
176
- );
177
- s.importStylesheet(t);
178
- const r = s.transformToFragment(a, document), h = (n, c) => n.querySelector(c), p = h(i, 'template[mode="payload"]');
179
- if (!r)
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");
188
- p.append(c);
189
- let g = b(c, "select")?.split("??");
190
- g || (g = ["//" + E, `'${c.textContent}'`], H(c), c.setAttribute("name", E));
191
- let x;
192
- if (g?.length > 1) {
193
- c.removeAttribute("select");
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);
196
- } else
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));
202
- });
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");
208
- E && c.firstElementChild.setAttribute("select", `'${E}'`);
209
- for (let g of n.childNodes)
210
- c.lastElementChild.append(g);
211
- return c;
212
- };
213
- C(p, "slot", (n) => n.parentNode.replaceChild(u(n), n));
214
- const m = Z(i);
215
- return m.params = d, m;
216
- }
217
- async function de(e) {
218
- return await new Promise((t, s) => {
219
- const a = new XMLHttpRequest();
220
- a.open("GET", e), a.responseType = "document", a.onload = () => {
221
- a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
222
- }, a.addEventListener("error", (i) => s(i)), a.send();
223
- });
224
- }
225
- function ue(e, l, t = !1) {
226
- if (e === l)
227
- return !0;
228
- if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
229
- return t;
230
- for (let s in e)
231
- if (!(s in l) || !ue(e[s], l[s]))
232
- return t;
233
- return !0;
234
- }
235
- const se = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), pe = (e, l) => se(l).map((t) => {
236
- let s = e.ownerDocument, a = (i) => (e.append(i), i);
237
- if (t.includes("/")) {
238
- const i = [], r = s.evaluate(t, e);
239
- for (let h; h = r.iterateNext(); )
240
- i.push(h);
241
- return i;
242
- }
243
- return [...e.childNodes].find((i) => i.localName === t) || a(N(t, "", s));
244
- }).flat();
245
- function J(e, l, t, s) {
246
- if (!t.sliceProcessed)
247
- return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
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")) {
250
- r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
251
- const d = D(b(h, "slice-value"), a);
252
- p(), a.append(S(i, d));
253
- } else {
254
- if ("elements" in r)
255
- return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
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));
258
- }
259
- return a;
260
- });
261
- }
262
- function C(e, l, t) {
263
- e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
264
- }
265
- const fe = async (e, l) => {
266
- if (!e || !e.trim())
267
- return [l];
268
- if (e.startsWith("#"))
269
- return ((t) => {
270
- const s = t.querySelectorAll(e);
271
- return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
272
- })(l.parentElement);
273
- try {
274
- const [t, s] = e.split("#");
275
- if (e.charAt(0) === ".")
276
- e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
277
- else
278
- try {
279
- e = import.meta.resolve(t), s && (e += "#" + s);
280
- } catch (i) {
281
- console.error(i.message);
282
- }
283
- const a = await de(e);
284
- if (l.setAttributeNS("xml", "base", e), s) {
285
- const i = a.querySelectorAll("#" + s);
286
- return i.length ? [...i] : [l];
287
- }
288
- return [a];
289
- } catch {
290
- return [l];
291
- }
292
- };
293
- function he(e, l) {
294
- for (let t of e.attributes)
295
- t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
296
- }
297
- function le(e, l = 0) {
298
- const t = {};
299
- for (const s of e.childNodes) {
300
- const a = b(s, "data-dce-id") || s.dceId || 0;
301
- if (!t[a])
302
- a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
303
- else {
304
- const i = s.dceId = a + "-" + t[a]++;
305
- s.setAttribute && s.setAttribute("data-dce-id", i);
306
- }
307
- s.childNodes.length && le(s);
308
- }
309
- }
310
- function xe(e, l, t) {
311
- t = 1 * t;
312
- for (let s of e.childNodes)
313
- if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
314
- return e.insertBefore(l, s);
315
- e.append(l);
316
- }
317
- function ae(e, l) {
318
- if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
319
- return;
320
- if (!l.length)
321
- return e.firstElementChild?.localName !== "dce-root" && K(e);
322
- const t = {};
323
- for (let s of e.childNodes)
324
- t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[b(s, "data-dce-id") || 0] = s;
325
- for (let s of [...l]) {
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);
328
- }
329
- for (let s of Object.values(t))
330
- s.localName !== "dce-root" && s.remove();
331
- }
332
- function be(e, l) {
333
- return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
334
- }
335
- const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
336
- if (!e.trim())
337
- return e;
338
- const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
339
- return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
340
- }, D = (e, l) => {
341
- const t = e.split("??");
342
- if (t.length > 1)
343
- return D(t[0], l) || D(t[1], l);
344
- e = F(e);
345
- const s = l.ownerDocument.evaluate(e, l);
346
- switch (s.resultType) {
347
- case XPathResult.NUMBER_TYPE:
348
- return s.numberValue;
349
- case XPathResult.STRING_TYPE:
350
- return s.stringValue;
351
- case XPathResult.BOOLEAN_TYPE:
352
- return s.booleanValue;
353
- }
354
- let a = "";
355
- for (let i; i = s.iterateNext(); )
356
- a += i.textContent;
357
- return a;
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) => {
359
- const t = N("xsl:" + e.localName);
360
- for (let s of e.attributes)
361
- t.setAttribute(s.name, s.value);
362
- for (; e.firstChild; )
363
- t.append(e.firstChild);
364
- if (e.parentElement)
365
- e.parentElement.replaceChild(t, e);
366
- else {
367
- const s = e.parentElement || l, a = [...s.childNodes];
368
- a.forEach((i, r) => {
369
- i === e && (a[r] = t);
370
- }), s.replaceChildren(...a);
371
- }
372
- };
373
- class Ee extends HTMLElement {
374
- static observedAttributes = ["src", "tag", "hidden"];
375
- async connectedCallback() {
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}"]` : "";
380
- m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
381
- });
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(`
392
- `) });
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), []);
394
- class w extends HTMLElement {
395
- static get observedAttributes() {
396
- return d.map((m) => b(m, "name"));
397
- }
398
- #e = 0;
399
- connectedCallback() {
400
- let m = this.childNodes;
401
- if (this.firstElementChild?.tagName === "TEMPLATE") {
402
- this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
403
- const f = this.firstElementChild;
404
- f.remove(), m = f.content.childNodes;
405
- for (const o of [...f.content.childNodes])
406
- if (o.localName === "style") {
407
- const v = be(this, "data-dce-style");
408
- o.innerHTML = `${s}[data-dce-style="${v}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
409
- } else
410
- o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
411
- }
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);
413
- Q(E), ee(E), this.innerHTML = "";
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 = () => {
419
- const f = {};
420
- for (let o; o = L.pop(); ) {
421
- const v = b(o.sliceElement, "slice");
422
- f[v] || (J(x, v, o), f[v] = o);
423
- }
424
- Object.keys(f).length !== 0 && I();
425
- };
426
- let V;
427
- this.onSlice = (f) => {
428
- L.push(f), V || (V = setTimeout(() => {
429
- W(), V = 0;
430
- }, 1));
431
- };
432
- const I = this.transform = () => {
433
- if (this.#e)
434
- debugger;
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]), `
439
- xml:
440
- `, M(n)), X;
441
- }).map((o) => {
442
- o && (le(o), ae(this, o.childNodes));
443
- }), w.observedAttributes.map((o) => {
444
- let v = b(this.firstElementChild, o);
445
- v !== b(this, o) && (this.setAttribute(o, v), this.#t(o, v));
446
- }), C(this, "[slice],[slice-event]", (o) => {
447
- if (!o.dceInitialized) {
448
- o.dceInitialized = 1;
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) => {
451
- A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
452
- const ne = J(x, b(A.sliceElement, "slice"), A);
453
- C(this, "[custom-validity]", (z) => {
454
- if (!z.setCustomValidity)
455
- return;
456
- const _ = b(z, "custom-validity");
457
- try {
458
- const j = _ && D(_, g);
459
- z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
460
- } catch (j) {
461
- console.error(j, "xPath", _);
462
- }
463
- });
464
- const k = b(o, "custom-validity"), T = k && D(k, g), O = T === !0 ? "" : T;
465
- if (k) {
466
- if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
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);
469
- }
470
- this.onSlice(A);
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")));
472
- }
473
- }), this.#e = 0;
474
- };
475
- I(), W();
476
- }
477
- #t(m, n) {
478
- m === "value" && (this.value = n);
479
- let c = this.xml.querySelector(`attributes>${m}`);
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 } }));
481
- }
482
- attributeChangedCallback(m, n, c) {
483
- !this.xml || this.#e || (this.#t(m, c), this.transform());
484
- }
485
- get dce() {
486
- return r;
487
- }
488
- }
489
- const R = (u) => {
490
- window.customElements.get(u) !== w && window.customElements.define(u, w);
491
- };
492
- if (t)
493
- R(t);
494
- else {
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);
499
- }
500
- }
501
- get templateNode() {
502
- return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
503
- }
504
- get dce() {
505
- return this;
506
- }
507
- get xslt() {
508
- return P(this.xsltString);
509
- }
510
- }
511
- window.customElements.define("custom-element", Ee);
512
- export {
513
- Ee as C,
514
- M as a,
515
- de as b,
516
- me as c,
517
- ue as d,
518
- pe as e,
519
- J as f,
520
- le as g,
521
- xe as h,
522
- ae as i,
523
- be as j,
524
- ye as k,
525
- F as l,
526
- he as m,
527
- D as n,
528
- $ as o,
529
- ve as p,
530
- ge as q,
531
- Z as t,
532
- P as x
533
- };