@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
package/vite.config.js
CHANGED
|
@@ -37,8 +37,9 @@ export default {
|
|
|
37
37
|
test : {
|
|
38
38
|
isolate : true,
|
|
39
39
|
browser : {
|
|
40
|
+
provider: 'playwright', // or 'webdriverio'
|
|
40
41
|
enabled : true,
|
|
41
|
-
name : '
|
|
42
|
+
name : 'chromium', // browser name is required
|
|
42
43
|
headless: true,
|
|
43
44
|
},
|
|
44
45
|
include :
|
package/.idea/compiler.xml
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"html.customData": [
|
|
3
|
-
"./src/custom-element/ide/customData-dce.json",
|
|
4
|
-
"./src/custom-element/ide/customData-xsl.json"
|
|
5
|
-
],
|
|
6
|
-
"terminal.integrated.profiles.windows": {
|
|
7
|
-
"PowerShell": {
|
|
8
|
-
"source": "PowerShell",
|
|
9
|
-
"icon": "terminal-powershell"
|
|
10
|
-
},
|
|
11
|
-
"Command Prompt": {
|
|
12
|
-
"path": [
|
|
13
|
-
"${env:windir}\\Sysnative\\cmd.exe",
|
|
14
|
-
"${env:windir}\\System32\\cmd.exe"
|
|
15
|
-
],
|
|
16
|
-
"args": [],
|
|
17
|
-
"icon": "terminal-cmd"
|
|
18
|
-
},
|
|
19
|
-
"Git Bash": {
|
|
20
|
-
"source": "Git Bash"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"terminal.integrated.defaultProfile.windows": "Git Bash"
|
|
24
|
-
}
|
|
@@ -1,477 +0,0 @@
|
|
|
1
|
-
const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, re = (e) => typeof e == "string", oe = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
|
-
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), A = (e, l = "", t = document) => {
|
|
5
|
-
const s = (a) => ((o) => (l && o.append(S(t.ownerDocument || t, l)), o))((t.ownerDocument || t).createElement(a));
|
|
6
|
-
if (te(e))
|
|
7
|
-
return s(e);
|
|
8
|
-
const n = s("dce-object");
|
|
9
|
-
return n.setAttribute("dce-object-name", e), n;
|
|
10
|
-
}, G = (e, l) => {
|
|
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 n = (h) => e.ownerDocument.createElement(h), o = ((h, p, m) => (p.append(m = n(h)), m))(l, e);
|
|
26
|
-
return [...t].forEach((h) => o.append(s(h))), o;
|
|
27
|
-
}
|
|
28
|
-
function ce(e) {
|
|
29
|
-
return e.slot || (e.setAttribute || (e = A("span", e.textContent.replaceAll(`
|
|
30
|
-
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
|
-
}
|
|
32
|
-
function D(e, l, t) {
|
|
33
|
-
const s = typeof e;
|
|
34
|
-
if (s === "string")
|
|
35
|
-
return A(l, e, t);
|
|
36
|
-
if (s === "number")
|
|
37
|
-
return A(l, "" + e, t);
|
|
38
|
-
if (e instanceof Array) {
|
|
39
|
-
const a = A("array", "", t);
|
|
40
|
-
return e.map((o) => a.append(D(o, l, t))), a;
|
|
41
|
-
}
|
|
42
|
-
if (e instanceof FormData) {
|
|
43
|
-
const a = A("form-data", "", t);
|
|
44
|
-
for (const o of e)
|
|
45
|
-
a.append(D(o[1], o[0], t));
|
|
46
|
-
return a;
|
|
47
|
-
}
|
|
48
|
-
const n = A(l, "", t);
|
|
49
|
-
for (let a in e)
|
|
50
|
-
oe(e[a]) || typeof e[a] == "function" || e[a] instanceof Window || (typeof e[a] != "object" && te(a) ? n.setAttribute(a, e[a]) : n.append(D(e[a], a, t)));
|
|
51
|
-
return n;
|
|
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, n = s.matchAll(/{([^}]*)}/g);
|
|
56
|
-
if (n) {
|
|
57
|
-
let a = 0, o = (p) => S(t, p), h = [];
|
|
58
|
-
if ([...n].forEach((p) => {
|
|
59
|
-
p.index > a && h.push(o(p.input.substring(a, p.index)));
|
|
60
|
-
const m = e.querySelector("value-of").cloneNode();
|
|
61
|
-
m.setAttribute("select", p[1]), h.push(m), a = p.index + p[0].length;
|
|
62
|
-
}), a < s.length && h.push(o(s.substring(a, s.length))), h.length) {
|
|
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(), n = ((i) => {
|
|
92
|
-
C(i, "script", (b) => b.remove());
|
|
93
|
-
const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
|
|
94
|
-
ve.forEach((b) => C(c, b, (v) => ge(v, c)));
|
|
95
|
-
const E = i.firstElementChild?.content || i.content, g = (b) => {
|
|
96
|
-
const v = M("<xhtml/>"), $ = v.importNode(b, !0);
|
|
97
|
-
return v.replaceChild($, v.documentElement), ee($);
|
|
98
|
-
};
|
|
99
|
-
if (E) {
|
|
100
|
-
const b = A("div");
|
|
101
|
-
return [...E.childNodes].map((v) => b.append(v.cloneNode(!0))), g(b);
|
|
102
|
-
}
|
|
103
|
-
return g(i.documentElement || i.body || i);
|
|
104
|
-
})(e), a = 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 o = s.transformToFragment(n, document), h = (i, c) => i.querySelector(c), p = h(a, 'template[mode="payload"]');
|
|
143
|
-
if (!o)
|
|
144
|
-
return console.error("transformation error", { xml: n.outerHTML, xsl: H(t) });
|
|
145
|
-
const m = [];
|
|
146
|
-
[...o.querySelectorAll("dce-root>attribute")].forEach((i) => {
|
|
147
|
-
const c = G(i, "xsl:param"), E = x(i, "name");
|
|
148
|
-
p.append(c);
|
|
149
|
-
let g = x(c, "select")?.split("??");
|
|
150
|
-
g || (g = ["//" + E, `'${c.textContent}'`], U(c), c.setAttribute("name", E));
|
|
151
|
-
let b;
|
|
152
|
-
if (g?.length > 1) {
|
|
153
|
-
c.removeAttribute("select");
|
|
154
|
-
const v = h(a, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
155
|
-
U(v.firstElementChild).append(S(v, "{" + g[0] + "}")), U(v.lastElementChild).append(S(v, "{" + g[1] + "}")), v.firstElementChild.setAttribute("test", g[0]), c.append(v), b = v.cloneNode(!0);
|
|
156
|
-
} else
|
|
157
|
-
b = G(i, "xsl:value-of");
|
|
158
|
-
b.removeAttribute("name"), i.append(b), i.removeAttribute("select"), m.push(c);
|
|
159
|
-
}), [...o.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
|
|
160
|
-
const c = x(i, "value");
|
|
161
|
-
c && i.setAttribute("value", be(c));
|
|
162
|
-
});
|
|
163
|
-
for (const i of o.childNodes)
|
|
164
|
-
p.append(a.importNode(i, !0));
|
|
165
|
-
[...p.querySelectorAll("template")].forEach((i) => p.ownerDocument.documentElement.append(i));
|
|
166
|
-
const P = h(a, 'call-template[name="slot"]'), d = (i) => {
|
|
167
|
-
const c = P.cloneNode(!0), E = x(i, "name");
|
|
168
|
-
E && c.firstElementChild.setAttribute("select", `'${E}'`);
|
|
169
|
-
for (let g of i.childNodes)
|
|
170
|
-
c.lastElementChild.append(g);
|
|
171
|
-
return c;
|
|
172
|
-
};
|
|
173
|
-
C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
|
|
174
|
-
const u = Z(a);
|
|
175
|
-
return u.params = m, u;
|
|
176
|
-
}
|
|
177
|
-
async function ue(e) {
|
|
178
|
-
return await new Promise((t, s) => {
|
|
179
|
-
const n = new XMLHttpRequest();
|
|
180
|
-
n.open("GET", e), n.responseType = "document", n.onload = () => {
|
|
181
|
-
n.readyState === n.DONE && n.status === 200 && t(n.responseXML || A("div", n.responseText)), s(n.statusText);
|
|
182
|
-
}, n.addEventListener("error", (a) => s(a)), n.send();
|
|
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, n = (a) => (e.append(a), a);
|
|
197
|
-
if (t.includes("/")) {
|
|
198
|
-
const a = [], o = s.evaluate(t, e);
|
|
199
|
-
for (let h; h = o.iterateNext(); )
|
|
200
|
-
a.push(h);
|
|
201
|
-
return a;
|
|
202
|
-
}
|
|
203
|
-
return [...e.childNodes].find((a) => a.localName === t) || n(A(t, "", s));
|
|
204
|
-
}).flat();
|
|
205
|
-
function J(e, l, t, s) {
|
|
206
|
-
if (!t.sliceProcessed)
|
|
207
|
-
return t.sliceProcessed = 1, pe(e, l ?? "").map((n) => {
|
|
208
|
-
const a = e.ownerDocument, o = t.sliceEventSource, h = t.sliceElement, p = () => [...n.childNodes].filter((m) => m.nodeType === 3 || m.localName === "value" || m.localName === "form-data").map((m) => m.remove());
|
|
209
|
-
if (o.getAttributeNames().map((m) => n.setAttribute(m, x(o, m))), [...n.childNodes].filter((m) => m.localName === "event").map((m) => m.remove()), "validationMessage" in o && n.setAttribute("validation-message", o.validationMessage), t.type === "init" && p(), n.append(D(t, "event", a)), h.hasAttribute("slice-value")) {
|
|
210
|
-
o.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", o.value);
|
|
211
|
-
const m = L(x(h, "slice-value"), n);
|
|
212
|
-
p(), n.append(S(a, m));
|
|
213
|
-
} else {
|
|
214
|
-
if ("elements" in o)
|
|
215
|
-
return p(), n.append(D(new FormData(o), "value", n.ownerDocument)), n;
|
|
216
|
-
const m = o.value ?? x(h, "value");
|
|
217
|
-
p(), m == null ? [...n.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : re(m) ? n.append(S(a, m)) : n.append(D(m, "value", n.ownerDocument));
|
|
218
|
-
}
|
|
219
|
-
return n;
|
|
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
|
-
if (!t) return [];
|
|
231
|
-
const s = t.querySelectorAll(e);
|
|
232
|
-
if (s.length)
|
|
233
|
-
return [...s];
|
|
234
|
-
const n = t.getRootNode();
|
|
235
|
-
return n === t ? [] : getByHashId(n);
|
|
236
|
-
})(l.parentElement);
|
|
237
|
-
try {
|
|
238
|
-
const t = await ue(e), s = new URL(e, location).hash;
|
|
239
|
-
if (s) {
|
|
240
|
-
const n = t.querySelectorAll(s);
|
|
241
|
-
return n.length ? [...n] : [l];
|
|
242
|
-
}
|
|
243
|
-
return [t];
|
|
244
|
-
} catch {
|
|
245
|
-
return [l];
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
function he(e, l) {
|
|
249
|
-
for (let t of e.attributes)
|
|
250
|
-
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
251
|
-
}
|
|
252
|
-
function le(e, l = 0) {
|
|
253
|
-
const t = {};
|
|
254
|
-
for (const s of e.childNodes) {
|
|
255
|
-
const n = x(s, "data-dce-id") || s.dceId || 0;
|
|
256
|
-
if (!t[n])
|
|
257
|
-
n ? t[n] = 1 : (t[n] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
258
|
-
else {
|
|
259
|
-
const a = s.dceId = n + "-" + t[n]++;
|
|
260
|
-
s.setAttribute && s.setAttribute("data-dce-id", a);
|
|
261
|
-
}
|
|
262
|
-
s.childNodes.length && le(s);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function xe(e, l, t) {
|
|
266
|
-
t = 1 * t;
|
|
267
|
-
for (let s of e.childNodes)
|
|
268
|
-
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
269
|
-
return e.insertBefore(l, s);
|
|
270
|
-
e.append(l);
|
|
271
|
-
}
|
|
272
|
-
function ne(e, l) {
|
|
273
|
-
if (!l.length)
|
|
274
|
-
return K(e);
|
|
275
|
-
const t = {};
|
|
276
|
-
for (let s of e.childNodes)
|
|
277
|
-
t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
278
|
-
for (let s of [...l]) {
|
|
279
|
-
const n = x(s, "data-dce-id") || s.dceId, a = t[n];
|
|
280
|
-
a ? (Y(s) ? a.nodeValue !== s.nodeValue && (a.nodeValue = s.nodeValue) : (he(s, a), (a.childNodes.length || s.childNodes.length) && ne(a, s.childNodes)), delete t[n]) : xe(e, s, n);
|
|
281
|
-
}
|
|
282
|
-
for (let s of Object.values(t))
|
|
283
|
-
s.remove();
|
|
284
|
-
}
|
|
285
|
-
function ye(e, l) {
|
|
286
|
-
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
287
|
-
}
|
|
288
|
-
const be = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
289
|
-
if (!e.trim())
|
|
290
|
-
return e;
|
|
291
|
-
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
292
|
-
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
293
|
-
}, L = (e, l) => {
|
|
294
|
-
const t = e.split("??");
|
|
295
|
-
if (t.length > 1)
|
|
296
|
-
return L(t[0], l) || L(t[1], l);
|
|
297
|
-
e = F(e);
|
|
298
|
-
const s = l.ownerDocument.evaluate(e, l);
|
|
299
|
-
switch (s.resultType) {
|
|
300
|
-
case XPathResult.NUMBER_TYPE:
|
|
301
|
-
return s.numberValue;
|
|
302
|
-
case XPathResult.STRING_TYPE:
|
|
303
|
-
return s.stringValue;
|
|
304
|
-
case XPathResult.BOOLEAN_TYPE:
|
|
305
|
-
return s.booleanValue;
|
|
306
|
-
}
|
|
307
|
-
let n = "";
|
|
308
|
-
for (let a; a = s.iterateNext(); )
|
|
309
|
-
n += a.textContent;
|
|
310
|
-
return n;
|
|
311
|
-
}, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,template,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), ge = (e, l) => {
|
|
312
|
-
const t = A("xsl:" + e.localName);
|
|
313
|
-
for (let s of e.attributes)
|
|
314
|
-
t.setAttribute(s.name, s.value);
|
|
315
|
-
for (; e.firstChild; )
|
|
316
|
-
t.append(e.firstChild);
|
|
317
|
-
if (e.parentElement)
|
|
318
|
-
e.parentElement.replaceChild(t, e);
|
|
319
|
-
else {
|
|
320
|
-
const s = e.parentElement || l, n = [...s.childNodes];
|
|
321
|
-
n.forEach((a, o) => {
|
|
322
|
-
a === e && (n[o] = t);
|
|
323
|
-
}), s.replaceChildren(...n);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
class Ee extends HTMLElement {
|
|
327
|
-
static observedAttributes = ["src", "tag", "hidden"];
|
|
328
|
-
async connectedCallback() {
|
|
329
|
-
const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
330
|
-
for (const d of l)
|
|
331
|
-
C(d.templateNode || d.content || d, "style", (u) => {
|
|
332
|
-
const i = u.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
|
|
333
|
-
u.innerHTML = `${s} ${c}{${u.innerHTML}}`, this.append(u);
|
|
334
|
-
});
|
|
335
|
-
const n = l.map((d) => me(d)), a = n.map((d, u) => (u = new XSLTProcessor(), u.importStylesheet(d), u));
|
|
336
|
-
Object.defineProperty(this, "xsltString", { get: () => n.map((d) => H(d)).join(`
|
|
337
|
-
`) });
|
|
338
|
-
const o = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, u, i) => i.indexOf(d) === u).map(se).flat(), m = n.reduce((d, u) => (u.params && d.push(...u.params), d), []);
|
|
339
|
-
class w extends HTMLElement {
|
|
340
|
-
static get observedAttributes() {
|
|
341
|
-
return m.map((u) => x(u, "name"));
|
|
342
|
-
}
|
|
343
|
-
#e = 0;
|
|
344
|
-
connectedCallback() {
|
|
345
|
-
let u = this.childNodes;
|
|
346
|
-
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
347
|
-
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
348
|
-
const f = this.firstElementChild;
|
|
349
|
-
f.remove(), u = f.content.childNodes;
|
|
350
|
-
for (const r of [...f.content.childNodes])
|
|
351
|
-
if (r.localName === "style") {
|
|
352
|
-
const y = ye(this, "data-dce-style");
|
|
353
|
-
r.innerHTML = `${s}[data-dce-style="${y}"]{${r.innerHTML}}`, f.insertAdjacentElement("beforebegin", r);
|
|
354
|
-
} else
|
|
355
|
-
r.nodeType === 1 ? f.insertAdjacentElement("beforebegin", r) : r.nodeType === 3 && f.insertAdjacentText("beforebegin", r.data);
|
|
356
|
-
}
|
|
357
|
-
const i = M("<datadom/>").documentElement, c = (f, r = "") => ((y) => (r && y.append(S(i, r)), y))(i.ownerDocument.createElement(f)), E = X(i, "payload", u, ce);
|
|
358
|
-
Q(E), ee(E), this.innerHTML = "";
|
|
359
|
-
const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
|
|
360
|
-
X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
|
|
361
|
-
const b = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, b);
|
|
362
|
-
this.xml = i;
|
|
363
|
-
const $ = [], W = () => {
|
|
364
|
-
const f = {};
|
|
365
|
-
for (let r; r = $.pop(); ) {
|
|
366
|
-
const y = x(r.sliceElement, "slice");
|
|
367
|
-
f[y] || (J(b, y, r), f[y] = r);
|
|
368
|
-
}
|
|
369
|
-
Object.keys(f).length !== 0 && I();
|
|
370
|
-
};
|
|
371
|
-
let V;
|
|
372
|
-
this.onSlice = (f) => {
|
|
373
|
-
$.push(f), V || (V = setTimeout(() => {
|
|
374
|
-
W(), V = 0;
|
|
375
|
-
}, 1));
|
|
376
|
-
};
|
|
377
|
-
const I = this.transform = () => {
|
|
378
|
-
if (this.#e)
|
|
379
|
-
debugger;
|
|
380
|
-
this.#e = 1, a.map((r, y) => {
|
|
381
|
-
const R = r.transformToFragment(i.ownerDocument, document);
|
|
382
|
-
return R || console.error(`XSLT transformation error. xsl:
|
|
383
|
-
`, H(n[y]), `
|
|
384
|
-
xml:
|
|
385
|
-
`, H(i)), R;
|
|
386
|
-
}).map((r) => {
|
|
387
|
-
r && (le(r), ne(this, r.childNodes));
|
|
388
|
-
}), w.observedAttributes.map((r) => {
|
|
389
|
-
let y = x(this.firstElementChild, r);
|
|
390
|
-
y !== x(this, r) && (this.setAttribute(r, y), this.#t(r, y));
|
|
391
|
-
}), C(this, "[slice],[slice-event]", (r) => {
|
|
392
|
-
if (!r.dceInitialized) {
|
|
393
|
-
r.dceInitialized = 1;
|
|
394
|
-
let y = x(r, "slice-event");
|
|
395
|
-
r.hasAttribute("custom-validity") && (y += " change submit"), [...new Set((y || "change").split(" "))].forEach((R) => (r.localName === "slice" ? r.parentElement : r).addEventListener(R, (N) => {
|
|
396
|
-
N.sliceElement = r, N.sliceEventSource = N.currentTarget || N.target;
|
|
397
|
-
const ae = J(b, x(N.sliceElement, "slice"), N);
|
|
398
|
-
C(this, "[custom-validity]", (z) => {
|
|
399
|
-
if (!z.setCustomValidity)
|
|
400
|
-
return;
|
|
401
|
-
const _ = x(z, "custom-validity");
|
|
402
|
-
try {
|
|
403
|
-
const j = _ && L(_, g);
|
|
404
|
-
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
405
|
-
} catch (j) {
|
|
406
|
-
console.error(j, "xPath", _);
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
const k = x(r, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
|
|
410
|
-
if (k) {
|
|
411
|
-
if (r.setCustomValidity ? r.setCustomValidity(O) : r.validationMessage = O, ae.map((z) => z.setAttribute("validation-message", O)), N.type === "submit")
|
|
412
|
-
return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || N.preventDefault(), T) : T ? (N.preventDefault(), !1) : void 0);
|
|
413
|
-
setTimeout(I, 1);
|
|
414
|
-
}
|
|
415
|
-
this.onSlice(N);
|
|
416
|
-
})), (!y || y.includes("init")) && (r.hasAttribute("slice-value") || r.hasAttribute("value") || r.value ? this.onSlice({ type: "init", target: r, sliceElement: r, sliceEventSource: r }) : r.value = v(x(r, "slice")));
|
|
417
|
-
}
|
|
418
|
-
}), this.#e = 0;
|
|
419
|
-
};
|
|
420
|
-
I(), W();
|
|
421
|
-
}
|
|
422
|
-
#t(u, i) {
|
|
423
|
-
let c = this.xml.querySelector(`attributes>${u}`);
|
|
424
|
-
c ? U(c).append(S(c, i)) : (c = A(u, i, this.xml), this.xml.querySelector("attributes").append(c));
|
|
425
|
-
}
|
|
426
|
-
attributeChangedCallback(u, i, c) {
|
|
427
|
-
!this.xml || this.#e || (this.#t(u, c), this.transform());
|
|
428
|
-
}
|
|
429
|
-
get dce() {
|
|
430
|
-
return o;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
const P = (d) => {
|
|
434
|
-
window.customElements.get(d) !== w && window.customElements.define(d, w);
|
|
435
|
-
};
|
|
436
|
-
if (t)
|
|
437
|
-
P(t);
|
|
438
|
-
else {
|
|
439
|
-
const d = s;
|
|
440
|
-
this.setAttribute("tag", d), P(d);
|
|
441
|
-
const u = document.createElement(d);
|
|
442
|
-
this.getAttributeNames().forEach((i) => u.setAttribute(i, this.getAttribute(i))), u.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(u);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
get templateNode() {
|
|
446
|
-
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
447
|
-
}
|
|
448
|
-
get dce() {
|
|
449
|
-
return this;
|
|
450
|
-
}
|
|
451
|
-
get xslt() {
|
|
452
|
-
return M(this.xsltString);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
window.customElements.define("custom-element", Ee);
|
|
456
|
-
export {
|
|
457
|
-
Ee as C,
|
|
458
|
-
H as a,
|
|
459
|
-
ue as b,
|
|
460
|
-
me as c,
|
|
461
|
-
de as d,
|
|
462
|
-
pe as e,
|
|
463
|
-
J as f,
|
|
464
|
-
le as g,
|
|
465
|
-
xe as h,
|
|
466
|
-
ne as i,
|
|
467
|
-
ye as j,
|
|
468
|
-
be as k,
|
|
469
|
-
F as l,
|
|
470
|
-
he as m,
|
|
471
|
-
L as n,
|
|
472
|
-
D as o,
|
|
473
|
-
ve as p,
|
|
474
|
-
ge as q,
|
|
475
|
-
Z as t,
|
|
476
|
-
M as x
|
|
477
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";const F="http://www.w3.org/1999/XSL/Transform",q="http://www.w3.org/1999/xhtml",ye="http://exslt.org/common",x=(e,l)=>e.getAttribute?.(l),K=e=>e.nodeType===3,be=e=>typeof e=="string",ge=e=>e&&typeof e.nodeType=="number",S=(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),A=(e,l="",t=document)=>{const s=a=>(o=>(l&&o.append(S(t.ownerDocument||t,l)),o))((t.ownerDocument||t).createElement(a));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 $(e){return new DOMParser().parseFromString(e,"application/xml")}function I(e){return new XMLSerializer().serializeToString(e)}function U(e,l,t,s){const n=h=>e.ownerDocument.createElement(h),o=((h,p,m)=>(p.append(m=n(h)),m))(l,e);return[...t].forEach(h=>o.append(s(h))),o}function ve(e){return e.slot||(e.setAttribute||(e=A("span",e.textContent.replaceAll(`
|
|
2
|
-
`,""))),e.setAttribute("slot","")),e}function C(e,l,t){const s=typeof e;if(s==="string")return A(l,e,t);if(s==="number")return A(l,""+e,t);if(e instanceof Array){const a=A("array","",t);return e.map(o=>a.append(C(o,l,t))),a}if(e instanceof FormData){const a=A("form-data","",t);for(const o of e)a.append(C(o[1],o[0],t));return a}const n=A(l,"",t);for(let a in e)ge(e[a])||typeof e[a]=="function"||e[a]instanceof Window||(typeof e[a]!="object"&&le(a)?n.setAttribute(a,e[a]):n.append(C(e[a],a,t)));return n}function W(e){if(D(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 a=0,o=p=>S(t,p),h=[];if([...n].forEach(p=>{p.index>a&&h.push(o(p.input.substring(a,p.index)));const m=e.querySelector("value-of").cloneNode();m.setAttribute("select",p[1]),h.push(m),a=p.index+p[0].length}),a<s.length&&h.push(o(s.substring(a,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=$(`<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']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
6
|
-
<xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
7
|
-
<xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
|
|
8
|
-
<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>
|
|
9
|
-
<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>
|
|
10
|
-
<xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
|
|
11
|
-
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
12
|
-
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
13
|
-
<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>
|
|
14
|
-
<xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
|
|
15
|
-
</xsl:stylesheet>`),s=new XSLTProcessor,n=(i=>{D(i,"script",b=>b.remove());const c=i.content??i.firstElementChild?.content??i.body??i;pe.forEach(b=>D(c,b,g=>fe(g,c)));const E=i.firstElementChild?.content||i.content,v=b=>{const g=$("<xhtml/>"),z=g.importNode(b,!0);return g.replaceChild(z,g.documentElement),se(z)};if(E){const b=A("div");return[...E.childNodes].map(g=>b.append(g.cloneNode(!0))),v(b)}return v(i.documentElement||i.body||i)})(e),a=$(`<xsl:stylesheet version="1.0"
|
|
16
|
-
xmlns:xsl="${F}"
|
|
17
|
-
xmlns:xhtml="${q}"
|
|
18
|
-
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
19
|
-
xmlns:exsl="http://exslt.org/common"
|
|
20
|
-
exclude-result-prefixes="exsl"
|
|
21
|
-
>
|
|
22
|
-
<xsl:template match="ignore">
|
|
23
|
-
<xsl:choose>
|
|
24
|
-
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
25
|
-
<xsl:otherwise>{def}</xsl:otherwise>
|
|
26
|
-
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
27
|
-
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
28
|
-
<xsl:template match="/">
|
|
29
|
-
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
30
|
-
</xsl:template>
|
|
31
|
-
<xsl:template name="slot" >
|
|
32
|
-
<xsl:param name="slotname" />
|
|
33
|
-
<xsl:param name="defaultvalue" />
|
|
34
|
-
<xsl:choose>
|
|
35
|
-
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
36
|
-
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
37
|
-
</xsl:when>
|
|
38
|
-
<xsl:otherwise>
|
|
39
|
-
<xsl:copy-of select="$defaultvalue"/>
|
|
40
|
-
</xsl:otherwise>
|
|
41
|
-
</xsl:choose>
|
|
42
|
-
</xsl:template>
|
|
43
|
-
<xsl:variable name="js-injected-body">
|
|
44
|
-
<xsl:call-template name="slot" >
|
|
45
|
-
<xsl:with-param name="slotname" select="''"/>
|
|
46
|
-
<xsl:with-param name="defaultvalue"/>
|
|
47
|
-
</xsl:call-template>
|
|
48
|
-
</xsl:variable>
|
|
49
|
-
</xsl:stylesheet>`);s.importStylesheet(t);const o=s.transformToFragment(n,document),h=(i,c)=>i.querySelector(c),p=h(a,'template[mode="payload"]');if(!o)return console.error("transformation error",{xml:n.outerHTML,xsl:I(t)});const m=[];[...o.querySelectorAll("dce-root>attribute")].forEach(i=>{const c=Q(i,"xsl:param"),E=x(i,"name");p.append(c);let v=x(c,"select")?.split("??");v||(v=["//"+E,`'${c.textContent}'`],H(c),c.setAttribute("name",E));let b;if(v?.length>1){c.removeAttribute("select");const g=h(a,'template[match="ignore"]>choose').cloneNode(!0);H(g.firstElementChild).append(S(g,"{"+v[0]+"}")),H(g.lastElementChild).append(S(g,"{"+v[1]+"}")),g.firstElementChild.setAttribute("test",v[0]),c.append(g),b=g.cloneNode(!0)}else b=Q(i,"xsl:value-of");b.removeAttribute("name"),i.append(b),i.removeAttribute("select"),m.push(c)}),[...o.querySelectorAll("[value]")].filter(i=>i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(i=>{const c=x(i,"value");c&&i.setAttribute("value",de(c))});for(const i of o.childNodes)p.append(a.importNode(i,!0));[...p.querySelectorAll("template")].forEach(i=>p.ownerDocument.documentElement.append(i));const M=h(a,'call-template[name="slot"]'),d=i=>{const c=M.cloneNode(!0),E=x(i,"name");E&&c.firstElementChild.setAttribute("select",`'${E}'`);for(let v of i.childNodes)c.lastElementChild.append(v);return c};D(p,"slot",i=>i.parentNode.replaceChild(d(i),i));const u=W(a);return u.params=m,u}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||A("div",n.responseText)),s(n.statusText)},n.addEventListener("error",a=>s(a)),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 re=e=>e.split("|").map(l=>l.trim()).filter(l=>l),oe=(e,l)=>re(l).map(t=>{let s=e.ownerDocument,n=a=>(e.append(a),a);if(t.includes("/")){const a=[],o=s.evaluate(t,e);for(let h;h=o.iterateNext();)a.push(h);return a}return[...e.childNodes].find(a=>a.localName===t)||n(A(t,"",s))}).flat();function Y(e,l,t,s){if(!t.sliceProcessed)return t.sliceProcessed=1,oe(e,l??"").map(n=>{const a=e.ownerDocument,o=t.sliceEventSource,h=t.sliceElement,p=()=>[...n.childNodes].filter(m=>m.nodeType===3||m.localName==="value"||m.localName==="form-data").map(m=>m.remove());if(o.getAttributeNames().map(m=>n.setAttribute(m,x(o,m))),[...n.childNodes].filter(m=>m.localName==="event").map(m=>m.remove()),"validationMessage"in o&&n.setAttribute("validation-message",o.validationMessage),t.type==="init"&&p(),n.append(C(t,"event",a)),h.hasAttribute("slice-value")){o.value===void 0?n.removeAttribute("value"):n.setAttribute("value",o.value);const m=L(x(h,"slice-value"),n);p(),n.append(S(a,m))}else{if("elements"in o)return p(),n.append(C(new FormData(o),"value",n.ownerDocument)),n;const m=o.value??x(h,"value");p(),m==null?[...n.childNodes].filter(w=>w.localName!=="event").map(w=>w.remove()):be(m)?n.append(S(a,m)):n.append(C(m,"value",n.ownerDocument))}return n})}function D(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=>{if(!t)return[];const s=t.querySelectorAll(e);if(s.length)return[...s];const n=t.getRootNode();return n===t?[]:getByHashId(n)})(l.parentElement);try{const t=await ae(e),s=new URL(e,location).hash;if(s){const n=t.querySelectorAll(s);return n.length?[...n]:[l]}return[t]}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=x(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 a=s.dceId=n+"-"+t[n]++;s.setAttribute&&s.setAttribute("data-dce-id",a)}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(!l.length)return ee(e);const t={};for(let s of e.childNodes)t[s.dceId],K(s)?(s.data.trim(),t[s.dceId||0]=s):t[x(s,"data-dce-id")||0]=s;for(let s of[...l]){const n=x(s,"data-dce-id")||s.dceId,a=t[n];a?(K(s)?a.nodeValue!==s.nodeValue&&(a.nodeValue=s.nodeValue):(ce(s,a),(a.childNodes.length||s.childNodes.length)&&Z(a,s.childNodes)),delete t[n]):me(e,s,n)}for(let s of Object.values(t))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},L=(e,l)=>{const t=e.split("??");if(t.length>1)return L(t[0],l)||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 a;a=s.iterateNext();)n+=a.textContent;return n},pe="stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,template,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","),fe=(e,l)=>{const t=A("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((a,o)=>{a===e&&(n[o]=t)}),s.replaceChildren(...n)}};class he extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){const l=await Ee(x(this,"src"),this),t=x(this,"tag"),s=t||"dce-"+crypto.randomUUID();for(const d of l)D(d.templateNode||d.content||d,"style",u=>{const i=u.closest("slot"),c=i?`slot[name="${i.name}"]`:"";u.innerHTML=`${s} ${c}{${u.innerHTML}}`,this.append(u)});const n=l.map(d=>ne(d)),a=n.map((d,u)=>(u=new XSLTProcessor,u.importStylesheet(d),u));Object.defineProperty(this,"xsltString",{get:()=>n.map(d=>I(d)).join(`
|
|
50
|
-
`)});const o=this,h=[...this.templateNode.querySelectorAll("[slice]")],p=h.map(d=>x(d,"slice")).filter(d=>!d.includes("/")).filter((d,u,i)=>i.indexOf(d)===u).map(re).flat(),m=n.reduce((d,u)=>(u.params&&d.push(...u.params),d),[]);class w extends HTMLElement{static get observedAttributes(){return m.map(u=>x(u,"name"))}#e=0;connectedCallback(){let u=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(),u=f.content.childNodes;for(const r of[...f.content.childNodes])if(r.localName==="style"){const y=ue(this,"data-dce-style");r.innerHTML=`${s}[data-dce-style="${y}"]{${r.innerHTML}}`,f.insertAdjacentElement("beforebegin",r)}else r.nodeType===1?f.insertAdjacentElement("beforebegin",r):r.nodeType===3&&f.insertAdjacentText("beforebegin",r.data)}const i=$("<datadom/>").documentElement,c=(f,r="")=>(y=>(r&&y.append(S(i,r)),y))(i.ownerDocument.createElement(f)),E=U(i,"payload",u,ve);te(E),se(E),this.innerHTML="";const v=U(i,"attributes",this.attributes,f=>c(f.nodeName,f.value));U(i,"dataset",Object.keys(this.dataset),f=>c(f,this.dataset[f]));const b=U(i,"slice",p,f=>c(f,"")),g=f=>L(f,b);this.xml=i;const z=[],J=()=>{const f={};for(let r;r=z.pop();){const y=x(r.sliceElement,"slice");f[y]||(Y(b,y,r),f[y]=r)}Object.keys(f).length!==0&&R()};let O;this.onSlice=f=>{z.push(f),O||(O=setTimeout(()=>{J(),O=0},1))};const R=this.transform=()=>{if(this.#e)debugger;this.#e=1,a.map((r,y)=>{const X=r.transformToFragment(i.ownerDocument,document);return X||console.error(`XSLT transformation error. xsl:
|
|
51
|
-
`,I(n[y]),`
|
|
52
|
-
xml:
|
|
53
|
-
`,I(i)),X}).map(r=>{r&&(G(r),Z(this,r.childNodes))}),w.observedAttributes.map(r=>{let y=x(this.firstElementChild,r);y!==x(this,r)&&(this.setAttribute(r,y),this.#t(r,y))}),D(this,"[slice],[slice-event]",r=>{if(!r.dceInitialized){r.dceInitialized=1;let y=x(r,"slice-event");r.hasAttribute("custom-validity")&&(y+=" change submit"),[...new Set((y||"change").split(" "))].forEach(X=>(r.localName==="slice"?r.parentElement:r).addEventListener(X,N=>{N.sliceElement=r,N.sliceEventSource=N.currentTarget||N.target;const xe=Y(b,x(N.sliceElement,"slice"),N);D(this,"[custom-validity]",j=>{if(!j.setCustomValidity)return;const B=x(j,"custom-validity");try{const P=B&&L(B,v);j.setCustomValidity(P===!0?"":P===!1?"invalid":P)}catch(P){console.error(P,"xPath",B)}});const _=x(r,"custom-validity"),T=_&&L(_,v),k=T===!0?"":T;if(_){if(r.setCustomValidity?r.setCustomValidity(k):r.validationMessage=k,xe.map(j=>j.setAttribute("validation-message",k)),N.type==="submit")return T===!0?void 0:(setTimeout(R,1),!!T===T?(T||N.preventDefault(),T):T?(N.preventDefault(),!1):void 0);setTimeout(R,1)}this.onSlice(N)})),(!y||y.includes("init"))&&(r.hasAttribute("slice-value")||r.hasAttribute("value")||r.value?this.onSlice({type:"init",target:r,sliceElement:r,sliceEventSource:r}):r.value=g(x(r,"slice")))}}),this.#e=0};R(),J()}#t(u,i){let c=this.xml.querySelector(`attributes>${u}`);c?H(c).append(S(c,i)):(c=A(u,i,this.xml),this.xml.querySelector("attributes").append(c))}attributeChangedCallback(u,i,c){!this.xml||this.#e||(this.#t(u,c),this.transform())}get dce(){return o}}const M=d=>{window.customElements.get(d)!==w&&window.customElements.define(d,w)};if(t)M(t);else{const d=s;this.setAttribute("tag",d),M(d);const u=document.createElement(d);this.getAttributeNames().forEach(i=>u.setAttribute(i,this.getAttribute(i))),u.append(...[...this.childNodes].filter(i=>i.localName!=="style")),this.append(u)}}get templateNode(){return this.firstElementChild?.tagName==="TEMPLATE"?this.firstElementChild.content:this}get dce(){return this}get xslt(){return $(this.xsltString)}}window.customElements.define("custom-element",he);exports.CustomElement=he;exports.appendByDceId=me;exports.assureSlices=oe;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=C;exports.tagUid=W;exports.toXsl=fe;exports.xPath=L;exports.xPathDefaults=V;exports.xhrTemplate=ae;exports.xml2dom=$;exports.xmlString=I;exports.xslTags=pe;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=(t,e)=>{if(t==="text")return e;if(t==="json")try{return JSON.parse(e)}catch{return null}const a=document.createElement("input");return a.setAttribute("type",t),t==="number"?(a.value=e,a.valueAsNumber):t==="date"?e?(a.valueAsDate=new Date(e),a.value):null:(a.value=e,a.value)};let n,i,s;function d(){n||(n=localStorage.setItem,localStorage.setItem=function(t,e,...a){n.apply(this,[t,e,...a]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t,value:e}}))},i=localStorage.removeItem,localStorage.removeItem=function(t,...e){i.apply(this,[t,...e]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t}}))},s=localStorage.clear,localStorage.clear=function(...t){s.apply(this,[...t]),window.dispatchEvent(new CustomEvent("local-storage",{detail:{}}))})}function c(t,e){localStorage.setItem(t,e),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:t,value:e}}))}class u extends HTMLElement{static observedAttributes=["value","slice","key","type","live"];#e;get value(){return this.#e===null?void 0:this.#e}set value(e){return this.#e=e}async connectedCallback(){const e=l=>this.getAttribute(l),a=()=>{this.#e=r(e("type"),localStorage.getItem(e("key"))),this.dispatchEvent(new Event("change"))};if(this.#e=r(e("type"),localStorage.getItem(e("key"))),this.hasAttribute("value")?c(e("key"),this.#e=e("value")):a(),this.hasAttribute("live")){const l=o=>(o.detail.key===e("key")||!o.detail.key)&&a();window.addEventListener("local-storage",l),d(),this._destroy=()=>window.removeEventListener("local-storage",l)}}disconnectedCallback(){this._destroy?.()}}window.customElements.define("local-storage",u);exports.LocalStorageElement=u;exports.localStorageSetItem=c;
|