@epa-wg/custom-element-dist 0.0.25 → 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 +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 +12 -9
- 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 +422 -371
- 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 +10 -10
- package/coverage/src/custom-element/index.html +31 -16
- package/coverage/src/custom-element/local-storage.js.html +1 -1
- package/coverage/src/custom-element/location-element.js.html +3 -3
- 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 +34 -19
- 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.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-CckoVsvO.cjs +53 -0
- package/dist/{custom-element-DAe7uvIt.js → custom-element-b7c_7Kz4.js} +175 -167
- package/dist/custom-element-bundle.cjs +1 -1
- package/dist/custom-element-bundle.js +2 -2
- 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/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 +36 -19
- 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/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 -35
- package/src/custom-element/demo/s.xslt +96 -96
- package/src/custom-element/demo/set-url.html +1 -1
- package/src/custom-element/demo/z.js +9 -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 +2 -1
- package/src/custom-element/module-url.js +33 -0
- 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/version-select.test.stories.ts +38 -12
- package/storybook-static/assets/Color-KGDBMAHA-CH-YyWYq.js +1 -0
- package/storybook-static/assets/{Configure-D0qG3gR9.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-W34tZdUt.js → attributes.test.stories-DIQXccHc.js} +2 -3
- package/storybook-static/assets/{css.test.stories-BZFYx1TQ.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-S-7U5N3h.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-QIO3lAFz.js → external-template.test.stories-BHO48b0j.js} +19 -16
- package/storybook-static/assets/{form.test.stories-ClYhj9F1.js → form.test.stories-dv9mwp24.js} +1 -1
- package/storybook-static/assets/handlers-CaCq2ZPF.js +467 -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-BqgYwqr-.js → local-storage.test.stories-BpogLNq-.js} +1 -1
- package/storybook-static/assets/{location-element.test.stories-DvH1TWK4.js → location-element.test.stories-BiFvBop7.js} +1 -1
- 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-GlJOh31I.js → set-url.test.stories-Cg5Z0r7x.js} +1 -1
- package/storybook-static/assets/{slice-events.test.stories-VoNjuPCX.js → slice-events.test.stories-D_ttGp3g.js} +1 -1
- package/storybook-static/assets/{slots.test.stories-Da2j9YuO.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-DZvvhscI.cjs +0 -53
- 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/preview-B4GcaC1c.js +0 -1
- package/storybook-static/assets/preview-B63p-W8V.js +0 -20
- 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
|
@@ -1,12 +1,12 @@
|
|
|
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,
|
|
1
|
+
const B = "http://www.w3.org/1999/XSL/Transform", q = "http://www.w3.org/1999/xhtml", ie = "http://exslt.org/common", x = (e, l) => e.getAttribute?.(l), Y = (e) => e.nodeType === 3, oe = (e) => typeof e == "string", re = (e) => e && typeof e.nodeType == "number", S = (e, l) => (e.ownerDocument || e).createTextNode(l), K = (e) => {
|
|
2
2
|
for (; e.firstChild; ) e.firstChild.remove();
|
|
3
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),
|
|
5
|
-
const s = (
|
|
4
|
+
}, U = (e) => (e.getAttributeNames().map((l) => e.removeAttribute(l)), K(e)), Q = (e) => (e?.setAttribute("xmlns:xsl", B), e), ee = (e) => (e?.setAttribute("xmlns:xhtml", q), Q(e)), te = (e) => /^[_a-zA-Z][-_:a-zA-Z0-9]*$/.test(e), N = (e, l = "", t = document) => {
|
|
5
|
+
const s = (n) => ((r) => (l && r.append(S(t.ownerDocument || t, l)), r))((t.ownerDocument || t).createElement(n));
|
|
6
6
|
if (te(e))
|
|
7
7
|
return s(e);
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const a = s("dce-object");
|
|
9
|
+
return a.setAttribute("dce-object-name", e), a;
|
|
10
10
|
}, G = (e, l) => {
|
|
11
11
|
const t = e.ownerDocument.createElementNS(e.namespaceURI, l);
|
|
12
12
|
for (let s of e.attributes)
|
|
@@ -22,44 +22,44 @@ function H(e) {
|
|
|
22
22
|
return new XMLSerializer().serializeToString(e);
|
|
23
23
|
}
|
|
24
24
|
function X(e, l, t, s) {
|
|
25
|
-
const
|
|
26
|
-
return [...t].forEach((h) =>
|
|
25
|
+
const a = (h) => e.ownerDocument.createElement(h), r = ((h, p, u) => (p.append(u = a(h)), u))(l, e);
|
|
26
|
+
return [...t].forEach((h) => r.append(s(h))), r;
|
|
27
27
|
}
|
|
28
28
|
function ce(e) {
|
|
29
|
-
return e.slot || (e.setAttribute || (e =
|
|
29
|
+
return e.slot || (e.setAttribute || (e = N("span", e.textContent.replaceAll(`
|
|
30
30
|
`, ""))), e.setAttribute("slot", "")), e;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function $(e, l, t) {
|
|
33
33
|
const s = typeof e;
|
|
34
34
|
if (s === "string")
|
|
35
|
-
return
|
|
35
|
+
return N(l, e, t);
|
|
36
36
|
if (s === "number")
|
|
37
|
-
return
|
|
37
|
+
return N(l, "" + e, t);
|
|
38
38
|
if (e instanceof Array) {
|
|
39
|
-
const
|
|
40
|
-
return e.map((
|
|
39
|
+
const n = N("array", "", t);
|
|
40
|
+
return e.map((r) => n.append($(r, l, t))), n;
|
|
41
41
|
}
|
|
42
42
|
if (e instanceof FormData) {
|
|
43
|
-
const
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
return
|
|
43
|
+
const n = N("form-data", "", t);
|
|
44
|
+
for (const r of e)
|
|
45
|
+
n.append($(r[1], r[0], t));
|
|
46
|
+
return n;
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
for (let
|
|
50
|
-
|
|
51
|
-
return
|
|
48
|
+
const a = N(l, "", t);
|
|
49
|
+
for (let n in e)
|
|
50
|
+
re(e[n]) || typeof e[n] == "function" || e[n] instanceof Window || (typeof e[n] != "object" && te(n) ? a.setAttribute(n, e[n]) : a.append($(e[n], n, t)));
|
|
51
|
+
return a;
|
|
52
52
|
}
|
|
53
53
|
function Z(e) {
|
|
54
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,
|
|
56
|
-
if (
|
|
57
|
-
let
|
|
58
|
-
if ([...
|
|
59
|
-
p.index >
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}),
|
|
55
|
+
const s = t.data, a = s.matchAll(/{([^}]*)}/g);
|
|
56
|
+
if (a) {
|
|
57
|
+
let n = 0, r = (p) => S(t, p), h = [];
|
|
58
|
+
if ([...a].forEach((p) => {
|
|
59
|
+
p.index > n && h.push(r(p.input.substring(n, p.index)));
|
|
60
|
+
const u = e.querySelector("value-of").cloneNode();
|
|
61
|
+
u.setAttribute("select", p[1]), h.push(u), n = p.index + p[0].length;
|
|
62
|
+
}), n < s.length && h.push(r(s.substring(n, s.length))), h.length) {
|
|
63
63
|
for (let p of h)
|
|
64
64
|
l.insertBefore(p, t);
|
|
65
65
|
l.removeChild(t);
|
|
@@ -88,20 +88,20 @@ function me(e, l = "xsl:stylesheet") {
|
|
|
88
88
|
<xsl:template mode="sanitize" match="text()"><dce-text><xsl:copy/></dce-text></xsl:template>
|
|
89
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
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(),
|
|
92
|
-
C(i, "script", (
|
|
91
|
+
</xsl:stylesheet>`), s = new XSLTProcessor(), a = ((i) => {
|
|
92
|
+
C(i, "script", (y) => y.remove());
|
|
93
93
|
const c = i.content ?? i.firstElementChild?.content ?? i.body ?? i;
|
|
94
|
-
ve.forEach((
|
|
95
|
-
const E = i.firstElementChild?.content || i.content, g = (
|
|
96
|
-
const v = M("<xhtml/>"),
|
|
97
|
-
return v.replaceChild(
|
|
94
|
+
ve.forEach((y) => C(c, y, (v) => ge(v, c)));
|
|
95
|
+
const E = i.firstElementChild?.content || i.content, g = (y) => {
|
|
96
|
+
const v = M("<xhtml/>"), D = v.importNode(y, !0);
|
|
97
|
+
return v.replaceChild(D, v.documentElement), ee(D);
|
|
98
98
|
};
|
|
99
99
|
if (E) {
|
|
100
|
-
const
|
|
101
|
-
return [...E.childNodes].map((v) =>
|
|
100
|
+
const y = N("div");
|
|
101
|
+
return [...E.childNodes].map((v) => y.append(v.cloneNode(!0))), g(y);
|
|
102
102
|
}
|
|
103
103
|
return g(i.documentElement || i.body || i);
|
|
104
|
-
})(e),
|
|
104
|
+
})(e), n = M(
|
|
105
105
|
`<xsl:stylesheet version="1.0"
|
|
106
106
|
xmlns:xsl="${B}"
|
|
107
107
|
xmlns:xhtml="${q}"
|
|
@@ -139,31 +139,31 @@ function me(e, l = "xsl:stylesheet") {
|
|
|
139
139
|
</xsl:stylesheet>`
|
|
140
140
|
);
|
|
141
141
|
s.importStylesheet(t);
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
144
|
-
return console.error("transformation error", { xml:
|
|
145
|
-
const
|
|
146
|
-
[...
|
|
142
|
+
const r = s.transformToFragment(a, document), h = (i, c) => i.querySelector(c), p = h(n, 'template[mode="payload"]');
|
|
143
|
+
if (!r)
|
|
144
|
+
return console.error("transformation error", { xml: a.outerHTML, xsl: H(t) });
|
|
145
|
+
const u = [];
|
|
146
|
+
[...r.querySelectorAll("dce-root>attribute")].forEach((i) => {
|
|
147
147
|
const c = G(i, "xsl:param"), E = x(i, "name");
|
|
148
148
|
p.append(c);
|
|
149
149
|
let g = x(c, "select")?.split("??");
|
|
150
150
|
g || (g = ["//" + E, `'${c.textContent}'`], U(c), c.setAttribute("name", E));
|
|
151
|
-
let
|
|
151
|
+
let y;
|
|
152
152
|
if (g?.length > 1) {
|
|
153
153
|
c.removeAttribute("select");
|
|
154
|
-
const v = h(
|
|
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),
|
|
154
|
+
const v = h(n, 'template[match="ignore"]>choose').cloneNode(!0);
|
|
155
|
+
U(v.firstElementChild).append(S(v, "{" + g[0] + "}")), U(v.lastElementChild).append(S(v, "{" + g[1] + "}")), v.firstElementChild.setAttribute("test", g[0]), c.append(v), y = v.cloneNode(!0);
|
|
156
156
|
} else
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}), [...
|
|
157
|
+
y = G(i, "xsl:value-of");
|
|
158
|
+
y.removeAttribute("name"), i.append(y), i.removeAttribute("select"), u.push(c);
|
|
159
|
+
}), [...r.querySelectorAll("[value]")].filter((i) => i.getAttribute("value").match(/\{(.*)\?\?(.*)\}/g)).forEach((i) => {
|
|
160
160
|
const c = x(i, "value");
|
|
161
|
-
c && i.setAttribute("value",
|
|
161
|
+
c && i.setAttribute("value", ye(c));
|
|
162
162
|
});
|
|
163
|
-
for (const i of
|
|
164
|
-
p.append(
|
|
165
|
-
[...p.
|
|
166
|
-
const P = h(
|
|
163
|
+
for (const i of r.childNodes)
|
|
164
|
+
p.append(n.importNode(i, !0));
|
|
165
|
+
[...p.getElementsByTagName("xsl:template")].forEach((i) => p.ownerDocument.documentElement.append(i));
|
|
166
|
+
const P = h(n, 'call-template[name="slot"]'), d = (i) => {
|
|
167
167
|
const c = P.cloneNode(!0), E = x(i, "name");
|
|
168
168
|
E && c.firstElementChild.setAttribute("select", `'${E}'`);
|
|
169
169
|
for (let g of i.childNodes)
|
|
@@ -171,15 +171,15 @@ function me(e, l = "xsl:stylesheet") {
|
|
|
171
171
|
return c;
|
|
172
172
|
};
|
|
173
173
|
C(p, "slot", (i) => i.parentNode.replaceChild(d(i), i));
|
|
174
|
-
const
|
|
175
|
-
return
|
|
174
|
+
const m = Z(n);
|
|
175
|
+
return m.params = u, m;
|
|
176
176
|
}
|
|
177
177
|
async function ue(e) {
|
|
178
178
|
return await new Promise((t, s) => {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
},
|
|
179
|
+
const a = new XMLHttpRequest();
|
|
180
|
+
a.open("GET", e), a.responseType = "document", a.onload = () => {
|
|
181
|
+
a.readyState === a.DONE && a.status === 200 ? t(a.responseXML?.body || a.responseXML || N("div", a.responseText)) : s(`${a.statusText} - ${e}`);
|
|
182
|
+
}, a.addEventListener("error", (n) => s(n)), a.send();
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
function de(e, l, t = !1) {
|
|
@@ -193,30 +193,30 @@ function de(e, l, t = !1) {
|
|
|
193
193
|
return !0;
|
|
194
194
|
}
|
|
195
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,
|
|
196
|
+
let s = e.ownerDocument, a = (n) => (e.append(n), n);
|
|
197
197
|
if (t.includes("/")) {
|
|
198
|
-
const
|
|
199
|
-
for (let h; h =
|
|
200
|
-
|
|
201
|
-
return
|
|
198
|
+
const n = [], r = s.evaluate(t, e);
|
|
199
|
+
for (let h; h = r.iterateNext(); )
|
|
200
|
+
n.push(h);
|
|
201
|
+
return n;
|
|
202
202
|
}
|
|
203
|
-
return [...e.childNodes].find((
|
|
203
|
+
return [...e.childNodes].find((n) => n.localName === t) || a(N(t, "", s));
|
|
204
204
|
}).flat();
|
|
205
205
|
function J(e, l, t, s) {
|
|
206
206
|
if (!t.sliceProcessed)
|
|
207
|
-
return t.sliceProcessed = 1, pe(e, l ?? "").map((
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
p(),
|
|
207
|
+
return t.sliceProcessed = 1, pe(e, l ?? "").map((a) => {
|
|
208
|
+
const n = e.ownerDocument, r = t.sliceEventSource, h = t.sliceElement, p = () => [...a.childNodes].filter((u) => u.nodeType === 3 || u.localName === "value" || u.localName === "form-data").map((u) => u.remove());
|
|
209
|
+
if (r.getAttributeNames().map((u) => a.setAttribute(u, x(r, u))), [...a.childNodes].filter((u) => u.localName === "event").map((u) => u.remove()), "validationMessage" in r && a.setAttribute("validation-message", r.validationMessage), t.type === "init" && p(), a.append($(t, "event", n)), h.hasAttribute("slice-value")) {
|
|
210
|
+
r.value === void 0 ? a.removeAttribute("value") : a.setAttribute("value", r.value);
|
|
211
|
+
const u = L(x(h, "slice-value"), a);
|
|
212
|
+
p(), a.append(S(n, u));
|
|
213
213
|
} else {
|
|
214
|
-
if ("elements" in
|
|
215
|
-
return p(),
|
|
216
|
-
const
|
|
217
|
-
p(),
|
|
214
|
+
if ("elements" in r)
|
|
215
|
+
return p(), a.append($(new FormData(r), "value", a.ownerDocument)), a;
|
|
216
|
+
const u = r.value ?? x(r, "value");
|
|
217
|
+
p(), u == null ? [...a.childNodes].filter((w) => w.localName !== "event").map((w) => w.remove()) : oe(u) ? a.append(S(n, u)) : a.append($(u, "value", a.ownerDocument));
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return a;
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
function C(e, l, t) {
|
|
@@ -227,20 +227,25 @@ const fe = async (e, l) => {
|
|
|
227
227
|
return [l];
|
|
228
228
|
if (e.startsWith("#"))
|
|
229
229
|
return ((t) => {
|
|
230
|
-
if (!t) return [];
|
|
231
230
|
const s = t.querySelectorAll(e);
|
|
232
|
-
|
|
233
|
-
return [...s];
|
|
234
|
-
const n = t.getRootNode();
|
|
235
|
-
return n === t ? [] : getByHashId(n);
|
|
231
|
+
return [...s.length ? s : t.getRootNode().querySelectorAll(e)];
|
|
236
232
|
})(l.parentElement);
|
|
237
233
|
try {
|
|
238
|
-
const t
|
|
239
|
-
if (
|
|
240
|
-
|
|
234
|
+
const [t, s] = e.split("#");
|
|
235
|
+
if (e.charAt(0) === ".")
|
|
236
|
+
e = new URL(t, l.closest("[base]")?.getAttribute("base") || location).href;
|
|
237
|
+
else
|
|
238
|
+
try {
|
|
239
|
+
e = import.meta.resolve(t), s && (e += "#" + s);
|
|
240
|
+
} catch (n) {
|
|
241
|
+
console.error(n.message);
|
|
242
|
+
}
|
|
243
|
+
const a = await ue(e);
|
|
244
|
+
if (l.setAttributeNS("xml", "base", e), s) {
|
|
245
|
+
const n = a.querySelectorAll("#" + s);
|
|
241
246
|
return n.length ? [...n] : [l];
|
|
242
247
|
}
|
|
243
|
-
return [
|
|
248
|
+
return [a];
|
|
244
249
|
} catch {
|
|
245
250
|
return [l];
|
|
246
251
|
}
|
|
@@ -252,12 +257,12 @@ function he(e, l) {
|
|
|
252
257
|
function le(e, l = 0) {
|
|
253
258
|
const t = {};
|
|
254
259
|
for (const s of e.childNodes) {
|
|
255
|
-
const
|
|
256
|
-
if (!t[
|
|
257
|
-
|
|
260
|
+
const a = x(s, "data-dce-id") || s.dceId || 0;
|
|
261
|
+
if (!t[a])
|
|
262
|
+
a ? t[a] = 1 : (t[a] = s.dceId = ++l, s.setAttribute && s.setAttribute("data-dce-id", s.dceId));
|
|
258
263
|
else {
|
|
259
|
-
const
|
|
260
|
-
s.setAttribute && s.setAttribute("data-dce-id",
|
|
264
|
+
const n = s.dceId = a + "-" + t[a]++;
|
|
265
|
+
s.setAttribute && s.setAttribute("data-dce-id", n);
|
|
261
266
|
}
|
|
262
267
|
s.childNodes.length && le(s);
|
|
263
268
|
}
|
|
@@ -269,23 +274,25 @@ function xe(e, l, t) {
|
|
|
269
274
|
return e.insertBefore(l, s);
|
|
270
275
|
e.append(l);
|
|
271
276
|
}
|
|
272
|
-
function
|
|
277
|
+
function ae(e, l) {
|
|
278
|
+
if (e.firstElementChild?.localName === "dce-root" && l[0].localName !== "dce-root")
|
|
279
|
+
return;
|
|
273
280
|
if (!l.length)
|
|
274
|
-
return K(e);
|
|
281
|
+
return e.firstElementChild?.localName !== "dce-root" && K(e);
|
|
275
282
|
const t = {};
|
|
276
283
|
for (let s of e.childNodes)
|
|
277
284
|
t[s.dceId], Y(s) ? (s.data.trim(), t[s.dceId || 0] = s) : t[x(s, "data-dce-id") || 0] = s;
|
|
278
285
|
for (let s of [...l]) {
|
|
279
|
-
const
|
|
280
|
-
|
|
286
|
+
const a = x(s, "data-dce-id") || s.dceId, n = t[a];
|
|
287
|
+
n ? (Y(s) ? n.nodeValue !== s.nodeValue && (n.nodeValue = s.nodeValue) : (he(s, n), (n.childNodes.length || s.childNodes.length) && ae(n, s.childNodes)), delete t[a]) : xe(e, s, a);
|
|
281
288
|
}
|
|
282
289
|
for (let s of Object.values(t))
|
|
283
|
-
s.remove();
|
|
290
|
+
s.localName !== "dce-root" && s.remove();
|
|
284
291
|
}
|
|
285
|
-
function
|
|
292
|
+
function be(e, l) {
|
|
286
293
|
return e.hasAttribute(l) || e.setAttribute(l, crypto.randomUUID()), e.getAttribute(l);
|
|
287
294
|
}
|
|
288
|
-
const
|
|
295
|
+
const ye = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `${t[1]}{${F(t[3])}}${t[4]}`).join(""), F = (e) => {
|
|
289
296
|
if (!e.trim())
|
|
290
297
|
return e;
|
|
291
298
|
const l = e.split("??"), t = l.shift(), s = F(l.join("??"));
|
|
@@ -304,12 +311,12 @@ const be = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
|
|
|
304
311
|
case XPathResult.BOOLEAN_TYPE:
|
|
305
312
|
return s.booleanValue;
|
|
306
313
|
}
|
|
307
|
-
let
|
|
308
|
-
for (let
|
|
309
|
-
|
|
310
|
-
return
|
|
311
|
-
}, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,
|
|
312
|
-
const t =
|
|
314
|
+
let a = "";
|
|
315
|
+
for (let n; n = s.iterateNext(); )
|
|
316
|
+
a += n.textContent;
|
|
317
|
+
return a;
|
|
318
|
+
}, ve = "stylesheet,transform,import,include,strip-space,preserve-space,output,key,decimal-format,namespace-alias,value-of,copy-of,number,apply-templates,apply-imports,for-each,sort,if,choose,when,otherwise,attribute-set,call-template,with-param,variable,param,text,processing-instruction,element,attribute,comment,copy,message,fallback".split(","), ge = (e, l) => {
|
|
319
|
+
const t = N("xsl:" + e.localName);
|
|
313
320
|
for (let s of e.attributes)
|
|
314
321
|
t.setAttribute(s.name, s.value);
|
|
315
322
|
for (; e.firstChild; )
|
|
@@ -317,10 +324,10 @@ const be = (e) => [...e?.matchAll(/([^{}]*)(\{)([^}]+)}([^{}]*)/g)].map((t) => `
|
|
|
317
324
|
if (e.parentElement)
|
|
318
325
|
e.parentElement.replaceChild(t, e);
|
|
319
326
|
else {
|
|
320
|
-
const s = e.parentElement || l,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}), s.replaceChildren(...
|
|
327
|
+
const s = e.parentElement || l, a = [...s.childNodes];
|
|
328
|
+
a.forEach((n, r) => {
|
|
329
|
+
n === e && (a[r] = t);
|
|
330
|
+
}), s.replaceChildren(...a);
|
|
324
331
|
}
|
|
325
332
|
};
|
|
326
333
|
class Ee extends HTMLElement {
|
|
@@ -328,73 +335,73 @@ class Ee extends HTMLElement {
|
|
|
328
335
|
async connectedCallback() {
|
|
329
336
|
const l = await fe(x(this, "src"), this), t = x(this, "tag"), s = t || "dce-" + crypto.randomUUID();
|
|
330
337
|
for (const d of l)
|
|
331
|
-
C(d.templateNode || d.content || d, "style", (
|
|
332
|
-
const i =
|
|
333
|
-
|
|
338
|
+
C(d.templateNode || d.content || d, "style", (m) => {
|
|
339
|
+
const i = m.closest("slot"), c = i ? `slot[name="${i.name}"]` : "";
|
|
340
|
+
m.innerHTML = `${s} ${c}{${m.innerHTML}}`, this.append(m);
|
|
334
341
|
});
|
|
335
|
-
const
|
|
336
|
-
Object.defineProperty(this, "xsltString", { get: () =>
|
|
342
|
+
const a = l.map((d) => me(d)), n = a.map((d, m) => (m = new XSLTProcessor(), m.importStylesheet(d), m));
|
|
343
|
+
Object.defineProperty(this, "xsltString", { get: () => a.map((d) => H(d)).join(`
|
|
337
344
|
`) });
|
|
338
|
-
const
|
|
345
|
+
const r = this, h = [...this.templateNode.querySelectorAll("[slice]")], p = h.map((d) => x(d, "slice")).filter((d) => !d.includes("/")).filter((d, m, i) => i.indexOf(d) === m).map(se).flat(), u = a.reduce((d, m) => (m.params && d.push(...m.params), d), []);
|
|
339
346
|
class w extends HTMLElement {
|
|
340
347
|
static get observedAttributes() {
|
|
341
|
-
return
|
|
348
|
+
return u.map((m) => x(m, "name"));
|
|
342
349
|
}
|
|
343
350
|
#e = 0;
|
|
344
351
|
connectedCallback() {
|
|
345
|
-
let
|
|
352
|
+
let m = this.childNodes;
|
|
346
353
|
if (this.firstElementChild?.tagName === "TEMPLATE") {
|
|
347
354
|
this.firstElementChild !== this.lastElementChild && console.error("payload should have TEMPLATE as only child", this.outerHTML);
|
|
348
355
|
const f = this.firstElementChild;
|
|
349
|
-
f.remove(),
|
|
350
|
-
for (const
|
|
351
|
-
if (
|
|
352
|
-
const
|
|
353
|
-
|
|
356
|
+
f.remove(), m = f.content.childNodes;
|
|
357
|
+
for (const o of [...f.content.childNodes])
|
|
358
|
+
if (o.localName === "style") {
|
|
359
|
+
const b = be(this, "data-dce-style");
|
|
360
|
+
o.innerHTML = `${s}[data-dce-style="${b}"]{${o.innerHTML}}`, f.insertAdjacentElement("beforebegin", o);
|
|
354
361
|
} else
|
|
355
|
-
|
|
362
|
+
o.nodeType === 1 ? f.insertAdjacentElement("beforebegin", o) : o.nodeType === 3 && f.insertAdjacentText("beforebegin", o.data);
|
|
356
363
|
}
|
|
357
|
-
const i = M("<datadom/>").documentElement, c = (f,
|
|
364
|
+
const i = M("<datadom/>").documentElement, c = (f, o = "") => ((b) => (o && b.append(S(i, o)), b))(i.ownerDocument.createElement(f)), E = X(i, "payload", m, ce);
|
|
358
365
|
Q(E), ee(E), this.innerHTML = "";
|
|
359
366
|
const g = X(i, "attributes", this.attributes, (f) => c(f.nodeName, f.value));
|
|
360
367
|
X(i, "dataset", Object.keys(this.dataset), (f) => c(f, this.dataset[f]));
|
|
361
|
-
const
|
|
368
|
+
const y = X(i, "slice", p, (f) => c(f, "")), v = (f) => L(f, y);
|
|
362
369
|
this.xml = i;
|
|
363
|
-
const
|
|
370
|
+
const D = [], W = () => {
|
|
364
371
|
const f = {};
|
|
365
|
-
for (let
|
|
366
|
-
const
|
|
367
|
-
f[
|
|
372
|
+
for (let o; o = D.pop(); ) {
|
|
373
|
+
const b = x(o.sliceElement, "slice");
|
|
374
|
+
f[b] || (J(y, b, o), f[b] = o);
|
|
368
375
|
}
|
|
369
|
-
Object.keys(f).length !== 0 &&
|
|
376
|
+
Object.keys(f).length !== 0 && R();
|
|
370
377
|
};
|
|
371
378
|
let V;
|
|
372
379
|
this.onSlice = (f) => {
|
|
373
|
-
|
|
380
|
+
D.push(f), V || (V = setTimeout(() => {
|
|
374
381
|
W(), V = 0;
|
|
375
382
|
}, 1));
|
|
376
383
|
};
|
|
377
|
-
const
|
|
384
|
+
const R = this.transform = () => {
|
|
378
385
|
if (this.#e)
|
|
379
386
|
debugger;
|
|
380
|
-
this.#e = 1,
|
|
381
|
-
const
|
|
382
|
-
return
|
|
383
|
-
`, H(
|
|
387
|
+
this.#e = 1, n.map((o, b) => {
|
|
388
|
+
const I = o.transformToFragment(i.ownerDocument, document);
|
|
389
|
+
return I || console.error(`XSLT transformation error. xsl:
|
|
390
|
+
`, H(a[b]), `
|
|
384
391
|
xml:
|
|
385
|
-
`, H(i)),
|
|
386
|
-
}).map((
|
|
387
|
-
|
|
388
|
-
}), w.observedAttributes.map((
|
|
389
|
-
let
|
|
390
|
-
|
|
391
|
-
}), C(this, "[slice],[slice-event]", (
|
|
392
|
-
if (!
|
|
393
|
-
|
|
394
|
-
let
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const
|
|
392
|
+
`, H(i)), I;
|
|
393
|
+
}).map((o) => {
|
|
394
|
+
o && (le(o), ae(this, o.childNodes));
|
|
395
|
+
}), w.observedAttributes.map((o) => {
|
|
396
|
+
let b = x(this.firstElementChild, o);
|
|
397
|
+
b !== x(this, o) && (this.setAttribute(o, b), this.#t(o, b));
|
|
398
|
+
}), C(this, "[slice],[slice-event]", (o) => {
|
|
399
|
+
if (!o.dceInitialized) {
|
|
400
|
+
o.dceInitialized = 1;
|
|
401
|
+
let b = x(o, "slice-event");
|
|
402
|
+
o.hasAttribute("custom-validity") && (b += " change submit"), [...new Set((b || "change").split(" "))].forEach((I) => (o.localName === "slice" ? o.parentElement : o).addEventListener(I, (A) => {
|
|
403
|
+
A.sliceElement = o, A.sliceEventSource = A.currentTarget || A.target;
|
|
404
|
+
const ne = J(y, x(A.sliceElement, "slice"), A);
|
|
398
405
|
C(this, "[custom-validity]", (z) => {
|
|
399
406
|
if (!z.setCustomValidity)
|
|
400
407
|
return;
|
|
@@ -406,28 +413,29 @@ xml:
|
|
|
406
413
|
console.error(j, "xPath", _);
|
|
407
414
|
}
|
|
408
415
|
});
|
|
409
|
-
const k = x(
|
|
416
|
+
const k = x(o, "custom-validity"), T = k && L(k, g), O = T === !0 ? "" : T;
|
|
410
417
|
if (k) {
|
|
411
|
-
if (
|
|
412
|
-
return T === !0 ? void 0 : (setTimeout(
|
|
413
|
-
setTimeout(
|
|
418
|
+
if (o.setCustomValidity ? o.setCustomValidity(O) : o.validationMessage = O, ne.map((z) => z.setAttribute("validation-message", O)), A.type === "submit")
|
|
419
|
+
return T === !0 ? void 0 : (setTimeout(R, 1), !!T === T ? (T || A.preventDefault(), T) : T ? (A.preventDefault(), !1) : void 0);
|
|
420
|
+
setTimeout(R, 1);
|
|
414
421
|
}
|
|
415
|
-
this.onSlice(
|
|
416
|
-
})), (!
|
|
422
|
+
this.onSlice(A);
|
|
423
|
+
})), (!b || b.includes("init")) && (o.hasAttribute("slice-value") || o.hasAttribute("value") || o.value ? this.onSlice({ type: "init", target: o, sliceElement: o, sliceEventSource: o }) : o.value = v(x(o, "slice")));
|
|
417
424
|
}
|
|
418
425
|
}), this.#e = 0;
|
|
419
426
|
};
|
|
420
|
-
|
|
427
|
+
R(), W();
|
|
421
428
|
}
|
|
422
|
-
#t(
|
|
423
|
-
|
|
424
|
-
|
|
429
|
+
#t(m, i) {
|
|
430
|
+
m === "value" && (this.value = i);
|
|
431
|
+
let c = this.xml.querySelector(`attributes>${m}`);
|
|
432
|
+
c ? U(c).append(S(c, i)) : (c = N(m, i, this.xml), this.xml.querySelector("attributes").append(c)), this.dispatchEvent(new CustomEvent("change", { bubbles: !0, detail: { [m]: i } }));
|
|
425
433
|
}
|
|
426
|
-
attributeChangedCallback(
|
|
427
|
-
!this.xml || this.#e || (this.#t(
|
|
434
|
+
attributeChangedCallback(m, i, c) {
|
|
435
|
+
!this.xml || this.#e || (this.#t(m, c), this.transform());
|
|
428
436
|
}
|
|
429
437
|
get dce() {
|
|
430
|
-
return
|
|
438
|
+
return r;
|
|
431
439
|
}
|
|
432
440
|
}
|
|
433
441
|
const P = (d) => {
|
|
@@ -438,8 +446,8 @@ xml:
|
|
|
438
446
|
else {
|
|
439
447
|
const d = s;
|
|
440
448
|
this.setAttribute("tag", d), P(d);
|
|
441
|
-
const
|
|
442
|
-
this.getAttributeNames().forEach((i) =>
|
|
449
|
+
const m = document.createElement(d);
|
|
450
|
+
this.getAttributeNames().forEach((i) => m.setAttribute(i, this.getAttribute(i))), m.append(...[...this.childNodes].filter((i) => i.localName !== "style")), this.append(m);
|
|
443
451
|
}
|
|
444
452
|
}
|
|
445
453
|
get templateNode() {
|
|
@@ -463,13 +471,13 @@ export {
|
|
|
463
471
|
J as f,
|
|
464
472
|
le as g,
|
|
465
473
|
xe as h,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
474
|
+
ae as i,
|
|
475
|
+
be as j,
|
|
476
|
+
ye as k,
|
|
469
477
|
F as l,
|
|
470
478
|
he as m,
|
|
471
479
|
L as n,
|
|
472
|
-
|
|
480
|
+
$ as o,
|
|
473
481
|
ve as p,
|
|
474
482
|
ge as q,
|
|
475
483
|
Z as t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./custom-element-CckoVsvO.cjs"),l=require("./http-request-DPrY7mGh.cjs"),t=require("./local-storage-Boafngui.cjs"),a=require("./location-element-DRB7hCwA.cjs");exports.CustomElement=e.CustomElement;exports.appendByDceId=e.appendByDceId;exports.assureSlices=e.assureSlices;exports.assureUID=e.assureUID;exports.assureUnique=e.assureUnique;exports.createXsltFromDom=e.createXsltFromDom;exports.deepEqual=e.deepEqual;exports.default=e.CustomElement;exports.evalCurly=e.evalCurly;exports.event2slice=e.event2slice;exports.merge=e.merge;exports.mergeAttr=e.mergeAttr;exports.obj2node=e.obj2node;exports.tagUid=e.tagUid;exports.toXsl=e.toXsl;exports.xPath=e.xPath;exports.xPathDefaults=e.xPathDefaults;exports.xhrTemplate=e.xhrTemplate;exports.xml2dom=e.xml2dom;exports.xmlString=e.xmlString;exports.xslTags=e.xslTags;exports.HttpRequestElement=l.HttpRequestElement;exports.LocalStorageElement=t.LocalStorageElement;exports.localStorageSetItem=t.localStorageSetItem;exports.LocationElement=a.LocationElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as e } from "./custom-element-
|
|
2
|
-
import { h as o, e as r, j as l, g as m, c as p, d as x, k as n, f as u, i as c, m as d, o as f, t as g, q as i, n as E, l as S, b as h, x as q, a as D, p as L } from "./custom-element-
|
|
1
|
+
import { C as e } from "./custom-element-b7c_7Kz4.js";
|
|
2
|
+
import { h as o, e as r, j as l, g as m, c as p, d as x, k as n, f as u, i as c, m as d, o as f, t as g, q as i, n as E, l as S, b as h, x as q, a as D, p as L } from "./custom-element-b7c_7Kz4.js";
|
|
3
3
|
import { H as I } from "./http-request-BOvP4KTl.js";
|
|
4
4
|
import { L as b, l as j } from "./local-storage-BqDEu2kF.js";
|
|
5
5
|
import { L as y } from "./location-element-FJlONi2n.js";
|
package/dist/demo/a.html
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
5
|
+
<title>Data slices - Declarative Custom Element implementation demo</title>
|
|
6
|
+
<link rel="icon" href="./wc-square.svg"/>
|
|
7
|
+
|
|
8
|
+
<script type="module" src="../http-request.js"></script>
|
|
9
|
+
<script type="module" src="../custom-element.js"></script>
|
|
10
|
+
<style>
|
|
11
|
+
@import "./demo.css";
|
|
12
|
+
|
|
13
|
+
label {
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
label:has(input[type="text"],input[type="password"],input:not([type]) ) {
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
nav {
|
|
22
|
+
max-width: 32em;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
<!-- https://github.com/mdn/learning-area/blob/main/html/forms/form-validation/custom-error-message.html
|
|
26
|
+
todo: apply setCustomValidity( warningStr )
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
|
|
32
|
+
<fieldset>
|
|
33
|
+
<legend><b style="color:green">green</b> in instance style can be overridden in payload as <i
|
|
34
|
+
style="color:red">red</i> in 1st instance
|
|
35
|
+
</legend>
|
|
36
|
+
<custom-element tag="dce-3">
|
|
37
|
+
<template>
|
|
38
|
+
<u>
|
|
39
|
+
<slot>is green</slot>
|
|
40
|
+
</u>
|
|
41
|
+
</template>
|
|
42
|
+
<style>dce-3 {
|
|
43
|
+
color: green
|
|
44
|
+
}</style>
|
|
45
|
+
</custom-element>
|
|
46
|
+
<u>should be</u> <i style="color:red">red</i>:
|
|
47
|
+
<dce-3 id="dce32">
|
|
48
|
+
<template>
|
|
49
|
+
<style> color:red; </style>
|
|
50
|
+
<u>red</u>
|
|
51
|
+
</template>
|
|
52
|
+
</dce-3> <br/>
|
|
53
|
+
should be GREEN:
|
|
54
|
+
<dce-3 id="dce31">green</dce-3>
|
|
55
|
+
</fieldset>
|
|
56
|
+
|
|
57
|
+
<script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
|
|
58
|
+
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|