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