@epa-wg/custom-element-dist 0.0.24 → 0.0.26
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 +19 -21
- package/.storybook/preview-head.html +8 -0
- package/.storybook/preview.ts +13 -5
- package/README.md +4 -4
- package/bin/postinstall.sh +3 -2
- package/bin/vitest/vitest-browser-importmaps.mjs +20 -0
- package/coverage/coverage-final.json +13 -8
- package/coverage/index.html +51 -36
- 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 +493 -406
- package/coverage/src/custom-element/demo/coverage.svg +10 -0
- package/coverage/src/custom-element/demo/index.html +116 -0
- package/coverage/src/custom-element/demo/z.js/coverage.svg +10 -0
- package/coverage/src/custom-element/demo/z.js.html +112 -0
- package/coverage/src/custom-element/http-request.js.html +12 -12
- package/coverage/src/custom-element/index.html +37 -22
- 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/custom-element/module-url.js/coverage.svg +10 -0
- package/coverage/src/custom-element/module-url.js.html +181 -0
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/coverage.svg +1 -1
- package/coverage/src/mocks/handlers.ts/coverage.svg +1 -1
- package/coverage/src/mocks/handlers.ts.html +36 -12
- package/coverage/src/mocks/index.html +19 -19
- package/coverage/src/stories/attributes.test.stories.ts.html +6 -9
- 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 +22 -10
- 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 +58 -13
- 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/module-url.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/module-url.test.stories.ts.html +634 -0
- 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 +391 -0
- package/coverage/src/sum.ts.html +1 -1
- package/dist/confused.svg +1 -0
- package/dist/custom-element-CckoVsvO.cjs +53 -0
- package/dist/custom-element-b7c_7Kz4.js +485 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +3 -3
- package/dist/demo/a.html +60 -0
- package/dist/demo/b.html +13 -0
- package/dist/demo/confused.svg +38 -0
- package/dist/demo/data-slices.html +216 -0
- package/dist/demo/dce-social-preview.png +0 -0
- package/dist/demo/demo.css +26 -0
- package/dist/demo/dom-merge.html +123 -0
- package/dist/demo/embed-1.html +2 -0
- package/dist/demo/external-template.html +239 -0
- package/dist/demo/form.html +239 -0
- package/dist/demo/hex-grid-dce.html +183 -0
- package/dist/demo/hex-grid-transform.png +0 -0
- package/dist/demo/hex-grid.html +66 -0
- package/dist/demo/html-template.html +126 -0
- package/dist/demo/html-template.xhtml +45 -0
- package/dist/demo/html-template.xml +45 -0
- package/dist/demo/http-request.html +143 -0
- package/dist/demo/lib-dir/Smiley.svg +24 -0
- package/dist/demo/lib-dir/embed-lib.html +34 -0
- package/dist/demo/local-storage.html +218 -0
- package/dist/demo/location-element.html +168 -0
- package/dist/demo/logo.png +0 -0
- package/dist/demo/module-url.html +215 -0
- package/dist/demo/npm-versions-demo.html +105 -0
- package/dist/demo/npm-versions.html +65 -0
- package/dist/demo/parameters.html +70 -0
- package/dist/demo/s.xml +28 -0
- package/dist/demo/s.xslt +97 -0
- package/dist/demo/s1.xslt +60 -0
- package/dist/demo/scoped-css.html +169 -0
- package/dist/demo/set-url.html +141 -0
- package/dist/demo/ss.html +57 -0
- package/dist/demo/table.xml +25 -0
- package/dist/demo/table.xsl +293 -0
- package/dist/demo/template.xsl +46 -0
- package/dist/demo/tree.xml +25 -0
- package/dist/demo/tree.xsl +33 -0
- package/dist/demo/wc-square.svg +1 -0
- package/dist/demo/xhtml-template.xhtml +45 -0
- package/dist/demo/z.html +62 -0
- package/dist/demo/z.js +9 -0
- package/dist/demo/z.xml +60 -0
- package/dist/embed-1.html +1 -2
- package/dist/location-element-DRB7hCwA.cjs +1 -0
- package/dist/location-element-FJlONi2n.js +65 -0
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +93 -93
- package/public/confused.svg +1 -0
- package/public/demo/a.html +60 -0
- package/public/demo/b.html +13 -0
- package/public/demo/confused.svg +38 -0
- package/public/demo/data-slices.html +216 -0
- package/public/demo/dce-social-preview.png +0 -0
- package/public/demo/demo.css +26 -0
- package/public/demo/dom-merge.html +123 -0
- package/public/demo/embed-1.html +2 -0
- package/public/demo/external-template.html +239 -0
- package/public/demo/form.html +239 -0
- package/public/demo/hex-grid-dce.html +183 -0
- package/public/demo/hex-grid-transform.png +0 -0
- package/public/demo/hex-grid.html +66 -0
- package/public/demo/html-template.html +126 -0
- package/public/demo/html-template.xhtml +45 -0
- package/public/demo/html-template.xml +45 -0
- package/public/demo/http-request.html +143 -0
- package/public/demo/lib-dir/Smiley.svg +24 -0
- package/public/demo/lib-dir/embed-lib.html +34 -0
- package/public/demo/local-storage.html +218 -0
- package/public/demo/location-element.html +168 -0
- package/public/demo/logo.png +0 -0
- package/public/demo/module-url.html +215 -0
- package/public/demo/npm-versions-demo.html +105 -0
- package/public/demo/npm-versions.html +65 -0
- package/public/demo/parameters.html +70 -0
- package/public/demo/s.xml +28 -0
- package/public/demo/s.xslt +97 -0
- package/public/demo/s1.xslt +60 -0
- package/public/demo/scoped-css.html +169 -0
- package/public/demo/set-url.html +141 -0
- package/public/demo/ss.html +57 -0
- package/public/demo/table.xml +25 -0
- package/public/demo/table.xsl +293 -0
- package/public/demo/template.xsl +46 -0
- package/public/demo/tree.xml +25 -0
- package/public/demo/tree.xsl +33 -0
- package/public/demo/wc-square.svg +1 -0
- package/public/demo/xhtml-template.xhtml +45 -0
- package/public/demo/z.html +62 -0
- package/public/demo/z.js +9 -0
- package/public/demo/z.xml +60 -0
- package/public/embed-1.html +1 -2
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.js +52 -23
- package/src/custom-element/demo/confused.svg +1 -0
- package/src/custom-element/demo/demo.css +5 -1
- package/src/custom-element/demo/embed-1.html +1 -2
- package/src/custom-element/demo/external-template.html +122 -62
- package/src/custom-element/demo/lib-dir/Smiley.svg +24 -0
- package/src/custom-element/demo/lib-dir/embed-lib.html +34 -0
- package/src/custom-element/demo/location-element.html +17 -4
- package/src/custom-element/demo/module-url.html +215 -0
- package/src/custom-element/demo/npm-versions-demo.html +105 -0
- package/src/custom-element/demo/npm-versions.html +65 -0
- package/src/custom-element/demo/s.xml +27 -10
- package/src/custom-element/demo/s.xslt +96 -59
- package/src/custom-element/demo/set-url.html +141 -0
- package/src/custom-element/demo/z.js +9 -0
- package/src/custom-element/ide/customData-dce.json +215 -125
- package/src/custom-element/ide/web-types-dce.json +184 -116
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +3 -1
- package/src/custom-element/location-element.js +25 -2
- package/src/custom-element/module-url.js +33 -0
- package/src/custom-element.test.ts +26 -26
- package/src/mocks/handlers.ts +10 -1
- package/src/mocks/versions.mock.ts +786 -0
- package/src/stories/attributes.test.stories.ts +0 -1
- package/src/stories/external-template.test.stories.ts +11 -7
- package/src/stories/module-url.test.stories.ts +183 -0
- package/src/stories/set-url.test.stories.ts +114 -0
- package/src/stories/version-select.test.stories.ts +102 -0
- package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +1 -0
- package/storybook-static/assets/{Configure-CyLVkwlf.js → Configure-DFL_bm2M.js} +2 -2
- package/storybook-static/assets/DocsRenderer-PKQXORMH-Bz-_1hmS.js +2 -0
- package/storybook-static/assets/{attributes.test.stories-BckCcyrF.js → attributes.test.stories-DIQXccHc.js} +2 -3
- package/storybook-static/assets/{css.test.stories-B-QcObCF.js → css.test.stories-BV2hi4CY.js} +1 -1
- package/storybook-static/assets/custom-element-wn23PUwN.js +231 -0
- package/storybook-static/assets/{dom-merge.test.stories-CjXhjTQY.js → dom-merge.test.stories-Dws0C2-g.js} +1 -1
- package/storybook-static/assets/{entry-preview-DrgzXgwT.js → entry-preview-BKQ8UCxI.js} +1 -1
- package/storybook-static/assets/{entry-preview-docs-Bxv0qQWs.js → entry-preview-docs-BMKNVQXA.js} +2 -2
- package/storybook-static/assets/{external-template.test.stories-BBqyi0az.js → external-template.test.stories-BHO48b0j.js} +19 -16
- package/storybook-static/assets/{form.test.stories-DsIo1B4n.js → form.test.stories-dv9mwp24.js} +1 -1
- package/storybook-static/assets/handlers-CaCq2ZPF.js +467 -0
- package/storybook-static/assets/http-request-DNq59pnj.js +1 -0
- package/storybook-static/assets/http-request.stories-B2ke7LtS.js +281 -0
- package/storybook-static/assets/iframe-D4Sos1HO.js +2 -0
- package/storybook-static/assets/index-BnXBQqj9.js +605 -0
- package/storybook-static/assets/index-C8k3Z-3Y.js +28 -0
- package/storybook-static/assets/index-Cpxqn5iQ.js +1 -0
- package/storybook-static/assets/{index-DXimoRZY.js → index-D-8MO0q_.js} +1 -1
- package/storybook-static/assets/index-DGdNYaqV.js +8 -0
- package/storybook-static/assets/index-Dz4OaB2k.js +1 -0
- package/storybook-static/assets/index-sm7QlJZE.js +1 -0
- package/storybook-static/assets/lit-element-DzhCn-8W.js +19 -0
- package/storybook-static/assets/{local-storage.test.stories-Cs2v3QTS.js → local-storage.test.stories-BpogLNq-.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-BiFvBop7.js} +9 -9
- package/storybook-static/assets/module-url.test.stories-BXoM34tX.js +208 -0
- package/storybook-static/assets/{preview-BKCN0mOr.js → preview-0Jj89qip.js} +1 -1
- package/storybook-static/assets/{preview-TCN6m6T-.js → preview-BJPLiuSt.js} +1 -1
- package/storybook-static/assets/{preview-BDY5ThwJ.js → preview-BMWqy4Bi.js} +1 -1
- package/storybook-static/assets/preview-BnWGZYux.js +1 -0
- package/storybook-static/assets/preview-Cg7hXPRq.js +2 -0
- package/storybook-static/assets/{preview-BAz7FMXc.js → preview-DB9FwMii.js} +1 -1
- package/storybook-static/assets/preview-Djh1_Tal.js +20 -0
- package/storybook-static/assets/{preview-DRnyIGXK.js → preview-oHxXRSIu.js} +15 -15
- package/storybook-static/assets/set-url.test.stories-Cg5Z0r7x.js +81 -0
- package/storybook-static/assets/{slice-events.test.stories-BRBBc0JT.js → slice-events.test.stories-D_ttGp3g.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-r-i91k3y.js → slots.test.stories-DBNXOm0T.js} +1 -1
- package/storybook-static/assets/version-select.test.stories-CgV3UCim.js +109 -0
- package/storybook-static/confused.svg +1 -0
- package/storybook-static/demo/a.html +60 -0
- package/storybook-static/demo/b.html +13 -0
- package/storybook-static/demo/confused.svg +38 -0
- package/storybook-static/demo/data-slices.html +216 -0
- package/storybook-static/demo/dce-social-preview.png +0 -0
- package/storybook-static/demo/demo.css +26 -0
- package/storybook-static/demo/dom-merge.html +123 -0
- package/storybook-static/demo/embed-1.html +2 -0
- package/storybook-static/demo/external-template.html +239 -0
- package/storybook-static/demo/form.html +239 -0
- package/storybook-static/demo/hex-grid-dce.html +183 -0
- package/storybook-static/demo/hex-grid-transform.png +0 -0
- package/storybook-static/demo/hex-grid.html +66 -0
- package/storybook-static/demo/html-template.html +126 -0
- package/storybook-static/demo/html-template.xhtml +45 -0
- package/storybook-static/demo/html-template.xml +45 -0
- package/storybook-static/demo/http-request.html +143 -0
- package/storybook-static/demo/lib-dir/Smiley.svg +24 -0
- package/storybook-static/demo/lib-dir/embed-lib.html +34 -0
- package/storybook-static/demo/local-storage.html +218 -0
- package/storybook-static/demo/location-element.html +168 -0
- package/storybook-static/demo/logo.png +0 -0
- package/storybook-static/demo/module-url.html +215 -0
- package/storybook-static/demo/npm-versions-demo.html +105 -0
- package/storybook-static/demo/npm-versions.html +65 -0
- package/storybook-static/demo/parameters.html +70 -0
- package/storybook-static/demo/s.xml +28 -0
- package/storybook-static/demo/s.xslt +97 -0
- package/storybook-static/demo/s1.xslt +60 -0
- package/storybook-static/demo/scoped-css.html +169 -0
- package/storybook-static/demo/set-url.html +141 -0
- package/storybook-static/demo/ss.html +57 -0
- package/storybook-static/demo/table.xml +25 -0
- package/storybook-static/demo/table.xsl +293 -0
- package/storybook-static/demo/template.xsl +46 -0
- package/storybook-static/demo/tree.xml +25 -0
- package/storybook-static/demo/tree.xsl +33 -0
- package/storybook-static/demo/wc-square.svg +1 -0
- package/storybook-static/demo/xhtml-template.xhtml +45 -0
- package/storybook-static/demo/z.html +62 -0
- package/storybook-static/demo/z.js +9 -0
- package/storybook-static/demo/z.xml +60 -0
- package/storybook-static/embed-1.html +1 -2
- package/storybook-static/favicon.svg +1 -7
- package/storybook-static/iframe.html +42 -30
- package/storybook-static/index.html +36 -18
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +32 -32
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +395 -43
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -18
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js +221 -22
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-manager/globals-module-info.js +995 -1
- package/storybook-static/sb-manager/globals-runtime.js +53525 -1
- package/storybook-static/sb-manager/globals.js +48 -1
- package/storybook-static/sb-manager/runtime.js +11884 -1
- package/storybook-static/sb-preview/globals.js +33 -1
- package/storybook-static/sb-preview/runtime.js +9437 -108
- package/vite.config.js +2 -1
- package/dist/custom-element-BDK7dcJN.cjs +0 -53
- package/dist/custom-element-DqtzLkTG.js +0 -471
- package/dist/location-element-2m0gWq_d.cjs +0 -1
- package/dist/location-element-nA_wsqBt.js +0 -49
- package/storybook-static/assets/Color-PRSJMWNM-y4ZsI1hY.js +0 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-VRGUwRrq.js +0 -2
- package/storybook-static/assets/WithTooltip-KJL26V4Q-xdXH9Ztt.js +0 -1
- package/storybook-static/assets/custom-element-BIxkVg7K.js +0 -219
- package/storybook-static/assets/formatter-2WMMO6ZP-CThVcQxM.js +0 -58
- package/storybook-static/assets/http-request.stories-sXA_Y-VM.js +0 -300
- package/storybook-static/assets/iframe-DcDTQOmA.js +0 -2
- package/storybook-static/assets/index-CUFHd5VD.js +0 -1
- package/storybook-static/assets/index-CVRyq5ci.js +0 -27
- package/storybook-static/assets/index-Cc7K62zD.js +0 -3
- package/storybook-static/assets/index-DPPi9iZu.js +0 -548
- package/storybook-static/assets/index-DuIEV_9C.js +0 -13
- package/storybook-static/assets/index-VWixWKZ7.js +0 -1
- package/storybook-static/assets/lit-element-CenEXOuS.js +0 -19
- package/storybook-static/assets/preview-B4GcaC1c.js +0 -1
- package/storybook-static/assets/preview-B63p-W8V.js +0 -20
- package/storybook-static/assets/preview-p-Bwze-K.js +0 -2
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-OnioRcs9.js +0 -1
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
- package/storybook-static/sb-common-assets/fonts.css +0 -31
- package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +0 -1
- package/storybook-static/sb-manager/chunk-B3YDJJJH.js +0 -347
- package/storybook-static/sb-manager/chunk-BLWCBWKL.js +0 -9
- package/storybook-static/sb-manager/chunk-GUVK2GTO.js +0 -6
- package/storybook-static/sb-manager/chunk-LFRML3ZV.js +0 -186
- package/storybook-static/sb-manager/chunk-MC7RAF2B.js +0 -274
- package/storybook-static/sb-manager/chunk-ZR5JZWHI.js +0 -1
- package/storybook-static/sb-manager/formatter-2WMMO6ZP-JI7RHVTW.js +0 -58
- package/storybook-static/sb-manager/index.js +0 -1
- package/storybook-static/sb-manager/syntaxhighlighter-BP7B2CQK-WOJYHKQR.js +0 -1
- /package/storybook-static/sb-addons/{storybook-core-server-presets-0 → storybook-core-core-server-presets-0}/common-manager-bundle.js.LEGAL.txt +0 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, oe = (e) => typeof e == "string", re = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
|
+
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
|
+
return e;
|
|
4
|
+
}, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", q), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), N = (e, l = "", t = document) => {
|
|
5
|
+
const s = (n) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(n));
|
|
6
|
+
if (te(e))
|
|
7
|
+
return s(e);
|
|
8
|
+
const a = s("dce-object");
|
|
9
|
+
return a.setAttribute("dce-object-name", e), a;
|
|
10
|
+
}, G = (e, l) => {
|
|
11
|
+
const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
|
|
12
|
+
for (let s of e.attributes)
|
|
13
|
+
t.setAttribute(s.name, s.value);
|
|
14
|
+
for (; e.firstChild; )
|
|
15
|
+
t.append(e.firstChild);
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
function M(e) {
|
|
19
|
+
return new DOMParser().parseFromString(e, "application/xml");
|
|
20
|
+
}
|
|
21
|
+
function H(e) {
|
|
22
|
+
return new XMLSerializer().serializeToString(e);
|
|
23
|
+
}
|
|
24
|
+
function X(e, l, t, s) {
|
|
25
|
+
const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, u) => (p.append(u = a(h)), u))(l, e);
|
|
26
|
+
return [...t].forEach((h) => r.append(s(h))), r;
|
|
27
|
+
}
|
|
28
|
+
function ce(e) {
|
|
29
|
+
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
30
|
+
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
|
+
}
|
|
32
|
+
function $(e, l, t) {
|
|
33
|
+
const s = typeof e;
|
|
34
|
+
if (s === "string")
|
|
35
|
+
return N(l, e, t);
|
|
36
|
+
if (s === "number")
|
|
37
|
+
return N(l, "" + e, t);
|
|
38
|
+
if (e instanceof Array) {
|
|
39
|
+
const n = N("array", "", t);
|
|
40
|
+
return e.map((r) => n.append($(r, l, t))), n;
|
|
41
|
+
}
|
|
42
|
+
if (e instanceof FormData) {
|
|
43
|
+
const n = N("form-data", "", t);
|
|
44
|
+
for (const r of e)
|
|
45
|
+
n.append($(r[1], r[0], t));
|
|
46
|
+
return n;
|
|
47
|
+
}
|
|
48
|
+
const a = N(l, "", t);
|
|
49
|
+
for (let n in e)
|
|
50
|
+
re(e[n]) || typeof e[n] == "function" || e[n] instanceof Window || (typeof e[n] != "object" && te(n) ? a.setAttribute(n, e[n]) : a.append($(e[n], n, t)));
|
|
51
|
+
return a;
|
|
52
|
+
}
|
|
53
|
+
function Z(e) {
|
|
54
|
+
if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
55
|
+
const s = t.data, a = s.matchAll(/{([^}]*)}/g);
|
|
56
|
+
if (a) {
|
|
57
|
+
let n = 0, r = (p) => S(t, p), h = [];
|
|
58
|
+
if ([...a].forEach((p) => {
|
|
59
|
+
p.index > n && h.push(r(p.input.substring(n, p.index)));
|
|
60
|
+
const u = e.querySelector("value-of").cloneNode();
|
|
61
|
+
u.setAttribute("select", p[1]), h.push(u), n = p.index + p[0].length;
|
|
62
|
+
}), n < s.length && h.push(r(s.substring(n, s.length))), h.length) {
|
|
63
|
+
for (let p of h)
|
|
64
|
+
l.insertBefore(p, t);
|
|
65
|
+
l.removeChild(t);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})), "all" in e) {
|
|
69
|
+
let l = 1;
|
|
70
|
+
for (let t of e.all)
|
|
71
|
+
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
72
|
+
}
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
function me(e, l = "xsl:stylesheet") {
|
|
76
|
+
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
77
|
+
return Z(e);
|
|
78
|
+
const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${q}" xmlns:exsl="${ie}" exclude-result-prefixes="exsl" >
|
|
79
|
+
<xsl:output method="xml" />
|
|
80
|
+
<xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
|
|
81
|
+
<xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
82
|
+
<xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
83
|
+
<xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
|
|
84
|
+
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]"><xsl:copy><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:copy></xsl:template>
|
|
85
|
+
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="@*"/><xsl:value-of select="text()"></xsl:value-of></xsl:element></xsl:template>
|
|
86
|
+
<xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
|
|
87
|
+
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
88
|
+
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
89
|
+
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']"><dce-text><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></dce-text></xsl:template>
|
|
90
|
+
<xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
|
|
91
|
+
</xsl:stylesheet>`), s = new XSLTProcessor(), a = ((i) => {
|
|
92
|
+
C(i, "script", (y) => y.remove());
|
|
93
|
+
const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
|
|
94
|
+
ve.forEach((y) => C(c, y, (v) => ge(v, c)));
|
|
95
|
+
const E = i.firstElementChild?.content || i.content, g = (y) => {
|
|
96
|
+
const v = M("<xhtml/>"), D = v.importNode(y, !0);
|
|
97
|
+
return v.replaceChild(D, v.documentElement), ee(D);
|
|
98
|
+
};
|
|
99
|
+
if (E) {
|
|
100
|
+
const y = N("div");
|
|
101
|
+
return [...E.childNodes].map((v) => y.append(v.cloneNode(!0))), g(y);
|
|
102
|
+
}
|
|
103
|
+
return g(i.documentElement || i.body || i);
|
|
104
|
+
})(e), n = M(
|
|
105
|
+
`<xsl:stylesheet version="1.0"
|
|
106
|
+
xmlns:xsl="${B}"
|
|
107
|
+
xmlns:xhtml="${q}"
|
|
108
|
+
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
109
|
+
xmlns:exsl="http://exslt.org/common"
|
|
110
|
+
exclude-result-prefixes="exsl"
|
|
111
|
+
>
|
|
112
|
+
<xsl:template match="ignore">
|
|
113
|
+
<xsl:choose>
|
|
114
|
+
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
115
|
+
<xsl:otherwise>{def}</xsl:otherwise>
|
|
116
|
+
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
117
|
+
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
118
|
+
<xsl:template match="/">
|
|
119
|
+
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
120
|
+
</xsl:template>
|
|
121
|
+
<xsl:template name="slot" >
|
|
122
|
+
<xsl:param name="slotname" />
|
|
123
|
+
<xsl:param name="defaultvalue" />
|
|
124
|
+
<xsl:choose>
|
|
125
|
+
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
126
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
127
|
+
</xsl:when>
|
|
128
|
+
<xsl:otherwise>
|
|
129
|
+
<xsl:copy-of select="$defaultvalue"/>
|
|
130
|
+
</xsl:otherwise>
|
|
131
|
+
</xsl:choose>
|
|
132
|
+
</xsl:template>
|
|
133
|
+
<xsl:variable name="js-injected-body">
|
|
134
|
+
<xsl:call-template name="slot" >
|
|
135
|
+
<xsl:with-param name="slotname" select="''"/>
|
|
136
|
+
<xsl:with-param name="defaultvalue"/>
|
|
137
|
+
</xsl:call-template>
|
|
138
|
+
</xsl:variable>
|
|
139
|
+
</xsl:stylesheet>`
|
|
140
|
+
);
|
|
141
|
+
s.importStylesheet(t);
|
|
142
|
+
const r = s.transformToFragment(a, document), h = (i, c) => i.querySelector(c), p = h(n, 'template[mode="payload"]');
|
|
143
|
+
if (!r)
|
|
144
|
+
return console.error("transformation error", { xml: a.outerHTML, xsl: H(t) });
|
|
145
|
+
const u = [];
|
|
146
|
+
[...r.querySelectorAll("dce-root>attribute")].forEach((i) => {
|
|
147
|
+
const c = G(i, "xsl:param"), E = x(i, "name");
|
|
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 y;
|
|
152
|
+
if (g?.length > 1) {
|
|
153
|
+
c.removeAttribute("select");
|
|
154
|
+
const v = h(n, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
155
|
+
U(v.firstElementChild).append(S(v, "{" + g[0] + "}")), U(v.lastElementChild).append(S(v, "{" + g[1] + "}")), v.firstElementChild.setAttribute("test", g[0]), c.append(v), y = v.cloneNode(!0);
|
|
156
|
+
} else
|
|
157
|
+
y = G(i, "xsl:value-of");
|
|
158
|
+
y.removeAttribute("name"), i.append(y), i.removeAttribute("select"), u.push(c);
|
|
159
|
+
}), [...r.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
|
|
160
|
+
const c = x(i, "value");
|
|
161
|
+
c && i.setAttribute("value", ye(c));
|
|
162
|
+
});
|
|
163
|
+
for (const i of r.childNodes)
|
|
164
|
+
p.append(n.importNode(i, !0));
|
|
165
|
+
[...p.getElementsByTagName("xsl:template")].forEach((i) => p.ownerDocument.documentElement.append(i));
|
|
166
|
+
const P = h(n, 'call-template[name="slot"]'), d = (i) => {
|
|
167
|
+
const c = P.cloneNode(!0), E = x(i, "name");
|
|
168
|
+
E && c.firstElementChild.setAttribute("select", `'${E}'`);
|
|
169
|
+
for (let g of i.childNodes)
|
|
170
|
+
c.lastElementChild.append(g);
|
|
171
|
+
return c;
|
|
172
|
+
};
|
|
173
|
+
C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
|
|
174
|
+
const m = Z(n);
|
|
175
|
+
return m.params = u, m;
|
|
176
|
+
}
|
|
177
|
+
async function ue(e) {
|
|
178
|
+
return await new Promise((t, s) => {
|
|
179
|
+
const a = new XMLHttpRequest();
|
|
180
|
+
a.open("GET", e), a.responseType = "document", a.onload = () => {
|
|
181
|
+
a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
|
|
182
|
+
}, a.addEventListener("error", (n) => s(n)), a.send();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function de(e, l, t = !1) {
|
|
186
|
+
if (e === l)
|
|
187
|
+
return !0;
|
|
188
|
+
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
189
|
+
return t;
|
|
190
|
+
for (let s in e)
|
|
191
|
+
if (!(s in l) || !de(e[s], l[s]))
|
|
192
|
+
return t;
|
|
193
|
+
return !0;
|
|
194
|
+
}
|
|
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, a = (n) => (e.append(n), n);
|
|
197
|
+
if (t.includes("/")) {
|
|
198
|
+
const n = [], r = s.evaluate(t, e);
|
|
199
|
+
for (let h; h = r.iterateNext(); )
|
|
200
|
+
n.push(h);
|
|
201
|
+
return n;
|
|
202
|
+
}
|
|
203
|
+
return [...e.childNodes].find((n) => n.localName === t) || a(N(t, "", s));
|
|
204
|
+
}).flat();
|
|
205
|
+
function J(e, l, t, s) {
|
|
206
|
+
if (!t.sliceProcessed)
|
|
207
|
+
return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
|
|
208
|
+
const n = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
|
|
209
|
+
if (r.getAttributeNames().map((u) => a.setAttribute(u, x(r, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append($(t, "event", n)), h.hasAttribute("slice-value")) {
|
|
210
|
+
r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
|
|
211
|
+
const u = L(x(h, "slice-value"), a);
|
|
212
|
+
p(), a.append(S(n, u));
|
|
213
|
+
} else {
|
|
214
|
+
if ("elements" in r)
|
|
215
|
+
return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
|
|
216
|
+
const u = r.value ?? x(r, "value");
|
|
217
|
+
p(), u == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(u) ? a.append(S(n, u)) : a.append($(u, "value", a.ownerDocument));
|
|
218
|
+
}
|
|
219
|
+
return a;
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function C(e, l, t) {
|
|
223
|
+
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
224
|
+
}
|
|
225
|
+
const fe = async (e, l) => {
|
|
226
|
+
if (!e || !e.trim())
|
|
227
|
+
return [l];
|
|
228
|
+
if (e.startsWith("#"))
|
|
229
|
+
return ((t) => {
|
|
230
|
+
const s = t.querySelectorAll(e);
|
|
231
|
+
return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
|
|
232
|
+
})(l.parentElement);
|
|
233
|
+
try {
|
|
234
|
+
const [t, s] = e.split("#");
|
|
235
|
+
if (e.charAt(0) === ".")
|
|
236
|
+
e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
|
|
237
|
+
else
|
|
238
|
+
try {
|
|
239
|
+
e = import.meta.resolve(t), s && (e += "#" + s);
|
|
240
|
+
} catch (n) {
|
|
241
|
+
console.error(n.message);
|
|
242
|
+
}
|
|
243
|
+
const a = await ue(e);
|
|
244
|
+
if (l.setAttributeNS("xml", "base", e), s) {
|
|
245
|
+
const n = a.querySelectorAll("#" + s);
|
|
246
|
+
return n.length ? [...n] : [l];
|
|
247
|
+
}
|
|
248
|
+
return [a];
|
|
249
|
+
} catch {
|
|
250
|
+
return [l];
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
function he(e, l) {
|
|
254
|
+
for (let t of e.attributes)
|
|
255
|
+
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
256
|
+
}
|
|
257
|
+
function le(e, l = 0) {
|
|
258
|
+
const t = {};
|
|
259
|
+
for (const s of e.childNodes) {
|
|
260
|
+
const a = x(s, "data-dce-id") || s.dceId || 0;
|
|
261
|
+
if (!t[a])
|
|
262
|
+
a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
263
|
+
else {
|
|
264
|
+
const n = s.dceId = a + "-" + t[a]++;
|
|
265
|
+
s.setAttribute && s.setAttribute("data-dce-id", n);
|
|
266
|
+
}
|
|
267
|
+
s.childNodes.length && le(s);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function xe(e, l, t) {
|
|
271
|
+
t = 1 * t;
|
|
272
|
+
for (let s of e.childNodes)
|
|
273
|
+
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
274
|
+
return e.insertBefore(l, s);
|
|
275
|
+
e.append(l);
|
|
276
|
+
}
|
|
277
|
+
function ae(e, l) {
|
|
278
|
+
if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
|
|
279
|
+
return;
|
|
280
|
+
if (!l.length)
|
|
281
|
+
return e.firstElementChild?.localName !== "dce-root" && K(e);
|
|
282
|
+
const t = {};
|
|
283
|
+
for (let s of e.childNodes)
|
|
284
|
+
t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
285
|
+
for (let s of [...l]) {
|
|
286
|
+
const a = x(s, "data-dce-id") || s.dceId, n = t[a];
|
|
287
|
+
n ? (Y(s) ? n.nodeValue !== s.nodeValue && (n.nodeValue = s.nodeValue) : (he(s, n), (n.childNodes.length || s.childNodes.length) && ae(n, s.childNodes)), delete t[a]) : xe(e, s, a);
|
|
288
|
+
}
|
|
289
|
+
for (let s of Object.values(t))
|
|
290
|
+
s.localName !== "dce-root" && s.remove();
|
|
291
|
+
}
|
|
292
|
+
function be(e, l) {
|
|
293
|
+
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
294
|
+
}
|
|
295
|
+
const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
296
|
+
if (!e.trim())
|
|
297
|
+
return e;
|
|
298
|
+
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
299
|
+
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
300
|
+
}, L = (e, l) => {
|
|
301
|
+
const t = e.split("??");
|
|
302
|
+
if (t.length > 1)
|
|
303
|
+
return L(t[0], l) || L(t[1], l);
|
|
304
|
+
e = F(e);
|
|
305
|
+
const s = l.ownerDocument.evaluate(e, l);
|
|
306
|
+
switch (s.resultType) {
|
|
307
|
+
case XPathResult.NUMBER_TYPE:
|
|
308
|
+
return s.numberValue;
|
|
309
|
+
case XPathResult.STRING_TYPE:
|
|
310
|
+
return s.stringValue;
|
|
311
|
+
case XPathResult.BOOLEAN_TYPE:
|
|
312
|
+
return s.booleanValue;
|
|
313
|
+
}
|
|
314
|
+
let a = "";
|
|
315
|
+
for (let n; n = s.iterateNext(); )
|
|
316
|
+
a += n.textContent;
|
|
317
|
+
return a;
|
|
318
|
+
}, 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
|
+
const t = N("xsl:" + e.localName);
|
|
320
|
+
for (let s of e.attributes)
|
|
321
|
+
t.setAttribute(s.name, s.value);
|
|
322
|
+
for (; e.firstChild; )
|
|
323
|
+
t.append(e.firstChild);
|
|
324
|
+
if (e.parentElement)
|
|
325
|
+
e.parentElement.replaceChild(t, e);
|
|
326
|
+
else {
|
|
327
|
+
const s = e.parentElement || l, a = [...s.childNodes];
|
|
328
|
+
a.forEach((n, r) => {
|
|
329
|
+
n === e && (a[r] = t);
|
|
330
|
+
}), s.replaceChildren(...a);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
class Ee extends HTMLElement {
|
|
334
|
+
static observedAttributes = ["src", "tag", "hidden"];
|
|
335
|
+
async connectedCallback() {
|
|
336
|
+
const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
337
|
+
for (const d of l)
|
|
338
|
+
C(d.templateNode || d.content || d, "style", (m) => {
|
|
339
|
+
const i = m.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
|
|
340
|
+
m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
|
|
341
|
+
});
|
|
342
|
+
const a = l.map((d) => me(d)), n = a.map((d, m) => (m = new XSLTProcessor(), m.importStylesheet(d), m));
|
|
343
|
+
Object.defineProperty(this, "xsltString", { get: () => a.map((d) => H(d)).join(`
|
|
344
|
+
`) });
|
|
345
|
+
const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, i) => i.indexOf(d) === m).map(se).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
|
|
346
|
+
class w extends HTMLElement {
|
|
347
|
+
static get observedAttributes() {
|
|
348
|
+
return u.map((m) => x(m, "name"));
|
|
349
|
+
}
|
|
350
|
+
#e = 0;
|
|
351
|
+
connectedCallback() {
|
|
352
|
+
let m = this.childNodes;
|
|
353
|
+
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
354
|
+
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
355
|
+
const f = this.firstElementChild;
|
|
356
|
+
f.remove(), m = f.content.childNodes;
|
|
357
|
+
for (const o of [...f.content.childNodes])
|
|
358
|
+
if (o.localName === "style") {
|
|
359
|
+
const b = be(this, "data-dce-style");
|
|
360
|
+
o.innerHTML = `${s}[data-dce-style="${b}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
|
|
361
|
+
} else
|
|
362
|
+
o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
|
|
363
|
+
}
|
|
364
|
+
const i = M("<datadom/>").documentElement, c = (f, o = "") => ((b) => (o && b.append(S(i, o)), b))(i.ownerDocument.createElement(f)), E = X(i, "payload", m, ce);
|
|
365
|
+
Q(E), ee(E), this.innerHTML = "";
|
|
366
|
+
const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
|
|
367
|
+
X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
|
|
368
|
+
const y = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, y);
|
|
369
|
+
this.xml = i;
|
|
370
|
+
const D = [], W = () => {
|
|
371
|
+
const f = {};
|
|
372
|
+
for (let o; o = D.pop(); ) {
|
|
373
|
+
const b = x(o.sliceElement, "slice");
|
|
374
|
+
f[b] || (J(y, b, o), f[b] = o);
|
|
375
|
+
}
|
|
376
|
+
Object.keys(f).length !== 0 && R();
|
|
377
|
+
};
|
|
378
|
+
let V;
|
|
379
|
+
this.onSlice = (f) => {
|
|
380
|
+
D.push(f), V || (V = setTimeout(() => {
|
|
381
|
+
W(), V = 0;
|
|
382
|
+
}, 1));
|
|
383
|
+
};
|
|
384
|
+
const R = this.transform = () => {
|
|
385
|
+
if (this.#e)
|
|
386
|
+
debugger;
|
|
387
|
+
this.#e = 1, n.map((o, b) => {
|
|
388
|
+
const I = o.transformToFragment(i.ownerDocument, document);
|
|
389
|
+
return I || console.error(`XSLT transformation error. xsl:
|
|
390
|
+
`, H(a[b]), `
|
|
391
|
+
xml:
|
|
392
|
+
`, H(i)), I;
|
|
393
|
+
}).map((o) => {
|
|
394
|
+
o && (le(o), ae(this, o.childNodes));
|
|
395
|
+
}), w.observedAttributes.map((o) => {
|
|
396
|
+
let b = x(this.firstElementChild, o);
|
|
397
|
+
b !== x(this, o) && (this.setAttribute(o, b), this.#t(o, b));
|
|
398
|
+
}), C(this, "[slice],[slice-event]", (o) => {
|
|
399
|
+
if (!o.dceInitialized) {
|
|
400
|
+
o.dceInitialized = 1;
|
|
401
|
+
let b = x(o, "slice-event");
|
|
402
|
+
o.hasAttribute("custom-validity") && (b += " change submit"), [...new Set((b || "change").split(" "))].forEach((I) => (o.localName === "slice" ? o.parentElement : o).addEventListener(I, (A) => {
|
|
403
|
+
A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
|
|
404
|
+
const ne = J(y, x(A.sliceElement, "slice"), A);
|
|
405
|
+
C(this, "[custom-validity]", (z) => {
|
|
406
|
+
if (!z.setCustomValidity)
|
|
407
|
+
return;
|
|
408
|
+
const _ = x(z, "custom-validity");
|
|
409
|
+
try {
|
|
410
|
+
const j = _ && L(_, g);
|
|
411
|
+
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
412
|
+
} catch (j) {
|
|
413
|
+
console.error(j, "xPath", _);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
const k = x(o, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
|
|
417
|
+
if (k) {
|
|
418
|
+
if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
419
|
+
return T === !0 ? void 0 : (setTimeout(R, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
420
|
+
setTimeout(R, 1);
|
|
421
|
+
}
|
|
422
|
+
this.onSlice(A);
|
|
423
|
+
})), (!b || b.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = v(x(o, "slice")));
|
|
424
|
+
}
|
|
425
|
+
}), this.#e = 0;
|
|
426
|
+
};
|
|
427
|
+
R(), W();
|
|
428
|
+
}
|
|
429
|
+
#t(m, i) {
|
|
430
|
+
m === "value" && (this.value = i);
|
|
431
|
+
let c = this.xml.querySelector(`attributes>${m}`);
|
|
432
|
+
c ? U(c).append(S(c, i)) : (c = N(m, i, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: i } }));
|
|
433
|
+
}
|
|
434
|
+
attributeChangedCallback(m, i, c) {
|
|
435
|
+
!this.xml || this.#e || (this.#t(m, c), this.transform());
|
|
436
|
+
}
|
|
437
|
+
get dce() {
|
|
438
|
+
return r;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
const P = (d) => {
|
|
442
|
+
window.customElements.get(d) !== w && window.customElements.define(d, w);
|
|
443
|
+
};
|
|
444
|
+
if (t)
|
|
445
|
+
P(t);
|
|
446
|
+
else {
|
|
447
|
+
const d = s;
|
|
448
|
+
this.setAttribute("tag", d), P(d);
|
|
449
|
+
const m = document.createElement(d);
|
|
450
|
+
this.getAttributeNames().forEach((i) => m.setAttribute(i, this.getAttribute(i))), m.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(m);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
get templateNode() {
|
|
454
|
+
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
455
|
+
}
|
|
456
|
+
get dce() {
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
get xslt() {
|
|
460
|
+
return M(this.xsltString);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
window.customElements.define("custom-element", Ee);
|
|
464
|
+
export {
|
|
465
|
+
Ee as C,
|
|
466
|
+
H as a,
|
|
467
|
+
ue as b,
|
|
468
|
+
me as c,
|
|
469
|
+
de as d,
|
|
470
|
+
pe as e,
|
|
471
|
+
J as f,
|
|
472
|
+
le as g,
|
|
473
|
+
xe as h,
|
|
474
|
+
ae as i,
|
|
475
|
+
be as j,
|
|
476
|
+
ye as k,
|
|
477
|
+
F as l,
|
|
478
|
+
he as m,
|
|
479
|
+
L as n,
|
|
480
|
+
$ as o,
|
|
481
|
+
ve as p,
|
|
482
|
+
ge as q,
|
|
483
|
+
Z as t,
|
|
484
|
+
M as x
|
|
485
|
+
};
|
|
@@ -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-CckoVsvO.cjs"),l=require("./http-request-DPrY7mGh.cjs"),t=require("./local-storage-Boafngui.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.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.obj2node=e.obj2node;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.LocationElement=a.LocationElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as e } from "./custom-element-
|
|
2
|
-
import { h as o, e as r, j as l, g as m, c as p, d as x, k as n, f as u, i as c, m as d, o as f, t as g, q as i, n as E, l as S, b as h, x as q, a as D, p as L } from "./custom-element-
|
|
1
|
+
import { C as e } from "./custom-element-b7c_7Kz4.js";
|
|
2
|
+
import { h as o, e as r, j as l, g as m, c as p, d as x, k as n, f as u, i as c, m as d, o as f, t as g, q as i, n as E, l as S, b as h, x as q, a as D, p as L } from "./custom-element-b7c_7Kz4.js";
|
|
3
3
|
import { H as I } from "./http-request-BOvP4KTl.js";
|
|
4
4
|
import { L as b, l as j } from "./local-storage-BqDEu2kF.js";
|
|
5
|
-
import { L as y } from "./location-element-
|
|
5
|
+
import { L as y } from "./location-element-FJlONi2n.js";
|
|
6
6
|
export {
|
|
7
7
|
e as CustomElement,
|
|
8
8
|
I as HttpRequestElement,
|
package/dist/demo/a.html
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Data slices - Declarative Custom Element implementation demo</title>
|
|
6
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
7
|
+
|
|
8
|
+
<script type="module" src="../http-request.js"></script>
|
|
9
|
+
<script type="module" src="../custom-element.js"></script>
|
|
10
|
+
<style>
|
|
11
|
+
@import "./demo.css";
|
|
12
|
+
|
|
13
|
+
label {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
label:has(input[type="text"],input[type="password"],input:not([type]) ) {
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
nav {
|
|
22
|
+
max-width: 32em;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
<!-- https://github.com/mdn/learning-area/blob/main/html/forms/form-validation/custom-error-message.html
|
|
26
|
+
todo: apply setCustomValidity( warningStr )
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
|
|
32
|
+
<fieldset>
|
|
33
|
+
<legend><b style="color:green">green</b> in instance style can be overridden in payload as <i
|
|
34
|
+
style="color:red">red</i> in 1st instance
|
|
35
|
+
</legend>
|
|
36
|
+
<custom-element tag="dce-3">
|
|
37
|
+
<template>
|
|
38
|
+
<u>
|
|
39
|
+
<slot>is green</slot>
|
|
40
|
+
</u>
|
|
41
|
+
</template>
|
|
42
|
+
<style>dce-3 {
|
|
43
|
+
color: green
|
|
44
|
+
}</style>
|
|
45
|
+
</custom-element>
|
|
46
|
+
<u>should be</u> <i style="color:red">red</i>:
|
|
47
|
+
<dce-3 id="dce32">
|
|
48
|
+
<template>
|
|
49
|
+
<style> color:red; </style>
|
|
50
|
+
<u>red</u>
|
|
51
|
+
</template>
|
|
52
|
+
</dce-3> <br/>
|
|
53
|
+
should be GREEN:
|
|
54
|
+
<dce-3 id="dce31">green</dce-3>
|
|
55
|
+
</fieldset>
|
|
56
|
+
|
|
57
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
58
|
+
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|
package/dist/demo/b.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<dce-root data-dce-id="1" xmlns="http://www.w3.org/1999/xhtml" xmlns:dce="urn:schemas-epa-wg:dce"
|
|
3
|
+
xmlns:xhtml="http://www.w3.org/1999/xhtml"><u data-dce-id="2" xmlns="">
|
|
4
|
+
<dce-text data-dce-id="3">
|
|
5
|
+
<xhtml:span xmlns:xsl="http://www.w3.org/1999/XSL/Transform" slot=""/>
|
|
6
|
+
<xhtml:style xmlns:xsl="http://www.w3.org/1999/XSL/Transform" slot="" title="ABC">
|
|
7
|
+
dce-3[data-dce-style="54f96d52-ce70-435d-83c4-b421357d9a17"]{ color:red; }
|
|
8
|
+
</xhtml:style>
|
|
9
|
+
<xhtml:span xmlns:xsl="http://www.w3.org/1999/XSL/Transform" slot=""/>
|
|
10
|
+
<xhtml:u xmlns:xsl="http://www.w3.org/1999/XSL/Transform" slot="">red</xhtml:u>
|
|
11
|
+
<xhtml:span xmlns:xsl="http://www.w3.org/1999/XSL/Transform" slot=""/>
|
|
12
|
+
</dce-text>
|
|
13
|
+
</u></dce-root>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.0">
|
|
3
|
+
<title>Confused</title>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="d">
|
|
6
|
+
<stop offset="0"/>
|
|
7
|
+
<stop offset=".5"/>
|
|
8
|
+
<stop offset=".80000001" stop-opacity=".46666667"/>
|
|
9
|
+
<stop offset="1" stop-opacity="0"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
<linearGradient id="a">
|
|
12
|
+
<stop offset="0" stop-color="#fb0"/>
|
|
13
|
+
<stop offset=".5" stop-color="#e29d00"/>
|
|
14
|
+
<stop offset="1" stop-color="#fb0"/>
|
|
15
|
+
</linearGradient>
|
|
16
|
+
<linearGradient id="c">
|
|
17
|
+
<stop offset="0"/>
|
|
18
|
+
<stop offset="1" stop-opacity="0"/>
|
|
19
|
+
</linearGradient>
|
|
20
|
+
<linearGradient id="b">
|
|
21
|
+
<stop offset="0" stop-color="#ffc"/>
|
|
22
|
+
<stop offset=".5" stop-color="#fff965"/>
|
|
23
|
+
<stop offset="1" stop-color="#fc3"/>
|
|
24
|
+
</linearGradient>
|
|
25
|
+
<linearGradient xlink:href="#a" id="i" x1="8.0350637" x2="42.788235" y1="32.372219" y2="32.372219" gradientUnits="userSpaceOnUse" spreadMethod="pad"/>
|
|
26
|
+
<radialGradient xlink:href="#b" id="f" cx="17.986637" cy="16.545853" r="23.978155" fx="17.986637" fy="16.545853" gradientUnits="userSpaceOnUse"/>
|
|
27
|
+
<radialGradient xlink:href="#c" id="e" cx="53.309223" cy="94.956306" r="63.252911" fx="53.309223" fy="94.956306" gradientTransform="matrix(1 0 0 .34935 0 61.7838)" gradientUnits="userSpaceOnUse"/>
|
|
28
|
+
<radialGradient xlink:href="#d" id="g" cx="18.71347" cy="21.759708" r="1.8644418" fx="18.71347" fy="21.759708" gradientTransform="matrix(1 0 0 1.77778 0 -16.92422)" gradientUnits="userSpaceOnUse"/>
|
|
29
|
+
</defs>
|
|
30
|
+
<path fill="url(#e)" d="M116.56213 94.956306a63.252911 22.097088 0 1 1-126.5058174 0 63.252911 22.097088 0 1 1 126.5058174 0z" opacity=".53200001" transform="matrix(.3162 0 0 .33941 6.936944 8.132618)"/>
|
|
31
|
+
<path fill="url(#f)" stroke="#fb0" stroke-width="1.43869453" d="M47.094418 23.83131a23.478155 23.478155 0 1 1-46.9563107 0 23.478155 23.478155 0 1 1 46.9563107 0z" transform="translate(4.30185 4.122792) scale(.83409)"/>
|
|
32
|
+
<path id="h" fill="#fff" fill-opacity="1" fill-rule="nonzero" stroke="#fc0" stroke-dasharray="none" stroke-dashoffset="0" stroke-linejoin="miter" stroke-miterlimit="4" stroke-opacity="1" stroke-width="1" d="M21.682767 18.5142a3.9360437 6.9743929 0 1 1-7.872088 0 3.9360437 6.9743929 0 1 1 7.872088 0z" opacity="1" transform="matrix(1.01507 0 0 1.00354 -.0090285 .916405)"/>
|
|
33
|
+
<path id="j" fill="url(#g)" fill-opacity="1" fill-rule="nonzero" stroke="none" stroke-dasharray="none" stroke-dashoffset="0" stroke-linejoin="miter" stroke-miterlimit="4" stroke-opacity="1" stroke-width="1" d="M20.577912 21.759708a1.8644418 3.314563 0 1 1-3.728883 0 1.8644418 3.314563 0 1 1 3.728883 0z" opacity="1" transform="translate(-.138107 .535104)"/>
|
|
34
|
+
<use xlink:href="#h" width="48" height="48" transform="translate(12.50001 -4.4e-7)"/>
|
|
35
|
+
<path fill="none" stroke="url(#i)" stroke-linecap="round" stroke-width="1.97319973" d="M9.0216636 35.899178c4.7689724-7.457767 10.9544424-9.489956 17.3095664-3.728884 5.404329 4.899155 11.190398 4.350365 15.470406-.656007"/>
|
|
36
|
+
<path fill="none" stroke="#e2ac00" stroke-linecap="round" stroke-width="1.17813516" d="M15.504748 34.21319c3.012147-3.243177 6.693658.87012 6.693658.87012" opacity=".8"/>
|
|
37
|
+
<use xlink:href="#j" width="48" height="48" transform="translate(10.78418 -5)"/>
|
|
38
|
+
</svg>
|