@epa-wg/custom-element-dist 0.0.31 → 0.0.33
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/inspectionProfiles/Project_Default.xml +2 -1
- package/.storybook/main.ts +3 -7
- package/.storybook/preview.ts +4 -6
- package/README.md +4 -4
- package/coverage/coverage-final.json +7 -18
- package/coverage/index.html +30 -30
- 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 +719 -473
- package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
- package/coverage/src/custom-element/http-request.js.html +6 -6
- package/coverage/src/custom-element/index.html +29 -29
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js.html +31 -31
- package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
- package/coverage/src/custom-element/module-url.js.html +20 -20
- 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/coverage.svg +1 -1
- package/coverage/src/stories/{attributes.test.stories.ts → frame.canvas.ts}/coverage.svg +1 -1
- package/coverage/src/stories/frame.canvas.ts.html +175 -0
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +14 -179
- package/coverage/src/stories/testStoryBook.ts.html +8 -8
- package/coverage/src/sum.ts.html +1 -1
- package/dist/custom-element-6slVaFEs.cjs +97 -0
- package/dist/custom-element-WnOqmEOe.js +609 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +30 -28
- package/dist/demo/a.html +51 -38
- package/dist/demo/attributes.html +153 -0
- package/dist/demo/data-slices.html +2 -2
- package/dist/demo/external-template.html +1 -0
- package/dist/demo/external-templates-sb-6.html +42 -0
- package/dist/demo/external-templates-sb-7.html +42 -0
- package/dist/demo/form.html +42 -0
- package/dist/demo/hex-grid-dce.html +1 -1
- package/dist/demo/hex-grid.html +1 -1
- package/dist/demo/html-template.html +1 -1
- package/dist/demo/module-url-sb-2.html +46 -0
- package/dist/demo/module-url-sb-4.html +48 -0
- package/dist/demo/module-url-sb-5.html +53 -0
- package/dist/demo/parameters.html +20 -1
- package/dist/demo/s.xml +66 -9
- package/dist/demo/s.xslt +89 -16
- package/dist/demo/ss.html +12 -22
- package/dist/mockServiceWorker.js +31 -8
- package/package.json +25 -26
- package/public/demo/a.html +51 -38
- package/public/demo/attributes.html +153 -0
- package/public/demo/data-slices.html +2 -2
- package/public/demo/external-template.html +1 -0
- package/public/demo/external-templates-sb-6.html +42 -0
- package/public/demo/external-templates-sb-7.html +42 -0
- package/public/demo/form.html +42 -0
- package/public/demo/hex-grid-dce.html +1 -1
- package/public/demo/hex-grid.html +1 -1
- package/public/demo/html-template.html +1 -1
- package/public/demo/module-url-sb-2.html +46 -0
- package/public/demo/module-url-sb-4.html +48 -0
- package/public/demo/module-url-sb-5.html +53 -0
- package/public/demo/parameters.html +20 -1
- package/public/demo/s.xml +66 -9
- package/public/demo/s.xslt +89 -16
- package/public/demo/ss.html +12 -22
- package/public/mockServiceWorker.js +31 -8
- package/src/custom-element/custom-element.d.ts +4 -0
- package/src/custom-element/custom-element.js +148 -66
- package/src/custom-element/demo/a.html +51 -38
- package/src/custom-element/demo/attributes.html +153 -0
- package/src/custom-element/demo/data-slices.html +2 -2
- package/src/custom-element/demo/external-template.html +1 -0
- package/src/custom-element/demo/form.html +42 -0
- package/src/custom-element/demo/hex-grid-dce.html +1 -1
- package/src/custom-element/demo/hex-grid.html +1 -1
- package/src/custom-element/demo/html-template.html +1 -1
- package/src/custom-element/demo/parameters.html +20 -1
- package/src/custom-element/demo/s.xml +66 -9
- package/src/custom-element/demo/s.xslt +89 -16
- package/src/custom-element/demo/ss.html +12 -22
- 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 +1 -1
- package/src/material/components/badge.html +240 -0
- package/src/material/components/dropdown.html +26 -14
- package/src/material/components/icon-link.html +1 -0
- package/src/material/components/icon.html +253 -0
- package/src/material/components/input.html +571 -0
- package/src/material/components/menu.html +7 -5
- package/src/material/components.html +48 -11
- package/src/material/theme/semantic.css +20 -1
- package/src/mocks/versions.mock.ts +1 -1
- package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
- package/src/stories/__screenshots__/external-template.test.stories.ts +1 -0
- package/src/stories/__screenshots__/module-url.test.stories.ts +1 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/attributes-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-definition-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-cloneAs-el-newTag--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---2.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---3.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-mix-to-from--1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-and-slice-1.png +0 -0
- package/src/stories/__screenshots__/stories.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +177 -11
- package/src/stories/external-template.test.stories.ts +17 -15
- package/src/stories/frame.canvas.ts +31 -0
- package/src/stories/module-url.test.stories.ts +29 -61
- package/storybook-static/assets/Color-F6OSRLHC-Cbp293x2.js +1 -0
- package/storybook-static/assets/Configure-BrFr4SLE.js +165 -0
- package/storybook-static/assets/DocsRenderer-CFRXHY34-DhHzJiIO.js +2 -0
- package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +1 -0
- package/storybook-static/assets/attributes.test.stories-Gg9LQTEK.js +349 -0
- package/storybook-static/assets/{css.test.stories-Cgn6ICr0.js → css.test.stories-B_3ltOrx.js} +1 -1
- package/storybook-static/assets/custom-element-CPnvJnn8.js +97 -0
- package/storybook-static/assets/{dom-merge.test.stories-CBObfPWg.js → dom-merge.test.stories-nQxcgLoM.js} +1 -1
- package/storybook-static/assets/entry-preview-docs-Dwczwtsc.js +2 -0
- package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +1 -0
- package/storybook-static/assets/{external-template.test.stories-VfKUQ8eu.js → external-template.test.stories-DZ-rjnfd.js} +39 -41
- package/storybook-static/assets/{form.test.stories-CnuGN7Zw.js → form.test.stories-DQhPYtMj.js} +1 -1
- package/storybook-static/assets/frame.canvas-ClTqYyMN.js +1 -0
- package/storybook-static/assets/{handlers-V_T7WjNK.js → handlers-CLkps6Nz.js} +17 -14
- package/storybook-static/assets/{http-request.stories-8NN1Coqm.js → http-request.stories-jo0f73nw.js} +1 -1
- package/storybook-static/assets/iframe-CZwRpnn9.js +199 -0
- package/storybook-static/assets/index-B68YUdzy.js +621 -0
- package/storybook-static/assets/index-BwkS7JH_.js +8 -0
- package/storybook-static/assets/index-CJQtnF9V.js +1 -0
- package/storybook-static/assets/index-Dr4PwNfd.js +240 -0
- package/storybook-static/assets/{local-storage.test.stories-Dk5Yqc7m.js → local-storage.test.stories-uA5EKRPf.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-56um6s5L.js → location-element.test.stories-Cu-6Elcg.js} +1 -1
- package/storybook-static/assets/module-url.test.stories-CD_wusXQ.js +142 -0
- package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +1 -0
- package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
- package/storybook-static/assets/preview-BFlNN3Wj.js +1 -0
- package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
- package/storybook-static/assets/preview-Cm4PPhHS.js +50 -0
- package/storybook-static/assets/preview-CuCH40jj.js +2 -0
- package/storybook-static/assets/preview-DfTudP20.js +1 -0
- package/storybook-static/assets/{set-url.test.stories-B4E6hIe-.js → set-url.test.stories-CY7B9BVZ.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-BR0F-B6I.js → slice-events.test.stories-BVnPXm6e.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-CgfJIyCr.js → slots.test.stories-Dxsa9KdA.js} +1 -1
- package/storybook-static/assets/{version-select.test.stories-nmxATIwv.js → version-select.test.stories-Buga1PAa.js} +1 -1
- package/storybook-static/demo/a.html +51 -38
- package/storybook-static/demo/attributes.html +153 -0
- package/storybook-static/demo/data-slices.html +2 -2
- package/storybook-static/demo/external-template.html +1 -0
- package/storybook-static/demo/external-templates-sb-6.html +42 -0
- package/storybook-static/demo/external-templates-sb-7.html +42 -0
- package/storybook-static/demo/form.html +42 -0
- package/storybook-static/demo/hex-grid-dce.html +1 -1
- package/storybook-static/demo/hex-grid.html +1 -1
- package/storybook-static/demo/html-template.html +1 -1
- package/storybook-static/demo/module-url-sb-2.html +46 -0
- package/storybook-static/demo/module-url-sb-4.html +48 -0
- package/storybook-static/demo/module-url-sb-5.html +53 -0
- package/storybook-static/demo/parameters.html +20 -1
- package/storybook-static/demo/s.xml +66 -9
- package/storybook-static/demo/s.xslt +89 -16
- package/storybook-static/demo/ss.html +12 -22
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/index.html +6 -10
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +31 -8
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +391 -0
- package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +230 -0
- package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-9/manager-bundle.js +58 -58
- package/storybook-static/sb-manager/globals-module-info.js +9 -0
- package/storybook-static/sb-manager/globals-runtime.js +10719 -10473
- package/storybook-static/sb-manager/runtime.js +4944 -6321
- package/coverage/src/stories/attributes.test.stories.ts.html +0 -514
- package/coverage/src/stories/css.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/css.test.stories.ts.html +0 -460
- package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/dom-merge.test.stories.ts.html +0 -706
- package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/external-template.test.stories.ts.html +0 -865
- package/coverage/src/stories/form.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/form.test.stories.ts.html +0 -661
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/local-storage.test.stories.ts.html +0 -1315
- package/coverage/src/stories/location-element.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/location-element.test.stories.ts.html +0 -523
- package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/module-url.test.stories.ts.html +0 -640
- package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/set-url.test.stories.ts.html +0 -433
- package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slice-events.test.stories.ts.html +0 -952
- package/coverage/src/stories/slots.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/slots.test.stories.ts.html +0 -742
- package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +0 -10
- package/coverage/src/stories/version-select.test.stories.ts.html +0 -397
- package/dist/custom-element-BbJMY20-.cjs +0 -97
- package/dist/custom-element-CoRNKeEP.js +0 -567
- package/storybook-static/assets/Color-F6OSRLHC-CFyd3TND.js +0 -1
- package/storybook-static/assets/Configure-UGTbPRKK.js +0 -165
- package/storybook-static/assets/DocsRenderer-CFRXHY34-Dpr5iB0o.js +0 -2
- package/storybook-static/assets/attributes.test.stories-DSOLHHOW.js +0 -152
- package/storybook-static/assets/custom-element-D59Fok1f.js +0 -97
- package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
- package/storybook-static/assets/iframe-DnhkgdtG.js +0 -2
- package/storybook-static/assets/index-3Sfy-t3H.js +0 -769
- package/storybook-static/assets/index-BcZLpTeD.js +0 -8
- package/storybook-static/assets/index-CIBI7sCB.js +0 -1
- package/storybook-static/assets/index-CxRwF5Or.js +0 -234
- package/storybook-static/assets/index-D-8MO0q_.js +0 -1
- package/storybook-static/assets/index-DN1RoK17.js +0 -1
- package/storybook-static/assets/index-DjJD7gkO.js +0 -1
- package/storybook-static/assets/module-url.test.stories-DEponQ7l.js +0 -208
- package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
- package/storybook-static/assets/preview-CNKoaWES.js +0 -1
- package/storybook-static/assets/preview-Czc-sw5H.js +0 -2
- package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
- package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
- package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
- package/storybook-static/assets/preview-vbpHsp94.js +0 -52
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -333
- package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -40
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
- package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
- package/storybook-static/sb-preview/globals.js +0 -33
- package/storybook-static/sb-preview/runtime.js +0 -7174
- package/test-runner-jest.config.js +0 -15
- /package/storybook-static/sb-addons/{essentials-actions-3 → essentials-actions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{essentials-controls-2 → essentials-controls-1}/manager-bundle.js.LEGAL.txt +0 -0
- /package/storybook-static/sb-addons/{links-1 → essentials-docs-3}/manager-bundle.js.LEGAL.txt +0 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
const K = "http://www.w3.org/1999/XSL/Transform", R = "http://www.w3.org/1999/xhtml", be = "http://exslt.org/common", d = (e, l) => e?.getAttribute?.(l), se = (e) => e.nodeType === 3, ye = (e) => typeof e == "string", ge = (e) => e && typeof e.nodeType == "number", L = (e, l) => (e.ownerDocument || e).createTextNode(l), oe = (e) => {
|
|
2
|
+
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
|
+
return e;
|
|
4
|
+
}, F = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), oe(e)), ce = (e) => (e?.setAttribute("xmlns:xsl", K), e), me = (e) => (e?.setAttribute("xmlns:xhtml", R), ce(e)), ue = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), le = (e, l) => (Object.keys(l).map((t) => e[t] = l[t]), e), $ = (e, l = "", t = document) => {
|
|
5
|
+
const s = (n) => ((o) => (l && o.append(L(t.ownerDocument || t, l)), o))((t.ownerDocument || t).createElement(n));
|
|
6
|
+
if (ue(e))
|
|
7
|
+
return s(e);
|
|
8
|
+
const a = s("dce-object");
|
|
9
|
+
return a.setAttribute("dce-object-name", e), a;
|
|
10
|
+
}, ne = (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 (let s of e.childNodes)
|
|
15
|
+
t.append(s.cloneNode(!0));
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
function U(e) {
|
|
19
|
+
return new DOMParser().parseFromString(e, "application/xml");
|
|
20
|
+
}
|
|
21
|
+
function q(e) {
|
|
22
|
+
return new XMLSerializer().serializeToString(e);
|
|
23
|
+
}
|
|
24
|
+
function B(e, l, t, s) {
|
|
25
|
+
const a = (g) => e.ownerDocument.createElement(g), o = ((g, x, v) => (x.append(v = a(g)), v))(l, e);
|
|
26
|
+
return [...t].forEach((g) => o.append(s(g))), o;
|
|
27
|
+
}
|
|
28
|
+
function Ae(e) {
|
|
29
|
+
return e.slot || (e.setAttribute || (e = $("span", e.textContent.replaceAll(`
|
|
30
|
+
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
|
+
}
|
|
32
|
+
function J(e, l) {
|
|
33
|
+
e.getAttributeNames().forEach((t) => l.includes(t) || e.removeAttribute(t));
|
|
34
|
+
}
|
|
35
|
+
const ae = (e) => [...e].filter((l) => !(l.nodeType === 3 && l.data.trim() === ""));
|
|
36
|
+
function I(e, l, t) {
|
|
37
|
+
const s = typeof e;
|
|
38
|
+
if (s === "string")
|
|
39
|
+
return $(l, e, t);
|
|
40
|
+
if (s === "number")
|
|
41
|
+
return $(l, "" + e, t);
|
|
42
|
+
if (e instanceof Array) {
|
|
43
|
+
const n = $("array", "", t);
|
|
44
|
+
return e.map((o) => n.append(I(o, l, t))), n;
|
|
45
|
+
}
|
|
46
|
+
if (e instanceof FormData) {
|
|
47
|
+
const n = $("form-data", "", t);
|
|
48
|
+
for (const o of e)
|
|
49
|
+
n.append(I(o[1], o[0], t));
|
|
50
|
+
return n;
|
|
51
|
+
}
|
|
52
|
+
const a = $(l, "", t);
|
|
53
|
+
for (let n in e)
|
|
54
|
+
ge(e[n]) || typeof e[n] == "function" || e[n] instanceof Window || (typeof e[n] != "object" && ue(n) ? a.setAttribute(n, e[n]) : a.append(I(e[n], n, t)));
|
|
55
|
+
return a;
|
|
56
|
+
}
|
|
57
|
+
function ie(e) {
|
|
58
|
+
if (z(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
59
|
+
const s = t.data, a = s.matchAll(/{([^}]*)}/g);
|
|
60
|
+
if (a) {
|
|
61
|
+
let n = 0, o = (x) => L(t, x), g = [];
|
|
62
|
+
if ([...a].forEach((x) => {
|
|
63
|
+
x.index > n && g.push(o(x.input.substring(n, x.index)));
|
|
64
|
+
const v = e.querySelector("value-of").cloneNode();
|
|
65
|
+
v.setAttribute("select", x[1]), g.push(v), n = x.index + x[0].length;
|
|
66
|
+
}), n < s.length && g.push(o(s.substring(n, s.length))), g.length) {
|
|
67
|
+
for (let x of g)
|
|
68
|
+
l.insertBefore(x, t);
|
|
69
|
+
l.removeChild(t);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})), "all" in e) {
|
|
73
|
+
let l = 1;
|
|
74
|
+
for (let t of e.all)
|
|
75
|
+
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
76
|
+
}
|
|
77
|
+
return e;
|
|
78
|
+
}
|
|
79
|
+
function ve(e, l = "xsl:stylesheet") {
|
|
80
|
+
const t = [], s = {}, a = {};
|
|
81
|
+
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
82
|
+
return ie(le(e, { declaredAttributes: t, hardcodedAttributes: s, exposedAttributes: a }));
|
|
83
|
+
const n = U(`<xsl:stylesheet version="1.0" xmlns:xsl="${K}" xmlns:xhtml="${R}" xmlns:exsl="${be}" exclude-result-prefixes="exsl" >
|
|
84
|
+
<xsl:output method="xml"/>
|
|
85
|
+
<xsl:template match="/"><dce-root xmlns="${R}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
|
|
86
|
+
<xsl:template match="*[name()='template']">
|
|
87
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
88
|
+
</xsl:template>
|
|
89
|
+
<xsl:template match="*">
|
|
90
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
91
|
+
</xsl:template>
|
|
92
|
+
<xsl:template match="*[name()='svg']|*[name()='math']">
|
|
93
|
+
<xsl:apply-templates mode="sanitize" select="."/>
|
|
94
|
+
</xsl:template>
|
|
95
|
+
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
|
|
96
|
+
<xsl:copy>
|
|
97
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
98
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
99
|
+
</xsl:copy>
|
|
100
|
+
</xsl:template>
|
|
101
|
+
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
|
|
102
|
+
<xsl:element name="{local-name()}">
|
|
103
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
104
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
105
|
+
</xsl:element>
|
|
106
|
+
</xsl:template>
|
|
107
|
+
<xsl:template mode="sanitize" match="*|@*">
|
|
108
|
+
<xsl:copy>
|
|
109
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
110
|
+
</xsl:copy>
|
|
111
|
+
</xsl:template>
|
|
112
|
+
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
113
|
+
<xsl:template mode="sanitize" match="text()">
|
|
114
|
+
<dce-text>
|
|
115
|
+
<xsl:copy/>
|
|
116
|
+
</dce-text>
|
|
117
|
+
</xsl:template>
|
|
118
|
+
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
|
|
119
|
+
<xsl:copy>
|
|
120
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
121
|
+
</xsl:copy>
|
|
122
|
+
</xsl:template>
|
|
123
|
+
<xsl:template mode="sanitize" match="xhtml:*">
|
|
124
|
+
<xsl:element name="{local-name()}">
|
|
125
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
126
|
+
</xsl:element>
|
|
127
|
+
</xsl:template>
|
|
128
|
+
<xsl:template mode="sanitize" match="xhtml:input">
|
|
129
|
+
<xsl:element name="{local-name()}">
|
|
130
|
+
<xsl:apply-templates mode="sanitize" select="*[not(name()='slice')]|@*|text()"/>
|
|
131
|
+
</xsl:element>
|
|
132
|
+
<xsl:for-each select="slice">
|
|
133
|
+
<xsl:copy>
|
|
134
|
+
<xsl:attribute name="for" >^</xsl:attribute>
|
|
135
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
136
|
+
</xsl:copy>
|
|
137
|
+
</xsl:for-each>
|
|
138
|
+
</xsl:template>
|
|
139
|
+
</xsl:stylesheet>`), o = new XSLTProcessor(), g = ((i) => {
|
|
140
|
+
z(i, "custom-element", (h) => {
|
|
141
|
+
h.firstElementChild.localName === "template" && ([...h.firstElementChild.content.childNodes].forEach((b) => h.append(b)), h.firstElementChild.remove());
|
|
142
|
+
}), z(i, "script", (h) => h.remove());
|
|
143
|
+
const r = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
|
|
144
|
+
Le.forEach((h) => z(r, h, (b) => De(b, r)));
|
|
145
|
+
const f = i.firstElementChild?.content || i.content, y = (h) => {
|
|
146
|
+
const b = U("<xhtml/>"), T = b.importNode(h, !0);
|
|
147
|
+
return b.replaceChild(T, b.documentElement), T.namespaceURI === R && !d(T, "xmlns") && T.setAttribute("xmlns", R), me(T);
|
|
148
|
+
};
|
|
149
|
+
if (f) {
|
|
150
|
+
const h = $("div");
|
|
151
|
+
return [...f.childNodes].map((b) => h.append(b.cloneNode(!0))), y(h);
|
|
152
|
+
}
|
|
153
|
+
return y(i.documentElement || i.body || i);
|
|
154
|
+
})(e), x = U(
|
|
155
|
+
`<xsl:stylesheet version="1.0"
|
|
156
|
+
xmlns:xsl="${K}"
|
|
157
|
+
xmlns:xhtml="${R}"
|
|
158
|
+
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
159
|
+
xmlns:exsl="http://exslt.org/common"
|
|
160
|
+
exclude-result-prefixes="exsl"
|
|
161
|
+
>
|
|
162
|
+
<xsl:template match="ignore">
|
|
163
|
+
<xsl:choose>
|
|
164
|
+
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
165
|
+
<xsl:otherwise>{def}</xsl:otherwise>
|
|
166
|
+
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
167
|
+
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
168
|
+
<xsl:template match="/">
|
|
169
|
+
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
170
|
+
</xsl:template>
|
|
171
|
+
<xsl:template name="slot" >
|
|
172
|
+
<xsl:param name="slotname" />
|
|
173
|
+
<xsl:param name="defaultvalue" />
|
|
174
|
+
<xsl:choose>
|
|
175
|
+
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
176
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
177
|
+
</xsl:when>
|
|
178
|
+
<xsl:otherwise>
|
|
179
|
+
<xsl:copy-of select="$defaultvalue"/>
|
|
180
|
+
</xsl:otherwise>
|
|
181
|
+
</xsl:choose>
|
|
182
|
+
</xsl:template>
|
|
183
|
+
<xsl:variable name="js-injected-body">
|
|
184
|
+
<xsl:call-template name="slot" >
|
|
185
|
+
<xsl:with-param name="slotname" select="''"/>
|
|
186
|
+
<xsl:with-param name="defaultvalue"/>
|
|
187
|
+
</xsl:call-template>
|
|
188
|
+
</xsl:variable>
|
|
189
|
+
</xsl:stylesheet>`
|
|
190
|
+
);
|
|
191
|
+
o.importStylesheet(n);
|
|
192
|
+
const v = o.transformToFragment(g, document), u = (i, r) => i.querySelector(r), w = u(x, 'template[mode="payload"]');
|
|
193
|
+
if (!v)
|
|
194
|
+
return console.error("transformation error", { xml: g.outerHTML, xsl: q(n) });
|
|
195
|
+
if (v.firstElementChild.localName !== "dce-root") {
|
|
196
|
+
const i = v.ownerDocument.createElement("dce-root");
|
|
197
|
+
[...v.childNodes].forEach((r) => i.append(r)), v.append(i);
|
|
198
|
+
}
|
|
199
|
+
[...v.querySelectorAll("[test]")].forEach((i) => {
|
|
200
|
+
const r = d(i, "test"), f = r.replace(
|
|
201
|
+
/hasBoolAttribute\((.*?)\)/g,
|
|
202
|
+
(y, h, b, T, M) => {
|
|
203
|
+
const D = h.substring(1);
|
|
204
|
+
return `(not($${D} = 'false') and ($${D} = '' or $${D} = '${D}' or $${D} = 'true' ))`;
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
r !== f && i.setAttribute("test", f);
|
|
208
|
+
}), [...v.querySelectorAll("dce-root>attribute")].forEach((i) => {
|
|
209
|
+
J(i, "namespace,name,select");
|
|
210
|
+
const r = ne(i, "xsl:param"), f = d(i, "name");
|
|
211
|
+
if (t.push(f), i.childNodes.length && (s[f] = i.textContent), w.append(r), i.hasAttribute("select")) {
|
|
212
|
+
a[f] = d(i, "select"), J(r, "select,name");
|
|
213
|
+
let y = d(i, "select").split("??"), h;
|
|
214
|
+
if (y?.length > 1) {
|
|
215
|
+
r.removeAttribute("select");
|
|
216
|
+
const b = u(x, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
217
|
+
F(b.firstElementChild).append(L(b, "{" + y[0] + "}")), b.firstElementChild.setAttribute("test", y[0]);
|
|
218
|
+
for (let T = 1; T < y.length - 1; T++) {
|
|
219
|
+
const M = b.firstElementChild.cloneNode(!0);
|
|
220
|
+
F(M).append(L(b, "{" + y[T] + "}")), M.setAttribute("test", y[T]), b.insertBefore(M, b.lastElementChild);
|
|
221
|
+
}
|
|
222
|
+
F(b.lastElementChild).append(L(b, "{" + y[y.length - 1] + "}")), r.append(b), h = b.cloneNode(!0);
|
|
223
|
+
} else
|
|
224
|
+
h = ne(i, "xsl:value-of");
|
|
225
|
+
h.removeAttribute("name"), i.append(h), i.removeAttribute("select");
|
|
226
|
+
} else
|
|
227
|
+
J(r, "name"), r.setAttribute("select", "/datadom/attributes/" + f), s[f] || i.remove();
|
|
228
|
+
}), [...v.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
|
|
229
|
+
const r = d(i, "value");
|
|
230
|
+
r && i.setAttribute("value", $e(r));
|
|
231
|
+
});
|
|
232
|
+
for (const i of v.childNodes)
|
|
233
|
+
w.append(x.importNode(i, !0));
|
|
234
|
+
[...w.getElementsByTagName("xsl:template")].forEach((i) => w.ownerDocument.documentElement.append(i));
|
|
235
|
+
const O = u(x, 'call-template[name="slot"]'), H = (i) => {
|
|
236
|
+
const r = O.cloneNode(!0), f = d(i, "name");
|
|
237
|
+
f && r.firstElementChild.setAttribute("select", `'${f}'`);
|
|
238
|
+
for (let y of i.childNodes)
|
|
239
|
+
r.lastElementChild.append(y);
|
|
240
|
+
return r;
|
|
241
|
+
};
|
|
242
|
+
z(w, "slot", (i) => i.parentNode.replaceChild(H(i), i));
|
|
243
|
+
const p = ie(x);
|
|
244
|
+
return le(p, { declaredAttributes: t, hardcodedAttributes: s, exposedAttributes: a }), p;
|
|
245
|
+
}
|
|
246
|
+
async function Ee(e) {
|
|
247
|
+
return await new Promise((t, s) => {
|
|
248
|
+
const a = new XMLHttpRequest();
|
|
249
|
+
a.open("GET", e), a.responseType = "document", a.onload = () => {
|
|
250
|
+
a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || $("div", a.responseText)) : s(`${a.statusText} - ${e}`);
|
|
251
|
+
}, a.addEventListener("error", (n) => s(n)), a.send();
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function Ne(e, l, t = !1) {
|
|
255
|
+
if (e === l)
|
|
256
|
+
return !0;
|
|
257
|
+
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
258
|
+
return t;
|
|
259
|
+
for (let s in e)
|
|
260
|
+
if (!(s in l) || !Ne(e[s], l[s]))
|
|
261
|
+
return t;
|
|
262
|
+
return !0;
|
|
263
|
+
}
|
|
264
|
+
const de = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), we = (e, l) => de(l).map((t) => {
|
|
265
|
+
let s = e.ownerDocument, a = (n) => (e.append(n), n);
|
|
266
|
+
if (t.includes("/")) {
|
|
267
|
+
const n = [], o = s.evaluate(t, e);
|
|
268
|
+
for (let g; g = o.iterateNext(); )
|
|
269
|
+
n.push(g);
|
|
270
|
+
return n;
|
|
271
|
+
}
|
|
272
|
+
return [...e.childNodes].find((n) => n.localName === t) || a($(t, "", s));
|
|
273
|
+
}).flat();
|
|
274
|
+
function re(e, l, t, s) {
|
|
275
|
+
if (!t.sliceProcessed)
|
|
276
|
+
return t.sliceProcessed = 1, we(e, l ?? "").map((a) => {
|
|
277
|
+
const n = e.ownerDocument, o = t.sliceEventSource, g = t.sliceElement, x = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
|
|
278
|
+
o.getAttributeNames().map((u) => a.setAttribute(u, d(o, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in o && a.setAttribute("validation-message", o.validationMessage), t.type === "init" && x(), a.append(I(t, "event", n));
|
|
279
|
+
const v = (o.type === "checkbox" || o.type === "radio") && !o.checked;
|
|
280
|
+
if (g.hasAttribute("slice-value")) {
|
|
281
|
+
o.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", o.value);
|
|
282
|
+
const u = v ? "" : P(d(g, "slice-value"), a);
|
|
283
|
+
x(), a.append(L(n, u));
|
|
284
|
+
} else {
|
|
285
|
+
if ("elements" in o)
|
|
286
|
+
return x(), a.append(I(new FormData(o), "value", a.ownerDocument)), a;
|
|
287
|
+
const u = v ? "" : o.value ?? d(o, "value");
|
|
288
|
+
if (x(), u == null)
|
|
289
|
+
[...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()), a.removeAttribute("value");
|
|
290
|
+
else {
|
|
291
|
+
const w = ye(u) ? L(n, u) : I(u, "value", a.ownerDocument);
|
|
292
|
+
a.append(w), a.setAttribute("value", u);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return a;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
function z(e, l, t) {
|
|
299
|
+
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
300
|
+
}
|
|
301
|
+
const Te = async (e, l) => {
|
|
302
|
+
if (!e || !e.trim())
|
|
303
|
+
return [l];
|
|
304
|
+
if (e.startsWith("#"))
|
|
305
|
+
return ((t) => {
|
|
306
|
+
const s = t.querySelectorAll(e);
|
|
307
|
+
return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
|
|
308
|
+
})(l.parentElement);
|
|
309
|
+
try {
|
|
310
|
+
const [t, s] = e.split("#");
|
|
311
|
+
if (e.charAt(0) === ".")
|
|
312
|
+
e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
|
|
313
|
+
else
|
|
314
|
+
try {
|
|
315
|
+
e = import.meta.resolve(t), s && (e += "#" + s);
|
|
316
|
+
} catch (n) {
|
|
317
|
+
console.error(n.message);
|
|
318
|
+
}
|
|
319
|
+
const a = await Ee(e);
|
|
320
|
+
if (l.setAttributeNS("xml", "base", e), s) {
|
|
321
|
+
const n = a.querySelectorAll("#" + s);
|
|
322
|
+
return n.length ? [...n] : (console.error("template not found", e + "#" + s), [l]);
|
|
323
|
+
}
|
|
324
|
+
return [a];
|
|
325
|
+
} catch {
|
|
326
|
+
return [l];
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
function pe(e, l) {
|
|
330
|
+
for (let n of e.attributes)
|
|
331
|
+
try {
|
|
332
|
+
const o = n.name;
|
|
333
|
+
n.namespaceURI ? (!l.hasAttributeNS(n.namespaceURI, o) || l.getAttributeNS(n.namespaceURI, o) !== n.value) && l.setAttributeNS(n.namespaceURI, o, n.value) : (!l.hasAttribute(o) || l.getAttribute(o) !== n.value) && l.setAttribute(n.name, n.value), n.name === "value" && (l.value = n.value);
|
|
334
|
+
} catch (o) {
|
|
335
|
+
console.warn("attribute assignment error", o?.message || o);
|
|
336
|
+
}
|
|
337
|
+
const t = l.dceExportedAttributes, s = l.getAttribute("dce-exported-attributes"), a = s ? new Set(s.split(" ")) : null;
|
|
338
|
+
for (let n of l.getAttributeNames())
|
|
339
|
+
!e.hasAttribute(n) && !t?.has(n) && !a?.has(n) && l.removeAttribute(n);
|
|
340
|
+
}
|
|
341
|
+
function fe(e, l = 0) {
|
|
342
|
+
const t = {};
|
|
343
|
+
for (const s of e.childNodes) {
|
|
344
|
+
const a = d(s, "data-dce-id") || s.dceId || 0;
|
|
345
|
+
if (!t[a])
|
|
346
|
+
a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
347
|
+
else {
|
|
348
|
+
const n = s.dceId = a + "-" + t[a]++;
|
|
349
|
+
s.setAttribute && s.setAttribute("data-dce-id", n);
|
|
350
|
+
}
|
|
351
|
+
s.childNodes.length && fe(s);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function Se(e, l, t) {
|
|
355
|
+
t = 1 * t;
|
|
356
|
+
for (let s of e.childNodes)
|
|
357
|
+
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
358
|
+
return e.insertBefore(l, s);
|
|
359
|
+
e.append(l);
|
|
360
|
+
}
|
|
361
|
+
function he(e, l) {
|
|
362
|
+
if (e.firstElementChild?.localName === "dce-root" && l[0]?.localName !== "dce-root")
|
|
363
|
+
return;
|
|
364
|
+
if (!l.length)
|
|
365
|
+
return e.firstElementChild?.localName !== "dce-root" && oe(e);
|
|
366
|
+
const t = {};
|
|
367
|
+
for (let s of e.childNodes)
|
|
368
|
+
t[s.dceId], se(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[d(s, "data-dce-id") || 0] = s;
|
|
369
|
+
for (let s of [...l]) {
|
|
370
|
+
const a = d(s, "data-dce-id") || s.dceId, n = t[a];
|
|
371
|
+
n ? (se(s) ? n.nodeValue !== s.nodeValue && (n.nodeValue = s.nodeValue) : (pe(s, n), (n.childNodes.length || s.childNodes.length) && he(n, s.childNodes)), delete t[a]) : Se(e, s, a);
|
|
372
|
+
}
|
|
373
|
+
for (let s of Object.values(t))
|
|
374
|
+
s.localName !== "dce-root" && s.remove();
|
|
375
|
+
}
|
|
376
|
+
function Ce(e, l) {
|
|
377
|
+
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
378
|
+
}
|
|
379
|
+
const $e = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${Q(t[3])}}${t[4]}`).join(""), Q = (e) => {
|
|
380
|
+
if (!e.trim())
|
|
381
|
+
return e;
|
|
382
|
+
const l = e.split("??"), t = l.shift(), s = Q(l.join("??"));
|
|
383
|
+
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
384
|
+
}, P = (e, l) => {
|
|
385
|
+
const t = e.split("??");
|
|
386
|
+
if (t.length > 1)
|
|
387
|
+
return P(t[0], l) || P(t[1], l);
|
|
388
|
+
e = Q(e);
|
|
389
|
+
const s = l.ownerDocument.evaluate(e, l);
|
|
390
|
+
switch (s.resultType) {
|
|
391
|
+
case XPathResult.NUMBER_TYPE:
|
|
392
|
+
return s.numberValue;
|
|
393
|
+
case XPathResult.STRING_TYPE:
|
|
394
|
+
return s.stringValue;
|
|
395
|
+
case XPathResult.BOOLEAN_TYPE:
|
|
396
|
+
return s.booleanValue;
|
|
397
|
+
}
|
|
398
|
+
let a = "";
|
|
399
|
+
for (let n; n = s.iterateNext(); )
|
|
400
|
+
a += n.textContent;
|
|
401
|
+
return a;
|
|
402
|
+
}, Le = "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(","), De = (e, l) => {
|
|
403
|
+
const t = $("xsl:" + e.localName);
|
|
404
|
+
for (let s of e.attributes)
|
|
405
|
+
t.setAttribute(s.name, s.value);
|
|
406
|
+
for (; e.firstChild; )
|
|
407
|
+
t.append(e.firstChild);
|
|
408
|
+
if (e.parentElement)
|
|
409
|
+
e.parentElement.replaceChild(t, e);
|
|
410
|
+
else {
|
|
411
|
+
const s = e.parentElement || l, a = [...s.childNodes];
|
|
412
|
+
a.forEach((n, o) => {
|
|
413
|
+
n === e && (a[o] = t);
|
|
414
|
+
}), s.replaceChildren(...a);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
class je extends HTMLElement {
|
|
418
|
+
static observedAttributes = ["src", "tag", "hidden"];
|
|
419
|
+
async connectedCallback() {
|
|
420
|
+
this.firstElementChild && this.firstElementChild.localName !== "template" && console.log(`custom-element used without template wrapping content
|
|
421
|
+
`, this.outerHTML);
|
|
422
|
+
const l = await Te(d(this, "src"), this), t = d(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
423
|
+
for (const p of l)
|
|
424
|
+
z(p.templateNode || p.content || p, "style", (i) => {
|
|
425
|
+
const r = i.closest("slot"), f = r ? `slot[name="${r.name}"]` : "";
|
|
426
|
+
i.innerHTML = `${s} ${f}{${i.innerHTML}}`, this.append(i);
|
|
427
|
+
});
|
|
428
|
+
const a = l.map((p) => ve(p)), n = a.map((p, i) => {
|
|
429
|
+
i = new XSLTProcessor();
|
|
430
|
+
try {
|
|
431
|
+
i.importStylesheet(p);
|
|
432
|
+
} catch (r) {
|
|
433
|
+
console.error(r, q(p));
|
|
434
|
+
}
|
|
435
|
+
return i;
|
|
436
|
+
});
|
|
437
|
+
Object.defineProperty(this, "xsltString", { get: () => a.map((p) => q(p)).join(`
|
|
438
|
+
`) });
|
|
439
|
+
const o = this, g = [...this.templateNode.querySelectorAll("[slice]")], x = g.map((p) => d(p, "slice")).filter((p) => !p.includes("/")).filter((p, i, r) => r.indexOf(p) === i).map(de).flat(), { declaredAttributes: v, hardcodedAttributes: u, exposedAttributes: w } = a[0], ee = /* @__PURE__ */ new Set([...Object.keys(u), ...Object.keys(w)]);
|
|
440
|
+
class O extends HTMLElement {
|
|
441
|
+
static get observedAttributes() {
|
|
442
|
+
return v;
|
|
443
|
+
}
|
|
444
|
+
#e = 0;
|
|
445
|
+
get dceExportedAttributes() {
|
|
446
|
+
return ee;
|
|
447
|
+
}
|
|
448
|
+
connectedCallback() {
|
|
449
|
+
let i = ae(this.childNodes);
|
|
450
|
+
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
451
|
+
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
452
|
+
const c = this.firstElementChild;
|
|
453
|
+
c.remove(), i = ae(c.content.childNodes);
|
|
454
|
+
for (const E of i)
|
|
455
|
+
if (E.localName === "style") {
|
|
456
|
+
const m = Ce(this, "data-dce-style");
|
|
457
|
+
E.innerHTML = `${s}[data-dce-style="${m}"]{${E.innerHTML}}`, c.insertAdjacentElement("beforebegin", E);
|
|
458
|
+
} else
|
|
459
|
+
E.nodeType === 1 ? c.insertAdjacentElement("beforebegin", E) : E.nodeType === 3 && c.insertAdjacentText("beforebegin", E.data);
|
|
460
|
+
}
|
|
461
|
+
const r = U("<datadom/>").documentElement, f = (c, E = "") => ((m) => (E && m.append(L(r, E)), m))(r.ownerDocument.createElement(c)), y = B(r, "payload", i, Ae);
|
|
462
|
+
ce(y), me(y), this.innerHTML = "";
|
|
463
|
+
const h = B(r, "attributes", this.attributes, (c) => f(c.nodeName, c.value)), b = (c) => this.hasAttribute(c) || [...h.children].find((E) => E.localName === c);
|
|
464
|
+
pe(this, h), Object.keys(u).map((c) => b(c) || h.append(f(c, u[c]))), Object.keys(w).map((c) => b(c) || h.append(f(c))), B(r, "dataset", Object.keys(this.dataset), (c) => f(c, this.dataset[c]));
|
|
465
|
+
const T = B(r, "slice", x, (c) => f(c, "")), M = (c) => P(c, T);
|
|
466
|
+
this.xml = r;
|
|
467
|
+
const D = [], te = () => {
|
|
468
|
+
const c = {};
|
|
469
|
+
for (let E; E = D.pop(); ) {
|
|
470
|
+
const m = d(E.sliceElement, "slice");
|
|
471
|
+
c[m] || (re(T, m, E), c[m] = E);
|
|
472
|
+
}
|
|
473
|
+
Object.keys(c).length !== 0 && V();
|
|
474
|
+
};
|
|
475
|
+
let W;
|
|
476
|
+
this.onSlice = (c) => {
|
|
477
|
+
D.push(c), W || (W = setTimeout(() => {
|
|
478
|
+
te(), W = 0;
|
|
479
|
+
}, 1));
|
|
480
|
+
};
|
|
481
|
+
const V = this.transform = () => {
|
|
482
|
+
if (this.#e)
|
|
483
|
+
debugger;
|
|
484
|
+
this.#e = 1;
|
|
485
|
+
const c = () => {
|
|
486
|
+
n.map((A, S) => {
|
|
487
|
+
const _ = A.transformToFragment(r.ownerDocument, document);
|
|
488
|
+
return _ || console.error(`XSLT transformation error. xsl:
|
|
489
|
+
`, q(a[S]), `
|
|
490
|
+
xml:
|
|
491
|
+
`, q(r)), _;
|
|
492
|
+
}).map((A) => {
|
|
493
|
+
A && (fe(A), he(this, A.childNodes));
|
|
494
|
+
});
|
|
495
|
+
let N = 0;
|
|
496
|
+
return Object.entries(u).map(([A, S]) => {
|
|
497
|
+
!this.hasAttribute(A) && S !== d(this, A) && (this.setAttribute(A, S), this.#t(A, S), N++);
|
|
498
|
+
}), Object.keys(w).map((A) => {
|
|
499
|
+
let S = d(this.firstElementChild, A);
|
|
500
|
+
S !== d(this, A) && (this.setAttribute(A, S), this.#t(A, S), N++);
|
|
501
|
+
}), N;
|
|
502
|
+
};
|
|
503
|
+
c() && c() && console.warn("model update should not be the result of transform more than once");
|
|
504
|
+
function E(m) {
|
|
505
|
+
let N = m;
|
|
506
|
+
if (m.localName === "slice") {
|
|
507
|
+
const A = d(m, "for");
|
|
508
|
+
if (A || (N = m.parentElement), A === "^")
|
|
509
|
+
do
|
|
510
|
+
N = N.previousElementSibling;
|
|
511
|
+
while (N.localName === "slice");
|
|
512
|
+
else
|
|
513
|
+
N = this.querySelector(A);
|
|
514
|
+
if (!N)
|
|
515
|
+
return console.warn(`can not find selector in "slice for=${A}" `, m.outerHTML);
|
|
516
|
+
d(m, "slice") || m.setAttribute("slice", d(m, "name"));
|
|
517
|
+
}
|
|
518
|
+
return N;
|
|
519
|
+
}
|
|
520
|
+
z(this, "[slice],[slice-event]", (m) => {
|
|
521
|
+
let N = d(m, "slice-event");
|
|
522
|
+
const A = m.hasAttribute("slice-value") || m.hasAttribute("value") || m.value, S = E(m);
|
|
523
|
+
m.dceInitialized || (m.dceInitialized = 1, S.hasAttribute("custom-validity") && (N += " change submit"), [...new Set((N || "change").split(" "))].forEach((_) => S.addEventListener(_, (C) => {
|
|
524
|
+
C.sliceElement = m, C.sliceEventSource = C.currentTarget || C.target, C.sliceProcessed = 0;
|
|
525
|
+
const xe = re(T, d(C.sliceElement, "slice"), C);
|
|
526
|
+
z(this, "[custom-validity]", (k) => {
|
|
527
|
+
if (!k.setCustomValidity)
|
|
528
|
+
return;
|
|
529
|
+
const Z = d(k, "custom-validity");
|
|
530
|
+
try {
|
|
531
|
+
const X = Z && P(Z, h);
|
|
532
|
+
k.setCustomValidity(X === !0 ? "" : X === !1 ? "invalid" : X);
|
|
533
|
+
} catch (X) {
|
|
534
|
+
console.error(X, "xPath", Z);
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
const Y = d(S, "custom-validity"), j = Y && P(Y, h), G = j === !0 ? "" : j;
|
|
538
|
+
if (Y) {
|
|
539
|
+
if (m.setCustomValidity ? m.setCustomValidity(G) : m.validationMessage = G, xe.map((k) => k.setAttribute("validation-message", G)), C.type === "submit")
|
|
540
|
+
return j === !0 ? void 0 : (setTimeout(V, 1), !!j === j ? (j || C.preventDefault(), j) : j ? (C.preventDefault(), !1) : void 0);
|
|
541
|
+
setTimeout(V, 1);
|
|
542
|
+
}
|
|
543
|
+
this.onSlice(C);
|
|
544
|
+
})), (!N || N.includes("init")) && (A ? this.onSlice({ type: "init", target: S, sliceElement: m, sliceEventSource: S }) : m.value = M(d(m, "slice"))));
|
|
545
|
+
}), this.#e = 0;
|
|
546
|
+
};
|
|
547
|
+
V(), te();
|
|
548
|
+
}
|
|
549
|
+
#t(i, r) {
|
|
550
|
+
i === "value" && (this.value = r);
|
|
551
|
+
const f = this.xml.querySelector("attributes");
|
|
552
|
+
let y = this.xml.querySelector(`attributes>${i}`);
|
|
553
|
+
y ? F(y).append(L(y, r)) : (y = $(i, r, this.xml), f.append(y)), this.#e || f.setAttribute(i, r), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [i]: r } }));
|
|
554
|
+
}
|
|
555
|
+
attributeChangedCallback(i, r, f) {
|
|
556
|
+
!this.xml || this.#e || (this.#t(i, f), this.transform());
|
|
557
|
+
}
|
|
558
|
+
get dce() {
|
|
559
|
+
return o;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const H = (p) => {
|
|
563
|
+
window.customElements.get(p) !== O && window.customElements.define(p, O);
|
|
564
|
+
};
|
|
565
|
+
if (t)
|
|
566
|
+
H(t);
|
|
567
|
+
else {
|
|
568
|
+
const p = s;
|
|
569
|
+
this.setAttribute("tag", p), H(p);
|
|
570
|
+
const i = document.createElement(p);
|
|
571
|
+
this.getAttributeNames().forEach((r) => i.setAttribute(r, this.getAttribute(r))), i.append(...[...this.childNodes].filter((r) => r.localName !== "style")), this.append(i);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
get templateNode() {
|
|
575
|
+
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
576
|
+
}
|
|
577
|
+
get dce() {
|
|
578
|
+
return this;
|
|
579
|
+
}
|
|
580
|
+
get xslt() {
|
|
581
|
+
return U(this.xsltString);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
window.customElements.define("custom-element", je);
|
|
585
|
+
export {
|
|
586
|
+
je as C,
|
|
587
|
+
q as a,
|
|
588
|
+
ve as b,
|
|
589
|
+
ne as c,
|
|
590
|
+
Ee as d,
|
|
591
|
+
Ne as e,
|
|
592
|
+
we as f,
|
|
593
|
+
re as g,
|
|
594
|
+
pe as h,
|
|
595
|
+
fe as i,
|
|
596
|
+
Se as j,
|
|
597
|
+
he as k,
|
|
598
|
+
Ce as l,
|
|
599
|
+
le as m,
|
|
600
|
+
$e as n,
|
|
601
|
+
I as o,
|
|
602
|
+
Q as p,
|
|
603
|
+
P as q,
|
|
604
|
+
Le as r,
|
|
605
|
+
ae as s,
|
|
606
|
+
ie as t,
|
|
607
|
+
De as u,
|
|
608
|
+
U as x
|
|
609
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-6slVaFEs.cjs"),l=require("./http-request-DPrY7mGh.cjs"),t=require("./local-storage-78EivJ_B.cjs"),a=require("./location-element-DRB7hCwA.cjs");exports.CustomElement=e.CustomElement;exports.appendByDceId=e.appendByDceId;exports.assureSlices=e.assureSlices;exports.assureUID=e.assureUID;exports.assureUnique=e.assureUnique;exports.cloneAs=e.cloneAs;exports.createXsltFromDom=e.createXsltFromDom;exports.deepEqual=e.deepEqual;exports.default=e.CustomElement;exports.evalCurly=e.evalCurly;exports.event2slice=e.event2slice;exports.merge=e.merge;exports.mergeAttr=e.mergeAttr;exports.mix=e.mix;exports.obj2node=e.obj2node;exports.sanitizeBlankText=e.sanitizeBlankText;exports.tagUid=e.tagUid;exports.toXsl=e.toXsl;exports.xPath=e.xPath;exports.xPathDefaults=e.xPathDefaults;exports.xhrTemplate=e.xhrTemplate;exports.xml2dom=e.xml2dom;exports.xmlString=e.xmlString;exports.xslTags=e.xslTags;exports.HttpRequestElement=l.HttpRequestElement;exports.LocalStorageElement=t.LocalStorageElement;exports.localStorageSetItem=t.localStorageSetItem;exports.localStorage_clear=t.localStorage_clear;exports.localStorage_removeItem=t.localStorage_removeItem;exports.localStorage_setItem=t.localStorage_setItem;exports.LocationElement=a.LocationElement;
|