@epa-wg/custom-element-dist 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/custom-element-dist.iml +1 -5
- package/.storybook/main.ts +1 -3
- 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 +14 -11
- 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 +596 -386
- 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 +33 -18
- package/coverage/src/custom-element/local-storage.js.html +56 -41
- package/coverage/src/custom-element/location-element.js.html +4 -4
- package/coverage/src/custom-element/module-url.js/coverage.svg +10 -0
- package/coverage/src/custom-element/module-url.js.html +187 -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 +9 -15
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts.html +1 -1
- package/coverage/src/stories/dom-merge.test.stories.ts.html +15 -9
- package/coverage/src/stories/external-template.test.stories.ts.html +27 -18
- 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 +48 -33
- package/coverage/src/stories/local-storage.test.stories.ts/coverage.svg +1 -1
- package/coverage/src/stories/local-storage.test.stories.ts.html +87 -63
- package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
- package/coverage/src/stories/module-url.test.stories.ts/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.html +1 -1
- package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
- package/coverage/src/stories/slots.test.stories.ts.html +1 -1
- package/coverage/src/stories/testStoryBook.ts.html +12 -12
- package/coverage/src/stories/version-select.test.stories.ts.html +98 -20
- package/coverage/src/sum.ts.html +1 -1
- package/dist/confused.svg +1 -0
- package/dist/custom-element-BMMsP1Dy.js +533 -0
- package/dist/custom-element-CPSk7s0j.cjs +87 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +28 -25
- package/dist/demo/a.html +60 -0
- package/dist/demo/a.svg +27 -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 +25 -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 +118 -0
- package/dist/demo/npm-versions.html +94 -0
- package/dist/demo/parameters.html +70 -0
- package/dist/demo/s.xml +3 -0
- package/dist/demo/s.xslt +56 -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 +33 -0
- package/dist/demo/z.js +9 -0
- package/dist/demo/z.xml +60 -0
- package/dist/demo/z1.html +34 -0
- package/dist/embed-1.html +1 -2
- package/dist/local-storage-78EivJ_B.cjs +1 -0
- package/dist/local-storage-DzmNKzgN.js +66 -0
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +95 -93
- package/public/confused.svg +1 -0
- package/public/demo/a.html +60 -0
- package/public/demo/a.svg +27 -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 +25 -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 +118 -0
- package/public/demo/npm-versions.html +94 -0
- package/public/demo/parameters.html +70 -0
- package/public/demo/s.xml +3 -0
- package/public/demo/s.xslt +56 -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 +33 -0
- package/public/demo/z.js +9 -0
- package/public/demo/z.xml +60 -0
- package/public/demo/z1.html +34 -0
- package/public/embed-1.html +1 -2
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.js +103 -33
- package/src/custom-element/demo/a.svg +27 -0
- package/src/custom-element/demo/confused.svg +1 -0
- package/src/custom-element/demo/demo.css +11 -8
- 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/module-url.html +215 -0
- package/src/custom-element/demo/npm-versions-demo.html +118 -0
- package/src/custom-element/demo/npm-versions.html +94 -0
- package/src/custom-element/demo/s.xml +3 -36
- package/src/custom-element/demo/s.xslt +55 -96
- package/src/custom-element/demo/set-url.html +1 -1
- package/src/custom-element/demo/z.html +32 -61
- package/src/custom-element/demo/z.js +9 -0
- package/src/custom-element/demo/z1.html +34 -0
- package/src/custom-element/ide/customData-dce.json +215 -181
- package/src/custom-element/ide/web-types-dce.json +184 -159
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +21 -3
- package/src/custom-element/local-storage.js +19 -14
- package/src/custom-element/module-url.js +34 -0
- package/src/mocks/handlers.ts +10 -1
- package/src/mocks/versions.mock.ts +786 -0
- package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
- package/src/stories/attributes.test.stories.ts +3 -5
- package/src/stories/dom-merge.test.stories.ts +9 -7
- package/src/stories/external-template.test.stories.ts +13 -10
- package/src/stories/local-storage.test.stories.ts +61 -53
- package/src/stories/module-url.test.stories.ts +183 -0
- package/src/stories/version-select.test.stories.ts +38 -12
- package/src/sum.test.ts +5 -5
- package/src/sum.ts +3 -3
- package/storybook-static/assets/Color-KGDBMAHA-CJo5gHY3.js +1 -0
- package/storybook-static/assets/{Configure-D0qG3gR9.js → Configure-DdXbGKhY.js} +2 -2
- package/storybook-static/assets/DocsRenderer-PKQXORMH-DLnpL5hE.js +2 -0
- package/storybook-static/assets/{attributes.test.stories-W34tZdUt.js → attributes.test.stories-Bt5V18qO.js} +10 -12
- package/storybook-static/assets/{css.test.stories-BZFYx1TQ.js → css.test.stories-CGYy2daE.js} +1 -1
- package/storybook-static/assets/custom-element-D8hcDZHh.js +265 -0
- package/storybook-static/assets/{dom-merge.test.stories-S-7U5N3h.js → dom-merge.test.stories-XlsZ0UvX.js} +22 -20
- 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-QIO3lAFz.js → external-template.test.stories-Bt_Pflu8.js} +23 -21
- package/storybook-static/assets/{form.test.stories-ClYhj9F1.js → form.test.stories-B0NoI8wm.js} +1 -1
- package/storybook-static/assets/handlers-B5969HUu.js +467 -0
- package/storybook-static/assets/http-request.stories-B2skuTFV.js +281 -0
- package/storybook-static/assets/iframe-Dfrt81rk.js +2 -0
- package/storybook-static/assets/index-Ay195x2L.js +605 -0
- package/storybook-static/assets/index-C3ChPTMh.js +1 -0
- package/storybook-static/assets/index-C7lvoJNv.js +1 -0
- package/storybook-static/assets/index-C8k3Z-3Y.js +28 -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-Gpdhz4ab.js +1 -0
- package/storybook-static/assets/lit-element-DzhCn-8W.js +19 -0
- package/storybook-static/assets/local-storage.test.stories-DfY6feqG.js +420 -0
- package/storybook-static/assets/{location-element.test.stories-DvH1TWK4.js → location-element.test.stories-944AotIJ.js} +1 -1
- package/storybook-static/assets/module-url.test.stories-DSKcwApl.js +208 -0
- package/storybook-static/assets/{preview-BKCN0mOr.js → preview-0Jj89qip.js} +1 -1
- package/storybook-static/assets/preview-AJR7rVPD.js +52 -0
- 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-CadgX-4y.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/{set-url.test.stories-GlJOh31I.js → set-url.test.stories-DjLHKkEh.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-VoNjuPCX.js → slice-events.test.stories-8I_BrHd6.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-Da2j9YuO.js → slots.test.stories-CvZz4jyP.js} +1 -1
- package/storybook-static/assets/version-select.test.stories-DSxmJylI.js +109 -0
- package/storybook-static/confused.svg +1 -0
- package/storybook-static/demo/a.html +60 -0
- package/storybook-static/demo/a.svg +27 -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 +25 -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 +118 -0
- package/storybook-static/demo/npm-versions.html +94 -0
- package/storybook-static/demo/parameters.html +70 -0
- package/storybook-static/demo/s.xml +3 -0
- package/storybook-static/demo/s.xslt +56 -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 +33 -0
- package/storybook-static/demo/z.js +9 -0
- package/storybook-static/demo/z.xml +60 -0
- package/storybook-static/demo/z1.html +34 -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 +39 -36
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +38 -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/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/compiler.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.vscode/settings.json +0 -24
- package/dist/custom-element-DAe7uvIt.js +0 -477
- package/dist/custom-element-DZvvhscI.cjs +0 -53
- package/dist/local-storage-Boafngui.cjs +0 -1
- package/dist/local-storage-BqDEu2kF.js +0 -59
- package/storybook-static/assets/Color-PRSJMWNM-CRSv4C7i.js +0 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-CG_P5zRZ.js +0 -2
- package/storybook-static/assets/WithTooltip-KJL26V4Q-CUqUi5E8.js +0 -1
- package/storybook-static/assets/custom-element-DpIq8E2p.js +0 -219
- package/storybook-static/assets/formatter-2WMMO6ZP-C-UiBIma.js +0 -58
- package/storybook-static/assets/http-request.stories-DCqY5s2i.js +0 -300
- package/storybook-static/assets/iframe-CURpvmVV.js +0 -2
- package/storybook-static/assets/index-CKw1EbdP.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-DYpTqTNu.js +0 -1
- package/storybook-static/assets/index-DsWii_Ep.js +0 -548
- package/storybook-static/assets/index-DuIEV_9C.js +0 -13
- package/storybook-static/assets/lit-element-CenEXOuS.js +0 -19
- package/storybook-static/assets/local-storage.test.stories-BqgYwqr-.js +0 -419
- package/storybook-static/assets/preview-B4GcaC1c.js +0 -1
- package/storybook-static/assets/preview-B63p-W8V.js +0 -20
- package/storybook-static/assets/preview-DRnyIGXK.js +0 -48
- package/storybook-static/assets/preview-DjDbQHPa.js +0 -2
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-CDpEe51g.js +0 -1
- package/storybook-static/assets/version-select.test.stories-DLwf-TPB.js +0 -60
- 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,533 @@
|
|
|
1
|
+
const B = "http://www.w3.org/1999/XSL/Transform", U = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", b = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, oe = (e) => typeof e == "string", re = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
|
+
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
|
+
return e;
|
|
4
|
+
}, H = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", U), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), N = (e, l = "", t = document) => {
|
|
5
|
+
const s = (i) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(i));
|
|
6
|
+
if (te(e))
|
|
7
|
+
return s(e);
|
|
8
|
+
const a = s("dce-object");
|
|
9
|
+
return a.setAttribute("dce-object-name", e), a;
|
|
10
|
+
}, G = (e, l) => {
|
|
11
|
+
const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
|
|
12
|
+
for (let s of e.attributes)
|
|
13
|
+
t.setAttribute(s.name, s.value);
|
|
14
|
+
for (; e.firstChild; )
|
|
15
|
+
t.append(e.firstChild);
|
|
16
|
+
return t;
|
|
17
|
+
};
|
|
18
|
+
function P(e) {
|
|
19
|
+
return new DOMParser().parseFromString(e, "application/xml");
|
|
20
|
+
}
|
|
21
|
+
function M(e) {
|
|
22
|
+
return new XMLSerializer().serializeToString(e);
|
|
23
|
+
}
|
|
24
|
+
function q(e, l, t, s) {
|
|
25
|
+
const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, d) => (p.append(d = a(h)), d))(l, e);
|
|
26
|
+
return [...t].forEach((h) => r.append(s(h))), r;
|
|
27
|
+
}
|
|
28
|
+
function ce(e) {
|
|
29
|
+
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
30
|
+
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
|
+
}
|
|
32
|
+
function $(e, l, t) {
|
|
33
|
+
const s = typeof e;
|
|
34
|
+
if (s === "string")
|
|
35
|
+
return N(l, e, t);
|
|
36
|
+
if (s === "number")
|
|
37
|
+
return N(l, "" + e, t);
|
|
38
|
+
if (e instanceof Array) {
|
|
39
|
+
const i = N("array", "", t);
|
|
40
|
+
return e.map((r) => i.append($(r, l, t))), i;
|
|
41
|
+
}
|
|
42
|
+
if (e instanceof FormData) {
|
|
43
|
+
const i = N("form-data", "", t);
|
|
44
|
+
for (const r of e)
|
|
45
|
+
i.append($(r[1], r[0], t));
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
const a = N(l, "", t);
|
|
49
|
+
for (let i in e)
|
|
50
|
+
re(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" && te(i) ? a.setAttribute(i, e[i]) : a.append($(e[i], i, t)));
|
|
51
|
+
return a;
|
|
52
|
+
}
|
|
53
|
+
function Z(e) {
|
|
54
|
+
if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
55
|
+
const s = t.data, a = s.matchAll(/{([^}]*)}/g);
|
|
56
|
+
if (a) {
|
|
57
|
+
let i = 0, r = (p) => S(t, p), h = [];
|
|
58
|
+
if ([...a].forEach((p) => {
|
|
59
|
+
p.index > i && h.push(r(p.input.substring(i, p.index)));
|
|
60
|
+
const d = e.querySelector("value-of").cloneNode();
|
|
61
|
+
d.setAttribute("select", p[1]), h.push(d), i = p.index + p[0].length;
|
|
62
|
+
}), i < s.length && h.push(r(s.substring(i, s.length))), h.length) {
|
|
63
|
+
for (let p of h)
|
|
64
|
+
l.insertBefore(p, t);
|
|
65
|
+
l.removeChild(t);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})), "all" in e) {
|
|
69
|
+
let l = 1;
|
|
70
|
+
for (let t of e.all)
|
|
71
|
+
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
72
|
+
}
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
function me(e, l = "xsl:stylesheet") {
|
|
76
|
+
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
77
|
+
return Z(e);
|
|
78
|
+
const t = P(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${U}" xmlns:exsl="${ie}" exclude-result-prefixes="exsl" >
|
|
79
|
+
<xsl:output method="xml"/>
|
|
80
|
+
<xsl:template match="/"><dce-root xmlns="${U}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
|
|
81
|
+
<xsl:template match="*[name()='template']">
|
|
82
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
83
|
+
</xsl:template>
|
|
84
|
+
<xsl:template match="*">
|
|
85
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
86
|
+
</xsl:template>
|
|
87
|
+
<xsl:template match="*[name()='svg']|*[name()='math']">
|
|
88
|
+
<xsl:apply-templates mode="sanitize" select="."/>
|
|
89
|
+
</xsl:template>
|
|
90
|
+
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
|
|
91
|
+
<xsl:copy>
|
|
92
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
93
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
94
|
+
</xsl:copy>
|
|
95
|
+
</xsl:template>
|
|
96
|
+
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
|
|
97
|
+
<xsl:element name="{local-name()}">
|
|
98
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
99
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
100
|
+
</xsl:element>
|
|
101
|
+
</xsl:template>
|
|
102
|
+
<xsl:template mode="sanitize" match="*|@*">
|
|
103
|
+
<xsl:copy>
|
|
104
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
105
|
+
</xsl:copy>
|
|
106
|
+
</xsl:template>
|
|
107
|
+
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
108
|
+
<xsl:template mode="sanitize" match="text()">
|
|
109
|
+
<dce-text>
|
|
110
|
+
<xsl:copy/>
|
|
111
|
+
</dce-text>
|
|
112
|
+
</xsl:template>
|
|
113
|
+
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
|
|
114
|
+
<dce-text>
|
|
115
|
+
<xsl:copy>
|
|
116
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
117
|
+
</xsl:copy>
|
|
118
|
+
</dce-text>
|
|
119
|
+
</xsl:template>
|
|
120
|
+
<xsl:template mode="sanitize" match="xhtml:*">
|
|
121
|
+
<xsl:element name="{local-name()}">
|
|
122
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
123
|
+
</xsl:element>
|
|
124
|
+
</xsl:template>
|
|
125
|
+
</xsl:stylesheet>`), s = new XSLTProcessor(), a = ((n) => {
|
|
126
|
+
C(n, "custom-element", (x) => {
|
|
127
|
+
x.firstElementChild.localName === "template" && ([...x.firstElementChild.content.childNodes].forEach((y) => x.append(y)), x.firstElementChild.remove());
|
|
128
|
+
}), C(n, "script", (x) => x.remove());
|
|
129
|
+
const c = n.content ?? n.firstElementChild?.content ?? n.body ?? n;
|
|
130
|
+
ve.forEach((x) => C(c, x, (y) => ge(y, c)));
|
|
131
|
+
const E = n.firstElementChild?.content || n.content, g = (x) => {
|
|
132
|
+
const y = P("<xhtml/>"), L = y.importNode(x, !0);
|
|
133
|
+
return y.replaceChild(L, y.documentElement), ee(L);
|
|
134
|
+
};
|
|
135
|
+
if (E) {
|
|
136
|
+
const x = N("div");
|
|
137
|
+
return [...E.childNodes].map((y) => x.append(y.cloneNode(!0))), g(x);
|
|
138
|
+
}
|
|
139
|
+
return g(n.documentElement || n.body || n);
|
|
140
|
+
})(e), i = P(
|
|
141
|
+
`<xsl:stylesheet version="1.0"
|
|
142
|
+
xmlns:xsl="${B}"
|
|
143
|
+
xmlns:xhtml="${U}"
|
|
144
|
+
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
145
|
+
xmlns:exsl="http://exslt.org/common"
|
|
146
|
+
exclude-result-prefixes="exsl"
|
|
147
|
+
>
|
|
148
|
+
<xsl:template match="ignore">
|
|
149
|
+
<xsl:choose>
|
|
150
|
+
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
151
|
+
<xsl:otherwise>{def}</xsl:otherwise>
|
|
152
|
+
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
153
|
+
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
154
|
+
<xsl:template match="/">
|
|
155
|
+
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
156
|
+
</xsl:template>
|
|
157
|
+
<xsl:template name="slot" >
|
|
158
|
+
<xsl:param name="slotname" />
|
|
159
|
+
<xsl:param name="defaultvalue" />
|
|
160
|
+
<xsl:choose>
|
|
161
|
+
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
162
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
163
|
+
</xsl:when>
|
|
164
|
+
<xsl:otherwise>
|
|
165
|
+
<xsl:copy-of select="$defaultvalue"/>
|
|
166
|
+
</xsl:otherwise>
|
|
167
|
+
</xsl:choose>
|
|
168
|
+
</xsl:template>
|
|
169
|
+
<xsl:variable name="js-injected-body">
|
|
170
|
+
<xsl:call-template name="slot" >
|
|
171
|
+
<xsl:with-param name="slotname" select="''"/>
|
|
172
|
+
<xsl:with-param name="defaultvalue"/>
|
|
173
|
+
</xsl:call-template>
|
|
174
|
+
</xsl:variable>
|
|
175
|
+
</xsl:stylesheet>`
|
|
176
|
+
);
|
|
177
|
+
s.importStylesheet(t);
|
|
178
|
+
const r = s.transformToFragment(a, document), h = (n, c) => n.querySelector(c), p = h(i, 'template[mode="payload"]');
|
|
179
|
+
if (!r)
|
|
180
|
+
return console.error("transformation error", { xml: a.outerHTML, xsl: M(t) });
|
|
181
|
+
if (r.firstElementChild.localName !== "dce-root") {
|
|
182
|
+
const n = r.ownerDocument.createElement("dce-root");
|
|
183
|
+
[...r.childNodes].forEach((c) => n.append(c)), r.append(n);
|
|
184
|
+
}
|
|
185
|
+
const d = [];
|
|
186
|
+
[...r.querySelectorAll("dce-root>attribute")].forEach((n) => {
|
|
187
|
+
const c = G(n, "xsl:param"), E = b(n, "name");
|
|
188
|
+
p.append(c);
|
|
189
|
+
let g = b(c, "select")?.split("??");
|
|
190
|
+
g || (g = ["//" + E, `'${c.textContent}'`], H(c), c.setAttribute("name", E));
|
|
191
|
+
let x;
|
|
192
|
+
if (g?.length > 1) {
|
|
193
|
+
c.removeAttribute("select");
|
|
194
|
+
const y = h(i, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
195
|
+
H(y.firstElementChild).append(S(y, "{" + g[0] + "}")), H(y.lastElementChild).append(S(y, "{" + g[1] + "}")), y.firstElementChild.setAttribute("test", g[0]), c.append(y), x = y.cloneNode(!0);
|
|
196
|
+
} else
|
|
197
|
+
x = G(n, "xsl:value-of");
|
|
198
|
+
x.removeAttribute("name"), n.append(x), n.removeAttribute("select"), d.push(c);
|
|
199
|
+
}), [...r.querySelectorAll("[value]")].filter((n) => n.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((n) => {
|
|
200
|
+
const c = b(n, "value");
|
|
201
|
+
c && n.setAttribute("value", ye(c));
|
|
202
|
+
});
|
|
203
|
+
for (const n of r.childNodes)
|
|
204
|
+
p.append(i.importNode(n, !0));
|
|
205
|
+
[...p.getElementsByTagName("xsl:template")].forEach((n) => p.ownerDocument.documentElement.append(n));
|
|
206
|
+
const R = h(i, 'call-template[name="slot"]'), u = (n) => {
|
|
207
|
+
const c = R.cloneNode(!0), E = b(n, "name");
|
|
208
|
+
E && c.firstElementChild.setAttribute("select", `'${E}'`);
|
|
209
|
+
for (let g of n.childNodes)
|
|
210
|
+
c.lastElementChild.append(g);
|
|
211
|
+
return c;
|
|
212
|
+
};
|
|
213
|
+
C(p, "slot", (n) => n.parentNode.replaceChild(u(n), n));
|
|
214
|
+
const m = Z(i);
|
|
215
|
+
return m.params = d, m;
|
|
216
|
+
}
|
|
217
|
+
async function de(e) {
|
|
218
|
+
return await new Promise((t, s) => {
|
|
219
|
+
const a = new XMLHttpRequest();
|
|
220
|
+
a.open("GET", e), a.responseType = "document", a.onload = () => {
|
|
221
|
+
a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
|
|
222
|
+
}, a.addEventListener("error", (i) => s(i)), a.send();
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function ue(e, l, t = !1) {
|
|
226
|
+
if (e === l)
|
|
227
|
+
return !0;
|
|
228
|
+
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
229
|
+
return t;
|
|
230
|
+
for (let s in e)
|
|
231
|
+
if (!(s in l) || !ue(e[s], l[s]))
|
|
232
|
+
return t;
|
|
233
|
+
return !0;
|
|
234
|
+
}
|
|
235
|
+
const se = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), pe = (e, l) => se(l).map((t) => {
|
|
236
|
+
let s = e.ownerDocument, a = (i) => (e.append(i), i);
|
|
237
|
+
if (t.includes("/")) {
|
|
238
|
+
const i = [], r = s.evaluate(t, e);
|
|
239
|
+
for (let h; h = r.iterateNext(); )
|
|
240
|
+
i.push(h);
|
|
241
|
+
return i;
|
|
242
|
+
}
|
|
243
|
+
return [...e.childNodes].find((i) => i.localName === t) || a(N(t, "", s));
|
|
244
|
+
}).flat();
|
|
245
|
+
function J(e, l, t, s) {
|
|
246
|
+
if (!t.sliceProcessed)
|
|
247
|
+
return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
|
|
248
|
+
const i = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((d) => d.nodeType === 3 || d.localName === "value" || d.localName === "form-data").map((d) => d.remove());
|
|
249
|
+
if (r.getAttributeNames().map((d) => a.setAttribute(d, b(r, d))), [...a.childNodes].filter((d) => d.localName === "event").map((d) => d.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append($(t, "event", i)), h.hasAttribute("slice-value")) {
|
|
250
|
+
r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
|
|
251
|
+
const d = D(b(h, "slice-value"), a);
|
|
252
|
+
p(), a.append(S(i, d));
|
|
253
|
+
} else {
|
|
254
|
+
if ("elements" in r)
|
|
255
|
+
return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
|
|
256
|
+
const d = r.value ?? b(r, "value");
|
|
257
|
+
p(), d == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(d) ? a.append(S(i, d)) : a.append($(d, "value", a.ownerDocument));
|
|
258
|
+
}
|
|
259
|
+
return a;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function C(e, l, t) {
|
|
263
|
+
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
264
|
+
}
|
|
265
|
+
const fe = async (e, l) => {
|
|
266
|
+
if (!e || !e.trim())
|
|
267
|
+
return [l];
|
|
268
|
+
if (e.startsWith("#"))
|
|
269
|
+
return ((t) => {
|
|
270
|
+
const s = t.querySelectorAll(e);
|
|
271
|
+
return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
|
|
272
|
+
})(l.parentElement);
|
|
273
|
+
try {
|
|
274
|
+
const [t, s] = e.split("#");
|
|
275
|
+
if (e.charAt(0) === ".")
|
|
276
|
+
e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
|
|
277
|
+
else
|
|
278
|
+
try {
|
|
279
|
+
e = import.meta.resolve(t), s && (e += "#" + s);
|
|
280
|
+
} catch (i) {
|
|
281
|
+
console.error(i.message);
|
|
282
|
+
}
|
|
283
|
+
const a = await de(e);
|
|
284
|
+
if (l.setAttributeNS("xml", "base", e), s) {
|
|
285
|
+
const i = a.querySelectorAll("#" + s);
|
|
286
|
+
return i.length ? [...i] : [l];
|
|
287
|
+
}
|
|
288
|
+
return [a];
|
|
289
|
+
} catch {
|
|
290
|
+
return [l];
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
function he(e, l) {
|
|
294
|
+
for (let t of e.attributes)
|
|
295
|
+
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
296
|
+
}
|
|
297
|
+
function le(e, l = 0) {
|
|
298
|
+
const t = {};
|
|
299
|
+
for (const s of e.childNodes) {
|
|
300
|
+
const a = b(s, "data-dce-id") || s.dceId || 0;
|
|
301
|
+
if (!t[a])
|
|
302
|
+
a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
303
|
+
else {
|
|
304
|
+
const i = s.dceId = a + "-" + t[a]++;
|
|
305
|
+
s.setAttribute && s.setAttribute("data-dce-id", i);
|
|
306
|
+
}
|
|
307
|
+
s.childNodes.length && le(s);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function xe(e, l, t) {
|
|
311
|
+
t = 1 * t;
|
|
312
|
+
for (let s of e.childNodes)
|
|
313
|
+
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
314
|
+
return e.insertBefore(l, s);
|
|
315
|
+
e.append(l);
|
|
316
|
+
}
|
|
317
|
+
function ae(e, l) {
|
|
318
|
+
if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
|
|
319
|
+
return;
|
|
320
|
+
if (!l.length)
|
|
321
|
+
return e.firstElementChild?.localName !== "dce-root" && K(e);
|
|
322
|
+
const t = {};
|
|
323
|
+
for (let s of e.childNodes)
|
|
324
|
+
t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[b(s, "data-dce-id") || 0] = s;
|
|
325
|
+
for (let s of [...l]) {
|
|
326
|
+
const a = b(s, "data-dce-id") || s.dceId, i = t[a];
|
|
327
|
+
i ? (Y(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (he(s, i), (i.childNodes.length || s.childNodes.length) && ae(i, s.childNodes)), delete t[a]) : xe(e, s, a);
|
|
328
|
+
}
|
|
329
|
+
for (let s of Object.values(t))
|
|
330
|
+
s.localName !== "dce-root" && s.remove();
|
|
331
|
+
}
|
|
332
|
+
function be(e, l) {
|
|
333
|
+
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
334
|
+
}
|
|
335
|
+
const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
336
|
+
if (!e.trim())
|
|
337
|
+
return e;
|
|
338
|
+
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
339
|
+
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
340
|
+
}, D = (e, l) => {
|
|
341
|
+
const t = e.split("??");
|
|
342
|
+
if (t.length > 1)
|
|
343
|
+
return D(t[0], l) || D(t[1], l);
|
|
344
|
+
e = F(e);
|
|
345
|
+
const s = l.ownerDocument.evaluate(e, l);
|
|
346
|
+
switch (s.resultType) {
|
|
347
|
+
case XPathResult.NUMBER_TYPE:
|
|
348
|
+
return s.numberValue;
|
|
349
|
+
case XPathResult.STRING_TYPE:
|
|
350
|
+
return s.stringValue;
|
|
351
|
+
case XPathResult.BOOLEAN_TYPE:
|
|
352
|
+
return s.booleanValue;
|
|
353
|
+
}
|
|
354
|
+
let a = "";
|
|
355
|
+
for (let i; i = s.iterateNext(); )
|
|
356
|
+
a += i.textContent;
|
|
357
|
+
return a;
|
|
358
|
+
}, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), ge = (e, l) => {
|
|
359
|
+
const t = N("xsl:" + e.localName);
|
|
360
|
+
for (let s of e.attributes)
|
|
361
|
+
t.setAttribute(s.name, s.value);
|
|
362
|
+
for (; e.firstChild; )
|
|
363
|
+
t.append(e.firstChild);
|
|
364
|
+
if (e.parentElement)
|
|
365
|
+
e.parentElement.replaceChild(t, e);
|
|
366
|
+
else {
|
|
367
|
+
const s = e.parentElement || l, a = [...s.childNodes];
|
|
368
|
+
a.forEach((i, r) => {
|
|
369
|
+
i === e && (a[r] = t);
|
|
370
|
+
}), s.replaceChildren(...a);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
class Ee extends HTMLElement {
|
|
374
|
+
static observedAttributes = ["src", "tag", "hidden"];
|
|
375
|
+
async connectedCallback() {
|
|
376
|
+
const l = await fe(b(this, "src"), this), t = b(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
377
|
+
for (const u of l)
|
|
378
|
+
C(u.templateNode || u.content || u, "style", (m) => {
|
|
379
|
+
const n = m.closest("slot"), c = n ? `slot[name="${n.name}"]` : "";
|
|
380
|
+
m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
|
|
381
|
+
});
|
|
382
|
+
const a = l.map((u) => me(u)), i = a.map((u, m) => {
|
|
383
|
+
m = new XSLTProcessor();
|
|
384
|
+
try {
|
|
385
|
+
m.importStylesheet(u);
|
|
386
|
+
} catch (n) {
|
|
387
|
+
console.error(n, M(u));
|
|
388
|
+
}
|
|
389
|
+
return m;
|
|
390
|
+
});
|
|
391
|
+
Object.defineProperty(this, "xsltString", { get: () => a.map((u) => M(u)).join(`
|
|
392
|
+
`) });
|
|
393
|
+
const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((u) => b(u, "slice")).filter((u) => !u.includes("/")).filter((u, m, n) => n.indexOf(u) === m).map(se).flat(), d = a.reduce((u, m) => (m.params && u.push(...m.params), u), []);
|
|
394
|
+
class w extends HTMLElement {
|
|
395
|
+
static get observedAttributes() {
|
|
396
|
+
return d.map((m) => b(m, "name"));
|
|
397
|
+
}
|
|
398
|
+
#e = 0;
|
|
399
|
+
connectedCallback() {
|
|
400
|
+
let m = this.childNodes;
|
|
401
|
+
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
402
|
+
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
403
|
+
const f = this.firstElementChild;
|
|
404
|
+
f.remove(), m = f.content.childNodes;
|
|
405
|
+
for (const o of [...f.content.childNodes])
|
|
406
|
+
if (o.localName === "style") {
|
|
407
|
+
const v = be(this, "data-dce-style");
|
|
408
|
+
o.innerHTML = `${s}[data-dce-style="${v}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
|
|
409
|
+
} else
|
|
410
|
+
o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
|
|
411
|
+
}
|
|
412
|
+
const n = P("<datadom/>").documentElement, c = (f, o = "") => ((v) => (o && v.append(S(n, o)), v))(n.ownerDocument.createElement(f)), E = q(n, "payload", m, ce);
|
|
413
|
+
Q(E), ee(E), this.innerHTML = "";
|
|
414
|
+
const g = q(n, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
|
|
415
|
+
q(n, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
|
|
416
|
+
const x = q(n, "slice", p, (f) => c(f, "")), y = (f) => D(f, x);
|
|
417
|
+
this.xml = n;
|
|
418
|
+
const L = [], W = () => {
|
|
419
|
+
const f = {};
|
|
420
|
+
for (let o; o = L.pop(); ) {
|
|
421
|
+
const v = b(o.sliceElement, "slice");
|
|
422
|
+
f[v] || (J(x, v, o), f[v] = o);
|
|
423
|
+
}
|
|
424
|
+
Object.keys(f).length !== 0 && I();
|
|
425
|
+
};
|
|
426
|
+
let V;
|
|
427
|
+
this.onSlice = (f) => {
|
|
428
|
+
L.push(f), V || (V = setTimeout(() => {
|
|
429
|
+
W(), V = 0;
|
|
430
|
+
}, 1));
|
|
431
|
+
};
|
|
432
|
+
const I = this.transform = () => {
|
|
433
|
+
if (this.#e)
|
|
434
|
+
debugger;
|
|
435
|
+
this.#e = 1, i.map((o, v) => {
|
|
436
|
+
const X = o.transformToFragment(n.ownerDocument, document);
|
|
437
|
+
return X || console.error(`XSLT transformation error. xsl:
|
|
438
|
+
`, M(a[v]), `
|
|
439
|
+
xml:
|
|
440
|
+
`, M(n)), X;
|
|
441
|
+
}).map((o) => {
|
|
442
|
+
o && (le(o), ae(this, o.childNodes));
|
|
443
|
+
}), w.observedAttributes.map((o) => {
|
|
444
|
+
let v = b(this.firstElementChild, o);
|
|
445
|
+
v !== b(this, o) && (this.setAttribute(o, v), this.#t(o, v));
|
|
446
|
+
}), C(this, "[slice],[slice-event]", (o) => {
|
|
447
|
+
if (!o.dceInitialized) {
|
|
448
|
+
o.dceInitialized = 1;
|
|
449
|
+
let v = b(o, "slice-event");
|
|
450
|
+
o.hasAttribute("custom-validity") && (v += " change submit"), [...new Set((v || "change").split(" "))].forEach((X) => (o.localName === "slice" ? o.parentElement : o).addEventListener(X, (A) => {
|
|
451
|
+
A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
|
|
452
|
+
const ne = J(x, b(A.sliceElement, "slice"), A);
|
|
453
|
+
C(this, "[custom-validity]", (z) => {
|
|
454
|
+
if (!z.setCustomValidity)
|
|
455
|
+
return;
|
|
456
|
+
const _ = b(z, "custom-validity");
|
|
457
|
+
try {
|
|
458
|
+
const j = _ && D(_, g);
|
|
459
|
+
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
460
|
+
} catch (j) {
|
|
461
|
+
console.error(j, "xPath", _);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
const k = b(o, "custom-validity"), T = k && D(k, g), O = T === !0 ? "" : T;
|
|
465
|
+
if (k) {
|
|
466
|
+
if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
467
|
+
return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
468
|
+
setTimeout(I, 1);
|
|
469
|
+
}
|
|
470
|
+
this.onSlice(A);
|
|
471
|
+
})), (!v || v.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = y(b(o, "slice")));
|
|
472
|
+
}
|
|
473
|
+
}), this.#e = 0;
|
|
474
|
+
};
|
|
475
|
+
I(), W();
|
|
476
|
+
}
|
|
477
|
+
#t(m, n) {
|
|
478
|
+
m === "value" && (this.value = n);
|
|
479
|
+
let c = this.xml.querySelector(`attributes>${m}`);
|
|
480
|
+
c ? H(c).append(S(c, n)) : (c = N(m, n, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: n } }));
|
|
481
|
+
}
|
|
482
|
+
attributeChangedCallback(m, n, c) {
|
|
483
|
+
!this.xml || this.#e || (this.#t(m, c), this.transform());
|
|
484
|
+
}
|
|
485
|
+
get dce() {
|
|
486
|
+
return r;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const R = (u) => {
|
|
490
|
+
window.customElements.get(u) !== w && window.customElements.define(u, w);
|
|
491
|
+
};
|
|
492
|
+
if (t)
|
|
493
|
+
R(t);
|
|
494
|
+
else {
|
|
495
|
+
const u = s;
|
|
496
|
+
this.setAttribute("tag", u), R(u);
|
|
497
|
+
const m = document.createElement(u);
|
|
498
|
+
this.getAttributeNames().forEach((n) => m.setAttribute(n, this.getAttribute(n))), m.append(...[...this.childNodes].filter((n) => n.localName !== "style")), this.append(m);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
get templateNode() {
|
|
502
|
+
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
503
|
+
}
|
|
504
|
+
get dce() {
|
|
505
|
+
return this;
|
|
506
|
+
}
|
|
507
|
+
get xslt() {
|
|
508
|
+
return P(this.xsltString);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
window.customElements.define("custom-element", Ee);
|
|
512
|
+
export {
|
|
513
|
+
Ee as C,
|
|
514
|
+
M as a,
|
|
515
|
+
de as b,
|
|
516
|
+
me as c,
|
|
517
|
+
ue as d,
|
|
518
|
+
pe as e,
|
|
519
|
+
J as f,
|
|
520
|
+
le as g,
|
|
521
|
+
xe as h,
|
|
522
|
+
ae as i,
|
|
523
|
+
be as j,
|
|
524
|
+
ye as k,
|
|
525
|
+
F as l,
|
|
526
|
+
he as m,
|
|
527
|
+
D as n,
|
|
528
|
+
$ as o,
|
|
529
|
+
ve as p,
|
|
530
|
+
ge as q,
|
|
531
|
+
Z as t,
|
|
532
|
+
P as x
|
|
533
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";const F="http://www.w3.org/1999/XSL/Transform",q="http://www.w3.org/1999/xhtml",ye="http://exslt.org/common",y=(e,l)=>e.getAttribute?.(l),K=e=>e.nodeType===3,be=e=>typeof e=="string",ge=e=>e&&typeof e.nodeType=="number",C=(e,l)=>(e.ownerDocument||e).createTextNode(l),ee=e=>{for(;e.firstChild;)e.firstChild.remove();return e},H=e=>(e.getAttributeNames().map(l=>e.removeAttribute(l)),ee(e)),te=e=>(e?.setAttribute("xmlns:xsl",F),e),se=e=>(e?.setAttribute("xmlns:xhtml",q),te(e)),le=e=>/^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e),N=(e,l="",t=document)=>{const s=i=>(r=>(l&&r.append(C(t.ownerDocument||t,l)),r))((t.ownerDocument||t).createElement(i));if(le(e))return s(e);const n=s("dce-object");return n.setAttribute("dce-object-name",e),n},Q=(e,l)=>{const t=e.ownerDocument.createElementNS(e.namespaceURI,l);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);return t};function z(e){return new DOMParser().parseFromString(e,"application/xml")}function L(e){return new XMLSerializer().serializeToString(e)}function U(e,l,t,s){const n=h=>e.ownerDocument.createElement(h),r=((h,p,u)=>(p.append(u=n(h)),u))(l,e);return[...t].forEach(h=>r.append(s(h))),r}function ve(e){return e.slot||(e.setAttribute||(e=N("span",e.textContent.replaceAll(`
|
|
2
|
+
`,""))),e.setAttribute("slot","")),e}function D(e,l,t){const s=typeof e;if(s==="string")return N(l,e,t);if(s==="number")return N(l,""+e,t);if(e instanceof Array){const i=N("array","",t);return e.map(r=>i.append(D(r,l,t))),i}if(e instanceof FormData){const i=N("form-data","",t);for(const r of e)i.append(D(r[1],r[0],t));return i}const n=N(l,"",t);for(let i in e)ge(e[i])||typeof e[i]=="function"||e[i]instanceof Window||(typeof e[i]!="object"&&le(i)?n.setAttribute(i,e[i]):n.append(D(e[i],i,t)));return n}function W(e){if(S(e,"*",l=>[...l.childNodes].filter(t=>t.nodeType===3&&t.parentNode.localName!=="style"&&t.data).forEach(t=>{const s=t.data,n=s.matchAll(/{([^}]*)}/g);if(n){let i=0,r=p=>C(t,p),h=[];if([...n].forEach(p=>{p.index>i&&h.push(r(p.input.substring(i,p.index)));const u=e.querySelector("value-of").cloneNode();u.setAttribute("select",p[1]),h.push(u),i=p.index+p[0].length}),i<s.length&&h.push(r(s.substring(i,s.length))),h.length){for(let p of h)l.insertBefore(p,t);l.removeChild(t)}}})),"all"in e){let l=1;for(let t of e.all)t.setAttribute&&!t.tagName.startsWith("xsl:")&&t.setAttribute("data-dce-id",""+l++)}return e}function ne(e,l="xsl:stylesheet"){if(e.tagName===l||e.documentElement?.tagName===l)return W(e);const t=z(`<xsl:stylesheet version="1.0" xmlns:xsl="${F}" xmlns:xhtml="${q}" xmlns:exsl="${ye}" exclude-result-prefixes="exsl" >
|
|
3
|
+
<xsl:output method="xml"/>
|
|
4
|
+
<xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*" /></dce-root></xsl:template>
|
|
5
|
+
<xsl:template match="*[name()='template']">
|
|
6
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
7
|
+
</xsl:template>
|
|
8
|
+
<xsl:template match="*">
|
|
9
|
+
<xsl:apply-templates mode="sanitize" select="*|text()"/>
|
|
10
|
+
</xsl:template>
|
|
11
|
+
<xsl:template match="*[name()='svg']|*[name()='math']">
|
|
12
|
+
<xsl:apply-templates mode="sanitize" select="."/>
|
|
13
|
+
</xsl:template>
|
|
14
|
+
<xsl:template mode="sanitize" match="*[count(text())=1 and count(*)=0]">
|
|
15
|
+
<xsl:copy>
|
|
16
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
17
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
18
|
+
</xsl:copy>
|
|
19
|
+
</xsl:template>
|
|
20
|
+
<xsl:template mode="sanitize" match="xhtml:*[count(text())=1 and count(*)=0]">
|
|
21
|
+
<xsl:element name="{local-name()}">
|
|
22
|
+
<xsl:apply-templates mode="sanitize" select="@*"/>
|
|
23
|
+
<xsl:value-of select="text()"></xsl:value-of>
|
|
24
|
+
</xsl:element>
|
|
25
|
+
</xsl:template>
|
|
26
|
+
<xsl:template mode="sanitize" match="*|@*">
|
|
27
|
+
<xsl:copy>
|
|
28
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
29
|
+
</xsl:copy>
|
|
30
|
+
</xsl:template>
|
|
31
|
+
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
32
|
+
<xsl:template mode="sanitize" match="text()">
|
|
33
|
+
<dce-text>
|
|
34
|
+
<xsl:copy/>
|
|
35
|
+
</dce-text>
|
|
36
|
+
</xsl:template>
|
|
37
|
+
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']">
|
|
38
|
+
<dce-text>
|
|
39
|
+
<xsl:copy>
|
|
40
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
41
|
+
</xsl:copy>
|
|
42
|
+
</dce-text>
|
|
43
|
+
</xsl:template>
|
|
44
|
+
<xsl:template mode="sanitize" match="xhtml:*">
|
|
45
|
+
<xsl:element name="{local-name()}">
|
|
46
|
+
<xsl:apply-templates mode="sanitize" select="*|@*|text()"/>
|
|
47
|
+
</xsl:element>
|
|
48
|
+
</xsl:template>
|
|
49
|
+
</xsl:stylesheet>`),s=new XSLTProcessor,n=(a=>{S(a,"custom-element",x=>{x.firstElementChild.localName==="template"&&([...x.firstElementChild.content.childNodes].forEach(b=>x.append(b)),x.firstElementChild.remove())}),S(a,"script",x=>x.remove());const c=a.content??a.firstElementChild?.content??a.body??a;pe.forEach(x=>S(c,x,b=>fe(b,c)));const E=a.firstElementChild?.content||a.content,v=x=>{const b=z("<xhtml/>"),j=b.importNode(x,!0);return b.replaceChild(j,b.documentElement),se(j)};if(E){const x=N("div");return[...E.childNodes].map(b=>x.append(b.cloneNode(!0))),v(x)}return v(a.documentElement||a.body||a)})(e),i=z(`<xsl:stylesheet version="1.0"
|
|
50
|
+
xmlns:xsl="${F}"
|
|
51
|
+
xmlns:xhtml="${q}"
|
|
52
|
+
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
53
|
+
xmlns:exsl="http://exslt.org/common"
|
|
54
|
+
exclude-result-prefixes="exsl"
|
|
55
|
+
>
|
|
56
|
+
<xsl:template match="ignore">
|
|
57
|
+
<xsl:choose>
|
|
58
|
+
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
59
|
+
<xsl:otherwise>{def}</xsl:otherwise>
|
|
60
|
+
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
61
|
+
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
62
|
+
<xsl:template match="/">
|
|
63
|
+
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
64
|
+
</xsl:template>
|
|
65
|
+
<xsl:template name="slot" >
|
|
66
|
+
<xsl:param name="slotname" />
|
|
67
|
+
<xsl:param name="defaultvalue" />
|
|
68
|
+
<xsl:choose>
|
|
69
|
+
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
70
|
+
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
71
|
+
</xsl:when>
|
|
72
|
+
<xsl:otherwise>
|
|
73
|
+
<xsl:copy-of select="$defaultvalue"/>
|
|
74
|
+
</xsl:otherwise>
|
|
75
|
+
</xsl:choose>
|
|
76
|
+
</xsl:template>
|
|
77
|
+
<xsl:variable name="js-injected-body">
|
|
78
|
+
<xsl:call-template name="slot" >
|
|
79
|
+
<xsl:with-param name="slotname" select="''"/>
|
|
80
|
+
<xsl:with-param name="defaultvalue"/>
|
|
81
|
+
</xsl:call-template>
|
|
82
|
+
</xsl:variable>
|
|
83
|
+
</xsl:stylesheet>`);s.importStylesheet(t);const r=s.transformToFragment(n,document),h=(a,c)=>a.querySelector(c),p=h(i,'template[mode="payload"]');if(!r)return console.error("transformation error",{xml:n.outerHTML,xsl:L(t)});if(r.firstElementChild.localName!=="dce-root"){const a=r.ownerDocument.createElement("dce-root");[...r.childNodes].forEach(c=>a.append(c)),r.append(a)}const u=[];[...r.querySelectorAll("dce-root>attribute")].forEach(a=>{const c=Q(a,"xsl:param"),E=y(a,"name");p.append(c);let v=y(c,"select")?.split("??");v||(v=["//"+E,`'${c.textContent}'`],H(c),c.setAttribute("name",E));let x;if(v?.length>1){c.removeAttribute("select");const b=h(i,'template[match="ignore"]>choose').cloneNode(!0);H(b.firstElementChild).append(C(b,"{"+v[0]+"}")),H(b.lastElementChild).append(C(b,"{"+v[1]+"}")),b.firstElementChild.setAttribute("test",v[0]),c.append(b),x=b.cloneNode(!0)}else x=Q(a,"xsl:value-of");x.removeAttribute("name"),a.append(x),a.removeAttribute("select"),u.push(c)}),[...r.querySelectorAll("[value]")].filter(a=>a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(a=>{const c=y(a,"value");c&&a.setAttribute("value",de(c))});for(const a of r.childNodes)p.append(i.importNode(a,!0));[...p.getElementsByTagName("xsl:template")].forEach(a=>p.ownerDocument.documentElement.append(a));const I=h(i,'call-template[name="slot"]'),d=a=>{const c=I.cloneNode(!0),E=y(a,"name");E&&c.firstElementChild.setAttribute("select",`'${E}'`);for(let v of a.childNodes)c.lastElementChild.append(v);return c};S(p,"slot",a=>a.parentNode.replaceChild(d(a),a));const m=W(i);return m.params=u,m}async function ae(e){return await new Promise((t,s)=>{const n=new XMLHttpRequest;n.open("GET",e),n.responseType="document",n.onload=()=>{n.readyState===n.DONE&&n.status===200?t(n.responseXML?.body||n.responseXML||N("div",n.responseText)):s(`${n.statusText} - ${e}`)},n.addEventListener("error",i=>s(i)),n.send()})}function ie(e,l,t=!1){if(e===l)return!0;if(typeof e!="object"||e===null||typeof l!="object"||l===null||Object.keys(e).length!==Object.keys(l).length)return t;for(let s in e)if(!(s in l)||!ie(e[s],l[s]))return t;return!0}const oe=e=>e.split("|").map(l=>l.trim()).filter(l=>l),re=(e,l)=>oe(l).map(t=>{let s=e.ownerDocument,n=i=>(e.append(i),i);if(t.includes("/")){const i=[],r=s.evaluate(t,e);for(let h;h=r.iterateNext();)i.push(h);return i}return[...e.childNodes].find(i=>i.localName===t)||n(N(t,"",s))}).flat();function Y(e,l,t,s){if(!t.sliceProcessed)return t.sliceProcessed=1,re(e,l??"").map(n=>{const i=e.ownerDocument,r=t.sliceEventSource,h=t.sliceElement,p=()=>[...n.childNodes].filter(u=>u.nodeType===3||u.localName==="value"||u.localName==="form-data").map(u=>u.remove());if(r.getAttributeNames().map(u=>n.setAttribute(u,y(r,u))),[...n.childNodes].filter(u=>u.localName==="event").map(u=>u.remove()),"validationMessage"in r&&n.setAttribute("validation-message",r.validationMessage),t.type==="init"&&p(),n.append(D(t,"event",i)),h.hasAttribute("slice-value")){r.value===void 0?n.removeAttribute("value"):n.setAttribute("value",r.value);const u=$(y(h,"slice-value"),n);p(),n.append(C(i,u))}else{if("elements"in r)return p(),n.append(D(new FormData(r),"value",n.ownerDocument)),n;const u=r.value??y(r,"value");p(),u==null?[...n.childNodes].filter(T=>T.localName!=="event").map(T=>T.remove()):be(u)?n.append(C(i,u)):n.append(D(u,"value",n.ownerDocument))}return n})}function S(e,l,t){e.querySelectorAll&&[...e.querySelectorAll(l)].forEach(t)}const Ee=async(e,l)=>{if(!e||!e.trim())return[l];if(e.startsWith("#"))return(t=>{const s=t.querySelectorAll(e);return[...s.length?s:t.getRootNode().querySelectorAll(e)]})(l.parentElement);try{const[t,s]=e.split("#");if(e.charAt(0)===".")e=new URL(t,l.closest("[base]")?.getAttribute("base")||location).href;else try{e=(void 0)(t),s&&(e+="#"+s)}catch(i){console.error(i.message)}const n=await ae(e);if(l.setAttributeNS("xml","base",e),s){const i=n.querySelectorAll("#"+s);return i.length?[...i]:[l]}return[n]}catch{return[l]}};function ce(e,l){for(let t of e.attributes)t.namespaceURI?l.setAttributeNS(t.namespaceURI,t.name,t.value):l.setAttribute(t.name,t.value),t.name==="value"&&(l.value=t.value)}function G(e,l=0){const t={};for(const s of e.childNodes){const n=y(s,"data-dce-id")||s.dceId||0;if(!t[n])n?t[n]=1:(t[n]=s.dceId=++l,s.setAttribute&&s.setAttribute("data-dce-id",s.dceId));else{const i=s.dceId=n+"-"+t[n]++;s.setAttribute&&s.setAttribute("data-dce-id",i)}s.childNodes.length&&G(s)}}function me(e,l,t){t=1*t;for(let s of e.childNodes)if((s.dceId??s.getAttribute("data-dce-id")*1)>t)return e.insertBefore(l,s);e.append(l)}function Z(e,l){if(e.firstElementChild?.localName==="dce-root"&&l[0].localName!=="dce-root")return;if(!l.length)return e.firstElementChild?.localName!=="dce-root"&&ee(e);const t={};for(let s of e.childNodes)t[s.dceId],K(s)?(s.data.trim(),t[s.dceId||0]=s):t[y(s,"data-dce-id")||0]=s;for(let s of[...l]){const n=y(s,"data-dce-id")||s.dceId,i=t[n];i?(K(s)?i.nodeValue!==s.nodeValue&&(i.nodeValue=s.nodeValue):(ce(s,i),(i.childNodes.length||s.childNodes.length)&&Z(i,s.childNodes)),delete t[n]):me(e,s,n)}for(let s of Object.values(t))s.localName!=="dce-root"&&s.remove()}function ue(e,l){return e.hasAttribute(l)||e.setAttribute(l,crypto.randomUUID()),e.getAttribute(l)}const de=e=>[...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map(t=>`${t[1]}{${V(t[3])}}${t[4]}`).join(""),V=e=>{if(!e.trim())return e;const l=e.split("??"),t=l.shift(),s=V(l.join("??"));return l.length?`concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )`:e},$=(e,l)=>{const t=e.split("??");if(t.length>1)return $(t[0],l)||$(t[1],l);e=V(e);const s=l.ownerDocument.evaluate(e,l);switch(s.resultType){case XPathResult.NUMBER_TYPE:return s.numberValue;case XPathResult.STRING_TYPE:return s.stringValue;case XPathResult.BOOLEAN_TYPE:return s.booleanValue}let n="";for(let i;i=s.iterateNext();)n+=i.textContent;return n},pe="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(","),fe=(e,l)=>{const t=N("xsl:"+e.localName);for(let s of e.attributes)t.setAttribute(s.name,s.value);for(;e.firstChild;)t.append(e.firstChild);if(e.parentElement)e.parentElement.replaceChild(t,e);else{const s=e.parentElement||l,n=[...s.childNodes];n.forEach((i,r)=>{i===e&&(n[r]=t)}),s.replaceChildren(...n)}};class he extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){const l=await Ee(y(this,"src"),this),t=y(this,"tag"),s=t||"dce-"+crypto.randomUUID();for(const d of l)S(d.templateNode||d.content||d,"style",m=>{const a=m.closest("slot"),c=a?`slot[name="${a.name}"]`:"";m.innerHTML=`${s} ${c}{${m.innerHTML}}`,this.append(m)});const n=l.map(d=>ne(d)),i=n.map((d,m)=>{m=new XSLTProcessor;try{m.importStylesheet(d)}catch(a){console.error(a,L(d))}return m});Object.defineProperty(this,"xsltString",{get:()=>n.map(d=>L(d)).join(`
|
|
84
|
+
`)});const r=this,h=[...this.templateNode.querySelectorAll("[slice]")],p=h.map(d=>y(d,"slice")).filter(d=>!d.includes("/")).filter((d,m,a)=>a.indexOf(d)===m).map(oe).flat(),u=n.reduce((d,m)=>(m.params&&d.push(...m.params),d),[]);class T extends HTMLElement{static get observedAttributes(){return u.map(m=>y(m,"name"))}#e=0;connectedCallback(){let m=this.childNodes;if(this.firstElementChild?.tagName==="TEMPLATE"){this.firstElementChild!==this.lastElementChild&&console.error("payload should have TEMPLATE as only child",this.outerHTML);const f=this.firstElementChild;f.remove(),m=f.content.childNodes;for(const o of[...f.content.childNodes])if(o.localName==="style"){const g=ue(this,"data-dce-style");o.innerHTML=`${s}[data-dce-style="${g}"]{${o.innerHTML}}`,f.insertAdjacentElement("beforebegin",o)}else o.nodeType===1?f.insertAdjacentElement("beforebegin",o):o.nodeType===3&&f.insertAdjacentText("beforebegin",o.data)}const a=z("<datadom/>").documentElement,c=(f,o="")=>(g=>(o&&g.append(C(a,o)),g))(a.ownerDocument.createElement(f)),E=U(a,"payload",m,ve);te(E),se(E),this.innerHTML="";const v=U(a,"attributes",this.attributes,f=>c(f.nodeName,f.value));U(a,"dataset",Object.keys(this.dataset),f=>c(f,this.dataset[f]));const x=U(a,"slice",p,f=>c(f,"")),b=f=>$(f,x);this.xml=a;const j=[],J=()=>{const f={};for(let o;o=j.pop();){const g=y(o.sliceElement,"slice");f[g]||(Y(x,g,o),f[g]=o)}Object.keys(f).length!==0&&X()};let O;this.onSlice=f=>{j.push(f),O||(O=setTimeout(()=>{J(),O=0},1))};const X=this.transform=()=>{if(this.#e)debugger;this.#e=1,i.map((o,g)=>{const R=o.transformToFragment(a.ownerDocument,document);return R||console.error(`XSLT transformation error. xsl:
|
|
85
|
+
`,L(n[g]),`
|
|
86
|
+
xml:
|
|
87
|
+
`,L(a)),R}).map(o=>{o&&(G(o),Z(this,o.childNodes))}),T.observedAttributes.map(o=>{let g=y(this.firstElementChild,o);g!==y(this,o)&&(this.setAttribute(o,g),this.#t(o,g))}),S(this,"[slice],[slice-event]",o=>{if(!o.dceInitialized){o.dceInitialized=1;let g=y(o,"slice-event");o.hasAttribute("custom-validity")&&(g+=" change submit"),[...new Set((g||"change").split(" "))].forEach(R=>(o.localName==="slice"?o.parentElement:o).addEventListener(R,A=>{A.sliceElement=o,A.sliceEventSource=A.currentTarget||A.target;const xe=Y(x,y(A.sliceElement,"slice"),A);S(this,"[custom-validity]",P=>{if(!P.setCustomValidity)return;const B=y(P,"custom-validity");try{const M=B&&$(B,v);P.setCustomValidity(M===!0?"":M===!1?"invalid":M)}catch(M){console.error(M,"xPath",B)}});const _=y(o,"custom-validity"),w=_&&$(_,v),k=w===!0?"":w;if(_){if(o.setCustomValidity?o.setCustomValidity(k):o.validationMessage=k,xe.map(P=>P.setAttribute("validation-message",k)),A.type==="submit")return w===!0?void 0:(setTimeout(X,1),!!w===w?(w||A.preventDefault(),w):w?(A.preventDefault(),!1):void 0);setTimeout(X,1)}this.onSlice(A)})),(!g||g.includes("init"))&&(o.hasAttribute("slice-value")||o.hasAttribute("value")||o.value?this.onSlice({type:"init",target:o,sliceElement:o,sliceEventSource:o}):o.value=b(y(o,"slice")))}}),this.#e=0};X(),J()}#t(m,a){m==="value"&&(this.value=a);let c=this.xml.querySelector(`attributes>${m}`);c?H(c).append(C(c,a)):(c=N(m,a,this.xml),this.xml.querySelector("attributes").append(c)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{[m]:a}}))}attributeChangedCallback(m,a,c){!this.xml||this.#e||(this.#t(m,c),this.transform())}get dce(){return r}}const I=d=>{window.customElements.get(d)!==T&&window.customElements.define(d,T)};if(t)I(t);else{const d=s;this.setAttribute("tag",d),I(d);const m=document.createElement(d);this.getAttributeNames().forEach(a=>m.setAttribute(a,this.getAttribute(a))),m.append(...[...this.childNodes].filter(a=>a.localName!=="style")),this.append(m)}}get templateNode(){return this.firstElementChild?.tagName==="TEMPLATE"?this.firstElementChild.content:this}get dce(){return this}get xslt(){return z(this.xsltString)}}window.customElements.define("custom-element",he);exports.CustomElement=he;exports.appendByDceId=me;exports.assureSlices=re;exports.assureUID=ue;exports.assureUnique=G;exports.createXsltFromDom=ne;exports.deepEqual=ie;exports.evalCurly=de;exports.event2slice=Y;exports.merge=Z;exports.mergeAttr=ce;exports.obj2node=D;exports.tagUid=W;exports.toXsl=fe;exports.xPath=$;exports.xPathDefaults=V;exports.xhrTemplate=ae;exports.xml2dom=z;exports.xmlString=L;exports.xslTags=pe;
|
|
@@ -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-CPSk7s0j.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.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.localStorage_clear=t.localStorage_clear;exports.localStorage_removeItem=t.localStorage_removeItem;exports.localStorage_setItem=t.localStorage_setItem;exports.LocationElement=a.LocationElement;
|