@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.
- package/.idea/custom-element-dist.iml +1 -5
- package/.storybook/preview.ts +1 -1
- package/README.md +4 -4
- package/bin/vitest/vitest-browser-importmaps.mjs +20 -20
- package/coverage/coverage-final.json +9 -9
- package/coverage/index.html +25 -25
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +467 -308
- package/coverage/src/custom-element/demo/index.html +1 -1
- package/coverage/src/custom-element/demo/z.js.html +1 -1
- package/coverage/src/custom-element/http-request.js.html +12 -12
- package/coverage/src/custom-element/index.html +20 -20
- package/coverage/src/custom-element/local-storage.js.html +56 -41
- package/coverage/src/custom-element/location-element.js.html +4 -4
- package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
- package/coverage/src/custom-element/module-url.js.html +16 -10
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/handlers.ts.html +1 -1
- package/coverage/src/mocks/index.html +1 -1
- package/coverage/src/stories/attributes.test.stories.ts.html +9 -12
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts.html +1 -1
- package/coverage/src/stories/dom-merge.test.stories.ts.html +15 -9
- package/coverage/src/stories/external-template.test.stories.ts.html +8 -11
- package/coverage/src/stories/form.test.stories.ts.html +1 -1
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +26 -26
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/local-storage.test.stories.ts.html +87 -63
- package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
- package/coverage/src/stories/module-url.test.stories.ts.html +1 -1
- package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
- package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
- package/coverage/src/stories/slots.test.stories.ts.html +1 -1
- package/coverage/src/stories/testStoryBook.ts.html +1 -1
- package/coverage/src/stories/version-select.test.stories.ts.html +1 -1
- package/coverage/src/sum.ts.html +1 -1
- package/dist/{custom-element-b7c_7Kz4.js → custom-element-BMMsP1Dy.js} +204 -156
- package/dist/custom-element-CPSk7s0j.cjs +87 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +28 -25
- package/dist/demo/a.svg +27 -0
- package/dist/demo/demo.css +6 -7
- package/dist/demo/external-template.html +3 -3
- package/dist/demo/npm-versions-demo.html +21 -8
- package/dist/demo/npm-versions.html +54 -25
- package/dist/demo/s.xml +3 -28
- package/dist/demo/s.xslt +51 -92
- package/dist/demo/z.html +32 -61
- package/dist/demo/z1.html +34 -0
- package/dist/local-storage-78EivJ_B.cjs +1 -0
- package/dist/local-storage-DzmNKzgN.js +66 -0
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +27 -25
- package/public/demo/a.svg +27 -0
- package/public/demo/demo.css +6 -7
- package/public/demo/external-template.html +3 -3
- package/public/demo/npm-versions-demo.html +21 -8
- package/public/demo/npm-versions.html +54 -25
- package/public/demo/s.xml +3 -28
- package/public/demo/s.xslt +51 -92
- package/public/demo/z.html +32 -61
- package/public/demo/z1.html +34 -0
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.js +67 -14
- package/src/custom-element/demo/a.svg +27 -0
- package/src/custom-element/demo/demo.css +6 -7
- package/src/custom-element/demo/external-template.html +3 -3
- package/src/custom-element/demo/npm-versions-demo.html +21 -8
- package/src/custom-element/demo/npm-versions.html +54 -25
- package/src/custom-element/demo/s.xml +3 -28
- package/src/custom-element/demo/s.xslt +51 -92
- package/src/custom-element/demo/z.html +32 -61
- package/src/custom-element/demo/z1.html +34 -0
- package/src/custom-element/ide/web-types-dce.json +1 -1
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +19 -2
- package/src/custom-element/local-storage.js +19 -14
- package/src/custom-element/module-url.js +3 -2
- package/src/mocks/versions.mock.ts +8 -8
- package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +3 -4
- package/src/stories/dom-merge.test.stories.ts +9 -7
- package/src/stories/external-template.test.stories.ts +2 -3
- package/src/stories/local-storage.test.stories.ts +61 -53
- package/src/sum.test.ts +5 -5
- package/src/sum.ts +3 -3
- package/storybook-static/assets/{Color-KGDBMAHA-CH-YyWYq.js → Color-KGDBMAHA-CJo5gHY3.js} +1 -1
- package/storybook-static/assets/{Configure-DFL_bm2M.js → Configure-DdXbGKhY.js} +1 -1
- package/storybook-static/assets/{DocsRenderer-PKQXORMH-Bz-_1hmS.js → DocsRenderer-PKQXORMH-DLnpL5hE.js} +2 -2
- package/storybook-static/assets/{attributes.test.stories-DIQXccHc.js → attributes.test.stories-Bt5V18qO.js} +10 -11
- package/storybook-static/assets/{css.test.stories-BV2hi4CY.js → css.test.stories-CGYy2daE.js} +1 -1
- package/storybook-static/assets/{custom-element-wn23PUwN.js → custom-element-D8hcDZHh.js} +116 -82
- package/storybook-static/assets/{dom-merge.test.stories-Dws0C2-g.js → dom-merge.test.stories-XlsZ0UvX.js} +22 -20
- package/storybook-static/assets/{external-template.test.stories-BHO48b0j.js → external-template.test.stories-Bt_Pflu8.js} +7 -8
- package/storybook-static/assets/{form.test.stories-dv9mwp24.js → form.test.stories-B0NoI8wm.js} +1 -1
- package/storybook-static/assets/{handlers-CaCq2ZPF.js → handlers-B5969HUu.js} +13 -13
- package/storybook-static/assets/{http-request.stories-B2ke7LtS.js → http-request.stories-B2skuTFV.js} +1 -1
- package/storybook-static/assets/iframe-Dfrt81rk.js +2 -0
- package/storybook-static/assets/{index-BnXBQqj9.js → index-Ay195x2L.js} +4 -4
- package/storybook-static/assets/{index-sm7QlJZE.js → index-C3ChPTMh.js} +1 -1
- package/storybook-static/assets/{index-Dz4OaB2k.js → index-C7lvoJNv.js} +1 -1
- package/storybook-static/assets/{index-Cpxqn5iQ.js → index-Gpdhz4ab.js} +1 -1
- package/storybook-static/assets/local-storage.test.stories-DfY6feqG.js +420 -0
- package/storybook-static/assets/{location-element.test.stories-BiFvBop7.js → location-element.test.stories-944AotIJ.js} +1 -1
- package/storybook-static/assets/{module-url.test.stories-BXoM34tX.js → module-url.test.stories-DSKcwApl.js} +1 -1
- package/storybook-static/assets/preview-AJR7rVPD.js +52 -0
- package/storybook-static/assets/{preview-Cg7hXPRq.js → preview-CadgX-4y.js} +2 -2
- package/storybook-static/assets/{set-url.test.stories-Cg5Z0r7x.js → set-url.test.stories-DjLHKkEh.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-D_ttGp3g.js → slice-events.test.stories-8I_BrHd6.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-DBNXOm0T.js → slots.test.stories-CvZz4jyP.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-CgV3UCim.js → version-select.test.stories-DSxmJylI.js} +1 -1
- package/storybook-static/demo/a.svg +27 -0
- package/storybook-static/demo/demo.css +6 -7
- package/storybook-static/demo/external-template.html +3 -3
- package/storybook-static/demo/npm-versions-demo.html +21 -8
- package/storybook-static/demo/npm-versions.html +54 -25
- package/storybook-static/demo/s.xml +3 -28
- package/storybook-static/demo/s.xslt +51 -92
- package/storybook-static/demo/z.html +32 -61
- package/storybook-static/demo/z1.html +34 -0
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +39 -36
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +38 -1
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/compiler.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.vscode/settings.json +0 -24
- package/dist/custom-element-CckoVsvO.cjs +0 -53
- package/dist/local-storage-Boafngui.cjs +0 -1
- package/dist/local-storage-BqDEu2kF.js +0 -59
- package/storybook-static/assets/iframe-D4Sos1HO.js +0 -2
- package/storybook-static/assets/local-storage.test.stories-BpogLNq-.js +0 -419
- package/storybook-static/assets/preview-oHxXRSIu.js +0 -48
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const B = "http://www.w3.org/1999/XSL/Transform",
|
|
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
|
-
},
|
|
5
|
-
const s = (
|
|
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
|
|
18
|
+
function P(e) {
|
|
19
19
|
return new DOMParser().parseFromString(e, "application/xml");
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function M(e) {
|
|
22
22
|
return new XMLSerializer().serializeToString(e);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const a = (h) => e.ownerDocument.createElement(h), r = ((h, p,
|
|
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
|
|
40
|
-
return e.map((r) =>
|
|
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
|
|
43
|
+
const i = N("form-data", "", t);
|
|
44
44
|
for (const r of e)
|
|
45
|
-
|
|
46
|
-
return
|
|
45
|
+
i.append($(r[1], r[0], t));
|
|
46
|
+
return i;
|
|
47
47
|
}
|
|
48
48
|
const a = N(l, "", t);
|
|
49
|
-
for (let
|
|
50
|
-
re(e[
|
|
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
|
|
57
|
+
let i = 0, r = (p) => S(t, p), h = [];
|
|
58
58
|
if ([...a].forEach((p) => {
|
|
59
|
-
p.index >
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}),
|
|
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 =
|
|
79
|
-
|
|
80
|
-
<xsl:template match="/"><dce-root xmlns="${
|
|
81
|
-
|
|
82
|
-
<xsl:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<xsl:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<xsl:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
101
|
-
return [...E.childNodes].map((
|
|
136
|
+
const x = N("div");
|
|
137
|
+
return [...E.childNodes].map((y) => x.append(y.cloneNode(!0))), g(x);
|
|
102
138
|
}
|
|
103
|
-
return g(
|
|
104
|
-
})(e),
|
|
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="${
|
|
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 = (
|
|
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:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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 =
|
|
150
|
-
g || (g = ["//" + E, `'${c.textContent}'`],
|
|
151
|
-
let
|
|
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
|
|
155
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
}), [...r.querySelectorAll("[value]")].filter((
|
|
160
|
-
const c =
|
|
161
|
-
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
|
|
164
|
-
p.append(
|
|
165
|
-
[...p.getElementsByTagName("xsl:template")].forEach((
|
|
166
|
-
const
|
|
167
|
-
const c =
|
|
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
|
|
209
|
+
for (let g of n.childNodes)
|
|
170
210
|
c.lastElementChild.append(g);
|
|
171
211
|
return c;
|
|
172
212
|
};
|
|
173
|
-
C(p, "slot", (
|
|
174
|
-
const m = Z(
|
|
175
|
-
return m.params =
|
|
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
|
|
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", (
|
|
222
|
+
}, a.addEventListener("error", (i) => s(i)), a.send();
|
|
183
223
|
});
|
|
184
224
|
}
|
|
185
|
-
function
|
|
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) || !
|
|
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 = (
|
|
236
|
+
let s = e.ownerDocument, a = (i) => (e.append(i), i);
|
|
197
237
|
if (t.includes("/")) {
|
|
198
|
-
const
|
|
238
|
+
const i = [], r = s.evaluate(t, e);
|
|
199
239
|
for (let h; h = r.iterateNext(); )
|
|
200
|
-
|
|
201
|
-
return
|
|
240
|
+
i.push(h);
|
|
241
|
+
return i;
|
|
202
242
|
}
|
|
203
|
-
return [...e.childNodes].find((
|
|
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
|
|
209
|
-
if (r.getAttributeNames().map((
|
|
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
|
|
212
|
-
p(), a.append(S(
|
|
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
|
|
217
|
-
p(),
|
|
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 (
|
|
241
|
-
console.error(
|
|
280
|
+
} catch (i) {
|
|
281
|
+
console.error(i.message);
|
|
242
282
|
}
|
|
243
|
-
const a = await
|
|
283
|
+
const a = await de(e);
|
|
244
284
|
if (l.setAttributeNS("xml", "base", e), s) {
|
|
245
|
-
const
|
|
246
|
-
return
|
|
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 =
|
|
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
|
|
265
|
-
s.setAttribute && s.setAttribute("data-dce-id",
|
|
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[
|
|
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 =
|
|
287
|
-
|
|
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
|
-
},
|
|
340
|
+
}, D = (e, l) => {
|
|
301
341
|
const t = e.split("??");
|
|
302
342
|
if (t.length > 1)
|
|
303
|
-
return
|
|
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
|
|
316
|
-
a +=
|
|
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((
|
|
329
|
-
|
|
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(
|
|
337
|
-
for (const
|
|
338
|
-
C(
|
|
339
|
-
const
|
|
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((
|
|
343
|
-
|
|
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((
|
|
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
|
|
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
|
|
360
|
-
o.innerHTML = `${s}[data-dce-style="${
|
|
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
|
|
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 =
|
|
367
|
-
|
|
368
|
-
const
|
|
369
|
-
this.xml =
|
|
370
|
-
const
|
|
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 =
|
|
373
|
-
const
|
|
374
|
-
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);
|
|
375
423
|
}
|
|
376
|
-
Object.keys(f).length !== 0 &&
|
|
424
|
+
Object.keys(f).length !== 0 && I();
|
|
377
425
|
};
|
|
378
426
|
let V;
|
|
379
427
|
this.onSlice = (f) => {
|
|
380
|
-
|
|
428
|
+
L.push(f), V || (V = setTimeout(() => {
|
|
381
429
|
W(), V = 0;
|
|
382
430
|
}, 1));
|
|
383
431
|
};
|
|
384
|
-
const
|
|
432
|
+
const I = this.transform = () => {
|
|
385
433
|
if (this.#e)
|
|
386
434
|
debugger;
|
|
387
|
-
this.#e = 1,
|
|
388
|
-
const
|
|
389
|
-
return
|
|
390
|
-
`,
|
|
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
|
-
`,
|
|
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
|
|
397
|
-
|
|
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
|
|
402
|
-
o.hasAttribute("custom-validity") && (
|
|
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(
|
|
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 _ =
|
|
456
|
+
const _ = b(z, "custom-validity");
|
|
409
457
|
try {
|
|
410
|
-
const j = _ &&
|
|
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 =
|
|
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(
|
|
420
|
-
setTimeout(
|
|
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
|
-
})), (!
|
|
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
|
-
|
|
475
|
+
I(), W();
|
|
428
476
|
}
|
|
429
|
-
#t(m,
|
|
430
|
-
m === "value" && (this.value =
|
|
477
|
+
#t(m, n) {
|
|
478
|
+
m === "value" && (this.value = n);
|
|
431
479
|
let c = this.xml.querySelector(`attributes>${m}`);
|
|
432
|
-
c ?
|
|
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,
|
|
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
|
|
442
|
-
window.customElements.get(
|
|
489
|
+
const R = (u) => {
|
|
490
|
+
window.customElements.get(u) !== w && window.customElements.define(u, w);
|
|
443
491
|
};
|
|
444
492
|
if (t)
|
|
445
|
-
|
|
493
|
+
R(t);
|
|
446
494
|
else {
|
|
447
|
-
const
|
|
448
|
-
this.setAttribute("tag",
|
|
449
|
-
const m = document.createElement(
|
|
450
|
-
this.getAttributeNames().forEach((
|
|
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
|
|
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
|
-
|
|
467
|
-
|
|
514
|
+
M as a,
|
|
515
|
+
de as b,
|
|
468
516
|
me as c,
|
|
469
|
-
|
|
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
|
-
|
|
527
|
+
D as n,
|
|
480
528
|
$ as o,
|
|
481
529
|
ve as p,
|
|
482
530
|
ge as q,
|
|
483
531
|
Z as t,
|
|
484
|
-
|
|
532
|
+
P as x
|
|
485
533
|
};
|