@epa-wg/custom-element-dist 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +19 -21
- package/.storybook/preview-head.html +8 -0
- package/.storybook/preview.ts +13 -5
- package/README.md +4 -4
- package/bin/postinstall.sh +3 -2
- package/bin/vitest/vitest-browser-importmaps.mjs +20 -0
- package/coverage/coverage-final.json +13 -8
- package/coverage/index.html +51 -36
- package/coverage/src/custom-element/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/custom-element.js.html +493 -406
- package/coverage/src/custom-element/demo/coverage.svg +10 -0
- package/coverage/src/custom-element/demo/index.html +116 -0
- package/coverage/src/custom-element/demo/z.js/coverage.svg +10 -0
- package/coverage/src/custom-element/demo/z.js.html +112 -0
- package/coverage/src/custom-element/http-request.js.html +12 -12
- package/coverage/src/custom-element/index.html +37 -22
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js/coverage.svg +1 -1
- package/coverage/src/custom-element/location-element.js.html +116 -47
- package/coverage/src/custom-element/module-url.js/coverage.svg +10 -0
- package/coverage/src/custom-element/module-url.js.html +181 -0
- package/coverage/src/index.html +1 -1
- package/coverage/src/mocks/coverage.svg +1 -1
- package/coverage/src/mocks/handlers.ts/coverage.svg +1 -1
- package/coverage/src/mocks/handlers.ts.html +36 -12
- package/coverage/src/mocks/index.html +19 -19
- package/coverage/src/stories/attributes.test.stories.ts.html +6 -9
- package/coverage/src/stories/coverage.svg +1 -1
- package/coverage/src/stories/css.test.stories.ts.html +1 -1
- package/coverage/src/stories/dom-merge.test.stories.ts.html +1 -1
- package/coverage/src/stories/external-template.test.stories.ts.html +22 -10
- package/coverage/src/stories/form.test.stories.ts.html +1 -1
- package/coverage/src/stories/http-request.stories.ts.html +1 -1
- package/coverage/src/stories/index.html +58 -13
- package/coverage/src/stories/local-storage.test.stories.ts.html +1 -1
- package/coverage/src/stories/location-element.test.stories.ts.html +1 -1
- package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/module-url.test.stories.ts.html +634 -0
- package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/set-url.test.stories.ts.html +427 -0
- package/coverage/src/stories/slice-events.test.stories.ts.html +1 -1
- package/coverage/src/stories/slots.test.stories.ts.html +1 -1
- package/coverage/src/stories/testStoryBook.ts.html +12 -12
- package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +10 -0
- package/coverage/src/stories/version-select.test.stories.ts.html +391 -0
- package/coverage/src/sum.ts.html +1 -1
- package/dist/confused.svg +1 -0
- package/dist/custom-element-CckoVsvO.cjs +53 -0
- package/dist/custom-element-b7c_7Kz4.js +485 -0
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +3 -3
- package/dist/demo/a.html +60 -0
- package/dist/demo/b.html +13 -0
- package/dist/demo/confused.svg +38 -0
- package/dist/demo/data-slices.html +216 -0
- package/dist/demo/dce-social-preview.png +0 -0
- package/dist/demo/demo.css +26 -0
- package/dist/demo/dom-merge.html +123 -0
- package/dist/demo/embed-1.html +2 -0
- package/dist/demo/external-template.html +239 -0
- package/dist/demo/form.html +239 -0
- package/dist/demo/hex-grid-dce.html +183 -0
- package/dist/demo/hex-grid-transform.png +0 -0
- package/dist/demo/hex-grid.html +66 -0
- package/dist/demo/html-template.html +126 -0
- package/dist/demo/html-template.xhtml +45 -0
- package/dist/demo/html-template.xml +45 -0
- package/dist/demo/http-request.html +143 -0
- package/dist/demo/lib-dir/Smiley.svg +24 -0
- package/dist/demo/lib-dir/embed-lib.html +34 -0
- package/dist/demo/local-storage.html +218 -0
- package/dist/demo/location-element.html +168 -0
- package/dist/demo/logo.png +0 -0
- package/dist/demo/module-url.html +215 -0
- package/dist/demo/npm-versions-demo.html +105 -0
- package/dist/demo/npm-versions.html +65 -0
- package/dist/demo/parameters.html +70 -0
- package/dist/demo/s.xml +28 -0
- package/dist/demo/s.xslt +97 -0
- package/dist/demo/s1.xslt +60 -0
- package/dist/demo/scoped-css.html +169 -0
- package/dist/demo/set-url.html +141 -0
- package/dist/demo/ss.html +57 -0
- package/dist/demo/table.xml +25 -0
- package/dist/demo/table.xsl +293 -0
- package/dist/demo/template.xsl +46 -0
- package/dist/demo/tree.xml +25 -0
- package/dist/demo/tree.xsl +33 -0
- package/dist/demo/wc-square.svg +1 -0
- package/dist/demo/xhtml-template.xhtml +45 -0
- package/dist/demo/z.html +62 -0
- package/dist/demo/z.js +9 -0
- package/dist/demo/z.xml +60 -0
- package/dist/embed-1.html +1 -2
- package/dist/location-element-DRB7hCwA.cjs +1 -0
- package/dist/location-element-FJlONi2n.js +65 -0
- package/dist/mockServiceWorker.js +1 -1
- package/package.json +93 -93
- package/public/confused.svg +1 -0
- package/public/demo/a.html +60 -0
- package/public/demo/b.html +13 -0
- package/public/demo/confused.svg +38 -0
- package/public/demo/data-slices.html +216 -0
- package/public/demo/dce-social-preview.png +0 -0
- package/public/demo/demo.css +26 -0
- package/public/demo/dom-merge.html +123 -0
- package/public/demo/embed-1.html +2 -0
- package/public/demo/external-template.html +239 -0
- package/public/demo/form.html +239 -0
- package/public/demo/hex-grid-dce.html +183 -0
- package/public/demo/hex-grid-transform.png +0 -0
- package/public/demo/hex-grid.html +66 -0
- package/public/demo/html-template.html +126 -0
- package/public/demo/html-template.xhtml +45 -0
- package/public/demo/html-template.xml +45 -0
- package/public/demo/http-request.html +143 -0
- package/public/demo/lib-dir/Smiley.svg +24 -0
- package/public/demo/lib-dir/embed-lib.html +34 -0
- package/public/demo/local-storage.html +218 -0
- package/public/demo/location-element.html +168 -0
- package/public/demo/logo.png +0 -0
- package/public/demo/module-url.html +215 -0
- package/public/demo/npm-versions-demo.html +105 -0
- package/public/demo/npm-versions.html +65 -0
- package/public/demo/parameters.html +70 -0
- package/public/demo/s.xml +28 -0
- package/public/demo/s.xslt +97 -0
- package/public/demo/s1.xslt +60 -0
- package/public/demo/scoped-css.html +169 -0
- package/public/demo/set-url.html +141 -0
- package/public/demo/ss.html +57 -0
- package/public/demo/table.xml +25 -0
- package/public/demo/table.xsl +293 -0
- package/public/demo/template.xsl +46 -0
- package/public/demo/tree.xml +25 -0
- package/public/demo/tree.xsl +33 -0
- package/public/demo/wc-square.svg +1 -0
- package/public/demo/xhtml-template.xhtml +45 -0
- package/public/demo/z.html +62 -0
- package/public/demo/z.js +9 -0
- package/public/demo/z.xml +60 -0
- package/public/embed-1.html +1 -2
- package/public/mockServiceWorker.js +1 -1
- package/src/custom-element/custom-element.js +52 -23
- package/src/custom-element/demo/confused.svg +1 -0
- package/src/custom-element/demo/demo.css +5 -1
- package/src/custom-element/demo/embed-1.html +1 -2
- package/src/custom-element/demo/external-template.html +122 -62
- package/src/custom-element/demo/lib-dir/Smiley.svg +24 -0
- package/src/custom-element/demo/lib-dir/embed-lib.html +34 -0
- package/src/custom-element/demo/location-element.html +17 -4
- package/src/custom-element/demo/module-url.html +215 -0
- package/src/custom-element/demo/npm-versions-demo.html +105 -0
- package/src/custom-element/demo/npm-versions.html +65 -0
- package/src/custom-element/demo/s.xml +27 -10
- package/src/custom-element/demo/s.xslt +96 -59
- package/src/custom-element/demo/set-url.html +141 -0
- package/src/custom-element/demo/z.js +9 -0
- package/src/custom-element/ide/customData-dce.json +215 -125
- package/src/custom-element/ide/web-types-dce.json +184 -116
- package/src/custom-element/ide/web-types-xsl.json +1 -1
- package/src/custom-element/index.html +3 -1
- package/src/custom-element/location-element.js +25 -2
- package/src/custom-element/module-url.js +33 -0
- package/src/custom-element.test.ts +26 -26
- package/src/mocks/handlers.ts +10 -1
- package/src/mocks/versions.mock.ts +786 -0
- package/src/stories/attributes.test.stories.ts +0 -1
- package/src/stories/external-template.test.stories.ts +11 -7
- package/src/stories/module-url.test.stories.ts +183 -0
- package/src/stories/set-url.test.stories.ts +114 -0
- package/src/stories/version-select.test.stories.ts +102 -0
- package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +1 -0
- package/storybook-static/assets/{Configure-CyLVkwlf.js → Configure-DFL_bm2M.js} +2 -2
- package/storybook-static/assets/DocsRenderer-PKQXORMH-Bz-_1hmS.js +2 -0
- package/storybook-static/assets/{attributes.test.stories-BckCcyrF.js → attributes.test.stories-DIQXccHc.js} +2 -3
- package/storybook-static/assets/{css.test.stories-B-QcObCF.js → css.test.stories-BV2hi4CY.js} +1 -1
- package/storybook-static/assets/custom-element-wn23PUwN.js +231 -0
- package/storybook-static/assets/{dom-merge.test.stories-CjXhjTQY.js → dom-merge.test.stories-Dws0C2-g.js} +1 -1
- package/storybook-static/assets/{entry-preview-DrgzXgwT.js → entry-preview-BKQ8UCxI.js} +1 -1
- package/storybook-static/assets/{entry-preview-docs-Bxv0qQWs.js → entry-preview-docs-BMKNVQXA.js} +2 -2
- package/storybook-static/assets/{external-template.test.stories-BBqyi0az.js → external-template.test.stories-BHO48b0j.js} +19 -16
- package/storybook-static/assets/{form.test.stories-DsIo1B4n.js → form.test.stories-dv9mwp24.js} +1 -1
- package/storybook-static/assets/handlers-CaCq2ZPF.js +467 -0
- package/storybook-static/assets/http-request-DNq59pnj.js +1 -0
- package/storybook-static/assets/http-request.stories-B2ke7LtS.js +281 -0
- package/storybook-static/assets/iframe-D4Sos1HO.js +2 -0
- package/storybook-static/assets/index-BnXBQqj9.js +605 -0
- package/storybook-static/assets/index-C8k3Z-3Y.js +28 -0
- package/storybook-static/assets/index-Cpxqn5iQ.js +1 -0
- package/storybook-static/assets/{index-DXimoRZY.js → index-D-8MO0q_.js} +1 -1
- package/storybook-static/assets/index-DGdNYaqV.js +8 -0
- package/storybook-static/assets/index-Dz4OaB2k.js +1 -0
- package/storybook-static/assets/index-sm7QlJZE.js +1 -0
- package/storybook-static/assets/lit-element-DzhCn-8W.js +19 -0
- package/storybook-static/assets/{local-storage.test.stories-Cs2v3QTS.js → local-storage.test.stories-BpogLNq-.js} +1 -1
- package/storybook-static/assets/location-element-hKpcXCdn.js +1 -0
- package/storybook-static/assets/{location-element.test.stories-WkrQDzJJ.js → location-element.test.stories-BiFvBop7.js} +9 -9
- package/storybook-static/assets/module-url.test.stories-BXoM34tX.js +208 -0
- package/storybook-static/assets/{preview-BKCN0mOr.js → preview-0Jj89qip.js} +1 -1
- package/storybook-static/assets/{preview-TCN6m6T-.js → preview-BJPLiuSt.js} +1 -1
- package/storybook-static/assets/{preview-BDY5ThwJ.js → preview-BMWqy4Bi.js} +1 -1
- package/storybook-static/assets/preview-BnWGZYux.js +1 -0
- package/storybook-static/assets/preview-Cg7hXPRq.js +2 -0
- package/storybook-static/assets/{preview-BAz7FMXc.js → preview-DB9FwMii.js} +1 -1
- package/storybook-static/assets/preview-Djh1_Tal.js +20 -0
- package/storybook-static/assets/{preview-DRnyIGXK.js → preview-oHxXRSIu.js} +15 -15
- package/storybook-static/assets/set-url.test.stories-Cg5Z0r7x.js +81 -0
- package/storybook-static/assets/{slice-events.test.stories-BRBBc0JT.js → slice-events.test.stories-D_ttGp3g.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-r-i91k3y.js → slots.test.stories-DBNXOm0T.js} +1 -1
- package/storybook-static/assets/version-select.test.stories-CgV3UCim.js +109 -0
- package/storybook-static/confused.svg +1 -0
- package/storybook-static/demo/a.html +60 -0
- package/storybook-static/demo/b.html +13 -0
- package/storybook-static/demo/confused.svg +38 -0
- package/storybook-static/demo/data-slices.html +216 -0
- package/storybook-static/demo/dce-social-preview.png +0 -0
- package/storybook-static/demo/demo.css +26 -0
- package/storybook-static/demo/dom-merge.html +123 -0
- package/storybook-static/demo/embed-1.html +2 -0
- package/storybook-static/demo/external-template.html +239 -0
- package/storybook-static/demo/form.html +239 -0
- package/storybook-static/demo/hex-grid-dce.html +183 -0
- package/storybook-static/demo/hex-grid-transform.png +0 -0
- package/storybook-static/demo/hex-grid.html +66 -0
- package/storybook-static/demo/html-template.html +126 -0
- package/storybook-static/demo/html-template.xhtml +45 -0
- package/storybook-static/demo/html-template.xml +45 -0
- package/storybook-static/demo/http-request.html +143 -0
- package/storybook-static/demo/lib-dir/Smiley.svg +24 -0
- package/storybook-static/demo/lib-dir/embed-lib.html +34 -0
- package/storybook-static/demo/local-storage.html +218 -0
- package/storybook-static/demo/location-element.html +168 -0
- package/storybook-static/demo/logo.png +0 -0
- package/storybook-static/demo/module-url.html +215 -0
- package/storybook-static/demo/npm-versions-demo.html +105 -0
- package/storybook-static/demo/npm-versions.html +65 -0
- package/storybook-static/demo/parameters.html +70 -0
- package/storybook-static/demo/s.xml +28 -0
- package/storybook-static/demo/s.xslt +97 -0
- package/storybook-static/demo/s1.xslt +60 -0
- package/storybook-static/demo/scoped-css.html +169 -0
- package/storybook-static/demo/set-url.html +141 -0
- package/storybook-static/demo/ss.html +57 -0
- package/storybook-static/demo/table.xml +25 -0
- package/storybook-static/demo/table.xsl +293 -0
- package/storybook-static/demo/template.xsl +46 -0
- package/storybook-static/demo/tree.xml +25 -0
- package/storybook-static/demo/tree.xsl +33 -0
- package/storybook-static/demo/wc-square.svg +1 -0
- package/storybook-static/demo/xhtml-template.xhtml +45 -0
- package/storybook-static/demo/z.html +62 -0
- package/storybook-static/demo/z.js +9 -0
- package/storybook-static/demo/z.xml +60 -0
- package/storybook-static/embed-1.html +1 -2
- package/storybook-static/favicon.svg +1 -7
- package/storybook-static/iframe.html +42 -30
- package/storybook-static/index.html +36 -18
- package/storybook-static/index.json +1 -1
- package/storybook-static/mockServiceWorker.js +1 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -1
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js +32 -32
- package/storybook-static/sb-addons/chromatic-com-storybook-9/manager-bundle.js.LEGAL.txt +1 -1
- package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +395 -43
- package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +0 -18
- package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
- package/storybook-static/sb-addons/interactions-10/manager-bundle.js +221 -22
- package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-manager/globals-module-info.js +995 -1
- package/storybook-static/sb-manager/globals-runtime.js +53525 -1
- package/storybook-static/sb-manager/globals.js +48 -1
- package/storybook-static/sb-manager/runtime.js +11884 -1
- package/storybook-static/sb-preview/globals.js +33 -1
- package/storybook-static/sb-preview/runtime.js +9437 -108
- package/vite.config.js +2 -1
- package/dist/custom-element-BDK7dcJN.cjs +0 -53
- package/dist/custom-element-DqtzLkTG.js +0 -471
- package/dist/location-element-2m0gWq_d.cjs +0 -1
- package/dist/location-element-nA_wsqBt.js +0 -49
- package/storybook-static/assets/Color-PRSJMWNM-y4ZsI1hY.js +0 -1
- package/storybook-static/assets/DocsRenderer-K4EAMTCU-VRGUwRrq.js +0 -2
- package/storybook-static/assets/WithTooltip-KJL26V4Q-xdXH9Ztt.js +0 -1
- package/storybook-static/assets/custom-element-BIxkVg7K.js +0 -219
- package/storybook-static/assets/formatter-2WMMO6ZP-CThVcQxM.js +0 -58
- package/storybook-static/assets/http-request.stories-sXA_Y-VM.js +0 -300
- package/storybook-static/assets/iframe-DcDTQOmA.js +0 -2
- package/storybook-static/assets/index-CUFHd5VD.js +0 -1
- package/storybook-static/assets/index-CVRyq5ci.js +0 -27
- package/storybook-static/assets/index-Cc7K62zD.js +0 -3
- package/storybook-static/assets/index-DPPi9iZu.js +0 -548
- package/storybook-static/assets/index-DuIEV_9C.js +0 -13
- package/storybook-static/assets/index-VWixWKZ7.js +0 -1
- package/storybook-static/assets/lit-element-CenEXOuS.js +0 -19
- package/storybook-static/assets/preview-B4GcaC1c.js +0 -1
- package/storybook-static/assets/preview-B63p-W8V.js +0 -20
- package/storybook-static/assets/preview-p-Bwze-K.js +0 -2
- package/storybook-static/assets/syntaxhighlighter-BP7B2CQK-OnioRcs9.js +0 -1
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -3
- package/storybook-static/sb-common-assets/fonts.css +0 -31
- package/storybook-static/sb-manager/WithTooltip-KJL26V4Q-5LS5AN27.js +0 -1
- package/storybook-static/sb-manager/chunk-B3YDJJJH.js +0 -347
- package/storybook-static/sb-manager/chunk-BLWCBWKL.js +0 -9
- package/storybook-static/sb-manager/chunk-GUVK2GTO.js +0 -6
- package/storybook-static/sb-manager/chunk-LFRML3ZV.js +0 -186
- package/storybook-static/sb-manager/chunk-MC7RAF2B.js +0 -274
- package/storybook-static/sb-manager/chunk-ZR5JZWHI.js +0 -1
- package/storybook-static/sb-manager/formatter-2WMMO6ZP-JI7RHVTW.js +0 -58
- package/storybook-static/sb-manager/index.js +0 -1
- package/storybook-static/sb-manager/syntaxhighlighter-BP7B2CQK-WOJYHKQR.js +0 -1
- /package/storybook-static/sb-addons/{storybook-core-server-presets-0 → storybook-core-core-server-presets-0}/common-manager-bundle.js.LEGAL.txt +0 -0
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 :
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";const F="http://www.w3.org/1999/XSL/Transform",q="http://www.w3.org/1999/xhtml",pe="http://exslt.org/common",x=(e,l)=>e.getAttribute?.(l),K=e=>e.nodeType===3,fe=e=>typeof e=="string",he=e=>e&&typeof e.nodeType=="number",N=(e,l="",t=document)=>(s=>(l&&s.append(S(t.ownerDocument||t,l)),s))((t.ownerDocument||t).createElement(e)),S=(e,l)=>(e.ownerDocument||e).createTextNode(l),Z=e=>{for(;e.firstChild;)e.firstChild.remove();return e},H=e=>(e.getAttributeNames().map(l=>e.removeAttribute(l)),Z(e)),xe=e=>(e?.setAttribute("xmlns:xsl",F),e),ye=e=>(e?.setAttribute("xmlns:xhtml",q),xe(e)),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 j(e){return new XMLSerializer().serializeToString(e)}function U(e,l,t,s){const n=h=>e.ownerDocument.createElement(h),c=((h,p,m)=>(p.append(m=n(h)),m))(l,e);return[...t].forEach(h=>c.append(s(h))),c}function be(e){return e.slot||(e.setAttribute||(e=N("span",e.textContent.replaceAll(`
|
|
2
|
-
`,""))),e.setAttribute("slot","")),e}function C(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(c=>i.append(C(c,l,t))),i}if(e instanceof FormData){const i=N("form-data","",t);for(const c of e)i.append(C(c[1],c[0],t));return i}const n=N(l,"",t);for(let i in e)he(e[i])||typeof e[i]=="function"||e[i]instanceof Window||(typeof e[i]!="object"?n.setAttribute(i,e[i]):n.append(C(e[i],i,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 i=0,c=p=>S(t,p),h=[];if([...n].forEach(p=>{p.index>i&&h.push(c(p.input.substring(i,p.index)));const m=e.querySelector("value-of").cloneNode();m.setAttribute("select",p[1]),h.push(m),i=p.index+p[0].length}),i<s.length&&h.push(c(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 ee(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="${pe}" 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=(a=>{D(a,"script",v=>v.remove());const o=a.content??a.firstElementChild?.content??a.body??a;ce.forEach(v=>D(o,v,b=>me(b,o)));const E=a.firstElementChild?.content||a.content,g=v=>{const b=$("<xhtml/>"),P=b.importNode(v,!0);return b.replaceChild(P,b.documentElement),ye(P)};if(E){const v=N("div");return[...E.childNodes].map(b=>v.append(b.cloneNode(!0))),g(v)}return g(a.documentElement||a.body||a)})(e),i=$(`<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 c=s.transformToFragment(n,document),h=(a,o)=>a.querySelector(o),p=h(i,'template[mode="payload"]');if(!c)return console.error("transformation error",{xml:n.outerHTML,xsl:j(t)});const m=[];[...c.querySelectorAll("dce-root>attribute")].forEach(a=>{const o=Q(a,"xsl:param"),E=x(a,"name");p.append(o);let g=x(o,"select")?.split("??");g||(g=["//"+E,`'${o.textContent}'`],H(o),o.setAttribute("name",E));let v;if(g?.length>1){o.removeAttribute("select");const b=h(i,'template[match="ignore"]>choose').cloneNode(!0);H(b.firstElementChild).append(S(b,"{"+g[0]+"}")),H(b.lastElementChild).append(S(b,"{"+g[1]+"}")),b.firstElementChild.setAttribute("test",g[0]),o.append(b),v=b.cloneNode(!0)}else v=Q(a,"xsl:value-of");v.removeAttribute("name"),a.append(v),a.removeAttribute("select"),m.push(o)}),[...c.querySelectorAll("[value]")].filter(a=>a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach(a=>{const o=x(a,"value");o&&a.setAttribute("value",oe(o))});for(const a of c.childNodes)p.append(i.importNode(a,!0));[...p.querySelectorAll("template")].forEach(a=>p.ownerDocument.documentElement.append(a));const M=h(i,'call-template[name="slot"]'),d=a=>{const o=M.cloneNode(!0),E=x(a,"name");E&&o.firstElementChild.setAttribute("select",`'${E}'`);for(let g of a.childNodes)o.lastElementChild.append(g);return o};D(p,"slot",a=>a.parentNode.replaceChild(d(a),a));const u=W(i);return u.params=m,u}async function te(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||N("div",n.responseText)),s(n.statusText)},n.addEventListener("error",i=>s(i)),n.send()})}function se(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)||!se(e[s],l[s]))return t;return!0}const le=e=>e.split("|").map(l=>l.trim()).filter(l=>l),ne=(e,l)=>le(l).map(t=>{let s=e.ownerDocument,n=i=>(e.append(i),i);if(t.includes("/")){const i=[],c=s.evaluate(t,e);for(let h;h=c.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,ne(e,l??"").map(n=>{const i=e.ownerDocument,c=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(c.getAttributeNames().map(m=>n.setAttribute(m,x(c,m))),[...n.childNodes].filter(m=>m.localName==="event").map(m=>m.remove()),"validationMessage"in c&&n.setAttribute("validation-message",c.validationMessage),t.type==="init"&&p(),n.append(C(t,"event",i)),h.hasAttribute("slice-value")){c.value===void 0?n.removeAttribute("value"):n.setAttribute("value",c.value);const m=L(x(h,"slice-value"),n);p(),n.append(S(i,m))}else{if("elements"in c)return p(),n.append(C(new FormData(c),"value",n.ownerDocument)),n;const m=c.value??x(h,"value");p(),m==null?[...n.childNodes].filter(w=>w.localName!=="event").map(w=>w.remove()):fe(m)?n.append(S(i,m)):n.append(C(m,"value",n.ownerDocument))}return n})}function D(e,l,t){e.querySelectorAll&&[...e.querySelectorAll(l)].forEach(t)}const ge=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 te(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 ae(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 i=s.dceId=n+"-"+t[n]++;s.setAttribute&&s.setAttribute("data-dce-id",i)}s.childNodes.length&&G(s)}}function ie(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 J(e,l){if(!l.length)return Z(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,i=t[n];i?(K(s)?i.nodeValue!==s.nodeValue&&(i.nodeValue=s.nodeValue):(ae(s,i),(i.childNodes.length||s.childNodes.length)&&J(i,s.childNodes)),delete t[n]):ie(e,s,n)}for(let s of Object.values(t))s.remove()}function re(e,l){return e.hasAttribute(l)||e.setAttribute(l,crypto.randomUUID()),e.getAttribute(l)}const oe=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 i;i=s.iterateNext();)n+=i.textContent;return n},ce="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(","),me=(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,c)=>{i===e&&(n[c]=t)}),s.replaceChildren(...n)}};class ue extends HTMLElement{static observedAttributes=["src","tag","hidden"];async connectedCallback(){const l=await ge(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 a=u.closest("slot"),o=a?`slot[name="${a.name}"]`:"";u.innerHTML=`${s} ${o}{${u.innerHTML}}`,this.append(u)});const n=l.map(d=>ee(d)),i=n.map((d,u)=>(u=new XSLTProcessor,u.importStylesheet(d),u));Object.defineProperty(this,"xsltString",{get:()=>n.map(d=>j(d)).join(`
|
|
50
|
-
`)});const c=this,h=[...this.templateNode.querySelectorAll("[slice]")],p=h.map(d=>x(d,"slice")).filter(d=>!d.includes("/")).filter((d,u,a)=>a.indexOf(d)===u).map(le).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=re(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 a=$("<datadom/>").documentElement,o=(f,r="")=>(y=>(r&&y.append(S(a,r)),y))(a.ownerDocument.createElement(f));U(a,"payload",u,be),this.innerHTML="";const E=U(a,"attributes",this.attributes,f=>o(f.nodeName,f.value));U(a,"dataset",Object.keys(this.dataset),f=>o(f,this.dataset[f]));const g=U(a,"slice",p,f=>o(f,"")),v=f=>L(f,g);this.xml=a;const b=[],P=()=>{const f={};for(let r;r=b.pop();){const y=x(r.sliceElement,"slice");f[y]||(Y(g,y,r),f[y]=r)}Object.keys(f).length!==0&&R()};let O;this.onSlice=f=>{b.push(f),O||(O=setTimeout(()=>{P(),O=0},1))};const R=this.transform=()=>{if(this.#e)debugger;this.#e=1,i.map((r,y)=>{const X=r.transformToFragment(a.ownerDocument,document);return X||console.error(`XSLT transformation error. xsl:
|
|
51
|
-
`,j(n[y]),`
|
|
52
|
-
xml:
|
|
53
|
-
`,j(a)),X}).map(r=>{r&&(G(r),J(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");x(r,"custom-validity")&&(y+=" change submit"),[...new Set((y||"change").split(" "))].forEach(X=>(r.localName==="slice"?r.parentElement:r).addEventListener(X,A=>{A.sliceElement=r,A.sliceEventSource=A.currentTarget||A.target;const de=Y(g,x(A.sliceElement,"slice"),A);D(this,"[custom-validity]",z=>{if(!z.setCustomValidity)return;const B=x(z,"custom-validity");try{const I=B&&L(B,E);z.setCustomValidity(I===!0?"":I===!1?"invalid":I)}catch(I){console.error(I,"xPath",B)}});const k=x(r,"custom-validity"),T=k&&L(k,E),_=T===!0?"":T;if(k){if(r.setCustomValidity?r.setCustomValidity(_):r.validationMessage=_,de.map(z=>z.setAttribute("validation-message",_)),A.type==="submit")return T===!0?void 0:(setTimeout(R,1),!!T===T?(T||A.preventDefault(),T):T?(A.preventDefault(),!1):void 0);setTimeout(R,1)}this.onSlice(A)})),(!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")))}}),this.#e=0};R(),P()}#t(u,a){let o=this.xml.querySelector(`attributes>${u}`);o?H(o).append(S(o,a)):(o=N(u,a,this.xml),this.xml.querySelector("attributes").append(o))}attributeChangedCallback(u,a,o){!this.xml||this.#e||(this.#t(u,o),this.transform())}get dce(){return c}}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(a=>u.setAttribute(a,this.getAttribute(a))),u.append(...[...this.childNodes].filter(a=>a.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",ue);exports.CustomElement=ue;exports.appendByDceId=ie;exports.assureSlices=ne;exports.assureUID=re;exports.assureUnique=G;exports.createXsltFromDom=ee;exports.deepEqual=se;exports.evalCurly=oe;exports.event2slice=Y;exports.merge=J;exports.mergeAttr=ae;exports.obj2node=C;exports.tagUid=W;exports.toXsl=me;exports.xPath=L;exports.xPathDefaults=V;exports.xhrTemplate=te;exports.xml2dom=$;exports.xmlString=j;exports.xslTags=ce;
|
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", se = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), W = (e) => e.nodeType === 3, le = (e) => typeof e == "string", ne = (e) => e && typeof e.nodeType == "number", N = (e, l = "", t = document) => ((s) => (l && s.append(S(t.ownerDocument || t, l)), s))((t.ownerDocument || t).createElement(e)), 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)), ae = (e) => (e?.setAttribute("xmlns:xsl", B), e), ie = (e) => (e?.setAttribute("xmlns:xhtml", q), ae(e)), Y = (e, l) => {
|
|
5
|
-
const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
|
|
6
|
-
for (let s of e.attributes)
|
|
7
|
-
t.setAttribute(s.name, s.value);
|
|
8
|
-
for (; e.firstChild; )
|
|
9
|
-
t.append(e.firstChild);
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
function M(e) {
|
|
13
|
-
return new DOMParser().parseFromString(e, "application/xml");
|
|
14
|
-
}
|
|
15
|
-
function H(e) {
|
|
16
|
-
return new XMLSerializer().serializeToString(e);
|
|
17
|
-
}
|
|
18
|
-
function X(e, l, t, s) {
|
|
19
|
-
const n = (h) => e.ownerDocument.createElement(h), c = ((h, p, m) => (p.append(m = n(h)), m))(l, e);
|
|
20
|
-
return [...t].forEach((h) => c.append(s(h))), c;
|
|
21
|
-
}
|
|
22
|
-
function re(e) {
|
|
23
|
-
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
24
|
-
`, ""))), e.setAttribute("slot", "")), e;
|
|
25
|
-
}
|
|
26
|
-
function D(e, l, t) {
|
|
27
|
-
const s = typeof e;
|
|
28
|
-
if (s === "string")
|
|
29
|
-
return N(l, e, t);
|
|
30
|
-
if (s === "number")
|
|
31
|
-
return N(l, "" + e, t);
|
|
32
|
-
if (e instanceof Array) {
|
|
33
|
-
const i = N("array", "", t);
|
|
34
|
-
return e.map((c) => i.append(D(c, l, t))), i;
|
|
35
|
-
}
|
|
36
|
-
if (e instanceof FormData) {
|
|
37
|
-
const i = N("form-data", "", t);
|
|
38
|
-
for (const c of e)
|
|
39
|
-
i.append(D(c[1], c[0], t));
|
|
40
|
-
return i;
|
|
41
|
-
}
|
|
42
|
-
const n = N(l, "", t);
|
|
43
|
-
for (let i in e)
|
|
44
|
-
ne(e[i]) || typeof e[i] == "function" || e[i] instanceof Window || (typeof e[i] != "object" ? n.setAttribute(i, e[i]) : n.append(D(e[i], i, t)));
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
function G(e) {
|
|
48
|
-
if (C(e, "*", (l) => [...l.childNodes].filter((t) => t.nodeType === 3 && t.parentNode.localName !== "style" && t.data).forEach((t) => {
|
|
49
|
-
const s = t.data, n = s.matchAll(/{([^}]*)}/g);
|
|
50
|
-
if (n) {
|
|
51
|
-
let i = 0, c = (p) => S(t, p), h = [];
|
|
52
|
-
if ([...n].forEach((p) => {
|
|
53
|
-
p.index > i && h.push(c(p.input.substring(i, p.index)));
|
|
54
|
-
const m = e.querySelector("value-of").cloneNode();
|
|
55
|
-
m.setAttribute("select", p[1]), h.push(m), i = p.index + p[0].length;
|
|
56
|
-
}), i < s.length && h.push(c(s.substring(i, s.length))), h.length) {
|
|
57
|
-
for (let p of h)
|
|
58
|
-
l.insertBefore(p, t);
|
|
59
|
-
l.removeChild(t);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
})), "all" in e) {
|
|
63
|
-
let l = 1;
|
|
64
|
-
for (let t of e.all)
|
|
65
|
-
t.setAttribute && !t.tagName.startsWith("xsl:") && t.setAttribute("data-dce-id", "" + l++);
|
|
66
|
-
}
|
|
67
|
-
return e;
|
|
68
|
-
}
|
|
69
|
-
function oe(e, l = "xsl:stylesheet") {
|
|
70
|
-
if (e.tagName === l || e.documentElement?.tagName === l)
|
|
71
|
-
return G(e);
|
|
72
|
-
const t = M(`<xsl:stylesheet version="1.0" xmlns:xsl="${B}" xmlns:xhtml="${q}" xmlns:exsl="${se}" exclude-result-prefixes="exsl" >
|
|
73
|
-
<xsl:output method="xml" />
|
|
74
|
-
<xsl:template match="/"><dce-root xmlns="${q}"><xsl:apply-templates select="*"/></dce-root></xsl:template>
|
|
75
|
-
<xsl:template match="*[name()='template']"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
76
|
-
<xsl:template match="*"><xsl:apply-templates mode="sanitize" select="*|text()"/></xsl:template>
|
|
77
|
-
<xsl:template match="*[name()='svg']|*[name()='math']"><xsl:apply-templates mode="sanitize" select="."/></xsl:template>
|
|
78
|
-
<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>
|
|
79
|
-
<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>
|
|
80
|
-
<xsl:template mode="sanitize" match="*|@*"><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></xsl:template>
|
|
81
|
-
<xsl:template mode="sanitize" match="text()[normalize-space(.) = '']"/>
|
|
82
|
-
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
83
|
-
<xsl:template mode="sanitize" match="xsl:value-of|*[name()='slot']"><dce-text><xsl:copy><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:copy></dce-text></xsl:template>
|
|
84
|
-
<xsl:template mode="sanitize" match="xhtml:*"><xsl:element name="{local-name()}"><xsl:apply-templates mode="sanitize" select="*|@*|text()"/></xsl:element></xsl:template>
|
|
85
|
-
</xsl:stylesheet>`), s = new XSLTProcessor(), n = ((a) => {
|
|
86
|
-
C(a, "script", (v) => v.remove());
|
|
87
|
-
const o = a.content ?? a.firstElementChild?.content ?? a.body ?? a;
|
|
88
|
-
ye.forEach((v) => C(o, v, (b) => be(b, o)));
|
|
89
|
-
const E = a.firstElementChild?.content || a.content, g = (v) => {
|
|
90
|
-
const b = M("<xhtml/>"), $ = b.importNode(v, !0);
|
|
91
|
-
return b.replaceChild($, b.documentElement), ie($);
|
|
92
|
-
};
|
|
93
|
-
if (E) {
|
|
94
|
-
const v = N("div");
|
|
95
|
-
return [...E.childNodes].map((b) => v.append(b.cloneNode(!0))), g(v);
|
|
96
|
-
}
|
|
97
|
-
return g(a.documentElement || a.body || a);
|
|
98
|
-
})(e), i = M(
|
|
99
|
-
`<xsl:stylesheet version="1.0"
|
|
100
|
-
xmlns:xsl="${B}"
|
|
101
|
-
xmlns:xhtml="${q}"
|
|
102
|
-
xmlns:dce="urn:schemas-epa-wg:dce"
|
|
103
|
-
xmlns:exsl="http://exslt.org/common"
|
|
104
|
-
exclude-result-prefixes="exsl"
|
|
105
|
-
>
|
|
106
|
-
<xsl:template match="ignore">
|
|
107
|
-
<xsl:choose>
|
|
108
|
-
<xsl:when test="//attr">{//attr}</xsl:when>
|
|
109
|
-
<xsl:otherwise>{def}</xsl:otherwise>
|
|
110
|
-
</xsl:choose><xsl:value-of select="."></xsl:value-of></xsl:template>
|
|
111
|
-
<xsl:template mode="payload" match="attributes"></xsl:template>
|
|
112
|
-
<xsl:template match="/">
|
|
113
|
-
<xsl:apply-templates mode="payload" select="/datadom/attributes"/>
|
|
114
|
-
</xsl:template>
|
|
115
|
-
<xsl:template name="slot" >
|
|
116
|
-
<xsl:param name="slotname" />
|
|
117
|
-
<xsl:param name="defaultvalue" />
|
|
118
|
-
<xsl:choose>
|
|
119
|
-
<xsl:when test="//payload/*[@slot=$slotname]">
|
|
120
|
-
<xsl:copy-of select="//payload/*[@slot=$slotname]"/>
|
|
121
|
-
</xsl:when>
|
|
122
|
-
<xsl:otherwise>
|
|
123
|
-
<xsl:copy-of select="$defaultvalue"/>
|
|
124
|
-
</xsl:otherwise>
|
|
125
|
-
</xsl:choose>
|
|
126
|
-
</xsl:template>
|
|
127
|
-
<xsl:variable name="js-injected-body">
|
|
128
|
-
<xsl:call-template name="slot" >
|
|
129
|
-
<xsl:with-param name="slotname" select="''"/>
|
|
130
|
-
<xsl:with-param name="defaultvalue"/>
|
|
131
|
-
</xsl:call-template>
|
|
132
|
-
</xsl:variable>
|
|
133
|
-
</xsl:stylesheet>`
|
|
134
|
-
);
|
|
135
|
-
s.importStylesheet(t);
|
|
136
|
-
const c = s.transformToFragment(n, document), h = (a, o) => a.querySelector(o), p = h(i, 'template[mode="payload"]');
|
|
137
|
-
if (!c)
|
|
138
|
-
return console.error("transformation error", { xml: n.outerHTML, xsl: H(t) });
|
|
139
|
-
const m = [];
|
|
140
|
-
[...c.querySelectorAll("dce-root>attribute")].forEach((a) => {
|
|
141
|
-
const o = Y(a, "xsl:param"), E = x(a, "name");
|
|
142
|
-
p.append(o);
|
|
143
|
-
let g = x(o, "select")?.split("??");
|
|
144
|
-
g || (g = ["//" + E, `'${o.textContent}'`], U(o), o.setAttribute("name", E));
|
|
145
|
-
let v;
|
|
146
|
-
if (g?.length > 1) {
|
|
147
|
-
o.removeAttribute("select");
|
|
148
|
-
const b = h(i, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
149
|
-
U(b.firstElementChild).append(S(b, "{" + g[0] + "}")), U(b.lastElementChild).append(S(b, "{" + g[1] + "}")), b.firstElementChild.setAttribute("test", g[0]), o.append(b), v = b.cloneNode(!0);
|
|
150
|
-
} else
|
|
151
|
-
v = Y(a, "xsl:value-of");
|
|
152
|
-
v.removeAttribute("name"), a.append(v), a.removeAttribute("select"), m.push(o);
|
|
153
|
-
}), [...c.querySelectorAll("[value]")].filter((a) => a.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((a) => {
|
|
154
|
-
const o = x(a, "value");
|
|
155
|
-
o && a.setAttribute("value", xe(o));
|
|
156
|
-
});
|
|
157
|
-
for (const a of c.childNodes)
|
|
158
|
-
p.append(i.importNode(a, !0));
|
|
159
|
-
[...p.querySelectorAll("template")].forEach((a) => p.ownerDocument.documentElement.append(a));
|
|
160
|
-
const P = h(i, 'call-template[name="slot"]'), d = (a) => {
|
|
161
|
-
const o = P.cloneNode(!0), E = x(a, "name");
|
|
162
|
-
E && o.firstElementChild.setAttribute("select", `'${E}'`);
|
|
163
|
-
for (let g of a.childNodes)
|
|
164
|
-
o.lastElementChild.append(g);
|
|
165
|
-
return o;
|
|
166
|
-
};
|
|
167
|
-
C(p, "slot", (a) => a.parentNode.replaceChild(d(a), a));
|
|
168
|
-
const u = G(i);
|
|
169
|
-
return u.params = m, u;
|
|
170
|
-
}
|
|
171
|
-
async function ce(e) {
|
|
172
|
-
return await new Promise((t, s) => {
|
|
173
|
-
const n = new XMLHttpRequest();
|
|
174
|
-
n.open("GET", e), n.responseType = "document", n.onload = () => {
|
|
175
|
-
n.readyState === n.DONE && n.status === 200 && t(n.responseXML || N("div", n.responseText)), s(n.statusText);
|
|
176
|
-
}, n.addEventListener("error", (i) => s(i)), n.send();
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
function me(e, l, t = !1) {
|
|
180
|
-
if (e === l)
|
|
181
|
-
return !0;
|
|
182
|
-
if (typeof e != "object" || e === null || typeof l != "object" || l === null || Object.keys(e).length !== Object.keys(l).length)
|
|
183
|
-
return t;
|
|
184
|
-
for (let s in e)
|
|
185
|
-
if (!(s in l) || !me(e[s], l[s]))
|
|
186
|
-
return t;
|
|
187
|
-
return !0;
|
|
188
|
-
}
|
|
189
|
-
const Q = (e) => e.split("|").map((l) => l.trim()).filter((l) => l), ue = (e, l) => Q(l).map((t) => {
|
|
190
|
-
let s = e.ownerDocument, n = (i) => (e.append(i), i);
|
|
191
|
-
if (t.includes("/")) {
|
|
192
|
-
const i = [], c = s.evaluate(t, e);
|
|
193
|
-
for (let h; h = c.iterateNext(); )
|
|
194
|
-
i.push(h);
|
|
195
|
-
return i;
|
|
196
|
-
}
|
|
197
|
-
return [...e.childNodes].find((i) => i.localName === t) || n(N(t, "", s));
|
|
198
|
-
}).flat();
|
|
199
|
-
function J(e, l, t, s) {
|
|
200
|
-
if (!t.sliceProcessed)
|
|
201
|
-
return t.sliceProcessed = 1, ue(e, l ?? "").map((n) => {
|
|
202
|
-
const i = e.ownerDocument, c = t.sliceEventSource, h = t.sliceElement, p = () => [...n.childNodes].filter((m) => m.nodeType === 3 || m.localName === "value" || m.localName === "form-data").map((m) => m.remove());
|
|
203
|
-
if (c.getAttributeNames().map((m) => n.setAttribute(m, x(c, m))), [...n.childNodes].filter((m) => m.localName === "event").map((m) => m.remove()), "validationMessage" in c && n.setAttribute("validation-message", c.validationMessage), t.type === "init" && p(), n.append(D(t, "event", i)), h.hasAttribute("slice-value")) {
|
|
204
|
-
c.value === void 0 ? n.removeAttribute("value") : n.setAttribute("value", c.value);
|
|
205
|
-
const m = L(x(h, "slice-value"), n);
|
|
206
|
-
p(), n.append(S(i, m));
|
|
207
|
-
} else {
|
|
208
|
-
if ("elements" in c)
|
|
209
|
-
return p(), n.append(D(new FormData(c), "value", n.ownerDocument)), n;
|
|
210
|
-
const m = c.value ?? x(h, "value");
|
|
211
|
-
p(), m == null ? [...n.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : le(m) ? n.append(S(i, m)) : n.append(D(m, "value", n.ownerDocument));
|
|
212
|
-
}
|
|
213
|
-
return n;
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
function C(e, l, t) {
|
|
217
|
-
e.querySelectorAll && [...e.querySelectorAll(l)].forEach(t);
|
|
218
|
-
}
|
|
219
|
-
const de = async (e, l) => {
|
|
220
|
-
if (!e || !e.trim())
|
|
221
|
-
return [l];
|
|
222
|
-
if (e.startsWith("#"))
|
|
223
|
-
return ((t) => {
|
|
224
|
-
if (!t) return [];
|
|
225
|
-
const s = t.querySelectorAll(e);
|
|
226
|
-
if (s.length)
|
|
227
|
-
return [...s];
|
|
228
|
-
const n = t.getRootNode();
|
|
229
|
-
return n === t ? [] : getByHashId(n);
|
|
230
|
-
})(l.parentElement);
|
|
231
|
-
try {
|
|
232
|
-
const t = await ce(e), s = new URL(e, location).hash;
|
|
233
|
-
if (s) {
|
|
234
|
-
const n = t.querySelectorAll(s);
|
|
235
|
-
return n.length ? [...n] : [l];
|
|
236
|
-
}
|
|
237
|
-
return [t];
|
|
238
|
-
} catch {
|
|
239
|
-
return [l];
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
function pe(e, l) {
|
|
243
|
-
for (let t of e.attributes)
|
|
244
|
-
t.namespaceURI ? l.setAttributeNS(t.namespaceURI, t.name, t.value) : l.setAttribute(t.name, t.value), t.name === "value" && (l.value = t.value);
|
|
245
|
-
}
|
|
246
|
-
function Z(e, l = 0) {
|
|
247
|
-
const t = {};
|
|
248
|
-
for (const s of e.childNodes) {
|
|
249
|
-
const n = x(s, "data-dce-id") || s.dceId || 0;
|
|
250
|
-
if (!t[n])
|
|
251
|
-
n ? t[n] = 1 : (t[n] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
252
|
-
else {
|
|
253
|
-
const i = s.dceId = n + "-" + t[n]++;
|
|
254
|
-
s.setAttribute && s.setAttribute("data-dce-id", i);
|
|
255
|
-
}
|
|
256
|
-
s.childNodes.length && Z(s);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
function fe(e, l, t) {
|
|
260
|
-
t = 1 * t;
|
|
261
|
-
for (let s of e.childNodes)
|
|
262
|
-
if ((s.dceId ?? s.getAttribute("data-dce-id") * 1) > t)
|
|
263
|
-
return e.insertBefore(l, s);
|
|
264
|
-
e.append(l);
|
|
265
|
-
}
|
|
266
|
-
function ee(e, l) {
|
|
267
|
-
if (!l.length)
|
|
268
|
-
return K(e);
|
|
269
|
-
const t = {};
|
|
270
|
-
for (let s of e.childNodes)
|
|
271
|
-
t[s.dceId], W(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
272
|
-
for (let s of [...l]) {
|
|
273
|
-
const n = x(s, "data-dce-id") || s.dceId, i = t[n];
|
|
274
|
-
i ? (W(s) ? i.nodeValue !== s.nodeValue && (i.nodeValue = s.nodeValue) : (pe(s, i), (i.childNodes.length || s.childNodes.length) && ee(i, s.childNodes)), delete t[n]) : fe(e, s, n);
|
|
275
|
-
}
|
|
276
|
-
for (let s of Object.values(t))
|
|
277
|
-
s.remove();
|
|
278
|
-
}
|
|
279
|
-
function he(e, l) {
|
|
280
|
-
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
281
|
-
}
|
|
282
|
-
const xe = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
283
|
-
if (!e.trim())
|
|
284
|
-
return e;
|
|
285
|
-
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
286
|
-
return l.length ? `concat( ${t} , substring( ${s} , (1+string-length( ${s} )) * string-length( ${t} ) ) )` : e;
|
|
287
|
-
}, L = (e, l) => {
|
|
288
|
-
const t = e.split("??");
|
|
289
|
-
if (t.length > 1)
|
|
290
|
-
return L(t[0], l) || L(t[1], l);
|
|
291
|
-
e = F(e);
|
|
292
|
-
const s = l.ownerDocument.evaluate(e, l);
|
|
293
|
-
switch (s.resultType) {
|
|
294
|
-
case XPathResult.NUMBER_TYPE:
|
|
295
|
-
return s.numberValue;
|
|
296
|
-
case XPathResult.STRING_TYPE:
|
|
297
|
-
return s.stringValue;
|
|
298
|
-
case XPathResult.BOOLEAN_TYPE:
|
|
299
|
-
return s.booleanValue;
|
|
300
|
-
}
|
|
301
|
-
let n = "";
|
|
302
|
-
for (let i; i = s.iterateNext(); )
|
|
303
|
-
n += i.textContent;
|
|
304
|
-
return n;
|
|
305
|
-
}, ye = "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(","), be = (e, l) => {
|
|
306
|
-
const t = N("xsl:" + e.localName);
|
|
307
|
-
for (let s of e.attributes)
|
|
308
|
-
t.setAttribute(s.name, s.value);
|
|
309
|
-
for (; e.firstChild; )
|
|
310
|
-
t.append(e.firstChild);
|
|
311
|
-
if (e.parentElement)
|
|
312
|
-
e.parentElement.replaceChild(t, e);
|
|
313
|
-
else {
|
|
314
|
-
const s = e.parentElement || l, n = [...s.childNodes];
|
|
315
|
-
n.forEach((i, c) => {
|
|
316
|
-
i === e && (n[c] = t);
|
|
317
|
-
}), s.replaceChildren(...n);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
class ge extends HTMLElement {
|
|
321
|
-
static observedAttributes = ["src", "tag", "hidden"];
|
|
322
|
-
async connectedCallback() {
|
|
323
|
-
const l = await de(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
324
|
-
for (const d of l)
|
|
325
|
-
C(d.templateNode || d.content || d, "style", (u) => {
|
|
326
|
-
const a = u.closest("slot"), o = a ? `slot[name="${a.name}"]` : "";
|
|
327
|
-
u.innerHTML = `${s} ${o}{${u.innerHTML}}`, this.append(u);
|
|
328
|
-
});
|
|
329
|
-
const n = l.map((d) => oe(d)), i = n.map((d, u) => (u = new XSLTProcessor(), u.importStylesheet(d), u));
|
|
330
|
-
Object.defineProperty(this, "xsltString", { get: () => n.map((d) => H(d)).join(`
|
|
331
|
-
`) });
|
|
332
|
-
const c = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, u, a) => a.indexOf(d) === u).map(Q).flat(), m = n.reduce((d, u) => (u.params && d.push(...u.params), d), []);
|
|
333
|
-
class w extends HTMLElement {
|
|
334
|
-
static get observedAttributes() {
|
|
335
|
-
return m.map((u) => x(u, "name"));
|
|
336
|
-
}
|
|
337
|
-
#e = 0;
|
|
338
|
-
connectedCallback() {
|
|
339
|
-
let u = this.childNodes;
|
|
340
|
-
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
341
|
-
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
342
|
-
const f = this.firstElementChild;
|
|
343
|
-
f.remove(), u = f.content.childNodes;
|
|
344
|
-
for (const r of [...f.content.childNodes])
|
|
345
|
-
if (r.localName === "style") {
|
|
346
|
-
const y = he(this, "data-dce-style");
|
|
347
|
-
r.innerHTML = `${s}[data-dce-style="${y}"]{${r.innerHTML}}`, f.insertAdjacentElement("beforebegin", r);
|
|
348
|
-
} else
|
|
349
|
-
r.nodeType === 1 ? f.insertAdjacentElement("beforebegin", r) : r.nodeType === 3 && f.insertAdjacentText("beforebegin", r.data);
|
|
350
|
-
}
|
|
351
|
-
const a = M("<datadom/>").documentElement, o = (f, r = "") => ((y) => (r && y.append(S(a, r)), y))(a.ownerDocument.createElement(f));
|
|
352
|
-
X(a, "payload", u, re), this.innerHTML = "";
|
|
353
|
-
const E = X(a, "attributes", this.attributes, (f) => o(f.nodeName, f.value));
|
|
354
|
-
X(a, "dataset", Object.keys(this.dataset), (f) => o(f, this.dataset[f]));
|
|
355
|
-
const g = X(a, "slice", p, (f) => o(f, "")), v = (f) => L(f, g);
|
|
356
|
-
this.xml = a;
|
|
357
|
-
const b = [], $ = () => {
|
|
358
|
-
const f = {};
|
|
359
|
-
for (let r; r = b.pop(); ) {
|
|
360
|
-
const y = x(r.sliceElement, "slice");
|
|
361
|
-
f[y] || (J(g, y, r), f[y] = r);
|
|
362
|
-
}
|
|
363
|
-
Object.keys(f).length !== 0 && I();
|
|
364
|
-
};
|
|
365
|
-
let V;
|
|
366
|
-
this.onSlice = (f) => {
|
|
367
|
-
b.push(f), V || (V = setTimeout(() => {
|
|
368
|
-
$(), V = 0;
|
|
369
|
-
}, 1));
|
|
370
|
-
};
|
|
371
|
-
const I = this.transform = () => {
|
|
372
|
-
if (this.#e)
|
|
373
|
-
debugger;
|
|
374
|
-
this.#e = 1, i.map((r, y) => {
|
|
375
|
-
const R = r.transformToFragment(a.ownerDocument, document);
|
|
376
|
-
return R || console.error(`XSLT transformation error. xsl:
|
|
377
|
-
`, H(n[y]), `
|
|
378
|
-
xml:
|
|
379
|
-
`, H(a)), R;
|
|
380
|
-
}).map((r) => {
|
|
381
|
-
r && (Z(r), ee(this, r.childNodes));
|
|
382
|
-
}), w.observedAttributes.map((r) => {
|
|
383
|
-
let y = x(this.firstElementChild, r);
|
|
384
|
-
y !== x(this, r) && (this.setAttribute(r, y), this.#t(r, y));
|
|
385
|
-
}), C(this, "[slice],[slice-event]", (r) => {
|
|
386
|
-
if (!r.dceInitialized) {
|
|
387
|
-
r.dceInitialized = 1;
|
|
388
|
-
let y = x(r, "slice-event");
|
|
389
|
-
x(r, "custom-validity") && (y += " change submit"), [...new Set((y || "change").split(" "))].forEach((R) => (r.localName === "slice" ? r.parentElement : r).addEventListener(R, (A) => {
|
|
390
|
-
A.sliceElement = r, A.sliceEventSource = A.currentTarget || A.target;
|
|
391
|
-
const te = J(g, x(A.sliceElement, "slice"), A);
|
|
392
|
-
C(this, "[custom-validity]", (z) => {
|
|
393
|
-
if (!z.setCustomValidity)
|
|
394
|
-
return;
|
|
395
|
-
const _ = x(z, "custom-validity");
|
|
396
|
-
try {
|
|
397
|
-
const j = _ && L(_, E);
|
|
398
|
-
z.setCustomValidity(j === !0 ? "" : j === !1 ? "invalid" : j);
|
|
399
|
-
} catch (j) {
|
|
400
|
-
console.error(j, "xPath", _);
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
const k = x(r, "custom-validity"), T = k && L(k, E), O = T === !0 ? "" : T;
|
|
404
|
-
if (k) {
|
|
405
|
-
if (r.setCustomValidity ? r.setCustomValidity(O) : r.validationMessage = O, te.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
406
|
-
return T === !0 ? void 0 : (setTimeout(I, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
407
|
-
setTimeout(I, 1);
|
|
408
|
-
}
|
|
409
|
-
this.onSlice(A);
|
|
410
|
-
})), (!y || y.includes("init")) && (r.hasAttribute("slice-value") || r.hasAttribute("value") || r.value ? this.onSlice({ type: "init", target: r, sliceElement: r, sliceEventSource: r }) : r.value = v(x(r, "slice")));
|
|
411
|
-
}
|
|
412
|
-
}), this.#e = 0;
|
|
413
|
-
};
|
|
414
|
-
I(), $();
|
|
415
|
-
}
|
|
416
|
-
#t(u, a) {
|
|
417
|
-
let o = this.xml.querySelector(`attributes>${u}`);
|
|
418
|
-
o ? U(o).append(S(o, a)) : (o = N(u, a, this.xml), this.xml.querySelector("attributes").append(o));
|
|
419
|
-
}
|
|
420
|
-
attributeChangedCallback(u, a, o) {
|
|
421
|
-
!this.xml || this.#e || (this.#t(u, o), this.transform());
|
|
422
|
-
}
|
|
423
|
-
get dce() {
|
|
424
|
-
return c;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
const P = (d) => {
|
|
428
|
-
window.customElements.get(d) !== w && window.customElements.define(d, w);
|
|
429
|
-
};
|
|
430
|
-
if (t)
|
|
431
|
-
P(t);
|
|
432
|
-
else {
|
|
433
|
-
const d = s;
|
|
434
|
-
this.setAttribute("tag", d), P(d);
|
|
435
|
-
const u = document.createElement(d);
|
|
436
|
-
this.getAttributeNames().forEach((a) => u.setAttribute(a, this.getAttribute(a))), u.append(...[...this.childNodes].filter((a) => a.localName !== "style")), this.append(u);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
get templateNode() {
|
|
440
|
-
return this.firstElementChild?.tagName === "TEMPLATE" ? this.firstElementChild.content : this;
|
|
441
|
-
}
|
|
442
|
-
get dce() {
|
|
443
|
-
return this;
|
|
444
|
-
}
|
|
445
|
-
get xslt() {
|
|
446
|
-
return M(this.xsltString);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
window.customElements.define("custom-element", ge);
|
|
450
|
-
export {
|
|
451
|
-
ge as C,
|
|
452
|
-
H as a,
|
|
453
|
-
ce as b,
|
|
454
|
-
oe as c,
|
|
455
|
-
me as d,
|
|
456
|
-
ue as e,
|
|
457
|
-
J as f,
|
|
458
|
-
Z as g,
|
|
459
|
-
fe as h,
|
|
460
|
-
ee as i,
|
|
461
|
-
he as j,
|
|
462
|
-
xe as k,
|
|
463
|
-
F as l,
|
|
464
|
-
pe as m,
|
|
465
|
-
L as n,
|
|
466
|
-
D as o,
|
|
467
|
-
ye as p,
|
|
468
|
-
be as q,
|
|
469
|
-
G as t,
|
|
470
|
-
M as x
|
|
471
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const w=(t,e)=>t.getAttribute(e);let a;function u(){a||(a={},"back,forward,go,pushState,replaceState".split(",").forEach(t=>{a[t]=history[t],history[t]=function(...e){a[t].apply(history,e),window.dispatchEvent(new CustomEvent("dce-location",{detail:{k:t}}))}}))}class h extends HTMLElement{static observedAttributes=["value","slice","href","type","live"];constructor(){super();const e={},n=()=>setTimeout(r,1),r=()=>{const s=w(this,"href");s||u();const o=s?new URL(s,window.location):window.location,c={},l=new URLSearchParams(o.search);for(const i of l.keys())c[i]=l.getAll(i);const d={params:c};for(const i in o)typeof o[i]=="string"&&(d[i]=o[i]);this.value=d,this.dispatchEvent(new Event("change"))};this.sliceInit=s=>(!e.listener&&this.hasAttribute("live")&&(e.listener=1,window.navigation?.addEventListener("navigate",n),window.addEventListener("popstate",n),window.addEventListener("hashchange",n),window.addEventListener("dce-location",n)),r(),s||{}),this._destroy=()=>{window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n),window.removeEventListener("dce-location",n),delete e.listener}}attributeChangedCallback(e,n,r){e==="href"&&this.sliceInit&&this.sliceInit()}connectedCallback(){this.sliceInit()}disconnectedCallback(){this._destroy()}}window.customElements.define("location-element",h);exports.LocationElement=h;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const h = (t, e) => t.getAttribute(e);
|
|
2
|
-
let a;
|
|
3
|
-
function w() {
|
|
4
|
-
a || (a = {}, "back,forward,go,pushState,replaceState".split(",").forEach((t) => {
|
|
5
|
-
a[t] = history[t], history[t] = function(...e) {
|
|
6
|
-
a[t].apply(history, e), window.dispatchEvent(new CustomEvent("dce-location", { detail: { k: t } }));
|
|
7
|
-
};
|
|
8
|
-
}));
|
|
9
|
-
}
|
|
10
|
-
class u extends HTMLElement {
|
|
11
|
-
static observedAttributes = [
|
|
12
|
-
"value",
|
|
13
|
-
"slice",
|
|
14
|
-
"href",
|
|
15
|
-
"type",
|
|
16
|
-
"live"
|
|
17
|
-
// monitors history change, applicable only when href is omitted.
|
|
18
|
-
];
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
const e = {}, n = () => setTimeout(r, 1), r = () => {
|
|
22
|
-
const s = h(this, "href");
|
|
23
|
-
s || w();
|
|
24
|
-
const o = s ? new URL(s, window.location) : window.location, c = {}, l = new URLSearchParams(o.search);
|
|
25
|
-
for (const i of l.keys())
|
|
26
|
-
c[i] = l.getAll(i);
|
|
27
|
-
const d = { params: c };
|
|
28
|
-
for (const i in o)
|
|
29
|
-
typeof o[i] == "string" && (d[i] = o[i]);
|
|
30
|
-
this.value = d, this.dispatchEvent(new Event("change"));
|
|
31
|
-
};
|
|
32
|
-
this.sliceInit = (s) => (!e.listener && this.hasAttribute("live") && (e.listener = 1, window.navigation?.addEventListener("navigate", n), window.addEventListener("popstate", n), window.addEventListener("hashchange", n), window.addEventListener("dce-location", n)), r(), s || {}), this._destroy = () => {
|
|
33
|
-
window.removeEventListener("popstate", n), window.removeEventListener("hashchange", n), window.removeEventListener("dce-location", n), delete e.listener;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
attributeChangedCallback(e, n, r) {
|
|
37
|
-
e === "href" && this.sliceInit && this.sliceInit();
|
|
38
|
-
}
|
|
39
|
-
connectedCallback() {
|
|
40
|
-
this.sliceInit();
|
|
41
|
-
}
|
|
42
|
-
disconnectedCallback() {
|
|
43
|
-
this._destroy();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
window.customElements.define("location-element", u);
|
|
47
|
-
export {
|
|
48
|
-
u as L
|
|
49
|
-
};
|